From ca4d22fbbacf9ddc32b42a14113b13ea3feb9ccd Mon Sep 17 00:00:00 2001 From: Joel Hendrix Date: Mon, 23 May 2022 19:18:39 -0700 Subject: [PATCH] Release v65.0.0 (#18214) * Release v65.0.0 * add back a handful to satisfy the terraform provider --- CHANGELOG.md | 49 + .../apimanagement/CHANGELOG.md | 2 - .../apimanagement/_meta.json | 11 - .../2018-06-01-preview/apimanagement/api.go | 824 - .../apimanagement/apidiagnostic.go | 717 - .../apimanagement/apiexport.go | 128 - .../apimanagement/apiissue.go | 695 - .../apimanagement/apiissueattachment.go | 616 - .../apimanagement/apiissuecomment.go | 614 - .../apimanagementapi/interfaces.go | 711 - .../apimanagement/apioperation.go | 709 - .../apimanagement/apioperationpolicy.go | 539 - .../apimanagement/apipolicy.go | 503 - .../apimanagement/apiproduct.go | 185 - .../apimanagement/apirelease.go | 681 - .../apimanagement/apirevisions.go | 185 - .../apimanagement/apischema.go | 590 - .../apimanagement/apiversionset.go | 648 - .../apimanagement/authorizationserver.go | 656 - .../apimanagement/backend.go | 748 - .../2018-06-01-preview/apimanagement/cache.go | 650 - .../apimanagement/certificate.go | 560 - .../apimanagement/client.go | 41 - .../apimanagement/delegationsettings.go | 381 - .../apimanagement/diagnostic.go | 681 - .../apimanagement/emailtemplate.go | 629 - .../2018-06-01-preview/apimanagement/enums.go | 688 - .../2018-06-01-preview/apimanagement/group.go | 653 - .../apimanagement/groupuser.go | 476 - .../apimanagement/identityprovider.go | 610 - .../2018-06-01-preview/apimanagement/issue.go | 274 - .../apimanagement/logger.go | 651 - .../apimanagement/models.go | 12402 -------- .../apimanagement/networkstatus.go | 207 - .../apimanagement/notification.go | 349 - .../notificationrecipientemail.go | 381 - .../notificationrecipientuser.go | 393 - .../apimanagement/openidconnectprovider.go | 647 - .../apimanagement/operation.go | 195 - .../apimanagement/operations.go | 140 - .../apimanagement/policy.go | 468 - .../apimanagement/policysnippets.go | 120 - .../apimanagement/product.go | 823 - .../apimanagement/productapi.go | 478 - .../apimanagement/productgroup.go | 473 - .../apimanagement/productpolicy.go | 498 - .../apimanagement/productsubscriptions.go | 194 - .../apimanagement/property.go | 651 - .../apimanagement/quotabycounterkeys.go | 215 - .../apimanagement/quotabyperiodkeys.go | 218 - .../apimanagement/region.go | 158 - .../apimanagement/reports.go | 1136 - .../apimanagement/service.go | 1262 - .../apimanagement/serviceskus.go | 158 - .../apimanagement/signinsettings.go | 380 - .../apimanagement/signupsettings.go | 380 - .../apimanagement/subscription.go | 857 - .../2018-06-01-preview/apimanagement/tag.go | 2308 -- .../apimanagement/tagdescription.go | 590 - .../apimanagement/tagresource.go | 191 - .../apimanagement/tenantaccess.go | 459 - .../apimanagement/tenantaccessgit.go | 285 - .../apimanagement/tenantconfiguration.go | 401 - .../2018-06-01-preview/apimanagement/user.go | 862 - .../apimanagement/userconfirmationpassword.go | 122 - .../apimanagement/usergroup.go | 187 - .../apimanagement/useridentities.go | 164 - .../apimanagement/usersubscription.go | 192 - .../apimanagement/version.go | 19 - .../apimanagement/CHANGELOG.md | 2 - .../apimanagement/_meta.json | 11 - .../2019-12-01-preview/apimanagement/api.go | 823 - .../apimanagement/apidiagnostic.go | 710 - .../apimanagement/apiexport.go | 128 - .../apimanagement/apiissue.go | 687 - .../apimanagement/apiissueattachment.go | 610 - .../apimanagement/apiissuecomment.go | 608 - .../apimanagementapi/interfaces.go | 756 - .../apimanagement/apioperation.go | 704 - .../apimanagement/apioperationpolicy.go | 540 - .../apimanagement/apipolicy.go | 509 - .../apimanagement/apiproduct.go | 183 - .../apimanagement/apirelease.go | 674 - .../apimanagement/apirevision.go | 183 - .../apimanagement/apischema.go | 592 - .../apimanagement/apitagdescription.go | 594 - .../apimanagement/apiversionset.go | 648 - .../apimanagement/authorizationserver.go | 745 - .../apimanagement/backend.go | 741 - .../2019-12-01-preview/apimanagement/cache.go | 650 - .../apimanagement/certificate.go | 559 - .../apimanagement/client.go | 41 - .../apimanagement/delegationsettings.go | 465 - .../apimanagement/diagnostic.go | 680 - .../apimanagement/emailtemplate.go | 631 - .../2019-12-01-preview/apimanagement/enums.go | 815 - .../apimanagement/gateway.go | 924 - .../apimanagement/gatewayapi.go | 466 - .../gatewayhostnameconfiguration.go | 559 - .../2019-12-01-preview/apimanagement/group.go | 646 - .../apimanagement/groupuser.go | 467 - .../apimanagement/identityprovider.go | 696 - .../2019-12-01-preview/apimanagement/issue.go | 272 - .../apimanagement/logger.go | 649 - .../apimanagement/models.go | 13635 -------- .../apimanagement/namedvalue.go | 746 - .../apimanagement/networkstatus.go | 207 - .../apimanagement/notification.go | 349 - .../notificationrecipientemail.go | 381 - .../notificationrecipientuser.go | 390 - .../apimanagement/openidconnectprovider.go | 735 - .../apimanagement/operation.go | 194 - .../apimanagement/operations.go | 140 - .../apimanagement/policy.go | 474 - .../apimanagement/policydescription.go | 121 - .../apimanagement/product.go | 815 - .../apimanagement/productapi.go | 473 - .../apimanagement/productgroup.go | 463 - .../apimanagement/productpolicy.go | 499 - .../apimanagement/productsubscriptions.go | 190 - .../apimanagement/quotabycounterkeys.go | 215 - .../apimanagement/quotabyperiodkeys.go | 218 - .../apimanagement/region.go | 158 - .../apimanagement/reports.go | 1220 - .../apimanagement/service.go | 1078 - .../apimanagement/serviceskus.go | 158 - .../apimanagement/signinsettings.go | 380 - .../apimanagement/signupsettings.go | 380 - .../apimanagement/subscription.go | 944 - .../2019-12-01-preview/apimanagement/tag.go | 2294 -- .../apimanagement/tagresource.go | 188 - .../apimanagement/tenantaccess.go | 544 - .../apimanagement/tenantaccessgit.go | 370 - .../apimanagement/tenantconfiguration.go | 404 - .../2019-12-01-preview/apimanagement/user.go | 854 - .../apimanagement/userconfirmationpassword.go | 121 - .../apimanagement/usergroup.go | 185 - .../apimanagement/useridentities.go | 163 - .../apimanagement/usersubscription.go | 190 - .../apimanagement/version.go | 19 - .../automation/CHANGELOG.md | 2 - .../2017-05-15-preview/automation/_meta.json | 11 - .../2017-05-15-preview/automation/account.go | 610 - .../2017-05-15-preview/automation/activity.go | 248 - .../agentregistrationinformation.go | 204 - .../automation/automationapi/interfaces.go | 402 - .../automation/certificate.go | 511 - .../2017-05-15-preview/automation/client.go | 41 - .../automation/connection.go | 512 - .../automation/connectiontype.go | 422 - .../automation/credential.go | 513 - .../automation/dsccompilationjob.go | 430 - .../automation/dsccompilationjobstream.go | 120 - .../automation/dscconfiguration.go | 621 - .../2017-05-15-preview/automation/dscnode.go | 423 - .../automation/dscnodeconfiguration.go | 432 - .../2017-05-15-preview/automation/enums.go | 631 - .../2017-05-15-preview/automation/fields.go | 120 - .../automation/hybridrunbookworkergroup.go | 423 - .../mgmt/2017-05-15-preview/automation/job.go | 804 - .../automation/jobschedule.go | 428 - .../automation/jobstream.go | 262 - .../2017-05-15-preview/automation/keys.go | 116 - .../automation/linkedworkspace.go | 116 - .../2017-05-15-preview/automation/models.go | 9874 ------ .../2017-05-15-preview/automation/module.go | 516 - .../automation/nodereports.go | 340 - .../automation/objectdatatypes.go | 206 - .../automation/operations.go | 98 - .../2017-05-15-preview/automation/runbook.go | 610 - .../automation/runbookdraft.go | 470 - .../2017-05-15-preview/automation/schedule.go | 511 - .../softwareupdateconfigurationmachineruns.go | 228 - .../softwareupdateconfigurationruns.go | 227 - .../softwareupdateconfigurations.go | 409 - .../automation/sourcecontrol.go | 528 - .../automation/sourcecontrolsyncjob.go | 350 - .../automation/sourcecontrolsyncjobstreams.go | 258 - .../automation/statistics.go | 120 - .../2017-05-15-preview/automation/testjob.go | 462 - .../automation/testjobstreams.go | 252 - .../2017-05-15-preview/automation/usages.go | 116 - .../2017-05-15-preview/automation/variable.go | 510 - .../2017-05-15-preview/automation/version.go | 19 - .../2017-05-15-preview/automation/webhook.go | 598 - .../automation/CHANGELOG.md | 2 - .../2018-01-15-preview/automation/_meta.json | 11 - .../2018-01-15-preview/automation/account.go | 610 - .../2018-01-15-preview/automation/activity.go | 248 - .../agentregistrationinformation.go | 204 - .../automation/automationapi/interfaces.go | 423 - .../automation/certificate.go | 511 - .../2018-01-15-preview/automation/client.go | 41 - .../automation/connection.go | 512 - .../automation/connectiontype.go | 422 - .../automation/credential.go | 513 - .../automation/dsccompilationjob.go | 433 - .../automation/dsccompilationjobstream.go | 120 - .../automation/dscconfiguration.go | 621 - .../2018-01-15-preview/automation/dscnode.go | 435 - .../automation/dscnodeconfiguration.go | 448 - .../2018-01-15-preview/automation/enums.go | 646 - .../2018-01-15-preview/automation/fields.go | 120 - .../automation/hybridrunbookworkergroup.go | 423 - .../mgmt/2018-01-15-preview/automation/job.go | 804 - .../automation/jobschedule.go | 428 - .../automation/jobstream.go | 262 - .../2018-01-15-preview/automation/keys.go | 116 - .../automation/linkedworkspace.go | 116 - .../2018-01-15-preview/automation/models.go | 10675 ------- .../2018-01-15-preview/automation/module.go | 516 - .../automation/nodecountinformation.go | 119 - .../automation/nodereports.go | 340 - .../automation/objectdatatypes.go | 206 - .../automation/operations.go | 98 - .../2018-01-15-preview/automation/runbook.go | 610 - .../automation/runbookdraft.go | 470 - .../2018-01-15-preview/automation/schedule.go | 511 - .../softwareupdateconfigurationmachineruns.go | 228 - .../softwareupdateconfigurationruns.go | 227 - .../softwareupdateconfigurations.go | 409 - .../automation/sourcecontrol.go | 528 - .../automation/sourcecontrolsyncjob.go | 350 - .../automation/sourcecontrolsyncjobstreams.go | 258 - .../automation/statistics.go | 120 - .../2018-01-15-preview/automation/testjob.go | 462 - .../automation/testjobstreams.go | 252 - .../2018-01-15-preview/automation/usages.go | 116 - .../2018-01-15-preview/automation/variable.go | 510 - .../2018-01-15-preview/automation/version.go | 19 - .../2018-01-15-preview/automation/watcher.go | 681 - .../2018-01-15-preview/automation/webhook.go | 598 - .../automation/CHANGELOG.md | 2 - .../2018-06-30-preview/automation/_meta.json | 11 - .../2018-06-30-preview/automation/account.go | 610 - .../2018-06-30-preview/automation/activity.go | 248 - .../agentregistrationinformation.go | 204 - .../automation/automationapi/interfaces.go | 435 - .../automation/certificate.go | 511 - .../2018-06-30-preview/automation/client.go | 41 - .../automation/connection.go | 512 - .../automation/connectiontype.go | 422 - .../automation/credential.go | 513 - .../automation/dsccompilationjob.go | 433 - .../automation/dsccompilationjobstream.go | 120 - .../automation/dscconfiguration.go | 621 - .../2018-06-30-preview/automation/dscnode.go | 435 - .../automation/dscnodeconfiguration.go | 448 - .../2018-06-30-preview/automation/enums.go | 646 - .../2018-06-30-preview/automation/fields.go | 120 - .../automation/hybridrunbookworkergroup.go | 423 - .../mgmt/2018-06-30-preview/automation/job.go | 804 - .../automation/jobschedule.go | 428 - .../automation/jobstream.go | 262 - .../2018-06-30-preview/automation/keys.go | 116 - .../automation/linkedworkspace.go | 116 - .../2018-06-30-preview/automation/models.go | 10749 ------- .../2018-06-30-preview/automation/module.go | 516 - .../automation/nodecountinformation.go | 119 - .../automation/nodereports.go | 340 - .../automation/objectdatatypes.go | 206 - .../automation/operations.go | 98 - .../automation/python2package.go | 516 - .../2018-06-30-preview/automation/runbook.go | 698 - .../automation/runbookdraft.go | 382 - .../2018-06-30-preview/automation/schedule.go | 511 - .../softwareupdateconfigurationmachineruns.go | 228 - .../softwareupdateconfigurationruns.go | 227 - .../softwareupdateconfigurations.go | 409 - .../automation/sourcecontrol.go | 528 - .../automation/sourcecontrolsyncjob.go | 350 - .../automation/sourcecontrolsyncjobstreams.go | 258 - .../automation/statistics.go | 120 - .../2018-06-30-preview/automation/testjob.go | 462 - .../automation/testjobstreams.go | 252 - .../2018-06-30-preview/automation/usages.go | 116 - .../2018-06-30-preview/automation/variable.go | 510 - .../2018-06-30-preview/automation/version.go | 19 - .../2018-06-30-preview/automation/watcher.go | 681 - .../2018-06-30-preview/automation/webhook.go | 598 - .../containerregistry/CHANGELOG.md | 2 - .../containerregistry/_meta.json | 11 - .../containerregistry/client.go | 41 - .../containerregistryapi/interfaces.go | 30 - .../containerregistry/models.go | 428 - .../containerregistry/registries.go | 816 - .../containerregistry/version.go | 19 - .../containerregistry/CHANGELOG.md | 2 - .../containerregistry/_meta.json | 11 - .../containerregistry/client.go | 41 - .../containerregistryapi/interfaces.go | 66 - .../containerregistry/enums.go | 124 - .../containerregistry/models.go | 2172 -- .../containerregistry/operations.go | 140 - .../containerregistry/registries.go | 960 - .../containerregistry/replications.go | 532 - .../containerregistry/version.go | 19 - .../containerregistry/webhooks.go | 850 - .../2018-02-01/containerregistry/CHANGELOG.md | 2 - .../2018-02-01/containerregistry/_meta.json | 11 - .../2018-02-01/containerregistry/builds.go | 523 - .../containerregistry/buildsteps.go | 700 - .../containerregistry/buildtasks.go | 645 - .../2018-02-01/containerregistry/client.go | 41 - .../containerregistryapi/interfaces.go | 110 - .../2018-02-01/containerregistry/enums.go | 387 - .../2018-02-01/containerregistry/models.go | 4552 --- .../containerregistry/operations.go | 140 - .../containerregistry/registries.go | 1429 - .../containerregistry/replications.go | 542 - .../2018-02-01/containerregistry/version.go | 19 - .../2018-02-01/containerregistry/webhooks.go | 866 - .../containerregistry/CHANGELOG.md | 2 - .../containerregistry/_meta.json | 11 - .../containerregistry/agentpools.go | 634 - .../containerregistry/client.go | 41 - .../containerregistryapi/interfaces.go | 191 - .../containerregistry/enums.go | 737 - .../containerregistry/exportpipelines.go | 449 - .../containerregistry/importpipelines.go | 449 - .../containerregistry/models.go | 9394 ------ .../containerregistry/operations.go | 140 - .../containerregistry/pipelineruns.go | 453 - .../privateendpointconnections.go | 434 - .../containerregistry/registries.go | 1475 - .../containerregistry/replications.go | 542 - .../containerregistry/runs.go | 529 - .../containerregistry/scopemaps.go | 545 - .../containerregistry/taskruns.go | 634 - .../containerregistry/tasks.go | 645 - .../containerregistry/tokens.go | 542 - .../containerregistry/version.go | 19 - .../containerregistry/webhooks.go | 866 - .../containerregistry/CHANGELOG.md | 27 - .../containerregistry/_meta.json | 11 - .../containerregistry/agentpools.go | 634 - .../containerregistry/client.go | 41 - .../containerregistry/connectedregistries.go | 652 - .../containerregistryapi/interfaces.go | 204 - .../containerregistry/enums.go | 880 - .../containerregistry/exportpipelines.go | 449 - .../containerregistry/importpipelines.go | 449 - .../containerregistry/models.go | 10052 ------ .../containerregistry/operations.go | 140 - .../containerregistry/pipelineruns.go | 453 - .../privateendpointconnections.go | 434 - .../containerregistry/registries.go | 1471 - .../containerregistry/replications.go | 542 - .../containerregistry/runs.go | 529 - .../containerregistry/scopemaps.go | 545 - .../containerregistry/taskruns.go | 634 - .../containerregistry/tasks.go | 645 - .../containerregistry/tokens.go | 542 - .../containerregistry/version.go | 19 - .../containerregistry/webhooks.go | 866 - .../containerregistry/CHANGELOG.md | 2 - .../containerregistry/_meta.json | 11 - .../containerregistry/agentpools.go | 634 - .../containerregistry/client.go | 41 - .../containerregistry/connectedregistries.go | 652 - .../containerregistryapi/interfaces.go | 204 - .../containerregistry/enums.go | 895 - .../containerregistry/exportpipelines.go | 449 - .../containerregistry/importpipelines.go | 449 - .../containerregistry/models.go | 10075 ------ .../containerregistry/operations.go | 140 - .../containerregistry/pipelineruns.go | 453 - .../privateendpointconnections.go | 434 - .../containerregistry/registries.go | 1471 - .../containerregistry/replications.go | 542 - .../containerregistry/runs.go | 529 - .../containerregistry/scopemaps.go | 545 - .../containerregistry/taskruns.go | 634 - .../containerregistry/tasks.go | 645 - .../containerregistry/tokens.go | 542 - .../containerregistry/version.go | 19 - .../containerregistry/webhooks.go | 866 - .../2021-09-01/containerregistry/CHANGELOG.md | 2 - .../2021-09-01/containerregistry/_meta.json | 11 - .../containerregistry/agentpools.go | 634 - .../2021-09-01/containerregistry/client.go | 41 - .../containerregistryapi/interfaces.go | 134 - .../2021-09-01/containerregistry/enums.go | 679 - .../2021-09-01/containerregistry/models.go | 7237 ----- .../containerregistry/operations.go | 140 - .../privateendpointconnections.go | 434 - .../containerregistry/registries.go | 1467 - .../containerregistry/replications.go | 542 - .../mgmt/2021-09-01/containerregistry/runs.go | 529 - .../2021-09-01/containerregistry/taskruns.go | 634 - .../2021-09-01/containerregistry/tasks.go | 645 - .../2021-09-01/containerregistry/version.go | 19 - .../2021-09-01/containerregistry/webhooks.go | 866 - .../2019-07/containerregistry/CHANGELOG.md | 2 - .../2019-07/containerregistry/client.go | 1567 - .../containerregistryapi/interfaces.go | 39 - .../containerregistry/dataplane_meta.json | 11 - .../2019-07/containerregistry/models.go | 318 - .../2019-07/containerregistry/version.go | 19 - .../documentdb/CHANGELOG.md | 2 - .../2019-08-01-preview/documentdb/_meta.json | 11 - .../documentdb/cassandraresources.go | 1200 - .../2019-08-01-preview/documentdb/client.go | 41 - .../documentdb/collection.go | 323 - .../documentdb/collectionpartition.go | 230 - .../documentdb/collectionpartitionregion.go | 134 - .../documentdb/collectionregion.go | 134 - .../2019-08-01-preview/documentdb/database.go | 317 - .../documentdb/databaseaccountregion.go | 129 - .../documentdb/databaseaccounts.go | 1692 - .../documentdb/documentdbapi/interfaces.go | 254 - .../2019-08-01-preview/documentdb/enums.go | 295 - .../documentdb/gremlinresources.go | 1206 - .../2019-08-01-preview/documentdb/models.go | 7178 ----- .../documentdb/mongodbresources.go | 1200 - .../documentdb/notebookworkspaces.go | 681 - .../documentdb/operations.go | 140 - .../documentdb/partitionkeyrangeid.go | 133 - .../documentdb/partitionkeyrangeidregion.go | 135 - .../documentdb/percentile.go | 127 - .../documentdb/percentilesourcetarget.go | 134 - .../documentdb/percentiletarget.go | 131 - .../documentdb/privateendpointconnections.go | 406 - .../documentdb/privatelinkresources.go | 215 - .../documentdb/sqlresources.go | 2392 -- .../documentdb/tableresources.go | 608 - .../2019-08-01-preview/documentdb/version.go | 19 - .../documentdb/CHANGELOG.md | 2 - .../2019-12-12-preview/documentdb/_meta.json | 11 - .../documentdb/cassandraresources.go | 1180 - .../2019-12-12-preview/documentdb/client.go | 43 - .../documentdb/collection.go | 317 - .../documentdb/collectionpartition.go | 226 - .../documentdb/collectionpartitionregion.go | 132 - .../documentdb/collectionregion.go | 132 - .../2019-12-12-preview/documentdb/database.go | 311 - .../documentdb/databaseaccountregion.go | 127 - .../documentdb/databaseaccounts.go | 1654 - .../documentdb/documentdbapi/interfaces.go | 254 - .../2019-12-12-preview/documentdb/enums.go | 295 - .../documentdb/gremlinresources.go | 1186 - .../2019-12-12-preview/documentdb/models.go | 7147 ----- .../documentdb/mongodbresources.go | 1180 - .../documentdb/notebookworkspaces.go | 681 - .../documentdb/operations.go | 140 - .../documentdb/partitionkeyrangeid.go | 131 - .../documentdb/partitionkeyrangeidregion.go | 133 - .../documentdb/percentile.go | 125 - .../documentdb/percentilesourcetarget.go | 132 - .../documentdb/percentiletarget.go | 129 - .../documentdb/privateendpointconnections.go | 406 - .../documentdb/privatelinkresources.go | 215 - .../documentdb/sqlresources.go | 2348 -- .../documentdb/tableresources.go | 598 - .../2019-12-12-preview/documentdb/version.go | 19 - .../documentdb/CHANGELOG.md | 2 - .../2020-03-01-preview/documentdb/_meta.json | 11 - .../documentdb/cassandraresources.go | 1591 - .../2020-03-01-preview/documentdb/client.go | 41 - .../documentdb/collection.go | 323 - .../documentdb/collectionpartition.go | 230 - .../documentdb/collectionpartitionregion.go | 134 - .../documentdb/collectionregion.go | 134 - .../2020-03-01-preview/documentdb/database.go | 317 - .../documentdb/databaseaccountregion.go | 129 - .../documentdb/databaseaccounts.go | 1692 - .../documentdb/documentdbapi/interfaces.go | 272 - .../2020-03-01-preview/documentdb/enums.go | 310 - .../documentdb/gremlinresources.go | 1595 - .../2020-03-01-preview/documentdb/models.go | 8001 ----- .../documentdb/mongodbresources.go | 1591 - .../documentdb/notebookworkspaces.go | 681 - .../documentdb/operations.go | 140 - .../documentdb/partitionkeyrangeid.go | 133 - .../documentdb/partitionkeyrangeidregion.go | 135 - .../documentdb/percentile.go | 127 - .../documentdb/percentilesourcetarget.go | 134 - .../documentdb/percentiletarget.go | 131 - .../documentdb/privateendpointconnections.go | 406 - .../documentdb/privatelinkresources.go | 215 - .../documentdb/sqlresources.go | 2780 -- .../documentdb/tableresources.go | 800 - .../2020-03-01-preview/documentdb/version.go | 19 - .../documentdb/CHANGELOG.md | 2 - .../2020-04-01-preview/documentdb/_meta.json | 11 - .../documentdb/cassandraresources.go | 1591 - .../2020-04-01-preview/documentdb/client.go | 41 - .../documentdb/collection.go | 323 - .../documentdb/collectionpartition.go | 230 - .../documentdb/collectionpartitionregion.go | 134 - .../documentdb/collectionregion.go | 134 - .../2020-04-01-preview/documentdb/database.go | 317 - .../documentdb/databaseaccountregion.go | 129 - .../documentdb/databaseaccounts.go | 1692 - .../documentdb/documentdbapi/interfaces.go | 272 - .../2020-04-01-preview/documentdb/enums.go | 325 - .../documentdb/gremlinresources.go | 1595 - .../2020-04-01-preview/documentdb/models.go | 8065 ----- .../documentdb/mongodbresources.go | 1591 - .../documentdb/notebookworkspaces.go | 681 - .../documentdb/operations.go | 140 - .../documentdb/partitionkeyrangeid.go | 133 - .../documentdb/partitionkeyrangeidregion.go | 135 - .../documentdb/percentile.go | 127 - .../documentdb/percentilesourcetarget.go | 134 - .../documentdb/percentiletarget.go | 131 - .../documentdb/privateendpointconnections.go | 406 - .../documentdb/privatelinkresources.go | 215 - .../documentdb/sqlresources.go | 2780 -- .../documentdb/tableresources.go | 800 - .../2020-04-01-preview/documentdb/version.go | 19 - .../documentdb/CHANGELOG.md | 2 - .../2020-06-01-preview/documentdb/_meta.json | 11 - .../documentdb/cassandraresources.go | 1204 - .../2020-06-01-preview/documentdb/client.go | 41 - .../documentdb/collection.go | 323 - .../documentdb/collectionpartition.go | 230 - .../documentdb/collectionpartitionregion.go | 134 - .../documentdb/collectionregion.go | 134 - .../2020-06-01-preview/documentdb/database.go | 317 - .../documentdb/databaseaccountregion.go | 129 - .../documentdb/databaseaccounts.go | 1677 - .../documentdb/documentdbapi/interfaces.go | 313 - .../2020-06-01-preview/documentdb/enums.go | 483 - .../documentdb/gremlinresources.go | 1210 - .../2020-06-01-preview/documentdb/models.go | 10704 ------- .../documentdb/mongodbresources.go | 1204 - .../documentdb/notebookworkspaces.go | 681 - .../documentdb/operations.go | 140 - .../documentdb/partitionkeyrangeid.go | 133 - .../documentdb/partitionkeyrangeidregion.go | 135 - .../documentdb/percentile.go | 127 - .../documentdb/percentilesourcetarget.go | 134 - .../documentdb/percentiletarget.go | 131 - .../documentdb/privateendpointconnections.go | 406 - .../documentdb/privatelinkresources.go | 215 - .../documentdb/restorabledatabaseaccounts.go | 273 - .../restorablemongodbcollections.go | 120 - .../documentdb/restorablemongodbdatabases.go | 115 - .../documentdb/restorablemongodbresources.go | 124 - .../documentdb/restorablesqlcontainers.go | 119 - .../documentdb/restorablesqldatabases.go | 115 - .../documentdb/restorablesqlresources.go | 124 - .../documentdb/sqlresources.go | 3144 -- .../documentdb/tableresources.go | 610 - .../2020-06-01-preview/documentdb/version.go | 19 - .../documentdb/CHANGELOG.md | 2 - .../2020-09-01-preview/documentdb/_meta.json | 11 - .../documentdb/cassandraresources.go | 1589 - .../2020-09-01-preview/documentdb/client.go | 41 - .../documentdb/collection.go | 323 - .../documentdb/collectionpartition.go | 230 - .../documentdb/collectionpartitionregion.go | 134 - .../documentdb/collectionregion.go | 134 - .../2020-09-01-preview/documentdb/database.go | 317 - .../documentdb/databaseaccountregion.go | 129 - .../documentdb/databaseaccounts.go | 1692 - .../documentdb/documentdbapi/interfaces.go | 272 - .../2020-09-01-preview/documentdb/enums.go | 357 - .../documentdb/gremlinresources.go | 1593 - .../2020-09-01-preview/documentdb/models.go | 8846 ------ .../documentdb/mongodbresources.go | 1589 - .../documentdb/notebookworkspaces.go | 681 - .../documentdb/operations.go | 140 - .../documentdb/partitionkeyrangeid.go | 133 - .../documentdb/partitionkeyrangeidregion.go | 135 - .../documentdb/percentile.go | 127 - .../documentdb/percentilesourcetarget.go | 134 - .../documentdb/percentiletarget.go | 131 - .../documentdb/privateendpointconnections.go | 406 - .../documentdb/privatelinkresources.go | 215 - .../documentdb/sqlresources.go | 2775 -- .../documentdb/tableresources.go | 799 - .../2020-09-01-preview/documentdb/version.go | 19 - .../documentdb/CHANGELOG.md | 2 - .../2021-03-01-preview/documentdb/_meta.json | 11 - .../documentdb/cassandraclusters.go | 936 - .../documentdb/cassandradatacenters.go | 517 - .../documentdb/cassandraresources.go | 1573 - .../2021-03-01-preview/documentdb/client.go | 203 - .../documentdb/collection.go | 320 - .../documentdb/collectionpartition.go | 228 - .../documentdb/collectionpartitionregion.go | 133 - .../documentdb/collectionregion.go | 133 - .../2021-03-01-preview/documentdb/database.go | 314 - .../documentdb/databaseaccountregion.go | 128 - .../documentdb/databaseaccounts.go | 1661 - .../documentdb/documentdbapi/interfaces.go | 366 - .../2021-03-01-preview/documentdb/enums.go | 608 - .../documentdb/gremlinresources.go | 1577 - .../2021-03-01-preview/documentdb/models.go | 12125 ------- .../documentdb/mongodbresources.go | 1573 - .../documentdb/notebookworkspaces.go | 674 - .../documentdb/operations.go | 140 - .../documentdb/partitionkeyrangeid.go | 132 - .../documentdb/partitionkeyrangeidregion.go | 134 - .../documentdb/percentile.go | 126 - .../documentdb/percentilesourcetarget.go | 133 - .../documentdb/percentiletarget.go | 130 - .../documentdb/privateendpointconnections.go | 402 - .../documentdb/privatelinkresources.go | 213 - .../documentdb/restorabledatabaseaccounts.go | 275 - .../restorablemongodbcollections.go | 122 - .../documentdb/restorablemongodbdatabases.go | 117 - .../documentdb/restorablemongodbresources.go | 125 - .../documentdb/restorablesqlcontainers.go | 121 - .../documentdb/restorablesqldatabases.go | 117 - .../documentdb/restorablesqlresources.go | 125 - .../documentdb/sqlresources.go | 3487 -- .../documentdb/tableresources.go | 791 - .../2021-03-01-preview/documentdb/version.go | 19 - .../2017-06-15-preview/eventgrid/CHANGELOG.md | 2 - .../2017-06-15-preview/eventgrid/_meta.json | 11 - .../2017-06-15-preview/eventgrid/client.go | 41 - .../2017-06-15-preview/eventgrid/enums.go | 121 - .../eventgrid/eventgridapi/interfaces.go | 62 - .../eventgrid/eventsubscriptions.go | 1142 - .../2017-06-15-preview/eventgrid/models.go | 826 - .../eventgrid/operations.go | 98 - .../2017-06-15-preview/eventgrid/topics.go | 654 - .../eventgrid/topictypes.go | 244 - .../2017-06-15-preview/eventgrid/version.go | 19 - .../2017-09-15-preview/eventgrid/CHANGELOG.md | 2 - .../2017-09-15-preview/eventgrid/_meta.json | 11 - .../2017-09-15-preview/eventgrid/client.go | 41 - .../2017-09-15-preview/eventgrid/enums.go | 125 - .../eventgrid/eventgridapi/interfaces.go | 63 - .../eventgrid/eventsubscriptions.go | 1142 - .../2017-09-15-preview/eventgrid/models.go | 1170 - .../eventgrid/operations.go | 98 - .../2017-09-15-preview/eventgrid/topics.go | 736 - .../eventgrid/topictypes.go | 244 - .../2017-09-15-preview/eventgrid/version.go | 19 - .../2018-05-01-preview/eventgrid/CHANGELOG.md | 2 - .../2018-05-01-preview/eventgrid/_meta.json | 11 - .../2018-05-01-preview/eventgrid/client.go | 41 - .../2018-05-01-preview/eventgrid/enums.go | 179 - .../eventgrid/eventgridapi/interfaces.go | 63 - .../eventgrid/eventsubscriptions.go | 1142 - .../2018-05-01-preview/eventgrid/models.go | 1872 -- .../eventgrid/operations.go | 98 - .../2018-05-01-preview/eventgrid/topics.go | 736 - .../eventgrid/topictypes.go | 244 - .../2018-05-01-preview/eventgrid/version.go | 19 - .../2018-09-15-preview/eventgrid/CHANGELOG.md | 2 - .../2018-09-15-preview/eventgrid/_meta.json | 11 - .../2018-09-15-preview/eventgrid/client.go | 41 - .../2018-09-15-preview/eventgrid/domains.go | 656 - .../eventgrid/domaintopics.go | 185 - .../2018-09-15-preview/eventgrid/enums.go | 239 - .../eventgrid/eventgridapi/interfaces.go | 86 - .../eventgrid/eventsubscriptions.go | 1220 - .../2018-09-15-preview/eventgrid/models.go | 3659 --- .../eventgrid/operations.go | 98 - .../2018-09-15-preview/eventgrid/topics.go | 736 - .../eventgrid/topictypes.go | 244 - .../2018-09-15-preview/eventgrid/version.go | 19 - .../2019-02-01-preview/eventgrid/CHANGELOG.md | 2 - .../2019-02-01-preview/eventgrid/_meta.json | 11 - .../2019-02-01-preview/eventgrid/client.go | 41 - .../2019-02-01-preview/eventgrid/domains.go | 757 - .../eventgrid/domaintopics.go | 396 - .../2019-02-01-preview/eventgrid/enums.go | 264 - .../eventgrid/eventgridapi/interfaces.go | 103 - .../eventgrid/eventsubscriptions.go | 1761 -- .../2019-02-01-preview/eventgrid/models.go | 4544 --- .../eventgrid/operations.go | 98 - .../2019-02-01-preview/eventgrid/topics.go | 837 - .../eventgrid/topictypes.go | 244 - .../2019-02-01-preview/eventgrid/version.go | 19 - .../2020-01-01-preview/eventgrid/CHANGELOG.md | 2 - .../2020-01-01-preview/eventgrid/_meta.json | 11 - .../2020-01-01-preview/eventgrid/client.go | 41 - .../2020-01-01-preview/eventgrid/domains.go | 769 - .../eventgrid/domaintopics.go | 402 - .../2020-01-01-preview/eventgrid/enums.go | 268 - .../eventgrid/eventgridapi/interfaces.go | 103 - .../eventgrid/eventsubscriptions.go | 1781 -- .../2020-01-01-preview/eventgrid/models.go | 4874 --- .../eventgrid/operations.go | 98 - .../2020-01-01-preview/eventgrid/topics.go | 849 - .../eventgrid/topictypes.go | 244 - .../2020-01-01-preview/eventgrid/version.go | 19 - .../2020-04-01-preview/eventgrid/CHANGELOG.md | 2 - .../2020-04-01-preview/eventgrid/_meta.json | 11 - .../2020-04-01-preview/eventgrid/client.go | 41 - .../2020-04-01-preview/eventgrid/domains.go | 769 - .../eventgrid/domaintopics.go | 402 - .../2020-04-01-preview/eventgrid/enums.go | 549 - .../eventgrid/eventchannels.go | 402 - .../eventgrid/eventgridapi/interfaces.go | 228 - .../eventgrid/eventsubscriptions.go | 1782 -- .../eventgrid/extensiontopics.go | 109 - .../2020-04-01-preview/eventgrid/models.go | 8342 ----- .../eventgrid/operations.go | 98 - .../eventgrid/partnernamespaces.go | 770 - .../eventgrid/partnerregistrations.go | 666 - .../partnertopiceventsubscriptions.go | 574 - .../eventgrid/partnertopics.go | 674 - .../eventgrid/privateendpointconnections.go | 414 - .../eventgrid/privatelinkresources.go | 246 - .../systemtopiceventsubscriptions.go | 574 - .../eventgrid/systemtopics.go | 607 - .../2020-04-01-preview/eventgrid/topics.go | 849 - .../eventgrid/topictypes.go | 244 - .../2020-04-01-preview/eventgrid/version.go | 19 - .../2020-10-15-preview/eventgrid/CHANGELOG.md | 2 - .../2020-10-15-preview/eventgrid/_meta.json | 11 - .../2020-10-15-preview/eventgrid/client.go | 41 - .../2020-10-15-preview/eventgrid/domains.go | 769 - .../eventgrid/domaintopics.go | 402 - .../2020-10-15-preview/eventgrid/enums.go | 614 - .../eventgrid/eventchannels.go | 403 - .../eventgrid/eventgridapi/interfaces.go | 231 - .../eventgrid/eventsubscriptions.go | 1865 -- .../eventgrid/extensiontopics.go | 109 - .../2020-10-15-preview/eventgrid/models.go | 10538 ------- .../eventgrid/operations.go | 98 - .../eventgrid/partnernamespaces.go | 771 - .../eventgrid/partnerregistrations.go | 667 - .../partnertopiceventsubscriptions.go | 654 - .../eventgrid/partnertopics.go | 674 - .../eventgrid/privateendpointconnections.go | 414 - .../eventgrid/privatelinkresources.go | 246 - .../systemtopiceventsubscriptions.go | 654 - .../eventgrid/systemtopics.go | 608 - .../2020-10-15-preview/eventgrid/topics.go | 852 - .../eventgrid/topictypes.go | 244 - .../2020-10-15-preview/eventgrid/version.go | 19 - .../monitorlegacy/CHANGELOG.md | 2 - .../monitorlegacy/_meta.json | 11 - .../monitorlegacy/alertruleincidents.go | 205 - .../monitorlegacy/alertrules.go | 542 - .../monitorlegacy/client.go | 41 - .../2016-03-01-preview/monitorlegacy/enums.go | 132 - .../monitorlegacy/eventcategories.go | 99 - .../monitorlegacy/logprofiles.go | 444 - .../monitorlegacy/models.go | 1678 - .../monitorlegacyapi/interfaces.go | 58 - .../monitorlegacy/version.go | 19 - .../monitorlegacy/vminsights.go | 105 - .../2017-05-01-preview/insights/CHANGELOG.md | 2 - .../2017-05-01-preview/insights/_meta.json | 11 - .../insights/actiongroups.go | 581 - .../insights/activitylogalerts.go | 498 - .../insights/activitylogs.go | 166 - .../insights/alertruleincidents.go | 186 - .../2017-05-01-preview/insights/alertrules.go | 495 - .../insights/autoscalesettings.go | 580 - .../2017-05-01-preview/insights/client.go | 41 - .../insights/diagnosticsettings.go | 332 - .../insights/diagnosticsettingscategory.go | 180 - .../mgmt/2017-05-01-preview/insights/enums.go | 378 - .../insights/eventcategories.go | 99 - .../insights/insightsapi/interfaces.go | 153 - .../insights/logprofiles.go | 418 - .../insights/metricbaseline.go | 217 - .../insights/metricdefinitions.go | 105 - .../2017-05-01-preview/insights/metrics.go | 148 - .../2017-05-01-preview/insights/models.go | 3176 -- .../2017-05-01-preview/insights/operations.go | 98 - .../insights/tenantactivitylogs.go | 168 - .../2017-05-01-preview/insights/version.go | 19 - .../mgmt/2018-03-01/insights/CHANGELOG.md | 2 - .../mgmt/2018-03-01/insights/_meta.json | 11 - .../mgmt/2018-03-01/insights/actiongroups.go | 581 - .../2018-03-01/insights/activitylogalerts.go | 498 - .../mgmt/2018-03-01/insights/activitylogs.go | 166 - .../2018-03-01/insights/alertruleincidents.go | 186 - .../mgmt/2018-03-01/insights/alertrules.go | 495 - .../2018-03-01/insights/autoscalesettings.go | 580 - .../mgmt/2018-03-01/insights/client.go | 41 - .../2018-03-01/insights/diagnosticsettings.go | 332 - .../insights/diagnosticsettingscategory.go | 180 - .../monitor/mgmt/2018-03-01/insights/enums.go | 596 - .../2018-03-01/insights/eventcategories.go | 99 - .../insights/insightsapi/interfaces.go | 185 - .../mgmt/2018-03-01/insights/logprofiles.go | 418 - .../mgmt/2018-03-01/insights/metricalerts.go | 498 - .../2018-03-01/insights/metricalertsstatus.go | 186 - .../2018-03-01/insights/metricbaseline.go | 217 - .../2018-03-01/insights/metricdefinitions.go | 109 - .../mgmt/2018-03-01/insights/metrics.go | 152 - .../mgmt/2018-03-01/insights/models.go | 5204 --- .../mgmt/2018-03-01/insights/operations.go | 98 - .../insights/scheduledqueryrules.go | 511 - .../2018-03-01/insights/tenantactivitylogs.go | 168 - .../mgmt/2018-03-01/insights/version.go | 19 - .../mgmt/2018-09-01/insights/CHANGELOG.md | 2 - .../mgmt/2018-09-01/insights/_meta.json | 11 - .../mgmt/2018-09-01/insights/actiongroups.go | 581 - .../2018-09-01/insights/activitylogalerts.go | 498 - .../mgmt/2018-09-01/insights/activitylogs.go | 166 - .../2018-09-01/insights/alertruleincidents.go | 186 - .../mgmt/2018-09-01/insights/alertrules.go | 495 - .../2018-09-01/insights/autoscalesettings.go | 580 - .../mgmt/2018-09-01/insights/client.go | 41 - .../2018-09-01/insights/diagnosticsettings.go | 332 - .../insights/diagnosticsettingscategory.go | 180 - .../monitor/mgmt/2018-09-01/insights/enums.go | 596 - .../2018-09-01/insights/eventcategories.go | 99 - .../insights/insightsapi/interfaces.go | 192 - .../mgmt/2018-09-01/insights/logprofiles.go | 418 - .../mgmt/2018-09-01/insights/metricalerts.go | 498 - .../2018-09-01/insights/metricalertsstatus.go | 186 - .../2018-09-01/insights/metricbaseline.go | 217 - .../2018-09-01/insights/metricdefinitions.go | 109 - .../2018-09-01/insights/metricnamespaces.go | 109 - .../mgmt/2018-09-01/insights/metrics.go | 152 - .../mgmt/2018-09-01/insights/models.go | 5239 --- .../mgmt/2018-09-01/insights/operations.go | 98 - .../insights/scheduledqueryrules.go | 511 - .../2018-09-01/insights/tenantactivitylogs.go | 168 - .../mgmt/2018-09-01/insights/version.go | 19 - .../2018-11-01-preview/insights/CHANGELOG.md | 2 - .../2018-11-01-preview/insights/_meta.json | 11 - .../insights/actiongroups.go | 581 - .../insights/activitylogalerts.go | 498 - .../insights/activitylogs.go | 166 - .../insights/alertruleincidents.go | 186 - .../2018-11-01-preview/insights/alertrules.go | 495 - .../insights/autoscalesettings.go | 580 - .../2018-11-01-preview/insights/client.go | 41 - .../insights/diagnosticsettings.go | 332 - .../insights/diagnosticsettingscategory.go | 180 - .../mgmt/2018-11-01-preview/insights/enums.go | 628 - .../insights/eventcategories.go | 99 - .../insights/insightsapi/interfaces.go | 199 - .../insights/logprofiles.go | 418 - .../insights/metricalerts.go | 498 - .../insights/metricalertsstatus.go | 186 - .../insights/metricbaseline.go | 217 - .../insights/metricdefinitions.go | 109 - .../insights/metricnamespaces.go | 109 - .../2018-11-01-preview/insights/metrics.go | 152 - .../2018-11-01-preview/insights/models.go | 5433 ---- .../2018-11-01-preview/insights/operations.go | 98 - .../insights/scheduledqueryrules.go | 511 - .../insights/tenantactivitylogs.go | 168 - .../2018-11-01-preview/insights/version.go | 19 - .../2018-11-01-preview/insights/vminsights.go | 105 - .../mgmt/2019-03-01/insights/CHANGELOG.md | 2 - .../mgmt/2019-03-01/insights/_meta.json | 11 - .../mgmt/2019-03-01/insights/actiongroups.go | 581 - .../2019-03-01/insights/activitylogalerts.go | 498 - .../mgmt/2019-03-01/insights/activitylogs.go | 166 - .../2019-03-01/insights/alertruleincidents.go | 186 - .../mgmt/2019-03-01/insights/alertrules.go | 495 - .../2019-03-01/insights/autoscalesettings.go | 580 - .../mgmt/2019-03-01/insights/baselines.go | 143 - .../mgmt/2019-03-01/insights/client.go | 41 - .../2019-03-01/insights/diagnosticsettings.go | 332 - .../insights/diagnosticsettingscategory.go | 180 - .../monitor/mgmt/2019-03-01/insights/enums.go | 645 - .../2019-03-01/insights/eventcategories.go | 99 - .../insights/insightsapi/interfaces.go | 206 - .../mgmt/2019-03-01/insights/logprofiles.go | 418 - .../mgmt/2019-03-01/insights/metricalerts.go | 498 - .../2019-03-01/insights/metricalertsstatus.go | 186 - .../2019-03-01/insights/metricbaseline.go | 217 - .../2019-03-01/insights/metricdefinitions.go | 109 - .../2019-03-01/insights/metricnamespaces.go | 109 - .../mgmt/2019-03-01/insights/metrics.go | 152 - .../mgmt/2019-03-01/insights/models.go | 5588 ---- .../mgmt/2019-03-01/insights/operations.go | 98 - .../insights/scheduledqueryrules.go | 511 - .../2019-03-01/insights/tenantactivitylogs.go | 168 - .../mgmt/2019-03-01/insights/version.go | 19 - .../mgmt/2019-03-01/insights/vminsights.go | 105 - .../mgmt/2019-06-01/insights/CHANGELOG.md | 2 - .../mgmt/2019-06-01/insights/_meta.json | 11 - .../mgmt/2019-06-01/insights/actiongroups.go | 581 - .../2019-06-01/insights/activitylogalerts.go | 498 - .../mgmt/2019-06-01/insights/activitylogs.go | 166 - .../2019-06-01/insights/alertruleincidents.go | 186 - .../mgmt/2019-06-01/insights/alertrules.go | 495 - .../2019-06-01/insights/autoscalesettings.go | 580 - .../mgmt/2019-06-01/insights/baselines.go | 143 - .../mgmt/2019-06-01/insights/client.go | 41 - .../2019-06-01/insights/diagnosticsettings.go | 332 - .../insights/diagnosticsettingscategory.go | 180 - .../monitor/mgmt/2019-06-01/insights/enums.go | 645 - .../2019-06-01/insights/eventcategories.go | 99 - .../insights/insightsapi/interfaces.go | 206 - .../mgmt/2019-06-01/insights/logprofiles.go | 418 - .../mgmt/2019-06-01/insights/metricalerts.go | 498 - .../2019-06-01/insights/metricalertsstatus.go | 186 - .../2019-06-01/insights/metricbaseline.go | 217 - .../2019-06-01/insights/metricdefinitions.go | 109 - .../2019-06-01/insights/metricnamespaces.go | 109 - .../mgmt/2019-06-01/insights/metrics.go | 152 - .../mgmt/2019-06-01/insights/models.go | 5596 ---- .../mgmt/2019-06-01/insights/operations.go | 98 - .../insights/scheduledqueryrules.go | 511 - .../2019-06-01/insights/tenantactivitylogs.go | 168 - .../mgmt/2019-06-01/insights/version.go | 19 - .../mgmt/2019-06-01/insights/vminsights.go | 105 - .../2019-11-01-preview/insights/CHANGELOG.md | 2 - .../2019-11-01-preview/insights/_meta.json | 11 - .../insights/actiongroups.go | 615 - .../insights/activitylogalerts.go | 530 - .../insights/activitylogs.go | 173 - .../insights/alertruleincidents.go | 199 - .../2019-11-01-preview/insights/alertrules.go | 527 - .../insights/autoscalesettings.go | 612 - .../2019-11-01-preview/insights/baselines.go | 143 - .../2019-11-01-preview/insights/client.go | 41 - .../insights/diagnosticsettings.go | 332 - .../insights/diagnosticsettingscategory.go | 180 - .../mgmt/2019-11-01-preview/insights/enums.go | 645 - .../insights/eventcategories.go | 99 - .../insights/insightsapi/interfaces.go | 268 - .../insights/logprofiles.go | 444 - .../insights/metricalerts.go | 530 - .../insights/metricalertsstatus.go | 199 - .../insights/metricbaseline.go | 217 - .../insights/metricdefinitions.go | 109 - .../insights/metricnamespaces.go | 109 - .../2019-11-01-preview/insights/metrics.go | 152 - .../2019-11-01-preview/insights/models.go | 7293 ----- .../2019-11-01-preview/insights/operations.go | 98 - .../insights/privateendpointconnections.go | 423 - .../insights/privatelinkresources.go | 241 - .../insights/privatelinkscopedresources.go | 416 - .../privatelinkscopeoperationstatus.go | 115 - .../insights/privatelinkscopes.go | 614 - .../insights/scheduledqueryrules.go | 543 - .../subscriptiondiagnosticsettings.go | 352 - .../insights/tenantactivitylogs.go | 168 - .../2019-11-01-preview/insights/version.go | 19 - .../2019-11-01-preview/insights/vminsights.go | 105 - .../2021-04-01-preview/insights/CHANGELOG.md | 2 - .../2021-04-01-preview/insights/_meta.json | 11 - .../insights/actiongroups.go | 633 - .../insights/activitylogalerts.go | 545 - .../insights/activitylogs.go | 173 - .../insights/alertruleincidents.go | 205 - .../2021-04-01-preview/insights/alertrules.go | 542 - .../insights/autoscalesettings.go | 627 - .../2021-04-01-preview/insights/baselines.go | 154 - .../2021-04-01-preview/insights/client.go | 41 - .../insights/datacollectionendpoints.go | 636 - .../datacollectionruleassociations.go | 534 - .../insights/datacollectionrules.go | 636 - .../insights/diagnosticsettings.go | 357 - .../insights/diagnosticsettingscategory.go | 193 - .../mgmt/2021-04-01-preview/insights/enums.go | 989 - .../insights/eventcategories.go | 99 - .../insights/insightsapi/interfaces.go | 291 - .../insights/logprofiles.go | 444 - .../insights/metricalerts.go | 545 - .../insights/metricalertsstatus.go | 205 - .../insights/metricdefinitions.go | 116 - .../insights/metricnamespaces.go | 116 - .../2021-04-01-preview/insights/metrics.go | 163 - .../2021-04-01-preview/insights/models.go | 8744 ----- .../2021-04-01-preview/insights/operations.go | 98 - .../insights/privateendpointconnections.go | 435 - .../insights/privatelinkresources.go | 247 - .../insights/privatelinkscopedresources.go | 428 - .../privatelinkscopeoperationstatus.go | 118 - .../insights/privatelinkscopes.go | 629 - .../insights/scheduledqueryrules.go | 558 - .../insights/tenantactivitylogs.go | 168 - .../2021-04-01-preview/insights/version.go | 19 - .../2021-04-01-preview/insights/vminsights.go | 105 - .../diagnostics/CHANGELOG.md | 2 - .../2021-05-01-preview/diagnostics/_meta.json | 11 - .../diagnostics/actiongroups.go | 800 - .../diagnostics/autoscalesettings.go | 632 - .../2021-05-01-preview/diagnostics/client.go | 41 - .../diagnostics/diagnosticsapi/interfaces.go | 137 - .../2021-05-01-preview/diagnostics/enums.go | 272 - .../managementgroupdiagnosticsettings.go | 334 - .../2021-05-01-preview/diagnostics/models.go | 2780 -- .../diagnostics/predictivemetric.go | 130 - .../diagnostics/privateendpointconnections.go | 389 - .../diagnostics/privatelinkresources.go | 205 - .../diagnostics/privatelinkscopedresources.go | 429 - .../privatelinkscopeoperationstatus.go | 118 - .../diagnostics/privatelinkscopes.go | 631 - .../diagnostics/settings.go | 332 - .../diagnostics/settingscategory.go | 180 - .../subscriptiondiagnosticsettings.go | 353 - .../2021-05-01-preview/diagnostics/version.go | 19 - .../2021-05-01-preview/metrics/CHANGELOG.md | 2 - .../2021-05-01-preview/metrics/_meta.json | 11 - .../mgmt/2021-05-01-preview/metrics/alerts.go | 545 - .../metrics/alertsstatus.go | 204 - .../2021-05-01-preview/metrics/baselines.go | 146 - .../mgmt/2021-05-01-preview/metrics/client.go | 41 - .../2021-05-01-preview/metrics/definitions.go | 193 - .../mgmt/2021-05-01-preview/metrics/enums.go | 324 - .../2021-05-01-preview/metrics/metrics.go | 449 - .../metrics/metricsapi/interfaces.go | 71 - .../mgmt/2021-05-01-preview/metrics/models.go | 2336 -- .../2021-05-01-preview/metrics/namespaces.go | 108 - .../2021-05-01-preview/metrics/operations.go | 98 - .../2021-05-01-preview/metrics/version.go | 19 - .../mgmt/2015-05-01-preview/sql/CHANGELOG.md | 2 - .../mgmt/2015-05-01-preview/sql/_meta.json | 11 - .../2015-05-01-preview/sql/capabilities.go | 107 - .../sql/mgmt/2015-05-01-preview/sql/client.go | 42 - .../sql/databaseblobauditingpolicies.go | 319 - .../mgmt/2015-05-01-preview/sql/databases.go | 1373 - .../sql/databasethreatdetectionpolicies.go | 198 - .../2015-05-01-preview/sql/databaseusages.go | 112 - .../sql/datamaskingpolicies.go | 199 - .../sql/datamaskingrules.go | 212 - .../sql/elasticpoolactivities.go | 113 - .../sql/elasticpooldatabaseactivities.go | 113 - .../2015-05-01-preview/sql/elasticpools.go | 598 - .../sql/encryptionprotectors.go | 397 - .../sql/mgmt/2015-05-01-preview/sql/enums.go | 1054 - .../2015-05-01-preview/sql/failovergroups.go | 658 - .../2015-05-01-preview/sql/firewallrules.go | 361 - .../sql/geobackuppolicies.go | 285 - .../sql/managedinstances.go | 594 - .../sql/mgmt/2015-05-01-preview/sql/models.go | 10306 ------ .../mgmt/2015-05-01-preview/sql/operations.go | 142 - .../sql/recoverabledatabases.go | 190 - .../sql/replicationlinks.go | 527 - .../sql/restorabledroppeddatabases.go | 191 - .../2015-05-01-preview/sql/restorepoints.go | 112 - .../sql/serverazureadadministrators.go | 367 - .../sql/servercommunicationlinks.go | 363 - .../sql/serverconnectionpolicies.go | 195 - .../mgmt/2015-05-01-preview/sql/serverkeys.go | 401 - .../mgmt/2015-05-01-preview/sql/servers.go | 669 - .../2015-05-01-preview/sql/serverusages.go | 110 - .../sql/serviceobjectives.go | 190 - .../sql/servicetieradvisors.go | 194 - .../sql/sqlapi/interfaces.go | 386 - .../sql/subscriptionusages.go | 226 - .../mgmt/2015-05-01-preview/sql/syncagents.go | 597 - .../mgmt/2015-05-01-preview/sql/syncgroups.go | 1107 - .../2015-05-01-preview/sql/syncmembers.go | 712 - .../transparentdataencryptionactivities.go | 115 - .../sql/transparentdataencryptions.go | 198 - .../mgmt/2015-05-01-preview/sql/version.go | 19 - .../2015-05-01-preview/sql/virtualclusters.go | 502 - .../sql/virtualnetworkrules.go | 406 - .../mgmt/2017-10-01-preview/sql/CHANGELOG.md | 2 - .../mgmt/2017-10-01-preview/sql/_meta.json | 11 - .../sql/backupshorttermretentionpolicies.go | 407 - .../2017-10-01-preview/sql/capabilities.go | 111 - .../sql/mgmt/2017-10-01-preview/sql/client.go | 42 - .../sql/databaseoperations.go | 236 - .../mgmt/2017-10-01-preview/sql/databases.go | 949 - .../databasevulnerabilityassessmentscans.go | 405 - .../sql/elasticpooloperations.go | 234 - .../2017-10-01-preview/sql/elasticpools.go | 495 - .../sql/mgmt/2017-10-01-preview/sql/enums.go | 409 - .../sql/instancefailovergroups.go | 574 - ...asevulnerabilityassessmentrulebaselines.go | 300 - ...manageddatabasevulnerabilityassessments.go | 398 - ...geddatabasevulnerabilityassessmentscans.go | 405 - .../managedinstanceencryptionprotectors.go | 397 - .../sql/managedinstancekeys.go | 403 - .../sql/managedinstancetdecertificates.go | 124 - .../sql/mgmt/2017-10-01-preview/sql/models.go | 5051 --- .../sql/recoverablemanageddatabases.go | 231 - .../sql/sqlapi/interfaces.go | 180 - .../2017-10-01-preview/sql/tdecertificates.go | 123 - .../mgmt/2017-10-01-preview/sql/version.go | 19 - .../preview/sql/mgmt/v3.0/sql/CHANGELOG.md | 2 - services/preview/sql/mgmt/v3.0/sql/_meta.json | 11 - .../sql/backuplongtermretentionpolicies.go | 279 - .../sql/backupshorttermretentionpolicies.go | 407 - .../preview/sql/mgmt/v3.0/sql/capabilities.go | 111 - services/preview/sql/mgmt/v3.0/sql/client.go | 42 - .../mgmt/v3.0/sql/databaseautomatictuning.go | 195 - .../v3.0/sql/databaseblobauditingpolicies.go | 319 - .../sql/mgmt/v3.0/sql/databaseoperations.go | 236 - .../preview/sql/mgmt/v3.0/sql/databases.go | 1407 - .../sql/databasethreatdetectionpolicies.go | 198 - .../sql/mgmt/v3.0/sql/databaseusages.go | 112 - ...asevulnerabilityassessmentrulebaselines.go | 300 - .../sql/databasevulnerabilityassessments.go | 397 - .../databasevulnerabilityassessmentscans.go | 405 - .../sql/mgmt/v3.0/sql/datamaskingpolicies.go | 199 - .../sql/mgmt/v3.0/sql/datamaskingrules.go | 212 - .../mgmt/v3.0/sql/elasticpoolactivities.go | 113 - .../v3.0/sql/elasticpooldatabaseactivities.go | 113 - .../mgmt/v3.0/sql/elasticpooloperations.go | 234 - .../preview/sql/mgmt/v3.0/sql/elasticpools.go | 736 - .../sql/mgmt/v3.0/sql/encryptionprotectors.go | 397 - services/preview/sql/mgmt/v3.0/sql/enums.go | 1905 -- .../extendeddatabaseblobauditingpolicies.go | 319 - .../sql/extendedserverblobauditingpolicies.go | 316 - .../sql/mgmt/v3.0/sql/failovergroups.go | 658 - .../sql/mgmt/v3.0/sql/firewallrules.go | 361 - .../sql/mgmt/v3.0/sql/geobackuppolicies.go | 285 - .../preview/sql/mgmt/v3.0/sql/importexport.go | 128 - .../mgmt/v3.0/sql/instancefailovergroups.go | 574 - .../sql/mgmt/v3.0/sql/instancepools.go | 597 - .../preview/sql/mgmt/v3.0/sql/jobagents.go | 492 - .../sql/mgmt/v3.0/sql/jobcredentials.go | 409 - .../sql/mgmt/v3.0/sql/jobexecutions.go | 670 - services/preview/sql/mgmt/v3.0/sql/jobs.go | 399 - .../sql/mgmt/v3.0/sql/jobstepexecutions.go | 274 - .../preview/sql/mgmt/v3.0/sql/jobsteps.go | 635 - .../sql/mgmt/v3.0/sql/jobtargetexecutions.go | 431 - .../sql/mgmt/v3.0/sql/jobtargetgroups.go | 407 - .../preview/sql/mgmt/v3.0/sql/jobversions.go | 239 - .../mgmt/v3.0/sql/longtermretentionbackups.go | 1129 - ...longtermretentionmanagedinstancebackups.go | 1130 - ...managedbackupshorttermretentionpolicies.go | 408 - .../v3.0/sql/manageddatabaserestoredetails.go | 122 - .../sql/mgmt/v3.0/sql/manageddatabases.go | 738 - .../manageddatabasesecurityalertpolicies.go | 319 - .../sql/manageddatabasesensitivitylabels.go | 723 - ...asevulnerabilityassessmentrulebaselines.go | 300 - ...manageddatabasevulnerabilityassessments.go | 398 - ...geddatabasevulnerabilityassessmentscans.go | 405 - .../v3.0/sql/managedinstanceadministrators.go | 406 - ...nagedinstanceazureadonlyauthentications.go | 406 - .../managedinstanceencryptionprotectors.go | 397 - .../sql/mgmt/v3.0/sql/managedinstancekeys.go | 403 - ...anagedinstancelongtermretentionpolicies.go | 322 - .../v3.0/sql/managedinstanceoperations.go | 309 - .../sql/mgmt/v3.0/sql/managedinstances.go | 803 - .../sql/managedinstancetdecertificates.go | 124 - ...managedinstancevulnerabilityassessments.go | 398 - ...atabasebackupshorttermretentionpolicies.go | 404 - .../sql/managedserversecurityalertpolicies.go | 316 - services/preview/sql/mgmt/v3.0/sql/models.go | 26280 ---------------- .../preview/sql/mgmt/v3.0/sql/operations.go | 142 - .../v3.0/sql/privateendpointconnections.go | 405 - .../sql/mgmt/v3.0/sql/privatelinkresources.go | 232 - .../mgmt/v3.0/sql/recommendedelasticpools.go | 269 - .../sql/mgmt/v3.0/sql/recoverabledatabases.go | 190 - .../v3.0/sql/recoverablemanageddatabases.go | 231 - .../sql/mgmt/v3.0/sql/replicationlinks.go | 527 - .../v3.0/sql/restorabledroppeddatabases.go | 191 - .../sql/restorabledroppedmanageddatabases.go | 232 - .../sql/mgmt/v3.0/sql/restorepoints.go | 365 - .../sql/mgmt/v3.0/sql/sensitivitylabels.go | 723 - .../mgmt/v3.0/sql/serverautomatictuning.go | 191 - .../v3.0/sql/serverazureadadministrators.go | 406 - .../sql/serverazureadonlyauthentications.go | 405 - .../v3.0/sql/serverblobauditingpolicies.go | 315 - .../mgmt/v3.0/sql/servercommunicationlinks.go | 363 - .../mgmt/v3.0/sql/serverconnectionpolicies.go | 195 - .../sql/mgmt/v3.0/sql/serverdnsaliases.go | 478 - .../preview/sql/mgmt/v3.0/sql/serverkeys.go | 401 - services/preview/sql/mgmt/v3.0/sql/servers.go | 761 - .../v3.0/sql/serversecurityalertpolicies.go | 315 - .../sql/mgmt/v3.0/sql/servertrustgroups.go | 527 - .../preview/sql/mgmt/v3.0/sql/serverusages.go | 110 - .../sql/servervulnerabilityassessments.go | 397 - .../sql/mgmt/v3.0/sql/serviceobjectives.go | 190 - .../sql/mgmt/v3.0/sql/servicetieradvisors.go | 194 - .../sql/mgmt/v3.0/sql/sqlapi/interfaces.go | 1043 - .../sql/mgmt/v3.0/sql/subscriptionusages.go | 226 - .../preview/sql/mgmt/v3.0/sql/syncagents.go | 597 - .../preview/sql/mgmt/v3.0/sql/syncgroups.go | 1107 - .../preview/sql/mgmt/v3.0/sql/syncmembers.go | 712 - .../sql/mgmt/v3.0/sql/tdecertificates.go | 123 - .../transparentdataencryptionactivities.go | 115 - .../v3.0/sql/transparentdataencryptions.go | 198 - services/preview/sql/mgmt/v3.0/sql/usages.go | 156 - services/preview/sql/mgmt/v3.0/sql/version.go | 19 - .../sql/mgmt/v3.0/sql/virtualclusters.go | 502 - .../sql/mgmt/v3.0/sql/virtualnetworkrules.go | 406 - .../sql/mgmt/v3.0/sql/workloadclassifiers.go | 422 - .../sql/mgmt/v3.0/sql/workloadgroups.go | 416 - .../monitoring/CHANGELOG.md | 2 - .../2019-11-01-preview/monitoring/client.go | 33 - .../monitoring/dataplane_meta.json | 11 - .../2019-11-01-preview/monitoring/models.go | 47 - .../monitoring/monitoring.go | 188 - .../monitoring/monitoringapi/interfaces.go | 20 - .../2019-11-01-preview/monitoring/version.go | 19 - .../2019-11-01-preview/spark/CHANGELOG.md | 2 - .../synapse/2019-11-01-preview/spark/batch.go | 347 - .../2019-11-01-preview/spark/client.go | 42 - .../spark/dataplane_meta.json | 11 - .../synapse/2019-11-01-preview/spark/enums.go | 140 - .../2019-11-01-preview/spark/models.go | 538 - .../2019-11-01-preview/spark/session.go | 717 - .../spark/sparkapi/interfaces.go | 38 - .../2019-11-01-preview/spark/version.go | 19 - .../accesscontrol/CHANGELOG.md | 2 - .../accesscontrolapi/interfaces.go | 27 - .../accesscontrol/client.go | 631 - .../accesscontrol/dataplane_meta.json | 11 - .../accesscontrol/models.go | 240 - .../accesscontrol/version.go | 19 - .../2019-06-01-preview/synapse/CHANGELOG.md | 2 - .../2019-06-01-preview/synapse/_meta.json | 11 - .../synapse/bigdatapools.go | 530 - .../mgmt/2019-06-01-preview/synapse/client.go | 41 - .../synapse/datamaskingpolicies.go | 217 - .../synapse/datamaskingrules.go | 224 - .../mgmt/2019-06-01-preview/synapse/enums.go | 916 - .../extendedsqlpoolblobauditingpolicies.go | 345 - .../synapse/integrationruntimeauthkeys.go | 212 - .../integrationruntimeconnectioninfos.go | 122 - .../synapse/integrationruntimecredentials.go | 123 - .../integrationruntimemonitoringdata.go | 121 - .../integrationruntimenodeipaddress.go | 123 - .../synapse/integrationruntimenodes.go | 305 - .../integrationruntimeobjectmetadata.go | 218 - .../synapse/integrationruntimes.go | 984 - .../synapse/integrationruntimestatus.go | 121 - .../synapse/ipfirewallrules.go | 525 - .../mgmt/2019-06-01-preview/synapse/keys.go | 427 - .../mgmt/2019-06-01-preview/synapse/models.go | 15219 --------- .../2019-06-01-preview/synapse/operations.go | 349 - .../synapse/privateendpointconnections.go | 434 - ...rivateendpointconnectionsprivatelinkhub.go | 162 - .../synapse/privatelinkhubs.go | 629 - .../synapse/privatelinkresources.go | 249 - .../synapse/restorabledroppedsqlpools.go | 208 - .../synapse/sqlpoolblobauditingpolicies.go | 345 - .../synapse/sqlpoolcolumns.go | 126 - .../synapse/sqlpoolconnectionpolicies.go | 122 - .../sqlpooldatawarehouseuseractivities.go | 123 - .../synapse/sqlpoolgeobackuppolicies.go | 210 - .../synapse/sqlpoolmetadatasyncconfigs.go | 212 - .../synapse/sqlpooloperationresults.go | 123 - .../synapse/sqlpooloperations.go | 163 - .../synapse/sqlpoolreplicationlinks.go | 253 - .../synapse/sqlpoolrestorepoints.go | 438 - .../2019-06-01-preview/synapse/sqlpools.go | 706 - .../synapse/sqlpoolschemas.go | 256 - .../synapse/sqlpoolsecurityalertpolicies.go | 344 - .../synapse/sqlpoolsensitivitylabels.go | 786 - .../synapse/sqlpooltablecolumns.go | 171 - .../synapse/sqlpooltables.go | 260 - .../sqlpooltransparentdataencryptions.go | 346 - .../synapse/sqlpoolusages.go | 162 - ...oolvulnerabilityassessmentrulebaselines.go | 321 - .../sqlpoolvulnerabilityassessments.go | 432 - .../sqlpoolvulnerabilityassessmentscans.go | 440 - .../synapse/sqlpoolworkloadclassifier.go | 452 - .../synapse/sqlpoolworkloadgroup.go | 447 - .../synapse/synapseapi/interfaces.go | 527 - .../2019-06-01-preview/synapse/version.go | 19 - .../synapse/workspaceaadadmins.go | 299 - ...kspacemanagedidentitysqlcontrolsettings.go | 212 - ...acemanagedsqlserverblobauditingpolicies.go | 342 - ...edsqlserverextendedblobauditingpolicies.go | 342 - ...pacemanagedsqlserverrecoverablesqlpools.go | 250 - ...pacemanagedsqlserversecurityalertpolicy.go | 342 - .../workspacemanagedsqlserverusages.go | 161 - ...anagedsqlservervulnerabilityassessments.go | 428 - .../2019-06-01-preview/synapse/workspaces.go | 636 - .../synapse/workspacesqlaadadmins.go | 299 - .../synapse/mgmt/v1.0/synapse/CHANGELOG.md | 2 - .../synapse/mgmt/v1.0/synapse/_meta.json | 11 - .../synapse/azureadonlyauthentications.go | 341 - .../synapse/mgmt/v1.0/synapse/bigdatapools.go | 525 - .../synapse/mgmt/v1.0/synapse/client.go | 41 - .../mgmt/v1.0/synapse/datamaskingpolicies.go | 215 - .../mgmt/v1.0/synapse/datamaskingrules.go | 312 - .../synapse/mgmt/v1.0/synapse/enums.go | 1077 - .../extendedsqlpoolblobauditingpolicies.go | 342 - .../synapse/integrationruntimeauthkeys.go | 210 - .../integrationruntimeconnectioninfos.go | 121 - .../synapse/integrationruntimecredentials.go | 122 - .../integrationruntimemonitoringdata.go | 120 - .../integrationruntimenodeipaddress.go | 122 - .../v1.0/synapse/integrationruntimenodes.go | 302 - .../integrationruntimeobjectmetadata.go | 216 - .../mgmt/v1.0/synapse/integrationruntimes.go | 1062 - .../v1.0/synapse/integrationruntimestatus.go | 120 - .../mgmt/v1.0/synapse/ipfirewallrules.go | 520 - .../preview/synapse/mgmt/v1.0/synapse/keys.go | 423 - .../synapse/mgmt/v1.0/synapse/libraries.go | 159 - .../synapse/mgmt/v1.0/synapse/library.go | 119 - .../synapse/mgmt/v1.0/synapse/models.go | 17023 ---------- .../synapse/mgmt/v1.0/synapse/operations.go | 347 - .../synapse/privateendpointconnections.go | 430 - ...rivateendpointconnectionsprivatelinkhub.go | 248 - .../privatelinkhubprivatelinkresources.go | 248 - .../mgmt/v1.0/synapse/privatelinkhubs.go | 624 - .../mgmt/v1.0/synapse/privatelinkresources.go | 247 - .../v1.0/synapse/restorabledroppedsqlpools.go | 206 - .../mgmt/v1.0/synapse/sparkconfiguration.go | 120 - .../mgmt/v1.0/synapse/sparkconfigurations.go | 160 - .../synapse/sqlpoolblobauditingpolicies.go | 342 - .../mgmt/v1.0/synapse/sqlpoolcolumns.go | 125 - .../v1.0/synapse/sqlpoolconnectionpolicies.go | 121 - .../sqlpooldatawarehouseuseractivities.go | 122 - .../v1.0/synapse/sqlpoolgeobackuppolicies.go | 303 - .../sqlpoolmaintenancewindowoptions.go | 122 - .../v1.0/synapse/sqlpoolmaintenancewindows.go | 213 - .../synapse/sqlpoolmetadatasyncconfigs.go | 210 - .../v1.0/synapse/sqlpooloperationresults.go | 122 - .../mgmt/v1.0/synapse/sqlpooloperations.go | 162 - .../sqlpoolrecommendedsensitivitylabels.go | 122 - .../v1.0/synapse/sqlpoolreplicationlinks.go | 251 - .../mgmt/v1.0/synapse/sqlpoolrestorepoints.go | 434 - .../synapse/mgmt/v1.0/synapse/sqlpools.go | 790 - .../mgmt/v1.0/synapse/sqlpoolschemas.go | 254 - .../synapse/sqlpoolsecurityalertpolicies.go | 341 - .../v1.0/synapse/sqlpoolsensitivitylabels.go | 868 - .../mgmt/v1.0/synapse/sqlpooltablecolumns.go | 170 - .../mgmt/v1.0/synapse/sqlpooltables.go | 258 - .../sqlpooltransparentdataencryptions.go | 343 - .../mgmt/v1.0/synapse/sqlpoolusages.go | 161 - ...oolvulnerabilityassessmentrulebaselines.go | 318 - .../sqlpoolvulnerabilityassessments.go | 428 - .../sqlpoolvulnerabilityassessmentscans.go | 436 - .../v1.0/synapse/sqlpoolworkloadclassifier.go | 448 - .../mgmt/v1.0/synapse/sqlpoolworkloadgroup.go | 443 - .../v1.0/synapse/synapseapi/interfaces.go | 615 - .../synapse/mgmt/v1.0/synapse/version.go | 19 - .../mgmt/v1.0/synapse/workspaceaadadmins.go | 296 - ...kspacemanagedidentitysqlcontrolsettings.go | 210 - ...acemanagedsqlserverblobauditingpolicies.go | 339 - ...pacemanagedsqlserverencryptionprotector.go | 429 - ...edsqlserverextendedblobauditingpolicies.go | 339 - ...pacemanagedsqlserverrecoverablesqlpools.go | 248 - ...pacemanagedsqlserversecurityalertpolicy.go | 339 - .../workspacemanagedsqlserverusages.go | 160 - ...anagedsqlservervulnerabilityassessments.go | 424 - .../synapse/mgmt/v1.0/synapse/workspaces.go | 631 - .../v1.0/synapse/workspacesqlaadadmins.go | 296 - version/version.go | 2 +- 1322 files changed, 50 insertions(+), 799893 deletions(-) delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/CHANGELOG.md delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/_meta.json delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/api.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apidiagnostic.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiexport.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissue.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissueattachment.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissuecomment.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apimanagementapi/interfaces.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apioperation.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apioperationpolicy.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apipolicy.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiproduct.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apirelease.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apirevisions.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apischema.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiversionset.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/authorizationserver.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/backend.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/cache.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/certificate.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/client.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/delegationsettings.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/diagnostic.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/emailtemplate.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/enums.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/group.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/groupuser.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/identityprovider.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/issue.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/logger.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/models.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/networkstatus.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notification.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notificationrecipientemail.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notificationrecipientuser.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/openidconnectprovider.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/operation.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/operations.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/policy.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/policysnippets.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/product.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productapi.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productgroup.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productpolicy.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productsubscriptions.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/property.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/quotabycounterkeys.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/quotabyperiodkeys.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/region.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/reports.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/service.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/serviceskus.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/signinsettings.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/signupsettings.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/subscription.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tag.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tagdescription.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tagresource.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantaccess.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantaccessgit.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantconfiguration.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/user.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/userconfirmationpassword.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/usergroup.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/useridentities.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/usersubscription.go delete mode 100644 services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/version.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/CHANGELOG.md delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/_meta.json delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/api.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apidiagnostic.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiexport.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissue.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissueattachment.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissuecomment.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apimanagementapi/interfaces.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apioperation.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apioperationpolicy.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apipolicy.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiproduct.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apirelease.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apirevision.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apischema.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apitagdescription.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiversionset.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/authorizationserver.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/backend.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/cache.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/certificate.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/client.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/delegationsettings.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/diagnostic.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/emailtemplate.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/enums.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gateway.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gatewayapi.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gatewayhostnameconfiguration.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/group.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/groupuser.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/identityprovider.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/issue.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/logger.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/models.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/namedvalue.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/networkstatus.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notification.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notificationrecipientemail.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notificationrecipientuser.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/openidconnectprovider.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/operation.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/operations.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/policy.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/policydescription.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/product.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productapi.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productgroup.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productpolicy.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productsubscriptions.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/quotabycounterkeys.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/quotabyperiodkeys.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/region.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/reports.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/service.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/serviceskus.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/signinsettings.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/signupsettings.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/subscription.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tag.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tagresource.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantaccess.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantaccessgit.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantconfiguration.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/user.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/userconfirmationpassword.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/usergroup.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/useridentities.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/usersubscription.go delete mode 100644 services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/version.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/CHANGELOG.md delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/_meta.json delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/account.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/activity.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/agentregistrationinformation.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/automationapi/interfaces.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/certificate.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/client.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/connection.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/connectiontype.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/credential.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/dsccompilationjob.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/dsccompilationjobstream.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/dscconfiguration.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/dscnode.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/dscnodeconfiguration.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/enums.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/fields.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/hybridrunbookworkergroup.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/job.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/jobschedule.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/jobstream.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/keys.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/linkedworkspace.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/models.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/module.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/nodereports.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/objectdatatypes.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/operations.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/runbook.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/runbookdraft.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/schedule.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurationmachineruns.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurationruns.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurations.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrol.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrolsyncjob.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrolsyncjobstreams.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/statistics.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/testjob.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/testjobstreams.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/usages.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/variable.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/version.go delete mode 100644 services/preview/automation/mgmt/2017-05-15-preview/automation/webhook.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/CHANGELOG.md delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/_meta.json delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/account.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/activity.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/agentregistrationinformation.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/automationapi/interfaces.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/certificate.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/client.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/connection.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/connectiontype.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/credential.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/dsccompilationjob.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/dsccompilationjobstream.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/dscconfiguration.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/dscnode.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/dscnodeconfiguration.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/enums.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/fields.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/hybridrunbookworkergroup.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/job.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/jobschedule.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/jobstream.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/keys.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/linkedworkspace.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/models.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/module.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/nodecountinformation.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/nodereports.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/objectdatatypes.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/operations.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/runbook.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/runbookdraft.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/schedule.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurationmachineruns.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurationruns.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurations.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrol.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrolsyncjob.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrolsyncjobstreams.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/statistics.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/testjob.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/testjobstreams.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/usages.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/variable.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/version.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/watcher.go delete mode 100644 services/preview/automation/mgmt/2018-01-15-preview/automation/webhook.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/CHANGELOG.md delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/_meta.json delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/account.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/activity.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/agentregistrationinformation.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/automationapi/interfaces.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/certificate.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/client.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/connection.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/connectiontype.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/credential.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/dsccompilationjob.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/dsccompilationjobstream.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/dscconfiguration.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/dscnode.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/dscnodeconfiguration.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/enums.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/fields.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/hybridrunbookworkergroup.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/job.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/jobschedule.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/jobstream.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/keys.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/linkedworkspace.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/models.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/module.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/nodecountinformation.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/nodereports.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/objectdatatypes.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/operations.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/python2package.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/runbook.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/runbookdraft.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/schedule.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurationmachineruns.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurationruns.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurations.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrol.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrolsyncjob.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrolsyncjobstreams.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/statistics.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/testjob.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/testjobstreams.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/usages.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/variable.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/version.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/watcher.go delete mode 100644 services/preview/automation/mgmt/2018-06-30-preview/automation/webhook.go delete mode 100644 services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/CHANGELOG.md delete mode 100644 services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/_meta.json delete mode 100644 services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/client.go delete mode 100644 services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/containerregistryapi/interfaces.go delete mode 100644 services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/models.go delete mode 100644 services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/registries.go delete mode 100644 services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/version.go delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/CHANGELOG.md delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/_meta.json delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/client.go delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/containerregistryapi/interfaces.go delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/enums.go delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/models.go delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/operations.go delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/registries.go delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/replications.go delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/version.go delete mode 100644 services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/webhooks.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/CHANGELOG.md delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/_meta.json delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/builds.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/buildsteps.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/buildtasks.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/client.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/containerregistryapi/interfaces.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/enums.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/models.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/operations.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/registries.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/replications.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/version.go delete mode 100644 services/preview/containerregistry/mgmt/2018-02-01/containerregistry/webhooks.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/CHANGELOG.md delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/_meta.json delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/agentpools.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/client.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/containerregistryapi/interfaces.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/enums.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/exportpipelines.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/importpipelines.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/models.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/operations.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/pipelineruns.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/privateendpointconnections.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/registries.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/replications.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/runs.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/scopemaps.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/taskruns.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/tasks.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/tokens.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/version.go delete mode 100644 services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/webhooks.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/CHANGELOG.md delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/_meta.json delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/agentpools.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/client.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/connectedregistries.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/containerregistryapi/interfaces.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/enums.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/exportpipelines.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/importpipelines.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/models.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/operations.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/pipelineruns.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/privateendpointconnections.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/registries.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/replications.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/runs.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/scopemaps.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/taskruns.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/tasks.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/tokens.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/version.go delete mode 100644 services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/webhooks.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/CHANGELOG.md delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/_meta.json delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/agentpools.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/client.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/connectedregistries.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/containerregistryapi/interfaces.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/enums.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/exportpipelines.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/importpipelines.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/models.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/operations.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/pipelineruns.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/privateendpointconnections.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/registries.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/replications.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/runs.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/scopemaps.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/taskruns.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tasks.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tokens.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/version.go delete mode 100644 services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/webhooks.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/CHANGELOG.md delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/_meta.json delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/agentpools.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/client.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/containerregistryapi/interfaces.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/enums.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/models.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/operations.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/privateendpointconnections.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/registries.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/replications.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/runs.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/taskruns.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/tasks.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/version.go delete mode 100644 services/preview/containerregistry/mgmt/2021-09-01/containerregistry/webhooks.go delete mode 100644 services/preview/containerregistry/runtime/2019-07/containerregistry/CHANGELOG.md delete mode 100644 services/preview/containerregistry/runtime/2019-07/containerregistry/client.go delete mode 100644 services/preview/containerregistry/runtime/2019-07/containerregistry/containerregistryapi/interfaces.go delete mode 100644 services/preview/containerregistry/runtime/2019-07/containerregistry/dataplane_meta.json delete mode 100644 services/preview/containerregistry/runtime/2019-07/containerregistry/models.go delete mode 100644 services/preview/containerregistry/runtime/2019-07/containerregistry/version.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/CHANGELOG.md delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/_meta.json delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/cassandraresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/client.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collection.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionpartition.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionpartitionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/database.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/databaseaccountregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/databaseaccounts.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/documentdbapi/interfaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/enums.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/gremlinresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/models.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/mongodbresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/notebookworkspaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/operations.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/partitionkeyrangeid.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/partitionkeyrangeidregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentile.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentilesourcetarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentiletarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/privateendpointconnections.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/privatelinkresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/sqlresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/tableresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/version.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/CHANGELOG.md delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/_meta.json delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/cassandraresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/client.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collection.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionpartition.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionpartitionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/database.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/databaseaccountregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/databaseaccounts.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/documentdbapi/interfaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/enums.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/gremlinresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/models.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/mongodbresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/notebookworkspaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/operations.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/partitionkeyrangeid.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/partitionkeyrangeidregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentile.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentilesourcetarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentiletarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/privateendpointconnections.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/privatelinkresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/sqlresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/tableresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/version.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/CHANGELOG.md delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/_meta.json delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/cassandraresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/client.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collection.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionpartition.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionpartitionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/database.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/databaseaccountregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/databaseaccounts.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/documentdbapi/interfaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/enums.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/gremlinresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/models.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/mongodbresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/notebookworkspaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/operations.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/partitionkeyrangeid.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/partitionkeyrangeidregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentile.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentilesourcetarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentiletarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/privateendpointconnections.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/privatelinkresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/sqlresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/tableresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/version.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/CHANGELOG.md delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/_meta.json delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/cassandraresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/client.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collection.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionpartition.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionpartitionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/database.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/databaseaccountregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/databaseaccounts.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/documentdbapi/interfaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/enums.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/gremlinresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/models.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/mongodbresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/notebookworkspaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/operations.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/partitionkeyrangeid.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/partitionkeyrangeidregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentile.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentilesourcetarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentiletarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/privateendpointconnections.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/privatelinkresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/sqlresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/tableresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/version.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/CHANGELOG.md delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/_meta.json delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/cassandraresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/client.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collection.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartition.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartitionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/database.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccountregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccounts.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/documentdbapi/interfaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/enums.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/gremlinresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/models.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/mongodbresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/notebookworkspaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/operations.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeid.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeidregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentile.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentilesourcetarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentiletarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privateendpointconnections.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privatelinkresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorabledatabaseaccounts.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbcollections.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbdatabases.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqlcontainers.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqldatabases.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqlresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/sqlresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/tableresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/version.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/CHANGELOG.md delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/_meta.json delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/cassandraresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/client.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collection.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionpartition.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionpartitionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/database.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/databaseaccountregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/databaseaccounts.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/documentdbapi/interfaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/enums.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/gremlinresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/models.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/mongodbresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/notebookworkspaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/operations.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/partitionkeyrangeid.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/partitionkeyrangeidregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentile.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentilesourcetarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentiletarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/privateendpointconnections.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/privatelinkresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/sqlresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/tableresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/version.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/CHANGELOG.md delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/_meta.json delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandraclusters.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandradatacenters.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandraresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/client.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collection.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionpartition.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionpartitionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/database.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/databaseaccountregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/databaseaccounts.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/documentdbapi/interfaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/enums.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/gremlinresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/models.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/mongodbresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/notebookworkspaces.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/operations.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/partitionkeyrangeid.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/partitionkeyrangeidregion.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentile.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentilesourcetarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentiletarget.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/privateendpointconnections.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/privatelinkresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorabledatabaseaccounts.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbcollections.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbdatabases.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqlcontainers.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqldatabases.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqlresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/sqlresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/tableresources.go delete mode 100644 services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/version.go delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/CHANGELOG.md delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/_meta.json delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/client.go delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/enums.go delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/eventgridapi/interfaces.go delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/eventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/models.go delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/operations.go delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/topics.go delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/topictypes.go delete mode 100644 services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/version.go delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/CHANGELOG.md delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/_meta.json delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/client.go delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/enums.go delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventgridapi/interfaces.go delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/models.go delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/operations.go delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/topics.go delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/topictypes.go delete mode 100644 services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/version.go delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/CHANGELOG.md delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/_meta.json delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/client.go delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/enums.go delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/eventgridapi/interfaces.go delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/eventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/models.go delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/operations.go delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/topics.go delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/topictypes.go delete mode 100644 services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/version.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/CHANGELOG.md delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/_meta.json delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/client.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domains.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domaintopics.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/enums.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventgridapi/interfaces.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/models.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/operations.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topics.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topictypes.go delete mode 100644 services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/version.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/CHANGELOG.md delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/_meta.json delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/client.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/domains.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/domaintopics.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/enums.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/eventgridapi/interfaces.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/eventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/models.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/operations.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/topics.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/topictypes.go delete mode 100644 services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/version.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/CHANGELOG.md delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/_meta.json delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/client.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/domains.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/domaintopics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/enums.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/eventgridapi/interfaces.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/eventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/models.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/operations.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/topics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/topictypes.go delete mode 100644 services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/version.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/CHANGELOG.md delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/_meta.json delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/client.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/domains.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/domaintopics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/enums.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventchannels.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventgridapi/interfaces.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/extensiontopics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/models.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/operations.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnernamespaces.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnerregistrations.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnertopiceventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnertopics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/privateendpointconnections.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/privatelinkresources.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/systemtopiceventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/systemtopics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/topics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/topictypes.go delete mode 100644 services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/version.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/CHANGELOG.md delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/_meta.json delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/client.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/domains.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/domaintopics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/enums.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventchannels.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventgridapi/interfaces.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/extensiontopics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/models.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/operations.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnernamespaces.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnerregistrations.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnertopiceventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnertopics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/privateendpointconnections.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/privatelinkresources.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/systemtopiceventsubscriptions.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/systemtopics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/topics.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/topictypes.go delete mode 100644 services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/version.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/_meta.json delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertruleincidents.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertrules.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/client.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/enums.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/eventcategories.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/logprofiles.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/models.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/monitorlegacyapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/version.go delete mode 100644 services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/vminsights.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/_meta.json delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogs.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/alertrules.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/client.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/enums.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/eventcategories.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/insightsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/metricdefinitions.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/metrics.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/models.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/operations.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/tenantactivitylogs.go delete mode 100644 services/preview/monitor/mgmt/2017-05-01-preview/insights/version.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/_meta.json delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/client.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/enums.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/eventcategories.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/insightsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/metrics.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/models.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/operations.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go delete mode 100644 services/preview/monitor/mgmt/2018-03-01/insights/version.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/_meta.json delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/activitylogalerts.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/activitylogs.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/alertrules.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/autoscalesettings.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/client.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettingscategory.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/enums.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/eventcategories.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/metricalerts.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/metricdefinitions.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/metricnamespaces.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/metrics.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/models.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/operations.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/tenantactivitylogs.go delete mode 100644 services/preview/monitor/mgmt/2018-09-01/insights/version.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/_meta.json delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/actiongroups.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogalerts.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogs.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/alertruleincidents.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/alertrules.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/autoscalesettings.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/client.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettingscategory.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/enums.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/eventcategories.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/insightsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/logprofiles.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalerts.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalertsstatus.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/metricdefinitions.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/metricnamespaces.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/metrics.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/models.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/operations.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/scheduledqueryrules.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/tenantactivitylogs.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/version.go delete mode 100644 services/preview/monitor/mgmt/2018-11-01-preview/insights/vminsights.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/_meta.json delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/actiongroups.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/activitylogalerts.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/activitylogs.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/alertruleincidents.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/alertrules.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/autoscalesettings.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/baselines.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/client.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettingscategory.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/enums.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/eventcategories.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/insightsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/logprofiles.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/metricalerts.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/metricalertsstatus.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/metricdefinitions.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/metricnamespaces.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/metrics.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/models.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/operations.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/scheduledqueryrules.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/tenantactivitylogs.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/version.go delete mode 100644 services/preview/monitor/mgmt/2019-03-01/insights/vminsights.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/_meta.json delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/actiongroups.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/activitylogalerts.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/activitylogs.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/alertruleincidents.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/alertrules.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/autoscalesettings.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/baselines.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/client.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettingscategory.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/enums.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/eventcategories.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/insightsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/logprofiles.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/metricalerts.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/metricalertsstatus.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/metricdefinitions.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/metricnamespaces.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/metrics.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/models.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/operations.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/scheduledqueryrules.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/tenantactivitylogs.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/version.go delete mode 100644 services/preview/monitor/mgmt/2019-06-01/insights/vminsights.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/_meta.json delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/actiongroups.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogalerts.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogs.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/alertruleincidents.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/alertrules.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/autoscalesettings.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/baselines.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/client.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettingscategory.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/enums.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/eventcategories.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/insightsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/logprofiles.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalerts.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalertsstatus.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/metricbaseline.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/metricdefinitions.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/metricnamespaces.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/metrics.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/models.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/operations.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/privateendpointconnections.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkresources.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopedresources.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopeoperationstatus.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopes.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/scheduledqueryrules.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/subscriptiondiagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/tenantactivitylogs.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/version.go delete mode 100644 services/preview/monitor/mgmt/2019-11-01-preview/insights/vminsights.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/_meta.json delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/actiongroups.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogalerts.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogs.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/alertruleincidents.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/alertrules.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/autoscalesettings.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/baselines.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/client.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionendpoints.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionruleassociations.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionrules.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettingscategory.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/enums.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/eventcategories.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/insightsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/logprofiles.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalerts.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalertsstatus.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/metricdefinitions.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/metricnamespaces.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/metrics.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/models.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/operations.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/privateendpointconnections.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkresources.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopedresources.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopeoperationstatus.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopes.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/scheduledqueryrules.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/tenantactivitylogs.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/version.go delete mode 100644 services/preview/monitor/mgmt/2021-04-01-preview/insights/vminsights.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/_meta.json delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/actiongroups.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/autoscalesettings.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/client.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/diagnosticsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/enums.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/managementgroupdiagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/models.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/predictivemetric.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privateendpointconnections.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkresources.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopedresources.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopeoperationstatus.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopes.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settings.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settingscategory.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/subscriptiondiagnosticsettings.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/version.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/CHANGELOG.md delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/_meta.json delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/alerts.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/alertsstatus.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/baselines.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/client.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/definitions.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/enums.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/metrics.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/metricsapi/interfaces.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/models.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/namespaces.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/operations.go delete mode 100644 services/preview/monitor/mgmt/2021-05-01-preview/metrics/version.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/CHANGELOG.md delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/_meta.json delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/capabilities.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/client.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/databases.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/databaseusages.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpools.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/enums.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/failovergroups.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/firewallrules.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/models.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/operations.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/restorepoints.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/serverkeys.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/servers.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/serverusages.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/syncagents.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/syncgroups.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/syncmembers.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/version.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/virtualclusters.go delete mode 100644 services/preview/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/CHANGELOG.md delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/_meta.json delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/backupshorttermretentionpolicies.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/capabilities.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/client.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/databaseoperations.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/databases.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/databasevulnerabilityassessmentscans.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/elasticpooloperations.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/elasticpools.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/enums.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/instancefailovergroups.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessmentrulebaselines.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessments.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessmentscans.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstancekeys.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstancetdecertificates.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/models.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/recoverablemanageddatabases.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/tdecertificates.go delete mode 100644 services/preview/sql/mgmt/2017-10-01-preview/sql/version.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/CHANGELOG.md delete mode 100644 services/preview/sql/mgmt/v3.0/sql/_meta.json delete mode 100644 services/preview/sql/mgmt/v3.0/sql/backuplongtermretentionpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/backupshorttermretentionpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/capabilities.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/client.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/databaseautomatictuning.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/databaseblobauditingpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/databaseoperations.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/databases.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/databasethreatdetectionpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/databaseusages.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessmentrulebaselines.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessments.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessmentscans.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/datamaskingpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/datamaskingrules.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/elasticpoolactivities.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/elasticpooldatabaseactivities.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/elasticpooloperations.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/elasticpools.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/encryptionprotectors.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/enums.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/extendeddatabaseblobauditingpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/extendedserverblobauditingpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/failovergroups.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/firewallrules.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/geobackuppolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/importexport.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/instancefailovergroups.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/instancepools.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/jobagents.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/jobcredentials.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/jobexecutions.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/jobs.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/jobstepexecutions.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/jobsteps.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/jobtargetexecutions.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/jobtargetgroups.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/jobversions.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/longtermretentionbackups.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/longtermretentionmanagedinstancebackups.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedbackupshorttermretentionpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/manageddatabaserestoredetails.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/manageddatabases.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/manageddatabasesecurityalertpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/manageddatabasesensitivitylabels.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessmentrulebaselines.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessments.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessmentscans.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedinstanceadministrators.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedinstanceazureadonlyauthentications.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedinstanceencryptionprotectors.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedinstancekeys.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedinstancelongtermretentionpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedinstanceoperations.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedinstances.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedinstancetdecertificates.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedinstancevulnerabilityassessments.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/managedserversecurityalertpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/models.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/operations.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/privateendpointconnections.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/privatelinkresources.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/recommendedelasticpools.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/recoverabledatabases.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/recoverablemanageddatabases.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/replicationlinks.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/restorabledroppeddatabases.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/restorabledroppedmanageddatabases.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/restorepoints.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/sensitivitylabels.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serverautomatictuning.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serverazureadadministrators.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serverazureadonlyauthentications.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serverblobauditingpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/servercommunicationlinks.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serverconnectionpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serverdnsaliases.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serverkeys.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/servers.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serversecurityalertpolicies.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/servertrustgroups.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serverusages.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/servervulnerabilityassessments.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/serviceobjectives.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/servicetieradvisors.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/subscriptionusages.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/syncagents.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/syncgroups.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/syncmembers.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/tdecertificates.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/transparentdataencryptionactivities.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/transparentdataencryptions.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/usages.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/version.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/virtualclusters.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/virtualnetworkrules.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/workloadclassifiers.go delete mode 100644 services/preview/sql/mgmt/v3.0/sql/workloadgroups.go delete mode 100644 services/preview/synapse/2019-11-01-preview/monitoring/CHANGELOG.md delete mode 100644 services/preview/synapse/2019-11-01-preview/monitoring/client.go delete mode 100644 services/preview/synapse/2019-11-01-preview/monitoring/dataplane_meta.json delete mode 100644 services/preview/synapse/2019-11-01-preview/monitoring/models.go delete mode 100644 services/preview/synapse/2019-11-01-preview/monitoring/monitoring.go delete mode 100644 services/preview/synapse/2019-11-01-preview/monitoring/monitoringapi/interfaces.go delete mode 100644 services/preview/synapse/2019-11-01-preview/monitoring/version.go delete mode 100644 services/preview/synapse/2019-11-01-preview/spark/CHANGELOG.md delete mode 100644 services/preview/synapse/2019-11-01-preview/spark/batch.go delete mode 100644 services/preview/synapse/2019-11-01-preview/spark/client.go delete mode 100644 services/preview/synapse/2019-11-01-preview/spark/dataplane_meta.json delete mode 100644 services/preview/synapse/2019-11-01-preview/spark/enums.go delete mode 100644 services/preview/synapse/2019-11-01-preview/spark/models.go delete mode 100644 services/preview/synapse/2019-11-01-preview/spark/session.go delete mode 100644 services/preview/synapse/2019-11-01-preview/spark/sparkapi/interfaces.go delete mode 100644 services/preview/synapse/2019-11-01-preview/spark/version.go delete mode 100644 services/preview/synapse/2020-02-01-preview/accesscontrol/CHANGELOG.md delete mode 100644 services/preview/synapse/2020-02-01-preview/accesscontrol/accesscontrolapi/interfaces.go delete mode 100644 services/preview/synapse/2020-02-01-preview/accesscontrol/client.go delete mode 100644 services/preview/synapse/2020-02-01-preview/accesscontrol/dataplane_meta.json delete mode 100644 services/preview/synapse/2020-02-01-preview/accesscontrol/models.go delete mode 100644 services/preview/synapse/2020-02-01-preview/accesscontrol/version.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/CHANGELOG.md delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/_meta.json delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/bigdatapools.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/client.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/datamaskingpolicies.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/datamaskingrules.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/enums.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/extendedsqlpoolblobauditingpolicies.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeauthkeys.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeconnectioninfos.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimecredentials.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimemonitoringdata.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimenodeipaddress.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimenodes.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeobjectmetadata.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimes.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimestatus.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/ipfirewallrules.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/keys.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/models.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/operations.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/privateendpointconnections.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/privateendpointconnectionsprivatelinkhub.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/privatelinkhubs.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/privatelinkresources.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/restorabledroppedsqlpools.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolblobauditingpolicies.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolcolumns.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolconnectionpolicies.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooldatawarehouseuseractivities.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolgeobackuppolicies.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolmetadatasyncconfigs.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooloperationresults.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooloperations.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolreplicationlinks.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolrestorepoints.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpools.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolschemas.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolsecurityalertpolicies.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolsensitivitylabels.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltablecolumns.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltables.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltransparentdataencryptions.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolusages.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessmentrulebaselines.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessments.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessmentscans.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolworkloadclassifier.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolworkloadgroup.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/synapseapi/interfaces.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/version.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspaceaadadmins.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedidentitysqlcontrolsettings.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverblobauditingpolicies.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverextendedblobauditingpolicies.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverrecoverablesqlpools.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserversecurityalertpolicy.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverusages.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlservervulnerabilityassessments.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspaces.go delete mode 100644 services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacesqlaadadmins.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/CHANGELOG.md delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/_meta.json delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/azureadonlyauthentications.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/bigdatapools.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/client.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/datamaskingpolicies.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/datamaskingrules.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/enums.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/extendedsqlpoolblobauditingpolicies.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeauthkeys.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeconnectioninfos.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/integrationruntimecredentials.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/integrationruntimemonitoringdata.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/integrationruntimenodeipaddress.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/integrationruntimenodes.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeobjectmetadata.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/integrationruntimes.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/integrationruntimestatus.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/ipfirewallrules.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/keys.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/libraries.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/library.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/models.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/operations.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/privateendpointconnections.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/privateendpointconnectionsprivatelinkhub.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/privatelinkhubprivatelinkresources.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/privatelinkhubs.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/privatelinkresources.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/restorabledroppedsqlpools.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sparkconfiguration.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sparkconfigurations.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolblobauditingpolicies.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolcolumns.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolconnectionpolicies.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpooldatawarehouseuseractivities.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolgeobackuppolicies.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolmaintenancewindowoptions.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolmaintenancewindows.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolmetadatasyncconfigs.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpooloperationresults.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpooloperations.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolrecommendedsensitivitylabels.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolreplicationlinks.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolrestorepoints.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpools.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolschemas.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolsecurityalertpolicies.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolsensitivitylabels.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpooltablecolumns.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpooltables.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpooltransparentdataencryptions.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolusages.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessmentrulebaselines.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessments.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessmentscans.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolworkloadclassifier.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/sqlpoolworkloadgroup.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/synapseapi/interfaces.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/version.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspaceaadadmins.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedidentitysqlcontrolsettings.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverblobauditingpolicies.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverencryptionprotector.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverextendedblobauditingpolicies.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverrecoverablesqlpools.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserversecurityalertpolicy.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverusages.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlservervulnerabilityassessments.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspaces.go delete mode 100644 services/preview/synapse/mgmt/v1.0/synapse/workspacesqlaadadmins.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f21ef7eeaf8..b16a6408ded7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,54 @@ # CHANGELOG +## `v65.0.0` + +### Removed Packages + +- `github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement` +- `github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement` +- `github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2017-05-15-preview/automation` +- `github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2018-01-15-preview/automation` +- `github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry` +- `github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry` +- `github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2018-02-01/containerregistry` +- `github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry` +- `github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry` +- `github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry` +- `github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-09-01/containerregistry` +- `github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb` +- `github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb` +- `github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb` +- `github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb` +- `github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb` +- `github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb` +- `github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb` +- `github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-09-01/insights` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-11-01-preview/insights` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2019-03-01/insights` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2019-06-01/insights` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2019-11-01-preview/insights` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-04-01-preview/insights` +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics` +- `github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql` +- `github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-10-01-preview/sql` +- `github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v3.0/sql` +- `github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-11-01-preview/monitoring` +- `github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-11-01-preview/spark` +- `github.com/Azure/azure-sdk-for-go/services/preview/synapse/2020-02-01-preview/accesscontrol` +- `github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/2019-06-01-preview/synapse` +- `github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/v1.0/synapse` + ## `v64.2.0` ### New Packages diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/CHANGELOG.md b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/_meta.json b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/_meta.json deleted file mode 100644 index 35fe5a061fcc..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md", - "tag": "package-2018-06-preview", - "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-2018-06-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/api.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/api.go deleted file mode 100644 index a82238f474b3..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/api.go +++ /dev/null @@ -1,824 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIClient is the apiManagement Client -type APIClient struct { - BaseClient -} - -// NewAPIClient creates an instance of the APIClient client. -func NewAPIClient(subscriptionID string) APIClient { - return NewAPIClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIClientWithBaseURI creates an instance of the APIClient 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 NewAPIClientWithBaseURI(baseURI string, subscriptionID string) APIClient { - return APIClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates new or updates existing specified API of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APICreateOrUpdateParameter, ifMatch string) (result APICreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APICreateOrUpdateParameter, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) CreateOrUpdateSender(req *http.Request) (future APICreateOrUpdateFuture, 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 APIClient) CreateOrUpdateResponder(resp *http.Response) (result APIContract, 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 the specified API of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// deleteRevisions - delete all revisions of the Api. -func (client APIClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string, deleteRevisions *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, ifMatch, deleteRevisions) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string, deleteRevisions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteRevisions != nil { - queryParameters["deleteRevisions"] = autorest.Encode("query", *deleteRevisions) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIClient) 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 APIClient) 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 details of the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result APIContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}", 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 APIClient) 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 APIClient) GetResponder(resp *http.Response) (result APIContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all APIs of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -// tags - include tags in the response. -// expandAPIVersionSet - include full ApiVersionSet resource in response -func (client APIClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result APICollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByService") - defer func() { - sc := -1 - if result.ac.Response.Response != nil { - sc = result.ac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, tags, expandAPIVersionSet) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByService", resp, "Failure sending request") - return - } - - result.ac, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ac.hasNextLink() && result.ac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags) - } - if expandAPIVersionSet != nil { - queryParameters["expandApiVersionSet"] = autorest.Encode("query", *expandAPIVersionSet) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIClient) ListByServiceResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIClient) listByServiceNextResults(ctx context.Context, lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.aPICollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result APICollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, tags, expandAPIVersionSet) - return -} - -// ListByTags lists a collection of apis associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |apiRevision | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |isCurrent | eq | | -// top - number of records to return. -// skip - number of records to skip. -// includeNotTaggedApis - include not tagged APIs. -func (client APIClient) ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByTags") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "ListByTags", err.Error()) - } - - result.fn = client.listByTagsNextResults - req, err := client.ListByTagsPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByTags", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTagsSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByTags", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByTags", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTagsPreparer prepares the ListByTags request. -func (client APIClient) ListByTagsPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if includeNotTaggedApis != nil { - queryParameters["includeNotTaggedApis"] = autorest.Encode("query", *includeNotTaggedApis) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTagsSender sends the ListByTags request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) ListByTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTagsResponder handles the response to the ListByTags request. The method always -// closes the http.Response Body. -func (client APIClient) ListByTagsResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTagsNextResults retrieves the next set of results, if any. -func (client APIClient) listByTagsNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByTagsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByTagsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByTagsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTagsComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIClient) ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByTags") - 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.ListByTags(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis) - return -} - -// Update updates the specified API of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// parameters - API Update Contract parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APIUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APIUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIClient) 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 APIClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apidiagnostic.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apidiagnostic.go deleted file mode 100644 index 80bf11be6513..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apidiagnostic.go +++ /dev/null @@ -1,717 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIDiagnosticClient is the apiManagement Client -type APIDiagnosticClient struct { - BaseClient -} - -// NewAPIDiagnosticClient creates an instance of the APIDiagnosticClient client. -func NewAPIDiagnosticClient(subscriptionID string) APIDiagnosticClient { - return NewAPIDiagnosticClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIDiagnosticClientWithBaseURI creates an instance of the APIDiagnosticClient 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 NewAPIDiagnosticClientWithBaseURI(baseURI string, subscriptionID string) APIDiagnosticClient { - return APIDiagnosticClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Diagnostic for an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIDiagnosticClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.LoggerID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMaximum, Rule: float64(100), Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIDiagnosticClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) 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 APIDiagnosticClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticContract, 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 specified Diagnostic from an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIDiagnosticClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIDiagnosticClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIDiagnosticClient) 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 APIDiagnosticClient) 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 details of the Diagnostic for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client APIDiagnosticClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIDiagnosticClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", 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 APIDiagnosticClient) 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 APIDiagnosticClient) GetResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client APIDiagnosticClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIDiagnosticClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all diagnostics of an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client APIDiagnosticClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result DiagnosticCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.ListByService") - defer func() { - sc := -1 - if result.dc.Response.Response != nil { - sc = result.dc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.dc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "ListByService", resp, "Failure sending request") - return - } - - result.dc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "ListByService", resp, "Failure responding to request") - return - } - if result.dc.hasNextLink() && result.dc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIDiagnosticClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) ListByServiceResponder(resp *http.Response) (result DiagnosticCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIDiagnosticClient) listByServiceNextResults(ctx context.Context, lastResults DiagnosticCollection) (result DiagnosticCollection, err error) { - req, err := lastResults.diagnosticCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIDiagnosticClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result DiagnosticCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} - -// Update updates the details of the Diagnostic for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - diagnostic Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIDiagnosticClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIDiagnosticClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIDiagnosticClient) 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 APIDiagnosticClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiexport.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiexport.go deleted file mode 100644 index 9942bc54fc49..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiexport.go +++ /dev/null @@ -1,128 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIExportClient is the apiManagement Client -type APIExportClient struct { - BaseClient -} - -// NewAPIExportClient creates an instance of the APIExportClient client. -func NewAPIExportClient(subscriptionID string) APIExportClient { - return NewAPIExportClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIExportClientWithBaseURI creates an instance of the APIExportClient 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 NewAPIExportClientWithBaseURI(baseURI string, subscriptionID string) APIExportClient { - return APIExportClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key -// valid for 5 minutes. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// formatParameter - format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 -// minutes. -func (client APIExportClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter ExportFormat) (result APIExportResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIExportClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIExportClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIExportClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter ExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "export": autorest.Encode("query", "true"), - "format": autorest.Encode("query", formatParameter), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", 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 APIExportClient) 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 APIExportClient) GetResponder(resp *http.Response) (result APIExportResult, 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/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissue.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissue.go deleted file mode 100644 index ef802bcd8909..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissue.go +++ /dev/null @@ -1,695 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIIssueClient is the apiManagement Client -type APIIssueClient struct { - BaseClient -} - -// NewAPIIssueClient creates an instance of the APIIssueClient client. -func NewAPIIssueClient(subscriptionID string) APIIssueClient { - return NewAPIIssueClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIIssueClientWithBaseURI creates an instance of the APIIssueClient 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 NewAPIIssueClientWithBaseURI(baseURI string, subscriptionID string) APIIssueClient { - return APIIssueClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Issue for an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIIssueClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueContract, ifMatch string) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IssueContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IssueContractProperties.Title", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueContractProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueContractProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIIssueClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) 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 APIIssueClient) CreateOrUpdateResponder(resp *http.Response) (result IssueContract, 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 specified Issue from an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIIssueClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIIssueClient) 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 APIIssueClient) 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 details of the Issue for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// expandCommentsAttachments - expand the comment attachments. -func (client APIIssueClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, expandCommentsAttachments *bool) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, expandCommentsAttachments) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIIssueClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, expandCommentsAttachments *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if expandCommentsAttachments != nil { - queryParameters["expandCommentsAttachments"] = autorest.Encode("query", *expandCommentsAttachments) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", 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 APIIssueClient) 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 APIIssueClient) GetResponder(resp *http.Response) (result IssueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Issue for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -func (client APIIssueClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, issueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIIssueClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIIssueClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all issues associated with the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |state | eq | | -// expandCommentsAttachments - expand the comment attachments. -// top - number of records to return. -// skip - number of records to skip. -func (client APIIssueClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result IssueCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.ListByService") - defer func() { - sc := -1 - if result.ic.Response.Response != nil { - sc = result.ic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, expandCommentsAttachments, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "ListByService", resp, "Failure sending request") - return - } - - result.ic, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ic.hasNextLink() && result.ic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIIssueClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if expandCommentsAttachments != nil { - queryParameters["expandCommentsAttachments"] = autorest.Encode("query", *expandCommentsAttachments) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/issues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIIssueClient) ListByServiceResponder(resp *http.Response) (result IssueCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIIssueClient) listByServiceNextResults(ctx context.Context, lastResults IssueCollection) (result IssueCollection, err error) { - req, err := lastResults.issueCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIIssueClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result IssueCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, expandCommentsAttachments, top, skip) - return -} - -// Update updates an existing issue for an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIIssueClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIIssueClient) 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 APIIssueClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissueattachment.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissueattachment.go deleted file mode 100644 index f24681607fd8..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissueattachment.go +++ /dev/null @@ -1,616 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIIssueAttachmentClient is the apiManagement Client -type APIIssueAttachmentClient struct { - BaseClient -} - -// NewAPIIssueAttachmentClient creates an instance of the APIIssueAttachmentClient client. -func NewAPIIssueAttachmentClient(subscriptionID string) APIIssueAttachmentClient { - return NewAPIIssueAttachmentClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIIssueAttachmentClientWithBaseURI creates an instance of the APIIssueAttachmentClient 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 NewAPIIssueAttachmentClientWithBaseURI(baseURI string, subscriptionID string) APIIssueAttachmentClient { - return APIIssueAttachmentClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Attachment for the Issue in an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIIssueAttachmentClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, parameters IssueAttachmentContract, ifMatch string) (result IssueAttachmentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IssueAttachmentContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IssueAttachmentContractProperties.Title", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueAttachmentContractProperties.ContentFormat", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueAttachmentContractProperties.Content", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIIssueAttachmentClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, parameters IssueAttachmentContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) 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 APIIssueAttachmentClient) CreateOrUpdateResponder(resp *http.Response) (result IssueAttachmentContract, 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 specified comment from an Issue. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueAttachmentClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIIssueAttachmentClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIIssueAttachmentClient) 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 APIIssueAttachmentClient) 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 details of the issue Attachment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueAttachmentClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result IssueAttachmentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIIssueAttachmentClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", 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 APIIssueAttachmentClient) 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 APIIssueAttachmentClient) GetResponder(resp *http.Response) (result IssueAttachmentContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueAttachmentClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIIssueAttachmentClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIIssueAttachmentClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all attachments for the Issue associated with the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client APIIssueAttachmentClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueAttachmentCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.ListByService") - defer func() { - sc := -1 - if result.iac.Response.Response != nil { - sc = result.iac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.iac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "ListByService", resp, "Failure sending request") - return - } - - result.iac, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "ListByService", resp, "Failure responding to request") - return - } - if result.iac.hasNextLink() && result.iac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIIssueAttachmentClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIIssueAttachmentClient) ListByServiceResponder(resp *http.Response) (result IssueAttachmentCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIIssueAttachmentClient) listByServiceNextResults(ctx context.Context, lastResults IssueAttachmentCollection) (result IssueAttachmentCollection, err error) { - req, err := lastResults.issueAttachmentCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIIssueAttachmentClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueAttachmentCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissuecomment.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissuecomment.go deleted file mode 100644 index a5ce99c55159..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiissuecomment.go +++ /dev/null @@ -1,614 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIIssueCommentClient is the apiManagement Client -type APIIssueCommentClient struct { - BaseClient -} - -// NewAPIIssueCommentClient creates an instance of the APIIssueCommentClient client. -func NewAPIIssueCommentClient(subscriptionID string) APIIssueCommentClient { - return NewAPIIssueCommentClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIIssueCommentClientWithBaseURI creates an instance of the APIIssueCommentClient 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 NewAPIIssueCommentClientWithBaseURI(baseURI string, subscriptionID string) APIIssueCommentClient { - return APIIssueCommentClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Comment for the Issue in an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIIssueCommentClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, parameters IssueCommentContract, ifMatch string) (result IssueCommentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IssueCommentContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IssueCommentContractProperties.Text", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueCommentContractProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIIssueCommentClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, parameters IssueCommentContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) 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 APIIssueCommentClient) CreateOrUpdateResponder(resp *http.Response) (result IssueCommentContract, 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 specified comment from an Issue. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueCommentClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIIssueCommentClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIIssueCommentClient) 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 APIIssueCommentClient) 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 details of the issue Comment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueCommentClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result IssueCommentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIIssueCommentClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", 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 APIIssueCommentClient) 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 APIIssueCommentClient) GetResponder(resp *http.Response) (result IssueCommentContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueCommentClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIIssueCommentClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIIssueCommentClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all comments for the Issue associated with the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client APIIssueCommentClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueCommentCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.ListByService") - defer func() { - sc := -1 - if result.icc.Response.Response != nil { - sc = result.icc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.icc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "ListByService", resp, "Failure sending request") - return - } - - result.icc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "ListByService", resp, "Failure responding to request") - return - } - if result.icc.hasNextLink() && result.icc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIIssueCommentClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIIssueCommentClient) ListByServiceResponder(resp *http.Response) (result IssueCommentCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIIssueCommentClient) listByServiceNextResults(ctx context.Context, lastResults IssueCommentCollection) (result IssueCommentCollection, err error) { - req, err := lastResults.issueCommentCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIIssueCommentClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueCommentCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apimanagementapi/interfaces.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apimanagementapi/interfaces.go deleted file mode 100644 index f724dab1f012..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apimanagementapi/interfaces.go +++ /dev/null @@ -1,711 +0,0 @@ -package apimanagementapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/apimanagement/mgmt/2018-06-01-preview/apimanagement" - "github.com/Azure/go-autorest/autorest" -) - -// APIClientAPI contains the set of methods on the APIClient type. -type APIClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters apimanagement.APICreateOrUpdateParameter, ifMatch string) (result apimanagement.APICreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string, deleteRevisions *bool) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result apimanagement.APIContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result apimanagement.APICollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result apimanagement.APICollectionIterator, err error) - ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result apimanagement.TagResourceCollectionPage, err error) - ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result apimanagement.TagResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters apimanagement.APIUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIClientAPI = (*apimanagement.APIClient)(nil) - -// APIRevisionsClientAPI contains the set of methods on the APIRevisionsClient type. -type APIRevisionsClientAPI interface { - List(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.APIRevisionCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.APIRevisionCollectionIterator, err error) -} - -var _ APIRevisionsClientAPI = (*apimanagement.APIRevisionsClient)(nil) - -// APIReleaseClientAPI contains the set of methods on the APIReleaseClient type. -type APIReleaseClientAPI interface { - Create(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters apimanagement.APIReleaseContract, ifMatch string) (result apimanagement.APIReleaseContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result apimanagement.APIReleaseContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result autorest.Response, err error) - List(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.APIReleaseCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.APIReleaseCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters apimanagement.APIReleaseContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIReleaseClientAPI = (*apimanagement.APIReleaseClient)(nil) - -// APIOperationClientAPI contains the set of methods on the APIOperationClient type. -type APIOperationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters apimanagement.OperationContract, ifMatch string) (result apimanagement.OperationContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result apimanagement.OperationContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result apimanagement.OperationCollectionPage, err error) - ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result apimanagement.OperationCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters apimanagement.OperationUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIOperationClientAPI = (*apimanagement.APIOperationClient)(nil) - -// APIOperationPolicyClientAPI contains the set of methods on the APIOperationPolicyClient type. -type APIOperationPolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters apimanagement.PolicyContract, ifMatch string) (result apimanagement.PolicyContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result apimanagement.PolicyContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) - ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result apimanagement.PolicyCollection, err error) -} - -var _ APIOperationPolicyClientAPI = (*apimanagement.APIOperationPolicyClient)(nil) - -// TagClientAPI contains the set of methods on the TagClient type. -type TagClientAPI interface { - AssignToAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result apimanagement.TagContract, err error) - AssignToOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result apimanagement.TagContract, err error) - AssignToProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result apimanagement.TagContract, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters apimanagement.TagCreateUpdateParameters, ifMatch string) (result apimanagement.TagContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, tagID string, ifMatch string) (result autorest.Response, err error) - DetachFromAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) - DetachFromOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) - DetachFromProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result apimanagement.TagContract, err error) - GetByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result apimanagement.TagContract, err error) - GetByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result apimanagement.TagContract, err error) - GetByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result apimanagement.TagContract, err error) - GetEntityState(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result autorest.Response, err error) - GetEntityStateByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) - GetEntityStateByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) - GetEntityStateByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionPage, err error) - ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionIterator, err error) - ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionPage, err error) - ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionIterator, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionPage, err error) - ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionIterator, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result apimanagement.TagCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result apimanagement.TagCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters apimanagement.TagCreateUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ TagClientAPI = (*apimanagement.TagClient)(nil) - -// APIProductClientAPI contains the set of methods on the APIProductClient type. -type APIProductClientAPI interface { - ListByApis(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.ProductCollectionPage, err error) - ListByApisComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.ProductCollectionIterator, err error) -} - -var _ APIProductClientAPI = (*apimanagement.APIProductClient)(nil) - -// APIPolicyClientAPI contains the set of methods on the APIPolicyClient type. -type APIPolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters apimanagement.PolicyContract, ifMatch string) (result apimanagement.PolicyContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result apimanagement.PolicyContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result apimanagement.PolicyCollection, err error) -} - -var _ APIPolicyClientAPI = (*apimanagement.APIPolicyClient)(nil) - -// APISchemaClientAPI contains the set of methods on the APISchemaClient type. -type APISchemaClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters apimanagement.SchemaContract, ifMatch string) (result apimanagement.SchemaContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, ifMatch string, force *bool) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result apimanagement.SchemaContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result autorest.Response, err error) - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.SchemaCollectionPage, err error) - ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.SchemaCollectionIterator, err error) -} - -var _ APISchemaClientAPI = (*apimanagement.APISchemaClient)(nil) - -// APIDiagnosticClientAPI contains the set of methods on the APIDiagnosticClient type. -type APIDiagnosticClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters apimanagement.DiagnosticContract, ifMatch string) (result apimanagement.DiagnosticContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result apimanagement.DiagnosticContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.DiagnosticCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.DiagnosticCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters apimanagement.DiagnosticContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIDiagnosticClientAPI = (*apimanagement.APIDiagnosticClient)(nil) - -// APIIssueClientAPI contains the set of methods on the APIIssueClient type. -type APIIssueClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters apimanagement.IssueContract, ifMatch string) (result apimanagement.IssueContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, expandCommentsAttachments *bool) (result apimanagement.IssueContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result apimanagement.IssueCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result apimanagement.IssueCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters apimanagement.IssueUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIIssueClientAPI = (*apimanagement.APIIssueClient)(nil) - -// APIIssueCommentClientAPI contains the set of methods on the APIIssueCommentClient type. -type APIIssueCommentClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, parameters apimanagement.IssueCommentContract, ifMatch string) (result apimanagement.IssueCommentContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result apimanagement.IssueCommentContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result apimanagement.IssueCommentCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result apimanagement.IssueCommentCollectionIterator, err error) -} - -var _ APIIssueCommentClientAPI = (*apimanagement.APIIssueCommentClient)(nil) - -// APIIssueAttachmentClientAPI contains the set of methods on the APIIssueAttachmentClient type. -type APIIssueAttachmentClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, parameters apimanagement.IssueAttachmentContract, ifMatch string) (result apimanagement.IssueAttachmentContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result apimanagement.IssueAttachmentContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result apimanagement.IssueAttachmentCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result apimanagement.IssueAttachmentCollectionIterator, err error) -} - -var _ APIIssueAttachmentClientAPI = (*apimanagement.APIIssueAttachmentClient)(nil) - -// TagDescriptionClientAPI contains the set of methods on the TagDescriptionClient type. -type TagDescriptionClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string, parameters apimanagement.TagDescriptionCreateParameters, ifMatch string) (result apimanagement.TagDescriptionContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result apimanagement.TagDescriptionContract, err error) - GetEntityState(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.TagDescriptionCollectionPage, err error) - ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.TagDescriptionCollectionIterator, err error) -} - -var _ TagDescriptionClientAPI = (*apimanagement.TagDescriptionClient)(nil) - -// OperationClientAPI contains the set of methods on the OperationClient type. -type OperationClientAPI interface { - ListByTags(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result apimanagement.TagResourceCollectionPage, err error) - ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result apimanagement.TagResourceCollectionIterator, err error) -} - -var _ OperationClientAPI = (*apimanagement.OperationClient)(nil) - -// AuthorizationServerClientAPI contains the set of methods on the AuthorizationServerClient type. -type AuthorizationServerClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters apimanagement.AuthorizationServerContract, ifMatch string) (result apimanagement.AuthorizationServerContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, authsid string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result apimanagement.AuthorizationServerContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.AuthorizationServerCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.AuthorizationServerCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters apimanagement.AuthorizationServerUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ AuthorizationServerClientAPI = (*apimanagement.AuthorizationServerClient)(nil) - -// BackendClientAPI contains the set of methods on the BackendClient type. -type BackendClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters apimanagement.BackendContract, ifMatch string) (result apimanagement.BackendContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, backendID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result apimanagement.BackendContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.BackendCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.BackendCollectionIterator, err error) - Reconnect(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters *apimanagement.BackendReconnectContract) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters apimanagement.BackendUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ BackendClientAPI = (*apimanagement.BackendClient)(nil) - -// CacheClientAPI contains the set of methods on the CacheClient type. -type CacheClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters apimanagement.CacheContract, ifMatch string) (result apimanagement.CacheContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result apimanagement.CacheContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.CacheCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.CacheCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters apimanagement.CacheUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ CacheClientAPI = (*apimanagement.CacheClient)(nil) - -// CertificateClientAPI contains the set of methods on the CertificateClient type. -type CertificateClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, parameters apimanagement.CertificateCreateOrUpdateParameters, ifMatch string) (result apimanagement.CertificateContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result apimanagement.CertificateContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.CertificateCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.CertificateCollectionIterator, err error) -} - -var _ CertificateClientAPI = (*apimanagement.CertificateClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result apimanagement.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result apimanagement.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*apimanagement.OperationsClient)(nil) - -// ServiceSkusClientAPI contains the set of methods on the ServiceSkusClient type. -type ServiceSkusClientAPI interface { - ListAvailableServiceSkus(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ResourceSkuResultsPage, err error) - ListAvailableServiceSkusComplete(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ResourceSkuResultsIterator, err error) -} - -var _ ServiceSkusClientAPI = (*apimanagement.ServiceSkusClient)(nil) - -// ServiceClientAPI contains the set of methods on the ServiceClient type. -type ServiceClientAPI interface { - ApplyNetworkConfigurationUpdates(ctx context.Context, resourceGroupName string, serviceName string, parameters *apimanagement.ServiceApplyNetworkConfigurationParameters) (result apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture, err error) - Backup(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceBackupRestoreParameters) (result apimanagement.ServiceBackupFuture, err error) - CheckNameAvailability(ctx context.Context, parameters apimanagement.ServiceCheckNameAvailabilityParameters) (result apimanagement.ServiceNameAvailabilityResult, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceResource) (result apimanagement.ServiceCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ServiceDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ServiceResource, err error) - GetSsoToken(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ServiceGetSsoTokenResult, err error) - List(ctx context.Context) (result apimanagement.ServiceListResultPage, err error) - ListComplete(ctx context.Context) (result apimanagement.ServiceListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result apimanagement.ServiceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result apimanagement.ServiceListResultIterator, err error) - Restore(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceBackupRestoreParameters) (result apimanagement.ServiceRestoreFuture, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceUpdateParameters) (result apimanagement.ServiceUpdateFuture, err error) - UpdateHostname(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceUpdateHostnameParameters) (result apimanagement.ServiceUpdateHostnameFuture, err error) - UploadCertificate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceUploadCertificateParameters) (result apimanagement.CertificateInformation, err error) -} - -var _ ServiceClientAPI = (*apimanagement.ServiceClient)(nil) - -// DiagnosticClientAPI contains the set of methods on the DiagnosticClient type. -type DiagnosticClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters apimanagement.DiagnosticContract, ifMatch string) (result apimanagement.DiagnosticContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result apimanagement.DiagnosticContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.DiagnosticCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.DiagnosticCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters apimanagement.DiagnosticContract, ifMatch string) (result autorest.Response, err error) -} - -var _ DiagnosticClientAPI = (*apimanagement.DiagnosticClient)(nil) - -// EmailTemplateClientAPI contains the set of methods on the EmailTemplateClient type. -type EmailTemplateClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName, parameters apimanagement.EmailTemplateUpdateParameters, ifMatch string) (result apimanagement.EmailTemplateContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName) (result apimanagement.EmailTemplateContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.EmailTemplateCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.EmailTemplateCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName, parameters apimanagement.EmailTemplateUpdateParameters) (result autorest.Response, err error) -} - -var _ EmailTemplateClientAPI = (*apimanagement.EmailTemplateClient)(nil) - -// GroupClientAPI contains the set of methods on the GroupClient type. -type GroupClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters apimanagement.GroupCreateParameters, ifMatch string) (result apimanagement.GroupContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result apimanagement.GroupContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters apimanagement.GroupUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ GroupClientAPI = (*apimanagement.GroupClient)(nil) - -// GroupUserClientAPI contains the set of methods on the GroupUserClient type. -type GroupUserClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) - Create(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result apimanagement.UserContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) - List(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result apimanagement.UserCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result apimanagement.UserCollectionIterator, err error) -} - -var _ GroupUserClientAPI = (*apimanagement.GroupUserClient)(nil) - -// IdentityProviderClientAPI contains the set of methods on the IdentityProviderClient type. -type IdentityProviderClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType, parameters apimanagement.IdentityProviderContract, ifMatch string) (result apimanagement.IdentityProviderContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType) (result apimanagement.IdentityProviderContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.IdentityProviderListPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.IdentityProviderListIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType, parameters apimanagement.IdentityProviderUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ IdentityProviderClientAPI = (*apimanagement.IdentityProviderClient)(nil) - -// IssueClientAPI contains the set of methods on the IssueClient type. -type IssueClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string, issueID string) (result apimanagement.IssueContract, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.IssueCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.IssueCollectionIterator, err error) -} - -var _ IssueClientAPI = (*apimanagement.IssueClient)(nil) - -// LoggerClientAPI contains the set of methods on the LoggerClient type. -type LoggerClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters apimanagement.LoggerContract, ifMatch string) (result apimanagement.LoggerContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, ifMatch string, force *bool) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result apimanagement.LoggerContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.LoggerCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.LoggerCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters apimanagement.LoggerUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ LoggerClientAPI = (*apimanagement.LoggerClient)(nil) - -// NotificationClientAPI contains the set of methods on the NotificationClient type. -type NotificationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, ifMatch string) (result apimanagement.NotificationContract, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName) (result apimanagement.NotificationContract, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.NotificationCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.NotificationCollectionIterator, err error) -} - -var _ NotificationClientAPI = (*apimanagement.NotificationClient)(nil) - -// NotificationRecipientUserClientAPI contains the set of methods on the NotificationRecipientUserClient type. -type NotificationRecipientUserClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, userID string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, userID string) (result apimanagement.RecipientUserContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, userID string) (result autorest.Response, err error) - ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName) (result apimanagement.RecipientUserCollection, err error) -} - -var _ NotificationRecipientUserClientAPI = (*apimanagement.NotificationRecipientUserClient)(nil) - -// NotificationRecipientEmailClientAPI contains the set of methods on the NotificationRecipientEmailClient type. -type NotificationRecipientEmailClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, email string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, email string) (result apimanagement.RecipientEmailContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, email string) (result autorest.Response, err error) - ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName) (result apimanagement.RecipientEmailCollection, err error) -} - -var _ NotificationRecipientEmailClientAPI = (*apimanagement.NotificationRecipientEmailClient)(nil) - -// NetworkStatusClientAPI contains the set of methods on the NetworkStatusClient type. -type NetworkStatusClientAPI interface { - ListByLocation(ctx context.Context, resourceGroupName string, serviceName string, locationName string) (result apimanagement.NetworkStatusContract, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ListNetworkStatusContractByLocation, err error) -} - -var _ NetworkStatusClientAPI = (*apimanagement.NetworkStatusClient)(nil) - -// OpenIDConnectProviderClientAPI contains the set of methods on the OpenIDConnectProviderClient type. -type OpenIDConnectProviderClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters apimanagement.OpenidConnectProviderContract, ifMatch string) (result apimanagement.OpenidConnectProviderContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, opid string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result apimanagement.OpenidConnectProviderContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.OpenIDConnectProviderCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.OpenIDConnectProviderCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters apimanagement.OpenidConnectProviderUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ OpenIDConnectProviderClientAPI = (*apimanagement.OpenIDConnectProviderClient)(nil) - -// PolicyClientAPI contains the set of methods on the PolicyClient type. -type PolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PolicyContract, ifMatch string) (result apimanagement.PolicyContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PolicyContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PolicyCollection, err error) -} - -var _ PolicyClientAPI = (*apimanagement.PolicyClient)(nil) - -// PolicySnippetsClientAPI contains the set of methods on the PolicySnippetsClient type. -type PolicySnippetsClientAPI interface { - ListByService(ctx context.Context, resourceGroupName string, serviceName string, scope apimanagement.PolicyScopeContract) (result apimanagement.PolicySnippetsCollection, err error) -} - -var _ PolicySnippetsClientAPI = (*apimanagement.PolicySnippetsClient)(nil) - -// SignInSettingsClientAPI contains the set of methods on the SignInSettingsClient type. -type SignInSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalSigninSettings, ifMatch string) (result apimanagement.PortalSigninSettings, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PortalSigninSettings, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalSigninSettings, ifMatch string) (result autorest.Response, err error) -} - -var _ SignInSettingsClientAPI = (*apimanagement.SignInSettingsClient)(nil) - -// SignUpSettingsClientAPI contains the set of methods on the SignUpSettingsClient type. -type SignUpSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalSignupSettings, ifMatch string) (result apimanagement.PortalSignupSettings, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PortalSignupSettings, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalSignupSettings, ifMatch string) (result autorest.Response, err error) -} - -var _ SignUpSettingsClientAPI = (*apimanagement.SignUpSettingsClient)(nil) - -// DelegationSettingsClientAPI contains the set of methods on the DelegationSettingsClient type. -type DelegationSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalDelegationSettings, ifMatch string) (result apimanagement.PortalDelegationSettings, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PortalDelegationSettings, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalDelegationSettings, ifMatch string) (result autorest.Response, err error) -} - -var _ DelegationSettingsClientAPI = (*apimanagement.DelegationSettingsClient)(nil) - -// ProductClientAPI contains the set of methods on the ProductClient type. -type ProductClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters apimanagement.ProductContract, ifMatch string) (result apimanagement.ProductContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result apimanagement.ProductContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result apimanagement.ProductCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result apimanagement.ProductCollectionIterator, err error) - ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result apimanagement.TagResourceCollectionPage, err error) - ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result apimanagement.TagResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters apimanagement.ProductUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ ProductClientAPI = (*apimanagement.ProductClient)(nil) - -// ProductAPIClientAPI contains the set of methods on the ProductAPIClient type. -type ProductAPIClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result apimanagement.APIContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.APICollectionPage, err error) - ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.APICollectionIterator, err error) -} - -var _ ProductAPIClientAPI = (*apimanagement.ProductAPIClient)(nil) - -// ProductGroupClientAPI contains the set of methods on the ProductGroupClient type. -type ProductGroupClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result apimanagement.GroupContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionPage, err error) - ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionIterator, err error) -} - -var _ ProductGroupClientAPI = (*apimanagement.ProductGroupClient)(nil) - -// ProductSubscriptionsClientAPI contains the set of methods on the ProductSubscriptionsClient type. -type ProductSubscriptionsClientAPI interface { - List(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionIterator, err error) -} - -var _ ProductSubscriptionsClientAPI = (*apimanagement.ProductSubscriptionsClient)(nil) - -// ProductPolicyClientAPI contains the set of methods on the ProductPolicyClient type. -type ProductPolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters apimanagement.PolicyContract, ifMatch string) (result apimanagement.PolicyContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result apimanagement.PolicyContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result apimanagement.PolicyCollection, err error) -} - -var _ ProductPolicyClientAPI = (*apimanagement.ProductPolicyClient)(nil) - -// PropertyClientAPI contains the set of methods on the PropertyClient type. -type PropertyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, propID string, parameters apimanagement.PropertyContract, ifMatch string) (result apimanagement.PropertyContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, propID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, propID string) (result apimanagement.PropertyContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, propID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.PropertyCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.PropertyCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, propID string, parameters apimanagement.PropertyUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ PropertyClientAPI = (*apimanagement.PropertyClient)(nil) - -// QuotaByCounterKeysClientAPI contains the set of methods on the QuotaByCounterKeysClient type. -type QuotaByCounterKeysClientAPI interface { - ListByService(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string) (result apimanagement.QuotaCounterCollection, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, parameters apimanagement.QuotaCounterValueContractProperties) (result autorest.Response, err error) -} - -var _ QuotaByCounterKeysClientAPI = (*apimanagement.QuotaByCounterKeysClient)(nil) - -// QuotaByPeriodKeysClientAPI contains the set of methods on the QuotaByPeriodKeysClient type. -type QuotaByPeriodKeysClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (result apimanagement.QuotaCounterContract, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters apimanagement.QuotaCounterValueContractProperties) (result autorest.Response, err error) -} - -var _ QuotaByPeriodKeysClientAPI = (*apimanagement.QuotaByPeriodKeysClient)(nil) - -// RegionClientAPI contains the set of methods on the RegionClient type. -type RegionClientAPI interface { - ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.RegionListResultPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.RegionListResultIterator, err error) -} - -var _ RegionClientAPI = (*apimanagement.RegionClient)(nil) - -// ReportsClientAPI contains the set of methods on the ReportsClient type. -type ReportsClientAPI interface { - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionPage, err error) - ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionIterator, err error) - ListByGeo(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionPage, err error) - ListByGeoComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionIterator, err error) - ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionPage, err error) - ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionIterator, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionPage, err error) - ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionIterator, err error) - ListByRequest(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.RequestReportCollection, err error) - ListBySubscription(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionIterator, err error) - ListByTime(ctx context.Context, resourceGroupName string, serviceName string, interval string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionPage, err error) - ListByTimeComplete(ctx context.Context, resourceGroupName string, serviceName string, interval string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionIterator, err error) - ListByUser(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionPage, err error) - ListByUserComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionIterator, err error) -} - -var _ ReportsClientAPI = (*apimanagement.ReportsClient)(nil) - -// SubscriptionClientAPI contains the set of methods on the SubscriptionClient type. -type SubscriptionClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters apimanagement.SubscriptionCreateParameters, notify *bool, ifMatch string) (result apimanagement.SubscriptionContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, sid string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result apimanagement.SubscriptionContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) - List(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionIterator, err error) - RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) - RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters apimanagement.SubscriptionUpdateParameters, ifMatch string, notify *bool) (result autorest.Response, err error) -} - -var _ SubscriptionClientAPI = (*apimanagement.SubscriptionClient)(nil) - -// TagResourceClientAPI contains the set of methods on the TagResourceClient type. -type TagResourceClientAPI interface { - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.TagResourceCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.TagResourceCollectionIterator, err error) -} - -var _ TagResourceClientAPI = (*apimanagement.TagResourceClient)(nil) - -// TenantAccessClientAPI contains the set of methods on the TenantAccessClient type. -type TenantAccessClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.AccessInformationContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.AccessInformationUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ TenantAccessClientAPI = (*apimanagement.TenantAccessClient)(nil) - -// TenantAccessGitClientAPI contains the set of methods on the TenantAccessGitClient type. -type TenantAccessGitClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.AccessInformationContract, err error) - RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) -} - -var _ TenantAccessGitClientAPI = (*apimanagement.TenantAccessGitClient)(nil) - -// TenantConfigurationClientAPI contains the set of methods on the TenantConfigurationClient type. -type TenantConfigurationClientAPI interface { - Deploy(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.DeployConfigurationParameters) (result apimanagement.TenantConfigurationDeployFuture, err error) - GetSyncState(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.TenantConfigurationSyncStateContract, err error) - Save(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.SaveConfigurationParameter) (result apimanagement.TenantConfigurationSaveFuture, err error) - Validate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.DeployConfigurationParameters) (result apimanagement.TenantConfigurationValidateFuture, err error) -} - -var _ TenantConfigurationClientAPI = (*apimanagement.TenantConfigurationClient)(nil) - -// UserClientAPI contains the set of methods on the UserClient type. -type UserClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters apimanagement.UserCreateParameters, ifMatch string) (result apimanagement.UserContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, userID string, ifMatch string, deleteSubscriptions *bool, notify *bool) (result autorest.Response, err error) - GenerateSsoURL(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result apimanagement.GenerateSsoURLResult, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result apimanagement.UserContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result autorest.Response, err error) - GetSharedAccessToken(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters apimanagement.UserTokenParameters) (result apimanagement.UserTokenResult, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result apimanagement.UserCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result apimanagement.UserCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters apimanagement.UserUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ UserClientAPI = (*apimanagement.UserClient)(nil) - -// UserGroupClientAPI contains the set of methods on the UserGroupClient type. -type UserGroupClientAPI interface { - List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionIterator, err error) -} - -var _ UserGroupClientAPI = (*apimanagement.UserGroupClient)(nil) - -// UserSubscriptionClientAPI contains the set of methods on the UserSubscriptionClient type. -type UserSubscriptionClientAPI interface { - List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionIterator, err error) -} - -var _ UserSubscriptionClientAPI = (*apimanagement.UserSubscriptionClient)(nil) - -// UserIdentitiesClientAPI contains the set of methods on the UserIdentitiesClient type. -type UserIdentitiesClientAPI interface { - List(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result apimanagement.UserIdentityCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result apimanagement.UserIdentityCollectionIterator, err error) -} - -var _ UserIdentitiesClientAPI = (*apimanagement.UserIdentitiesClient)(nil) - -// UserConfirmationPasswordClientAPI contains the set of methods on the UserConfirmationPasswordClient type. -type UserConfirmationPasswordClientAPI interface { - SendMethod(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result autorest.Response, err error) -} - -var _ UserConfirmationPasswordClientAPI = (*apimanagement.UserConfirmationPasswordClient)(nil) - -// APIVersionSetClientAPI contains the set of methods on the APIVersionSetClient type. -type APIVersionSetClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters apimanagement.APIVersionSetContract, ifMatch string) (result apimanagement.APIVersionSetContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result apimanagement.APIVersionSetContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.APIVersionSetCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.APIVersionSetCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters apimanagement.APIVersionSetUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ APIVersionSetClientAPI = (*apimanagement.APIVersionSetClient)(nil) - -// APIExportClientAPI contains the set of methods on the APIExportClient type. -type APIExportClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter apimanagement.ExportFormat) (result apimanagement.APIExportResult, err error) -} - -var _ APIExportClientAPI = (*apimanagement.APIExportClient)(nil) diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apioperation.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apioperation.go deleted file mode 100644 index 8c1880bc28f8..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apioperation.go +++ /dev/null @@ -1,709 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIOperationClient is the apiManagement Client -type APIOperationClient struct { - BaseClient -} - -// NewAPIOperationClient creates an instance of the APIOperationClient client. -func NewAPIOperationClient(subscriptionID string) APIOperationClient { - return NewAPIOperationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIOperationClientWithBaseURI creates an instance of the APIOperationClient 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 NewAPIOperationClientWithBaseURI(baseURI string, subscriptionID string) APIOperationClient { - return APIOperationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new operation in the API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIOperationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationContract, ifMatch string) (result OperationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.OperationContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.OperationContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.OperationContractProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.OperationContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.OperationContractProperties.Method", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.OperationContractProperties.URLTemplate", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.OperationContractProperties.URLTemplate", Name: validation.MaxLength, Rule: 1000, Chain: nil}, - {Target: "parameters.OperationContractProperties.URLTemplate", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIOperationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) 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 APIOperationClient) CreateOrUpdateResponder(resp *http.Response) (result OperationContract, 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 specified operation in the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIOperationClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIOperationClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIOperationClient) 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 APIOperationClient) 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 details of the API Operation specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result OperationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIOperationClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{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 APIOperationClient) 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 APIOperationClient) GetResponder(resp *http.Response) (result OperationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API operation specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIOperationClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIOperationClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI lists a collection of the operations for the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |method | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |urlTemplate | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client APIOperationClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result OperationCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.ListByAPI") - defer func() { - sc := -1 - if result.oc.Response.Response != nil { - sc = result.oc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, tags) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.oc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.oc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.oc.hasNextLink() && result.oc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client APIOperationClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if 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.ApiManagement/service/{serviceName}/apis/{apiId}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client APIOperationClient) ListByAPIResponder(resp *http.Response) (result OperationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client APIOperationClient) listByAPINextResults(ctx context.Context, lastResults OperationCollection) (result OperationCollection, err error) { - req, err := lastResults.operationCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIOperationClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result OperationCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.ListByAPI") - 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.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, tags) - return -} - -// Update updates the details of the operation in the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// parameters - API Operation Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIOperationClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIOperationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIOperationClient) 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 APIOperationClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apioperationpolicy.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apioperationpolicy.go deleted file mode 100644 index 5d284283050e..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apioperationpolicy.go +++ /dev/null @@ -1,539 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIOperationPolicyClient is the apiManagement Client -type APIOperationPolicyClient struct { - BaseClient -} - -// NewAPIOperationPolicyClient creates an instance of the APIOperationPolicyClient client. -func NewAPIOperationPolicyClient(subscriptionID string) APIOperationPolicyClient { - return NewAPIOperationPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIOperationPolicyClientWithBaseURI creates an instance of the APIOperationPolicyClient 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 NewAPIOperationPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIOperationPolicyClient { - return APIOperationPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the API Operation level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIOperationPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.PolicyContent", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIOperationPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) 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 APIOperationPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, 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 policy configuration at the Api Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIOperationPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIOperationPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIOperationPolicyClient) 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 APIOperationPolicyClient) 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 the policy configuration at the API Operation level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIOperationPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", 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 APIOperationPolicyClient) 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 APIOperationPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API operation policy specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIOperationPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIOperationPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByOperation get the list of policy configuration at the API Operation level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationPolicyClient) ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.ListByOperation") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "ListByOperation", err.Error()) - } - - req, err := client.ListByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "ListByOperation", resp, "Failure sending request") - return - } - - result, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "ListByOperation", resp, "Failure responding to request") - return - } - - return -} - -// ListByOperationPreparer prepares the ListByOperation request. -func (client APIOperationPolicyClient) ListByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByOperationSender sends the ListByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) ListByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByOperationResponder handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (client APIOperationPolicyClient) ListByOperationResponder(resp *http.Response) (result PolicyCollection, 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/apimanagement/mgmt/2018-06-01-preview/apimanagement/apipolicy.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apipolicy.go deleted file mode 100644 index 5501ea91f50b..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apipolicy.go +++ /dev/null @@ -1,503 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIPolicyClient is the apiManagement Client -type APIPolicyClient struct { - BaseClient -} - -// NewAPIPolicyClient creates an instance of the APIPolicyClient client. -func NewAPIPolicyClient(subscriptionID string) APIPolicyClient { - return NewAPIPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIPolicyClientWithBaseURI creates an instance of the APIPolicyClient 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 NewAPIPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIPolicyClient { - return APIPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.PolicyContent", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) 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 APIPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, 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 policy configuration at the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIPolicyClient) 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 APIPolicyClient) 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 the policy configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", 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 APIPolicyClient) 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 APIPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API policy specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI get the policy configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIPolicyClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.ListByAPI") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "ListByAPI", err.Error()) - } - - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "ListByAPI", resp, "Failure sending request") - return - } - - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "ListByAPI", resp, "Failure responding to request") - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client APIPolicyClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) ListByAPIResponder(resp *http.Response) (result PolicyCollection, 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/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiproduct.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiproduct.go deleted file mode 100644 index b67693d5c0a9..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiproduct.go +++ /dev/null @@ -1,185 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIProductClient is the apiManagement Client -type APIProductClient struct { - BaseClient -} - -// NewAPIProductClient creates an instance of the APIProductClient client. -func NewAPIProductClient(subscriptionID string) APIProductClient { - return NewAPIProductClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIProductClientWithBaseURI creates an instance of the APIProductClient 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 NewAPIProductClientWithBaseURI(baseURI string, subscriptionID string) APIProductClient { - return APIProductClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByApis lists all Products, which the API is part of. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client APIProductClient) ListByApis(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result ProductCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIProductClient.ListByApis") - defer func() { - sc := -1 - if result.pc.Response.Response != nil { - sc = result.pc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIProductClient", "ListByApis", err.Error()) - } - - result.fn = client.listByApisNextResults - req, err := client.ListByApisPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "ListByApis", nil, "Failure preparing request") - return - } - - resp, err := client.ListByApisSender(req) - if err != nil { - result.pc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "ListByApis", resp, "Failure sending request") - return - } - - result.pc, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "ListByApis", resp, "Failure responding to request") - return - } - if result.pc.hasNextLink() && result.pc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByApisPreparer prepares the ListByApis request. -func (client APIProductClient) ListByApisPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/products", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByApisSender sends the ListByApis request. The method will close the -// http.Response Body if it receives an error. -func (client APIProductClient) ListByApisSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByApisResponder handles the response to the ListByApis request. The method always -// closes the http.Response Body. -func (client APIProductClient) ListByApisResponder(resp *http.Response) (result ProductCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByApisNextResults retrieves the next set of results, if any. -func (client APIProductClient) listByApisNextResults(ctx context.Context, lastResults ProductCollection) (result ProductCollection, err error) { - req, err := lastResults.productCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "listByApisNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByApisSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "listByApisNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "listByApisNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByApisComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIProductClient) ListByApisComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result ProductCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIProductClient.ListByApis") - 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.ListByApis(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apirelease.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apirelease.go deleted file mode 100644 index af205540ca80..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apirelease.go +++ /dev/null @@ -1,681 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIReleaseClient is the apiManagement Client -type APIReleaseClient struct { - BaseClient -} - -// NewAPIReleaseClient creates an instance of the APIReleaseClient client. -func NewAPIReleaseClient(subscriptionID string) APIReleaseClient { - return NewAPIReleaseClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIReleaseClientWithBaseURI creates an instance of the APIReleaseClient 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 NewAPIReleaseClientWithBaseURI(baseURI string, subscriptionID string) APIReleaseClient { - return APIReleaseClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new Release for the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIReleaseClient) Create(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (result APIReleaseContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serviceName, apiid, releaseID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client APIReleaseClient) CreatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", 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)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) 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 APIReleaseClient) CreateResponder(resp *http.Response) (result APIReleaseContract, 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 specified release in the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIReleaseClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, releaseID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIReleaseClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIReleaseClient) 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 APIReleaseClient) 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 details of an API release. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -func (client APIReleaseClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result APIReleaseContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, releaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIReleaseClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", 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 APIReleaseClient) 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 APIReleaseClient) GetResponder(resp *http.Response) (result APIReleaseContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag returns the etag of an API release. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -func (client APIReleaseClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, releaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIReleaseClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIReleaseClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all releases of an API. An API release is created when making an API Revision current. Releases are also -// used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip -// parameters. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |notes | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client APIReleaseClient) List(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIReleaseCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.List") - defer func() { - sc := -1 - if result.arc.Response.Response != nil { - sc = result.arc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.arc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "List", resp, "Failure sending request") - return - } - - result.arc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "List", resp, "Failure responding to request") - return - } - if result.arc.hasNextLink() && result.arc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client APIReleaseClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/releases", 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 APIReleaseClient) 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 APIReleaseClient) ListResponder(resp *http.Response) (result APIReleaseCollection, 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 APIReleaseClient) listNextResults(ctx context.Context, lastResults APIReleaseCollection) (result APIReleaseCollection, err error) { - req, err := lastResults.aPIReleaseCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "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, "apimanagement.APIReleaseClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIReleaseClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIReleaseCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.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, serviceName, apiid, filter, top, skip) - return -} - -// Update updates the details of the release of the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -// parameters - API Release Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIReleaseClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, releaseID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIReleaseClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIReleaseClient) 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 APIReleaseClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apirevisions.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apirevisions.go deleted file mode 100644 index a8f4b3554079..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apirevisions.go +++ /dev/null @@ -1,185 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIRevisionsClient is the apiManagement Client -type APIRevisionsClient struct { - BaseClient -} - -// NewAPIRevisionsClient creates an instance of the APIRevisionsClient client. -func NewAPIRevisionsClient(subscriptionID string) APIRevisionsClient { - return NewAPIRevisionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIRevisionsClientWithBaseURI creates an instance of the APIRevisionsClient 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 NewAPIRevisionsClientWithBaseURI(baseURI string, subscriptionID string) APIRevisionsClient { - return APIRevisionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all revisions of an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |apiRevision | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client APIRevisionsClient) List(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIRevisionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionsClient.List") - defer func() { - sc := -1 - if result.arc.Response.Response != nil { - sc = result.arc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIRevisionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.arc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionsClient", "List", resp, "Failure sending request") - return - } - - result.arc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionsClient", "List", resp, "Failure responding to request") - return - } - if result.arc.hasNextLink() && result.arc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client APIRevisionsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/revisions", 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 APIRevisionsClient) 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 APIRevisionsClient) ListResponder(resp *http.Response) (result APIRevisionCollection, 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 APIRevisionsClient) listNextResults(ctx context.Context, lastResults APIRevisionCollection) (result APIRevisionCollection, err error) { - req, err := lastResults.aPIRevisionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIRevisionsClient", "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, "apimanagement.APIRevisionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIRevisionsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIRevisionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionsClient.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, serviceName, apiid, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apischema.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apischema.go deleted file mode 100644 index 69bb36f082f6..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apischema.go +++ /dev/null @@ -1,590 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APISchemaClient is the apiManagement Client -type APISchemaClient struct { - BaseClient -} - -// NewAPISchemaClient creates an instance of the APISchemaClient client. -func NewAPISchemaClient(subscriptionID string) APISchemaClient { - return NewAPISchemaClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPISchemaClientWithBaseURI creates an instance of the APISchemaClient 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 NewAPISchemaClientWithBaseURI(baseURI string, subscriptionID string) APISchemaClient { - return APISchemaClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates schema configuration for the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -// parameters - the schema contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APISchemaClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaContract, ifMatch string) (result SchemaContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SchemaContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SchemaContractProperties.ContentType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, schemaID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APISchemaClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) 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 APISchemaClient) CreateOrUpdateResponder(resp *http.Response) (result SchemaContract, 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 schema configuration at the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// force - if true removes all references to the schema before deleting it. -func (client APISchemaClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, ifMatch string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, schemaID, ifMatch, force) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APISchemaClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, ifMatch string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APISchemaClient) 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 APISchemaClient) 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 the schema configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -func (client APISchemaClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result SchemaContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, schemaID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APISchemaClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", 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 APISchemaClient) 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 APISchemaClient) GetResponder(resp *http.Response) (result SchemaContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the schema specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -func (client APISchemaClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, schemaID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APISchemaClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APISchemaClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI get the schema configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |contentType | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client APISchemaClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result SchemaCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.ListByAPI") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.sc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client APISchemaClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/schemas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client APISchemaClient) ListByAPIResponder(resp *http.Response) (result SchemaCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client APISchemaClient) listByAPINextResults(ctx context.Context, lastResults SchemaCollection) (result SchemaCollection, err error) { - req, err := lastResults.schemaCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client APISchemaClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result SchemaCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.ListByAPI") - 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.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiversionset.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiversionset.go deleted file mode 100644 index bec1f571b2e7..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/apiversionset.go +++ /dev/null @@ -1,648 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIVersionSetClient is the apiManagement Client -type APIVersionSetClient struct { - BaseClient -} - -// NewAPIVersionSetClient creates an instance of the APIVersionSetClient client. -func NewAPIVersionSetClient(subscriptionID string) APIVersionSetClient { - return NewAPIVersionSetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIVersionSetClientWithBaseURI creates an instance of the APIVersionSetClient 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 NewAPIVersionSetClientWithBaseURI(baseURI string, subscriptionID string) APIVersionSetClient { - return APIVersionSetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a Api Version Set. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIVersionSetClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetContract, ifMatch string) (result APIVersionSetContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.APIVersionSetContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.APIVersionSetContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.APIVersionSetContractProperties.DisplayName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.APIVersionSetContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, versionSetID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIVersionSetClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/api-version-sets/{versionSetId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) 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 APIVersionSetClient) CreateOrUpdateResponder(resp *http.Response) (result APIVersionSetContract, 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 specific Api Version Set. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIVersionSetClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, versionSetID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIVersionSetClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/api-version-sets/{versionSetId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIVersionSetClient) 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 APIVersionSetClient) 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 details of the Api Version Set specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -func (client APIVersionSetClient) Get(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result APIVersionSetContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, versionSetID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIVersionSetClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/api-version-sets/{versionSetId}", 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 APIVersionSetClient) 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 APIVersionSetClient) GetResponder(resp *http.Response) (result APIVersionSetContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Api Version Set specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -func (client APIVersionSetClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, versionSetID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIVersionSetClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/api-version-sets/{versionSetId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of API Version Sets in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// top - number of records to return. -// skip - number of records to skip. -func (client APIVersionSetClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result APIVersionSetCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.ListByService") - defer func() { - sc := -1 - if result.avsc.Response.Response != nil { - sc = result.avsc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.avsc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "ListByService", resp, "Failure sending request") - return - } - - result.avsc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "ListByService", resp, "Failure responding to request") - return - } - if result.avsc.hasNextLink() && result.avsc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIVersionSetClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/api-version-sets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) ListByServiceResponder(resp *http.Response) (result APIVersionSetCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIVersionSetClient) listByServiceNextResults(ctx context.Context, lastResults APIVersionSetCollection) (result APIVersionSetCollection, err error) { - req, err := lastResults.aPIVersionSetCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIVersionSetClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result APIVersionSetCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the Api VersionSet specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIVersionSetClient) Update(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, versionSetID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIVersionSetClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/api-version-sets/{versionSetId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIVersionSetClient) 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 APIVersionSetClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/authorizationserver.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/authorizationserver.go deleted file mode 100644 index a937d4240fc9..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/authorizationserver.go +++ /dev/null @@ -1,656 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AuthorizationServerClient is the apiManagement Client -type AuthorizationServerClient struct { - BaseClient -} - -// NewAuthorizationServerClient creates an instance of the AuthorizationServerClient client. -func NewAuthorizationServerClient(subscriptionID string) AuthorizationServerClient { - return NewAuthorizationServerClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAuthorizationServerClientWithBaseURI creates an instance of the AuthorizationServerClient 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 NewAuthorizationServerClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationServerClient { - return AuthorizationServerClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates new authorization server or updates an existing authorization server. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client AuthorizationServerClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerContract, ifMatch string) (result AuthorizationServerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AuthorizationServerContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationServerContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationServerContractProperties.DisplayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.AuthorizationServerContractProperties.ClientRegistrationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.AuthorizationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.GrantTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.ClientID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, authsid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AuthorizationServerClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) 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 AuthorizationServerClient) CreateOrUpdateResponder(resp *http.Response) (result AuthorizationServerContract, 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 specific authorization server instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client AuthorizationServerClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, authsid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, authsid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AuthorizationServerClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 AuthorizationServerClient) 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 AuthorizationServerClient) 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 details of the authorization server specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -func (client AuthorizationServerClient) Get(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result AuthorizationServerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, authsid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AuthorizationServerClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", 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 AuthorizationServerClient) 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 AuthorizationServerClient) GetResponder(resp *http.Response) (result AuthorizationServerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the authorizationServer specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -func (client AuthorizationServerClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, authsid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client AuthorizationServerClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of authorization servers defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client AuthorizationServerClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result AuthorizationServerCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.ListByService") - defer func() { - sc := -1 - if result.asc.Response.Response != nil { - sc = result.asc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.asc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListByService", resp, "Failure sending request") - return - } - - result.asc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListByService", resp, "Failure responding to request") - return - } - if result.asc.hasNextLink() && result.asc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client AuthorizationServerClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/authorizationServers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) ListByServiceResponder(resp *http.Response) (result AuthorizationServerCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client AuthorizationServerClient) listByServiceNextResults(ctx context.Context, lastResults AuthorizationServerCollection) (result AuthorizationServerCollection, err error) { - req, err := lastResults.authorizationServerCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client AuthorizationServerClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result AuthorizationServerCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the authorization server specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -// parameters - oAuth2 Server settings Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client AuthorizationServerClient) Update(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, authsid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AuthorizationServerClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 AuthorizationServerClient) 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 AuthorizationServerClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/backend.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/backend.go deleted file mode 100644 index 40716b3020af..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/backend.go +++ /dev/null @@ -1,748 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BackendClient is the apiManagement Client -type BackendClient struct { - BaseClient -} - -// NewBackendClient creates an instance of the BackendClient client. -func NewBackendClient(subscriptionID string) BackendClient { - return NewBackendClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackendClientWithBaseURI creates an instance of the BackendClient 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 NewBackendClientWithBaseURI(baseURI string, subscriptionID string) BackendClient { - return BackendClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client BackendClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendContract, ifMatch string) (result BackendContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.BackendContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.BackendContractProperties.URL", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.BackendContractProperties.URL", Name: validation.MaxLength, Rule: 2000, Chain: nil}, - {Target: "parameters.BackendContractProperties.URL", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, backendID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackendClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/backends/{backendId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) 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 BackendClient) CreateOrUpdateResponder(resp *http.Response) (result BackendContract, 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 specified backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client BackendClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, backendID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, backendID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackendClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 BackendClient) 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 BackendClient) 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 details of the backend specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -func (client BackendClient) Get(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result BackendContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, backendID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackendClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/backends/{backendId}", 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 BackendClient) 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 BackendClient) GetResponder(resp *http.Response) (result BackendContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the backend specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -func (client BackendClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, backendID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client BackendClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client BackendClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of backends in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |title | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |url | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client BackendClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result BackendCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.ListByService") - defer func() { - sc := -1 - if result.bc.Response.Response != nil { - sc = result.bc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.bc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "ListByService", resp, "Failure sending request") - return - } - - result.bc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "ListByService", resp, "Failure responding to request") - return - } - if result.bc.hasNextLink() && result.bc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client BackendClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/backends", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client BackendClient) ListByServiceResponder(resp *http.Response) (result BackendCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client BackendClient) listByServiceNextResults(ctx context.Context, lastResults BackendCollection) (result BackendCollection, err error) { - req, err := lastResults.backendCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.BackendClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.BackendClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client BackendClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result BackendCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Reconnect notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no -// timeout was specified, timeout of 2 minutes is used. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// parameters - reconnect request parameters. -func (client BackendClient) Reconnect(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters *BackendReconnectContract) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.Reconnect") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Reconnect", err.Error()) - } - - req, err := client.ReconnectPreparer(ctx, resourceGroupName, serviceName, backendID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Reconnect", nil, "Failure preparing request") - return - } - - resp, err := client.ReconnectSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Reconnect", resp, "Failure sending request") - return - } - - result, err = client.ReconnectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Reconnect", resp, "Failure responding to request") - return - } - - return -} - -// ReconnectPreparer prepares the Reconnect request. -func (client BackendClient) ReconnectPreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters *BackendReconnectContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReconnectSender sends the Reconnect request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) ReconnectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ReconnectResponder handles the response to the Reconnect request. The method always -// closes the http.Response Body. -func (client BackendClient) ReconnectResponder(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 backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client BackendClient) Update(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, backendID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackendClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 BackendClient) 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 BackendClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/cache.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/cache.go deleted file mode 100644 index d2f9e96c9ab4..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/cache.go +++ /dev/null @@ -1,650 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CacheClient is the apiManagement Client -type CacheClient struct { - BaseClient -} - -// NewCacheClient creates an instance of the CacheClient client. -func NewCacheClient(subscriptionID string) CacheClient { - return NewCacheClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCacheClientWithBaseURI creates an instance of the CacheClient 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 NewCacheClientWithBaseURI(baseURI string, subscriptionID string) CacheClient { - return CacheClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an External Cache to be used in Api Management instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -// parameters - create or Update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client CacheClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheContract, ifMatch string) (result CacheContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CacheContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.Description", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - {Target: "parameters.CacheContractProperties.ConnectionString", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.ConnectionString", Name: validation.MaxLength, Rule: 300, Chain: nil}}}, - {Target: "parameters.CacheContractProperties.ResourceID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.ResourceID", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, cacheID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CacheClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/caches/{cacheId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) 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 CacheClient) CreateOrUpdateResponder(resp *http.Response) (result CacheContract, 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 specific Cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client CacheClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, cacheID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CacheClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 CacheClient) 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 CacheClient) 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 details of the Cache specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -func (client CacheClient) Get(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result CacheContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, cacheID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CacheClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/caches/{cacheId}", 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 CacheClient) 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 CacheClient) GetResponder(resp *http.Response) (result CacheContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Cache specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -func (client CacheClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, cacheID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client CacheClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client CacheClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of all external Caches in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// top - number of records to return. -// skip - number of records to skip. -func (client CacheClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result CacheCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.ListByService") - defer func() { - sc := -1 - if result.cc.Response.Response != nil { - sc = result.cc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.cc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "ListByService", resp, "Failure sending request") - return - } - - result.cc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "ListByService", resp, "Failure responding to request") - return - } - if result.cc.hasNextLink() && result.cc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client CacheClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/caches", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client CacheClient) ListByServiceResponder(resp *http.Response) (result CacheCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client CacheClient) listByServiceNextResults(ctx context.Context, lastResults CacheCollection) (result CacheCollection, err error) { - req, err := lastResults.cacheCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.CacheClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.CacheClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client CacheClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result CacheCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, top, skip) - return -} - -// Update updates the details of the cache specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client CacheClient) Update(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, cacheID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CacheClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 CacheClient) 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 CacheClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/certificate.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/certificate.go deleted file mode 100644 index 349c7b3fc69c..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/certificate.go +++ /dev/null @@ -1,560 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 apiManagement 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)} -} - -// CreateOrUpdate creates or updates the certificate being used for authentication with the backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -// parameters - create or Update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client CertificateClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (result CertificateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, 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}, - {Target: "parameters.CertificateCreateOrUpdateProperties.Password", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, certificateID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/certificates/{certificateId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) 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 CertificateClient) CreateOrUpdateResponder(resp *http.Response) (result CertificateContract, 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 specific certificate. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, certificateID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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) (*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 CertificateClient) 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 details of the certificate specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result CertificateContract, 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.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, "apimanagement.CertificateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/certificates/{certificateId}", 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 CertificateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the certificate specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -func (client CertificateClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client CertificateClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client CertificateClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of all certificates in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |subject | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |thumbprint | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |expirationDate | ge, le, eq, ne, gt, lt | | -// top - number of records to return. -// skip - number of records to skip. -func (client CertificateClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result CertificateCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByService") - defer func() { - sc := -1 - if result.cc.Response.Response != nil { - sc = result.cc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.cc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "ListByService", resp, "Failure sending request") - return - } - - result.cc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "ListByService", resp, "Failure responding to request") - return - } - if result.cc.hasNextLink() && result.cc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client CertificateClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client CertificateClient) ListByServiceResponder(resp *http.Response) (result CertificateCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client CertificateClient) listByServiceNextResults(ctx context.Context, lastResults CertificateCollection) (result CertificateCollection, err error) { - req, err := lastResults.certificateCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client CertificateClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result CertificateCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/client.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/client.go deleted file mode 100644 index 816c9c742aa5..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package apimanagement implements the Azure ARM Apimanagement service API version 2018-06-01-preview. -// -// ApiManagement Client -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Apimanagement - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Apimanagement. -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/apimanagement/mgmt/2018-06-01-preview/apimanagement/delegationsettings.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/delegationsettings.go deleted file mode 100644 index 30b422682b6f..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/delegationsettings.go +++ /dev/null @@ -1,381 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DelegationSettingsClient is the apiManagement Client -type DelegationSettingsClient struct { - BaseClient -} - -// NewDelegationSettingsClient creates an instance of the DelegationSettingsClient client. -func NewDelegationSettingsClient(subscriptionID string) DelegationSettingsClient { - return NewDelegationSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDelegationSettingsClientWithBaseURI creates an instance of the DelegationSettingsClient 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 NewDelegationSettingsClientWithBaseURI(baseURI string, subscriptionID string) DelegationSettingsClient { - return DelegationSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update Delegation settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client DelegationSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (result PortalDelegationSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DelegationSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/portalsettings/delegation", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) 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 DelegationSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result PortalDelegationSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get Delegation Settings for the Portal. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client DelegationSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PortalDelegationSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DelegationSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/portalsettings/delegation", 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 DelegationSettingsClient) 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 DelegationSettingsClient) GetResponder(resp *http.Response) (result PortalDelegationSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the DelegationSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client DelegationSettingsClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client DelegationSettingsClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client DelegationSettingsClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update Delegation settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - update Delegation settings. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client DelegationSettingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DelegationSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/portalsettings/delegation", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 DelegationSettingsClient) 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 DelegationSettingsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/diagnostic.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/diagnostic.go deleted file mode 100644 index f16fda4e8e87..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/diagnostic.go +++ /dev/null @@ -1,681 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DiagnosticClient is the apiManagement Client -type DiagnosticClient struct { - BaseClient -} - -// NewDiagnosticClient creates an instance of the DiagnosticClient client. -func NewDiagnosticClient(subscriptionID string) DiagnosticClient { - return NewDiagnosticClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticClientWithBaseURI creates an instance of the DiagnosticClient 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 NewDiagnosticClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticClient { - return DiagnosticClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Diagnostic or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client DiagnosticClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.LoggerID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMaximum, Rule: float64(100), Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) 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 DiagnosticClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticContract, 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 specified Diagnostic. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client DiagnosticClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, diagnosticID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 DiagnosticClient) 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 DiagnosticClient) 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 details of the Diagnostic specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client DiagnosticClient) Get(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", 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 DiagnosticClient) 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 DiagnosticClient) GetResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Diagnostic specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client DiagnosticClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client DiagnosticClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all diagnostics of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client DiagnosticClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result DiagnosticCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.ListByService") - defer func() { - sc := -1 - if result.dc.Response.Response != nil { - sc = result.dc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.dc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "ListByService", resp, "Failure sending request") - return - } - - result.dc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "ListByService", resp, "Failure responding to request") - return - } - if result.dc.hasNextLink() && result.dc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client DiagnosticClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/diagnostics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) ListByServiceResponder(resp *http.Response) (result DiagnosticCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client DiagnosticClient) listByServiceNextResults(ctx context.Context, lastResults DiagnosticCollection) (result DiagnosticCollection, err error) { - req, err := lastResults.diagnosticCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client DiagnosticClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result DiagnosticCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the Diagnostic specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - diagnostic Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client DiagnosticClient) Update(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DiagnosticClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 DiagnosticClient) 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 DiagnosticClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/emailtemplate.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/emailtemplate.go deleted file mode 100644 index 3a95049e4558..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/emailtemplate.go +++ /dev/null @@ -1,629 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EmailTemplateClient is the apiManagement Client -type EmailTemplateClient struct { - BaseClient -} - -// NewEmailTemplateClient creates an instance of the EmailTemplateClient client. -func NewEmailTemplateClient(subscriptionID string) EmailTemplateClient { - return NewEmailTemplateClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEmailTemplateClientWithBaseURI creates an instance of the EmailTemplateClient 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 NewEmailTemplateClientWithBaseURI(baseURI string, subscriptionID string) EmailTemplateClient { - return EmailTemplateClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates an Email Template. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -// parameters - email Template update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client EmailTemplateClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters, ifMatch string) (result EmailTemplateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties.Subject", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties.Subject", Name: validation.MaxLength, Rule: 1000, Chain: nil}, - {Target: "parameters.EmailTemplateUpdateParameterProperties.Subject", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.EmailTemplateUpdateParameterProperties.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties.Body", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, templateName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EmailTemplateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/templates/{templateName}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) 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 EmailTemplateClient) CreateOrUpdateResponder(resp *http.Response) (result EmailTemplateContract, 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 reset the Email Template to default template provided by the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client EmailTemplateClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, templateName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EmailTemplateClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 EmailTemplateClient) 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 EmailTemplateClient) 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 details of the email template specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -func (client EmailTemplateClient) Get(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (result EmailTemplateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, templateName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EmailTemplateClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/templates/{templateName}", 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 EmailTemplateClient) 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 EmailTemplateClient) GetResponder(resp *http.Response) (result EmailTemplateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the email template specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -func (client EmailTemplateClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, templateName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client EmailTemplateClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of properties defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client EmailTemplateClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result EmailTemplateCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.ListByService") - defer func() { - sc := -1 - if result.etc.Response.Response != nil { - sc = result.etc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.etc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "ListByService", resp, "Failure sending request") - return - } - - result.etc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "ListByService", resp, "Failure responding to request") - return - } - if result.etc.hasNextLink() && result.etc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client EmailTemplateClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/templates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) ListByServiceResponder(resp *http.Response) (result EmailTemplateCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client EmailTemplateClient) listByServiceNextResults(ctx context.Context, lastResults EmailTemplateCollection) (result EmailTemplateCollection, err error) { - req, err := lastResults.emailTemplateCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EmailTemplateClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result EmailTemplateCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the specific Email Template. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -// parameters - update parameters. -func (client EmailTemplateClient) Update(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, templateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EmailTemplateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/templates/{templateName}", 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 EmailTemplateClient) 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 EmailTemplateClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/enums.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/enums.go deleted file mode 100644 index f56caabd75fc..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/enums.go +++ /dev/null @@ -1,688 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AlwaysLog enumerates the values for always log. -type AlwaysLog string - -const ( - // AllErrors Always log all erroneous request regardless of sampling settings. - AllErrors AlwaysLog = "allErrors" -) - -// PossibleAlwaysLogValues returns an array of possible values for the AlwaysLog const type. -func PossibleAlwaysLogValues() []AlwaysLog { - return []AlwaysLog{AllErrors} -} - -// APIType enumerates the values for api type. -type APIType string - -const ( - // HTTP ... - HTTP APIType = "http" - // Soap ... - Soap APIType = "soap" -) - -// PossibleAPITypeValues returns an array of possible values for the APIType const type. -func PossibleAPITypeValues() []APIType { - return []APIType{HTTP, Soap} -} - -// AsyncOperationStatus enumerates the values for async operation status. -type AsyncOperationStatus string - -const ( - // Failed ... - Failed AsyncOperationStatus = "Failed" - // InProgress ... - InProgress AsyncOperationStatus = "InProgress" - // Started ... - Started AsyncOperationStatus = "Started" - // Succeeded ... - Succeeded AsyncOperationStatus = "Succeeded" -) - -// PossibleAsyncOperationStatusValues returns an array of possible values for the AsyncOperationStatus const type. -func PossibleAsyncOperationStatusValues() []AsyncOperationStatus { - return []AsyncOperationStatus{Failed, InProgress, Started, Succeeded} -} - -// AuthorizationMethod enumerates the values for authorization method. -type AuthorizationMethod string - -const ( - // DELETE ... - DELETE AuthorizationMethod = "DELETE" - // GET ... - GET AuthorizationMethod = "GET" - // HEAD ... - HEAD AuthorizationMethod = "HEAD" - // OPTIONS ... - OPTIONS AuthorizationMethod = "OPTIONS" - // PATCH ... - PATCH AuthorizationMethod = "PATCH" - // POST ... - POST AuthorizationMethod = "POST" - // PUT ... - PUT AuthorizationMethod = "PUT" - // TRACE ... - TRACE AuthorizationMethod = "TRACE" -) - -// PossibleAuthorizationMethodValues returns an array of possible values for the AuthorizationMethod const type. -func PossibleAuthorizationMethodValues() []AuthorizationMethod { - return []AuthorizationMethod{DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT, TRACE} -} - -// BackendProtocol enumerates the values for backend protocol. -type BackendProtocol string - -const ( - // BackendProtocolHTTP The Backend is a RESTful service. - BackendProtocolHTTP BackendProtocol = "http" - // BackendProtocolSoap The Backend is a SOAP service. - BackendProtocolSoap BackendProtocol = "soap" -) - -// PossibleBackendProtocolValues returns an array of possible values for the BackendProtocol const type. -func PossibleBackendProtocolValues() []BackendProtocol { - return []BackendProtocol{BackendProtocolHTTP, BackendProtocolSoap} -} - -// BearerTokenSendingMethod enumerates the values for bearer token sending method. -type BearerTokenSendingMethod string - -const ( - // AuthorizationHeader ... - AuthorizationHeader BearerTokenSendingMethod = "authorizationHeader" - // Query ... - Query BearerTokenSendingMethod = "query" -) - -// PossibleBearerTokenSendingMethodValues returns an array of possible values for the BearerTokenSendingMethod const type. -func PossibleBearerTokenSendingMethodValues() []BearerTokenSendingMethod { - return []BearerTokenSendingMethod{AuthorizationHeader, Query} -} - -// BearerTokenSendingMethods enumerates the values for bearer token sending methods. -type BearerTokenSendingMethods string - -const ( - // BearerTokenSendingMethodsAuthorizationHeader Access token will be transmitted in the Authorization - // header using Bearer schema - BearerTokenSendingMethodsAuthorizationHeader BearerTokenSendingMethods = "authorizationHeader" - // BearerTokenSendingMethodsQuery Access token will be transmitted as query parameters. - BearerTokenSendingMethodsQuery BearerTokenSendingMethods = "query" -) - -// PossibleBearerTokenSendingMethodsValues returns an array of possible values for the BearerTokenSendingMethods const type. -func PossibleBearerTokenSendingMethodsValues() []BearerTokenSendingMethods { - return []BearerTokenSendingMethods{BearerTokenSendingMethodsAuthorizationHeader, BearerTokenSendingMethodsQuery} -} - -// ClientAuthenticationMethod enumerates the values for client authentication method. -type ClientAuthenticationMethod string - -const ( - // Basic Basic Client Authentication method. - Basic ClientAuthenticationMethod = "Basic" - // Body Body based Authentication method. - Body ClientAuthenticationMethod = "Body" -) - -// PossibleClientAuthenticationMethodValues returns an array of possible values for the ClientAuthenticationMethod const type. -func PossibleClientAuthenticationMethodValues() []ClientAuthenticationMethod { - return []ClientAuthenticationMethod{Basic, Body} -} - -// Confirmation enumerates the values for confirmation. -type Confirmation string - -const ( - // Invite Send an e-mail inviting the user to sign-up and complete registration. - Invite Confirmation = "invite" - // Signup Send an e-mail to the user confirming they have successfully signed up. - Signup Confirmation = "signup" -) - -// PossibleConfirmationValues returns an array of possible values for the Confirmation const type. -func PossibleConfirmationValues() []Confirmation { - return []Confirmation{Invite, Signup} -} - -// ConnectivityStatusType enumerates the values for connectivity status type. -type ConnectivityStatusType string - -const ( - // Failure ... - Failure ConnectivityStatusType = "failure" - // Initializing ... - Initializing ConnectivityStatusType = "initializing" - // Success ... - Success ConnectivityStatusType = "success" -) - -// PossibleConnectivityStatusTypeValues returns an array of possible values for the ConnectivityStatusType const type. -func PossibleConnectivityStatusTypeValues() []ConnectivityStatusType { - return []ConnectivityStatusType{Failure, Initializing, Success} -} - -// ContentFormat enumerates the values for content format. -type ContentFormat string - -const ( - // Openapi The contents are inline and Content Type is a OpenApi 3.0 Document in YAML format. - Openapi ContentFormat = "openapi" - // Openapijson The contents are inline and Content Type is a OpenApi 3.0 Document in JSON format. - Openapijson ContentFormat = "openapi+json" - // OpenapiLink The Open Api 3.0 document is hosted on a publicly accessible internet address. - OpenapiLink ContentFormat = "openapi-link" - // SwaggerJSON The contents are inline and Content Type is a OpenApi 2.0 Document. - SwaggerJSON ContentFormat = "swagger-json" - // SwaggerLinkJSON The Open Api 2.0 document is hosted on a publicly accessible internet address. - SwaggerLinkJSON ContentFormat = "swagger-link-json" - // WadlLinkJSON The WADL document is hosted on a publicly accessible internet address. - WadlLinkJSON ContentFormat = "wadl-link-json" - // WadlXML The contents are inline and Content type is a WADL document. - WadlXML ContentFormat = "wadl-xml" - // Wsdl The contents are inline and the document is a WSDL/Soap document. - Wsdl ContentFormat = "wsdl" - // WsdlLink The WSDL document is hosted on a publicly accessible internet address. - WsdlLink ContentFormat = "wsdl-link" -) - -// PossibleContentFormatValues returns an array of possible values for the ContentFormat const type. -func PossibleContentFormatValues() []ContentFormat { - return []ContentFormat{Openapi, Openapijson, OpenapiLink, SwaggerJSON, SwaggerLinkJSON, WadlLinkJSON, WadlXML, Wsdl, WsdlLink} -} - -// ExportFormat enumerates the values for export format. -type ExportFormat string - -const ( - // ExportFormatOpenAPI3 Export the Api Definition in OpenApi Specification 3.0 to Storage Blob. - ExportFormatOpenAPI3 ExportFormat = "openapi-link" - // ExportFormatSwagger Export the Api Definition in OpenApi Specification 2.0 format to the Storage Blob. - ExportFormatSwagger ExportFormat = "swagger-link" - // ExportFormatWadl Export the Api Definition in WADL Schema to Storage Blob. - ExportFormatWadl ExportFormat = "wadl-link" - // ExportFormatWsdl Export the Api Definition in WSDL Schema to Storage Blob. This is only supported for - // APIs of Type `soap` - ExportFormatWsdl ExportFormat = "wsdl-link" -) - -// PossibleExportFormatValues returns an array of possible values for the ExportFormat const type. -func PossibleExportFormatValues() []ExportFormat { - return []ExportFormat{ExportFormatOpenAPI3, ExportFormatSwagger, ExportFormatWadl, ExportFormatWsdl} -} - -// GrantType enumerates the values for grant type. -type GrantType string - -const ( - // AuthorizationCode Authorization Code Grant flow as described - // https://tools.ietf.org/html/rfc6749#section-4.1. - AuthorizationCode GrantType = "authorizationCode" - // ClientCredentials Client Credentials Grant flow as described - // https://tools.ietf.org/html/rfc6749#section-4.4. - ClientCredentials GrantType = "clientCredentials" - // Implicit Implicit Code Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.2. - Implicit GrantType = "implicit" - // ResourceOwnerPassword Resource Owner Password Grant flow as described - // https://tools.ietf.org/html/rfc6749#section-4.3. - ResourceOwnerPassword GrantType = "resourceOwnerPassword" -) - -// PossibleGrantTypeValues returns an array of possible values for the GrantType const type. -func PossibleGrantTypeValues() []GrantType { - return []GrantType{AuthorizationCode, ClientCredentials, Implicit, ResourceOwnerPassword} -} - -// GroupType enumerates the values for group type. -type GroupType string - -const ( - // Custom ... - Custom GroupType = "custom" - // External ... - External GroupType = "external" - // System ... - System GroupType = "system" -) - -// PossibleGroupTypeValues returns an array of possible values for the GroupType const type. -func PossibleGroupTypeValues() []GroupType { - return []GroupType{Custom, External, System} -} - -// HostnameType enumerates the values for hostname type. -type HostnameType string - -const ( - // Management ... - Management HostnameType = "Management" - // Portal ... - Portal HostnameType = "Portal" - // Proxy ... - Proxy HostnameType = "Proxy" - // Scm ... - Scm HostnameType = "Scm" -) - -// PossibleHostnameTypeValues returns an array of possible values for the HostnameType const type. -func PossibleHostnameTypeValues() []HostnameType { - return []HostnameType{Management, Portal, Proxy, Scm} -} - -// IdentityProviderType enumerates the values for identity provider type. -type IdentityProviderType string - -const ( - // Aad Azure Active Directory as Identity provider. - Aad IdentityProviderType = "aad" - // AadB2C Azure Active Directory B2C as Identity provider. - AadB2C IdentityProviderType = "aadB2C" - // Facebook Facebook as Identity provider. - Facebook IdentityProviderType = "facebook" - // Google Google as Identity provider. - Google IdentityProviderType = "google" - // Microsoft Microsoft Live as Identity provider. - Microsoft IdentityProviderType = "microsoft" - // Twitter Twitter as Identity provider. - Twitter IdentityProviderType = "twitter" -) - -// PossibleIdentityProviderTypeValues returns an array of possible values for the IdentityProviderType const type. -func PossibleIdentityProviderTypeValues() []IdentityProviderType { - return []IdentityProviderType{Aad, AadB2C, Facebook, Google, Microsoft, Twitter} -} - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // Primary ... - Primary KeyType = "primary" - // Secondary ... - Secondary KeyType = "secondary" -) - -// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. -func PossibleKeyTypeValues() []KeyType { - return []KeyType{Primary, Secondary} -} - -// LoggerType enumerates the values for logger type. -type LoggerType string - -const ( - // ApplicationInsights Azure Application Insights as log destination. - ApplicationInsights LoggerType = "applicationInsights" - // AzureEventHub Azure Event Hub as log destination. - AzureEventHub LoggerType = "azureEventHub" -) - -// PossibleLoggerTypeValues returns an array of possible values for the LoggerType const type. -func PossibleLoggerTypeValues() []LoggerType { - return []LoggerType{ApplicationInsights, AzureEventHub} -} - -// NameAvailabilityReason enumerates the values for name availability reason. -type NameAvailabilityReason string - -const ( - // AlreadyExists ... - AlreadyExists NameAvailabilityReason = "AlreadyExists" - // Invalid ... - Invalid NameAvailabilityReason = "Invalid" - // Valid ... - Valid NameAvailabilityReason = "Valid" -) - -// PossibleNameAvailabilityReasonValues returns an array of possible values for the NameAvailabilityReason const type. -func PossibleNameAvailabilityReasonValues() []NameAvailabilityReason { - return []NameAvailabilityReason{AlreadyExists, Invalid, Valid} -} - -// NotificationName enumerates the values for notification name. -type NotificationName string - -const ( - // AccountClosedPublisher The following email recipients and users will receive email notifications when - // developer closes his account. - AccountClosedPublisher NotificationName = "AccountClosedPublisher" - // BCC The following recipients will receive blind carbon copies of all emails sent to developers. - BCC NotificationName = "BCC" - // NewApplicationNotificationMessage The following email recipients and users will receive email - // notifications when new applications are submitted to the application gallery. - NewApplicationNotificationMessage NotificationName = "NewApplicationNotificationMessage" - // NewIssuePublisherNotificationMessage The following email recipients and users will receive email - // notifications when a new issue or comment is submitted on the developer portal. - NewIssuePublisherNotificationMessage NotificationName = "NewIssuePublisherNotificationMessage" - // PurchasePublisherNotificationMessage The following email recipients and users will receive email - // notifications about new API product subscriptions. - PurchasePublisherNotificationMessage NotificationName = "PurchasePublisherNotificationMessage" - // QuotaLimitApproachingPublisherNotificationMessage The following email recipients and users will receive - // email notifications when subscription usage gets close to usage quota. - QuotaLimitApproachingPublisherNotificationMessage NotificationName = "QuotaLimitApproachingPublisherNotificationMessage" - // RequestPublisherNotificationMessage The following email recipients and users will receive email - // notifications about subscription requests for API products requiring approval. - RequestPublisherNotificationMessage NotificationName = "RequestPublisherNotificationMessage" -) - -// PossibleNotificationNameValues returns an array of possible values for the NotificationName const type. -func PossibleNotificationNameValues() []NotificationName { - return []NotificationName{AccountClosedPublisher, BCC, NewApplicationNotificationMessage, NewIssuePublisherNotificationMessage, PurchasePublisherNotificationMessage, QuotaLimitApproachingPublisherNotificationMessage, RequestPublisherNotificationMessage} -} - -// PolicyContentFormat enumerates the values for policy content format. -type PolicyContentFormat string - -const ( - // Rawxml The contents are inline and Content type is a non XML encoded policy document. - Rawxml PolicyContentFormat = "rawxml" - // RawxmlLink The policy document is not Xml encoded and is hosted on a http endpoint accessible from the - // API Management service. - RawxmlLink PolicyContentFormat = "rawxml-link" - // XML The contents are inline and Content type is an XML document. - XML PolicyContentFormat = "xml" - // XMLLink The policy XML document is hosted on a http endpoint accessible from the API Management service. - XMLLink PolicyContentFormat = "xml-link" -) - -// PossiblePolicyContentFormatValues returns an array of possible values for the PolicyContentFormat const type. -func PossiblePolicyContentFormatValues() []PolicyContentFormat { - return []PolicyContentFormat{Rawxml, RawxmlLink, XML, XMLLink} -} - -// PolicyScopeContract enumerates the values for policy scope contract. -type PolicyScopeContract string - -const ( - // PolicyScopeContractAll ... - PolicyScopeContractAll PolicyScopeContract = "All" - // PolicyScopeContractAPI ... - PolicyScopeContractAPI PolicyScopeContract = "Api" - // PolicyScopeContractOperation ... - PolicyScopeContractOperation PolicyScopeContract = "Operation" - // PolicyScopeContractProduct ... - PolicyScopeContractProduct PolicyScopeContract = "Product" - // PolicyScopeContractTenant ... - PolicyScopeContractTenant PolicyScopeContract = "Tenant" -) - -// PossiblePolicyScopeContractValues returns an array of possible values for the PolicyScopeContract const type. -func PossiblePolicyScopeContractValues() []PolicyScopeContract { - return []PolicyScopeContract{PolicyScopeContractAll, PolicyScopeContractAPI, PolicyScopeContractOperation, PolicyScopeContractProduct, PolicyScopeContractTenant} -} - -// ProductState enumerates the values for product state. -type ProductState string - -const ( - // NotPublished ... - NotPublished ProductState = "notPublished" - // Published ... - Published ProductState = "published" -) - -// PossibleProductStateValues returns an array of possible values for the ProductState const type. -func PossibleProductStateValues() []ProductState { - return []ProductState{NotPublished, Published} -} - -// Protocol enumerates the values for protocol. -type Protocol string - -const ( - // ProtocolHTTP ... - ProtocolHTTP Protocol = "http" - // ProtocolHTTPS ... - ProtocolHTTPS Protocol = "https" -) - -// PossibleProtocolValues returns an array of possible values for the Protocol const type. -func PossibleProtocolValues() []Protocol { - return []Protocol{ProtocolHTTP, ProtocolHTTPS} -} - -// ResourceSkuCapacityScaleType enumerates the values for resource sku capacity scale type. -type ResourceSkuCapacityScaleType string - -const ( - // Automatic Supported scale type automatic. - Automatic ResourceSkuCapacityScaleType = "automatic" - // Manual Supported scale type manual. - Manual ResourceSkuCapacityScaleType = "manual" - // None Scaling not supported. - None ResourceSkuCapacityScaleType = "none" -) - -// PossibleResourceSkuCapacityScaleTypeValues returns an array of possible values for the ResourceSkuCapacityScaleType const type. -func PossibleResourceSkuCapacityScaleTypeValues() []ResourceSkuCapacityScaleType { - return []ResourceSkuCapacityScaleType{Automatic, Manual, None} -} - -// SamplingType enumerates the values for sampling type. -type SamplingType string - -const ( - // Fixed Fixed-rate sampling. - Fixed SamplingType = "fixed" -) - -// PossibleSamplingTypeValues returns an array of possible values for the SamplingType const type. -func PossibleSamplingTypeValues() []SamplingType { - return []SamplingType{Fixed} -} - -// SkuType enumerates the values for sku type. -type SkuType string - -const ( - // SkuTypeBasic Basic SKU of Api Management. - SkuTypeBasic SkuType = "Basic" - // SkuTypeConsumption Consumption SKU of Api Management. - SkuTypeConsumption SkuType = "Consumption" - // SkuTypeDeveloper Developer SKU of Api Management. - SkuTypeDeveloper SkuType = "Developer" - // SkuTypePremium Premium SKU of Api Management. - SkuTypePremium SkuType = "Premium" - // SkuTypeStandard Standard SKU of Api Management. - SkuTypeStandard SkuType = "Standard" -) - -// PossibleSkuTypeValues returns an array of possible values for the SkuType const type. -func PossibleSkuTypeValues() []SkuType { - return []SkuType{SkuTypeBasic, SkuTypeConsumption, SkuTypeDeveloper, SkuTypePremium, SkuTypeStandard} -} - -// SoapAPIType enumerates the values for soap api type. -type SoapAPIType string - -const ( - // SoapPassThrough Imports the Soap API having a SOAP front end. - SoapPassThrough SoapAPIType = "soap" - // SoapToRest Imports a SOAP API having a RESTful front end. - SoapToRest SoapAPIType = "http" -) - -// PossibleSoapAPITypeValues returns an array of possible values for the SoapAPIType const type. -func PossibleSoapAPITypeValues() []SoapAPIType { - return []SoapAPIType{SoapPassThrough, SoapToRest} -} - -// State enumerates the values for state. -type State string - -const ( - // Closed The issue was closed. - Closed State = "closed" - // Open The issue is opened. - Open State = "open" - // Proposed The issue is proposed. - Proposed State = "proposed" - // Removed The issue was removed. - Removed State = "removed" - // Resolved The issue is now resolved. - Resolved State = "resolved" -) - -// PossibleStateValues returns an array of possible values for the State const type. -func PossibleStateValues() []State { - return []State{Closed, Open, Proposed, Removed, Resolved} -} - -// StoreName enumerates the values for store name. -type StoreName string - -const ( - // CertificateAuthority ... - CertificateAuthority StoreName = "CertificateAuthority" - // Root ... - Root StoreName = "Root" -) - -// PossibleStoreNameValues returns an array of possible values for the StoreName const type. -func PossibleStoreNameValues() []StoreName { - return []StoreName{CertificateAuthority, Root} -} - -// SubscriptionState enumerates the values for subscription state. -type SubscriptionState string - -const ( - // Active ... - Active SubscriptionState = "active" - // Cancelled ... - Cancelled SubscriptionState = "cancelled" - // Expired ... - Expired SubscriptionState = "expired" - // Rejected ... - Rejected SubscriptionState = "rejected" - // Submitted ... - Submitted SubscriptionState = "submitted" - // Suspended ... - Suspended SubscriptionState = "suspended" -) - -// PossibleSubscriptionStateValues returns an array of possible values for the SubscriptionState const type. -func PossibleSubscriptionStateValues() []SubscriptionState { - return []SubscriptionState{Active, Cancelled, Expired, Rejected, Submitted, Suspended} -} - -// TemplateName enumerates the values for template name. -type TemplateName string - -const ( - // AccountClosedDeveloper ... - AccountClosedDeveloper TemplateName = "accountClosedDeveloper" - // ApplicationApprovedNotificationMessage ... - ApplicationApprovedNotificationMessage TemplateName = "applicationApprovedNotificationMessage" - // ConfirmSignUpIdentityDefault ... - ConfirmSignUpIdentityDefault TemplateName = "confirmSignUpIdentityDefault" - // EmailChangeIdentityDefault ... - EmailChangeIdentityDefault TemplateName = "emailChangeIdentityDefault" - // InviteUserNotificationMessage ... - InviteUserNotificationMessage TemplateName = "inviteUserNotificationMessage" - // NewCommentNotificationMessage ... - NewCommentNotificationMessage TemplateName = "newCommentNotificationMessage" - // NewDeveloperNotificationMessage ... - NewDeveloperNotificationMessage TemplateName = "newDeveloperNotificationMessage" - // NewIssueNotificationMessage ... - NewIssueNotificationMessage TemplateName = "newIssueNotificationMessage" - // PasswordResetByAdminNotificationMessage ... - PasswordResetByAdminNotificationMessage TemplateName = "passwordResetByAdminNotificationMessage" - // PasswordResetIdentityDefault ... - PasswordResetIdentityDefault TemplateName = "passwordResetIdentityDefault" - // PurchaseDeveloperNotificationMessage ... - PurchaseDeveloperNotificationMessage TemplateName = "purchaseDeveloperNotificationMessage" - // QuotaLimitApproachingDeveloperNotificationMessage ... - QuotaLimitApproachingDeveloperNotificationMessage TemplateName = "quotaLimitApproachingDeveloperNotificationMessage" - // RejectDeveloperNotificationMessage ... - RejectDeveloperNotificationMessage TemplateName = "rejectDeveloperNotificationMessage" - // RequestDeveloperNotificationMessage ... - RequestDeveloperNotificationMessage TemplateName = "requestDeveloperNotificationMessage" -) - -// PossibleTemplateNameValues returns an array of possible values for the TemplateName const type. -func PossibleTemplateNameValues() []TemplateName { - return []TemplateName{AccountClosedDeveloper, ApplicationApprovedNotificationMessage, ConfirmSignUpIdentityDefault, EmailChangeIdentityDefault, InviteUserNotificationMessage, NewCommentNotificationMessage, NewDeveloperNotificationMessage, NewIssueNotificationMessage, PasswordResetByAdminNotificationMessage, PasswordResetIdentityDefault, PurchaseDeveloperNotificationMessage, QuotaLimitApproachingDeveloperNotificationMessage, RejectDeveloperNotificationMessage, RequestDeveloperNotificationMessage} -} - -// UserState enumerates the values for user state. -type UserState string - -const ( - // UserStateActive User state is active. - UserStateActive UserState = "active" - // UserStateBlocked User is blocked. Blocked users cannot authenticate at developer portal or call API. - UserStateBlocked UserState = "blocked" - // UserStateDeleted User account is closed. All identities and related entities are removed. - UserStateDeleted UserState = "deleted" - // UserStatePending User account is pending. Requires identity confirmation before it can be made active. - UserStatePending UserState = "pending" -) - -// PossibleUserStateValues returns an array of possible values for the UserState const type. -func PossibleUserStateValues() []UserState { - return []UserState{UserStateActive, UserStateBlocked, UserStateDeleted, UserStatePending} -} - -// VersioningScheme enumerates the values for versioning scheme. -type VersioningScheme string - -const ( - // VersioningSchemeHeader The API Version is passed in a HTTP header. - VersioningSchemeHeader VersioningScheme = "Header" - // VersioningSchemeQuery The API Version is passed in a query parameter. - VersioningSchemeQuery VersioningScheme = "Query" - // VersioningSchemeSegment The API Version is passed in a path segment. - VersioningSchemeSegment VersioningScheme = "Segment" -) - -// PossibleVersioningSchemeValues returns an array of possible values for the VersioningScheme const type. -func PossibleVersioningSchemeValues() []VersioningScheme { - return []VersioningScheme{VersioningSchemeHeader, VersioningSchemeQuery, VersioningSchemeSegment} -} - -// VersioningScheme1 enumerates the values for versioning scheme 1. -type VersioningScheme1 string - -const ( - // VersioningScheme1Header ... - VersioningScheme1Header VersioningScheme1 = "Header" - // VersioningScheme1Query ... - VersioningScheme1Query VersioningScheme1 = "Query" - // VersioningScheme1Segment ... - VersioningScheme1Segment VersioningScheme1 = "Segment" -) - -// PossibleVersioningScheme1Values returns an array of possible values for the VersioningScheme1 const type. -func PossibleVersioningScheme1Values() []VersioningScheme1 { - return []VersioningScheme1{VersioningScheme1Header, VersioningScheme1Query, VersioningScheme1Segment} -} - -// VirtualNetworkType enumerates the values for virtual network type. -type VirtualNetworkType string - -const ( - // VirtualNetworkTypeExternal The service is part of Virtual Network and it is accessible from Internet. - VirtualNetworkTypeExternal VirtualNetworkType = "External" - // VirtualNetworkTypeInternal The service is part of Virtual Network and it is only accessible from within - // the virtual network. - VirtualNetworkTypeInternal VirtualNetworkType = "Internal" - // VirtualNetworkTypeNone The service is not part of any Virtual Network. - VirtualNetworkTypeNone VirtualNetworkType = "None" -) - -// PossibleVirtualNetworkTypeValues returns an array of possible values for the VirtualNetworkType const type. -func PossibleVirtualNetworkTypeValues() []VirtualNetworkType { - return []VirtualNetworkType{VirtualNetworkTypeExternal, VirtualNetworkTypeInternal, VirtualNetworkTypeNone} -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/group.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/group.go deleted file mode 100644 index adde43f71bb1..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/group.go +++ /dev/null @@ -1,653 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GroupClient is the apiManagement Client -type GroupClient struct { - BaseClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient 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 NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a group. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client GroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/groups/{groupId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) 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 GroupClient) CreateOrUpdateResponder(resp *http.Response) (result GroupContract, 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 specific group of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GroupClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, groupID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 GroupClient) 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 GroupClient) 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 details of the group specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client GroupClient) Get(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/groups/{groupId}", 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 GroupClient) 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 GroupClient) GetResponder(resp *http.Response) (result GroupContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the group specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client GroupClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GroupClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GroupClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of groups defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |aadObjectId | eq | | -// top - number of records to return. -// skip - number of records to skip. -func (client GroupClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure sending request") - return - } - - result.gc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GroupClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GroupClient) ListByServiceResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GroupClient) listByServiceNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.groupCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the group specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GroupClient) Update(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 GroupClient) 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 GroupClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/groupuser.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/groupuser.go deleted file mode 100644 index 19ec6b95e77f..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/groupuser.go +++ /dev/null @@ -1,476 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GroupUserClient is the apiManagement Client -type GroupUserClient struct { - BaseClient -} - -// NewGroupUserClient creates an instance of the GroupUserClient client. -func NewGroupUserClient(subscriptionID string) GroupUserClient { - return NewGroupUserClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupUserClientWithBaseURI creates an instance of the GroupUserClient 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 NewGroupUserClientWithBaseURI(baseURI string, subscriptionID string) GroupUserClient { - return GroupUserClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists checks that user entity specified by identifier is associated with the group entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client GroupUserClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, groupID, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client GroupUserClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client GroupUserClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client GroupUserClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create add existing user to existing group -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client GroupUserClient) Create(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serviceName, groupID, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client GroupUserClient) CreatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", 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 GroupUserClient) 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 GroupUserClient) CreateResponder(resp *http.Response) (result UserContract, 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 remove existing user from existing group. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client GroupUserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, groupID, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupUserClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", 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 GroupUserClient) 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 GroupUserClient) 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 -} - -// List lists a collection of user entities associated with the group. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |firstName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |lastName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |email | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |registrationDate | ge, le, eq, ne, gt, lt | | -// |note | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client GroupUserClient) List(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result UserCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.List") - defer func() { - sc := -1 - if result.uc.Response.Response != nil { - sc = result.uc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, groupID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.uc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "List", resp, "Failure sending request") - return - } - - result.uc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "List", resp, "Failure responding to request") - return - } - if result.uc.hasNextLink() && result.uc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupUserClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/groups/{groupId}/users", 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 GroupUserClient) 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 GroupUserClient) ListResponder(resp *http.Response) (result UserCollection, 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 GroupUserClient) listNextResults(ctx context.Context, lastResults UserCollection) (result UserCollection, err error) { - req, err := lastResults.userCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "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, "apimanagement.GroupUserClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupUserClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result UserCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.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, serviceName, groupID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/identityprovider.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/identityprovider.go deleted file mode 100644 index 3462e22fd21c..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/identityprovider.go +++ /dev/null @@ -1,610 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IdentityProviderClient is the apiManagement Client -type IdentityProviderClient struct { - BaseClient -} - -// NewIdentityProviderClient creates an instance of the IdentityProviderClient client. -func NewIdentityProviderClient(subscriptionID string) IdentityProviderClient { - return NewIdentityProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIdentityProviderClientWithBaseURI creates an instance of the IdentityProviderClient 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 NewIdentityProviderClientWithBaseURI(baseURI string, subscriptionID string) IdentityProviderClient { - return IdentityProviderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates the IdentityProvider configuration. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client IdentityProviderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderContract, ifMatch string) (result IdentityProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IdentityProviderContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IdentityProviderContractProperties.ClientID", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.IdentityProviderContractProperties.ClientID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {Target: "parameters.IdentityProviderContractProperties.ClientSecret", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.IdentityProviderContractProperties.ClientSecret", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, identityProviderName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IdentityProviderClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) 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 IdentityProviderClient) CreateOrUpdateResponder(resp *http.Response) (result IdentityProviderContract, 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 specified identity provider configuration. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client IdentityProviderClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, identityProviderName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IdentityProviderClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 IdentityProviderClient) 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 IdentityProviderClient) 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 configuration details of the identity Provider configured in specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -func (client IdentityProviderClient) Get(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (result IdentityProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, identityProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IdentityProviderClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", 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 IdentityProviderClient) 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 IdentityProviderClient) GetResponder(resp *http.Response) (result IdentityProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the identityProvider specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -func (client IdentityProviderClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, identityProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client IdentityProviderClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of Identity Provider configured in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client IdentityProviderClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result IdentityProviderListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.ListByService") - defer func() { - sc := -1 - if result.ipl.Response.Response != nil { - sc = result.ipl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ipl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListByService", resp, "Failure sending request") - return - } - - result.ipl, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ipl.hasNextLink() && result.ipl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client IdentityProviderClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/identityProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) ListByServiceResponder(resp *http.Response) (result IdentityProviderList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client IdentityProviderClient) listByServiceNextResults(ctx context.Context, lastResults IdentityProviderList) (result IdentityProviderList, err error) { - req, err := lastResults.identityProviderListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IdentityProviderClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result IdentityProviderListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName) - return -} - -// Update updates an existing IdentityProvider configuration. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client IdentityProviderClient) Update(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, identityProviderName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IdentityProviderClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 IdentityProviderClient) 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 IdentityProviderClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/issue.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/issue.go deleted file mode 100644 index 000971ea271d..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/issue.go +++ /dev/null @@ -1,274 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IssueClient is the apiManagement Client -type IssueClient struct { - BaseClient -} - -// NewIssueClient creates an instance of the IssueClient client. -func NewIssueClient(subscriptionID string) IssueClient { - return NewIssueClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIssueClientWithBaseURI creates an instance of the IssueClient 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 NewIssueClientWithBaseURI(baseURI string, subscriptionID string) IssueClient { - return IssueClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets API Management issue details -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// issueID - issue identifier. Must be unique in the current API Management service instance. -func (client IssueClient) Get(ctx context.Context, resourceGroupName string, serviceName string, issueID string) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IssueClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, issueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IssueClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, issueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/issues/{issueId}", 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 IssueClient) 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 IssueClient) GetResponder(resp *http.Response) (result IssueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of issues in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |apiId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |title | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |authorName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |state | eq | | -// top - number of records to return. -// skip - number of records to skip. -func (client IssueClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result IssueCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueClient.ListByService") - defer func() { - sc := -1 - if result.ic.Response.Response != nil { - sc = result.ic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.IssueClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "ListByService", resp, "Failure sending request") - return - } - - result.ic, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ic.hasNextLink() && result.ic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client IssueClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/issues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client IssueClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client IssueClient) ListByServiceResponder(resp *http.Response) (result IssueCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client IssueClient) listByServiceNextResults(ctx context.Context, lastResults IssueCollection) (result IssueCollection, err error) { - req, err := lastResults.issueCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.IssueClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.IssueClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IssueClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result IssueCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/logger.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/logger.go deleted file mode 100644 index 799662d85f49..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/logger.go +++ /dev/null @@ -1,651 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LoggerClient is the apiManagement Client -type LoggerClient struct { - BaseClient -} - -// NewLoggerClient creates an instance of the LoggerClient client. -func NewLoggerClient(subscriptionID string) LoggerClient { - return NewLoggerClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLoggerClientWithBaseURI creates an instance of the LoggerClient 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 NewLoggerClientWithBaseURI(baseURI string, subscriptionID string) LoggerClient { - return LoggerClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a logger. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client LoggerClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerContract, ifMatch string) (result LoggerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LoggerContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LoggerContractProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LoggerContractProperties.Description", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - {Target: "parameters.LoggerContractProperties.Credentials", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, loggerID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LoggerClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/loggers/{loggerId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) 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 LoggerClient) CreateOrUpdateResponder(resp *http.Response) (result LoggerContract, 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 specified logger. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// force - force deletion even if diagnostic is attached. -func (client LoggerClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, ifMatch string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, loggerID, ifMatch, force) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LoggerClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, ifMatch string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 LoggerClient) 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 LoggerClient) 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 details of the logger specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -func (client LoggerClient) Get(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result LoggerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, loggerID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LoggerClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/loggers/{loggerId}", 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 LoggerClient) 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 LoggerClient) GetResponder(resp *http.Response) (result LoggerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the logger specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -func (client LoggerClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, loggerID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client LoggerClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client LoggerClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of loggers in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |loggerType | eq | | -// |resourceId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client LoggerClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.ListByService") - defer func() { - sc := -1 - if result.lc.Response.Response != nil { - sc = result.lc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.lc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "ListByService", resp, "Failure sending request") - return - } - - result.lc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "ListByService", resp, "Failure responding to request") - return - } - if result.lc.hasNextLink() && result.lc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client LoggerClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/loggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client LoggerClient) ListByServiceResponder(resp *http.Response) (result LoggerCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client LoggerClient) listByServiceNextResults(ctx context.Context, lastResults LoggerCollection) (result LoggerCollection, err error) { - req, err := lastResults.loggerCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client LoggerClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates an existing logger. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client LoggerClient) Update(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, loggerID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LoggerClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 LoggerClient) 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 LoggerClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/models.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/models.go deleted file mode 100644 index a9e5e379aa86..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/models.go +++ /dev/null @@ -1,12402 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement" - -// AccessInformationContract tenant access information contract of the API Management service. -type AccessInformationContract struct { - autorest.Response `json:"-"` - // ID - Identifier. - ID *string `json:"id,omitempty"` - // PrimaryKey - Primary access key. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary access key. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // Enabled - Tenant access information of the API Management service. - Enabled *bool `json:"enabled,omitempty"` -} - -// AccessInformationUpdateParameters tenant access information update parameters of the API Management -// service. -type AccessInformationUpdateParameters struct { - // Enabled - Tenant access information of the API Management service. - Enabled *bool `json:"enabled,omitempty"` -} - -// AdditionalLocation description of an additional API Management resource location. -type AdditionalLocation struct { - // Location - The location name of the additional region among Azure Data center regions. - Location *string `json:"location,omitempty"` - // Sku - SKU properties of the API Management service. - Sku *ServiceSkuProperties `json:"sku,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in the additional location. Available only for Basic, Standard and Premium SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service which is deployed in an Internal Virtual Network in a particular additional location. Available only for Basic, Standard and Premium SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration for the location. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdditionalLocation. -func (al AdditionalLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if al.Location != nil { - objectMap["location"] = al.Location - } - if al.Sku != nil { - objectMap["sku"] = al.Sku - } - if al.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = al.VirtualNetworkConfiguration - } - return json.Marshal(objectMap) -} - -// APICollection paged Api list representation. -type APICollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]APIContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for APICollection. -func (ac APICollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APICollectionIterator provides access to a complete listing of APIContract values. -type APICollectionIterator struct { - i int - page APICollectionPage -} - -// 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 *APICollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APICollectionIterator.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 *APICollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APICollectionIterator) 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 APICollectionIterator) Response() APICollection { - 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 APICollectionIterator) Value() APIContract { - if !iter.page.NotDone() { - return APIContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APICollectionIterator type. -func NewAPICollectionIterator(page APICollectionPage) APICollectionIterator { - return APICollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ac APICollection) IsEmpty() bool { - return ac.Value == nil || len(*ac.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ac APICollection) hasNextLink() bool { - return ac.NextLink != nil && len(*ac.NextLink) != 0 -} - -// aPICollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ac APICollection) aPICollectionPreparer(ctx context.Context) (*http.Request, error) { - if !ac.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ac.NextLink))) -} - -// APICollectionPage contains a page of APIContract values. -type APICollectionPage struct { - fn func(context.Context, APICollection) (APICollection, error) - ac APICollection -} - -// 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 *APICollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APICollectionPage.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.ac) - if err != nil { - return err - } - page.ac = 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 *APICollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APICollectionPage) NotDone() bool { - return !page.ac.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APICollectionPage) Response() APICollection { - return page.ac -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APICollectionPage) Values() []APIContract { - if page.ac.IsEmpty() { - return nil - } - return *page.ac.Value -} - -// Creates a new instance of the APICollectionPage type. -func NewAPICollectionPage(cur APICollection, getNextPage func(context.Context, APICollection) (APICollection, error)) APICollectionPage { - return APICollectionPage{ - fn: getNextPage, - ac: cur, - } -} - -// APIContract API details. -type APIContract struct { - autorest.Response `json:"-"` - // APIContractProperties - Api entity contract properties. - *APIContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIContract. -func (ac APIContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ac.APIContractProperties != nil { - objectMap["properties"] = ac.APIContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIContract struct. -func (ac *APIContract) 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 APIContractProperties APIContractProperties - err = json.Unmarshal(*v, &APIContractProperties) - if err != nil { - return err - } - ac.APIContractProperties = &APIContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ac.Type = &typeVar - } - } - } - - return nil -} - -// APIContractProperties api Entity Properties -type APIContractProperties struct { - // DisplayName - API name. - DisplayName *string `json:"displayName,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - APIVersionSet *APIVersionSetContractDetails `json:"apiVersionSet,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - READ-ONLY; Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIContractProperties. -func (acp APIContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acp.DisplayName != nil { - objectMap["displayName"] = acp.DisplayName - } - if acp.ServiceURL != nil { - objectMap["serviceUrl"] = acp.ServiceURL - } - if acp.Path != nil { - objectMap["path"] = acp.Path - } - if acp.Protocols != nil { - objectMap["protocols"] = acp.Protocols - } - if acp.APIVersionSet != nil { - objectMap["apiVersionSet"] = acp.APIVersionSet - } - if acp.Description != nil { - objectMap["description"] = acp.Description - } - if acp.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = acp.AuthenticationSettings - } - if acp.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = acp.SubscriptionKeyParameterNames - } - if acp.APIType != "" { - objectMap["type"] = acp.APIType - } - if acp.APIRevision != nil { - objectMap["apiRevision"] = acp.APIRevision - } - if acp.APIVersion != nil { - objectMap["apiVersion"] = acp.APIVersion - } - if acp.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = acp.APIRevisionDescription - } - if acp.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = acp.APIVersionDescription - } - if acp.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = acp.APIVersionSetID - } - if acp.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = acp.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APIContractUpdateProperties API update contract properties. -type APIContractUpdateProperties struct { - // DisplayName - API name. - DisplayName *string `json:"displayName,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - READ-ONLY; Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIContractUpdateProperties. -func (acup APIContractUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acup.DisplayName != nil { - objectMap["displayName"] = acup.DisplayName - } - if acup.ServiceURL != nil { - objectMap["serviceUrl"] = acup.ServiceURL - } - if acup.Path != nil { - objectMap["path"] = acup.Path - } - if acup.Protocols != nil { - objectMap["protocols"] = acup.Protocols - } - if acup.Description != nil { - objectMap["description"] = acup.Description - } - if acup.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = acup.AuthenticationSettings - } - if acup.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = acup.SubscriptionKeyParameterNames - } - if acup.APIType != "" { - objectMap["type"] = acup.APIType - } - if acup.APIRevision != nil { - objectMap["apiRevision"] = acup.APIRevision - } - if acup.APIVersion != nil { - objectMap["apiVersion"] = acup.APIVersion - } - if acup.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = acup.APIRevisionDescription - } - if acup.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = acup.APIVersionDescription - } - if acup.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = acup.APIVersionSetID - } - if acup.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = acup.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APICreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type APICreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(APIClient) (APIContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *APICreateOrUpdateFuture) 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 APICreateOrUpdateFuture.Result. -func (future *APICreateOrUpdateFuture) result(client APIClient) (ac APIContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APICreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ac.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.APICreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ac.Response.Response, err = future.GetResult(sender); err == nil && ac.Response.Response.StatusCode != http.StatusNoContent { - ac, err = client.CreateOrUpdateResponder(ac.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APICreateOrUpdateFuture", "Result", ac.Response.Response, "Failure responding to request") - } - } - return -} - -// APICreateOrUpdateParameter API Create or Update Parameters. -type APICreateOrUpdateParameter struct { - // APICreateOrUpdateProperties - Api entity create of update properties. - *APICreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for APICreateOrUpdateParameter. -func (acoup APICreateOrUpdateParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acoup.APICreateOrUpdateProperties != nil { - objectMap["properties"] = acoup.APICreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APICreateOrUpdateParameter struct. -func (acoup *APICreateOrUpdateParameter) 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 APICreateOrUpdateProperties APICreateOrUpdateProperties - err = json.Unmarshal(*v, &APICreateOrUpdateProperties) - if err != nil { - return err - } - acoup.APICreateOrUpdateProperties = &APICreateOrUpdateProperties - } - } - } - - return nil -} - -// APICreateOrUpdateProperties api Create or Update Properties. -type APICreateOrUpdateProperties struct { - // ContentValue - Content value when Importing an API. - ContentValue *string `json:"contentValue,omitempty"` - // ContentFormat - Format of the Content in which the API is getting imported. Possible values include: 'WadlXML', 'WadlLinkJSON', 'SwaggerJSON', 'SwaggerLinkJSON', 'Wsdl', 'WsdlLink', 'Openapi', 'Openapijson', 'OpenapiLink' - ContentFormat ContentFormat `json:"contentFormat,omitempty"` - // WsdlSelector - Criteria to limit import of WSDL to a subset of the document. - WsdlSelector *APICreateOrUpdatePropertiesWsdlSelector `json:"wsdlSelector,omitempty"` - // SoapAPIType - Type of Api to create. - // * `http` creates a SOAP to REST API - // * `soap` creates a SOAP pass-through API. Possible values include: 'SoapToRest', 'SoapPassThrough' - SoapAPIType SoapAPIType `json:"apiType,omitempty"` - // DisplayName - API name. - DisplayName *string `json:"displayName,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - APIVersionSet *APIVersionSetContractDetails `json:"apiVersionSet,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - READ-ONLY; Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APICreateOrUpdateProperties. -func (acoup APICreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acoup.ContentValue != nil { - objectMap["contentValue"] = acoup.ContentValue - } - if acoup.ContentFormat != "" { - objectMap["contentFormat"] = acoup.ContentFormat - } - if acoup.WsdlSelector != nil { - objectMap["wsdlSelector"] = acoup.WsdlSelector - } - if acoup.SoapAPIType != "" { - objectMap["apiType"] = acoup.SoapAPIType - } - if acoup.DisplayName != nil { - objectMap["displayName"] = acoup.DisplayName - } - if acoup.ServiceURL != nil { - objectMap["serviceUrl"] = acoup.ServiceURL - } - if acoup.Path != nil { - objectMap["path"] = acoup.Path - } - if acoup.Protocols != nil { - objectMap["protocols"] = acoup.Protocols - } - if acoup.APIVersionSet != nil { - objectMap["apiVersionSet"] = acoup.APIVersionSet - } - if acoup.Description != nil { - objectMap["description"] = acoup.Description - } - if acoup.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = acoup.AuthenticationSettings - } - if acoup.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = acoup.SubscriptionKeyParameterNames - } - if acoup.APIType != "" { - objectMap["type"] = acoup.APIType - } - if acoup.APIRevision != nil { - objectMap["apiRevision"] = acoup.APIRevision - } - if acoup.APIVersion != nil { - objectMap["apiVersion"] = acoup.APIVersion - } - if acoup.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = acoup.APIRevisionDescription - } - if acoup.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = acoup.APIVersionDescription - } - if acoup.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = acoup.APIVersionSetID - } - if acoup.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = acoup.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APICreateOrUpdatePropertiesWsdlSelector criteria to limit import of WSDL to a subset of the document. -type APICreateOrUpdatePropertiesWsdlSelector struct { - // WsdlServiceName - Name of service to import from WSDL - WsdlServiceName *string `json:"wsdlServiceName,omitempty"` - // WsdlEndpointName - Name of endpoint(port) to import from WSDL - WsdlEndpointName *string `json:"wsdlEndpointName,omitempty"` -} - -// APIEntityBaseContract API base contract details. -type APIEntityBaseContract struct { - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - READ-ONLY; Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIEntityBaseContract. -func (aebc APIEntityBaseContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aebc.Description != nil { - objectMap["description"] = aebc.Description - } - if aebc.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = aebc.AuthenticationSettings - } - if aebc.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = aebc.SubscriptionKeyParameterNames - } - if aebc.APIType != "" { - objectMap["type"] = aebc.APIType - } - if aebc.APIRevision != nil { - objectMap["apiRevision"] = aebc.APIRevision - } - if aebc.APIVersion != nil { - objectMap["apiVersion"] = aebc.APIVersion - } - if aebc.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = aebc.APIRevisionDescription - } - if aebc.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = aebc.APIVersionDescription - } - if aebc.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = aebc.APIVersionSetID - } - if aebc.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = aebc.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APIExportResult API Export result Blob Uri. -type APIExportResult struct { - autorest.Response `json:"-"` - // Link - Link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes. - Link *string `json:"link,omitempty"` -} - -// ApimResource the Resource definition. -type ApimResource 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 for API Management resource is set to Microsoft.ApiManagement. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApimResource. -func (ar ApimResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Tags != nil { - objectMap["tags"] = ar.Tags - } - return json.Marshal(objectMap) -} - -// APIReleaseCollection paged Api Revision list representation. -type APIReleaseCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]APIReleaseContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReleaseCollection. -func (arc APIReleaseCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIReleaseCollectionIterator provides access to a complete listing of APIReleaseContract values. -type APIReleaseCollectionIterator struct { - i int - page APIReleaseCollectionPage -} - -// 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 *APIReleaseCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseCollectionIterator.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 *APIReleaseCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIReleaseCollectionIterator) 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 APIReleaseCollectionIterator) Response() APIReleaseCollection { - 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 APIReleaseCollectionIterator) Value() APIReleaseContract { - if !iter.page.NotDone() { - return APIReleaseContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIReleaseCollectionIterator type. -func NewAPIReleaseCollectionIterator(page APIReleaseCollectionPage) APIReleaseCollectionIterator { - return APIReleaseCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arc APIReleaseCollection) IsEmpty() bool { - return arc.Value == nil || len(*arc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arc APIReleaseCollection) hasNextLink() bool { - return arc.NextLink != nil && len(*arc.NextLink) != 0 -} - -// aPIReleaseCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arc APIReleaseCollection) aPIReleaseCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !arc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arc.NextLink))) -} - -// APIReleaseCollectionPage contains a page of APIReleaseContract values. -type APIReleaseCollectionPage struct { - fn func(context.Context, APIReleaseCollection) (APIReleaseCollection, error) - arc APIReleaseCollection -} - -// 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 *APIReleaseCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseCollectionPage.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.arc) - if err != nil { - return err - } - page.arc = 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 *APIReleaseCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIReleaseCollectionPage) NotDone() bool { - return !page.arc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIReleaseCollectionPage) Response() APIReleaseCollection { - return page.arc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIReleaseCollectionPage) Values() []APIReleaseContract { - if page.arc.IsEmpty() { - return nil - } - return *page.arc.Value -} - -// Creates a new instance of the APIReleaseCollectionPage type. -func NewAPIReleaseCollectionPage(cur APIReleaseCollection, getNextPage func(context.Context, APIReleaseCollection) (APIReleaseCollection, error)) APIReleaseCollectionPage { - return APIReleaseCollectionPage{ - fn: getNextPage, - arc: cur, - } -} - -// APIReleaseContract api Release details. -type APIReleaseContract struct { - autorest.Response `json:"-"` - // APIReleaseContractProperties - Properties of the Api Release Contract. - *APIReleaseContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReleaseContract. -func (arc APIReleaseContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arc.APIReleaseContractProperties != nil { - objectMap["properties"] = arc.APIReleaseContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIReleaseContract struct. -func (arc *APIReleaseContract) 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 APIReleaseContractProperties APIReleaseContractProperties - err = json.Unmarshal(*v, &APIReleaseContractProperties) - if err != nil { - return err - } - arc.APIReleaseContractProperties = &APIReleaseContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arc.Type = &typeVar - } - } - } - - return nil -} - -// APIReleaseContractProperties API Release details -type APIReleaseContractProperties struct { - // APIID - Identifier of the API the release belongs to. - APIID *string `json:"apiId,omitempty"` - // CreatedDateTime - READ-ONLY; The time the API was released. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - // UpdatedDateTime - READ-ONLY; The time the API release was updated. - UpdatedDateTime *date.Time `json:"updatedDateTime,omitempty"` - // Notes - Release Notes - Notes *string `json:"notes,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReleaseContractProperties. -func (arcp APIReleaseContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arcp.APIID != nil { - objectMap["apiId"] = arcp.APIID - } - if arcp.Notes != nil { - objectMap["notes"] = arcp.Notes - } - return json.Marshal(objectMap) -} - -// APIRevisionCollection paged Api Revision list representation. -type APIRevisionCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]APIRevisionContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIRevisionCollection. -func (arc APIRevisionCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIRevisionCollectionIterator provides access to a complete listing of APIRevisionContract values. -type APIRevisionCollectionIterator struct { - i int - page APIRevisionCollectionPage -} - -// 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 *APIRevisionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionCollectionIterator.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 *APIRevisionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIRevisionCollectionIterator) 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 APIRevisionCollectionIterator) Response() APIRevisionCollection { - 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 APIRevisionCollectionIterator) Value() APIRevisionContract { - if !iter.page.NotDone() { - return APIRevisionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIRevisionCollectionIterator type. -func NewAPIRevisionCollectionIterator(page APIRevisionCollectionPage) APIRevisionCollectionIterator { - return APIRevisionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arc APIRevisionCollection) IsEmpty() bool { - return arc.Value == nil || len(*arc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arc APIRevisionCollection) hasNextLink() bool { - return arc.NextLink != nil && len(*arc.NextLink) != 0 -} - -// aPIRevisionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arc APIRevisionCollection) aPIRevisionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !arc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arc.NextLink))) -} - -// APIRevisionCollectionPage contains a page of APIRevisionContract values. -type APIRevisionCollectionPage struct { - fn func(context.Context, APIRevisionCollection) (APIRevisionCollection, error) - arc APIRevisionCollection -} - -// 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 *APIRevisionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionCollectionPage.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.arc) - if err != nil { - return err - } - page.arc = 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 *APIRevisionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIRevisionCollectionPage) NotDone() bool { - return !page.arc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIRevisionCollectionPage) Response() APIRevisionCollection { - return page.arc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIRevisionCollectionPage) Values() []APIRevisionContract { - if page.arc.IsEmpty() { - return nil - } - return *page.arc.Value -} - -// Creates a new instance of the APIRevisionCollectionPage type. -func NewAPIRevisionCollectionPage(cur APIRevisionCollection, getNextPage func(context.Context, APIRevisionCollection) (APIRevisionCollection, error)) APIRevisionCollectionPage { - return APIRevisionCollectionPage{ - fn: getNextPage, - arc: cur, - } -} - -// APIRevisionContract summary of revision metadata. -type APIRevisionContract struct { - // APIID - READ-ONLY; Identifier of the API Revision. - APIID *string `json:"apiId,omitempty"` - // APIRevision - READ-ONLY; Revision number of API. - APIRevision *string `json:"apiRevision,omitempty"` - // CreatedDateTime - READ-ONLY; The time the API Revision was created. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - // UpdatedDateTime - READ-ONLY; The time the API Revision were updated. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - UpdatedDateTime *date.Time `json:"updatedDateTime,omitempty"` - // Description - READ-ONLY; Description of the API Revision. - Description *string `json:"description,omitempty"` - // PrivateURL - READ-ONLY; Gateway URL for accessing the non-current API Revision. - PrivateURL *string `json:"privateUrl,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is the current api revision. - IsOnline *bool `json:"isOnline,omitempty"` - // IsCurrent - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsCurrent *bool `json:"isCurrent,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIRevisionContract. -func (arc APIRevisionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIRevisionInfoContract object used to create an API Revision or Version based on an existing API -// Revision -type APIRevisionInfoContract struct { - // SourceAPIID - Resource identifier of API to be used to create the revision from. - SourceAPIID *string `json:"sourceApiId,omitempty"` - // APIVersionName - Version identifier for the new API Version. - APIVersionName *string `json:"apiVersionName,omitempty"` - // APIRevisionDescription - Description of new API Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionSet - Version set details - APIVersionSet *APIVersionSetContractDetails `json:"apiVersionSet,omitempty"` -} - -// APITagResourceContractProperties API contract properties for the Tag Resources. -type APITagResourceContractProperties struct { - // ID - API identifier in the form /apis/{apiId}. - ID *string `json:"id,omitempty"` - // Name - API name. - Name *string `json:"name,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - READ-ONLY; Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APITagResourceContractProperties. -func (atrcp APITagResourceContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atrcp.ID != nil { - objectMap["id"] = atrcp.ID - } - if atrcp.Name != nil { - objectMap["name"] = atrcp.Name - } - if atrcp.ServiceURL != nil { - objectMap["serviceUrl"] = atrcp.ServiceURL - } - if atrcp.Path != nil { - objectMap["path"] = atrcp.Path - } - if atrcp.Protocols != nil { - objectMap["protocols"] = atrcp.Protocols - } - if atrcp.Description != nil { - objectMap["description"] = atrcp.Description - } - if atrcp.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = atrcp.AuthenticationSettings - } - if atrcp.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = atrcp.SubscriptionKeyParameterNames - } - if atrcp.APIType != "" { - objectMap["type"] = atrcp.APIType - } - if atrcp.APIRevision != nil { - objectMap["apiRevision"] = atrcp.APIRevision - } - if atrcp.APIVersion != nil { - objectMap["apiVersion"] = atrcp.APIVersion - } - if atrcp.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = atrcp.APIRevisionDescription - } - if atrcp.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = atrcp.APIVersionDescription - } - if atrcp.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = atrcp.APIVersionSetID - } - if atrcp.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = atrcp.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APIUpdateContract API update contract details. -type APIUpdateContract struct { - // APIContractUpdateProperties - Properties of the API entity that can be updated. - *APIContractUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIUpdateContract. -func (auc APIUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if auc.APIContractUpdateProperties != nil { - objectMap["properties"] = auc.APIContractUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIUpdateContract struct. -func (auc *APIUpdateContract) 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 APIContractUpdateProperties APIContractUpdateProperties - err = json.Unmarshal(*v, &APIContractUpdateProperties) - if err != nil { - return err - } - auc.APIContractUpdateProperties = &APIContractUpdateProperties - } - } - } - - return nil -} - -// APIVersionSetCollection paged Api Version Set list representation. -type APIVersionSetCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]APIVersionSetContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// APIVersionSetCollectionIterator provides access to a complete listing of APIVersionSetContract values. -type APIVersionSetCollectionIterator struct { - i int - page APIVersionSetCollectionPage -} - -// 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 *APIVersionSetCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetCollectionIterator.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 *APIVersionSetCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIVersionSetCollectionIterator) 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 APIVersionSetCollectionIterator) Response() APIVersionSetCollection { - 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 APIVersionSetCollectionIterator) Value() APIVersionSetContract { - if !iter.page.NotDone() { - return APIVersionSetContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIVersionSetCollectionIterator type. -func NewAPIVersionSetCollectionIterator(page APIVersionSetCollectionPage) APIVersionSetCollectionIterator { - return APIVersionSetCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (avsc APIVersionSetCollection) IsEmpty() bool { - return avsc.Value == nil || len(*avsc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (avsc APIVersionSetCollection) hasNextLink() bool { - return avsc.NextLink != nil && len(*avsc.NextLink) != 0 -} - -// aPIVersionSetCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (avsc APIVersionSetCollection) aPIVersionSetCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !avsc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(avsc.NextLink))) -} - -// APIVersionSetCollectionPage contains a page of APIVersionSetContract values. -type APIVersionSetCollectionPage struct { - fn func(context.Context, APIVersionSetCollection) (APIVersionSetCollection, error) - avsc APIVersionSetCollection -} - -// 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 *APIVersionSetCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetCollectionPage.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.avsc) - if err != nil { - return err - } - page.avsc = 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 *APIVersionSetCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIVersionSetCollectionPage) NotDone() bool { - return !page.avsc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIVersionSetCollectionPage) Response() APIVersionSetCollection { - return page.avsc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIVersionSetCollectionPage) Values() []APIVersionSetContract { - if page.avsc.IsEmpty() { - return nil - } - return *page.avsc.Value -} - -// Creates a new instance of the APIVersionSetCollectionPage type. -func NewAPIVersionSetCollectionPage(cur APIVersionSetCollection, getNextPage func(context.Context, APIVersionSetCollection) (APIVersionSetCollection, error)) APIVersionSetCollectionPage { - return APIVersionSetCollectionPage{ - fn: getNextPage, - avsc: cur, - } -} - -// APIVersionSetContract api Version Set Contract details. -type APIVersionSetContract struct { - autorest.Response `json:"-"` - // APIVersionSetContractProperties - Api VersionSet contract properties. - *APIVersionSetContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIVersionSetContract. -func (avsc APIVersionSetContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if avsc.APIVersionSetContractProperties != nil { - objectMap["properties"] = avsc.APIVersionSetContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIVersionSetContract struct. -func (avsc *APIVersionSetContract) 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 APIVersionSetContractProperties APIVersionSetContractProperties - err = json.Unmarshal(*v, &APIVersionSetContractProperties) - if err != nil { - return err - } - avsc.APIVersionSetContractProperties = &APIVersionSetContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - avsc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - avsc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - avsc.Type = &typeVar - } - } - } - - return nil -} - -// APIVersionSetContractDetails an API Version Set contains the common configuration for a set of API -// Versions relating -type APIVersionSetContractDetails struct { - // ID - Identifier for existing API Version Set. Omit this value to create a new Version Set. - ID *string `json:"id,omitempty"` - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersioningScheme - An value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'VersioningScheme1Segment', 'VersioningScheme1Query', 'VersioningScheme1Header' - VersioningScheme VersioningScheme1 `json:"versioningScheme,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// APIVersionSetContractProperties properties of an API Version Set. -type APIVersionSetContractProperties struct { - // DisplayName - Name of API Version Set - DisplayName *string `json:"displayName,omitempty"` - // VersioningScheme - An value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'VersioningSchemeSegment', 'VersioningSchemeQuery', 'VersioningSchemeHeader' - VersioningScheme VersioningScheme `json:"versioningScheme,omitempty"` - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// APIVersionSetEntityBase api Version set base parameters -type APIVersionSetEntityBase struct { - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// APIVersionSetUpdateParameters parameters to update or create an Api Version Set Contract. -type APIVersionSetUpdateParameters struct { - // APIVersionSetUpdateParametersProperties - Parameters to update or create an Api Version Set Contract. - *APIVersionSetUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIVersionSetUpdateParameters. -func (avsup APIVersionSetUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if avsup.APIVersionSetUpdateParametersProperties != nil { - objectMap["properties"] = avsup.APIVersionSetUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIVersionSetUpdateParameters struct. -func (avsup *APIVersionSetUpdateParameters) 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 APIVersionSetUpdateParametersProperties APIVersionSetUpdateParametersProperties - err = json.Unmarshal(*v, &APIVersionSetUpdateParametersProperties) - if err != nil { - return err - } - avsup.APIVersionSetUpdateParametersProperties = &APIVersionSetUpdateParametersProperties - } - } - } - - return nil -} - -// APIVersionSetUpdateParametersProperties properties used to create or update an API Version Set. -type APIVersionSetUpdateParametersProperties struct { - // DisplayName - Name of API Version Set - DisplayName *string `json:"displayName,omitempty"` - // VersioningScheme - An value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'VersioningSchemeSegment', 'VersioningSchemeQuery', 'VersioningSchemeHeader' - VersioningScheme VersioningScheme `json:"versioningScheme,omitempty"` - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// AuthenticationSettingsContract API Authentication Settings. -type AuthenticationSettingsContract struct { - // OAuth2 - OAuth2 Authentication settings - OAuth2 *OAuth2AuthenticationSettingsContract `json:"oAuth2,omitempty"` - // Openid - OpenID Connect Authentication Settings - Openid *OpenIDAuthenticationSettingsContract `json:"openid,omitempty"` - // SubscriptionKeyRequired - Specifies whether subscription key is required during call to this API, true - API is included into closed products only, false - API is included into open products alone, null - there is a mix of products. - SubscriptionKeyRequired *bool `json:"subscriptionKeyRequired,omitempty"` -} - -// AuthorizationServerCollection paged OAuth2 Authorization Servers list representation. -type AuthorizationServerCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]AuthorizationServerContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// AuthorizationServerCollectionIterator provides access to a complete listing of -// AuthorizationServerContract values. -type AuthorizationServerCollectionIterator struct { - i int - page AuthorizationServerCollectionPage -} - -// 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 *AuthorizationServerCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerCollectionIterator.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 *AuthorizationServerCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AuthorizationServerCollectionIterator) 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 AuthorizationServerCollectionIterator) Response() AuthorizationServerCollection { - 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 AuthorizationServerCollectionIterator) Value() AuthorizationServerContract { - if !iter.page.NotDone() { - return AuthorizationServerContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AuthorizationServerCollectionIterator type. -func NewAuthorizationServerCollectionIterator(page AuthorizationServerCollectionPage) AuthorizationServerCollectionIterator { - return AuthorizationServerCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asc AuthorizationServerCollection) IsEmpty() bool { - return asc.Value == nil || len(*asc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asc AuthorizationServerCollection) hasNextLink() bool { - return asc.NextLink != nil && len(*asc.NextLink) != 0 -} - -// authorizationServerCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asc AuthorizationServerCollection) authorizationServerCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asc.NextLink))) -} - -// AuthorizationServerCollectionPage contains a page of AuthorizationServerContract values. -type AuthorizationServerCollectionPage struct { - fn func(context.Context, AuthorizationServerCollection) (AuthorizationServerCollection, error) - asc AuthorizationServerCollection -} - -// 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 *AuthorizationServerCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerCollectionPage.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.asc) - if err != nil { - return err - } - page.asc = 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 *AuthorizationServerCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AuthorizationServerCollectionPage) NotDone() bool { - return !page.asc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AuthorizationServerCollectionPage) Response() AuthorizationServerCollection { - return page.asc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AuthorizationServerCollectionPage) Values() []AuthorizationServerContract { - if page.asc.IsEmpty() { - return nil - } - return *page.asc.Value -} - -// Creates a new instance of the AuthorizationServerCollectionPage type. -func NewAuthorizationServerCollectionPage(cur AuthorizationServerCollection, getNextPage func(context.Context, AuthorizationServerCollection) (AuthorizationServerCollection, error)) AuthorizationServerCollectionPage { - return AuthorizationServerCollectionPage{ - fn: getNextPage, - asc: cur, - } -} - -// AuthorizationServerContract external OAuth authorization server settings. -type AuthorizationServerContract struct { - autorest.Response `json:"-"` - // AuthorizationServerContractProperties - Properties of the External OAuth authorization server Contract. - *AuthorizationServerContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AuthorizationServerContract. -func (asc AuthorizationServerContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asc.AuthorizationServerContractProperties != nil { - objectMap["properties"] = asc.AuthorizationServerContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AuthorizationServerContract struct. -func (asc *AuthorizationServerContract) 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 authorizationServerContractProperties AuthorizationServerContractProperties - err = json.Unmarshal(*v, &authorizationServerContractProperties) - if err != nil { - return err - } - asc.AuthorizationServerContractProperties = &authorizationServerContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asc.Type = &typeVar - } - } - } - - return nil -} - -// AuthorizationServerContractBaseProperties external OAuth authorization server Update settings contract. -type AuthorizationServerContractBaseProperties struct { - // Description - Description of the authorization server. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` - // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` - // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - SupportState *bool `json:"supportState,omitempty"` - // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - DefaultScope *string `json:"defaultScope,omitempty"` - // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. - BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` - // ClientSecret - Client or app secret registered with this authorization server. - ClientSecret *string `json:"clientSecret,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// AuthorizationServerContractProperties external OAuth authorization server settings Properties. -type AuthorizationServerContractProperties struct { - // DisplayName - User-friendly authorization server name. - DisplayName *string `json:"displayName,omitempty"` - // ClientRegistrationEndpoint - Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` - // AuthorizationEndpoint - OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` - // GrantTypes - Form of an authorization grant, which the client uses to request the access token. - GrantTypes *[]GrantType `json:"grantTypes,omitempty"` - // ClientID - Client or app id registered with this authorization server. - ClientID *string `json:"clientId,omitempty"` - // Description - Description of the authorization server. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` - // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` - // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - SupportState *bool `json:"supportState,omitempty"` - // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - DefaultScope *string `json:"defaultScope,omitempty"` - // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. - BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` - // ClientSecret - Client or app secret registered with this authorization server. - ClientSecret *string `json:"clientSecret,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// AuthorizationServerUpdateContract external OAuth authorization server settings. -type AuthorizationServerUpdateContract struct { - // AuthorizationServerUpdateContractProperties - Properties of the External OAuth authorization server update Contract. - *AuthorizationServerUpdateContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AuthorizationServerUpdateContract. -func (asuc AuthorizationServerUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asuc.AuthorizationServerUpdateContractProperties != nil { - objectMap["properties"] = asuc.AuthorizationServerUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AuthorizationServerUpdateContract struct. -func (asuc *AuthorizationServerUpdateContract) 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 authorizationServerUpdateContractProperties AuthorizationServerUpdateContractProperties - err = json.Unmarshal(*v, &authorizationServerUpdateContractProperties) - if err != nil { - return err - } - asuc.AuthorizationServerUpdateContractProperties = &authorizationServerUpdateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asuc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asuc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asuc.Type = &typeVar - } - } - } - - return nil -} - -// AuthorizationServerUpdateContractProperties external OAuth authorization server Update settings -// contract. -type AuthorizationServerUpdateContractProperties struct { - // DisplayName - User-friendly authorization server name. - DisplayName *string `json:"displayName,omitempty"` - // ClientRegistrationEndpoint - Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` - // AuthorizationEndpoint - OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` - // GrantTypes - Form of an authorization grant, which the client uses to request the access token. - GrantTypes *[]GrantType `json:"grantTypes,omitempty"` - // ClientID - Client or app id registered with this authorization server. - ClientID *string `json:"clientId,omitempty"` - // Description - Description of the authorization server. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` - // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` - // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - SupportState *bool `json:"supportState,omitempty"` - // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - DefaultScope *string `json:"defaultScope,omitempty"` - // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. - BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` - // ClientSecret - Client or app secret registered with this authorization server. - ClientSecret *string `json:"clientSecret,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// BackendAuthorizationHeaderCredentials authorization header information. -type BackendAuthorizationHeaderCredentials struct { - // Scheme - Authentication Scheme name. - Scheme *string `json:"scheme,omitempty"` - // Parameter - Authentication Parameter value. - Parameter *string `json:"parameter,omitempty"` -} - -// BackendBaseParameters backend entity base Parameter set. -type BackendBaseParameters struct { - // Title - Backend Title. - Title *string `json:"title,omitempty"` - // Description - Backend Description. - Description *string `json:"description,omitempty"` - // ResourceID - Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. - ResourceID *string `json:"resourceId,omitempty"` - // Properties - Backend Properties contract - Properties *BackendProperties `json:"properties,omitempty"` - // Credentials - Backend Credentials Contract Properties - Credentials *BackendCredentialsContract `json:"credentials,omitempty"` - // Proxy - Backend Proxy Contract Properties - Proxy *BackendProxyContract `json:"proxy,omitempty"` - // TLS - Backend TLS Properties - TLS *BackendTLSProperties `json:"tls,omitempty"` -} - -// BackendCollection paged Backend list representation. -type BackendCollection struct { - autorest.Response `json:"-"` - // Value - Backend values. - Value *[]BackendContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// BackendCollectionIterator provides access to a complete listing of BackendContract values. -type BackendCollectionIterator struct { - i int - page BackendCollectionPage -} - -// 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 *BackendCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendCollectionIterator.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 *BackendCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BackendCollectionIterator) 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 BackendCollectionIterator) Response() BackendCollection { - 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 BackendCollectionIterator) Value() BackendContract { - if !iter.page.NotDone() { - return BackendContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BackendCollectionIterator type. -func NewBackendCollectionIterator(page BackendCollectionPage) BackendCollectionIterator { - return BackendCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bc BackendCollection) IsEmpty() bool { - return bc.Value == nil || len(*bc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bc BackendCollection) hasNextLink() bool { - return bc.NextLink != nil && len(*bc.NextLink) != 0 -} - -// backendCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bc BackendCollection) backendCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !bc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bc.NextLink))) -} - -// BackendCollectionPage contains a page of BackendContract values. -type BackendCollectionPage struct { - fn func(context.Context, BackendCollection) (BackendCollection, error) - bc BackendCollection -} - -// 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 *BackendCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendCollectionPage.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.bc) - if err != nil { - return err - } - page.bc = 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 *BackendCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BackendCollectionPage) NotDone() bool { - return !page.bc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BackendCollectionPage) Response() BackendCollection { - return page.bc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BackendCollectionPage) Values() []BackendContract { - if page.bc.IsEmpty() { - return nil - } - return *page.bc.Value -} - -// Creates a new instance of the BackendCollectionPage type. -func NewBackendCollectionPage(cur BackendCollection, getNextPage func(context.Context, BackendCollection) (BackendCollection, error)) BackendCollectionPage { - return BackendCollectionPage{ - fn: getNextPage, - bc: cur, - } -} - -// BackendContract backend details. -type BackendContract struct { - autorest.Response `json:"-"` - // BackendContractProperties - Backend entity contract properties. - *BackendContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendContract. -func (bc BackendContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bc.BackendContractProperties != nil { - objectMap["properties"] = bc.BackendContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendContract struct. -func (bc *BackendContract) 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 backendContractProperties BackendContractProperties - err = json.Unmarshal(*v, &backendContractProperties) - if err != nil { - return err - } - bc.BackendContractProperties = &backendContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bc.Type = &typeVar - } - } - } - - return nil -} - -// BackendContractProperties parameters supplied to the Create Backend operation. -type BackendContractProperties struct { - // URL - Runtime Url of the Backend. - URL *string `json:"url,omitempty"` - // Protocol - Backend communication protocol. Possible values include: 'BackendProtocolHTTP', 'BackendProtocolSoap' - Protocol BackendProtocol `json:"protocol,omitempty"` - // Title - Backend Title. - Title *string `json:"title,omitempty"` - // Description - Backend Description. - Description *string `json:"description,omitempty"` - // ResourceID - Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. - ResourceID *string `json:"resourceId,omitempty"` - // Properties - Backend Properties contract - Properties *BackendProperties `json:"properties,omitempty"` - // Credentials - Backend Credentials Contract Properties - Credentials *BackendCredentialsContract `json:"credentials,omitempty"` - // Proxy - Backend Proxy Contract Properties - Proxy *BackendProxyContract `json:"proxy,omitempty"` - // TLS - Backend TLS Properties - TLS *BackendTLSProperties `json:"tls,omitempty"` -} - -// BackendCredentialsContract details of the Credentials used to connect to Backend. -type BackendCredentialsContract struct { - // Certificate - List of Client Certificate Thumbprint. - Certificate *[]string `json:"certificate,omitempty"` - // Query - Query Parameter description. - Query map[string][]string `json:"query"` - // Header - Header Parameter description. - Header map[string][]string `json:"header"` - // Authorization - Authorization header authentication - Authorization *BackendAuthorizationHeaderCredentials `json:"authorization,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendCredentialsContract. -func (bcc BackendCredentialsContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bcc.Certificate != nil { - objectMap["certificate"] = bcc.Certificate - } - if bcc.Query != nil { - objectMap["query"] = bcc.Query - } - if bcc.Header != nil { - objectMap["header"] = bcc.Header - } - if bcc.Authorization != nil { - objectMap["authorization"] = bcc.Authorization - } - return json.Marshal(objectMap) -} - -// BackendProperties properties specific to the Backend Type. -type BackendProperties struct { - // ServiceFabricCluster - Backend Service Fabric Cluster Properties - ServiceFabricCluster *BackendServiceFabricClusterProperties `json:"serviceFabricCluster,omitempty"` -} - -// BackendProxyContract details of the Backend WebProxy Server to use in the Request to Backend. -type BackendProxyContract struct { - // URL - WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. - URL *string `json:"url,omitempty"` - // Username - Username to connect to the WebProxy server - Username *string `json:"username,omitempty"` - // Password - Password to connect to the WebProxy Server - Password *string `json:"password,omitempty"` -} - -// BackendReconnectContract reconnect request parameters. -type BackendReconnectContract struct { - // BackendReconnectProperties - Reconnect request properties. - *BackendReconnectProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendReconnectContract. -func (brc BackendReconnectContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if brc.BackendReconnectProperties != nil { - objectMap["properties"] = brc.BackendReconnectProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendReconnectContract struct. -func (brc *BackendReconnectContract) 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 backendReconnectProperties BackendReconnectProperties - err = json.Unmarshal(*v, &backendReconnectProperties) - if err != nil { - return err - } - brc.BackendReconnectProperties = &backendReconnectProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - brc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - brc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - brc.Type = &typeVar - } - } - } - - return nil -} - -// BackendReconnectProperties properties to control reconnect requests. -type BackendReconnectProperties struct { - // After - Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. - After *string `json:"after,omitempty"` -} - -// BackendServiceFabricClusterProperties properties of the Service Fabric Type Backend. -type BackendServiceFabricClusterProperties struct { - // ClientCertificatethumbprint - The client certificate thumbprint for the management endpoint. - ClientCertificatethumbprint *string `json:"clientCertificatethumbprint,omitempty"` - // MaxPartitionResolutionRetries - Maximum number of retries while attempting resolve the partition. - MaxPartitionResolutionRetries *int32 `json:"maxPartitionResolutionRetries,omitempty"` - // ManagementEndpoints - The cluster management endpoint. - ManagementEndpoints *[]string `json:"managementEndpoints,omitempty"` - // ServerCertificateThumbprints - Thumbprints of certificates cluster management service uses for tls communication - ServerCertificateThumbprints *[]string `json:"serverCertificateThumbprints,omitempty"` - // ServerX509Names - Server X509 Certificate Names Collection - ServerX509Names *[]X509CertificateName `json:"serverX509Names,omitempty"` -} - -// BackendTLSProperties properties controlling TLS Certificate Validation. -type BackendTLSProperties struct { - // ValidateCertificateChain - Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. - ValidateCertificateChain *bool `json:"validateCertificateChain,omitempty"` - // ValidateCertificateName - Flag indicating whether SSL certificate name validation should be done when using self-signed certificates for this backend host. - ValidateCertificateName *bool `json:"validateCertificateName,omitempty"` -} - -// BackendUpdateParameterProperties parameters supplied to the Update Backend operation. -type BackendUpdateParameterProperties struct { - // URL - Runtime Url of the Backend. - URL *string `json:"url,omitempty"` - // Protocol - Backend communication protocol. Possible values include: 'BackendProtocolHTTP', 'BackendProtocolSoap' - Protocol BackendProtocol `json:"protocol,omitempty"` - // Title - Backend Title. - Title *string `json:"title,omitempty"` - // Description - Backend Description. - Description *string `json:"description,omitempty"` - // ResourceID - Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. - ResourceID *string `json:"resourceId,omitempty"` - // Properties - Backend Properties contract - Properties *BackendProperties `json:"properties,omitempty"` - // Credentials - Backend Credentials Contract Properties - Credentials *BackendCredentialsContract `json:"credentials,omitempty"` - // Proxy - Backend Proxy Contract Properties - Proxy *BackendProxyContract `json:"proxy,omitempty"` - // TLS - Backend TLS Properties - TLS *BackendTLSProperties `json:"tls,omitempty"` -} - -// BackendUpdateParameters backend update parameters. -type BackendUpdateParameters struct { - // BackendUpdateParameterProperties - Backend entity update contract properties. - *BackendUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendUpdateParameters. -func (bup BackendUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bup.BackendUpdateParameterProperties != nil { - objectMap["properties"] = bup.BackendUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendUpdateParameters struct. -func (bup *BackendUpdateParameters) 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 backendUpdateParameterProperties BackendUpdateParameterProperties - err = json.Unmarshal(*v, &backendUpdateParameterProperties) - if err != nil { - return err - } - bup.BackendUpdateParameterProperties = &backendUpdateParameterProperties - } - } - } - - return nil -} - -// BodyDiagnosticSettings body logging settings. -type BodyDiagnosticSettings struct { - // Bytes - Number of request body bytes to log. - Bytes *int32 `json:"bytes,omitempty"` -} - -// CacheCollection paged Caches list representation. -type CacheCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]CacheContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// CacheCollectionIterator provides access to a complete listing of CacheContract values. -type CacheCollectionIterator struct { - i int - page CacheCollectionPage -} - -// 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 *CacheCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheCollectionIterator.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 *CacheCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CacheCollectionIterator) 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 CacheCollectionIterator) Response() CacheCollection { - 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 CacheCollectionIterator) Value() CacheContract { - if !iter.page.NotDone() { - return CacheContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CacheCollectionIterator type. -func NewCacheCollectionIterator(page CacheCollectionPage) CacheCollectionIterator { - return CacheCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cc CacheCollection) IsEmpty() bool { - return cc.Value == nil || len(*cc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cc CacheCollection) hasNextLink() bool { - return cc.NextLink != nil && len(*cc.NextLink) != 0 -} - -// cacheCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cc CacheCollection) cacheCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !cc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cc.NextLink))) -} - -// CacheCollectionPage contains a page of CacheContract values. -type CacheCollectionPage struct { - fn func(context.Context, CacheCollection) (CacheCollection, error) - cc CacheCollection -} - -// 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 *CacheCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheCollectionPage.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.cc) - if err != nil { - return err - } - page.cc = 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 *CacheCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CacheCollectionPage) NotDone() bool { - return !page.cc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CacheCollectionPage) Response() CacheCollection { - return page.cc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CacheCollectionPage) Values() []CacheContract { - if page.cc.IsEmpty() { - return nil - } - return *page.cc.Value -} - -// Creates a new instance of the CacheCollectionPage type. -func NewCacheCollectionPage(cur CacheCollection, getNextPage func(context.Context, CacheCollection) (CacheCollection, error)) CacheCollectionPage { - return CacheCollectionPage{ - fn: getNextPage, - cc: cur, - } -} - -// CacheContract cache details. -type CacheContract struct { - autorest.Response `json:"-"` - // CacheContractProperties - Cache properties details. - *CacheContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for CacheContract. -func (cc CacheContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.CacheContractProperties != nil { - objectMap["properties"] = cc.CacheContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CacheContract struct. -func (cc *CacheContract) 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 cacheContractProperties CacheContractProperties - err = json.Unmarshal(*v, &cacheContractProperties) - if err != nil { - return err - } - cc.CacheContractProperties = &cacheContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cc.Type = &typeVar - } - } - } - - return nil -} - -// CacheContractProperties properties of the Cache contract. -type CacheContractProperties struct { - // Description - Cache description - Description *string `json:"description,omitempty"` - // ConnectionString - Runtime connection string to cache - ConnectionString *string `json:"connectionString,omitempty"` - // ResourceID - Original uri of entity in external system cache points to - ResourceID *string `json:"resourceId,omitempty"` -} - -// CacheUpdateParameters cache update details. -type CacheUpdateParameters struct { - // CacheUpdateProperties - Cache update properties details. - *CacheUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CacheUpdateParameters. -func (cup CacheUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.CacheUpdateProperties != nil { - objectMap["properties"] = cup.CacheUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CacheUpdateParameters struct. -func (cup *CacheUpdateParameters) 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 cacheUpdateProperties CacheUpdateProperties - err = json.Unmarshal(*v, &cacheUpdateProperties) - if err != nil { - return err - } - cup.CacheUpdateProperties = &cacheUpdateProperties - } - } - } - - return nil -} - -// CacheUpdateProperties parameters supplied to the Update Cache operation. -type CacheUpdateProperties struct { - // Description - Cache description - Description *string `json:"description,omitempty"` - // ConnectionString - Runtime connection string to cache - ConnectionString *string `json:"connectionString,omitempty"` - // ResourceID - Original uri of entity in external system cache points to - ResourceID *string `json:"resourceId,omitempty"` -} - -// CertificateCollection paged Certificates list representation. -type CertificateCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]CertificateContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateCollectionIterator provides access to a complete listing of CertificateContract values. -type CertificateCollectionIterator struct { - i int - page CertificateCollectionPage -} - -// 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 *CertificateCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionIterator.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 *CertificateCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CertificateCollectionIterator) 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 CertificateCollectionIterator) Response() CertificateCollection { - 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 CertificateCollectionIterator) Value() CertificateContract { - if !iter.page.NotDone() { - return CertificateContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CertificateCollectionIterator type. -func NewCertificateCollectionIterator(page CertificateCollectionPage) CertificateCollectionIterator { - return CertificateCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cc CertificateCollection) IsEmpty() bool { - return cc.Value == nil || len(*cc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cc CertificateCollection) hasNextLink() bool { - return cc.NextLink != nil && len(*cc.NextLink) != 0 -} - -// certificateCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cc CertificateCollection) certificateCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !cc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cc.NextLink))) -} - -// CertificateCollectionPage contains a page of CertificateContract values. -type CertificateCollectionPage struct { - fn func(context.Context, CertificateCollection) (CertificateCollection, error) - cc CertificateCollection -} - -// 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 *CertificateCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionPage.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.cc) - if err != nil { - return err - } - page.cc = 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 *CertificateCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CertificateCollectionPage) NotDone() bool { - return !page.cc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CertificateCollectionPage) Response() CertificateCollection { - return page.cc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CertificateCollectionPage) Values() []CertificateContract { - if page.cc.IsEmpty() { - return nil - } - return *page.cc.Value -} - -// Creates a new instance of the CertificateCollectionPage type. -func NewCertificateCollectionPage(cur CertificateCollection, getNextPage func(context.Context, CertificateCollection) (CertificateCollection, error)) CertificateCollectionPage { - return CertificateCollectionPage{ - fn: getNextPage, - cc: cur, - } -} - -// CertificateConfiguration certificate configuration which consist of non-trusted intermediates and root -// certificates. -type CertificateConfiguration struct { - // EncodedCertificate - Base64 Encoded certificate. - EncodedCertificate *string `json:"encodedCertificate,omitempty"` - // CertificatePassword - Certificate Password. - CertificatePassword *string `json:"certificatePassword,omitempty"` - // StoreName - The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. Possible values include: 'CertificateAuthority', 'Root' - StoreName StoreName `json:"storeName,omitempty"` - // Certificate - Certificate information. - Certificate *CertificateInformation `json:"certificate,omitempty"` -} - -// CertificateContract certificate details. -type CertificateContract struct { - autorest.Response `json:"-"` - // CertificateContractProperties - Certificate properties details. - *CertificateContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateContract. -func (cc CertificateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.CertificateContractProperties != nil { - objectMap["properties"] = cc.CertificateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateContract struct. -func (cc *CertificateContract) 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 certificateContractProperties CertificateContractProperties - err = json.Unmarshal(*v, &certificateContractProperties) - if err != nil { - return err - } - cc.CertificateContractProperties = &certificateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cc.Type = &typeVar - } - } - } - - return nil -} - -// CertificateContractProperties properties of the Certificate contract. -type CertificateContractProperties struct { - // Subject - Subject attribute of the certificate. - Subject *string `json:"subject,omitempty"` - // Thumbprint - Thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // ExpirationDate - Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` -} - -// CertificateCreateOrUpdateParameters certificate create or update details. -type CertificateCreateOrUpdateParameters struct { - // CertificateCreateOrUpdateProperties - Certificate create or update properties details. - *CertificateCreateOrUpdateProperties `json:"properties,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 - } - } - } - - return nil -} - -// CertificateCreateOrUpdateProperties parameters supplied to the CreateOrUpdate certificate operation. -type CertificateCreateOrUpdateProperties struct { - // Data - Base 64 encoded certificate using the application/x-pkcs12 representation. - Data *string `json:"data,omitempty"` - // Password - Password for the Certificate - Password *string `json:"password,omitempty"` -} - -// CertificateInformation SSL certificate information. -type CertificateInformation struct { - autorest.Response `json:"-"` - // Expiry - Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Expiry *date.Time `json:"expiry,omitempty"` - // Thumbprint - Thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // Subject - Subject of the certificate. - Subject *string `json:"subject,omitempty"` -} - -// ConnectivityStatusContract details about connectivity to a resource. -type ConnectivityStatusContract struct { - // Name - The hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. - Name *string `json:"name,omitempty"` - // Status - Resource Connectivity Status Type identifier. Possible values include: 'Initializing', 'Success', 'Failure' - Status ConnectivityStatusType `json:"status,omitempty"` - // Error - Error details of the connectivity to the resource. - Error *string `json:"error,omitempty"` - // LastUpdated - The date when the resource connectivity status was last updated. This status should be updated every 15 minutes. If this status has not been updated, then it means that the service has lost network connectivity to the resource, from inside the Virtual Network.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - LastUpdated *date.Time `json:"lastUpdated,omitempty"` - // LastStatusChange - The date when the resource connectivity status last Changed from success to failure or vice-versa. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - LastStatusChange *date.Time `json:"lastStatusChange,omitempty"` -} - -// CurrentUserIdentity ... -type CurrentUserIdentity struct { - // ID - API Management service user id. - ID *string `json:"id,omitempty"` -} - -// DeployConfigurationParameters parameters supplied to the Deploy Configuration operation. -type DeployConfigurationParameters struct { - // Branch - The name of the Git branch from which the configuration is to be deployed to the configuration database. - Branch *string `json:"branch,omitempty"` - // Force - The value enforcing deleting subscriptions to products that are deleted in this update. - Force *bool `json:"force,omitempty"` -} - -// DiagnosticCollection paged Diagnostic list representation. -type DiagnosticCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]DiagnosticContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// DiagnosticCollectionIterator provides access to a complete listing of DiagnosticContract values. -type DiagnosticCollectionIterator struct { - i int - page DiagnosticCollectionPage -} - -// 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 *DiagnosticCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticCollectionIterator.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 *DiagnosticCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DiagnosticCollectionIterator) 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 DiagnosticCollectionIterator) Response() DiagnosticCollection { - 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 DiagnosticCollectionIterator) Value() DiagnosticContract { - if !iter.page.NotDone() { - return DiagnosticContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DiagnosticCollectionIterator type. -func NewDiagnosticCollectionIterator(page DiagnosticCollectionPage) DiagnosticCollectionIterator { - return DiagnosticCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dc DiagnosticCollection) IsEmpty() bool { - return dc.Value == nil || len(*dc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dc DiagnosticCollection) hasNextLink() bool { - return dc.NextLink != nil && len(*dc.NextLink) != 0 -} - -// diagnosticCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dc DiagnosticCollection) diagnosticCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !dc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dc.NextLink))) -} - -// DiagnosticCollectionPage contains a page of DiagnosticContract values. -type DiagnosticCollectionPage struct { - fn func(context.Context, DiagnosticCollection) (DiagnosticCollection, error) - dc DiagnosticCollection -} - -// 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 *DiagnosticCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticCollectionPage.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.dc) - if err != nil { - return err - } - page.dc = 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 *DiagnosticCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DiagnosticCollectionPage) NotDone() bool { - return !page.dc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DiagnosticCollectionPage) Response() DiagnosticCollection { - return page.dc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DiagnosticCollectionPage) Values() []DiagnosticContract { - if page.dc.IsEmpty() { - return nil - } - return *page.dc.Value -} - -// Creates a new instance of the DiagnosticCollectionPage type. -func NewDiagnosticCollectionPage(cur DiagnosticCollection, getNextPage func(context.Context, DiagnosticCollection) (DiagnosticCollection, error)) DiagnosticCollectionPage { - return DiagnosticCollectionPage{ - fn: getNextPage, - dc: cur, - } -} - -// DiagnosticContract diagnostic details. -type DiagnosticContract struct { - autorest.Response `json:"-"` - // DiagnosticContractProperties - Diagnostic entity contract properties. - *DiagnosticContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DiagnosticContract. -func (dc DiagnosticContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dc.DiagnosticContractProperties != nil { - objectMap["properties"] = dc.DiagnosticContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticContract struct. -func (dc *DiagnosticContract) 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 diagnosticContractProperties DiagnosticContractProperties - err = json.Unmarshal(*v, &diagnosticContractProperties) - if err != nil { - return err - } - dc.DiagnosticContractProperties = &diagnosticContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dc.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticContractProperties diagnostic Entity Properties -type DiagnosticContractProperties struct { - // AlwaysLog - Specifies for what type of messages sampling settings should not apply. Possible values include: 'AllErrors' - AlwaysLog AlwaysLog `json:"alwaysLog,omitempty"` - // LoggerID - Resource Id of a target logger. - LoggerID *string `json:"loggerId,omitempty"` - // Sampling - Sampling settings for Diagnostic. - Sampling *SamplingSettings `json:"sampling,omitempty"` - // Frontend - Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. - Frontend *PipelineDiagnosticSettings `json:"frontend,omitempty"` - // Backend - Diagnostic settings for incoming/outgoing HTTP messages to the Backend - Backend *PipelineDiagnosticSettings `json:"backend,omitempty"` - // EnableHTTPCorrelationHeaders - Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true. - EnableHTTPCorrelationHeaders *bool `json:"enableHttpCorrelationHeaders,omitempty"` -} - -// EmailTemplateCollection paged email template list representation. -type EmailTemplateCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]EmailTemplateContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// EmailTemplateCollectionIterator provides access to a complete listing of EmailTemplateContract values. -type EmailTemplateCollectionIterator struct { - i int - page EmailTemplateCollectionPage -} - -// 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 *EmailTemplateCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateCollectionIterator.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 *EmailTemplateCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EmailTemplateCollectionIterator) 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 EmailTemplateCollectionIterator) Response() EmailTemplateCollection { - 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 EmailTemplateCollectionIterator) Value() EmailTemplateContract { - if !iter.page.NotDone() { - return EmailTemplateContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EmailTemplateCollectionIterator type. -func NewEmailTemplateCollectionIterator(page EmailTemplateCollectionPage) EmailTemplateCollectionIterator { - return EmailTemplateCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (etc EmailTemplateCollection) IsEmpty() bool { - return etc.Value == nil || len(*etc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (etc EmailTemplateCollection) hasNextLink() bool { - return etc.NextLink != nil && len(*etc.NextLink) != 0 -} - -// emailTemplateCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (etc EmailTemplateCollection) emailTemplateCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !etc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(etc.NextLink))) -} - -// EmailTemplateCollectionPage contains a page of EmailTemplateContract values. -type EmailTemplateCollectionPage struct { - fn func(context.Context, EmailTemplateCollection) (EmailTemplateCollection, error) - etc EmailTemplateCollection -} - -// 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 *EmailTemplateCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateCollectionPage.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.etc) - if err != nil { - return err - } - page.etc = 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 *EmailTemplateCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EmailTemplateCollectionPage) NotDone() bool { - return !page.etc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EmailTemplateCollectionPage) Response() EmailTemplateCollection { - return page.etc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EmailTemplateCollectionPage) Values() []EmailTemplateContract { - if page.etc.IsEmpty() { - return nil - } - return *page.etc.Value -} - -// Creates a new instance of the EmailTemplateCollectionPage type. -func NewEmailTemplateCollectionPage(cur EmailTemplateCollection, getNextPage func(context.Context, EmailTemplateCollection) (EmailTemplateCollection, error)) EmailTemplateCollectionPage { - return EmailTemplateCollectionPage{ - fn: getNextPage, - etc: cur, - } -} - -// EmailTemplateContract email Template details. -type EmailTemplateContract struct { - autorest.Response `json:"-"` - // EmailTemplateContractProperties - Email Template entity contract properties. - *EmailTemplateContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailTemplateContract. -func (etc EmailTemplateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if etc.EmailTemplateContractProperties != nil { - objectMap["properties"] = etc.EmailTemplateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EmailTemplateContract struct. -func (etc *EmailTemplateContract) 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 emailTemplateContractProperties EmailTemplateContractProperties - err = json.Unmarshal(*v, &emailTemplateContractProperties) - if err != nil { - return err - } - etc.EmailTemplateContractProperties = &emailTemplateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - etc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - etc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - etc.Type = &typeVar - } - } - } - - return nil -} - -// EmailTemplateContractProperties email Template Contract properties. -type EmailTemplateContractProperties struct { - // Subject - Subject of the Template. - Subject *string `json:"subject,omitempty"` - // Body - Email Template Body. This should be a valid XDocument - Body *string `json:"body,omitempty"` - // Title - Title of the Template. - Title *string `json:"title,omitempty"` - // Description - Description of the Email Template. - Description *string `json:"description,omitempty"` - // IsDefault - READ-ONLY; Whether the template is the default template provided by Api Management or has been edited. - IsDefault *bool `json:"isDefault,omitempty"` - // Parameters - Email Template Parameter values. - Parameters *[]EmailTemplateParametersContractProperties `json:"parameters,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailTemplateContractProperties. -func (etcp EmailTemplateContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if etcp.Subject != nil { - objectMap["subject"] = etcp.Subject - } - if etcp.Body != nil { - objectMap["body"] = etcp.Body - } - if etcp.Title != nil { - objectMap["title"] = etcp.Title - } - if etcp.Description != nil { - objectMap["description"] = etcp.Description - } - if etcp.Parameters != nil { - objectMap["parameters"] = etcp.Parameters - } - return json.Marshal(objectMap) -} - -// EmailTemplateParametersContractProperties email Template Parameter contract. -type EmailTemplateParametersContractProperties struct { - // Name - Template parameter name. - Name *string `json:"name,omitempty"` - // Title - Template parameter title. - Title *string `json:"title,omitempty"` - // Description - Template parameter description. - Description *string `json:"description,omitempty"` -} - -// EmailTemplateUpdateParameterProperties email Template Update Contract properties. -type EmailTemplateUpdateParameterProperties struct { - // Subject - Subject of the Template. - Subject *string `json:"subject,omitempty"` - // Title - Title of the Template. - Title *string `json:"title,omitempty"` - // Description - Description of the Email Template. - Description *string `json:"description,omitempty"` - // Body - Email Template Body. This should be a valid XDocument - Body *string `json:"body,omitempty"` - // Parameters - Email Template Parameter values. - Parameters *[]EmailTemplateParametersContractProperties `json:"parameters,omitempty"` -} - -// EmailTemplateUpdateParameters email Template update Parameters. -type EmailTemplateUpdateParameters struct { - // EmailTemplateUpdateParameterProperties - Email Template Update contract properties. - *EmailTemplateUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailTemplateUpdateParameters. -func (etup EmailTemplateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if etup.EmailTemplateUpdateParameterProperties != nil { - objectMap["properties"] = etup.EmailTemplateUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EmailTemplateUpdateParameters struct. -func (etup *EmailTemplateUpdateParameters) 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 emailTemplateUpdateParameterProperties EmailTemplateUpdateParameterProperties - err = json.Unmarshal(*v, &emailTemplateUpdateParameterProperties) - if err != nil { - return err - } - etup.EmailTemplateUpdateParameterProperties = &emailTemplateUpdateParameterProperties - } - } - } - - return nil -} - -// ErrorFieldContract error Field contract. -type ErrorFieldContract 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"` -} - -// ErrorResponse error Response. -type ErrorResponse struct { - // ErrorResponseBody - Properties of the Error Response. - *ErrorResponseBody `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.ErrorResponseBody != nil { - objectMap["error"] = er.ErrorResponseBody - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ErrorResponse struct. -func (er *ErrorResponse) 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 "error": - if v != nil { - var errorResponseBody ErrorResponseBody - err = json.Unmarshal(*v, &errorResponseBody) - if err != nil { - return err - } - er.ErrorResponseBody = &errorResponseBody - } - } - } - - return nil -} - -// ErrorResponseBody error Body contract. -type ErrorResponseBody 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 *[]ErrorFieldContract `json:"details,omitempty"` -} - -// GenerateSsoURLResult generate SSO Url operations response details. -type GenerateSsoURLResult struct { - autorest.Response `json:"-"` - // Value - Redirect Url containing the SSO URL value. - Value *string `json:"value,omitempty"` -} - -// GroupCollection paged Group list representation. -type GroupCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]GroupContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// GroupCollectionIterator provides access to a complete listing of GroupContract values. -type GroupCollectionIterator struct { - i int - page GroupCollectionPage -} - -// 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 *GroupCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupCollectionIterator.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 *GroupCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GroupCollectionIterator) 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 GroupCollectionIterator) Response() GroupCollection { - 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 GroupCollectionIterator) Value() GroupContract { - if !iter.page.NotDone() { - return GroupContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GroupCollectionIterator type. -func NewGroupCollectionIterator(page GroupCollectionPage) GroupCollectionIterator { - return GroupCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (gc GroupCollection) IsEmpty() bool { - return gc.Value == nil || len(*gc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (gc GroupCollection) hasNextLink() bool { - return gc.NextLink != nil && len(*gc.NextLink) != 0 -} - -// groupCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (gc GroupCollection) groupCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !gc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(gc.NextLink))) -} - -// GroupCollectionPage contains a page of GroupContract values. -type GroupCollectionPage struct { - fn func(context.Context, GroupCollection) (GroupCollection, error) - gc GroupCollection -} - -// 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 *GroupCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupCollectionPage.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.gc) - if err != nil { - return err - } - page.gc = 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 *GroupCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GroupCollectionPage) NotDone() bool { - return !page.gc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GroupCollectionPage) Response() GroupCollection { - return page.gc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GroupCollectionPage) Values() []GroupContract { - if page.gc.IsEmpty() { - return nil - } - return *page.gc.Value -} - -// Creates a new instance of the GroupCollectionPage type. -func NewGroupCollectionPage(cur GroupCollection, getNextPage func(context.Context, GroupCollection) (GroupCollection, error)) GroupCollectionPage { - return GroupCollectionPage{ - fn: getNextPage, - gc: cur, - } -} - -// GroupContract contract details. -type GroupContract struct { - autorest.Response `json:"-"` - // GroupContractProperties - Group entity contract properties. - *GroupContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupContract. -func (gc GroupContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gc.GroupContractProperties != nil { - objectMap["properties"] = gc.GroupContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupContract struct. -func (gc *GroupContract) 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 groupContractProperties GroupContractProperties - err = json.Unmarshal(*v, &groupContractProperties) - if err != nil { - return err - } - gc.GroupContractProperties = &groupContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gc.Type = &typeVar - } - } - } - - return nil -} - -// GroupContractProperties group contract Properties. -type GroupContractProperties struct { - // DisplayName - Group name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Group description. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // BuiltIn - READ-ONLY; true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. - BuiltIn *bool `json:"builtIn,omitempty"` - // Type - Group type. Possible values include: 'Custom', 'System', 'External' - Type GroupType `json:"type,omitempty"` - // ExternalID - For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null. - ExternalID *string `json:"externalId,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupContractProperties. -func (gcp GroupContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gcp.DisplayName != nil { - objectMap["displayName"] = gcp.DisplayName - } - if gcp.Description != nil { - objectMap["description"] = gcp.Description - } - if gcp.Type != "" { - objectMap["type"] = gcp.Type - } - if gcp.ExternalID != nil { - objectMap["externalId"] = gcp.ExternalID - } - return json.Marshal(objectMap) -} - -// GroupCreateParameters parameters supplied to the Create Group operation. -type GroupCreateParameters struct { - // GroupCreateParametersProperties - Properties supplied to Create Group operation. - *GroupCreateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupCreateParameters. -func (gcp GroupCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gcp.GroupCreateParametersProperties != nil { - objectMap["properties"] = gcp.GroupCreateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupCreateParameters struct. -func (gcp *GroupCreateParameters) 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 groupCreateParametersProperties GroupCreateParametersProperties - err = json.Unmarshal(*v, &groupCreateParametersProperties) - if err != nil { - return err - } - gcp.GroupCreateParametersProperties = &groupCreateParametersProperties - } - } - } - - return nil -} - -// GroupCreateParametersProperties parameters supplied to the Create Group operation. -type GroupCreateParametersProperties struct { - // DisplayName - Group name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Group description. - Description *string `json:"description,omitempty"` - // Type - Group type. Possible values include: 'Custom', 'System', 'External' - Type GroupType `json:"type,omitempty"` - // ExternalID - Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null. - ExternalID *string `json:"externalId,omitempty"` -} - -// GroupUpdateParameters parameters supplied to the Update Group operation. -type GroupUpdateParameters struct { - // GroupUpdateParametersProperties - Group entity update contract properties. - *GroupUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupUpdateParameters. -func (gup GroupUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gup.GroupUpdateParametersProperties != nil { - objectMap["properties"] = gup.GroupUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupUpdateParameters struct. -func (gup *GroupUpdateParameters) 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 groupUpdateParametersProperties GroupUpdateParametersProperties - err = json.Unmarshal(*v, &groupUpdateParametersProperties) - if err != nil { - return err - } - gup.GroupUpdateParametersProperties = &groupUpdateParametersProperties - } - } - } - - return nil -} - -// GroupUpdateParametersProperties parameters supplied to the Update Group operation. -type GroupUpdateParametersProperties struct { - // DisplayName - Group name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Group description. - Description *string `json:"description,omitempty"` - // Type - Group type. Possible values include: 'Custom', 'System', 'External' - Type GroupType `json:"type,omitempty"` - // ExternalID - Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null. - ExternalID *string `json:"externalId,omitempty"` -} - -// HostnameConfiguration custom hostname configuration. -type HostnameConfiguration struct { - // Type - Hostname type. Possible values include: 'Proxy', 'Portal', 'Management', 'Scm' - Type HostnameType `json:"type,omitempty"` - // HostName - Hostname to configure on the Api Management service. - HostName *string `json:"hostName,omitempty"` - // KeyVaultID - Url to the KeyVault Secret containing the Ssl Certificate. If absolute Url containing version is provided, auto-update of ssl certificate will not work. This requires Api Management service to be configured with MSI. The secret should be of type *application/x-pkcs12* - KeyVaultID *string `json:"keyVaultId,omitempty"` - // EncodedCertificate - Base64 Encoded certificate. - EncodedCertificate *string `json:"encodedCertificate,omitempty"` - // CertificatePassword - Certificate Password. - CertificatePassword *string `json:"certificatePassword,omitempty"` - // DefaultSslBinding - Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type. - DefaultSslBinding *bool `json:"defaultSslBinding,omitempty"` - // NegotiateClientCertificate - Specify true to always negotiate client certificate on the hostname. Default Value is false. - NegotiateClientCertificate *bool `json:"negotiateClientCertificate,omitempty"` - // Certificate - Certificate information. - Certificate *CertificateInformation `json:"certificate,omitempty"` -} - -// HostnameConfigurationOld custom hostname configuration. -type HostnameConfigurationOld struct { - // Type - Hostname type. Possible values include: 'Proxy', 'Portal', 'Management', 'Scm' - Type HostnameType `json:"type,omitempty"` - // Hostname - Hostname to configure. - Hostname *string `json:"hostname,omitempty"` - // Certificate - Certificate information. - Certificate *CertificateInformation `json:"certificate,omitempty"` -} - -// HTTPMessageDiagnostic http message diagnostic settings. -type HTTPMessageDiagnostic struct { - // Headers - Array of HTTP Headers to log. - Headers *[]string `json:"headers,omitempty"` - // Body - Body logging settings. - Body *BodyDiagnosticSettings `json:"body,omitempty"` -} - -// IdentityProviderBaseParameters identity Provider Base Parameter Properties. -type IdentityProviderBaseParameters struct { - // Type - Identity Provider Type identifier. Possible values include: 'Facebook', 'Google', 'Microsoft', 'Twitter', 'Aad', 'AadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IdentityProviderContract identity Provider details. -type IdentityProviderContract struct { - autorest.Response `json:"-"` - // IdentityProviderContractProperties - Identity Provider contract properties. - *IdentityProviderContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityProviderContract. -func (ipc IdentityProviderContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipc.IdentityProviderContractProperties != nil { - objectMap["properties"] = ipc.IdentityProviderContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IdentityProviderContract struct. -func (ipc *IdentityProviderContract) 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 identityProviderContractProperties IdentityProviderContractProperties - err = json.Unmarshal(*v, &identityProviderContractProperties) - if err != nil { - return err - } - ipc.IdentityProviderContractProperties = &identityProviderContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ipc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ipc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ipc.Type = &typeVar - } - } - } - - return nil -} - -// IdentityProviderContractProperties the external Identity Providers like Facebook, Google, Microsoft, -// Twitter or Azure Active Directory which can be used to enable access to the API Management service -// developer portal for all users. -type IdentityProviderContractProperties struct { - // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. - ClientSecret *string `json:"clientSecret,omitempty"` - // Type - Identity Provider Type identifier. Possible values include: 'Facebook', 'Google', 'Microsoft', 'Twitter', 'Aad', 'AadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IdentityProviderList list of all the Identity Providers configured on the service instance. -type IdentityProviderList struct { - autorest.Response `json:"-"` - // Value - Identity Provider configuration values. - Value *[]IdentityProviderContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// IdentityProviderListIterator provides access to a complete listing of IdentityProviderContract values. -type IdentityProviderListIterator struct { - i int - page IdentityProviderListPage -} - -// 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 *IdentityProviderListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderListIterator.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 *IdentityProviderListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IdentityProviderListIterator) 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 IdentityProviderListIterator) Response() IdentityProviderList { - 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 IdentityProviderListIterator) Value() IdentityProviderContract { - if !iter.page.NotDone() { - return IdentityProviderContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IdentityProviderListIterator type. -func NewIdentityProviderListIterator(page IdentityProviderListPage) IdentityProviderListIterator { - return IdentityProviderListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ipl IdentityProviderList) IsEmpty() bool { - return ipl.Value == nil || len(*ipl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ipl IdentityProviderList) hasNextLink() bool { - return ipl.NextLink != nil && len(*ipl.NextLink) != 0 -} - -// identityProviderListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ipl IdentityProviderList) identityProviderListPreparer(ctx context.Context) (*http.Request, error) { - if !ipl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ipl.NextLink))) -} - -// IdentityProviderListPage contains a page of IdentityProviderContract values. -type IdentityProviderListPage struct { - fn func(context.Context, IdentityProviderList) (IdentityProviderList, error) - ipl IdentityProviderList -} - -// 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 *IdentityProviderListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderListPage.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.ipl) - if err != nil { - return err - } - page.ipl = 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 *IdentityProviderListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IdentityProviderListPage) NotDone() bool { - return !page.ipl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IdentityProviderListPage) Response() IdentityProviderList { - return page.ipl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IdentityProviderListPage) Values() []IdentityProviderContract { - if page.ipl.IsEmpty() { - return nil - } - return *page.ipl.Value -} - -// Creates a new instance of the IdentityProviderListPage type. -func NewIdentityProviderListPage(cur IdentityProviderList, getNextPage func(context.Context, IdentityProviderList) (IdentityProviderList, error)) IdentityProviderListPage { - return IdentityProviderListPage{ - fn: getNextPage, - ipl: cur, - } -} - -// IdentityProviderUpdateParameters parameters supplied to update Identity Provider -type IdentityProviderUpdateParameters struct { - // IdentityProviderUpdateProperties - Identity Provider update properties. - *IdentityProviderUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityProviderUpdateParameters. -func (ipup IdentityProviderUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipup.IdentityProviderUpdateProperties != nil { - objectMap["properties"] = ipup.IdentityProviderUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IdentityProviderUpdateParameters struct. -func (ipup *IdentityProviderUpdateParameters) 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 identityProviderUpdateProperties IdentityProviderUpdateProperties - err = json.Unmarshal(*v, &identityProviderUpdateProperties) - if err != nil { - return err - } - ipup.IdentityProviderUpdateProperties = &identityProviderUpdateProperties - } - } - } - - return nil -} - -// IdentityProviderUpdateProperties parameters supplied to the Update Identity Provider operation. -type IdentityProviderUpdateProperties struct { - // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. - ClientSecret *string `json:"clientSecret,omitempty"` - // Type - Identity Provider Type identifier. Possible values include: 'Facebook', 'Google', 'Microsoft', 'Twitter', 'Aad', 'AadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IssueAttachmentCollection paged Issue Attachment list representation. -type IssueAttachmentCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Issue Attachment values. - Value *[]IssueAttachmentContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueAttachmentCollection. -func (iac IssueAttachmentCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IssueAttachmentCollectionIterator provides access to a complete listing of IssueAttachmentContract -// values. -type IssueAttachmentCollectionIterator struct { - i int - page IssueAttachmentCollectionPage -} - -// 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 *IssueAttachmentCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueAttachmentCollectionIterator.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 *IssueAttachmentCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IssueAttachmentCollectionIterator) 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 IssueAttachmentCollectionIterator) Response() IssueAttachmentCollection { - 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 IssueAttachmentCollectionIterator) Value() IssueAttachmentContract { - if !iter.page.NotDone() { - return IssueAttachmentContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IssueAttachmentCollectionIterator type. -func NewIssueAttachmentCollectionIterator(page IssueAttachmentCollectionPage) IssueAttachmentCollectionIterator { - return IssueAttachmentCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iac IssueAttachmentCollection) IsEmpty() bool { - return iac.Value == nil || len(*iac.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iac IssueAttachmentCollection) hasNextLink() bool { - return iac.NextLink != nil && len(*iac.NextLink) != 0 -} - -// issueAttachmentCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iac IssueAttachmentCollection) issueAttachmentCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !iac.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iac.NextLink))) -} - -// IssueAttachmentCollectionPage contains a page of IssueAttachmentContract values. -type IssueAttachmentCollectionPage struct { - fn func(context.Context, IssueAttachmentCollection) (IssueAttachmentCollection, error) - iac IssueAttachmentCollection -} - -// 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 *IssueAttachmentCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueAttachmentCollectionPage.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.iac) - if err != nil { - return err - } - page.iac = 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 *IssueAttachmentCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IssueAttachmentCollectionPage) NotDone() bool { - return !page.iac.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IssueAttachmentCollectionPage) Response() IssueAttachmentCollection { - return page.iac -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IssueAttachmentCollectionPage) Values() []IssueAttachmentContract { - if page.iac.IsEmpty() { - return nil - } - return *page.iac.Value -} - -// Creates a new instance of the IssueAttachmentCollectionPage type. -func NewIssueAttachmentCollectionPage(cur IssueAttachmentCollection, getNextPage func(context.Context, IssueAttachmentCollection) (IssueAttachmentCollection, error)) IssueAttachmentCollectionPage { - return IssueAttachmentCollectionPage{ - fn: getNextPage, - iac: cur, - } -} - -// IssueAttachmentContract issue Attachment Contract details. -type IssueAttachmentContract struct { - autorest.Response `json:"-"` - // IssueAttachmentContractProperties - Properties of the Issue Attachment. - *IssueAttachmentContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueAttachmentContract. -func (iac IssueAttachmentContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iac.IssueAttachmentContractProperties != nil { - objectMap["properties"] = iac.IssueAttachmentContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueAttachmentContract struct. -func (iac *IssueAttachmentContract) 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 issueAttachmentContractProperties IssueAttachmentContractProperties - err = json.Unmarshal(*v, &issueAttachmentContractProperties) - if err != nil { - return err - } - iac.IssueAttachmentContractProperties = &issueAttachmentContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - iac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - iac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - iac.Type = &typeVar - } - } - } - - return nil -} - -// IssueAttachmentContractProperties issue Attachment contract Properties. -type IssueAttachmentContractProperties struct { - // Title - Filename by which the binary data will be saved. - Title *string `json:"title,omitempty"` - // ContentFormat - Either 'link' if content is provided via an HTTP link or the MIME type of the Base64-encoded binary data provided in the 'content' property. - ContentFormat *string `json:"contentFormat,omitempty"` - // Content - An HTTP link or Base64-encoded binary data. - Content *string `json:"content,omitempty"` -} - -// IssueCollection paged Issue list representation. -type IssueCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Issue values. - Value *[]IssueContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueCollection. -func (ic IssueCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IssueCollectionIterator provides access to a complete listing of IssueContract values. -type IssueCollectionIterator struct { - i int - page IssueCollectionPage -} - -// 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 *IssueCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCollectionIterator.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 *IssueCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IssueCollectionIterator) 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 IssueCollectionIterator) Response() IssueCollection { - 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 IssueCollectionIterator) Value() IssueContract { - if !iter.page.NotDone() { - return IssueContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IssueCollectionIterator type. -func NewIssueCollectionIterator(page IssueCollectionPage) IssueCollectionIterator { - return IssueCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ic IssueCollection) IsEmpty() bool { - return ic.Value == nil || len(*ic.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ic IssueCollection) hasNextLink() bool { - return ic.NextLink != nil && len(*ic.NextLink) != 0 -} - -// issueCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ic IssueCollection) issueCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !ic.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ic.NextLink))) -} - -// IssueCollectionPage contains a page of IssueContract values. -type IssueCollectionPage struct { - fn func(context.Context, IssueCollection) (IssueCollection, error) - ic IssueCollection -} - -// 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 *IssueCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCollectionPage.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.ic) - if err != nil { - return err - } - page.ic = 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 *IssueCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IssueCollectionPage) NotDone() bool { - return !page.ic.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IssueCollectionPage) Response() IssueCollection { - return page.ic -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IssueCollectionPage) Values() []IssueContract { - if page.ic.IsEmpty() { - return nil - } - return *page.ic.Value -} - -// Creates a new instance of the IssueCollectionPage type. -func NewIssueCollectionPage(cur IssueCollection, getNextPage func(context.Context, IssueCollection) (IssueCollection, error)) IssueCollectionPage { - return IssueCollectionPage{ - fn: getNextPage, - ic: cur, - } -} - -// IssueCommentCollection paged Issue Comment list representation. -type IssueCommentCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Issue Comment values. - Value *[]IssueCommentContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueCommentCollection. -func (icc IssueCommentCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IssueCommentCollectionIterator provides access to a complete listing of IssueCommentContract values. -type IssueCommentCollectionIterator struct { - i int - page IssueCommentCollectionPage -} - -// 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 *IssueCommentCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCommentCollectionIterator.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 *IssueCommentCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IssueCommentCollectionIterator) 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 IssueCommentCollectionIterator) Response() IssueCommentCollection { - 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 IssueCommentCollectionIterator) Value() IssueCommentContract { - if !iter.page.NotDone() { - return IssueCommentContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IssueCommentCollectionIterator type. -func NewIssueCommentCollectionIterator(page IssueCommentCollectionPage) IssueCommentCollectionIterator { - return IssueCommentCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (icc IssueCommentCollection) IsEmpty() bool { - return icc.Value == nil || len(*icc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (icc IssueCommentCollection) hasNextLink() bool { - return icc.NextLink != nil && len(*icc.NextLink) != 0 -} - -// issueCommentCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (icc IssueCommentCollection) issueCommentCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !icc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(icc.NextLink))) -} - -// IssueCommentCollectionPage contains a page of IssueCommentContract values. -type IssueCommentCollectionPage struct { - fn func(context.Context, IssueCommentCollection) (IssueCommentCollection, error) - icc IssueCommentCollection -} - -// 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 *IssueCommentCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCommentCollectionPage.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.icc) - if err != nil { - return err - } - page.icc = 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 *IssueCommentCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IssueCommentCollectionPage) NotDone() bool { - return !page.icc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IssueCommentCollectionPage) Response() IssueCommentCollection { - return page.icc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IssueCommentCollectionPage) Values() []IssueCommentContract { - if page.icc.IsEmpty() { - return nil - } - return *page.icc.Value -} - -// Creates a new instance of the IssueCommentCollectionPage type. -func NewIssueCommentCollectionPage(cur IssueCommentCollection, getNextPage func(context.Context, IssueCommentCollection) (IssueCommentCollection, error)) IssueCommentCollectionPage { - return IssueCommentCollectionPage{ - fn: getNextPage, - icc: cur, - } -} - -// IssueCommentContract issue Comment Contract details. -type IssueCommentContract struct { - autorest.Response `json:"-"` - // IssueCommentContractProperties - Properties of the Issue Comment. - *IssueCommentContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueCommentContract. -func (icc IssueCommentContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icc.IssueCommentContractProperties != nil { - objectMap["properties"] = icc.IssueCommentContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueCommentContract struct. -func (icc *IssueCommentContract) 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 issueCommentContractProperties IssueCommentContractProperties - err = json.Unmarshal(*v, &issueCommentContractProperties) - if err != nil { - return err - } - icc.IssueCommentContractProperties = &issueCommentContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - icc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - icc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - icc.Type = &typeVar - } - } - } - - return nil -} - -// IssueCommentContractProperties issue Comment contract Properties. -type IssueCommentContractProperties struct { - // Text - Comment text. - Text *string `json:"text,omitempty"` - // CreatedDate - Date and time when the comment was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // UserID - A resource identifier for the user who left the comment. - UserID *string `json:"userId,omitempty"` -} - -// IssueContract issue Contract details. -type IssueContract struct { - autorest.Response `json:"-"` - // IssueContractProperties - Properties of the Issue. - *IssueContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueContract. -func (ic IssueContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ic.IssueContractProperties != nil { - objectMap["properties"] = ic.IssueContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueContract struct. -func (ic *IssueContract) 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 issueContractProperties IssueContractProperties - err = json.Unmarshal(*v, &issueContractProperties) - if err != nil { - return err - } - ic.IssueContractProperties = &issueContractProperties - } - 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 - } - } - } - - return nil -} - -// IssueContractBaseProperties issue contract Base Properties. -type IssueContractBaseProperties struct { - // CreatedDate - Date and time when the issue was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // State - Status of the issue. Possible values include: 'Proposed', 'Open', 'Removed', 'Resolved', 'Closed' - State State `json:"state,omitempty"` - // APIID - A resource identifier for the API the issue was created for. - APIID *string `json:"apiId,omitempty"` -} - -// IssueContractProperties issue contract Properties. -type IssueContractProperties struct { - // Title - The issue title. - Title *string `json:"title,omitempty"` - // Description - Text describing the issue. - Description *string `json:"description,omitempty"` - // UserID - A resource identifier for the user created the issue. - UserID *string `json:"userId,omitempty"` - // CreatedDate - Date and time when the issue was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // State - Status of the issue. Possible values include: 'Proposed', 'Open', 'Removed', 'Resolved', 'Closed' - State State `json:"state,omitempty"` - // APIID - A resource identifier for the API the issue was created for. - APIID *string `json:"apiId,omitempty"` -} - -// IssueUpdateContract issue update Parameters. -type IssueUpdateContract struct { - // IssueUpdateContractProperties - Issue entity Update contract properties. - *IssueUpdateContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueUpdateContract. -func (iuc IssueUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iuc.IssueUpdateContractProperties != nil { - objectMap["properties"] = iuc.IssueUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueUpdateContract struct. -func (iuc *IssueUpdateContract) 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 issueUpdateContractProperties IssueUpdateContractProperties - err = json.Unmarshal(*v, &issueUpdateContractProperties) - if err != nil { - return err - } - iuc.IssueUpdateContractProperties = &issueUpdateContractProperties - } - } - } - - return nil -} - -// IssueUpdateContractProperties issue contract Update Properties. -type IssueUpdateContractProperties struct { - // Title - The issue title. - Title *string `json:"title,omitempty"` - // Description - Text describing the issue. - Description *string `json:"description,omitempty"` - // UserID - A resource identifier for the user created the issue. - UserID *string `json:"userId,omitempty"` - // CreatedDate - Date and time when the issue was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // State - Status of the issue. Possible values include: 'Proposed', 'Open', 'Removed', 'Resolved', 'Closed' - State State `json:"state,omitempty"` - // APIID - A resource identifier for the API the issue was created for. - APIID *string `json:"apiId,omitempty"` -} - -// ListNetworkStatusContractByLocation ... -type ListNetworkStatusContractByLocation struct { - autorest.Response `json:"-"` - Value *[]NetworkStatusContractByLocation `json:"value,omitempty"` -} - -// LoggerCollection paged Logger list representation. -type LoggerCollection struct { - autorest.Response `json:"-"` - // Value - Logger values. - Value *[]LoggerContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// LoggerCollectionIterator provides access to a complete listing of LoggerContract values. -type LoggerCollectionIterator struct { - i int - page LoggerCollectionPage -} - -// 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 *LoggerCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerCollectionIterator.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 *LoggerCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LoggerCollectionIterator) 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 LoggerCollectionIterator) Response() LoggerCollection { - 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 LoggerCollectionIterator) Value() LoggerContract { - if !iter.page.NotDone() { - return LoggerContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LoggerCollectionIterator type. -func NewLoggerCollectionIterator(page LoggerCollectionPage) LoggerCollectionIterator { - return LoggerCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lc LoggerCollection) IsEmpty() bool { - return lc.Value == nil || len(*lc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lc LoggerCollection) hasNextLink() bool { - return lc.NextLink != nil && len(*lc.NextLink) != 0 -} - -// loggerCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lc LoggerCollection) loggerCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !lc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lc.NextLink))) -} - -// LoggerCollectionPage contains a page of LoggerContract values. -type LoggerCollectionPage struct { - fn func(context.Context, LoggerCollection) (LoggerCollection, error) - lc LoggerCollection -} - -// 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 *LoggerCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerCollectionPage.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.lc) - if err != nil { - return err - } - page.lc = 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 *LoggerCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LoggerCollectionPage) NotDone() bool { - return !page.lc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LoggerCollectionPage) Response() LoggerCollection { - return page.lc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LoggerCollectionPage) Values() []LoggerContract { - if page.lc.IsEmpty() { - return nil - } - return *page.lc.Value -} - -// Creates a new instance of the LoggerCollectionPage type. -func NewLoggerCollectionPage(cur LoggerCollection, getNextPage func(context.Context, LoggerCollection) (LoggerCollection, error)) LoggerCollectionPage { - return LoggerCollectionPage{ - fn: getNextPage, - lc: cur, - } -} - -// LoggerContract logger details. -type LoggerContract struct { - autorest.Response `json:"-"` - // LoggerContractProperties - Logger entity contract properties. - *LoggerContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerContract. -func (lc LoggerContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lc.LoggerContractProperties != nil { - objectMap["properties"] = lc.LoggerContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoggerContract struct. -func (lc *LoggerContract) 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 loggerContractProperties LoggerContractProperties - err = json.Unmarshal(*v, &loggerContractProperties) - if err != nil { - return err - } - lc.LoggerContractProperties = &loggerContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lc.Type = &typeVar - } - } - } - - return nil -} - -// LoggerContractProperties the Logger entity in API Management represents an event sink that you can use -// to log API Management events. Currently the Logger entity supports logging API Management events to -// Azure Event Hubs. -type LoggerContractProperties struct { - // LoggerType - Logger type. Possible values include: 'AzureEventHub', 'ApplicationInsights' - LoggerType LoggerType `json:"loggerType,omitempty"` - // Description - Logger description. - Description *string `json:"description,omitempty"` - // Credentials - The name and SendRule connection string of the event hub for azureEventHub logger. - // Instrumentation key for applicationInsights logger. - Credentials map[string]*string `json:"credentials"` - // IsBuffered - Whether records are buffered in the logger before publishing. Default is assumed to be true. - IsBuffered *bool `json:"isBuffered,omitempty"` - // ResourceID - Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource). - ResourceID *string `json:"resourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerContractProperties. -func (lcp LoggerContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lcp.LoggerType != "" { - objectMap["loggerType"] = lcp.LoggerType - } - if lcp.Description != nil { - objectMap["description"] = lcp.Description - } - if lcp.Credentials != nil { - objectMap["credentials"] = lcp.Credentials - } - if lcp.IsBuffered != nil { - objectMap["isBuffered"] = lcp.IsBuffered - } - if lcp.ResourceID != nil { - objectMap["resourceId"] = lcp.ResourceID - } - return json.Marshal(objectMap) -} - -// LoggerUpdateContract logger update contract. -type LoggerUpdateContract struct { - // LoggerUpdateParameters - Logger entity update contract properties. - *LoggerUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerUpdateContract. -func (luc LoggerUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if luc.LoggerUpdateParameters != nil { - objectMap["properties"] = luc.LoggerUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoggerUpdateContract struct. -func (luc *LoggerUpdateContract) 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 loggerUpdateParameters LoggerUpdateParameters - err = json.Unmarshal(*v, &loggerUpdateParameters) - if err != nil { - return err - } - luc.LoggerUpdateParameters = &loggerUpdateParameters - } - } - } - - return nil -} - -// LoggerUpdateParameters parameters supplied to the Update Logger operation. -type LoggerUpdateParameters struct { - // LoggerType - Logger type. Possible values include: 'AzureEventHub', 'ApplicationInsights' - LoggerType LoggerType `json:"loggerType,omitempty"` - // Description - Logger description. - Description *string `json:"description,omitempty"` - // Credentials - Logger credentials. - Credentials map[string]*string `json:"credentials"` - // IsBuffered - Whether records are buffered in the logger before publishing. Default is assumed to be true. - IsBuffered *bool `json:"isBuffered,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerUpdateParameters. -func (lup LoggerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lup.LoggerType != "" { - objectMap["loggerType"] = lup.LoggerType - } - if lup.Description != nil { - objectMap["description"] = lup.Description - } - if lup.Credentials != nil { - objectMap["credentials"] = lup.Credentials - } - if lup.IsBuffered != nil { - objectMap["isBuffered"] = lup.IsBuffered - } - return json.Marshal(objectMap) -} - -// NetworkStatusContract network Status details. -type NetworkStatusContract struct { - autorest.Response `json:"-"` - // DNSServers - Gets the list of DNS servers IPV4 addresses. - DNSServers *[]string `json:"dnsServers,omitempty"` - // ConnectivityStatus - Gets the list of Connectivity Status to the Resources on which the service depends upon. - ConnectivityStatus *[]ConnectivityStatusContract `json:"connectivityStatus,omitempty"` -} - -// NetworkStatusContractByLocation network Status in the Location -type NetworkStatusContractByLocation struct { - // Location - Location of service - Location *string `json:"location,omitempty"` - // NetworkStatus - Network status in Location - NetworkStatus *NetworkStatusContract `json:"networkStatus,omitempty"` -} - -// NotificationCollection paged Notification list representation. -type NotificationCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]NotificationContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// NotificationCollectionIterator provides access to a complete listing of NotificationContract values. -type NotificationCollectionIterator struct { - i int - page NotificationCollectionPage -} - -// 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 *NotificationCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationCollectionIterator.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 *NotificationCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NotificationCollectionIterator) 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 NotificationCollectionIterator) Response() NotificationCollection { - 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 NotificationCollectionIterator) Value() NotificationContract { - if !iter.page.NotDone() { - return NotificationContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NotificationCollectionIterator type. -func NewNotificationCollectionIterator(page NotificationCollectionPage) NotificationCollectionIterator { - return NotificationCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (nc NotificationCollection) IsEmpty() bool { - return nc.Value == nil || len(*nc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (nc NotificationCollection) hasNextLink() bool { - return nc.NextLink != nil && len(*nc.NextLink) != 0 -} - -// notificationCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nc NotificationCollection) notificationCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !nc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nc.NextLink))) -} - -// NotificationCollectionPage contains a page of NotificationContract values. -type NotificationCollectionPage struct { - fn func(context.Context, NotificationCollection) (NotificationCollection, error) - nc NotificationCollection -} - -// 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 *NotificationCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationCollectionPage.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.nc) - if err != nil { - return err - } - page.nc = 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 *NotificationCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NotificationCollectionPage) NotDone() bool { - return !page.nc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NotificationCollectionPage) Response() NotificationCollection { - return page.nc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NotificationCollectionPage) Values() []NotificationContract { - if page.nc.IsEmpty() { - return nil - } - return *page.nc.Value -} - -// Creates a new instance of the NotificationCollectionPage type. -func NewNotificationCollectionPage(cur NotificationCollection, getNextPage func(context.Context, NotificationCollection) (NotificationCollection, error)) NotificationCollectionPage { - return NotificationCollectionPage{ - fn: getNextPage, - nc: cur, - } -} - -// NotificationContract notification details. -type NotificationContract struct { - autorest.Response `json:"-"` - // NotificationContractProperties - Notification entity contract properties. - *NotificationContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotificationContract. -func (nc NotificationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nc.NotificationContractProperties != nil { - objectMap["properties"] = nc.NotificationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotificationContract struct. -func (nc *NotificationContract) 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 notificationContractProperties NotificationContractProperties - err = json.Unmarshal(*v, ¬ificationContractProperties) - if err != nil { - return err - } - nc.NotificationContractProperties = ¬ificationContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nc.Type = &typeVar - } - } - } - - return nil -} - -// NotificationContractProperties notification Contract properties. -type NotificationContractProperties struct { - // Title - Title of the Notification. - Title *string `json:"title,omitempty"` - // Description - Description of the Notification. - Description *string `json:"description,omitempty"` - // Recipients - Recipient Parameter values. - Recipients *RecipientsContractProperties `json:"recipients,omitempty"` -} - -// OAuth2AuthenticationSettingsContract API OAuth2 Authentication settings details. -type OAuth2AuthenticationSettingsContract struct { - // AuthorizationServerID - OAuth authorization server identifier. - AuthorizationServerID *string `json:"authorizationServerId,omitempty"` - // Scope - operations scope. - Scope *string `json:"scope,omitempty"` -} - -// OpenIDAuthenticationSettingsContract API OAuth2 Authentication settings details. -type OpenIDAuthenticationSettingsContract struct { - // OpenidProviderID - OAuth authorization server identifier. - OpenidProviderID *string `json:"openidProviderId,omitempty"` - // BearerTokenSendingMethods - How to send token to the server. - BearerTokenSendingMethods *[]BearerTokenSendingMethods `json:"bearerTokenSendingMethods,omitempty"` -} - -// OpenIDConnectProviderCollection paged OpenIdProviders list representation. -type OpenIDConnectProviderCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]OpenidConnectProviderContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OpenIDConnectProviderCollectionIterator provides access to a complete listing of -// OpenidConnectProviderContract values. -type OpenIDConnectProviderCollectionIterator struct { - i int - page OpenIDConnectProviderCollectionPage -} - -// 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 *OpenIDConnectProviderCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderCollectionIterator.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 *OpenIDConnectProviderCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OpenIDConnectProviderCollectionIterator) 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 OpenIDConnectProviderCollectionIterator) Response() OpenIDConnectProviderCollection { - 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 OpenIDConnectProviderCollectionIterator) Value() OpenidConnectProviderContract { - if !iter.page.NotDone() { - return OpenidConnectProviderContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OpenIDConnectProviderCollectionIterator type. -func NewOpenIDConnectProviderCollectionIterator(page OpenIDConnectProviderCollectionPage) OpenIDConnectProviderCollectionIterator { - return OpenIDConnectProviderCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oicpc OpenIDConnectProviderCollection) IsEmpty() bool { - return oicpc.Value == nil || len(*oicpc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oicpc OpenIDConnectProviderCollection) hasNextLink() bool { - return oicpc.NextLink != nil && len(*oicpc.NextLink) != 0 -} - -// openIDConnectProviderCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oicpc OpenIDConnectProviderCollection) openIDConnectProviderCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !oicpc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oicpc.NextLink))) -} - -// OpenIDConnectProviderCollectionPage contains a page of OpenidConnectProviderContract values. -type OpenIDConnectProviderCollectionPage struct { - fn func(context.Context, OpenIDConnectProviderCollection) (OpenIDConnectProviderCollection, error) - oicpc OpenIDConnectProviderCollection -} - -// 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 *OpenIDConnectProviderCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderCollectionPage.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.oicpc) - if err != nil { - return err - } - page.oicpc = 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 *OpenIDConnectProviderCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OpenIDConnectProviderCollectionPage) NotDone() bool { - return !page.oicpc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OpenIDConnectProviderCollectionPage) Response() OpenIDConnectProviderCollection { - return page.oicpc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OpenIDConnectProviderCollectionPage) Values() []OpenidConnectProviderContract { - if page.oicpc.IsEmpty() { - return nil - } - return *page.oicpc.Value -} - -// Creates a new instance of the OpenIDConnectProviderCollectionPage type. -func NewOpenIDConnectProviderCollectionPage(cur OpenIDConnectProviderCollection, getNextPage func(context.Context, OpenIDConnectProviderCollection) (OpenIDConnectProviderCollection, error)) OpenIDConnectProviderCollectionPage { - return OpenIDConnectProviderCollectionPage{ - fn: getNextPage, - oicpc: cur, - } -} - -// OpenidConnectProviderContract openId Connect Provider details. -type OpenidConnectProviderContract struct { - autorest.Response `json:"-"` - // OpenidConnectProviderContractProperties - OpenId Connect Provider contract properties. - *OpenidConnectProviderContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenidConnectProviderContract. -func (ocpc OpenidConnectProviderContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ocpc.OpenidConnectProviderContractProperties != nil { - objectMap["properties"] = ocpc.OpenidConnectProviderContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OpenidConnectProviderContract struct. -func (ocpc *OpenidConnectProviderContract) 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 openidConnectProviderContractProperties OpenidConnectProviderContractProperties - err = json.Unmarshal(*v, &openidConnectProviderContractProperties) - if err != nil { - return err - } - ocpc.OpenidConnectProviderContractProperties = &openidConnectProviderContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ocpc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ocpc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ocpc.Type = &typeVar - } - } - } - - return nil -} - -// OpenidConnectProviderContractProperties openID Connect Providers Contract. -type OpenidConnectProviderContractProperties struct { - // DisplayName - User-friendly OpenID Connect Provider name. - DisplayName *string `json:"displayName,omitempty"` - // Description - User-friendly description of OpenID Connect Provider. - Description *string `json:"description,omitempty"` - // MetadataEndpoint - Metadata endpoint URI. - MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` - // ClientID - Client ID of developer console which is the client application. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client Secret of developer console which is the client application. - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// OpenidConnectProviderUpdateContract parameters supplied to the Update OpenID Connect Provider operation. -type OpenidConnectProviderUpdateContract struct { - // OpenidConnectProviderUpdateContractProperties - OpenId Connect Provider Update contract properties. - *OpenidConnectProviderUpdateContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenidConnectProviderUpdateContract. -func (ocpuc OpenidConnectProviderUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ocpuc.OpenidConnectProviderUpdateContractProperties != nil { - objectMap["properties"] = ocpuc.OpenidConnectProviderUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OpenidConnectProviderUpdateContract struct. -func (ocpuc *OpenidConnectProviderUpdateContract) 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 openidConnectProviderUpdateContractProperties OpenidConnectProviderUpdateContractProperties - err = json.Unmarshal(*v, &openidConnectProviderUpdateContractProperties) - if err != nil { - return err - } - ocpuc.OpenidConnectProviderUpdateContractProperties = &openidConnectProviderUpdateContractProperties - } - } - } - - return nil -} - -// OpenidConnectProviderUpdateContractProperties parameters supplied to the Update OpenID Connect Provider -// operation. -type OpenidConnectProviderUpdateContractProperties struct { - // DisplayName - User-friendly OpenID Connect Provider name. - DisplayName *string `json:"displayName,omitempty"` - // Description - User-friendly description of OpenID Connect Provider. - Description *string `json:"description,omitempty"` - // MetadataEndpoint - Metadata endpoint URI. - MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` - // ClientID - Client ID of developer console which is the client application. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client Secret of developer console which is the client application. - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// Operation REST API operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that describes the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - The operation origin. - Origin *string `json:"origin,omitempty"` - // Properties - The operation properties. - Properties interface{} `json:"properties,omitempty"` -} - -// OperationCollection paged Operation list representation. -type OperationCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]OperationContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationCollection. -func (oc OperationCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationCollectionIterator provides access to a complete listing of OperationContract values. -type OperationCollectionIterator struct { - i int - page OperationCollectionPage -} - -// 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 *OperationCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionIterator.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 *OperationCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationCollectionIterator) 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 OperationCollectionIterator) Response() OperationCollection { - 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 OperationCollectionIterator) Value() OperationContract { - if !iter.page.NotDone() { - return OperationContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationCollectionIterator type. -func NewOperationCollectionIterator(page OperationCollectionPage) OperationCollectionIterator { - return OperationCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oc OperationCollection) IsEmpty() bool { - return oc.Value == nil || len(*oc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oc OperationCollection) hasNextLink() bool { - return oc.NextLink != nil && len(*oc.NextLink) != 0 -} - -// operationCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oc OperationCollection) operationCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !oc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oc.NextLink))) -} - -// OperationCollectionPage contains a page of OperationContract values. -type OperationCollectionPage struct { - fn func(context.Context, OperationCollection) (OperationCollection, error) - oc OperationCollection -} - -// 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 *OperationCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionPage.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.oc) - if err != nil { - return err - } - page.oc = 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 *OperationCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationCollectionPage) NotDone() bool { - return !page.oc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationCollectionPage) Response() OperationCollection { - return page.oc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationCollectionPage) Values() []OperationContract { - if page.oc.IsEmpty() { - return nil - } - return *page.oc.Value -} - -// Creates a new instance of the OperationCollectionPage type. -func NewOperationCollectionPage(cur OperationCollection, getNextPage func(context.Context, OperationCollection) (OperationCollection, error)) OperationCollectionPage { - return OperationCollectionPage{ - fn: getNextPage, - oc: cur, - } -} - -// OperationContract api Operation details. -type OperationContract struct { - autorest.Response `json:"-"` - // OperationContractProperties - Properties of the Operation Contract. - *OperationContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationContract. -func (oc OperationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oc.OperationContractProperties != nil { - objectMap["properties"] = oc.OperationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationContract struct. -func (oc *OperationContract) 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 operationContractProperties OperationContractProperties - err = json.Unmarshal(*v, &operationContractProperties) - if err != nil { - return err - } - oc.OperationContractProperties = &operationContractProperties - } - 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 - } - } - } - - return nil -} - -// OperationContractProperties operation Contract Properties -type OperationContractProperties struct { - // DisplayName - Operation Name. - DisplayName *string `json:"displayName,omitempty"` - // Method - A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - Method *string `json:"method,omitempty"` - // URLTemplate - Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} - URLTemplate *string `json:"urlTemplate,omitempty"` - // TemplateParameters - Collection of URL template parameters. - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - // Description - Description of the operation. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Request - An entity containing request details. - Request *RequestContract `json:"request,omitempty"` - // Responses - Array of Operation responses. - Responses *[]ResponseContract `json:"responses,omitempty"` - // Policies - Operation Policies - Policies *string `json:"policies,omitempty"` -} - -// OperationDisplay the object that describes the operation. -type OperationDisplay struct { - // Provider - Friendly name of the resource provider - Provider *string `json:"provider,omitempty"` - // Operation - Operation type: read, write, delete, listKeys/action, etc. - Operation *string `json:"operation,omitempty"` - // Resource - Resource type on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Description - Friendly name of the operation - Description *string `json:"description,omitempty"` -} - -// OperationEntityBaseContract api Operation Entity Base Contract details. -type OperationEntityBaseContract struct { - // TemplateParameters - Collection of URL template parameters. - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - // Description - Description of the operation. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Request - An entity containing request details. - Request *RequestContract `json:"request,omitempty"` - // Responses - Array of Operation responses. - Responses *[]ResponseContract `json:"responses,omitempty"` - // Policies - Operation Policies - Policies *string `json:"policies,omitempty"` -} - -// OperationListResult result of the request to list REST API operations. It contains a list of operations -// and a URL nextLink to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the 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, - } -} - -// OperationResultContract operation Result. -type OperationResultContract struct { - autorest.Response `json:"-"` - // ID - Operation result identifier. - ID *string `json:"id,omitempty"` - // Status - Status of an async operation. Possible values include: 'Started', 'InProgress', 'Succeeded', 'Failed' - Status AsyncOperationStatus `json:"status,omitempty"` - // Started - Start time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Started *date.Time `json:"started,omitempty"` - // Updated - Last update time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Updated *date.Time `json:"updated,omitempty"` - // ResultInfo - Optional result info. - ResultInfo *string `json:"resultInfo,omitempty"` - // Error - Error Body Contract - Error *ErrorResponseBody `json:"error,omitempty"` - // ActionLog - READ-ONLY; This property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation. - ActionLog *[]OperationResultLogItemContract `json:"actionLog,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationResultContract. -func (orc OperationResultContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if orc.ID != nil { - objectMap["id"] = orc.ID - } - if orc.Status != "" { - objectMap["status"] = orc.Status - } - if orc.Started != nil { - objectMap["started"] = orc.Started - } - if orc.Updated != nil { - objectMap["updated"] = orc.Updated - } - if orc.ResultInfo != nil { - objectMap["resultInfo"] = orc.ResultInfo - } - if orc.Error != nil { - objectMap["error"] = orc.Error - } - return json.Marshal(objectMap) -} - -// OperationResultLogItemContract log of the entity being created, updated or deleted. -type OperationResultLogItemContract struct { - // ObjectType - The type of entity contract. - ObjectType *string `json:"objectType,omitempty"` - // Action - Action like create/update/delete. - Action *string `json:"action,omitempty"` - // ObjectKey - Identifier of the entity being created/updated/deleted. - ObjectKey *string `json:"objectKey,omitempty"` -} - -// OperationTagResourceContractProperties operation Entity contract Properties. -type OperationTagResourceContractProperties struct { - // ID - Identifier of the operation in form /operations/{operationId}. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Operation name. - Name *string `json:"name,omitempty"` - // APIName - READ-ONLY; Api Name. - APIName *string `json:"apiName,omitempty"` - // APIRevision - READ-ONLY; Api Revision. - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - READ-ONLY; Api Version. - APIVersion *string `json:"apiVersion,omitempty"` - // Description - READ-ONLY; Operation Description. - Description *string `json:"description,omitempty"` - // Method - READ-ONLY; A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - Method *string `json:"method,omitempty"` - // URLTemplate - READ-ONLY; Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} - URLTemplate *string `json:"urlTemplate,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationTagResourceContractProperties. -func (otrcp OperationTagResourceContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if otrcp.ID != nil { - objectMap["id"] = otrcp.ID - } - return json.Marshal(objectMap) -} - -// OperationUpdateContract api Operation Update Contract details. -type OperationUpdateContract struct { - // OperationUpdateContractProperties - Properties of the API Operation entity that can be updated. - *OperationUpdateContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationUpdateContract. -func (ouc OperationUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ouc.OperationUpdateContractProperties != nil { - objectMap["properties"] = ouc.OperationUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationUpdateContract struct. -func (ouc *OperationUpdateContract) 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 operationUpdateContractProperties OperationUpdateContractProperties - err = json.Unmarshal(*v, &operationUpdateContractProperties) - if err != nil { - return err - } - ouc.OperationUpdateContractProperties = &operationUpdateContractProperties - } - } - } - - return nil -} - -// OperationUpdateContractProperties operation Update Contract Properties. -type OperationUpdateContractProperties struct { - // DisplayName - Operation Name. - DisplayName *string `json:"displayName,omitempty"` - // Method - A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - Method *string `json:"method,omitempty"` - // URLTemplate - Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} - URLTemplate *string `json:"urlTemplate,omitempty"` - // TemplateParameters - Collection of URL template parameters. - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - // Description - Description of the operation. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Request - An entity containing request details. - Request *RequestContract `json:"request,omitempty"` - // Responses - Array of Operation responses. - Responses *[]ResponseContract `json:"responses,omitempty"` - // Policies - Operation Policies - Policies *string `json:"policies,omitempty"` -} - -// ParameterContract operation parameters details. -type ParameterContract struct { - // Name - Parameter name. - Name *string `json:"name,omitempty"` - // Description - Parameter description. - Description *string `json:"description,omitempty"` - // Type - Parameter type. - Type *string `json:"type,omitempty"` - // DefaultValue - Default parameter value. - DefaultValue *string `json:"defaultValue,omitempty"` - // Required - whether parameter is required or not. - Required *bool `json:"required,omitempty"` - // Values - Parameter values. - Values *[]string `json:"values,omitempty"` -} - -// PipelineDiagnosticSettings diagnostic settings for incoming/outgoing HTTP messages to the Gateway. -type PipelineDiagnosticSettings struct { - // Request - Diagnostic settings for request. - Request *HTTPMessageDiagnostic `json:"request,omitempty"` - // Response - Diagnostic settings for response. - Response *HTTPMessageDiagnostic `json:"response,omitempty"` -} - -// PolicyCollection the response of the list policy operation. -type PolicyCollection struct { - autorest.Response `json:"-"` - // Value - Policy Contract value. - Value *[]PolicyContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// PolicyContract policy Contract details. -type PolicyContract struct { - autorest.Response `json:"-"` - // PolicyContractProperties - Properties of the Policy. - *PolicyContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyContract. -func (pc PolicyContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.PolicyContractProperties != nil { - objectMap["properties"] = pc.PolicyContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PolicyContract struct. -func (pc *PolicyContract) 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 policyContractProperties PolicyContractProperties - err = json.Unmarshal(*v, &policyContractProperties) - if err != nil { - return err - } - pc.PolicyContractProperties = &policyContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pc.Type = &typeVar - } - } - } - - return nil -} - -// PolicyContractProperties policy contract Properties. -type PolicyContractProperties struct { - // PolicyContent - Json escaped Xml Encoded contents of the Policy. - PolicyContent *string `json:"policyContent,omitempty"` - // ContentFormat - Format of the policyContent. Possible values include: 'XML', 'XMLLink', 'Rawxml', 'RawxmlLink' - ContentFormat PolicyContentFormat `json:"contentFormat,omitempty"` -} - -// PolicySnippetContract policy snippet. -type PolicySnippetContract struct { - // Name - READ-ONLY; Snippet name. - Name *string `json:"name,omitempty"` - // Content - READ-ONLY; Snippet content. - Content *string `json:"content,omitempty"` - // ToolTip - READ-ONLY; Snippet toolTip. - ToolTip *string `json:"toolTip,omitempty"` - // Scope - READ-ONLY; Binary OR value of the Snippet scope. - Scope *int32 `json:"scope,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicySnippetContract. -func (psc PolicySnippetContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PolicySnippetsCollection the response of the list policy snippets operation. -type PolicySnippetsCollection struct { - autorest.Response `json:"-"` - // Value - Policy snippet value. - Value *[]PolicySnippetContract `json:"value,omitempty"` -} - -// PortalDelegationSettings delegation settings for a developer portal. -type PortalDelegationSettings struct { - autorest.Response `json:"-"` - // PortalDelegationSettingsProperties - Delegation settings contract properties. - *PortalDelegationSettingsProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalDelegationSettings. -func (pds PortalDelegationSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pds.PortalDelegationSettingsProperties != nil { - objectMap["properties"] = pds.PortalDelegationSettingsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalDelegationSettings struct. -func (pds *PortalDelegationSettings) 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 portalDelegationSettingsProperties PortalDelegationSettingsProperties - err = json.Unmarshal(*v, &portalDelegationSettingsProperties) - if err != nil { - return err - } - pds.PortalDelegationSettingsProperties = &portalDelegationSettingsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pds.Type = &typeVar - } - } - } - - return nil -} - -// PortalDelegationSettingsProperties delegation settings contract properties. -type PortalDelegationSettingsProperties struct { - // URL - A delegation Url. - URL *string `json:"url,omitempty"` - // ValidationKey - A base64-encoded validation key to validate, that a request is coming from Azure API Management. - ValidationKey *string `json:"validationKey,omitempty"` - // Subscriptions - Subscriptions delegation settings. - Subscriptions *SubscriptionsDelegationSettingsProperties `json:"subscriptions,omitempty"` - // UserRegistration - User registration delegation settings. - UserRegistration *RegistrationDelegationSettingsProperties `json:"userRegistration,omitempty"` -} - -// PortalSigninSettingProperties sign-in settings contract properties. -type PortalSigninSettingProperties struct { - // Enabled - Redirect Anonymous users to the Sign-In page. - Enabled *bool `json:"enabled,omitempty"` -} - -// PortalSigninSettings sign-In settings for the Developer Portal. -type PortalSigninSettings struct { - autorest.Response `json:"-"` - // PortalSigninSettingProperties - Sign-in settings contract properties. - *PortalSigninSettingProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalSigninSettings. -func (pss PortalSigninSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pss.PortalSigninSettingProperties != nil { - objectMap["properties"] = pss.PortalSigninSettingProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalSigninSettings struct. -func (pss *PortalSigninSettings) 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 portalSigninSettingProperties PortalSigninSettingProperties - err = json.Unmarshal(*v, &portalSigninSettingProperties) - if err != nil { - return err - } - pss.PortalSigninSettingProperties = &portalSigninSettingProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pss.Type = &typeVar - } - } - } - - return nil -} - -// PortalSignupSettings sign-Up settings for a developer portal. -type PortalSignupSettings struct { - autorest.Response `json:"-"` - // PortalSignupSettingsProperties - Sign-up settings contract properties. - *PortalSignupSettingsProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalSignupSettings. -func (pss PortalSignupSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pss.PortalSignupSettingsProperties != nil { - objectMap["properties"] = pss.PortalSignupSettingsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalSignupSettings struct. -func (pss *PortalSignupSettings) 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 portalSignupSettingsProperties PortalSignupSettingsProperties - err = json.Unmarshal(*v, &portalSignupSettingsProperties) - if err != nil { - return err - } - pss.PortalSignupSettingsProperties = &portalSignupSettingsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pss.Type = &typeVar - } - } - } - - return nil -} - -// PortalSignupSettingsProperties sign-up settings contract properties. -type PortalSignupSettingsProperties struct { - // Enabled - Allow users to sign up on a developer portal. - Enabled *bool `json:"enabled,omitempty"` - // TermsOfService - Terms of service contract properties. - TermsOfService *TermsOfServiceProperties `json:"termsOfService,omitempty"` -} - -// ProductCollection paged Products list representation. -type ProductCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]ProductContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ProductCollectionIterator provides access to a complete listing of ProductContract values. -type ProductCollectionIterator struct { - i int - page ProductCollectionPage -} - -// 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 *ProductCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductCollectionIterator.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 *ProductCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProductCollectionIterator) 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 ProductCollectionIterator) Response() ProductCollection { - 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 ProductCollectionIterator) Value() ProductContract { - if !iter.page.NotDone() { - return ProductContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProductCollectionIterator type. -func NewProductCollectionIterator(page ProductCollectionPage) ProductCollectionIterator { - return ProductCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pc ProductCollection) IsEmpty() bool { - return pc.Value == nil || len(*pc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pc ProductCollection) hasNextLink() bool { - return pc.NextLink != nil && len(*pc.NextLink) != 0 -} - -// productCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pc ProductCollection) productCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !pc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pc.NextLink))) -} - -// ProductCollectionPage contains a page of ProductContract values. -type ProductCollectionPage struct { - fn func(context.Context, ProductCollection) (ProductCollection, error) - pc ProductCollection -} - -// 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 *ProductCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductCollectionPage.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.pc) - if err != nil { - return err - } - page.pc = 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 *ProductCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProductCollectionPage) NotDone() bool { - return !page.pc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProductCollectionPage) Response() ProductCollection { - return page.pc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProductCollectionPage) Values() []ProductContract { - if page.pc.IsEmpty() { - return nil - } - return *page.pc.Value -} - -// Creates a new instance of the ProductCollectionPage type. -func NewProductCollectionPage(cur ProductCollection, getNextPage func(context.Context, ProductCollection) (ProductCollection, error)) ProductCollectionPage { - return ProductCollectionPage{ - fn: getNextPage, - pc: cur, - } -} - -// ProductContract product details. -type ProductContract struct { - autorest.Response `json:"-"` - // ProductContractProperties - Product entity contract properties. - *ProductContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProductContract. -func (pc ProductContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.ProductContractProperties != nil { - objectMap["properties"] = pc.ProductContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProductContract struct. -func (pc *ProductContract) 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 productContractProperties ProductContractProperties - err = json.Unmarshal(*v, &productContractProperties) - if err != nil { - return err - } - pc.ProductContractProperties = &productContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pc.Type = &typeVar - } - } - } - - return nil -} - -// ProductContractProperties product profile. -type ProductContractProperties struct { - // DisplayName - Product name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'NotPublished', 'Published' - State ProductState `json:"state,omitempty"` -} - -// ProductEntityBaseParameters product Entity Base Parameters -type ProductEntityBaseParameters struct { - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'NotPublished', 'Published' - State ProductState `json:"state,omitempty"` -} - -// ProductTagResourceContractProperties product profile. -type ProductTagResourceContractProperties struct { - // ID - Identifier of the product in the form of /products/{productId} - ID *string `json:"id,omitempty"` - // Name - Product name. - Name *string `json:"name,omitempty"` - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'NotPublished', 'Published' - State ProductState `json:"state,omitempty"` -} - -// ProductUpdateParameters product Update parameters. -type ProductUpdateParameters struct { - // ProductUpdateProperties - Product entity Update contract properties. - *ProductUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProductUpdateParameters. -func (pup ProductUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pup.ProductUpdateProperties != nil { - objectMap["properties"] = pup.ProductUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProductUpdateParameters struct. -func (pup *ProductUpdateParameters) 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 productUpdateProperties ProductUpdateProperties - err = json.Unmarshal(*v, &productUpdateProperties) - if err != nil { - return err - } - pup.ProductUpdateProperties = &productUpdateProperties - } - } - } - - return nil -} - -// ProductUpdateProperties parameters supplied to the Update Product operation. -type ProductUpdateProperties struct { - // DisplayName - Product name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'NotPublished', 'Published' - State ProductState `json:"state,omitempty"` -} - -// PropertyCollection paged Property list representation. -type PropertyCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]PropertyContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// PropertyCollectionIterator provides access to a complete listing of PropertyContract values. -type PropertyCollectionIterator struct { - i int - page PropertyCollectionPage -} - -// 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 *PropertyCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PropertyCollectionIterator.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 *PropertyCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PropertyCollectionIterator) 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 PropertyCollectionIterator) Response() PropertyCollection { - 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 PropertyCollectionIterator) Value() PropertyContract { - if !iter.page.NotDone() { - return PropertyContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PropertyCollectionIterator type. -func NewPropertyCollectionIterator(page PropertyCollectionPage) PropertyCollectionIterator { - return PropertyCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pc PropertyCollection) IsEmpty() bool { - return pc.Value == nil || len(*pc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pc PropertyCollection) hasNextLink() bool { - return pc.NextLink != nil && len(*pc.NextLink) != 0 -} - -// propertyCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pc PropertyCollection) propertyCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !pc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pc.NextLink))) -} - -// PropertyCollectionPage contains a page of PropertyContract values. -type PropertyCollectionPage struct { - fn func(context.Context, PropertyCollection) (PropertyCollection, error) - pc PropertyCollection -} - -// 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 *PropertyCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PropertyCollectionPage.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.pc) - if err != nil { - return err - } - page.pc = 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 *PropertyCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PropertyCollectionPage) NotDone() bool { - return !page.pc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PropertyCollectionPage) Response() PropertyCollection { - return page.pc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PropertyCollectionPage) Values() []PropertyContract { - if page.pc.IsEmpty() { - return nil - } - return *page.pc.Value -} - -// Creates a new instance of the PropertyCollectionPage type. -func NewPropertyCollectionPage(cur PropertyCollection, getNextPage func(context.Context, PropertyCollection) (PropertyCollection, error)) PropertyCollectionPage { - return PropertyCollectionPage{ - fn: getNextPage, - pc: cur, - } -} - -// PropertyContract property details. -type PropertyContract struct { - autorest.Response `json:"-"` - // PropertyContractProperties - Property entity contract properties. - *PropertyContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PropertyContract. -func (pc PropertyContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.PropertyContractProperties != nil { - objectMap["properties"] = pc.PropertyContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PropertyContract struct. -func (pc *PropertyContract) 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 propertyContractProperties PropertyContractProperties - err = json.Unmarshal(*v, &propertyContractProperties) - if err != nil { - return err - } - pc.PropertyContractProperties = &propertyContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pc.Type = &typeVar - } - } - } - - return nil -} - -// PropertyContractProperties property Contract properties. -type PropertyContractProperties struct { - // DisplayName - Unique name of Property. It may contain only letters, digits, period, dash, and underscore characters. - DisplayName *string `json:"displayName,omitempty"` - // Value - Value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace. - Value *string `json:"value,omitempty"` - // Tags - Optional tags that when provided can be used to filter the property list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// PropertyEntityBaseParameters property Entity Base Parameters set. -type PropertyEntityBaseParameters struct { - // Tags - Optional tags that when provided can be used to filter the property list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// PropertyUpdateParameterProperties property Contract properties. -type PropertyUpdateParameterProperties struct { - // DisplayName - Unique name of Property. It may contain only letters, digits, period, dash, and underscore characters. - DisplayName *string `json:"displayName,omitempty"` - // Value - Value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace. - Value *string `json:"value,omitempty"` - // Tags - Optional tags that when provided can be used to filter the property list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// PropertyUpdateParameters property update Parameters. -type PropertyUpdateParameters struct { - // PropertyUpdateParameterProperties - Property entity Update contract properties. - *PropertyUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PropertyUpdateParameters. -func (pup PropertyUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pup.PropertyUpdateParameterProperties != nil { - objectMap["properties"] = pup.PropertyUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PropertyUpdateParameters struct. -func (pup *PropertyUpdateParameters) 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 propertyUpdateParameterProperties PropertyUpdateParameterProperties - err = json.Unmarshal(*v, &propertyUpdateParameterProperties) - if err != nil { - return err - } - pup.PropertyUpdateParameterProperties = &propertyUpdateParameterProperties - } - } - } - - return nil -} - -// QuotaCounterCollection paged Quota Counter list representation. -type QuotaCounterCollection struct { - autorest.Response `json:"-"` - // Value - Quota counter values. - Value *[]QuotaCounterContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// QuotaCounterContract quota counter details. -type QuotaCounterContract struct { - autorest.Response `json:"-"` - // CounterKey - The Key value of the Counter. Must not be empty. - CounterKey *string `json:"counterKey,omitempty"` - // PeriodKey - Identifier of the Period for which the counter was collected. Must not be empty. - PeriodKey *string `json:"periodKey,omitempty"` - // PeriodStartTime - The date of the start of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - PeriodStartTime *date.Time `json:"periodStartTime,omitempty"` - // PeriodEndTime - The date of the end of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - PeriodEndTime *date.Time `json:"periodEndTime,omitempty"` - // Value - Quota Value Properties - Value *QuotaCounterValueContractProperties `json:"value,omitempty"` -} - -// QuotaCounterValueContract quota counter value details. -type QuotaCounterValueContract struct { - // QuotaCounterValueContractProperties - Quota counter Value Properties. - *QuotaCounterValueContractProperties `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for QuotaCounterValueContract. -func (qcvc QuotaCounterValueContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qcvc.QuotaCounterValueContractProperties != nil { - objectMap["value"] = qcvc.QuotaCounterValueContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QuotaCounterValueContract struct. -func (qcvc *QuotaCounterValueContract) 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 { - var quotaCounterValueContractProperties QuotaCounterValueContractProperties - err = json.Unmarshal(*v, "aCounterValueContractProperties) - if err != nil { - return err - } - qcvc.QuotaCounterValueContractProperties = "aCounterValueContractProperties - } - } - } - - return nil -} - -// QuotaCounterValueContractProperties quota counter value details. -type QuotaCounterValueContractProperties struct { - // CallsCount - Number of times Counter was called. - CallsCount *int32 `json:"callsCount,omitempty"` - // KbTransferred - Data Transferred in KiloBytes. - KbTransferred *float64 `json:"kbTransferred,omitempty"` -} - -// RecipientEmailCollection paged Recipient User list representation. -type RecipientEmailCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]RecipientEmailContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RecipientEmailContract recipient Email details. -type RecipientEmailContract struct { - autorest.Response `json:"-"` - // RecipientEmailContractProperties - Recipient Email contract properties. - *RecipientEmailContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecipientEmailContract. -func (rec RecipientEmailContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rec.RecipientEmailContractProperties != nil { - objectMap["properties"] = rec.RecipientEmailContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecipientEmailContract struct. -func (rec *RecipientEmailContract) 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 recipientEmailContractProperties RecipientEmailContractProperties - err = json.Unmarshal(*v, &recipientEmailContractProperties) - if err != nil { - return err - } - rec.RecipientEmailContractProperties = &recipientEmailContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rec.Type = &typeVar - } - } - } - - return nil -} - -// RecipientEmailContractProperties recipient Email Contract Properties. -type RecipientEmailContractProperties struct { - // Email - User Email subscribed to notification. - Email *string `json:"email,omitempty"` -} - -// RecipientsContractProperties notification Parameter contract. -type RecipientsContractProperties struct { - // Emails - List of Emails subscribed for the notification. - Emails *[]string `json:"emails,omitempty"` - // Users - List of Users subscribed for the notification. - Users *[]string `json:"users,omitempty"` -} - -// RecipientUserCollection paged Recipient User list representation. -type RecipientUserCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]RecipientUserContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RecipientUserContract recipient User details. -type RecipientUserContract struct { - autorest.Response `json:"-"` - // RecipientUsersContractProperties - Recipient User entity contract properties. - *RecipientUsersContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecipientUserContract. -func (ruc RecipientUserContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ruc.RecipientUsersContractProperties != nil { - objectMap["properties"] = ruc.RecipientUsersContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecipientUserContract struct. -func (ruc *RecipientUserContract) 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 recipientUsersContractProperties RecipientUsersContractProperties - err = json.Unmarshal(*v, &recipientUsersContractProperties) - if err != nil { - return err - } - ruc.RecipientUsersContractProperties = &recipientUsersContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ruc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ruc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ruc.Type = &typeVar - } - } - } - - return nil -} - -// RecipientUsersContractProperties recipient User Contract Properties. -type RecipientUsersContractProperties struct { - // UserID - API Management UserId subscribed to notification. - UserID *string `json:"userId,omitempty"` -} - -// RegionContract region profile. -type RegionContract struct { - // Name - READ-ONLY; Region name. - Name *string `json:"name,omitempty"` - // IsMasterRegion - whether Region is the master region. - IsMasterRegion *bool `json:"isMasterRegion,omitempty"` - // IsDeleted - whether Region is deleted. - IsDeleted *bool `json:"isDeleted,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegionContract. -func (rc RegionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rc.IsMasterRegion != nil { - objectMap["isMasterRegion"] = rc.IsMasterRegion - } - if rc.IsDeleted != nil { - objectMap["isDeleted"] = rc.IsDeleted - } - return json.Marshal(objectMap) -} - -// RegionListResult lists Regions operation response details. -type RegionListResult struct { - autorest.Response `json:"-"` - // Value - Lists of Regions. - Value *[]RegionContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegionListResultIterator provides access to a complete listing of RegionContract values. -type RegionListResultIterator struct { - i int - page RegionListResultPage -} - -// 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 *RegionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionListResultIterator.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 *RegionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegionListResultIterator) 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 RegionListResultIterator) Response() RegionListResult { - 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 RegionListResultIterator) Value() RegionContract { - if !iter.page.NotDone() { - return RegionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegionListResultIterator type. -func NewRegionListResultIterator(page RegionListResultPage) RegionListResultIterator { - return RegionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegionListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegionListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// regionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegionListResult) regionListResultPreparer(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))) -} - -// RegionListResultPage contains a page of RegionContract values. -type RegionListResultPage struct { - fn func(context.Context, RegionListResult) (RegionListResult, error) - rlr RegionListResult -} - -// 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 *RegionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionListResultPage.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 *RegionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegionListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegionListResultPage) Response() RegionListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegionListResultPage) Values() []RegionContract { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegionListResultPage type. -func NewRegionListResultPage(cur RegionListResult, getNextPage func(context.Context, RegionListResult) (RegionListResult, error)) RegionListResultPage { - return RegionListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistrationDelegationSettingsProperties user registration delegation settings properties. -type RegistrationDelegationSettingsProperties struct { - // Enabled - Enable or disable delegation for user registration. - Enabled *bool `json:"enabled,omitempty"` -} - -// ReportCollection paged Report records list representation. -type ReportCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]ReportRecordContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReportCollectionIterator provides access to a complete listing of ReportRecordContract values. -type ReportCollectionIterator struct { - i int - page ReportCollectionPage -} - -// 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 *ReportCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportCollectionIterator.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 *ReportCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReportCollectionIterator) 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 ReportCollectionIterator) Response() ReportCollection { - 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 ReportCollectionIterator) Value() ReportRecordContract { - if !iter.page.NotDone() { - return ReportRecordContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReportCollectionIterator type. -func NewReportCollectionIterator(page ReportCollectionPage) ReportCollectionIterator { - return ReportCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rc ReportCollection) IsEmpty() bool { - return rc.Value == nil || len(*rc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rc ReportCollection) hasNextLink() bool { - return rc.NextLink != nil && len(*rc.NextLink) != 0 -} - -// reportCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rc ReportCollection) reportCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !rc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rc.NextLink))) -} - -// ReportCollectionPage contains a page of ReportRecordContract values. -type ReportCollectionPage struct { - fn func(context.Context, ReportCollection) (ReportCollection, error) - rc ReportCollection -} - -// 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 *ReportCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportCollectionPage.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.rc) - if err != nil { - return err - } - page.rc = 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 *ReportCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReportCollectionPage) NotDone() bool { - return !page.rc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReportCollectionPage) Response() ReportCollection { - return page.rc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReportCollectionPage) Values() []ReportRecordContract { - if page.rc.IsEmpty() { - return nil - } - return *page.rc.Value -} - -// Creates a new instance of the ReportCollectionPage type. -func NewReportCollectionPage(cur ReportCollection, getNextPage func(context.Context, ReportCollection) (ReportCollection, error)) ReportCollectionPage { - return ReportCollectionPage{ - fn: getNextPage, - rc: cur, - } -} - -// ReportRecordContract report data. -type ReportRecordContract struct { - // Name - Name depending on report endpoint specifies product, API, operation or developer name. - Name *string `json:"name,omitempty"` - // Timestamp - Start of aggregation period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Interval - Length of aggregation period. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). - Interval *string `json:"interval,omitempty"` - // Country - Country to which this record data is related. - Country *string `json:"country,omitempty"` - // Region - Country region to which this record data is related. - Region *string `json:"region,omitempty"` - // Zip - Zip code to which this record data is related. - Zip *string `json:"zip,omitempty"` - // UserID - READ-ONLY; User identifier path. /users/{userId} - UserID *string `json:"userId,omitempty"` - // ProductID - READ-ONLY; Product identifier path. /products/{productId} - ProductID *string `json:"productId,omitempty"` - // APIID - API identifier path. /apis/{apiId} - APIID *string `json:"apiId,omitempty"` - // OperationID - Operation identifier path. /apis/{apiId}/operations/{operationId} - OperationID *string `json:"operationId,omitempty"` - // APIRegion - API region identifier. - APIRegion *string `json:"apiRegion,omitempty"` - // SubscriptionID - Subscription identifier path. /subscriptions/{subscriptionId} - SubscriptionID *string `json:"subscriptionId,omitempty"` - // CallCountSuccess - Number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect - CallCountSuccess *int32 `json:"callCountSuccess,omitempty"` - // CallCountBlocked - Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests - CallCountBlocked *int32 `json:"callCountBlocked,omitempty"` - // CallCountFailed - Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600 - CallCountFailed *int32 `json:"callCountFailed,omitempty"` - // CallCountOther - Number of other calls. - CallCountOther *int32 `json:"callCountOther,omitempty"` - // CallCountTotal - Total number of calls. - CallCountTotal *int32 `json:"callCountTotal,omitempty"` - // Bandwidth - Bandwidth consumed. - Bandwidth *int64 `json:"bandwidth,omitempty"` - // CacheHitCount - Number of times when content was served from cache policy. - CacheHitCount *int32 `json:"cacheHitCount,omitempty"` - // CacheMissCount - Number of times content was fetched from backend. - CacheMissCount *int32 `json:"cacheMissCount,omitempty"` - // APITimeAvg - Average time it took to process request. - APITimeAvg *float64 `json:"apiTimeAvg,omitempty"` - // APITimeMin - Minimum time it took to process request. - APITimeMin *float64 `json:"apiTimeMin,omitempty"` - // APITimeMax - Maximum time it took to process request. - APITimeMax *float64 `json:"apiTimeMax,omitempty"` - // ServiceTimeAvg - Average time it took to process request on backend. - ServiceTimeAvg *float64 `json:"serviceTimeAvg,omitempty"` - // ServiceTimeMin - Minimum time it took to process request on backend. - ServiceTimeMin *float64 `json:"serviceTimeMin,omitempty"` - // ServiceTimeMax - Maximum time it took to process request on backend. - ServiceTimeMax *float64 `json:"serviceTimeMax,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReportRecordContract. -func (rrc ReportRecordContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rrc.Name != nil { - objectMap["name"] = rrc.Name - } - if rrc.Timestamp != nil { - objectMap["timestamp"] = rrc.Timestamp - } - if rrc.Interval != nil { - objectMap["interval"] = rrc.Interval - } - if rrc.Country != nil { - objectMap["country"] = rrc.Country - } - if rrc.Region != nil { - objectMap["region"] = rrc.Region - } - if rrc.Zip != nil { - objectMap["zip"] = rrc.Zip - } - if rrc.APIID != nil { - objectMap["apiId"] = rrc.APIID - } - if rrc.OperationID != nil { - objectMap["operationId"] = rrc.OperationID - } - if rrc.APIRegion != nil { - objectMap["apiRegion"] = rrc.APIRegion - } - if rrc.SubscriptionID != nil { - objectMap["subscriptionId"] = rrc.SubscriptionID - } - if rrc.CallCountSuccess != nil { - objectMap["callCountSuccess"] = rrc.CallCountSuccess - } - if rrc.CallCountBlocked != nil { - objectMap["callCountBlocked"] = rrc.CallCountBlocked - } - if rrc.CallCountFailed != nil { - objectMap["callCountFailed"] = rrc.CallCountFailed - } - if rrc.CallCountOther != nil { - objectMap["callCountOther"] = rrc.CallCountOther - } - if rrc.CallCountTotal != nil { - objectMap["callCountTotal"] = rrc.CallCountTotal - } - if rrc.Bandwidth != nil { - objectMap["bandwidth"] = rrc.Bandwidth - } - if rrc.CacheHitCount != nil { - objectMap["cacheHitCount"] = rrc.CacheHitCount - } - if rrc.CacheMissCount != nil { - objectMap["cacheMissCount"] = rrc.CacheMissCount - } - if rrc.APITimeAvg != nil { - objectMap["apiTimeAvg"] = rrc.APITimeAvg - } - if rrc.APITimeMin != nil { - objectMap["apiTimeMin"] = rrc.APITimeMin - } - if rrc.APITimeMax != nil { - objectMap["apiTimeMax"] = rrc.APITimeMax - } - if rrc.ServiceTimeAvg != nil { - objectMap["serviceTimeAvg"] = rrc.ServiceTimeAvg - } - if rrc.ServiceTimeMin != nil { - objectMap["serviceTimeMin"] = rrc.ServiceTimeMin - } - if rrc.ServiceTimeMax != nil { - objectMap["serviceTimeMax"] = rrc.ServiceTimeMax - } - return json.Marshal(objectMap) -} - -// RepresentationContract operation request/response representation details. -type RepresentationContract struct { - // ContentType - Specifies a registered or custom content type for this representation, e.g. application/xml. - ContentType *string `json:"contentType,omitempty"` - // Sample - An example of the representation. - Sample *string `json:"sample,omitempty"` - // SchemaID - Schema identifier. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - SchemaID *string `json:"schemaId,omitempty"` - // TypeName - Type name defined by the schema. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - TypeName *string `json:"typeName,omitempty"` - // FormParameters - Collection of form parameters. Required if 'contentType' value is either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. - FormParameters *[]ParameterContract `json:"formParameters,omitempty"` -} - -// RequestContract operation request details. -type RequestContract struct { - // Description - Operation request description. - Description *string `json:"description,omitempty"` - // QueryParameters - Collection of operation request query parameters. - QueryParameters *[]ParameterContract `json:"queryParameters,omitempty"` - // Headers - Collection of operation request headers. - Headers *[]ParameterContract `json:"headers,omitempty"` - // Representations - Collection of operation request representations. - Representations *[]RepresentationContract `json:"representations,omitempty"` -} - -// RequestReportCollection paged Report records list representation. -type RequestReportCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]RequestReportRecordContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` -} - -// RequestReportRecordContract request Report data. -type RequestReportRecordContract struct { - // APIID - API identifier path. /apis/{apiId} - APIID *string `json:"apiId,omitempty"` - // OperationID - Operation identifier path. /apis/{apiId}/operations/{operationId} - OperationID *string `json:"operationId,omitempty"` - // ProductID - READ-ONLY; Product identifier path. /products/{productId} - ProductID *string `json:"productId,omitempty"` - // UserID - READ-ONLY; User identifier path. /users/{userId} - UserID *string `json:"userId,omitempty"` - // Method - The HTTP method associated with this request.. - Method *string `json:"method,omitempty"` - // URL - The full URL associated with this request. - URL *string `json:"url,omitempty"` - // IPAddress - The client IP address associated with this request. - IPAddress *string `json:"ipAddress,omitempty"` - // BackendResponseCode - The HTTP status code received by the gateway as a result of forwarding this request to the backend. - BackendResponseCode *string `json:"backendResponseCode,omitempty"` - // ResponseCode - The HTTP status code returned by the gateway. - ResponseCode *int32 `json:"responseCode,omitempty"` - // ResponseSize - The size of the response returned by the gateway. - ResponseSize *int32 `json:"responseSize,omitempty"` - // Timestamp - The date and time when this request was received by the gateway in ISO 8601 format. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Cache - Specifies if response cache was involved in generating the response. If the value is none, the cache was not used. If the value is hit, cached response was returned. If the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by the backend. - Cache *string `json:"cache,omitempty"` - // APITime - The total time it took to process this request. - APITime *float64 `json:"apiTime,omitempty"` - // ServiceTime - he time it took to forward this request to the backend and get the response back. - ServiceTime *float64 `json:"serviceTime,omitempty"` - // APIRegion - Azure region where the gateway that processed this request is located. - APIRegion *string `json:"apiRegion,omitempty"` - // SubscriptionID - Subscription identifier path. /subscriptions/{subscriptionId} - SubscriptionID *string `json:"subscriptionId,omitempty"` - // RequestID - Request Identifier. - RequestID *string `json:"requestId,omitempty"` - // RequestSize - The size of this request.. - RequestSize *int32 `json:"requestSize,omitempty"` -} - -// MarshalJSON is the custom marshaler for RequestReportRecordContract. -func (rrrc RequestReportRecordContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rrrc.APIID != nil { - objectMap["apiId"] = rrrc.APIID - } - if rrrc.OperationID != nil { - objectMap["operationId"] = rrrc.OperationID - } - if rrrc.Method != nil { - objectMap["method"] = rrrc.Method - } - if rrrc.URL != nil { - objectMap["url"] = rrrc.URL - } - if rrrc.IPAddress != nil { - objectMap["ipAddress"] = rrrc.IPAddress - } - if rrrc.BackendResponseCode != nil { - objectMap["backendResponseCode"] = rrrc.BackendResponseCode - } - if rrrc.ResponseCode != nil { - objectMap["responseCode"] = rrrc.ResponseCode - } - if rrrc.ResponseSize != nil { - objectMap["responseSize"] = rrrc.ResponseSize - } - if rrrc.Timestamp != nil { - objectMap["timestamp"] = rrrc.Timestamp - } - if rrrc.Cache != nil { - objectMap["cache"] = rrrc.Cache - } - if rrrc.APITime != nil { - objectMap["apiTime"] = rrrc.APITime - } - if rrrc.ServiceTime != nil { - objectMap["serviceTime"] = rrrc.ServiceTime - } - if rrrc.APIRegion != nil { - objectMap["apiRegion"] = rrrc.APIRegion - } - if rrrc.SubscriptionID != nil { - objectMap["subscriptionId"] = rrrc.SubscriptionID - } - if rrrc.RequestID != nil { - objectMap["requestId"] = rrrc.RequestID - } - if rrrc.RequestSize != nil { - objectMap["requestSize"] = rrrc.RequestSize - } - return json.Marshal(objectMap) -} - -// Resource the Resource definition. -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 for API Management resource. - 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) -} - -// ResourceSku describes an available API Management SKU. -type ResourceSku struct { - // Name - Name of the Sku. Possible values include: 'SkuTypeDeveloper', 'SkuTypeStandard', 'SkuTypePremium', 'SkuTypeBasic', 'SkuTypeConsumption' - Name SkuType `json:"name,omitempty"` -} - -// ResourceSkuCapacity describes scaling information of a SKU. -type ResourceSkuCapacity struct { - // Minimum - READ-ONLY; The minimum capacity. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - READ-ONLY; The maximum capacity that can be set. - Maximum *int32 `json:"maximum,omitempty"` - // Default - READ-ONLY; The default capacity. - Default *int32 `json:"default,omitempty"` - // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'Automatic', 'Manual', 'None' - ScaleType ResourceSkuCapacityScaleType `json:"scaleType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuCapacity. -func (rsc ResourceSkuCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuResult describes an available API Management service SKU. -type ResourceSkuResult struct { - // ResourceType - READ-ONLY; The type of resource the SKU applies to. - ResourceType *string `json:"resourceType,omitempty"` - // Sku - READ-ONLY; Specifies API Management SKU. - Sku *ResourceSku `json:"sku,omitempty"` - // Capacity - READ-ONLY; Specifies the number of API Management units. - Capacity *ResourceSkuCapacity `json:"capacity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuResult. -func (rsr ResourceSkuResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuResults the API Management service SKUs operation response. -type ResourceSkuResults struct { - autorest.Response `json:"-"` - // Value - The list of skus available for the service. - Value *[]ResourceSkuResult `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of API Management service Skus. - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceSkuResultsIterator provides access to a complete listing of ResourceSkuResult values. -type ResourceSkuResultsIterator struct { - i int - page ResourceSkuResultsPage -} - -// 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 *ResourceSkuResultsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuResultsIterator.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 *ResourceSkuResultsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceSkuResultsIterator) 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 ResourceSkuResultsIterator) Response() ResourceSkuResults { - 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 ResourceSkuResultsIterator) Value() ResourceSkuResult { - if !iter.page.NotDone() { - return ResourceSkuResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceSkuResultsIterator type. -func NewResourceSkuResultsIterator(page ResourceSkuResultsPage) ResourceSkuResultsIterator { - return ResourceSkuResultsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rsr ResourceSkuResults) IsEmpty() bool { - return rsr.Value == nil || len(*rsr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rsr ResourceSkuResults) hasNextLink() bool { - return rsr.NextLink != nil && len(*rsr.NextLink) != 0 -} - -// resourceSkuResultsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rsr ResourceSkuResults) resourceSkuResultsPreparer(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))) -} - -// ResourceSkuResultsPage contains a page of ResourceSkuResult values. -type ResourceSkuResultsPage struct { - fn func(context.Context, ResourceSkuResults) (ResourceSkuResults, error) - rsr ResourceSkuResults -} - -// 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 *ResourceSkuResultsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuResultsPage.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 *ResourceSkuResultsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceSkuResultsPage) NotDone() bool { - return !page.rsr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceSkuResultsPage) Response() ResourceSkuResults { - return page.rsr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceSkuResultsPage) Values() []ResourceSkuResult { - if page.rsr.IsEmpty() { - return nil - } - return *page.rsr.Value -} - -// Creates a new instance of the ResourceSkuResultsPage type. -func NewResourceSkuResultsPage(cur ResourceSkuResults, getNextPage func(context.Context, ResourceSkuResults) (ResourceSkuResults, error)) ResourceSkuResultsPage { - return ResourceSkuResultsPage{ - fn: getNextPage, - rsr: cur, - } -} - -// ResponseContract operation response details. -type ResponseContract struct { - // StatusCode - Operation response HTTP status code. - StatusCode *int32 `json:"statusCode,omitempty"` - // Description - Operation response description. - Description *string `json:"description,omitempty"` - // Representations - Collection of operation response representations. - Representations *[]RepresentationContract `json:"representations,omitempty"` - // Headers - Collection of operation response headers. - Headers *[]ParameterContract `json:"headers,omitempty"` -} - -// SamplingSettings sampling settings for Diagnostic. -type SamplingSettings struct { - // SamplingType - Sampling type. Possible values include: 'Fixed' - SamplingType SamplingType `json:"samplingType,omitempty"` - // Percentage - Rate of sampling for fixed-rate sampling. - Percentage *float64 `json:"percentage,omitempty"` -} - -// SaveConfigurationParameter parameters supplied to the Save Tenant Configuration operation. -type SaveConfigurationParameter struct { - // Branch - The name of the Git branch in which to commit the current configuration snapshot. - Branch *string `json:"branch,omitempty"` - // Force - The value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. - Force *bool `json:"force,omitempty"` -} - -// SchemaCollection the response of the list schema operation. -type SchemaCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Api Schema Contract value. - Value *[]SchemaContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaCollection. -func (sc SchemaCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SchemaCollectionIterator provides access to a complete listing of SchemaContract values. -type SchemaCollectionIterator struct { - i int - page SchemaCollectionPage -} - -// 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 *SchemaCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchemaCollectionIterator.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 *SchemaCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SchemaCollectionIterator) 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 SchemaCollectionIterator) Response() SchemaCollection { - 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 SchemaCollectionIterator) Value() SchemaContract { - if !iter.page.NotDone() { - return SchemaContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SchemaCollectionIterator type. -func NewSchemaCollectionIterator(page SchemaCollectionPage) SchemaCollectionIterator { - return SchemaCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sc SchemaCollection) IsEmpty() bool { - return sc.Value == nil || len(*sc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sc SchemaCollection) hasNextLink() bool { - return sc.NextLink != nil && len(*sc.NextLink) != 0 -} - -// schemaCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sc SchemaCollection) schemaCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !sc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sc.NextLink))) -} - -// SchemaCollectionPage contains a page of SchemaContract values. -type SchemaCollectionPage struct { - fn func(context.Context, SchemaCollection) (SchemaCollection, error) - sc SchemaCollection -} - -// 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 *SchemaCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchemaCollectionPage.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.sc) - if err != nil { - return err - } - page.sc = 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 *SchemaCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SchemaCollectionPage) NotDone() bool { - return !page.sc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SchemaCollectionPage) Response() SchemaCollection { - return page.sc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SchemaCollectionPage) Values() []SchemaContract { - if page.sc.IsEmpty() { - return nil - } - return *page.sc.Value -} - -// Creates a new instance of the SchemaCollectionPage type. -func NewSchemaCollectionPage(cur SchemaCollection, getNextPage func(context.Context, SchemaCollection) (SchemaCollection, error)) SchemaCollectionPage { - return SchemaCollectionPage{ - fn: getNextPage, - sc: cur, - } -} - -// SchemaContract schema Contract details. -type SchemaContract struct { - autorest.Response `json:"-"` - // SchemaContractProperties - Properties of the Schema. - *SchemaContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaContract. -func (sc SchemaContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sc.SchemaContractProperties != nil { - objectMap["properties"] = sc.SchemaContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SchemaContract struct. -func (sc *SchemaContract) 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 schemaContractProperties SchemaContractProperties - err = json.Unmarshal(*v, &schemaContractProperties) - if err != nil { - return err - } - sc.SchemaContractProperties = &schemaContractProperties - } - 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 - } - } - } - - return nil -} - -// SchemaContractProperties schema contract Properties. -type SchemaContractProperties struct { - // ContentType - Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). - ContentType *string `json:"contentType,omitempty"` - // SchemaDocumentProperties - Properties of the Schema Document. - *SchemaDocumentProperties `json:"document,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaContractProperties. -func (scp SchemaContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.ContentType != nil { - objectMap["contentType"] = scp.ContentType - } - if scp.SchemaDocumentProperties != nil { - objectMap["document"] = scp.SchemaDocumentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SchemaContractProperties struct. -func (scp *SchemaContractProperties) 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 "contentType": - if v != nil { - var contentType string - err = json.Unmarshal(*v, &contentType) - if err != nil { - return err - } - scp.ContentType = &contentType - } - case "document": - if v != nil { - var schemaDocumentProperties SchemaDocumentProperties - err = json.Unmarshal(*v, &schemaDocumentProperties) - if err != nil { - return err - } - scp.SchemaDocumentProperties = &schemaDocumentProperties - } - } - } - - return nil -} - -// SchemaDocumentProperties schema Document Properties. -type SchemaDocumentProperties struct { - // Value - Json escaped string defining the document representing the Schema. - Value *string `json:"value,omitempty"` -} - -// ServiceApplyNetworkConfigurationParameters parameter supplied to the Apply Network configuration -// operation. -type ServiceApplyNetworkConfigurationParameters struct { - // Location - Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. - Location *string `json:"location,omitempty"` -} - -// ServiceApplyNetworkConfigurationUpdatesFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServiceApplyNetworkConfigurationUpdatesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceApplyNetworkConfigurationUpdatesFuture) 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 ServiceApplyNetworkConfigurationUpdatesFuture.Result. -func (future *ServiceApplyNetworkConfigurationUpdatesFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.ApplyNetworkConfigurationUpdatesResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceBackupFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceBackupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceBackupFuture) 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 ServiceBackupFuture.Result. -func (future *ServiceBackupFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceBackupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceBackupFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.BackupResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceBackupFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceBackupRestoreParameters parameters supplied to the Backup/Restore of an API Management service -// operation. -type ServiceBackupRestoreParameters struct { - // StorageAccount - Azure Cloud Storage account (used to place/retrieve the backup) name. - StorageAccount *string `json:"storageAccount,omitempty"` - // AccessKey - Azure Cloud Storage account (used to place/retrieve the backup) access key. - AccessKey *string `json:"accessKey,omitempty"` - // ContainerName - Azure Cloud Storage blob container name used to place/retrieve the backup. - ContainerName *string `json:"containerName,omitempty"` - // BackupName - The name of the backup file to create. - BackupName *string `json:"backupName,omitempty"` -} - -// ServiceBaseProperties base Properties of an API Management service resource description. -type ServiceBaseProperties struct { - // NotificationSenderEmail - Email address from which the notification will be sent. - NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - // GatewayURL - READ-ONLY; Gateway URL of the API Management service. - GatewayURL *string `json:"gatewayUrl,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Default Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. - PortalURL *string `json:"portalUrl,omitempty"` - // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. - ScmURL *string `json:"scmUrl,omitempty"` - // HostnameConfigurations - Custom hostname configuration of the API Management service. - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard and Premium SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard and Premium SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration of the API Management service. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // AdditionalLocations - Additional datacenter locations of the API Management service. - AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` - // CustomProperties - Custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. - CustomProperties map[string]*string `json:"customProperties"` - // Certificates - List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` - // VirtualNetworkType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' - VirtualNetworkType VirtualNetworkType `json:"virtualNetworkType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBaseProperties. -func (sbp ServiceBaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sbp.NotificationSenderEmail != nil { - objectMap["notificationSenderEmail"] = sbp.NotificationSenderEmail - } - if sbp.HostnameConfigurations != nil { - objectMap["hostnameConfigurations"] = sbp.HostnameConfigurations - } - if sbp.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = sbp.VirtualNetworkConfiguration - } - if sbp.AdditionalLocations != nil { - objectMap["additionalLocations"] = sbp.AdditionalLocations - } - if sbp.CustomProperties != nil { - objectMap["customProperties"] = sbp.CustomProperties - } - if sbp.Certificates != nil { - objectMap["certificates"] = sbp.Certificates - } - if sbp.VirtualNetworkType != "" { - objectMap["virtualNetworkType"] = sbp.VirtualNetworkType - } - return json.Marshal(objectMap) -} - -// ServiceCheckNameAvailabilityParameters parameters supplied to the CheckNameAvailability operation. -type ServiceCheckNameAvailabilityParameters struct { - // Name - The name to check for availability. - Name *string `json:"name,omitempty"` -} - -// ServiceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceCreateOrUpdateFuture) 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 ServiceCreateOrUpdateFuture.Result. -func (future *ServiceCreateOrUpdateFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceDeleteFuture) 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 ServiceDeleteFuture.Result. -func (future *ServiceDeleteFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.DeleteResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceDeleteFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceGetSsoTokenResult the response of the GetSsoToken operation. -type ServiceGetSsoTokenResult struct { - autorest.Response `json:"-"` - // RedirectURI - Redirect URL to the Publisher Portal containing the SSO token. - RedirectURI *string `json:"redirectUri,omitempty"` -} - -// ServiceIdentity identity properties of the Api Management service resource. -type ServiceIdentity struct { - // Type - The identity type. Currently the only supported type is 'SystemAssigned'. - Type *string `json:"type,omitempty"` - // PrincipalID - READ-ONLY; The principal id of the identity. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The client tenant id of the identity. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceIdentity. -func (si ServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if si.Type != nil { - objectMap["type"] = si.Type - } - return json.Marshal(objectMap) -} - -// ServiceListResult the response of the List API Management services operation. -type ServiceListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List API Management services operation. - Value *[]ServiceResource `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of API Management services. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceListResultIterator provides access to a complete listing of ServiceResource values. -type ServiceListResultIterator struct { - i int - page ServiceListResultPage -} - -// 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 *ServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultIterator.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 *ServiceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceListResultIterator) 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 ServiceListResultIterator) Response() ServiceListResult { - 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 ServiceListResultIterator) Value() ServiceResource { - if !iter.page.NotDone() { - return ServiceResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceListResultIterator type. -func NewServiceListResultIterator(page ServiceListResultPage) ServiceListResultIterator { - return ServiceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr ServiceListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr ServiceListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// serviceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr ServiceListResult) serviceListResultPreparer(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))) -} - -// ServiceListResultPage contains a page of ServiceResource values. -type ServiceListResultPage struct { - fn func(context.Context, ServiceListResult) (ServiceListResult, error) - slr ServiceListResult -} - -// 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 *ServiceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultPage.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 *ServiceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceListResultPage) Response() ServiceListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceListResultPage) Values() []ServiceResource { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the ServiceListResultPage type. -func NewServiceListResultPage(cur ServiceListResult, getNextPage func(context.Context, ServiceListResult) (ServiceListResult, error)) ServiceListResultPage { - return ServiceListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// ServiceNameAvailabilityResult response of the CheckNameAvailability operation. -type ServiceNameAvailabilityResult struct { - autorest.Response `json:"-"` - // NameAvailable - READ-ONLY; True if the name is available and can be used to create a new API Management service; otherwise false. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Message - READ-ONLY; If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a different name. - Message *string `json:"message,omitempty"` - // Reason - Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'Valid', 'Invalid', 'AlreadyExists' - Reason NameAvailabilityReason `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceNameAvailabilityResult. -func (snar ServiceNameAvailabilityResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if snar.Reason != "" { - objectMap["reason"] = snar.Reason - } - return json.Marshal(objectMap) -} - -// ServiceProperties properties of an API Management service resource description. -type ServiceProperties struct { - // PublisherEmail - Publisher email. - PublisherEmail *string `json:"publisherEmail,omitempty"` - // PublisherName - Publisher name. - PublisherName *string `json:"publisherName,omitempty"` - // NotificationSenderEmail - Email address from which the notification will be sent. - NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - // GatewayURL - READ-ONLY; Gateway URL of the API Management service. - GatewayURL *string `json:"gatewayUrl,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Default Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. - PortalURL *string `json:"portalUrl,omitempty"` - // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. - ScmURL *string `json:"scmUrl,omitempty"` - // HostnameConfigurations - Custom hostname configuration of the API Management service. - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard and Premium SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard and Premium SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration of the API Management service. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // AdditionalLocations - Additional datacenter locations of the API Management service. - AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` - // CustomProperties - Custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. - CustomProperties map[string]*string `json:"customProperties"` - // Certificates - List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` - // VirtualNetworkType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' - VirtualNetworkType VirtualNetworkType `json:"virtualNetworkType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceProperties. -func (sp ServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.PublisherEmail != nil { - objectMap["publisherEmail"] = sp.PublisherEmail - } - if sp.PublisherName != nil { - objectMap["publisherName"] = sp.PublisherName - } - if sp.NotificationSenderEmail != nil { - objectMap["notificationSenderEmail"] = sp.NotificationSenderEmail - } - if sp.HostnameConfigurations != nil { - objectMap["hostnameConfigurations"] = sp.HostnameConfigurations - } - if sp.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = sp.VirtualNetworkConfiguration - } - if sp.AdditionalLocations != nil { - objectMap["additionalLocations"] = sp.AdditionalLocations - } - if sp.CustomProperties != nil { - objectMap["customProperties"] = sp.CustomProperties - } - if sp.Certificates != nil { - objectMap["certificates"] = sp.Certificates - } - if sp.VirtualNetworkType != "" { - objectMap["virtualNetworkType"] = sp.VirtualNetworkType - } - return json.Marshal(objectMap) -} - -// ServiceResource a single API Management service resource in List or Get response. -type ServiceResource struct { - autorest.Response `json:"-"` - // ServiceProperties - Properties of the API Management service. - *ServiceProperties `json:"properties,omitempty"` - // Sku - SKU properties of the API Management service. - Sku *ServiceSkuProperties `json:"sku,omitempty"` - // Identity - Managed service identity of the Api Management service. - Identity *ServiceIdentity `json:"identity,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Etag - READ-ONLY; ETag of the resource. - Etag *string `json:"etag,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 for API Management resource is set to Microsoft.ApiManagement. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceResource. -func (sr ServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.ServiceProperties != nil { - objectMap["properties"] = sr.ServiceProperties - } - if sr.Sku != nil { - objectMap["sku"] = sr.Sku - } - if sr.Identity != nil { - objectMap["identity"] = sr.Identity - } - if sr.Location != nil { - objectMap["location"] = sr.Location - } - if sr.Tags != nil { - objectMap["tags"] = sr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResource struct. -func (sr *ServiceResource) 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 serviceProperties ServiceProperties - err = json.Unmarshal(*v, &serviceProperties) - if err != nil { - return err - } - sr.ServiceProperties = &serviceProperties - } - case "sku": - if v != nil { - var sku ServiceSkuProperties - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sr.Sku = &sku - } - case "identity": - if v != nil { - var identity ServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sr.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sr.Location = &location - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sr.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sr.Tags = tags - } - } - } - - return nil -} - -// ServiceRestoreFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceRestoreFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceRestoreFuture) 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 ServiceRestoreFuture.Result. -func (future *ServiceRestoreFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceRestoreFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceRestoreFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.RestoreResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceRestoreFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceSkuProperties API Management service resource SKU properties. -type ServiceSkuProperties struct { - // Name - Name of the Sku. Possible values include: 'SkuTypeDeveloper', 'SkuTypeStandard', 'SkuTypePremium', 'SkuTypeBasic', 'SkuTypeConsumption' - Name SkuType `json:"name,omitempty"` - // Capacity - Capacity of the SKU (number of deployed units of the SKU). The default value is 1. - Capacity *int32 `json:"capacity,omitempty"` -} - -// ServiceUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceUpdateFuture) 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 ServiceUpdateFuture.Result. -func (future *ServiceUpdateFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.UpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceUpdateHostnameFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceUpdateHostnameFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceUpdateHostnameFuture) 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 ServiceUpdateHostnameFuture.Result. -func (future *ServiceUpdateHostnameFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceUpdateHostnameFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceUpdateHostnameFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.UpdateHostnameResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceUpdateHostnameFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceUpdateHostnameParameters parameters supplied to the UpdateHostname operation. -type ServiceUpdateHostnameParameters struct { - // Update - Hostnames to create or update. - Update *[]HostnameConfigurationOld `json:"update,omitempty"` - // Delete - Hostnames types to delete. - Delete *[]HostnameType `json:"delete,omitempty"` -} - -// ServiceUpdateParameters parameter supplied to Update Api Management Service. -type ServiceUpdateParameters struct { - // ServiceUpdateProperties - Properties of the API Management service. - *ServiceUpdateProperties `json:"properties,omitempty"` - // Sku - SKU properties of the API Management service. - Sku *ServiceSkuProperties `json:"sku,omitempty"` - // Identity - Managed service identity of the Api Management service. - Identity *ServiceIdentity `json:"identity,omitempty"` - // Etag - READ-ONLY; ETag of the resource. - Etag *string `json:"etag,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 for API Management resource is set to Microsoft.ApiManagement. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceUpdateParameters. -func (sup ServiceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.ServiceUpdateProperties != nil { - objectMap["properties"] = sup.ServiceUpdateProperties - } - if sup.Sku != nil { - objectMap["sku"] = sup.Sku - } - if sup.Identity != nil { - objectMap["identity"] = sup.Identity - } - if sup.Tags != nil { - objectMap["tags"] = sup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceUpdateParameters struct. -func (sup *ServiceUpdateParameters) 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 serviceUpdateProperties ServiceUpdateProperties - err = json.Unmarshal(*v, &serviceUpdateProperties) - if err != nil { - return err - } - sup.ServiceUpdateProperties = &serviceUpdateProperties - } - case "sku": - if v != nil { - var sku ServiceSkuProperties - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sup.Sku = &sku - } - case "identity": - if v != nil { - var identity ServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sup.Identity = &identity - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sup.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sup.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sup.Tags = tags - } - } - } - - return nil -} - -// ServiceUpdateProperties properties of an API Management service resource description. -type ServiceUpdateProperties struct { - // PublisherEmail - Publisher email. - PublisherEmail *string `json:"publisherEmail,omitempty"` - // PublisherName - Publisher name. - PublisherName *string `json:"publisherName,omitempty"` - // NotificationSenderEmail - Email address from which the notification will be sent. - NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - // GatewayURL - READ-ONLY; Gateway URL of the API Management service. - GatewayURL *string `json:"gatewayUrl,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Default Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. - PortalURL *string `json:"portalUrl,omitempty"` - // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. - ScmURL *string `json:"scmUrl,omitempty"` - // HostnameConfigurations - Custom hostname configuration of the API Management service. - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard and Premium SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard and Premium SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration of the API Management service. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // AdditionalLocations - Additional datacenter locations of the API Management service. - AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` - // CustomProperties - Custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. - CustomProperties map[string]*string `json:"customProperties"` - // Certificates - List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` - // VirtualNetworkType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' - VirtualNetworkType VirtualNetworkType `json:"virtualNetworkType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceUpdateProperties. -func (sup ServiceUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.PublisherEmail != nil { - objectMap["publisherEmail"] = sup.PublisherEmail - } - if sup.PublisherName != nil { - objectMap["publisherName"] = sup.PublisherName - } - if sup.NotificationSenderEmail != nil { - objectMap["notificationSenderEmail"] = sup.NotificationSenderEmail - } - if sup.HostnameConfigurations != nil { - objectMap["hostnameConfigurations"] = sup.HostnameConfigurations - } - if sup.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = sup.VirtualNetworkConfiguration - } - if sup.AdditionalLocations != nil { - objectMap["additionalLocations"] = sup.AdditionalLocations - } - if sup.CustomProperties != nil { - objectMap["customProperties"] = sup.CustomProperties - } - if sup.Certificates != nil { - objectMap["certificates"] = sup.Certificates - } - if sup.VirtualNetworkType != "" { - objectMap["virtualNetworkType"] = sup.VirtualNetworkType - } - return json.Marshal(objectMap) -} - -// ServiceUploadCertificateParameters parameters supplied to the Upload SSL certificate for an API -// Management service operation. -type ServiceUploadCertificateParameters struct { - // Type - Hostname type. Possible values include: 'Proxy', 'Portal', 'Management', 'Scm' - Type HostnameType `json:"type,omitempty"` - // Certificate - Base64 Encoded certificate. - Certificate *string `json:"certificate,omitempty"` - // CertificatePassword - Certificate password. - CertificatePassword *string `json:"certificate_password,omitempty"` -} - -// SubscriptionCollection paged Subscriptions list representation. -type SubscriptionCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]SubscriptionContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// SubscriptionCollectionIterator provides access to a complete listing of SubscriptionContract values. -type SubscriptionCollectionIterator struct { - i int - page SubscriptionCollectionPage -} - -// 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 *SubscriptionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionCollectionIterator.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 *SubscriptionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SubscriptionCollectionIterator) 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 SubscriptionCollectionIterator) Response() SubscriptionCollection { - 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 SubscriptionCollectionIterator) Value() SubscriptionContract { - if !iter.page.NotDone() { - return SubscriptionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SubscriptionCollectionIterator type. -func NewSubscriptionCollectionIterator(page SubscriptionCollectionPage) SubscriptionCollectionIterator { - return SubscriptionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sc SubscriptionCollection) IsEmpty() bool { - return sc.Value == nil || len(*sc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sc SubscriptionCollection) hasNextLink() bool { - return sc.NextLink != nil && len(*sc.NextLink) != 0 -} - -// subscriptionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sc SubscriptionCollection) subscriptionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !sc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sc.NextLink))) -} - -// SubscriptionCollectionPage contains a page of SubscriptionContract values. -type SubscriptionCollectionPage struct { - fn func(context.Context, SubscriptionCollection) (SubscriptionCollection, error) - sc SubscriptionCollection -} - -// 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 *SubscriptionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionCollectionPage.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.sc) - if err != nil { - return err - } - page.sc = 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 *SubscriptionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SubscriptionCollectionPage) NotDone() bool { - return !page.sc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SubscriptionCollectionPage) Response() SubscriptionCollection { - return page.sc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SubscriptionCollectionPage) Values() []SubscriptionContract { - if page.sc.IsEmpty() { - return nil - } - return *page.sc.Value -} - -// Creates a new instance of the SubscriptionCollectionPage type. -func NewSubscriptionCollectionPage(cur SubscriptionCollection, getNextPage func(context.Context, SubscriptionCollection) (SubscriptionCollection, error)) SubscriptionCollectionPage { - return SubscriptionCollectionPage{ - fn: getNextPage, - sc: cur, - } -} - -// SubscriptionContract subscription details. -type SubscriptionContract struct { - autorest.Response `json:"-"` - // SubscriptionContractProperties - Subscription contract properties. - *SubscriptionContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionContract. -func (sc SubscriptionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sc.SubscriptionContractProperties != nil { - objectMap["properties"] = sc.SubscriptionContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionContract struct. -func (sc *SubscriptionContract) 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 subscriptionContractProperties SubscriptionContractProperties - err = json.Unmarshal(*v, &subscriptionContractProperties) - if err != nil { - return err - } - sc.SubscriptionContractProperties = &subscriptionContractProperties - } - 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 - } - } - } - - return nil -} - -// SubscriptionContractProperties subscription details. -type SubscriptionContractProperties struct { - // OwnerID - The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier. - OwnerID *string `json:"ownerId,omitempty"` - // Scope - Scope like /products/{productId} or /apis or /apis/{apiId}. - Scope *string `json:"scope,omitempty"` - // DisplayName - The name of the subscription, or null if the subscription has no name. - DisplayName *string `json:"displayName,omitempty"` - // State - Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'Suspended', 'Active', 'Expired', 'Submitted', 'Rejected', 'Cancelled' - State SubscriptionState `json:"state,omitempty"` - // CreatedDate - READ-ONLY; Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // StartDate - Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - StartDate *date.Time `json:"startDate,omitempty"` - // ExpirationDate - Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // EndDate - Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - EndDate *date.Time `json:"endDate,omitempty"` - // NotificationDate - Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - NotificationDate *date.Time `json:"notificationDate,omitempty"` - // PrimaryKey - Subscription primary key. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Subscription secondary key. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // StateComment - Optional subscription comment added by an administrator. - StateComment *string `json:"stateComment,omitempty"` - // AllowTracing - Determines whether tracing is enabled - AllowTracing *bool `json:"allowTracing,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionContractProperties. -func (scp SubscriptionContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.OwnerID != nil { - objectMap["ownerId"] = scp.OwnerID - } - if scp.Scope != nil { - objectMap["scope"] = scp.Scope - } - if scp.DisplayName != nil { - objectMap["displayName"] = scp.DisplayName - } - if scp.State != "" { - objectMap["state"] = scp.State - } - if scp.StartDate != nil { - objectMap["startDate"] = scp.StartDate - } - if scp.ExpirationDate != nil { - objectMap["expirationDate"] = scp.ExpirationDate - } - if scp.EndDate != nil { - objectMap["endDate"] = scp.EndDate - } - if scp.NotificationDate != nil { - objectMap["notificationDate"] = scp.NotificationDate - } - if scp.PrimaryKey != nil { - objectMap["primaryKey"] = scp.PrimaryKey - } - if scp.SecondaryKey != nil { - objectMap["secondaryKey"] = scp.SecondaryKey - } - if scp.StateComment != nil { - objectMap["stateComment"] = scp.StateComment - } - if scp.AllowTracing != nil { - objectMap["allowTracing"] = scp.AllowTracing - } - return json.Marshal(objectMap) -} - -// SubscriptionCreateParameterProperties parameters supplied to the Create subscription operation. -type SubscriptionCreateParameterProperties struct { - // OwnerID - User (user id path) for whom subscription is being created in form /users/{userId} - OwnerID *string `json:"ownerId,omitempty"` - // Scope - Scope like /products/{productId} or /apis or /apis/{apiId}. - Scope *string `json:"scope,omitempty"` - // DisplayName - Subscription name. - DisplayName *string `json:"displayName,omitempty"` - // PrimaryKey - Primary subscription key. If not specified during request key will be generated automatically. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary subscription key. If not specified during request key will be generated automatically. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // State - Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'Suspended', 'Active', 'Expired', 'Submitted', 'Rejected', 'Cancelled' - State SubscriptionState `json:"state,omitempty"` - // AllowTracing - Determines whether tracing can be enabled - AllowTracing *bool `json:"allowTracing,omitempty"` -} - -// SubscriptionCreateParameters subscription create details. -type SubscriptionCreateParameters struct { - // SubscriptionCreateParameterProperties - Subscription contract properties. - *SubscriptionCreateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionCreateParameters. -func (scp SubscriptionCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.SubscriptionCreateParameterProperties != nil { - objectMap["properties"] = scp.SubscriptionCreateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionCreateParameters struct. -func (scp *SubscriptionCreateParameters) 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 subscriptionCreateParameterProperties SubscriptionCreateParameterProperties - err = json.Unmarshal(*v, &subscriptionCreateParameterProperties) - if err != nil { - return err - } - scp.SubscriptionCreateParameterProperties = &subscriptionCreateParameterProperties - } - } - } - - return nil -} - -// SubscriptionKeyParameterNamesContract subscription key parameter names details. -type SubscriptionKeyParameterNamesContract struct { - // Header - Subscription key header name. - Header *string `json:"header,omitempty"` - // Query - Subscription key query string parameter name. - Query *string `json:"query,omitempty"` -} - -// SubscriptionsDelegationSettingsProperties subscriptions delegation settings properties. -type SubscriptionsDelegationSettingsProperties struct { - // Enabled - Enable or disable delegation for subscriptions. - Enabled *bool `json:"enabled,omitempty"` -} - -// SubscriptionUpdateParameterProperties parameters supplied to the Update subscription operation. -type SubscriptionUpdateParameterProperties struct { - // OwnerID - User identifier path: /users/{userId} - OwnerID *string `json:"ownerId,omitempty"` - // Scope - Scope like /products/{productId} or /apis or /apis/{apiId} - Scope *string `json:"scope,omitempty"` - // ExpirationDate - Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // DisplayName - Subscription name. - DisplayName *string `json:"displayName,omitempty"` - // PrimaryKey - Primary subscription key. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary subscription key. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // State - Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'Suspended', 'Active', 'Expired', 'Submitted', 'Rejected', 'Cancelled' - State SubscriptionState `json:"state,omitempty"` - // StateComment - Comments describing subscription state change by the administrator. - StateComment *string `json:"stateComment,omitempty"` - // AllowTracing - Determines whether tracing can be enabled - AllowTracing *bool `json:"allowTracing,omitempty"` -} - -// SubscriptionUpdateParameters subscription update details. -type SubscriptionUpdateParameters struct { - // SubscriptionUpdateParameterProperties - Subscription Update contract properties. - *SubscriptionUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionUpdateParameters. -func (sup SubscriptionUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.SubscriptionUpdateParameterProperties != nil { - objectMap["properties"] = sup.SubscriptionUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionUpdateParameters struct. -func (sup *SubscriptionUpdateParameters) 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 subscriptionUpdateParameterProperties SubscriptionUpdateParameterProperties - err = json.Unmarshal(*v, &subscriptionUpdateParameterProperties) - if err != nil { - return err - } - sup.SubscriptionUpdateParameterProperties = &subscriptionUpdateParameterProperties - } - } - } - - return nil -} - -// TagCollection paged Tag list representation. -type TagCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]TagContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// TagCollectionIterator provides access to a complete listing of TagContract values. -type TagCollectionIterator struct { - i int - page TagCollectionPage -} - -// 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 *TagCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagCollectionIterator.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 *TagCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagCollectionIterator) 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 TagCollectionIterator) Response() TagCollection { - 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 TagCollectionIterator) Value() TagContract { - if !iter.page.NotDone() { - return TagContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagCollectionIterator type. -func NewTagCollectionIterator(page TagCollectionPage) TagCollectionIterator { - return TagCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tc TagCollection) IsEmpty() bool { - return tc.Value == nil || len(*tc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tc TagCollection) hasNextLink() bool { - return tc.NextLink != nil && len(*tc.NextLink) != 0 -} - -// tagCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tc TagCollection) tagCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !tc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tc.NextLink))) -} - -// TagCollectionPage contains a page of TagContract values. -type TagCollectionPage struct { - fn func(context.Context, TagCollection) (TagCollection, error) - tc TagCollection -} - -// 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 *TagCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagCollectionPage.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.tc) - if err != nil { - return err - } - page.tc = 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 *TagCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagCollectionPage) NotDone() bool { - return !page.tc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagCollectionPage) Response() TagCollection { - return page.tc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagCollectionPage) Values() []TagContract { - if page.tc.IsEmpty() { - return nil - } - return *page.tc.Value -} - -// Creates a new instance of the TagCollectionPage type. -func NewTagCollectionPage(cur TagCollection, getNextPage func(context.Context, TagCollection) (TagCollection, error)) TagCollectionPage { - return TagCollectionPage{ - fn: getNextPage, - tc: cur, - } -} - -// TagContract tag Contract details. -type TagContract struct { - autorest.Response `json:"-"` - // TagContractProperties - Tag entity contract properties. - *TagContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagContract. -func (tc TagContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tc.TagContractProperties != nil { - objectMap["properties"] = tc.TagContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagContract struct. -func (tc *TagContract) 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 tagContractProperties TagContractProperties - err = json.Unmarshal(*v, &tagContractProperties) - if err != nil { - return err - } - tc.TagContractProperties = &tagContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tc.Type = &typeVar - } - } - } - - return nil -} - -// TagContractProperties tag contract Properties. -type TagContractProperties struct { - // DisplayName - Tag name. - DisplayName *string `json:"displayName,omitempty"` -} - -// TagCreateUpdateParameters parameters supplied to Create/Update Tag operations. -type TagCreateUpdateParameters struct { - // TagContractProperties - Properties supplied to Create Tag operation. - *TagContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagCreateUpdateParameters. -func (tcup TagCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TagContractProperties != nil { - objectMap["properties"] = tcup.TagContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagCreateUpdateParameters struct. -func (tcup *TagCreateUpdateParameters) 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 tagContractProperties TagContractProperties - err = json.Unmarshal(*v, &tagContractProperties) - if err != nil { - return err - } - tcup.TagContractProperties = &tagContractProperties - } - } - } - - return nil -} - -// TagDescriptionBaseProperties parameters supplied to the Create TagDescription operation. -type TagDescriptionBaseProperties struct { - // Description - Description of the Tag. - Description *string `json:"description,omitempty"` - // ExternalDocsURL - Absolute URL of external resources describing the tag. - ExternalDocsURL *string `json:"externalDocsUrl,omitempty"` - // ExternalDocsDescription - Description of the external resources describing the tag. - ExternalDocsDescription *string `json:"externalDocsDescription,omitempty"` -} - -// TagDescriptionCollection paged TagDescription list representation. -type TagDescriptionCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]TagDescriptionContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// TagDescriptionCollectionIterator provides access to a complete listing of TagDescriptionContract values. -type TagDescriptionCollectionIterator struct { - i int - page TagDescriptionCollectionPage -} - -// 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 *TagDescriptionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionCollectionIterator.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 *TagDescriptionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagDescriptionCollectionIterator) 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 TagDescriptionCollectionIterator) Response() TagDescriptionCollection { - 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 TagDescriptionCollectionIterator) Value() TagDescriptionContract { - if !iter.page.NotDone() { - return TagDescriptionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagDescriptionCollectionIterator type. -func NewTagDescriptionCollectionIterator(page TagDescriptionCollectionPage) TagDescriptionCollectionIterator { - return TagDescriptionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tdc TagDescriptionCollection) IsEmpty() bool { - return tdc.Value == nil || len(*tdc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tdc TagDescriptionCollection) hasNextLink() bool { - return tdc.NextLink != nil && len(*tdc.NextLink) != 0 -} - -// tagDescriptionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tdc TagDescriptionCollection) tagDescriptionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !tdc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tdc.NextLink))) -} - -// TagDescriptionCollectionPage contains a page of TagDescriptionContract values. -type TagDescriptionCollectionPage struct { - fn func(context.Context, TagDescriptionCollection) (TagDescriptionCollection, error) - tdc TagDescriptionCollection -} - -// 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 *TagDescriptionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionCollectionPage.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.tdc) - if err != nil { - return err - } - page.tdc = 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 *TagDescriptionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagDescriptionCollectionPage) NotDone() bool { - return !page.tdc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagDescriptionCollectionPage) Response() TagDescriptionCollection { - return page.tdc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagDescriptionCollectionPage) Values() []TagDescriptionContract { - if page.tdc.IsEmpty() { - return nil - } - return *page.tdc.Value -} - -// Creates a new instance of the TagDescriptionCollectionPage type. -func NewTagDescriptionCollectionPage(cur TagDescriptionCollection, getNextPage func(context.Context, TagDescriptionCollection) (TagDescriptionCollection, error)) TagDescriptionCollectionPage { - return TagDescriptionCollectionPage{ - fn: getNextPage, - tdc: cur, - } -} - -// TagDescriptionContract contract details. -type TagDescriptionContract struct { - autorest.Response `json:"-"` - // TagDescriptionContractProperties - TagDescription entity contract properties. - *TagDescriptionContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagDescriptionContract. -func (tdc TagDescriptionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tdc.TagDescriptionContractProperties != nil { - objectMap["properties"] = tdc.TagDescriptionContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagDescriptionContract struct. -func (tdc *TagDescriptionContract) 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 tagDescriptionContractProperties TagDescriptionContractProperties - err = json.Unmarshal(*v, &tagDescriptionContractProperties) - if err != nil { - return err - } - tdc.TagDescriptionContractProperties = &tagDescriptionContractProperties - } - 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 - } - } - } - - return nil -} - -// TagDescriptionContractProperties tagDescription contract Properties. -type TagDescriptionContractProperties struct { - // DisplayName - Tag name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the Tag. - Description *string `json:"description,omitempty"` - // ExternalDocsURL - Absolute URL of external resources describing the tag. - ExternalDocsURL *string `json:"externalDocsUrl,omitempty"` - // ExternalDocsDescription - Description of the external resources describing the tag. - ExternalDocsDescription *string `json:"externalDocsDescription,omitempty"` -} - -// TagDescriptionCreateParameters parameters supplied to the Create TagDescription operation. -type TagDescriptionCreateParameters struct { - // TagDescriptionBaseProperties - Properties supplied to Create TagDescription operation. - *TagDescriptionBaseProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagDescriptionCreateParameters. -func (tdcp TagDescriptionCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tdcp.TagDescriptionBaseProperties != nil { - objectMap["properties"] = tdcp.TagDescriptionBaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagDescriptionCreateParameters struct. -func (tdcp *TagDescriptionCreateParameters) 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 tagDescriptionBaseProperties TagDescriptionBaseProperties - err = json.Unmarshal(*v, &tagDescriptionBaseProperties) - if err != nil { - return err - } - tdcp.TagDescriptionBaseProperties = &tagDescriptionBaseProperties - } - } - } - - return nil -} - -// TagResourceCollection paged Tag list representation. -type TagResourceCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]TagResourceContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// TagResourceCollectionIterator provides access to a complete listing of TagResourceContract values. -type TagResourceCollectionIterator struct { - i int - page TagResourceCollectionPage -} - -// 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 *TagResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceCollectionIterator.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 *TagResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagResourceCollectionIterator) 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 TagResourceCollectionIterator) Response() TagResourceCollection { - 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 TagResourceCollectionIterator) Value() TagResourceContract { - if !iter.page.NotDone() { - return TagResourceContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagResourceCollectionIterator type. -func NewTagResourceCollectionIterator(page TagResourceCollectionPage) TagResourceCollectionIterator { - return TagResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (trc TagResourceCollection) IsEmpty() bool { - return trc.Value == nil || len(*trc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (trc TagResourceCollection) hasNextLink() bool { - return trc.NextLink != nil && len(*trc.NextLink) != 0 -} - -// tagResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (trc TagResourceCollection) tagResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !trc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(trc.NextLink))) -} - -// TagResourceCollectionPage contains a page of TagResourceContract values. -type TagResourceCollectionPage struct { - fn func(context.Context, TagResourceCollection) (TagResourceCollection, error) - trc TagResourceCollection -} - -// 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 *TagResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceCollectionPage.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.trc) - if err != nil { - return err - } - page.trc = 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 *TagResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagResourceCollectionPage) NotDone() bool { - return !page.trc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagResourceCollectionPage) Response() TagResourceCollection { - return page.trc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagResourceCollectionPage) Values() []TagResourceContract { - if page.trc.IsEmpty() { - return nil - } - return *page.trc.Value -} - -// Creates a new instance of the TagResourceCollectionPage type. -func NewTagResourceCollectionPage(cur TagResourceCollection, getNextPage func(context.Context, TagResourceCollection) (TagResourceCollection, error)) TagResourceCollectionPage { - return TagResourceCollectionPage{ - fn: getNextPage, - trc: cur, - } -} - -// TagResourceContract tagResource contract properties. -type TagResourceContract struct { - // Tag - Tag associated with the resource. - Tag *TagTagResourceContractProperties `json:"tag,omitempty"` - // API - Api associated with the tag. - API *APITagResourceContractProperties `json:"api,omitempty"` - // Operation - Operation associated with the tag. - Operation *OperationTagResourceContractProperties `json:"operation,omitempty"` - // Product - Product associated with the tag. - Product *ProductTagResourceContractProperties `json:"product,omitempty"` -} - -// TagTagResourceContractProperties contract defining the Tag property in the Tag Resource Contract -type TagTagResourceContractProperties struct { - // ID - Tag identifier - ID *string `json:"id,omitempty"` - // Name - Tag Name - Name *string `json:"name,omitempty"` -} - -// TenantConfigurationDeployFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TenantConfigurationDeployFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TenantConfigurationClient) (OperationResultContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TenantConfigurationDeployFuture) 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 TenantConfigurationDeployFuture.Result. -func (future *TenantConfigurationDeployFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationDeployFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - orc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationDeployFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { - orc, err = client.DeployResponder(orc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationDeployFuture", "Result", orc.Response.Response, "Failure responding to request") - } - } - return -} - -// TenantConfigurationSaveFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TenantConfigurationSaveFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TenantConfigurationClient) (OperationResultContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TenantConfigurationSaveFuture) 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 TenantConfigurationSaveFuture.Result. -func (future *TenantConfigurationSaveFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSaveFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - orc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationSaveFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { - orc, err = client.SaveResponder(orc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSaveFuture", "Result", orc.Response.Response, "Failure responding to request") - } - } - return -} - -// TenantConfigurationSyncStateContract tenant Configuration Synchronization State. -type TenantConfigurationSyncStateContract struct { - autorest.Response `json:"-"` - // Branch - The name of Git branch. - Branch *string `json:"branch,omitempty"` - // CommitID - The latest commit Id. - CommitID *string `json:"commitId,omitempty"` - // IsExport - value indicating if last sync was save (true) or deploy (false) operation. - IsExport *bool `json:"isExport,omitempty"` - // IsSynced - value indicating if last synchronization was later than the configuration change. - IsSynced *bool `json:"isSynced,omitempty"` - // IsGitEnabled - value indicating whether Git configuration access is enabled. - IsGitEnabled *bool `json:"isGitEnabled,omitempty"` - // SyncDate - The date of the latest synchronization. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - SyncDate *date.Time `json:"syncDate,omitempty"` - // ConfigurationChangeDate - The date of the latest configuration change. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ConfigurationChangeDate *date.Time `json:"configurationChangeDate,omitempty"` -} - -// TenantConfigurationValidateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TenantConfigurationValidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TenantConfigurationClient) (OperationResultContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TenantConfigurationValidateFuture) 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 TenantConfigurationValidateFuture.Result. -func (future *TenantConfigurationValidateFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationValidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - orc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationValidateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { - orc, err = client.ValidateResponder(orc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationValidateFuture", "Result", orc.Response.Response, "Failure responding to request") - } - } - return -} - -// TermsOfServiceProperties terms of service contract properties. -type TermsOfServiceProperties struct { - // Text - A terms of service text. - Text *string `json:"text,omitempty"` - // Enabled - Display terms of service during a sign-up process. - Enabled *bool `json:"enabled,omitempty"` - // ConsentRequired - Ask user for consent to the terms of service. - ConsentRequired *bool `json:"consentRequired,omitempty"` -} - -// TokenBodyParameterContract oAuth acquire token request body parameter (www-url-form-encoded). -type TokenBodyParameterContract struct { - // Name - body parameter name. - Name *string `json:"name,omitempty"` - // Value - body parameter value. - Value *string `json:"value,omitempty"` -} - -// UserCollection paged Users list representation. -type UserCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]UserContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// UserCollectionIterator provides access to a complete listing of UserContract values. -type UserCollectionIterator struct { - i int - page UserCollectionPage -} - -// 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 *UserCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserCollectionIterator.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 *UserCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserCollectionIterator) 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 UserCollectionIterator) Response() UserCollection { - 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 UserCollectionIterator) Value() UserContract { - if !iter.page.NotDone() { - return UserContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserCollectionIterator type. -func NewUserCollectionIterator(page UserCollectionPage) UserCollectionIterator { - return UserCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (uc UserCollection) IsEmpty() bool { - return uc.Value == nil || len(*uc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (uc UserCollection) hasNextLink() bool { - return uc.NextLink != nil && len(*uc.NextLink) != 0 -} - -// userCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (uc UserCollection) userCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !uc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(uc.NextLink))) -} - -// UserCollectionPage contains a page of UserContract values. -type UserCollectionPage struct { - fn func(context.Context, UserCollection) (UserCollection, error) - uc UserCollection -} - -// 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 *UserCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserCollectionPage.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.uc) - if err != nil { - return err - } - page.uc = 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 *UserCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserCollectionPage) NotDone() bool { - return !page.uc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserCollectionPage) Response() UserCollection { - return page.uc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserCollectionPage) Values() []UserContract { - if page.uc.IsEmpty() { - return nil - } - return *page.uc.Value -} - -// Creates a new instance of the UserCollectionPage type. -func NewUserCollectionPage(cur UserCollection, getNextPage func(context.Context, UserCollection) (UserCollection, error)) UserCollectionPage { - return UserCollectionPage{ - fn: getNextPage, - uc: cur, - } -} - -// UserContract user details. -type UserContract struct { - autorest.Response `json:"-"` - // UserContractProperties - User entity contract properties. - *UserContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserContract. -func (uc UserContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if uc.UserContractProperties != nil { - objectMap["properties"] = uc.UserContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserContract struct. -func (uc *UserContract) 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 userContractProperties UserContractProperties - err = json.Unmarshal(*v, &userContractProperties) - if err != nil { - return err - } - uc.UserContractProperties = &userContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - uc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - uc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - uc.Type = &typeVar - } - } - } - - return nil -} - -// UserContractProperties user profile. -type UserContractProperties struct { - // FirstName - First name. - FirstName *string `json:"firstName,omitempty"` - // LastName - Last name. - LastName *string `json:"lastName,omitempty"` - // Email - Email address. - Email *string `json:"email,omitempty"` - // RegistrationDate - Date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - RegistrationDate *date.Time `json:"registrationDate,omitempty"` - // Groups - READ-ONLY; Collection of groups user is part of. - Groups *[]GroupContractProperties `json:"groups,omitempty"` - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserContractProperties. -func (ucp UserContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucp.FirstName != nil { - objectMap["firstName"] = ucp.FirstName - } - if ucp.LastName != nil { - objectMap["lastName"] = ucp.LastName - } - if ucp.Email != nil { - objectMap["email"] = ucp.Email - } - if ucp.RegistrationDate != nil { - objectMap["registrationDate"] = ucp.RegistrationDate - } - if ucp.State != "" { - objectMap["state"] = ucp.State - } - if ucp.Note != nil { - objectMap["note"] = ucp.Note - } - if ucp.Identities != nil { - objectMap["identities"] = ucp.Identities - } - return json.Marshal(objectMap) -} - -// UserCreateParameterProperties parameters supplied to the Create User operation. -type UserCreateParameterProperties struct { - // Email - Email address. Must not be empty and must be unique within the service instance. - Email *string `json:"email,omitempty"` - // FirstName - First name. - FirstName *string `json:"firstName,omitempty"` - // LastName - Last name. - LastName *string `json:"lastName,omitempty"` - // Password - User Password. If no value is provided, a default password is generated. - Password *string `json:"password,omitempty"` - // Confirmation - Determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: 'Signup', 'Invite' - Confirmation Confirmation `json:"confirmation,omitempty"` - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// UserCreateParameters user create details. -type UserCreateParameters struct { - // UserCreateParameterProperties - User entity create contract properties. - *UserCreateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserCreateParameters. -func (ucp UserCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucp.UserCreateParameterProperties != nil { - objectMap["properties"] = ucp.UserCreateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserCreateParameters struct. -func (ucp *UserCreateParameters) 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 userCreateParameterProperties UserCreateParameterProperties - err = json.Unmarshal(*v, &userCreateParameterProperties) - if err != nil { - return err - } - ucp.UserCreateParameterProperties = &userCreateParameterProperties - } - } - } - - return nil -} - -// UserEntityBaseParameters user Entity Base Parameters set. -type UserEntityBaseParameters struct { - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// UserIdentityCollection list of Users Identity list representation. -type UserIdentityCollection struct { - autorest.Response `json:"-"` - // Value - User Identity values. - Value *[]UserIdentityContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// UserIdentityCollectionIterator provides access to a complete listing of UserIdentityContract values. -type UserIdentityCollectionIterator struct { - i int - page UserIdentityCollectionPage -} - -// 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 *UserIdentityCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentityCollectionIterator.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 *UserIdentityCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserIdentityCollectionIterator) 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 UserIdentityCollectionIterator) Response() UserIdentityCollection { - 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 UserIdentityCollectionIterator) Value() UserIdentityContract { - if !iter.page.NotDone() { - return UserIdentityContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserIdentityCollectionIterator type. -func NewUserIdentityCollectionIterator(page UserIdentityCollectionPage) UserIdentityCollectionIterator { - return UserIdentityCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (uic UserIdentityCollection) IsEmpty() bool { - return uic.Value == nil || len(*uic.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (uic UserIdentityCollection) hasNextLink() bool { - return uic.NextLink != nil && len(*uic.NextLink) != 0 -} - -// userIdentityCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (uic UserIdentityCollection) userIdentityCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !uic.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(uic.NextLink))) -} - -// UserIdentityCollectionPage contains a page of UserIdentityContract values. -type UserIdentityCollectionPage struct { - fn func(context.Context, UserIdentityCollection) (UserIdentityCollection, error) - uic UserIdentityCollection -} - -// 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 *UserIdentityCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentityCollectionPage.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.uic) - if err != nil { - return err - } - page.uic = 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 *UserIdentityCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserIdentityCollectionPage) NotDone() bool { - return !page.uic.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserIdentityCollectionPage) Response() UserIdentityCollection { - return page.uic -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserIdentityCollectionPage) Values() []UserIdentityContract { - if page.uic.IsEmpty() { - return nil - } - return *page.uic.Value -} - -// Creates a new instance of the UserIdentityCollectionPage type. -func NewUserIdentityCollectionPage(cur UserIdentityCollection, getNextPage func(context.Context, UserIdentityCollection) (UserIdentityCollection, error)) UserIdentityCollectionPage { - return UserIdentityCollectionPage{ - fn: getNextPage, - uic: cur, - } -} - -// UserIdentityContract user identity details. -type UserIdentityContract struct { - // Provider - Identity provider name. - Provider *string `json:"provider,omitempty"` - // ID - Identifier value within provider. - ID *string `json:"id,omitempty"` -} - -// UserTokenParameters parameters supplied to the Get User Token operation. -type UserTokenParameters struct { - // KeyType - The Key to be used to generate token for user. Possible values include: 'Primary', 'Secondary' - KeyType KeyType `json:"keyType,omitempty"` - // Expiry - The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Expiry *date.Time `json:"expiry,omitempty"` -} - -// UserTokenResult get User Token response details. -type UserTokenResult struct { - autorest.Response `json:"-"` - // Value - Shared Access Authorization token for the User. - Value *string `json:"value,omitempty"` -} - -// UserUpdateParameters user update parameters. -type UserUpdateParameters struct { - // UserUpdateParametersProperties - User entity update contract properties. - *UserUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserUpdateParameters. -func (uup UserUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if uup.UserUpdateParametersProperties != nil { - objectMap["properties"] = uup.UserUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserUpdateParameters struct. -func (uup *UserUpdateParameters) 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 userUpdateParametersProperties UserUpdateParametersProperties - err = json.Unmarshal(*v, &userUpdateParametersProperties) - if err != nil { - return err - } - uup.UserUpdateParametersProperties = &userUpdateParametersProperties - } - } - } - - return nil -} - -// UserUpdateParametersProperties parameters supplied to the Update User operation. -type UserUpdateParametersProperties struct { - // Email - Email address. Must not be empty and must be unique within the service instance. - Email *string `json:"email,omitempty"` - // Password - User Password. - Password *string `json:"password,omitempty"` - // FirstName - First name. - FirstName *string `json:"firstName,omitempty"` - // LastName - Last name. - LastName *string `json:"lastName,omitempty"` - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// VirtualNetworkConfiguration configuration of a virtual network to which API Management service is -// deployed. -type VirtualNetworkConfiguration struct { - // Vnetid - READ-ONLY; The virtual network ID. This is typically a GUID. Expect a null GUID by default. - Vnetid *string `json:"vnetid,omitempty"` - // Subnetname - READ-ONLY; The name of the subnet. - Subnetname *string `json:"subnetname,omitempty"` - // SubnetResourceID - The full resource ID of a subnet in a virtual network to deploy the API Management service in. - SubnetResourceID *string `json:"subnetResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkConfiguration. -func (vnc VirtualNetworkConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnc.SubnetResourceID != nil { - objectMap["subnetResourceId"] = vnc.SubnetResourceID - } - return json.Marshal(objectMap) -} - -// X509CertificateName properties of server X509Names. -type X509CertificateName struct { - // Name - Common Name of the Certificate. - Name *string `json:"name,omitempty"` - // IssuerCertificateThumbprint - Thumbprint for the Issuer of the Certificate. - IssuerCertificateThumbprint *string `json:"issuerCertificateThumbprint,omitempty"` -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/networkstatus.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/networkstatus.go deleted file mode 100644 index b9c25413d044..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/networkstatus.go +++ /dev/null @@ -1,207 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NetworkStatusClient is the apiManagement Client -type NetworkStatusClient struct { - BaseClient -} - -// NewNetworkStatusClient creates an instance of the NetworkStatusClient client. -func NewNetworkStatusClient(subscriptionID string) NetworkStatusClient { - return NewNetworkStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNetworkStatusClientWithBaseURI creates an instance of the NetworkStatusClient 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 NewNetworkStatusClientWithBaseURI(baseURI string, subscriptionID string) NetworkStatusClient { - return NetworkStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByLocation gets the Connectivity Status to the external resources on which the Api Management service depends -// from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// locationName - location in which the API Management service is deployed. This is one of the Azure Regions -// like West US, East US, South Central US. -func (client NetworkStatusClient) ListByLocation(ctx context.Context, resourceGroupName string, serviceName string, locationName string) (result NetworkStatusContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkStatusClient.ListByLocation") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: locationName, - Constraints: []validation.Constraint{{Target: "locationName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NetworkStatusClient", "ListByLocation", err.Error()) - } - - req, err := client.ListByLocationPreparer(ctx, resourceGroupName, serviceName, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByLocation", resp, "Failure sending request") - return - } - - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByLocation", resp, "Failure responding to request") - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client NetworkStatusClient) ListByLocationPreparer(ctx context.Context, resourceGroupName string, serviceName string, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkStatusClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client NetworkStatusClient) ListByLocationResponder(resp *http.Response) (result NetworkStatusContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService gets the Connectivity Status to the external resources on which the Api Management service depends -// from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client NetworkStatusClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result ListNetworkStatusContractByLocation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkStatusClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NetworkStatusClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client NetworkStatusClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/networkstatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkStatusClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client NetworkStatusClient) ListByServiceResponder(resp *http.Response) (result ListNetworkStatusContractByLocation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notification.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notification.go deleted file mode 100644 index 376db5b6c87c..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notification.go +++ /dev/null @@ -1,349 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotificationClient is the apiManagement Client -type NotificationClient struct { - BaseClient -} - -// NewNotificationClient creates an instance of the NotificationClient client. -func NewNotificationClient(subscriptionID string) NotificationClient { - return NewNotificationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationClientWithBaseURI creates an instance of the NotificationClient 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 NewNotificationClientWithBaseURI(baseURI string, subscriptionID string) NotificationClient { - return NotificationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update API Management publisher notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client NotificationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, ifMatch string) (result NotificationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, notificationName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}", pathParameters), - 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationClient) 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 NotificationClient) CreateOrUpdateResponder(resp *http.Response) (result NotificationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the Notification specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -func (client NotificationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (result NotificationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, notificationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotificationClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/notifications/{notificationName}", 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 NotificationClient) 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 NotificationClient) GetResponder(resp *http.Response) (result NotificationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of properties defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// top - number of records to return. -// skip - number of records to skip. -func (client NotificationClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result NotificationCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.ListByService") - defer func() { - sc := -1 - if result.nc.Response.Response != nil { - sc = result.nc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.nc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "ListByService", resp, "Failure sending request") - return - } - - result.nc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "ListByService", resp, "Failure responding to request") - return - } - if result.nc.hasNextLink() && result.nc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client NotificationClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/notifications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client NotificationClient) ListByServiceResponder(resp *http.Response) (result NotificationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client NotificationClient) listByServiceNextResults(ctx context.Context, lastResults NotificationCollection) (result NotificationCollection, err error) { - req, err := lastResults.notificationCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client NotificationClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result NotificationCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notificationrecipientemail.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notificationrecipientemail.go deleted file mode 100644 index d3a52764de65..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notificationrecipientemail.go +++ /dev/null @@ -1,381 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotificationRecipientEmailClient is the apiManagement Client -type NotificationRecipientEmailClient struct { - BaseClient -} - -// NewNotificationRecipientEmailClient creates an instance of the NotificationRecipientEmailClient client. -func NewNotificationRecipientEmailClient(subscriptionID string) NotificationRecipientEmailClient { - return NewNotificationRecipientEmailClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationRecipientEmailClientWithBaseURI creates an instance of the NotificationRecipientEmailClient 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 NewNotificationRecipientEmailClientWithBaseURI(baseURI string, subscriptionID string) NotificationRecipientEmailClient { - return NotificationRecipientEmailClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists determine if Notification Recipient Email subscribed to the notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// email - email identifier. -func (client NotificationRecipientEmailClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, notificationName, email) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client NotificationRecipientEmailClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "email": autorest.Encode("path", email), - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientEmailClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client NotificationRecipientEmailClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds the Email address to the list of Recipients for the Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// email - email identifier. -func (client NotificationRecipientEmailClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (result RecipientEmailContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, notificationName, email) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationRecipientEmailClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "email": autorest.Encode("path", email), - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", pathParameters), - 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 NotificationRecipientEmailClient) 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 NotificationRecipientEmailClient) CreateOrUpdateResponder(resp *http.Response) (result RecipientEmailContract, 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 removes the email from the list of Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// email - email identifier. -func (client NotificationRecipientEmailClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, notificationName, email) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotificationRecipientEmailClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "email": autorest.Encode("path", email), - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", 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 NotificationRecipientEmailClient) 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 NotificationRecipientEmailClient) 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 -} - -// ListByNotification gets the list of the Notification Recipient Emails subscribed to a notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -func (client NotificationRecipientEmailClient) ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (result RecipientEmailCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.ListByNotification") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "ListByNotification", err.Error()) - } - - req, err := client.ListByNotificationPreparer(ctx, resourceGroupName, serviceName, notificationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "ListByNotification", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNotificationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "ListByNotification", resp, "Failure sending request") - return - } - - result, err = client.ListByNotificationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "ListByNotification", resp, "Failure responding to request") - return - } - - return -} - -// ListByNotificationPreparer prepares the ListByNotification request. -func (client NotificationRecipientEmailClient) ListByNotificationPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNotificationSender sends the ListByNotification request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientEmailClient) ListByNotificationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNotificationResponder handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (client NotificationRecipientEmailClient) ListByNotificationResponder(resp *http.Response) (result RecipientEmailCollection, 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/apimanagement/mgmt/2018-06-01-preview/apimanagement/notificationrecipientuser.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notificationrecipientuser.go deleted file mode 100644 index adc2dd9a3b61..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/notificationrecipientuser.go +++ /dev/null @@ -1,393 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotificationRecipientUserClient is the apiManagement Client -type NotificationRecipientUserClient struct { - BaseClient -} - -// NewNotificationRecipientUserClient creates an instance of the NotificationRecipientUserClient client. -func NewNotificationRecipientUserClient(subscriptionID string) NotificationRecipientUserClient { - return NewNotificationRecipientUserClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationRecipientUserClientWithBaseURI creates an instance of the NotificationRecipientUserClient 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 NewNotificationRecipientUserClientWithBaseURI(baseURI string, subscriptionID string) NotificationRecipientUserClient { - return NotificationRecipientUserClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists determine if the Notification Recipient User is subscribed to the notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client NotificationRecipientUserClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, notificationName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client NotificationRecipientUserClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientUserClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client NotificationRecipientUserClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds the API Management User to the list of Recipients for the Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client NotificationRecipientUserClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (result RecipientUserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, notificationName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationRecipientUserClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", pathParameters), - 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 NotificationRecipientUserClient) 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 NotificationRecipientUserClient) CreateOrUpdateResponder(resp *http.Response) (result RecipientUserContract, 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 removes the API Management user from the list of Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client NotificationRecipientUserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, notificationName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotificationRecipientUserClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", 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 NotificationRecipientUserClient) 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 NotificationRecipientUserClient) 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 -} - -// ListByNotification gets the list of the Notification Recipient User subscribed to the notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -func (client NotificationRecipientUserClient) ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (result RecipientUserCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.ListByNotification") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "ListByNotification", err.Error()) - } - - req, err := client.ListByNotificationPreparer(ctx, resourceGroupName, serviceName, notificationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "ListByNotification", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNotificationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "ListByNotification", resp, "Failure sending request") - return - } - - result, err = client.ListByNotificationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "ListByNotification", resp, "Failure responding to request") - return - } - - return -} - -// ListByNotificationPreparer prepares the ListByNotification request. -func (client NotificationRecipientUserClient) ListByNotificationPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNotificationSender sends the ListByNotification request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientUserClient) ListByNotificationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNotificationResponder handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (client NotificationRecipientUserClient) ListByNotificationResponder(resp *http.Response) (result RecipientUserCollection, 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/apimanagement/mgmt/2018-06-01-preview/apimanagement/openidconnectprovider.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/openidconnectprovider.go deleted file mode 100644 index eae2f41c33f8..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/openidconnectprovider.go +++ /dev/null @@ -1,647 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// OpenIDConnectProviderClient is the apiManagement Client -type OpenIDConnectProviderClient struct { - BaseClient -} - -// NewOpenIDConnectProviderClient creates an instance of the OpenIDConnectProviderClient client. -func NewOpenIDConnectProviderClient(subscriptionID string) OpenIDConnectProviderClient { - return NewOpenIDConnectProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOpenIDConnectProviderClientWithBaseURI creates an instance of the OpenIDConnectProviderClient 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 NewOpenIDConnectProviderClientWithBaseURI(baseURI string, subscriptionID string) OpenIDConnectProviderClient { - return OpenIDConnectProviderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client OpenIDConnectProviderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderContract, ifMatch string) (result OpenidConnectProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.OpenidConnectProviderContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.OpenidConnectProviderContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.OpenidConnectProviderContractProperties.DisplayName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, - {Target: "parameters.OpenidConnectProviderContractProperties.MetadataEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.OpenidConnectProviderContractProperties.ClientID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, opid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client OpenIDConnectProviderClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) 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 OpenIDConnectProviderClient) CreateOrUpdateResponder(resp *http.Response) (result OpenidConnectProviderContract, 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 specific OpenID Connect Provider of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client OpenIDConnectProviderClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, opid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, opid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client OpenIDConnectProviderClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 OpenIDConnectProviderClient) 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 OpenIDConnectProviderClient) 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 specific OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -func (client OpenIDConnectProviderClient) Get(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result OpenidConnectProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, opid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OpenIDConnectProviderClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", 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 OpenIDConnectProviderClient) 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 OpenIDConnectProviderClient) GetResponder(resp *http.Response) (result OpenidConnectProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -func (client OpenIDConnectProviderClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, opid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client OpenIDConnectProviderClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists of all the OpenId Connect Providers. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client OpenIDConnectProviderClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result OpenIDConnectProviderCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.ListByService") - defer func() { - sc := -1 - if result.oicpc.Response.Response != nil { - sc = result.oicpc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.oicpc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListByService", resp, "Failure sending request") - return - } - - result.oicpc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListByService", resp, "Failure responding to request") - return - } - if result.oicpc.hasNextLink() && result.oicpc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client OpenIDConnectProviderClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/openidConnectProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) ListByServiceResponder(resp *http.Response) (result OpenIDConnectProviderCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client OpenIDConnectProviderClient) listByServiceNextResults(ctx context.Context, lastResults OpenIDConnectProviderCollection) (result OpenIDConnectProviderCollection, err error) { - req, err := lastResults.openIDConnectProviderCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client OpenIDConnectProviderClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result OpenIDConnectProviderCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the specific OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client OpenIDConnectProviderClient) Update(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, opid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client OpenIDConnectProviderClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 OpenIDConnectProviderClient) 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 OpenIDConnectProviderClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/operation.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/operation.go deleted file mode 100644 index 7855d3d17826..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/operation.go +++ /dev/null @@ -1,195 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// OperationClient is the apiManagement Client -type OperationClient struct { - BaseClient -} - -// NewOperationClient creates an instance of the OperationClient client. -func NewOperationClient(subscriptionID string) OperationClient { - return NewOperationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationClientWithBaseURI creates an instance of the OperationClient 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 NewOperationClientWithBaseURI(baseURI string, subscriptionID string) OperationClient { - return OperationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByTags lists a collection of operations associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |apiName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |method | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |urlTemplate | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -// includeNotTaggedOperations - include not tagged Operations. -func (client OperationClient) ListByTags(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationClient.ListByTags") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.OperationClient", "ListByTags", err.Error()) - } - - result.fn = client.listByTagsNextResults - req, err := client.ListByTagsPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, includeNotTaggedOperations) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "ListByTags", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTagsSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "ListByTags", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "ListByTags", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTagsPreparer prepares the ListByTags request. -func (client OperationClient) ListByTagsPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if includeNotTaggedOperations != nil { - queryParameters["includeNotTaggedOperations"] = autorest.Encode("query", *includeNotTaggedOperations) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTagsSender sends the ListByTags request. The method will close the -// http.Response Body if it receives an error. -func (client OperationClient) ListByTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTagsResponder handles the response to the ListByTags request. The method always -// closes the http.Response Body. -func (client OperationClient) ListByTagsResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTagsNextResults retrieves the next set of results, if any. -func (client OperationClient) listByTagsNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.OperationClient", "listByTagsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.OperationClient", "listByTagsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "listByTagsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTagsComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationClient) ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationClient.ListByTags") - 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.ListByTags(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, includeNotTaggedOperations) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/operations.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/operations.go deleted file mode 100644 index fb1d2548bde0..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 apiManagement 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 REST API operations of the Microsoft.ApiManagement 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, "apimanagement.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, "apimanagement.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.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 = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ApiManagement/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, "apimanagement.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, "apimanagement.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.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/apimanagement/mgmt/2018-06-01-preview/apimanagement/policy.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/policy.go deleted file mode 100644 index 13e648248099..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/policy.go +++ /dev/null @@ -1,468 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PolicyClient is the apiManagement Client -type PolicyClient struct { - BaseClient -} - -// NewPolicyClient creates an instance of the PolicyClient client. -func NewPolicyClient(subscriptionID string) PolicyClient { - return NewPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPolicyClientWithBaseURI creates an instance of the PolicyClient 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 NewPolicyClientWithBaseURI(baseURI string, subscriptionID string) PolicyClient { - return PolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the global policy configuration of the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client PolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.PolicyContent", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/policies/{policyId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) 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 PolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, 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 global policy configuration of the Api Management Service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client PolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 PolicyClient) 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 PolicyClient) 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 the Global policy definition of the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/policies/{policyId}", 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 PolicyClient) 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 PolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Global policy definition in the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client PolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client PolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all the Global Policy definitions of the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PolicyClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PolicyClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PolicyClient) ListByServiceResponder(resp *http.Response) (result PolicyCollection, 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/apimanagement/mgmt/2018-06-01-preview/apimanagement/policysnippets.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/policysnippets.go deleted file mode 100644 index 8f3b5eb9a816..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/policysnippets.go +++ /dev/null @@ -1,120 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PolicySnippetsClient is the apiManagement Client -type PolicySnippetsClient struct { - BaseClient -} - -// NewPolicySnippetsClient creates an instance of the PolicySnippetsClient client. -func NewPolicySnippetsClient(subscriptionID string) PolicySnippetsClient { - return NewPolicySnippetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPolicySnippetsClientWithBaseURI creates an instance of the PolicySnippetsClient 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 NewPolicySnippetsClientWithBaseURI(baseURI string, subscriptionID string) PolicySnippetsClient { - return PolicySnippetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all policy snippets. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// scope - policy scope. -func (client PolicySnippetsClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, scope PolicyScopeContract) (result PolicySnippetsCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicySnippetsClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicySnippetsClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicySnippetsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicySnippetsClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicySnippetsClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PolicySnippetsClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, scope PolicyScopeContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(scope)) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policySnippets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PolicySnippetsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PolicySnippetsClient) ListByServiceResponder(resp *http.Response) (result PolicySnippetsCollection, 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/apimanagement/mgmt/2018-06-01-preview/apimanagement/product.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/product.go deleted file mode 100644 index 6aed46307d7e..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/product.go +++ /dev/null @@ -1,823 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductClient is the apiManagement Client -type ProductClient struct { - BaseClient -} - -// NewProductClient creates an instance of the ProductClient client. -func NewProductClient(subscriptionID string) ProductClient { - return NewProductClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductClientWithBaseURI creates an instance of the ProductClient 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 NewProductClientWithBaseURI(baseURI string, subscriptionID string) ProductClient { - return ProductClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client ProductClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductContract, ifMatch string) (result ProductContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ProductContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ProductContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ProductContractProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.ProductContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) 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 ProductClient) CreateOrUpdateResponder(resp *http.Response) (result ProductContract, 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 product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// deleteSubscriptions - delete existing subscriptions associated with the product or not. -func (client ProductClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, ifMatch, deleteSubscriptions) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteSubscriptions != nil { - queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 ProductClient) 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 ProductClient) 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 details of the product specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result ProductContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProductClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}", 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 ProductClient) 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 ProductClient) GetResponder(resp *http.Response) (result ProductContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the product specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client ProductClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client ProductClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of products in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |terms | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |state | eq | | -// |groups | | | -// top - number of records to return. -// skip - number of records to skip. -// expandGroups - when set to true, the response contains an array of groups that have visibility to the -// product. The default is false. -// tags - products which are part of a specific tag. -func (client ProductClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result ProductCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByService") - defer func() { - sc := -1 - if result.pc.Response.Response != nil { - sc = result.pc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups, tags) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.pc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByService", resp, "Failure sending request") - return - } - - result.pc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByService", resp, "Failure responding to request") - return - } - if result.pc.hasNextLink() && result.pc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client ProductClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if expandGroups != nil { - queryParameters["expandGroups"] = autorest.Encode("query", *expandGroups) - } - if 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.ApiManagement/service/{serviceName}/products", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client ProductClient) ListByServiceResponder(resp *http.Response) (result ProductCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client ProductClient) listByServiceNextResults(ctx context.Context, lastResults ProductCollection) (result ProductCollection, err error) { - req, err := lastResults.productCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result ProductCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups, tags) - return -} - -// ListByTags lists a collection of products associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |terms | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |state | eq | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -// includeNotTaggedProducts - include not tagged Products. -func (client ProductClient) ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByTags") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "ListByTags", err.Error()) - } - - result.fn = client.listByTagsNextResults - req, err := client.ListByTagsPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByTags", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTagsSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByTags", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByTags", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTagsPreparer prepares the ListByTags request. -func (client ProductClient) ListByTagsPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if includeNotTaggedProducts != nil { - queryParameters["includeNotTaggedProducts"] = autorest.Encode("query", *includeNotTaggedProducts) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTagsSender sends the ListByTags request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) ListByTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTagsResponder handles the response to the ListByTags request. The method always -// closes the http.Response Body. -func (client ProductClient) ListByTagsResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTagsNextResults retrieves the next set of results, if any. -func (client ProductClient) listByTagsNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByTagsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByTagsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByTagsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTagsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductClient) ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByTags") - 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.ListByTags(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts) - return -} - -// Update update existing product details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client ProductClient) Update(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ProductClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 ProductClient) 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 ProductClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productapi.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productapi.go deleted file mode 100644 index 65825d4cbe6a..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productapi.go +++ /dev/null @@ -1,478 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductAPIClient is the apiManagement Client -type ProductAPIClient struct { - BaseClient -} - -// NewProductAPIClient creates an instance of the ProductAPIClient client. -func NewProductAPIClient(subscriptionID string) ProductAPIClient { - return NewProductAPIClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductAPIClientWithBaseURI creates an instance of the ProductAPIClient 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 NewProductAPIClientWithBaseURI(baseURI string, subscriptionID string) ProductAPIClient { - return ProductAPIClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists checks that API entity specified by identifier is associated with the Product entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client ProductAPIClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, productID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client ProductAPIClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client ProductAPIClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client ProductAPIClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds an API to the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client ProductAPIClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result APIContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductAPIClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), - 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 ProductAPIClient) 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 ProductAPIClient) CreateOrUpdateResponder(resp *http.Response) (result APIContract, 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 specified API from the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client ProductAPIClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductAPIClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", 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 ProductAPIClient) 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 ProductAPIClient) 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 -} - -// ListByProduct lists a collection of the APIs associated with a product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client ProductAPIClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result APICollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.ListByProduct") - defer func() { - sc := -1 - if result.ac.Response.Response != nil { - sc = result.ac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.ac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.ac, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.ac.hasNextLink() && result.ac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ProductAPIClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/products/{productId}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ProductAPIClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ProductAPIClient) ListByProductResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client ProductAPIClient) listByProductNextResults(ctx context.Context, lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.aPICollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductAPIClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result APICollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.ListByProduct") - 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.ListByProduct(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productgroup.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productgroup.go deleted file mode 100644 index 6e5ee1c08702..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productgroup.go +++ /dev/null @@ -1,473 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductGroupClient is the apiManagement Client -type ProductGroupClient struct { - BaseClient -} - -// NewProductGroupClient creates an instance of the ProductGroupClient client. -func NewProductGroupClient(subscriptionID string) ProductGroupClient { - return NewProductGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductGroupClientWithBaseURI creates an instance of the ProductGroupClient 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 NewProductGroupClientWithBaseURI(baseURI string, subscriptionID string) ProductGroupClient { - return ProductGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists checks that Group entity specified by identifier is associated with the Product entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client ProductGroupClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client ProductGroupClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client ProductGroupClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds the association between the specified developer group with the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client ProductGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), - 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 ProductGroupClient) 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 ProductGroupClient) CreateOrUpdateResponder(resp *http.Response) (result GroupContract, 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 association between the specified group and product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client ProductGroupClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", 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 ProductGroupClient) 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 ProductGroupClient) 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 -} - -// ListByProduct lists the collection of developer groups associated with the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | | -// |displayName | eq, ne | | -// |description | eq, ne | | -// top - number of records to return. -// skip - number of records to skip. -func (client ProductGroupClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.ListByProduct") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.gc, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ProductGroupClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/products/{productId}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ProductGroupClient) ListByProductResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client ProductGroupClient) listByProductNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.groupCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductGroupClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.ListByProduct") - 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.ListByProduct(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productpolicy.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productpolicy.go deleted file mode 100644 index ccd49d6cb752..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productpolicy.go +++ /dev/null @@ -1,498 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductPolicyClient is the apiManagement Client -type ProductPolicyClient struct { - BaseClient -} - -// NewProductPolicyClient creates an instance of the ProductPolicyClient client. -func NewProductPolicyClient(subscriptionID string) ProductPolicyClient { - return NewProductPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductPolicyClientWithBaseURI creates an instance of the ProductPolicyClient 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 NewProductPolicyClientWithBaseURI(baseURI string, subscriptionID string) ProductPolicyClient { - return ProductPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client ProductPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.PolicyContent", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) 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 ProductPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, 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 policy configuration at the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client ProductPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 ProductPolicyClient) 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 ProductPolicyClient) 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 the policy configuration at the Product level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProductPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", 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 ProductPolicyClient) 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 ProductPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag get the ETag of the policy configuration at the Product level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client ProductPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByProduct get the policy configuration at the Product level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductPolicyClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.ListByProduct") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "ListByProduct", err.Error()) - } - - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", resp, "Failure sending request") - return - } - - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", resp, "Failure responding to request") - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ProductPolicyClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) ListByProductResponder(resp *http.Response) (result PolicyCollection, 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/apimanagement/mgmt/2018-06-01-preview/apimanagement/productsubscriptions.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productsubscriptions.go deleted file mode 100644 index 92abbf6ca93b..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/productsubscriptions.go +++ /dev/null @@ -1,194 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductSubscriptionsClient is the apiManagement Client -type ProductSubscriptionsClient struct { - BaseClient -} - -// NewProductSubscriptionsClient creates an instance of the ProductSubscriptionsClient client. -func NewProductSubscriptionsClient(subscriptionID string) ProductSubscriptionsClient { - return NewProductSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductSubscriptionsClientWithBaseURI creates an instance of the ProductSubscriptionsClient 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 NewProductSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) ProductSubscriptionsClient { - return ProductSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the collection of subscriptions to the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |ownerId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |scope | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |state | eq | | -// |user | | | -// top - number of records to return. -// skip - number of records to skip. -func (client ProductSubscriptionsClient) List(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductSubscriptionsClient.List") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductSubscriptionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "List", resp, "Failure sending request") - return - } - - result.sc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "List", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ProductSubscriptionsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/products/{productId}/subscriptions", 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 ProductSubscriptionsClient) 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 ProductSubscriptionsClient) ListResponder(resp *http.Response) (result SubscriptionCollection, 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 ProductSubscriptionsClient) listNextResults(ctx context.Context, lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.subscriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "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, "apimanagement.ProductSubscriptionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductSubscriptionsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductSubscriptionsClient.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, serviceName, productID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/property.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/property.go deleted file mode 100644 index 4ed0fcc581f2..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/property.go +++ /dev/null @@ -1,651 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PropertyClient is the apiManagement Client -type PropertyClient struct { - BaseClient -} - -// NewPropertyClient creates an instance of the PropertyClient client. -func NewPropertyClient(subscriptionID string) PropertyClient { - return NewPropertyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPropertyClientWithBaseURI creates an instance of the PropertyClient 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 NewPropertyClientWithBaseURI(baseURI string, subscriptionID string) PropertyClient { - return PropertyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a property. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// propID - identifier of the property. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client PropertyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, propID string, parameters PropertyContract, ifMatch string) (result PropertyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PropertyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: propID, - Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PropertyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PropertyContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.PropertyContractProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.PropertyContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "parameters.PropertyContractProperties.DisplayName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-._]+$`, Chain: nil}, - }}, - {Target: "parameters.PropertyContractProperties.Value", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.PropertyContractProperties.Value", Name: validation.MaxLength, Rule: 4096, Chain: nil}, - {Target: "parameters.PropertyContractProperties.Value", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.PropertyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, propID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PropertyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, propID string, parameters PropertyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "propId": autorest.Encode("path", propID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/properties/{propId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PropertyClient) 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 PropertyClient) CreateOrUpdateResponder(resp *http.Response) (result PropertyContract, 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 specific property from the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// propID - identifier of the property. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client PropertyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, propID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PropertyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: propID, - Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PropertyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, propID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PropertyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, propID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "propId": autorest.Encode("path", propID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 PropertyClient) 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 PropertyClient) 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 details of the property specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// propID - identifier of the property. -func (client PropertyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, propID string) (result PropertyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PropertyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: propID, - Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PropertyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, propID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PropertyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, propID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "propId": autorest.Encode("path", propID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/properties/{propId}", 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 PropertyClient) 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 PropertyClient) GetResponder(resp *http.Response) (result PropertyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the property specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// propID - identifier of the property. -func (client PropertyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, propID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PropertyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: propID, - Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PropertyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, propID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client PropertyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, propID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "propId": autorest.Encode("path", propID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client PropertyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client PropertyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of properties defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |tags | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client PropertyClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result PropertyCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PropertyClient.ListByService") - defer func() { - sc := -1 - if result.pc.Response.Response != nil { - sc = result.pc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.PropertyClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.pc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "ListByService", resp, "Failure sending request") - return - } - - result.pc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "ListByService", resp, "Failure responding to request") - return - } - if result.pc.hasNextLink() && result.pc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PropertyClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/properties", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PropertyClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PropertyClient) ListByServiceResponder(resp *http.Response) (result PropertyCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client PropertyClient) listByServiceNextResults(ctx context.Context, lastResults PropertyCollection) (result PropertyCollection, err error) { - req, err := lastResults.propertyCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PropertyClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result PropertyCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PropertyClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the specific property. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// propID - identifier of the property. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client PropertyClient) Update(ctx context.Context, resourceGroupName string, serviceName string, propID string, parameters PropertyUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PropertyClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: propID, - Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PropertyClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, propID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PropertyClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, propID string, parameters PropertyUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "propId": autorest.Encode("path", propID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 PropertyClient) 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 PropertyClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/quotabycounterkeys.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/quotabycounterkeys.go deleted file mode 100644 index da3c6355a8d3..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/quotabycounterkeys.go +++ /dev/null @@ -1,215 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// QuotaByCounterKeysClient is the apiManagement Client -type QuotaByCounterKeysClient struct { - BaseClient -} - -// NewQuotaByCounterKeysClient creates an instance of the QuotaByCounterKeysClient client. -func NewQuotaByCounterKeysClient(subscriptionID string) QuotaByCounterKeysClient { - return NewQuotaByCounterKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQuotaByCounterKeysClientWithBaseURI creates an instance of the QuotaByCounterKeysClient 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 NewQuotaByCounterKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByCounterKeysClient { - return QuotaByCounterKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists a collection of current quota counter periods associated with the counter-key configured in the -// policy on the specified service instance. The api does not support paging yet. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -func (client QuotaByCounterKeysClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string) (result QuotaCounterCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByCounterKeysClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByCounterKeysClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, quotaCounterKey) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client QuotaByCounterKeysClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByCounterKeysClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client QuotaByCounterKeysClient) ListByServiceResponder(resp *http.Response) (result QuotaCounterCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates all the quota counter values specified with the existing quota counter key to a value in the -// specified service instance. This should be used for reset of the quota counter values. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -// parameters - the value of the quota counter to be applied to all quota counter periods. -func (client QuotaByCounterKeysClient) Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueContractProperties) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByCounterKeysClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByCounterKeysClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, quotaCounterKey, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client QuotaByCounterKeysClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueContractProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", 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 QuotaByCounterKeysClient) 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 QuotaByCounterKeysClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/quotabyperiodkeys.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/quotabyperiodkeys.go deleted file mode 100644 index 3a0b9185a81b..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/quotabyperiodkeys.go +++ /dev/null @@ -1,218 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// QuotaByPeriodKeysClient is the apiManagement Client -type QuotaByPeriodKeysClient struct { - BaseClient -} - -// NewQuotaByPeriodKeysClient creates an instance of the QuotaByPeriodKeysClient client. -func NewQuotaByPeriodKeysClient(subscriptionID string) QuotaByPeriodKeysClient { - return NewQuotaByPeriodKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQuotaByPeriodKeysClientWithBaseURI creates an instance of the QuotaByPeriodKeysClient 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 NewQuotaByPeriodKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByPeriodKeysClient { - return QuotaByPeriodKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the value of the quota counter associated with the counter-key in the policy for the specific period in -// service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -// quotaPeriodKey - quota period key identifier. -func (client QuotaByPeriodKeysClient) Get(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (result QuotaCounterContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByPeriodKeysClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByPeriodKeysClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client QuotaByPeriodKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}", 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 QuotaByPeriodKeysClient) 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 QuotaByPeriodKeysClient) GetResponder(resp *http.Response) (result QuotaCounterContract, 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 quota counter value in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -// quotaPeriodKey - quota period key identifier. -// parameters - the value of the Quota counter to be applied on the specified period. -func (client QuotaByPeriodKeysClient) Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueContractProperties) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByPeriodKeysClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByPeriodKeysClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client QuotaByPeriodKeysClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueContractProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}", 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 QuotaByPeriodKeysClient) 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 QuotaByPeriodKeysClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/region.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/region.go deleted file mode 100644 index de5c83c3074f..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/region.go +++ /dev/null @@ -1,158 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RegionClient is the apiManagement Client -type RegionClient struct { - BaseClient -} - -// NewRegionClient creates an instance of the RegionClient client. -func NewRegionClient(subscriptionID string) RegionClient { - return NewRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegionClientWithBaseURI creates an instance of the RegionClient 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 NewRegionClientWithBaseURI(baseURI string, subscriptionID string) RegionClient { - return RegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all azure regions in which the service exists. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client RegionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result RegionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.RegionClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "ListByService", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "ListByService", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client RegionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/regions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client RegionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client RegionClient) ListByServiceResponder(resp *http.Response) (result RegionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client RegionClient) listByServiceNextResults(ctx context.Context, lastResults RegionListResult) (result RegionListResult, err error) { - req, err := lastResults.regionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.RegionClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.RegionClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegionClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result RegionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/reports.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/reports.go deleted file mode 100644 index 6cbab51d7638..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/reports.go +++ /dev/null @@ -1,1136 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReportsClient is the apiManagement Client -type ReportsClient struct { - BaseClient -} - -// NewReportsClient creates an instance of the ReportsClient client. -func NewReportsClient(subscriptionID string) ReportsClient { - return NewReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReportsClientWithBaseURI creates an instance of the ReportsClient 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 NewReportsClientWithBaseURI(baseURI string, subscriptionID string) ReportsClient { - return ReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAPI lists report records by API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByAPI") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client ReportsClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/reports/byApi", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByAPIResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client ReportsClient) listByAPINextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByAPI") - 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.ListByAPI(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListByGeo lists report records by geography. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByGeo(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByGeo") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByGeo", err.Error()) - } - - result.fn = client.listByGeoNextResults - req, err := client.ListByGeoPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByGeo", nil, "Failure preparing request") - return - } - - resp, err := client.ListByGeoSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByGeo", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByGeoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByGeo", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByGeoPreparer prepares the ListByGeo request. -func (client ReportsClient) ListByGeoPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/reports/byGeo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByGeoSender sends the ListByGeo request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByGeoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByGeoResponder handles the response to the ListByGeo request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByGeoResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByGeoNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByGeoNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByGeoNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByGeoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByGeoNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByGeoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByGeoNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByGeoComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByGeoComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByGeo") - 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.ListByGeo(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListByOperation lists report records by API Operations. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByOperation") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByOperation", err.Error()) - } - - result.fn = client.listByOperationNextResults - req, err := client.ListByOperationPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByOperationSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByOperation", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByOperation", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByOperationPreparer prepares the ListByOperation request. -func (client ReportsClient) ListByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/reports/byOperation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByOperationSender sends the ListByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByOperationResponder handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByOperationResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByOperationNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByOperationNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByOperationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByOperationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByOperationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByOperationComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByOperation") - 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.ListByOperation(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListByProduct lists report records by Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByProduct") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ReportsClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/reports/byProduct", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByProductResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByProductNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByProduct") - 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.ListByProduct(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListByRequest lists report records by Request. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByRequest(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result RequestReportCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByRequest") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByRequest", err.Error()) - } - - req, err := client.ListByRequestPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByRequest", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRequestSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByRequest", resp, "Failure sending request") - return - } - - result, err = client.ListByRequestResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByRequest", resp, "Failure responding to request") - return - } - - return -} - -// ListByRequestPreparer prepares the ListByRequest request. -func (client ReportsClient) ListByRequestPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/reports/byRequest", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByRequestSender sends the ListByRequest request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByRequestSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByRequestResponder handles the response to the ListByRequest request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByRequestResponder(resp *http.Response) (result RequestReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription lists report records by subscription. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListBySubscription(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListBySubscription") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.rc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ReportsClient) ListBySubscriptionPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/reports/bySubscription", 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 ReportsClient) 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 ReportsClient) ListBySubscriptionResponder(resp *http.Response) (result ReportCollection, 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 ReportsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "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, "apimanagement.ReportsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListBySubscriptionComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.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, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListByTime lists report records by Time. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// interval - by time interval. Interval must be multiple of 15 minutes and may not be zero. The value should -// be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert -// TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByTime(ctx context.Context, resourceGroupName string, serviceName string, interval string, filter string, top *int32, skip *int32) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByTime") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByTime", err.Error()) - } - - result.fn = client.listByTimeNextResults - req, err := client.ListByTimePreparer(ctx, resourceGroupName, serviceName, interval, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByTime", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTimeSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByTime", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByTimeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByTime", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTimePreparer prepares the ListByTime request. -func (client ReportsClient) ListByTimePreparer(ctx context.Context, resourceGroupName string, serviceName string, interval string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "interval": autorest.Encode("query", interval), - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/reports/byTime", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTimeSender sends the ListByTime request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByTimeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTimeResponder handles the response to the ListByTime request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByTimeResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTimeNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByTimeNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByTimeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTimeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByTimeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTimeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByTimeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTimeComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByTimeComplete(ctx context.Context, resourceGroupName string, serviceName string, interval string, filter string, top *int32, skip *int32) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByTime") - 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.ListByTime(ctx, resourceGroupName, serviceName, interval, filter, top, skip) - return -} - -// ListByUser lists report records by User. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByUser(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByUser") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByUser", err.Error()) - } - - result.fn = client.listByUserNextResults - req, err := client.ListByUserPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByUser", nil, "Failure preparing request") - return - } - - resp, err := client.ListByUserSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByUser", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByUser", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByUserPreparer prepares the ListByUser request. -func (client ReportsClient) ListByUserPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/reports/byUser", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByUserSender sends the ListByUser request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByUserSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByUserResponder handles the response to the ListByUser request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByUserResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByUserNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByUserNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByUserNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByUserSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByUserNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByUserNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByUserComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByUserComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByUser") - 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.ListByUser(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/service.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/service.go deleted file mode 100644 index 8d319c8e0bb8..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/service.go +++ /dev/null @@ -1,1262 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServiceClient is the apiManagement Client -type ServiceClient struct { - BaseClient -} - -// NewServiceClient creates an instance of the ServiceClient client. -func NewServiceClient(subscriptionID string) ServiceClient { - return NewServiceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceClientWithBaseURI creates an instance of the ServiceClient 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 NewServiceClientWithBaseURI(baseURI string, subscriptionID string) ServiceClient { - return ServiceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ApplyNetworkConfigurationUpdates updates the Microsoft.ApiManagement resource running in the Virtual network to pick -// the updated network settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the Apply Network Configuration operation. If the parameters are empty, -// all the regions in which the Api Management service is deployed will be updated sequentially without -// incurring downtime in the region. -func (client ServiceClient) ApplyNetworkConfigurationUpdates(ctx context.Context, resourceGroupName string, serviceName string, parameters *ServiceApplyNetworkConfigurationParameters) (result ServiceApplyNetworkConfigurationUpdatesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ApplyNetworkConfigurationUpdates") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "ApplyNetworkConfigurationUpdates", err.Error()) - } - - req, err := client.ApplyNetworkConfigurationUpdatesPreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ApplyNetworkConfigurationUpdates", nil, "Failure preparing request") - return - } - - result, err = client.ApplyNetworkConfigurationUpdatesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ApplyNetworkConfigurationUpdates", result.Response(), "Failure sending request") - return - } - - return -} - -// ApplyNetworkConfigurationUpdatesPreparer prepares the ApplyNetworkConfigurationUpdates request. -func (client ServiceClient) ApplyNetworkConfigurationUpdatesPreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters *ServiceApplyNetworkConfigurationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ApplyNetworkConfigurationUpdatesSender sends the ApplyNetworkConfigurationUpdates request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) ApplyNetworkConfigurationUpdatesSender(req *http.Request) (future ServiceApplyNetworkConfigurationUpdatesFuture, 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 -} - -// ApplyNetworkConfigurationUpdatesResponder handles the response to the ApplyNetworkConfigurationUpdates request. The method always -// closes the http.Response Body. -func (client ServiceClient) ApplyNetworkConfigurationUpdatesResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Backup creates a backup of the API Management service to the given Azure Storage Account. This is long running -// operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the ApiManagementService_Backup operation. -func (client ServiceClient) Backup(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (result ServiceBackupFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Backup") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Backup", err.Error()) - } - - req, err := client.BackupPreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Backup", nil, "Failure preparing request") - return - } - - result, err = client.BackupSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Backup", result.Response(), "Failure sending request") - return - } - - return -} - -// BackupPreparer prepares the Backup request. -func (client ServiceClient) BackupPreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/backup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// BackupSender sends the Backup request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) BackupSender(req *http.Request) (future ServiceBackupFuture, 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 -} - -// BackupResponder handles the response to the Backup request. The method always -// closes the http.Response Body. -func (client ServiceClient) BackupResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckNameAvailability checks availability and correctness of a name for an API Management service. -// Parameters: -// parameters - parameters supplied to the CheckNameAvailability operation. -func (client ServiceClient) CheckNameAvailability(ctx context.Context, parameters ServiceCheckNameAvailabilityParameters) (result ServiceNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ServiceClient) CheckNameAvailabilityPreparer(ctx context.Context, parameters ServiceCheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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}/providers/Microsoft.ApiManagement/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 ServiceClient) 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 ServiceClient) CheckNameAvailabilityResponder(resp *http.Response) (result ServiceNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates an API Management service. This is long running operation and could take several -// minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the CreateOrUpdate API Management service operation. -func (client ServiceClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceResource) (result ServiceCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServiceProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.MaxLength, Rule: 100, Chain: nil}}}, - {Target: "parameters.ServiceProperties.PublisherName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherName", Name: validation.MaxLength, Rule: 100, Chain: nil}}}, - }}, - {Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Identity", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Identity.Type", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Etag = 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.ApiManagement/service/{serviceName}", 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 ServiceClient) CreateOrUpdateSender(req *http.Request) (future ServiceCreateOrUpdateFuture, 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 ServiceClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, 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 API Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceClient) Delete(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServiceClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}", 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 ServiceClient) DeleteSender(req *http.Request) (future ServiceDeleteFuture, 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 ServiceClient) DeleteResponder(resp *http.Response) (result ServiceResource, 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 -} - -// Get gets an API Management service resource description. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}", 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 ServiceClient) 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 ServiceClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSsoToken gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceClient) GetSsoToken(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceGetSsoTokenResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.GetSsoToken") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "GetSsoToken", err.Error()) - } - - req, err := client.GetSsoTokenPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetSsoToken", nil, "Failure preparing request") - return - } - - resp, err := client.GetSsoTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetSsoToken", resp, "Failure sending request") - return - } - - result, err = client.GetSsoTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetSsoToken", resp, "Failure responding to request") - return - } - - return -} - -// GetSsoTokenPreparer prepares the GetSsoToken request. -func (client ServiceClient) GetSsoTokenPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/getssotoken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSsoTokenSender sends the GetSsoToken request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) GetSsoTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSsoTokenResponder handles the response to the GetSsoToken request. The method always -// closes the http.Response Body. -func (client ServiceClient) GetSsoTokenResponder(resp *http.Response) (result ServiceGetSsoTokenResult, 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 API Management services within an Azure subscription. -func (client ServiceClient) List(ctx context.Context) (result ServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.List") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "List", resp, "Failure sending request") - return - } - - result.slr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "List", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServiceClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service", 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 ServiceClient) 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 ServiceClient) ListResponder(resp *http.Response) (result ServiceListResult, 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 ServiceClient) listNextResults(ctx context.Context, lastResults ServiceListResult) (result ServiceListResult, err error) { - req, err := lastResults.serviceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "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, "apimanagement.ServiceClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceClient) ListComplete(ctx context.Context) (result ServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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 list all API Management services within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ServiceClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.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, "apimanagement.ServiceClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServiceClient) 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 = "2018-06-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.ApiManagement/service", 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 ServiceClient) 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 ServiceClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceListResult, 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 ServiceClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServiceListResult) (result ServiceListResult, err error) { - req, err := lastResults.serviceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "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, "apimanagement.ServiceClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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 -} - -// Restore restores a backup of an API Management service created using the ApiManagementService_Backup operation on -// the current service. This is a long running operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the Restore API Management service from backup operation. -func (client ServiceClient) Restore(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (result ServiceRestoreFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Restore") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Restore", err.Error()) - } - - req, err := client.RestorePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Restore", nil, "Failure preparing request") - return - } - - result, err = client.RestoreSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Restore", result.Response(), "Failure sending request") - return - } - - return -} - -// RestorePreparer prepares the Restore request. -func (client ServiceClient) RestorePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/restore", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestoreSender sends the Restore request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) RestoreSender(req *http.Request) (future ServiceRestoreFuture, 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 -} - -// RestoreResponder handles the response to the Restore request. The method always -// closes the http.Response Body. -func (client ServiceClient) RestoreResponder(resp *http.Response) (result ServiceResource, 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 API Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the CreateOrUpdate API Management service operation. -func (client ServiceClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUpdateParameters) (result ServiceUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServiceClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Etag = 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.ApiManagement/service/{serviceName}", 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 ServiceClient) UpdateSender(req *http.Request) (future ServiceUpdateFuture, 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 ServiceClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateHostname creates, updates, or deletes the custom hostnames for an API Management service. The custom hostname -// can be applied to the Proxy and Portal endpoint. This is a long running operation and could take several minutes to -// complete. This operation will be deprecated in the next version update. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the UpdateHostname operation. -func (client ServiceClient) UpdateHostname(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUpdateHostnameParameters) (result ServiceUpdateHostnameFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.UpdateHostname") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "UpdateHostname", err.Error()) - } - - req, err := client.UpdateHostnamePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "UpdateHostname", nil, "Failure preparing request") - return - } - - result, err = client.UpdateHostnameSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "UpdateHostname", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateHostnamePreparer prepares the UpdateHostname request. -func (client ServiceClient) UpdateHostnamePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUpdateHostnameParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/updatehostname", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateHostnameSender sends the UpdateHostname request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) UpdateHostnameSender(req *http.Request) (future ServiceUpdateHostnameFuture, 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 -} - -// UpdateHostnameResponder handles the response to the UpdateHostname request. The method always -// closes the http.Response Body. -func (client ServiceClient) UpdateHostnameResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UploadCertificate upload Custom Domain SSL certificate for an API Management service. This operation will be -// deprecated in future releases. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the Upload SSL certificate for an API Management service operation. -func (client ServiceClient) UploadCertificate(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUploadCertificateParameters) (result CertificateInformation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.UploadCertificate") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Certificate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CertificatePassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "UploadCertificate", err.Error()) - } - - req, err := client.UploadCertificatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "UploadCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.UploadCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "UploadCertificate", resp, "Failure sending request") - return - } - - result, err = client.UploadCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "UploadCertificate", resp, "Failure responding to request") - return - } - - return -} - -// UploadCertificatePreparer prepares the UploadCertificate request. -func (client ServiceClient) UploadCertificatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUploadCertificateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/updatecertificate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UploadCertificateSender sends the UploadCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) UploadCertificateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UploadCertificateResponder handles the response to the UploadCertificate request. The method always -// closes the http.Response Body. -func (client ServiceClient) UploadCertificateResponder(resp *http.Response) (result CertificateInformation, 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/apimanagement/mgmt/2018-06-01-preview/apimanagement/serviceskus.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/serviceskus.go deleted file mode 100644 index 169b1d8934be..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/serviceskus.go +++ /dev/null @@ -1,158 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServiceSkusClient is the apiManagement Client -type ServiceSkusClient struct { - BaseClient -} - -// NewServiceSkusClient creates an instance of the ServiceSkusClient client. -func NewServiceSkusClient(subscriptionID string) ServiceSkusClient { - return NewServiceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceSkusClientWithBaseURI creates an instance of the ServiceSkusClient 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 NewServiceSkusClientWithBaseURI(baseURI string, subscriptionID string) ServiceSkusClient { - return ServiceSkusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListAvailableServiceSkus gets all available SKU for a given API Management service -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceSkusClient) ListAvailableServiceSkus(ctx context.Context, resourceGroupName string, serviceName string) (result ResourceSkuResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceSkusClient.ListAvailableServiceSkus") - defer func() { - sc := -1 - if result.rsr.Response.Response != nil { - sc = result.rsr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", err.Error()) - } - - result.fn = client.listAvailableServiceSkusNextResults - req, err := client.ListAvailableServiceSkusPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListAvailableServiceSkusSender(req) - if err != nil { - result.rsr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", resp, "Failure sending request") - return - } - - result.rsr, err = client.ListAvailableServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", resp, "Failure responding to request") - return - } - if result.rsr.hasNextLink() && result.rsr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAvailableServiceSkusPreparer prepares the ListAvailableServiceSkus request. -func (client ServiceSkusClient) ListAvailableServiceSkusPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAvailableServiceSkusSender sends the ListAvailableServiceSkus request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceSkusClient) ListAvailableServiceSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAvailableServiceSkusResponder handles the response to the ListAvailableServiceSkus request. The method always -// closes the http.Response Body. -func (client ServiceSkusClient) ListAvailableServiceSkusResponder(resp *http.Response) (result ResourceSkuResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAvailableServiceSkusNextResults retrieves the next set of results, if any. -func (client ServiceSkusClient) listAvailableServiceSkusNextResults(ctx context.Context, lastResults ResourceSkuResults) (result ResourceSkuResults, err error) { - req, err := lastResults.resourceSkuResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "listAvailableServiceSkusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAvailableServiceSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "listAvailableServiceSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAvailableServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "listAvailableServiceSkusNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAvailableServiceSkusComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceSkusClient) ListAvailableServiceSkusComplete(ctx context.Context, resourceGroupName string, serviceName string) (result ResourceSkuResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceSkusClient.ListAvailableServiceSkus") - 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.ListAvailableServiceSkus(ctx, resourceGroupName, serviceName) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/signinsettings.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/signinsettings.go deleted file mode 100644 index 515dc82ce63e..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/signinsettings.go +++ /dev/null @@ -1,380 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SignInSettingsClient is the apiManagement Client -type SignInSettingsClient struct { - BaseClient -} - -// NewSignInSettingsClient creates an instance of the SignInSettingsClient client. -func NewSignInSettingsClient(subscriptionID string) SignInSettingsClient { - return NewSignInSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSignInSettingsClientWithBaseURI creates an instance of the SignInSettingsClient 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 NewSignInSettingsClientWithBaseURI(baseURI string, subscriptionID string) SignInSettingsClient { - return SignInSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update Sign-In settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client SignInSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (result PortalSigninSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SignInSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/portalsettings/signin", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SignInSettingsClient) 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 SignInSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result PortalSigninSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get Sign In Settings for the Portal -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignInSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PortalSigninSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SignInSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/portalsettings/signin", 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 SignInSettingsClient) 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 SignInSettingsClient) GetResponder(resp *http.Response) (result PortalSigninSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the SignInSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignInSettingsClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client SignInSettingsClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client SignInSettingsClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client SignInSettingsClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update Sign-In settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - update Sign-In settings. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client SignInSettingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SignInSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/portalsettings/signin", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 SignInSettingsClient) 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 SignInSettingsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/signupsettings.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/signupsettings.go deleted file mode 100644 index 1c40fbae6272..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/signupsettings.go +++ /dev/null @@ -1,380 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SignUpSettingsClient is the apiManagement Client -type SignUpSettingsClient struct { - BaseClient -} - -// NewSignUpSettingsClient creates an instance of the SignUpSettingsClient client. -func NewSignUpSettingsClient(subscriptionID string) SignUpSettingsClient { - return NewSignUpSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSignUpSettingsClientWithBaseURI creates an instance of the SignUpSettingsClient 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 NewSignUpSettingsClientWithBaseURI(baseURI string, subscriptionID string) SignUpSettingsClient { - return SignUpSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update Sign-Up settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client SignUpSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (result PortalSignupSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SignUpSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/portalsettings/signup", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SignUpSettingsClient) 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 SignUpSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result PortalSignupSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get Sign Up Settings for the Portal -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignUpSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PortalSignupSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SignUpSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/portalsettings/signup", 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 SignUpSettingsClient) 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 SignUpSettingsClient) GetResponder(resp *http.Response) (result PortalSignupSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the SignUpSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignUpSettingsClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client SignUpSettingsClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client SignUpSettingsClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client SignUpSettingsClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update Sign-Up settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - update Sign-Up settings. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client SignUpSettingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SignUpSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/portalsettings/signup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 SignUpSettingsClient) 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 SignUpSettingsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/subscription.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/subscription.go deleted file mode 100644 index 1ec89e9047ca..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/subscription.go +++ /dev/null @@ -1,857 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SubscriptionClient is the apiManagement Client -type SubscriptionClient struct { - BaseClient -} - -// NewSubscriptionClient creates an instance of the SubscriptionClient client. -func NewSubscriptionClient(subscriptionID string) SubscriptionClient { - return NewSubscriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionClientWithBaseURI creates an instance of the SubscriptionClient 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 NewSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionClient { - return SubscriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the subscription of specified user to the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -// parameters - create parameters. -// notify - notify change in Subscription State. -// - If false, do not send any email notification for change of state of subscription -// - If true, send email notification of change of state of subscription -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client SubscriptionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters, notify *bool, ifMatch string) (result SubscriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.Scope", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.DisplayName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.SubscriptionCreateParameterProperties.PrimaryKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.PrimaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.PrimaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.SubscriptionCreateParameterProperties.SecondaryKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.SecondaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.SecondaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, sid, parameters, notify, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SubscriptionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters, notify *bool, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) 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 SubscriptionClient) CreateOrUpdateResponder(resp *http.Response) (result SubscriptionContract, 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 specified subscription. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client SubscriptionClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, sid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, sid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubscriptionClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 SubscriptionClient) 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 SubscriptionClient) 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 specified Subscription entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) Get(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result SubscriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/subscriptions/{sid}", 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 SubscriptionClient) 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 SubscriptionClient) GetResponder(resp *http.Response) (result SubscriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client SubscriptionClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all subscriptions of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |ownerId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |scope | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |state | eq | | -// |user | | | -// top - number of records to return. -// skip - number of records to skip. -func (client SubscriptionClient) List(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result SubscriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.List") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "List", resp, "Failure sending request") - return - } - - result.sc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "List", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SubscriptionClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/subscriptions", 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 SubscriptionClient) 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 SubscriptionClient) ListResponder(resp *http.Response) (result SubscriptionCollection, 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 SubscriptionClient) listNextResults(ctx context.Context, lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.subscriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "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, "apimanagement.SubscriptionClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SubscriptionClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result SubscriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.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, serviceName, filter, top, skip) - return -} - -// RegeneratePrimaryKey regenerates primary key of existing subscription of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.RegeneratePrimaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "RegeneratePrimaryKey", err.Error()) - } - - req, err := client.RegeneratePrimaryKeyPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client SubscriptionClient) RegeneratePrimaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerates secondary key of existing subscription of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.RegenerateSecondaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "RegenerateSecondaryKey", err.Error()) - } - - req, err := client.RegenerateSecondaryKeyPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client SubscriptionClient) RegenerateSecondaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) RegenerateSecondaryKeyResponder(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 details of a subscription specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// notify - notify change in Subscription State. -// - If false, do not send any email notification for change of state of subscription -// - If true, send email notification of change of state of subscription -func (client SubscriptionClient) Update(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string, notify *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, sid, parameters, ifMatch, notify) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SubscriptionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string, notify *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 SubscriptionClient) 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 SubscriptionClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tag.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tag.go deleted file mode 100644 index fcd5b4df85d4..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tag.go +++ /dev/null @@ -1,2308 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TagClient is the apiManagement Client -type TagClient struct { - BaseClient -} - -// NewTagClient creates an instance of the TagClient client. -func NewTagClient(subscriptionID string) TagClient { - return NewTagClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagClientWithBaseURI creates an instance of the TagClient 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 NewTagClientWithBaseURI(baseURI string, subscriptionID string) TagClient { - return TagClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AssignToAPI assign tag to the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) AssignToAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.AssignToAPI") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "AssignToAPI", err.Error()) - } - - req, err := client.AssignToAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToAPI", nil, "Failure preparing request") - return - } - - resp, err := client.AssignToAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToAPI", resp, "Failure sending request") - return - } - - result, err = client.AssignToAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToAPI", resp, "Failure responding to request") - return - } - - return -} - -// AssignToAPIPreparer prepares the AssignToAPI request. -func (client TagClient) AssignToAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AssignToAPISender sends the AssignToAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) AssignToAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AssignToAPIResponder handles the response to the AssignToAPI request. The method always -// closes the http.Response Body. -func (client TagClient) AssignToAPIResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AssignToOperation assign tag to the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) AssignToOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.AssignToOperation") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "AssignToOperation", err.Error()) - } - - req, err := client.AssignToOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToOperation", nil, "Failure preparing request") - return - } - - resp, err := client.AssignToOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToOperation", resp, "Failure sending request") - return - } - - result, err = client.AssignToOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToOperation", resp, "Failure responding to request") - return - } - - return -} - -// AssignToOperationPreparer prepares the AssignToOperation request. -func (client TagClient) AssignToOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AssignToOperationSender sends the AssignToOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) AssignToOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AssignToOperationResponder handles the response to the AssignToOperation request. The method always -// closes the http.Response Body. -func (client TagClient) AssignToOperationResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AssignToProduct assign tag to the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) AssignToProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.AssignToProduct") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "AssignToProduct", err.Error()) - } - - req, err := client.AssignToProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToProduct", nil, "Failure preparing request") - return - } - - resp, err := client.AssignToProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToProduct", resp, "Failure sending request") - return - } - - result, err = client.AssignToProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToProduct", resp, "Failure responding to request") - return - } - - return -} - -// AssignToProductPreparer prepares the AssignToProduct request. -func (client TagClient) AssignToProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AssignToProductSender sends the AssignToProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) AssignToProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AssignToProductResponder handles the response to the AssignToProduct request. The method always -// closes the http.Response Body. -func (client TagClient) AssignToProductResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates a tag. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client TagClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TagContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TagContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.TagContractProperties.DisplayName", Name: validation.MaxLength, Rule: 160, Chain: nil}, - {Target: "parameters.TagContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, tagID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TagClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tags/{tagId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) 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 TagClient) CreateOrUpdateResponder(resp *http.Response) (result TagContract, 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 specific tag of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TagClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, tagID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, tagID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TagClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 TagClient) 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 TagClient) 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 -} - -// DetachFromAPI detach the tag from the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) DetachFromAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.DetachFromAPI") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "DetachFromAPI", err.Error()) - } - - req, err := client.DetachFromAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromAPI", nil, "Failure preparing request") - return - } - - resp, err := client.DetachFromAPISender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromAPI", resp, "Failure sending request") - return - } - - result, err = client.DetachFromAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromAPI", resp, "Failure responding to request") - return - } - - return -} - -// DetachFromAPIPreparer prepares the DetachFromAPI request. -func (client TagClient) DetachFromAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFromAPISender sends the DetachFromAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DetachFromAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DetachFromAPIResponder handles the response to the DetachFromAPI request. The method always -// closes the http.Response Body. -func (client TagClient) DetachFromAPIResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachFromOperation detach the tag from the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) DetachFromOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.DetachFromOperation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "DetachFromOperation", err.Error()) - } - - req, err := client.DetachFromOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromOperation", nil, "Failure preparing request") - return - } - - resp, err := client.DetachFromOperationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromOperation", resp, "Failure sending request") - return - } - - result, err = client.DetachFromOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromOperation", resp, "Failure responding to request") - return - } - - return -} - -// DetachFromOperationPreparer prepares the DetachFromOperation request. -func (client TagClient) DetachFromOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFromOperationSender sends the DetachFromOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DetachFromOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DetachFromOperationResponder handles the response to the DetachFromOperation request. The method always -// closes the http.Response Body. -func (client TagClient) DetachFromOperationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachFromProduct detach the tag from the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) DetachFromProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.DetachFromProduct") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "DetachFromProduct", err.Error()) - } - - req, err := client.DetachFromProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromProduct", nil, "Failure preparing request") - return - } - - resp, err := client.DetachFromProductSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromProduct", resp, "Failure sending request") - return - } - - result, err = client.DetachFromProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromProduct", resp, "Failure responding to request") - return - } - - return -} - -// DetachFromProductPreparer prepares the DetachFromProduct request. -func (client TagClient) DetachFromProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFromProductSender sends the DetachFromProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DetachFromProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DetachFromProductResponder handles the response to the DetachFromProduct request. The method always -// closes the http.Response Body. -func (client TagClient) DetachFromProductResponder(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 details of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) Get(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TagClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tags/{tagId}", 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 TagClient) 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 TagClient) GetResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByAPI get tag associated with the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetByAPI") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetByAPI", err.Error()) - } - - req, err := client.GetByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.GetByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByAPI", resp, "Failure sending request") - return - } - - result, err = client.GetByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByAPI", resp, "Failure responding to request") - return - } - - return -} - -// GetByAPIPreparer prepares the GetByAPI request. -func (client TagClient) GetByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByAPISender sends the GetByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByAPIResponder handles the response to the GetByAPI request. The method always -// closes the http.Response Body. -func (client TagClient) GetByAPIResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByOperation get tag associated with the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetByOperation") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetByOperation", err.Error()) - } - - req, err := client.GetByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.GetByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByOperation", resp, "Failure sending request") - return - } - - result, err = client.GetByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByOperation", resp, "Failure responding to request") - return - } - - return -} - -// GetByOperationPreparer prepares the GetByOperation request. -func (client TagClient) GetByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByOperationSender sends the GetByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByOperationResponder handles the response to the GetByOperation request. The method always -// closes the http.Response Body. -func (client TagClient) GetByOperationResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByProduct get tag associated with the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetByProduct") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetByProduct", err.Error()) - } - - req, err := client.GetByProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.GetByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByProduct", resp, "Failure sending request") - return - } - - result, err = client.GetByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByProduct", resp, "Failure responding to request") - return - } - - return -} - -// GetByProductPreparer prepares the GetByProduct request. -func (client TagClient) GetByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByProductSender sends the GetByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByProductResponder handles the response to the GetByProduct request. The method always -// closes the http.Response Body. -func (client TagClient) GetByProductResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityState gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityState(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityState") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityState", err.Error()) - } - - req, err := client.GetEntityStatePreparer(ctx, resourceGroupName, serviceName, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityState", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityState", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityState", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStatePreparer prepares the GetEntityState request. -func (client TagClient) GetEntityStatePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateSender sends the GetEntityState request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateResponder handles the response to the GetEntityState request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityStateByAPI gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityStateByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityStateByAPI") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityStateByAPI", err.Error()) - } - - req, err := client.GetEntityStateByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateByAPISender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByAPI", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByAPI", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStateByAPIPreparer prepares the GetEntityStateByAPI request. -func (client TagClient) GetEntityStateByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateByAPISender sends the GetEntityStateByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateByAPIResponder handles the response to the GetEntityStateByAPI request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateByAPIResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityStateByOperation gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityStateByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityStateByOperation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityStateByOperation", err.Error()) - } - - req, err := client.GetEntityStateByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateByOperationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByOperation", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByOperation", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStateByOperationPreparer prepares the GetEntityStateByOperation request. -func (client TagClient) GetEntityStateByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateByOperationSender sends the GetEntityStateByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateByOperationResponder handles the response to the GetEntityStateByOperation request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateByOperationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityStateByProduct gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityStateByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityStateByProduct") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityStateByProduct", err.Error()) - } - - req, err := client.GetEntityStateByProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateByProductSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByProduct", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByProduct", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStateByProductPreparer prepares the GetEntityStateByProduct request. -func (client TagClient) GetEntityStateByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateByProductSender sends the GetEntityStateByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateByProductResponder handles the response to the GetEntityStateByProduct request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateByProductResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI lists all Tags associated with the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client TagClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByAPI") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client TagClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client TagClient) ListByAPIResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client TagClient) listByAPINextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByAPI") - 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.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} - -// ListByOperation lists all Tags associated with the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client TagClient) ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByOperation") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByOperation", err.Error()) - } - - result.fn = client.listByOperationNextResults - req, err := client.ListByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByOperationSender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByOperation", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByOperation", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByOperationPreparer prepares the ListByOperation request. -func (client TagClient) ListByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByOperationSender sends the ListByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByOperationResponder handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (client TagClient) ListByOperationResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByOperationNextResults retrieves the next set of results, if any. -func (client TagClient) listByOperationNextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByOperationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByOperationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByOperationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByOperationComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByOperation") - 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.ListByOperation(ctx, resourceGroupName, serviceName, apiid, operationID, filter, top, skip) - return -} - -// ListByProduct lists all Tags associated with the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client TagClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByProduct") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client TagClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/products/{productId}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client TagClient) ListByProductResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client TagClient) listByProductNextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByProduct") - 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.ListByProduct(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} - -// ListByService lists a collection of tags defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -// scope - scope like 'apis', 'products' or 'apis/{apiId} -func (client TagClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByService") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByService", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByService", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client TagClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(scope) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client TagClient) ListByServiceResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client TagClient) listByServiceNextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, scope) - return -} - -// Update updates the details of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TagClient) Update(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, tagID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TagClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 TagClient) 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 TagClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tagdescription.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tagdescription.go deleted file mode 100644 index 2f9fdb679f08..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tagdescription.go +++ /dev/null @@ -1,590 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TagDescriptionClient is the apiManagement Client -type TagDescriptionClient struct { - BaseClient -} - -// NewTagDescriptionClient creates an instance of the TagDescriptionClient client. -func NewTagDescriptionClient(subscriptionID string) TagDescriptionClient { - return NewTagDescriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagDescriptionClientWithBaseURI creates an instance of the TagDescriptionClient 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 NewTagDescriptionClientWithBaseURI(baseURI string, subscriptionID string) TagDescriptionClient { - return TagDescriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create/Update tag description in scope of the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client TagDescriptionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string, parameters TagDescriptionCreateParameters, ifMatch string) (result TagDescriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TagDescriptionBaseProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TagDescriptionBaseProperties.ExternalDocsURL", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TagDescriptionBaseProperties.ExternalDocsURL", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.TagDescriptionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, tagID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TagDescriptionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string, parameters TagDescriptionCreateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TagDescriptionClient) 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 TagDescriptionClient) CreateOrUpdateResponder(resp *http.Response) (result TagDescriptionContract, 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 tag description for the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TagDescriptionClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagDescriptionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, tagID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TagDescriptionClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 TagDescriptionClient) 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 TagDescriptionClient) 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 Tag description in scope of API -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagDescriptionClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result TagDescriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagDescriptionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TagDescriptionClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagId}", 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 TagDescriptionClient) 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 TagDescriptionClient) GetResponder(resp *http.Response) (result TagDescriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityState gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagDescriptionClient) GetEntityState(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionClient.GetEntityState") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagDescriptionClient", "GetEntityState", err.Error()) - } - - req, err := client.GetEntityStatePreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "GetEntityState", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "GetEntityState", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "GetEntityState", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStatePreparer prepares the GetEntityState request. -func (client TagDescriptionClient) GetEntityStatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateSender sends the GetEntityState request. The method will close the -// http.Response Body if it receives an error. -func (client TagDescriptionClient) GetEntityStateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateResponder handles the response to the GetEntityState request. The method always -// closes the http.Response Body. -func (client TagDescriptionClient) GetEntityStateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API -// level but tag may be assigned to the Operations -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client TagDescriptionClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagDescriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionClient.ListByAPI") - defer func() { - sc := -1 - if result.tdc.Response.Response != nil { - sc = result.tdc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagDescriptionClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.tdc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.tdc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.tdc.hasNextLink() && result.tdc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client TagDescriptionClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagDescriptionClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client TagDescriptionClient) ListByAPIResponder(resp *http.Response) (result TagDescriptionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client TagDescriptionClient) listByAPINextResults(ctx context.Context, lastResults TagDescriptionCollection) (result TagDescriptionCollection, err error) { - req, err := lastResults.tagDescriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagDescriptionClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagDescriptionClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagDescriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionClient.ListByAPI") - 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.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tagresource.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tagresource.go deleted file mode 100644 index 5778e10aa9a5..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tagresource.go +++ /dev/null @@ -1,191 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TagResourceClient is the apiManagement Client -type TagResourceClient struct { - BaseClient -} - -// NewTagResourceClient creates an instance of the TagResourceClient client. -func NewTagResourceClient(subscriptionID string) TagResourceClient { - return NewTagResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagResourceClientWithBaseURI creates an instance of the TagResourceClient 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 NewTagResourceClientWithBaseURI(baseURI string, subscriptionID string) TagResourceClient { - return TagResourceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists a collection of resources associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |aid | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |apiName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |apiRevision | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |method | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |urlTemplate | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |terms | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |state | eq | | -// |isCurrent | eq | | -// top - number of records to return. -// skip - number of records to skip. -func (client TagResourceClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceClient.ListByService") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagResourceClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "ListByService", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "ListByService", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client TagResourceClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/tagResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client TagResourceClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client TagResourceClient) ListByServiceResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client TagResourceClient) listByServiceNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagResourceClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantaccess.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantaccess.go deleted file mode 100644 index da517f2a8c91..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantaccess.go +++ /dev/null @@ -1,459 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TenantAccessClient is the apiManagement Client -type TenantAccessClient struct { - BaseClient -} - -// NewTenantAccessClient creates an instance of the TenantAccessClient client. -func NewTenantAccessClient(subscriptionID string) TenantAccessClient { - return NewTenantAccessClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantAccessClientWithBaseURI creates an instance of the TenantAccessClient 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 NewTenantAccessClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessClient { - return TenantAccessClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get tenant access information details -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantAccessClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{accessName}", 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 TenantAccessClient) 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 TenantAccessClient) GetResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag tenant access metadata -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client TenantAccessClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegeneratePrimaryKey regenerate primary access key -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.RegeneratePrimaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "RegeneratePrimaryKey", err.Error()) - } - - req, err := client.RegeneratePrimaryKeyPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client TenantAccessClient) RegeneratePrimaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerate secondary access key -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.RegenerateSecondaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "RegenerateSecondaryKey", err.Error()) - } - - req, err := client.RegenerateSecondaryKeyPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client TenantAccessClient) RegenerateSecondaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) RegenerateSecondaryKeyResponder(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 update tenant access information details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to retrieve the Tenant Access Information. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TenantAccessClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TenantAccessClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{accessName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 TenantAccessClient) 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 TenantAccessClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantaccessgit.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantaccessgit.go deleted file mode 100644 index 988ff1047485..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantaccessgit.go +++ /dev/null @@ -1,285 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TenantAccessGitClient is the apiManagement Client -type TenantAccessGitClient struct { - BaseClient -} - -// NewTenantAccessGitClient creates an instance of the TenantAccessGitClient client. -func NewTenantAccessGitClient(subscriptionID string) TenantAccessGitClient { - return NewTenantAccessGitClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantAccessGitClientWithBaseURI creates an instance of the TenantAccessGitClient 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 NewTenantAccessGitClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessGitClient { - return TenantAccessGitClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the Git access configuration for the tenant. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessGitClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessGitClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessGitClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantAccessGitClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{accessName}/git", 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 TenantAccessGitClient) 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 TenantAccessGitClient) GetResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegeneratePrimaryKey regenerate primary access key for GIT. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessGitClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessGitClient.RegeneratePrimaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", err.Error()) - } - - req, err := client.RegeneratePrimaryKeyPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client TenantAccessGitClient) RegeneratePrimaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerate secondary access key for GIT. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessGitClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessGitClient.RegenerateSecondaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", err.Error()) - } - - req, err := client.RegenerateSecondaryKeyPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client TenantAccessGitClient) RegenerateSecondaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantconfiguration.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantconfiguration.go deleted file mode 100644 index e3adab7e0117..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/tenantconfiguration.go +++ /dev/null @@ -1,401 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TenantConfigurationClient is the apiManagement Client -type TenantConfigurationClient struct { - BaseClient -} - -// NewTenantConfigurationClient creates an instance of the TenantConfigurationClient client. -func NewTenantConfigurationClient(subscriptionID string) TenantConfigurationClient { - return NewTenantConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantConfigurationClientWithBaseURI creates an instance of the TenantConfigurationClient 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 NewTenantConfigurationClientWithBaseURI(baseURI string, subscriptionID string) TenantConfigurationClient { - return TenantConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Deploy this operation applies changes from the specified Git branch to the configuration database. This is a long -// running operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - deploy Configuration parameters. -func (client TenantConfigurationClient) Deploy(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (result TenantConfigurationDeployFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.Deploy") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "Deploy", err.Error()) - } - - req, err := client.DeployPreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", nil, "Failure preparing request") - return - } - - result, err = client.DeploySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", result.Response(), "Failure sending request") - return - } - - return -} - -// DeployPreparer prepares the Deploy request. -func (client TenantConfigurationClient) DeployPreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeploySender sends the Deploy request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) DeploySender(req *http.Request) (future TenantConfigurationDeployFuture, 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 -} - -// DeployResponder handles the response to the Deploy request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) DeployResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSyncState gets the status of the most recent synchronization between the configuration database and the Git -// repository. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantConfigurationClient) GetSyncState(ctx context.Context, resourceGroupName string, serviceName string) (result TenantConfigurationSyncStateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.GetSyncState") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "GetSyncState", err.Error()) - } - - req, err := client.GetSyncStatePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "GetSyncState", nil, "Failure preparing request") - return - } - - resp, err := client.GetSyncStateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "GetSyncState", resp, "Failure sending request") - return - } - - result, err = client.GetSyncStateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "GetSyncState", resp, "Failure responding to request") - return - } - - return -} - -// GetSyncStatePreparer prepares the GetSyncState request. -func (client TenantConfigurationClient) GetSyncStatePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSyncStateSender sends the GetSyncState request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) GetSyncStateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSyncStateResponder handles the response to the GetSyncState request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) GetSyncStateResponder(resp *http.Response) (result TenantConfigurationSyncStateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Save this operation creates a commit with the current configuration snapshot to the specified branch in the -// repository. This is a long running operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - save Configuration parameters. -func (client TenantConfigurationClient) Save(ctx context.Context, resourceGroupName string, serviceName string, parameters SaveConfigurationParameter) (result TenantConfigurationSaveFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.Save") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "Save", err.Error()) - } - - req, err := client.SavePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", nil, "Failure preparing request") - return - } - - result, err = client.SaveSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", result.Response(), "Failure sending request") - return - } - - return -} - -// SavePreparer prepares the Save request. -func (client TenantConfigurationClient) SavePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters SaveConfigurationParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{configurationName}/save", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SaveSender sends the Save request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) SaveSender(req *http.Request) (future TenantConfigurationSaveFuture, 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 -} - -// SaveResponder handles the response to the Save request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) SaveResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Validate this operation validates the changes in the specified Git branch. This is a long running operation and -// could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - validate Configuration parameters. -func (client TenantConfigurationClient) Validate(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (result TenantConfigurationValidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.Validate") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "Validate", err.Error()) - } - - req, err := client.ValidatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", nil, "Failure preparing request") - return - } - - result, err = client.ValidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", result.Response(), "Failure sending request") - return - } - - return -} - -// ValidatePreparer prepares the Validate request. -func (client TenantConfigurationClient) ValidatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateSender sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) ValidateSender(req *http.Request) (future TenantConfigurationValidateFuture, 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 -} - -// ValidateResponder handles the response to the Validate request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) ValidateResponder(resp *http.Response) (result OperationResultContract, 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/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/user.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/user.go deleted file mode 100644 index 6918310c3657..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/user.go +++ /dev/null @@ -1,862 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserClient is the apiManagement Client -type UserClient struct { - BaseClient -} - -// NewUserClient creates an instance of the UserClient client. -func NewUserClient(subscriptionID string) UserClient { - return NewUserClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserClientWithBaseURI creates an instance of the UserClient 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 NewUserClientWithBaseURI(baseURI string, subscriptionID string) UserClient { - return UserClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client UserClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserCreateParameters, ifMatch string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.Email", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.Email", Name: validation.MaxLength, Rule: 254, Chain: nil}, - {Target: "parameters.UserCreateParameterProperties.Email", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.UserCreateParameterProperties.FirstName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.FirstName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.UserCreateParameterProperties.FirstName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.UserCreateParameterProperties.LastName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.LastName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.UserCreateParameterProperties.LastName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, userID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client UserClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserCreateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/users/{userId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) 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 UserClient) CreateOrUpdateResponder(resp *http.Response) (result UserContract, 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 specific user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// deleteSubscriptions - whether to delete user's subscription or not. -// notify - send an Account Closed Email notification to the User. -func (client UserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, userID string, ifMatch string, deleteSubscriptions *bool, notify *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, userID, ifMatch, deleteSubscriptions, notify) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client UserClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, ifMatch string, deleteSubscriptions *bool, notify *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteSubscriptions != nil { - queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 UserClient) 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 UserClient) 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 -} - -// GenerateSsoURL retrieves a redirection URL containing an authentication token for signing a given user into the -// developer portal. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserClient) GenerateSsoURL(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result GenerateSsoURLResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.GenerateSsoURL") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "GenerateSsoURL", err.Error()) - } - - req, err := client.GenerateSsoURLPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GenerateSsoURL", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateSsoURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GenerateSsoURL", resp, "Failure sending request") - return - } - - result, err = client.GenerateSsoURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GenerateSsoURL", resp, "Failure responding to request") - return - } - - return -} - -// GenerateSsoURLPreparer prepares the GenerateSsoURL request. -func (client UserClient) GenerateSsoURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateSsoURLSender sends the GenerateSsoURL request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GenerateSsoURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateSsoURLResponder handles the response to the GenerateSsoURL request. The method always -// closes the http.Response Body. -func (client UserClient) GenerateSsoURLResponder(resp *http.Response) (result GenerateSsoURLResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the user specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserClient) Get(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client UserClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/users/{userId}", 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 UserClient) 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 UserClient) GetResponder(resp *http.Response) (result UserContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the user specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client UserClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client UserClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetSharedAccessToken gets the Shared Access Authorization Token for the User. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// parameters - create Authorization Token parameters. -func (client UserClient) GetSharedAccessToken(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserTokenParameters) (result UserTokenResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.GetSharedAccessToken") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Expiry", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "GetSharedAccessToken", err.Error()) - } - - req, err := client.GetSharedAccessTokenPreparer(ctx, resourceGroupName, serviceName, userID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetSharedAccessToken", nil, "Failure preparing request") - return - } - - resp, err := client.GetSharedAccessTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetSharedAccessToken", resp, "Failure sending request") - return - } - - result, err = client.GetSharedAccessTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetSharedAccessToken", resp, "Failure responding to request") - return - } - - return -} - -// GetSharedAccessTokenPreparer prepares the GetSharedAccessToken request. -func (client UserClient) GetSharedAccessTokenPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserTokenParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/users/{userId}/token", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSharedAccessTokenSender sends the GetSharedAccessToken request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GetSharedAccessTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSharedAccessTokenResponder handles the response to the GetSharedAccessToken request. The method always -// closes the http.Response Body. -func (client UserClient) GetSharedAccessTokenResponder(resp *http.Response) (result UserTokenResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of registered users in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |firstName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |lastName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |email | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |state | eq | | -// |registrationDate | ge, le, eq, ne, gt, lt | | -// |note | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |groups | | | -// top - number of records to return. -// skip - number of records to skip. -func (client UserClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result UserCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.ListByService") - defer func() { - sc := -1 - if result.uc.Response.Response != nil { - sc = result.uc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.uc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "ListByService", resp, "Failure sending request") - return - } - - result.uc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "ListByService", resp, "Failure responding to request") - return - } - if result.uc.hasNextLink() && result.uc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client UserClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if expandGroups != nil { - queryParameters["expandGroups"] = autorest.Encode("query", *expandGroups) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client UserClient) ListByServiceResponder(resp *http.Response) (result UserCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client UserClient) listByServiceNextResults(ctx context.Context, lastResults UserCollection) (result UserCollection, err error) { - req, err := lastResults.userCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.UserClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result UserCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups) - return -} - -// Update updates the details of the user specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client UserClient) Update(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, userID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client UserClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 UserClient) 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 UserClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/userconfirmationpassword.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/userconfirmationpassword.go deleted file mode 100644 index 5a322c68100a..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/userconfirmationpassword.go +++ /dev/null @@ -1,122 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserConfirmationPasswordClient is the apiManagement Client -type UserConfirmationPasswordClient struct { - BaseClient -} - -// NewUserConfirmationPasswordClient creates an instance of the UserConfirmationPasswordClient client. -func NewUserConfirmationPasswordClient(subscriptionID string) UserConfirmationPasswordClient { - return NewUserConfirmationPasswordClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserConfirmationPasswordClientWithBaseURI creates an instance of the UserConfirmationPasswordClient 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 NewUserConfirmationPasswordClientWithBaseURI(baseURI string, subscriptionID string) UserConfirmationPasswordClient { - return UserConfirmationPasswordClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// SendMethod sends confirmation -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserConfirmationPasswordClient) SendMethod(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserConfirmationPasswordClient.SendMethod") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserConfirmationPasswordClient", "SendMethod", err.Error()) - } - - req, err := client.SendMethodPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserConfirmationPasswordClient", "SendMethod", nil, "Failure preparing request") - return - } - - resp, err := client.SendMethodSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserConfirmationPasswordClient", "SendMethod", resp, "Failure sending request") - return - } - - result, err = client.SendMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserConfirmationPasswordClient", "SendMethod", resp, "Failure responding to request") - return - } - - return -} - -// SendMethodPreparer prepares the SendMethod request. -func (client UserConfirmationPasswordClient) SendMethodPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SendMethodSender sends the SendMethod request. The method will close the -// http.Response Body if it receives an error. -func (client UserConfirmationPasswordClient) SendMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SendMethodResponder handles the response to the SendMethod request. The method always -// closes the http.Response Body. -func (client UserConfirmationPasswordClient) SendMethodResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/usergroup.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/usergroup.go deleted file mode 100644 index 1e6953e6bb86..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/usergroup.go +++ /dev/null @@ -1,187 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserGroupClient is the apiManagement Client -type UserGroupClient struct { - BaseClient -} - -// NewUserGroupClient creates an instance of the UserGroupClient client. -func NewUserGroupClient(subscriptionID string) UserGroupClient { - return NewUserGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserGroupClientWithBaseURI creates an instance of the UserGroupClient 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 NewUserGroupClientWithBaseURI(baseURI string, subscriptionID string) UserGroupClient { - return UserGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all user groups. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client UserGroupClient) List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserGroupClient.List") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserGroupClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, userID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "List", resp, "Failure sending request") - return - } - - result.gc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "List", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserGroupClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/users/{userId}/groups", 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 UserGroupClient) 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 UserGroupClient) ListResponder(resp *http.Response) (result GroupCollection, 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 UserGroupClient) listNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.groupCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "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, "apimanagement.UserGroupClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserGroupClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserGroupClient.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, serviceName, userID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/useridentities.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/useridentities.go deleted file mode 100644 index 8ca0018620a2..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/useridentities.go +++ /dev/null @@ -1,164 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserIdentitiesClient is the apiManagement Client -type UserIdentitiesClient struct { - BaseClient -} - -// NewUserIdentitiesClient creates an instance of the UserIdentitiesClient client. -func NewUserIdentitiesClient(subscriptionID string) UserIdentitiesClient { - return NewUserIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserIdentitiesClientWithBaseURI creates an instance of the UserIdentitiesClient 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 NewUserIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) UserIdentitiesClient { - return UserIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list of all user identities. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserIdentitiesClient) List(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result UserIdentityCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentitiesClient.List") - defer func() { - sc := -1 - if result.uic.Response.Response != nil { - sc = result.uic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserIdentitiesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.uic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "List", resp, "Failure sending request") - return - } - - result.uic, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "List", resp, "Failure responding to request") - return - } - if result.uic.hasNextLink() && result.uic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserIdentitiesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-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.ApiManagement/service/{serviceName}/users/{userId}/identities", 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 UserIdentitiesClient) 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 UserIdentitiesClient) ListResponder(resp *http.Response) (result UserIdentityCollection, 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 UserIdentitiesClient) listNextResults(ctx context.Context, lastResults UserIdentityCollection) (result UserIdentityCollection, err error) { - req, err := lastResults.userIdentityCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "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, "apimanagement.UserIdentitiesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserIdentitiesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result UserIdentityCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentitiesClient.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, serviceName, userID) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/usersubscription.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/usersubscription.go deleted file mode 100644 index e5342a5e5940..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/usersubscription.go +++ /dev/null @@ -1,192 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserSubscriptionClient is the apiManagement Client -type UserSubscriptionClient struct { - BaseClient -} - -// NewUserSubscriptionClient creates an instance of the UserSubscriptionClient client. -func NewUserSubscriptionClient(subscriptionID string) UserSubscriptionClient { - return NewUserSubscriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserSubscriptionClientWithBaseURI creates an instance of the UserSubscriptionClient 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 NewUserSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) UserSubscriptionClient { - return UserSubscriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the collection of subscriptions of the specified user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |ownerId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |scope | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// top - number of records to return. -// skip - number of records to skip. -func (client UserSubscriptionClient) List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSubscriptionClient.List") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "userID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserSubscriptionClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, userID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "List", resp, "Failure sending request") - return - } - - result.sc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "List", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserSubscriptionClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/users/{userId}/subscriptions", 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 UserSubscriptionClient) 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 UserSubscriptionClient) ListResponder(resp *http.Response) (result SubscriptionCollection, 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 UserSubscriptionClient) listNextResults(ctx context.Context, lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.subscriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "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, "apimanagement.UserSubscriptionClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserSubscriptionClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSubscriptionClient.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, serviceName, userID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/version.go b/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/version.go deleted file mode 100644 index 3ec88f2b97fc..000000000000 --- a/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package apimanagement - -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() + " apimanagement/2018-06-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/apimanagement/mgmt/2019-12-01-preview/apimanagement/CHANGELOG.md b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/_meta.json b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/_meta.json deleted file mode 100644 index 9019f01b3166..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md", - "tag": "package-preview-2019-12", - "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-2019-12 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/api.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/api.go deleted file mode 100644 index 3442b20c46ad..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/api.go +++ /dev/null @@ -1,823 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIClient is the apiManagement Client -type APIClient struct { - BaseClient -} - -// NewAPIClient creates an instance of the APIClient client. -func NewAPIClient(subscriptionID string) APIClient { - return NewAPIClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIClientWithBaseURI creates an instance of the APIClient 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 NewAPIClientWithBaseURI(baseURI string, subscriptionID string) APIClient { - return APIClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates new or updates existing specified API of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APICreateOrUpdateParameter, ifMatch string) (result APICreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APICreateOrUpdateParameter, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) CreateOrUpdateSender(req *http.Request) (future APICreateOrUpdateFuture, 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 APIClient) CreateOrUpdateResponder(resp *http.Response) (result APIContract, 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 the specified API of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// deleteRevisions - delete all revisions of the Api. -func (client APIClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string, deleteRevisions *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, ifMatch, deleteRevisions) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string, deleteRevisions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteRevisions != nil { - queryParameters["deleteRevisions"] = autorest.Encode("query", *deleteRevisions) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIClient) 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 APIClient) 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 details of the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result APIContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}", 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 APIClient) 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 APIClient) GetResponder(resp *http.Response) (result APIContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all APIs of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| serviceUrl | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| path | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -// tags - include tags in the response. -// expandAPIVersionSet - include full ApiVersionSet resource in response -func (client APIClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result APICollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByService") - defer func() { - sc := -1 - if result.ac.Response.Response != nil { - sc = result.ac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, tags, expandAPIVersionSet) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByService", resp, "Failure sending request") - return - } - - result.ac, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ac.hasNextLink() && result.ac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags) - } - if expandAPIVersionSet != nil { - queryParameters["expandApiVersionSet"] = autorest.Encode("query", *expandAPIVersionSet) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIClient) ListByServiceResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIClient) listByServiceNextResults(ctx context.Context, lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.aPICollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result APICollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, tags, expandAPIVersionSet) - return -} - -// ListByTags lists a collection of apis associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// -// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |apiRevision | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| -// |isCurrent | eq | | -// top - number of records to return. -// skip - number of records to skip. -// includeNotTaggedApis - include not tagged APIs. -func (client APIClient) ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByTags") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "ListByTags", err.Error()) - } - - result.fn = client.listByTagsNextResults - req, err := client.ListByTagsPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByTags", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTagsSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByTags", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "ListByTags", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTagsPreparer prepares the ListByTags request. -func (client APIClient) ListByTagsPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if includeNotTaggedApis != nil { - queryParameters["includeNotTaggedApis"] = autorest.Encode("query", *includeNotTaggedApis) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTagsSender sends the ListByTags request. The method will close the -// http.Response Body if it receives an error. -func (client APIClient) ListByTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTagsResponder handles the response to the ListByTags request. The method always -// closes the http.Response Body. -func (client APIClient) ListByTagsResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTagsNextResults retrieves the next set of results, if any. -func (client APIClient) listByTagsNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByTagsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByTagsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "listByTagsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTagsComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIClient) ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.ListByTags") - 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.ListByTags(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis) - return -} - -// Update updates the specified API of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// parameters - API Update Contract parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APIUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters APIUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIClient) 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 APIClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apidiagnostic.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apidiagnostic.go deleted file mode 100644 index 19a8e9fb4da7..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apidiagnostic.go +++ /dev/null @@ -1,710 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIDiagnosticClient is the apiManagement Client -type APIDiagnosticClient struct { - BaseClient -} - -// NewAPIDiagnosticClient creates an instance of the APIDiagnosticClient client. -func NewAPIDiagnosticClient(subscriptionID string) APIDiagnosticClient { - return NewAPIDiagnosticClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIDiagnosticClientWithBaseURI creates an instance of the APIDiagnosticClient 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 NewAPIDiagnosticClientWithBaseURI(baseURI string, subscriptionID string) APIDiagnosticClient { - return APIDiagnosticClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Diagnostic for an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIDiagnosticClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.LoggerID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMaximum, Rule: float64(100), Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIDiagnosticClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) 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 APIDiagnosticClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticContract, 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 specified Diagnostic from an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIDiagnosticClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIDiagnosticClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIDiagnosticClient) 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 APIDiagnosticClient) 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 details of the Diagnostic for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client APIDiagnosticClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIDiagnosticClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", 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 APIDiagnosticClient) 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 APIDiagnosticClient) GetResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client APIDiagnosticClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIDiagnosticClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all diagnostics of an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIDiagnosticClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result DiagnosticCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.ListByService") - defer func() { - sc := -1 - if result.dc.Response.Response != nil { - sc = result.dc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.dc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "ListByService", resp, "Failure sending request") - return - } - - result.dc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "ListByService", resp, "Failure responding to request") - return - } - if result.dc.hasNextLink() && result.dc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIDiagnosticClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIDiagnosticClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIDiagnosticClient) ListByServiceResponder(resp *http.Response) (result DiagnosticCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIDiagnosticClient) listByServiceNextResults(ctx context.Context, lastResults DiagnosticCollection) (result DiagnosticCollection, err error) { - req, err := lastResults.diagnosticCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIDiagnosticClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result DiagnosticCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} - -// Update updates the details of the Diagnostic for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - diagnostic Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIDiagnosticClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIDiagnosticClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIDiagnosticClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIDiagnosticClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIDiagnosticClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIDiagnosticClient) 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 APIDiagnosticClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiexport.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiexport.go deleted file mode 100644 index 6047e9b10ba4..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiexport.go +++ /dev/null @@ -1,128 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIExportClient is the apiManagement Client -type APIExportClient struct { - BaseClient -} - -// NewAPIExportClient creates an instance of the APIExportClient client. -func NewAPIExportClient(subscriptionID string) APIExportClient { - return NewAPIExportClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIExportClientWithBaseURI creates an instance of the APIExportClient 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 NewAPIExportClientWithBaseURI(baseURI string, subscriptionID string) APIExportClient { - return APIExportClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key -// valid for 5 minutes. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// formatParameter - format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 -// minutes. -func (client APIExportClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter ExportFormat) (result APIExportResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIExportClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIExportClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIExportClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter ExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "export": autorest.Encode("query", "true"), - "format": autorest.Encode("query", formatParameter), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", 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 APIExportClient) 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 APIExportClient) GetResponder(resp *http.Response) (result APIExportResult, 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/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissue.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissue.go deleted file mode 100644 index 4e47f4bd6b2e..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissue.go +++ /dev/null @@ -1,687 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIIssueClient is the apiManagement Client -type APIIssueClient struct { - BaseClient -} - -// NewAPIIssueClient creates an instance of the APIIssueClient client. -func NewAPIIssueClient(subscriptionID string) APIIssueClient { - return NewAPIIssueClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIIssueClientWithBaseURI creates an instance of the APIIssueClient 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 NewAPIIssueClientWithBaseURI(baseURI string, subscriptionID string) APIIssueClient { - return APIIssueClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Issue for an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIIssueClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueContract, ifMatch string) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IssueContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IssueContractProperties.Title", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueContractProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueContractProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIIssueClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) 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 APIIssueClient) CreateOrUpdateResponder(resp *http.Response) (result IssueContract, 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 specified Issue from an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIIssueClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIIssueClient) 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 APIIssueClient) 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 details of the Issue for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// expandCommentsAttachments - expand the comment attachments. -func (client APIIssueClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, expandCommentsAttachments *bool) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, expandCommentsAttachments) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIIssueClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, expandCommentsAttachments *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if expandCommentsAttachments != nil { - queryParameters["expandCommentsAttachments"] = autorest.Encode("query", *expandCommentsAttachments) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", 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 APIIssueClient) 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 APIIssueClient) GetResponder(resp *http.Response) (result IssueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Issue for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -func (client APIIssueClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, issueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIIssueClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIIssueClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all issues associated with the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| state | filter | eq | |
-// expandCommentsAttachments - expand the comment attachments. -// top - number of records to return. -// skip - number of records to skip. -func (client APIIssueClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result IssueCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.ListByService") - defer func() { - sc := -1 - if result.ic.Response.Response != nil { - sc = result.ic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, expandCommentsAttachments, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "ListByService", resp, "Failure sending request") - return - } - - result.ic, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ic.hasNextLink() && result.ic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIIssueClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if expandCommentsAttachments != nil { - queryParameters["expandCommentsAttachments"] = autorest.Encode("query", *expandCommentsAttachments) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/issues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIIssueClient) ListByServiceResponder(resp *http.Response) (result IssueCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIIssueClient) listByServiceNextResults(ctx context.Context, lastResults IssueCollection) (result IssueCollection, err error) { - req, err := lastResults.issueCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIIssueClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result IssueCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, expandCommentsAttachments, top, skip) - return -} - -// Update updates an existing issue for an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIIssueClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters IssueUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIIssueClient) 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 APIIssueClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissueattachment.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissueattachment.go deleted file mode 100644 index 0f3f045cbeaa..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissueattachment.go +++ /dev/null @@ -1,610 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIIssueAttachmentClient is the apiManagement Client -type APIIssueAttachmentClient struct { - BaseClient -} - -// NewAPIIssueAttachmentClient creates an instance of the APIIssueAttachmentClient client. -func NewAPIIssueAttachmentClient(subscriptionID string) APIIssueAttachmentClient { - return NewAPIIssueAttachmentClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIIssueAttachmentClientWithBaseURI creates an instance of the APIIssueAttachmentClient 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 NewAPIIssueAttachmentClientWithBaseURI(baseURI string, subscriptionID string) APIIssueAttachmentClient { - return APIIssueAttachmentClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Attachment for the Issue in an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIIssueAttachmentClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, parameters IssueAttachmentContract, ifMatch string) (result IssueAttachmentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IssueAttachmentContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IssueAttachmentContractProperties.Title", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueAttachmentContractProperties.ContentFormat", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueAttachmentContractProperties.Content", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIIssueAttachmentClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, parameters IssueAttachmentContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) 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 APIIssueAttachmentClient) CreateOrUpdateResponder(resp *http.Response) (result IssueAttachmentContract, 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 specified comment from an Issue. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueAttachmentClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIIssueAttachmentClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIIssueAttachmentClient) 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 APIIssueAttachmentClient) 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 details of the issue Attachment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueAttachmentClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result IssueAttachmentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIIssueAttachmentClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", 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 APIIssueAttachmentClient) 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 APIIssueAttachmentClient) GetResponder(resp *http.Response) (result IssueAttachmentContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// attachmentID - attachment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueAttachmentClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: attachmentID, - Constraints: []validation.Constraint{{Target: "attachmentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "attachmentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "attachmentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, attachmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIIssueAttachmentClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "attachmentId": autorest.Encode("path", attachmentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIIssueAttachmentClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all attachments for the Issue associated with the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIIssueAttachmentClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueAttachmentCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.ListByService") - defer func() { - sc := -1 - if result.iac.Response.Response != nil { - sc = result.iac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueAttachmentClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.iac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "ListByService", resp, "Failure sending request") - return - } - - result.iac, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "ListByService", resp, "Failure responding to request") - return - } - if result.iac.hasNextLink() && result.iac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIIssueAttachmentClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueAttachmentClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIIssueAttachmentClient) ListByServiceResponder(resp *http.Response) (result IssueAttachmentCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIIssueAttachmentClient) listByServiceNextResults(ctx context.Context, lastResults IssueAttachmentCollection) (result IssueAttachmentCollection, err error) { - req, err := lastResults.issueAttachmentCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueAttachmentClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIIssueAttachmentClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueAttachmentCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueAttachmentClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissuecomment.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissuecomment.go deleted file mode 100644 index 8b5095c0dfb6..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiissuecomment.go +++ /dev/null @@ -1,608 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIIssueCommentClient is the apiManagement Client -type APIIssueCommentClient struct { - BaseClient -} - -// NewAPIIssueCommentClient creates an instance of the APIIssueCommentClient client. -func NewAPIIssueCommentClient(subscriptionID string) APIIssueCommentClient { - return NewAPIIssueCommentClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIIssueCommentClientWithBaseURI creates an instance of the APIIssueCommentClient 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 NewAPIIssueCommentClientWithBaseURI(baseURI string, subscriptionID string) APIIssueCommentClient { - return APIIssueCommentClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Comment for the Issue in an API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIIssueCommentClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, parameters IssueCommentContract, ifMatch string) (result IssueCommentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IssueCommentContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IssueCommentContractProperties.Text", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IssueCommentContractProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIIssueCommentClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, parameters IssueCommentContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) 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 APIIssueCommentClient) CreateOrUpdateResponder(resp *http.Response) (result IssueCommentContract, 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 specified comment from an Issue. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIIssueCommentClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIIssueCommentClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIIssueCommentClient) 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 APIIssueCommentClient) 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 details of the issue Comment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueCommentClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result IssueCommentContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIIssueCommentClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", 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 APIIssueCommentClient) 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 APIIssueCommentClient) GetResponder(resp *http.Response) (result IssueCommentContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// commentID - comment identifier within an Issue. Must be unique in the current Issue. -func (client APIIssueCommentClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: commentID, - Constraints: []validation.Constraint{{Target: "commentID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "commentID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "commentID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, issueID, commentID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIIssueCommentClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "commentId": autorest.Encode("path", commentID), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIIssueCommentClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all comments for the Issue associated with the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// issueID - issue identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIIssueCommentClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueCommentCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.ListByService") - defer func() { - sc := -1 - if result.icc.Response.Response != nil { - sc = result.icc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIIssueCommentClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.icc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "ListByService", resp, "Failure sending request") - return - } - - result.icc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "ListByService", resp, "Failure responding to request") - return - } - if result.icc.hasNextLink() && result.icc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIIssueCommentClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIIssueCommentClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIIssueCommentClient) ListByServiceResponder(resp *http.Response) (result IssueCommentCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIIssueCommentClient) listByServiceNextResults(ctx context.Context, lastResults IssueCommentCollection) (result IssueCommentCollection, err error) { - req, err := lastResults.issueCommentCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIIssueCommentClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIIssueCommentClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result IssueCommentCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIIssueCommentClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, issueID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apimanagementapi/interfaces.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apimanagementapi/interfaces.go deleted file mode 100644 index 7be1bfd6e32c..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apimanagementapi/interfaces.go +++ /dev/null @@ -1,756 +0,0 @@ -package apimanagementapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/apimanagement/mgmt/2019-12-01-preview/apimanagement" - "github.com/Azure/go-autorest/autorest" -) - -// APIClientAPI contains the set of methods on the APIClient type. -type APIClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters apimanagement.APICreateOrUpdateParameter, ifMatch string) (result apimanagement.APICreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string, deleteRevisions *bool) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result apimanagement.APIContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result apimanagement.APICollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, tags string, expandAPIVersionSet *bool) (result apimanagement.APICollectionIterator, err error) - ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result apimanagement.TagResourceCollectionPage, err error) - ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedApis *bool) (result apimanagement.TagResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters apimanagement.APIUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIClientAPI = (*apimanagement.APIClient)(nil) - -// APIRevisionClientAPI contains the set of methods on the APIRevisionClient type. -type APIRevisionClientAPI interface { - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.APIRevisionCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.APIRevisionCollectionIterator, err error) -} - -var _ APIRevisionClientAPI = (*apimanagement.APIRevisionClient)(nil) - -// APIReleaseClientAPI contains the set of methods on the APIReleaseClient type. -type APIReleaseClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters apimanagement.APIReleaseContract, ifMatch string) (result apimanagement.APIReleaseContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result apimanagement.APIReleaseContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.APIReleaseCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.APIReleaseCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters apimanagement.APIReleaseContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIReleaseClientAPI = (*apimanagement.APIReleaseClient)(nil) - -// APIOperationClientAPI contains the set of methods on the APIOperationClient type. -type APIOperationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters apimanagement.OperationContract, ifMatch string) (result apimanagement.OperationContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result apimanagement.OperationContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result apimanagement.OperationCollectionPage, err error) - ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result apimanagement.OperationCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters apimanagement.OperationUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIOperationClientAPI = (*apimanagement.APIOperationClient)(nil) - -// APIOperationPolicyClientAPI contains the set of methods on the APIOperationPolicyClient type. -type APIOperationPolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters apimanagement.PolicyContract, ifMatch string) (result apimanagement.PolicyContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, formatParameter apimanagement.PolicyExportFormat) (result apimanagement.PolicyContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) - ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result apimanagement.PolicyCollection, err error) -} - -var _ APIOperationPolicyClientAPI = (*apimanagement.APIOperationPolicyClient)(nil) - -// TagClientAPI contains the set of methods on the TagClient type. -type TagClientAPI interface { - AssignToAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result apimanagement.TagContract, err error) - AssignToOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result apimanagement.TagContract, err error) - AssignToProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result apimanagement.TagContract, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters apimanagement.TagCreateUpdateParameters, ifMatch string) (result apimanagement.TagContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, tagID string, ifMatch string) (result autorest.Response, err error) - DetachFromAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) - DetachFromOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) - DetachFromProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result apimanagement.TagContract, err error) - GetByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result apimanagement.TagContract, err error) - GetByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result apimanagement.TagContract, err error) - GetByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result apimanagement.TagContract, err error) - GetEntityState(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result autorest.Response, err error) - GetEntityStateByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) - GetEntityStateByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) - GetEntityStateByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionPage, err error) - ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionIterator, err error) - ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionPage, err error) - ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionIterator, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionPage, err error) - ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.TagCollectionIterator, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result apimanagement.TagCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result apimanagement.TagCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters apimanagement.TagCreateUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ TagClientAPI = (*apimanagement.TagClient)(nil) - -// APIProductClientAPI contains the set of methods on the APIProductClient type. -type APIProductClientAPI interface { - ListByApis(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.ProductCollectionPage, err error) - ListByApisComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.ProductCollectionIterator, err error) -} - -var _ APIProductClientAPI = (*apimanagement.APIProductClient)(nil) - -// APIPolicyClientAPI contains the set of methods on the APIPolicyClient type. -type APIPolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters apimanagement.PolicyContract, ifMatch string) (result apimanagement.PolicyContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter apimanagement.PolicyExportFormat) (result apimanagement.PolicyContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result apimanagement.PolicyCollection, err error) -} - -var _ APIPolicyClientAPI = (*apimanagement.APIPolicyClient)(nil) - -// APISchemaClientAPI contains the set of methods on the APISchemaClient type. -type APISchemaClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters apimanagement.SchemaContract, ifMatch string) (result apimanagement.APISchemaCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, ifMatch string, force *bool) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result apimanagement.SchemaContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result autorest.Response, err error) - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.SchemaCollectionPage, err error) - ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.SchemaCollectionIterator, err error) -} - -var _ APISchemaClientAPI = (*apimanagement.APISchemaClient)(nil) - -// APIDiagnosticClientAPI contains the set of methods on the APIDiagnosticClient type. -type APIDiagnosticClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters apimanagement.DiagnosticContract, ifMatch string) (result apimanagement.DiagnosticContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result apimanagement.DiagnosticContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.DiagnosticCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.DiagnosticCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, diagnosticID string, parameters apimanagement.DiagnosticContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIDiagnosticClientAPI = (*apimanagement.APIDiagnosticClient)(nil) - -// APIIssueClientAPI contains the set of methods on the APIIssueClient type. -type APIIssueClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters apimanagement.IssueContract, ifMatch string) (result apimanagement.IssueContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, expandCommentsAttachments *bool) (result apimanagement.IssueContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result apimanagement.IssueCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, expandCommentsAttachments *bool, top *int32, skip *int32) (result apimanagement.IssueCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, parameters apimanagement.IssueUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ APIIssueClientAPI = (*apimanagement.APIIssueClient)(nil) - -// APIIssueCommentClientAPI contains the set of methods on the APIIssueCommentClient type. -type APIIssueCommentClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, parameters apimanagement.IssueCommentContract, ifMatch string) (result apimanagement.IssueCommentContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result apimanagement.IssueCommentContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, commentID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result apimanagement.IssueCommentCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result apimanagement.IssueCommentCollectionIterator, err error) -} - -var _ APIIssueCommentClientAPI = (*apimanagement.APIIssueCommentClient)(nil) - -// APIIssueAttachmentClientAPI contains the set of methods on the APIIssueAttachmentClient type. -type APIIssueAttachmentClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, parameters apimanagement.IssueAttachmentContract, ifMatch string) (result apimanagement.IssueAttachmentContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result apimanagement.IssueAttachmentContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, attachmentID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result apimanagement.IssueAttachmentCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, issueID string, filter string, top *int32, skip *int32) (result apimanagement.IssueAttachmentCollectionIterator, err error) -} - -var _ APIIssueAttachmentClientAPI = (*apimanagement.APIIssueAttachmentClient)(nil) - -// APITagDescriptionClientAPI contains the set of methods on the APITagDescriptionClient type. -type APITagDescriptionClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, parameters apimanagement.TagDescriptionCreateParameters, ifMatch string) (result apimanagement.TagDescriptionContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (result apimanagement.TagDescriptionContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.TagDescriptionCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result apimanagement.TagDescriptionCollectionIterator, err error) -} - -var _ APITagDescriptionClientAPI = (*apimanagement.APITagDescriptionClient)(nil) - -// OperationClientAPI contains the set of methods on the OperationClient type. -type OperationClientAPI interface { - ListByTags(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result apimanagement.TagResourceCollectionPage, err error) - ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result apimanagement.TagResourceCollectionIterator, err error) -} - -var _ OperationClientAPI = (*apimanagement.OperationClient)(nil) - -// APIVersionSetClientAPI contains the set of methods on the APIVersionSetClient type. -type APIVersionSetClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters apimanagement.APIVersionSetContract, ifMatch string) (result apimanagement.APIVersionSetContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result apimanagement.APIVersionSetContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.APIVersionSetCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.APIVersionSetCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters apimanagement.APIVersionSetUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ APIVersionSetClientAPI = (*apimanagement.APIVersionSetClient)(nil) - -// AuthorizationServerClientAPI contains the set of methods on the AuthorizationServerClient type. -type AuthorizationServerClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters apimanagement.AuthorizationServerContract, ifMatch string) (result apimanagement.AuthorizationServerContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, authsid string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result apimanagement.AuthorizationServerContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.AuthorizationServerCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.AuthorizationServerCollectionIterator, err error) - ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result apimanagement.ClientSecretContract, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters apimanagement.AuthorizationServerUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ AuthorizationServerClientAPI = (*apimanagement.AuthorizationServerClient)(nil) - -// BackendClientAPI contains the set of methods on the BackendClient type. -type BackendClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters apimanagement.BackendContract, ifMatch string) (result apimanagement.BackendContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, backendID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result apimanagement.BackendContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.BackendCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.BackendCollectionIterator, err error) - Reconnect(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters *apimanagement.BackendReconnectContract) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters apimanagement.BackendUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ BackendClientAPI = (*apimanagement.BackendClient)(nil) - -// CacheClientAPI contains the set of methods on the CacheClient type. -type CacheClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters apimanagement.CacheContract, ifMatch string) (result apimanagement.CacheContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result apimanagement.CacheContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.CacheCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.CacheCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters apimanagement.CacheUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ CacheClientAPI = (*apimanagement.CacheClient)(nil) - -// CertificateClientAPI contains the set of methods on the CertificateClient type. -type CertificateClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, parameters apimanagement.CertificateCreateOrUpdateParameters, ifMatch string) (result apimanagement.CertificateContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result apimanagement.CertificateContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.CertificateCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.CertificateCollectionIterator, err error) -} - -var _ CertificateClientAPI = (*apimanagement.CertificateClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result apimanagement.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result apimanagement.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*apimanagement.OperationsClient)(nil) - -// ServiceSkusClientAPI contains the set of methods on the ServiceSkusClient type. -type ServiceSkusClientAPI interface { - ListAvailableServiceSkus(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ResourceSkuResultsPage, err error) - ListAvailableServiceSkusComplete(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ResourceSkuResultsIterator, err error) -} - -var _ ServiceSkusClientAPI = (*apimanagement.ServiceSkusClient)(nil) - -// ServiceClientAPI contains the set of methods on the ServiceClient type. -type ServiceClientAPI interface { - ApplyNetworkConfigurationUpdates(ctx context.Context, resourceGroupName string, serviceName string, parameters *apimanagement.ServiceApplyNetworkConfigurationParameters) (result apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture, err error) - Backup(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceBackupRestoreParameters) (result apimanagement.ServiceBackupFuture, err error) - CheckNameAvailability(ctx context.Context, parameters apimanagement.ServiceCheckNameAvailabilityParameters) (result apimanagement.ServiceNameAvailabilityResult, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceResource) (result apimanagement.ServiceCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ServiceDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ServiceResource, err error) - GetSsoToken(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ServiceGetSsoTokenResult, err error) - List(ctx context.Context) (result apimanagement.ServiceListResultPage, err error) - ListComplete(ctx context.Context) (result apimanagement.ServiceListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result apimanagement.ServiceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result apimanagement.ServiceListResultIterator, err error) - Restore(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceBackupRestoreParameters) (result apimanagement.ServiceRestoreFuture, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.ServiceUpdateParameters) (result apimanagement.ServiceUpdateFuture, err error) -} - -var _ ServiceClientAPI = (*apimanagement.ServiceClient)(nil) - -// DiagnosticClientAPI contains the set of methods on the DiagnosticClient type. -type DiagnosticClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters apimanagement.DiagnosticContract, ifMatch string) (result apimanagement.DiagnosticContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result apimanagement.DiagnosticContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.DiagnosticCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.DiagnosticCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters apimanagement.DiagnosticContract, ifMatch string) (result autorest.Response, err error) -} - -var _ DiagnosticClientAPI = (*apimanagement.DiagnosticClient)(nil) - -// EmailTemplateClientAPI contains the set of methods on the EmailTemplateClient type. -type EmailTemplateClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName, parameters apimanagement.EmailTemplateUpdateParameters, ifMatch string) (result apimanagement.EmailTemplateContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName) (result apimanagement.EmailTemplateContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.EmailTemplateCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.EmailTemplateCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, templateName apimanagement.TemplateName, parameters apimanagement.EmailTemplateUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ EmailTemplateClientAPI = (*apimanagement.EmailTemplateClient)(nil) - -// GatewayClientAPI contains the set of methods on the GatewayClient type. -type GatewayClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters apimanagement.GatewayContract, ifMatch string) (result apimanagement.GatewayContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, ifMatch string) (result autorest.Response, err error) - GenerateToken(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters apimanagement.GatewayTokenRequestContract) (result apimanagement.GatewayTokenContract, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (result apimanagement.GatewayContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.GatewayCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.GatewayCollectionIterator, err error) - ListKeys(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (result apimanagement.GatewayKeysContract, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters apimanagement.GatewayKeyRegenerationRequestContract) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters apimanagement.GatewayContract, ifMatch string) (result autorest.Response, err error) -} - -var _ GatewayClientAPI = (*apimanagement.GatewayClient)(nil) - -// GatewayHostnameConfigurationClientAPI contains the set of methods on the GatewayHostnameConfigurationClient type. -type GatewayHostnameConfigurationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string, parameters apimanagement.GatewayHostnameConfigurationContract) (result apimanagement.GatewayHostnameConfigurationContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (result apimanagement.GatewayHostnameConfigurationContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (result apimanagement.GatewayHostnameConfigurationCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (result apimanagement.GatewayHostnameConfigurationCollectionIterator, err error) -} - -var _ GatewayHostnameConfigurationClientAPI = (*apimanagement.GatewayHostnameConfigurationClient)(nil) - -// GatewayAPIClientAPI contains the set of methods on the GatewayAPIClient type. -type GatewayAPIClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string, parameters *apimanagement.AssociationContract) (result apimanagement.APIContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (result autorest.Response, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (result apimanagement.APICollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (result apimanagement.APICollectionIterator, err error) -} - -var _ GatewayAPIClientAPI = (*apimanagement.GatewayAPIClient)(nil) - -// GroupClientAPI contains the set of methods on the GroupClient type. -type GroupClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters apimanagement.GroupCreateParameters, ifMatch string) (result apimanagement.GroupContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result apimanagement.GroupContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters apimanagement.GroupUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ GroupClientAPI = (*apimanagement.GroupClient)(nil) - -// GroupUserClientAPI contains the set of methods on the GroupUserClient type. -type GroupUserClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) - Create(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result apimanagement.UserContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) - List(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result apimanagement.UserCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result apimanagement.UserCollectionIterator, err error) -} - -var _ GroupUserClientAPI = (*apimanagement.GroupUserClient)(nil) - -// IdentityProviderClientAPI contains the set of methods on the IdentityProviderClient type. -type IdentityProviderClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType, parameters apimanagement.IdentityProviderCreateContract, ifMatch string) (result apimanagement.IdentityProviderContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType) (result apimanagement.IdentityProviderContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.IdentityProviderListPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.IdentityProviderListIterator, err error) - ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType) (result apimanagement.ClientSecretContract, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName apimanagement.IdentityProviderType, parameters apimanagement.IdentityProviderUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ IdentityProviderClientAPI = (*apimanagement.IdentityProviderClient)(nil) - -// IssueClientAPI contains the set of methods on the IssueClient type. -type IssueClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string, issueID string) (result apimanagement.IssueContract, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.IssueCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.IssueCollectionIterator, err error) -} - -var _ IssueClientAPI = (*apimanagement.IssueClient)(nil) - -// LoggerClientAPI contains the set of methods on the LoggerClient type. -type LoggerClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters apimanagement.LoggerContract, ifMatch string) (result apimanagement.LoggerContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, ifMatch string, force *bool) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result apimanagement.LoggerContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.LoggerCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.LoggerCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters apimanagement.LoggerUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ LoggerClientAPI = (*apimanagement.LoggerClient)(nil) - -// NetworkStatusClientAPI contains the set of methods on the NetworkStatusClient type. -type NetworkStatusClientAPI interface { - ListByLocation(ctx context.Context, resourceGroupName string, serviceName string, locationName string) (result apimanagement.NetworkStatusContract, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.ListNetworkStatusContractByLocation, err error) -} - -var _ NetworkStatusClientAPI = (*apimanagement.NetworkStatusClient)(nil) - -// NotificationClientAPI contains the set of methods on the NotificationClient type. -type NotificationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, ifMatch string) (result apimanagement.NotificationContract, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName) (result apimanagement.NotificationContract, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.NotificationCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result apimanagement.NotificationCollectionIterator, err error) -} - -var _ NotificationClientAPI = (*apimanagement.NotificationClient)(nil) - -// NotificationRecipientUserClientAPI contains the set of methods on the NotificationRecipientUserClient type. -type NotificationRecipientUserClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, userID string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, userID string) (result apimanagement.RecipientUserContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, userID string) (result autorest.Response, err error) - ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName) (result apimanagement.RecipientUserCollection, err error) -} - -var _ NotificationRecipientUserClientAPI = (*apimanagement.NotificationRecipientUserClient)(nil) - -// NotificationRecipientEmailClientAPI contains the set of methods on the NotificationRecipientEmailClient type. -type NotificationRecipientEmailClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, email string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, email string) (result apimanagement.RecipientEmailContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName, email string) (result autorest.Response, err error) - ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName apimanagement.NotificationName) (result apimanagement.RecipientEmailCollection, err error) -} - -var _ NotificationRecipientEmailClientAPI = (*apimanagement.NotificationRecipientEmailClient)(nil) - -// OpenIDConnectProviderClientAPI contains the set of methods on the OpenIDConnectProviderClient type. -type OpenIDConnectProviderClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters apimanagement.OpenidConnectProviderContract, ifMatch string) (result apimanagement.OpenidConnectProviderContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, opid string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result apimanagement.OpenidConnectProviderContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.OpenIDConnectProviderCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.OpenIDConnectProviderCollectionIterator, err error) - ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result apimanagement.ClientSecretContract, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters apimanagement.OpenidConnectProviderUpdateContract, ifMatch string) (result autorest.Response, err error) -} - -var _ OpenIDConnectProviderClientAPI = (*apimanagement.OpenIDConnectProviderClient)(nil) - -// PolicyClientAPI contains the set of methods on the PolicyClient type. -type PolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PolicyContract, ifMatch string) (result apimanagement.PolicyContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, formatParameter apimanagement.PolicyExportFormat) (result apimanagement.PolicyContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PolicyCollection, err error) -} - -var _ PolicyClientAPI = (*apimanagement.PolicyClient)(nil) - -// PolicyDescriptionClientAPI contains the set of methods on the PolicyDescriptionClient type. -type PolicyDescriptionClientAPI interface { - ListByService(ctx context.Context, resourceGroupName string, serviceName string, scope apimanagement.PolicyScopeContract) (result apimanagement.PolicyDescriptionCollection, err error) -} - -var _ PolicyDescriptionClientAPI = (*apimanagement.PolicyDescriptionClient)(nil) - -// SignInSettingsClientAPI contains the set of methods on the SignInSettingsClient type. -type SignInSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalSigninSettings, ifMatch string) (result apimanagement.PortalSigninSettings, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PortalSigninSettings, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalSigninSettings, ifMatch string) (result autorest.Response, err error) -} - -var _ SignInSettingsClientAPI = (*apimanagement.SignInSettingsClient)(nil) - -// SignUpSettingsClientAPI contains the set of methods on the SignUpSettingsClient type. -type SignUpSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalSignupSettings, ifMatch string) (result apimanagement.PortalSignupSettings, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PortalSignupSettings, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalSignupSettings, ifMatch string) (result autorest.Response, err error) -} - -var _ SignUpSettingsClientAPI = (*apimanagement.SignUpSettingsClient)(nil) - -// DelegationSettingsClientAPI contains the set of methods on the DelegationSettingsClient type. -type DelegationSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalDelegationSettings, ifMatch string) (result apimanagement.PortalDelegationSettings, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PortalDelegationSettings, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - ListSecrets(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.PortalSettingValidationKeyContract, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.PortalDelegationSettings, ifMatch string) (result autorest.Response, err error) -} - -var _ DelegationSettingsClientAPI = (*apimanagement.DelegationSettingsClient)(nil) - -// ProductClientAPI contains the set of methods on the ProductClient type. -type ProductClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters apimanagement.ProductContract, ifMatch string) (result apimanagement.ProductContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result apimanagement.ProductContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result apimanagement.ProductCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result apimanagement.ProductCollectionIterator, err error) - ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result apimanagement.TagResourceCollectionPage, err error) - ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result apimanagement.TagResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters apimanagement.ProductUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ ProductClientAPI = (*apimanagement.ProductClient)(nil) - -// ProductAPIClientAPI contains the set of methods on the ProductAPIClient type. -type ProductAPIClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result apimanagement.APIContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.APICollectionPage, err error) - ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.APICollectionIterator, err error) -} - -var _ ProductAPIClientAPI = (*apimanagement.ProductAPIClient)(nil) - -// ProductGroupClientAPI contains the set of methods on the ProductGroupClient type. -type ProductGroupClientAPI interface { - CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result apimanagement.GroupContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionPage, err error) - ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionIterator, err error) -} - -var _ ProductGroupClientAPI = (*apimanagement.ProductGroupClient)(nil) - -// ProductSubscriptionsClientAPI contains the set of methods on the ProductSubscriptionsClient type. -type ProductSubscriptionsClientAPI interface { - List(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionIterator, err error) -} - -var _ ProductSubscriptionsClientAPI = (*apimanagement.ProductSubscriptionsClient)(nil) - -// ProductPolicyClientAPI contains the set of methods on the ProductPolicyClient type. -type ProductPolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters apimanagement.PolicyContract, ifMatch string) (result apimanagement.PolicyContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, productID string, formatParameter apimanagement.PolicyExportFormat) (result apimanagement.PolicyContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result apimanagement.PolicyCollection, err error) -} - -var _ ProductPolicyClientAPI = (*apimanagement.ProductPolicyClient)(nil) - -// NamedValueClientAPI contains the set of methods on the NamedValueClient type. -type NamedValueClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters apimanagement.NamedValueCreateContract, ifMatch string) (result apimanagement.NamedValueCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result apimanagement.NamedValueContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result autorest.Response, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.NamedValueCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.NamedValueCollectionIterator, err error) - ListValue(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result apimanagement.PropertyValueContract, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters apimanagement.NamedValueUpdateParameters, ifMatch string) (result apimanagement.NamedValueUpdateFuture, err error) -} - -var _ NamedValueClientAPI = (*apimanagement.NamedValueClient)(nil) - -// QuotaByCounterKeysClientAPI contains the set of methods on the QuotaByCounterKeysClient type. -type QuotaByCounterKeysClientAPI interface { - ListByService(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string) (result apimanagement.QuotaCounterCollection, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, parameters apimanagement.QuotaCounterValueContractProperties) (result autorest.Response, err error) -} - -var _ QuotaByCounterKeysClientAPI = (*apimanagement.QuotaByCounterKeysClient)(nil) - -// QuotaByPeriodKeysClientAPI contains the set of methods on the QuotaByPeriodKeysClient type. -type QuotaByPeriodKeysClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (result apimanagement.QuotaCounterContract, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters apimanagement.QuotaCounterValueContractProperties) (result autorest.Response, err error) -} - -var _ QuotaByPeriodKeysClientAPI = (*apimanagement.QuotaByPeriodKeysClient)(nil) - -// RegionClientAPI contains the set of methods on the RegionClient type. -type RegionClientAPI interface { - ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.RegionListResultPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.RegionListResultIterator, err error) -} - -var _ RegionClientAPI = (*apimanagement.RegionClient)(nil) - -// ReportsClientAPI contains the set of methods on the ReportsClient type. -type ReportsClientAPI interface { - ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionPage, err error) - ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionIterator, err error) - ListByGeo(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionPage, err error) - ListByGeoComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.ReportCollectionIterator, err error) - ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionPage, err error) - ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionIterator, err error) - ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionPage, err error) - ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionIterator, err error) - ListByRequest(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.RequestReportCollection, err error) - ListBySubscription(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionIterator, err error) - ListByTime(ctx context.Context, resourceGroupName string, serviceName string, filter string, interval string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionPage, err error) - ListByTimeComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, interval string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionIterator, err error) - ListByUser(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionPage, err error) - ListByUserComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result apimanagement.ReportCollectionIterator, err error) -} - -var _ ReportsClientAPI = (*apimanagement.ReportsClient)(nil) - -// SubscriptionClientAPI contains the set of methods on the SubscriptionClient type. -type SubscriptionClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters apimanagement.SubscriptionCreateParameters, notify *bool, ifMatch string) (result apimanagement.SubscriptionContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, sid string, ifMatch string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result apimanagement.SubscriptionContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) - List(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionIterator, err error) - ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result apimanagement.SubscriptionKeysContract, err error) - RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) - RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters apimanagement.SubscriptionUpdateParameters, ifMatch string, notify *bool) (result autorest.Response, err error) -} - -var _ SubscriptionClientAPI = (*apimanagement.SubscriptionClient)(nil) - -// TagResourceClientAPI contains the set of methods on the TagResourceClient type. -type TagResourceClientAPI interface { - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.TagResourceCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result apimanagement.TagResourceCollectionIterator, err error) -} - -var _ TagResourceClientAPI = (*apimanagement.TagResourceClient)(nil) - -// TenantAccessClientAPI contains the set of methods on the TenantAccessClient type. -type TenantAccessClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.AccessInformationContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - ListSecrets(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.AccessInformationContract, err error) - RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.AccessInformationUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ TenantAccessClientAPI = (*apimanagement.TenantAccessClient)(nil) - -// TenantAccessGitClientAPI contains the set of methods on the TenantAccessGitClient type. -type TenantAccessGitClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.AccessInformationContract, err error) - ListSecrets(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.AccessInformationContract, err error) - RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) - RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) -} - -var _ TenantAccessGitClientAPI = (*apimanagement.TenantAccessGitClient)(nil) - -// TenantConfigurationClientAPI contains the set of methods on the TenantConfigurationClient type. -type TenantConfigurationClientAPI interface { - Deploy(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.DeployConfigurationParameters) (result apimanagement.TenantConfigurationDeployFuture, err error) - GetSyncState(ctx context.Context, resourceGroupName string, serviceName string) (result apimanagement.TenantConfigurationSyncStateContract, err error) - Save(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.SaveConfigurationParameter) (result apimanagement.TenantConfigurationSaveFuture, err error) - Validate(ctx context.Context, resourceGroupName string, serviceName string, parameters apimanagement.DeployConfigurationParameters) (result apimanagement.TenantConfigurationValidateFuture, err error) -} - -var _ TenantConfigurationClientAPI = (*apimanagement.TenantConfigurationClient)(nil) - -// UserClientAPI contains the set of methods on the UserClient type. -type UserClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters apimanagement.UserCreateParameters, ifMatch string) (result apimanagement.UserContract, err error) - Delete(ctx context.Context, resourceGroupName string, serviceName string, userID string, ifMatch string, deleteSubscriptions *bool, notify *bool) (result autorest.Response, err error) - GenerateSsoURL(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result apimanagement.GenerateSsoURLResult, err error) - Get(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result apimanagement.UserContract, err error) - GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result autorest.Response, err error) - GetSharedAccessToken(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters apimanagement.UserTokenParameters) (result apimanagement.UserTokenResult, err error) - ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result apimanagement.UserCollectionPage, err error) - ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result apimanagement.UserCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters apimanagement.UserUpdateParameters, ifMatch string) (result autorest.Response, err error) -} - -var _ UserClientAPI = (*apimanagement.UserClient)(nil) - -// UserGroupClientAPI contains the set of methods on the UserGroupClient type. -type UserGroupClientAPI interface { - List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result apimanagement.GroupCollectionIterator, err error) -} - -var _ UserGroupClientAPI = (*apimanagement.UserGroupClient)(nil) - -// UserSubscriptionClientAPI contains the set of methods on the UserSubscriptionClient type. -type UserSubscriptionClientAPI interface { - List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result apimanagement.SubscriptionCollectionIterator, err error) -} - -var _ UserSubscriptionClientAPI = (*apimanagement.UserSubscriptionClient)(nil) - -// UserIdentitiesClientAPI contains the set of methods on the UserIdentitiesClient type. -type UserIdentitiesClientAPI interface { - List(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result apimanagement.UserIdentityCollectionPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result apimanagement.UserIdentityCollectionIterator, err error) -} - -var _ UserIdentitiesClientAPI = (*apimanagement.UserIdentitiesClient)(nil) - -// UserConfirmationPasswordClientAPI contains the set of methods on the UserConfirmationPasswordClient type. -type UserConfirmationPasswordClientAPI interface { - SendMethod(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result autorest.Response, err error) -} - -var _ UserConfirmationPasswordClientAPI = (*apimanagement.UserConfirmationPasswordClient)(nil) - -// APIExportClientAPI contains the set of methods on the APIExportClient type. -type APIExportClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter apimanagement.ExportFormat) (result apimanagement.APIExportResult, err error) -} - -var _ APIExportClientAPI = (*apimanagement.APIExportClient)(nil) diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apioperation.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apioperation.go deleted file mode 100644 index 3499c5c1da26..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apioperation.go +++ /dev/null @@ -1,704 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIOperationClient is the apiManagement Client -type APIOperationClient struct { - BaseClient -} - -// NewAPIOperationClient creates an instance of the APIOperationClient client. -func NewAPIOperationClient(subscriptionID string) APIOperationClient { - return NewAPIOperationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIOperationClientWithBaseURI creates an instance of the APIOperationClient 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 NewAPIOperationClientWithBaseURI(baseURI string, subscriptionID string) APIOperationClient { - return APIOperationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new operation in the API or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIOperationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationContract, ifMatch string) (result OperationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.OperationContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.OperationContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.OperationContractProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.OperationContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.OperationContractProperties.Method", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.OperationContractProperties.URLTemplate", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.OperationContractProperties.URLTemplate", Name: validation.MaxLength, Rule: 1000, Chain: nil}, - {Target: "parameters.OperationContractProperties.URLTemplate", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIOperationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) 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 APIOperationClient) CreateOrUpdateResponder(resp *http.Response) (result OperationContract, 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 specified operation in the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIOperationClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIOperationClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIOperationClient) 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 APIOperationClient) 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 details of the API Operation specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result OperationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIOperationClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{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 APIOperationClient) 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 APIOperationClient) GetResponder(resp *http.Response) (result OperationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API operation specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIOperationClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIOperationClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI lists a collection of the operations for the specified API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| method | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -// tags - include tags in the response. -func (client APIOperationClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result OperationCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.ListByAPI") - defer func() { - sc := -1 - if result.oc.Response.Response != nil { - sc = result.oc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, tags) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.oc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.oc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.oc.hasNextLink() && result.oc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client APIOperationClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if 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.ApiManagement/service/{serviceName}/apis/{apiId}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client APIOperationClient) ListByAPIResponder(resp *http.Response) (result OperationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client APIOperationClient) listByAPINextResults(ctx context.Context, lastResults OperationCollection) (result OperationCollection, err error) { - req, err := lastResults.operationCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIOperationClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, tags string) (result OperationCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.ListByAPI") - 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.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, tags) - return -} - -// Update updates the details of the operation in the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// parameters - API Operation Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIOperationClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIOperationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters OperationUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIOperationClient) 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 APIOperationClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apioperationpolicy.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apioperationpolicy.go deleted file mode 100644 index fccd61c52715..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apioperationpolicy.go +++ /dev/null @@ -1,540 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIOperationPolicyClient is the apiManagement Client -type APIOperationPolicyClient struct { - BaseClient -} - -// NewAPIOperationPolicyClient creates an instance of the APIOperationPolicyClient client. -func NewAPIOperationPolicyClient(subscriptionID string) APIOperationPolicyClient { - return NewAPIOperationPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIOperationPolicyClientWithBaseURI creates an instance of the APIOperationPolicyClient 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 NewAPIOperationPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIOperationPolicyClient { - return APIOperationPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the API Operation level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIOperationPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIOperationPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) 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 APIOperationPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, 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 policy configuration at the Api Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIOperationPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, operationID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIOperationPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIOperationPolicyClient) 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 APIOperationPolicyClient) 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 the policy configuration at the API Operation level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// formatParameter - policy Export Format. -func (client APIOperationPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, formatParameter PolicyExportFormat) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIOperationPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, formatParameter PolicyExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(formatParameter)) > 0 { - queryParameters["format"] = autorest.Encode("query", formatParameter) - } else { - queryParameters["format"] = autorest.Encode("query", "xml") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", 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 APIOperationPolicyClient) 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 APIOperationPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API operation policy specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIOperationPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIOperationPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByOperation get the list of policy configuration at the API Operation level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -func (client APIOperationPolicyClient) ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationPolicyClient.ListByOperation") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIOperationPolicyClient", "ListByOperation", err.Error()) - } - - req, err := client.ListByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "ListByOperation", resp, "Failure sending request") - return - } - - result, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationPolicyClient", "ListByOperation", resp, "Failure responding to request") - return - } - - return -} - -// ListByOperationPreparer prepares the ListByOperation request. -func (client APIOperationPolicyClient) ListByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByOperationSender sends the ListByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationPolicyClient) ListByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByOperationResponder handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (client APIOperationPolicyClient) ListByOperationResponder(resp *http.Response) (result PolicyCollection, 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/apimanagement/mgmt/2019-12-01-preview/apimanagement/apipolicy.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apipolicy.go deleted file mode 100644 index 97783a85e40d..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apipolicy.go +++ /dev/null @@ -1,509 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIPolicyClient is the apiManagement Client -type APIPolicyClient struct { - BaseClient -} - -// NewAPIPolicyClient creates an instance of the APIPolicyClient client. -func NewAPIPolicyClient(subscriptionID string) APIPolicyClient { - return NewAPIPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIPolicyClientWithBaseURI creates an instance of the APIPolicyClient 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 NewAPIPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIPolicyClient { - return APIPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) 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 APIPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, 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 policy configuration at the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIPolicyClient) 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 APIPolicyClient) 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 the policy configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// formatParameter - policy Export Format. -func (client APIPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter PolicyExportFormat) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, formatParameter PolicyExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(formatParameter)) > 0 { - queryParameters["format"] = autorest.Encode("query", formatParameter) - } else { - queryParameters["format"] = autorest.Encode("query", "xml") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", 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 APIPolicyClient) 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 APIPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the API policy specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI get the policy configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client APIPolicyClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPolicyClient.ListByAPI") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIPolicyClient", "ListByAPI", err.Error()) - } - - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "ListByAPI", resp, "Failure sending request") - return - } - - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "ListByAPI", resp, "Failure responding to request") - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client APIPolicyClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) ListByAPIResponder(resp *http.Response) (result PolicyCollection, 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/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiproduct.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiproduct.go deleted file mode 100644 index 0ff9ad0181d7..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiproduct.go +++ /dev/null @@ -1,183 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIProductClient is the apiManagement Client -type APIProductClient struct { - BaseClient -} - -// NewAPIProductClient creates an instance of the APIProductClient client. -func NewAPIProductClient(subscriptionID string) APIProductClient { - return NewAPIProductClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIProductClientWithBaseURI creates an instance of the APIProductClient 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 NewAPIProductClientWithBaseURI(baseURI string, subscriptionID string) APIProductClient { - return APIProductClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByApis lists all Products, which the API is part of. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIProductClient) ListByApis(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result ProductCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIProductClient.ListByApis") - defer func() { - sc := -1 - if result.pc.Response.Response != nil { - sc = result.pc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIProductClient", "ListByApis", err.Error()) - } - - result.fn = client.listByApisNextResults - req, err := client.ListByApisPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "ListByApis", nil, "Failure preparing request") - return - } - - resp, err := client.ListByApisSender(req) - if err != nil { - result.pc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "ListByApis", resp, "Failure sending request") - return - } - - result.pc, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "ListByApis", resp, "Failure responding to request") - return - } - if result.pc.hasNextLink() && result.pc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByApisPreparer prepares the ListByApis request. -func (client APIProductClient) ListByApisPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/products", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByApisSender sends the ListByApis request. The method will close the -// http.Response Body if it receives an error. -func (client APIProductClient) ListByApisSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByApisResponder handles the response to the ListByApis request. The method always -// closes the http.Response Body. -func (client APIProductClient) ListByApisResponder(resp *http.Response) (result ProductCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByApisNextResults retrieves the next set of results, if any. -func (client APIProductClient) listByApisNextResults(ctx context.Context, lastResults ProductCollection) (result ProductCollection, err error) { - req, err := lastResults.productCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "listByApisNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByApisSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "listByApisNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductClient", "listByApisNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByApisComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIProductClient) ListByApisComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result ProductCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIProductClient.ListByApis") - 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.ListByApis(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apirelease.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apirelease.go deleted file mode 100644 index 51796c6a066d..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apirelease.go +++ /dev/null @@ -1,674 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIReleaseClient is the apiManagement Client -type APIReleaseClient struct { - BaseClient -} - -// NewAPIReleaseClient creates an instance of the APIReleaseClient client. -func NewAPIReleaseClient(subscriptionID string) APIReleaseClient { - return NewAPIReleaseClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIReleaseClientWithBaseURI creates an instance of the APIReleaseClient 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 NewAPIReleaseClientWithBaseURI(baseURI string, subscriptionID string) APIReleaseClient { - return APIReleaseClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Release for the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIReleaseClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (result APIReleaseContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, releaseID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIReleaseClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) 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 APIReleaseClient) CreateOrUpdateResponder(resp *http.Response) (result APIReleaseContract, 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 specified release in the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIReleaseClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, releaseID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIReleaseClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIReleaseClient) 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 APIReleaseClient) 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 details of an API release. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -func (client APIReleaseClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result APIReleaseContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, releaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIReleaseClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", 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 APIReleaseClient) 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 APIReleaseClient) GetResponder(resp *http.Response) (result APIReleaseContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag returns the etag of an API release. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -func (client APIReleaseClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, releaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIReleaseClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIReleaseClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all releases of an API. An API release is created when making an API Revision current. Releases -// are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip -// parameters. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| notes | filter | ge, le, eq, ne, gt, -// lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIReleaseClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIReleaseCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.ListByService") - defer func() { - sc := -1 - if result.arc.Response.Response != nil { - sc = result.arc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.arc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "ListByService", resp, "Failure sending request") - return - } - - result.arc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "ListByService", resp, "Failure responding to request") - return - } - if result.arc.hasNextLink() && result.arc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIReleaseClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/releases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIReleaseClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIReleaseClient) ListByServiceResponder(resp *http.Response) (result APIReleaseCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIReleaseClient) listByServiceNextResults(ctx context.Context, lastResults APIReleaseCollection) (result APIReleaseCollection, err error) { - req, err := lastResults.aPIReleaseCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIReleaseClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIReleaseCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} - -// Update updates the details of the release of the API specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// releaseID - release identifier within an API. Must be unique in the current API Management service instance. -// parameters - API Release Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIReleaseClient) Update(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: releaseID, - Constraints: []validation.Constraint{{Target: "releaseID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "releaseID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "releaseID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIReleaseClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, apiid, releaseID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIReleaseClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIReleaseClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, releaseID string, parameters APIReleaseContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "releaseId": autorest.Encode("path", releaseID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIReleaseClient) 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 APIReleaseClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apirevision.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apirevision.go deleted file mode 100644 index d5042594fc5e..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apirevision.go +++ /dev/null @@ -1,183 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIRevisionClient is the apiManagement Client -type APIRevisionClient struct { - BaseClient -} - -// NewAPIRevisionClient creates an instance of the APIRevisionClient client. -func NewAPIRevisionClient(subscriptionID string) APIRevisionClient { - return NewAPIRevisionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIRevisionClientWithBaseURI creates an instance of the APIRevisionClient 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 NewAPIRevisionClientWithBaseURI(baseURI string, subscriptionID string) APIRevisionClient { - return APIRevisionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all revisions of an API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| apiRevision | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APIRevisionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIRevisionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionClient.ListByService") - defer func() { - sc := -1 - if result.arc.Response.Response != nil { - sc = result.arc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIRevisionClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.arc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "ListByService", resp, "Failure sending request") - return - } - - result.arc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "ListByService", resp, "Failure responding to request") - return - } - if result.arc.hasNextLink() && result.arc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIRevisionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/revisions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIRevisionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIRevisionClient) ListByServiceResponder(resp *http.Response) (result APIRevisionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIRevisionClient) listByServiceNextResults(ctx context.Context, lastResults APIRevisionCollection) (result APIRevisionCollection, err error) { - req, err := lastResults.aPIRevisionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIRevisionClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIRevisionClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result APIRevisionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apischema.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apischema.go deleted file mode 100644 index f78808cc9e84..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apischema.go +++ /dev/null @@ -1,592 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APISchemaClient is the apiManagement Client -type APISchemaClient struct { - BaseClient -} - -// NewAPISchemaClient creates an instance of the APISchemaClient client. -func NewAPISchemaClient(subscriptionID string) APISchemaClient { - return NewAPISchemaClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPISchemaClientWithBaseURI creates an instance of the APISchemaClient 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 NewAPISchemaClientWithBaseURI(baseURI string, subscriptionID string) APISchemaClient { - return APISchemaClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates schema configuration for the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -// parameters - the schema contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APISchemaClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaContract, ifMatch string) (result APISchemaCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SchemaContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SchemaContractProperties.ContentType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, schemaID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APISchemaClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) CreateOrUpdateSender(req *http.Request) (future APISchemaCreateOrUpdateFuture, 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 APISchemaClient) CreateOrUpdateResponder(resp *http.Response) (result SchemaContract, 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 the schema configuration at the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// force - if true removes all references to the schema before deleting it. -func (client APISchemaClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, ifMatch string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, schemaID, ifMatch, force) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APISchemaClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, ifMatch string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APISchemaClient) 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 APISchemaClient) 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 the schema configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -func (client APISchemaClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result SchemaContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, schemaID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APISchemaClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", 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 APISchemaClient) 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 APISchemaClient) GetResponder(resp *http.Response) (result SchemaContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the schema specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// schemaID - schema identifier within an API. Must be unique in the current API Management service instance. -func (client APISchemaClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: schemaID, - Constraints: []validation.Constraint{{Target: "schemaID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, schemaID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APISchemaClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaId": autorest.Encode("path", schemaID), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APISchemaClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI get the schema configuration at the API level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| contentType | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APISchemaClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result SchemaCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.ListByAPI") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APISchemaClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.sc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client APISchemaClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/schemas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client APISchemaClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client APISchemaClient) ListByAPIResponder(resp *http.Response) (result SchemaCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client APISchemaClient) listByAPINextResults(ctx context.Context, lastResults SchemaCollection) (result SchemaCollection, err error) { - req, err := lastResults.schemaCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client APISchemaClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result SchemaCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.ListByAPI") - 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.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apitagdescription.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apitagdescription.go deleted file mode 100644 index 9f88b759bbd0..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apitagdescription.go +++ /dev/null @@ -1,594 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APITagDescriptionClient is the apiManagement Client -type APITagDescriptionClient struct { - BaseClient -} - -// NewAPITagDescriptionClient creates an instance of the APITagDescriptionClient client. -func NewAPITagDescriptionClient(subscriptionID string) APITagDescriptionClient { - return NewAPITagDescriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPITagDescriptionClientWithBaseURI creates an instance of the APITagDescriptionClient 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 NewAPITagDescriptionClientWithBaseURI(baseURI string, subscriptionID string) APITagDescriptionClient { - return APITagDescriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create/Update tag description in scope of the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagDescriptionID - tag description identifier. Used when creating tagDescription for API/Tag association. -// Based on API and Tag names. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APITagDescriptionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, parameters TagDescriptionCreateParameters, ifMatch string) (result TagDescriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagDescriptionID, - Constraints: []validation.Constraint{{Target: "tagDescriptionID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TagDescriptionBaseProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TagDescriptionBaseProperties.ExternalDocsURL", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TagDescriptionBaseProperties.ExternalDocsURL", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, apiid, tagDescriptionID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APITagDescriptionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, parameters TagDescriptionCreateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagDescriptionId": autorest.Encode("path", tagDescriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APITagDescriptionClient) 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 APITagDescriptionClient) CreateOrUpdateResponder(resp *http.Response) (result TagDescriptionContract, 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 tag description for the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagDescriptionID - tag description identifier. Used when creating tagDescription for API/Tag association. -// Based on API and Tag names. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APITagDescriptionClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagDescriptionID, - Constraints: []validation.Constraint{{Target: "tagDescriptionID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, apiid, tagDescriptionID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APITagDescriptionClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagDescriptionId": autorest.Encode("path", tagDescriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APITagDescriptionClient) 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 APITagDescriptionClient) 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 Tag description in scope of API -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagDescriptionID - tag description identifier. Used when creating tagDescription for API/Tag association. -// Based on API and Tag names. -func (client APITagDescriptionClient) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (result TagDescriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagDescriptionID, - Constraints: []validation.Constraint{{Target: "tagDescriptionID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, apiid, tagDescriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APITagDescriptionClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagDescriptionId": autorest.Encode("path", tagDescriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", 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 APITagDescriptionClient) 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 APITagDescriptionClient) GetResponder(resp *http.Response) (result TagDescriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagDescriptionID - tag description identifier. Used when creating tagDescription for API/Tag association. -// Based on API and Tag names. -func (client APITagDescriptionClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagDescriptionID, - Constraints: []validation.Constraint{{Target: "tagDescriptionID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagDescriptionID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, apiid, tagDescriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APITagDescriptionClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagDescriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagDescriptionId": autorest.Encode("path", tagDescriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APITagDescriptionClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APITagDescriptionClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on -// API level but tag may be assigned to the Operations -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client APITagDescriptionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagDescriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.ListByService") - defer func() { - sc := -1 - if result.tdc.Response.Response != nil { - sc = result.tdc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APITagDescriptionClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.tdc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "ListByService", resp, "Failure sending request") - return - } - - result.tdc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "ListByService", resp, "Failure responding to request") - return - } - if result.tdc.hasNextLink() && result.tdc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APITagDescriptionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APITagDescriptionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APITagDescriptionClient) ListByServiceResponder(resp *http.Response) (result TagDescriptionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APITagDescriptionClient) listByServiceNextResults(ctx context.Context, lastResults TagDescriptionCollection) (result TagDescriptionCollection, err error) { - req, err := lastResults.tagDescriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APITagDescriptionClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APITagDescriptionClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagDescriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APITagDescriptionClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiversionset.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiversionset.go deleted file mode 100644 index b7b30d69e017..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/apiversionset.go +++ /dev/null @@ -1,648 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// APIVersionSetClient is the apiManagement Client -type APIVersionSetClient struct { - BaseClient -} - -// NewAPIVersionSetClient creates an instance of the APIVersionSetClient client. -func NewAPIVersionSetClient(subscriptionID string) APIVersionSetClient { - return NewAPIVersionSetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIVersionSetClientWithBaseURI creates an instance of the APIVersionSetClient 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 NewAPIVersionSetClientWithBaseURI(baseURI string, subscriptionID string) APIVersionSetClient { - return APIVersionSetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a Api Version Set. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APIVersionSetClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetContract, ifMatch string) (result APIVersionSetContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.APIVersionSetContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.APIVersionSetContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.APIVersionSetContractProperties.DisplayName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.APIVersionSetContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, versionSetID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIVersionSetClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) 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 APIVersionSetClient) CreateOrUpdateResponder(resp *http.Response) (result APIVersionSetContract, 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 specific Api Version Set. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIVersionSetClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, versionSetID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIVersionSetClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 APIVersionSetClient) 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 APIVersionSetClient) 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 details of the Api Version Set specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -func (client APIVersionSetClient) Get(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result APIVersionSetContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, versionSetID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIVersionSetClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", 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 APIVersionSetClient) 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 APIVersionSetClient) GetResponder(resp *http.Response) (result APIVersionSetContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Api Version Set specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -func (client APIVersionSetClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, versionSetID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client APIVersionSetClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of API Version Sets in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
-// top - number of records to return. -// skip - number of records to skip. -func (client APIVersionSetClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result APIVersionSetCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.ListByService") - defer func() { - sc := -1 - if result.avsc.Response.Response != nil { - sc = result.avsc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.avsc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "ListByService", resp, "Failure sending request") - return - } - - result.avsc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "ListByService", resp, "Failure responding to request") - return - } - if result.avsc.hasNextLink() && result.avsc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client APIVersionSetClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apiVersionSets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client APIVersionSetClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client APIVersionSetClient) ListByServiceResponder(resp *http.Response) (result APIVersionSetCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client APIVersionSetClient) listByServiceNextResults(ctx context.Context, lastResults APIVersionSetCollection) (result APIVersionSetCollection, err error) { - req, err := lastResults.aPIVersionSetCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client APIVersionSetClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result APIVersionSetCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the Api VersionSet specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// versionSetID - api Version Set identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client APIVersionSetClient) Update(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: versionSetID, - Constraints: []validation.Constraint{{Target: "versionSetID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "versionSetID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionSetID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.APIVersionSetClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, versionSetID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIVersionSetClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIVersionSetClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, versionSetID string, parameters APIVersionSetUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionSetId": autorest.Encode("path", versionSetID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 APIVersionSetClient) 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 APIVersionSetClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/authorizationserver.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/authorizationserver.go deleted file mode 100644 index 420b8c009b00..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/authorizationserver.go +++ /dev/null @@ -1,745 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AuthorizationServerClient is the apiManagement Client -type AuthorizationServerClient struct { - BaseClient -} - -// NewAuthorizationServerClient creates an instance of the AuthorizationServerClient client. -func NewAuthorizationServerClient(subscriptionID string) AuthorizationServerClient { - return NewAuthorizationServerClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAuthorizationServerClientWithBaseURI creates an instance of the AuthorizationServerClient 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 NewAuthorizationServerClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationServerClient { - return AuthorizationServerClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates new authorization server or updates an existing authorization server. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client AuthorizationServerClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerContract, ifMatch string) (result AuthorizationServerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AuthorizationServerContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationServerContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationServerContractProperties.DisplayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.AuthorizationServerContractProperties.ClientRegistrationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.AuthorizationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.GrantTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationServerContractProperties.ClientID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, authsid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AuthorizationServerClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) 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 AuthorizationServerClient) CreateOrUpdateResponder(resp *http.Response) (result AuthorizationServerContract, 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 specific authorization server instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client AuthorizationServerClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, authsid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, authsid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AuthorizationServerClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 AuthorizationServerClient) 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 AuthorizationServerClient) 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 details of the authorization server specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -func (client AuthorizationServerClient) Get(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result AuthorizationServerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, authsid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AuthorizationServerClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", 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 AuthorizationServerClient) 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 AuthorizationServerClient) GetResponder(resp *http.Response) (result AuthorizationServerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the authorizationServer specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -func (client AuthorizationServerClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, authsid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client AuthorizationServerClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of authorization servers defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client AuthorizationServerClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result AuthorizationServerCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.ListByService") - defer func() { - sc := -1 - if result.asc.Response.Response != nil { - sc = result.asc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.asc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListByService", resp, "Failure sending request") - return - } - - result.asc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListByService", resp, "Failure responding to request") - return - } - if result.asc.hasNextLink() && result.asc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client AuthorizationServerClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/authorizationServers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) ListByServiceResponder(resp *http.Response) (result AuthorizationServerCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client AuthorizationServerClient) listByServiceNextResults(ctx context.Context, lastResults AuthorizationServerCollection) (result AuthorizationServerCollection, err error) { - req, err := lastResults.authorizationServerCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client AuthorizationServerClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result AuthorizationServerCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListSecrets gets the client secret details of the authorization server. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -func (client AuthorizationServerClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (result ClientSecretContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.ListSecrets") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName, authsid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client AuthorizationServerClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServerClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client AuthorizationServerClient) ListSecretsResponder(resp *http.Response) (result ClientSecretContract, 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 details of the authorization server specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// authsid - identifier of the authorization server. -// parameters - oAuth2 Server settings Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client AuthorizationServerClient) Update(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "authsid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.AuthorizationServerClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, authsid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServerClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AuthorizationServerClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, authsid string, parameters AuthorizationServerUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 AuthorizationServerClient) 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 AuthorizationServerClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/backend.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/backend.go deleted file mode 100644 index 9436bda4044c..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/backend.go +++ /dev/null @@ -1,741 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BackendClient is the apiManagement Client -type BackendClient struct { - BaseClient -} - -// NewBackendClient creates an instance of the BackendClient client. -func NewBackendClient(subscriptionID string) BackendClient { - return NewBackendClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackendClientWithBaseURI creates an instance of the BackendClient 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 NewBackendClientWithBaseURI(baseURI string, subscriptionID string) BackendClient { - return BackendClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client BackendClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendContract, ifMatch string) (result BackendContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.BackendContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.BackendContractProperties.URL", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.BackendContractProperties.URL", Name: validation.MaxLength, Rule: 2000, Chain: nil}, - {Target: "parameters.BackendContractProperties.URL", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, backendID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackendClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/backends/{backendId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) 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 BackendClient) CreateOrUpdateResponder(resp *http.Response) (result BackendContract, 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 specified backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client BackendClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, backendID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, backendID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackendClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 BackendClient) 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 BackendClient) 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 details of the backend specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -func (client BackendClient) Get(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result BackendContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, backendID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackendClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/backends/{backendId}", 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 BackendClient) 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 BackendClient) GetResponder(resp *http.Response) (result BackendContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the backend specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -func (client BackendClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, backendID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client BackendClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client BackendClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of backends in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| title | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| url | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client BackendClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result BackendCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.ListByService") - defer func() { - sc := -1 - if result.bc.Response.Response != nil { - sc = result.bc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.bc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "ListByService", resp, "Failure sending request") - return - } - - result.bc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "ListByService", resp, "Failure responding to request") - return - } - if result.bc.hasNextLink() && result.bc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client BackendClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/backends", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client BackendClient) ListByServiceResponder(resp *http.Response) (result BackendCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client BackendClient) listByServiceNextResults(ctx context.Context, lastResults BackendCollection) (result BackendCollection, err error) { - req, err := lastResults.backendCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.BackendClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.BackendClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client BackendClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result BackendCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Reconnect notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no -// timeout was specified, timeout of 2 minutes is used. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// parameters - reconnect request parameters. -func (client BackendClient) Reconnect(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters *BackendReconnectContract) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.Reconnect") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Reconnect", err.Error()) - } - - req, err := client.ReconnectPreparer(ctx, resourceGroupName, serviceName, backendID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Reconnect", nil, "Failure preparing request") - return - } - - resp, err := client.ReconnectSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Reconnect", resp, "Failure sending request") - return - } - - result, err = client.ReconnectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Reconnect", resp, "Failure responding to request") - return - } - - return -} - -// ReconnectPreparer prepares the Reconnect request. -func (client BackendClient) ReconnectPreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters *BackendReconnectContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReconnectSender sends the Reconnect request. The method will close the -// http.Response Body if it receives an error. -func (client BackendClient) ReconnectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ReconnectResponder handles the response to the Reconnect request. The method always -// closes the http.Response Body. -func (client BackendClient) ReconnectResponder(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 backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// backendID - identifier of the Backend entity. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client BackendClient) Update(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendID, - Constraints: []validation.Constraint{{Target: "backendID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "backendID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.BackendClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, backendID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackendClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, backendID string, parameters BackendUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendId": autorest.Encode("path", backendID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/backends/{backendId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 BackendClient) 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 BackendClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/cache.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/cache.go deleted file mode 100644 index c35f0d4f171b..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/cache.go +++ /dev/null @@ -1,650 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CacheClient is the apiManagement Client -type CacheClient struct { - BaseClient -} - -// NewCacheClient creates an instance of the CacheClient client. -func NewCacheClient(subscriptionID string) CacheClient { - return NewCacheClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCacheClientWithBaseURI creates an instance of the CacheClient 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 NewCacheClientWithBaseURI(baseURI string, subscriptionID string) CacheClient { - return CacheClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an External Cache to be used in Api Management instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -// parameters - create or Update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client CacheClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheContract, ifMatch string) (result CacheContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CacheContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.Description", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - {Target: "parameters.CacheContractProperties.ConnectionString", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.ConnectionString", Name: validation.MaxLength, Rule: 300, Chain: nil}}}, - {Target: "parameters.CacheContractProperties.ResourceID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CacheContractProperties.ResourceID", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, cacheID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CacheClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/caches/{cacheId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) 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 CacheClient) CreateOrUpdateResponder(resp *http.Response) (result CacheContract, 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 specific Cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client CacheClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, cacheID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CacheClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 CacheClient) 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 CacheClient) 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 details of the Cache specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -func (client CacheClient) Get(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result CacheContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, cacheID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CacheClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/caches/{cacheId}", 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 CacheClient) 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 CacheClient) GetResponder(resp *http.Response) (result CacheContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Cache specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -func (client CacheClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, cacheID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client CacheClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client CacheClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of all external Caches in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// top - number of records to return. -// skip - number of records to skip. -func (client CacheClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result CacheCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.ListByService") - defer func() { - sc := -1 - if result.cc.Response.Response != nil { - sc = result.cc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.cc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "ListByService", resp, "Failure sending request") - return - } - - result.cc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "ListByService", resp, "Failure responding to request") - return - } - if result.cc.hasNextLink() && result.cc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client CacheClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/caches", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client CacheClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client CacheClient) ListByServiceResponder(resp *http.Response) (result CacheCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client CacheClient) listByServiceNextResults(ctx context.Context, lastResults CacheCollection) (result CacheCollection, err error) { - req, err := lastResults.cacheCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.CacheClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.CacheClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client CacheClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result CacheCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, top, skip) - return -} - -// Update updates the details of the cache specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// cacheID - identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region -// identifier). -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client CacheClient) Update(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: cacheID, - Constraints: []validation.Constraint{{Target: "cacheID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "cacheID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "cacheID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CacheClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, cacheID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CacheClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CacheClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, cacheID string, parameters CacheUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheId": autorest.Encode("path", cacheID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/caches/{cacheId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 CacheClient) 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 CacheClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/certificate.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/certificate.go deleted file mode 100644 index 70919d8cc3b3..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/certificate.go +++ /dev/null @@ -1,559 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 apiManagement 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)} -} - -// CreateOrUpdate creates or updates the certificate being used for authentication with the backend. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -// parameters - create or Update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client CertificateClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (result CertificateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, 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}, - {Target: "parameters.CertificateCreateOrUpdateProperties.Password", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, certificateID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/certificates/{certificateId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) 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 CertificateClient) CreateOrUpdateResponder(resp *http.Response) (result CertificateContract, 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 specific certificate. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, certificateID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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) (*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 CertificateClient) 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 details of the certificate specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result CertificateContract, 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.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, "apimanagement.CertificateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/certificates/{certificateId}", 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 CertificateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the certificate specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// certificateID - identifier of the certificate entity. Must be unique in the current API Management service -// instance. -func (client CertificateClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client CertificateClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client CertificateClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of all certificates in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| subject | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| thumbprint | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| expirationDate | filter | ge, le, eq, ne, gt, lt | -// |
-// top - number of records to return. -// skip - number of records to skip. -func (client CertificateClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result CertificateCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByService") - defer func() { - sc := -1 - if result.cc.Response.Response != nil { - sc = result.cc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.CertificateClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.cc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "ListByService", resp, "Failure sending request") - return - } - - result.cc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "ListByService", resp, "Failure responding to request") - return - } - if result.cc.hasNextLink() && result.cc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client CertificateClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client CertificateClient) ListByServiceResponder(resp *http.Response) (result CertificateCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client CertificateClient) listByServiceNextResults(ctx context.Context, lastResults CertificateCollection) (result CertificateCollection, err error) { - req, err := lastResults.certificateCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificateClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client CertificateClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result CertificateCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/client.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/client.go deleted file mode 100644 index 35f4916880dc..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package apimanagement implements the Azure ARM Apimanagement service API version 2019-12-01-preview. -// -// ApiManagement Client -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Apimanagement - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Apimanagement. -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/apimanagement/mgmt/2019-12-01-preview/apimanagement/delegationsettings.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/delegationsettings.go deleted file mode 100644 index 266a90631875..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/delegationsettings.go +++ /dev/null @@ -1,465 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DelegationSettingsClient is the apiManagement Client -type DelegationSettingsClient struct { - BaseClient -} - -// NewDelegationSettingsClient creates an instance of the DelegationSettingsClient client. -func NewDelegationSettingsClient(subscriptionID string) DelegationSettingsClient { - return NewDelegationSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDelegationSettingsClientWithBaseURI creates an instance of the DelegationSettingsClient 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 NewDelegationSettingsClientWithBaseURI(baseURI string, subscriptionID string) DelegationSettingsClient { - return DelegationSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update Delegation settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client DelegationSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (result PortalDelegationSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DelegationSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/delegation", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) 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 DelegationSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result PortalDelegationSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get Delegation Settings for the Portal. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client DelegationSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PortalDelegationSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DelegationSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/delegation", 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 DelegationSettingsClient) 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 DelegationSettingsClient) GetResponder(resp *http.Response) (result PortalDelegationSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the DelegationSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client DelegationSettingsClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client DelegationSettingsClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client DelegationSettingsClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListSecrets gets the secret validation key of the DelegationSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client DelegationSettingsClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string) (result PortalSettingValidationKeyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.ListSecrets") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client DelegationSettingsClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client DelegationSettingsClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client DelegationSettingsClient) ListSecretsResponder(resp *http.Response) (result PortalSettingValidationKeyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update Delegation settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - update Delegation settings. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client DelegationSettingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DelegationSettingsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DelegationSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DelegationSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DelegationSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalDelegationSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/delegation", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 DelegationSettingsClient) 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 DelegationSettingsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/diagnostic.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/diagnostic.go deleted file mode 100644 index 9def414c0881..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/diagnostic.go +++ /dev/null @@ -1,680 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DiagnosticClient is the apiManagement Client -type DiagnosticClient struct { - BaseClient -} - -// NewDiagnosticClient creates an instance of the DiagnosticClient client. -func NewDiagnosticClient(subscriptionID string) DiagnosticClient { - return NewDiagnosticClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticClientWithBaseURI creates an instance of the DiagnosticClient 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 NewDiagnosticClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticClient { - return DiagnosticClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Diagnostic or updates an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client DiagnosticClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.LoggerID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMaximum, Rule: float64(100), Chain: nil}, - {Target: "parameters.DiagnosticContractProperties.Sampling.Percentage", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Frontend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Frontend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Request.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - {Target: "parameters.DiagnosticContractProperties.Backend.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DiagnosticContractProperties.Backend.Response.Body.Bytes", Name: validation.InclusiveMaximum, Rule: int64(8192), Chain: nil}}}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) 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 DiagnosticClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticContract, 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 specified Diagnostic. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client DiagnosticClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, diagnosticID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 DiagnosticClient) 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 DiagnosticClient) 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 details of the Diagnostic specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client DiagnosticClient) Get(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result DiagnosticContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", 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 DiagnosticClient) 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 DiagnosticClient) GetResponder(resp *http.Response) (result DiagnosticContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Diagnostic specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -func (client DiagnosticClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, diagnosticID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client DiagnosticClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all diagnostics of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client DiagnosticClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result DiagnosticCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.ListByService") - defer func() { - sc := -1 - if result.dc.Response.Response != nil { - sc = result.dc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.dc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "ListByService", resp, "Failure sending request") - return - } - - result.dc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "ListByService", resp, "Failure responding to request") - return - } - if result.dc.hasNextLink() && result.dc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client DiagnosticClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/diagnostics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client DiagnosticClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client DiagnosticClient) ListByServiceResponder(resp *http.Response) (result DiagnosticCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client DiagnosticClient) listByServiceNextResults(ctx context.Context, lastResults DiagnosticCollection) (result DiagnosticCollection, err error) { - req, err := lastResults.diagnosticCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client DiagnosticClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result DiagnosticCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the Diagnostic specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// diagnosticID - diagnostic identifier. Must be unique in the current API Management service instance. -// parameters - diagnostic Update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client DiagnosticClient) Update(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: diagnosticID, - Constraints: []validation.Constraint{{Target: "diagnosticID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "diagnosticID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "diagnosticID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.DiagnosticClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, diagnosticID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.DiagnosticClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DiagnosticClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, diagnosticID string, parameters DiagnosticContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticId": autorest.Encode("path", diagnosticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 DiagnosticClient) 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 DiagnosticClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/emailtemplate.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/emailtemplate.go deleted file mode 100644 index 0b07f4a21e6e..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/emailtemplate.go +++ /dev/null @@ -1,631 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EmailTemplateClient is the apiManagement Client -type EmailTemplateClient struct { - BaseClient -} - -// NewEmailTemplateClient creates an instance of the EmailTemplateClient client. -func NewEmailTemplateClient(subscriptionID string) EmailTemplateClient { - return NewEmailTemplateClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEmailTemplateClientWithBaseURI creates an instance of the EmailTemplateClient 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 NewEmailTemplateClientWithBaseURI(baseURI string, subscriptionID string) EmailTemplateClient { - return EmailTemplateClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates an Email Template. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -// parameters - email Template update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client EmailTemplateClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters, ifMatch string) (result EmailTemplateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties.Subject", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties.Subject", Name: validation.MaxLength, Rule: 1000, Chain: nil}, - {Target: "parameters.EmailTemplateUpdateParameterProperties.Subject", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.EmailTemplateUpdateParameterProperties.Body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.EmailTemplateUpdateParameterProperties.Body", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, templateName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EmailTemplateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/templates/{templateName}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) 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 EmailTemplateClient) CreateOrUpdateResponder(resp *http.Response) (result EmailTemplateContract, 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 reset the Email Template to default template provided by the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client EmailTemplateClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, templateName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EmailTemplateClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 EmailTemplateClient) 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 EmailTemplateClient) 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 details of the email template specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -func (client EmailTemplateClient) Get(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (result EmailTemplateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, templateName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EmailTemplateClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/templates/{templateName}", 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 EmailTemplateClient) 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 EmailTemplateClient) GetResponder(resp *http.Response) (result EmailTemplateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the email template specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -func (client EmailTemplateClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, templateName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client EmailTemplateClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of properties defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client EmailTemplateClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result EmailTemplateCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.ListByService") - defer func() { - sc := -1 - if result.etc.Response.Response != nil { - sc = result.etc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.etc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "ListByService", resp, "Failure sending request") - return - } - - result.etc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "ListByService", resp, "Failure responding to request") - return - } - if result.etc.hasNextLink() && result.etc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client EmailTemplateClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/templates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client EmailTemplateClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client EmailTemplateClient) ListByServiceResponder(resp *http.Response) (result EmailTemplateCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client EmailTemplateClient) listByServiceNextResults(ctx context.Context, lastResults EmailTemplateCollection) (result EmailTemplateCollection, err error) { - req, err := lastResults.emailTemplateCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EmailTemplateClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result EmailTemplateCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the specific Email Template. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// templateName - email Template Name Identifier. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client EmailTemplateClient) Update(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.EmailTemplateClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, templateName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.EmailTemplateClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EmailTemplateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, templateName TemplateName, parameters EmailTemplateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "templateName": autorest.Encode("path", templateName), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/templates/{templateName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 EmailTemplateClient) 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 EmailTemplateClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/enums.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/enums.go deleted file mode 100644 index bb2c01185975..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/enums.go +++ /dev/null @@ -1,815 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AlwaysLog enumerates the values for always log. -type AlwaysLog string - -const ( - // AllErrors Always log all erroneous request regardless of sampling settings. - AllErrors AlwaysLog = "allErrors" -) - -// PossibleAlwaysLogValues returns an array of possible values for the AlwaysLog const type. -func PossibleAlwaysLogValues() []AlwaysLog { - return []AlwaysLog{AllErrors} -} - -// ApimIdentityType enumerates the values for apim identity type. -type ApimIdentityType string - -const ( - // None ... - None ApimIdentityType = "None" - // SystemAssigned ... - SystemAssigned ApimIdentityType = "SystemAssigned" - // SystemAssignedUserAssigned ... - SystemAssignedUserAssigned ApimIdentityType = "SystemAssigned, UserAssigned" - // UserAssigned ... - UserAssigned ApimIdentityType = "UserAssigned" -) - -// PossibleApimIdentityTypeValues returns an array of possible values for the ApimIdentityType const type. -func PossibleApimIdentityTypeValues() []ApimIdentityType { - return []ApimIdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} -} - -// APIType enumerates the values for api type. -type APIType string - -const ( - // HTTP ... - HTTP APIType = "http" - // Soap ... - Soap APIType = "soap" -) - -// PossibleAPITypeValues returns an array of possible values for the APIType const type. -func PossibleAPITypeValues() []APIType { - return []APIType{HTTP, Soap} -} - -// AppType enumerates the values for app type. -type AppType string - -const ( - // DeveloperPortal User create request was sent by new developer portal. - DeveloperPortal AppType = "developerPortal" -) - -// PossibleAppTypeValues returns an array of possible values for the AppType const type. -func PossibleAppTypeValues() []AppType { - return []AppType{DeveloperPortal} -} - -// AsyncOperationStatus enumerates the values for async operation status. -type AsyncOperationStatus string - -const ( - // Failed ... - Failed AsyncOperationStatus = "Failed" - // InProgress ... - InProgress AsyncOperationStatus = "InProgress" - // Started ... - Started AsyncOperationStatus = "Started" - // Succeeded ... - Succeeded AsyncOperationStatus = "Succeeded" -) - -// PossibleAsyncOperationStatusValues returns an array of possible values for the AsyncOperationStatus const type. -func PossibleAsyncOperationStatusValues() []AsyncOperationStatus { - return []AsyncOperationStatus{Failed, InProgress, Started, Succeeded} -} - -// AuthorizationMethod enumerates the values for authorization method. -type AuthorizationMethod string - -const ( - // DELETE ... - DELETE AuthorizationMethod = "DELETE" - // GET ... - GET AuthorizationMethod = "GET" - // HEAD ... - HEAD AuthorizationMethod = "HEAD" - // OPTIONS ... - OPTIONS AuthorizationMethod = "OPTIONS" - // PATCH ... - PATCH AuthorizationMethod = "PATCH" - // POST ... - POST AuthorizationMethod = "POST" - // PUT ... - PUT AuthorizationMethod = "PUT" - // TRACE ... - TRACE AuthorizationMethod = "TRACE" -) - -// PossibleAuthorizationMethodValues returns an array of possible values for the AuthorizationMethod const type. -func PossibleAuthorizationMethodValues() []AuthorizationMethod { - return []AuthorizationMethod{DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT, TRACE} -} - -// BackendProtocol enumerates the values for backend protocol. -type BackendProtocol string - -const ( - // BackendProtocolHTTP The Backend is a RESTful service. - BackendProtocolHTTP BackendProtocol = "http" - // BackendProtocolSoap The Backend is a SOAP service. - BackendProtocolSoap BackendProtocol = "soap" -) - -// PossibleBackendProtocolValues returns an array of possible values for the BackendProtocol const type. -func PossibleBackendProtocolValues() []BackendProtocol { - return []BackendProtocol{BackendProtocolHTTP, BackendProtocolSoap} -} - -// BearerTokenSendingMethod enumerates the values for bearer token sending method. -type BearerTokenSendingMethod string - -const ( - // AuthorizationHeader ... - AuthorizationHeader BearerTokenSendingMethod = "authorizationHeader" - // Query ... - Query BearerTokenSendingMethod = "query" -) - -// PossibleBearerTokenSendingMethodValues returns an array of possible values for the BearerTokenSendingMethod const type. -func PossibleBearerTokenSendingMethodValues() []BearerTokenSendingMethod { - return []BearerTokenSendingMethod{AuthorizationHeader, Query} -} - -// BearerTokenSendingMethods enumerates the values for bearer token sending methods. -type BearerTokenSendingMethods string - -const ( - // BearerTokenSendingMethodsAuthorizationHeader Access token will be transmitted in the Authorization - // header using Bearer schema - BearerTokenSendingMethodsAuthorizationHeader BearerTokenSendingMethods = "authorizationHeader" - // BearerTokenSendingMethodsQuery Access token will be transmitted as query parameters. - BearerTokenSendingMethodsQuery BearerTokenSendingMethods = "query" -) - -// PossibleBearerTokenSendingMethodsValues returns an array of possible values for the BearerTokenSendingMethods const type. -func PossibleBearerTokenSendingMethodsValues() []BearerTokenSendingMethods { - return []BearerTokenSendingMethods{BearerTokenSendingMethodsAuthorizationHeader, BearerTokenSendingMethodsQuery} -} - -// ClientAuthenticationMethod enumerates the values for client authentication method. -type ClientAuthenticationMethod string - -const ( - // Basic Basic Client Authentication method. - Basic ClientAuthenticationMethod = "Basic" - // Body Body based Authentication method. - Body ClientAuthenticationMethod = "Body" -) - -// PossibleClientAuthenticationMethodValues returns an array of possible values for the ClientAuthenticationMethod const type. -func PossibleClientAuthenticationMethodValues() []ClientAuthenticationMethod { - return []ClientAuthenticationMethod{Basic, Body} -} - -// Confirmation enumerates the values for confirmation. -type Confirmation string - -const ( - // Invite Send an e-mail inviting the user to sign-up and complete registration. - Invite Confirmation = "invite" - // Signup Send an e-mail to the user confirming they have successfully signed up. - Signup Confirmation = "signup" -) - -// PossibleConfirmationValues returns an array of possible values for the Confirmation const type. -func PossibleConfirmationValues() []Confirmation { - return []Confirmation{Invite, Signup} -} - -// ConnectivityStatusType enumerates the values for connectivity status type. -type ConnectivityStatusType string - -const ( - // Failure ... - Failure ConnectivityStatusType = "failure" - // Initializing ... - Initializing ConnectivityStatusType = "initializing" - // Success ... - Success ConnectivityStatusType = "success" -) - -// PossibleConnectivityStatusTypeValues returns an array of possible values for the ConnectivityStatusType const type. -func PossibleConnectivityStatusTypeValues() []ConnectivityStatusType { - return []ConnectivityStatusType{Failure, Initializing, Success} -} - -// ContentFormat enumerates the values for content format. -type ContentFormat string - -const ( - // Openapi The contents are inline and Content Type is a OpenApi 3.0 Document in YAML format. - Openapi ContentFormat = "openapi" - // Openapijson The contents are inline and Content Type is a OpenApi 3.0 Document in JSON format. - Openapijson ContentFormat = "openapi+json" - // OpenapijsonLink The Open Api 3.0 Json document is hosted on a publicly accessible internet address. - OpenapijsonLink ContentFormat = "openapi+json-link" - // OpenapiLink The Open Api 3.0 document is hosted on a publicly accessible internet address. - OpenapiLink ContentFormat = "openapi-link" - // SwaggerJSON The contents are inline and Content Type is a OpenApi 2.0 Document. - SwaggerJSON ContentFormat = "swagger-json" - // SwaggerLinkJSON The Open Api 2.0 document is hosted on a publicly accessible internet address. - SwaggerLinkJSON ContentFormat = "swagger-link-json" - // WadlLinkJSON The WADL document is hosted on a publicly accessible internet address. - WadlLinkJSON ContentFormat = "wadl-link-json" - // WadlXML The contents are inline and Content type is a WADL document. - WadlXML ContentFormat = "wadl-xml" - // Wsdl The contents are inline and the document is a WSDL/Soap document. - Wsdl ContentFormat = "wsdl" - // WsdlLink The WSDL document is hosted on a publicly accessible internet address. - WsdlLink ContentFormat = "wsdl-link" -) - -// PossibleContentFormatValues returns an array of possible values for the ContentFormat const type. -func PossibleContentFormatValues() []ContentFormat { - return []ContentFormat{Openapi, Openapijson, OpenapijsonLink, OpenapiLink, SwaggerJSON, SwaggerLinkJSON, WadlLinkJSON, WadlXML, Wsdl, WsdlLink} -} - -// ExportFormat enumerates the values for export format. -type ExportFormat string - -const ( - // ExportFormatOpenapi Export the Api Definition in OpenApi Specification 3.0 to Storage Blob. - ExportFormatOpenapi ExportFormat = "openapi-link" - // ExportFormatOpenapiJSON Export the Api Definition in OpenApi Specification 3.0 as JSON document to - // Storage Blob. - ExportFormatOpenapiJSON ExportFormat = "openapi+json-link" - // ExportFormatSwagger Export the Api Definition in OpenApi Specification 2.0 format to the Storage Blob. - ExportFormatSwagger ExportFormat = "swagger-link" - // ExportFormatWadl Export the Api Definition in WADL Schema to Storage Blob. - ExportFormatWadl ExportFormat = "wadl-link" - // ExportFormatWsdl Export the Api Definition in WSDL Schema to Storage Blob. This is only supported for - // APIs of Type `soap` - ExportFormatWsdl ExportFormat = "wsdl-link" -) - -// PossibleExportFormatValues returns an array of possible values for the ExportFormat const type. -func PossibleExportFormatValues() []ExportFormat { - return []ExportFormat{ExportFormatOpenapi, ExportFormatOpenapiJSON, ExportFormatSwagger, ExportFormatWadl, ExportFormatWsdl} -} - -// ExportResultFormat enumerates the values for export result format. -type ExportResultFormat string - -const ( - // ExportResultFormatOpenAPI Export the Api Definition in OpenApi Specification 3.0 to Storage Blob. - ExportResultFormatOpenAPI ExportResultFormat = "openapi-link" - // ExportResultFormatSwagger The Api Definition is exported in OpenApi Specification 2.0 format to the - // Storage Blob. - ExportResultFormatSwagger ExportResultFormat = "swagger-link-json" - // ExportResultFormatWadl Export the Api Definition in WADL Schema to Storage Blob. - ExportResultFormatWadl ExportResultFormat = "wadl-link-json" - // ExportResultFormatWsdl The Api Definition is exported in WSDL Schema to Storage Blob. This is only - // supported for APIs of Type `soap` - ExportResultFormatWsdl ExportResultFormat = "wsdl-link+xml" -) - -// PossibleExportResultFormatValues returns an array of possible values for the ExportResultFormat const type. -func PossibleExportResultFormatValues() []ExportResultFormat { - return []ExportResultFormat{ExportResultFormatOpenAPI, ExportResultFormatSwagger, ExportResultFormatWadl, ExportResultFormatWsdl} -} - -// GrantType enumerates the values for grant type. -type GrantType string - -const ( - // AuthorizationCode Authorization Code Grant flow as described - // https://tools.ietf.org/html/rfc6749#section-4.1. - AuthorizationCode GrantType = "authorizationCode" - // ClientCredentials Client Credentials Grant flow as described - // https://tools.ietf.org/html/rfc6749#section-4.4. - ClientCredentials GrantType = "clientCredentials" - // Implicit Implicit Code Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.2. - Implicit GrantType = "implicit" - // ResourceOwnerPassword Resource Owner Password Grant flow as described - // https://tools.ietf.org/html/rfc6749#section-4.3. - ResourceOwnerPassword GrantType = "resourceOwnerPassword" -) - -// PossibleGrantTypeValues returns an array of possible values for the GrantType const type. -func PossibleGrantTypeValues() []GrantType { - return []GrantType{AuthorizationCode, ClientCredentials, Implicit, ResourceOwnerPassword} -} - -// GroupType enumerates the values for group type. -type GroupType string - -const ( - // Custom ... - Custom GroupType = "custom" - // External ... - External GroupType = "external" - // System ... - System GroupType = "system" -) - -// PossibleGroupTypeValues returns an array of possible values for the GroupType const type. -func PossibleGroupTypeValues() []GroupType { - return []GroupType{Custom, External, System} -} - -// HostnameType enumerates the values for hostname type. -type HostnameType string - -const ( - // HostnameTypeDeveloperPortal ... - HostnameTypeDeveloperPortal HostnameType = "DeveloperPortal" - // HostnameTypeManagement ... - HostnameTypeManagement HostnameType = "Management" - // HostnameTypePortal ... - HostnameTypePortal HostnameType = "Portal" - // HostnameTypeProxy ... - HostnameTypeProxy HostnameType = "Proxy" - // HostnameTypeScm ... - HostnameTypeScm HostnameType = "Scm" -) - -// PossibleHostnameTypeValues returns an array of possible values for the HostnameType const type. -func PossibleHostnameTypeValues() []HostnameType { - return []HostnameType{HostnameTypeDeveloperPortal, HostnameTypeManagement, HostnameTypePortal, HostnameTypeProxy, HostnameTypeScm} -} - -// HTTPCorrelationProtocol enumerates the values for http correlation protocol. -type HTTPCorrelationProtocol string - -const ( - // HTTPCorrelationProtocolLegacy Inject Request-Id and Request-Context headers with request correlation - // data. See - // https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md. - HTTPCorrelationProtocolLegacy HTTPCorrelationProtocol = "Legacy" - // HTTPCorrelationProtocolNone Do not read and inject correlation headers. - HTTPCorrelationProtocolNone HTTPCorrelationProtocol = "None" - // HTTPCorrelationProtocolW3C Inject Trace Context headers. See https://w3c.github.io/trace-context. - HTTPCorrelationProtocolW3C HTTPCorrelationProtocol = "W3C" -) - -// PossibleHTTPCorrelationProtocolValues returns an array of possible values for the HTTPCorrelationProtocol const type. -func PossibleHTTPCorrelationProtocolValues() []HTTPCorrelationProtocol { - return []HTTPCorrelationProtocol{HTTPCorrelationProtocolLegacy, HTTPCorrelationProtocolNone, HTTPCorrelationProtocolW3C} -} - -// IdentityProviderType enumerates the values for identity provider type. -type IdentityProviderType string - -const ( - // Aad Azure Active Directory as Identity provider. - Aad IdentityProviderType = "aad" - // AadB2C Azure Active Directory B2C as Identity provider. - AadB2C IdentityProviderType = "aadB2C" - // Facebook Facebook as Identity provider. - Facebook IdentityProviderType = "facebook" - // Google Google as Identity provider. - Google IdentityProviderType = "google" - // Microsoft Microsoft Live as Identity provider. - Microsoft IdentityProviderType = "microsoft" - // Twitter Twitter as Identity provider. - Twitter IdentityProviderType = "twitter" -) - -// PossibleIdentityProviderTypeValues returns an array of possible values for the IdentityProviderType const type. -func PossibleIdentityProviderTypeValues() []IdentityProviderType { - return []IdentityProviderType{Aad, AadB2C, Facebook, Google, Microsoft, Twitter} -} - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // Primary ... - Primary KeyType = "primary" - // Secondary ... - Secondary KeyType = "secondary" -) - -// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. -func PossibleKeyTypeValues() []KeyType { - return []KeyType{Primary, Secondary} -} - -// LoggerType enumerates the values for logger type. -type LoggerType string - -const ( - // ApplicationInsights Azure Application Insights as log destination. - ApplicationInsights LoggerType = "applicationInsights" - // AzureEventHub Azure Event Hub as log destination. - AzureEventHub LoggerType = "azureEventHub" -) - -// PossibleLoggerTypeValues returns an array of possible values for the LoggerType const type. -func PossibleLoggerTypeValues() []LoggerType { - return []LoggerType{ApplicationInsights, AzureEventHub} -} - -// NameAvailabilityReason enumerates the values for name availability reason. -type NameAvailabilityReason string - -const ( - // AlreadyExists ... - AlreadyExists NameAvailabilityReason = "AlreadyExists" - // Invalid ... - Invalid NameAvailabilityReason = "Invalid" - // Valid ... - Valid NameAvailabilityReason = "Valid" -) - -// PossibleNameAvailabilityReasonValues returns an array of possible values for the NameAvailabilityReason const type. -func PossibleNameAvailabilityReasonValues() []NameAvailabilityReason { - return []NameAvailabilityReason{AlreadyExists, Invalid, Valid} -} - -// NotificationName enumerates the values for notification name. -type NotificationName string - -const ( - // AccountClosedPublisher The following email recipients and users will receive email notifications when - // developer closes his account. - AccountClosedPublisher NotificationName = "AccountClosedPublisher" - // BCC The following recipients will receive blind carbon copies of all emails sent to developers. - BCC NotificationName = "BCC" - // NewApplicationNotificationMessage The following email recipients and users will receive email - // notifications when new applications are submitted to the application gallery. - NewApplicationNotificationMessage NotificationName = "NewApplicationNotificationMessage" - // NewIssuePublisherNotificationMessage The following email recipients and users will receive email - // notifications when a new issue or comment is submitted on the developer portal. - NewIssuePublisherNotificationMessage NotificationName = "NewIssuePublisherNotificationMessage" - // PurchasePublisherNotificationMessage The following email recipients and users will receive email - // notifications about new API product subscriptions. - PurchasePublisherNotificationMessage NotificationName = "PurchasePublisherNotificationMessage" - // QuotaLimitApproachingPublisherNotificationMessage The following email recipients and users will receive - // email notifications when subscription usage gets close to usage quota. - QuotaLimitApproachingPublisherNotificationMessage NotificationName = "QuotaLimitApproachingPublisherNotificationMessage" - // RequestPublisherNotificationMessage The following email recipients and users will receive email - // notifications about subscription requests for API products requiring approval. - RequestPublisherNotificationMessage NotificationName = "RequestPublisherNotificationMessage" -) - -// PossibleNotificationNameValues returns an array of possible values for the NotificationName const type. -func PossibleNotificationNameValues() []NotificationName { - return []NotificationName{AccountClosedPublisher, BCC, NewApplicationNotificationMessage, NewIssuePublisherNotificationMessage, PurchasePublisherNotificationMessage, QuotaLimitApproachingPublisherNotificationMessage, RequestPublisherNotificationMessage} -} - -// PolicyContentFormat enumerates the values for policy content format. -type PolicyContentFormat string - -const ( - // Rawxml The contents are inline and Content type is a non XML encoded policy document. - Rawxml PolicyContentFormat = "rawxml" - // RawxmlLink The policy document is not Xml encoded and is hosted on a http endpoint accessible from the - // API Management service. - RawxmlLink PolicyContentFormat = "rawxml-link" - // XML The contents are inline and Content type is an XML document. - XML PolicyContentFormat = "xml" - // XMLLink The policy XML document is hosted on a http endpoint accessible from the API Management service. - XMLLink PolicyContentFormat = "xml-link" -) - -// PossiblePolicyContentFormatValues returns an array of possible values for the PolicyContentFormat const type. -func PossiblePolicyContentFormatValues() []PolicyContentFormat { - return []PolicyContentFormat{Rawxml, RawxmlLink, XML, XMLLink} -} - -// PolicyExportFormat enumerates the values for policy export format. -type PolicyExportFormat string - -const ( - // PolicyExportFormatRawxml The contents are inline and Content type is a non XML encoded policy document. - PolicyExportFormatRawxml PolicyExportFormat = "rawxml" - // PolicyExportFormatXML The contents are inline and Content type is an XML document. - PolicyExportFormatXML PolicyExportFormat = "xml" -) - -// PossiblePolicyExportFormatValues returns an array of possible values for the PolicyExportFormat const type. -func PossiblePolicyExportFormatValues() []PolicyExportFormat { - return []PolicyExportFormat{PolicyExportFormatRawxml, PolicyExportFormatXML} -} - -// PolicyScopeContract enumerates the values for policy scope contract. -type PolicyScopeContract string - -const ( - // PolicyScopeContractAll ... - PolicyScopeContractAll PolicyScopeContract = "All" - // PolicyScopeContractAPI ... - PolicyScopeContractAPI PolicyScopeContract = "Api" - // PolicyScopeContractOperation ... - PolicyScopeContractOperation PolicyScopeContract = "Operation" - // PolicyScopeContractProduct ... - PolicyScopeContractProduct PolicyScopeContract = "Product" - // PolicyScopeContractTenant ... - PolicyScopeContractTenant PolicyScopeContract = "Tenant" -) - -// PossiblePolicyScopeContractValues returns an array of possible values for the PolicyScopeContract const type. -func PossiblePolicyScopeContractValues() []PolicyScopeContract { - return []PolicyScopeContract{PolicyScopeContractAll, PolicyScopeContractAPI, PolicyScopeContractOperation, PolicyScopeContractProduct, PolicyScopeContractTenant} -} - -// ProductState enumerates the values for product state. -type ProductState string - -const ( - // NotPublished ... - NotPublished ProductState = "notPublished" - // Published ... - Published ProductState = "published" -) - -// PossibleProductStateValues returns an array of possible values for the ProductState const type. -func PossibleProductStateValues() []ProductState { - return []ProductState{NotPublished, Published} -} - -// Protocol enumerates the values for protocol. -type Protocol string - -const ( - // ProtocolHTTP ... - ProtocolHTTP Protocol = "http" - // ProtocolHTTPS ... - ProtocolHTTPS Protocol = "https" -) - -// PossibleProtocolValues returns an array of possible values for the Protocol const type. -func PossibleProtocolValues() []Protocol { - return []Protocol{ProtocolHTTP, ProtocolHTTPS} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Created ... - Created ProvisioningState = "created" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Created} -} - -// ResourceSkuCapacityScaleType enumerates the values for resource sku capacity scale type. -type ResourceSkuCapacityScaleType string - -const ( - // ResourceSkuCapacityScaleTypeAutomatic Supported scale type automatic. - ResourceSkuCapacityScaleTypeAutomatic ResourceSkuCapacityScaleType = "automatic" - // ResourceSkuCapacityScaleTypeManual Supported scale type manual. - ResourceSkuCapacityScaleTypeManual ResourceSkuCapacityScaleType = "manual" - // ResourceSkuCapacityScaleTypeNone Scaling not supported. - ResourceSkuCapacityScaleTypeNone ResourceSkuCapacityScaleType = "none" -) - -// PossibleResourceSkuCapacityScaleTypeValues returns an array of possible values for the ResourceSkuCapacityScaleType const type. -func PossibleResourceSkuCapacityScaleTypeValues() []ResourceSkuCapacityScaleType { - return []ResourceSkuCapacityScaleType{ResourceSkuCapacityScaleTypeAutomatic, ResourceSkuCapacityScaleTypeManual, ResourceSkuCapacityScaleTypeNone} -} - -// SamplingType enumerates the values for sampling type. -type SamplingType string - -const ( - // Fixed Fixed-rate sampling. - Fixed SamplingType = "fixed" -) - -// PossibleSamplingTypeValues returns an array of possible values for the SamplingType const type. -func PossibleSamplingTypeValues() []SamplingType { - return []SamplingType{Fixed} -} - -// SkuType enumerates the values for sku type. -type SkuType string - -const ( - // SkuTypeBasic Basic SKU of Api Management. - SkuTypeBasic SkuType = "Basic" - // SkuTypeConsumption Consumption SKU of Api Management. - SkuTypeConsumption SkuType = "Consumption" - // SkuTypeDeveloper Developer SKU of Api Management. - SkuTypeDeveloper SkuType = "Developer" - // SkuTypePremium Premium SKU of Api Management. - SkuTypePremium SkuType = "Premium" - // SkuTypeStandard Standard SKU of Api Management. - SkuTypeStandard SkuType = "Standard" -) - -// PossibleSkuTypeValues returns an array of possible values for the SkuType const type. -func PossibleSkuTypeValues() []SkuType { - return []SkuType{SkuTypeBasic, SkuTypeConsumption, SkuTypeDeveloper, SkuTypePremium, SkuTypeStandard} -} - -// SoapAPIType enumerates the values for soap api type. -type SoapAPIType string - -const ( - // SoapPassThrough Imports the Soap API having a SOAP front end. - SoapPassThrough SoapAPIType = "soap" - // SoapToRest Imports a SOAP API having a RESTful front end. - SoapToRest SoapAPIType = "http" -) - -// PossibleSoapAPITypeValues returns an array of possible values for the SoapAPIType const type. -func PossibleSoapAPITypeValues() []SoapAPIType { - return []SoapAPIType{SoapPassThrough, SoapToRest} -} - -// State enumerates the values for state. -type State string - -const ( - // Closed The issue was closed. - Closed State = "closed" - // Open The issue is opened. - Open State = "open" - // Proposed The issue is proposed. - Proposed State = "proposed" - // Removed The issue was removed. - Removed State = "removed" - // Resolved The issue is now resolved. - Resolved State = "resolved" -) - -// PossibleStateValues returns an array of possible values for the State const type. -func PossibleStateValues() []State { - return []State{Closed, Open, Proposed, Removed, Resolved} -} - -// StoreName enumerates the values for store name. -type StoreName string - -const ( - // CertificateAuthority ... - CertificateAuthority StoreName = "CertificateAuthority" - // Root ... - Root StoreName = "Root" -) - -// PossibleStoreNameValues returns an array of possible values for the StoreName const type. -func PossibleStoreNameValues() []StoreName { - return []StoreName{CertificateAuthority, Root} -} - -// SubscriptionState enumerates the values for subscription state. -type SubscriptionState string - -const ( - // Active ... - Active SubscriptionState = "active" - // Cancelled ... - Cancelled SubscriptionState = "cancelled" - // Expired ... - Expired SubscriptionState = "expired" - // Rejected ... - Rejected SubscriptionState = "rejected" - // Submitted ... - Submitted SubscriptionState = "submitted" - // Suspended ... - Suspended SubscriptionState = "suspended" -) - -// PossibleSubscriptionStateValues returns an array of possible values for the SubscriptionState const type. -func PossibleSubscriptionStateValues() []SubscriptionState { - return []SubscriptionState{Active, Cancelled, Expired, Rejected, Submitted, Suspended} -} - -// TemplateName enumerates the values for template name. -type TemplateName string - -const ( - // AccountClosedDeveloper ... - AccountClosedDeveloper TemplateName = "accountClosedDeveloper" - // ApplicationApprovedNotificationMessage ... - ApplicationApprovedNotificationMessage TemplateName = "applicationApprovedNotificationMessage" - // ConfirmSignUpIdentityDefault ... - ConfirmSignUpIdentityDefault TemplateName = "confirmSignUpIdentityDefault" - // EmailChangeIdentityDefault ... - EmailChangeIdentityDefault TemplateName = "emailChangeIdentityDefault" - // InviteUserNotificationMessage ... - InviteUserNotificationMessage TemplateName = "inviteUserNotificationMessage" - // NewCommentNotificationMessage ... - NewCommentNotificationMessage TemplateName = "newCommentNotificationMessage" - // NewDeveloperNotificationMessage ... - NewDeveloperNotificationMessage TemplateName = "newDeveloperNotificationMessage" - // NewIssueNotificationMessage ... - NewIssueNotificationMessage TemplateName = "newIssueNotificationMessage" - // PasswordResetByAdminNotificationMessage ... - PasswordResetByAdminNotificationMessage TemplateName = "passwordResetByAdminNotificationMessage" - // PasswordResetIdentityDefault ... - PasswordResetIdentityDefault TemplateName = "passwordResetIdentityDefault" - // PurchaseDeveloperNotificationMessage ... - PurchaseDeveloperNotificationMessage TemplateName = "purchaseDeveloperNotificationMessage" - // QuotaLimitApproachingDeveloperNotificationMessage ... - QuotaLimitApproachingDeveloperNotificationMessage TemplateName = "quotaLimitApproachingDeveloperNotificationMessage" - // RejectDeveloperNotificationMessage ... - RejectDeveloperNotificationMessage TemplateName = "rejectDeveloperNotificationMessage" - // RequestDeveloperNotificationMessage ... - RequestDeveloperNotificationMessage TemplateName = "requestDeveloperNotificationMessage" -) - -// PossibleTemplateNameValues returns an array of possible values for the TemplateName const type. -func PossibleTemplateNameValues() []TemplateName { - return []TemplateName{AccountClosedDeveloper, ApplicationApprovedNotificationMessage, ConfirmSignUpIdentityDefault, EmailChangeIdentityDefault, InviteUserNotificationMessage, NewCommentNotificationMessage, NewDeveloperNotificationMessage, NewIssueNotificationMessage, PasswordResetByAdminNotificationMessage, PasswordResetIdentityDefault, PurchaseDeveloperNotificationMessage, QuotaLimitApproachingDeveloperNotificationMessage, RejectDeveloperNotificationMessage, RequestDeveloperNotificationMessage} -} - -// UserState enumerates the values for user state. -type UserState string - -const ( - // UserStateActive User state is active. - UserStateActive UserState = "active" - // UserStateBlocked User is blocked. Blocked users cannot authenticate at developer portal or call API. - UserStateBlocked UserState = "blocked" - // UserStateDeleted User account is closed. All identities and related entities are removed. - UserStateDeleted UserState = "deleted" - // UserStatePending User account is pending. Requires identity confirmation before it can be made active. - UserStatePending UserState = "pending" -) - -// PossibleUserStateValues returns an array of possible values for the UserState const type. -func PossibleUserStateValues() []UserState { - return []UserState{UserStateActive, UserStateBlocked, UserStateDeleted, UserStatePending} -} - -// Verbosity enumerates the values for verbosity. -type Verbosity string - -const ( - // Error Only traces with 'severity' set to 'error' will be sent to the logger attached to this diagnostic - // instance. - Error Verbosity = "error" - // Information Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached - // to this diagnostic instance. - Information Verbosity = "information" - // Verbose All the traces emitted by trace policies will be sent to the logger attached to this diagnostic - // instance. - Verbose Verbosity = "verbose" -) - -// PossibleVerbosityValues returns an array of possible values for the Verbosity const type. -func PossibleVerbosityValues() []Verbosity { - return []Verbosity{Error, Information, Verbose} -} - -// VersioningScheme enumerates the values for versioning scheme. -type VersioningScheme string - -const ( - // VersioningSchemeHeader The API Version is passed in a HTTP header. - VersioningSchemeHeader VersioningScheme = "Header" - // VersioningSchemeQuery The API Version is passed in a query parameter. - VersioningSchemeQuery VersioningScheme = "Query" - // VersioningSchemeSegment The API Version is passed in a path segment. - VersioningSchemeSegment VersioningScheme = "Segment" -) - -// PossibleVersioningSchemeValues returns an array of possible values for the VersioningScheme const type. -func PossibleVersioningSchemeValues() []VersioningScheme { - return []VersioningScheme{VersioningSchemeHeader, VersioningSchemeQuery, VersioningSchemeSegment} -} - -// VersioningScheme1 enumerates the values for versioning scheme 1. -type VersioningScheme1 string - -const ( - // VersioningScheme1Header ... - VersioningScheme1Header VersioningScheme1 = "Header" - // VersioningScheme1Query ... - VersioningScheme1Query VersioningScheme1 = "Query" - // VersioningScheme1Segment ... - VersioningScheme1Segment VersioningScheme1 = "Segment" -) - -// PossibleVersioningScheme1Values returns an array of possible values for the VersioningScheme1 const type. -func PossibleVersioningScheme1Values() []VersioningScheme1 { - return []VersioningScheme1{VersioningScheme1Header, VersioningScheme1Query, VersioningScheme1Segment} -} - -// VirtualNetworkType enumerates the values for virtual network type. -type VirtualNetworkType string - -const ( - // VirtualNetworkTypeExternal The service is part of Virtual Network and it is accessible from Internet. - VirtualNetworkTypeExternal VirtualNetworkType = "External" - // VirtualNetworkTypeInternal The service is part of Virtual Network and it is only accessible from within - // the virtual network. - VirtualNetworkTypeInternal VirtualNetworkType = "Internal" - // VirtualNetworkTypeNone The service is not part of any Virtual Network. - VirtualNetworkTypeNone VirtualNetworkType = "None" -) - -// PossibleVirtualNetworkTypeValues returns an array of possible values for the VirtualNetworkType const type. -func PossibleVirtualNetworkTypeValues() []VirtualNetworkType { - return []VirtualNetworkType{VirtualNetworkTypeExternal, VirtualNetworkTypeInternal, VirtualNetworkTypeNone} -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gateway.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gateway.go deleted file mode 100644 index 19b1c1559fcb..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gateway.go +++ /dev/null @@ -1,924 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GatewayClient is the apiManagement Client -type GatewayClient struct { - BaseClient -} - -// NewGatewayClient creates an instance of the GatewayClient client. -func NewGatewayClient(subscriptionID string) GatewayClient { - return NewGatewayClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGatewayClientWithBaseURI creates an instance of the GatewayClient 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 NewGatewayClientWithBaseURI(baseURI string, subscriptionID string) GatewayClient { - return GatewayClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Gateway to be used in Api Management instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client GatewayClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayContract, ifMatch string) (result GatewayContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GatewayContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.Name", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - {Target: "parameters.GatewayContractProperties.LocationData.City", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.City", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - {Target: "parameters.GatewayContractProperties.LocationData.District", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.District", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - {Target: "parameters.GatewayContractProperties.LocationData.CountryOrRegion", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.LocationData.CountryOrRegion", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - }}, - {Target: "parameters.GatewayContractProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GatewayContractProperties.Description", Name: validation.MaxLength, Rule: 1000, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GatewayClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) 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 GatewayClient) CreateOrUpdateResponder(resp *http.Response) (result GatewayContract, 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 specific Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GatewayClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, gatewayID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GatewayClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 GatewayClient) 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 GatewayClient) 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 -} - -// GenerateToken gets the Shared Access Authorization Token for the gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) GenerateToken(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayTokenRequestContract) (result GatewayTokenContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.GenerateToken") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Expiry", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "GenerateToken", err.Error()) - } - - req, err := client.GenerateTokenPreparer(ctx, resourceGroupName, serviceName, gatewayID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GenerateToken", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GenerateToken", resp, "Failure sending request") - return - } - - result, err = client.GenerateTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GenerateToken", resp, "Failure responding to request") - return - } - - return -} - -// GenerateTokenPreparer prepares the GenerateToken request. -func (client GatewayClient) GenerateTokenPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayTokenRequestContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateTokenSender sends the GenerateToken request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) GenerateTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateTokenResponder handles the response to the GenerateToken request. The method always -// closes the http.Response Body. -func (client GatewayClient) GenerateTokenResponder(resp *http.Response) (result GatewayTokenContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the Gateway specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (result GatewayContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, gatewayID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GatewayClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}", 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 GatewayClient) 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 GatewayClient) GetResponder(resp *http.Response) (result GatewayContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Gateway specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, gatewayID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GatewayClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GatewayClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of gateways registered with service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// top - number of records to return. -// skip - number of records to skip. -func (client GatewayClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result GatewayCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.ListByService") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListByService", resp, "Failure sending request") - return - } - - result.gc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListByService", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GatewayClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/gateways", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GatewayClient) ListByServiceResponder(resp *http.Response) (result GatewayCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GatewayClient) listByServiceNextResults(ctx context.Context, lastResults GatewayCollection) (result GatewayCollection, err error) { - req, err := lastResults.gatewayCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GatewayClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result GatewayCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, top, skip) - return -} - -// ListKeys retrieves gateway keys. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) ListKeys(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (result GatewayKeysContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.ListKeys") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, serviceName, gatewayID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client GatewayClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client GatewayClient) ListKeysResponder(resp *http.Response) (result GatewayKeysContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerates specified gateway key invalidating any tokens created with it. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -func (client GatewayClient) RegenerateKey(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayKeyRegenerationRequestContract) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.RegenerateKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, serviceName, gatewayID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client GatewayClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayKeyRegenerationRequestContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey", 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 GatewayClient) 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 GatewayClient) RegenerateKeyResponder(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 details of the gateway specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GatewayClient) Update(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, gatewayID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GatewayClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, parameters GatewayContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 GatewayClient) 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 GatewayClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gatewayapi.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gatewayapi.go deleted file mode 100644 index 5a9c3e0ba322..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gatewayapi.go +++ /dev/null @@ -1,466 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GatewayAPIClient is the apiManagement Client -type GatewayAPIClient struct { - BaseClient -} - -// NewGatewayAPIClient creates an instance of the GatewayAPIClient client. -func NewGatewayAPIClient(subscriptionID string) GatewayAPIClient { - return NewGatewayAPIClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGatewayAPIClientWithBaseURI creates an instance of the GatewayAPIClient 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 NewGatewayAPIClientWithBaseURI(baseURI string, subscriptionID string) GatewayAPIClient { - return GatewayAPIClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate adds an API to the specified Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// apiid - API identifier. Must be unique in the current API Management service instance. -func (client GatewayAPIClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string, parameters *AssociationContract) (result APIContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayAPIClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayID, apiid, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GatewayAPIClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string, parameters *AssociationContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - 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 GatewayAPIClient) 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 GatewayAPIClient) CreateOrUpdateResponder(resp *http.Response) (result APIContract, 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 specified API from the specified Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// apiid - API identifier. Must be unique in the current API Management service instance. -func (client GatewayAPIClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayAPIClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, gatewayID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GatewayAPIClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}", 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 GatewayAPIClient) 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 GatewayAPIClient) 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 -} - -// GetEntityTag checks that API entity specified by identifier is associated with the Gateway entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// apiid - API identifier. Must be unique in the current API Management service instance. -func (client GatewayAPIClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayAPIClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, gatewayID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GatewayAPIClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayAPIClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GatewayAPIClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of the APIs associated with a gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// top - number of records to return. -// skip - number of records to skip. -func (client GatewayAPIClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (result APICollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.ListByService") - defer func() { - sc := -1 - if result.ac.Response.Response != nil { - sc = result.ac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayAPIClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, gatewayID, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "ListByService", resp, "Failure sending request") - return - } - - result.ac, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ac.hasNextLink() && result.ac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GatewayAPIClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayAPIClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GatewayAPIClient) ListByServiceResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GatewayAPIClient) listByServiceNextResults(ctx context.Context, lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.aPICollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayAPIClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GatewayAPIClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (result APICollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayAPIClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, gatewayID, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gatewayhostnameconfiguration.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gatewayhostnameconfiguration.go deleted file mode 100644 index 9856e3c00e96..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/gatewayhostnameconfiguration.go +++ /dev/null @@ -1,559 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GatewayHostnameConfigurationClient is the apiManagement Client -type GatewayHostnameConfigurationClient struct { - BaseClient -} - -// NewGatewayHostnameConfigurationClient creates an instance of the GatewayHostnameConfigurationClient client. -func NewGatewayHostnameConfigurationClient(subscriptionID string) GatewayHostnameConfigurationClient { - return NewGatewayHostnameConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGatewayHostnameConfigurationClientWithBaseURI creates an instance of the GatewayHostnameConfigurationClient -// 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 NewGatewayHostnameConfigurationClientWithBaseURI(baseURI string, subscriptionID string) GatewayHostnameConfigurationClient { - return GatewayHostnameConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates of updates hostname configuration for a Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// hcID - gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. -func (client GatewayHostnameConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string, parameters GatewayHostnameConfigurationContract) (result GatewayHostnameConfigurationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hcID, - Constraints: []validation.Constraint{{Target: "hcID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "hcID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayID, hcID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GatewayHostnameConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string, parameters GatewayHostnameConfigurationContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "hcId": autorest.Encode("path", hcID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", 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 GatewayHostnameConfigurationClient) 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 GatewayHostnameConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result GatewayHostnameConfigurationContract, 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 specified hostname configuration from the specified Gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// hcID - gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. -func (client GatewayHostnameConfigurationClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hcID, - Constraints: []validation.Constraint{{Target: "hcID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "hcID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, gatewayID, hcID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GatewayHostnameConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "hcId": autorest.Encode("path", hcID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", 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 GatewayHostnameConfigurationClient) 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 GatewayHostnameConfigurationClient) 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 details of the Gateway hostname configuration specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// hcID - gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. -func (client GatewayHostnameConfigurationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (result GatewayHostnameConfigurationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hcID, - Constraints: []validation.Constraint{{Target: "hcID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "hcID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, gatewayID, hcID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GatewayHostnameConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "hcId": autorest.Encode("path", hcID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", 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 GatewayHostnameConfigurationClient) 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 GatewayHostnameConfigurationClient) GetResponder(resp *http.Response) (result GatewayHostnameConfigurationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag checks that hostname configuration entity specified by identifier exists for specified Gateway entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// hcID - gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. -func (client GatewayHostnameConfigurationClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hcID, - Constraints: []validation.Constraint{{Target: "hcID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "hcID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, gatewayID, hcID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GatewayHostnameConfigurationClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, hcID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "hcId": autorest.Encode("path", hcID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayHostnameConfigurationClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GatewayHostnameConfigurationClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists the collection of hostname configurations for the specified gateway. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// gatewayID - gateway entity identifier. Must be unique in the current API Management service instance. Must -// not have value 'managed' -// top - number of records to return. -// skip - number of records to skip. -func (client GatewayHostnameConfigurationClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (result GatewayHostnameConfigurationCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.ListByService") - defer func() { - sc := -1 - if result.ghcc.Response.Response != nil { - sc = result.ghcc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: gatewayID, - Constraints: []validation.Constraint{{Target: "gatewayID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "gatewayID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GatewayHostnameConfigurationClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, gatewayID, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ghcc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "ListByService", resp, "Failure sending request") - return - } - - result.ghcc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ghcc.hasNextLink() && result.ghcc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GatewayHostnameConfigurationClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayId": autorest.Encode("path", gatewayID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayHostnameConfigurationClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GatewayHostnameConfigurationClient) ListByServiceResponder(resp *http.Response) (result GatewayHostnameConfigurationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GatewayHostnameConfigurationClient) listByServiceNextResults(ctx context.Context, lastResults GatewayHostnameConfigurationCollection) (result GatewayHostnameConfigurationCollection, err error) { - req, err := lastResults.gatewayHostnameConfigurationCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GatewayHostnameConfigurationClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GatewayHostnameConfigurationClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayID string, top *int32, skip *int32) (result GatewayHostnameConfigurationCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, gatewayID, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/group.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/group.go deleted file mode 100644 index 1e2165cc9911..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/group.go +++ /dev/null @@ -1,646 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GroupClient is the apiManagement Client -type GroupClient struct { - BaseClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient 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 NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a group. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client GroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/groups/{groupId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) 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 GroupClient) CreateOrUpdateResponder(resp *http.Response) (result GroupContract, 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 specific group of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GroupClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, groupID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 GroupClient) 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 GroupClient) 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 details of the group specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client GroupClient) Get(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/groups/{groupId}", 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 GroupClient) 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 GroupClient) GetResponder(resp *http.Response) (result GroupContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the group specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client GroupClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client GroupClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client GroupClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of groups defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| aadObjectId | filter | eq | |
-// top - number of records to return. -// skip - number of records to skip. -func (client GroupClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure sending request") - return - } - - result.gc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GroupClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GroupClient) ListByServiceResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client GroupClient) listByServiceNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.groupCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates the details of the group specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client GroupClient) Update(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 GroupClient) 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 GroupClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/groupuser.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/groupuser.go deleted file mode 100644 index 17688ac27a08..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/groupuser.go +++ /dev/null @@ -1,467 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GroupUserClient is the apiManagement Client -type GroupUserClient struct { - BaseClient -} - -// NewGroupUserClient creates an instance of the GroupUserClient client. -func NewGroupUserClient(subscriptionID string) GroupUserClient { - return NewGroupUserClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupUserClientWithBaseURI creates an instance of the GroupUserClient 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 NewGroupUserClientWithBaseURI(baseURI string, subscriptionID string) GroupUserClient { - return GroupUserClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists checks that user entity specified by identifier is associated with the group entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client GroupUserClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, groupID, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client GroupUserClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client GroupUserClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client GroupUserClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create add existing user to existing group -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client GroupUserClient) Create(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serviceName, groupID, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client GroupUserClient) CreatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", 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 GroupUserClient) 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 GroupUserClient) CreateResponder(resp *http.Response) (result UserContract, 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 remove existing user from existing group. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client GroupUserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, groupID, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupUserClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", 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 GroupUserClient) 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 GroupUserClient) 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 -} - -// List lists a collection of user entities associated with the group. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// groupID - group identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| firstName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| lastName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| email | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| registrationDate | filter | ge, le, eq, ne, gt, lt | |
| -// note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client GroupUserClient) List(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result UserCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.List") - defer func() { - sc := -1 - if result.uc.Response.Response != nil { - sc = result.uc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.GroupUserClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, groupID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.uc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "List", resp, "Failure sending request") - return - } - - result.uc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "List", resp, "Failure responding to request") - return - } - if result.uc.hasNextLink() && result.uc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupUserClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/groups/{groupId}/users", 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 GroupUserClient) 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 GroupUserClient) ListResponder(resp *http.Response) (result UserCollection, 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 GroupUserClient) listNextResults(ctx context.Context, lastResults UserCollection) (result UserCollection, err error) { - req, err := lastResults.userCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "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, "apimanagement.GroupUserClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUserClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupUserClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result UserCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupUserClient.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, serviceName, groupID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/identityprovider.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/identityprovider.go deleted file mode 100644 index 337592732f5b..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/identityprovider.go +++ /dev/null @@ -1,696 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IdentityProviderClient is the apiManagement Client -type IdentityProviderClient struct { - BaseClient -} - -// NewIdentityProviderClient creates an instance of the IdentityProviderClient client. -func NewIdentityProviderClient(subscriptionID string) IdentityProviderClient { - return NewIdentityProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIdentityProviderClientWithBaseURI creates an instance of the IdentityProviderClient 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 NewIdentityProviderClientWithBaseURI(baseURI string, subscriptionID string) IdentityProviderClient { - return IdentityProviderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates the IdentityProvider configuration. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client IdentityProviderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderCreateContract, ifMatch string) (result IdentityProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IdentityProviderCreateContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.IdentityProviderCreateContractProperties.ClientID", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.IdentityProviderCreateContractProperties.ClientID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {Target: "parameters.IdentityProviderCreateContractProperties.ClientSecret", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.IdentityProviderCreateContractProperties.ClientSecret", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, identityProviderName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IdentityProviderClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderCreateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) 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 IdentityProviderClient) CreateOrUpdateResponder(resp *http.Response) (result IdentityProviderContract, 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 specified identity provider configuration. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client IdentityProviderClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, identityProviderName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IdentityProviderClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 IdentityProviderClient) 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 IdentityProviderClient) 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 configuration details of the identity Provider configured in specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -func (client IdentityProviderClient) Get(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (result IdentityProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, identityProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IdentityProviderClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", 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 IdentityProviderClient) 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 IdentityProviderClient) GetResponder(resp *http.Response) (result IdentityProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the identityProvider specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -func (client IdentityProviderClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, identityProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client IdentityProviderClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of Identity Provider configured in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client IdentityProviderClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result IdentityProviderListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.ListByService") - defer func() { - sc := -1 - if result.ipl.Response.Response != nil { - sc = result.ipl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ipl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListByService", resp, "Failure sending request") - return - } - - result.ipl, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ipl.hasNextLink() && result.ipl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client IdentityProviderClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/identityProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) ListByServiceResponder(resp *http.Response) (result IdentityProviderList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client IdentityProviderClient) listByServiceNextResults(ctx context.Context, lastResults IdentityProviderList) (result IdentityProviderList, err error) { - req, err := lastResults.identityProviderListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IdentityProviderClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result IdentityProviderListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName) - return -} - -// ListSecrets gets the client secret details of the Identity Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -func (client IdentityProviderClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (result ClientSecretContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.ListSecrets") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName, identityProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client IdentityProviderClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProviderClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client IdentityProviderClient) ListSecretsResponder(resp *http.Response) (result ClientSecretContract, 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 IdentityProvider configuration. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// identityProviderName - identity Provider Type identifier. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client IdentityProviderClient) Update(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IdentityProviderClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, identityProviderName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProviderClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IdentityProviderClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, identityProviderName IdentityProviderType, parameters IdentityProviderUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 IdentityProviderClient) 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 IdentityProviderClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/issue.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/issue.go deleted file mode 100644 index e8f389770cf3..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/issue.go +++ /dev/null @@ -1,272 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IssueClient is the apiManagement Client -type IssueClient struct { - BaseClient -} - -// NewIssueClient creates an instance of the IssueClient client. -func NewIssueClient(subscriptionID string) IssueClient { - return NewIssueClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIssueClientWithBaseURI creates an instance of the IssueClient 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 NewIssueClientWithBaseURI(baseURI string, subscriptionID string) IssueClient { - return IssueClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets API Management issue details -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// issueID - issue identifier. Must be unique in the current API Management service instance. -func (client IssueClient) Get(ctx context.Context, resourceGroupName string, serviceName string, issueID string) (result IssueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: issueID, - Constraints: []validation.Constraint{{Target: "issueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "issueID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "issueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.IssueClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, issueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IssueClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, issueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "issueId": autorest.Encode("path", issueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/issues/{issueId}", 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 IssueClient) 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 IssueClient) GetResponder(resp *http.Response) (result IssueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of issues in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| apiId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| title | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| authorName | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| state | filter | eq | |
-// top - number of records to return. -// skip - number of records to skip. -func (client IssueClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result IssueCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueClient.ListByService") - defer func() { - sc := -1 - if result.ic.Response.Response != nil { - sc = result.ic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.IssueClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.ic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "ListByService", resp, "Failure sending request") - return - } - - result.ic, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "ListByService", resp, "Failure responding to request") - return - } - if result.ic.hasNextLink() && result.ic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client IssueClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/issues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client IssueClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client IssueClient) ListByServiceResponder(resp *http.Response) (result IssueCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client IssueClient) listByServiceNextResults(ctx context.Context, lastResults IssueCollection) (result IssueCollection, err error) { - req, err := lastResults.issueCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.IssueClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.IssueClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IssueClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IssueClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result IssueCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/logger.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/logger.go deleted file mode 100644 index 5f8fdd5e2d1a..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/logger.go +++ /dev/null @@ -1,649 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LoggerClient is the apiManagement Client -type LoggerClient struct { - BaseClient -} - -// NewLoggerClient creates an instance of the LoggerClient client. -func NewLoggerClient(subscriptionID string) LoggerClient { - return NewLoggerClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLoggerClientWithBaseURI creates an instance of the LoggerClient 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 NewLoggerClientWithBaseURI(baseURI string, subscriptionID string) LoggerClient { - return LoggerClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a logger. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client LoggerClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerContract, ifMatch string) (result LoggerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LoggerContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LoggerContractProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LoggerContractProperties.Description", Name: validation.MaxLength, Rule: 256, Chain: nil}}}, - {Target: "parameters.LoggerContractProperties.Credentials", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, loggerID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LoggerClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/loggers/{loggerId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) 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 LoggerClient) CreateOrUpdateResponder(resp *http.Response) (result LoggerContract, 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 specified logger. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// force - force deletion even if diagnostic is attached. -func (client LoggerClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, ifMatch string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, loggerID, ifMatch, force) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LoggerClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, ifMatch string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 LoggerClient) 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 LoggerClient) 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 details of the logger specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -func (client LoggerClient) Get(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result LoggerContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, loggerID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LoggerClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/loggers/{loggerId}", 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 LoggerClient) 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 LoggerClient) GetResponder(resp *http.Response) (result LoggerContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the logger specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -func (client LoggerClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, loggerID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client LoggerClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client LoggerClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of loggers in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| loggerType | filter | eq | |
| resourceId | -// filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client LoggerClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.ListByService") - defer func() { - sc := -1 - if result.lc.Response.Response != nil { - sc = result.lc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.lc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "ListByService", resp, "Failure sending request") - return - } - - result.lc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "ListByService", resp, "Failure responding to request") - return - } - if result.lc.hasNextLink() && result.lc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client LoggerClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/loggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client LoggerClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client LoggerClient) ListByServiceResponder(resp *http.Response) (result LoggerCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client LoggerClient) listByServiceNextResults(ctx context.Context, lastResults LoggerCollection) (result LoggerCollection, err error) { - req, err := lastResults.loggerCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client LoggerClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// Update updates an existing logger. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// loggerID - logger identifier. Must be unique in the API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client LoggerClient) Update(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerID, - Constraints: []validation.Constraint{{Target: "loggerID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.LoggerClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, loggerID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggerClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LoggerClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, loggerID string, parameters LoggerUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerId": autorest.Encode("path", loggerID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/loggers/{loggerId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 LoggerClient) 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 LoggerClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/models.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/models.go deleted file mode 100644 index 2c6b2a8586ef..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/models.go +++ /dev/null @@ -1,13635 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement" - -// AccessInformationContract tenant access information contract of the API Management service. -type AccessInformationContract struct { - autorest.Response `json:"-"` - // ID - Identifier. - ID *string `json:"id,omitempty"` - // PrimaryKey - Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // Enabled - Determines whether direct access is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// AccessInformationUpdateParameterProperties tenant access information update parameters of the API -// Management service -type AccessInformationUpdateParameterProperties struct { - // Enabled - Determines whether direct access is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// AccessInformationUpdateParameters tenant access information update parameters. -type AccessInformationUpdateParameters struct { - // AccessInformationUpdateParameterProperties - Tenant access information update parameter properties. - *AccessInformationUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessInformationUpdateParameters. -func (aiup AccessInformationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aiup.AccessInformationUpdateParameterProperties != nil { - objectMap["properties"] = aiup.AccessInformationUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccessInformationUpdateParameters struct. -func (aiup *AccessInformationUpdateParameters) 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 accessInformationUpdateParameterProperties AccessInformationUpdateParameterProperties - err = json.Unmarshal(*v, &accessInformationUpdateParameterProperties) - if err != nil { - return err - } - aiup.AccessInformationUpdateParameterProperties = &accessInformationUpdateParameterProperties - } - } - } - - return nil -} - -// AdditionalLocation description of an additional API Management resource location. -type AdditionalLocation struct { - // Location - The location name of the additional region among Azure Data center regions. - Location *string `json:"location,omitempty"` - // Sku - SKU properties of the API Management service. - Sku *ServiceSkuProperties `json:"sku,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in the additional location. Available only for Basic, Standard and Premium SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service which is deployed in an Internal Virtual Network in a particular additional location. Available only for Basic, Standard and Premium SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration for the location. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // DisableGateway - Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. - DisableGateway *bool `json:"disableGateway,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdditionalLocation. -func (al AdditionalLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if al.Location != nil { - objectMap["location"] = al.Location - } - if al.Sku != nil { - objectMap["sku"] = al.Sku - } - if al.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = al.VirtualNetworkConfiguration - } - if al.DisableGateway != nil { - objectMap["disableGateway"] = al.DisableGateway - } - return json.Marshal(objectMap) -} - -// APICollection paged Api list representation. -type APICollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]APIContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for APICollection. -func (ac APICollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APICollectionIterator provides access to a complete listing of APIContract values. -type APICollectionIterator struct { - i int - page APICollectionPage -} - -// 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 *APICollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APICollectionIterator.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 *APICollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APICollectionIterator) 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 APICollectionIterator) Response() APICollection { - 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 APICollectionIterator) Value() APIContract { - if !iter.page.NotDone() { - return APIContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APICollectionIterator type. -func NewAPICollectionIterator(page APICollectionPage) APICollectionIterator { - return APICollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ac APICollection) IsEmpty() bool { - return ac.Value == nil || len(*ac.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ac APICollection) hasNextLink() bool { - return ac.NextLink != nil && len(*ac.NextLink) != 0 -} - -// aPICollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ac APICollection) aPICollectionPreparer(ctx context.Context) (*http.Request, error) { - if !ac.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ac.NextLink))) -} - -// APICollectionPage contains a page of APIContract values. -type APICollectionPage struct { - fn func(context.Context, APICollection) (APICollection, error) - ac APICollection -} - -// 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 *APICollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APICollectionPage.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.ac) - if err != nil { - return err - } - page.ac = 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 *APICollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APICollectionPage) NotDone() bool { - return !page.ac.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APICollectionPage) Response() APICollection { - return page.ac -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APICollectionPage) Values() []APIContract { - if page.ac.IsEmpty() { - return nil - } - return *page.ac.Value -} - -// Creates a new instance of the APICollectionPage type. -func NewAPICollectionPage(cur APICollection, getNextPage func(context.Context, APICollection) (APICollection, error)) APICollectionPage { - return APICollectionPage{ - fn: getNextPage, - ac: cur, - } -} - -// APIContract api details. -type APIContract struct { - autorest.Response `json:"-"` - // APIContractProperties - Api entity contract properties. - *APIContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIContract. -func (ac APIContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ac.APIContractProperties != nil { - objectMap["properties"] = ac.APIContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIContract struct. -func (ac *APIContract) 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 APIContractProperties APIContractProperties - err = json.Unmarshal(*v, &APIContractProperties) - if err != nil { - return err - } - ac.APIContractProperties = &APIContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ac.Type = &typeVar - } - } - } - - return nil -} - -// APIContractProperties api Entity Properties -type APIContractProperties struct { - // SourceAPIID - API identifier of the source API. - SourceAPIID *string `json:"sourceApiId,omitempty"` - // DisplayName - API name. Must be 1 to 300 characters long. - DisplayName *string `json:"displayName,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // APIVersionSet - Version set details - APIVersionSet *APIVersionSetContractDetails `json:"apiVersionSet,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIContractProperties. -func (acp APIContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acp.SourceAPIID != nil { - objectMap["sourceApiId"] = acp.SourceAPIID - } - if acp.DisplayName != nil { - objectMap["displayName"] = acp.DisplayName - } - if acp.ServiceURL != nil { - objectMap["serviceUrl"] = acp.ServiceURL - } - if acp.Path != nil { - objectMap["path"] = acp.Path - } - if acp.Protocols != nil { - objectMap["protocols"] = acp.Protocols - } - if acp.APIVersionSet != nil { - objectMap["apiVersionSet"] = acp.APIVersionSet - } - if acp.Description != nil { - objectMap["description"] = acp.Description - } - if acp.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = acp.AuthenticationSettings - } - if acp.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = acp.SubscriptionKeyParameterNames - } - if acp.APIType != "" { - objectMap["type"] = acp.APIType - } - if acp.APIRevision != nil { - objectMap["apiRevision"] = acp.APIRevision - } - if acp.APIVersion != nil { - objectMap["apiVersion"] = acp.APIVersion - } - if acp.IsCurrent != nil { - objectMap["isCurrent"] = acp.IsCurrent - } - if acp.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = acp.APIRevisionDescription - } - if acp.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = acp.APIVersionDescription - } - if acp.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = acp.APIVersionSetID - } - if acp.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = acp.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APIContractUpdateProperties API update contract properties. -type APIContractUpdateProperties struct { - // DisplayName - API name. - DisplayName *string `json:"displayName,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIContractUpdateProperties. -func (acup APIContractUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acup.DisplayName != nil { - objectMap["displayName"] = acup.DisplayName - } - if acup.ServiceURL != nil { - objectMap["serviceUrl"] = acup.ServiceURL - } - if acup.Path != nil { - objectMap["path"] = acup.Path - } - if acup.Protocols != nil { - objectMap["protocols"] = acup.Protocols - } - if acup.Description != nil { - objectMap["description"] = acup.Description - } - if acup.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = acup.AuthenticationSettings - } - if acup.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = acup.SubscriptionKeyParameterNames - } - if acup.APIType != "" { - objectMap["type"] = acup.APIType - } - if acup.APIRevision != nil { - objectMap["apiRevision"] = acup.APIRevision - } - if acup.APIVersion != nil { - objectMap["apiVersion"] = acup.APIVersion - } - if acup.IsCurrent != nil { - objectMap["isCurrent"] = acup.IsCurrent - } - if acup.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = acup.APIRevisionDescription - } - if acup.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = acup.APIVersionDescription - } - if acup.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = acup.APIVersionSetID - } - if acup.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = acup.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APICreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type APICreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(APIClient) (APIContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *APICreateOrUpdateFuture) 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 APICreateOrUpdateFuture.Result. -func (future *APICreateOrUpdateFuture) result(client APIClient) (ac APIContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APICreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ac.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.APICreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ac.Response.Response, err = future.GetResult(sender); err == nil && ac.Response.Response.StatusCode != http.StatusNoContent { - ac, err = client.CreateOrUpdateResponder(ac.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APICreateOrUpdateFuture", "Result", ac.Response.Response, "Failure responding to request") - } - } - return -} - -// APICreateOrUpdateParameter API Create or Update Parameters. -type APICreateOrUpdateParameter struct { - // APICreateOrUpdateProperties - Api entity create of update properties. - *APICreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for APICreateOrUpdateParameter. -func (acoup APICreateOrUpdateParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acoup.APICreateOrUpdateProperties != nil { - objectMap["properties"] = acoup.APICreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APICreateOrUpdateParameter struct. -func (acoup *APICreateOrUpdateParameter) 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 APICreateOrUpdateProperties APICreateOrUpdateProperties - err = json.Unmarshal(*v, &APICreateOrUpdateProperties) - if err != nil { - return err - } - acoup.APICreateOrUpdateProperties = &APICreateOrUpdateProperties - } - } - } - - return nil -} - -// APICreateOrUpdateProperties api Create or Update Properties. -type APICreateOrUpdateProperties struct { - // Value - Content value when Importing an API. - Value *string `json:"value,omitempty"` - // Format - Format of the Content in which the API is getting imported. Possible values include: 'WadlXML', 'WadlLinkJSON', 'SwaggerJSON', 'SwaggerLinkJSON', 'Wsdl', 'WsdlLink', 'Openapi', 'Openapijson', 'OpenapiLink', 'OpenapijsonLink' - Format ContentFormat `json:"format,omitempty"` - // WsdlSelector - Criteria to limit import of WSDL to a subset of the document. - WsdlSelector *APICreateOrUpdatePropertiesWsdlSelector `json:"wsdlSelector,omitempty"` - // SoapAPIType - Type of Api to create. - // * `http` creates a SOAP to REST API - // * `soap` creates a SOAP pass-through API. Possible values include: 'SoapToRest', 'SoapPassThrough' - SoapAPIType SoapAPIType `json:"apiType,omitempty"` - // SourceAPIID - API identifier of the source API. - SourceAPIID *string `json:"sourceApiId,omitempty"` - // DisplayName - API name. Must be 1 to 300 characters long. - DisplayName *string `json:"displayName,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // APIVersionSet - Version set details - APIVersionSet *APIVersionSetContractDetails `json:"apiVersionSet,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APICreateOrUpdateProperties. -func (acoup APICreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acoup.Value != nil { - objectMap["value"] = acoup.Value - } - if acoup.Format != "" { - objectMap["format"] = acoup.Format - } - if acoup.WsdlSelector != nil { - objectMap["wsdlSelector"] = acoup.WsdlSelector - } - if acoup.SoapAPIType != "" { - objectMap["apiType"] = acoup.SoapAPIType - } - if acoup.SourceAPIID != nil { - objectMap["sourceApiId"] = acoup.SourceAPIID - } - if acoup.DisplayName != nil { - objectMap["displayName"] = acoup.DisplayName - } - if acoup.ServiceURL != nil { - objectMap["serviceUrl"] = acoup.ServiceURL - } - if acoup.Path != nil { - objectMap["path"] = acoup.Path - } - if acoup.Protocols != nil { - objectMap["protocols"] = acoup.Protocols - } - if acoup.APIVersionSet != nil { - objectMap["apiVersionSet"] = acoup.APIVersionSet - } - if acoup.Description != nil { - objectMap["description"] = acoup.Description - } - if acoup.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = acoup.AuthenticationSettings - } - if acoup.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = acoup.SubscriptionKeyParameterNames - } - if acoup.APIType != "" { - objectMap["type"] = acoup.APIType - } - if acoup.APIRevision != nil { - objectMap["apiRevision"] = acoup.APIRevision - } - if acoup.APIVersion != nil { - objectMap["apiVersion"] = acoup.APIVersion - } - if acoup.IsCurrent != nil { - objectMap["isCurrent"] = acoup.IsCurrent - } - if acoup.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = acoup.APIRevisionDescription - } - if acoup.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = acoup.APIVersionDescription - } - if acoup.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = acoup.APIVersionSetID - } - if acoup.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = acoup.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APICreateOrUpdatePropertiesWsdlSelector criteria to limit import of WSDL to a subset of the document. -type APICreateOrUpdatePropertiesWsdlSelector struct { - // WsdlServiceName - Name of service to import from WSDL - WsdlServiceName *string `json:"wsdlServiceName,omitempty"` - // WsdlEndpointName - Name of endpoint(port) to import from WSDL - WsdlEndpointName *string `json:"wsdlEndpointName,omitempty"` -} - -// APIEntityBaseContract API base contract details. -type APIEntityBaseContract struct { - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIEntityBaseContract. -func (aebc APIEntityBaseContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aebc.Description != nil { - objectMap["description"] = aebc.Description - } - if aebc.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = aebc.AuthenticationSettings - } - if aebc.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = aebc.SubscriptionKeyParameterNames - } - if aebc.APIType != "" { - objectMap["type"] = aebc.APIType - } - if aebc.APIRevision != nil { - objectMap["apiRevision"] = aebc.APIRevision - } - if aebc.APIVersion != nil { - objectMap["apiVersion"] = aebc.APIVersion - } - if aebc.IsCurrent != nil { - objectMap["isCurrent"] = aebc.IsCurrent - } - if aebc.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = aebc.APIRevisionDescription - } - if aebc.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = aebc.APIVersionDescription - } - if aebc.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = aebc.APIVersionSetID - } - if aebc.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = aebc.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APIExportResult API Export result. -type APIExportResult struct { - autorest.Response `json:"-"` - // ID - ResourceId of the API which was exported. - ID *string `json:"id,omitempty"` - // ExportResultFormat - Format in which the Api Details are exported to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: 'ExportResultFormatSwagger', 'ExportResultFormatWsdl', 'ExportResultFormatWadl', 'ExportResultFormatOpenAPI' - ExportResultFormat ExportResultFormat `json:"format,omitempty"` - // Value - The object defining the schema of the exported Api Detail - Value *APIExportResultValue `json:"value,omitempty"` -} - -// APIExportResultValue the object defining the schema of the exported Api Detail -type APIExportResultValue struct { - // Link - Link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes. - Link *string `json:"link,omitempty"` -} - -// ApimResource the Resource definition. -type ApimResource 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 for API Management resource is set to Microsoft.ApiManagement. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApimResource. -func (ar ApimResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Tags != nil { - objectMap["tags"] = ar.Tags - } - return json.Marshal(objectMap) -} - -// APIReleaseCollection paged ApiRelease list representation. -type APIReleaseCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]APIReleaseContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReleaseCollection. -func (arc APIReleaseCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIReleaseCollectionIterator provides access to a complete listing of APIReleaseContract values. -type APIReleaseCollectionIterator struct { - i int - page APIReleaseCollectionPage -} - -// 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 *APIReleaseCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseCollectionIterator.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 *APIReleaseCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIReleaseCollectionIterator) 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 APIReleaseCollectionIterator) Response() APIReleaseCollection { - 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 APIReleaseCollectionIterator) Value() APIReleaseContract { - if !iter.page.NotDone() { - return APIReleaseContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIReleaseCollectionIterator type. -func NewAPIReleaseCollectionIterator(page APIReleaseCollectionPage) APIReleaseCollectionIterator { - return APIReleaseCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arc APIReleaseCollection) IsEmpty() bool { - return arc.Value == nil || len(*arc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arc APIReleaseCollection) hasNextLink() bool { - return arc.NextLink != nil && len(*arc.NextLink) != 0 -} - -// aPIReleaseCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arc APIReleaseCollection) aPIReleaseCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !arc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arc.NextLink))) -} - -// APIReleaseCollectionPage contains a page of APIReleaseContract values. -type APIReleaseCollectionPage struct { - fn func(context.Context, APIReleaseCollection) (APIReleaseCollection, error) - arc APIReleaseCollection -} - -// 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 *APIReleaseCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIReleaseCollectionPage.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.arc) - if err != nil { - return err - } - page.arc = 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 *APIReleaseCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIReleaseCollectionPage) NotDone() bool { - return !page.arc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIReleaseCollectionPage) Response() APIReleaseCollection { - return page.arc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIReleaseCollectionPage) Values() []APIReleaseContract { - if page.arc.IsEmpty() { - return nil - } - return *page.arc.Value -} - -// Creates a new instance of the APIReleaseCollectionPage type. -func NewAPIReleaseCollectionPage(cur APIReleaseCollection, getNextPage func(context.Context, APIReleaseCollection) (APIReleaseCollection, error)) APIReleaseCollectionPage { - return APIReleaseCollectionPage{ - fn: getNextPage, - arc: cur, - } -} - -// APIReleaseContract apiRelease details. -type APIReleaseContract struct { - autorest.Response `json:"-"` - // APIReleaseContractProperties - ApiRelease entity contract properties. - *APIReleaseContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReleaseContract. -func (arc APIReleaseContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arc.APIReleaseContractProperties != nil { - objectMap["properties"] = arc.APIReleaseContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIReleaseContract struct. -func (arc *APIReleaseContract) 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 APIReleaseContractProperties APIReleaseContractProperties - err = json.Unmarshal(*v, &APIReleaseContractProperties) - if err != nil { - return err - } - arc.APIReleaseContractProperties = &APIReleaseContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arc.Type = &typeVar - } - } - } - - return nil -} - -// APIReleaseContractProperties API Release details -type APIReleaseContractProperties struct { - // APIID - Identifier of the API the release belongs to. - APIID *string `json:"apiId,omitempty"` - // CreatedDateTime - READ-ONLY; The time the API was released. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - // UpdatedDateTime - READ-ONLY; The time the API release was updated. - UpdatedDateTime *date.Time `json:"updatedDateTime,omitempty"` - // Notes - Release Notes - Notes *string `json:"notes,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReleaseContractProperties. -func (arcp APIReleaseContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arcp.APIID != nil { - objectMap["apiId"] = arcp.APIID - } - if arcp.Notes != nil { - objectMap["notes"] = arcp.Notes - } - return json.Marshal(objectMap) -} - -// APIRevisionCollection paged Api Revision list representation. -type APIRevisionCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]APIRevisionContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIRevisionCollection. -func (arc APIRevisionCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIRevisionCollectionIterator provides access to a complete listing of APIRevisionContract values. -type APIRevisionCollectionIterator struct { - i int - page APIRevisionCollectionPage -} - -// 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 *APIRevisionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionCollectionIterator.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 *APIRevisionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIRevisionCollectionIterator) 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 APIRevisionCollectionIterator) Response() APIRevisionCollection { - 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 APIRevisionCollectionIterator) Value() APIRevisionContract { - if !iter.page.NotDone() { - return APIRevisionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIRevisionCollectionIterator type. -func NewAPIRevisionCollectionIterator(page APIRevisionCollectionPage) APIRevisionCollectionIterator { - return APIRevisionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arc APIRevisionCollection) IsEmpty() bool { - return arc.Value == nil || len(*arc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arc APIRevisionCollection) hasNextLink() bool { - return arc.NextLink != nil && len(*arc.NextLink) != 0 -} - -// aPIRevisionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arc APIRevisionCollection) aPIRevisionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !arc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arc.NextLink))) -} - -// APIRevisionCollectionPage contains a page of APIRevisionContract values. -type APIRevisionCollectionPage struct { - fn func(context.Context, APIRevisionCollection) (APIRevisionCollection, error) - arc APIRevisionCollection -} - -// 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 *APIRevisionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIRevisionCollectionPage.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.arc) - if err != nil { - return err - } - page.arc = 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 *APIRevisionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIRevisionCollectionPage) NotDone() bool { - return !page.arc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIRevisionCollectionPage) Response() APIRevisionCollection { - return page.arc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIRevisionCollectionPage) Values() []APIRevisionContract { - if page.arc.IsEmpty() { - return nil - } - return *page.arc.Value -} - -// Creates a new instance of the APIRevisionCollectionPage type. -func NewAPIRevisionCollectionPage(cur APIRevisionCollection, getNextPage func(context.Context, APIRevisionCollection) (APIRevisionCollection, error)) APIRevisionCollectionPage { - return APIRevisionCollectionPage{ - fn: getNextPage, - arc: cur, - } -} - -// APIRevisionContract summary of revision metadata. -type APIRevisionContract struct { - // APIID - READ-ONLY; Identifier of the API Revision. - APIID *string `json:"apiId,omitempty"` - // APIRevision - READ-ONLY; Revision number of API. - APIRevision *string `json:"apiRevision,omitempty"` - // CreatedDateTime - READ-ONLY; The time the API Revision was created. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - // UpdatedDateTime - READ-ONLY; The time the API Revision were updated. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - UpdatedDateTime *date.Time `json:"updatedDateTime,omitempty"` - // Description - READ-ONLY; Description of the API Revision. - Description *string `json:"description,omitempty"` - // PrivateURL - READ-ONLY; Gateway URL for accessing the non-current API Revision. - PrivateURL *string `json:"privateUrl,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is the current api revision. - IsOnline *bool `json:"isOnline,omitempty"` - // IsCurrent - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsCurrent *bool `json:"isCurrent,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIRevisionContract. -func (arc APIRevisionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIRevisionInfoContract object used to create an API Revision or Version based on an existing API -// Revision -type APIRevisionInfoContract struct { - // SourceAPIID - Resource identifier of API to be used to create the revision from. - SourceAPIID *string `json:"sourceApiId,omitempty"` - // APIVersionName - Version identifier for the new API Version. - APIVersionName *string `json:"apiVersionName,omitempty"` - // APIRevisionDescription - Description of new API Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionSet - Version set details - APIVersionSet *APIVersionSetContractDetails `json:"apiVersionSet,omitempty"` -} - -// APISchemaCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type APISchemaCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(APISchemaClient) (SchemaContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *APISchemaCreateOrUpdateFuture) 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 APISchemaCreateOrUpdateFuture.Result. -func (future *APISchemaCreateOrUpdateFuture) result(client APISchemaClient) (sc SchemaContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.APISchemaCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sc.Response.Response, err = future.GetResult(sender); err == nil && sc.Response.Response.StatusCode != http.StatusNoContent { - sc, err = client.CreateOrUpdateResponder(sc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APISchemaCreateOrUpdateFuture", "Result", sc.Response.Response, "Failure responding to request") - } - } - return -} - -// APITagResourceContractProperties API contract properties for the Tag Resources. -type APITagResourceContractProperties struct { - // ID - API identifier in the form /apis/{apiId}. - ID *string `json:"id,omitempty"` - // Name - API name. - Name *string `json:"name,omitempty"` - // ServiceURL - Absolute URL of the backend service implementing this API. - ServiceURL *string `json:"serviceUrl,omitempty"` - // Path - Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - Path *string `json:"path,omitempty"` - // Protocols - Describes on which protocols the operations in this API can be invoked. - Protocols *[]Protocol `json:"protocols,omitempty"` - // Description - Description of the API. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthenticationSettings - Collection of authentication settings included into this API. - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - // SubscriptionKeyParameterNames - Protocols over which API is made available. - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - // APIType - Type of API. Possible values include: 'HTTP', 'Soap' - APIType APIType `json:"type,omitempty"` - // APIRevision - Describes the Revision of the Api. If no value is provided, default revision 1 is created - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - Indicates the Version identifier of the API if the API is versioned - APIVersion *string `json:"apiVersion,omitempty"` - // IsCurrent - Indicates if API revision is current api revision. - IsCurrent *bool `json:"isCurrent,omitempty"` - // IsOnline - READ-ONLY; Indicates if API revision is accessible via the gateway. - IsOnline *bool `json:"isOnline,omitempty"` - // APIRevisionDescription - Description of the Api Revision. - APIRevisionDescription *string `json:"apiRevisionDescription,omitempty"` - // APIVersionDescription - Description of the Api Version. - APIVersionDescription *string `json:"apiVersionDescription,omitempty"` - // APIVersionSetID - A resource identifier for the related ApiVersionSet. - APIVersionSetID *string `json:"apiVersionSetId,omitempty"` - // SubscriptionRequired - Specifies whether an API or Product subscription is required for accessing the API. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for APITagResourceContractProperties. -func (atrcp APITagResourceContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atrcp.ID != nil { - objectMap["id"] = atrcp.ID - } - if atrcp.Name != nil { - objectMap["name"] = atrcp.Name - } - if atrcp.ServiceURL != nil { - objectMap["serviceUrl"] = atrcp.ServiceURL - } - if atrcp.Path != nil { - objectMap["path"] = atrcp.Path - } - if atrcp.Protocols != nil { - objectMap["protocols"] = atrcp.Protocols - } - if atrcp.Description != nil { - objectMap["description"] = atrcp.Description - } - if atrcp.AuthenticationSettings != nil { - objectMap["authenticationSettings"] = atrcp.AuthenticationSettings - } - if atrcp.SubscriptionKeyParameterNames != nil { - objectMap["subscriptionKeyParameterNames"] = atrcp.SubscriptionKeyParameterNames - } - if atrcp.APIType != "" { - objectMap["type"] = atrcp.APIType - } - if atrcp.APIRevision != nil { - objectMap["apiRevision"] = atrcp.APIRevision - } - if atrcp.APIVersion != nil { - objectMap["apiVersion"] = atrcp.APIVersion - } - if atrcp.IsCurrent != nil { - objectMap["isCurrent"] = atrcp.IsCurrent - } - if atrcp.APIRevisionDescription != nil { - objectMap["apiRevisionDescription"] = atrcp.APIRevisionDescription - } - if atrcp.APIVersionDescription != nil { - objectMap["apiVersionDescription"] = atrcp.APIVersionDescription - } - if atrcp.APIVersionSetID != nil { - objectMap["apiVersionSetId"] = atrcp.APIVersionSetID - } - if atrcp.SubscriptionRequired != nil { - objectMap["subscriptionRequired"] = atrcp.SubscriptionRequired - } - return json.Marshal(objectMap) -} - -// APIUpdateContract API update contract details. -type APIUpdateContract struct { - // APIContractUpdateProperties - Properties of the API entity that can be updated. - *APIContractUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIUpdateContract. -func (auc APIUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if auc.APIContractUpdateProperties != nil { - objectMap["properties"] = auc.APIContractUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIUpdateContract struct. -func (auc *APIUpdateContract) 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 APIContractUpdateProperties APIContractUpdateProperties - err = json.Unmarshal(*v, &APIContractUpdateProperties) - if err != nil { - return err - } - auc.APIContractUpdateProperties = &APIContractUpdateProperties - } - } - } - - return nil -} - -// APIVersionConstraint control Plane Apis version constraint for the API Management service. -type APIVersionConstraint struct { - // MinAPIVersion - Limit control plane API calls to API Management service with version equal to or newer than this value. - MinAPIVersion *string `json:"minApiVersion,omitempty"` -} - -// APIVersionSetCollection paged Api Version Set list representation. -type APIVersionSetCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]APIVersionSetContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// APIVersionSetCollectionIterator provides access to a complete listing of APIVersionSetContract values. -type APIVersionSetCollectionIterator struct { - i int - page APIVersionSetCollectionPage -} - -// 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 *APIVersionSetCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetCollectionIterator.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 *APIVersionSetCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIVersionSetCollectionIterator) 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 APIVersionSetCollectionIterator) Response() APIVersionSetCollection { - 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 APIVersionSetCollectionIterator) Value() APIVersionSetContract { - if !iter.page.NotDone() { - return APIVersionSetContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIVersionSetCollectionIterator type. -func NewAPIVersionSetCollectionIterator(page APIVersionSetCollectionPage) APIVersionSetCollectionIterator { - return APIVersionSetCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (avsc APIVersionSetCollection) IsEmpty() bool { - return avsc.Value == nil || len(*avsc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (avsc APIVersionSetCollection) hasNextLink() bool { - return avsc.NextLink != nil && len(*avsc.NextLink) != 0 -} - -// aPIVersionSetCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (avsc APIVersionSetCollection) aPIVersionSetCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !avsc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(avsc.NextLink))) -} - -// APIVersionSetCollectionPage contains a page of APIVersionSetContract values. -type APIVersionSetCollectionPage struct { - fn func(context.Context, APIVersionSetCollection) (APIVersionSetCollection, error) - avsc APIVersionSetCollection -} - -// 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 *APIVersionSetCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIVersionSetCollectionPage.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.avsc) - if err != nil { - return err - } - page.avsc = 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 *APIVersionSetCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIVersionSetCollectionPage) NotDone() bool { - return !page.avsc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIVersionSetCollectionPage) Response() APIVersionSetCollection { - return page.avsc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIVersionSetCollectionPage) Values() []APIVersionSetContract { - if page.avsc.IsEmpty() { - return nil - } - return *page.avsc.Value -} - -// Creates a new instance of the APIVersionSetCollectionPage type. -func NewAPIVersionSetCollectionPage(cur APIVersionSetCollection, getNextPage func(context.Context, APIVersionSetCollection) (APIVersionSetCollection, error)) APIVersionSetCollectionPage { - return APIVersionSetCollectionPage{ - fn: getNextPage, - avsc: cur, - } -} - -// APIVersionSetContract api Version Set Contract details. -type APIVersionSetContract struct { - autorest.Response `json:"-"` - // APIVersionSetContractProperties - Api VersionSet contract properties. - *APIVersionSetContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIVersionSetContract. -func (avsc APIVersionSetContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if avsc.APIVersionSetContractProperties != nil { - objectMap["properties"] = avsc.APIVersionSetContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIVersionSetContract struct. -func (avsc *APIVersionSetContract) 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 APIVersionSetContractProperties APIVersionSetContractProperties - err = json.Unmarshal(*v, &APIVersionSetContractProperties) - if err != nil { - return err - } - avsc.APIVersionSetContractProperties = &APIVersionSetContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - avsc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - avsc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - avsc.Type = &typeVar - } - } - } - - return nil -} - -// APIVersionSetContractDetails an API Version Set contains the common configuration for a set of API -// Versions relating -type APIVersionSetContractDetails struct { - // ID - Identifier for existing API Version Set. Omit this value to create a new Version Set. - ID *string `json:"id,omitempty"` - // Name - The display Name of the API Version Set. - Name *string `json:"name,omitempty"` - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersioningScheme - An value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'VersioningScheme1Segment', 'VersioningScheme1Query', 'VersioningScheme1Header' - VersioningScheme VersioningScheme1 `json:"versioningScheme,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// APIVersionSetContractProperties properties of an API Version Set. -type APIVersionSetContractProperties struct { - // DisplayName - Name of API Version Set - DisplayName *string `json:"displayName,omitempty"` - // VersioningScheme - An value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'VersioningSchemeSegment', 'VersioningSchemeQuery', 'VersioningSchemeHeader' - VersioningScheme VersioningScheme `json:"versioningScheme,omitempty"` - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// APIVersionSetEntityBase api Version set base parameters -type APIVersionSetEntityBase struct { - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// APIVersionSetUpdateParameters parameters to update or create an Api Version Set Contract. -type APIVersionSetUpdateParameters struct { - // APIVersionSetUpdateParametersProperties - Parameters to update or create an Api Version Set Contract. - *APIVersionSetUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIVersionSetUpdateParameters. -func (avsup APIVersionSetUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if avsup.APIVersionSetUpdateParametersProperties != nil { - objectMap["properties"] = avsup.APIVersionSetUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for APIVersionSetUpdateParameters struct. -func (avsup *APIVersionSetUpdateParameters) 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 APIVersionSetUpdateParametersProperties APIVersionSetUpdateParametersProperties - err = json.Unmarshal(*v, &APIVersionSetUpdateParametersProperties) - if err != nil { - return err - } - avsup.APIVersionSetUpdateParametersProperties = &APIVersionSetUpdateParametersProperties - } - } - } - - return nil -} - -// APIVersionSetUpdateParametersProperties properties used to create or update an API Version Set. -type APIVersionSetUpdateParametersProperties struct { - // DisplayName - Name of API Version Set - DisplayName *string `json:"displayName,omitempty"` - // VersioningScheme - An value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'VersioningSchemeSegment', 'VersioningSchemeQuery', 'VersioningSchemeHeader' - VersioningScheme VersioningScheme `json:"versioningScheme,omitempty"` - // Description - Description of API Version Set. - Description *string `json:"description,omitempty"` - // VersionQueryName - Name of query parameter that indicates the API Version if versioningScheme is set to `query`. - VersionQueryName *string `json:"versionQueryName,omitempty"` - // VersionHeaderName - Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - VersionHeaderName *string `json:"versionHeaderName,omitempty"` -} - -// AssociationContract association entity details. -type AssociationContract struct { - // AssociationContractProperties - Association entity contract properties. - *AssociationContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssociationContract. -func (ac AssociationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ac.AssociationContractProperties != nil { - objectMap["properties"] = ac.AssociationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AssociationContract struct. -func (ac *AssociationContract) 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 associationContractProperties AssociationContractProperties - err = json.Unmarshal(*v, &associationContractProperties) - if err != nil { - return err - } - ac.AssociationContractProperties = &associationContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ac.Type = &typeVar - } - } - } - - return nil -} - -// AssociationContractProperties association entity contract properties. -type AssociationContractProperties struct { - // ProvisioningState - Provisioning state. Possible values include: 'Created' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// AuthenticationSettingsContract API Authentication Settings. -type AuthenticationSettingsContract struct { - // OAuth2 - OAuth2 Authentication settings - OAuth2 *OAuth2AuthenticationSettingsContract `json:"oAuth2,omitempty"` - // Openid - OpenID Connect Authentication Settings - Openid *OpenIDAuthenticationSettingsContract `json:"openid,omitempty"` -} - -// AuthorizationServerCollection paged OAuth2 Authorization Servers list representation. -type AuthorizationServerCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]AuthorizationServerContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// AuthorizationServerCollectionIterator provides access to a complete listing of -// AuthorizationServerContract values. -type AuthorizationServerCollectionIterator struct { - i int - page AuthorizationServerCollectionPage -} - -// 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 *AuthorizationServerCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerCollectionIterator.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 *AuthorizationServerCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AuthorizationServerCollectionIterator) 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 AuthorizationServerCollectionIterator) Response() AuthorizationServerCollection { - 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 AuthorizationServerCollectionIterator) Value() AuthorizationServerContract { - if !iter.page.NotDone() { - return AuthorizationServerContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AuthorizationServerCollectionIterator type. -func NewAuthorizationServerCollectionIterator(page AuthorizationServerCollectionPage) AuthorizationServerCollectionIterator { - return AuthorizationServerCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asc AuthorizationServerCollection) IsEmpty() bool { - return asc.Value == nil || len(*asc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asc AuthorizationServerCollection) hasNextLink() bool { - return asc.NextLink != nil && len(*asc.NextLink) != 0 -} - -// authorizationServerCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asc AuthorizationServerCollection) authorizationServerCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asc.NextLink))) -} - -// AuthorizationServerCollectionPage contains a page of AuthorizationServerContract values. -type AuthorizationServerCollectionPage struct { - fn func(context.Context, AuthorizationServerCollection) (AuthorizationServerCollection, error) - asc AuthorizationServerCollection -} - -// 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 *AuthorizationServerCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationServerCollectionPage.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.asc) - if err != nil { - return err - } - page.asc = 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 *AuthorizationServerCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AuthorizationServerCollectionPage) NotDone() bool { - return !page.asc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AuthorizationServerCollectionPage) Response() AuthorizationServerCollection { - return page.asc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AuthorizationServerCollectionPage) Values() []AuthorizationServerContract { - if page.asc.IsEmpty() { - return nil - } - return *page.asc.Value -} - -// Creates a new instance of the AuthorizationServerCollectionPage type. -func NewAuthorizationServerCollectionPage(cur AuthorizationServerCollection, getNextPage func(context.Context, AuthorizationServerCollection) (AuthorizationServerCollection, error)) AuthorizationServerCollectionPage { - return AuthorizationServerCollectionPage{ - fn: getNextPage, - asc: cur, - } -} - -// AuthorizationServerContract external OAuth authorization server settings. -type AuthorizationServerContract struct { - autorest.Response `json:"-"` - // AuthorizationServerContractProperties - Properties of the External OAuth authorization server Contract. - *AuthorizationServerContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AuthorizationServerContract. -func (asc AuthorizationServerContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asc.AuthorizationServerContractProperties != nil { - objectMap["properties"] = asc.AuthorizationServerContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AuthorizationServerContract struct. -func (asc *AuthorizationServerContract) 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 authorizationServerContractProperties AuthorizationServerContractProperties - err = json.Unmarshal(*v, &authorizationServerContractProperties) - if err != nil { - return err - } - asc.AuthorizationServerContractProperties = &authorizationServerContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asc.Type = &typeVar - } - } - } - - return nil -} - -// AuthorizationServerContractBaseProperties external OAuth authorization server Update settings contract. -type AuthorizationServerContractBaseProperties struct { - // Description - Description of the authorization server. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` - // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` - // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - SupportState *bool `json:"supportState,omitempty"` - // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - DefaultScope *string `json:"defaultScope,omitempty"` - // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. - BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// AuthorizationServerContractProperties external OAuth authorization server settings Properties. -type AuthorizationServerContractProperties struct { - // DisplayName - User-friendly authorization server name. - DisplayName *string `json:"displayName,omitempty"` - // ClientRegistrationEndpoint - Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` - // AuthorizationEndpoint - OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` - // GrantTypes - Form of an authorization grant, which the client uses to request the access token. - GrantTypes *[]GrantType `json:"grantTypes,omitempty"` - // ClientID - Client or app id registered with this authorization server. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - ClientSecret *string `json:"clientSecret,omitempty"` - // Description - Description of the authorization server. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` - // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` - // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - SupportState *bool `json:"supportState,omitempty"` - // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - DefaultScope *string `json:"defaultScope,omitempty"` - // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. - BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// AuthorizationServerUpdateContract external OAuth authorization server settings. -type AuthorizationServerUpdateContract struct { - // AuthorizationServerUpdateContractProperties - Properties of the External OAuth authorization server update Contract. - *AuthorizationServerUpdateContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AuthorizationServerUpdateContract. -func (asuc AuthorizationServerUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asuc.AuthorizationServerUpdateContractProperties != nil { - objectMap["properties"] = asuc.AuthorizationServerUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AuthorizationServerUpdateContract struct. -func (asuc *AuthorizationServerUpdateContract) 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 authorizationServerUpdateContractProperties AuthorizationServerUpdateContractProperties - err = json.Unmarshal(*v, &authorizationServerUpdateContractProperties) - if err != nil { - return err - } - asuc.AuthorizationServerUpdateContractProperties = &authorizationServerUpdateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asuc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asuc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asuc.Type = &typeVar - } - } - } - - return nil -} - -// AuthorizationServerUpdateContractProperties external OAuth authorization server Update settings -// contract. -type AuthorizationServerUpdateContractProperties struct { - // DisplayName - User-friendly authorization server name. - DisplayName *string `json:"displayName,omitempty"` - // ClientRegistrationEndpoint - Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` - // AuthorizationEndpoint - OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` - // GrantTypes - Form of an authorization grant, which the client uses to request the access token. - GrantTypes *[]GrantType `json:"grantTypes,omitempty"` - // ClientID - Client or app id registered with this authorization server. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - ClientSecret *string `json:"clientSecret,omitempty"` - // Description - Description of the authorization server. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // AuthorizationMethods - HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - AuthorizationMethods *[]AuthorizationMethod `json:"authorizationMethods,omitempty"` - // ClientAuthenticationMethod - Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - ClientAuthenticationMethod *[]ClientAuthenticationMethod `json:"clientAuthenticationMethod,omitempty"` - // TokenBodyParameters - Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - // TokenEndpoint - OAuth token endpoint. Contains absolute URI to entity being referenced. - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - // SupportState - If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - SupportState *bool `json:"supportState,omitempty"` - // DefaultScope - Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - DefaultScope *string `json:"defaultScope,omitempty"` - // BearerTokenSendingMethods - Specifies the mechanism by which access token is passed to the API. - BearerTokenSendingMethods *[]BearerTokenSendingMethod `json:"bearerTokenSendingMethods,omitempty"` - // ResourceOwnerUsername - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - // ResourceOwnerPassword - Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// BackendAuthorizationHeaderCredentials authorization header information. -type BackendAuthorizationHeaderCredentials struct { - // Scheme - Authentication Scheme name. - Scheme *string `json:"scheme,omitempty"` - // Parameter - Authentication Parameter value. - Parameter *string `json:"parameter,omitempty"` -} - -// BackendBaseParameters backend entity base Parameter set. -type BackendBaseParameters struct { - // Title - Backend Title. - Title *string `json:"title,omitempty"` - // Description - Backend Description. - Description *string `json:"description,omitempty"` - // ResourceID - Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. - ResourceID *string `json:"resourceId,omitempty"` - // Properties - Backend Properties contract - Properties *BackendProperties `json:"properties,omitempty"` - // Credentials - Backend Credentials Contract Properties - Credentials *BackendCredentialsContract `json:"credentials,omitempty"` - // Proxy - Backend Proxy Contract Properties - Proxy *BackendProxyContract `json:"proxy,omitempty"` - // TLS - Backend TLS Properties - TLS *BackendTLSProperties `json:"tls,omitempty"` -} - -// BackendCollection paged Backend list representation. -type BackendCollection struct { - autorest.Response `json:"-"` - // Value - Backend values. - Value *[]BackendContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// BackendCollectionIterator provides access to a complete listing of BackendContract values. -type BackendCollectionIterator struct { - i int - page BackendCollectionPage -} - -// 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 *BackendCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendCollectionIterator.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 *BackendCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BackendCollectionIterator) 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 BackendCollectionIterator) Response() BackendCollection { - 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 BackendCollectionIterator) Value() BackendContract { - if !iter.page.NotDone() { - return BackendContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BackendCollectionIterator type. -func NewBackendCollectionIterator(page BackendCollectionPage) BackendCollectionIterator { - return BackendCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bc BackendCollection) IsEmpty() bool { - return bc.Value == nil || len(*bc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bc BackendCollection) hasNextLink() bool { - return bc.NextLink != nil && len(*bc.NextLink) != 0 -} - -// backendCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bc BackendCollection) backendCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !bc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bc.NextLink))) -} - -// BackendCollectionPage contains a page of BackendContract values. -type BackendCollectionPage struct { - fn func(context.Context, BackendCollection) (BackendCollection, error) - bc BackendCollection -} - -// 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 *BackendCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackendCollectionPage.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.bc) - if err != nil { - return err - } - page.bc = 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 *BackendCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BackendCollectionPage) NotDone() bool { - return !page.bc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BackendCollectionPage) Response() BackendCollection { - return page.bc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BackendCollectionPage) Values() []BackendContract { - if page.bc.IsEmpty() { - return nil - } - return *page.bc.Value -} - -// Creates a new instance of the BackendCollectionPage type. -func NewBackendCollectionPage(cur BackendCollection, getNextPage func(context.Context, BackendCollection) (BackendCollection, error)) BackendCollectionPage { - return BackendCollectionPage{ - fn: getNextPage, - bc: cur, - } -} - -// BackendContract backend details. -type BackendContract struct { - autorest.Response `json:"-"` - // BackendContractProperties - Backend entity contract properties. - *BackendContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendContract. -func (bc BackendContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bc.BackendContractProperties != nil { - objectMap["properties"] = bc.BackendContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendContract struct. -func (bc *BackendContract) 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 backendContractProperties BackendContractProperties - err = json.Unmarshal(*v, &backendContractProperties) - if err != nil { - return err - } - bc.BackendContractProperties = &backendContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bc.Type = &typeVar - } - } - } - - return nil -} - -// BackendContractProperties parameters supplied to the Create Backend operation. -type BackendContractProperties struct { - // URL - Runtime Url of the Backend. - URL *string `json:"url,omitempty"` - // Protocol - Backend communication protocol. Possible values include: 'BackendProtocolHTTP', 'BackendProtocolSoap' - Protocol BackendProtocol `json:"protocol,omitempty"` - // Title - Backend Title. - Title *string `json:"title,omitempty"` - // Description - Backend Description. - Description *string `json:"description,omitempty"` - // ResourceID - Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. - ResourceID *string `json:"resourceId,omitempty"` - // Properties - Backend Properties contract - Properties *BackendProperties `json:"properties,omitempty"` - // Credentials - Backend Credentials Contract Properties - Credentials *BackendCredentialsContract `json:"credentials,omitempty"` - // Proxy - Backend Proxy Contract Properties - Proxy *BackendProxyContract `json:"proxy,omitempty"` - // TLS - Backend TLS Properties - TLS *BackendTLSProperties `json:"tls,omitempty"` -} - -// BackendCredentialsContract details of the Credentials used to connect to Backend. -type BackendCredentialsContract struct { - // Certificate - List of Client Certificate Thumbprint. - Certificate *[]string `json:"certificate,omitempty"` - // Query - Query Parameter description. - Query map[string][]string `json:"query"` - // Header - Header Parameter description. - Header map[string][]string `json:"header"` - // Authorization - Authorization header authentication - Authorization *BackendAuthorizationHeaderCredentials `json:"authorization,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendCredentialsContract. -func (bcc BackendCredentialsContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bcc.Certificate != nil { - objectMap["certificate"] = bcc.Certificate - } - if bcc.Query != nil { - objectMap["query"] = bcc.Query - } - if bcc.Header != nil { - objectMap["header"] = bcc.Header - } - if bcc.Authorization != nil { - objectMap["authorization"] = bcc.Authorization - } - return json.Marshal(objectMap) -} - -// BackendProperties properties specific to the Backend Type. -type BackendProperties struct { - // ServiceFabricCluster - Backend Service Fabric Cluster Properties - ServiceFabricCluster *BackendServiceFabricClusterProperties `json:"serviceFabricCluster,omitempty"` -} - -// BackendProxyContract details of the Backend WebProxy Server to use in the Request to Backend. -type BackendProxyContract struct { - // URL - WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. - URL *string `json:"url,omitempty"` - // Username - Username to connect to the WebProxy server - Username *string `json:"username,omitempty"` - // Password - Password to connect to the WebProxy Server - Password *string `json:"password,omitempty"` -} - -// BackendReconnectContract reconnect request parameters. -type BackendReconnectContract struct { - // BackendReconnectProperties - Reconnect request properties. - *BackendReconnectProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendReconnectContract. -func (brc BackendReconnectContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if brc.BackendReconnectProperties != nil { - objectMap["properties"] = brc.BackendReconnectProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendReconnectContract struct. -func (brc *BackendReconnectContract) 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 backendReconnectProperties BackendReconnectProperties - err = json.Unmarshal(*v, &backendReconnectProperties) - if err != nil { - return err - } - brc.BackendReconnectProperties = &backendReconnectProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - brc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - brc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - brc.Type = &typeVar - } - } - } - - return nil -} - -// BackendReconnectProperties properties to control reconnect requests. -type BackendReconnectProperties struct { - // After - Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. - After *string `json:"after,omitempty"` -} - -// BackendServiceFabricClusterProperties properties of the Service Fabric Type Backend. -type BackendServiceFabricClusterProperties struct { - // ClientCertificatethumbprint - The client certificate thumbprint for the management endpoint. - ClientCertificatethumbprint *string `json:"clientCertificatethumbprint,omitempty"` - // MaxPartitionResolutionRetries - Maximum number of retries while attempting resolve the partition. - MaxPartitionResolutionRetries *int32 `json:"maxPartitionResolutionRetries,omitempty"` - // ManagementEndpoints - The cluster management endpoint. - ManagementEndpoints *[]string `json:"managementEndpoints,omitempty"` - // ServerCertificateThumbprints - Thumbprints of certificates cluster management service uses for tls communication - ServerCertificateThumbprints *[]string `json:"serverCertificateThumbprints,omitempty"` - // ServerX509Names - Server X509 Certificate Names Collection - ServerX509Names *[]X509CertificateName `json:"serverX509Names,omitempty"` -} - -// BackendTLSProperties properties controlling TLS Certificate Validation. -type BackendTLSProperties struct { - // ValidateCertificateChain - Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. - ValidateCertificateChain *bool `json:"validateCertificateChain,omitempty"` - // ValidateCertificateName - Flag indicating whether SSL certificate name validation should be done when using self-signed certificates for this backend host. - ValidateCertificateName *bool `json:"validateCertificateName,omitempty"` -} - -// BackendUpdateParameterProperties parameters supplied to the Update Backend operation. -type BackendUpdateParameterProperties struct { - // URL - Runtime Url of the Backend. - URL *string `json:"url,omitempty"` - // Protocol - Backend communication protocol. Possible values include: 'BackendProtocolHTTP', 'BackendProtocolSoap' - Protocol BackendProtocol `json:"protocol,omitempty"` - // Title - Backend Title. - Title *string `json:"title,omitempty"` - // Description - Backend Description. - Description *string `json:"description,omitempty"` - // ResourceID - Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. - ResourceID *string `json:"resourceId,omitempty"` - // Properties - Backend Properties contract - Properties *BackendProperties `json:"properties,omitempty"` - // Credentials - Backend Credentials Contract Properties - Credentials *BackendCredentialsContract `json:"credentials,omitempty"` - // Proxy - Backend Proxy Contract Properties - Proxy *BackendProxyContract `json:"proxy,omitempty"` - // TLS - Backend TLS Properties - TLS *BackendTLSProperties `json:"tls,omitempty"` -} - -// BackendUpdateParameters backend update parameters. -type BackendUpdateParameters struct { - // BackendUpdateParameterProperties - Backend entity update contract properties. - *BackendUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendUpdateParameters. -func (bup BackendUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bup.BackendUpdateParameterProperties != nil { - objectMap["properties"] = bup.BackendUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendUpdateParameters struct. -func (bup *BackendUpdateParameters) 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 backendUpdateParameterProperties BackendUpdateParameterProperties - err = json.Unmarshal(*v, &backendUpdateParameterProperties) - if err != nil { - return err - } - bup.BackendUpdateParameterProperties = &backendUpdateParameterProperties - } - } - } - - return nil -} - -// BodyDiagnosticSettings body logging settings. -type BodyDiagnosticSettings struct { - // Bytes - Number of request body bytes to log. - Bytes *int32 `json:"bytes,omitempty"` -} - -// CacheCollection paged Caches list representation. -type CacheCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]CacheContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// CacheCollectionIterator provides access to a complete listing of CacheContract values. -type CacheCollectionIterator struct { - i int - page CacheCollectionPage -} - -// 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 *CacheCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheCollectionIterator.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 *CacheCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CacheCollectionIterator) 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 CacheCollectionIterator) Response() CacheCollection { - 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 CacheCollectionIterator) Value() CacheContract { - if !iter.page.NotDone() { - return CacheContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CacheCollectionIterator type. -func NewCacheCollectionIterator(page CacheCollectionPage) CacheCollectionIterator { - return CacheCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cc CacheCollection) IsEmpty() bool { - return cc.Value == nil || len(*cc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cc CacheCollection) hasNextLink() bool { - return cc.NextLink != nil && len(*cc.NextLink) != 0 -} - -// cacheCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cc CacheCollection) cacheCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !cc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cc.NextLink))) -} - -// CacheCollectionPage contains a page of CacheContract values. -type CacheCollectionPage struct { - fn func(context.Context, CacheCollection) (CacheCollection, error) - cc CacheCollection -} - -// 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 *CacheCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CacheCollectionPage.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.cc) - if err != nil { - return err - } - page.cc = 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 *CacheCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CacheCollectionPage) NotDone() bool { - return !page.cc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CacheCollectionPage) Response() CacheCollection { - return page.cc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CacheCollectionPage) Values() []CacheContract { - if page.cc.IsEmpty() { - return nil - } - return *page.cc.Value -} - -// Creates a new instance of the CacheCollectionPage type. -func NewCacheCollectionPage(cur CacheCollection, getNextPage func(context.Context, CacheCollection) (CacheCollection, error)) CacheCollectionPage { - return CacheCollectionPage{ - fn: getNextPage, - cc: cur, - } -} - -// CacheContract cache details. -type CacheContract struct { - autorest.Response `json:"-"` - // CacheContractProperties - Cache properties details. - *CacheContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for CacheContract. -func (cc CacheContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.CacheContractProperties != nil { - objectMap["properties"] = cc.CacheContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CacheContract struct. -func (cc *CacheContract) 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 cacheContractProperties CacheContractProperties - err = json.Unmarshal(*v, &cacheContractProperties) - if err != nil { - return err - } - cc.CacheContractProperties = &cacheContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cc.Type = &typeVar - } - } - } - - return nil -} - -// CacheContractProperties properties of the Cache contract. -type CacheContractProperties struct { - // Description - Cache description - Description *string `json:"description,omitempty"` - // ConnectionString - Runtime connection string to cache - ConnectionString *string `json:"connectionString,omitempty"` - // ResourceID - Original uri of entity in external system cache points to - ResourceID *string `json:"resourceId,omitempty"` -} - -// CacheUpdateParameters cache update details. -type CacheUpdateParameters struct { - // CacheUpdateProperties - Cache update properties details. - *CacheUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CacheUpdateParameters. -func (cup CacheUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.CacheUpdateProperties != nil { - objectMap["properties"] = cup.CacheUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CacheUpdateParameters struct. -func (cup *CacheUpdateParameters) 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 cacheUpdateProperties CacheUpdateProperties - err = json.Unmarshal(*v, &cacheUpdateProperties) - if err != nil { - return err - } - cup.CacheUpdateProperties = &cacheUpdateProperties - } - } - } - - return nil -} - -// CacheUpdateProperties parameters supplied to the Update Cache operation. -type CacheUpdateProperties struct { - // Description - Cache description - Description *string `json:"description,omitempty"` - // ConnectionString - Runtime connection string to cache - ConnectionString *string `json:"connectionString,omitempty"` - // ResourceID - Original uri of entity in external system cache points to - ResourceID *string `json:"resourceId,omitempty"` -} - -// CertificateCollection paged Certificates list representation. -type CertificateCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]CertificateContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateCollectionIterator provides access to a complete listing of CertificateContract values. -type CertificateCollectionIterator struct { - i int - page CertificateCollectionPage -} - -// 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 *CertificateCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionIterator.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 *CertificateCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CertificateCollectionIterator) 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 CertificateCollectionIterator) Response() CertificateCollection { - 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 CertificateCollectionIterator) Value() CertificateContract { - if !iter.page.NotDone() { - return CertificateContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CertificateCollectionIterator type. -func NewCertificateCollectionIterator(page CertificateCollectionPage) CertificateCollectionIterator { - return CertificateCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cc CertificateCollection) IsEmpty() bool { - return cc.Value == nil || len(*cc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cc CertificateCollection) hasNextLink() bool { - return cc.NextLink != nil && len(*cc.NextLink) != 0 -} - -// certificateCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cc CertificateCollection) certificateCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !cc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cc.NextLink))) -} - -// CertificateCollectionPage contains a page of CertificateContract values. -type CertificateCollectionPage struct { - fn func(context.Context, CertificateCollection) (CertificateCollection, error) - cc CertificateCollection -} - -// 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 *CertificateCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionPage.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.cc) - if err != nil { - return err - } - page.cc = 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 *CertificateCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CertificateCollectionPage) NotDone() bool { - return !page.cc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CertificateCollectionPage) Response() CertificateCollection { - return page.cc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CertificateCollectionPage) Values() []CertificateContract { - if page.cc.IsEmpty() { - return nil - } - return *page.cc.Value -} - -// Creates a new instance of the CertificateCollectionPage type. -func NewCertificateCollectionPage(cur CertificateCollection, getNextPage func(context.Context, CertificateCollection) (CertificateCollection, error)) CertificateCollectionPage { - return CertificateCollectionPage{ - fn: getNextPage, - cc: cur, - } -} - -// CertificateConfiguration certificate configuration which consist of non-trusted intermediates and root -// certificates. -type CertificateConfiguration struct { - // EncodedCertificate - Base64 Encoded certificate. - EncodedCertificate *string `json:"encodedCertificate,omitempty"` - // CertificatePassword - Certificate Password. - CertificatePassword *string `json:"certificatePassword,omitempty"` - // StoreName - The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. Possible values include: 'CertificateAuthority', 'Root' - StoreName StoreName `json:"storeName,omitempty"` - // Certificate - Certificate information. - Certificate *CertificateInformation `json:"certificate,omitempty"` -} - -// CertificateContract certificate details. -type CertificateContract struct { - autorest.Response `json:"-"` - // CertificateContractProperties - Certificate properties details. - *CertificateContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateContract. -func (cc CertificateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.CertificateContractProperties != nil { - objectMap["properties"] = cc.CertificateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateContract struct. -func (cc *CertificateContract) 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 certificateContractProperties CertificateContractProperties - err = json.Unmarshal(*v, &certificateContractProperties) - if err != nil { - return err - } - cc.CertificateContractProperties = &certificateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cc.Type = &typeVar - } - } - } - - return nil -} - -// CertificateContractProperties properties of the Certificate contract. -type CertificateContractProperties struct { - // Subject - Subject attribute of the certificate. - Subject *string `json:"subject,omitempty"` - // Thumbprint - Thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // ExpirationDate - Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` -} - -// CertificateCreateOrUpdateParameters certificate create or update details. -type CertificateCreateOrUpdateParameters struct { - // CertificateCreateOrUpdateProperties - Certificate create or update properties details. - *CertificateCreateOrUpdateProperties `json:"properties,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 - } - } - } - - return nil -} - -// CertificateCreateOrUpdateProperties parameters supplied to the CreateOrUpdate certificate operation. -type CertificateCreateOrUpdateProperties struct { - // Data - Base 64 encoded certificate using the application/x-pkcs12 representation. - Data *string `json:"data,omitempty"` - // Password - Password for the Certificate - Password *string `json:"password,omitempty"` -} - -// CertificateInformation SSL certificate information. -type CertificateInformation struct { - // Expiry - Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Expiry *date.Time `json:"expiry,omitempty"` - // Thumbprint - Thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // Subject - Subject of the certificate. - Subject *string `json:"subject,omitempty"` -} - -// ClientSecretContract client or app secret used in IdentityProviders, Aad, OpenID or OAuth. -type ClientSecretContract struct { - autorest.Response `json:"-"` - // ClientSecret - Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// ConnectivityStatusContract details about connectivity to a resource. -type ConnectivityStatusContract struct { - // Name - The hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. - Name *string `json:"name,omitempty"` - // Status - Resource Connectivity Status Type identifier. Possible values include: 'Initializing', 'Success', 'Failure' - Status ConnectivityStatusType `json:"status,omitempty"` - // Error - Error details of the connectivity to the resource. - Error *string `json:"error,omitempty"` - // LastUpdated - The date when the resource connectivity status was last updated. This status should be updated every 15 minutes. If this status has not been updated, then it means that the service has lost network connectivity to the resource, from inside the Virtual Network.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - LastUpdated *date.Time `json:"lastUpdated,omitempty"` - // LastStatusChange - The date when the resource connectivity status last Changed from success to failure or vice-versa. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - LastStatusChange *date.Time `json:"lastStatusChange,omitempty"` -} - -// DeployConfigurationParameterProperties parameters supplied to the Deploy Configuration operation. -type DeployConfigurationParameterProperties struct { - // Branch - The name of the Git branch from which the configuration is to be deployed to the configuration database. - Branch *string `json:"branch,omitempty"` - // Force - The value enforcing deleting subscriptions to products that are deleted in this update. - Force *bool `json:"force,omitempty"` -} - -// DeployConfigurationParameters deploy Tenant Configuration Contract. -type DeployConfigurationParameters struct { - // DeployConfigurationParameterProperties - Deploy Configuration Parameter contract properties. - *DeployConfigurationParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeployConfigurationParameters. -func (dcp DeployConfigurationParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcp.DeployConfigurationParameterProperties != nil { - objectMap["properties"] = dcp.DeployConfigurationParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DeployConfigurationParameters struct. -func (dcp *DeployConfigurationParameters) 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 deployConfigurationParameterProperties DeployConfigurationParameterProperties - err = json.Unmarshal(*v, &deployConfigurationParameterProperties) - if err != nil { - return err - } - dcp.DeployConfigurationParameterProperties = &deployConfigurationParameterProperties - } - } - } - - return nil -} - -// DiagnosticCollection paged Diagnostic list representation. -type DiagnosticCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]DiagnosticContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// DiagnosticCollectionIterator provides access to a complete listing of DiagnosticContract values. -type DiagnosticCollectionIterator struct { - i int - page DiagnosticCollectionPage -} - -// 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 *DiagnosticCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticCollectionIterator.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 *DiagnosticCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DiagnosticCollectionIterator) 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 DiagnosticCollectionIterator) Response() DiagnosticCollection { - 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 DiagnosticCollectionIterator) Value() DiagnosticContract { - if !iter.page.NotDone() { - return DiagnosticContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DiagnosticCollectionIterator type. -func NewDiagnosticCollectionIterator(page DiagnosticCollectionPage) DiagnosticCollectionIterator { - return DiagnosticCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dc DiagnosticCollection) IsEmpty() bool { - return dc.Value == nil || len(*dc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dc DiagnosticCollection) hasNextLink() bool { - return dc.NextLink != nil && len(*dc.NextLink) != 0 -} - -// diagnosticCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dc DiagnosticCollection) diagnosticCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !dc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dc.NextLink))) -} - -// DiagnosticCollectionPage contains a page of DiagnosticContract values. -type DiagnosticCollectionPage struct { - fn func(context.Context, DiagnosticCollection) (DiagnosticCollection, error) - dc DiagnosticCollection -} - -// 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 *DiagnosticCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticCollectionPage.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.dc) - if err != nil { - return err - } - page.dc = 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 *DiagnosticCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DiagnosticCollectionPage) NotDone() bool { - return !page.dc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DiagnosticCollectionPage) Response() DiagnosticCollection { - return page.dc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DiagnosticCollectionPage) Values() []DiagnosticContract { - if page.dc.IsEmpty() { - return nil - } - return *page.dc.Value -} - -// Creates a new instance of the DiagnosticCollectionPage type. -func NewDiagnosticCollectionPage(cur DiagnosticCollection, getNextPage func(context.Context, DiagnosticCollection) (DiagnosticCollection, error)) DiagnosticCollectionPage { - return DiagnosticCollectionPage{ - fn: getNextPage, - dc: cur, - } -} - -// DiagnosticContract diagnostic details. -type DiagnosticContract struct { - autorest.Response `json:"-"` - // DiagnosticContractProperties - Diagnostic entity contract properties. - *DiagnosticContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DiagnosticContract. -func (dc DiagnosticContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dc.DiagnosticContractProperties != nil { - objectMap["properties"] = dc.DiagnosticContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticContract struct. -func (dc *DiagnosticContract) 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 diagnosticContractProperties DiagnosticContractProperties - err = json.Unmarshal(*v, &diagnosticContractProperties) - if err != nil { - return err - } - dc.DiagnosticContractProperties = &diagnosticContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dc.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticContractProperties diagnostic Entity Properties -type DiagnosticContractProperties struct { - // AlwaysLog - Specifies for what type of messages sampling settings should not apply. Possible values include: 'AllErrors' - AlwaysLog AlwaysLog `json:"alwaysLog,omitempty"` - // LoggerID - Resource Id of a target logger. - LoggerID *string `json:"loggerId,omitempty"` - // Sampling - Sampling settings for Diagnostic. - Sampling *SamplingSettings `json:"sampling,omitempty"` - // Frontend - Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. - Frontend *PipelineDiagnosticSettings `json:"frontend,omitempty"` - // Backend - Diagnostic settings for incoming/outgoing HTTP messages to the Backend - Backend *PipelineDiagnosticSettings `json:"backend,omitempty"` - // LogClientIP - Log the ClientIP. Default is false. - LogClientIP *bool `json:"logClientIp,omitempty"` - // HTTPCorrelationProtocol - Sets correlation protocol to use for Application Insights diagnostics. Possible values include: 'HTTPCorrelationProtocolNone', 'HTTPCorrelationProtocolLegacy', 'HTTPCorrelationProtocolW3C' - HTTPCorrelationProtocol HTTPCorrelationProtocol `json:"httpCorrelationProtocol,omitempty"` - // Verbosity - The verbosity level applied to traces emitted by trace policies. Possible values include: 'Verbose', 'Information', 'Error' - Verbosity Verbosity `json:"verbosity,omitempty"` -} - -// EmailTemplateCollection paged email template list representation. -type EmailTemplateCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]EmailTemplateContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// EmailTemplateCollectionIterator provides access to a complete listing of EmailTemplateContract values. -type EmailTemplateCollectionIterator struct { - i int - page EmailTemplateCollectionPage -} - -// 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 *EmailTemplateCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateCollectionIterator.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 *EmailTemplateCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EmailTemplateCollectionIterator) 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 EmailTemplateCollectionIterator) Response() EmailTemplateCollection { - 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 EmailTemplateCollectionIterator) Value() EmailTemplateContract { - if !iter.page.NotDone() { - return EmailTemplateContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EmailTemplateCollectionIterator type. -func NewEmailTemplateCollectionIterator(page EmailTemplateCollectionPage) EmailTemplateCollectionIterator { - return EmailTemplateCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (etc EmailTemplateCollection) IsEmpty() bool { - return etc.Value == nil || len(*etc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (etc EmailTemplateCollection) hasNextLink() bool { - return etc.NextLink != nil && len(*etc.NextLink) != 0 -} - -// emailTemplateCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (etc EmailTemplateCollection) emailTemplateCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !etc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(etc.NextLink))) -} - -// EmailTemplateCollectionPage contains a page of EmailTemplateContract values. -type EmailTemplateCollectionPage struct { - fn func(context.Context, EmailTemplateCollection) (EmailTemplateCollection, error) - etc EmailTemplateCollection -} - -// 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 *EmailTemplateCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EmailTemplateCollectionPage.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.etc) - if err != nil { - return err - } - page.etc = 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 *EmailTemplateCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EmailTemplateCollectionPage) NotDone() bool { - return !page.etc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EmailTemplateCollectionPage) Response() EmailTemplateCollection { - return page.etc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EmailTemplateCollectionPage) Values() []EmailTemplateContract { - if page.etc.IsEmpty() { - return nil - } - return *page.etc.Value -} - -// Creates a new instance of the EmailTemplateCollectionPage type. -func NewEmailTemplateCollectionPage(cur EmailTemplateCollection, getNextPage func(context.Context, EmailTemplateCollection) (EmailTemplateCollection, error)) EmailTemplateCollectionPage { - return EmailTemplateCollectionPage{ - fn: getNextPage, - etc: cur, - } -} - -// EmailTemplateContract email Template details. -type EmailTemplateContract struct { - autorest.Response `json:"-"` - // EmailTemplateContractProperties - Email Template entity contract properties. - *EmailTemplateContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailTemplateContract. -func (etc EmailTemplateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if etc.EmailTemplateContractProperties != nil { - objectMap["properties"] = etc.EmailTemplateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EmailTemplateContract struct. -func (etc *EmailTemplateContract) 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 emailTemplateContractProperties EmailTemplateContractProperties - err = json.Unmarshal(*v, &emailTemplateContractProperties) - if err != nil { - return err - } - etc.EmailTemplateContractProperties = &emailTemplateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - etc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - etc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - etc.Type = &typeVar - } - } - } - - return nil -} - -// EmailTemplateContractProperties email Template Contract properties. -type EmailTemplateContractProperties struct { - // Subject - Subject of the Template. - Subject *string `json:"subject,omitempty"` - // Body - Email Template Body. This should be a valid XDocument - Body *string `json:"body,omitempty"` - // Title - Title of the Template. - Title *string `json:"title,omitempty"` - // Description - Description of the Email Template. - Description *string `json:"description,omitempty"` - // IsDefault - READ-ONLY; Whether the template is the default template provided by Api Management or has been edited. - IsDefault *bool `json:"isDefault,omitempty"` - // Parameters - Email Template Parameter values. - Parameters *[]EmailTemplateParametersContractProperties `json:"parameters,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailTemplateContractProperties. -func (etcp EmailTemplateContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if etcp.Subject != nil { - objectMap["subject"] = etcp.Subject - } - if etcp.Body != nil { - objectMap["body"] = etcp.Body - } - if etcp.Title != nil { - objectMap["title"] = etcp.Title - } - if etcp.Description != nil { - objectMap["description"] = etcp.Description - } - if etcp.Parameters != nil { - objectMap["parameters"] = etcp.Parameters - } - return json.Marshal(objectMap) -} - -// EmailTemplateParametersContractProperties email Template Parameter contract. -type EmailTemplateParametersContractProperties struct { - // Name - Template parameter name. - Name *string `json:"name,omitempty"` - // Title - Template parameter title. - Title *string `json:"title,omitempty"` - // Description - Template parameter description. - Description *string `json:"description,omitempty"` -} - -// EmailTemplateUpdateParameterProperties email Template Update Contract properties. -type EmailTemplateUpdateParameterProperties struct { - // Subject - Subject of the Template. - Subject *string `json:"subject,omitempty"` - // Title - Title of the Template. - Title *string `json:"title,omitempty"` - // Description - Description of the Email Template. - Description *string `json:"description,omitempty"` - // Body - Email Template Body. This should be a valid XDocument - Body *string `json:"body,omitempty"` - // Parameters - Email Template Parameter values. - Parameters *[]EmailTemplateParametersContractProperties `json:"parameters,omitempty"` -} - -// EmailTemplateUpdateParameters email Template update Parameters. -type EmailTemplateUpdateParameters struct { - // EmailTemplateUpdateParameterProperties - Email Template Update contract properties. - *EmailTemplateUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailTemplateUpdateParameters. -func (etup EmailTemplateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if etup.EmailTemplateUpdateParameterProperties != nil { - objectMap["properties"] = etup.EmailTemplateUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EmailTemplateUpdateParameters struct. -func (etup *EmailTemplateUpdateParameters) 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 emailTemplateUpdateParameterProperties EmailTemplateUpdateParameterProperties - err = json.Unmarshal(*v, &emailTemplateUpdateParameterProperties) - if err != nil { - return err - } - etup.EmailTemplateUpdateParameterProperties = &emailTemplateUpdateParameterProperties - } - } - } - - return nil -} - -// ErrorFieldContract error Field contract. -type ErrorFieldContract 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"` -} - -// ErrorResponse error Response. -type ErrorResponse struct { - // ErrorResponseBody - Properties of the Error Response. - *ErrorResponseBody `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.ErrorResponseBody != nil { - objectMap["error"] = er.ErrorResponseBody - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ErrorResponse struct. -func (er *ErrorResponse) 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 "error": - if v != nil { - var errorResponseBody ErrorResponseBody - err = json.Unmarshal(*v, &errorResponseBody) - if err != nil { - return err - } - er.ErrorResponseBody = &errorResponseBody - } - } - } - - return nil -} - -// ErrorResponseBody error Body contract. -type ErrorResponseBody 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 *[]ErrorFieldContract `json:"details,omitempty"` -} - -// GatewayCollection paged Gateway list representation. -type GatewayCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]GatewayContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayCollection. -func (gc GatewayCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GatewayCollectionIterator provides access to a complete listing of GatewayContract values. -type GatewayCollectionIterator struct { - i int - page GatewayCollectionPage -} - -// 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 *GatewayCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCollectionIterator.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 *GatewayCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GatewayCollectionIterator) 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 GatewayCollectionIterator) Response() GatewayCollection { - 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 GatewayCollectionIterator) Value() GatewayContract { - if !iter.page.NotDone() { - return GatewayContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GatewayCollectionIterator type. -func NewGatewayCollectionIterator(page GatewayCollectionPage) GatewayCollectionIterator { - return GatewayCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (gc GatewayCollection) IsEmpty() bool { - return gc.Value == nil || len(*gc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (gc GatewayCollection) hasNextLink() bool { - return gc.NextLink != nil && len(*gc.NextLink) != 0 -} - -// gatewayCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (gc GatewayCollection) gatewayCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !gc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(gc.NextLink))) -} - -// GatewayCollectionPage contains a page of GatewayContract values. -type GatewayCollectionPage struct { - fn func(context.Context, GatewayCollection) (GatewayCollection, error) - gc GatewayCollection -} - -// 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 *GatewayCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCollectionPage.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.gc) - if err != nil { - return err - } - page.gc = 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 *GatewayCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GatewayCollectionPage) NotDone() bool { - return !page.gc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GatewayCollectionPage) Response() GatewayCollection { - return page.gc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GatewayCollectionPage) Values() []GatewayContract { - if page.gc.IsEmpty() { - return nil - } - return *page.gc.Value -} - -// Creates a new instance of the GatewayCollectionPage type. -func NewGatewayCollectionPage(cur GatewayCollection, getNextPage func(context.Context, GatewayCollection) (GatewayCollection, error)) GatewayCollectionPage { - return GatewayCollectionPage{ - fn: getNextPage, - gc: cur, - } -} - -// GatewayContract gateway details. -type GatewayContract struct { - autorest.Response `json:"-"` - // GatewayContractProperties - Gateway details. - *GatewayContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayContract. -func (gc GatewayContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gc.GatewayContractProperties != nil { - objectMap["properties"] = gc.GatewayContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GatewayContract struct. -func (gc *GatewayContract) 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 gatewayContractProperties GatewayContractProperties - err = json.Unmarshal(*v, &gatewayContractProperties) - if err != nil { - return err - } - gc.GatewayContractProperties = &gatewayContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gc.Type = &typeVar - } - } - } - - return nil -} - -// GatewayContractProperties properties of the Gateway contract. -type GatewayContractProperties struct { - // LocationData - Gateway location. - LocationData *ResourceLocationDataContract `json:"locationData,omitempty"` - // Description - Gateway description - Description *string `json:"description,omitempty"` -} - -// GatewayHostnameConfigurationCollection paged Gateway hostname configuration list representation. -type GatewayHostnameConfigurationCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]GatewayHostnameConfigurationContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayHostnameConfigurationCollection. -func (ghcc GatewayHostnameConfigurationCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GatewayHostnameConfigurationCollectionIterator provides access to a complete listing of -// GatewayHostnameConfigurationContract values. -type GatewayHostnameConfigurationCollectionIterator struct { - i int - page GatewayHostnameConfigurationCollectionPage -} - -// 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 *GatewayHostnameConfigurationCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationCollectionIterator.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 *GatewayHostnameConfigurationCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GatewayHostnameConfigurationCollectionIterator) 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 GatewayHostnameConfigurationCollectionIterator) Response() GatewayHostnameConfigurationCollection { - 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 GatewayHostnameConfigurationCollectionIterator) Value() GatewayHostnameConfigurationContract { - if !iter.page.NotDone() { - return GatewayHostnameConfigurationContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GatewayHostnameConfigurationCollectionIterator type. -func NewGatewayHostnameConfigurationCollectionIterator(page GatewayHostnameConfigurationCollectionPage) GatewayHostnameConfigurationCollectionIterator { - return GatewayHostnameConfigurationCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ghcc GatewayHostnameConfigurationCollection) IsEmpty() bool { - return ghcc.Value == nil || len(*ghcc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ghcc GatewayHostnameConfigurationCollection) hasNextLink() bool { - return ghcc.NextLink != nil && len(*ghcc.NextLink) != 0 -} - -// gatewayHostnameConfigurationCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ghcc GatewayHostnameConfigurationCollection) gatewayHostnameConfigurationCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !ghcc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ghcc.NextLink))) -} - -// GatewayHostnameConfigurationCollectionPage contains a page of GatewayHostnameConfigurationContract -// values. -type GatewayHostnameConfigurationCollectionPage struct { - fn func(context.Context, GatewayHostnameConfigurationCollection) (GatewayHostnameConfigurationCollection, error) - ghcc GatewayHostnameConfigurationCollection -} - -// 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 *GatewayHostnameConfigurationCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayHostnameConfigurationCollectionPage.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.ghcc) - if err != nil { - return err - } - page.ghcc = 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 *GatewayHostnameConfigurationCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GatewayHostnameConfigurationCollectionPage) NotDone() bool { - return !page.ghcc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GatewayHostnameConfigurationCollectionPage) Response() GatewayHostnameConfigurationCollection { - return page.ghcc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GatewayHostnameConfigurationCollectionPage) Values() []GatewayHostnameConfigurationContract { - if page.ghcc.IsEmpty() { - return nil - } - return *page.ghcc.Value -} - -// Creates a new instance of the GatewayHostnameConfigurationCollectionPage type. -func NewGatewayHostnameConfigurationCollectionPage(cur GatewayHostnameConfigurationCollection, getNextPage func(context.Context, GatewayHostnameConfigurationCollection) (GatewayHostnameConfigurationCollection, error)) GatewayHostnameConfigurationCollectionPage { - return GatewayHostnameConfigurationCollectionPage{ - fn: getNextPage, - ghcc: cur, - } -} - -// GatewayHostnameConfigurationContract gateway hostname configuration details. -type GatewayHostnameConfigurationContract struct { - autorest.Response `json:"-"` - // GatewayHostnameConfigurationContractProperties - Gateway hostname configuration details. - *GatewayHostnameConfigurationContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayHostnameConfigurationContract. -func (ghcc GatewayHostnameConfigurationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ghcc.GatewayHostnameConfigurationContractProperties != nil { - objectMap["properties"] = ghcc.GatewayHostnameConfigurationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GatewayHostnameConfigurationContract struct. -func (ghcc *GatewayHostnameConfigurationContract) 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 gatewayHostnameConfigurationContractProperties GatewayHostnameConfigurationContractProperties - err = json.Unmarshal(*v, &gatewayHostnameConfigurationContractProperties) - if err != nil { - return err - } - ghcc.GatewayHostnameConfigurationContractProperties = &gatewayHostnameConfigurationContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ghcc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ghcc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ghcc.Type = &typeVar - } - } - } - - return nil -} - -// GatewayHostnameConfigurationContractProperties gateway hostname configuration details. -type GatewayHostnameConfigurationContractProperties struct { - // Hostname - Hostname value. Supports valid domain name, partial or full wildcard - Hostname *string `json:"hostname,omitempty"` - // CertificateID - Identifier of Certificate entity that will be used for TLS connection establishment - CertificateID *string `json:"certificateId,omitempty"` - // NegotiateClientCertificate - Determines whether gateway requests client certificate - NegotiateClientCertificate *bool `json:"negotiateClientCertificate,omitempty"` -} - -// GatewayKeyRegenerationRequestContract gateway key regeneration request contract properties. -type GatewayKeyRegenerationRequestContract struct { - // KeyType - The Key being regenerated. Possible values include: 'Primary', 'Secondary' - KeyType KeyType `json:"keyType,omitempty"` -} - -// GatewayKeysContract gateway authentication keys. -type GatewayKeysContract struct { - autorest.Response `json:"-"` - // Primary - Primary gateway key. - Primary *string `json:"primary,omitempty"` - // Secondary - Secondary gateway key. - Secondary *string `json:"secondary,omitempty"` -} - -// GatewayTokenContract gateway access token. -type GatewayTokenContract struct { - autorest.Response `json:"-"` - // Value - Shared Access Authentication token value for the Gateway. - Value *string `json:"value,omitempty"` -} - -// GatewayTokenRequestContract gateway token request contract properties. -type GatewayTokenRequestContract struct { - // KeyType - The Key to be used to generate gateway token. Possible values include: 'Primary', 'Secondary' - KeyType KeyType `json:"keyType,omitempty"` - // Expiry - The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Expiry *date.Time `json:"expiry,omitempty"` -} - -// GenerateSsoURLResult generate SSO Url operations response details. -type GenerateSsoURLResult struct { - autorest.Response `json:"-"` - // Value - Redirect Url containing the SSO URL value. - Value *string `json:"value,omitempty"` -} - -// GroupCollection paged Group list representation. -type GroupCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]GroupContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// GroupCollectionIterator provides access to a complete listing of GroupContract values. -type GroupCollectionIterator struct { - i int - page GroupCollectionPage -} - -// 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 *GroupCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupCollectionIterator.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 *GroupCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GroupCollectionIterator) 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 GroupCollectionIterator) Response() GroupCollection { - 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 GroupCollectionIterator) Value() GroupContract { - if !iter.page.NotDone() { - return GroupContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GroupCollectionIterator type. -func NewGroupCollectionIterator(page GroupCollectionPage) GroupCollectionIterator { - return GroupCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (gc GroupCollection) IsEmpty() bool { - return gc.Value == nil || len(*gc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (gc GroupCollection) hasNextLink() bool { - return gc.NextLink != nil && len(*gc.NextLink) != 0 -} - -// groupCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (gc GroupCollection) groupCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !gc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(gc.NextLink))) -} - -// GroupCollectionPage contains a page of GroupContract values. -type GroupCollectionPage struct { - fn func(context.Context, GroupCollection) (GroupCollection, error) - gc GroupCollection -} - -// 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 *GroupCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupCollectionPage.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.gc) - if err != nil { - return err - } - page.gc = 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 *GroupCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GroupCollectionPage) NotDone() bool { - return !page.gc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GroupCollectionPage) Response() GroupCollection { - return page.gc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GroupCollectionPage) Values() []GroupContract { - if page.gc.IsEmpty() { - return nil - } - return *page.gc.Value -} - -// Creates a new instance of the GroupCollectionPage type. -func NewGroupCollectionPage(cur GroupCollection, getNextPage func(context.Context, GroupCollection) (GroupCollection, error)) GroupCollectionPage { - return GroupCollectionPage{ - fn: getNextPage, - gc: cur, - } -} - -// GroupContract contract details. -type GroupContract struct { - autorest.Response `json:"-"` - // GroupContractProperties - Group entity contract properties. - *GroupContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupContract. -func (gc GroupContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gc.GroupContractProperties != nil { - objectMap["properties"] = gc.GroupContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupContract struct. -func (gc *GroupContract) 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 groupContractProperties GroupContractProperties - err = json.Unmarshal(*v, &groupContractProperties) - if err != nil { - return err - } - gc.GroupContractProperties = &groupContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gc.Type = &typeVar - } - } - } - - return nil -} - -// GroupContractProperties group contract Properties. -type GroupContractProperties struct { - // DisplayName - Group name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Group description. Can contain HTML formatting tags. - Description *string `json:"description,omitempty"` - // BuiltIn - READ-ONLY; true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. - BuiltIn *bool `json:"builtIn,omitempty"` - // Type - Group type. Possible values include: 'Custom', 'System', 'External' - Type GroupType `json:"type,omitempty"` - // ExternalID - For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null. - ExternalID *string `json:"externalId,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupContractProperties. -func (gcp GroupContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gcp.DisplayName != nil { - objectMap["displayName"] = gcp.DisplayName - } - if gcp.Description != nil { - objectMap["description"] = gcp.Description - } - if gcp.Type != "" { - objectMap["type"] = gcp.Type - } - if gcp.ExternalID != nil { - objectMap["externalId"] = gcp.ExternalID - } - return json.Marshal(objectMap) -} - -// GroupCreateParameters parameters supplied to the Create Group operation. -type GroupCreateParameters struct { - // GroupCreateParametersProperties - Properties supplied to Create Group operation. - *GroupCreateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupCreateParameters. -func (gcp GroupCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gcp.GroupCreateParametersProperties != nil { - objectMap["properties"] = gcp.GroupCreateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupCreateParameters struct. -func (gcp *GroupCreateParameters) 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 groupCreateParametersProperties GroupCreateParametersProperties - err = json.Unmarshal(*v, &groupCreateParametersProperties) - if err != nil { - return err - } - gcp.GroupCreateParametersProperties = &groupCreateParametersProperties - } - } - } - - return nil -} - -// GroupCreateParametersProperties parameters supplied to the Create Group operation. -type GroupCreateParametersProperties struct { - // DisplayName - Group name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Group description. - Description *string `json:"description,omitempty"` - // Type - Group type. Possible values include: 'Custom', 'System', 'External' - Type GroupType `json:"type,omitempty"` - // ExternalID - Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null. - ExternalID *string `json:"externalId,omitempty"` -} - -// GroupUpdateParameters parameters supplied to the Update Group operation. -type GroupUpdateParameters struct { - // GroupUpdateParametersProperties - Group entity update contract properties. - *GroupUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupUpdateParameters. -func (gup GroupUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gup.GroupUpdateParametersProperties != nil { - objectMap["properties"] = gup.GroupUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupUpdateParameters struct. -func (gup *GroupUpdateParameters) 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 groupUpdateParametersProperties GroupUpdateParametersProperties - err = json.Unmarshal(*v, &groupUpdateParametersProperties) - if err != nil { - return err - } - gup.GroupUpdateParametersProperties = &groupUpdateParametersProperties - } - } - } - - return nil -} - -// GroupUpdateParametersProperties parameters supplied to the Update Group operation. -type GroupUpdateParametersProperties struct { - // DisplayName - Group name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Group description. - Description *string `json:"description,omitempty"` - // Type - Group type. Possible values include: 'Custom', 'System', 'External' - Type GroupType `json:"type,omitempty"` - // ExternalID - Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://.onmicrosoft.com/groups/`; otherwise the value is null. - ExternalID *string `json:"externalId,omitempty"` -} - -// HostnameConfiguration custom hostname configuration. -type HostnameConfiguration struct { - // Type - Hostname type. Possible values include: 'HostnameTypeProxy', 'HostnameTypePortal', 'HostnameTypeManagement', 'HostnameTypeScm', 'HostnameTypeDeveloperPortal' - Type HostnameType `json:"type,omitempty"` - // HostName - Hostname to configure on the Api Management service. - HostName *string `json:"hostName,omitempty"` - // KeyVaultID - Url to the KeyVault Secret containing the Ssl Certificate. If absolute Url containing version is provided, auto-update of ssl certificate will not work. This requires Api Management service to be configured with MSI. The secret should be of type *application/x-pkcs12* - KeyVaultID *string `json:"keyVaultId,omitempty"` - // EncodedCertificate - Base64 Encoded certificate. - EncodedCertificate *string `json:"encodedCertificate,omitempty"` - // CertificatePassword - Certificate Password. - CertificatePassword *string `json:"certificatePassword,omitempty"` - // DefaultSslBinding - Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type. - DefaultSslBinding *bool `json:"defaultSslBinding,omitempty"` - // NegotiateClientCertificate - Specify true to always negotiate client certificate on the hostname. Default Value is false. - NegotiateClientCertificate *bool `json:"negotiateClientCertificate,omitempty"` - // Certificate - Certificate information. - Certificate *CertificateInformation `json:"certificate,omitempty"` -} - -// HTTPMessageDiagnostic http message diagnostic settings. -type HTTPMessageDiagnostic struct { - // Headers - Array of HTTP Headers to log. - Headers *[]string `json:"headers,omitempty"` - // Body - Body logging settings. - Body *BodyDiagnosticSettings `json:"body,omitempty"` -} - -// IdentityProviderBaseParameters identity Provider Base Parameter Properties. -type IdentityProviderBaseParameters struct { - // Type - Identity Provider Type identifier. Possible values include: 'Facebook', 'Google', 'Microsoft', 'Twitter', 'Aad', 'AadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // SigninTenant - The TenantId to use instead of Common when logging into Active Directory - SigninTenant *string `json:"signinTenant,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IdentityProviderContract identity Provider details. -type IdentityProviderContract struct { - autorest.Response `json:"-"` - // IdentityProviderContractProperties - Identity Provider contract properties. - *IdentityProviderContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityProviderContract. -func (ipc IdentityProviderContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipc.IdentityProviderContractProperties != nil { - objectMap["properties"] = ipc.IdentityProviderContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IdentityProviderContract struct. -func (ipc *IdentityProviderContract) 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 identityProviderContractProperties IdentityProviderContractProperties - err = json.Unmarshal(*v, &identityProviderContractProperties) - if err != nil { - return err - } - ipc.IdentityProviderContractProperties = &identityProviderContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ipc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ipc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ipc.Type = &typeVar - } - } - } - - return nil -} - -// IdentityProviderContractProperties the external Identity Providers like Facebook, Google, Microsoft, -// Twitter or Azure Active Directory which can be used to enable access to the API Management service -// developer portal for all users. -type IdentityProviderContractProperties struct { - // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - ClientSecret *string `json:"clientSecret,omitempty"` - // Type - Identity Provider Type identifier. Possible values include: 'Facebook', 'Google', 'Microsoft', 'Twitter', 'Aad', 'AadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // SigninTenant - The TenantId to use instead of Common when logging into Active Directory - SigninTenant *string `json:"signinTenant,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IdentityProviderCreateContract identity Provider details. -type IdentityProviderCreateContract struct { - // IdentityProviderCreateContractProperties - Identity Provider contract properties. - *IdentityProviderCreateContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityProviderCreateContract. -func (ipcc IdentityProviderCreateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipcc.IdentityProviderCreateContractProperties != nil { - objectMap["properties"] = ipcc.IdentityProviderCreateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IdentityProviderCreateContract struct. -func (ipcc *IdentityProviderCreateContract) 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 identityProviderCreateContractProperties IdentityProviderCreateContractProperties - err = json.Unmarshal(*v, &identityProviderCreateContractProperties) - if err != nil { - return err - } - ipcc.IdentityProviderCreateContractProperties = &identityProviderCreateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ipcc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ipcc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ipcc.Type = &typeVar - } - } - } - - return nil -} - -// IdentityProviderCreateContractProperties the external Identity Providers like Facebook, Google, -// Microsoft, Twitter or Azure Active Directory which can be used to enable access to the API Management -// service developer portal for all users. -type IdentityProviderCreateContractProperties struct { - // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - ClientSecret *string `json:"clientSecret,omitempty"` - // Type - Identity Provider Type identifier. Possible values include: 'Facebook', 'Google', 'Microsoft', 'Twitter', 'Aad', 'AadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // SigninTenant - The TenantId to use instead of Common when logging into Active Directory - SigninTenant *string `json:"signinTenant,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IdentityProviderList list of all the Identity Providers configured on the service instance. -type IdentityProviderList struct { - autorest.Response `json:"-"` - // Value - Identity Provider configuration values. - Value *[]IdentityProviderContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// IdentityProviderListIterator provides access to a complete listing of IdentityProviderContract values. -type IdentityProviderListIterator struct { - i int - page IdentityProviderListPage -} - -// 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 *IdentityProviderListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderListIterator.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 *IdentityProviderListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IdentityProviderListIterator) 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 IdentityProviderListIterator) Response() IdentityProviderList { - 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 IdentityProviderListIterator) Value() IdentityProviderContract { - if !iter.page.NotDone() { - return IdentityProviderContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IdentityProviderListIterator type. -func NewIdentityProviderListIterator(page IdentityProviderListPage) IdentityProviderListIterator { - return IdentityProviderListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ipl IdentityProviderList) IsEmpty() bool { - return ipl.Value == nil || len(*ipl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ipl IdentityProviderList) hasNextLink() bool { - return ipl.NextLink != nil && len(*ipl.NextLink) != 0 -} - -// identityProviderListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ipl IdentityProviderList) identityProviderListPreparer(ctx context.Context) (*http.Request, error) { - if !ipl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ipl.NextLink))) -} - -// IdentityProviderListPage contains a page of IdentityProviderContract values. -type IdentityProviderListPage struct { - fn func(context.Context, IdentityProviderList) (IdentityProviderList, error) - ipl IdentityProviderList -} - -// 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 *IdentityProviderListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IdentityProviderListPage.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.ipl) - if err != nil { - return err - } - page.ipl = 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 *IdentityProviderListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IdentityProviderListPage) NotDone() bool { - return !page.ipl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IdentityProviderListPage) Response() IdentityProviderList { - return page.ipl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IdentityProviderListPage) Values() []IdentityProviderContract { - if page.ipl.IsEmpty() { - return nil - } - return *page.ipl.Value -} - -// Creates a new instance of the IdentityProviderListPage type. -func NewIdentityProviderListPage(cur IdentityProviderList, getNextPage func(context.Context, IdentityProviderList) (IdentityProviderList, error)) IdentityProviderListPage { - return IdentityProviderListPage{ - fn: getNextPage, - ipl: cur, - } -} - -// IdentityProviderUpdateParameters parameters supplied to update Identity Provider -type IdentityProviderUpdateParameters struct { - // IdentityProviderUpdateProperties - Identity Provider update properties. - *IdentityProviderUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityProviderUpdateParameters. -func (ipup IdentityProviderUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipup.IdentityProviderUpdateProperties != nil { - objectMap["properties"] = ipup.IdentityProviderUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IdentityProviderUpdateParameters struct. -func (ipup *IdentityProviderUpdateParameters) 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 identityProviderUpdateProperties IdentityProviderUpdateProperties - err = json.Unmarshal(*v, &identityProviderUpdateProperties) - if err != nil { - return err - } - ipup.IdentityProviderUpdateProperties = &identityProviderUpdateProperties - } - } - } - - return nil -} - -// IdentityProviderUpdateProperties parameters supplied to the Update Identity Provider operation. -type IdentityProviderUpdateProperties struct { - // ClientID - Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. - ClientSecret *string `json:"clientSecret,omitempty"` - // Type - Identity Provider Type identifier. Possible values include: 'Facebook', 'Google', 'Microsoft', 'Twitter', 'Aad', 'AadB2C' - Type IdentityProviderType `json:"type,omitempty"` - // SigninTenant - The TenantId to use instead of Common when logging into Active Directory - SigninTenant *string `json:"signinTenant,omitempty"` - // AllowedTenants - List of Allowed Tenants when configuring Azure Active Directory login. - AllowedTenants *[]string `json:"allowedTenants,omitempty"` - // Authority - OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - Authority *string `json:"authority,omitempty"` - // SignupPolicyName - Signup Policy Name. Only applies to AAD B2C Identity Provider. - SignupPolicyName *string `json:"signupPolicyName,omitempty"` - // SigninPolicyName - Signin Policy Name. Only applies to AAD B2C Identity Provider. - SigninPolicyName *string `json:"signinPolicyName,omitempty"` - // ProfileEditingPolicyName - Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - ProfileEditingPolicyName *string `json:"profileEditingPolicyName,omitempty"` - // PasswordResetPolicyName - Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - PasswordResetPolicyName *string `json:"passwordResetPolicyName,omitempty"` -} - -// IssueAttachmentCollection paged Issue Attachment list representation. -type IssueAttachmentCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Issue Attachment values. - Value *[]IssueAttachmentContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueAttachmentCollection. -func (iac IssueAttachmentCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IssueAttachmentCollectionIterator provides access to a complete listing of IssueAttachmentContract -// values. -type IssueAttachmentCollectionIterator struct { - i int - page IssueAttachmentCollectionPage -} - -// 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 *IssueAttachmentCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueAttachmentCollectionIterator.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 *IssueAttachmentCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IssueAttachmentCollectionIterator) 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 IssueAttachmentCollectionIterator) Response() IssueAttachmentCollection { - 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 IssueAttachmentCollectionIterator) Value() IssueAttachmentContract { - if !iter.page.NotDone() { - return IssueAttachmentContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IssueAttachmentCollectionIterator type. -func NewIssueAttachmentCollectionIterator(page IssueAttachmentCollectionPage) IssueAttachmentCollectionIterator { - return IssueAttachmentCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iac IssueAttachmentCollection) IsEmpty() bool { - return iac.Value == nil || len(*iac.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iac IssueAttachmentCollection) hasNextLink() bool { - return iac.NextLink != nil && len(*iac.NextLink) != 0 -} - -// issueAttachmentCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iac IssueAttachmentCollection) issueAttachmentCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !iac.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iac.NextLink))) -} - -// IssueAttachmentCollectionPage contains a page of IssueAttachmentContract values. -type IssueAttachmentCollectionPage struct { - fn func(context.Context, IssueAttachmentCollection) (IssueAttachmentCollection, error) - iac IssueAttachmentCollection -} - -// 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 *IssueAttachmentCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueAttachmentCollectionPage.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.iac) - if err != nil { - return err - } - page.iac = 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 *IssueAttachmentCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IssueAttachmentCollectionPage) NotDone() bool { - return !page.iac.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IssueAttachmentCollectionPage) Response() IssueAttachmentCollection { - return page.iac -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IssueAttachmentCollectionPage) Values() []IssueAttachmentContract { - if page.iac.IsEmpty() { - return nil - } - return *page.iac.Value -} - -// Creates a new instance of the IssueAttachmentCollectionPage type. -func NewIssueAttachmentCollectionPage(cur IssueAttachmentCollection, getNextPage func(context.Context, IssueAttachmentCollection) (IssueAttachmentCollection, error)) IssueAttachmentCollectionPage { - return IssueAttachmentCollectionPage{ - fn: getNextPage, - iac: cur, - } -} - -// IssueAttachmentContract issue Attachment Contract details. -type IssueAttachmentContract struct { - autorest.Response `json:"-"` - // IssueAttachmentContractProperties - Properties of the Issue Attachment. - *IssueAttachmentContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueAttachmentContract. -func (iac IssueAttachmentContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iac.IssueAttachmentContractProperties != nil { - objectMap["properties"] = iac.IssueAttachmentContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueAttachmentContract struct. -func (iac *IssueAttachmentContract) 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 issueAttachmentContractProperties IssueAttachmentContractProperties - err = json.Unmarshal(*v, &issueAttachmentContractProperties) - if err != nil { - return err - } - iac.IssueAttachmentContractProperties = &issueAttachmentContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - iac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - iac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - iac.Type = &typeVar - } - } - } - - return nil -} - -// IssueAttachmentContractProperties issue Attachment contract Properties. -type IssueAttachmentContractProperties struct { - // Title - Filename by which the binary data will be saved. - Title *string `json:"title,omitempty"` - // ContentFormat - Either 'link' if content is provided via an HTTP link or the MIME type of the Base64-encoded binary data provided in the 'content' property. - ContentFormat *string `json:"contentFormat,omitempty"` - // Content - An HTTP link or Base64-encoded binary data. - Content *string `json:"content,omitempty"` -} - -// IssueCollection paged Issue list representation. -type IssueCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Issue values. - Value *[]IssueContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueCollection. -func (ic IssueCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IssueCollectionIterator provides access to a complete listing of IssueContract values. -type IssueCollectionIterator struct { - i int - page IssueCollectionPage -} - -// 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 *IssueCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCollectionIterator.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 *IssueCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IssueCollectionIterator) 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 IssueCollectionIterator) Response() IssueCollection { - 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 IssueCollectionIterator) Value() IssueContract { - if !iter.page.NotDone() { - return IssueContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IssueCollectionIterator type. -func NewIssueCollectionIterator(page IssueCollectionPage) IssueCollectionIterator { - return IssueCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ic IssueCollection) IsEmpty() bool { - return ic.Value == nil || len(*ic.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ic IssueCollection) hasNextLink() bool { - return ic.NextLink != nil && len(*ic.NextLink) != 0 -} - -// issueCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ic IssueCollection) issueCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !ic.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ic.NextLink))) -} - -// IssueCollectionPage contains a page of IssueContract values. -type IssueCollectionPage struct { - fn func(context.Context, IssueCollection) (IssueCollection, error) - ic IssueCollection -} - -// 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 *IssueCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCollectionPage.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.ic) - if err != nil { - return err - } - page.ic = 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 *IssueCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IssueCollectionPage) NotDone() bool { - return !page.ic.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IssueCollectionPage) Response() IssueCollection { - return page.ic -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IssueCollectionPage) Values() []IssueContract { - if page.ic.IsEmpty() { - return nil - } - return *page.ic.Value -} - -// Creates a new instance of the IssueCollectionPage type. -func NewIssueCollectionPage(cur IssueCollection, getNextPage func(context.Context, IssueCollection) (IssueCollection, error)) IssueCollectionPage { - return IssueCollectionPage{ - fn: getNextPage, - ic: cur, - } -} - -// IssueCommentCollection paged Issue Comment list representation. -type IssueCommentCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Issue Comment values. - Value *[]IssueCommentContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueCommentCollection. -func (icc IssueCommentCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IssueCommentCollectionIterator provides access to a complete listing of IssueCommentContract values. -type IssueCommentCollectionIterator struct { - i int - page IssueCommentCollectionPage -} - -// 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 *IssueCommentCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCommentCollectionIterator.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 *IssueCommentCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IssueCommentCollectionIterator) 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 IssueCommentCollectionIterator) Response() IssueCommentCollection { - 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 IssueCommentCollectionIterator) Value() IssueCommentContract { - if !iter.page.NotDone() { - return IssueCommentContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IssueCommentCollectionIterator type. -func NewIssueCommentCollectionIterator(page IssueCommentCollectionPage) IssueCommentCollectionIterator { - return IssueCommentCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (icc IssueCommentCollection) IsEmpty() bool { - return icc.Value == nil || len(*icc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (icc IssueCommentCollection) hasNextLink() bool { - return icc.NextLink != nil && len(*icc.NextLink) != 0 -} - -// issueCommentCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (icc IssueCommentCollection) issueCommentCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !icc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(icc.NextLink))) -} - -// IssueCommentCollectionPage contains a page of IssueCommentContract values. -type IssueCommentCollectionPage struct { - fn func(context.Context, IssueCommentCollection) (IssueCommentCollection, error) - icc IssueCommentCollection -} - -// 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 *IssueCommentCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IssueCommentCollectionPage.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.icc) - if err != nil { - return err - } - page.icc = 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 *IssueCommentCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IssueCommentCollectionPage) NotDone() bool { - return !page.icc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IssueCommentCollectionPage) Response() IssueCommentCollection { - return page.icc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IssueCommentCollectionPage) Values() []IssueCommentContract { - if page.icc.IsEmpty() { - return nil - } - return *page.icc.Value -} - -// Creates a new instance of the IssueCommentCollectionPage type. -func NewIssueCommentCollectionPage(cur IssueCommentCollection, getNextPage func(context.Context, IssueCommentCollection) (IssueCommentCollection, error)) IssueCommentCollectionPage { - return IssueCommentCollectionPage{ - fn: getNextPage, - icc: cur, - } -} - -// IssueCommentContract issue Comment Contract details. -type IssueCommentContract struct { - autorest.Response `json:"-"` - // IssueCommentContractProperties - Properties of the Issue Comment. - *IssueCommentContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueCommentContract. -func (icc IssueCommentContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icc.IssueCommentContractProperties != nil { - objectMap["properties"] = icc.IssueCommentContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueCommentContract struct. -func (icc *IssueCommentContract) 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 issueCommentContractProperties IssueCommentContractProperties - err = json.Unmarshal(*v, &issueCommentContractProperties) - if err != nil { - return err - } - icc.IssueCommentContractProperties = &issueCommentContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - icc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - icc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - icc.Type = &typeVar - } - } - } - - return nil -} - -// IssueCommentContractProperties issue Comment contract Properties. -type IssueCommentContractProperties struct { - // Text - Comment text. - Text *string `json:"text,omitempty"` - // CreatedDate - Date and time when the comment was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // UserID - A resource identifier for the user who left the comment. - UserID *string `json:"userId,omitempty"` -} - -// IssueContract issue Contract details. -type IssueContract struct { - autorest.Response `json:"-"` - // IssueContractProperties - Properties of the Issue. - *IssueContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueContract. -func (ic IssueContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ic.IssueContractProperties != nil { - objectMap["properties"] = ic.IssueContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueContract struct. -func (ic *IssueContract) 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 issueContractProperties IssueContractProperties - err = json.Unmarshal(*v, &issueContractProperties) - if err != nil { - return err - } - ic.IssueContractProperties = &issueContractProperties - } - 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 - } - } - } - - return nil -} - -// IssueContractBaseProperties issue contract Base Properties. -type IssueContractBaseProperties struct { - // CreatedDate - Date and time when the issue was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // State - Status of the issue. Possible values include: 'Proposed', 'Open', 'Removed', 'Resolved', 'Closed' - State State `json:"state,omitempty"` - // APIID - A resource identifier for the API the issue was created for. - APIID *string `json:"apiId,omitempty"` -} - -// IssueContractProperties issue contract Properties. -type IssueContractProperties struct { - // Title - The issue title. - Title *string `json:"title,omitempty"` - // Description - Text describing the issue. - Description *string `json:"description,omitempty"` - // UserID - A resource identifier for the user created the issue. - UserID *string `json:"userId,omitempty"` - // CreatedDate - Date and time when the issue was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // State - Status of the issue. Possible values include: 'Proposed', 'Open', 'Removed', 'Resolved', 'Closed' - State State `json:"state,omitempty"` - // APIID - A resource identifier for the API the issue was created for. - APIID *string `json:"apiId,omitempty"` -} - -// IssueUpdateContract issue update Parameters. -type IssueUpdateContract struct { - // IssueUpdateContractProperties - Issue entity Update contract properties. - *IssueUpdateContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IssueUpdateContract. -func (iuc IssueUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iuc.IssueUpdateContractProperties != nil { - objectMap["properties"] = iuc.IssueUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IssueUpdateContract struct. -func (iuc *IssueUpdateContract) 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 issueUpdateContractProperties IssueUpdateContractProperties - err = json.Unmarshal(*v, &issueUpdateContractProperties) - if err != nil { - return err - } - iuc.IssueUpdateContractProperties = &issueUpdateContractProperties - } - } - } - - return nil -} - -// IssueUpdateContractProperties issue contract Update Properties. -type IssueUpdateContractProperties struct { - // Title - The issue title. - Title *string `json:"title,omitempty"` - // Description - Text describing the issue. - Description *string `json:"description,omitempty"` - // UserID - A resource identifier for the user created the issue. - UserID *string `json:"userId,omitempty"` - // CreatedDate - Date and time when the issue was created. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // State - Status of the issue. Possible values include: 'Proposed', 'Open', 'Removed', 'Resolved', 'Closed' - State State `json:"state,omitempty"` - // APIID - A resource identifier for the API the issue was created for. - APIID *string `json:"apiId,omitempty"` -} - -// ListNetworkStatusContractByLocation ... -type ListNetworkStatusContractByLocation struct { - autorest.Response `json:"-"` - Value *[]NetworkStatusContractByLocation `json:"value,omitempty"` -} - -// LoggerCollection paged Logger list representation. -type LoggerCollection struct { - autorest.Response `json:"-"` - // Value - Logger values. - Value *[]LoggerContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// LoggerCollectionIterator provides access to a complete listing of LoggerContract values. -type LoggerCollectionIterator struct { - i int - page LoggerCollectionPage -} - -// 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 *LoggerCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerCollectionIterator.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 *LoggerCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LoggerCollectionIterator) 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 LoggerCollectionIterator) Response() LoggerCollection { - 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 LoggerCollectionIterator) Value() LoggerContract { - if !iter.page.NotDone() { - return LoggerContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LoggerCollectionIterator type. -func NewLoggerCollectionIterator(page LoggerCollectionPage) LoggerCollectionIterator { - return LoggerCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lc LoggerCollection) IsEmpty() bool { - return lc.Value == nil || len(*lc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lc LoggerCollection) hasNextLink() bool { - return lc.NextLink != nil && len(*lc.NextLink) != 0 -} - -// loggerCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lc LoggerCollection) loggerCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !lc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lc.NextLink))) -} - -// LoggerCollectionPage contains a page of LoggerContract values. -type LoggerCollectionPage struct { - fn func(context.Context, LoggerCollection) (LoggerCollection, error) - lc LoggerCollection -} - -// 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 *LoggerCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoggerCollectionPage.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.lc) - if err != nil { - return err - } - page.lc = 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 *LoggerCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LoggerCollectionPage) NotDone() bool { - return !page.lc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LoggerCollectionPage) Response() LoggerCollection { - return page.lc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LoggerCollectionPage) Values() []LoggerContract { - if page.lc.IsEmpty() { - return nil - } - return *page.lc.Value -} - -// Creates a new instance of the LoggerCollectionPage type. -func NewLoggerCollectionPage(cur LoggerCollection, getNextPage func(context.Context, LoggerCollection) (LoggerCollection, error)) LoggerCollectionPage { - return LoggerCollectionPage{ - fn: getNextPage, - lc: cur, - } -} - -// LoggerContract logger details. -type LoggerContract struct { - autorest.Response `json:"-"` - // LoggerContractProperties - Logger entity contract properties. - *LoggerContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerContract. -func (lc LoggerContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lc.LoggerContractProperties != nil { - objectMap["properties"] = lc.LoggerContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoggerContract struct. -func (lc *LoggerContract) 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 loggerContractProperties LoggerContractProperties - err = json.Unmarshal(*v, &loggerContractProperties) - if err != nil { - return err - } - lc.LoggerContractProperties = &loggerContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lc.Type = &typeVar - } - } - } - - return nil -} - -// LoggerContractProperties the Logger entity in API Management represents an event sink that you can use -// to log API Management events. Currently the Logger entity supports logging API Management events to -// Azure Event Hubs. -type LoggerContractProperties struct { - // LoggerType - Logger type. Possible values include: 'AzureEventHub', 'ApplicationInsights' - LoggerType LoggerType `json:"loggerType,omitempty"` - // Description - Logger description. - Description *string `json:"description,omitempty"` - // Credentials - The name and SendRule connection string of the event hub for azureEventHub logger. - // Instrumentation key for applicationInsights logger. - Credentials map[string]*string `json:"credentials"` - // IsBuffered - Whether records are buffered in the logger before publishing. Default is assumed to be true. - IsBuffered *bool `json:"isBuffered,omitempty"` - // ResourceID - Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource). - ResourceID *string `json:"resourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerContractProperties. -func (lcp LoggerContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lcp.LoggerType != "" { - objectMap["loggerType"] = lcp.LoggerType - } - if lcp.Description != nil { - objectMap["description"] = lcp.Description - } - if lcp.Credentials != nil { - objectMap["credentials"] = lcp.Credentials - } - if lcp.IsBuffered != nil { - objectMap["isBuffered"] = lcp.IsBuffered - } - if lcp.ResourceID != nil { - objectMap["resourceId"] = lcp.ResourceID - } - return json.Marshal(objectMap) -} - -// LoggerUpdateContract logger update contract. -type LoggerUpdateContract struct { - // LoggerUpdateParameters - Logger entity update contract properties. - *LoggerUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerUpdateContract. -func (luc LoggerUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if luc.LoggerUpdateParameters != nil { - objectMap["properties"] = luc.LoggerUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoggerUpdateContract struct. -func (luc *LoggerUpdateContract) 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 loggerUpdateParameters LoggerUpdateParameters - err = json.Unmarshal(*v, &loggerUpdateParameters) - if err != nil { - return err - } - luc.LoggerUpdateParameters = &loggerUpdateParameters - } - } - } - - return nil -} - -// LoggerUpdateParameters parameters supplied to the Update Logger operation. -type LoggerUpdateParameters struct { - // LoggerType - Logger type. Possible values include: 'AzureEventHub', 'ApplicationInsights' - LoggerType LoggerType `json:"loggerType,omitempty"` - // Description - Logger description. - Description *string `json:"description,omitempty"` - // Credentials - Logger credentials. - Credentials map[string]*string `json:"credentials"` - // IsBuffered - Whether records are buffered in the logger before publishing. Default is assumed to be true. - IsBuffered *bool `json:"isBuffered,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoggerUpdateParameters. -func (lup LoggerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lup.LoggerType != "" { - objectMap["loggerType"] = lup.LoggerType - } - if lup.Description != nil { - objectMap["description"] = lup.Description - } - if lup.Credentials != nil { - objectMap["credentials"] = lup.Credentials - } - if lup.IsBuffered != nil { - objectMap["isBuffered"] = lup.IsBuffered - } - return json.Marshal(objectMap) -} - -// NamedValueCollection paged NamedValue list representation. -type NamedValueCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]NamedValueContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// NamedValueCollectionIterator provides access to a complete listing of NamedValueContract values. -type NamedValueCollectionIterator struct { - i int - page NamedValueCollectionPage -} - -// 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 *NamedValueCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueCollectionIterator.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 *NamedValueCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NamedValueCollectionIterator) 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 NamedValueCollectionIterator) Response() NamedValueCollection { - 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 NamedValueCollectionIterator) Value() NamedValueContract { - if !iter.page.NotDone() { - return NamedValueContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NamedValueCollectionIterator type. -func NewNamedValueCollectionIterator(page NamedValueCollectionPage) NamedValueCollectionIterator { - return NamedValueCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (nvc NamedValueCollection) IsEmpty() bool { - return nvc.Value == nil || len(*nvc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (nvc NamedValueCollection) hasNextLink() bool { - return nvc.NextLink != nil && len(*nvc.NextLink) != 0 -} - -// namedValueCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nvc NamedValueCollection) namedValueCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !nvc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nvc.NextLink))) -} - -// NamedValueCollectionPage contains a page of NamedValueContract values. -type NamedValueCollectionPage struct { - fn func(context.Context, NamedValueCollection) (NamedValueCollection, error) - nvc NamedValueCollection -} - -// 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 *NamedValueCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueCollectionPage.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.nvc) - if err != nil { - return err - } - page.nvc = 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 *NamedValueCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NamedValueCollectionPage) NotDone() bool { - return !page.nvc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NamedValueCollectionPage) Response() NamedValueCollection { - return page.nvc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NamedValueCollectionPage) Values() []NamedValueContract { - if page.nvc.IsEmpty() { - return nil - } - return *page.nvc.Value -} - -// Creates a new instance of the NamedValueCollectionPage type. -func NewNamedValueCollectionPage(cur NamedValueCollection, getNextPage func(context.Context, NamedValueCollection) (NamedValueCollection, error)) NamedValueCollectionPage { - return NamedValueCollectionPage{ - fn: getNextPage, - nvc: cur, - } -} - -// NamedValueContract namedValue details. -type NamedValueContract struct { - autorest.Response `json:"-"` - // NamedValueContractProperties - NamedValue entity contract properties. - *NamedValueContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamedValueContract. -func (nvc NamedValueContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nvc.NamedValueContractProperties != nil { - objectMap["properties"] = nvc.NamedValueContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NamedValueContract struct. -func (nvc *NamedValueContract) 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 namedValueContractProperties NamedValueContractProperties - err = json.Unmarshal(*v, &namedValueContractProperties) - if err != nil { - return err - } - nvc.NamedValueContractProperties = &namedValueContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nvc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nvc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nvc.Type = &typeVar - } - } - } - - return nil -} - -// NamedValueContractProperties namedValue Contract properties. -type NamedValueContractProperties struct { - // DisplayName - Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - DisplayName *string `json:"displayName,omitempty"` - // Value - Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - Value *string `json:"value,omitempty"` - // Tags - Optional tags that when provided can be used to filter the NamedValue list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// NamedValueCreateContract namedValue details. -type NamedValueCreateContract struct { - // NamedValueCreateContractProperties - NamedValue entity contract properties for PUT operation. - *NamedValueCreateContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamedValueCreateContract. -func (nvcc NamedValueCreateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nvcc.NamedValueCreateContractProperties != nil { - objectMap["properties"] = nvcc.NamedValueCreateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NamedValueCreateContract struct. -func (nvcc *NamedValueCreateContract) 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 namedValueCreateContractProperties NamedValueCreateContractProperties - err = json.Unmarshal(*v, &namedValueCreateContractProperties) - if err != nil { - return err - } - nvcc.NamedValueCreateContractProperties = &namedValueCreateContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nvcc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nvcc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nvcc.Type = &typeVar - } - } - } - - return nil -} - -// NamedValueCreateContractProperties namedValue Contract properties. -type NamedValueCreateContractProperties struct { - // DisplayName - Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - DisplayName *string `json:"displayName,omitempty"` - // Value - Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - Value *string `json:"value,omitempty"` - // Tags - Optional tags that when provided can be used to filter the NamedValue list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// NamedValueCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NamedValueCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NamedValueClient) (NamedValueContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NamedValueCreateOrUpdateFuture) 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 NamedValueCreateOrUpdateFuture.Result. -func (future *NamedValueCreateOrUpdateFuture) result(client NamedValueClient) (nvc NamedValueContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nvc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.NamedValueCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nvc.Response.Response, err = future.GetResult(sender); err == nil && nvc.Response.Response.StatusCode != http.StatusNoContent { - nvc, err = client.CreateOrUpdateResponder(nvc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueCreateOrUpdateFuture", "Result", nvc.Response.Response, "Failure responding to request") - } - } - return -} - -// NamedValueEntityBaseParameters namedValue Entity Base Parameters set. -type NamedValueEntityBaseParameters struct { - // Tags - Optional tags that when provided can be used to filter the NamedValue list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// NamedValueUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NamedValueUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NamedValueClient) (NamedValueContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NamedValueUpdateFuture) 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 NamedValueUpdateFuture.Result. -func (future *NamedValueUpdateFuture) result(client NamedValueClient) (nvc NamedValueContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nvc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.NamedValueUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nvc.Response.Response, err = future.GetResult(sender); err == nil && nvc.Response.Response.StatusCode != http.StatusNoContent { - nvc, err = client.UpdateResponder(nvc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueUpdateFuture", "Result", nvc.Response.Response, "Failure responding to request") - } - } - return -} - -// NamedValueUpdateParameterProperties namedValue Contract properties. -type NamedValueUpdateParameterProperties struct { - // DisplayName - Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - DisplayName *string `json:"displayName,omitempty"` - // Value - Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. - Value *string `json:"value,omitempty"` - // Tags - Optional tags that when provided can be used to filter the NamedValue list. - Tags *[]string `json:"tags,omitempty"` - // Secret - Determines whether the value is a secret and should be encrypted or not. Default value is false. - Secret *bool `json:"secret,omitempty"` -} - -// NamedValueUpdateParameters namedValue update Parameters. -type NamedValueUpdateParameters struct { - // NamedValueUpdateParameterProperties - NamedValue entity Update contract properties. - *NamedValueUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamedValueUpdateParameters. -func (nvup NamedValueUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nvup.NamedValueUpdateParameterProperties != nil { - objectMap["properties"] = nvup.NamedValueUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NamedValueUpdateParameters struct. -func (nvup *NamedValueUpdateParameters) 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 namedValueUpdateParameterProperties NamedValueUpdateParameterProperties - err = json.Unmarshal(*v, &namedValueUpdateParameterProperties) - if err != nil { - return err - } - nvup.NamedValueUpdateParameterProperties = &namedValueUpdateParameterProperties - } - } - } - - return nil -} - -// NetworkStatusContract network Status details. -type NetworkStatusContract struct { - autorest.Response `json:"-"` - // DNSServers - Gets the list of DNS servers IPV4 addresses. - DNSServers *[]string `json:"dnsServers,omitempty"` - // ConnectivityStatus - Gets the list of Connectivity Status to the Resources on which the service depends upon. - ConnectivityStatus *[]ConnectivityStatusContract `json:"connectivityStatus,omitempty"` -} - -// NetworkStatusContractByLocation network Status in the Location -type NetworkStatusContractByLocation struct { - // Location - Location of service - Location *string `json:"location,omitempty"` - // NetworkStatus - Network status in Location - NetworkStatus *NetworkStatusContract `json:"networkStatus,omitempty"` -} - -// NotificationCollection paged Notification list representation. -type NotificationCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]NotificationContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// NotificationCollectionIterator provides access to a complete listing of NotificationContract values. -type NotificationCollectionIterator struct { - i int - page NotificationCollectionPage -} - -// 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 *NotificationCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationCollectionIterator.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 *NotificationCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NotificationCollectionIterator) 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 NotificationCollectionIterator) Response() NotificationCollection { - 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 NotificationCollectionIterator) Value() NotificationContract { - if !iter.page.NotDone() { - return NotificationContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NotificationCollectionIterator type. -func NewNotificationCollectionIterator(page NotificationCollectionPage) NotificationCollectionIterator { - return NotificationCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (nc NotificationCollection) IsEmpty() bool { - return nc.Value == nil || len(*nc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (nc NotificationCollection) hasNextLink() bool { - return nc.NextLink != nil && len(*nc.NextLink) != 0 -} - -// notificationCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nc NotificationCollection) notificationCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !nc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nc.NextLink))) -} - -// NotificationCollectionPage contains a page of NotificationContract values. -type NotificationCollectionPage struct { - fn func(context.Context, NotificationCollection) (NotificationCollection, error) - nc NotificationCollection -} - -// 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 *NotificationCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationCollectionPage.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.nc) - if err != nil { - return err - } - page.nc = 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 *NotificationCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NotificationCollectionPage) NotDone() bool { - return !page.nc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NotificationCollectionPage) Response() NotificationCollection { - return page.nc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NotificationCollectionPage) Values() []NotificationContract { - if page.nc.IsEmpty() { - return nil - } - return *page.nc.Value -} - -// Creates a new instance of the NotificationCollectionPage type. -func NewNotificationCollectionPage(cur NotificationCollection, getNextPage func(context.Context, NotificationCollection) (NotificationCollection, error)) NotificationCollectionPage { - return NotificationCollectionPage{ - fn: getNextPage, - nc: cur, - } -} - -// NotificationContract notification details. -type NotificationContract struct { - autorest.Response `json:"-"` - // NotificationContractProperties - Notification entity contract properties. - *NotificationContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotificationContract. -func (nc NotificationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nc.NotificationContractProperties != nil { - objectMap["properties"] = nc.NotificationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotificationContract struct. -func (nc *NotificationContract) 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 notificationContractProperties NotificationContractProperties - err = json.Unmarshal(*v, ¬ificationContractProperties) - if err != nil { - return err - } - nc.NotificationContractProperties = ¬ificationContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nc.Type = &typeVar - } - } - } - - return nil -} - -// NotificationContractProperties notification Contract properties. -type NotificationContractProperties struct { - // Title - Title of the Notification. - Title *string `json:"title,omitempty"` - // Description - Description of the Notification. - Description *string `json:"description,omitempty"` - // Recipients - Recipient Parameter values. - Recipients *RecipientsContractProperties `json:"recipients,omitempty"` -} - -// OAuth2AuthenticationSettingsContract API OAuth2 Authentication settings details. -type OAuth2AuthenticationSettingsContract struct { - // AuthorizationServerID - OAuth authorization server identifier. - AuthorizationServerID *string `json:"authorizationServerId,omitempty"` - // Scope - operations scope. - Scope *string `json:"scope,omitempty"` -} - -// OpenIDAuthenticationSettingsContract API OAuth2 Authentication settings details. -type OpenIDAuthenticationSettingsContract struct { - // OpenidProviderID - OAuth authorization server identifier. - OpenidProviderID *string `json:"openidProviderId,omitempty"` - // BearerTokenSendingMethods - How to send token to the server. - BearerTokenSendingMethods *[]BearerTokenSendingMethods `json:"bearerTokenSendingMethods,omitempty"` -} - -// OpenIDConnectProviderCollection paged OpenIdProviders list representation. -type OpenIDConnectProviderCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]OpenidConnectProviderContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OpenIDConnectProviderCollectionIterator provides access to a complete listing of -// OpenidConnectProviderContract values. -type OpenIDConnectProviderCollectionIterator struct { - i int - page OpenIDConnectProviderCollectionPage -} - -// 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 *OpenIDConnectProviderCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderCollectionIterator.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 *OpenIDConnectProviderCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OpenIDConnectProviderCollectionIterator) 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 OpenIDConnectProviderCollectionIterator) Response() OpenIDConnectProviderCollection { - 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 OpenIDConnectProviderCollectionIterator) Value() OpenidConnectProviderContract { - if !iter.page.NotDone() { - return OpenidConnectProviderContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OpenIDConnectProviderCollectionIterator type. -func NewOpenIDConnectProviderCollectionIterator(page OpenIDConnectProviderCollectionPage) OpenIDConnectProviderCollectionIterator { - return OpenIDConnectProviderCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oicpc OpenIDConnectProviderCollection) IsEmpty() bool { - return oicpc.Value == nil || len(*oicpc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oicpc OpenIDConnectProviderCollection) hasNextLink() bool { - return oicpc.NextLink != nil && len(*oicpc.NextLink) != 0 -} - -// openIDConnectProviderCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oicpc OpenIDConnectProviderCollection) openIDConnectProviderCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !oicpc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oicpc.NextLink))) -} - -// OpenIDConnectProviderCollectionPage contains a page of OpenidConnectProviderContract values. -type OpenIDConnectProviderCollectionPage struct { - fn func(context.Context, OpenIDConnectProviderCollection) (OpenIDConnectProviderCollection, error) - oicpc OpenIDConnectProviderCollection -} - -// 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 *OpenIDConnectProviderCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderCollectionPage.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.oicpc) - if err != nil { - return err - } - page.oicpc = 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 *OpenIDConnectProviderCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OpenIDConnectProviderCollectionPage) NotDone() bool { - return !page.oicpc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OpenIDConnectProviderCollectionPage) Response() OpenIDConnectProviderCollection { - return page.oicpc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OpenIDConnectProviderCollectionPage) Values() []OpenidConnectProviderContract { - if page.oicpc.IsEmpty() { - return nil - } - return *page.oicpc.Value -} - -// Creates a new instance of the OpenIDConnectProviderCollectionPage type. -func NewOpenIDConnectProviderCollectionPage(cur OpenIDConnectProviderCollection, getNextPage func(context.Context, OpenIDConnectProviderCollection) (OpenIDConnectProviderCollection, error)) OpenIDConnectProviderCollectionPage { - return OpenIDConnectProviderCollectionPage{ - fn: getNextPage, - oicpc: cur, - } -} - -// OpenidConnectProviderContract openId Connect Provider details. -type OpenidConnectProviderContract struct { - autorest.Response `json:"-"` - // OpenidConnectProviderContractProperties - OpenId Connect Provider contract properties. - *OpenidConnectProviderContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenidConnectProviderContract. -func (ocpc OpenidConnectProviderContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ocpc.OpenidConnectProviderContractProperties != nil { - objectMap["properties"] = ocpc.OpenidConnectProviderContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OpenidConnectProviderContract struct. -func (ocpc *OpenidConnectProviderContract) 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 openidConnectProviderContractProperties OpenidConnectProviderContractProperties - err = json.Unmarshal(*v, &openidConnectProviderContractProperties) - if err != nil { - return err - } - ocpc.OpenidConnectProviderContractProperties = &openidConnectProviderContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ocpc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ocpc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ocpc.Type = &typeVar - } - } - } - - return nil -} - -// OpenidConnectProviderContractProperties openID Connect Providers Contract. -type OpenidConnectProviderContractProperties struct { - // DisplayName - User-friendly OpenID Connect Provider name. - DisplayName *string `json:"displayName,omitempty"` - // Description - User-friendly description of OpenID Connect Provider. - Description *string `json:"description,omitempty"` - // MetadataEndpoint - Metadata endpoint URI. - MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` - // ClientID - Client ID of developer console which is the client application. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client Secret of developer console which is the client application. - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// OpenidConnectProviderUpdateContract parameters supplied to the Update OpenID Connect Provider operation. -type OpenidConnectProviderUpdateContract struct { - // OpenidConnectProviderUpdateContractProperties - OpenId Connect Provider Update contract properties. - *OpenidConnectProviderUpdateContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenidConnectProviderUpdateContract. -func (ocpuc OpenidConnectProviderUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ocpuc.OpenidConnectProviderUpdateContractProperties != nil { - objectMap["properties"] = ocpuc.OpenidConnectProviderUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OpenidConnectProviderUpdateContract struct. -func (ocpuc *OpenidConnectProviderUpdateContract) 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 openidConnectProviderUpdateContractProperties OpenidConnectProviderUpdateContractProperties - err = json.Unmarshal(*v, &openidConnectProviderUpdateContractProperties) - if err != nil { - return err - } - ocpuc.OpenidConnectProviderUpdateContractProperties = &openidConnectProviderUpdateContractProperties - } - } - } - - return nil -} - -// OpenidConnectProviderUpdateContractProperties parameters supplied to the Update OpenID Connect Provider -// operation. -type OpenidConnectProviderUpdateContractProperties struct { - // DisplayName - User-friendly OpenID Connect Provider name. - DisplayName *string `json:"displayName,omitempty"` - // Description - User-friendly description of OpenID Connect Provider. - Description *string `json:"description,omitempty"` - // MetadataEndpoint - Metadata endpoint URI. - MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` - // ClientID - Client ID of developer console which is the client application. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - Client Secret of developer console which is the client application. - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// Operation REST API operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that describes the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - The operation origin. - Origin *string `json:"origin,omitempty"` - // Properties - The operation properties. - Properties interface{} `json:"properties,omitempty"` -} - -// OperationCollection paged Operation list representation. -type OperationCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Page values. - Value *[]OperationContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationCollection. -func (oc OperationCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationCollectionIterator provides access to a complete listing of OperationContract values. -type OperationCollectionIterator struct { - i int - page OperationCollectionPage -} - -// 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 *OperationCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionIterator.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 *OperationCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationCollectionIterator) 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 OperationCollectionIterator) Response() OperationCollection { - 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 OperationCollectionIterator) Value() OperationContract { - if !iter.page.NotDone() { - return OperationContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationCollectionIterator type. -func NewOperationCollectionIterator(page OperationCollectionPage) OperationCollectionIterator { - return OperationCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oc OperationCollection) IsEmpty() bool { - return oc.Value == nil || len(*oc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oc OperationCollection) hasNextLink() bool { - return oc.NextLink != nil && len(*oc.NextLink) != 0 -} - -// operationCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oc OperationCollection) operationCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !oc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oc.NextLink))) -} - -// OperationCollectionPage contains a page of OperationContract values. -type OperationCollectionPage struct { - fn func(context.Context, OperationCollection) (OperationCollection, error) - oc OperationCollection -} - -// 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 *OperationCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationCollectionPage.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.oc) - if err != nil { - return err - } - page.oc = 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 *OperationCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationCollectionPage) NotDone() bool { - return !page.oc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationCollectionPage) Response() OperationCollection { - return page.oc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationCollectionPage) Values() []OperationContract { - if page.oc.IsEmpty() { - return nil - } - return *page.oc.Value -} - -// Creates a new instance of the OperationCollectionPage type. -func NewOperationCollectionPage(cur OperationCollection, getNextPage func(context.Context, OperationCollection) (OperationCollection, error)) OperationCollectionPage { - return OperationCollectionPage{ - fn: getNextPage, - oc: cur, - } -} - -// OperationContract api Operation details. -type OperationContract struct { - autorest.Response `json:"-"` - // OperationContractProperties - Properties of the Operation Contract. - *OperationContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationContract. -func (oc OperationContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oc.OperationContractProperties != nil { - objectMap["properties"] = oc.OperationContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationContract struct. -func (oc *OperationContract) 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 operationContractProperties OperationContractProperties - err = json.Unmarshal(*v, &operationContractProperties) - if err != nil { - return err - } - oc.OperationContractProperties = &operationContractProperties - } - 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 - } - } - } - - return nil -} - -// OperationContractProperties operation Contract Properties -type OperationContractProperties struct { - // DisplayName - Operation Name. - DisplayName *string `json:"displayName,omitempty"` - // Method - A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - Method *string `json:"method,omitempty"` - // URLTemplate - Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} - URLTemplate *string `json:"urlTemplate,omitempty"` - // TemplateParameters - Collection of URL template parameters. - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - // Description - Description of the operation. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Request - An entity containing request details. - Request *RequestContract `json:"request,omitempty"` - // Responses - Array of Operation responses. - Responses *[]ResponseContract `json:"responses,omitempty"` - // Policies - Operation Policies - Policies *string `json:"policies,omitempty"` -} - -// OperationDisplay the object that describes the operation. -type OperationDisplay struct { - // Provider - Friendly name of the resource provider - Provider *string `json:"provider,omitempty"` - // Operation - Operation type: read, write, delete, listKeys/action, etc. - Operation *string `json:"operation,omitempty"` - // Resource - Resource type on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Description - Friendly name of the operation - Description *string `json:"description,omitempty"` -} - -// OperationEntityBaseContract api Operation Entity Base Contract details. -type OperationEntityBaseContract struct { - // TemplateParameters - Collection of URL template parameters. - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - // Description - Description of the operation. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Request - An entity containing request details. - Request *RequestContract `json:"request,omitempty"` - // Responses - Array of Operation responses. - Responses *[]ResponseContract `json:"responses,omitempty"` - // Policies - Operation Policies - Policies *string `json:"policies,omitempty"` -} - -// OperationListResult result of the request to list REST API operations. It contains a list of operations -// and a URL nextLink to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the 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, - } -} - -// OperationResultContract operation Result. -type OperationResultContract struct { - autorest.Response `json:"-"` - // ID - Operation result identifier. - ID *string `json:"id,omitempty"` - // Status - Status of an async operation. Possible values include: 'Started', 'InProgress', 'Succeeded', 'Failed' - Status AsyncOperationStatus `json:"status,omitempty"` - // Started - Start time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Started *date.Time `json:"started,omitempty"` - // Updated - Last update time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Updated *date.Time `json:"updated,omitempty"` - // ResultInfo - Optional result info. - ResultInfo *string `json:"resultInfo,omitempty"` - // Error - Error Body Contract - Error *ErrorResponseBody `json:"error,omitempty"` - // ActionLog - READ-ONLY; This property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation. - ActionLog *[]OperationResultLogItemContract `json:"actionLog,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationResultContract. -func (orc OperationResultContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if orc.ID != nil { - objectMap["id"] = orc.ID - } - if orc.Status != "" { - objectMap["status"] = orc.Status - } - if orc.Started != nil { - objectMap["started"] = orc.Started - } - if orc.Updated != nil { - objectMap["updated"] = orc.Updated - } - if orc.ResultInfo != nil { - objectMap["resultInfo"] = orc.ResultInfo - } - if orc.Error != nil { - objectMap["error"] = orc.Error - } - return json.Marshal(objectMap) -} - -// OperationResultLogItemContract log of the entity being created, updated or deleted. -type OperationResultLogItemContract struct { - // ObjectType - The type of entity contract. - ObjectType *string `json:"objectType,omitempty"` - // Action - Action like create/update/delete. - Action *string `json:"action,omitempty"` - // ObjectKey - Identifier of the entity being created/updated/deleted. - ObjectKey *string `json:"objectKey,omitempty"` -} - -// OperationTagResourceContractProperties operation Entity contract Properties. -type OperationTagResourceContractProperties struct { - // ID - Identifier of the operation in form /operations/{operationId}. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Operation name. - Name *string `json:"name,omitempty"` - // APIName - READ-ONLY; Api Name. - APIName *string `json:"apiName,omitempty"` - // APIRevision - READ-ONLY; Api Revision. - APIRevision *string `json:"apiRevision,omitempty"` - // APIVersion - READ-ONLY; Api Version. - APIVersion *string `json:"apiVersion,omitempty"` - // Description - READ-ONLY; Operation Description. - Description *string `json:"description,omitempty"` - // Method - READ-ONLY; A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - Method *string `json:"method,omitempty"` - // URLTemplate - READ-ONLY; Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} - URLTemplate *string `json:"urlTemplate,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationTagResourceContractProperties. -func (otrcp OperationTagResourceContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if otrcp.ID != nil { - objectMap["id"] = otrcp.ID - } - return json.Marshal(objectMap) -} - -// OperationUpdateContract api Operation Update Contract details. -type OperationUpdateContract struct { - // OperationUpdateContractProperties - Properties of the API Operation entity that can be updated. - *OperationUpdateContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationUpdateContract. -func (ouc OperationUpdateContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ouc.OperationUpdateContractProperties != nil { - objectMap["properties"] = ouc.OperationUpdateContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationUpdateContract struct. -func (ouc *OperationUpdateContract) 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 operationUpdateContractProperties OperationUpdateContractProperties - err = json.Unmarshal(*v, &operationUpdateContractProperties) - if err != nil { - return err - } - ouc.OperationUpdateContractProperties = &operationUpdateContractProperties - } - } - } - - return nil -} - -// OperationUpdateContractProperties operation Update Contract Properties. -type OperationUpdateContractProperties struct { - // DisplayName - Operation Name. - DisplayName *string `json:"displayName,omitempty"` - // Method - A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - Method *string `json:"method,omitempty"` - // URLTemplate - Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} - URLTemplate *string `json:"urlTemplate,omitempty"` - // TemplateParameters - Collection of URL template parameters. - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - // Description - Description of the operation. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Request - An entity containing request details. - Request *RequestContract `json:"request,omitempty"` - // Responses - Array of Operation responses. - Responses *[]ResponseContract `json:"responses,omitempty"` - // Policies - Operation Policies - Policies *string `json:"policies,omitempty"` -} - -// ParameterContract operation parameters details. -type ParameterContract struct { - // Name - Parameter name. - Name *string `json:"name,omitempty"` - // Description - Parameter description. - Description *string `json:"description,omitempty"` - // Type - Parameter type. - Type *string `json:"type,omitempty"` - // DefaultValue - Default parameter value. - DefaultValue *string `json:"defaultValue,omitempty"` - // Required - Specifies whether parameter is required or not. - Required *bool `json:"required,omitempty"` - // Values - Parameter values. - Values *[]string `json:"values,omitempty"` -} - -// PipelineDiagnosticSettings diagnostic settings for incoming/outgoing HTTP messages to the Gateway. -type PipelineDiagnosticSettings struct { - // Request - Diagnostic settings for request. - Request *HTTPMessageDiagnostic `json:"request,omitempty"` - // Response - Diagnostic settings for response. - Response *HTTPMessageDiagnostic `json:"response,omitempty"` -} - -// PolicyCollection the response of the list policy operation. -type PolicyCollection struct { - autorest.Response `json:"-"` - // Value - Policy Contract value. - Value *[]PolicyContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// PolicyContract policy Contract details. -type PolicyContract struct { - autorest.Response `json:"-"` - // PolicyContractProperties - Properties of the Policy. - *PolicyContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyContract. -func (pc PolicyContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.PolicyContractProperties != nil { - objectMap["properties"] = pc.PolicyContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PolicyContract struct. -func (pc *PolicyContract) 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 policyContractProperties PolicyContractProperties - err = json.Unmarshal(*v, &policyContractProperties) - if err != nil { - return err - } - pc.PolicyContractProperties = &policyContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pc.Type = &typeVar - } - } - } - - return nil -} - -// PolicyContractProperties policy contract Properties. -type PolicyContractProperties struct { - // Value - Contents of the Policy as defined by the format. - Value *string `json:"value,omitempty"` - // Format - Format of the policyContent. Possible values include: 'XML', 'XMLLink', 'Rawxml', 'RawxmlLink' - Format PolicyContentFormat `json:"format,omitempty"` -} - -// PolicyDescriptionCollection descriptions of APIM policies. -type PolicyDescriptionCollection struct { - autorest.Response `json:"-"` - // Value - Descriptions of APIM policies. - Value *[]PolicyDescriptionContract `json:"value,omitempty"` - // Count - Total record count number. - Count *int64 `json:"count,omitempty"` -} - -// PolicyDescriptionContract policy description details. -type PolicyDescriptionContract struct { - // PolicyDescriptionContractProperties - Policy description contract properties. - *PolicyDescriptionContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyDescriptionContract. -func (pdc PolicyDescriptionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pdc.PolicyDescriptionContractProperties != nil { - objectMap["properties"] = pdc.PolicyDescriptionContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PolicyDescriptionContract struct. -func (pdc *PolicyDescriptionContract) 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 policyDescriptionContractProperties PolicyDescriptionContractProperties - err = json.Unmarshal(*v, &policyDescriptionContractProperties) - if err != nil { - return err - } - pdc.PolicyDescriptionContractProperties = &policyDescriptionContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pdc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pdc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pdc.Type = &typeVar - } - } - } - - return nil -} - -// PolicyDescriptionContractProperties policy description properties. -type PolicyDescriptionContractProperties struct { - // Description - READ-ONLY; Policy description. - Description *string `json:"description,omitempty"` - // Scope - READ-ONLY; Binary OR value of the Snippet scope. - Scope *int32 `json:"scope,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyDescriptionContractProperties. -func (pdcp PolicyDescriptionContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PortalDelegationSettings delegation settings for a developer portal. -type PortalDelegationSettings struct { - autorest.Response `json:"-"` - // PortalDelegationSettingsProperties - Delegation settings contract properties. - *PortalDelegationSettingsProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalDelegationSettings. -func (pds PortalDelegationSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pds.PortalDelegationSettingsProperties != nil { - objectMap["properties"] = pds.PortalDelegationSettingsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalDelegationSettings struct. -func (pds *PortalDelegationSettings) 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 portalDelegationSettingsProperties PortalDelegationSettingsProperties - err = json.Unmarshal(*v, &portalDelegationSettingsProperties) - if err != nil { - return err - } - pds.PortalDelegationSettingsProperties = &portalDelegationSettingsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pds.Type = &typeVar - } - } - } - - return nil -} - -// PortalDelegationSettingsProperties delegation settings contract properties. -type PortalDelegationSettingsProperties struct { - // URL - A delegation Url. - URL *string `json:"url,omitempty"` - // ValidationKey - A base64-encoded validation key to validate, that a request is coming from Azure API Management. - ValidationKey *string `json:"validationKey,omitempty"` - // Subscriptions - Subscriptions delegation settings. - Subscriptions *SubscriptionsDelegationSettingsProperties `json:"subscriptions,omitempty"` - // UserRegistration - User registration delegation settings. - UserRegistration *RegistrationDelegationSettingsProperties `json:"userRegistration,omitempty"` -} - -// PortalSettingValidationKeyContract client or app secret used in IdentityProviders, Aad, OpenID or OAuth. -type PortalSettingValidationKeyContract struct { - autorest.Response `json:"-"` - // ValidationKey - This is secret value of the validation key in portal settings. - ValidationKey *string `json:"validationKey,omitempty"` -} - -// PortalSigninSettingProperties sign-in settings contract properties. -type PortalSigninSettingProperties struct { - // Enabled - Redirect Anonymous users to the Sign-In page. - Enabled *bool `json:"enabled,omitempty"` -} - -// PortalSigninSettings sign-In settings for the Developer Portal. -type PortalSigninSettings struct { - autorest.Response `json:"-"` - // PortalSigninSettingProperties - Sign-in settings contract properties. - *PortalSigninSettingProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalSigninSettings. -func (pss PortalSigninSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pss.PortalSigninSettingProperties != nil { - objectMap["properties"] = pss.PortalSigninSettingProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalSigninSettings struct. -func (pss *PortalSigninSettings) 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 portalSigninSettingProperties PortalSigninSettingProperties - err = json.Unmarshal(*v, &portalSigninSettingProperties) - if err != nil { - return err - } - pss.PortalSigninSettingProperties = &portalSigninSettingProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pss.Type = &typeVar - } - } - } - - return nil -} - -// PortalSignupSettings sign-Up settings for a developer portal. -type PortalSignupSettings struct { - autorest.Response `json:"-"` - // PortalSignupSettingsProperties - Sign-up settings contract properties. - *PortalSignupSettingsProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PortalSignupSettings. -func (pss PortalSignupSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pss.PortalSignupSettingsProperties != nil { - objectMap["properties"] = pss.PortalSignupSettingsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PortalSignupSettings struct. -func (pss *PortalSignupSettings) 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 portalSignupSettingsProperties PortalSignupSettingsProperties - err = json.Unmarshal(*v, &portalSignupSettingsProperties) - if err != nil { - return err - } - pss.PortalSignupSettingsProperties = &portalSignupSettingsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pss.Type = &typeVar - } - } - } - - return nil -} - -// PortalSignupSettingsProperties sign-up settings contract properties. -type PortalSignupSettingsProperties struct { - // Enabled - Allow users to sign up on a developer portal. - Enabled *bool `json:"enabled,omitempty"` - // TermsOfService - Terms of service contract properties. - TermsOfService *TermsOfServiceProperties `json:"termsOfService,omitempty"` -} - -// ProductCollection paged Products list representation. -type ProductCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]ProductContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ProductCollectionIterator provides access to a complete listing of ProductContract values. -type ProductCollectionIterator struct { - i int - page ProductCollectionPage -} - -// 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 *ProductCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductCollectionIterator.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 *ProductCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProductCollectionIterator) 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 ProductCollectionIterator) Response() ProductCollection { - 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 ProductCollectionIterator) Value() ProductContract { - if !iter.page.NotDone() { - return ProductContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProductCollectionIterator type. -func NewProductCollectionIterator(page ProductCollectionPage) ProductCollectionIterator { - return ProductCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pc ProductCollection) IsEmpty() bool { - return pc.Value == nil || len(*pc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pc ProductCollection) hasNextLink() bool { - return pc.NextLink != nil && len(*pc.NextLink) != 0 -} - -// productCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pc ProductCollection) productCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !pc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pc.NextLink))) -} - -// ProductCollectionPage contains a page of ProductContract values. -type ProductCollectionPage struct { - fn func(context.Context, ProductCollection) (ProductCollection, error) - pc ProductCollection -} - -// 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 *ProductCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductCollectionPage.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.pc) - if err != nil { - return err - } - page.pc = 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 *ProductCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProductCollectionPage) NotDone() bool { - return !page.pc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProductCollectionPage) Response() ProductCollection { - return page.pc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProductCollectionPage) Values() []ProductContract { - if page.pc.IsEmpty() { - return nil - } - return *page.pc.Value -} - -// Creates a new instance of the ProductCollectionPage type. -func NewProductCollectionPage(cur ProductCollection, getNextPage func(context.Context, ProductCollection) (ProductCollection, error)) ProductCollectionPage { - return ProductCollectionPage{ - fn: getNextPage, - pc: cur, - } -} - -// ProductContract product details. -type ProductContract struct { - autorest.Response `json:"-"` - // ProductContractProperties - Product entity contract properties. - *ProductContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProductContract. -func (pc ProductContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.ProductContractProperties != nil { - objectMap["properties"] = pc.ProductContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProductContract struct. -func (pc *ProductContract) 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 productContractProperties ProductContractProperties - err = json.Unmarshal(*v, &productContractProperties) - if err != nil { - return err - } - pc.ProductContractProperties = &productContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pc.Type = &typeVar - } - } - } - - return nil -} - -// ProductContractProperties product profile. -type ProductContractProperties struct { - // DisplayName - Product name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'NotPublished', 'Published' - State ProductState `json:"state,omitempty"` -} - -// ProductEntityBaseParameters product Entity Base Parameters -type ProductEntityBaseParameters struct { - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'NotPublished', 'Published' - State ProductState `json:"state,omitempty"` -} - -// ProductTagResourceContractProperties product profile. -type ProductTagResourceContractProperties struct { - // ID - Identifier of the product in the form of /products/{productId} - ID *string `json:"id,omitempty"` - // Name - Product name. - Name *string `json:"name,omitempty"` - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'NotPublished', 'Published' - State ProductState `json:"state,omitempty"` -} - -// ProductUpdateParameters product Update parameters. -type ProductUpdateParameters struct { - // ProductUpdateProperties - Product entity Update contract properties. - *ProductUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProductUpdateParameters. -func (pup ProductUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pup.ProductUpdateProperties != nil { - objectMap["properties"] = pup.ProductUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProductUpdateParameters struct. -func (pup *ProductUpdateParameters) 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 productUpdateProperties ProductUpdateProperties - err = json.Unmarshal(*v, &productUpdateProperties) - if err != nil { - return err - } - pup.ProductUpdateProperties = &productUpdateProperties - } - } - } - - return nil -} - -// ProductUpdateProperties parameters supplied to the Update Product operation. -type ProductUpdateProperties struct { - // DisplayName - Product name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Product description. May include HTML formatting tags. - Description *string `json:"description,omitempty"` - // Terms - Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - Terms *string `json:"terms,omitempty"` - // SubscriptionRequired - Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - // ApprovalRequired - whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of true. - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - // SubscriptionsLimit - Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of true. - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - // State - whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'NotPublished', 'Published' - State ProductState `json:"state,omitempty"` -} - -// PropertyValueContract client or app secret used in IdentityProviders, Aad, OpenID or OAuth. -type PropertyValueContract struct { - autorest.Response `json:"-"` - // Value - This is secret value of the NamedValue entity. - Value *string `json:"value,omitempty"` -} - -// QuotaCounterCollection paged Quota Counter list representation. -type QuotaCounterCollection struct { - autorest.Response `json:"-"` - // Value - Quota counter values. - Value *[]QuotaCounterContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// QuotaCounterContract quota counter details. -type QuotaCounterContract struct { - autorest.Response `json:"-"` - // CounterKey - The Key value of the Counter. Must not be empty. - CounterKey *string `json:"counterKey,omitempty"` - // PeriodKey - Identifier of the Period for which the counter was collected. Must not be empty. - PeriodKey *string `json:"periodKey,omitempty"` - // PeriodStartTime - The date of the start of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - PeriodStartTime *date.Time `json:"periodStartTime,omitempty"` - // PeriodEndTime - The date of the end of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - PeriodEndTime *date.Time `json:"periodEndTime,omitempty"` - // Value - Quota Value Properties - Value *QuotaCounterValueContractProperties `json:"value,omitempty"` -} - -// QuotaCounterValueContract quota counter value details. -type QuotaCounterValueContract struct { - // QuotaCounterValueContractProperties - Quota counter Value Properties. - *QuotaCounterValueContractProperties `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for QuotaCounterValueContract. -func (qcvc QuotaCounterValueContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qcvc.QuotaCounterValueContractProperties != nil { - objectMap["value"] = qcvc.QuotaCounterValueContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QuotaCounterValueContract struct. -func (qcvc *QuotaCounterValueContract) 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 { - var quotaCounterValueContractProperties QuotaCounterValueContractProperties - err = json.Unmarshal(*v, "aCounterValueContractProperties) - if err != nil { - return err - } - qcvc.QuotaCounterValueContractProperties = "aCounterValueContractProperties - } - } - } - - return nil -} - -// QuotaCounterValueContractProperties quota counter value details. -type QuotaCounterValueContractProperties struct { - // CallsCount - Number of times Counter was called. - CallsCount *int32 `json:"callsCount,omitempty"` - // KbTransferred - Data Transferred in KiloBytes. - KbTransferred *float64 `json:"kbTransferred,omitempty"` -} - -// RecipientEmailCollection paged Recipient User list representation. -type RecipientEmailCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]RecipientEmailContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RecipientEmailContract recipient Email details. -type RecipientEmailContract struct { - autorest.Response `json:"-"` - // RecipientEmailContractProperties - Recipient Email contract properties. - *RecipientEmailContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecipientEmailContract. -func (rec RecipientEmailContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rec.RecipientEmailContractProperties != nil { - objectMap["properties"] = rec.RecipientEmailContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecipientEmailContract struct. -func (rec *RecipientEmailContract) 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 recipientEmailContractProperties RecipientEmailContractProperties - err = json.Unmarshal(*v, &recipientEmailContractProperties) - if err != nil { - return err - } - rec.RecipientEmailContractProperties = &recipientEmailContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rec.Type = &typeVar - } - } - } - - return nil -} - -// RecipientEmailContractProperties recipient Email Contract Properties. -type RecipientEmailContractProperties struct { - // Email - User Email subscribed to notification. - Email *string `json:"email,omitempty"` -} - -// RecipientsContractProperties notification Parameter contract. -type RecipientsContractProperties struct { - // Emails - List of Emails subscribed for the notification. - Emails *[]string `json:"emails,omitempty"` - // Users - List of Users subscribed for the notification. - Users *[]string `json:"users,omitempty"` -} - -// RecipientUserCollection paged Recipient User list representation. -type RecipientUserCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]RecipientUserContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RecipientUserContract recipient User details. -type RecipientUserContract struct { - autorest.Response `json:"-"` - // RecipientUsersContractProperties - Recipient User entity contract properties. - *RecipientUsersContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecipientUserContract. -func (ruc RecipientUserContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ruc.RecipientUsersContractProperties != nil { - objectMap["properties"] = ruc.RecipientUsersContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecipientUserContract struct. -func (ruc *RecipientUserContract) 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 recipientUsersContractProperties RecipientUsersContractProperties - err = json.Unmarshal(*v, &recipientUsersContractProperties) - if err != nil { - return err - } - ruc.RecipientUsersContractProperties = &recipientUsersContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ruc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ruc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ruc.Type = &typeVar - } - } - } - - return nil -} - -// RecipientUsersContractProperties recipient User Contract Properties. -type RecipientUsersContractProperties struct { - // UserID - API Management UserId subscribed to notification. - UserID *string `json:"userId,omitempty"` -} - -// RegionContract region profile. -type RegionContract struct { - // Name - READ-ONLY; Region name. - Name *string `json:"name,omitempty"` - // IsMasterRegion - whether Region is the master region. - IsMasterRegion *bool `json:"isMasterRegion,omitempty"` - // IsDeleted - whether Region is deleted. - IsDeleted *bool `json:"isDeleted,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegionContract. -func (rc RegionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rc.IsMasterRegion != nil { - objectMap["isMasterRegion"] = rc.IsMasterRegion - } - if rc.IsDeleted != nil { - objectMap["isDeleted"] = rc.IsDeleted - } - return json.Marshal(objectMap) -} - -// RegionListResult lists Regions operation response details. -type RegionListResult struct { - autorest.Response `json:"-"` - // Value - Lists of Regions. - Value *[]RegionContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegionListResultIterator provides access to a complete listing of RegionContract values. -type RegionListResultIterator struct { - i int - page RegionListResultPage -} - -// 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 *RegionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionListResultIterator.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 *RegionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegionListResultIterator) 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 RegionListResultIterator) Response() RegionListResult { - 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 RegionListResultIterator) Value() RegionContract { - if !iter.page.NotDone() { - return RegionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegionListResultIterator type. -func NewRegionListResultIterator(page RegionListResultPage) RegionListResultIterator { - return RegionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegionListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegionListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// regionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegionListResult) regionListResultPreparer(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))) -} - -// RegionListResultPage contains a page of RegionContract values. -type RegionListResultPage struct { - fn func(context.Context, RegionListResult) (RegionListResult, error) - rlr RegionListResult -} - -// 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 *RegionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionListResultPage.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 *RegionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegionListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegionListResultPage) Response() RegionListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegionListResultPage) Values() []RegionContract { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegionListResultPage type. -func NewRegionListResultPage(cur RegionListResult, getNextPage func(context.Context, RegionListResult) (RegionListResult, error)) RegionListResultPage { - return RegionListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistrationDelegationSettingsProperties user registration delegation settings properties. -type RegistrationDelegationSettingsProperties struct { - // Enabled - Enable or disable delegation for user registration. - Enabled *bool `json:"enabled,omitempty"` -} - -// ReportCollection paged Report records list representation. -type ReportCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]ReportRecordContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReportCollectionIterator provides access to a complete listing of ReportRecordContract values. -type ReportCollectionIterator struct { - i int - page ReportCollectionPage -} - -// 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 *ReportCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportCollectionIterator.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 *ReportCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReportCollectionIterator) 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 ReportCollectionIterator) Response() ReportCollection { - 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 ReportCollectionIterator) Value() ReportRecordContract { - if !iter.page.NotDone() { - return ReportRecordContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReportCollectionIterator type. -func NewReportCollectionIterator(page ReportCollectionPage) ReportCollectionIterator { - return ReportCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rc ReportCollection) IsEmpty() bool { - return rc.Value == nil || len(*rc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rc ReportCollection) hasNextLink() bool { - return rc.NextLink != nil && len(*rc.NextLink) != 0 -} - -// reportCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rc ReportCollection) reportCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !rc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rc.NextLink))) -} - -// ReportCollectionPage contains a page of ReportRecordContract values. -type ReportCollectionPage struct { - fn func(context.Context, ReportCollection) (ReportCollection, error) - rc ReportCollection -} - -// 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 *ReportCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportCollectionPage.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.rc) - if err != nil { - return err - } - page.rc = 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 *ReportCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReportCollectionPage) NotDone() bool { - return !page.rc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReportCollectionPage) Response() ReportCollection { - return page.rc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReportCollectionPage) Values() []ReportRecordContract { - if page.rc.IsEmpty() { - return nil - } - return *page.rc.Value -} - -// Creates a new instance of the ReportCollectionPage type. -func NewReportCollectionPage(cur ReportCollection, getNextPage func(context.Context, ReportCollection) (ReportCollection, error)) ReportCollectionPage { - return ReportCollectionPage{ - fn: getNextPage, - rc: cur, - } -} - -// ReportRecordContract report data. -type ReportRecordContract struct { - // Name - Name depending on report endpoint specifies product, API, operation or developer name. - Name *string `json:"name,omitempty"` - // Timestamp - Start of aggregation period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Interval - Length of aggregation period. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). - Interval *string `json:"interval,omitempty"` - // Country - Country to which this record data is related. - Country *string `json:"country,omitempty"` - // Region - Country region to which this record data is related. - Region *string `json:"region,omitempty"` - // Zip - Zip code to which this record data is related. - Zip *string `json:"zip,omitempty"` - // UserID - READ-ONLY; User identifier path. /users/{userId} - UserID *string `json:"userId,omitempty"` - // ProductID - READ-ONLY; Product identifier path. /products/{productId} - ProductID *string `json:"productId,omitempty"` - // APIID - API identifier path. /apis/{apiId} - APIID *string `json:"apiId,omitempty"` - // OperationID - Operation identifier path. /apis/{apiId}/operations/{operationId} - OperationID *string `json:"operationId,omitempty"` - // APIRegion - API region identifier. - APIRegion *string `json:"apiRegion,omitempty"` - // SubscriptionID - Subscription identifier path. /subscriptions/{subscriptionId} - SubscriptionID *string `json:"subscriptionId,omitempty"` - // CallCountSuccess - Number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect - CallCountSuccess *int32 `json:"callCountSuccess,omitempty"` - // CallCountBlocked - Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests - CallCountBlocked *int32 `json:"callCountBlocked,omitempty"` - // CallCountFailed - Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600 - CallCountFailed *int32 `json:"callCountFailed,omitempty"` - // CallCountOther - Number of other calls. - CallCountOther *int32 `json:"callCountOther,omitempty"` - // CallCountTotal - Total number of calls. - CallCountTotal *int32 `json:"callCountTotal,omitempty"` - // Bandwidth - Bandwidth consumed. - Bandwidth *int64 `json:"bandwidth,omitempty"` - // CacheHitCount - Number of times when content was served from cache policy. - CacheHitCount *int32 `json:"cacheHitCount,omitempty"` - // CacheMissCount - Number of times content was fetched from backend. - CacheMissCount *int32 `json:"cacheMissCount,omitempty"` - // APITimeAvg - Average time it took to process request. - APITimeAvg *float64 `json:"apiTimeAvg,omitempty"` - // APITimeMin - Minimum time it took to process request. - APITimeMin *float64 `json:"apiTimeMin,omitempty"` - // APITimeMax - Maximum time it took to process request. - APITimeMax *float64 `json:"apiTimeMax,omitempty"` - // ServiceTimeAvg - Average time it took to process request on backend. - ServiceTimeAvg *float64 `json:"serviceTimeAvg,omitempty"` - // ServiceTimeMin - Minimum time it took to process request on backend. - ServiceTimeMin *float64 `json:"serviceTimeMin,omitempty"` - // ServiceTimeMax - Maximum time it took to process request on backend. - ServiceTimeMax *float64 `json:"serviceTimeMax,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReportRecordContract. -func (rrc ReportRecordContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rrc.Name != nil { - objectMap["name"] = rrc.Name - } - if rrc.Timestamp != nil { - objectMap["timestamp"] = rrc.Timestamp - } - if rrc.Interval != nil { - objectMap["interval"] = rrc.Interval - } - if rrc.Country != nil { - objectMap["country"] = rrc.Country - } - if rrc.Region != nil { - objectMap["region"] = rrc.Region - } - if rrc.Zip != nil { - objectMap["zip"] = rrc.Zip - } - if rrc.APIID != nil { - objectMap["apiId"] = rrc.APIID - } - if rrc.OperationID != nil { - objectMap["operationId"] = rrc.OperationID - } - if rrc.APIRegion != nil { - objectMap["apiRegion"] = rrc.APIRegion - } - if rrc.SubscriptionID != nil { - objectMap["subscriptionId"] = rrc.SubscriptionID - } - if rrc.CallCountSuccess != nil { - objectMap["callCountSuccess"] = rrc.CallCountSuccess - } - if rrc.CallCountBlocked != nil { - objectMap["callCountBlocked"] = rrc.CallCountBlocked - } - if rrc.CallCountFailed != nil { - objectMap["callCountFailed"] = rrc.CallCountFailed - } - if rrc.CallCountOther != nil { - objectMap["callCountOther"] = rrc.CallCountOther - } - if rrc.CallCountTotal != nil { - objectMap["callCountTotal"] = rrc.CallCountTotal - } - if rrc.Bandwidth != nil { - objectMap["bandwidth"] = rrc.Bandwidth - } - if rrc.CacheHitCount != nil { - objectMap["cacheHitCount"] = rrc.CacheHitCount - } - if rrc.CacheMissCount != nil { - objectMap["cacheMissCount"] = rrc.CacheMissCount - } - if rrc.APITimeAvg != nil { - objectMap["apiTimeAvg"] = rrc.APITimeAvg - } - if rrc.APITimeMin != nil { - objectMap["apiTimeMin"] = rrc.APITimeMin - } - if rrc.APITimeMax != nil { - objectMap["apiTimeMax"] = rrc.APITimeMax - } - if rrc.ServiceTimeAvg != nil { - objectMap["serviceTimeAvg"] = rrc.ServiceTimeAvg - } - if rrc.ServiceTimeMin != nil { - objectMap["serviceTimeMin"] = rrc.ServiceTimeMin - } - if rrc.ServiceTimeMax != nil { - objectMap["serviceTimeMax"] = rrc.ServiceTimeMax - } - return json.Marshal(objectMap) -} - -// RepresentationContract operation request/response representation details. -type RepresentationContract struct { - // ContentType - Specifies a registered or custom content type for this representation, e.g. application/xml. - ContentType *string `json:"contentType,omitempty"` - // Sample - An example of the representation. - Sample *string `json:"sample,omitempty"` - // SchemaID - Schema identifier. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - SchemaID *string `json:"schemaId,omitempty"` - // TypeName - Type name defined by the schema. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - TypeName *string `json:"typeName,omitempty"` - // FormParameters - Collection of form parameters. Required if 'contentType' value is either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. - FormParameters *[]ParameterContract `json:"formParameters,omitempty"` -} - -// RequestContract operation request details. -type RequestContract struct { - // Description - Operation request description. - Description *string `json:"description,omitempty"` - // QueryParameters - Collection of operation request query parameters. - QueryParameters *[]ParameterContract `json:"queryParameters,omitempty"` - // Headers - Collection of operation request headers. - Headers *[]ParameterContract `json:"headers,omitempty"` - // Representations - Collection of operation request representations. - Representations *[]RepresentationContract `json:"representations,omitempty"` -} - -// RequestReportCollection paged Report records list representation. -type RequestReportCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]RequestReportRecordContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` -} - -// RequestReportRecordContract request Report data. -type RequestReportRecordContract struct { - // APIID - API identifier path. /apis/{apiId} - APIID *string `json:"apiId,omitempty"` - // OperationID - Operation identifier path. /apis/{apiId}/operations/{operationId} - OperationID *string `json:"operationId,omitempty"` - // ProductID - READ-ONLY; Product identifier path. /products/{productId} - ProductID *string `json:"productId,omitempty"` - // UserID - READ-ONLY; User identifier path. /users/{userId} - UserID *string `json:"userId,omitempty"` - // Method - The HTTP method associated with this request.. - Method *string `json:"method,omitempty"` - // URL - The full URL associated with this request. - URL *string `json:"url,omitempty"` - // IPAddress - The client IP address associated with this request. - IPAddress *string `json:"ipAddress,omitempty"` - // BackendResponseCode - The HTTP status code received by the gateway as a result of forwarding this request to the backend. - BackendResponseCode *string `json:"backendResponseCode,omitempty"` - // ResponseCode - The HTTP status code returned by the gateway. - ResponseCode *int32 `json:"responseCode,omitempty"` - // ResponseSize - The size of the response returned by the gateway. - ResponseSize *int32 `json:"responseSize,omitempty"` - // Timestamp - The date and time when this request was received by the gateway in ISO 8601 format. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Cache - Specifies if response cache was involved in generating the response. If the value is none, the cache was not used. If the value is hit, cached response was returned. If the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by the backend. - Cache *string `json:"cache,omitempty"` - // APITime - The total time it took to process this request. - APITime *float64 `json:"apiTime,omitempty"` - // ServiceTime - he time it took to forward this request to the backend and get the response back. - ServiceTime *float64 `json:"serviceTime,omitempty"` - // APIRegion - Azure region where the gateway that processed this request is located. - APIRegion *string `json:"apiRegion,omitempty"` - // SubscriptionID - Subscription identifier path. /subscriptions/{subscriptionId} - SubscriptionID *string `json:"subscriptionId,omitempty"` - // RequestID - Request Identifier. - RequestID *string `json:"requestId,omitempty"` - // RequestSize - The size of this request.. - RequestSize *int32 `json:"requestSize,omitempty"` -} - -// MarshalJSON is the custom marshaler for RequestReportRecordContract. -func (rrrc RequestReportRecordContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rrrc.APIID != nil { - objectMap["apiId"] = rrrc.APIID - } - if rrrc.OperationID != nil { - objectMap["operationId"] = rrrc.OperationID - } - if rrrc.Method != nil { - objectMap["method"] = rrrc.Method - } - if rrrc.URL != nil { - objectMap["url"] = rrrc.URL - } - if rrrc.IPAddress != nil { - objectMap["ipAddress"] = rrrc.IPAddress - } - if rrrc.BackendResponseCode != nil { - objectMap["backendResponseCode"] = rrrc.BackendResponseCode - } - if rrrc.ResponseCode != nil { - objectMap["responseCode"] = rrrc.ResponseCode - } - if rrrc.ResponseSize != nil { - objectMap["responseSize"] = rrrc.ResponseSize - } - if rrrc.Timestamp != nil { - objectMap["timestamp"] = rrrc.Timestamp - } - if rrrc.Cache != nil { - objectMap["cache"] = rrrc.Cache - } - if rrrc.APITime != nil { - objectMap["apiTime"] = rrrc.APITime - } - if rrrc.ServiceTime != nil { - objectMap["serviceTime"] = rrrc.ServiceTime - } - if rrrc.APIRegion != nil { - objectMap["apiRegion"] = rrrc.APIRegion - } - if rrrc.SubscriptionID != nil { - objectMap["subscriptionId"] = rrrc.SubscriptionID - } - if rrrc.RequestID != nil { - objectMap["requestId"] = rrrc.RequestID - } - if rrrc.RequestSize != nil { - objectMap["requestSize"] = rrrc.RequestSize - } - return json.Marshal(objectMap) -} - -// Resource the Resource definition. -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 for API Management resource. - 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) -} - -// ResourceLocationDataContract resource location data properties. -type ResourceLocationDataContract struct { - // Name - A canonical name for the geographic or physical location. - Name *string `json:"name,omitempty"` - // City - The city or locality where the resource is located. - City *string `json:"city,omitempty"` - // District - The district, state, or province where the resource is located. - District *string `json:"district,omitempty"` - // CountryOrRegion - The country or region where the resource is located. - CountryOrRegion *string `json:"countryOrRegion,omitempty"` -} - -// ResourceSku describes an available API Management SKU. -type ResourceSku struct { - // Name - Name of the Sku. Possible values include: 'SkuTypeDeveloper', 'SkuTypeStandard', 'SkuTypePremium', 'SkuTypeBasic', 'SkuTypeConsumption' - Name SkuType `json:"name,omitempty"` -} - -// ResourceSkuCapacity describes scaling information of a SKU. -type ResourceSkuCapacity struct { - // Minimum - READ-ONLY; The minimum capacity. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - READ-ONLY; The maximum capacity that can be set. - Maximum *int32 `json:"maximum,omitempty"` - // Default - READ-ONLY; The default capacity. - Default *int32 `json:"default,omitempty"` - // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'ResourceSkuCapacityScaleTypeAutomatic', 'ResourceSkuCapacityScaleTypeManual', 'ResourceSkuCapacityScaleTypeNone' - ScaleType ResourceSkuCapacityScaleType `json:"scaleType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuCapacity. -func (rsc ResourceSkuCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuResult describes an available API Management service SKU. -type ResourceSkuResult struct { - // ResourceType - READ-ONLY; The type of resource the SKU applies to. - ResourceType *string `json:"resourceType,omitempty"` - // Sku - READ-ONLY; Specifies API Management SKU. - Sku *ResourceSku `json:"sku,omitempty"` - // Capacity - READ-ONLY; Specifies the number of API Management units. - Capacity *ResourceSkuCapacity `json:"capacity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuResult. -func (rsr ResourceSkuResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuResults the API Management service SKUs operation response. -type ResourceSkuResults struct { - autorest.Response `json:"-"` - // Value - The list of skus available for the service. - Value *[]ResourceSkuResult `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of API Management service Skus. - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceSkuResultsIterator provides access to a complete listing of ResourceSkuResult values. -type ResourceSkuResultsIterator struct { - i int - page ResourceSkuResultsPage -} - -// 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 *ResourceSkuResultsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuResultsIterator.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 *ResourceSkuResultsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceSkuResultsIterator) 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 ResourceSkuResultsIterator) Response() ResourceSkuResults { - 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 ResourceSkuResultsIterator) Value() ResourceSkuResult { - if !iter.page.NotDone() { - return ResourceSkuResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceSkuResultsIterator type. -func NewResourceSkuResultsIterator(page ResourceSkuResultsPage) ResourceSkuResultsIterator { - return ResourceSkuResultsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rsr ResourceSkuResults) IsEmpty() bool { - return rsr.Value == nil || len(*rsr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rsr ResourceSkuResults) hasNextLink() bool { - return rsr.NextLink != nil && len(*rsr.NextLink) != 0 -} - -// resourceSkuResultsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rsr ResourceSkuResults) resourceSkuResultsPreparer(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))) -} - -// ResourceSkuResultsPage contains a page of ResourceSkuResult values. -type ResourceSkuResultsPage struct { - fn func(context.Context, ResourceSkuResults) (ResourceSkuResults, error) - rsr ResourceSkuResults -} - -// 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 *ResourceSkuResultsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuResultsPage.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 *ResourceSkuResultsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceSkuResultsPage) NotDone() bool { - return !page.rsr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceSkuResultsPage) Response() ResourceSkuResults { - return page.rsr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceSkuResultsPage) Values() []ResourceSkuResult { - if page.rsr.IsEmpty() { - return nil - } - return *page.rsr.Value -} - -// Creates a new instance of the ResourceSkuResultsPage type. -func NewResourceSkuResultsPage(cur ResourceSkuResults, getNextPage func(context.Context, ResourceSkuResults) (ResourceSkuResults, error)) ResourceSkuResultsPage { - return ResourceSkuResultsPage{ - fn: getNextPage, - rsr: cur, - } -} - -// ResponseContract operation response details. -type ResponseContract struct { - // StatusCode - Operation response HTTP status code. - StatusCode *int32 `json:"statusCode,omitempty"` - // Description - Operation response description. - Description *string `json:"description,omitempty"` - // Representations - Collection of operation response representations. - Representations *[]RepresentationContract `json:"representations,omitempty"` - // Headers - Collection of operation response headers. - Headers *[]ParameterContract `json:"headers,omitempty"` -} - -// SamplingSettings sampling settings for Diagnostic. -type SamplingSettings struct { - // SamplingType - Sampling type. Possible values include: 'Fixed' - SamplingType SamplingType `json:"samplingType,omitempty"` - // Percentage - Rate of sampling for fixed-rate sampling. - Percentage *float64 `json:"percentage,omitempty"` -} - -// SaveConfigurationParameter save Tenant Configuration Contract details. -type SaveConfigurationParameter struct { - // SaveConfigurationParameterProperties - Properties of the Save Configuration Parameters. - *SaveConfigurationParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SaveConfigurationParameter. -func (scp SaveConfigurationParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.SaveConfigurationParameterProperties != nil { - objectMap["properties"] = scp.SaveConfigurationParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SaveConfigurationParameter struct. -func (scp *SaveConfigurationParameter) 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 saveConfigurationParameterProperties SaveConfigurationParameterProperties - err = json.Unmarshal(*v, &saveConfigurationParameterProperties) - if err != nil { - return err - } - scp.SaveConfigurationParameterProperties = &saveConfigurationParameterProperties - } - } - } - - return nil -} - -// SaveConfigurationParameterProperties parameters supplied to the Save Tenant Configuration operation. -type SaveConfigurationParameterProperties struct { - // Branch - The name of the Git branch in which to commit the current configuration snapshot. - Branch *string `json:"branch,omitempty"` - // Force - The value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. - Force *bool `json:"force,omitempty"` -} - -// SchemaCollection the response of the list schema operation. -type SchemaCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Api Schema Contract value. - Value *[]SchemaContract `json:"value,omitempty"` - // NextLink - READ-ONLY; Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaCollection. -func (sc SchemaCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SchemaCollectionIterator provides access to a complete listing of SchemaContract values. -type SchemaCollectionIterator struct { - i int - page SchemaCollectionPage -} - -// 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 *SchemaCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchemaCollectionIterator.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 *SchemaCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SchemaCollectionIterator) 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 SchemaCollectionIterator) Response() SchemaCollection { - 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 SchemaCollectionIterator) Value() SchemaContract { - if !iter.page.NotDone() { - return SchemaContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SchemaCollectionIterator type. -func NewSchemaCollectionIterator(page SchemaCollectionPage) SchemaCollectionIterator { - return SchemaCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sc SchemaCollection) IsEmpty() bool { - return sc.Value == nil || len(*sc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sc SchemaCollection) hasNextLink() bool { - return sc.NextLink != nil && len(*sc.NextLink) != 0 -} - -// schemaCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sc SchemaCollection) schemaCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !sc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sc.NextLink))) -} - -// SchemaCollectionPage contains a page of SchemaContract values. -type SchemaCollectionPage struct { - fn func(context.Context, SchemaCollection) (SchemaCollection, error) - sc SchemaCollection -} - -// 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 *SchemaCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchemaCollectionPage.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.sc) - if err != nil { - return err - } - page.sc = 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 *SchemaCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SchemaCollectionPage) NotDone() bool { - return !page.sc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SchemaCollectionPage) Response() SchemaCollection { - return page.sc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SchemaCollectionPage) Values() []SchemaContract { - if page.sc.IsEmpty() { - return nil - } - return *page.sc.Value -} - -// Creates a new instance of the SchemaCollectionPage type. -func NewSchemaCollectionPage(cur SchemaCollection, getNextPage func(context.Context, SchemaCollection) (SchemaCollection, error)) SchemaCollectionPage { - return SchemaCollectionPage{ - fn: getNextPage, - sc: cur, - } -} - -// SchemaContract schema Contract details. -type SchemaContract struct { - autorest.Response `json:"-"` - // SchemaContractProperties - Properties of the Schema. - *SchemaContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaContract. -func (sc SchemaContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sc.SchemaContractProperties != nil { - objectMap["properties"] = sc.SchemaContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SchemaContract struct. -func (sc *SchemaContract) 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 schemaContractProperties SchemaContractProperties - err = json.Unmarshal(*v, &schemaContractProperties) - if err != nil { - return err - } - sc.SchemaContractProperties = &schemaContractProperties - } - 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 - } - } - } - - return nil -} - -// SchemaContractProperties API Schema create or update contract Properties. -type SchemaContractProperties struct { - // ContentType - Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
- `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json`
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml`
- `OpenApi` Schema use `application/vnd.oai.openapi.components+json`
- `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. - ContentType *string `json:"contentType,omitempty"` - // SchemaDocumentProperties - Create or update Properties of the Schema Document. - *SchemaDocumentProperties `json:"document,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaContractProperties. -func (scp SchemaContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.ContentType != nil { - objectMap["contentType"] = scp.ContentType - } - if scp.SchemaDocumentProperties != nil { - objectMap["document"] = scp.SchemaDocumentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SchemaContractProperties struct. -func (scp *SchemaContractProperties) 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 "contentType": - if v != nil { - var contentType string - err = json.Unmarshal(*v, &contentType) - if err != nil { - return err - } - scp.ContentType = &contentType - } - case "document": - if v != nil { - var schemaDocumentProperties SchemaDocumentProperties - err = json.Unmarshal(*v, &schemaDocumentProperties) - if err != nil { - return err - } - scp.SchemaDocumentProperties = &schemaDocumentProperties - } - } - } - - return nil -} - -// SchemaDocumentProperties schema Document Properties. -type SchemaDocumentProperties struct { - // Value - Json escaped string defining the document representing the Schema. Used for schemas other than Swagger/OpenAPI. - Value *string `json:"value,omitempty"` - // Definitions - Types definitions. Used for Swagger/OpenAPI schemas only, null otherwise. - Definitions interface{} `json:"definitions,omitempty"` -} - -// ServiceApplyNetworkConfigurationParameters parameter supplied to the Apply Network configuration -// operation. -type ServiceApplyNetworkConfigurationParameters struct { - // Location - Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. - Location *string `json:"location,omitempty"` -} - -// ServiceApplyNetworkConfigurationUpdatesFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServiceApplyNetworkConfigurationUpdatesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceApplyNetworkConfigurationUpdatesFuture) 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 ServiceApplyNetworkConfigurationUpdatesFuture.Result. -func (future *ServiceApplyNetworkConfigurationUpdatesFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.ApplyNetworkConfigurationUpdatesResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceApplyNetworkConfigurationUpdatesFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceBackupFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceBackupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceBackupFuture) 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 ServiceBackupFuture.Result. -func (future *ServiceBackupFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceBackupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceBackupFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.BackupResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceBackupFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceBackupRestoreParameters parameters supplied to the Backup/Restore of an API Management service -// operation. -type ServiceBackupRestoreParameters struct { - // StorageAccount - Azure Cloud Storage account (used to place/retrieve the backup) name. - StorageAccount *string `json:"storageAccount,omitempty"` - // AccessKey - Azure Cloud Storage account (used to place/retrieve the backup) access key. - AccessKey *string `json:"accessKey,omitempty"` - // ContainerName - Azure Cloud Storage blob container name used to place/retrieve the backup. - ContainerName *string `json:"containerName,omitempty"` - // BackupName - The name of the backup file to create. - BackupName *string `json:"backupName,omitempty"` -} - -// ServiceBaseProperties base Properties of an API Management service resource description. -type ServiceBaseProperties struct { - // NotificationSenderEmail - Email address from which the notification will be sent. - NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - // GatewayURL - READ-ONLY; Gateway URL of the API Management service. - GatewayURL *string `json:"gatewayUrl,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Default Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. - PortalURL *string `json:"portalUrl,omitempty"` - // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. - ScmURL *string `json:"scmUrl,omitempty"` - // DeveloperPortalURL - READ-ONLY; DEveloper Portal endpoint URL of the API Management service. - DeveloperPortalURL *string `json:"developerPortalUrl,omitempty"` - // HostnameConfigurations - Custom hostname configuration of the API Management service. - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard and Premium SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard and Premium SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration of the API Management service. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // AdditionalLocations - Additional datacenter locations of the API Management service. - AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` - // CustomProperties - Custom properties of the API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.

You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384 - CustomProperties map[string]*string `json:"customProperties"` - // Certificates - List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` - // EnableClientCertificate - Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - EnableClientCertificate *bool `json:"enableClientCertificate,omitempty"` - // DisableGateway - Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - DisableGateway *bool `json:"disableGateway,omitempty"` - // VirtualNetworkType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' - VirtualNetworkType VirtualNetworkType `json:"virtualNetworkType,omitempty"` - // APIVersionConstraint - Control Plane Apis version constraint for the API Management service. - APIVersionConstraint *APIVersionConstraint `json:"apiVersionConstraint,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBaseProperties. -func (sbp ServiceBaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sbp.NotificationSenderEmail != nil { - objectMap["notificationSenderEmail"] = sbp.NotificationSenderEmail - } - if sbp.HostnameConfigurations != nil { - objectMap["hostnameConfigurations"] = sbp.HostnameConfigurations - } - if sbp.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = sbp.VirtualNetworkConfiguration - } - if sbp.AdditionalLocations != nil { - objectMap["additionalLocations"] = sbp.AdditionalLocations - } - if sbp.CustomProperties != nil { - objectMap["customProperties"] = sbp.CustomProperties - } - if sbp.Certificates != nil { - objectMap["certificates"] = sbp.Certificates - } - if sbp.EnableClientCertificate != nil { - objectMap["enableClientCertificate"] = sbp.EnableClientCertificate - } - if sbp.DisableGateway != nil { - objectMap["disableGateway"] = sbp.DisableGateway - } - if sbp.VirtualNetworkType != "" { - objectMap["virtualNetworkType"] = sbp.VirtualNetworkType - } - if sbp.APIVersionConstraint != nil { - objectMap["apiVersionConstraint"] = sbp.APIVersionConstraint - } - return json.Marshal(objectMap) -} - -// ServiceCheckNameAvailabilityParameters parameters supplied to the CheckNameAvailability operation. -type ServiceCheckNameAvailabilityParameters struct { - // Name - The name to check for availability. - Name *string `json:"name,omitempty"` -} - -// ServiceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceCreateOrUpdateFuture) 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 ServiceCreateOrUpdateFuture.Result. -func (future *ServiceCreateOrUpdateFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceDeleteFuture) 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 ServiceDeleteFuture.Result. -func (future *ServiceDeleteFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.DeleteResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceDeleteFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceGetSsoTokenResult the response of the GetSsoToken operation. -type ServiceGetSsoTokenResult struct { - autorest.Response `json:"-"` - // RedirectURI - Redirect URL to the Publisher Portal containing the SSO token. - RedirectURI *string `json:"redirectUri,omitempty"` -} - -// ServiceIdentity identity properties of the Api Management service resource. -type ServiceIdentity struct { - // Type - The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned', 'None' - Type ApimIdentityType `json:"type,omitempty"` - // PrincipalID - READ-ONLY; The principal id of the identity. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The client tenant id of the identity. - TenantID *uuid.UUID `json:"tenantId,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the resource. The user identity - // dictionary key references will be ARM resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - // providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ServiceIdentity. -func (si ServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if si.Type != "" { - objectMap["type"] = si.Type - } - if si.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = si.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ServiceListResult the response of the List API Management services operation. -type ServiceListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List API Management services operation. - Value *[]ServiceResource `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of API Management services. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceListResultIterator provides access to a complete listing of ServiceResource values. -type ServiceListResultIterator struct { - i int - page ServiceListResultPage -} - -// 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 *ServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultIterator.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 *ServiceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceListResultIterator) 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 ServiceListResultIterator) Response() ServiceListResult { - 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 ServiceListResultIterator) Value() ServiceResource { - if !iter.page.NotDone() { - return ServiceResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceListResultIterator type. -func NewServiceListResultIterator(page ServiceListResultPage) ServiceListResultIterator { - return ServiceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr ServiceListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr ServiceListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// serviceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr ServiceListResult) serviceListResultPreparer(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))) -} - -// ServiceListResultPage contains a page of ServiceResource values. -type ServiceListResultPage struct { - fn func(context.Context, ServiceListResult) (ServiceListResult, error) - slr ServiceListResult -} - -// 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 *ServiceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultPage.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 *ServiceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceListResultPage) Response() ServiceListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceListResultPage) Values() []ServiceResource { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the ServiceListResultPage type. -func NewServiceListResultPage(cur ServiceListResult, getNextPage func(context.Context, ServiceListResult) (ServiceListResult, error)) ServiceListResultPage { - return ServiceListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// ServiceNameAvailabilityResult response of the CheckNameAvailability operation. -type ServiceNameAvailabilityResult struct { - autorest.Response `json:"-"` - // NameAvailable - READ-ONLY; True if the name is available and can be used to create a new API Management service; otherwise false. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Message - READ-ONLY; If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that is already in use, and direct them to select a different name. - Message *string `json:"message,omitempty"` - // Reason - Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'Valid', 'Invalid', 'AlreadyExists' - Reason NameAvailabilityReason `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceNameAvailabilityResult. -func (snar ServiceNameAvailabilityResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if snar.Reason != "" { - objectMap["reason"] = snar.Reason - } - return json.Marshal(objectMap) -} - -// ServiceProperties properties of an API Management service resource description. -type ServiceProperties struct { - // PublisherEmail - Publisher email. - PublisherEmail *string `json:"publisherEmail,omitempty"` - // PublisherName - Publisher name. - PublisherName *string `json:"publisherName,omitempty"` - // NotificationSenderEmail - Email address from which the notification will be sent. - NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - // GatewayURL - READ-ONLY; Gateway URL of the API Management service. - GatewayURL *string `json:"gatewayUrl,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Default Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. - PortalURL *string `json:"portalUrl,omitempty"` - // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. - ScmURL *string `json:"scmUrl,omitempty"` - // DeveloperPortalURL - READ-ONLY; DEveloper Portal endpoint URL of the API Management service. - DeveloperPortalURL *string `json:"developerPortalUrl,omitempty"` - // HostnameConfigurations - Custom hostname configuration of the API Management service. - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard and Premium SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard and Premium SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration of the API Management service. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // AdditionalLocations - Additional datacenter locations of the API Management service. - AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` - // CustomProperties - Custom properties of the API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.

You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384 - CustomProperties map[string]*string `json:"customProperties"` - // Certificates - List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` - // EnableClientCertificate - Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - EnableClientCertificate *bool `json:"enableClientCertificate,omitempty"` - // DisableGateway - Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - DisableGateway *bool `json:"disableGateway,omitempty"` - // VirtualNetworkType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' - VirtualNetworkType VirtualNetworkType `json:"virtualNetworkType,omitempty"` - // APIVersionConstraint - Control Plane Apis version constraint for the API Management service. - APIVersionConstraint *APIVersionConstraint `json:"apiVersionConstraint,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceProperties. -func (sp ServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.PublisherEmail != nil { - objectMap["publisherEmail"] = sp.PublisherEmail - } - if sp.PublisherName != nil { - objectMap["publisherName"] = sp.PublisherName - } - if sp.NotificationSenderEmail != nil { - objectMap["notificationSenderEmail"] = sp.NotificationSenderEmail - } - if sp.HostnameConfigurations != nil { - objectMap["hostnameConfigurations"] = sp.HostnameConfigurations - } - if sp.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = sp.VirtualNetworkConfiguration - } - if sp.AdditionalLocations != nil { - objectMap["additionalLocations"] = sp.AdditionalLocations - } - if sp.CustomProperties != nil { - objectMap["customProperties"] = sp.CustomProperties - } - if sp.Certificates != nil { - objectMap["certificates"] = sp.Certificates - } - if sp.EnableClientCertificate != nil { - objectMap["enableClientCertificate"] = sp.EnableClientCertificate - } - if sp.DisableGateway != nil { - objectMap["disableGateway"] = sp.DisableGateway - } - if sp.VirtualNetworkType != "" { - objectMap["virtualNetworkType"] = sp.VirtualNetworkType - } - if sp.APIVersionConstraint != nil { - objectMap["apiVersionConstraint"] = sp.APIVersionConstraint - } - return json.Marshal(objectMap) -} - -// ServiceResource a single API Management service resource in List or Get response. -type ServiceResource struct { - autorest.Response `json:"-"` - // ServiceProperties - Properties of the API Management service. - *ServiceProperties `json:"properties,omitempty"` - // Sku - SKU properties of the API Management service. - Sku *ServiceSkuProperties `json:"sku,omitempty"` - // Identity - Managed service identity of the Api Management service. - Identity *ServiceIdentity `json:"identity,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Etag - READ-ONLY; ETag of the resource. - Etag *string `json:"etag,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 for API Management resource is set to Microsoft.ApiManagement. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceResource. -func (sr ServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.ServiceProperties != nil { - objectMap["properties"] = sr.ServiceProperties - } - if sr.Sku != nil { - objectMap["sku"] = sr.Sku - } - if sr.Identity != nil { - objectMap["identity"] = sr.Identity - } - if sr.Location != nil { - objectMap["location"] = sr.Location - } - if sr.Tags != nil { - objectMap["tags"] = sr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResource struct. -func (sr *ServiceResource) 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 serviceProperties ServiceProperties - err = json.Unmarshal(*v, &serviceProperties) - if err != nil { - return err - } - sr.ServiceProperties = &serviceProperties - } - case "sku": - if v != nil { - var sku ServiceSkuProperties - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sr.Sku = &sku - } - case "identity": - if v != nil { - var identity ServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sr.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sr.Location = &location - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sr.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sr.Tags = tags - } - } - } - - return nil -} - -// ServiceRestoreFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceRestoreFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceRestoreFuture) 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 ServiceRestoreFuture.Result. -func (future *ServiceRestoreFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceRestoreFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceRestoreFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.RestoreResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceRestoreFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceSkuProperties API Management service resource SKU properties. -type ServiceSkuProperties struct { - // Name - Name of the Sku. Possible values include: 'SkuTypeDeveloper', 'SkuTypeStandard', 'SkuTypePremium', 'SkuTypeBasic', 'SkuTypeConsumption' - Name SkuType `json:"name,omitempty"` - // Capacity - Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU capacity must be specified as 0. - Capacity *int32 `json:"capacity,omitempty"` -} - -// ServiceUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceUpdateFuture) 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 ServiceUpdateFuture.Result. -func (future *ServiceUpdateFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.ServiceUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.UpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceUpdateParameters parameter supplied to Update Api Management Service. -type ServiceUpdateParameters struct { - // ServiceUpdateProperties - Properties of the API Management service. - *ServiceUpdateProperties `json:"properties,omitempty"` - // Sku - SKU properties of the API Management service. - Sku *ServiceSkuProperties `json:"sku,omitempty"` - // Identity - Managed service identity of the Api Management service. - Identity *ServiceIdentity `json:"identity,omitempty"` - // Etag - READ-ONLY; ETag of the resource. - Etag *string `json:"etag,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 for API Management resource is set to Microsoft.ApiManagement. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceUpdateParameters. -func (sup ServiceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.ServiceUpdateProperties != nil { - objectMap["properties"] = sup.ServiceUpdateProperties - } - if sup.Sku != nil { - objectMap["sku"] = sup.Sku - } - if sup.Identity != nil { - objectMap["identity"] = sup.Identity - } - if sup.Tags != nil { - objectMap["tags"] = sup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceUpdateParameters struct. -func (sup *ServiceUpdateParameters) 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 serviceUpdateProperties ServiceUpdateProperties - err = json.Unmarshal(*v, &serviceUpdateProperties) - if err != nil { - return err - } - sup.ServiceUpdateProperties = &serviceUpdateProperties - } - case "sku": - if v != nil { - var sku ServiceSkuProperties - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sup.Sku = &sku - } - case "identity": - if v != nil { - var identity ServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sup.Identity = &identity - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sup.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sup.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sup.Tags = tags - } - } - } - - return nil -} - -// ServiceUpdateProperties properties of an API Management service resource description. -type ServiceUpdateProperties struct { - // PublisherEmail - Publisher email. - PublisherEmail *string `json:"publisherEmail,omitempty"` - // PublisherName - Publisher name. - PublisherName *string `json:"publisherName,omitempty"` - // NotificationSenderEmail - Email address from which the notification will be sent. - NotificationSenderEmail *string `json:"notificationSenderEmail,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetProvisioningState - READ-ONLY; The provisioning state of the API Management service, which is targeted by the long running operation started on the service. - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - // CreatedAtUtc - READ-ONLY; Creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - // GatewayURL - READ-ONLY; Gateway URL of the API Management service. - GatewayURL *string `json:"gatewayUrl,omitempty"` - // GatewayRegionalURL - READ-ONLY; Gateway URL of the API Management service in the Default Region. - GatewayRegionalURL *string `json:"gatewayRegionalUrl,omitempty"` - // PortalURL - READ-ONLY; Publisher portal endpoint Url of the API Management service. - PortalURL *string `json:"portalUrl,omitempty"` - // ManagementAPIURL - READ-ONLY; Management API endpoint URL of the API Management service. - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - // ScmURL - READ-ONLY; SCM endpoint URL of the API Management service. - ScmURL *string `json:"scmUrl,omitempty"` - // DeveloperPortalURL - READ-ONLY; DEveloper Portal endpoint URL of the API Management service. - DeveloperPortalURL *string `json:"developerPortalUrl,omitempty"` - // HostnameConfigurations - Custom hostname configuration of the API Management service. - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - // PublicIPAddresses - READ-ONLY; Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard and Premium SKU. - PublicIPAddresses *[]string `json:"publicIPAddresses,omitempty"` - // PrivateIPAddresses - READ-ONLY; Private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard and Premium SKU. - PrivateIPAddresses *[]string `json:"privateIPAddresses,omitempty"` - // VirtualNetworkConfiguration - Virtual network configuration of the API Management service. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // AdditionalLocations - Additional datacenter locations of the API Management service. - AdditionalLocations *[]AdditionalLocation `json:"additionalLocations,omitempty"` - // CustomProperties - Custom properties of the API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.
Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.
Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.

You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384 - CustomProperties map[string]*string `json:"customProperties"` - // Certificates - List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - Certificates *[]CertificateConfiguration `json:"certificates,omitempty"` - // EnableClientCertificate - Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - EnableClientCertificate *bool `json:"enableClientCertificate,omitempty"` - // DisableGateway - Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - DisableGateway *bool `json:"disableGateway,omitempty"` - // VirtualNetworkType - The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'VirtualNetworkTypeNone', 'VirtualNetworkTypeExternal', 'VirtualNetworkTypeInternal' - VirtualNetworkType VirtualNetworkType `json:"virtualNetworkType,omitempty"` - // APIVersionConstraint - Control Plane Apis version constraint for the API Management service. - APIVersionConstraint *APIVersionConstraint `json:"apiVersionConstraint,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceUpdateProperties. -func (sup ServiceUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.PublisherEmail != nil { - objectMap["publisherEmail"] = sup.PublisherEmail - } - if sup.PublisherName != nil { - objectMap["publisherName"] = sup.PublisherName - } - if sup.NotificationSenderEmail != nil { - objectMap["notificationSenderEmail"] = sup.NotificationSenderEmail - } - if sup.HostnameConfigurations != nil { - objectMap["hostnameConfigurations"] = sup.HostnameConfigurations - } - if sup.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = sup.VirtualNetworkConfiguration - } - if sup.AdditionalLocations != nil { - objectMap["additionalLocations"] = sup.AdditionalLocations - } - if sup.CustomProperties != nil { - objectMap["customProperties"] = sup.CustomProperties - } - if sup.Certificates != nil { - objectMap["certificates"] = sup.Certificates - } - if sup.EnableClientCertificate != nil { - objectMap["enableClientCertificate"] = sup.EnableClientCertificate - } - if sup.DisableGateway != nil { - objectMap["disableGateway"] = sup.DisableGateway - } - if sup.VirtualNetworkType != "" { - objectMap["virtualNetworkType"] = sup.VirtualNetworkType - } - if sup.APIVersionConstraint != nil { - objectMap["apiVersionConstraint"] = sup.APIVersionConstraint - } - return json.Marshal(objectMap) -} - -// SubscriptionCollection paged Subscriptions list representation. -type SubscriptionCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]SubscriptionContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// SubscriptionCollectionIterator provides access to a complete listing of SubscriptionContract values. -type SubscriptionCollectionIterator struct { - i int - page SubscriptionCollectionPage -} - -// 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 *SubscriptionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionCollectionIterator.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 *SubscriptionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SubscriptionCollectionIterator) 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 SubscriptionCollectionIterator) Response() SubscriptionCollection { - 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 SubscriptionCollectionIterator) Value() SubscriptionContract { - if !iter.page.NotDone() { - return SubscriptionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SubscriptionCollectionIterator type. -func NewSubscriptionCollectionIterator(page SubscriptionCollectionPage) SubscriptionCollectionIterator { - return SubscriptionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sc SubscriptionCollection) IsEmpty() bool { - return sc.Value == nil || len(*sc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sc SubscriptionCollection) hasNextLink() bool { - return sc.NextLink != nil && len(*sc.NextLink) != 0 -} - -// subscriptionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sc SubscriptionCollection) subscriptionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !sc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sc.NextLink))) -} - -// SubscriptionCollectionPage contains a page of SubscriptionContract values. -type SubscriptionCollectionPage struct { - fn func(context.Context, SubscriptionCollection) (SubscriptionCollection, error) - sc SubscriptionCollection -} - -// 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 *SubscriptionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionCollectionPage.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.sc) - if err != nil { - return err - } - page.sc = 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 *SubscriptionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SubscriptionCollectionPage) NotDone() bool { - return !page.sc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SubscriptionCollectionPage) Response() SubscriptionCollection { - return page.sc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SubscriptionCollectionPage) Values() []SubscriptionContract { - if page.sc.IsEmpty() { - return nil - } - return *page.sc.Value -} - -// Creates a new instance of the SubscriptionCollectionPage type. -func NewSubscriptionCollectionPage(cur SubscriptionCollection, getNextPage func(context.Context, SubscriptionCollection) (SubscriptionCollection, error)) SubscriptionCollectionPage { - return SubscriptionCollectionPage{ - fn: getNextPage, - sc: cur, - } -} - -// SubscriptionContract subscription details. -type SubscriptionContract struct { - autorest.Response `json:"-"` - // SubscriptionContractProperties - Subscription contract properties. - *SubscriptionContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionContract. -func (sc SubscriptionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sc.SubscriptionContractProperties != nil { - objectMap["properties"] = sc.SubscriptionContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionContract struct. -func (sc *SubscriptionContract) 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 subscriptionContractProperties SubscriptionContractProperties - err = json.Unmarshal(*v, &subscriptionContractProperties) - if err != nil { - return err - } - sc.SubscriptionContractProperties = &subscriptionContractProperties - } - 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 - } - } - } - - return nil -} - -// SubscriptionContractProperties subscription details. -type SubscriptionContractProperties struct { - // OwnerID - The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier. - OwnerID *string `json:"ownerId,omitempty"` - // Scope - Scope like /products/{productId} or /apis or /apis/{apiId}. - Scope *string `json:"scope,omitempty"` - // DisplayName - The name of the subscription, or null if the subscription has no name. - DisplayName *string `json:"displayName,omitempty"` - // State - Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'Suspended', 'Active', 'Expired', 'Submitted', 'Rejected', 'Cancelled' - State SubscriptionState `json:"state,omitempty"` - // CreatedDate - READ-ONLY; Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // StartDate - Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - StartDate *date.Time `json:"startDate,omitempty"` - // ExpirationDate - Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // EndDate - Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - EndDate *date.Time `json:"endDate,omitempty"` - // NotificationDate - Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - NotificationDate *date.Time `json:"notificationDate,omitempty"` - // PrimaryKey - Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // StateComment - Optional subscription comment added by an administrator. - StateComment *string `json:"stateComment,omitempty"` - // AllowTracing - Determines whether tracing is enabled - AllowTracing *bool `json:"allowTracing,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionContractProperties. -func (scp SubscriptionContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.OwnerID != nil { - objectMap["ownerId"] = scp.OwnerID - } - if scp.Scope != nil { - objectMap["scope"] = scp.Scope - } - if scp.DisplayName != nil { - objectMap["displayName"] = scp.DisplayName - } - if scp.State != "" { - objectMap["state"] = scp.State - } - if scp.StartDate != nil { - objectMap["startDate"] = scp.StartDate - } - if scp.ExpirationDate != nil { - objectMap["expirationDate"] = scp.ExpirationDate - } - if scp.EndDate != nil { - objectMap["endDate"] = scp.EndDate - } - if scp.NotificationDate != nil { - objectMap["notificationDate"] = scp.NotificationDate - } - if scp.PrimaryKey != nil { - objectMap["primaryKey"] = scp.PrimaryKey - } - if scp.SecondaryKey != nil { - objectMap["secondaryKey"] = scp.SecondaryKey - } - if scp.StateComment != nil { - objectMap["stateComment"] = scp.StateComment - } - if scp.AllowTracing != nil { - objectMap["allowTracing"] = scp.AllowTracing - } - return json.Marshal(objectMap) -} - -// SubscriptionCreateParameterProperties parameters supplied to the Create subscription operation. -type SubscriptionCreateParameterProperties struct { - // OwnerID - User (user id path) for whom subscription is being created in form /users/{userId} - OwnerID *string `json:"ownerId,omitempty"` - // Scope - Scope like /products/{productId} or /apis or /apis/{apiId}. - Scope *string `json:"scope,omitempty"` - // DisplayName - Subscription name. - DisplayName *string `json:"displayName,omitempty"` - // PrimaryKey - Primary subscription key. If not specified during request key will be generated automatically. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary subscription key. If not specified during request key will be generated automatically. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // State - Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'Suspended', 'Active', 'Expired', 'Submitted', 'Rejected', 'Cancelled' - State SubscriptionState `json:"state,omitempty"` - // AllowTracing - Determines whether tracing can be enabled - AllowTracing *bool `json:"allowTracing,omitempty"` -} - -// SubscriptionCreateParameters subscription create details. -type SubscriptionCreateParameters struct { - // SubscriptionCreateParameterProperties - Subscription contract properties. - *SubscriptionCreateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionCreateParameters. -func (scp SubscriptionCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.SubscriptionCreateParameterProperties != nil { - objectMap["properties"] = scp.SubscriptionCreateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionCreateParameters struct. -func (scp *SubscriptionCreateParameters) 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 subscriptionCreateParameterProperties SubscriptionCreateParameterProperties - err = json.Unmarshal(*v, &subscriptionCreateParameterProperties) - if err != nil { - return err - } - scp.SubscriptionCreateParameterProperties = &subscriptionCreateParameterProperties - } - } - } - - return nil -} - -// SubscriptionKeyParameterNamesContract subscription key parameter names details. -type SubscriptionKeyParameterNamesContract struct { - // Header - Subscription key header name. - Header *string `json:"header,omitempty"` - // Query - Subscription key query string parameter name. - Query *string `json:"query,omitempty"` -} - -// SubscriptionKeysContract subscription keys. -type SubscriptionKeysContract struct { - autorest.Response `json:"-"` - // PrimaryKey - Subscription primary key. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Subscription secondary key. - SecondaryKey *string `json:"secondaryKey,omitempty"` -} - -// SubscriptionsDelegationSettingsProperties subscriptions delegation settings properties. -type SubscriptionsDelegationSettingsProperties struct { - // Enabled - Enable or disable delegation for subscriptions. - Enabled *bool `json:"enabled,omitempty"` -} - -// SubscriptionUpdateParameterProperties parameters supplied to the Update subscription operation. -type SubscriptionUpdateParameterProperties struct { - // OwnerID - User identifier path: /users/{userId} - OwnerID *string `json:"ownerId,omitempty"` - // Scope - Scope like /products/{productId} or /apis or /apis/{apiId} - Scope *string `json:"scope,omitempty"` - // ExpirationDate - Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // DisplayName - Subscription name. - DisplayName *string `json:"displayName,omitempty"` - // PrimaryKey - Primary subscription key. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary subscription key. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // State - Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'Suspended', 'Active', 'Expired', 'Submitted', 'Rejected', 'Cancelled' - State SubscriptionState `json:"state,omitempty"` - // StateComment - Comments describing subscription state change by the administrator. - StateComment *string `json:"stateComment,omitempty"` - // AllowTracing - Determines whether tracing can be enabled - AllowTracing *bool `json:"allowTracing,omitempty"` -} - -// SubscriptionUpdateParameters subscription update details. -type SubscriptionUpdateParameters struct { - // SubscriptionUpdateParameterProperties - Subscription Update contract properties. - *SubscriptionUpdateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionUpdateParameters. -func (sup SubscriptionUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.SubscriptionUpdateParameterProperties != nil { - objectMap["properties"] = sup.SubscriptionUpdateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionUpdateParameters struct. -func (sup *SubscriptionUpdateParameters) 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 subscriptionUpdateParameterProperties SubscriptionUpdateParameterProperties - err = json.Unmarshal(*v, &subscriptionUpdateParameterProperties) - if err != nil { - return err - } - sup.SubscriptionUpdateParameterProperties = &subscriptionUpdateParameterProperties - } - } - } - - return nil -} - -// TagCollection paged Tag list representation. -type TagCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]TagContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// TagCollectionIterator provides access to a complete listing of TagContract values. -type TagCollectionIterator struct { - i int - page TagCollectionPage -} - -// 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 *TagCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagCollectionIterator.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 *TagCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagCollectionIterator) 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 TagCollectionIterator) Response() TagCollection { - 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 TagCollectionIterator) Value() TagContract { - if !iter.page.NotDone() { - return TagContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagCollectionIterator type. -func NewTagCollectionIterator(page TagCollectionPage) TagCollectionIterator { - return TagCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tc TagCollection) IsEmpty() bool { - return tc.Value == nil || len(*tc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tc TagCollection) hasNextLink() bool { - return tc.NextLink != nil && len(*tc.NextLink) != 0 -} - -// tagCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tc TagCollection) tagCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !tc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tc.NextLink))) -} - -// TagCollectionPage contains a page of TagContract values. -type TagCollectionPage struct { - fn func(context.Context, TagCollection) (TagCollection, error) - tc TagCollection -} - -// 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 *TagCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagCollectionPage.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.tc) - if err != nil { - return err - } - page.tc = 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 *TagCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagCollectionPage) NotDone() bool { - return !page.tc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagCollectionPage) Response() TagCollection { - return page.tc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagCollectionPage) Values() []TagContract { - if page.tc.IsEmpty() { - return nil - } - return *page.tc.Value -} - -// Creates a new instance of the TagCollectionPage type. -func NewTagCollectionPage(cur TagCollection, getNextPage func(context.Context, TagCollection) (TagCollection, error)) TagCollectionPage { - return TagCollectionPage{ - fn: getNextPage, - tc: cur, - } -} - -// TagContract tag Contract details. -type TagContract struct { - autorest.Response `json:"-"` - // TagContractProperties - Tag entity contract properties. - *TagContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagContract. -func (tc TagContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tc.TagContractProperties != nil { - objectMap["properties"] = tc.TagContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagContract struct. -func (tc *TagContract) 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 tagContractProperties TagContractProperties - err = json.Unmarshal(*v, &tagContractProperties) - if err != nil { - return err - } - tc.TagContractProperties = &tagContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tc.Type = &typeVar - } - } - } - - return nil -} - -// TagContractProperties tag contract Properties. -type TagContractProperties struct { - // DisplayName - Tag name. - DisplayName *string `json:"displayName,omitempty"` -} - -// TagCreateUpdateParameters parameters supplied to Create/Update Tag operations. -type TagCreateUpdateParameters struct { - // TagContractProperties - Properties supplied to Create Tag operation. - *TagContractProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagCreateUpdateParameters. -func (tcup TagCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TagContractProperties != nil { - objectMap["properties"] = tcup.TagContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagCreateUpdateParameters struct. -func (tcup *TagCreateUpdateParameters) 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 tagContractProperties TagContractProperties - err = json.Unmarshal(*v, &tagContractProperties) - if err != nil { - return err - } - tcup.TagContractProperties = &tagContractProperties - } - } - } - - return nil -} - -// TagDescriptionBaseProperties parameters supplied to the Create TagDescription operation. -type TagDescriptionBaseProperties struct { - // Description - Description of the Tag. - Description *string `json:"description,omitempty"` - // ExternalDocsURL - Absolute URL of external resources describing the tag. - ExternalDocsURL *string `json:"externalDocsUrl,omitempty"` - // ExternalDocsDescription - Description of the external resources describing the tag. - ExternalDocsDescription *string `json:"externalDocsDescription,omitempty"` -} - -// TagDescriptionCollection paged TagDescription list representation. -type TagDescriptionCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]TagDescriptionContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// TagDescriptionCollectionIterator provides access to a complete listing of TagDescriptionContract values. -type TagDescriptionCollectionIterator struct { - i int - page TagDescriptionCollectionPage -} - -// 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 *TagDescriptionCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionCollectionIterator.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 *TagDescriptionCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagDescriptionCollectionIterator) 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 TagDescriptionCollectionIterator) Response() TagDescriptionCollection { - 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 TagDescriptionCollectionIterator) Value() TagDescriptionContract { - if !iter.page.NotDone() { - return TagDescriptionContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagDescriptionCollectionIterator type. -func NewTagDescriptionCollectionIterator(page TagDescriptionCollectionPage) TagDescriptionCollectionIterator { - return TagDescriptionCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tdc TagDescriptionCollection) IsEmpty() bool { - return tdc.Value == nil || len(*tdc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tdc TagDescriptionCollection) hasNextLink() bool { - return tdc.NextLink != nil && len(*tdc.NextLink) != 0 -} - -// tagDescriptionCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tdc TagDescriptionCollection) tagDescriptionCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !tdc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tdc.NextLink))) -} - -// TagDescriptionCollectionPage contains a page of TagDescriptionContract values. -type TagDescriptionCollectionPage struct { - fn func(context.Context, TagDescriptionCollection) (TagDescriptionCollection, error) - tdc TagDescriptionCollection -} - -// 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 *TagDescriptionCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagDescriptionCollectionPage.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.tdc) - if err != nil { - return err - } - page.tdc = 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 *TagDescriptionCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagDescriptionCollectionPage) NotDone() bool { - return !page.tdc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagDescriptionCollectionPage) Response() TagDescriptionCollection { - return page.tdc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagDescriptionCollectionPage) Values() []TagDescriptionContract { - if page.tdc.IsEmpty() { - return nil - } - return *page.tdc.Value -} - -// Creates a new instance of the TagDescriptionCollectionPage type. -func NewTagDescriptionCollectionPage(cur TagDescriptionCollection, getNextPage func(context.Context, TagDescriptionCollection) (TagDescriptionCollection, error)) TagDescriptionCollectionPage { - return TagDescriptionCollectionPage{ - fn: getNextPage, - tdc: cur, - } -} - -// TagDescriptionContract contract details. -type TagDescriptionContract struct { - autorest.Response `json:"-"` - // TagDescriptionContractProperties - TagDescription entity contract properties. - *TagDescriptionContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagDescriptionContract. -func (tdc TagDescriptionContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tdc.TagDescriptionContractProperties != nil { - objectMap["properties"] = tdc.TagDescriptionContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagDescriptionContract struct. -func (tdc *TagDescriptionContract) 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 tagDescriptionContractProperties TagDescriptionContractProperties - err = json.Unmarshal(*v, &tagDescriptionContractProperties) - if err != nil { - return err - } - tdc.TagDescriptionContractProperties = &tagDescriptionContractProperties - } - 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 - } - } - } - - return nil -} - -// TagDescriptionContractProperties tagDescription contract Properties. -type TagDescriptionContractProperties struct { - // TagID - Identifier of the tag in the form of /tags/{tagId} - TagID *string `json:"tagId,omitempty"` - // DisplayName - Tag name. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the Tag. - Description *string `json:"description,omitempty"` - // ExternalDocsURL - Absolute URL of external resources describing the tag. - ExternalDocsURL *string `json:"externalDocsUrl,omitempty"` - // ExternalDocsDescription - Description of the external resources describing the tag. - ExternalDocsDescription *string `json:"externalDocsDescription,omitempty"` -} - -// TagDescriptionCreateParameters parameters supplied to the Create TagDescription operation. -type TagDescriptionCreateParameters struct { - // TagDescriptionBaseProperties - Properties supplied to Create TagDescription operation. - *TagDescriptionBaseProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagDescriptionCreateParameters. -func (tdcp TagDescriptionCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tdcp.TagDescriptionBaseProperties != nil { - objectMap["properties"] = tdcp.TagDescriptionBaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TagDescriptionCreateParameters struct. -func (tdcp *TagDescriptionCreateParameters) 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 tagDescriptionBaseProperties TagDescriptionBaseProperties - err = json.Unmarshal(*v, &tagDescriptionBaseProperties) - if err != nil { - return err - } - tdcp.TagDescriptionBaseProperties = &tagDescriptionBaseProperties - } - } - } - - return nil -} - -// TagResourceCollection paged Tag list representation. -type TagResourceCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]TagResourceContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// TagResourceCollectionIterator provides access to a complete listing of TagResourceContract values. -type TagResourceCollectionIterator struct { - i int - page TagResourceCollectionPage -} - -// 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 *TagResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceCollectionIterator.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 *TagResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TagResourceCollectionIterator) 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 TagResourceCollectionIterator) Response() TagResourceCollection { - 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 TagResourceCollectionIterator) Value() TagResourceContract { - if !iter.page.NotDone() { - return TagResourceContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TagResourceCollectionIterator type. -func NewTagResourceCollectionIterator(page TagResourceCollectionPage) TagResourceCollectionIterator { - return TagResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (trc TagResourceCollection) IsEmpty() bool { - return trc.Value == nil || len(*trc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (trc TagResourceCollection) hasNextLink() bool { - return trc.NextLink != nil && len(*trc.NextLink) != 0 -} - -// tagResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (trc TagResourceCollection) tagResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !trc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(trc.NextLink))) -} - -// TagResourceCollectionPage contains a page of TagResourceContract values. -type TagResourceCollectionPage struct { - fn func(context.Context, TagResourceCollection) (TagResourceCollection, error) - trc TagResourceCollection -} - -// 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 *TagResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceCollectionPage.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.trc) - if err != nil { - return err - } - page.trc = 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 *TagResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TagResourceCollectionPage) NotDone() bool { - return !page.trc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TagResourceCollectionPage) Response() TagResourceCollection { - return page.trc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TagResourceCollectionPage) Values() []TagResourceContract { - if page.trc.IsEmpty() { - return nil - } - return *page.trc.Value -} - -// Creates a new instance of the TagResourceCollectionPage type. -func NewTagResourceCollectionPage(cur TagResourceCollection, getNextPage func(context.Context, TagResourceCollection) (TagResourceCollection, error)) TagResourceCollectionPage { - return TagResourceCollectionPage{ - fn: getNextPage, - trc: cur, - } -} - -// TagResourceContract tagResource contract properties. -type TagResourceContract struct { - // Tag - Tag associated with the resource. - Tag *TagTagResourceContractProperties `json:"tag,omitempty"` - // API - Api associated with the tag. - API *APITagResourceContractProperties `json:"api,omitempty"` - // Operation - Operation associated with the tag. - Operation *OperationTagResourceContractProperties `json:"operation,omitempty"` - // Product - Product associated with the tag. - Product *ProductTagResourceContractProperties `json:"product,omitempty"` -} - -// TagTagResourceContractProperties contract defining the Tag property in the Tag Resource Contract -type TagTagResourceContractProperties struct { - // ID - Tag identifier - ID *string `json:"id,omitempty"` - // Name - Tag Name - Name *string `json:"name,omitempty"` -} - -// TenantConfigurationDeployFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TenantConfigurationDeployFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TenantConfigurationClient) (OperationResultContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TenantConfigurationDeployFuture) 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 TenantConfigurationDeployFuture.Result. -func (future *TenantConfigurationDeployFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationDeployFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - orc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationDeployFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { - orc, err = client.DeployResponder(orc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationDeployFuture", "Result", orc.Response.Response, "Failure responding to request") - } - } - return -} - -// TenantConfigurationSaveFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TenantConfigurationSaveFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TenantConfigurationClient) (OperationResultContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TenantConfigurationSaveFuture) 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 TenantConfigurationSaveFuture.Result. -func (future *TenantConfigurationSaveFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSaveFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - orc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationSaveFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { - orc, err = client.SaveResponder(orc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSaveFuture", "Result", orc.Response.Response, "Failure responding to request") - } - } - return -} - -// TenantConfigurationSyncStateContract tenant Configuration Synchronization State. -type TenantConfigurationSyncStateContract struct { - autorest.Response `json:"-"` - // Branch - The name of Git branch. - Branch *string `json:"branch,omitempty"` - // CommitID - The latest commit Id. - CommitID *string `json:"commitId,omitempty"` - // IsExport - value indicating if last sync was save (true) or deploy (false) operation. - IsExport *bool `json:"isExport,omitempty"` - // IsSynced - value indicating if last synchronization was later than the configuration change. - IsSynced *bool `json:"isSynced,omitempty"` - // IsGitEnabled - value indicating whether Git configuration access is enabled. - IsGitEnabled *bool `json:"isGitEnabled,omitempty"` - // SyncDate - The date of the latest synchronization. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - SyncDate *date.Time `json:"syncDate,omitempty"` - // ConfigurationChangeDate - The date of the latest configuration change. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - ConfigurationChangeDate *date.Time `json:"configurationChangeDate,omitempty"` -} - -// TenantConfigurationValidateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TenantConfigurationValidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TenantConfigurationClient) (OperationResultContract, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TenantConfigurationValidateFuture) 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 TenantConfigurationValidateFuture.Result. -func (future *TenantConfigurationValidateFuture) result(client TenantConfigurationClient) (orc OperationResultContract, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationValidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - orc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("apimanagement.TenantConfigurationValidateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if orc.Response.Response, err = future.GetResult(sender); err == nil && orc.Response.Response.StatusCode != http.StatusNoContent { - orc, err = client.ValidateResponder(orc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationValidateFuture", "Result", orc.Response.Response, "Failure responding to request") - } - } - return -} - -// TermsOfServiceProperties terms of service contract properties. -type TermsOfServiceProperties struct { - // Text - A terms of service text. - Text *string `json:"text,omitempty"` - // Enabled - Display terms of service during a sign-up process. - Enabled *bool `json:"enabled,omitempty"` - // ConsentRequired - Ask user for consent to the terms of service. - ConsentRequired *bool `json:"consentRequired,omitempty"` -} - -// TokenBodyParameterContract oAuth acquire token request body parameter (www-url-form-encoded). -type TokenBodyParameterContract struct { - // Name - body parameter name. - Name *string `json:"name,omitempty"` - // Value - body parameter value. - Value *string `json:"value,omitempty"` -} - -// UserCollection paged Users list representation. -type UserCollection struct { - autorest.Response `json:"-"` - // Value - Page values. - Value *[]UserContract `json:"value,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// UserCollectionIterator provides access to a complete listing of UserContract values. -type UserCollectionIterator struct { - i int - page UserCollectionPage -} - -// 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 *UserCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserCollectionIterator.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 *UserCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserCollectionIterator) 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 UserCollectionIterator) Response() UserCollection { - 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 UserCollectionIterator) Value() UserContract { - if !iter.page.NotDone() { - return UserContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserCollectionIterator type. -func NewUserCollectionIterator(page UserCollectionPage) UserCollectionIterator { - return UserCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (uc UserCollection) IsEmpty() bool { - return uc.Value == nil || len(*uc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (uc UserCollection) hasNextLink() bool { - return uc.NextLink != nil && len(*uc.NextLink) != 0 -} - -// userCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (uc UserCollection) userCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !uc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(uc.NextLink))) -} - -// UserCollectionPage contains a page of UserContract values. -type UserCollectionPage struct { - fn func(context.Context, UserCollection) (UserCollection, error) - uc UserCollection -} - -// 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 *UserCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserCollectionPage.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.uc) - if err != nil { - return err - } - page.uc = 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 *UserCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserCollectionPage) NotDone() bool { - return !page.uc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserCollectionPage) Response() UserCollection { - return page.uc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserCollectionPage) Values() []UserContract { - if page.uc.IsEmpty() { - return nil - } - return *page.uc.Value -} - -// Creates a new instance of the UserCollectionPage type. -func NewUserCollectionPage(cur UserCollection, getNextPage func(context.Context, UserCollection) (UserCollection, error)) UserCollectionPage { - return UserCollectionPage{ - fn: getNextPage, - uc: cur, - } -} - -// UserContract user details. -type UserContract struct { - autorest.Response `json:"-"` - // UserContractProperties - User entity contract properties. - *UserContractProperties `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 for API Management resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserContract. -func (uc UserContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if uc.UserContractProperties != nil { - objectMap["properties"] = uc.UserContractProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserContract struct. -func (uc *UserContract) 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 userContractProperties UserContractProperties - err = json.Unmarshal(*v, &userContractProperties) - if err != nil { - return err - } - uc.UserContractProperties = &userContractProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - uc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - uc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - uc.Type = &typeVar - } - } - } - - return nil -} - -// UserContractProperties user profile. -type UserContractProperties struct { - // FirstName - First name. - FirstName *string `json:"firstName,omitempty"` - // LastName - Last name. - LastName *string `json:"lastName,omitempty"` - // Email - Email address. - Email *string `json:"email,omitempty"` - // RegistrationDate - Date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - RegistrationDate *date.Time `json:"registrationDate,omitempty"` - // Groups - READ-ONLY; Collection of groups user is part of. - Groups *[]GroupContractProperties `json:"groups,omitempty"` - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserContractProperties. -func (ucp UserContractProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucp.FirstName != nil { - objectMap["firstName"] = ucp.FirstName - } - if ucp.LastName != nil { - objectMap["lastName"] = ucp.LastName - } - if ucp.Email != nil { - objectMap["email"] = ucp.Email - } - if ucp.RegistrationDate != nil { - objectMap["registrationDate"] = ucp.RegistrationDate - } - if ucp.State != "" { - objectMap["state"] = ucp.State - } - if ucp.Note != nil { - objectMap["note"] = ucp.Note - } - if ucp.Identities != nil { - objectMap["identities"] = ucp.Identities - } - return json.Marshal(objectMap) -} - -// UserCreateParameterProperties parameters supplied to the Create User operation. -type UserCreateParameterProperties struct { - // Email - Email address. Must not be empty and must be unique within the service instance. - Email *string `json:"email,omitempty"` - // FirstName - First name. - FirstName *string `json:"firstName,omitempty"` - // LastName - Last name. - LastName *string `json:"lastName,omitempty"` - // Password - User Password. If no value is provided, a default password is generated. - Password *string `json:"password,omitempty"` - // AppType - Determines the type of application which send the create user request. Default is old publisher portal. Possible values include: 'DeveloperPortal' - AppType AppType `json:"appType,omitempty"` - // Confirmation - Determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: 'Signup', 'Invite' - Confirmation Confirmation `json:"confirmation,omitempty"` - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// UserCreateParameters user create details. -type UserCreateParameters struct { - // UserCreateParameterProperties - User entity create contract properties. - *UserCreateParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserCreateParameters. -func (ucp UserCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucp.UserCreateParameterProperties != nil { - objectMap["properties"] = ucp.UserCreateParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserCreateParameters struct. -func (ucp *UserCreateParameters) 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 userCreateParameterProperties UserCreateParameterProperties - err = json.Unmarshal(*v, &userCreateParameterProperties) - if err != nil { - return err - } - ucp.UserCreateParameterProperties = &userCreateParameterProperties - } - } - } - - return nil -} - -// UserEntityBaseParameters user Entity Base Parameters set. -type UserEntityBaseParameters struct { - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// UserIdentityCollection list of Users Identity list representation. -type UserIdentityCollection struct { - autorest.Response `json:"-"` - // Value - User Identity values. - Value *[]UserIdentityContract `json:"value,omitempty"` - // Count - Total record count number across all pages. - Count *int64 `json:"count,omitempty"` - // NextLink - Next page link if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// UserIdentityCollectionIterator provides access to a complete listing of UserIdentityContract values. -type UserIdentityCollectionIterator struct { - i int - page UserIdentityCollectionPage -} - -// 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 *UserIdentityCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentityCollectionIterator.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 *UserIdentityCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserIdentityCollectionIterator) 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 UserIdentityCollectionIterator) Response() UserIdentityCollection { - 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 UserIdentityCollectionIterator) Value() UserIdentityContract { - if !iter.page.NotDone() { - return UserIdentityContract{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserIdentityCollectionIterator type. -func NewUserIdentityCollectionIterator(page UserIdentityCollectionPage) UserIdentityCollectionIterator { - return UserIdentityCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (uic UserIdentityCollection) IsEmpty() bool { - return uic.Value == nil || len(*uic.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (uic UserIdentityCollection) hasNextLink() bool { - return uic.NextLink != nil && len(*uic.NextLink) != 0 -} - -// userIdentityCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (uic UserIdentityCollection) userIdentityCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !uic.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(uic.NextLink))) -} - -// UserIdentityCollectionPage contains a page of UserIdentityContract values. -type UserIdentityCollectionPage struct { - fn func(context.Context, UserIdentityCollection) (UserIdentityCollection, error) - uic UserIdentityCollection -} - -// 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 *UserIdentityCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentityCollectionPage.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.uic) - if err != nil { - return err - } - page.uic = 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 *UserIdentityCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserIdentityCollectionPage) NotDone() bool { - return !page.uic.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserIdentityCollectionPage) Response() UserIdentityCollection { - return page.uic -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserIdentityCollectionPage) Values() []UserIdentityContract { - if page.uic.IsEmpty() { - return nil - } - return *page.uic.Value -} - -// Creates a new instance of the UserIdentityCollectionPage type. -func NewUserIdentityCollectionPage(cur UserIdentityCollection, getNextPage func(context.Context, UserIdentityCollection) (UserIdentityCollection, error)) UserIdentityCollectionPage { - return UserIdentityCollectionPage{ - fn: getNextPage, - uic: cur, - } -} - -// UserIdentityContract user identity details. -type UserIdentityContract struct { - // Provider - Identity provider name. - Provider *string `json:"provider,omitempty"` - // ID - Identifier value within provider. - ID *string `json:"id,omitempty"` -} - -// UserIdentityProperties ... -type UserIdentityProperties struct { - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// UserTokenParameterProperties parameters supplied to the Get User Token operation. -type UserTokenParameterProperties struct { - // KeyType - The Key to be used to generate token for user. Possible values include: 'Primary', 'Secondary' - KeyType KeyType `json:"keyType,omitempty"` - // Expiry - The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. - Expiry *date.Time `json:"expiry,omitempty"` -} - -// UserTokenParameters get User Token parameters. -type UserTokenParameters struct { - // UserTokenParameterProperties - User Token Parameter contract properties. - *UserTokenParameterProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserTokenParameters. -func (utp UserTokenParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if utp.UserTokenParameterProperties != nil { - objectMap["properties"] = utp.UserTokenParameterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserTokenParameters struct. -func (utp *UserTokenParameters) 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 userTokenParameterProperties UserTokenParameterProperties - err = json.Unmarshal(*v, &userTokenParameterProperties) - if err != nil { - return err - } - utp.UserTokenParameterProperties = &userTokenParameterProperties - } - } - } - - return nil -} - -// UserTokenResult get User Token response details. -type UserTokenResult struct { - autorest.Response `json:"-"` - // Value - Shared Access Authorization token for the User. - Value *string `json:"value,omitempty"` -} - -// UserUpdateParameters user update parameters. -type UserUpdateParameters struct { - // UserUpdateParametersProperties - User entity update contract properties. - *UserUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserUpdateParameters. -func (uup UserUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if uup.UserUpdateParametersProperties != nil { - objectMap["properties"] = uup.UserUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserUpdateParameters struct. -func (uup *UserUpdateParameters) 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 userUpdateParametersProperties UserUpdateParametersProperties - err = json.Unmarshal(*v, &userUpdateParametersProperties) - if err != nil { - return err - } - uup.UserUpdateParametersProperties = &userUpdateParametersProperties - } - } - } - - return nil -} - -// UserUpdateParametersProperties parameters supplied to the Update User operation. -type UserUpdateParametersProperties struct { - // Email - Email address. Must not be empty and must be unique within the service instance. - Email *string `json:"email,omitempty"` - // Password - User Password. - Password *string `json:"password,omitempty"` - // FirstName - First name. - FirstName *string `json:"firstName,omitempty"` - // LastName - Last name. - LastName *string `json:"lastName,omitempty"` - // State - Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'UserStateActive', 'UserStateBlocked', 'UserStatePending', 'UserStateDeleted' - State UserState `json:"state,omitempty"` - // Note - Optional note about a user set by the administrator. - Note *string `json:"note,omitempty"` - // Identities - Collection of user identities. - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// VirtualNetworkConfiguration configuration of a virtual network to which API Management service is -// deployed. -type VirtualNetworkConfiguration struct { - // Vnetid - READ-ONLY; The virtual network ID. This is typically a GUID. Expect a null GUID by default. - Vnetid *string `json:"vnetid,omitempty"` - // Subnetname - READ-ONLY; The name of the subnet. - Subnetname *string `json:"subnetname,omitempty"` - // SubnetResourceID - The full resource ID of a subnet in a virtual network to deploy the API Management service in. - SubnetResourceID *string `json:"subnetResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkConfiguration. -func (vnc VirtualNetworkConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnc.SubnetResourceID != nil { - objectMap["subnetResourceId"] = vnc.SubnetResourceID - } - return json.Marshal(objectMap) -} - -// X509CertificateName properties of server X509Names. -type X509CertificateName struct { - // Name - Common Name of the Certificate. - Name *string `json:"name,omitempty"` - // IssuerCertificateThumbprint - Thumbprint for the Issuer of the Certificate. - IssuerCertificateThumbprint *string `json:"issuerCertificateThumbprint,omitempty"` -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/namedvalue.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/namedvalue.go deleted file mode 100644 index b3925d5ea67d..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/namedvalue.go +++ /dev/null @@ -1,746 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NamedValueClient is the apiManagement Client -type NamedValueClient struct { - BaseClient -} - -// NewNamedValueClient creates an instance of the NamedValueClient client. -func NewNamedValueClient(subscriptionID string) NamedValueClient { - return NewNamedValueClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNamedValueClientWithBaseURI creates an instance of the NamedValueClient 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 NewNamedValueClientWithBaseURI(baseURI string, subscriptionID string) NamedValueClient { - return NamedValueClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a NamedValue. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client NamedValueClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters NamedValueCreateContract, ifMatch string) (result NamedValueCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.NamedValueCreateContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.NamedValueCreateContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.NamedValueCreateContractProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.NamedValueCreateContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "parameters.NamedValueCreateContractProperties.DisplayName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-._]+$`, Chain: nil}, - }}, - {Target: "parameters.NamedValueCreateContractProperties.Value", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.NamedValueCreateContractProperties.Value", Name: validation.MaxLength, Rule: 4096, Chain: nil}, - {Target: "parameters.NamedValueCreateContractProperties.Value", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, namedValueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NamedValueClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters NamedValueCreateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) CreateOrUpdateSender(req *http.Request) (future NamedValueCreateOrUpdateFuture, 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 NamedValueClient) CreateOrUpdateResponder(resp *http.Response) (result NamedValueContract, 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 specific NamedValue from the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client NamedValueClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, namedValueID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NamedValueClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 NamedValueClient) 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 NamedValueClient) 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 details of the NamedValue specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -func (client NamedValueClient) Get(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result NamedValueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, namedValueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NamedValueClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", 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 NamedValueClient) 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 NamedValueClient) GetResponder(resp *http.Response) (result NamedValueContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the NamedValue specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -func (client NamedValueClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, namedValueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client NamedValueClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client NamedValueClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of NamedValues defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| tags | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith, any, all |
| displayName | filter | ge, le, eq, ne, gt, -// lt | substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client NamedValueClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result NamedValueCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.ListByService") - defer func() { - sc := -1 - if result.nvc.Response.Response != nil { - sc = result.nvc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.nvc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListByService", resp, "Failure sending request") - return - } - - result.nvc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListByService", resp, "Failure responding to request") - return - } - if result.nvc.hasNextLink() && result.nvc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client NamedValueClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/namedValues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client NamedValueClient) ListByServiceResponder(resp *http.Response) (result NamedValueCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client NamedValueClient) listByServiceNextResults(ctx context.Context, lastResults NamedValueCollection) (result NamedValueCollection, err error) { - req, err := lastResults.namedValueCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client NamedValueClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result NamedValueCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListValue gets the secret value of the NamedValue. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -func (client NamedValueClient) ListValue(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (result PropertyValueContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.ListValue") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "ListValue", err.Error()) - } - - req, err := client.ListValuePreparer(ctx, resourceGroupName, serviceName, namedValueID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListValue", nil, "Failure preparing request") - return - } - - resp, err := client.ListValueSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListValue", resp, "Failure sending request") - return - } - - result, err = client.ListValueResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "ListValue", resp, "Failure responding to request") - return - } - - return -} - -// ListValuePreparer prepares the ListValue request. -func (client NamedValueClient) ListValuePreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListValueSender sends the ListValue request. The method will close the -// http.Response Body if it receives an error. -func (client NamedValueClient) ListValueSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListValueResponder handles the response to the ListValue request. The method always -// closes the http.Response Body. -func (client NamedValueClient) ListValueResponder(resp *http.Response) (result PropertyValueContract, 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 specific NamedValue. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// namedValueID - identifier of the NamedValue. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client NamedValueClient) Update(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters NamedValueUpdateParameters, ifMatch string) (result NamedValueUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamedValueClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: namedValueID, - Constraints: []validation.Constraint{{Target: "namedValueID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "namedValueID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NamedValueClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, namedValueID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NamedValueClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client NamedValueClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, namedValueID string, parameters NamedValueUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namedValueId": autorest.Encode("path", namedValueID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/namedValues/{namedValueId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 NamedValueClient) UpdateSender(req *http.Request) (future NamedValueUpdateFuture, 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 NamedValueClient) UpdateResponder(resp *http.Response) (result NamedValueContract, 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/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/networkstatus.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/networkstatus.go deleted file mode 100644 index 850a5a275142..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/networkstatus.go +++ /dev/null @@ -1,207 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NetworkStatusClient is the apiManagement Client -type NetworkStatusClient struct { - BaseClient -} - -// NewNetworkStatusClient creates an instance of the NetworkStatusClient client. -func NewNetworkStatusClient(subscriptionID string) NetworkStatusClient { - return NewNetworkStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNetworkStatusClientWithBaseURI creates an instance of the NetworkStatusClient 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 NewNetworkStatusClientWithBaseURI(baseURI string, subscriptionID string) NetworkStatusClient { - return NetworkStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByLocation gets the Connectivity Status to the external resources on which the Api Management service depends -// from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// locationName - location in which the API Management service is deployed. This is one of the Azure Regions -// like West US, East US, South Central US. -func (client NetworkStatusClient) ListByLocation(ctx context.Context, resourceGroupName string, serviceName string, locationName string) (result NetworkStatusContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkStatusClient.ListByLocation") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: locationName, - Constraints: []validation.Constraint{{Target: "locationName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NetworkStatusClient", "ListByLocation", err.Error()) - } - - req, err := client.ListByLocationPreparer(ctx, resourceGroupName, serviceName, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByLocation", resp, "Failure sending request") - return - } - - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByLocation", resp, "Failure responding to request") - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client NetworkStatusClient) ListByLocationPreparer(ctx context.Context, resourceGroupName string, serviceName string, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkStatusClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client NetworkStatusClient) ListByLocationResponder(resp *http.Response) (result NetworkStatusContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService gets the Connectivity Status to the external resources on which the Api Management service depends -// from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client NetworkStatusClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result ListNetworkStatusContractByLocation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkStatusClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NetworkStatusClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client NetworkStatusClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/networkstatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkStatusClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client NetworkStatusClient) ListByServiceResponder(resp *http.Response) (result ListNetworkStatusContractByLocation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notification.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notification.go deleted file mode 100644 index bda038a3328e..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notification.go +++ /dev/null @@ -1,349 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotificationClient is the apiManagement Client -type NotificationClient struct { - BaseClient -} - -// NewNotificationClient creates an instance of the NotificationClient client. -func NewNotificationClient(subscriptionID string) NotificationClient { - return NewNotificationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationClientWithBaseURI creates an instance of the NotificationClient 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 NewNotificationClientWithBaseURI(baseURI string, subscriptionID string) NotificationClient { - return NotificationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update API Management publisher notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client NotificationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, ifMatch string) (result NotificationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, notificationName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}", pathParameters), - 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationClient) 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 NotificationClient) CreateOrUpdateResponder(resp *http.Response) (result NotificationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the Notification specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -func (client NotificationClient) Get(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (result NotificationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, notificationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotificationClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/notifications/{notificationName}", 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 NotificationClient) 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 NotificationClient) GetResponder(resp *http.Response) (result NotificationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of properties defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// top - number of records to return. -// skip - number of records to skip. -func (client NotificationClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result NotificationCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.ListByService") - defer func() { - sc := -1 - if result.nc.Response.Response != nil { - sc = result.nc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.nc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "ListByService", resp, "Failure sending request") - return - } - - result.nc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "ListByService", resp, "Failure responding to request") - return - } - if result.nc.hasNextLink() && result.nc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client NotificationClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/notifications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client NotificationClient) ListByServiceResponder(resp *http.Response) (result NotificationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client NotificationClient) listByServiceNextResults(ctx context.Context, lastResults NotificationCollection) (result NotificationCollection, err error) { - req, err := lastResults.notificationCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client NotificationClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, top *int32, skip *int32) (result NotificationCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notificationrecipientemail.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notificationrecipientemail.go deleted file mode 100644 index 2fb1ddcab504..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notificationrecipientemail.go +++ /dev/null @@ -1,381 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotificationRecipientEmailClient is the apiManagement Client -type NotificationRecipientEmailClient struct { - BaseClient -} - -// NewNotificationRecipientEmailClient creates an instance of the NotificationRecipientEmailClient client. -func NewNotificationRecipientEmailClient(subscriptionID string) NotificationRecipientEmailClient { - return NewNotificationRecipientEmailClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationRecipientEmailClientWithBaseURI creates an instance of the NotificationRecipientEmailClient 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 NewNotificationRecipientEmailClientWithBaseURI(baseURI string, subscriptionID string) NotificationRecipientEmailClient { - return NotificationRecipientEmailClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists determine if Notification Recipient Email subscribed to the notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// email - email identifier. -func (client NotificationRecipientEmailClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, notificationName, email) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client NotificationRecipientEmailClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "email": autorest.Encode("path", email), - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientEmailClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client NotificationRecipientEmailClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds the Email address to the list of Recipients for the Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// email - email identifier. -func (client NotificationRecipientEmailClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (result RecipientEmailContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, notificationName, email) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationRecipientEmailClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "email": autorest.Encode("path", email), - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", pathParameters), - 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 NotificationRecipientEmailClient) 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 NotificationRecipientEmailClient) CreateOrUpdateResponder(resp *http.Response) (result RecipientEmailContract, 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 removes the email from the list of Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// email - email identifier. -func (client NotificationRecipientEmailClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, notificationName, email) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotificationRecipientEmailClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, email string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "email": autorest.Encode("path", email), - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", 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 NotificationRecipientEmailClient) 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 NotificationRecipientEmailClient) 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 -} - -// ListByNotification gets the list of the Notification Recipient Emails subscribed to a notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -func (client NotificationRecipientEmailClient) ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (result RecipientEmailCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientEmailClient.ListByNotification") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientEmailClient", "ListByNotification", err.Error()) - } - - req, err := client.ListByNotificationPreparer(ctx, resourceGroupName, serviceName, notificationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "ListByNotification", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNotificationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "ListByNotification", resp, "Failure sending request") - return - } - - result, err = client.ListByNotificationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientEmailClient", "ListByNotification", resp, "Failure responding to request") - return - } - - return -} - -// ListByNotificationPreparer prepares the ListByNotification request. -func (client NotificationRecipientEmailClient) ListByNotificationPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNotificationSender sends the ListByNotification request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientEmailClient) ListByNotificationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNotificationResponder handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (client NotificationRecipientEmailClient) ListByNotificationResponder(resp *http.Response) (result RecipientEmailCollection, 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/apimanagement/mgmt/2019-12-01-preview/apimanagement/notificationrecipientuser.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notificationrecipientuser.go deleted file mode 100644 index 64364c934280..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/notificationrecipientuser.go +++ /dev/null @@ -1,390 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotificationRecipientUserClient is the apiManagement Client -type NotificationRecipientUserClient struct { - BaseClient -} - -// NewNotificationRecipientUserClient creates an instance of the NotificationRecipientUserClient client. -func NewNotificationRecipientUserClient(subscriptionID string) NotificationRecipientUserClient { - return NewNotificationRecipientUserClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationRecipientUserClientWithBaseURI creates an instance of the NotificationRecipientUserClient 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 NewNotificationRecipientUserClientWithBaseURI(baseURI string, subscriptionID string) NotificationRecipientUserClient { - return NotificationRecipientUserClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists determine if the Notification Recipient User is subscribed to the notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client NotificationRecipientUserClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, notificationName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client NotificationRecipientUserClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientUserClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client NotificationRecipientUserClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds the API Management User to the list of Recipients for the Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client NotificationRecipientUserClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (result RecipientUserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, notificationName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationRecipientUserClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", pathParameters), - 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 NotificationRecipientUserClient) 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 NotificationRecipientUserClient) CreateOrUpdateResponder(resp *http.Response) (result RecipientUserContract, 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 removes the API Management user from the list of Notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client NotificationRecipientUserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, notificationName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotificationRecipientUserClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", 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 NotificationRecipientUserClient) 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 NotificationRecipientUserClient) 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 -} - -// ListByNotification gets the list of the Notification Recipient User subscribed to the notification. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// notificationName - notification Name Identifier. -func (client NotificationRecipientUserClient) ListByNotification(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (result RecipientUserCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationRecipientUserClient.ListByNotification") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.NotificationRecipientUserClient", "ListByNotification", err.Error()) - } - - req, err := client.ListByNotificationPreparer(ctx, resourceGroupName, serviceName, notificationName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "ListByNotification", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNotificationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "ListByNotification", resp, "Failure sending request") - return - } - - result, err = client.ListByNotificationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NotificationRecipientUserClient", "ListByNotification", resp, "Failure responding to request") - return - } - - return -} - -// ListByNotificationPreparer prepares the ListByNotification request. -func (client NotificationRecipientUserClient) ListByNotificationPreparer(ctx context.Context, resourceGroupName string, serviceName string, notificationName NotificationName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationName": autorest.Encode("path", notificationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNotificationSender sends the ListByNotification request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationRecipientUserClient) ListByNotificationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNotificationResponder handles the response to the ListByNotification request. The method always -// closes the http.Response Body. -func (client NotificationRecipientUserClient) ListByNotificationResponder(resp *http.Response) (result RecipientUserCollection, 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/apimanagement/mgmt/2019-12-01-preview/apimanagement/openidconnectprovider.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/openidconnectprovider.go deleted file mode 100644 index 6ef43f91c29e..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/openidconnectprovider.go +++ /dev/null @@ -1,735 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// OpenIDConnectProviderClient is the apiManagement Client -type OpenIDConnectProviderClient struct { - BaseClient -} - -// NewOpenIDConnectProviderClient creates an instance of the OpenIDConnectProviderClient client. -func NewOpenIDConnectProviderClient(subscriptionID string) OpenIDConnectProviderClient { - return NewOpenIDConnectProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOpenIDConnectProviderClientWithBaseURI creates an instance of the OpenIDConnectProviderClient 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 NewOpenIDConnectProviderClientWithBaseURI(baseURI string, subscriptionID string) OpenIDConnectProviderClient { - return OpenIDConnectProviderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client OpenIDConnectProviderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderContract, ifMatch string) (result OpenidConnectProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.OpenidConnectProviderContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.OpenidConnectProviderContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.OpenidConnectProviderContractProperties.DisplayName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, - {Target: "parameters.OpenidConnectProviderContractProperties.MetadataEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.OpenidConnectProviderContractProperties.ClientID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, opid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client OpenIDConnectProviderClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) 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 OpenIDConnectProviderClient) CreateOrUpdateResponder(resp *http.Response) (result OpenidConnectProviderContract, 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 specific OpenID Connect Provider of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client OpenIDConnectProviderClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, opid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, opid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client OpenIDConnectProviderClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 OpenIDConnectProviderClient) 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 OpenIDConnectProviderClient) 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 specific OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -func (client OpenIDConnectProviderClient) Get(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result OpenidConnectProviderContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, opid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OpenIDConnectProviderClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", 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 OpenIDConnectProviderClient) 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 OpenIDConnectProviderClient) GetResponder(resp *http.Response) (result OpenidConnectProviderContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -func (client OpenIDConnectProviderClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, opid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client OpenIDConnectProviderClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists of all the OpenId Connect Providers. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client OpenIDConnectProviderClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result OpenIDConnectProviderCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.ListByService") - defer func() { - sc := -1 - if result.oicpc.Response.Response != nil { - sc = result.oicpc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.oicpc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListByService", resp, "Failure sending request") - return - } - - result.oicpc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListByService", resp, "Failure responding to request") - return - } - if result.oicpc.hasNextLink() && result.oicpc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client OpenIDConnectProviderClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/openidConnectProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) ListByServiceResponder(resp *http.Response) (result OpenIDConnectProviderCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client OpenIDConnectProviderClient) listByServiceNextResults(ctx context.Context, lastResults OpenIDConnectProviderCollection) (result OpenIDConnectProviderCollection, err error) { - req, err := lastResults.openIDConnectProviderCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client OpenIDConnectProviderClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result OpenIDConnectProviderCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListSecrets gets the client secret details of the OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -func (client OpenIDConnectProviderClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, opid string) (result ClientSecretContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.ListSecrets") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName, opid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client OpenIDConnectProviderClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProviderClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProviderClient) ListSecretsResponder(resp *http.Response) (result ClientSecretContract, 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 specific OpenID Connect Provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// opid - identifier of the OpenID Connect Provider. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client OpenIDConnectProviderClient) Update(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenIDConnectProviderClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.OpenIDConnectProviderClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, opid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProviderClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client OpenIDConnectProviderClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 OpenIDConnectProviderClient) 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 OpenIDConnectProviderClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/operation.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/operation.go deleted file mode 100644 index c7f134ba8852..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/operation.go +++ /dev/null @@ -1,194 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// OperationClient is the apiManagement Client -type OperationClient struct { - BaseClient -} - -// NewOperationClient creates an instance of the OperationClient client. -func NewOperationClient(subscriptionID string) OperationClient { - return NewOperationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationClientWithBaseURI creates an instance of the OperationClient 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 NewOperationClientWithBaseURI(baseURI string, subscriptionID string) OperationClient { - return OperationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByTags lists a collection of operations associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| apiName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| method | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -// includeNotTaggedOperations - include not tagged Operations. -func (client OperationClient) ListByTags(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationClient.ListByTags") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.OperationClient", "ListByTags", err.Error()) - } - - result.fn = client.listByTagsNextResults - req, err := client.ListByTagsPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, includeNotTaggedOperations) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "ListByTags", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTagsSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "ListByTags", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "ListByTags", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTagsPreparer prepares the ListByTags request. -func (client OperationClient) ListByTagsPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if includeNotTaggedOperations != nil { - queryParameters["includeNotTaggedOperations"] = autorest.Encode("query", *includeNotTaggedOperations) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTagsSender sends the ListByTags request. The method will close the -// http.Response Body if it receives an error. -func (client OperationClient) ListByTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTagsResponder handles the response to the ListByTags request. The method always -// closes the http.Response Body. -func (client OperationClient) ListByTagsResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTagsNextResults retrieves the next set of results, if any. -func (client OperationClient) listByTagsNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.OperationClient", "listByTagsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.OperationClient", "listByTagsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationClient", "listByTagsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTagsComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationClient) ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32, includeNotTaggedOperations *bool) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationClient.ListByTags") - 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.ListByTags(ctx, resourceGroupName, serviceName, apiid, filter, top, skip, includeNotTaggedOperations) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/operations.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/operations.go deleted file mode 100644 index aa290f90d61a..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 apiManagement 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 REST API operations of the Microsoft.ApiManagement 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, "apimanagement.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, "apimanagement.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.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 = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ApiManagement/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, "apimanagement.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, "apimanagement.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.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/apimanagement/mgmt/2019-12-01-preview/apimanagement/policy.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/policy.go deleted file mode 100644 index 2919278b26d3..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/policy.go +++ /dev/null @@ -1,474 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PolicyClient is the apiManagement Client -type PolicyClient struct { - BaseClient -} - -// NewPolicyClient creates an instance of the PolicyClient client. -func NewPolicyClient(subscriptionID string) PolicyClient { - return NewPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPolicyClientWithBaseURI creates an instance of the PolicyClient 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 NewPolicyClientWithBaseURI(baseURI string, subscriptionID string) PolicyClient { - return PolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the global policy configuration of the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client PolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/policies/{policyId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) 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 PolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, 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 global policy configuration of the Api Management Service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client PolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 PolicyClient) 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 PolicyClient) 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 the Global policy definition of the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// formatParameter - policy Export Format. -func (client PolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, formatParameter PolicyExportFormat) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, formatParameter PolicyExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(formatParameter)) > 0 { - queryParameters["format"] = autorest.Encode("query", formatParameter) - } else { - queryParameters["format"] = autorest.Encode("query", "xml") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", 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 PolicyClient) 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 PolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the Global policy definition in the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client PolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client PolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists all the Global Policy definitions of the Api Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client PolicyClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PolicyClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PolicyClient) ListByServiceResponder(resp *http.Response) (result PolicyCollection, 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/apimanagement/mgmt/2019-12-01-preview/apimanagement/policydescription.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/policydescription.go deleted file mode 100644 index 3ae113052582..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/policydescription.go +++ /dev/null @@ -1,121 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PolicyDescriptionClient is the apiManagement Client -type PolicyDescriptionClient struct { - BaseClient -} - -// NewPolicyDescriptionClient creates an instance of the PolicyDescriptionClient client. -func NewPolicyDescriptionClient(subscriptionID string) PolicyDescriptionClient { - return NewPolicyDescriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPolicyDescriptionClientWithBaseURI creates an instance of the PolicyDescriptionClient 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 NewPolicyDescriptionClientWithBaseURI(baseURI string, subscriptionID string) PolicyDescriptionClient { - return PolicyDescriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all policy descriptions. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// scope - policy scope. -func (client PolicyDescriptionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, scope PolicyScopeContract) (result PolicyDescriptionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyDescriptionClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.PolicyDescriptionClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyDescriptionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicyDescriptionClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicyDescriptionClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PolicyDescriptionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, scope PolicyScopeContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(scope)) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyDescriptionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PolicyDescriptionClient) ListByServiceResponder(resp *http.Response) (result PolicyDescriptionCollection, 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/apimanagement/mgmt/2019-12-01-preview/apimanagement/product.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/product.go deleted file mode 100644 index 20064ea68ef7..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/product.go +++ /dev/null @@ -1,815 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductClient is the apiManagement Client -type ProductClient struct { - BaseClient -} - -// NewProductClient creates an instance of the ProductClient client. -func NewProductClient(subscriptionID string) ProductClient { - return NewProductClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductClientWithBaseURI creates an instance of the ProductClient 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 NewProductClientWithBaseURI(baseURI string, subscriptionID string) ProductClient { - return ProductClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client ProductClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductContract, ifMatch string) (result ProductContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ProductContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ProductContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ProductContractProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.ProductContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) 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 ProductClient) CreateOrUpdateResponder(resp *http.Response) (result ProductContract, 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 product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// deleteSubscriptions - delete existing subscriptions associated with the product or not. -func (client ProductClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, ifMatch, deleteSubscriptions) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteSubscriptions != nil { - queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 ProductClient) 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 ProductClient) 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 details of the product specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result ProductContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProductClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}", 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 ProductClient) 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 ProductClient) GetResponder(resp *http.Response) (result ProductContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the product specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client ProductClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client ProductClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByService lists a collection of products in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| terms | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| state | filter | eq | |
| groups | expand | | | -//
-// top - number of records to return. -// skip - number of records to skip. -// expandGroups - when set to true, the response contains an array of groups that have visibility to the -// product. The default is false. -// tags - products which are part of a specific tag. -func (client ProductClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result ProductCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByService") - defer func() { - sc := -1 - if result.pc.Response.Response != nil { - sc = result.pc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups, tags) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.pc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByService", resp, "Failure sending request") - return - } - - result.pc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByService", resp, "Failure responding to request") - return - } - if result.pc.hasNextLink() && result.pc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client ProductClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if expandGroups != nil { - queryParameters["expandGroups"] = autorest.Encode("query", *expandGroups) - } - if 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.ApiManagement/service/{serviceName}/products", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client ProductClient) ListByServiceResponder(resp *http.Response) (result ProductCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client ProductClient) listByServiceNextResults(ctx context.Context, lastResults ProductCollection) (result ProductCollection, err error) { - req, err := lastResults.productCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool, tags string) (result ProductCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups, tags) - return -} - -// ListByTags lists a collection of products associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| terms | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| state | filter | eq | substringof, contains, startswith, endswith | -//
-// top - number of records to return. -// skip - number of records to skip. -// includeNotTaggedProducts - include not tagged Products. -func (client ProductClient) ListByTags(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByTags") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "ListByTags", err.Error()) - } - - result.fn = client.listByTagsNextResults - req, err := client.ListByTagsPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByTags", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTagsSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByTags", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "ListByTags", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTagsPreparer prepares the ListByTags request. -func (client ProductClient) ListByTagsPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if includeNotTaggedProducts != nil { - queryParameters["includeNotTaggedProducts"] = autorest.Encode("query", *includeNotTaggedProducts) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTagsSender sends the ListByTags request. The method will close the -// http.Response Body if it receives an error. -func (client ProductClient) ListByTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTagsResponder handles the response to the ListByTags request. The method always -// closes the http.Response Body. -func (client ProductClient) ListByTagsResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTagsNextResults retrieves the next set of results, if any. -func (client ProductClient) listByTagsNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByTagsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByTagsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "listByTagsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTagsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductClient) ListByTagsComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, includeNotTaggedProducts *bool) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.ListByTags") - 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.ListByTags(ctx, resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts) - return -} - -// Update update existing product details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client ProductClient) Update(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ProductClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 ProductClient) 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 ProductClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productapi.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productapi.go deleted file mode 100644 index 97f7ed9ffefb..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productapi.go +++ /dev/null @@ -1,473 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductAPIClient is the apiManagement Client -type ProductAPIClient struct { - BaseClient -} - -// NewProductAPIClient creates an instance of the ProductAPIClient client. -func NewProductAPIClient(subscriptionID string) ProductAPIClient { - return NewProductAPIClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductAPIClientWithBaseURI creates an instance of the ProductAPIClient 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 NewProductAPIClientWithBaseURI(baseURI string, subscriptionID string) ProductAPIClient { - return ProductAPIClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists checks that API entity specified by identifier is associated with the Product entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client ProductAPIClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, productID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client ProductAPIClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client ProductAPIClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client ProductAPIClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds an API to the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client ProductAPIClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result APIContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductAPIClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), - 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 ProductAPIClient) 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 ProductAPIClient) CreateOrUpdateResponder(resp *http.Response) (result APIContract, 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 specified API from the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -func (client ProductAPIClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, apiid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductAPIClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, apiid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", 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 ProductAPIClient) 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 ProductAPIClient) 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 -} - -// ListByProduct lists a collection of the APIs associated with a product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| serviceUrl | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| path | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client ProductAPIClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result APICollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.ListByProduct") - defer func() { - sc := -1 - if result.ac.Response.Response != nil { - sc = result.ac.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductAPIClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.ac.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.ac, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.ac.hasNextLink() && result.ac.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ProductAPIClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/products/{productId}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ProductAPIClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ProductAPIClient) ListByProductResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client ProductAPIClient) listByProductNextResults(ctx context.Context, lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.aPICollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductAPIClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductAPIClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result APICollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductAPIClient.ListByProduct") - 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.ListByProduct(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productgroup.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productgroup.go deleted file mode 100644 index 30fa578e382d..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productgroup.go +++ /dev/null @@ -1,463 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductGroupClient is the apiManagement Client -type ProductGroupClient struct { - BaseClient -} - -// NewProductGroupClient creates an instance of the ProductGroupClient client. -func NewProductGroupClient(subscriptionID string) ProductGroupClient { - return NewProductGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductGroupClientWithBaseURI creates an instance of the ProductGroupClient 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 NewProductGroupClientWithBaseURI(baseURI string, subscriptionID string) ProductGroupClient { - return ProductGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckEntityExists checks that Group entity specified by identifier is associated with the Product entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client ProductGroupClient) CheckEntityExists(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.CheckEntityExists") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "CheckEntityExists", err.Error()) - } - - req, err := client.CheckEntityExistsPreparer(ctx, resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CheckEntityExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckEntityExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CheckEntityExists", resp, "Failure sending request") - return - } - - result, err = client.CheckEntityExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CheckEntityExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckEntityExistsPreparer prepares the CheckEntityExists request. -func (client ProductGroupClient) CheckEntityExistsPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckEntityExistsSender sends the CheckEntityExists request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupClient) CheckEntityExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckEntityExistsResponder handles the response to the CheckEntityExists request. The method always -// closes the http.Response Body. -func (client ProductGroupClient) CheckEntityExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate adds the association between the specified developer group with the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client ProductGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result GroupContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), - 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 ProductGroupClient) 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 ProductGroupClient) CreateOrUpdateResponder(resp *http.Response) (result GroupContract, 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 association between the specified group and product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// groupID - group identifier. Must be unique in the current API Management service instance. -func (client ProductGroupClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", 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 ProductGroupClient) 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 ProductGroupClient) 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 -} - -// ListByProduct lists the collection of developer groups associated with the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | |
| displayName | filter | eq, ne | |
| description | filter | eq, ne | |
-// top - number of records to return. -// skip - number of records to skip. -func (client ProductGroupClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.ListByProduct") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductGroupClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.gc, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ProductGroupClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/products/{productId}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ProductGroupClient) ListByProductResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client ProductGroupClient) listByProductNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.groupCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductGroupClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductGroupClient.ListByProduct") - 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.ListByProduct(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productpolicy.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productpolicy.go deleted file mode 100644 index 4c985381d7a0..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productpolicy.go +++ /dev/null @@ -1,499 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductPolicyClient is the apiManagement Client -type ProductPolicyClient struct { - BaseClient -} - -// NewProductPolicyClient creates an instance of the ProductPolicyClient client. -func NewProductPolicyClient(subscriptionID string) ProductPolicyClient { - return NewProductPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductPolicyClientWithBaseURI creates an instance of the ProductPolicyClient 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 NewProductPolicyClientWithBaseURI(baseURI string, subscriptionID string) ProductPolicyClient { - return ProductPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// parameters - the policy contents to apply. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client ProductPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters PolicyContract, ifMatch string) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PolicyContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PolicyContractProperties.Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, parameters PolicyContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) 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 ProductPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result PolicyContract, 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 policy configuration at the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client ProductPolicyClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, productID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductPolicyClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 ProductPolicyClient) 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 ProductPolicyClient) 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 the policy configuration at the Product level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// formatParameter - policy Export Format. -func (client ProductPolicyClient) Get(ctx context.Context, resourceGroupName string, serviceName string, productID string, formatParameter PolicyExportFormat) (result PolicyContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, productID, formatParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProductPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, formatParameter PolicyExportFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(formatParameter)) > 0 { - queryParameters["format"] = autorest.Encode("query", formatParameter) - } else { - queryParameters["format"] = autorest.Encode("query", "xml") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", 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 ProductPolicyClient) 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 ProductPolicyClient) GetResponder(resp *http.Response) (result PolicyContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag get the ETag of the policy configuration at the Product level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductPolicyClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client ProductPolicyClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyId": autorest.Encode("path", "policy"), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByProduct get the policy configuration at the Product level. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -func (client ProductPolicyClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string) (result PolicyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductPolicyClient.ListByProduct") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductPolicyClient", "ListByProduct", err.Error()) - } - - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", resp, "Failure sending request") - return - } - - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "ListByProduct", resp, "Failure responding to request") - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ProductPolicyClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) ListByProductResponder(resp *http.Response) (result PolicyCollection, 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/apimanagement/mgmt/2019-12-01-preview/apimanagement/productsubscriptions.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productsubscriptions.go deleted file mode 100644 index 57c7ea94a226..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/productsubscriptions.go +++ /dev/null @@ -1,190 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ProductSubscriptionsClient is the apiManagement Client -type ProductSubscriptionsClient struct { - BaseClient -} - -// NewProductSubscriptionsClient creates an instance of the ProductSubscriptionsClient client. -func NewProductSubscriptionsClient(subscriptionID string) ProductSubscriptionsClient { - return NewProductSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductSubscriptionsClientWithBaseURI creates an instance of the ProductSubscriptionsClient 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 NewProductSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) ProductSubscriptionsClient { - return ProductSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the collection of subscriptions to the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| stateComment | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| ownerId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| scope | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| state | filter | eq | |
| user | expand | | |
-// top - number of records to return. -// skip - number of records to skip. -func (client ProductSubscriptionsClient) List(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductSubscriptionsClient.List") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ProductSubscriptionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "List", resp, "Failure sending request") - return - } - - result.sc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "List", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ProductSubscriptionsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/products/{productId}/subscriptions", 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 ProductSubscriptionsClient) 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 ProductSubscriptionsClient) ListResponder(resp *http.Response) (result SubscriptionCollection, 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 ProductSubscriptionsClient) listNextResults(ctx context.Context, lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.subscriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "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, "apimanagement.ProductSubscriptionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductSubscriptionsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductSubscriptionsClient.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, serviceName, productID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/quotabycounterkeys.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/quotabycounterkeys.go deleted file mode 100644 index 3db6a8b7fe6a..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/quotabycounterkeys.go +++ /dev/null @@ -1,215 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// QuotaByCounterKeysClient is the apiManagement Client -type QuotaByCounterKeysClient struct { - BaseClient -} - -// NewQuotaByCounterKeysClient creates an instance of the QuotaByCounterKeysClient client. -func NewQuotaByCounterKeysClient(subscriptionID string) QuotaByCounterKeysClient { - return NewQuotaByCounterKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQuotaByCounterKeysClientWithBaseURI creates an instance of the QuotaByCounterKeysClient 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 NewQuotaByCounterKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByCounterKeysClient { - return QuotaByCounterKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists a collection of current quota counter periods associated with the counter-key configured in the -// policy on the specified service instance. The api does not support paging yet. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -func (client QuotaByCounterKeysClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string) (result QuotaCounterCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByCounterKeysClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByCounterKeysClient", "ListByService", err.Error()) - } - - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, quotaCounterKey) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure responding to request") - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client QuotaByCounterKeysClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByCounterKeysClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client QuotaByCounterKeysClient) ListByServiceResponder(resp *http.Response) (result QuotaCounterCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates all the quota counter values specified with the existing quota counter key to a value in the -// specified service instance. This should be used for reset of the quota counter values. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -// parameters - the value of the quota counter to be applied to all quota counter periods. -func (client QuotaByCounterKeysClient) Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueContractProperties) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByCounterKeysClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByCounterKeysClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, quotaCounterKey, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client QuotaByCounterKeysClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueContractProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", 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 QuotaByCounterKeysClient) 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 QuotaByCounterKeysClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/quotabyperiodkeys.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/quotabyperiodkeys.go deleted file mode 100644 index 2dd53681e784..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/quotabyperiodkeys.go +++ /dev/null @@ -1,218 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// QuotaByPeriodKeysClient is the apiManagement Client -type QuotaByPeriodKeysClient struct { - BaseClient -} - -// NewQuotaByPeriodKeysClient creates an instance of the QuotaByPeriodKeysClient client. -func NewQuotaByPeriodKeysClient(subscriptionID string) QuotaByPeriodKeysClient { - return NewQuotaByPeriodKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQuotaByPeriodKeysClientWithBaseURI creates an instance of the QuotaByPeriodKeysClient 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 NewQuotaByPeriodKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByPeriodKeysClient { - return QuotaByPeriodKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the value of the quota counter associated with the counter-key in the policy for the specific period in -// service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -// quotaPeriodKey - quota period key identifier. -func (client QuotaByPeriodKeysClient) Get(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (result QuotaCounterContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByPeriodKeysClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByPeriodKeysClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client QuotaByPeriodKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}", 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 QuotaByPeriodKeysClient) 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 QuotaByPeriodKeysClient) GetResponder(resp *http.Response) (result QuotaCounterContract, 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 quota counter value in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// quotaCounterKey - quota counter key identifier.This is the result of expression defined in counter-key -// attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s -// accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible -// by "ba" key -// quotaPeriodKey - quota period key identifier. -// parameters - the value of the Quota counter to be applied on the specified period. -func (client QuotaByPeriodKeysClient) Update(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueContractProperties) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaByPeriodKeysClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.QuotaByPeriodKeysClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client QuotaByPeriodKeysClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueContractProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}", 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 QuotaByPeriodKeysClient) 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 QuotaByPeriodKeysClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/region.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/region.go deleted file mode 100644 index 24af7c561b77..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/region.go +++ /dev/null @@ -1,158 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RegionClient is the apiManagement Client -type RegionClient struct { - BaseClient -} - -// NewRegionClient creates an instance of the RegionClient client. -func NewRegionClient(subscriptionID string) RegionClient { - return NewRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegionClientWithBaseURI creates an instance of the RegionClient 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 NewRegionClientWithBaseURI(baseURI string, subscriptionID string) RegionClient { - return RegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all azure regions in which the service exists. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client RegionClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string) (result RegionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionClient.ListByService") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.RegionClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "ListByService", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "ListByService", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client RegionClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/regions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client RegionClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client RegionClient) ListByServiceResponder(resp *http.Response) (result RegionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client RegionClient) listByServiceNextResults(ctx context.Context, lastResults RegionListResult) (result RegionListResult, err error) { - req, err := lastResults.regionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.RegionClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.RegionClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegionClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string) (result RegionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegionClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/reports.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/reports.go deleted file mode 100644 index dcf27006a988..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/reports.go +++ /dev/null @@ -1,1220 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReportsClient is the apiManagement Client -type ReportsClient struct { - BaseClient -} - -// NewReportsClient creates an instance of the ReportsClient client. -func NewReportsClient(subscriptionID string) ReportsClient { - return NewReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReportsClientWithBaseURI creates an instance of the ReportsClient 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 NewReportsClientWithBaseURI(baseURI string, subscriptionID string) ReportsClient { - return ReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAPI lists report records by API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - the filter to apply on the operation. -// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByAPI") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client ReportsClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByAPIResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client ReportsClient) listByAPINextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByAPI") - 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.ListByAPI(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} - -// ListByGeo lists report records by geography. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| country | select | | |
| region | select | | |
| zip | select | | | -//
| apiRegion | filter | eq | |
| userId | filter | eq | |
| productId | filter | eq | -// |
| subscriptionId | filter | eq | |
| apiId | filter | eq | |
| operationId | filter -// | eq | |
| callCountSuccess | select | | |
| callCountBlocked | select | | | -//
| callCountFailed | select | | |
| callCountOther | select | | |
| bandwidth -// | select, orderBy | | |
| cacheHitsCount | select | | |
| cacheMissCount | select -// | | |
| apiTimeAvg | select | | |
| apiTimeMin | select | | |
| -// apiTimeMax | select | | |
| serviceTimeAvg | select | | |
| serviceTimeMin | -// select | | |
| serviceTimeMax | select | | |
-// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByGeo(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByGeo") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByGeo", err.Error()) - } - - result.fn = client.listByGeoNextResults - req, err := client.ListByGeoPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByGeo", nil, "Failure preparing request") - return - } - - resp, err := client.ListByGeoSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByGeo", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByGeoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByGeo", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByGeoPreparer prepares the ListByGeo request. -func (client ReportsClient) ListByGeoPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/reports/byGeo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByGeoSender sends the ListByGeo request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByGeoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByGeoResponder handles the response to the ListByGeo request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByGeoResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByGeoNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByGeoNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByGeoNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByGeoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByGeoNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByGeoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByGeoNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByGeoComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByGeoComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByGeo") - 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.ListByGeo(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} - -// ListByOperation lists report records by API Operations. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| displayName | select, orderBy | | |
| apiRegion | filter | eq | |
| userId | -// filter | eq | |
| productId | filter | eq | |
| subscriptionId | filter | eq | | -//
| apiId | filter | eq | |
| operationId | select, filter | eq | |
| callCountSuccess -// | select, orderBy | | |
| callCountBlocked | select, orderBy | | |
| -// callCountFailed | select, orderBy | | |
| callCountOther | select, orderBy | | |
| -// callCountTotal | select, orderBy | | |
| bandwidth | select, orderBy | | |
| -// cacheHitsCount | select | | |
| cacheMissCount | select | | |
| apiTimeAvg | -// select, orderBy | | |
| apiTimeMin | select | | |
| apiTimeMax | select | | -// |
| serviceTimeAvg | select | | |
| serviceTimeMin | select | | |
| -// serviceTimeMax | select | | |
-// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByOperation") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByOperation", err.Error()) - } - - result.fn = client.listByOperationNextResults - req, err := client.ListByOperationPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByOperationSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByOperation", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByOperation", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByOperationPreparer prepares the ListByOperation request. -func (client ReportsClient) ListByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByOperationSender sends the ListByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByOperationResponder handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByOperationResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByOperationNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByOperationNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByOperationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByOperationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByOperationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByOperationComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByOperation") - 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.ListByOperation(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} - -// ListByProduct lists report records by Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| displayName | select, orderBy | | |
| apiRegion | filter | eq | |
| userId | -// filter | eq | |
| productId | select, filter | eq | |
| subscriptionId | filter | eq | -// |
| callCountSuccess | select, orderBy | | |
| callCountBlocked | select, orderBy | | -// |
| callCountFailed | select, orderBy | | |
| callCountOther | select, orderBy | | -// |
| callCountTotal | select, orderBy | | |
| bandwidth | select, orderBy | | | -//
| cacheHitsCount | select | | |
| cacheMissCount | select | | |
| apiTimeAvg -// | select, orderBy | | |
| apiTimeMin | select | | |
| apiTimeMax | select | | -// |
| serviceTimeAvg | select | | |
| serviceTimeMin | select | | |
| -// serviceTimeMax | select | | |
-// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByProduct") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client ReportsClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByProductResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByProductNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByProduct") - 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.ListByProduct(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} - -// ListByRequest lists report records by Request. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| apiId | filter | eq | |
| operationId | filter | eq | |
| productId | filter | eq | -// |
| userId | filter | eq | |
| apiRegion | filter | eq | |
| subscriptionId | filter -// | eq | |
-// top - number of records to return. -// skip - number of records to skip. -func (client ReportsClient) ListByRequest(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result RequestReportCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByRequest") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByRequest", err.Error()) - } - - req, err := client.ListByRequestPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByRequest", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRequestSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByRequest", resp, "Failure sending request") - return - } - - result, err = client.ListByRequestResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByRequest", resp, "Failure responding to request") - return - } - - return -} - -// ListByRequestPreparer prepares the ListByRequest request. -func (client ReportsClient) ListByRequestPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - 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.ApiManagement/service/{serviceName}/reports/byRequest", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByRequestSender sends the ListByRequest request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByRequestSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByRequestResponder handles the response to the ListByRequest request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByRequestResponder(resp *http.Response) (result RequestReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription lists report records by subscription. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| displayName | select, orderBy | | |
| apiRegion | filter | eq | |
| userId | -// select, filter | eq | |
| productId | select, filter | eq | |
| subscriptionId | select, -// filter | eq | |
| callCountSuccess | select, orderBy | | |
| callCountBlocked | -// select, orderBy | | |
| callCountFailed | select, orderBy | | |
| callCountOther | -// select, orderBy | | |
| callCountTotal | select, orderBy | | |
| bandwidth | -// select, orderBy | | |
| cacheHitsCount | select | | |
| cacheMissCount | select | -// | |
| apiTimeAvg | select, orderBy | | |
| apiTimeMin | select | | |
| -// apiTimeMax | select | | |
| serviceTimeAvg | select | | |
| serviceTimeMin | -// select | | |
| serviceTimeMax | select | | |
-// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListBySubscription(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListBySubscription") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.rc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ReportsClient) ListBySubscriptionPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription", 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 ReportsClient) 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 ReportsClient) ListBySubscriptionResponder(resp *http.Response) (result ReportCollection, 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 ReportsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "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, "apimanagement.ReportsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListBySubscriptionComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.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, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} - -// ListByTime lists report records by Time. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter, select | ge, le | -// |
| interval | select | | |
| apiRegion | filter | eq | |
| userId | filter | eq -// | |
| productId | filter | eq | |
| subscriptionId | filter | eq | |
| apiId | -// filter | eq | |
| operationId | filter | eq | |
| callCountSuccess | select | | | -//
| callCountBlocked | select | | |
| callCountFailed | select | | |
| -// callCountOther | select | | |
| bandwidth | select, orderBy | | |
| cacheHitsCount -// | select | | |
| cacheMissCount | select | | |
| apiTimeAvg | select | | | -//
| apiTimeMin | select | | |
| apiTimeMax | select | | |
| serviceTimeAvg | -// select | | |
| serviceTimeMin | select | | |
| serviceTimeMax | select | | -// |
-// interval - by time interval. Interval must be multiple of 15 minutes and may not be zero. The value should -// be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert -// TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). -// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByTime(ctx context.Context, resourceGroupName string, serviceName string, filter string, interval string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByTime") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByTime", err.Error()) - } - - result.fn = client.listByTimeNextResults - req, err := client.ListByTimePreparer(ctx, resourceGroupName, serviceName, filter, interval, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByTime", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTimeSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByTime", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByTimeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByTime", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTimePreparer prepares the ListByTime request. -func (client ReportsClient) ListByTimePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, interval string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - "interval": autorest.Encode("query", interval), - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTimeSender sends the ListByTime request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByTimeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTimeResponder handles the response to the ListByTime request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByTimeResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTimeNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByTimeNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByTimeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTimeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByTimeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTimeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByTimeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTimeComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByTimeComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, interval string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByTime") - 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.ListByTime(ctx, resourceGroupName, serviceName, filter, interval, top, skip, orderby) - return -} - -// ListByUser lists report records by User. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| timestamp | filter | ge, le | | -//
| displayName | select, orderBy | | |
| userId | select, filter | eq | |
| -// apiRegion | filter | eq | |
| productId | filter | eq | |
| subscriptionId | filter | eq | -// |
| apiId | filter | eq | |
| operationId | filter | eq | |
| callCountSuccess | -// select, orderBy | | |
| callCountBlocked | select, orderBy | | |
| callCountFailed -// | select, orderBy | | |
| callCountOther | select, orderBy | | |
| callCountTotal -// | select, orderBy | | |
| bandwidth | select, orderBy | | |
| cacheHitsCount | -// select | | |
| cacheMissCount | select | | |
| apiTimeAvg | select, orderBy | -// | |
| apiTimeMin | select | | |
| apiTimeMax | select | | |
| -// serviceTimeAvg | select | | |
| serviceTimeMin | select | | |
| serviceTimeMax | -// select | | |
-// top - number of records to return. -// skip - number of records to skip. -// orderby - oData order by query option. -func (client ReportsClient) ListByUser(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByUser") - defer func() { - sc := -1 - if result.rc.Response.Response != nil { - sc = result.rc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.ReportsClient", "ListByUser", err.Error()) - } - - result.fn = client.listByUserNextResults - req, err := client.ListByUserPreparer(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByUser", nil, "Failure preparing request") - return - } - - resp, err := client.ListByUserSender(req) - if err != nil { - result.rc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByUser", resp, "Failure sending request") - return - } - - result.rc, err = client.ListByUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByUser", resp, "Failure responding to request") - return - } - if result.rc.hasNextLink() && result.rc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByUserPreparer prepares the ListByUser request. -func (client ReportsClient) ListByUserPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByUserSender sends the ListByUser request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByUserSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByUserResponder handles the response to the ListByUser request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByUserResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByUserNextResults retrieves the next set of results, if any. -func (client ReportsClient) listByUserNextResults(ctx context.Context, lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.reportCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByUserNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByUserSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByUserNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "listByUserNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByUserComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReportsClient) ListByUserComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, orderby string) (result ReportCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.ListByUser") - 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.ListByUser(ctx, resourceGroupName, serviceName, filter, top, skip, orderby) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/service.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/service.go deleted file mode 100644 index e319c192c3ad..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/service.go +++ /dev/null @@ -1,1078 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServiceClient is the apiManagement Client -type ServiceClient struct { - BaseClient -} - -// NewServiceClient creates an instance of the ServiceClient client. -func NewServiceClient(subscriptionID string) ServiceClient { - return NewServiceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceClientWithBaseURI creates an instance of the ServiceClient 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 NewServiceClientWithBaseURI(baseURI string, subscriptionID string) ServiceClient { - return ServiceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ApplyNetworkConfigurationUpdates updates the Microsoft.ApiManagement resource running in the Virtual network to pick -// the updated network settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the Apply Network Configuration operation. If the parameters are empty, -// all the regions in which the Api Management service is deployed will be updated sequentially without -// incurring downtime in the region. -func (client ServiceClient) ApplyNetworkConfigurationUpdates(ctx context.Context, resourceGroupName string, serviceName string, parameters *ServiceApplyNetworkConfigurationParameters) (result ServiceApplyNetworkConfigurationUpdatesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ApplyNetworkConfigurationUpdates") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "ApplyNetworkConfigurationUpdates", err.Error()) - } - - req, err := client.ApplyNetworkConfigurationUpdatesPreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ApplyNetworkConfigurationUpdates", nil, "Failure preparing request") - return - } - - result, err = client.ApplyNetworkConfigurationUpdatesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ApplyNetworkConfigurationUpdates", result.Response(), "Failure sending request") - return - } - - return -} - -// ApplyNetworkConfigurationUpdatesPreparer prepares the ApplyNetworkConfigurationUpdates request. -func (client ServiceClient) ApplyNetworkConfigurationUpdatesPreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters *ServiceApplyNetworkConfigurationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ApplyNetworkConfigurationUpdatesSender sends the ApplyNetworkConfigurationUpdates request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) ApplyNetworkConfigurationUpdatesSender(req *http.Request) (future ServiceApplyNetworkConfigurationUpdatesFuture, 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 -} - -// ApplyNetworkConfigurationUpdatesResponder handles the response to the ApplyNetworkConfigurationUpdates request. The method always -// closes the http.Response Body. -func (client ServiceClient) ApplyNetworkConfigurationUpdatesResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Backup creates a backup of the API Management service to the given Azure Storage Account. This is long running -// operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the ApiManagementService_Backup operation. -func (client ServiceClient) Backup(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (result ServiceBackupFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Backup") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Backup", err.Error()) - } - - req, err := client.BackupPreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Backup", nil, "Failure preparing request") - return - } - - result, err = client.BackupSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Backup", result.Response(), "Failure sending request") - return - } - - return -} - -// BackupPreparer prepares the Backup request. -func (client ServiceClient) BackupPreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/backup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// BackupSender sends the Backup request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) BackupSender(req *http.Request) (future ServiceBackupFuture, 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 -} - -// BackupResponder handles the response to the Backup request. The method always -// closes the http.Response Body. -func (client ServiceClient) BackupResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckNameAvailability checks availability and correctness of a name for an API Management service. -// Parameters: -// parameters - parameters supplied to the CheckNameAvailability operation. -func (client ServiceClient) CheckNameAvailability(ctx context.Context, parameters ServiceCheckNameAvailabilityParameters) (result ServiceNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ServiceClient) CheckNameAvailabilityPreparer(ctx context.Context, parameters ServiceCheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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}/providers/Microsoft.ApiManagement/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 ServiceClient) 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 ServiceClient) CheckNameAvailabilityResponder(resp *http.Response) (result ServiceNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates an API Management service. This is long running operation and could take several -// minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the CreateOrUpdate API Management service operation. -func (client ServiceClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceResource) (result ServiceCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServiceProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.MaxLength, Rule: 100, Chain: nil}}}, - {Target: "parameters.ServiceProperties.PublisherName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherName", Name: validation.MaxLength, Rule: 100, Chain: nil}}}, - }}, - {Target: "parameters.Sku", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Etag = 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.ApiManagement/service/{serviceName}", 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 ServiceClient) CreateOrUpdateSender(req *http.Request) (future ServiceCreateOrUpdateFuture, 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 ServiceClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, 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 API Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceClient) Delete(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServiceClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}", 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 ServiceClient) DeleteSender(req *http.Request) (future ServiceDeleteFuture, 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 ServiceClient) DeleteResponder(resp *http.Response) (result ServiceResource, 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 -} - -// Get gets an API Management service resource description. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}", 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 ServiceClient) 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 ServiceClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSsoToken gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceClient) GetSsoToken(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceGetSsoTokenResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.GetSsoToken") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "GetSsoToken", err.Error()) - } - - req, err := client.GetSsoTokenPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetSsoToken", nil, "Failure preparing request") - return - } - - resp, err := client.GetSsoTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetSsoToken", resp, "Failure sending request") - return - } - - result, err = client.GetSsoTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "GetSsoToken", resp, "Failure responding to request") - return - } - - return -} - -// GetSsoTokenPreparer prepares the GetSsoToken request. -func (client ServiceClient) GetSsoTokenPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/getssotoken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSsoTokenSender sends the GetSsoToken request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) GetSsoTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSsoTokenResponder handles the response to the GetSsoToken request. The method always -// closes the http.Response Body. -func (client ServiceClient) GetSsoTokenResponder(resp *http.Response) (result ServiceGetSsoTokenResult, 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 API Management services within an Azure subscription. -func (client ServiceClient) List(ctx context.Context) (result ServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.List") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "List", resp, "Failure sending request") - return - } - - result.slr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "List", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServiceClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service", 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 ServiceClient) 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 ServiceClient) ListResponder(resp *http.Response) (result ServiceListResult, 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 ServiceClient) listNextResults(ctx context.Context, lastResults ServiceListResult) (result ServiceListResult, err error) { - req, err := lastResults.serviceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "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, "apimanagement.ServiceClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceClient) ListComplete(ctx context.Context) (result ServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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 list all API Management services within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ServiceClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.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, "apimanagement.ServiceClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServiceClient) 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 = "2019-12-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.ApiManagement/service", 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 ServiceClient) 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 ServiceClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceListResult, 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 ServiceClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServiceListResult) (result ServiceListResult, err error) { - req, err := lastResults.serviceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "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, "apimanagement.ServiceClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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 -} - -// Restore restores a backup of an API Management service created using the ApiManagementService_Backup operation on -// the current service. This is a long running operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the Restore API Management service from backup operation. -func (client ServiceClient) Restore(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (result ServiceRestoreFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Restore") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Restore", err.Error()) - } - - req, err := client.RestorePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Restore", nil, "Failure preparing request") - return - } - - result, err = client.RestoreSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Restore", result.Response(), "Failure sending request") - return - } - - return -} - -// RestorePreparer prepares the Restore request. -func (client ServiceClient) RestorePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/restore", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestoreSender sends the Restore request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) RestoreSender(req *http.Request) (future ServiceRestoreFuture, 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 -} - -// RestoreResponder handles the response to the Restore request. The method always -// closes the http.Response Body. -func (client ServiceClient) RestoreResponder(resp *http.Response) (result ServiceResource, 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 API Management service. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to the CreateOrUpdate API Management service operation. -func (client ServiceClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUpdateParameters) (result ServiceUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServiceClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters ServiceUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Etag = 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.ApiManagement/service/{serviceName}", 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 ServiceClient) UpdateSender(req *http.Request) (future ServiceUpdateFuture, 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 ServiceClient) UpdateResponder(resp *http.Response) (result ServiceResource, 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/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/serviceskus.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/serviceskus.go deleted file mode 100644 index d5611aefd70b..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/serviceskus.go +++ /dev/null @@ -1,158 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServiceSkusClient is the apiManagement Client -type ServiceSkusClient struct { - BaseClient -} - -// NewServiceSkusClient creates an instance of the ServiceSkusClient client. -func NewServiceSkusClient(subscriptionID string) ServiceSkusClient { - return NewServiceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceSkusClientWithBaseURI creates an instance of the ServiceSkusClient 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 NewServiceSkusClientWithBaseURI(baseURI string, subscriptionID string) ServiceSkusClient { - return ServiceSkusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListAvailableServiceSkus gets all available SKU for a given API Management service -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client ServiceSkusClient) ListAvailableServiceSkus(ctx context.Context, resourceGroupName string, serviceName string) (result ResourceSkuResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceSkusClient.ListAvailableServiceSkus") - defer func() { - sc := -1 - if result.rsr.Response.Response != nil { - sc = result.rsr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", err.Error()) - } - - result.fn = client.listAvailableServiceSkusNextResults - req, err := client.ListAvailableServiceSkusPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListAvailableServiceSkusSender(req) - if err != nil { - result.rsr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", resp, "Failure sending request") - return - } - - result.rsr, err = client.ListAvailableServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "ListAvailableServiceSkus", resp, "Failure responding to request") - return - } - if result.rsr.hasNextLink() && result.rsr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAvailableServiceSkusPreparer prepares the ListAvailableServiceSkus request. -func (client ServiceSkusClient) ListAvailableServiceSkusPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAvailableServiceSkusSender sends the ListAvailableServiceSkus request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceSkusClient) ListAvailableServiceSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAvailableServiceSkusResponder handles the response to the ListAvailableServiceSkus request. The method always -// closes the http.Response Body. -func (client ServiceSkusClient) ListAvailableServiceSkusResponder(resp *http.Response) (result ResourceSkuResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAvailableServiceSkusNextResults retrieves the next set of results, if any. -func (client ServiceSkusClient) listAvailableServiceSkusNextResults(ctx context.Context, lastResults ResourceSkuResults) (result ResourceSkuResults, err error) { - req, err := lastResults.resourceSkuResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "listAvailableServiceSkusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAvailableServiceSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "listAvailableServiceSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAvailableServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServiceSkusClient", "listAvailableServiceSkusNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAvailableServiceSkusComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceSkusClient) ListAvailableServiceSkusComplete(ctx context.Context, resourceGroupName string, serviceName string) (result ResourceSkuResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceSkusClient.ListAvailableServiceSkus") - 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.ListAvailableServiceSkus(ctx, resourceGroupName, serviceName) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/signinsettings.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/signinsettings.go deleted file mode 100644 index a2155e4f530f..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/signinsettings.go +++ /dev/null @@ -1,380 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SignInSettingsClient is the apiManagement Client -type SignInSettingsClient struct { - BaseClient -} - -// NewSignInSettingsClient creates an instance of the SignInSettingsClient client. -func NewSignInSettingsClient(subscriptionID string) SignInSettingsClient { - return NewSignInSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSignInSettingsClientWithBaseURI creates an instance of the SignInSettingsClient 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 NewSignInSettingsClientWithBaseURI(baseURI string, subscriptionID string) SignInSettingsClient { - return SignInSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update Sign-In settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client SignInSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (result PortalSigninSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SignInSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/signin", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SignInSettingsClient) 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 SignInSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result PortalSigninSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get Sign In Settings for the Portal -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignInSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PortalSigninSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SignInSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/signin", 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 SignInSettingsClient) 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 SignInSettingsClient) GetResponder(resp *http.Response) (result PortalSigninSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the SignInSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignInSettingsClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client SignInSettingsClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client SignInSettingsClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client SignInSettingsClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update Sign-In settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - update Sign-In settings. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client SignInSettingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignInSettingsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignInSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignInSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SignInSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSigninSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/signin", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 SignInSettingsClient) 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 SignInSettingsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/signupsettings.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/signupsettings.go deleted file mode 100644 index b01d85f4ce4e..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/signupsettings.go +++ /dev/null @@ -1,380 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SignUpSettingsClient is the apiManagement Client -type SignUpSettingsClient struct { - BaseClient -} - -// NewSignUpSettingsClient creates an instance of the SignUpSettingsClient client. -func NewSignUpSettingsClient(subscriptionID string) SignUpSettingsClient { - return NewSignUpSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSignUpSettingsClientWithBaseURI creates an instance of the SignUpSettingsClient 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 NewSignUpSettingsClientWithBaseURI(baseURI string, subscriptionID string) SignUpSettingsClient { - return SignUpSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update Sign-Up settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client SignUpSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (result PortalSignupSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SignUpSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/signup", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SignUpSettingsClient) 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 SignUpSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result PortalSignupSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get Sign Up Settings for the Portal -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignUpSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result PortalSignupSettings, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SignUpSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/signup", 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 SignUpSettingsClient) 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 SignUpSettingsClient) GetResponder(resp *http.Response) (result PortalSignupSettings, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the SignUpSettings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client SignUpSettingsClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client SignUpSettingsClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client SignUpSettingsClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client SignUpSettingsClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update Sign-Up settings. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - update Sign-Up settings. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client SignUpSettingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignUpSettingsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SignUpSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SignUpSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SignUpSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PortalSignupSettings, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/portalsettings/signup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 SignUpSettingsClient) 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 SignUpSettingsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/subscription.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/subscription.go deleted file mode 100644 index df7f85e399dc..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/subscription.go +++ /dev/null @@ -1,944 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SubscriptionClient is the apiManagement Client -type SubscriptionClient struct { - BaseClient -} - -// NewSubscriptionClient creates an instance of the SubscriptionClient client. -func NewSubscriptionClient(subscriptionID string) SubscriptionClient { - return NewSubscriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionClientWithBaseURI creates an instance of the SubscriptionClient 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 NewSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionClient { - return SubscriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the subscription of specified user to the specified product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -// parameters - create parameters. -// notify - notify change in Subscription State. -// - If false, do not send any email notification for change of state of subscription -// - If true, send email notification of change of state of subscription -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client SubscriptionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters, notify *bool, ifMatch string) (result SubscriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.Scope", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.DisplayName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.SubscriptionCreateParameterProperties.PrimaryKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.PrimaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.PrimaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.SubscriptionCreateParameterProperties.SecondaryKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SubscriptionCreateParameterProperties.SecondaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.SubscriptionCreateParameterProperties.SecondaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, sid, parameters, notify, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SubscriptionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters, notify *bool, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) 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 SubscriptionClient) CreateOrUpdateResponder(resp *http.Response) (result SubscriptionContract, 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 specified subscription. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client SubscriptionClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, sid string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, sid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubscriptionClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 SubscriptionClient) 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 SubscriptionClient) 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 specified Subscription entity. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) Get(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result SubscriptionContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/subscriptions/{sid}", 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 SubscriptionClient) 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 SubscriptionClient) GetResponder(resp *http.Response) (result SubscriptionContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client SubscriptionClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all subscriptions of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| stateComment | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| ownerId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| scope | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| state | filter | eq | |
| user | expand | | |
-// top - number of records to return. -// skip - number of records to skip. -func (client SubscriptionClient) List(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result SubscriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.List") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "List", resp, "Failure sending request") - return - } - - result.sc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "List", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SubscriptionClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/subscriptions", 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 SubscriptionClient) 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 SubscriptionClient) ListResponder(resp *http.Response) (result SubscriptionCollection, 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 SubscriptionClient) listNextResults(ctx context.Context, lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.subscriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "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, "apimanagement.SubscriptionClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SubscriptionClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result SubscriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.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, serviceName, filter, top, skip) - return -} - -// ListSecrets gets the subscription keys. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result SubscriptionKeysContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.ListSecrets") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client SubscriptionClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) ListSecretsResponder(resp *http.Response) (result SubscriptionKeysContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegeneratePrimaryKey regenerates primary key of existing subscription of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.RegeneratePrimaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "RegeneratePrimaryKey", err.Error()) - } - - req, err := client.RegeneratePrimaryKeyPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client SubscriptionClient) RegeneratePrimaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerates secondary key of existing subscription of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -func (client SubscriptionClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.RegenerateSecondaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "RegenerateSecondaryKey", err.Error()) - } - - req, err := client.RegenerateSecondaryKeyPreparer(ctx, resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client SubscriptionClient) RegenerateSecondaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) RegenerateSecondaryKeyResponder(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 details of a subscription specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// sid - subscription entity Identifier. The entity represents the association between a user and a product in -// API Management. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// notify - notify change in Subscription State. -// - If false, do not send any email notification for change of state of subscription -// - If true, send email notification of change of state of subscription -func (client SubscriptionClient) Update(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string, notify *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.SubscriptionClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, sid, parameters, ifMatch, notify) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SubscriptionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string, notify *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 SubscriptionClient) 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 SubscriptionClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tag.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tag.go deleted file mode 100644 index b1fed802d03e..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tag.go +++ /dev/null @@ -1,2294 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TagClient is the apiManagement Client -type TagClient struct { - BaseClient -} - -// NewTagClient creates an instance of the TagClient client. -func NewTagClient(subscriptionID string) TagClient { - return NewTagClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagClientWithBaseURI creates an instance of the TagClient 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 NewTagClientWithBaseURI(baseURI string, subscriptionID string) TagClient { - return TagClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AssignToAPI assign tag to the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) AssignToAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.AssignToAPI") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "AssignToAPI", err.Error()) - } - - req, err := client.AssignToAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToAPI", nil, "Failure preparing request") - return - } - - resp, err := client.AssignToAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToAPI", resp, "Failure sending request") - return - } - - result, err = client.AssignToAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToAPI", resp, "Failure responding to request") - return - } - - return -} - -// AssignToAPIPreparer prepares the AssignToAPI request. -func (client TagClient) AssignToAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AssignToAPISender sends the AssignToAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) AssignToAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AssignToAPIResponder handles the response to the AssignToAPI request. The method always -// closes the http.Response Body. -func (client TagClient) AssignToAPIResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AssignToOperation assign tag to the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) AssignToOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.AssignToOperation") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "AssignToOperation", err.Error()) - } - - req, err := client.AssignToOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToOperation", nil, "Failure preparing request") - return - } - - resp, err := client.AssignToOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToOperation", resp, "Failure sending request") - return - } - - result, err = client.AssignToOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToOperation", resp, "Failure responding to request") - return - } - - return -} - -// AssignToOperationPreparer prepares the AssignToOperation request. -func (client TagClient) AssignToOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AssignToOperationSender sends the AssignToOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) AssignToOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AssignToOperationResponder handles the response to the AssignToOperation request. The method always -// closes the http.Response Body. -func (client TagClient) AssignToOperationResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AssignToProduct assign tag to the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) AssignToProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.AssignToProduct") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "AssignToProduct", err.Error()) - } - - req, err := client.AssignToProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToProduct", nil, "Failure preparing request") - return - } - - resp, err := client.AssignToProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToProduct", resp, "Failure sending request") - return - } - - result, err = client.AssignToProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "AssignToProduct", resp, "Failure responding to request") - return - } - - return -} - -// AssignToProductPreparer prepares the AssignToProduct request. -func (client TagClient) AssignToProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AssignToProductSender sends the AssignToProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) AssignToProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AssignToProductResponder handles the response to the AssignToProduct request. The method always -// closes the http.Response Body. -func (client TagClient) AssignToProductResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates a tag. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// parameters - create parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client TagClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TagContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TagContractProperties.DisplayName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.TagContractProperties.DisplayName", Name: validation.MaxLength, Rule: 160, Chain: nil}, - {Target: "parameters.TagContractProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, tagID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TagClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tags/{tagId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) 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 TagClient) CreateOrUpdateResponder(resp *http.Response) (result TagContract, 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 specific tag of the API Management service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TagClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, tagID string, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, tagID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TagClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 TagClient) 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 TagClient) 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 -} - -// DetachFromAPI detach the tag from the Api. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) DetachFromAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.DetachFromAPI") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "DetachFromAPI", err.Error()) - } - - req, err := client.DetachFromAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromAPI", nil, "Failure preparing request") - return - } - - resp, err := client.DetachFromAPISender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromAPI", resp, "Failure sending request") - return - } - - result, err = client.DetachFromAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromAPI", resp, "Failure responding to request") - return - } - - return -} - -// DetachFromAPIPreparer prepares the DetachFromAPI request. -func (client TagClient) DetachFromAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFromAPISender sends the DetachFromAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DetachFromAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DetachFromAPIResponder handles the response to the DetachFromAPI request. The method always -// closes the http.Response Body. -func (client TagClient) DetachFromAPIResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachFromOperation detach the tag from the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) DetachFromOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.DetachFromOperation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "DetachFromOperation", err.Error()) - } - - req, err := client.DetachFromOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromOperation", nil, "Failure preparing request") - return - } - - resp, err := client.DetachFromOperationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromOperation", resp, "Failure sending request") - return - } - - result, err = client.DetachFromOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromOperation", resp, "Failure responding to request") - return - } - - return -} - -// DetachFromOperationPreparer prepares the DetachFromOperation request. -func (client TagClient) DetachFromOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFromOperationSender sends the DetachFromOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DetachFromOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DetachFromOperationResponder handles the response to the DetachFromOperation request. The method always -// closes the http.Response Body. -func (client TagClient) DetachFromOperationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachFromProduct detach the tag from the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) DetachFromProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.DetachFromProduct") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "DetachFromProduct", err.Error()) - } - - req, err := client.DetachFromProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromProduct", nil, "Failure preparing request") - return - } - - resp, err := client.DetachFromProductSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromProduct", resp, "Failure sending request") - return - } - - result, err = client.DetachFromProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "DetachFromProduct", resp, "Failure responding to request") - return - } - - return -} - -// DetachFromProductPreparer prepares the DetachFromProduct request. -func (client TagClient) DetachFromProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFromProductSender sends the DetachFromProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) DetachFromProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DetachFromProductResponder handles the response to the DetachFromProduct request. The method always -// closes the http.Response Body. -func (client TagClient) DetachFromProductResponder(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 details of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) Get(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TagClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tags/{tagId}", 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 TagClient) 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 TagClient) GetResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByAPI get tag associated with the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetByAPI") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetByAPI", err.Error()) - } - - req, err := client.GetByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.GetByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByAPI", resp, "Failure sending request") - return - } - - result, err = client.GetByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByAPI", resp, "Failure responding to request") - return - } - - return -} - -// GetByAPIPreparer prepares the GetByAPI request. -func (client TagClient) GetByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByAPISender sends the GetByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByAPIResponder handles the response to the GetByAPI request. The method always -// closes the http.Response Body. -func (client TagClient) GetByAPIResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByOperation get tag associated with the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetByOperation") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetByOperation", err.Error()) - } - - req, err := client.GetByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.GetByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByOperation", resp, "Failure sending request") - return - } - - result, err = client.GetByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByOperation", resp, "Failure responding to request") - return - } - - return -} - -// GetByOperationPreparer prepares the GetByOperation request. -func (client TagClient) GetByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByOperationSender sends the GetByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByOperationResponder handles the response to the GetByOperation request. The method always -// closes the http.Response Body. -func (client TagClient) GetByOperationResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByProduct get tag associated with the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result TagContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetByProduct") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetByProduct", err.Error()) - } - - req, err := client.GetByProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.GetByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByProduct", resp, "Failure sending request") - return - } - - result, err = client.GetByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetByProduct", resp, "Failure responding to request") - return - } - - return -} - -// GetByProductPreparer prepares the GetByProduct request. -func (client TagClient) GetByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByProductSender sends the GetByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByProductResponder handles the response to the GetByProduct request. The method always -// closes the http.Response Body. -func (client TagClient) GetByProductResponder(resp *http.Response) (result TagContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityState gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityState(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityState") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityState", err.Error()) - } - - req, err := client.GetEntityStatePreparer(ctx, resourceGroupName, serviceName, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityState", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityState", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityState", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStatePreparer prepares the GetEntityState request. -func (client TagClient) GetEntityStatePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateSender sends the GetEntityState request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateResponder handles the response to the GetEntityState request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityStateByAPI gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityStateByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityStateByAPI") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityStateByAPI", err.Error()) - } - - req, err := client.GetEntityStateByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateByAPISender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByAPI", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByAPI", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStateByAPIPreparer prepares the GetEntityStateByAPI request. -func (client TagClient) GetEntityStateByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateByAPISender sends the GetEntityStateByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateByAPIResponder handles the response to the GetEntityStateByAPI request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateByAPIResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityStateByOperation gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityStateByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityStateByOperation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityStateByOperation", err.Error()) - } - - req, err := client.GetEntityStateByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateByOperationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByOperation", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByOperation", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStateByOperationPreparer prepares the GetEntityStateByOperation request. -func (client TagClient) GetEntityStateByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateByOperationSender sends the GetEntityStateByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateByOperationResponder handles the response to the GetEntityStateByOperation request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateByOperationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetEntityStateByProduct gets the entity state version of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// tagID - tag identifier. Must be unique in the current API Management service instance. -func (client TagClient) GetEntityStateByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.GetEntityStateByProduct") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "GetEntityStateByProduct", err.Error()) - } - - req, err := client.GetEntityStateByProductPreparer(ctx, resourceGroupName, serviceName, productID, tagID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityStateByProductSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByProduct", resp, "Failure sending request") - return - } - - result, err = client.GetEntityStateByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "GetEntityStateByProduct", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityStateByProductPreparer prepares the GetEntityStateByProduct request. -func (client TagClient) GetEntityStateByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, tagID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityStateByProductSender sends the GetEntityStateByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) GetEntityStateByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityStateByProductResponder handles the response to the GetEntityStateByProduct request. The method always -// closes the http.Response Body. -func (client TagClient) GetEntityStateByProductResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByAPI lists all Tags associated with the API. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client TagClient) ListByAPI(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByAPI") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByAPI", err.Error()) - } - - result.fn = client.listByAPINextResults - req, err := client.ListByAPIPreparer(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByAPI", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAPISender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByAPI", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByAPI", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAPIPreparer prepares the ListByAPI request. -func (client TagClient) ListByAPIPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAPISender sends the ListByAPI request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByAPISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAPIResponder handles the response to the ListByAPI request. The method always -// closes the http.Response Body. -func (client TagClient) ListByAPIResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAPINextResults retrieves the next set of results, if any. -func (client TagClient) listByAPINextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByAPINextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAPISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByAPINextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAPIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByAPINextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAPIComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByAPIComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, filter string, top *int32, skip *int32) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByAPI") - 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.ListByAPI(ctx, resourceGroupName, serviceName, apiid, filter, top, skip) - return -} - -// ListByOperation lists all Tags associated with the Operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// apiid - API revision identifier. Must be unique in the current API Management service instance. Non-current -// revision has ;rev=n as a suffix where n is the revision number. -// operationID - operation identifier within an API. Must be unique in the current API Management service -// instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client TagClient) ListByOperation(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByOperation") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: apiid, - Constraints: []validation.Constraint{{Target: "apiid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "apiid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "apiid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByOperation", err.Error()) - } - - result.fn = client.listByOperationNextResults - req, err := client.ListByOperationPreparer(ctx, resourceGroupName, serviceName, apiid, operationID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByOperation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByOperationSender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByOperation", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByOperation", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByOperationPreparer prepares the ListByOperation request. -func (client TagClient) ListByOperationPreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", apiid), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByOperationSender sends the ListByOperation request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByOperationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByOperationResponder handles the response to the ListByOperation request. The method always -// closes the http.Response Body. -func (client TagClient) ListByOperationResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByOperationNextResults retrieves the next set of results, if any. -func (client TagClient) listByOperationNextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByOperationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByOperationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByOperationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByOperationComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByOperationComplete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, operationID string, filter string, top *int32, skip *int32) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByOperation") - 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.ListByOperation(ctx, resourceGroupName, serviceName, apiid, operationID, filter, top, skip) - return -} - -// ListByProduct lists all Tags associated with the Product. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// productID - product identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| displayName | filter | ge, le, eq, ne, -// gt, lt | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client TagClient) ListByProduct(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByProduct") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByProduct", err.Error()) - } - - result.fn = client.listByProductNextResults - req, err := client.ListByProductPreparer(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByProduct", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductSender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByProduct", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByProduct", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByProductPreparer prepares the ListByProduct request. -func (client TagClient) ListByProductPreparer(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/products/{productId}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByProductSender sends the ListByProduct request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByProductSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByProductResponder handles the response to the ListByProduct request. The method always -// closes the http.Response Body. -func (client TagClient) ListByProductResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByProductNextResults retrieves the next set of results, if any. -func (client TagClient) listByProductNextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByProductNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByProductSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByProductNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByProductResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByProductNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByProductComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByProductComplete(ctx context.Context, resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByProduct") - 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.ListByProduct(ctx, resourceGroupName, serviceName, productID, filter, top, skip) - return -} - -// ListByService lists a collection of tags defined within a service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -// scope - scope like 'apis', 'products' or 'apis/{apiId} -func (client TagClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result TagCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByService") - defer func() { - sc := -1 - if result.tc.Response.Response != nil { - sc = result.tc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.tc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByService", resp, "Failure sending request") - return - } - - result.tc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "ListByService", resp, "Failure responding to request") - return - } - if result.tc.hasNextLink() && result.tc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client TagClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(scope) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client TagClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client TagClient) ListByServiceResponder(resp *http.Response) (result TagCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client TagClient) listByServiceNextResults(ctx context.Context, lastResults TagCollection) (result TagCollection, err error) { - req, err := lastResults.tagCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, scope string) (result TagCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, scope) - return -} - -// Update updates the details of the tag specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// tagID - tag identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TagClient) Update(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: tagID, - Constraints: []validation.Constraint{{Target: "tagID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "tagID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "tagID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TagClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, tagID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TagClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, tagID string, parameters TagCreateUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagId": autorest.Encode("path", tagID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tags/{tagId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 TagClient) 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 TagClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tagresource.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tagresource.go deleted file mode 100644 index 68c9c85ff784..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tagresource.go +++ /dev/null @@ -1,188 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TagResourceClient is the apiManagement Client -type TagResourceClient struct { - BaseClient -} - -// NewTagResourceClient creates an instance of the TagResourceClient client. -func NewTagResourceClient(subscriptionID string) TagResourceClient { - return NewTagResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagResourceClientWithBaseURI creates an instance of the TagResourceClient 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 NewTagResourceClientWithBaseURI(baseURI string, subscriptionID string) TagResourceClient { - return TagResourceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists a collection of resources associated with tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| aid | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| name | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith |
| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith |
| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith -// |
| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| -// urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| terms | -// filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
| state | filter | eq | -// |
| isCurrent | filter | eq | |
-// top - number of records to return. -// skip - number of records to skip. -func (client TagResourceClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result TagResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceClient.ListByService") - defer func() { - sc := -1 - if result.trc.Response.Response != nil { - sc = result.trc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TagResourceClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.trc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "ListByService", resp, "Failure sending request") - return - } - - result.trc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "ListByService", resp, "Failure responding to request") - return - } - if result.trc.hasNextLink() && result.trc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client TagResourceClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/tagResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client TagResourceClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client TagResourceClient) ListByServiceResponder(resp *http.Response) (result TagResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client TagResourceClient) listByServiceNextResults(ctx context.Context, lastResults TagResourceCollection) (result TagResourceCollection, err error) { - req, err := lastResults.tagResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TagResourceClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagResourceClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result TagResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagResourceClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantaccess.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantaccess.go deleted file mode 100644 index 112287ab370f..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantaccess.go +++ /dev/null @@ -1,544 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TenantAccessClient is the apiManagement Client -type TenantAccessClient struct { - BaseClient -} - -// NewTenantAccessClient creates an instance of the TenantAccessClient client. -func NewTenantAccessClient(subscriptionID string) TenantAccessClient { - return NewTenantAccessClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantAccessClientWithBaseURI creates an instance of the TenantAccessClient 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 NewTenantAccessClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessClient { - return TenantAccessClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get tenant access information details without secrets. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantAccessClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{accessName}", 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 TenantAccessClient) 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 TenantAccessClient) GetResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag tenant access metadata -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client TenantAccessClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListSecrets get tenant access information details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.ListSecrets") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client TenantAccessClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) ListSecretsResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegeneratePrimaryKey regenerate primary access key -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.RegeneratePrimaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "RegeneratePrimaryKey", err.Error()) - } - - req, err := client.RegeneratePrimaryKeyPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client TenantAccessClient) RegeneratePrimaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerate secondary access key -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.RegenerateSecondaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "RegenerateSecondaryKey", err.Error()) - } - - req, err := client.RegenerateSecondaryKeyPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client TenantAccessClient) RegenerateSecondaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) RegenerateSecondaryKeyResponder(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 update tenant access information details. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - parameters supplied to retrieve the Tenant Access Information. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client TenantAccessClient) Update(ctx context.Context, resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TenantAccessClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{accessName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 TenantAccessClient) 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 TenantAccessClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantaccessgit.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantaccessgit.go deleted file mode 100644 index dfa8c80786d1..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantaccessgit.go +++ /dev/null @@ -1,370 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TenantAccessGitClient is the apiManagement Client -type TenantAccessGitClient struct { - BaseClient -} - -// NewTenantAccessGitClient creates an instance of the TenantAccessGitClient client. -func NewTenantAccessGitClient(subscriptionID string) TenantAccessGitClient { - return NewTenantAccessGitClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantAccessGitClientWithBaseURI creates an instance of the TenantAccessGitClient 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 NewTenantAccessGitClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessGitClient { - return TenantAccessGitClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the Git access configuration for the tenant. Without secrets. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessGitClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessGitClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessGitClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantAccessGitClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{accessName}/git", 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 TenantAccessGitClient) 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 TenantAccessGitClient) GetResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSecrets gets the Git access configuration for the tenant. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessGitClient) ListSecrets(ctx context.Context, resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessGitClient.ListSecrets") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessGitClient", "ListSecrets", err.Error()) - } - - req, err := client.ListSecretsPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "ListSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "ListSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "ListSecrets", resp, "Failure responding to request") - return - } - - return -} - -// ListSecretsPreparer prepares the ListSecrets request. -func (client TenantAccessGitClient) ListSecretsPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{accessName}/git/listSecrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSecretsSender sends the ListSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) ListSecretsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSecretsResponder handles the response to the ListSecrets request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) ListSecretsResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegeneratePrimaryKey regenerate primary access key for GIT. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessGitClient) RegeneratePrimaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessGitClient.RegeneratePrimaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", err.Error()) - } - - req, err := client.RegeneratePrimaryKeyPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client TenantAccessGitClient) RegeneratePrimaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerate secondary access key for GIT. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantAccessGitClient) RegenerateSecondaryKey(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantAccessGitClient.RegenerateSecondaryKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", err.Error()) - } - - req, err := client.RegenerateSecondaryKeyPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client TenantAccessGitClient) RegenerateSecondaryKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accessName": autorest.Encode("path", "access"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantconfiguration.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantconfiguration.go deleted file mode 100644 index cb6c65d7c763..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/tenantconfiguration.go +++ /dev/null @@ -1,404 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TenantConfigurationClient is the apiManagement Client -type TenantConfigurationClient struct { - BaseClient -} - -// NewTenantConfigurationClient creates an instance of the TenantConfigurationClient client. -func NewTenantConfigurationClient(subscriptionID string) TenantConfigurationClient { - return NewTenantConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantConfigurationClientWithBaseURI creates an instance of the TenantConfigurationClient 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 NewTenantConfigurationClientWithBaseURI(baseURI string, subscriptionID string) TenantConfigurationClient { - return TenantConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Deploy this operation applies changes from the specified Git branch to the configuration database. This is a long -// running operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - deploy Configuration parameters. -func (client TenantConfigurationClient) Deploy(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (result TenantConfigurationDeployFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.Deploy") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DeployConfigurationParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DeployConfigurationParameterProperties.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "Deploy", err.Error()) - } - - req, err := client.DeployPreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", nil, "Failure preparing request") - return - } - - result, err = client.DeploySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", result.Response(), "Failure sending request") - return - } - - return -} - -// DeployPreparer prepares the Deploy request. -func (client TenantConfigurationClient) DeployPreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeploySender sends the Deploy request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) DeploySender(req *http.Request) (future TenantConfigurationDeployFuture, 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 -} - -// DeployResponder handles the response to the Deploy request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) DeployResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSyncState gets the status of the most recent synchronization between the configuration database and the Git -// repository. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -func (client TenantConfigurationClient) GetSyncState(ctx context.Context, resourceGroupName string, serviceName string) (result TenantConfigurationSyncStateContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.GetSyncState") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "GetSyncState", err.Error()) - } - - req, err := client.GetSyncStatePreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "GetSyncState", nil, "Failure preparing request") - return - } - - resp, err := client.GetSyncStateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "GetSyncState", resp, "Failure sending request") - return - } - - result, err = client.GetSyncStateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "GetSyncState", resp, "Failure responding to request") - return - } - - return -} - -// GetSyncStatePreparer prepares the GetSyncState request. -func (client TenantConfigurationClient) GetSyncStatePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSyncStateSender sends the GetSyncState request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) GetSyncStateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSyncStateResponder handles the response to the GetSyncState request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) GetSyncStateResponder(resp *http.Response) (result TenantConfigurationSyncStateContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Save this operation creates a commit with the current configuration snapshot to the specified branch in the -// repository. This is a long running operation and could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - save Configuration parameters. -func (client TenantConfigurationClient) Save(ctx context.Context, resourceGroupName string, serviceName string, parameters SaveConfigurationParameter) (result TenantConfigurationSaveFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.Save") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SaveConfigurationParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SaveConfigurationParameterProperties.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "Save", err.Error()) - } - - req, err := client.SavePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", nil, "Failure preparing request") - return - } - - result, err = client.SaveSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", result.Response(), "Failure sending request") - return - } - - return -} - -// SavePreparer prepares the Save request. -func (client TenantConfigurationClient) SavePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters SaveConfigurationParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{configurationName}/save", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SaveSender sends the Save request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) SaveSender(req *http.Request) (future TenantConfigurationSaveFuture, 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 -} - -// SaveResponder handles the response to the Save request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) SaveResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Validate this operation validates the changes in the specified Git branch. This is a long running operation and -// could take several minutes to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// parameters - validate Configuration parameters. -func (client TenantConfigurationClient) Validate(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (result TenantConfigurationValidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationClient.Validate") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DeployConfigurationParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DeployConfigurationParameterProperties.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.TenantConfigurationClient", "Validate", err.Error()) - } - - req, err := client.ValidatePreparer(ctx, resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", nil, "Failure preparing request") - return - } - - result, err = client.ValidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", result.Response(), "Failure sending request") - return - } - - return -} - -// ValidatePreparer prepares the Validate request. -func (client TenantConfigurationClient) ValidatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters DeployConfigurationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "configuration"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateSender sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) ValidateSender(req *http.Request) (future TenantConfigurationValidateFuture, 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 -} - -// ValidateResponder handles the response to the Validate request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) ValidateResponder(resp *http.Response) (result OperationResultContract, 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/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/user.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/user.go deleted file mode 100644 index ddc383f9a447..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/user.go +++ /dev/null @@ -1,854 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserClient is the apiManagement Client -type UserClient struct { - BaseClient -} - -// NewUserClient creates an instance of the UserClient client. -func NewUserClient(subscriptionID string) UserClient { - return NewUserClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserClientWithBaseURI creates an instance of the UserClient 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 NewUserClientWithBaseURI(baseURI string, subscriptionID string) UserClient { - return UserClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// parameters - create or update parameters. -// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client UserClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserCreateParameters, ifMatch string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.Email", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.Email", Name: validation.MaxLength, Rule: 254, Chain: nil}, - {Target: "parameters.UserCreateParameterProperties.Email", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.UserCreateParameterProperties.FirstName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.FirstName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.UserCreateParameterProperties.FirstName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.UserCreateParameterProperties.LastName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.UserCreateParameterProperties.LastName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.UserCreateParameterProperties.LastName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, userID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client UserClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserCreateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/users/{userId}", 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)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) 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 UserClient) CreateOrUpdateResponder(resp *http.Response) (result UserContract, 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 specific user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -// deleteSubscriptions - whether to delete user's subscription or not. -// notify - send an Account Closed Email notification to the User. -func (client UserClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, userID string, ifMatch string, deleteSubscriptions *bool, notify *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, userID, ifMatch, deleteSubscriptions, notify) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client UserClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, ifMatch string, deleteSubscriptions *bool, notify *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteSubscriptions != nil { - queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) - } - if notify != nil { - queryParameters["notify"] = autorest.Encode("query", *notify) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - 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 UserClient) 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 UserClient) 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 -} - -// GenerateSsoURL retrieves a redirection URL containing an authentication token for signing a given user into the -// developer portal. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserClient) GenerateSsoURL(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result GenerateSsoURLResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.GenerateSsoURL") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "GenerateSsoURL", err.Error()) - } - - req, err := client.GenerateSsoURLPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GenerateSsoURL", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateSsoURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GenerateSsoURL", resp, "Failure sending request") - return - } - - result, err = client.GenerateSsoURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GenerateSsoURL", resp, "Failure responding to request") - return - } - - return -} - -// GenerateSsoURLPreparer prepares the GenerateSsoURL request. -func (client UserClient) GenerateSsoURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateSsoURLSender sends the GenerateSsoURL request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GenerateSsoURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateSsoURLResponder handles the response to the GenerateSsoURL request. The method always -// closes the http.Response Body. -func (client UserClient) GenerateSsoURLResponder(resp *http.Response) (result GenerateSsoURLResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the user specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserClient) Get(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result UserContract, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client UserClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/users/{userId}", 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 UserClient) 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 UserClient) GetResponder(resp *http.Response) (result UserContract, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEntityTag gets the entity state (Etag) version of the user specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.GetEntityTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "GetEntityTag", err.Error()) - } - - req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetEntityTag", nil, "Failure preparing request") - return - } - - resp, err := client.GetEntityTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetEntityTag", resp, "Failure sending request") - return - } - - result, err = client.GetEntityTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetEntityTag", resp, "Failure responding to request") - return - } - - return -} - -// GetEntityTagPreparer prepares the GetEntityTag request. -func (client UserClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetEntityTagSender sends the GetEntityTag request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GetEntityTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetEntityTagResponder handles the response to the GetEntityTag request. The method always -// closes the http.Response Body. -func (client UserClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetSharedAccessToken gets the Shared Access Authorization Token for the User. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// parameters - create Authorization Token parameters. -func (client UserClient) GetSharedAccessToken(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserTokenParameters) (result UserTokenResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.GetSharedAccessToken") - 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: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.UserTokenParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.UserTokenParameterProperties.Expiry", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "GetSharedAccessToken", err.Error()) - } - - req, err := client.GetSharedAccessTokenPreparer(ctx, resourceGroupName, serviceName, userID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetSharedAccessToken", nil, "Failure preparing request") - return - } - - resp, err := client.GetSharedAccessTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetSharedAccessToken", resp, "Failure sending request") - return - } - - result, err = client.GetSharedAccessTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "GetSharedAccessToken", resp, "Failure responding to request") - return - } - - return -} - -// GetSharedAccessTokenPreparer prepares the GetSharedAccessToken request. -func (client UserClient) GetSharedAccessTokenPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserTokenParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/users/{userId}/token", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSharedAccessTokenSender sends the GetSharedAccessToken request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) GetSharedAccessTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSharedAccessTokenResponder handles the response to the GetSharedAccessToken request. The method always -// closes the http.Response Body. -func (client UserClient) GetSharedAccessTokenResponder(resp *http.Response) (result UserTokenResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of registered users in the specified service instance. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| firstName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| lastName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| email | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| state | filter | eq | |
| registrationDate | filter | ge, -// le, eq, ne, gt, lt | |
| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| groups | expand | | |
-// top - number of records to return. -// skip - number of records to skip. -// expandGroups - detailed Group in response. -func (client UserClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result UserCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.ListByService") - defer func() { - sc := -1 - if result.uc.Response.Response != nil { - sc = result.uc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "ListByService", err.Error()) - } - - result.fn = client.listByServiceNextResults - req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.uc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "ListByService", resp, "Failure sending request") - return - } - - result.uc, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "ListByService", resp, "Failure responding to request") - return - } - if result.uc.hasNextLink() && result.uc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client UserClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if expandGroups != nil { - queryParameters["expandGroups"] = autorest.Encode("query", *expandGroups) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client UserClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client UserClient) ListByServiceResponder(resp *http.Response) (result UserCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServiceNextResults retrieves the next set of results, if any. -func (client UserClient) listByServiceNextResults(ctx context.Context, lastResults UserCollection) (result UserCollection, err error) { - req, err := lastResults.userCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserClient", "listByServiceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.UserClient", "listByServiceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "listByServiceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result UserCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.ListByService") - 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.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip, expandGroups) - return -} - -// Update updates the details of the user specified by its identifier. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// parameters - update parameters. -// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET -// request or it should be * for unconditional update. -func (client UserClient) Update(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, userID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client UserClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, parameters UserUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/users/{userId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - 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 UserClient) 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 UserClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/userconfirmationpassword.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/userconfirmationpassword.go deleted file mode 100644 index 60f2de2a5465..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/userconfirmationpassword.go +++ /dev/null @@ -1,121 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserConfirmationPasswordClient is the apiManagement Client -type UserConfirmationPasswordClient struct { - BaseClient -} - -// NewUserConfirmationPasswordClient creates an instance of the UserConfirmationPasswordClient client. -func NewUserConfirmationPasswordClient(subscriptionID string) UserConfirmationPasswordClient { - return NewUserConfirmationPasswordClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserConfirmationPasswordClientWithBaseURI creates an instance of the UserConfirmationPasswordClient 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 NewUserConfirmationPasswordClientWithBaseURI(baseURI string, subscriptionID string) UserConfirmationPasswordClient { - return UserConfirmationPasswordClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// SendMethod sends confirmation -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserConfirmationPasswordClient) SendMethod(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserConfirmationPasswordClient.SendMethod") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserConfirmationPasswordClient", "SendMethod", err.Error()) - } - - req, err := client.SendMethodPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserConfirmationPasswordClient", "SendMethod", nil, "Failure preparing request") - return - } - - resp, err := client.SendMethodSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UserConfirmationPasswordClient", "SendMethod", resp, "Failure sending request") - return - } - - result, err = client.SendMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserConfirmationPasswordClient", "SendMethod", resp, "Failure responding to request") - return - } - - return -} - -// SendMethodPreparer prepares the SendMethod request. -func (client UserConfirmationPasswordClient) SendMethodPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SendMethodSender sends the SendMethod request. The method will close the -// http.Response Body if it receives an error. -func (client UserConfirmationPasswordClient) SendMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SendMethodResponder handles the response to the SendMethod request. The method always -// closes the http.Response Body. -func (client UserConfirmationPasswordClient) SendMethodResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/usergroup.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/usergroup.go deleted file mode 100644 index da36385a59ed..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/usergroup.go +++ /dev/null @@ -1,185 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserGroupClient is the apiManagement Client -type UserGroupClient struct { - BaseClient -} - -// NewUserGroupClient creates an instance of the UserGroupClient client. -func NewUserGroupClient(subscriptionID string) UserGroupClient { - return NewUserGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserGroupClientWithBaseURI creates an instance of the UserGroupClient 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 NewUserGroupClientWithBaseURI(baseURI string, subscriptionID string) UserGroupClient { - return UserGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all user groups. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| description | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client UserGroupClient) List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserGroupClient.List") - defer func() { - sc := -1 - if result.gc.Response.Response != nil { - sc = result.gc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserGroupClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, userID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.gc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "List", resp, "Failure sending request") - return - } - - result.gc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "List", resp, "Failure responding to request") - return - } - if result.gc.hasNextLink() && result.gc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserGroupClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/users/{userId}/groups", 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 UserGroupClient) 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 UserGroupClient) ListResponder(resp *http.Response) (result GroupCollection, 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 UserGroupClient) listNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.groupCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "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, "apimanagement.UserGroupClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserGroupClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserGroupClient.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, serviceName, userID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/useridentities.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/useridentities.go deleted file mode 100644 index 29bfd9ae1a57..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/useridentities.go +++ /dev/null @@ -1,163 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserIdentitiesClient is the apiManagement Client -type UserIdentitiesClient struct { - BaseClient -} - -// NewUserIdentitiesClient creates an instance of the UserIdentitiesClient client. -func NewUserIdentitiesClient(subscriptionID string) UserIdentitiesClient { - return NewUserIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserIdentitiesClientWithBaseURI creates an instance of the UserIdentitiesClient 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 NewUserIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) UserIdentitiesClient { - return UserIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list of all user identities. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -func (client UserIdentitiesClient) List(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result UserIdentityCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentitiesClient.List") - defer func() { - sc := -1 - if result.uic.Response.Response != nil { - sc = result.uic.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("apimanagement.UserIdentitiesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.uic.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "List", resp, "Failure sending request") - return - } - - result.uic, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "List", resp, "Failure responding to request") - return - } - if result.uic.hasNextLink() && result.uic.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserIdentitiesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-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.ApiManagement/service/{serviceName}/users/{userId}/identities", 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 UserIdentitiesClient) 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 UserIdentitiesClient) ListResponder(resp *http.Response) (result UserIdentityCollection, 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 UserIdentitiesClient) listNextResults(ctx context.Context, lastResults UserIdentityCollection) (result UserIdentityCollection, err error) { - req, err := lastResults.userIdentityCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "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, "apimanagement.UserIdentitiesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserIdentitiesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string) (result UserIdentityCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserIdentitiesClient.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, serviceName, userID) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/usersubscription.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/usersubscription.go deleted file mode 100644 index 581bc2b0773c..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/usersubscription.go +++ /dev/null @@ -1,190 +0,0 @@ -package apimanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UserSubscriptionClient is the apiManagement Client -type UserSubscriptionClient struct { - BaseClient -} - -// NewUserSubscriptionClient creates an instance of the UserSubscriptionClient client. -func NewUserSubscriptionClient(subscriptionID string) UserSubscriptionClient { - return NewUserSubscriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserSubscriptionClientWithBaseURI creates an instance of the UserSubscriptionClient 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 NewUserSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) UserSubscriptionClient { - return UserSubscriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the collection of subscriptions of the specified user. -// Parameters: -// resourceGroupName - the name of the resource group. -// serviceName - the name of the API Management service. -// userID - user identifier. Must be unique in the current API Management service instance. -// filter - | Field | Usage | Supported operators | Supported functions -// |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt -// | substringof, contains, startswith, endswith |
| displayName | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| stateComment | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| ownerId | filter | ge, le, eq, ne, gt, lt | -// substringof, contains, startswith, endswith |
| scope | filter | ge, le, eq, ne, gt, lt | substringof, -// contains, startswith, endswith |
| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith |
-// top - number of records to return. -// skip - number of records to skip. -func (client UserSubscriptionClient) List(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSubscriptionClient.List") - defer func() { - sc := -1 - if result.sc.Response.Response != nil { - sc = result.sc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: userID, - Constraints: []validation.Constraint{{Target: "userID", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "userID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {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(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("apimanagement.UserSubscriptionClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, userID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "List", resp, "Failure sending request") - return - } - - result.sc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "List", resp, "Failure responding to request") - return - } - if result.sc.hasNextLink() && result.sc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserSubscriptionClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ApiManagement/service/{serviceName}/users/{userId}/subscriptions", 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 UserSubscriptionClient) 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 UserSubscriptionClient) ListResponder(resp *http.Response) (result SubscriptionCollection, 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 UserSubscriptionClient) listNextResults(ctx context.Context, lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.subscriptionCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "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, "apimanagement.UserSubscriptionClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserSubscriptionClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, userID string, filter string, top *int32, skip *int32) (result SubscriptionCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSubscriptionClient.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, serviceName, userID, filter, top, skip) - return -} diff --git a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/version.go b/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/version.go deleted file mode 100644 index fa5a55bcd5b7..000000000000 --- a/services/preview/apimanagement/mgmt/2019-12-01-preview/apimanagement/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package apimanagement - -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() + " apimanagement/2019-12-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/automation/mgmt/2017-05-15-preview/automation/CHANGELOG.md b/services/preview/automation/mgmt/2017-05-15-preview/automation/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/_meta.json b/services/preview/automation/mgmt/2017-05-15-preview/automation/_meta.json deleted file mode 100644 index 466ba67e8645..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", - "tag": "package-2017-05-preview", - "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-2017-05-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/account.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/account.go deleted file mode 100644 index f9c7a69a123d..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/account.go +++ /dev/null @@ -1,610 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation 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)} -} - -// CreateOrUpdate create or update automation account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// parameters - parameters supplied to the create or update automation account. -func (client AccountClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.AccountClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AccountClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}", 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 AccountClient) 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 AccountClient) CreateOrUpdateResponder(resp *http.Response) (result Account, 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 an automation account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client AccountClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.AccountClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", 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) (*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 AccountClient) 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 information about an Automation Account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client AccountClient) Get(ctx context.Context, resourceGroupName string, automationAccountName 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: 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("automation.AccountClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.AccountClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", 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 -} - -// List retrieve a list of accounts within a given 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, "automation.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, "automation.AccountClient", "List", resp, "Failure sending request") - return - } - - result.alr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts", 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, "automation.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, "automation.AccountClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 retrieve a list of accounts within a given resource group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -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) - }() - } - 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("automation.AccountClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.AccountClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts", 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, "automation.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, "automation.AccountClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 -} - -// Update update an automation account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// parameters - parameters supplied to the update automation account. -func (client AccountClient) Update(ctx context.Context, resourceGroupName string, automationAccountName 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: 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("automation.AccountClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.AccountClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}", 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/preview/automation/mgmt/2017-05-15-preview/automation/activity.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/activity.go deleted file mode 100644 index 5612b8c1f186..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/activity.go +++ /dev/null @@ -1,248 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ActivityClient is the automation Client -type ActivityClient struct { - BaseClient -} - -// NewActivityClient creates an instance of the ActivityClient client. -func NewActivityClient(subscriptionID string) ActivityClient { - return NewActivityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityClientWithBaseURI creates an instance of the ActivityClient 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 NewActivityClientWithBaseURI(baseURI string, subscriptionID string) ActivityClient { - return ActivityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the activity in the module identified by module name and activity name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// activityName - the name of activity. -func (client ActivityClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, activityName string) (result Activity, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityClient.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("automation.ActivityClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, moduleName, activityName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, activityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityName": autorest.Encode("path", activityName), - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}", 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 ActivityClient) 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 ActivityClient) GetResponder(resp *http.Response) (result Activity, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByModule retrieve a list of activities in the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -func (client ActivityClient) ListByModule(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result ActivityListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityClient.ListByModule") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.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("automation.ActivityClient", "ListByModule", err.Error()) - } - - result.fn = client.listByModuleNextResults - req, err := client.ListByModulePreparer(ctx, resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByModuleSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByModuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByModulePreparer prepares the ListByModule request. -func (client ActivityClient) ListByModulePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByModuleSender sends the ListByModule request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityClient) ListByModuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByModuleResponder handles the response to the ListByModule request. The method always -// closes the http.Response Body. -func (client ActivityClient) ListByModuleResponder(resp *http.Response) (result ActivityListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByModuleNextResults retrieves the next set of results, if any. -func (client ActivityClient) listByModuleNextResults(ctx context.Context, lastResults ActivityListResult) (result ActivityListResult, err error) { - req, err := lastResults.activityListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "listByModuleNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByModuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "listByModuleNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByModuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "listByModuleNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByModuleComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityClient) ListByModuleComplete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result ActivityListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityClient.ListByModule") - 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.ListByModule(ctx, resourceGroupName, automationAccountName, moduleName) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/agentregistrationinformation.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/agentregistrationinformation.go deleted file mode 100644 index dd462ef1ae23..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/agentregistrationinformation.go +++ /dev/null @@ -1,204 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AgentRegistrationInformationClient is the automation Client -type AgentRegistrationInformationClient struct { - BaseClient -} - -// NewAgentRegistrationInformationClient creates an instance of the AgentRegistrationInformationClient client. -func NewAgentRegistrationInformationClient(subscriptionID string) AgentRegistrationInformationClient { - return NewAgentRegistrationInformationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgentRegistrationInformationClientWithBaseURI creates an instance of the AgentRegistrationInformationClient -// 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 NewAgentRegistrationInformationClientWithBaseURI(baseURI string, subscriptionID string) AgentRegistrationInformationClient { - return AgentRegistrationInformationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the automation agent registration information. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client AgentRegistrationInformationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result AgentRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentRegistrationInformationClient.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("automation.AgentRegistrationInformationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgentRegistrationInformationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation", 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 AgentRegistrationInformationClient) 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 AgentRegistrationInformationClient) GetResponder(resp *http.Response) (result AgentRegistration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a primary or secondary agent registration key -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// parameters - the name of the agent registration key to be regenerated -func (client AgentRegistrationInformationClient) RegenerateKey(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (result AgentRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentRegistrationInformationClient.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: 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("automation.AgentRegistrationInformationClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AgentRegistrationInformationClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey", 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 AgentRegistrationInformationClient) 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 AgentRegistrationInformationClient) RegenerateKeyResponder(resp *http.Response) (result AgentRegistration, 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/automation/mgmt/2017-05-15-preview/automation/automationapi/interfaces.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/automationapi/interfaces.go deleted file mode 100644 index b1f860865b98..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/automationapi/interfaces.go +++ /dev/null @@ -1,402 +0,0 @@ -package automationapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/automation/mgmt/2017-05-15-preview/automation" - "github.com/Azure/go-autorest/autorest" - "github.com/gofrs/uuid" - "io" -) - -// AccountClientAPI contains the set of methods on the AccountClient type. -type AccountClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, parameters automation.AccountCreateOrUpdateParameters) (result automation.Account, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.Account, err error) - List(ctx context.Context) (result automation.AccountListResultPage, err error) - ListComplete(ctx context.Context) (result automation.AccountListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result automation.AccountListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result automation.AccountListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, parameters automation.AccountUpdateParameters) (result automation.Account, err error) -} - -var _ AccountClientAPI = (*automation.AccountClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result automation.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*automation.OperationsClient)(nil) - -// StatisticsClientAPI contains the set of methods on the StatisticsClient type. -type StatisticsClientAPI interface { - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.StatisticsListResult, err error) -} - -var _ StatisticsClientAPI = (*automation.StatisticsClient)(nil) - -// UsagesClientAPI contains the set of methods on the UsagesClient type. -type UsagesClientAPI interface { - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.UsageListResult, err error) -} - -var _ UsagesClientAPI = (*automation.UsagesClient)(nil) - -// KeysClientAPI contains the set of methods on the KeysClient type. -type KeysClientAPI interface { - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.KeyListResult, err error) -} - -var _ KeysClientAPI = (*automation.KeysClient)(nil) - -// CertificateClientAPI contains the set of methods on the CertificateClient type. -type CertificateClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters automation.CertificateCreateOrUpdateParameters) (result automation.Certificate, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (result automation.Certificate, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CertificateListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CertificateListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters automation.CertificateUpdateParameters) (result automation.Certificate, err error) -} - -var _ CertificateClientAPI = (*automation.CertificateClient)(nil) - -// ConnectionClientAPI contains the set of methods on the ConnectionClient type. -type ConnectionClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters automation.ConnectionCreateOrUpdateParameters) (result automation.Connection, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result automation.Connection, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result automation.Connection, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters automation.ConnectionUpdateParameters) (result automation.Connection, err error) -} - -var _ ConnectionClientAPI = (*automation.ConnectionClient)(nil) - -// ConnectionTypeClientAPI contains the set of methods on the ConnectionTypeClient type. -type ConnectionTypeClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string, parameters automation.ConnectionTypeCreateOrUpdateParameters) (result automation.ConnectionType, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result automation.ConnectionType, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionTypeListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionTypeListResultIterator, err error) -} - -var _ ConnectionTypeClientAPI = (*automation.ConnectionTypeClient)(nil) - -// CredentialClientAPI contains the set of methods on the CredentialClient type. -type CredentialClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters automation.CredentialCreateOrUpdateParameters) (result automation.Credential, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result automation.Credential, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CredentialListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CredentialListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters automation.CredentialUpdateParameters) (result automation.Credential, err error) -} - -var _ CredentialClientAPI = (*automation.CredentialClient)(nil) - -// DscCompilationJobClientAPI contains the set of methods on the DscCompilationJobClient type. -type DscCompilationJobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID, parameters automation.DscCompilationJobCreateParameters) (result automation.DscCompilationJob, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID) (result automation.DscCompilationJob, err error) - GetStream(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (result automation.JobStream, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscCompilationJobListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscCompilationJobListResultIterator, err error) -} - -var _ DscCompilationJobClientAPI = (*automation.DscCompilationJobClient)(nil) - -// DscCompilationJobStreamClientAPI contains the set of methods on the DscCompilationJobStreamClient type. -type DscCompilationJobStreamClientAPI interface { - ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result automation.JobStreamListResult, err error) -} - -var _ DscCompilationJobStreamClientAPI = (*automation.DscCompilationJobStreamClient)(nil) - -// DscConfigurationClientAPI contains the set of methods on the DscConfigurationClient type. -type DscConfigurationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters automation.DscConfigurationCreateOrUpdateParameters) (result automation.DscConfiguration, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result automation.DscConfiguration, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result automation.ReadCloser, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscConfigurationListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscConfigurationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters *automation.DscConfigurationUpdateParameters) (result automation.DscConfiguration, err error) -} - -var _ DscConfigurationClientAPI = (*automation.DscConfigurationClient)(nil) - -// AgentRegistrationInformationClientAPI contains the set of methods on the AgentRegistrationInformationClient type. -type AgentRegistrationInformationClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.AgentRegistration, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, automationAccountName string, parameters automation.AgentRegistrationRegenerateKeyParameter) (result automation.AgentRegistration, err error) -} - -var _ AgentRegistrationInformationClientAPI = (*automation.AgentRegistrationInformationClient)(nil) - -// DscNodeClientAPI contains the set of methods on the DscNodeClient type. -type DscNodeClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result automation.DscNode, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result automation.DscNode, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscNodeListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscNodeListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, parameters automation.DscNodeUpdateParameters) (result automation.DscNode, err error) -} - -var _ DscNodeClientAPI = (*automation.DscNodeClient)(nil) - -// NodeReportsClientAPI contains the set of methods on the NodeReportsClient type. -type NodeReportsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result automation.DscNodeReport, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result automation.SetObject, err error) - ListByNode(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result automation.DscNodeReportListResultPage, err error) - ListByNodeComplete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result automation.DscNodeReportListResultIterator, err error) -} - -var _ NodeReportsClientAPI = (*automation.NodeReportsClient)(nil) - -// DscNodeConfigurationClientAPI contains the set of methods on the DscNodeConfigurationClient type. -type DscNodeConfigurationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters automation.DscNodeConfigurationCreateOrUpdateParameters) (result automation.DscNodeConfiguration, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result automation.DscNodeConfiguration, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscNodeConfigurationListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscNodeConfigurationListResultIterator, err error) -} - -var _ DscNodeConfigurationClientAPI = (*automation.DscNodeConfigurationClient)(nil) - -// HybridRunbookWorkerGroupClientAPI contains the set of methods on the HybridRunbookWorkerGroupClient type. -type HybridRunbookWorkerGroupClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result automation.HybridRunbookWorkerGroup, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.HybridRunbookWorkerGroupsListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.HybridRunbookWorkerGroupsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters automation.HybridRunbookWorkerGroupUpdateParameters) (result automation.HybridRunbookWorkerGroup, err error) -} - -var _ HybridRunbookWorkerGroupClientAPI = (*automation.HybridRunbookWorkerGroupClient)(nil) - -// JobScheduleClientAPI contains the set of methods on the JobScheduleClient type. -type JobScheduleClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters automation.JobScheduleCreateParameters) (result automation.JobSchedule, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result automation.JobSchedule, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.JobScheduleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.JobScheduleListResultIterator, err error) -} - -var _ JobScheduleClientAPI = (*automation.JobScheduleClient)(nil) - -// LinkedWorkspaceClientAPI contains the set of methods on the LinkedWorkspaceClient type. -type LinkedWorkspaceClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.LinkedWorkspace, err error) -} - -var _ LinkedWorkspaceClientAPI = (*automation.LinkedWorkspaceClient)(nil) - -// ActivityClientAPI contains the set of methods on the ActivityClient type. -type ActivityClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, activityName string) (result automation.Activity, err error) - ListByModule(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result automation.ActivityListResultPage, err error) - ListByModuleComplete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result automation.ActivityListResultIterator, err error) -} - -var _ ActivityClientAPI = (*automation.ActivityClient)(nil) - -// ModuleClientAPI contains the set of methods on the ModuleClient type. -type ModuleClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters automation.ModuleCreateOrUpdateParameters) (result automation.Module, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result automation.Module, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ModuleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ModuleListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters automation.ModuleUpdateParameters) (result automation.Module, err error) -} - -var _ ModuleClientAPI = (*automation.ModuleClient)(nil) - -// ObjectDataTypesClientAPI contains the set of methods on the ObjectDataTypesClient type. -type ObjectDataTypesClientAPI interface { - ListFieldsByModuleAndType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result automation.TypeFieldListResult, err error) - ListFieldsByType(ctx context.Context, resourceGroupName string, automationAccountName string, typeName string) (result automation.TypeFieldListResult, err error) -} - -var _ ObjectDataTypesClientAPI = (*automation.ObjectDataTypesClient)(nil) - -// FieldsClientAPI contains the set of methods on the FieldsClient type. -type FieldsClientAPI interface { - ListByType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result automation.TypeFieldListResult, err error) -} - -var _ FieldsClientAPI = (*automation.FieldsClient)(nil) - -// RunbookDraftClientAPI contains the set of methods on the RunbookDraftClient type. -type RunbookDraftClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.RunbookDraft, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.ReadCloser, err error) - Publish(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.RunbookDraftPublishFuture, err error) - ReplaceContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser) (result automation.RunbookDraftReplaceContentFuture, err error) - UndoEdit(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.RunbookDraftUndoEditResult, err error) -} - -var _ RunbookDraftClientAPI = (*automation.RunbookDraftClient)(nil) - -// RunbookClientAPI contains the set of methods on the RunbookClient type. -type RunbookClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters automation.RunbookCreateOrUpdateParameters) (result automation.Runbook, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.Runbook, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.ReadCloser, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.RunbookListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.RunbookListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters automation.RunbookUpdateParameters) (result automation.Runbook, err error) -} - -var _ RunbookClientAPI = (*automation.RunbookClient)(nil) - -// TestJobStreamsClientAPI contains the set of methods on the TestJobStreamsClient type. -type TestJobStreamsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (result automation.JobStream, err error) - ListByTestJob(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result automation.JobStreamListResultPage, err error) - ListByTestJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result automation.JobStreamListResultIterator, err error) -} - -var _ TestJobStreamsClientAPI = (*automation.TestJobStreamsClient)(nil) - -// TestJobClientAPI contains the set of methods on the TestJobClient type. -type TestJobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters automation.TestJobCreateParameters) (result automation.TestJob, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.TestJob, err error) - Resume(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) - Stop(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) - Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) -} - -var _ TestJobClientAPI = (*automation.TestJobClient)(nil) - -// ScheduleClientAPI contains the set of methods on the ScheduleClient type. -type ScheduleClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters automation.ScheduleCreateOrUpdateParameters) (result automation.Schedule, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result automation.Schedule, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ScheduleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ScheduleListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters automation.ScheduleUpdateParameters) (result automation.Schedule, err error) -} - -var _ ScheduleClientAPI = (*automation.ScheduleClient)(nil) - -// VariableClientAPI contains the set of methods on the VariableClient type. -type VariableClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters automation.VariableCreateOrUpdateParameters) (result automation.Variable, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result automation.Variable, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.VariableListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.VariableListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters automation.VariableUpdateParameters) (result automation.Variable, err error) -} - -var _ VariableClientAPI = (*automation.VariableClient)(nil) - -// WebhookClientAPI contains the set of methods on the WebhookClient type. -type WebhookClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters automation.WebhookCreateOrUpdateParameters) (result automation.Webhook, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result autorest.Response, err error) - GenerateURI(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.String, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result automation.Webhook, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WebhookListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WebhookListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters automation.WebhookUpdateParameters) (result automation.Webhook, err error) -} - -var _ WebhookClientAPI = (*automation.WebhookClient)(nil) - -// SoftwareUpdateConfigurationsClientAPI contains the set of methods on the SoftwareUpdateConfigurationsClient type. -type SoftwareUpdateConfigurationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, parameters automation.SoftwareUpdateConfiguration, clientRequestID string) (result automation.SoftwareUpdateConfiguration, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result autorest.Response, err error) - GetByName(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result automation.SoftwareUpdateConfiguration, err error) - List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string) (result automation.SoftwareUpdateConfigurationListResult, err error) -} - -var _ SoftwareUpdateConfigurationsClientAPI = (*automation.SoftwareUpdateConfigurationsClient)(nil) - -// SoftwareUpdateConfigurationRunsClientAPI contains the set of methods on the SoftwareUpdateConfigurationRunsClient type. -type SoftwareUpdateConfigurationRunsClientAPI interface { - GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationRunID uuid.UUID, clientRequestID string) (result automation.SoftwareUpdateConfigurationRun, err error) - List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result automation.SoftwareUpdateConfigurationRunListResult, err error) -} - -var _ SoftwareUpdateConfigurationRunsClientAPI = (*automation.SoftwareUpdateConfigurationRunsClient)(nil) - -// SoftwareUpdateConfigurationMachineRunsClientAPI contains the set of methods on the SoftwareUpdateConfigurationMachineRunsClient type. -type SoftwareUpdateConfigurationMachineRunsClientAPI interface { - GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationMachineRunID uuid.UUID, clientRequestID string) (result automation.SoftwareUpdateConfigurationMachineRun, err error) - List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result automation.SoftwareUpdateConfigurationMachineRunListResult, err error) -} - -var _ SoftwareUpdateConfigurationMachineRunsClientAPI = (*automation.SoftwareUpdateConfigurationMachineRunsClient)(nil) - -// SourceControlClientAPI contains the set of methods on the SourceControlClient type. -type SourceControlClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters automation.SourceControlCreateOrUpdateParameters) (result automation.SourceControl, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result automation.SourceControl, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.SourceControlListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.SourceControlListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters automation.SourceControlUpdateParameters) (result automation.SourceControl, err error) -} - -var _ SourceControlClientAPI = (*automation.SourceControlClient)(nil) - -// SourceControlSyncJobClientAPI contains the set of methods on the SourceControlSyncJobClient type. -type SourceControlSyncJobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, parameters automation.SourceControlSyncJobCreateParameters) (result automation.SourceControlSyncJob, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID) (result automation.SourceControlSyncJobByID, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result automation.SourceControlSyncJobListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result automation.SourceControlSyncJobListResultIterator, err error) -} - -var _ SourceControlSyncJobClientAPI = (*automation.SourceControlSyncJobClient)(nil) - -// SourceControlSyncJobStreamsClientAPI contains the set of methods on the SourceControlSyncJobStreamsClient type. -type SourceControlSyncJobStreamsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, streamID string) (result automation.SourceControlSyncJobStreamByID, err error) - ListBySyncJob(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result automation.SourceControlSyncJobStreamsListBySyncJobPage, err error) - ListBySyncJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result automation.SourceControlSyncJobStreamsListBySyncJobIterator, err error) -} - -var _ SourceControlSyncJobStreamsClientAPI = (*automation.SourceControlSyncJobStreamsClient)(nil) - -// JobClientAPI contains the set of methods on the JobClient type. -type JobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, parameters automation.JobCreateParameters, clientRequestID string) (result automation.Job, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result automation.Job, err error) - GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result automation.ReadCloser, err error) - GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result automation.ReadCloser, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result automation.JobListResultV2Page, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result automation.JobListResultV2Iterator, err error) - Resume(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) - Stop(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) - Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) -} - -var _ JobClientAPI = (*automation.JobClient)(nil) - -// JobStreamClientAPI contains the set of methods on the JobStreamClient type. -type JobStreamClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, jobStreamID string, clientRequestID string) (result automation.JobStream, err error) - ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result automation.JobStreamListResultPage, err error) - ListByJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result automation.JobStreamListResultIterator, err error) -} - -var _ JobStreamClientAPI = (*automation.JobStreamClient)(nil) diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/certificate.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/certificate.go deleted file mode 100644 index 65ee261ec45f..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/certificate.go +++ /dev/null @@ -1,511 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation 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)} -} - -// CreateOrUpdate create a certificate. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the parameters supplied to the create or update certificate operation. -// parameters - the parameters supplied to the create or update certificate operation. -func (client CertificateClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CertificateCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties.Base64Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.CertificateClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", 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 CertificateClient) 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 CertificateClient) CreateOrUpdateResponder(resp *http.Response) (result Certificate, 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 certificate. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the name of certificate. -func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.CertificateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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) (*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 CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the certificate identified by certificate name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the name of certificate. -func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, automationAccountName 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: 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("automation.CertificateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.CertificateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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 -} - -// ListByAutomationAccount retrieve a list of certificates. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client CertificateClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result CertificateListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.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("automation.CertificateClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client CertificateClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client CertificateClient) ListByAutomationAccountResponder(resp *http.Response) (result CertificateListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client CertificateClient) listByAutomationAccountNextResults(ctx context.Context, lastResults CertificateListResult) (result CertificateListResult, err error) { - req, err := lastResults.certificateListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client CertificateClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result CertificateListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a certificate. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the parameters supplied to the update certificate operation. -// parameters - the parameters supplied to the update certificate operation. -func (client CertificateClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (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: 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("automation.CertificateClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.CertificateClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CertificateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", 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 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/preview/automation/mgmt/2017-05-15-preview/automation/client.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/client.go deleted file mode 100644 index e729ae544fd6..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package automation implements the Azure ARM Automation service API version . -// -// Automation Client -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Automation - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Automation. -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/automation/mgmt/2017-05-15-preview/automation/connection.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/connection.go deleted file mode 100644 index 9f867a8a089d..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/connection.go +++ /dev/null @@ -1,512 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ConnectionClient is the automation Client -type ConnectionClient struct { - BaseClient -} - -// NewConnectionClient creates an instance of the ConnectionClient client. -func NewConnectionClient(subscriptionID string) ConnectionClient { - return NewConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectionClientWithBaseURI creates an instance of the ConnectionClient 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 NewConnectionClientWithBaseURI(baseURI string, subscriptionID string) ConnectionClient { - return ConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a connection. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the parameters supplied to the create or update connection operation. -// parameters - the parameters supplied to the create or update connection operation. -func (client ConnectionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectionCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectionCreateOrUpdateProperties.ConnectionType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.ConnectionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, connectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) CreateOrUpdateResponder(resp *http.Response) (result Connection, 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 connection. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the name of connection. -func (client ConnectionClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ConnectionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, connectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectionClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) DeleteResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the connection identified by connection name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the name of connection. -func (client ConnectionClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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("automation.ConnectionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, connectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) GetResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of connections. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ConnectionClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.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("automation.ConnectionClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ConnectionClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ConnectionClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ConnectionClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ConnectionListResult) (result ConnectionListResult, err error) { - req, err := lastResults.connectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConnectionClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a connection. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the parameters supplied to the update a connection operation. -// parameters - the parameters supplied to the update a connection operation. -func (client ConnectionClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ConnectionClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, connectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ConnectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) UpdateResponder(resp *http.Response) (result Connection, 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/automation/mgmt/2017-05-15-preview/automation/connectiontype.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/connectiontype.go deleted file mode 100644 index 1fd5f23b2812..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/connectiontype.go +++ /dev/null @@ -1,422 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ConnectionTypeClient is the automation Client -type ConnectionTypeClient struct { - BaseClient -} - -// NewConnectionTypeClient creates an instance of the ConnectionTypeClient client. -func NewConnectionTypeClient(subscriptionID string) ConnectionTypeClient { - return NewConnectionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectionTypeClientWithBaseURI creates an instance of the ConnectionTypeClient 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 NewConnectionTypeClientWithBaseURI(baseURI string, subscriptionID string) ConnectionTypeClient { - return ConnectionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a connection type. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionTypeName - the parameters supplied to the create or update connection type operation. -// parameters - the parameters supplied to the create or update connection type operation. -func (client ConnectionTypeClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (result ConnectionType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectionTypeCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectionTypeCreateOrUpdateProperties.FieldDefinitions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.ConnectionTypeClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, connectionTypeName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectionTypeClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", 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 ConnectionTypeClient) 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 ConnectionTypeClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectionType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the connection type. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionTypeName - the name of connection type. -func (client ConnectionTypeClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ConnectionTypeClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, connectionTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectionTypeClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", 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 ConnectionTypeClient) 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 ConnectionTypeClient) 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 the connection type identified by connection type name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionTypeName - the name of connection type. -func (client ConnectionTypeClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result ConnectionType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.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("automation.ConnectionTypeClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, connectionTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", 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 ConnectionTypeClient) 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 ConnectionTypeClient) GetResponder(resp *http.Response) (result ConnectionType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of connection types. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ConnectionTypeClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionTypeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.ctlr.Response.Response != nil { - sc = result.ctlr.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("automation.ConnectionTypeClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.ctlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.ctlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.ctlr.hasNextLink() && result.ctlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ConnectionTypeClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionTypeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ConnectionTypeClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionTypeListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ConnectionTypeClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ConnectionTypeListResult) (result ConnectionTypeListResult, err error) { - req, err := lastResults.connectionTypeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConnectionTypeClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionTypeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/credential.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/credential.go deleted file mode 100644 index dc406e5626e3..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/credential.go +++ /dev/null @@ -1,513 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CredentialClient is the automation Client -type CredentialClient struct { - BaseClient -} - -// NewCredentialClient creates an instance of the CredentialClient client. -func NewCredentialClient(subscriptionID string) CredentialClient { - return NewCredentialClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCredentialClientWithBaseURI creates an instance of the CredentialClient 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 NewCredentialClientWithBaseURI(baseURI string, subscriptionID string) CredentialClient { - return CredentialClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a credential. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the parameters supplied to the create or update credential operation. -// parameters - the parameters supplied to the create or update credential operation. -func (client CredentialClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (result Credential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CredentialCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CredentialCreateOrUpdateProperties.UserName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CredentialCreateOrUpdateProperties.Password", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.CredentialClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, credentialName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CredentialClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) CreateOrUpdateResponder(resp *http.Response) (result Credential, 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 credential. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the name of credential. -func (client CredentialClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.CredentialClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CredentialClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the credential identified by credential name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the name of credential. -func (client CredentialClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result Credential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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("automation.CredentialClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CredentialClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) GetResponder(resp *http.Response) (result Credential, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of credentials. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client CredentialClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result CredentialListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.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("automation.CredentialClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client CredentialClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CredentialClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client CredentialClient) ListByAutomationAccountResponder(resp *http.Response) (result CredentialListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client CredentialClient) listByAutomationAccountNextResults(ctx context.Context, lastResults CredentialListResult) (result CredentialListResult, err error) { - req, err := lastResults.credentialListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client CredentialClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result CredentialListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a credential. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the parameters supplied to the Update credential operation. -// parameters - the parameters supplied to the Update credential operation. -func (client CredentialClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (result Credential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.CredentialClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, credentialName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CredentialClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) UpdateResponder(resp *http.Response) (result Credential, 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/automation/mgmt/2017-05-15-preview/automation/dsccompilationjob.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/dsccompilationjob.go deleted file mode 100644 index adc050fe0c71..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/dsccompilationjob.go +++ /dev/null @@ -1,430 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// DscCompilationJobClient is the automation Client -type DscCompilationJobClient struct { - BaseClient -} - -// NewDscCompilationJobClient creates an instance of the DscCompilationJobClient client. -func NewDscCompilationJobClient(subscriptionID string) DscCompilationJobClient { - return NewDscCompilationJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscCompilationJobClientWithBaseURI creates an instance of the DscCompilationJobClient 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 NewDscCompilationJobClientWithBaseURI(baseURI string, subscriptionID string) DscCompilationJobClient { - return DscCompilationJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates the Dsc compilation job of the configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// compilationJobID - the DSC configuration Id. -// parameters - the parameters supplied to the create compilation job operation. -func (client DscCompilationJobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID, parameters DscCompilationJobCreateParameters) (result DscCompilationJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties.Configuration", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.DscCompilationJobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, compilationJobID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DscCompilationJobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID, parameters DscCompilationJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "compilationJobId": autorest.Encode("path", compilationJobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobId}", 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 DscCompilationJobClient) 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 DscCompilationJobClient) CreateResponder(resp *http.Response) (result DscCompilationJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the Dsc configuration compilation job identified by job id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// compilationJobID - the Dsc configuration compilation job id. -func (client DscCompilationJobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID) (result DscCompilationJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.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("automation.DscCompilationJobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, compilationJobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscCompilationJobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "compilationJobId": autorest.Encode("path", compilationJobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobId}", 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 DscCompilationJobClient) 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 DscCompilationJobClient) GetResponder(resp *http.Response) (result DscCompilationJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStream retrieve the job stream identified by job stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobID - the job id. -// jobStreamID - the job stream id. -func (client DscCompilationJobClient) GetStream(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (result JobStream, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.GetStream") - 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("automation.DscCompilationJobClient", "GetStream", err.Error()) - } - - req, err := client.GetStreamPreparer(ctx, resourceGroupName, automationAccountName, jobID, jobStreamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", nil, "Failure preparing request") - return - } - - resp, err := client.GetStreamSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure sending request") - return - } - - result, err = client.GetStreamResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure responding to request") - return - } - - return -} - -// GetStreamPreparer prepares the GetStream request. -func (client DscCompilationJobClient) GetStreamPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetStreamSender sends the GetStream request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) GetStreamSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetStreamResponder handles the response to the GetStream request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) GetStreamResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc compilation jobs. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client DscCompilationJobClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscCompilationJobListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dcjlr.Response.Response != nil { - sc = result.dcjlr.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("automation.DscCompilationJobClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dcjlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dcjlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dcjlr.hasNextLink() && result.dcjlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscCompilationJobClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/compilationjobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) ListByAutomationAccountResponder(resp *http.Response) (result DscCompilationJobListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscCompilationJobClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscCompilationJobListResult) (result DscCompilationJobListResult, err error) { - req, err := lastResults.dscCompilationJobListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscCompilationJobClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscCompilationJobListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/dsccompilationjobstream.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/dsccompilationjobstream.go deleted file mode 100644 index e68a4a6d39b7..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/dsccompilationjobstream.go +++ /dev/null @@ -1,120 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// DscCompilationJobStreamClient is the automation Client -type DscCompilationJobStreamClient struct { - BaseClient -} - -// NewDscCompilationJobStreamClient creates an instance of the DscCompilationJobStreamClient client. -func NewDscCompilationJobStreamClient(subscriptionID string) DscCompilationJobStreamClient { - return NewDscCompilationJobStreamClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscCompilationJobStreamClientWithBaseURI creates an instance of the DscCompilationJobStreamClient 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 NewDscCompilationJobStreamClientWithBaseURI(baseURI string, subscriptionID string) DscCompilationJobStreamClient { - return DscCompilationJobStreamClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByJob retrieve all the job streams for the compilation Job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobID - the job id. -func (client DscCompilationJobStreamClient) ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result JobStreamListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobStreamClient.ListByJob") - 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("automation.DscCompilationJobStreamClient", "ListByJob", err.Error()) - } - - req, err := client.ListByJobPreparer(ctx, resourceGroupName, automationAccountName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobStreamClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobStreamClient", "ListByJob", resp, "Failure sending request") - return - } - - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobStreamClient", "ListByJob", resp, "Failure responding to request") - return - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client DscCompilationJobStreamClient) ListByJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobStreamClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client DscCompilationJobStreamClient) ListByJobResponder(resp *http.Response) (result JobStreamListResult, 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/automation/mgmt/2017-05-15-preview/automation/dscconfiguration.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/dscconfiguration.go deleted file mode 100644 index 8dd04d90454e..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/dscconfiguration.go +++ /dev/null @@ -1,621 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DscConfigurationClient is the automation Client -type DscConfigurationClient struct { - BaseClient -} - -// NewDscConfigurationClient creates an instance of the DscConfigurationClient client. -func NewDscConfigurationClient(subscriptionID string) DscConfigurationClient { - return NewDscConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscConfigurationClientWithBaseURI creates an instance of the DscConfigurationClient 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 NewDscConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscConfigurationClient { - return DscConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the create or update parameters for configuration. -// parameters - the create or update parameters for configuration. -func (client DscConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (result DscConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.DscConfigurationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DscConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", 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 DscConfigurationClient) 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 DscConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscConfiguration, 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 dsc configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the configuration name. -func (client DscConfigurationClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscConfigurationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", 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 DscConfigurationClient) 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 DscConfigurationClient) 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 the configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the configuration name. -func (client DscConfigurationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result DscConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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("automation.DscConfigurationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", 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 DscConfigurationClient) 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 DscConfigurationClient) GetResponder(resp *http.Response) (result DscConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the configuration script identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the configuration name. -func (client DscConfigurationClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.GetContent") - 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("automation.DscConfigurationClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client DscConfigurationClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of configurations. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// skip - the number of rows to skip. -// top - the number of rows to take. -// inlinecount - return total rows. -func (client DscConfigurationClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscConfigurationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dclr.Response.Response != nil { - sc = result.dclr.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("automation.DscConfigurationClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dclr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dclr.hasNextLink() && result.dclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscConfigurationClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(inlinecount) > 0 { - queryParameters["$inlinecount"] = autorest.Encode("query", inlinecount) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscConfigurationClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscConfigurationListResult) (result DscConfigurationListResult, err error) { - req, err := lastResults.dscConfigurationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscConfigurationClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscConfigurationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - return -} - -// Update create the configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the create or update parameters for configuration. -// parameters - the create or update parameters for configuration. -func (client DscConfigurationClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters *DscConfigurationUpdateParameters) (result DscConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscConfigurationClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DscConfigurationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters *DscConfigurationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - 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 DscConfigurationClient) 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 DscConfigurationClient) UpdateResponder(resp *http.Response) (result DscConfiguration, 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/automation/mgmt/2017-05-15-preview/automation/dscnode.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/dscnode.go deleted file mode 100644 index 8d399e49254b..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/dscnode.go +++ /dev/null @@ -1,423 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DscNodeClient is the automation Client -type DscNodeClient struct { - BaseClient -} - -// NewDscNodeClient creates an instance of the DscNodeClient client. -func NewDscNodeClient(subscriptionID string) DscNodeClient { - return NewDscNodeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscNodeClientWithBaseURI creates an instance of the DscNodeClient 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 NewDscNodeClientWithBaseURI(baseURI string, subscriptionID string) DscNodeClient { - return DscNodeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete the dsc node identified by node id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the node id. -func (client DscNodeClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, nodeID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscNodeClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", 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 DscNodeClient) 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 DscNodeClient) DeleteResponder(resp *http.Response) (result DscNode, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the dsc node identified by node id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the node id. -func (client DscNodeClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.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("automation.DscNodeClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, nodeID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscNodeClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", 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 DscNodeClient) 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 DscNodeClient) GetResponder(resp *http.Response) (result DscNode, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc nodes. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client DscNodeClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscNodeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dnlr.Response.Response != nil { - sc = result.dnlr.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("automation.DscNodeClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dnlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dnlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dnlr.hasNextLink() && result.dnlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscNodeClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/nodes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscNodeClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscNodeClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscNodeListResult) (result DscNodeListResult, err error) { - req, err := lastResults.dscNodeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscNodeClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscNodeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update the dsc node. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - parameters supplied to the update dsc node. -// parameters - parameters supplied to the update dsc node. -func (client DscNodeClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, parameters DscNodeUpdateParameters) (result DscNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, nodeID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DscNodeClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, parameters DscNodeUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", 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 DscNodeClient) 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 DscNodeClient) UpdateResponder(resp *http.Response) (result DscNode, 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/automation/mgmt/2017-05-15-preview/automation/dscnodeconfiguration.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/dscnodeconfiguration.go deleted file mode 100644 index a2b8c5e8bd90..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/dscnodeconfiguration.go +++ /dev/null @@ -1,432 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DscNodeConfigurationClient is the automation Client -type DscNodeConfigurationClient struct { - BaseClient -} - -// NewDscNodeConfigurationClient creates an instance of the DscNodeConfigurationClient client. -func NewDscNodeConfigurationClient(subscriptionID string) DscNodeConfigurationClient { - return NewDscNodeConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscNodeConfigurationClientWithBaseURI creates an instance of the DscNodeConfigurationClient 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 NewDscNodeConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscNodeConfigurationClient { - return DscNodeConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the node configuration identified by node configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeConfigurationName - the create or update parameters for configuration. -// parameters - the create or update parameters for configuration. -func (client DscNodeConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (result DscNodeConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Source.Hash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Configuration", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeConfigurationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, nodeConfigurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DscNodeConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", 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 DscNodeConfigurationClient) 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 DscNodeConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscNodeConfiguration, 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 Dsc node configurations by node configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeConfigurationName - the Dsc node configuration name. -func (client DscNodeConfigurationClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeConfigurationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, nodeConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscNodeConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", 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 DscNodeConfigurationClient) 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 DscNodeConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the Dsc node configurations by node configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeConfigurationName - the Dsc node configuration name. -func (client DscNodeConfigurationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result DscNodeConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.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("automation.DscNodeConfigurationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, nodeConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscNodeConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", 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 DscNodeConfigurationClient) 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 DscNodeConfigurationClient) GetResponder(resp *http.Response) (result DscNodeConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc node configurations. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client DscNodeConfigurationClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscNodeConfigurationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dnclr.Response.Response != nil { - sc = result.dnclr.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("automation.DscNodeConfigurationClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dnclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dnclr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dnclr.hasNextLink() && result.dnclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscNodeConfigurationClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/nodeConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscNodeConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscNodeConfigurationClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscNodeConfigurationListResult) (result DscNodeConfigurationListResult, err error) { - req, err := lastResults.dscNodeConfigurationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscNodeConfigurationClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscNodeConfigurationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/enums.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/enums.go deleted file mode 100644 index 175caa4dca56..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/enums.go +++ /dev/null @@ -1,631 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccountState enumerates the values for account state. -type AccountState string - -const ( - // Ok ... - Ok AccountState = "Ok" - // Suspended ... - Suspended AccountState = "Suspended" - // Unavailable ... - Unavailable AccountState = "Unavailable" -) - -// PossibleAccountStateValues returns an array of possible values for the AccountState const type. -func PossibleAccountStateValues() []AccountState { - return []AccountState{Ok, Suspended, Unavailable} -} - -// AgentRegistrationKeyName enumerates the values for agent registration key name. -type AgentRegistrationKeyName string - -const ( - // Primary ... - Primary AgentRegistrationKeyName = "primary" - // Secondary ... - Secondary AgentRegistrationKeyName = "secondary" -) - -// PossibleAgentRegistrationKeyNameValues returns an array of possible values for the AgentRegistrationKeyName const type. -func PossibleAgentRegistrationKeyNameValues() []AgentRegistrationKeyName { - return []AgentRegistrationKeyName{Primary, Secondary} -} - -// ContentSourceType enumerates the values for content source type. -type ContentSourceType string - -const ( - // EmbeddedContent ... - EmbeddedContent ContentSourceType = "embeddedContent" - // URI ... - URI ContentSourceType = "uri" -) - -// PossibleContentSourceTypeValues returns an array of possible values for the ContentSourceType const type. -func PossibleContentSourceTypeValues() []ContentSourceType { - return []ContentSourceType{EmbeddedContent, URI} -} - -// DscConfigurationProvisioningState enumerates the values for dsc configuration provisioning state. -type DscConfigurationProvisioningState string - -const ( - // Succeeded ... - Succeeded DscConfigurationProvisioningState = "Succeeded" -) - -// PossibleDscConfigurationProvisioningStateValues returns an array of possible values for the DscConfigurationProvisioningState const type. -func PossibleDscConfigurationProvisioningStateValues() []DscConfigurationProvisioningState { - return []DscConfigurationProvisioningState{Succeeded} -} - -// DscConfigurationState enumerates the values for dsc configuration state. -type DscConfigurationState string - -const ( - // DscConfigurationStateEdit ... - DscConfigurationStateEdit DscConfigurationState = "Edit" - // DscConfigurationStateNew ... - DscConfigurationStateNew DscConfigurationState = "New" - // DscConfigurationStatePublished ... - DscConfigurationStatePublished DscConfigurationState = "Published" -) - -// PossibleDscConfigurationStateValues returns an array of possible values for the DscConfigurationState const type. -func PossibleDscConfigurationStateValues() []DscConfigurationState { - return []DscConfigurationState{DscConfigurationStateEdit, DscConfigurationStateNew, DscConfigurationStatePublished} -} - -// GroupTypeEnum enumerates the values for group type enum. -type GroupTypeEnum string - -const ( - // System ... - System GroupTypeEnum = "System" - // User ... - User GroupTypeEnum = "User" -) - -// PossibleGroupTypeEnumValues returns an array of possible values for the GroupTypeEnum const type. -func PossibleGroupTypeEnumValues() []GroupTypeEnum { - return []GroupTypeEnum{System, User} -} - -// HTTPStatusCode enumerates the values for http status code. -type HTTPStatusCode string - -const ( - // Accepted ... - Accepted HTTPStatusCode = "Accepted" - // Ambiguous ... - Ambiguous HTTPStatusCode = "Ambiguous" - // BadGateway ... - BadGateway HTTPStatusCode = "BadGateway" - // BadRequest ... - BadRequest HTTPStatusCode = "BadRequest" - // Conflict ... - Conflict HTTPStatusCode = "Conflict" - // Continue ... - Continue HTTPStatusCode = "Continue" - // Created ... - Created HTTPStatusCode = "Created" - // ExpectationFailed ... - ExpectationFailed HTTPStatusCode = "ExpectationFailed" - // Forbidden ... - Forbidden HTTPStatusCode = "Forbidden" - // Found ... - Found HTTPStatusCode = "Found" - // GatewayTimeout ... - GatewayTimeout HTTPStatusCode = "GatewayTimeout" - // Gone ... - Gone HTTPStatusCode = "Gone" - // HTTPVersionNotSupported ... - HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" - // InternalServerError ... - InternalServerError HTTPStatusCode = "InternalServerError" - // LengthRequired ... - LengthRequired HTTPStatusCode = "LengthRequired" - // MethodNotAllowed ... - MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" - // Moved ... - Moved HTTPStatusCode = "Moved" - // MovedPermanently ... - MovedPermanently HTTPStatusCode = "MovedPermanently" - // MultipleChoices ... - MultipleChoices HTTPStatusCode = "MultipleChoices" - // NoContent ... - NoContent HTTPStatusCode = "NoContent" - // NonAuthoritativeInformation ... - NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" - // NotAcceptable ... - NotAcceptable HTTPStatusCode = "NotAcceptable" - // NotFound ... - NotFound HTTPStatusCode = "NotFound" - // NotImplemented ... - NotImplemented HTTPStatusCode = "NotImplemented" - // NotModified ... - NotModified HTTPStatusCode = "NotModified" - // OK ... - OK HTTPStatusCode = "OK" - // PartialContent ... - PartialContent HTTPStatusCode = "PartialContent" - // PaymentRequired ... - PaymentRequired HTTPStatusCode = "PaymentRequired" - // PreconditionFailed ... - PreconditionFailed HTTPStatusCode = "PreconditionFailed" - // ProxyAuthenticationRequired ... - ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" - // Redirect ... - Redirect HTTPStatusCode = "Redirect" - // RedirectKeepVerb ... - RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" - // RedirectMethod ... - RedirectMethod HTTPStatusCode = "RedirectMethod" - // RequestedRangeNotSatisfiable ... - RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" - // RequestEntityTooLarge ... - RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" - // RequestTimeout ... - RequestTimeout HTTPStatusCode = "RequestTimeout" - // RequestURITooLong ... - RequestURITooLong HTTPStatusCode = "RequestUriTooLong" - // ResetContent ... - ResetContent HTTPStatusCode = "ResetContent" - // SeeOther ... - SeeOther HTTPStatusCode = "SeeOther" - // ServiceUnavailable ... - ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" - // SwitchingProtocols ... - SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" - // TemporaryRedirect ... - TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" - // Unauthorized ... - Unauthorized HTTPStatusCode = "Unauthorized" - // UnsupportedMediaType ... - UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" - // Unused ... - Unused HTTPStatusCode = "Unused" - // UpgradeRequired ... - UpgradeRequired HTTPStatusCode = "UpgradeRequired" - // UseProxy ... - UseProxy HTTPStatusCode = "UseProxy" -) - -// PossibleHTTPStatusCodeValues returns an array of possible values for the HTTPStatusCode const type. -func PossibleHTTPStatusCodeValues() []HTTPStatusCode { - return []HTTPStatusCode{Accepted, Ambiguous, BadGateway, BadRequest, Conflict, Continue, Created, ExpectationFailed, Forbidden, Found, GatewayTimeout, Gone, HTTPVersionNotSupported, InternalServerError, LengthRequired, MethodNotAllowed, Moved, MovedPermanently, MultipleChoices, NoContent, NonAuthoritativeInformation, NotAcceptable, NotFound, NotImplemented, NotModified, OK, PartialContent, PaymentRequired, PreconditionFailed, ProxyAuthenticationRequired, Redirect, RedirectKeepVerb, RedirectMethod, RequestedRangeNotSatisfiable, RequestEntityTooLarge, RequestTimeout, RequestURITooLong, ResetContent, SeeOther, ServiceUnavailable, SwitchingProtocols, TemporaryRedirect, Unauthorized, UnsupportedMediaType, Unused, UpgradeRequired, UseProxy} -} - -// JobProvisioningState enumerates the values for job provisioning state. -type JobProvisioningState string - -const ( - // JobProvisioningStateFailed ... - JobProvisioningStateFailed JobProvisioningState = "Failed" - // JobProvisioningStateProcessing ... - JobProvisioningStateProcessing JobProvisioningState = "Processing" - // JobProvisioningStateSucceeded ... - JobProvisioningStateSucceeded JobProvisioningState = "Succeeded" - // JobProvisioningStateSuspended ... - JobProvisioningStateSuspended JobProvisioningState = "Suspended" -) - -// PossibleJobProvisioningStateValues returns an array of possible values for the JobProvisioningState const type. -func PossibleJobProvisioningStateValues() []JobProvisioningState { - return []JobProvisioningState{JobProvisioningStateFailed, JobProvisioningStateProcessing, JobProvisioningStateSucceeded, JobProvisioningStateSuspended} -} - -// JobStatus enumerates the values for job status. -type JobStatus string - -const ( - // JobStatusActivating ... - JobStatusActivating JobStatus = "Activating" - // JobStatusBlocked ... - JobStatusBlocked JobStatus = "Blocked" - // JobStatusCompleted ... - JobStatusCompleted JobStatus = "Completed" - // JobStatusDisconnected ... - JobStatusDisconnected JobStatus = "Disconnected" - // JobStatusFailed ... - JobStatusFailed JobStatus = "Failed" - // JobStatusNew ... - JobStatusNew JobStatus = "New" - // JobStatusRemoving ... - JobStatusRemoving JobStatus = "Removing" - // JobStatusResuming ... - JobStatusResuming JobStatus = "Resuming" - // JobStatusRunning ... - JobStatusRunning JobStatus = "Running" - // JobStatusStopped ... - JobStatusStopped JobStatus = "Stopped" - // JobStatusStopping ... - JobStatusStopping JobStatus = "Stopping" - // JobStatusSuspended ... - JobStatusSuspended JobStatus = "Suspended" - // JobStatusSuspending ... - JobStatusSuspending JobStatus = "Suspending" -) - -// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. -func PossibleJobStatusValues() []JobStatus { - return []JobStatus{JobStatusActivating, JobStatusBlocked, JobStatusCompleted, JobStatusDisconnected, JobStatusFailed, JobStatusNew, JobStatusRemoving, JobStatusResuming, JobStatusRunning, JobStatusStopped, JobStatusStopping, JobStatusSuspended, JobStatusSuspending} -} - -// JobStreamType enumerates the values for job stream type. -type JobStreamType string - -const ( - // Any ... - Any JobStreamType = "Any" - // Debug ... - Debug JobStreamType = "Debug" - // Error ... - Error JobStreamType = "Error" - // Output ... - Output JobStreamType = "Output" - // Progress ... - Progress JobStreamType = "Progress" - // Verbose ... - Verbose JobStreamType = "Verbose" - // Warning ... - Warning JobStreamType = "Warning" -) - -// PossibleJobStreamTypeValues returns an array of possible values for the JobStreamType const type. -func PossibleJobStreamTypeValues() []JobStreamType { - return []JobStreamType{Any, Debug, Error, Output, Progress, Verbose, Warning} -} - -// KeyName enumerates the values for key name. -type KeyName string - -const ( - // KeyNamePrimary ... - KeyNamePrimary KeyName = "Primary" - // KeyNameSecondary ... - KeyNameSecondary KeyName = "Secondary" -) - -// PossibleKeyNameValues returns an array of possible values for the KeyName const type. -func PossibleKeyNameValues() []KeyName { - return []KeyName{KeyNamePrimary, KeyNameSecondary} -} - -// KeyPermissions enumerates the values for key permissions. -type KeyPermissions string - -const ( - // Full ... - Full KeyPermissions = "Full" - // Read ... - Read KeyPermissions = "Read" -) - -// PossibleKeyPermissionsValues returns an array of possible values for the KeyPermissions const type. -func PossibleKeyPermissionsValues() []KeyPermissions { - return []KeyPermissions{Full, Read} -} - -// LinuxUpdateClasses enumerates the values for linux update classes. -type LinuxUpdateClasses string - -const ( - // Critical ... - Critical LinuxUpdateClasses = "Critical" - // Other ... - Other LinuxUpdateClasses = "Other" - // Security ... - Security LinuxUpdateClasses = "Security" - // Unclassified ... - Unclassified LinuxUpdateClasses = "Unclassified" -) - -// PossibleLinuxUpdateClassesValues returns an array of possible values for the LinuxUpdateClasses const type. -func PossibleLinuxUpdateClassesValues() []LinuxUpdateClasses { - return []LinuxUpdateClasses{Critical, Other, Security, Unclassified} -} - -// ModuleProvisioningState enumerates the values for module provisioning state. -type ModuleProvisioningState string - -const ( - // ModuleProvisioningStateActivitiesStored ... - ModuleProvisioningStateActivitiesStored ModuleProvisioningState = "ActivitiesStored" - // ModuleProvisioningStateCancelled ... - ModuleProvisioningStateCancelled ModuleProvisioningState = "Cancelled" - // ModuleProvisioningStateConnectionTypeImported ... - ModuleProvisioningStateConnectionTypeImported ModuleProvisioningState = "ConnectionTypeImported" - // ModuleProvisioningStateContentDownloaded ... - ModuleProvisioningStateContentDownloaded ModuleProvisioningState = "ContentDownloaded" - // ModuleProvisioningStateContentRetrieved ... - ModuleProvisioningStateContentRetrieved ModuleProvisioningState = "ContentRetrieved" - // ModuleProvisioningStateContentStored ... - ModuleProvisioningStateContentStored ModuleProvisioningState = "ContentStored" - // ModuleProvisioningStateContentValidated ... - ModuleProvisioningStateContentValidated ModuleProvisioningState = "ContentValidated" - // ModuleProvisioningStateCreated ... - ModuleProvisioningStateCreated ModuleProvisioningState = "Created" - // ModuleProvisioningStateCreating ... - ModuleProvisioningStateCreating ModuleProvisioningState = "Creating" - // ModuleProvisioningStateFailed ... - ModuleProvisioningStateFailed ModuleProvisioningState = "Failed" - // ModuleProvisioningStateModuleDataStored ... - ModuleProvisioningStateModuleDataStored ModuleProvisioningState = "ModuleDataStored" - // ModuleProvisioningStateModuleImportRunbookComplete ... - ModuleProvisioningStateModuleImportRunbookComplete ModuleProvisioningState = "ModuleImportRunbookComplete" - // ModuleProvisioningStateRunningImportModuleRunbook ... - ModuleProvisioningStateRunningImportModuleRunbook ModuleProvisioningState = "RunningImportModuleRunbook" - // ModuleProvisioningStateStartingImportModuleRunbook ... - ModuleProvisioningStateStartingImportModuleRunbook ModuleProvisioningState = "StartingImportModuleRunbook" - // ModuleProvisioningStateSucceeded ... - ModuleProvisioningStateSucceeded ModuleProvisioningState = "Succeeded" - // ModuleProvisioningStateUpdating ... - ModuleProvisioningStateUpdating ModuleProvisioningState = "Updating" -) - -// PossibleModuleProvisioningStateValues returns an array of possible values for the ModuleProvisioningState const type. -func PossibleModuleProvisioningStateValues() []ModuleProvisioningState { - return []ModuleProvisioningState{ModuleProvisioningStateActivitiesStored, ModuleProvisioningStateCancelled, ModuleProvisioningStateConnectionTypeImported, ModuleProvisioningStateContentDownloaded, ModuleProvisioningStateContentRetrieved, ModuleProvisioningStateContentStored, ModuleProvisioningStateContentValidated, ModuleProvisioningStateCreated, ModuleProvisioningStateCreating, ModuleProvisioningStateFailed, ModuleProvisioningStateModuleDataStored, ModuleProvisioningStateModuleImportRunbookComplete, ModuleProvisioningStateRunningImportModuleRunbook, ModuleProvisioningStateStartingImportModuleRunbook, ModuleProvisioningStateSucceeded, ModuleProvisioningStateUpdating} -} - -// OperatingSystemType enumerates the values for operating system type. -type OperatingSystemType string - -const ( - // Linux ... - Linux OperatingSystemType = "Linux" - // Windows ... - Windows OperatingSystemType = "Windows" -) - -// PossibleOperatingSystemTypeValues returns an array of possible values for the OperatingSystemType const type. -func PossibleOperatingSystemTypeValues() []OperatingSystemType { - return []OperatingSystemType{Linux, Windows} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Completed ... - Completed ProvisioningState = "Completed" - // Failed ... - Failed ProvisioningState = "Failed" - // Running ... - Running ProvisioningState = "Running" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Completed, Failed, Running} -} - -// RunbookProvisioningState enumerates the values for runbook provisioning state. -type RunbookProvisioningState string - -const ( - // RunbookProvisioningStateSucceeded ... - RunbookProvisioningStateSucceeded RunbookProvisioningState = "Succeeded" -) - -// PossibleRunbookProvisioningStateValues returns an array of possible values for the RunbookProvisioningState const type. -func PossibleRunbookProvisioningStateValues() []RunbookProvisioningState { - return []RunbookProvisioningState{RunbookProvisioningStateSucceeded} -} - -// RunbookState enumerates the values for runbook state. -type RunbookState string - -const ( - // RunbookStateEdit ... - RunbookStateEdit RunbookState = "Edit" - // RunbookStateNew ... - RunbookStateNew RunbookState = "New" - // RunbookStatePublished ... - RunbookStatePublished RunbookState = "Published" -) - -// PossibleRunbookStateValues returns an array of possible values for the RunbookState const type. -func PossibleRunbookStateValues() []RunbookState { - return []RunbookState{RunbookStateEdit, RunbookStateNew, RunbookStatePublished} -} - -// RunbookTypeEnum enumerates the values for runbook type enum. -type RunbookTypeEnum string - -const ( - // Graph ... - Graph RunbookTypeEnum = "Graph" - // GraphPowerShell ... - GraphPowerShell RunbookTypeEnum = "GraphPowerShell" - // GraphPowerShellWorkflow ... - GraphPowerShellWorkflow RunbookTypeEnum = "GraphPowerShellWorkflow" - // PowerShell ... - PowerShell RunbookTypeEnum = "PowerShell" - // PowerShellWorkflow ... - PowerShellWorkflow RunbookTypeEnum = "PowerShellWorkflow" - // Script ... - Script RunbookTypeEnum = "Script" -) - -// PossibleRunbookTypeEnumValues returns an array of possible values for the RunbookTypeEnum const type. -func PossibleRunbookTypeEnumValues() []RunbookTypeEnum { - return []RunbookTypeEnum{Graph, GraphPowerShell, GraphPowerShellWorkflow, PowerShell, PowerShellWorkflow, Script} -} - -// ScheduleDay enumerates the values for schedule day. -type ScheduleDay string - -const ( - // Friday ... - Friday ScheduleDay = "Friday" - // Monday ... - Monday ScheduleDay = "Monday" - // Saturday ... - Saturday ScheduleDay = "Saturday" - // Sunday ... - Sunday ScheduleDay = "Sunday" - // Thursday ... - Thursday ScheduleDay = "Thursday" - // Tuesday ... - Tuesday ScheduleDay = "Tuesday" - // Wednesday ... - Wednesday ScheduleDay = "Wednesday" -) - -// PossibleScheduleDayValues returns an array of possible values for the ScheduleDay const type. -func PossibleScheduleDayValues() []ScheduleDay { - return []ScheduleDay{Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday} -} - -// ScheduleFrequency enumerates the values for schedule frequency. -type ScheduleFrequency string - -const ( - // Day ... - Day ScheduleFrequency = "Day" - // Hour ... - Hour ScheduleFrequency = "Hour" - // Minute The minimum allowed interval for Minute schedules is 15 minutes. - Minute ScheduleFrequency = "Minute" - // Month ... - Month ScheduleFrequency = "Month" - // OneTime ... - OneTime ScheduleFrequency = "OneTime" - // Week ... - Week ScheduleFrequency = "Week" -) - -// PossibleScheduleFrequencyValues returns an array of possible values for the ScheduleFrequency const type. -func PossibleScheduleFrequencyValues() []ScheduleFrequency { - return []ScheduleFrequency{Day, Hour, Minute, Month, OneTime, Week} -} - -// SkuNameEnum enumerates the values for sku name enum. -type SkuNameEnum string - -const ( - // Basic ... - Basic SkuNameEnum = "Basic" - // Free ... - Free SkuNameEnum = "Free" -) - -// PossibleSkuNameEnumValues returns an array of possible values for the SkuNameEnum const type. -func PossibleSkuNameEnumValues() []SkuNameEnum { - return []SkuNameEnum{Basic, Free} -} - -// SourceType enumerates the values for source type. -type SourceType string - -const ( - // GitHub ... - GitHub SourceType = "GitHub" - // VsoGit ... - VsoGit SourceType = "VsoGit" - // VsoTfvc ... - VsoTfvc SourceType = "VsoTfvc" -) - -// PossibleSourceTypeValues returns an array of possible values for the SourceType const type. -func PossibleSourceTypeValues() []SourceType { - return []SourceType{GitHub, VsoGit, VsoTfvc} -} - -// StreamType enumerates the values for stream type. -type StreamType string - -const ( - // StreamTypeError ... - StreamTypeError StreamType = "Error" - // StreamTypeOutput ... - StreamTypeOutput StreamType = "Output" -) - -// PossibleStreamTypeValues returns an array of possible values for the StreamType const type. -func PossibleStreamTypeValues() []StreamType { - return []StreamType{StreamTypeError, StreamTypeOutput} -} - -// SyncType enumerates the values for sync type. -type SyncType string - -const ( - // FullSync ... - FullSync SyncType = "FullSync" - // PartialSync ... - PartialSync SyncType = "PartialSync" -) - -// PossibleSyncTypeValues returns an array of possible values for the SyncType const type. -func PossibleSyncTypeValues() []SyncType { - return []SyncType{FullSync, PartialSync} -} - -// TagOperators enumerates the values for tag operators. -type TagOperators string - -const ( - // TagOperatorsAll ... - TagOperatorsAll TagOperators = "All" - // TagOperatorsAny ... - TagOperatorsAny TagOperators = "Any" -) - -// PossibleTagOperatorsValues returns an array of possible values for the TagOperators const type. -func PossibleTagOperatorsValues() []TagOperators { - return []TagOperators{TagOperatorsAll, TagOperatorsAny} -} - -// TokenType enumerates the values for token type. -type TokenType string - -const ( - // Oauth ... - Oauth TokenType = "Oauth" - // PersonalAccessToken ... - PersonalAccessToken TokenType = "PersonalAccessToken" -) - -// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. -func PossibleTokenTypeValues() []TokenType { - return []TokenType{Oauth, PersonalAccessToken} -} - -// WindowsUpdateClasses enumerates the values for windows update classes. -type WindowsUpdateClasses string - -const ( - // WindowsUpdateClassesCritical ... - WindowsUpdateClassesCritical WindowsUpdateClasses = "Critical" - // WindowsUpdateClassesDefinition ... - WindowsUpdateClassesDefinition WindowsUpdateClasses = "Definition" - // WindowsUpdateClassesFeaturePack ... - WindowsUpdateClassesFeaturePack WindowsUpdateClasses = "FeaturePack" - // WindowsUpdateClassesSecurity ... - WindowsUpdateClassesSecurity WindowsUpdateClasses = "Security" - // WindowsUpdateClassesServicePack ... - WindowsUpdateClassesServicePack WindowsUpdateClasses = "ServicePack" - // WindowsUpdateClassesTools ... - WindowsUpdateClassesTools WindowsUpdateClasses = "Tools" - // WindowsUpdateClassesUnclassified ... - WindowsUpdateClassesUnclassified WindowsUpdateClasses = "Unclassified" - // WindowsUpdateClassesUpdateRollup ... - WindowsUpdateClassesUpdateRollup WindowsUpdateClasses = "UpdateRollup" - // WindowsUpdateClassesUpdates ... - WindowsUpdateClassesUpdates WindowsUpdateClasses = "Updates" -) - -// PossibleWindowsUpdateClassesValues returns an array of possible values for the WindowsUpdateClasses const type. -func PossibleWindowsUpdateClassesValues() []WindowsUpdateClasses { - return []WindowsUpdateClasses{WindowsUpdateClassesCritical, WindowsUpdateClassesDefinition, WindowsUpdateClassesFeaturePack, WindowsUpdateClassesSecurity, WindowsUpdateClassesServicePack, WindowsUpdateClassesTools, WindowsUpdateClassesUnclassified, WindowsUpdateClassesUpdateRollup, WindowsUpdateClassesUpdates} -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/fields.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/fields.go deleted file mode 100644 index f695a854ec63..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/fields.go +++ /dev/null @@ -1,120 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// FieldsClient is the automation Client -type FieldsClient struct { - BaseClient -} - -// NewFieldsClient creates an instance of the FieldsClient client. -func NewFieldsClient(subscriptionID string) FieldsClient { - return NewFieldsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFieldsClientWithBaseURI creates an instance of the FieldsClient 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 NewFieldsClientWithBaseURI(baseURI string, subscriptionID string) FieldsClient { - return FieldsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByType retrieve a list of fields of a given type identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// typeName - the name of type. -func (client FieldsClient) ListByType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FieldsClient.ListByType") - 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("automation.FieldsClient", "ListByType", err.Error()) - } - - req, err := client.ListByTypePreparer(ctx, resourceGroupName, automationAccountName, moduleName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure sending request") - return - } - - result, err = client.ListByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure responding to request") - return - } - - return -} - -// ListByTypePreparer prepares the ListByType request. -func (client FieldsClient) ListByTypePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTypeSender sends the ListByType request. The method will close the -// http.Response Body if it receives an error. -func (client FieldsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTypeResponder handles the response to the ListByType request. The method always -// closes the http.Response Body. -func (client FieldsClient) ListByTypeResponder(resp *http.Response) (result TypeFieldListResult, 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/automation/mgmt/2017-05-15-preview/automation/hybridrunbookworkergroup.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/hybridrunbookworkergroup.go deleted file mode 100644 index 385234a5f13e..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/hybridrunbookworkergroup.go +++ /dev/null @@ -1,423 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// HybridRunbookWorkerGroupClient is the automation Client -type HybridRunbookWorkerGroupClient struct { - BaseClient -} - -// NewHybridRunbookWorkerGroupClient creates an instance of the HybridRunbookWorkerGroupClient client. -func NewHybridRunbookWorkerGroupClient(subscriptionID string) HybridRunbookWorkerGroupClient { - return NewHybridRunbookWorkerGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHybridRunbookWorkerGroupClientWithBaseURI creates an instance of the HybridRunbookWorkerGroupClient 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 NewHybridRunbookWorkerGroupClientWithBaseURI(baseURI string, subscriptionID string) HybridRunbookWorkerGroupClient { - return HybridRunbookWorkerGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete a hybrid runbook worker group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// hybridRunbookWorkerGroupName - the hybrid runbook worker group name -func (client HybridRunbookWorkerGroupClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.HybridRunbookWorkerGroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client HybridRunbookWorkerGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", 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 HybridRunbookWorkerGroupClient) 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 HybridRunbookWorkerGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve a hybrid runbook worker group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// hybridRunbookWorkerGroupName - the hybrid runbook worker group name -func (client HybridRunbookWorkerGroupClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result HybridRunbookWorkerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.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("automation.HybridRunbookWorkerGroupClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client HybridRunbookWorkerGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", 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 HybridRunbookWorkerGroupClient) 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 HybridRunbookWorkerGroupClient) GetResponder(resp *http.Response) (result HybridRunbookWorkerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of hybrid runbook worker groups. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result HybridRunbookWorkerGroupsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.hrwglr.Response.Response != nil { - sc = result.hrwglr.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("automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.hrwglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.hrwglr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.hrwglr.hasNextLink() && result.hrwglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountResponder(resp *http.Response) (result HybridRunbookWorkerGroupsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client HybridRunbookWorkerGroupClient) listByAutomationAccountNextResults(ctx context.Context, lastResults HybridRunbookWorkerGroupsListResult) (result HybridRunbookWorkerGroupsListResult, err error) { - req, err := lastResults.hybridRunbookWorkerGroupsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result HybridRunbookWorkerGroupsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update a hybrid runbook worker group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// hybridRunbookWorkerGroupName - the hybrid runbook worker group name -// parameters - the hybrid runbook worker group -func (client HybridRunbookWorkerGroupClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (result HybridRunbookWorkerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.HybridRunbookWorkerGroupClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client HybridRunbookWorkerGroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", 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 HybridRunbookWorkerGroupClient) 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 HybridRunbookWorkerGroupClient) UpdateResponder(resp *http.Response) (result HybridRunbookWorkerGroup, 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/automation/mgmt/2017-05-15-preview/automation/job.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/job.go deleted file mode 100644 index 725a6b5b0db2..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/job.go +++ /dev/null @@ -1,804 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobClient is the automation Client -type JobClient struct { - BaseClient -} - -// NewJobClient creates an instance of the JobClient client. -func NewJobClient(subscriptionID string) JobClient { - return NewJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobClientWithBaseURI creates an instance of the JobClient 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 NewJobClientWithBaseURI(baseURI string, subscriptionID string) JobClient { - return JobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a job of the runbook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// parameters - the parameters supplied to the create job operation. -// clientRequestID - identifies this specific client request. -func (client JobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, parameters JobCreateParameters, clientRequestID string) (result Job, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobCreateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, jobName, parameters, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client JobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, parameters JobCreateParameters, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) 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 JobClient) CreateResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the job identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result Job, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.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("automation.JobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) 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 JobClient) GetResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetOutput retrieve the job output identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the name of the job to be created. -// clientRequestID - identifies this specific client request. -func (client JobClient) GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.GetOutput") - 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("automation.JobClient", "GetOutput", err.Error()) - } - - req, err := client.GetOutputPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", nil, "Failure preparing request") - return - } - - resp, err := client.GetOutputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure sending request") - return - } - - result, err = client.GetOutputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure responding to request") - return - } - - return -} - -// GetOutputPreparer prepares the GetOutput request. -func (client JobClient) GetOutputPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOutputSender sends the GetOutput request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) GetOutputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetOutputResponder handles the response to the GetOutput request. The method always -// closes the http.Response Body. -func (client JobClient) GetOutputResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRunbookContent retrieve the runbook content of the job identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.GetRunbookContent") - 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("automation.JobClient", "GetRunbookContent", err.Error()) - } - - req, err := client.GetRunbookContentPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetRunbookContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure sending request") - return - } - - result, err = client.GetRunbookContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure responding to request") - return - } - - return -} - -// GetRunbookContentPreparer prepares the GetRunbookContent request. -func (client JobClient) GetRunbookContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetRunbookContentSender sends the GetRunbookContent request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) GetRunbookContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetRunbookContentResponder handles the response to the GetRunbookContent request. The method always -// closes the http.Response Body. -func (client JobClient) GetRunbookContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of jobs. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// clientRequestID - identifies this specific client request. -func (client JobClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result JobListResultV2Page, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.jlrv.Response.Response != nil { - sc = result.jlrv.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("automation.JobClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.jlrv.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.jlrv, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.jlrv.hasNextLink() && result.jlrv.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client JobClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/jobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client JobClient) ListByAutomationAccountResponder(resp *http.Response) (result JobListResultV2, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client JobClient) listByAutomationAccountNextResults(ctx context.Context, lastResults JobListResultV2) (result JobListResultV2, err error) { - req, err := lastResults.jobListResultV2Preparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result JobListResultV2Iterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, clientRequestID) - return -} - -// Resume resume the job identified by jobName. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Resume(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Resume") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Resume", err.Error()) - } - - req, err := client.ResumePreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure responding to request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client JobClient) ResumePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) ResumeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client JobClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop the job identified by jobName. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Stop") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client JobClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client JobClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Suspend suspend the job identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Suspend") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Suspend", err.Error()) - } - - req, err := client.SuspendPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure responding to request") - return - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client JobClient) SuspendPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) SuspendSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client JobClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/jobschedule.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/jobschedule.go deleted file mode 100644 index d21696e53076..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/jobschedule.go +++ /dev/null @@ -1,428 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// JobScheduleClient is the automation Client -type JobScheduleClient struct { - BaseClient -} - -// NewJobScheduleClient creates an instance of the JobScheduleClient client. -func NewJobScheduleClient(subscriptionID string) JobScheduleClient { - return NewJobScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobScheduleClientWithBaseURI creates an instance of the JobScheduleClient 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 NewJobScheduleClientWithBaseURI(baseURI string, subscriptionID string) JobScheduleClient { - return JobScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a job schedule. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobScheduleID - the job schedule name. -// parameters - the parameters supplied to the create job schedule operation. -func (client JobScheduleClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (result JobSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties.Schedule", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobScheduleCreateProperties.Runbook", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.JobScheduleClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, jobScheduleID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client JobScheduleClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", 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 JobScheduleClient) 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 JobScheduleClient) CreateResponder(resp *http.Response) (result JobSchedule, 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 job schedule identified by job schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobScheduleID - the job schedule name. -func (client JobScheduleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobScheduleClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, jobScheduleID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobScheduleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", 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 JobScheduleClient) 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 JobScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the job schedule identified by job schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobScheduleID - the job schedule name. -func (client JobScheduleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result JobSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.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("automation.JobScheduleClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, jobScheduleID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobScheduleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", 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 JobScheduleClient) 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 JobScheduleClient) GetResponder(resp *http.Response) (result JobSchedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of job schedules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client JobScheduleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result JobScheduleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.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("automation.JobScheduleClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client JobScheduleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/jobSchedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client JobScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client JobScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result JobScheduleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client JobScheduleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults JobScheduleListResult) (result JobScheduleListResult, err error) { - req, err := lastResults.jobScheduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobScheduleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result JobScheduleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/jobstream.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/jobstream.go deleted file mode 100644 index 519b6164746a..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/jobstream.go +++ /dev/null @@ -1,262 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobStreamClient is the automation Client -type JobStreamClient struct { - BaseClient -} - -// NewJobStreamClient creates an instance of the JobStreamClient client. -func NewJobStreamClient(subscriptionID string) JobStreamClient { - return NewJobStreamClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobStreamClientWithBaseURI creates an instance of the JobStreamClient 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 NewJobStreamClientWithBaseURI(baseURI string, subscriptionID string) JobStreamClient { - return JobStreamClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the job stream identified by job stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// jobStreamID - the job stream id. -// clientRequestID - identifies this specific client request. -func (client JobStreamClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, jobStreamID string, clientRequestID string) (result JobStream, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamClient.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("automation.JobStreamClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, jobName, jobStreamID, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobStreamClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, jobStreamID string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobStreamClient) 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 JobStreamClient) GetResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByJob retrieve a list of jobs streams identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// filter - the filter to apply on the operation. -// clientRequestID - identifies this specific client request. -func (client JobStreamClient) ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result JobStreamListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamClient.ListByJob") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.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("automation.JobStreamClient", "ListByJob", err.Error()) - } - - result.fn = client.listByJobNextResults - req, err := client.ListByJobPreparer(ctx, resourceGroupName, automationAccountName, jobName, filter, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client JobStreamClient) ListByJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client JobStreamClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client JobStreamClient) ListByJobResponder(resp *http.Response) (result JobStreamListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByJobNextResults retrieves the next set of results, if any. -func (client JobStreamClient) listByJobNextResults(ctx context.Context, lastResults JobStreamListResult) (result JobStreamListResult, err error) { - req, err := lastResults.jobStreamListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "listByJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "listByJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "listByJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobStreamClient) ListByJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result JobStreamListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamClient.ListByJob") - 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.ListByJob(ctx, resourceGroupName, automationAccountName, jobName, filter, clientRequestID) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/keys.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/keys.go deleted file mode 100644 index 3e6fb4e1d3cf..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/keys.go +++ /dev/null @@ -1,116 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// KeysClient is the automation Client -type KeysClient struct { - BaseClient -} - -// NewKeysClient creates an instance of the KeysClient client. -func NewKeysClient(subscriptionID string) KeysClient { - return NewKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewKeysClientWithBaseURI creates an instance of the KeysClient 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 NewKeysClientWithBaseURI(baseURI string, subscriptionID string) KeysClient { - return KeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the automation keys for an account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client KeysClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result KeyListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.ListByAutomationAccount") - 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("automation.KeysClient", "ListByAutomationAccount", err.Error()) - } - - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.KeysClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.KeysClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.KeysClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client KeysClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client KeysClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client KeysClient) ListByAutomationAccountResponder(resp *http.Response) (result KeyListResult, 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/automation/mgmt/2017-05-15-preview/automation/linkedworkspace.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/linkedworkspace.go deleted file mode 100644 index c29cf1ed93bc..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/linkedworkspace.go +++ /dev/null @@ -1,116 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LinkedWorkspaceClient is the automation Client -type LinkedWorkspaceClient struct { - BaseClient -} - -// NewLinkedWorkspaceClient creates an instance of the LinkedWorkspaceClient client. -func NewLinkedWorkspaceClient(subscriptionID string) LinkedWorkspaceClient { - return NewLinkedWorkspaceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLinkedWorkspaceClientWithBaseURI creates an instance of the LinkedWorkspaceClient 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 NewLinkedWorkspaceClientWithBaseURI(baseURI string, subscriptionID string) LinkedWorkspaceClient { - return LinkedWorkspaceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the linked workspace for the account id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client LinkedWorkspaceClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result LinkedWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedWorkspaceClient.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("automation.LinkedWorkspaceClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.LinkedWorkspaceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.LinkedWorkspaceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.LinkedWorkspaceClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LinkedWorkspaceClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/linkedWorkspace", 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 LinkedWorkspaceClient) 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 LinkedWorkspaceClient) GetResponder(resp *http.Response) (result LinkedWorkspace, 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/automation/mgmt/2017-05-15-preview/automation/models.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go deleted file mode 100644 index cff5a3424011..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go +++ /dev/null @@ -1,9874 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "io" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2017-05-15-preview/automation" - -// Account definition of the automation account type. -type Account struct { - autorest.Response `json:"-"` - // AccountProperties - Gets or sets the automation account properties. - *AccountProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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.Etag != nil { - objectMap["etag"] = a.Etag - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - if a.Location != nil { - objectMap["location"] = a.Location - } - 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 "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - a.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - 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 - } - } - } - - return nil -} - -// AccountCreateOrUpdateParameters the parameters supplied to the create or update automation account -// operation. -type AccountCreateOrUpdateParameters struct { - // AccountCreateOrUpdateProperties - Gets or sets account create or update properties. - *AccountCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AccountCreateOrUpdateParameters. -func (acoup AccountCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acoup.AccountCreateOrUpdateProperties != nil { - objectMap["properties"] = acoup.AccountCreateOrUpdateProperties - } - if acoup.Name != nil { - objectMap["name"] = acoup.Name - } - if acoup.Location != nil { - objectMap["location"] = acoup.Location - } - if acoup.Tags != nil { - objectMap["tags"] = acoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountCreateOrUpdateParameters struct. -func (acoup *AccountCreateOrUpdateParameters) 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 accountCreateOrUpdateProperties AccountCreateOrUpdateProperties - err = json.Unmarshal(*v, &accountCreateOrUpdateProperties) - if err != nil { - return err - } - acoup.AccountCreateOrUpdateProperties = &accountCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - acoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - acoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - acoup.Tags = tags - } - } - } - - return nil -} - -// AccountCreateOrUpdateProperties the parameters supplied to the create or update account properties. -type AccountCreateOrUpdateProperties struct { - // Sku - Gets or sets account SKU. - Sku *Sku `json:"sku,omitempty"` -} - -// AccountListResult the response model for the list account operation. -type AccountListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets list of accounts. - Value *[]Account `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - 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 definition of the account property. -type AccountProperties struct { - // Sku - Gets or sets the SKU of account. - Sku *Sku `json:"sku,omitempty"` - // LastModifiedBy - Gets or sets the last modified by. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // State - READ-ONLY; Gets status of account. Possible values include: 'Ok', 'Unavailable', 'Suspended' - State AccountState `json:"state,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Sku != nil { - objectMap["sku"] = ap.Sku - } - if ap.LastModifiedBy != nil { - objectMap["lastModifiedBy"] = ap.LastModifiedBy - } - if ap.Description != nil { - objectMap["description"] = ap.Description - } - return json.Marshal(objectMap) -} - -// AccountUpdateParameters the parameters supplied to the update automation account operation. -type AccountUpdateParameters struct { - // AccountUpdateProperties - Gets or sets account update properties. - *AccountUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.AccountUpdateProperties != nil { - objectMap["properties"] = aup.AccountUpdateProperties - } - if aup.Name != nil { - objectMap["name"] = aup.Name - } - if aup.Location != nil { - objectMap["location"] = aup.Location - } - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - 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 "properties": - if v != nil { - var accountUpdateProperties AccountUpdateProperties - err = json.Unmarshal(*v, &accountUpdateProperties) - if err != nil { - return err - } - aup.AccountUpdateProperties = &accountUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - aup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aup.Tags = tags - } - } - } - - return nil -} - -// AccountUpdateProperties the parameters supplied to the update account properties. -type AccountUpdateProperties struct { - // Sku - Gets or sets account SKU. - Sku *Sku `json:"sku,omitempty"` -} - -// Activity definition of the activity. -type Activity struct { - autorest.Response `json:"-"` - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the name of the activity. - Name *string `json:"name,omitempty"` - // ActivityProperties - Gets or sets the properties of the activity. - *ActivityProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Activity. -func (a Activity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.ID != nil { - objectMap["id"] = a.ID - } - if a.ActivityProperties != nil { - objectMap["properties"] = a.ActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Activity struct. -func (a *Activity) 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 - } - 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 "properties": - if v != nil { - var activityProperties ActivityProperties - err = json.Unmarshal(*v, &activityProperties) - if err != nil { - return err - } - a.ActivityProperties = &activityProperties - } - } - } - - return nil -} - -// ActivityListResult the response model for the list activity operation. -type ActivityListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of activities. - Value *[]Activity `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityListResultIterator provides access to a complete listing of Activity values. -type ActivityListResultIterator struct { - i int - page ActivityListResultPage -} - -// 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 *ActivityListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityListResultIterator.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 *ActivityListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ActivityListResultIterator) 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 ActivityListResultIterator) Response() ActivityListResult { - 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 ActivityListResultIterator) Value() Activity { - if !iter.page.NotDone() { - return Activity{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ActivityListResultIterator type. -func NewActivityListResultIterator(page ActivityListResultPage) ActivityListResultIterator { - return ActivityListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr ActivityListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr ActivityListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// activityListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr ActivityListResult) activityListResultPreparer(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))) -} - -// ActivityListResultPage contains a page of Activity values. -type ActivityListResultPage struct { - fn func(context.Context, ActivityListResult) (ActivityListResult, error) - alr ActivityListResult -} - -// 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 *ActivityListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityListResultPage.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 *ActivityListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ActivityListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ActivityListResultPage) Response() ActivityListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ActivityListResultPage) Values() []Activity { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the ActivityListResultPage type. -func NewActivityListResultPage(cur ActivityListResult, getNextPage func(context.Context, ActivityListResult) (ActivityListResult, error)) ActivityListResultPage { - return ActivityListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// ActivityOutputType definition of the activity output type. -type ActivityOutputType struct { - // Name - Gets or sets the name of the activity output type. - Name *string `json:"name,omitempty"` - // Type - Gets or sets the type of the activity output type. - Type *string `json:"type,omitempty"` -} - -// ActivityParameter definition of the activity parameter. -type ActivityParameter struct { - // Name - Gets or sets the name of the activity parameter. - Name *string `json:"name,omitempty"` - // Type - Gets or sets the type of the activity parameter. - Type *string `json:"type,omitempty"` - // IsMandatory - Gets or sets a Boolean value that indicates true if the parameter is required. If the value is false, the parameter is optional. - IsMandatory *bool `json:"isMandatory,omitempty"` - // IsDynamic - Gets or sets a Boolean value that indicates true if the parameter is dynamic. - IsDynamic *bool `json:"isDynamic,omitempty"` - // Position - Gets or sets the position of the activity parameter. - Position *int64 `json:"position,omitempty"` - // ValueFromPipeline - Gets or sets a Boolean value that indicates true if the parameter can take values from the incoming pipeline objects. This setting is used if the cmdlet must access the complete input object. false indicates that the parameter cannot take values from the complete input object. - ValueFromPipeline *bool `json:"valueFromPipeline,omitempty"` - // ValueFromPipelineByPropertyName - Gets or sets a Boolean value that indicates true if the parameter can be filled from a property of the incoming pipeline object that has the same name as this parameter. false indicates that the parameter cannot be filled from the incoming pipeline object property with the same name. - ValueFromPipelineByPropertyName *bool `json:"valueFromPipelineByPropertyName,omitempty"` - // ValueFromRemainingArguments - Gets or sets a Boolean value that indicates true if the cmdlet parameter accepts all the remaining command-line arguments that are associated with this parameter in the form of an array. false if the cmdlet parameter does not accept all the remaining argument values. - ValueFromRemainingArguments *bool `json:"valueFromRemainingArguments,omitempty"` - // Description - Gets or sets the description of the activity parameter. - Description *string `json:"description,omitempty"` - // ValidationSet - Gets or sets the validation set of activity parameter. - ValidationSet *[]ActivityParameterValidationSet `json:"validationSet,omitempty"` -} - -// ActivityParameterSet definition of the activity parameter set. -type ActivityParameterSet struct { - // Name - Gets or sets the name of the activity parameter set. - Name *string `json:"name,omitempty"` - // Parameters - Gets or sets the parameters of the activity parameter set. - Parameters *[]ActivityParameter `json:"parameters,omitempty"` -} - -// ActivityParameterValidationSet definition of the activity parameter validation set. -type ActivityParameterValidationSet struct { - // MemberValue - Gets or sets the name of the activity parameter validation set member. - MemberValue *string `json:"memberValue,omitempty"` -} - -// ActivityProperties properties of the activity. -type ActivityProperties struct { - // Definition - Gets or sets the user name of the activity. - Definition *string `json:"definition,omitempty"` - // ParameterSets - Gets or sets the parameter sets of the activity. - ParameterSets *[]ActivityParameterSet `json:"parameterSets,omitempty"` - // OutputTypes - Gets or sets the output types of the activity. - OutputTypes *[]ActivityOutputType `json:"outputTypes,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// AdvancedSchedule the properties of the create Advanced Schedule. -type AdvancedSchedule struct { - // WeekDays - Days of the week that the job should execute on. - WeekDays *[]string `json:"weekDays,omitempty"` - // MonthDays - Days of the month that the job should execute on. Must be between 1 and 31. - MonthDays *[]int32 `json:"monthDays,omitempty"` - // MonthlyOccurrences - Occurrences of days within a month. - MonthlyOccurrences *[]AdvancedScheduleMonthlyOccurrence `json:"monthlyOccurrences,omitempty"` -} - -// AdvancedScheduleMonthlyOccurrence the properties of the create advanced schedule monthly occurrence. -type AdvancedScheduleMonthlyOccurrence struct { - // Occurrence - Occurrence of the week within the month. Must be between 1 and 5 - Occurrence *int32 `json:"occurrence,omitempty"` - // Day - Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday. Possible values include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' - Day ScheduleDay `json:"day,omitempty"` -} - -// AgentRegistration definition of the agent registration information type. -type AgentRegistration struct { - autorest.Response `json:"-"` - // DscMetaConfiguration - Gets or sets the dsc meta configuration. - DscMetaConfiguration *string `json:"dscMetaConfiguration,omitempty"` - // Endpoint - Gets or sets the dsc server endpoint. - Endpoint *string `json:"endpoint,omitempty"` - // Keys - Gets or sets the agent registration keys. - Keys *AgentRegistrationKeys `json:"keys,omitempty"` - // ID - Gets or sets the id. - ID *string `json:"id,omitempty"` -} - -// AgentRegistrationKeys definition of the agent registration keys. -type AgentRegistrationKeys struct { - // Primary - Gets or sets the primary key. - Primary *string `json:"primary,omitempty"` - // Secondary - Gets or sets the secondary key. - Secondary *string `json:"secondary,omitempty"` -} - -// AgentRegistrationRegenerateKeyParameter the parameters supplied to the regenerate keys operation. -type AgentRegistrationRegenerateKeyParameter struct { - // KeyName - Gets or sets the agent registration key name - primary or secondary. Possible values include: 'Primary', 'Secondary' - KeyName AgentRegistrationKeyName `json:"keyName,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AgentRegistrationRegenerateKeyParameter. -func (arrkp AgentRegistrationRegenerateKeyParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrkp.KeyName != "" { - objectMap["keyName"] = arrkp.KeyName - } - if arrkp.Name != nil { - objectMap["name"] = arrkp.Name - } - if arrkp.Location != nil { - objectMap["location"] = arrkp.Location - } - if arrkp.Tags != nil { - objectMap["tags"] = arrkp.Tags - } - return json.Marshal(objectMap) -} - -// AzureQueryProperties azure query for the update configuration. -type AzureQueryProperties struct { - // Scope - List of Subscription or Resource Group ARM Ids. - Scope *[]string `json:"scope,omitempty"` - // Locations - List of locations to scope the query to. - Locations *[]string `json:"locations,omitempty"` - // TagSettings - Tag settings for the VM. - TagSettings *TagSettingsProperties `json:"tagSettings,omitempty"` -} - -// Certificate definition of the certificate. -type Certificate struct { - autorest.Response `json:"-"` - // CertificateProperties - Gets or sets the properties of the certificate. - *CertificateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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 - } - } - } - - return nil -} - -// CertificateCreateOrUpdateParameters the parameters supplied to the create or update or replace -// certificate operation. -type CertificateCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the certificate. - Name *string `json:"name,omitempty"` - // CertificateCreateOrUpdateProperties - Gets or sets the properties of the certificate. - *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateCreateOrUpdateParameters. -func (ccoup CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Name != nil { - objectMap["name"] = ccoup.Name - } - 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 "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ccoup.Name = &name - } - case "properties": - if v != nil { - var certificateCreateOrUpdateProperties CertificateCreateOrUpdateProperties - err = json.Unmarshal(*v, &certificateCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.CertificateCreateOrUpdateProperties = &certificateCreateOrUpdateProperties - } - } - } - - return nil -} - -// CertificateCreateOrUpdateProperties the properties of the create certificate operation. -type CertificateCreateOrUpdateProperties struct { - // Base64Value - Gets or sets the base64 encoded value of the certificate. - Base64Value *string `json:"base64Value,omitempty"` - // Description - Gets or sets the description of the certificate. - Description *string `json:"description,omitempty"` - // Thumbprint - Gets or sets the thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // IsExportable - Gets or sets the is exportable flag of the certificate. - IsExportable *bool `json:"isExportable,omitempty"` -} - -// CertificateListResult the response model for the list certificate operation. -type CertificateListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of certificates. - Value *[]Certificate `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateListResultIterator provides access to a complete listing of Certificate values. -type CertificateListResultIterator struct { - i int - page CertificateListResultPage -} - -// 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 *CertificateListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultIterator.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 *CertificateListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CertificateListResultIterator) 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 CertificateListResultIterator) Response() CertificateListResult { - 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 CertificateListResultIterator) Value() Certificate { - if !iter.page.NotDone() { - return Certificate{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CertificateListResultIterator type. -func NewCertificateListResultIterator(page CertificateListResultPage) CertificateListResultIterator { - return CertificateListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr CertificateListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr CertificateListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// certificateListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr CertificateListResult) certificateListResultPreparer(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))) -} - -// CertificateListResultPage contains a page of Certificate values. -type CertificateListResultPage struct { - fn func(context.Context, CertificateListResult) (CertificateListResult, error) - clr CertificateListResult -} - -// 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 *CertificateListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultPage.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 *CertificateListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CertificateListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CertificateListResultPage) Response() CertificateListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CertificateListResultPage) Values() []Certificate { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the CertificateListResultPage type. -func NewCertificateListResultPage(cur CertificateListResult, getNextPage func(context.Context, CertificateListResult) (CertificateListResult, error)) CertificateListResultPage { - return CertificateListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// CertificateProperties properties of the certificate. -type CertificateProperties struct { - // Thumbprint - READ-ONLY; Gets the thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // ExpiryTime - READ-ONLY; Gets the expiry time of the certificate. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // IsExportable - READ-ONLY; Gets the is exportable flag of the certificate. - IsExportable *bool `json:"isExportable,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateProperties. -func (cp CertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Description != nil { - objectMap["description"] = cp.Description - } - return json.Marshal(objectMap) -} - -// CertificateUpdateParameters the parameters supplied to the update certificate operation. -type CertificateUpdateParameters struct { - // Name - Gets or sets the name of the certificate. - Name *string `json:"name,omitempty"` - // CertificateUpdateProperties - Gets or sets the properties of the certificate. - *CertificateUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateUpdateParameters. -func (cup CertificateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Name != nil { - objectMap["name"] = cup.Name - } - if cup.CertificateUpdateProperties != nil { - objectMap["properties"] = cup.CertificateUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateUpdateParameters struct. -func (cup *CertificateUpdateParameters) 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 - } - cup.Name = &name - } - case "properties": - if v != nil { - var certificateUpdateProperties CertificateUpdateProperties - err = json.Unmarshal(*v, &certificateUpdateProperties) - if err != nil { - return err - } - cup.CertificateUpdateProperties = &certificateUpdateProperties - } - } - } - - return nil -} - -// CertificateUpdateProperties the properties of the update certificate operation -type CertificateUpdateProperties struct { - // Description - Gets or sets the description of the certificate. - Description *string `json:"description,omitempty"` -} - -// CollectionItemUpdateConfiguration object returned when requesting a collection of software update -// configuration -type CollectionItemUpdateConfiguration struct { - // AzureVirtualMachines - List of azure resource Ids for azure virtual machines targeted by the software update configuration. - AzureVirtualMachines *[]string `json:"azureVirtualMachines,omitempty"` - // Duration - Maximum time allowed for the software update configuration run. Duration needs to be specified using the format PT[n]H[n]M[n]S as per ISO8601 - Duration *string `json:"duration,omitempty"` -} - -// Connection definition of the connection. -type Connection struct { - autorest.Response `json:"-"` - // ConnectionProperties - Gets or sets the properties of the connection. - *ConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Connection. -func (c Connection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ConnectionProperties != nil { - objectMap["properties"] = c.ConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Connection struct. -func (c *Connection) 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 connectionProperties ConnectionProperties - err = json.Unmarshal(*v, &connectionProperties) - if err != nil { - return err - } - c.ConnectionProperties = &connectionProperties - } - 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 - } - } - } - - return nil -} - -// ConnectionCreateOrUpdateParameters the parameters supplied to the create or update connection operation. -type ConnectionCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the connection. - Name *string `json:"name,omitempty"` - // ConnectionCreateOrUpdateProperties - Gets or sets the properties of the connection. - *ConnectionCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionCreateOrUpdateParameters. -func (ccoup ConnectionCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Name != nil { - objectMap["name"] = ccoup.Name - } - if ccoup.ConnectionCreateOrUpdateProperties != nil { - objectMap["properties"] = ccoup.ConnectionCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionCreateOrUpdateParameters struct. -func (ccoup *ConnectionCreateOrUpdateParameters) 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 - } - ccoup.Name = &name - } - case "properties": - if v != nil { - var connectionCreateOrUpdateProperties ConnectionCreateOrUpdateProperties - err = json.Unmarshal(*v, &connectionCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.ConnectionCreateOrUpdateProperties = &connectionCreateOrUpdateProperties - } - } - } - - return nil -} - -// ConnectionCreateOrUpdateProperties the properties of the create connection properties -type ConnectionCreateOrUpdateProperties struct { - // Description - Gets or sets the description of the connection. - Description *string `json:"description,omitempty"` - // ConnectionType - Gets or sets the connectionType of the connection. - ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` - // FieldDefinitionValues - Gets or sets the field definition properties of the connection. - FieldDefinitionValues map[string]*string `json:"fieldDefinitionValues"` -} - -// MarshalJSON is the custom marshaler for ConnectionCreateOrUpdateProperties. -func (ccoup ConnectionCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Description != nil { - objectMap["description"] = ccoup.Description - } - if ccoup.ConnectionType != nil { - objectMap["connectionType"] = ccoup.ConnectionType - } - if ccoup.FieldDefinitionValues != nil { - objectMap["fieldDefinitionValues"] = ccoup.FieldDefinitionValues - } - return json.Marshal(objectMap) -} - -// ConnectionListResult the response model for the list connection operation. -type ConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of connection. - Value *[]Connection `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectionListResultIterator provides access to a complete listing of Connection values. -type ConnectionListResultIterator struct { - i int - page ConnectionListResultPage -} - -// 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 *ConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionListResultIterator.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 *ConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectionListResultIterator) 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 ConnectionListResultIterator) Response() ConnectionListResult { - 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 ConnectionListResultIterator) Value() Connection { - if !iter.page.NotDone() { - return Connection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectionListResultIterator type. -func NewConnectionListResultIterator(page ConnectionListResultPage) ConnectionListResultIterator { - return ConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr ConnectionListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr ConnectionListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// connectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr ConnectionListResult) connectionListResultPreparer(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))) -} - -// ConnectionListResultPage contains a page of Connection values. -type ConnectionListResultPage struct { - fn func(context.Context, ConnectionListResult) (ConnectionListResult, error) - clr ConnectionListResult -} - -// 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 *ConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionListResultPage.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 *ConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectionListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectionListResultPage) Response() ConnectionListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectionListResultPage) Values() []Connection { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the ConnectionListResultPage type. -func NewConnectionListResultPage(cur ConnectionListResult, getNextPage func(context.Context, ConnectionListResult) (ConnectionListResult, error)) ConnectionListResultPage { - return ConnectionListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// ConnectionProperties definition of the connection properties. -type ConnectionProperties struct { - // ConnectionType - Gets or sets the connectionType of the connection. - ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` - // FieldDefinitionValues - READ-ONLY; Gets the field definition values of the connection. - FieldDefinitionValues map[string]*string `json:"fieldDefinitionValues"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionProperties. -func (cp ConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.ConnectionType != nil { - objectMap["connectionType"] = cp.ConnectionType - } - if cp.Description != nil { - objectMap["description"] = cp.Description - } - return json.Marshal(objectMap) -} - -// ConnectionType definition of the connection type. -type ConnectionType struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Gets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the name of the connection type. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // ConnectionTypeProperties - Gets or sets the properties of the connection type. - *ConnectionTypeProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionType. -func (ct ConnectionType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ct.ConnectionTypeProperties != nil { - objectMap["properties"] = ct.ConnectionTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionType struct. -func (ct *ConnectionType) 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 - } - ct.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ct.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ct.Type = &typeVar - } - case "properties": - if v != nil { - var connectionTypeProperties ConnectionTypeProperties - err = json.Unmarshal(*v, &connectionTypeProperties) - if err != nil { - return err - } - ct.ConnectionTypeProperties = &connectionTypeProperties - } - } - } - - return nil -} - -// ConnectionTypeAssociationProperty the connection type property associated with the entity. -type ConnectionTypeAssociationProperty struct { - // Name - Gets or sets the name of the connection type. - Name *string `json:"name,omitempty"` -} - -// ConnectionTypeCreateOrUpdateParameters the parameters supplied to the create or update connection type -// operation. -type ConnectionTypeCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the connection type. - Name *string `json:"name,omitempty"` - // ConnectionTypeCreateOrUpdateProperties - Gets or sets the value of the connection type. - *ConnectionTypeCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionTypeCreateOrUpdateParameters. -func (ctcoup ConnectionTypeCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcoup.Name != nil { - objectMap["name"] = ctcoup.Name - } - if ctcoup.ConnectionTypeCreateOrUpdateProperties != nil { - objectMap["properties"] = ctcoup.ConnectionTypeCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionTypeCreateOrUpdateParameters struct. -func (ctcoup *ConnectionTypeCreateOrUpdateParameters) 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 - } - ctcoup.Name = &name - } - case "properties": - if v != nil { - var connectionTypeCreateOrUpdateProperties ConnectionTypeCreateOrUpdateProperties - err = json.Unmarshal(*v, &connectionTypeCreateOrUpdateProperties) - if err != nil { - return err - } - ctcoup.ConnectionTypeCreateOrUpdateProperties = &connectionTypeCreateOrUpdateProperties - } - } - } - - return nil -} - -// ConnectionTypeCreateOrUpdateProperties the properties of the create connection type. -type ConnectionTypeCreateOrUpdateProperties struct { - // IsGlobal - Gets or sets a Boolean value to indicate if the connection type is global. - IsGlobal *bool `json:"isGlobal,omitempty"` - // FieldDefinitions - Gets or sets the field definitions of the connection type. - FieldDefinitions map[string]*FieldDefinition `json:"fieldDefinitions"` -} - -// MarshalJSON is the custom marshaler for ConnectionTypeCreateOrUpdateProperties. -func (ctcoup ConnectionTypeCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcoup.IsGlobal != nil { - objectMap["isGlobal"] = ctcoup.IsGlobal - } - if ctcoup.FieldDefinitions != nil { - objectMap["fieldDefinitions"] = ctcoup.FieldDefinitions - } - return json.Marshal(objectMap) -} - -// ConnectionTypeListResult the response model for the list connection type operation. -type ConnectionTypeListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of connection types. - Value *[]ConnectionType `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectionTypeListResultIterator provides access to a complete listing of ConnectionType values. -type ConnectionTypeListResultIterator struct { - i int - page ConnectionTypeListResultPage -} - -// 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 *ConnectionTypeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeListResultIterator.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 *ConnectionTypeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectionTypeListResultIterator) 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 ConnectionTypeListResultIterator) Response() ConnectionTypeListResult { - 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 ConnectionTypeListResultIterator) Value() ConnectionType { - if !iter.page.NotDone() { - return ConnectionType{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectionTypeListResultIterator type. -func NewConnectionTypeListResultIterator(page ConnectionTypeListResultPage) ConnectionTypeListResultIterator { - return ConnectionTypeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ctlr ConnectionTypeListResult) IsEmpty() bool { - return ctlr.Value == nil || len(*ctlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ctlr ConnectionTypeListResult) hasNextLink() bool { - return ctlr.NextLink != nil && len(*ctlr.NextLink) != 0 -} - -// connectionTypeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ctlr ConnectionTypeListResult) connectionTypeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ctlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ctlr.NextLink))) -} - -// ConnectionTypeListResultPage contains a page of ConnectionType values. -type ConnectionTypeListResultPage struct { - fn func(context.Context, ConnectionTypeListResult) (ConnectionTypeListResult, error) - ctlr ConnectionTypeListResult -} - -// 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 *ConnectionTypeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeListResultPage.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.ctlr) - if err != nil { - return err - } - page.ctlr = 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 *ConnectionTypeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectionTypeListResultPage) NotDone() bool { - return !page.ctlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectionTypeListResultPage) Response() ConnectionTypeListResult { - return page.ctlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectionTypeListResultPage) Values() []ConnectionType { - if page.ctlr.IsEmpty() { - return nil - } - return *page.ctlr.Value -} - -// Creates a new instance of the ConnectionTypeListResultPage type. -func NewConnectionTypeListResultPage(cur ConnectionTypeListResult, getNextPage func(context.Context, ConnectionTypeListResult) (ConnectionTypeListResult, error)) ConnectionTypeListResultPage { - return ConnectionTypeListResultPage{ - fn: getNextPage, - ctlr: cur, - } -} - -// ConnectionTypeProperties properties of the connection type. -type ConnectionTypeProperties struct { - // IsGlobal - Gets or sets a Boolean value to indicate if the connection type is global. - IsGlobal *bool `json:"isGlobal,omitempty"` - // FieldDefinitions - READ-ONLY; Gets the field definitions of the connection type. - FieldDefinitions map[string]*FieldDefinition `json:"fieldDefinitions"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionTypeProperties. -func (ctp ConnectionTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctp.IsGlobal != nil { - objectMap["isGlobal"] = ctp.IsGlobal - } - if ctp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = ctp.LastModifiedTime - } - if ctp.Description != nil { - objectMap["description"] = ctp.Description - } - return json.Marshal(objectMap) -} - -// ConnectionUpdateParameters the parameters supplied to the update connection operation. -type ConnectionUpdateParameters struct { - // Name - Gets or sets the name of the connection. - Name *string `json:"name,omitempty"` - // ConnectionUpdateProperties - Gets or sets the properties of the connection. - *ConnectionUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionUpdateParameters. -func (cup ConnectionUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Name != nil { - objectMap["name"] = cup.Name - } - if cup.ConnectionUpdateProperties != nil { - objectMap["properties"] = cup.ConnectionUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionUpdateParameters struct. -func (cup *ConnectionUpdateParameters) 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 - } - cup.Name = &name - } - case "properties": - if v != nil { - var connectionUpdateProperties ConnectionUpdateProperties - err = json.Unmarshal(*v, &connectionUpdateProperties) - if err != nil { - return err - } - cup.ConnectionUpdateProperties = &connectionUpdateProperties - } - } - } - - return nil -} - -// ConnectionUpdateProperties the properties of the update connection operation. -type ConnectionUpdateProperties struct { - // Description - Gets or sets the description of the connection. - Description *string `json:"description,omitempty"` - // FieldDefinitionValues - Gets or sets the field definition values of the connection. - FieldDefinitionValues map[string]*string `json:"fieldDefinitionValues"` -} - -// MarshalJSON is the custom marshaler for ConnectionUpdateProperties. -func (cup ConnectionUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Description != nil { - objectMap["description"] = cup.Description - } - if cup.FieldDefinitionValues != nil { - objectMap["fieldDefinitionValues"] = cup.FieldDefinitionValues - } - return json.Marshal(objectMap) -} - -// ContentHash definition of the runbook property type. -type ContentHash struct { - // Algorithm - Gets or sets the content hash algorithm used to hash the content. - Algorithm *string `json:"algorithm,omitempty"` - // Value - Gets or sets expected hash value of the content. - Value *string `json:"value,omitempty"` -} - -// ContentLink definition of the content link. -type ContentLink struct { - // URI - Gets or sets the uri of the runbook content. - URI *string `json:"uri,omitempty"` - // ContentHash - Gets or sets the hash. - ContentHash *ContentHash `json:"contentHash,omitempty"` - // Version - Gets or sets the version of the content. - Version *string `json:"version,omitempty"` -} - -// ContentSource definition of the content source. -type ContentSource struct { - // Hash - Gets or sets the hash. - Hash *ContentHash `json:"hash,omitempty"` - // Type - Gets or sets the content source type. Possible values include: 'EmbeddedContent', 'URI' - Type ContentSourceType `json:"type,omitempty"` - // Value - Gets or sets the value of the content. This is based on the content source type. - Value *string `json:"value,omitempty"` - // Version - Gets or sets the version of the content. - Version *string `json:"version,omitempty"` -} - -// Credential definition of the credential. -type Credential struct { - autorest.Response `json:"-"` - // CredentialProperties - Gets or sets the properties of the credential. - *CredentialProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Credential. -func (c Credential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.CredentialProperties != nil { - objectMap["properties"] = c.CredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Credential struct. -func (c *Credential) 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 credentialProperties CredentialProperties - err = json.Unmarshal(*v, &credentialProperties) - if err != nil { - return err - } - c.CredentialProperties = &credentialProperties - } - 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 - } - } - } - - return nil -} - -// CredentialCreateOrUpdateParameters the parameters supplied to the create or update credential operation. -type CredentialCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the credential. - Name *string `json:"name,omitempty"` - // CredentialCreateOrUpdateProperties - Gets or sets the properties of the credential. - *CredentialCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialCreateOrUpdateParameters. -func (ccoup CredentialCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Name != nil { - objectMap["name"] = ccoup.Name - } - if ccoup.CredentialCreateOrUpdateProperties != nil { - objectMap["properties"] = ccoup.CredentialCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CredentialCreateOrUpdateParameters struct. -func (ccoup *CredentialCreateOrUpdateParameters) 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 - } - ccoup.Name = &name - } - case "properties": - if v != nil { - var credentialCreateOrUpdateProperties CredentialCreateOrUpdateProperties - err = json.Unmarshal(*v, &credentialCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.CredentialCreateOrUpdateProperties = &credentialCreateOrUpdateProperties - } - } - } - - return nil -} - -// CredentialCreateOrUpdateProperties the properties of the create credential operation. -type CredentialCreateOrUpdateProperties struct { - // UserName - Gets or sets the user name of the credential. - UserName *string `json:"userName,omitempty"` - // Password - Gets or sets the password of the credential. - Password *string `json:"password,omitempty"` - // Description - Gets or sets the description of the credential. - Description *string `json:"description,omitempty"` -} - -// CredentialListResult the response model for the list credential operation. -type CredentialListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of credentials. - Value *[]Credential `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// CredentialListResultIterator provides access to a complete listing of Credential values. -type CredentialListResultIterator struct { - i int - page CredentialListResultPage -} - -// 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 *CredentialListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialListResultIterator.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 *CredentialListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CredentialListResultIterator) 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 CredentialListResultIterator) Response() CredentialListResult { - 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 CredentialListResultIterator) Value() Credential { - if !iter.page.NotDone() { - return Credential{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CredentialListResultIterator type. -func NewCredentialListResultIterator(page CredentialListResultPage) CredentialListResultIterator { - return CredentialListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr CredentialListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr CredentialListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// credentialListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr CredentialListResult) credentialListResultPreparer(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))) -} - -// CredentialListResultPage contains a page of Credential values. -type CredentialListResultPage struct { - fn func(context.Context, CredentialListResult) (CredentialListResult, error) - clr CredentialListResult -} - -// 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 *CredentialListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialListResultPage.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 *CredentialListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CredentialListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CredentialListResultPage) Response() CredentialListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CredentialListResultPage) Values() []Credential { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the CredentialListResultPage type. -func NewCredentialListResultPage(cur CredentialListResult, getNextPage func(context.Context, CredentialListResult) (CredentialListResult, error)) CredentialListResultPage { - return CredentialListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// CredentialProperties definition of the credential properties -type CredentialProperties struct { - // UserName - READ-ONLY; Gets the user name of the credential. - UserName *string `json:"userName,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialProperties. -func (cp CredentialProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Description != nil { - objectMap["description"] = cp.Description - } - return json.Marshal(objectMap) -} - -// CredentialUpdateParameters the parameters supplied to the Update credential operation. -type CredentialUpdateParameters struct { - // Name - Gets or sets the name of the credential. - Name *string `json:"name,omitempty"` - // CredentialUpdateProperties - Gets or sets the properties of the variable. - *CredentialUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialUpdateParameters. -func (cup CredentialUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Name != nil { - objectMap["name"] = cup.Name - } - if cup.CredentialUpdateProperties != nil { - objectMap["properties"] = cup.CredentialUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CredentialUpdateParameters struct. -func (cup *CredentialUpdateParameters) 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 - } - cup.Name = &name - } - case "properties": - if v != nil { - var credentialUpdateProperties CredentialUpdateProperties - err = json.Unmarshal(*v, &credentialUpdateProperties) - if err != nil { - return err - } - cup.CredentialUpdateProperties = &credentialUpdateProperties - } - } - } - - return nil -} - -// CredentialUpdateProperties the properties of the Update credential -type CredentialUpdateProperties struct { - // UserName - Gets or sets the user name of the credential. - UserName *string `json:"userName,omitempty"` - // Password - Gets or sets the password of the credential. - Password *string `json:"password,omitempty"` - // Description - Gets or sets the description of the credential. - Description *string `json:"description,omitempty"` -} - -// DscCompilationJob definition of the Dsc Compilation job. -type DscCompilationJob struct { - autorest.Response `json:"-"` - // DscCompilationJobProperties - Gets or sets the properties of the Dsc Compilation job. - *DscCompilationJobProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJob. -func (dcj DscCompilationJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcj.DscCompilationJobProperties != nil { - objectMap["properties"] = dcj.DscCompilationJobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscCompilationJob struct. -func (dcj *DscCompilationJob) 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 dscCompilationJobProperties DscCompilationJobProperties - err = json.Unmarshal(*v, &dscCompilationJobProperties) - if err != nil { - return err - } - dcj.DscCompilationJobProperties = &dscCompilationJobProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcj.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcj.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcj.Type = &typeVar - } - } - } - - return nil -} - -// DscCompilationJobCreateParameters the parameters supplied to the create compilation job operation. -type DscCompilationJobCreateParameters struct { - // DscCompilationJobCreateProperties - Gets or sets the list of compilation job properties. - *DscCompilationJobCreateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJobCreateParameters. -func (dcjcp DscCompilationJobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcjcp.DscCompilationJobCreateProperties != nil { - objectMap["properties"] = dcjcp.DscCompilationJobCreateProperties - } - if dcjcp.Name != nil { - objectMap["name"] = dcjcp.Name - } - if dcjcp.Location != nil { - objectMap["location"] = dcjcp.Location - } - if dcjcp.Tags != nil { - objectMap["tags"] = dcjcp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscCompilationJobCreateParameters struct. -func (dcjcp *DscCompilationJobCreateParameters) 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 dscCompilationJobCreateProperties DscCompilationJobCreateProperties - err = json.Unmarshal(*v, &dscCompilationJobCreateProperties) - if err != nil { - return err - } - dcjcp.DscCompilationJobCreateProperties = &dscCompilationJobCreateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcjcp.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dcjcp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcjcp.Tags = tags - } - } - } - - return nil -} - -// DscCompilationJobCreateProperties the parameters supplied to the create compilation job operation. -type DscCompilationJobCreateProperties struct { - // Configuration - Gets or sets the configuration. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // IncrementNodeConfigurationBuild - If a new build version of NodeConfiguration is required. - IncrementNodeConfigurationBuild *bool `json:"incrementNodeConfigurationBuild,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJobCreateProperties. -func (dcjcp DscCompilationJobCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcjcp.Configuration != nil { - objectMap["configuration"] = dcjcp.Configuration - } - if dcjcp.Parameters != nil { - objectMap["parameters"] = dcjcp.Parameters - } - if dcjcp.IncrementNodeConfigurationBuild != nil { - objectMap["incrementNodeConfigurationBuild"] = dcjcp.IncrementNodeConfigurationBuild - } - return json.Marshal(objectMap) -} - -// DscCompilationJobListResult the response model for the list job operation. -type DscCompilationJobListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of Dsc Compilation jobs. - Value *[]DscCompilationJob `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// DscCompilationJobListResultIterator provides access to a complete listing of DscCompilationJob values. -type DscCompilationJobListResultIterator struct { - i int - page DscCompilationJobListResultPage -} - -// 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 *DscCompilationJobListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobListResultIterator.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 *DscCompilationJobListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscCompilationJobListResultIterator) 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 DscCompilationJobListResultIterator) Response() DscCompilationJobListResult { - 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 DscCompilationJobListResultIterator) Value() DscCompilationJob { - if !iter.page.NotDone() { - return DscCompilationJob{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscCompilationJobListResultIterator type. -func NewDscCompilationJobListResultIterator(page DscCompilationJobListResultPage) DscCompilationJobListResultIterator { - return DscCompilationJobListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dcjlr DscCompilationJobListResult) IsEmpty() bool { - return dcjlr.Value == nil || len(*dcjlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dcjlr DscCompilationJobListResult) hasNextLink() bool { - return dcjlr.NextLink != nil && len(*dcjlr.NextLink) != 0 -} - -// dscCompilationJobListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dcjlr DscCompilationJobListResult) dscCompilationJobListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dcjlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dcjlr.NextLink))) -} - -// DscCompilationJobListResultPage contains a page of DscCompilationJob values. -type DscCompilationJobListResultPage struct { - fn func(context.Context, DscCompilationJobListResult) (DscCompilationJobListResult, error) - dcjlr DscCompilationJobListResult -} - -// 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 *DscCompilationJobListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobListResultPage.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.dcjlr) - if err != nil { - return err - } - page.dcjlr = 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 *DscCompilationJobListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscCompilationJobListResultPage) NotDone() bool { - return !page.dcjlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscCompilationJobListResultPage) Response() DscCompilationJobListResult { - return page.dcjlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscCompilationJobListResultPage) Values() []DscCompilationJob { - if page.dcjlr.IsEmpty() { - return nil - } - return *page.dcjlr.Value -} - -// Creates a new instance of the DscCompilationJobListResultPage type. -func NewDscCompilationJobListResultPage(cur DscCompilationJobListResult, getNextPage func(context.Context, DscCompilationJobListResult) (DscCompilationJobListResult, error)) DscCompilationJobListResultPage { - return DscCompilationJobListResultPage{ - fn: getNextPage, - dcjlr: cur, - } -} - -// DscCompilationJobProperties definition of Dsc Compilation job properties. -type DscCompilationJobProperties struct { - // Configuration - Gets or sets the configuration. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // StartedBy - READ-ONLY; Gets the compilation job started by. - StartedBy *string `json:"startedBy,omitempty"` - // JobID - READ-ONLY; Gets the id of the job. - JobID *uuid.UUID `json:"jobId,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - The current provisioning state of the job. Possible values include: 'JobProvisioningStateFailed', 'JobProvisioningStateSucceeded', 'JobProvisioningStateSuspended', 'JobProvisioningStateProcessing' - ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` - // Status - Gets or sets the status of the job. Possible values include: 'JobStatusNew', 'JobStatusActivating', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusStopped', 'JobStatusBlocked', 'JobStatusSuspended', 'JobStatusDisconnected', 'JobStatusSuspending', 'JobStatusStopping', 'JobStatusResuming', 'JobStatusRemoving' - Status JobStatus `json:"status,omitempty"` - // StatusDetails - Gets or sets the status details of the job. - StatusDetails *string `json:"statusDetails,omitempty"` - // StartTime - READ-ONLY; Gets the start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // Exception - READ-ONLY; Gets the exception of the job. - Exception *string `json:"exception,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time of the job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastStatusModifiedTime - READ-ONLY; Gets the last status modified time of the job. - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJobProperties. -func (dcjp DscCompilationJobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcjp.Configuration != nil { - objectMap["configuration"] = dcjp.Configuration - } - if dcjp.ProvisioningState != "" { - objectMap["provisioningState"] = dcjp.ProvisioningState - } - if dcjp.RunOn != nil { - objectMap["runOn"] = dcjp.RunOn - } - if dcjp.Status != "" { - objectMap["status"] = dcjp.Status - } - if dcjp.StatusDetails != nil { - objectMap["statusDetails"] = dcjp.StatusDetails - } - if dcjp.Parameters != nil { - objectMap["parameters"] = dcjp.Parameters - } - return json.Marshal(objectMap) -} - -// DscConfiguration definition of the configuration type. -type DscConfiguration struct { - autorest.Response `json:"-"` - // DscConfigurationProperties - Gets or sets the configuration properties. - *DscConfigurationProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscConfiguration. -func (dc DscConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dc.DscConfigurationProperties != nil { - objectMap["properties"] = dc.DscConfigurationProperties - } - if dc.Etag != nil { - objectMap["etag"] = dc.Etag - } - if dc.Tags != nil { - objectMap["tags"] = dc.Tags - } - if dc.Location != nil { - objectMap["location"] = dc.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscConfiguration struct. -func (dc *DscConfiguration) 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 dscConfigurationProperties DscConfigurationProperties - err = json.Unmarshal(*v, &dscConfigurationProperties) - if err != nil { - return err - } - dc.DscConfigurationProperties = &dscConfigurationProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dc.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dc.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dc.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dc.Type = &typeVar - } - } - } - - return nil -} - -// DscConfigurationAssociationProperty the Dsc configuration property associated with the entity. -type DscConfigurationAssociationProperty struct { - // Name - Gets or sets the name of the Dsc configuration. - Name *string `json:"name,omitempty"` -} - -// DscConfigurationCreateOrUpdateParameters the parameters supplied to the create or update configuration -// operation. -type DscConfigurationCreateOrUpdateParameters struct { - // DscConfigurationCreateOrUpdateProperties - Gets or sets configuration create or update properties. - *DscConfigurationCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationCreateOrUpdateParameters. -func (dccoup DscConfigurationCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dccoup.DscConfigurationCreateOrUpdateProperties != nil { - objectMap["properties"] = dccoup.DscConfigurationCreateOrUpdateProperties - } - if dccoup.Name != nil { - objectMap["name"] = dccoup.Name - } - if dccoup.Location != nil { - objectMap["location"] = dccoup.Location - } - if dccoup.Tags != nil { - objectMap["tags"] = dccoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscConfigurationCreateOrUpdateParameters struct. -func (dccoup *DscConfigurationCreateOrUpdateParameters) 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 dscConfigurationCreateOrUpdateProperties DscConfigurationCreateOrUpdateProperties - err = json.Unmarshal(*v, &dscConfigurationCreateOrUpdateProperties) - if err != nil { - return err - } - dccoup.DscConfigurationCreateOrUpdateProperties = &dscConfigurationCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dccoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dccoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dccoup.Tags = tags - } - } - } - - return nil -} - -// DscConfigurationCreateOrUpdateProperties the properties to create or update configuration. -type DscConfigurationCreateOrUpdateProperties struct { - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // Source - Gets or sets the source. - Source *ContentSource `json:"source,omitempty"` - // Parameters - Gets or sets the configuration parameters. - Parameters map[string]*DscConfigurationParameter `json:"parameters"` - // Description - Gets or sets the description of the configuration. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationCreateOrUpdateProperties. -func (dccoup DscConfigurationCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dccoup.LogVerbose != nil { - objectMap["logVerbose"] = dccoup.LogVerbose - } - if dccoup.LogProgress != nil { - objectMap["logProgress"] = dccoup.LogProgress - } - if dccoup.Source != nil { - objectMap["source"] = dccoup.Source - } - if dccoup.Parameters != nil { - objectMap["parameters"] = dccoup.Parameters - } - if dccoup.Description != nil { - objectMap["description"] = dccoup.Description - } - return json.Marshal(objectMap) -} - -// DscConfigurationListResult the response model for the list configuration operation. -type DscConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of configurations. - Value *[]DscConfiguration `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` - // TotalCount - Gets the total number of configurations matching filter criteria. - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// DscConfigurationListResultIterator provides access to a complete listing of DscConfiguration values. -type DscConfigurationListResultIterator struct { - i int - page DscConfigurationListResultPage -} - -// 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 *DscConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationListResultIterator.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 *DscConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscConfigurationListResultIterator) 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 DscConfigurationListResultIterator) Response() DscConfigurationListResult { - 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 DscConfigurationListResultIterator) Value() DscConfiguration { - if !iter.page.NotDone() { - return DscConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscConfigurationListResultIterator type. -func NewDscConfigurationListResultIterator(page DscConfigurationListResultPage) DscConfigurationListResultIterator { - return DscConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dclr DscConfigurationListResult) IsEmpty() bool { - return dclr.Value == nil || len(*dclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dclr DscConfigurationListResult) hasNextLink() bool { - return dclr.NextLink != nil && len(*dclr.NextLink) != 0 -} - -// dscConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dclr DscConfigurationListResult) dscConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dclr.NextLink))) -} - -// DscConfigurationListResultPage contains a page of DscConfiguration values. -type DscConfigurationListResultPage struct { - fn func(context.Context, DscConfigurationListResult) (DscConfigurationListResult, error) - dclr DscConfigurationListResult -} - -// 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 *DscConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationListResultPage.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.dclr) - if err != nil { - return err - } - page.dclr = 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 *DscConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscConfigurationListResultPage) NotDone() bool { - return !page.dclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscConfigurationListResultPage) Response() DscConfigurationListResult { - return page.dclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscConfigurationListResultPage) Values() []DscConfiguration { - if page.dclr.IsEmpty() { - return nil - } - return *page.dclr.Value -} - -// Creates a new instance of the DscConfigurationListResultPage type. -func NewDscConfigurationListResultPage(cur DscConfigurationListResult, getNextPage func(context.Context, DscConfigurationListResult) (DscConfigurationListResult, error)) DscConfigurationListResultPage { - return DscConfigurationListResultPage{ - fn: getNextPage, - dclr: cur, - } -} - -// DscConfigurationParameter definition of the configuration parameter type. -type DscConfigurationParameter struct { - // Type - Gets or sets the type of the parameter. - Type *string `json:"type,omitempty"` - // IsMandatory - Gets or sets a Boolean value to indicate whether the parameter is mandatory or not. - IsMandatory *bool `json:"isMandatory,omitempty"` - // Position - Get or sets the position of the parameter. - Position *int32 `json:"position,omitempty"` - // DefaultValue - Gets or sets the default value of parameter. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// DscConfigurationProperties definition of the configuration property type. -type DscConfigurationProperties struct { - // ProvisioningState - Gets or sets the provisioning state of the configuration. Possible values include: 'Succeeded' - ProvisioningState DscConfigurationProvisioningState `json:"provisioningState,omitempty"` - // JobCount - Gets or sets the job count of the configuration. - JobCount *int32 `json:"jobCount,omitempty"` - // Parameters - Gets or sets the configuration parameters. - Parameters map[string]*DscConfigurationParameter `json:"parameters"` - // Source - Gets or sets the source. - Source *ContentSource `json:"source,omitempty"` - // State - Gets or sets the state of the configuration. Possible values include: 'DscConfigurationStateNew', 'DscConfigurationStateEdit', 'DscConfigurationStatePublished' - State DscConfigurationState `json:"state,omitempty"` - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // NodeConfigurationCount - Gets the number of compiled node configurations. - NodeConfigurationCount *int32 `json:"nodeConfigurationCount,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationProperties. -func (dcp DscConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcp.ProvisioningState != "" { - objectMap["provisioningState"] = dcp.ProvisioningState - } - if dcp.JobCount != nil { - objectMap["jobCount"] = dcp.JobCount - } - if dcp.Parameters != nil { - objectMap["parameters"] = dcp.Parameters - } - if dcp.Source != nil { - objectMap["source"] = dcp.Source - } - if dcp.State != "" { - objectMap["state"] = dcp.State - } - if dcp.LogVerbose != nil { - objectMap["logVerbose"] = dcp.LogVerbose - } - if dcp.CreationTime != nil { - objectMap["creationTime"] = dcp.CreationTime - } - if dcp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = dcp.LastModifiedTime - } - if dcp.NodeConfigurationCount != nil { - objectMap["nodeConfigurationCount"] = dcp.NodeConfigurationCount - } - if dcp.Description != nil { - objectMap["description"] = dcp.Description - } - return json.Marshal(objectMap) -} - -// DscConfigurationUpdateParameters the parameters supplied to the create or update configuration -// operation. -type DscConfigurationUpdateParameters struct { - // DscConfigurationCreateOrUpdateProperties - Gets or sets configuration create or update properties. - *DscConfigurationCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationUpdateParameters. -func (dcup DscConfigurationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcup.DscConfigurationCreateOrUpdateProperties != nil { - objectMap["properties"] = dcup.DscConfigurationCreateOrUpdateProperties - } - if dcup.Name != nil { - objectMap["name"] = dcup.Name - } - if dcup.Tags != nil { - objectMap["tags"] = dcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscConfigurationUpdateParameters struct. -func (dcup *DscConfigurationUpdateParameters) 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 dscConfigurationCreateOrUpdateProperties DscConfigurationCreateOrUpdateProperties - err = json.Unmarshal(*v, &dscConfigurationCreateOrUpdateProperties) - if err != nil { - return err - } - dcup.DscConfigurationCreateOrUpdateProperties = &dscConfigurationCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcup.Name = &name - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcup.Tags = tags - } - } - } - - return nil -} - -// DscMetaConfiguration definition of the DSC Meta Configuration. -type DscMetaConfiguration struct { - // ConfigurationModeFrequencyMins - Gets or sets the ConfigurationModeFrequencyMins value of the meta configuration. - ConfigurationModeFrequencyMins *int32 `json:"configurationModeFrequencyMins,omitempty"` - // RebootNodeIfNeeded - Gets or sets the RebootNodeIfNeeded value of the meta configuration. - RebootNodeIfNeeded *bool `json:"rebootNodeIfNeeded,omitempty"` - // ConfigurationMode - Gets or sets the ConfigurationMode value of the meta configuration. - ConfigurationMode *string `json:"configurationMode,omitempty"` - // ActionAfterReboot - Gets or sets the ActionAfterReboot value of the meta configuration. - ActionAfterReboot *string `json:"actionAfterReboot,omitempty"` - // CertificateID - Gets or sets the CertificateId value of the meta configuration. - CertificateID *string `json:"certificateId,omitempty"` - // RefreshFrequencyMins - Gets or sets the RefreshFrequencyMins value of the meta configuration. - RefreshFrequencyMins *int32 `json:"refreshFrequencyMins,omitempty"` - // AllowModuleOverwrite - Gets or sets the AllowModuleOverwrite value of the meta configuration. - AllowModuleOverwrite *bool `json:"allowModuleOverwrite,omitempty"` -} - -// DscNode definition of the dsc node type. -type DscNode struct { - autorest.Response `json:"-"` - // LastSeen - Gets or sets the last seen time of the node. - LastSeen *date.Time `json:"lastSeen,omitempty"` - // RegistrationTime - Gets or sets the registration time of the node. - RegistrationTime *date.Time `json:"registrationTime,omitempty"` - // IP - Gets or sets the ip of the node. - IP *string `json:"ip,omitempty"` - // AccountID - Gets or sets the account id of the node. - AccountID *string `json:"accountId,omitempty"` - // NodeConfiguration - Gets or sets the configuration of the node. - NodeConfiguration *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` - // Status - Gets or sets the status of the node. - Status *string `json:"status,omitempty"` - // NodeID - Gets or sets the node id. - NodeID *string `json:"nodeId,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // ExtensionHandler - Gets or sets the list of extensionHandler properties for a Node. - ExtensionHandler *[]DscNodeExtensionHandlerAssociationProperty `json:"extensionHandler,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscNode. -func (dn DscNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dn.LastSeen != nil { - objectMap["lastSeen"] = dn.LastSeen - } - if dn.RegistrationTime != nil { - objectMap["registrationTime"] = dn.RegistrationTime - } - if dn.IP != nil { - objectMap["ip"] = dn.IP - } - if dn.AccountID != nil { - objectMap["accountId"] = dn.AccountID - } - if dn.NodeConfiguration != nil { - objectMap["nodeConfiguration"] = dn.NodeConfiguration - } - if dn.Status != nil { - objectMap["status"] = dn.Status - } - if dn.NodeID != nil { - objectMap["nodeId"] = dn.NodeID - } - if dn.Etag != nil { - objectMap["etag"] = dn.Etag - } - if dn.ExtensionHandler != nil { - objectMap["extensionHandler"] = dn.ExtensionHandler - } - return json.Marshal(objectMap) -} - -// DscNodeConfiguration definition of the dsc node configuration. -type DscNodeConfiguration struct { - autorest.Response `json:"-"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // CreationTime - Gets or sets creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Configuration - Gets or sets the configuration of the node. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscNodeConfiguration. -func (dnc DscNodeConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dnc.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = dnc.LastModifiedTime - } - if dnc.CreationTime != nil { - objectMap["creationTime"] = dnc.CreationTime - } - if dnc.Configuration != nil { - objectMap["configuration"] = dnc.Configuration - } - return json.Marshal(objectMap) -} - -// DscNodeConfigurationAssociationProperty the dsc node configuration property associated with the entity. -type DscNodeConfigurationAssociationProperty struct { - // Name - Gets or sets the name of the dsc node configuration. - Name *string `json:"name,omitempty"` -} - -// DscNodeConfigurationCreateOrUpdateParameters the parameters supplied to the create or update node -// configuration operation. -type DscNodeConfigurationCreateOrUpdateParameters struct { - // Source - Gets or sets the source. - Source *ContentSource `json:"source,omitempty"` - // Name - Name of the node configuration. - Name *string `json:"name,omitempty"` - // Configuration - Gets or sets the configuration of the node. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // IncrementNodeConfigurationBuild - If a new build version of NodeConfiguration is required. - IncrementNodeConfigurationBuild *bool `json:"incrementNodeConfigurationBuild,omitempty"` -} - -// DscNodeConfigurationListResult the response model for the list job operation. -type DscNodeConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of Dsc node configurations. - Value *[]DscNodeConfiguration `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// DscNodeConfigurationListResultIterator provides access to a complete listing of DscNodeConfiguration -// values. -type DscNodeConfigurationListResultIterator struct { - i int - page DscNodeConfigurationListResultPage -} - -// 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 *DscNodeConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationListResultIterator.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 *DscNodeConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscNodeConfigurationListResultIterator) 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 DscNodeConfigurationListResultIterator) Response() DscNodeConfigurationListResult { - 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 DscNodeConfigurationListResultIterator) Value() DscNodeConfiguration { - if !iter.page.NotDone() { - return DscNodeConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscNodeConfigurationListResultIterator type. -func NewDscNodeConfigurationListResultIterator(page DscNodeConfigurationListResultPage) DscNodeConfigurationListResultIterator { - return DscNodeConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dnclr DscNodeConfigurationListResult) IsEmpty() bool { - return dnclr.Value == nil || len(*dnclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dnclr DscNodeConfigurationListResult) hasNextLink() bool { - return dnclr.NextLink != nil && len(*dnclr.NextLink) != 0 -} - -// dscNodeConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dnclr DscNodeConfigurationListResult) dscNodeConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dnclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dnclr.NextLink))) -} - -// DscNodeConfigurationListResultPage contains a page of DscNodeConfiguration values. -type DscNodeConfigurationListResultPage struct { - fn func(context.Context, DscNodeConfigurationListResult) (DscNodeConfigurationListResult, error) - dnclr DscNodeConfigurationListResult -} - -// 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 *DscNodeConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationListResultPage.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.dnclr) - if err != nil { - return err - } - page.dnclr = 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 *DscNodeConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscNodeConfigurationListResultPage) NotDone() bool { - return !page.dnclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscNodeConfigurationListResultPage) Response() DscNodeConfigurationListResult { - return page.dnclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscNodeConfigurationListResultPage) Values() []DscNodeConfiguration { - if page.dnclr.IsEmpty() { - return nil - } - return *page.dnclr.Value -} - -// Creates a new instance of the DscNodeConfigurationListResultPage type. -func NewDscNodeConfigurationListResultPage(cur DscNodeConfigurationListResult, getNextPage func(context.Context, DscNodeConfigurationListResult) (DscNodeConfigurationListResult, error)) DscNodeConfigurationListResultPage { - return DscNodeConfigurationListResultPage{ - fn: getNextPage, - dnclr: cur, - } -} - -// DscNodeExtensionHandlerAssociationProperty the dsc extensionHandler property associated with the node -type DscNodeExtensionHandlerAssociationProperty struct { - // Name - Gets or sets the name of the extension handler. - Name *string `json:"name,omitempty"` - // Version - Gets or sets the version of the extension handler. - Version *string `json:"version,omitempty"` -} - -// DscNodeListResult the response model for the list dsc nodes operation. -type DscNodeListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of dsc nodes. - Value *[]DscNode `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// DscNodeListResultIterator provides access to a complete listing of DscNode values. -type DscNodeListResultIterator struct { - i int - page DscNodeListResultPage -} - -// 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 *DscNodeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeListResultIterator.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 *DscNodeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscNodeListResultIterator) 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 DscNodeListResultIterator) Response() DscNodeListResult { - 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 DscNodeListResultIterator) Value() DscNode { - if !iter.page.NotDone() { - return DscNode{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscNodeListResultIterator type. -func NewDscNodeListResultIterator(page DscNodeListResultPage) DscNodeListResultIterator { - return DscNodeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dnlr DscNodeListResult) IsEmpty() bool { - return dnlr.Value == nil || len(*dnlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dnlr DscNodeListResult) hasNextLink() bool { - return dnlr.NextLink != nil && len(*dnlr.NextLink) != 0 -} - -// dscNodeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dnlr DscNodeListResult) dscNodeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dnlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dnlr.NextLink))) -} - -// DscNodeListResultPage contains a page of DscNode values. -type DscNodeListResultPage struct { - fn func(context.Context, DscNodeListResult) (DscNodeListResult, error) - dnlr DscNodeListResult -} - -// 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 *DscNodeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeListResultPage.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.dnlr) - if err != nil { - return err - } - page.dnlr = 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 *DscNodeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscNodeListResultPage) NotDone() bool { - return !page.dnlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscNodeListResultPage) Response() DscNodeListResult { - return page.dnlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscNodeListResultPage) Values() []DscNode { - if page.dnlr.IsEmpty() { - return nil - } - return *page.dnlr.Value -} - -// Creates a new instance of the DscNodeListResultPage type. -func NewDscNodeListResultPage(cur DscNodeListResult, getNextPage func(context.Context, DscNodeListResult) (DscNodeListResult, error)) DscNodeListResultPage { - return DscNodeListResultPage{ - fn: getNextPage, - dnlr: cur, - } -} - -// DscNodeReport definition of the dsc node report type. -type DscNodeReport struct { - autorest.Response `json:"-"` - // EndTime - Gets or sets the end time of the node report. - EndTime *date.Time `json:"endTime,omitempty"` - // LastModifiedTime - Gets or sets the lastModifiedTime of the node report. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // StartTime - Gets or sets the start time of the node report. - StartTime *date.Time `json:"startTime,omitempty"` - // Type - Gets or sets the type of the node report. - Type *string `json:"type,omitempty"` - // ReportID - Gets or sets the id of the node report. - ReportID *string `json:"reportId,omitempty"` - // Status - Gets or sets the status of the node report. - Status *string `json:"status,omitempty"` - // RefreshMode - Gets or sets the refreshMode of the node report. - RefreshMode *string `json:"refreshMode,omitempty"` - // RebootRequested - Gets or sets the rebootRequested of the node report. - RebootRequested *string `json:"rebootRequested,omitempty"` - // ReportFormatVersion - Gets or sets the reportFormatVersion of the node report. - ReportFormatVersion *string `json:"reportFormatVersion,omitempty"` - // ConfigurationVersion - Gets or sets the configurationVersion of the node report. - ConfigurationVersion *string `json:"configurationVersion,omitempty"` - // ID - Gets or sets the id. - ID *string `json:"id,omitempty"` - // Errors - Gets or sets the errors for the node report. - Errors *[]DscReportError `json:"errors,omitempty"` - // Resources - Gets or sets the resource for the node report. - Resources *[]DscReportResource `json:"resources,omitempty"` - // MetaConfiguration - Gets or sets the metaConfiguration of the node at the time of the report. - MetaConfiguration *DscMetaConfiguration `json:"metaConfiguration,omitempty"` - // HostName - Gets or sets the hostname of the node that sent the report. - HostName *string `json:"hostName,omitempty"` - // IPV4Addresses - Gets or sets the IPv4 address of the node that sent the report. - IPV4Addresses *[]string `json:"iPV4Addresses,omitempty"` - // IPV6Addresses - Gets or sets the IPv6 address of the node that sent the report. - IPV6Addresses *[]string `json:"iPV6Addresses,omitempty"` - // NumberOfResources - Gets or sets the number of resource in the node report. - NumberOfResources *int32 `json:"numberOfResources,omitempty"` - // RawErrors - Gets or sets the unparsed errors for the node report. - RawErrors *string `json:"rawErrors,omitempty"` -} - -// DscNodeReportListResult the response model for the list dsc nodes operation. -type DscNodeReportListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of dsc node reports. - Value *[]DscNodeReport `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// DscNodeReportListResultIterator provides access to a complete listing of DscNodeReport values. -type DscNodeReportListResultIterator struct { - i int - page DscNodeReportListResultPage -} - -// 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 *DscNodeReportListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeReportListResultIterator.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 *DscNodeReportListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscNodeReportListResultIterator) 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 DscNodeReportListResultIterator) Response() DscNodeReportListResult { - 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 DscNodeReportListResultIterator) Value() DscNodeReport { - if !iter.page.NotDone() { - return DscNodeReport{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscNodeReportListResultIterator type. -func NewDscNodeReportListResultIterator(page DscNodeReportListResultPage) DscNodeReportListResultIterator { - return DscNodeReportListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dnrlr DscNodeReportListResult) IsEmpty() bool { - return dnrlr.Value == nil || len(*dnrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dnrlr DscNodeReportListResult) hasNextLink() bool { - return dnrlr.NextLink != nil && len(*dnrlr.NextLink) != 0 -} - -// dscNodeReportListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dnrlr DscNodeReportListResult) dscNodeReportListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dnrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dnrlr.NextLink))) -} - -// DscNodeReportListResultPage contains a page of DscNodeReport values. -type DscNodeReportListResultPage struct { - fn func(context.Context, DscNodeReportListResult) (DscNodeReportListResult, error) - dnrlr DscNodeReportListResult -} - -// 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 *DscNodeReportListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeReportListResultPage.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.dnrlr) - if err != nil { - return err - } - page.dnrlr = 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 *DscNodeReportListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscNodeReportListResultPage) NotDone() bool { - return !page.dnrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscNodeReportListResultPage) Response() DscNodeReportListResult { - return page.dnrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscNodeReportListResultPage) Values() []DscNodeReport { - if page.dnrlr.IsEmpty() { - return nil - } - return *page.dnrlr.Value -} - -// Creates a new instance of the DscNodeReportListResultPage type. -func NewDscNodeReportListResultPage(cur DscNodeReportListResult, getNextPage func(context.Context, DscNodeReportListResult) (DscNodeReportListResult, error)) DscNodeReportListResultPage { - return DscNodeReportListResultPage{ - fn: getNextPage, - dnrlr: cur, - } -} - -// DscNodeUpdateParameters the parameters supplied to the update dsc node operation. -type DscNodeUpdateParameters struct { - // NodeID - Gets or sets the id of the dsc node. - NodeID *string `json:"nodeId,omitempty"` - // NodeConfiguration - Gets or sets the configuration of the node. - NodeConfiguration *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` -} - -// DscReportError definition of the dsc node report error type. -type DscReportError struct { - // ErrorSource - Gets or sets the source of the error. - ErrorSource *string `json:"errorSource,omitempty"` - // ResourceID - Gets or sets the resource ID which generated the error. - ResourceID *string `json:"resourceId,omitempty"` - // ErrorCode - Gets or sets the error code. - ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Gets or sets the error message. - ErrorMessage *string `json:"errorMessage,omitempty"` - // Locale - Gets or sets the locale of the error. - Locale *string `json:"locale,omitempty"` - // ErrorDetails - Gets or sets the error details. - ErrorDetails *string `json:"errorDetails,omitempty"` -} - -// DscReportResource definition of the DSC Report Resource. -type DscReportResource struct { - // ResourceID - Gets or sets the ID of the resource. - ResourceID *string `json:"resourceId,omitempty"` - // SourceInfo - Gets or sets the source info of the resource. - SourceInfo *string `json:"sourceInfo,omitempty"` - // DependsOn - Gets or sets the Resource Navigation values for resources the resource depends on. - DependsOn *[]DscReportResourceNavigation `json:"dependsOn,omitempty"` - // ModuleName - Gets or sets the module name of the resource. - ModuleName *string `json:"moduleName,omitempty"` - // ModuleVersion - Gets or sets the module version of the resource. - ModuleVersion *string `json:"moduleVersion,omitempty"` - // ResourceName - Gets or sets the name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // Error - Gets or sets the error of the resource. - Error *string `json:"error,omitempty"` - // Status - Gets or sets the status of the resource. - Status *string `json:"status,omitempty"` - // DurationInSeconds - Gets or sets the duration in seconds for the resource. - DurationInSeconds *float64 `json:"durationInSeconds,omitempty"` - // StartDate - Gets or sets the start date of the resource. - StartDate *date.Time `json:"startDate,omitempty"` -} - -// DscReportResourceNavigation navigation for DSC Report Resource. -type DscReportResourceNavigation struct { - // ResourceID - Gets or sets the ID of the resource to navigate to. - ResourceID *string `json:"resourceId,omitempty"` -} - -// ErrorResponse error response of an operation failure -type ErrorResponse struct { - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// FieldDefinition definition of the connection fields. -type FieldDefinition struct { - // IsEncrypted - Gets or sets the isEncrypted flag of the connection field definition. - IsEncrypted *bool `json:"isEncrypted,omitempty"` - // IsOptional - Gets or sets the isOptional flag of the connection field definition. - IsOptional *bool `json:"isOptional,omitempty"` - // Type - Gets or sets the type of the connection field definition. - Type *string `json:"type,omitempty"` -} - -// HybridRunbookWorker definition of hybrid runbook worker. -type HybridRunbookWorker struct { - // Name - Gets or sets the worker machine name. - Name *string `json:"name,omitempty"` - // IP - Gets or sets the assigned machine IP address. - IP *string `json:"ip,omitempty"` - // RegistrationTime - Gets or sets the registration time of the worker machine. - RegistrationTime *date.Time `json:"registrationTime,omitempty"` - // LastSeenDateTime - Last Heartbeat from the Worker - LastSeenDateTime *date.Time `json:"lastSeenDateTime,omitempty"` -} - -// HybridRunbookWorkerGroup definition of hybrid runbook worker group. -type HybridRunbookWorkerGroup struct { - autorest.Response `json:"-"` - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - Gets or sets the name of the group. - Name *string `json:"name,omitempty"` - // HybridRunbookWorkers - Gets or sets the list of hybrid runbook workers. - HybridRunbookWorkers *[]HybridRunbookWorker `json:"hybridRunbookWorkers,omitempty"` - // Credential - Sets the credential of a worker group. - Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` - // GroupType - Type of the HybridWorkerGroup. Possible values include: 'User', 'System' - GroupType GroupTypeEnum `json:"groupType,omitempty"` -} - -// HybridRunbookWorkerGroupsListResult the response model for the list hybrid runbook worker groups. -type HybridRunbookWorkerGroupsListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of hybrid runbook worker groups. - Value *[]HybridRunbookWorkerGroup `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// HybridRunbookWorkerGroupsListResultIterator provides access to a complete listing of -// HybridRunbookWorkerGroup values. -type HybridRunbookWorkerGroupsListResultIterator struct { - i int - page HybridRunbookWorkerGroupsListResultPage -} - -// 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 *HybridRunbookWorkerGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupsListResultIterator.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 *HybridRunbookWorkerGroupsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter HybridRunbookWorkerGroupsListResultIterator) 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 HybridRunbookWorkerGroupsListResultIterator) Response() HybridRunbookWorkerGroupsListResult { - 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 HybridRunbookWorkerGroupsListResultIterator) Value() HybridRunbookWorkerGroup { - if !iter.page.NotDone() { - return HybridRunbookWorkerGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the HybridRunbookWorkerGroupsListResultIterator type. -func NewHybridRunbookWorkerGroupsListResultIterator(page HybridRunbookWorkerGroupsListResultPage) HybridRunbookWorkerGroupsListResultIterator { - return HybridRunbookWorkerGroupsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (hrwglr HybridRunbookWorkerGroupsListResult) IsEmpty() bool { - return hrwglr.Value == nil || len(*hrwglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (hrwglr HybridRunbookWorkerGroupsListResult) hasNextLink() bool { - return hrwglr.NextLink != nil && len(*hrwglr.NextLink) != 0 -} - -// hybridRunbookWorkerGroupsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (hrwglr HybridRunbookWorkerGroupsListResult) hybridRunbookWorkerGroupsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !hrwglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(hrwglr.NextLink))) -} - -// HybridRunbookWorkerGroupsListResultPage contains a page of HybridRunbookWorkerGroup values. -type HybridRunbookWorkerGroupsListResultPage struct { - fn func(context.Context, HybridRunbookWorkerGroupsListResult) (HybridRunbookWorkerGroupsListResult, error) - hrwglr HybridRunbookWorkerGroupsListResult -} - -// 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 *HybridRunbookWorkerGroupsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupsListResultPage.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.hrwglr) - if err != nil { - return err - } - page.hrwglr = 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 *HybridRunbookWorkerGroupsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page HybridRunbookWorkerGroupsListResultPage) NotDone() bool { - return !page.hrwglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page HybridRunbookWorkerGroupsListResultPage) Response() HybridRunbookWorkerGroupsListResult { - return page.hrwglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page HybridRunbookWorkerGroupsListResultPage) Values() []HybridRunbookWorkerGroup { - if page.hrwglr.IsEmpty() { - return nil - } - return *page.hrwglr.Value -} - -// Creates a new instance of the HybridRunbookWorkerGroupsListResultPage type. -func NewHybridRunbookWorkerGroupsListResultPage(cur HybridRunbookWorkerGroupsListResult, getNextPage func(context.Context, HybridRunbookWorkerGroupsListResult) (HybridRunbookWorkerGroupsListResult, error)) HybridRunbookWorkerGroupsListResultPage { - return HybridRunbookWorkerGroupsListResultPage{ - fn: getNextPage, - hrwglr: cur, - } -} - -// HybridRunbookWorkerGroupUpdateParameters parameters supplied to the update operation. -type HybridRunbookWorkerGroupUpdateParameters struct { - // Credential - Sets the credential of a worker group. - Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` -} - -// Job definition of the job. -type Job struct { - autorest.Response `json:"-"` - // JobProperties - The properties of the job. - *JobProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Job. -func (j Job) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if j.JobProperties != nil { - objectMap["properties"] = j.JobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Job struct. -func (j *Job) 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 jobProperties JobProperties - err = json.Unmarshal(*v, &jobProperties) - if err != nil { - return err - } - j.JobProperties = &jobProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - j.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - j.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - j.Type = &typeVar - } - } - } - - return nil -} - -// JobCollectionItem job collection item properties. -type JobCollectionItem struct { - // JobCollectionItemProperties - Job properties. - *JobCollectionItemProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for JobCollectionItem. -func (jci JobCollectionItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jci.JobCollectionItemProperties != nil { - objectMap["properties"] = jci.JobCollectionItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobCollectionItem struct. -func (jci *JobCollectionItem) 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 jobCollectionItemProperties JobCollectionItemProperties - err = json.Unmarshal(*v, &jobCollectionItemProperties) - if err != nil { - return err - } - jci.JobCollectionItemProperties = &jobCollectionItemProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - jci.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - jci.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - jci.Type = &typeVar - } - } - } - - return nil -} - -// JobCollectionItemProperties job collection item properties. -type JobCollectionItemProperties struct { - // Runbook - READ-ONLY; The runbook association. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // JobID - READ-ONLY; The id of the job. - JobID *uuid.UUID `json:"jobId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Status - READ-ONLY; The status of the job. Possible values include: 'JobStatusNew', 'JobStatusActivating', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusStopped', 'JobStatusBlocked', 'JobStatusSuspended', 'JobStatusDisconnected', 'JobStatusSuspending', 'JobStatusStopping', 'JobStatusResuming', 'JobStatusRemoving' - Status JobStatus `json:"status,omitempty"` - // StartTime - READ-ONLY; The start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // LastModifiedTime - READ-ONLY; The last modified time of the job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of a resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // RunOn - Specifies the runOn group name where the job was executed. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCollectionItemProperties. -func (jcip JobCollectionItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jcip.RunOn != nil { - objectMap["runOn"] = jcip.RunOn - } - return json.Marshal(objectMap) -} - -// JobCreateParameters the parameters supplied to the create job operation. -type JobCreateParameters struct { - // JobCreateProperties - Gets or sets the list of job properties. - *JobCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCreateParameters. -func (jcp JobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jcp.JobCreateProperties != nil { - objectMap["properties"] = jcp.JobCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobCreateParameters struct. -func (jcp *JobCreateParameters) 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 jobCreateProperties JobCreateProperties - err = json.Unmarshal(*v, &jobCreateProperties) - if err != nil { - return err - } - jcp.JobCreateProperties = &jobCreateProperties - } - } - } - - return nil -} - -// JobCreateProperties ... -type JobCreateProperties struct { - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCreateProperties. -func (jcp JobCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jcp.Runbook != nil { - objectMap["runbook"] = jcp.Runbook - } - if jcp.Parameters != nil { - objectMap["parameters"] = jcp.Parameters - } - if jcp.RunOn != nil { - objectMap["runOn"] = jcp.RunOn - } - return json.Marshal(objectMap) -} - -// JobListResultV2 the response model for the list job operation. -type JobListResultV2 struct { - autorest.Response `json:"-"` - // Value - List of jobs. - Value *[]JobCollectionItem `json:"value,omitempty"` - // NextLink - READ-ONLY; The link to the next page. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobListResultV2. -func (jlrv JobListResultV2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jlrv.Value != nil { - objectMap["value"] = jlrv.Value - } - return json.Marshal(objectMap) -} - -// JobListResultV2Iterator provides access to a complete listing of JobCollectionItem values. -type JobListResultV2Iterator struct { - i int - page JobListResultV2Page -} - -// 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 *JobListResultV2Iterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultV2Iterator.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 *JobListResultV2Iterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobListResultV2Iterator) 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 JobListResultV2Iterator) Response() JobListResultV2 { - 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 JobListResultV2Iterator) Value() JobCollectionItem { - if !iter.page.NotDone() { - return JobCollectionItem{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobListResultV2Iterator type. -func NewJobListResultV2Iterator(page JobListResultV2Page) JobListResultV2Iterator { - return JobListResultV2Iterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jlrv JobListResultV2) IsEmpty() bool { - return jlrv.Value == nil || len(*jlrv.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jlrv JobListResultV2) hasNextLink() bool { - return jlrv.NextLink != nil && len(*jlrv.NextLink) != 0 -} - -// jobListResultV2Preparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jlrv JobListResultV2) jobListResultV2Preparer(ctx context.Context) (*http.Request, error) { - if !jlrv.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jlrv.NextLink))) -} - -// JobListResultV2Page contains a page of JobCollectionItem values. -type JobListResultV2Page struct { - fn func(context.Context, JobListResultV2) (JobListResultV2, error) - jlrv JobListResultV2 -} - -// 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 *JobListResultV2Page) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultV2Page.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.jlrv) - if err != nil { - return err - } - page.jlrv = 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 *JobListResultV2Page) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobListResultV2Page) NotDone() bool { - return !page.jlrv.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobListResultV2Page) Response() JobListResultV2 { - return page.jlrv -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobListResultV2Page) Values() []JobCollectionItem { - if page.jlrv.IsEmpty() { - return nil - } - return *page.jlrv.Value -} - -// Creates a new instance of the JobListResultV2Page type. -func NewJobListResultV2Page(cur JobListResultV2, getNextPage func(context.Context, JobListResultV2) (JobListResultV2, error)) JobListResultV2Page { - return JobListResultV2Page{ - fn: getNextPage, - jlrv: cur, - } -} - -// JobNavigation software update configuration machine run job navigation properties. -type JobNavigation struct { - // ID - READ-ONLY; Id of the job associated with the software update configuration run - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobNavigation. -func (jn JobNavigation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobProperties definition of job properties. -type JobProperties struct { - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // StartedBy - Gets or sets the job started by. - StartedBy *string `json:"startedBy,omitempty"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` - // JobID - Gets or sets the id of the job. - JobID *uuid.UUID `json:"jobId,omitempty"` - // CreationTime - Gets or sets the creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Status - Gets or sets the status of the job. Possible values include: 'JobStatusNew', 'JobStatusActivating', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusStopped', 'JobStatusBlocked', 'JobStatusSuspended', 'JobStatusDisconnected', 'JobStatusSuspending', 'JobStatusStopping', 'JobStatusResuming', 'JobStatusRemoving' - Status JobStatus `json:"status,omitempty"` - // StatusDetails - Gets or sets the status details of the job. - StatusDetails *string `json:"statusDetails,omitempty"` - // StartTime - Gets or sets the start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Gets or sets the end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // Exception - Gets or sets the exception of the job. - Exception *string `json:"exception,omitempty"` - // LastModifiedTime - Gets or sets the last modified time of the job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastStatusModifiedTime - Gets or sets the last status modified time of the job. - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // ProvisioningState - The current provisioning state of the job. Possible values include: 'JobProvisioningStateFailed', 'JobProvisioningStateSucceeded', 'JobProvisioningStateSuspended', 'JobProvisioningStateProcessing' - ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobProperties. -func (jp JobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jp.Runbook != nil { - objectMap["runbook"] = jp.Runbook - } - if jp.StartedBy != nil { - objectMap["startedBy"] = jp.StartedBy - } - if jp.RunOn != nil { - objectMap["runOn"] = jp.RunOn - } - if jp.JobID != nil { - objectMap["jobId"] = jp.JobID - } - if jp.CreationTime != nil { - objectMap["creationTime"] = jp.CreationTime - } - if jp.Status != "" { - objectMap["status"] = jp.Status - } - if jp.StatusDetails != nil { - objectMap["statusDetails"] = jp.StatusDetails - } - if jp.StartTime != nil { - objectMap["startTime"] = jp.StartTime - } - if jp.EndTime != nil { - objectMap["endTime"] = jp.EndTime - } - if jp.Exception != nil { - objectMap["exception"] = jp.Exception - } - if jp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = jp.LastModifiedTime - } - if jp.LastStatusModifiedTime != nil { - objectMap["lastStatusModifiedTime"] = jp.LastStatusModifiedTime - } - if jp.Parameters != nil { - objectMap["parameters"] = jp.Parameters - } - if jp.ProvisioningState != "" { - objectMap["provisioningState"] = jp.ProvisioningState - } - return json.Marshal(objectMap) -} - -// JobSchedule definition of the job schedule. -type JobSchedule struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Gets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the name of the variable. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // JobScheduleProperties - Gets or sets the properties of the job schedule. - *JobScheduleProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobSchedule. -func (js JobSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if js.JobScheduleProperties != nil { - objectMap["properties"] = js.JobScheduleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobSchedule struct. -func (js *JobSchedule) 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 - } - js.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - js.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - js.Type = &typeVar - } - case "properties": - if v != nil { - var jobScheduleProperties JobScheduleProperties - err = json.Unmarshal(*v, &jobScheduleProperties) - if err != nil { - return err - } - js.JobScheduleProperties = &jobScheduleProperties - } - } - } - - return nil -} - -// JobScheduleCreateParameters the parameters supplied to the create job schedule operation. -type JobScheduleCreateParameters struct { - // JobScheduleCreateProperties - Gets or sets the list of job schedule properties. - *JobScheduleCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobScheduleCreateParameters. -func (jscp JobScheduleCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jscp.JobScheduleCreateProperties != nil { - objectMap["properties"] = jscp.JobScheduleCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobScheduleCreateParameters struct. -func (jscp *JobScheduleCreateParameters) 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 jobScheduleCreateProperties JobScheduleCreateProperties - err = json.Unmarshal(*v, &jobScheduleCreateProperties) - if err != nil { - return err - } - jscp.JobScheduleCreateProperties = &jobScheduleCreateProperties - } - } - } - - return nil -} - -// JobScheduleCreateProperties the parameters supplied to the create job schedule operation. -type JobScheduleCreateProperties struct { - // Schedule - Gets or sets the schedule. - Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the hybrid worker group that the scheduled job should run on. - RunOn *string `json:"runOn,omitempty"` - // Parameters - Gets or sets a list of job properties. - Parameters map[string]*string `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for JobScheduleCreateProperties. -func (jscp JobScheduleCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jscp.Schedule != nil { - objectMap["schedule"] = jscp.Schedule - } - if jscp.Runbook != nil { - objectMap["runbook"] = jscp.Runbook - } - if jscp.RunOn != nil { - objectMap["runOn"] = jscp.RunOn - } - if jscp.Parameters != nil { - objectMap["parameters"] = jscp.Parameters - } - return json.Marshal(objectMap) -} - -// JobScheduleListResult the response model for the list job schedule operation. -type JobScheduleListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of job schedules. - Value *[]JobSchedule `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// JobScheduleListResultIterator provides access to a complete listing of JobSchedule values. -type JobScheduleListResultIterator struct { - i int - page JobScheduleListResultPage -} - -// 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 *JobScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleListResultIterator.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 *JobScheduleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobScheduleListResultIterator) 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 JobScheduleListResultIterator) Response() JobScheduleListResult { - 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 JobScheduleListResultIterator) Value() JobSchedule { - if !iter.page.NotDone() { - return JobSchedule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobScheduleListResultIterator type. -func NewJobScheduleListResultIterator(page JobScheduleListResultPage) JobScheduleListResultIterator { - return JobScheduleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jslr JobScheduleListResult) IsEmpty() bool { - return jslr.Value == nil || len(*jslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jslr JobScheduleListResult) hasNextLink() bool { - return jslr.NextLink != nil && len(*jslr.NextLink) != 0 -} - -// jobScheduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jslr JobScheduleListResult) jobScheduleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jslr.NextLink))) -} - -// JobScheduleListResultPage contains a page of JobSchedule values. -type JobScheduleListResultPage struct { - fn func(context.Context, JobScheduleListResult) (JobScheduleListResult, error) - jslr JobScheduleListResult -} - -// 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 *JobScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleListResultPage.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.jslr) - if err != nil { - return err - } - page.jslr = 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 *JobScheduleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobScheduleListResultPage) NotDone() bool { - return !page.jslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobScheduleListResultPage) Response() JobScheduleListResult { - return page.jslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobScheduleListResultPage) Values() []JobSchedule { - if page.jslr.IsEmpty() { - return nil - } - return *page.jslr.Value -} - -// Creates a new instance of the JobScheduleListResultPage type. -func NewJobScheduleListResultPage(cur JobScheduleListResult, getNextPage func(context.Context, JobScheduleListResult) (JobScheduleListResult, error)) JobScheduleListResultPage { - return JobScheduleListResultPage{ - fn: getNextPage, - jslr: cur, - } -} - -// JobScheduleProperties definition of job schedule parameters. -type JobScheduleProperties struct { - // JobScheduleID - Gets or sets the id of job schedule. - JobScheduleID *string `json:"jobScheduleId,omitempty"` - // Schedule - Gets or sets the schedule. - Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the hybrid worker group that the scheduled job should run on. - RunOn *string `json:"runOn,omitempty"` - // Parameters - Gets or sets the parameters of the job schedule. - Parameters map[string]*string `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for JobScheduleProperties. -func (jsp JobScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jsp.JobScheduleID != nil { - objectMap["jobScheduleId"] = jsp.JobScheduleID - } - if jsp.Schedule != nil { - objectMap["schedule"] = jsp.Schedule - } - if jsp.Runbook != nil { - objectMap["runbook"] = jsp.Runbook - } - if jsp.RunOn != nil { - objectMap["runOn"] = jsp.RunOn - } - if jsp.Parameters != nil { - objectMap["parameters"] = jsp.Parameters - } - return json.Marshal(objectMap) -} - -// JobStream definition of the job stream. -type JobStream struct { - autorest.Response `json:"-"` - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // JobStreamProperties - Gets or sets the id of the job stream. - *JobStreamProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobStream. -func (js JobStream) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if js.ID != nil { - objectMap["id"] = js.ID - } - if js.JobStreamProperties != nil { - objectMap["properties"] = js.JobStreamProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobStream struct. -func (js *JobStream) 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 - } - js.ID = &ID - } - case "properties": - if v != nil { - var jobStreamProperties JobStreamProperties - err = json.Unmarshal(*v, &jobStreamProperties) - if err != nil { - return err - } - js.JobStreamProperties = &jobStreamProperties - } - } - } - - return nil -} - -// JobStreamListResult the response model for the list job stream operation. -type JobStreamListResult struct { - autorest.Response `json:"-"` - // Value - A list of job streams. - Value *[]JobStream `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// JobStreamListResultIterator provides access to a complete listing of JobStream values. -type JobStreamListResultIterator struct { - i int - page JobStreamListResultPage -} - -// 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 *JobStreamListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamListResultIterator.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 *JobStreamListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobStreamListResultIterator) 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 JobStreamListResultIterator) Response() JobStreamListResult { - 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 JobStreamListResultIterator) Value() JobStream { - if !iter.page.NotDone() { - return JobStream{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobStreamListResultIterator type. -func NewJobStreamListResultIterator(page JobStreamListResultPage) JobStreamListResultIterator { - return JobStreamListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jslr JobStreamListResult) IsEmpty() bool { - return jslr.Value == nil || len(*jslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jslr JobStreamListResult) hasNextLink() bool { - return jslr.NextLink != nil && len(*jslr.NextLink) != 0 -} - -// jobStreamListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jslr JobStreamListResult) jobStreamListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jslr.NextLink))) -} - -// JobStreamListResultPage contains a page of JobStream values. -type JobStreamListResultPage struct { - fn func(context.Context, JobStreamListResult) (JobStreamListResult, error) - jslr JobStreamListResult -} - -// 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 *JobStreamListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamListResultPage.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.jslr) - if err != nil { - return err - } - page.jslr = 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 *JobStreamListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobStreamListResultPage) NotDone() bool { - return !page.jslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobStreamListResultPage) Response() JobStreamListResult { - return page.jslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobStreamListResultPage) Values() []JobStream { - if page.jslr.IsEmpty() { - return nil - } - return *page.jslr.Value -} - -// Creates a new instance of the JobStreamListResultPage type. -func NewJobStreamListResultPage(cur JobStreamListResult, getNextPage func(context.Context, JobStreamListResult) (JobStreamListResult, error)) JobStreamListResultPage { - return JobStreamListResultPage{ - fn: getNextPage, - jslr: cur, - } -} - -// JobStreamProperties definition of the job stream. -type JobStreamProperties struct { - // JobStreamID - Gets or sets the id of the job stream. - JobStreamID *string `json:"jobStreamId,omitempty"` - // Time - Gets or sets the creation time of the job. - Time *date.Time `json:"time,omitempty"` - // StreamType - Gets or sets the stream type. Possible values include: 'Progress', 'Output', 'Warning', 'Error', 'Debug', 'Verbose', 'Any' - StreamType JobStreamType `json:"streamType,omitempty"` - // StreamText - Gets or sets the stream text. - StreamText *string `json:"streamText,omitempty"` - // Summary - Gets or sets the summary. - Summary *string `json:"summary,omitempty"` - // Value - Gets or sets the values of the job stream. - Value map[string]interface{} `json:"value"` -} - -// MarshalJSON is the custom marshaler for JobStreamProperties. -func (jsp JobStreamProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jsp.JobStreamID != nil { - objectMap["jobStreamId"] = jsp.JobStreamID - } - if jsp.Time != nil { - objectMap["time"] = jsp.Time - } - if jsp.StreamType != "" { - objectMap["streamType"] = jsp.StreamType - } - if jsp.StreamText != nil { - objectMap["streamText"] = jsp.StreamText - } - if jsp.Summary != nil { - objectMap["summary"] = jsp.Summary - } - if jsp.Value != nil { - objectMap["value"] = jsp.Value - } - return json.Marshal(objectMap) -} - -// Key automation key which is used to register a DSC Node -type Key struct { - // KeyName - READ-ONLY; Automation key name. Possible values include: 'KeyNamePrimary', 'KeyNameSecondary' - KeyName KeyName `json:"KeyName,omitempty"` - // Permissions - READ-ONLY; Automation key permissions. Possible values include: 'Read', 'Full' - Permissions KeyPermissions `json:"Permissions,omitempty"` - // Value - READ-ONLY; Value of the Automation Key used for registration. - Value *string `json:"Value,omitempty"` -} - -// MarshalJSON is the custom marshaler for Key. -func (kVar Key) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// KeyListResult ... -type KeyListResult struct { - autorest.Response `json:"-"` - // Keys - Lists the automation keys. - Keys *[]Key `json:"keys,omitempty"` -} - -// LinkedWorkspace definition of the linked workspace. -type LinkedWorkspace struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Gets the id of the linked workspace. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedWorkspace. -func (lw LinkedWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LinuxProperties linux specific update configuration. -type LinuxProperties struct { - // IncludedPackageClassifications - Update classifications included in the software update configuration. Possible values include: 'Unclassified', 'Critical', 'Security', 'Other' - IncludedPackageClassifications LinuxUpdateClasses `json:"includedPackageClassifications,omitempty"` - // ExcludedPackageNameMasks - packages excluded from the software update configuration. - ExcludedPackageNameMasks *[]string `json:"excludedPackageNameMasks,omitempty"` - // IncludedPackageNameMasks - packages included from the software update configuration. - IncludedPackageNameMasks *[]string `json:"includedPackageNameMasks,omitempty"` - // RebootSetting - Reboot setting for the software update configuration. - RebootSetting *string `json:"rebootSetting,omitempty"` -} - -// Module definition of the module type. -type Module struct { - autorest.Response `json:"-"` - // ModuleProperties - Gets or sets the module properties. - *ModuleProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Module. -func (mVar Module) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.ModuleProperties != nil { - objectMap["properties"] = mVar.ModuleProperties - } - if mVar.Etag != nil { - objectMap["etag"] = mVar.Etag - } - if mVar.Tags != nil { - objectMap["tags"] = mVar.Tags - } - if mVar.Location != nil { - objectMap["location"] = mVar.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Module struct. -func (mVar *Module) 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 moduleProperties ModuleProperties - err = json.Unmarshal(*v, &moduleProperties) - if err != nil { - return err - } - mVar.ModuleProperties = &moduleProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - mVar.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mVar.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mVar.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mVar.Type = &typeVar - } - } - } - - return nil -} - -// ModuleCreateOrUpdateParameters the parameters supplied to the create or update module operation. -type ModuleCreateOrUpdateParameters struct { - // ModuleCreateOrUpdateProperties - Gets or sets the module create properties. - *ModuleCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ModuleCreateOrUpdateParameters. -func (mcoup ModuleCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcoup.ModuleCreateOrUpdateProperties != nil { - objectMap["properties"] = mcoup.ModuleCreateOrUpdateProperties - } - if mcoup.Name != nil { - objectMap["name"] = mcoup.Name - } - if mcoup.Location != nil { - objectMap["location"] = mcoup.Location - } - if mcoup.Tags != nil { - objectMap["tags"] = mcoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ModuleCreateOrUpdateParameters struct. -func (mcoup *ModuleCreateOrUpdateParameters) 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 moduleCreateOrUpdateProperties ModuleCreateOrUpdateProperties - err = json.Unmarshal(*v, &moduleCreateOrUpdateProperties) - if err != nil { - return err - } - mcoup.ModuleCreateOrUpdateProperties = &moduleCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mcoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mcoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mcoup.Tags = tags - } - } - } - - return nil -} - -// ModuleCreateOrUpdateProperties the parameters supplied to the create or update module properties. -type ModuleCreateOrUpdateProperties struct { - // ContentLink - Gets or sets the module content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// ModuleErrorInfo definition of the module error info type. -type ModuleErrorInfo struct { - // Code - Gets or sets the error code. - Code *string `json:"code,omitempty"` - // Message - Gets or sets the error message. - Message *string `json:"message,omitempty"` -} - -// ModuleListResult the response model for the list module operation. -type ModuleListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of modules. - Value *[]Module `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ModuleListResultIterator provides access to a complete listing of Module values. -type ModuleListResultIterator struct { - i int - page ModuleListResultPage -} - -// 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 *ModuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleListResultIterator.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 *ModuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ModuleListResultIterator) 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 ModuleListResultIterator) Response() ModuleListResult { - 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 ModuleListResultIterator) Value() Module { - if !iter.page.NotDone() { - return Module{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ModuleListResultIterator type. -func NewModuleListResultIterator(page ModuleListResultPage) ModuleListResultIterator { - return ModuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mlr ModuleListResult) IsEmpty() bool { - return mlr.Value == nil || len(*mlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mlr ModuleListResult) hasNextLink() bool { - return mlr.NextLink != nil && len(*mlr.NextLink) != 0 -} - -// moduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mlr ModuleListResult) moduleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mlr.NextLink))) -} - -// ModuleListResultPage contains a page of Module values. -type ModuleListResultPage struct { - fn func(context.Context, ModuleListResult) (ModuleListResult, error) - mlr ModuleListResult -} - -// 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 *ModuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleListResultPage.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.mlr) - if err != nil { - return err - } - page.mlr = 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 *ModuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ModuleListResultPage) NotDone() bool { - return !page.mlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ModuleListResultPage) Response() ModuleListResult { - return page.mlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ModuleListResultPage) Values() []Module { - if page.mlr.IsEmpty() { - return nil - } - return *page.mlr.Value -} - -// Creates a new instance of the ModuleListResultPage type. -func NewModuleListResultPage(cur ModuleListResult, getNextPage func(context.Context, ModuleListResult) (ModuleListResult, error)) ModuleListResultPage { - return ModuleListResultPage{ - fn: getNextPage, - mlr: cur, - } -} - -// ModuleProperties definition of the module property type. -type ModuleProperties struct { - // IsGlobal - Gets or sets the isGlobal flag of the module. - IsGlobal *bool `json:"isGlobal,omitempty"` - // Version - Gets or sets the version of the module. - Version *string `json:"version,omitempty"` - // SizeInBytes - Gets or sets the size in bytes of the module. - SizeInBytes *int64 `json:"sizeInBytes,omitempty"` - // ActivityCount - Gets or sets the activity count of the module. - ActivityCount *int32 `json:"activityCount,omitempty"` - // ProvisioningState - Gets or sets the provisioning state of the module. Possible values include: 'ModuleProvisioningStateCreated', 'ModuleProvisioningStateCreating', 'ModuleProvisioningStateStartingImportModuleRunbook', 'ModuleProvisioningStateRunningImportModuleRunbook', 'ModuleProvisioningStateContentRetrieved', 'ModuleProvisioningStateContentDownloaded', 'ModuleProvisioningStateContentValidated', 'ModuleProvisioningStateConnectionTypeImported', 'ModuleProvisioningStateContentStored', 'ModuleProvisioningStateModuleDataStored', 'ModuleProvisioningStateActivitiesStored', 'ModuleProvisioningStateModuleImportRunbookComplete', 'ModuleProvisioningStateSucceeded', 'ModuleProvisioningStateFailed', 'ModuleProvisioningStateCancelled', 'ModuleProvisioningStateUpdating' - ProvisioningState ModuleProvisioningState `json:"provisioningState,omitempty"` - // ContentLink - Gets or sets the contentLink of the module. - ContentLink *ContentLink `json:"contentLink,omitempty"` - // Error - Gets or sets the error info of the module. - Error *ModuleErrorInfo `json:"error,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` - // IsComposite - Gets or sets type of module, if its composite or not. - IsComposite *bool `json:"isComposite,omitempty"` -} - -// ModuleUpdateParameters the parameters supplied to the update module operation. -type ModuleUpdateParameters struct { - // ModuleUpdateProperties - Gets or sets the module update properties. - *ModuleUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ModuleUpdateParameters. -func (mup ModuleUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mup.ModuleUpdateProperties != nil { - objectMap["properties"] = mup.ModuleUpdateProperties - } - if mup.Name != nil { - objectMap["name"] = mup.Name - } - if mup.Location != nil { - objectMap["location"] = mup.Location - } - if mup.Tags != nil { - objectMap["tags"] = mup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ModuleUpdateParameters struct. -func (mup *ModuleUpdateParameters) 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 moduleUpdateProperties ModuleUpdateProperties - err = json.Unmarshal(*v, &moduleUpdateProperties) - if err != nil { - return err - } - mup.ModuleUpdateProperties = &moduleUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mup.Tags = tags - } - } - } - - return nil -} - -// ModuleUpdateProperties the parameters supplied to the update properties. -type ModuleUpdateProperties struct { - // ContentLink - Gets or sets the module content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// NonAzureQueryProperties non Azure query for the update configuration. -type NonAzureQueryProperties struct { - // FunctionAlias - Log Analytics Saved Search name. - FunctionAlias *string `json:"functionAlias,omitempty"` - // WorkspaceID - Workspace Id for Log Analytics in which the saved Search is resided. - WorkspaceID *string `json:"workspaceId,omitempty"` -} - -// Operation automation REST API operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Provider, Resource and Operation values - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay provider, Resource and Operation values -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Automation - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Runbooks, Jobs etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult the response model for the list of Automation operations -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Automation operations supported by the Automation resource provider. - Value *[]Operation `json:"value,omitempty"` -} - -// ProxyResource ARM proxy resource. -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReadCloser ... -type ReadCloser struct { - autorest.Response `json:"-"` - Value *io.ReadCloser `json:"value,omitempty"` -} - -// Resource the core properties of ARM resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RunAsCredentialAssociationProperty definition of RunAs credential to use for hybrid worker. -type RunAsCredentialAssociationProperty struct { - // Name - Gets or sets the name of the credential. - Name *string `json:"name,omitempty"` -} - -// Runbook definition of the runbook type. -type Runbook struct { - autorest.Response `json:"-"` - // RunbookProperties - Gets or sets the runbook properties. - *RunbookProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Runbook. -func (r Runbook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RunbookProperties != nil { - objectMap["properties"] = r.RunbookProperties - } - if r.Etag != nil { - objectMap["etag"] = r.Etag - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.Location != nil { - objectMap["location"] = r.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Runbook struct. -func (r *Runbook) 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 runbookProperties RunbookProperties - err = json.Unmarshal(*v, &runbookProperties) - if err != nil { - return err - } - r.RunbookProperties = &runbookProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - r.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - 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 - } - } - } - - return nil -} - -// RunbookAssociationProperty the runbook property associated with the entity. -type RunbookAssociationProperty struct { - // Name - Gets or sets the name of the runbook. - Name *string `json:"name,omitempty"` -} - -// RunbookCreateOrUpdateDraftParameters the parameters supplied to the create or update runbook operation. -type RunbookCreateOrUpdateDraftParameters struct { - // RunbookContent - Content of the Runbook. - RunbookContent *string `json:"runbookContent,omitempty"` -} - -// RunbookCreateOrUpdateDraftProperties the parameters supplied to the create or update draft runbook -// properties. -type RunbookCreateOrUpdateDraftProperties struct { - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // RunbookType - Gets or sets the type of the runbook. Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - // Draft - Gets or sets the draft runbook properties. - Draft *RunbookDraft `json:"draft,omitempty"` - // Description - Gets or sets the description of the runbook. - Description *string `json:"description,omitempty"` - // LogActivityTrace - Gets or sets the activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// RunbookCreateOrUpdateParameters the parameters supplied to the create or update runbook operation. -type RunbookCreateOrUpdateParameters struct { - // RunbookCreateOrUpdateProperties - Gets or sets runbook create or update properties. - *RunbookCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for RunbookCreateOrUpdateParameters. -func (rcoup RunbookCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rcoup.RunbookCreateOrUpdateProperties != nil { - objectMap["properties"] = rcoup.RunbookCreateOrUpdateProperties - } - if rcoup.Name != nil { - objectMap["name"] = rcoup.Name - } - if rcoup.Location != nil { - objectMap["location"] = rcoup.Location - } - if rcoup.Tags != nil { - objectMap["tags"] = rcoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RunbookCreateOrUpdateParameters struct. -func (rcoup *RunbookCreateOrUpdateParameters) 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 runbookCreateOrUpdateProperties RunbookCreateOrUpdateProperties - err = json.Unmarshal(*v, &runbookCreateOrUpdateProperties) - if err != nil { - return err - } - rcoup.RunbookCreateOrUpdateProperties = &runbookCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rcoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rcoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rcoup.Tags = tags - } - } - } - - return nil -} - -// RunbookCreateOrUpdateProperties the parameters supplied to the create or update runbook properties. -type RunbookCreateOrUpdateProperties struct { - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // RunbookType - Gets or sets the type of the runbook. Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - // Draft - Gets or sets the draft runbook properties. - Draft *RunbookDraft `json:"draft,omitempty"` - // PublishContentLink - Gets or sets the published runbook content link. - PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` - // Description - Gets or sets the description of the runbook. - Description *string `json:"description,omitempty"` - // LogActivityTrace - Gets or sets the activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// RunbookDraft ... -type RunbookDraft struct { - autorest.Response `json:"-"` - // InEdit - Gets or sets whether runbook is in edit mode. - InEdit *bool `json:"inEdit,omitempty"` - // DraftContentLink - Gets or sets the draft runbook content link. - DraftContentLink *ContentLink `json:"draftContentLink,omitempty"` - // CreationTime - Gets or sets the creation time of the runbook draft. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time of the runbook draft. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Parameters - Gets or sets the runbook draft parameters. - Parameters map[string]*RunbookParameter `json:"parameters"` - // OutputTypes - Gets or sets the runbook output types. - OutputTypes *[]string `json:"outputTypes,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunbookDraft. -func (rd RunbookDraft) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rd.InEdit != nil { - objectMap["inEdit"] = rd.InEdit - } - if rd.DraftContentLink != nil { - objectMap["draftContentLink"] = rd.DraftContentLink - } - if rd.CreationTime != nil { - objectMap["creationTime"] = rd.CreationTime - } - if rd.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = rd.LastModifiedTime - } - if rd.Parameters != nil { - objectMap["parameters"] = rd.Parameters - } - if rd.OutputTypes != nil { - objectMap["outputTypes"] = rd.OutputTypes - } - return json.Marshal(objectMap) -} - -// RunbookDraftPublishFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RunbookDraftPublishFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunbookDraftClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunbookDraftPublishFuture) 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 RunbookDraftPublishFuture.Result. -func (future *RunbookDraftPublishFuture) result(client RunbookDraftClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftPublishFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.RunbookDraftPublishFuture") - return - } - ar.Response = future.Response() - return -} - -// RunbookDraftReplaceContentFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RunbookDraftReplaceContentFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunbookDraftClient) (ReadCloser, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunbookDraftReplaceContentFuture) 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 RunbookDraftReplaceContentFuture.Result. -func (future *RunbookDraftReplaceContentFuture) result(client RunbookDraftClient) (rc ReadCloser, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.RunbookDraftReplaceContentFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rc.Response.Response, err = future.GetResult(sender); err == nil && rc.Response.Response.StatusCode != http.StatusNoContent { - rc, err = client.ReplaceContentResponder(rc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", rc.Response.Response, "Failure responding to request") - } - } - return -} - -// RunbookDraftUndoEditResult the response model for the undo edit runbook operation. -type RunbookDraftUndoEditResult struct { - autorest.Response `json:"-"` - // StatusCode - Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'Ambiguous', 'MovedPermanently', 'Moved', 'Found', 'Redirect', 'SeeOther', 'RedirectMethod', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'RedirectKeepVerb', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestURITooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HTTPVersionNotSupported' - StatusCode HTTPStatusCode `json:"statusCode,omitempty"` - RequestID *string `json:"requestId,omitempty"` -} - -// RunbookListResult the response model for the list runbook operation. -type RunbookListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of runbooks. - Value *[]Runbook `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// RunbookListResultIterator provides access to a complete listing of Runbook values. -type RunbookListResultIterator struct { - i int - page RunbookListResultPage -} - -// 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 *RunbookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookListResultIterator.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 *RunbookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RunbookListResultIterator) 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 RunbookListResultIterator) Response() RunbookListResult { - 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 RunbookListResultIterator) Value() Runbook { - if !iter.page.NotDone() { - return Runbook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RunbookListResultIterator type. -func NewRunbookListResultIterator(page RunbookListResultPage) RunbookListResultIterator { - return RunbookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RunbookListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RunbookListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// runbookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RunbookListResult) runbookListResultPreparer(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))) -} - -// RunbookListResultPage contains a page of Runbook values. -type RunbookListResultPage struct { - fn func(context.Context, RunbookListResult) (RunbookListResult, error) - rlr RunbookListResult -} - -// 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 *RunbookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookListResultPage.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 *RunbookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RunbookListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RunbookListResultPage) Response() RunbookListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RunbookListResultPage) Values() []Runbook { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RunbookListResultPage type. -func NewRunbookListResultPage(cur RunbookListResult, getNextPage func(context.Context, RunbookListResult) (RunbookListResult, error)) RunbookListResultPage { - return RunbookListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RunbookParameter definition of the runbook parameter type. -type RunbookParameter struct { - // Type - Gets or sets the type of the parameter. - Type *string `json:"type,omitempty"` - // IsMandatory - Gets or sets a Boolean value to indicate whether the parameter is mandatory or not. - IsMandatory *bool `json:"isMandatory,omitempty"` - // Position - Get or sets the position of the parameter. - Position *int32 `json:"position,omitempty"` - // DefaultValue - Gets or sets the default value of parameter. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// RunbookProperties definition of the runbook property type. -type RunbookProperties struct { - // RunbookType - Gets or sets the type of the runbook. Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - // PublishContentLink - Gets or sets the published runbook content link. - PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` - // State - Gets or sets the state of the runbook. Possible values include: 'RunbookStateNew', 'RunbookStateEdit', 'RunbookStatePublished' - State RunbookState `json:"state,omitempty"` - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // LogActivityTrace - Gets or sets the option to log activity trace of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` - // JobCount - Gets or sets the job count of the runbook. - JobCount *int32 `json:"jobCount,omitempty"` - // Parameters - Gets or sets the runbook parameters. - Parameters map[string]*RunbookParameter `json:"parameters"` - // OutputTypes - Gets or sets the runbook output types. - OutputTypes *[]string `json:"outputTypes,omitempty"` - // Draft - Gets or sets the draft runbook properties. - Draft *RunbookDraft `json:"draft,omitempty"` - // ProvisioningState - Gets or sets the provisioning state of the runbook. Possible values include: 'RunbookProvisioningStateSucceeded' - ProvisioningState RunbookProvisioningState `json:"provisioningState,omitempty"` - // LastModifiedBy - Gets or sets the last modified by. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunbookProperties. -func (rp RunbookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RunbookType != "" { - objectMap["runbookType"] = rp.RunbookType - } - if rp.PublishContentLink != nil { - objectMap["publishContentLink"] = rp.PublishContentLink - } - if rp.State != "" { - objectMap["state"] = rp.State - } - if rp.LogVerbose != nil { - objectMap["logVerbose"] = rp.LogVerbose - } - if rp.LogProgress != nil { - objectMap["logProgress"] = rp.LogProgress - } - if rp.LogActivityTrace != nil { - objectMap["logActivityTrace"] = rp.LogActivityTrace - } - if rp.JobCount != nil { - objectMap["jobCount"] = rp.JobCount - } - if rp.Parameters != nil { - objectMap["parameters"] = rp.Parameters - } - if rp.OutputTypes != nil { - objectMap["outputTypes"] = rp.OutputTypes - } - if rp.Draft != nil { - objectMap["draft"] = rp.Draft - } - if rp.ProvisioningState != "" { - objectMap["provisioningState"] = rp.ProvisioningState - } - if rp.LastModifiedBy != nil { - objectMap["lastModifiedBy"] = rp.LastModifiedBy - } - if rp.CreationTime != nil { - objectMap["creationTime"] = rp.CreationTime - } - if rp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = rp.LastModifiedTime - } - if rp.Description != nil { - objectMap["description"] = rp.Description - } - return json.Marshal(objectMap) -} - -// RunbookUpdateParameters the parameters supplied to the update runbook operation. -type RunbookUpdateParameters struct { - // RunbookUpdateProperties - Gets or sets the runbook update properties. - *RunbookUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for RunbookUpdateParameters. -func (rup RunbookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.RunbookUpdateProperties != nil { - objectMap["properties"] = rup.RunbookUpdateProperties - } - if rup.Name != nil { - objectMap["name"] = rup.Name - } - if rup.Location != nil { - objectMap["location"] = rup.Location - } - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RunbookUpdateParameters struct. -func (rup *RunbookUpdateParameters) 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 runbookUpdateProperties RunbookUpdateProperties - err = json.Unmarshal(*v, &runbookUpdateProperties) - if err != nil { - return err - } - rup.RunbookUpdateProperties = &runbookUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rup.Tags = tags - } - } - } - - return nil -} - -// RunbookUpdateProperties the parameters supplied to the update runbook properties. -type RunbookUpdateProperties struct { - // Description - Gets or sets the description of the runbook. - Description *string `json:"description,omitempty"` - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // LogActivityTrace - Gets or sets the activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// Schedule definition of the schedule. -type Schedule struct { - autorest.Response `json:"-"` - // ScheduleProperties - Gets or sets the properties of the schedule. - *ScheduleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Schedule. -func (s Schedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.ScheduleProperties != nil { - objectMap["properties"] = s.ScheduleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Schedule struct. -func (s *Schedule) 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 scheduleProperties ScheduleProperties - err = json.Unmarshal(*v, &scheduleProperties) - if err != nil { - return err - } - s.ScheduleProperties = &scheduleProperties - } - 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 - } - } - } - - return nil -} - -// ScheduleAssociationProperty the schedule property associated with the entity. -type ScheduleAssociationProperty struct { - // Name - Gets or sets the name of the Schedule. - Name *string `json:"name,omitempty"` -} - -// ScheduleCreateOrUpdateParameters the parameters supplied to the create or update schedule operation. -type ScheduleCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the Schedule. - Name *string `json:"name,omitempty"` - // ScheduleCreateOrUpdateProperties - Gets or sets the list of schedule properties. - *ScheduleCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleCreateOrUpdateParameters. -func (scoup ScheduleCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scoup.Name != nil { - objectMap["name"] = scoup.Name - } - if scoup.ScheduleCreateOrUpdateProperties != nil { - objectMap["properties"] = scoup.ScheduleCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScheduleCreateOrUpdateParameters struct. -func (scoup *ScheduleCreateOrUpdateParameters) 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 - } - scoup.Name = &name - } - case "properties": - if v != nil { - var scheduleCreateOrUpdateProperties ScheduleCreateOrUpdateProperties - err = json.Unmarshal(*v, &scheduleCreateOrUpdateProperties) - if err != nil { - return err - } - scoup.ScheduleCreateOrUpdateProperties = &scheduleCreateOrUpdateProperties - } - } - } - - return nil -} - -// ScheduleCreateOrUpdateProperties the parameters supplied to the create or update schedule operation. -type ScheduleCreateOrUpdateProperties struct { - // Description - Gets or sets the description of the schedule. - Description *string `json:"description,omitempty"` - // StartTime - Gets or sets the start time of the schedule. - StartTime *date.Time `json:"startTime,omitempty"` - // ExpiryTime - Gets or sets the end time of the schedule. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // Interval - Gets or sets the interval of the schedule. - Interval interface{} `json:"interval,omitempty"` - // Frequency - Gets or sets the frequency of the schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month', 'Minute' - Frequency ScheduleFrequency `json:"frequency,omitempty"` - // TimeZone - Gets or sets the time zone of the schedule. - TimeZone *string `json:"timeZone,omitempty"` - // AdvancedSchedule - Gets or sets the AdvancedSchedule. - AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` -} - -// ScheduleListResult the response model for the list schedule operation. -type ScheduleListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of schedules. - Value *[]Schedule `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ScheduleListResultIterator provides access to a complete listing of Schedule values. -type ScheduleListResultIterator struct { - i int - page ScheduleListResultPage -} - -// 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 *ScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleListResultIterator.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 *ScheduleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScheduleListResultIterator) 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 ScheduleListResultIterator) Response() ScheduleListResult { - 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 ScheduleListResultIterator) Value() Schedule { - if !iter.page.NotDone() { - return Schedule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScheduleListResultIterator type. -func NewScheduleListResultIterator(page ScheduleListResultPage) ScheduleListResultIterator { - return ScheduleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr ScheduleListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr ScheduleListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// scheduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr ScheduleListResult) scheduleListResultPreparer(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))) -} - -// ScheduleListResultPage contains a page of Schedule values. -type ScheduleListResultPage struct { - fn func(context.Context, ScheduleListResult) (ScheduleListResult, error) - slr ScheduleListResult -} - -// 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 *ScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleListResultPage.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 *ScheduleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScheduleListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScheduleListResultPage) Response() ScheduleListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScheduleListResultPage) Values() []Schedule { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the ScheduleListResultPage type. -func NewScheduleListResultPage(cur ScheduleListResult, getNextPage func(context.Context, ScheduleListResult) (ScheduleListResult, error)) ScheduleListResultPage { - return ScheduleListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// ScheduleProperties definition of schedule parameters. -type ScheduleProperties struct { - // StartTime - Gets or sets the start time of the schedule. - StartTime *date.Time `json:"startTime,omitempty"` - // StartTimeOffsetMinutes - READ-ONLY; Gets the start time's offset in minutes. - StartTimeOffsetMinutes *float64 `json:"startTimeOffsetMinutes,omitempty"` - // ExpiryTime - Gets or sets the end time of the schedule. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // ExpiryTimeOffsetMinutes - Gets or sets the expiry time's offset in minutes. - ExpiryTimeOffsetMinutes *float64 `json:"expiryTimeOffsetMinutes,omitempty"` - // IsEnabled - Gets or sets a value indicating whether this schedule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // NextRun - Gets or sets the next run time of the schedule. - NextRun *date.Time `json:"nextRun,omitempty"` - // NextRunOffsetMinutes - Gets or sets the next run time's offset in minutes. - NextRunOffsetMinutes *float64 `json:"nextRunOffsetMinutes,omitempty"` - // Interval - Gets or sets the interval of the schedule. - Interval *int32 `json:"interval,omitempty"` - // Frequency - Gets or sets the frequency of the schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month', 'Minute' - Frequency ScheduleFrequency `json:"frequency,omitempty"` - // TimeZone - Gets or sets the time zone of the schedule. - TimeZone *string `json:"timeZone,omitempty"` - // AdvancedSchedule - Gets or sets the advanced schedule. - AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleProperties. -func (sp ScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.StartTime != nil { - objectMap["startTime"] = sp.StartTime - } - if sp.ExpiryTime != nil { - objectMap["expiryTime"] = sp.ExpiryTime - } - if sp.ExpiryTimeOffsetMinutes != nil { - objectMap["expiryTimeOffsetMinutes"] = sp.ExpiryTimeOffsetMinutes - } - if sp.IsEnabled != nil { - objectMap["isEnabled"] = sp.IsEnabled - } - if sp.NextRun != nil { - objectMap["nextRun"] = sp.NextRun - } - if sp.NextRunOffsetMinutes != nil { - objectMap["nextRunOffsetMinutes"] = sp.NextRunOffsetMinutes - } - if sp.Interval != nil { - objectMap["interval"] = sp.Interval - } - if sp.Frequency != "" { - objectMap["frequency"] = sp.Frequency - } - if sp.TimeZone != nil { - objectMap["timeZone"] = sp.TimeZone - } - if sp.AdvancedSchedule != nil { - objectMap["advancedSchedule"] = sp.AdvancedSchedule - } - if sp.CreationTime != nil { - objectMap["creationTime"] = sp.CreationTime - } - if sp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = sp.LastModifiedTime - } - if sp.Description != nil { - objectMap["description"] = sp.Description - } - return json.Marshal(objectMap) -} - -// ScheduleUpdateParameters the parameters supplied to the update schedule operation. -type ScheduleUpdateParameters struct { - // Name - Gets or sets the name of the Schedule. - Name *string `json:"name,omitempty"` - // ScheduleUpdateProperties - Gets or sets the list of schedule properties. - *ScheduleUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleUpdateParameters. -func (sup ScheduleUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.Name != nil { - objectMap["name"] = sup.Name - } - if sup.ScheduleUpdateProperties != nil { - objectMap["properties"] = sup.ScheduleUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScheduleUpdateParameters struct. -func (sup *ScheduleUpdateParameters) 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 - } - sup.Name = &name - } - case "properties": - if v != nil { - var scheduleUpdateProperties ScheduleUpdateProperties - err = json.Unmarshal(*v, &scheduleUpdateProperties) - if err != nil { - return err - } - sup.ScheduleUpdateProperties = &scheduleUpdateProperties - } - } - } - - return nil -} - -// ScheduleUpdateProperties the parameters supplied to the update schedule operation. -type ScheduleUpdateProperties struct { - // Description - Gets or sets the description of the schedule. - Description *string `json:"description,omitempty"` - // IsEnabled - Gets or sets a value indicating whether this schedule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// SetObject ... -type SetObject struct { - autorest.Response `json:"-"` - Value interface{} `json:"value,omitempty"` -} - -// Sku the account SKU. -type Sku struct { - // Name - Gets or sets the SKU name of the account. Possible values include: 'Free', 'Basic' - Name SkuNameEnum `json:"name,omitempty"` - // Family - Gets or sets the SKU family. - Family *string `json:"family,omitempty"` - // Capacity - Gets or sets the SKU capacity. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SoftareUpdateConfigurationRunTaskProperties task properties of the software update configuration. -type SoftareUpdateConfigurationRunTaskProperties struct { - // Status - The status of the task. - Status *string `json:"status,omitempty"` - // Source - The name of the source of the task. - Source *string `json:"source,omitempty"` - // JobID - The job id of the task. - JobID *string `json:"jobId,omitempty"` -} - -// SoftareUpdateConfigurationRunTasks software update configuration run tasks model. -type SoftareUpdateConfigurationRunTasks struct { - // PreTask - Pre task properties. - PreTask *SoftareUpdateConfigurationRunTaskProperties `json:"preTask,omitempty"` - // PostTask - Post task properties. - PostTask *SoftareUpdateConfigurationRunTaskProperties `json:"postTask,omitempty"` -} - -// SoftwareUpdateConfiguration software update configuration properties. -type SoftwareUpdateConfiguration struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // SoftwareUpdateConfigurationProperties - Software update configuration properties. - *SoftwareUpdateConfigurationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfiguration. -func (suc SoftwareUpdateConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if suc.SoftwareUpdateConfigurationProperties != nil { - objectMap["properties"] = suc.SoftwareUpdateConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfiguration struct. -func (suc *SoftwareUpdateConfiguration) 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 - } - suc.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - suc.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - suc.Type = &typeVar - } - case "properties": - if v != nil { - var softwareUpdateConfigurationProperties SoftwareUpdateConfigurationProperties - err = json.Unmarshal(*v, &softwareUpdateConfigurationProperties) - if err != nil { - return err - } - suc.SoftwareUpdateConfigurationProperties = &softwareUpdateConfigurationProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationCollectionItem software update configuration collection item properties. -type SoftwareUpdateConfigurationCollectionItem struct { - // Name - READ-ONLY; Name of the software update configuration. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id of the software update configuration - ID *string `json:"id,omitempty"` - // SoftwareUpdateConfigurationCollectionItemProperties - Software update configuration properties. - *SoftwareUpdateConfigurationCollectionItemProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationCollectionItem. -func (succi SoftwareUpdateConfigurationCollectionItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if succi.SoftwareUpdateConfigurationCollectionItemProperties != nil { - objectMap["properties"] = succi.SoftwareUpdateConfigurationCollectionItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfigurationCollectionItem struct. -func (succi *SoftwareUpdateConfigurationCollectionItem) 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 - } - succi.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - succi.ID = &ID - } - case "properties": - if v != nil { - var softwareUpdateConfigurationCollectionItemProperties SoftwareUpdateConfigurationCollectionItemProperties - err = json.Unmarshal(*v, &softwareUpdateConfigurationCollectionItemProperties) - if err != nil { - return err - } - succi.SoftwareUpdateConfigurationCollectionItemProperties = &softwareUpdateConfigurationCollectionItemProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationCollectionItemProperties software update configuration collection item -// properties. -type SoftwareUpdateConfigurationCollectionItemProperties struct { - // UpdateConfiguration - Update specific properties of the software update configuration. - UpdateConfiguration *CollectionItemUpdateConfiguration `json:"updateConfiguration,omitempty"` - // Frequency - execution frequency of the schedule associated with the software update configuration. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month', 'Minute' - Frequency ScheduleFrequency `json:"frequency,omitempty"` - // StartTime - the start time of the update. - StartTime *date.Time `json:"startTime,omitempty"` - // CreationTime - READ-ONLY; Creation time of the software update configuration, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Last time software update configuration was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state for the software update configuration, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // NextRun - ext run time of the update. - NextRun *date.Time `json:"nextRun,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationCollectionItemProperties. -func (succip SoftwareUpdateConfigurationCollectionItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if succip.UpdateConfiguration != nil { - objectMap["updateConfiguration"] = succip.UpdateConfiguration - } - if succip.Frequency != "" { - objectMap["frequency"] = succip.Frequency - } - if succip.StartTime != nil { - objectMap["startTime"] = succip.StartTime - } - if succip.NextRun != nil { - objectMap["nextRun"] = succip.NextRun - } - return json.Marshal(objectMap) -} - -// SoftwareUpdateConfigurationListResult result of listing all software update configuration -type SoftwareUpdateConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - outer object returned when listing all software update configurations - Value *[]SoftwareUpdateConfigurationCollectionItem `json:"value,omitempty"` -} - -// SoftwareUpdateConfigurationMachineRun software update configuration machine run model. -type SoftwareUpdateConfigurationMachineRun struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Name of the software update configuration machine run - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id of the software update configuration machine run - ID *string `json:"id,omitempty"` - // UpdateConfigurationMachineRunProperties - Software update configuration machine run properties. - *UpdateConfigurationMachineRunProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationMachineRun. -func (sucmr SoftwareUpdateConfigurationMachineRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucmr.UpdateConfigurationMachineRunProperties != nil { - objectMap["properties"] = sucmr.UpdateConfigurationMachineRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfigurationMachineRun struct. -func (sucmr *SoftwareUpdateConfigurationMachineRun) 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 - } - sucmr.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sucmr.ID = &ID - } - case "properties": - if v != nil { - var updateConfigurationMachineRunProperties UpdateConfigurationMachineRunProperties - err = json.Unmarshal(*v, &updateConfigurationMachineRunProperties) - if err != nil { - return err - } - sucmr.UpdateConfigurationMachineRunProperties = &updateConfigurationMachineRunProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationMachineRunListResult result of listing all software update configuration -// machine runs -type SoftwareUpdateConfigurationMachineRunListResult struct { - autorest.Response `json:"-"` - // Value - outer object returned when listing all software update configuration machine runs - Value *[]SoftwareUpdateConfigurationMachineRun `json:"value,omitempty"` - // NextLink - link to next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SoftwareUpdateConfigurationProperties software update configuration properties. -type SoftwareUpdateConfigurationProperties struct { - // UpdateConfiguration - update specific properties for the Software update configuration - UpdateConfiguration *UpdateConfiguration `json:"updateConfiguration,omitempty"` - // ScheduleInfo - Schedule information for the Software update configuration - ScheduleInfo *ScheduleProperties `json:"scheduleInfo,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state for the software update configuration, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Error - Details of provisioning error - Error *ErrorResponse `json:"error,omitempty"` - // CreationTime - READ-ONLY; Creation time of the resource, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CreatedBy - READ-ONLY; CreatedBy property, which only appears in the response. - CreatedBy *string `json:"createdBy,omitempty"` - // LastModifiedTime - READ-ONLY; Last time resource was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; LastModifiedBy property, which only appears in the response. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Tasks - Tasks information for the Software update configuration. - Tasks *SoftwareUpdateConfigurationTasks `json:"tasks,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationProperties. -func (sucp SoftwareUpdateConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucp.UpdateConfiguration != nil { - objectMap["updateConfiguration"] = sucp.UpdateConfiguration - } - if sucp.ScheduleInfo != nil { - objectMap["scheduleInfo"] = sucp.ScheduleInfo - } - if sucp.Error != nil { - objectMap["error"] = sucp.Error - } - if sucp.Tasks != nil { - objectMap["tasks"] = sucp.Tasks - } - return json.Marshal(objectMap) -} - -// SoftwareUpdateConfigurationRun software update configuration Run properties. -type SoftwareUpdateConfigurationRun struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Name of the software update configuration run. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id of the software update configuration run - ID *string `json:"id,omitempty"` - // SoftwareUpdateConfigurationRunProperties - Software update configuration Run properties. - *SoftwareUpdateConfigurationRunProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationRun. -func (sucr SoftwareUpdateConfigurationRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucr.SoftwareUpdateConfigurationRunProperties != nil { - objectMap["properties"] = sucr.SoftwareUpdateConfigurationRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfigurationRun struct. -func (sucr *SoftwareUpdateConfigurationRun) 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 - } - sucr.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sucr.ID = &ID - } - case "properties": - if v != nil { - var softwareUpdateConfigurationRunProperties SoftwareUpdateConfigurationRunProperties - err = json.Unmarshal(*v, &softwareUpdateConfigurationRunProperties) - if err != nil { - return err - } - sucr.SoftwareUpdateConfigurationRunProperties = &softwareUpdateConfigurationRunProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationRunListResult result of listing all software update configuration runs -type SoftwareUpdateConfigurationRunListResult struct { - autorest.Response `json:"-"` - // Value - outer object returned when listing all software update configuration runs - Value *[]SoftwareUpdateConfigurationRun `json:"value,omitempty"` - // NextLink - link to next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SoftwareUpdateConfigurationRunProperties software update configuration properties. -type SoftwareUpdateConfigurationRunProperties struct { - // SoftwareUpdateConfiguration - software update configuration triggered this run - SoftwareUpdateConfiguration *UpdateConfigurationNavigation `json:"softwareUpdateConfiguration,omitempty"` - // Status - READ-ONLY; Status of the software update configuration run. - Status *string `json:"status,omitempty"` - // ConfiguredDuration - READ-ONLY; Configured duration for the software update configuration run. - ConfiguredDuration *string `json:"configuredDuration,omitempty"` - // OsType - READ-ONLY; Operating system target of the software update configuration triggered this run - OsType *string `json:"osType,omitempty"` - // StartTime - READ-ONLY; Start time of the software update configuration run. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; End time of the software update configuration run. - EndTime *date.Time `json:"endTime,omitempty"` - // ComputerCount - READ-ONLY; Number of computers in the software update configuration run. - ComputerCount *int32 `json:"computerCount,omitempty"` - // FailedCount - READ-ONLY; Number of computers with failed status. - FailedCount *int32 `json:"failedCount,omitempty"` - // CreationTime - READ-ONLY; Creation time of the resource, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CreatedBy - READ-ONLY; CreatedBy property, which only appears in the response. - CreatedBy *string `json:"createdBy,omitempty"` - // LastModifiedTime - READ-ONLY; Last time resource was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; LastModifiedBy property, which only appears in the response. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Tasks - Software update configuration tasks triggered in this run - Tasks *SoftareUpdateConfigurationRunTasks `json:"tasks,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationRunProperties. -func (sucrp SoftwareUpdateConfigurationRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucrp.SoftwareUpdateConfiguration != nil { - objectMap["softwareUpdateConfiguration"] = sucrp.SoftwareUpdateConfiguration - } - if sucrp.Tasks != nil { - objectMap["tasks"] = sucrp.Tasks - } - return json.Marshal(objectMap) -} - -// SoftwareUpdateConfigurationTasks task properties of the software update configuration. -type SoftwareUpdateConfigurationTasks struct { - // PreTask - Pre task properties. - PreTask *TaskProperties `json:"preTask,omitempty"` - // PostTask - Post task properties. - PostTask *TaskProperties `json:"postTask,omitempty"` -} - -// SourceControl definition of the source control. -type SourceControl struct { - autorest.Response `json:"-"` - // SourceControlProperties - The properties of the source control. - *SourceControlProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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 - } - 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 "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 - } - } - } - - return nil -} - -// SourceControlCreateOrUpdateParameters the parameters supplied to the create or update source control -// operation. -type SourceControlCreateOrUpdateParameters struct { - // SourceControlCreateOrUpdateProperties - The properties of the source control. - *SourceControlCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlCreateOrUpdateParameters. -func (sccoup SourceControlCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccoup.SourceControlCreateOrUpdateProperties != nil { - objectMap["properties"] = sccoup.SourceControlCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlCreateOrUpdateParameters struct. -func (sccoup *SourceControlCreateOrUpdateParameters) 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 sourceControlCreateOrUpdateProperties SourceControlCreateOrUpdateProperties - err = json.Unmarshal(*v, &sourceControlCreateOrUpdateProperties) - if err != nil { - return err - } - sccoup.SourceControlCreateOrUpdateProperties = &sourceControlCreateOrUpdateProperties - } - } - } - - return nil -} - -// SourceControlCreateOrUpdateProperties the properties of the create source control operation. -type SourceControlCreateOrUpdateProperties struct { - // RepoURL - The repo url of the source control. - RepoURL *string `json:"repoUrl,omitempty"` - // Branch - The repo branch of the source control. Include branch as empty string for VsoTfvc. - Branch *string `json:"branch,omitempty"` - // FolderPath - The folder path of the source control. Path must be relative. - FolderPath *string `json:"folderPath,omitempty"` - // AutoSync - The auto async of the source control. Default is false. - AutoSync *bool `json:"autoSync,omitempty"` - // PublishRunbook - The auto publish of the source control. Default is true. - PublishRunbook *bool `json:"publishRunbook,omitempty"` - // SourceType - The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' - SourceType SourceType `json:"sourceType,omitempty"` - // SecurityToken - The authorization token for the repo of the source control. - SecurityToken *SourceControlSecurityTokenProperties `json:"securityToken,omitempty"` - // Description - The user description of the source control. - Description *string `json:"description,omitempty"` -} - -// SourceControlListResult the response model for the list source controls operation. -type SourceControlListResult struct { - autorest.Response `json:"-"` - // Value - The list of source controls. - Value *[]SourceControl `json:"value,omitempty"` - // NextLink - The next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// SourceControlListResultIterator provides access to a complete listing of SourceControl values. -type SourceControlListResultIterator struct { - i int - page SourceControlListResultPage -} - -// 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 *SourceControlListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlListResultIterator.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 *SourceControlListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceControlListResultIterator) 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 SourceControlListResultIterator) Response() SourceControlListResult { - 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 SourceControlListResultIterator) Value() SourceControl { - if !iter.page.NotDone() { - return SourceControl{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceControlListResultIterator type. -func NewSourceControlListResultIterator(page SourceControlListResultPage) SourceControlListResultIterator { - return SourceControlListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sclr SourceControlListResult) IsEmpty() bool { - return sclr.Value == nil || len(*sclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sclr SourceControlListResult) hasNextLink() bool { - return sclr.NextLink != nil && len(*sclr.NextLink) != 0 -} - -// sourceControlListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sclr SourceControlListResult) sourceControlListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sclr.NextLink))) -} - -// SourceControlListResultPage contains a page of SourceControl values. -type SourceControlListResultPage struct { - fn func(context.Context, SourceControlListResult) (SourceControlListResult, error) - sclr SourceControlListResult -} - -// 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 *SourceControlListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlListResultPage.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.sclr) - if err != nil { - return err - } - page.sclr = 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 *SourceControlListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceControlListResultPage) NotDone() bool { - return !page.sclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceControlListResultPage) Response() SourceControlListResult { - return page.sclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceControlListResultPage) Values() []SourceControl { - if page.sclr.IsEmpty() { - return nil - } - return *page.sclr.Value -} - -// Creates a new instance of the SourceControlListResultPage type. -func NewSourceControlListResultPage(cur SourceControlListResult, getNextPage func(context.Context, SourceControlListResult) (SourceControlListResult, error)) SourceControlListResultPage { - return SourceControlListResultPage{ - fn: getNextPage, - sclr: cur, - } -} - -// SourceControlProperties definition of the source control properties -type SourceControlProperties struct { - // RepoURL - The repo url of the source control. - RepoURL *string `json:"repoUrl,omitempty"` - // Branch - The repo branch of the source control. Include branch as empty string for VsoTfvc. - Branch *string `json:"branch,omitempty"` - // FolderPath - The folder path of the source control. - FolderPath *string `json:"folderPath,omitempty"` - // AutoSync - The auto sync of the source control. Default is false. - AutoSync *bool `json:"autoSync,omitempty"` - // PublishRunbook - The auto publish of the source control. Default is true. - PublishRunbook *bool `json:"publishRunbook,omitempty"` - // SourceType - The source type. Must be one of VsoGit, VsoTfvc, GitHub. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' - SourceType SourceType `json:"sourceType,omitempty"` - // Description - The description. - Description *string `json:"description,omitempty"` - // CreationTime - The creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - The last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` -} - -// SourceControlSecurityTokenProperties ... -type SourceControlSecurityTokenProperties struct { - // AccessToken - The access token. - AccessToken *string `json:"accessToken,omitempty"` - // RefreshToken - The refresh token. - RefreshToken *string `json:"refreshToken,omitempty"` - // TokenType - The token type. Must be either PersonalAccessToken or Oauth. Possible values include: 'PersonalAccessToken', 'Oauth' - TokenType TokenType `json:"tokenType,omitempty"` -} - -// SourceControlSyncJob definition of the source control sync job. -type SourceControlSyncJob struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; Resource id. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobProperties - The properties of the source control sync job. - *SourceControlSyncJobProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJob. -func (scsj SourceControlSyncJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsj.SourceControlSyncJobProperties != nil { - objectMap["properties"] = scsj.SourceControlSyncJobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJob struct. -func (scsj *SourceControlSyncJob) 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 - } - scsj.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scsj.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scsj.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobProperties SourceControlSyncJobProperties - err = json.Unmarshal(*v, &sourceControlSyncJobProperties) - if err != nil { - return err - } - scsj.SourceControlSyncJobProperties = &sourceControlSyncJobProperties - } - } - } - - return nil -} - -// SourceControlSyncJobByID definition of the source control sync job. -type SourceControlSyncJobByID struct { - autorest.Response `json:"-"` - // ID - The id of the job. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobByIDProperties - The properties of the source control sync job. - *SourceControlSyncJobByIDProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobByID. -func (scsjbi SourceControlSyncJobByID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjbi.ID != nil { - objectMap["id"] = scsjbi.ID - } - if scsjbi.SourceControlSyncJobByIDProperties != nil { - objectMap["properties"] = scsjbi.SourceControlSyncJobByIDProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobByID struct. -func (scsjbi *SourceControlSyncJobByID) 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 - } - scsjbi.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobByIDProperties SourceControlSyncJobByIDProperties - err = json.Unmarshal(*v, &sourceControlSyncJobByIDProperties) - if err != nil { - return err - } - scsjbi.SourceControlSyncJobByIDProperties = &sourceControlSyncJobByIDProperties - } - } - } - - return nil -} - -// SourceControlSyncJobByIDProperties definition of source control sync job properties. -type SourceControlSyncJobByIDProperties struct { - // SourceControlSyncJobID - The source control sync job id. - SourceControlSyncJobID *string `json:"sourceControlSyncJobId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - The provisioning state of the job. Possible values include: 'Completed', 'Failed', 'Running' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // StartTime - READ-ONLY; The start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // SyncType - The sync type. Possible values include: 'PartialSync', 'FullSync' - SyncType SyncType `json:"syncType,omitempty"` - // Exception - The exceptions that occurred while running the sync job. - Exception *string `json:"exception,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobByIDProperties. -func (scsjbip SourceControlSyncJobByIDProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjbip.SourceControlSyncJobID != nil { - objectMap["sourceControlSyncJobId"] = scsjbip.SourceControlSyncJobID - } - if scsjbip.ProvisioningState != "" { - objectMap["provisioningState"] = scsjbip.ProvisioningState - } - if scsjbip.SyncType != "" { - objectMap["syncType"] = scsjbip.SyncType - } - if scsjbip.Exception != nil { - objectMap["exception"] = scsjbip.Exception - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobCreateParameters the parameters supplied to the create source control sync job -// operation. -type SourceControlSyncJobCreateParameters struct { - // SourceControlSyncJobCreateProperties - The properties of the source control sync job. - *SourceControlSyncJobCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobCreateParameters. -func (scsjcp SourceControlSyncJobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjcp.SourceControlSyncJobCreateProperties != nil { - objectMap["properties"] = scsjcp.SourceControlSyncJobCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobCreateParameters struct. -func (scsjcp *SourceControlSyncJobCreateParameters) 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 sourceControlSyncJobCreateProperties SourceControlSyncJobCreateProperties - err = json.Unmarshal(*v, &sourceControlSyncJobCreateProperties) - if err != nil { - return err - } - scsjcp.SourceControlSyncJobCreateProperties = &sourceControlSyncJobCreateProperties - } - } - } - - return nil -} - -// SourceControlSyncJobCreateProperties definition of create source control sync job properties. -type SourceControlSyncJobCreateProperties struct { - // CommitID - The commit id of the source control sync job. If not syncing to a commitId, enter an empty string. - CommitID *string `json:"commitId,omitempty"` -} - -// SourceControlSyncJobListResult the response model for the list source control sync jobs operation. -type SourceControlSyncJobListResult struct { - autorest.Response `json:"-"` - // Value - The list of source control sync jobs. - Value *[]SourceControlSyncJob `json:"value,omitempty"` - // NextLink - The next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// SourceControlSyncJobListResultIterator provides access to a complete listing of SourceControlSyncJob -// values. -type SourceControlSyncJobListResultIterator struct { - i int - page SourceControlSyncJobListResultPage -} - -// 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 *SourceControlSyncJobListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobListResultIterator.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 *SourceControlSyncJobListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceControlSyncJobListResultIterator) 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 SourceControlSyncJobListResultIterator) Response() SourceControlSyncJobListResult { - 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 SourceControlSyncJobListResultIterator) Value() SourceControlSyncJob { - if !iter.page.NotDone() { - return SourceControlSyncJob{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceControlSyncJobListResultIterator type. -func NewSourceControlSyncJobListResultIterator(page SourceControlSyncJobListResultPage) SourceControlSyncJobListResultIterator { - return SourceControlSyncJobListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (scsjlr SourceControlSyncJobListResult) IsEmpty() bool { - return scsjlr.Value == nil || len(*scsjlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (scsjlr SourceControlSyncJobListResult) hasNextLink() bool { - return scsjlr.NextLink != nil && len(*scsjlr.NextLink) != 0 -} - -// sourceControlSyncJobListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (scsjlr SourceControlSyncJobListResult) sourceControlSyncJobListResultPreparer(ctx context.Context) (*http.Request, error) { - if !scsjlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(scsjlr.NextLink))) -} - -// SourceControlSyncJobListResultPage contains a page of SourceControlSyncJob values. -type SourceControlSyncJobListResultPage struct { - fn func(context.Context, SourceControlSyncJobListResult) (SourceControlSyncJobListResult, error) - scsjlr SourceControlSyncJobListResult -} - -// 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 *SourceControlSyncJobListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobListResultPage.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.scsjlr) - if err != nil { - return err - } - page.scsjlr = 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 *SourceControlSyncJobListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceControlSyncJobListResultPage) NotDone() bool { - return !page.scsjlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceControlSyncJobListResultPage) Response() SourceControlSyncJobListResult { - return page.scsjlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceControlSyncJobListResultPage) Values() []SourceControlSyncJob { - if page.scsjlr.IsEmpty() { - return nil - } - return *page.scsjlr.Value -} - -// Creates a new instance of the SourceControlSyncJobListResultPage type. -func NewSourceControlSyncJobListResultPage(cur SourceControlSyncJobListResult, getNextPage func(context.Context, SourceControlSyncJobListResult) (SourceControlSyncJobListResult, error)) SourceControlSyncJobListResultPage { - return SourceControlSyncJobListResultPage{ - fn: getNextPage, - scsjlr: cur, - } -} - -// SourceControlSyncJobProperties definition of source control sync job properties. -type SourceControlSyncJobProperties struct { - // SourceControlSyncJobID - The source control sync job id. - SourceControlSyncJobID *string `json:"sourceControlSyncJobId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - The provisioning state of the job. Possible values include: 'Completed', 'Failed', 'Running' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // StartTime - READ-ONLY; The start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // SyncType - The sync type. Possible values include: 'PartialSync', 'FullSync' - SyncType SyncType `json:"syncType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobProperties. -func (scsjp SourceControlSyncJobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjp.SourceControlSyncJobID != nil { - objectMap["sourceControlSyncJobId"] = scsjp.SourceControlSyncJobID - } - if scsjp.ProvisioningState != "" { - objectMap["provisioningState"] = scsjp.ProvisioningState - } - if scsjp.SyncType != "" { - objectMap["syncType"] = scsjp.SyncType - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStream definition of the source control sync job stream. -type SourceControlSyncJobStream struct { - // ID - READ-ONLY; Resource id. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobStreamProperties - The properties of the source control sync job stream. - *SourceControlSyncJobStreamProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStream. -func (scsjs SourceControlSyncJobStream) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjs.SourceControlSyncJobStreamProperties != nil { - objectMap["properties"] = scsjs.SourceControlSyncJobStreamProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobStream struct. -func (scsjs *SourceControlSyncJobStream) 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 - } - scsjs.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobStreamProperties SourceControlSyncJobStreamProperties - err = json.Unmarshal(*v, &sourceControlSyncJobStreamProperties) - if err != nil { - return err - } - scsjs.SourceControlSyncJobStreamProperties = &sourceControlSyncJobStreamProperties - } - } - } - - return nil -} - -// SourceControlSyncJobStreamByID definition of the source control sync job stream by id. -type SourceControlSyncJobStreamByID struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Resource id. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobStreamByIDProperties - The properties of the source control sync job stream. - *SourceControlSyncJobStreamByIDProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamByID. -func (scsjsbi SourceControlSyncJobStreamByID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjsbi.SourceControlSyncJobStreamByIDProperties != nil { - objectMap["properties"] = scsjsbi.SourceControlSyncJobStreamByIDProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobStreamByID struct. -func (scsjsbi *SourceControlSyncJobStreamByID) 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 - } - scsjsbi.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobStreamByIDProperties SourceControlSyncJobStreamByIDProperties - err = json.Unmarshal(*v, &sourceControlSyncJobStreamByIDProperties) - if err != nil { - return err - } - scsjsbi.SourceControlSyncJobStreamByIDProperties = &sourceControlSyncJobStreamByIDProperties - } - } - } - - return nil -} - -// SourceControlSyncJobStreamByIDProperties definition of source control sync job stream by id properties. -type SourceControlSyncJobStreamByIDProperties struct { - // SourceControlSyncJobStreamID - The sync job stream id. - SourceControlSyncJobStreamID *string `json:"sourceControlSyncJobStreamId,omitempty"` - // Summary - The summary of the sync job stream. - Summary *string `json:"summary,omitempty"` - // Time - READ-ONLY; The time of the sync job stream. - Time *date.Time `json:"time,omitempty"` - // StreamType - The type of the sync job stream. Possible values include: 'StreamTypeError', 'StreamTypeOutput' - StreamType StreamType `json:"streamType,omitempty"` - // StreamText - The text of the sync job stream. - StreamText *string `json:"streamText,omitempty"` - // Value - The values of the job stream. - Value map[string]interface{} `json:"value"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamByIDProperties. -func (scsjsbip SourceControlSyncJobStreamByIDProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjsbip.SourceControlSyncJobStreamID != nil { - objectMap["sourceControlSyncJobStreamId"] = scsjsbip.SourceControlSyncJobStreamID - } - if scsjsbip.Summary != nil { - objectMap["summary"] = scsjsbip.Summary - } - if scsjsbip.StreamType != "" { - objectMap["streamType"] = scsjsbip.StreamType - } - if scsjsbip.StreamText != nil { - objectMap["streamText"] = scsjsbip.StreamText - } - if scsjsbip.Value != nil { - objectMap["value"] = scsjsbip.Value - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStreamProperties definition of source control sync job stream properties. -type SourceControlSyncJobStreamProperties struct { - // SourceControlSyncJobStreamID - The sync job stream id. - SourceControlSyncJobStreamID *string `json:"sourceControlSyncJobStreamId,omitempty"` - // Summary - The summary of the sync job stream. - Summary *string `json:"summary,omitempty"` - // Time - READ-ONLY; The time of the sync job stream. - Time *date.Time `json:"time,omitempty"` - // StreamType - The type of the sync job stream. Possible values include: 'StreamTypeError', 'StreamTypeOutput' - StreamType StreamType `json:"streamType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamProperties. -func (scsjsp SourceControlSyncJobStreamProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjsp.SourceControlSyncJobStreamID != nil { - objectMap["sourceControlSyncJobStreamId"] = scsjsp.SourceControlSyncJobStreamID - } - if scsjsp.Summary != nil { - objectMap["summary"] = scsjsp.Summary - } - if scsjsp.StreamType != "" { - objectMap["streamType"] = scsjsp.StreamType - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStreamsListBySyncJob the response model for the list source control sync job streams -// operation. -type SourceControlSyncJobStreamsListBySyncJob struct { - autorest.Response `json:"-"` - // Value - The list of source control sync job streams. - Value *[]SourceControlSyncJobStream `json:"value,omitempty"` - // NextLink - READ-ONLY; The next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamsListBySyncJob. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjslbsj.Value != nil { - objectMap["value"] = scsjslbsj.Value - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStreamsListBySyncJobIterator provides access to a complete listing of -// SourceControlSyncJobStream values. -type SourceControlSyncJobStreamsListBySyncJobIterator struct { - i int - page SourceControlSyncJobStreamsListBySyncJobPage -} - -// 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 *SourceControlSyncJobStreamsListBySyncJobIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsListBySyncJobIterator.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 *SourceControlSyncJobStreamsListBySyncJobIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceControlSyncJobStreamsListBySyncJobIterator) 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 SourceControlSyncJobStreamsListBySyncJobIterator) Response() SourceControlSyncJobStreamsListBySyncJob { - 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 SourceControlSyncJobStreamsListBySyncJobIterator) Value() SourceControlSyncJobStream { - if !iter.page.NotDone() { - return SourceControlSyncJobStream{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceControlSyncJobStreamsListBySyncJobIterator type. -func NewSourceControlSyncJobStreamsListBySyncJobIterator(page SourceControlSyncJobStreamsListBySyncJobPage) SourceControlSyncJobStreamsListBySyncJobIterator { - return SourceControlSyncJobStreamsListBySyncJobIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) IsEmpty() bool { - return scsjslbsj.Value == nil || len(*scsjslbsj.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) hasNextLink() bool { - return scsjslbsj.NextLink != nil && len(*scsjslbsj.NextLink) != 0 -} - -// sourceControlSyncJobStreamsListBySyncJobPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) sourceControlSyncJobStreamsListBySyncJobPreparer(ctx context.Context) (*http.Request, error) { - if !scsjslbsj.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(scsjslbsj.NextLink))) -} - -// SourceControlSyncJobStreamsListBySyncJobPage contains a page of SourceControlSyncJobStream values. -type SourceControlSyncJobStreamsListBySyncJobPage struct { - fn func(context.Context, SourceControlSyncJobStreamsListBySyncJob) (SourceControlSyncJobStreamsListBySyncJob, error) - scsjslbsj SourceControlSyncJobStreamsListBySyncJob -} - -// 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 *SourceControlSyncJobStreamsListBySyncJobPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsListBySyncJobPage.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.scsjslbsj) - if err != nil { - return err - } - page.scsjslbsj = 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 *SourceControlSyncJobStreamsListBySyncJobPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceControlSyncJobStreamsListBySyncJobPage) NotDone() bool { - return !page.scsjslbsj.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceControlSyncJobStreamsListBySyncJobPage) Response() SourceControlSyncJobStreamsListBySyncJob { - return page.scsjslbsj -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceControlSyncJobStreamsListBySyncJobPage) Values() []SourceControlSyncJobStream { - if page.scsjslbsj.IsEmpty() { - return nil - } - return *page.scsjslbsj.Value -} - -// Creates a new instance of the SourceControlSyncJobStreamsListBySyncJobPage type. -func NewSourceControlSyncJobStreamsListBySyncJobPage(cur SourceControlSyncJobStreamsListBySyncJob, getNextPage func(context.Context, SourceControlSyncJobStreamsListBySyncJob) (SourceControlSyncJobStreamsListBySyncJob, error)) SourceControlSyncJobStreamsListBySyncJobPage { - return SourceControlSyncJobStreamsListBySyncJobPage{ - fn: getNextPage, - scsjslbsj: cur, - } -} - -// SourceControlUpdateParameters the parameters supplied to the update source control operation. -type SourceControlUpdateParameters struct { - // SourceControlUpdateProperties - The value of the source control. - *SourceControlUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlUpdateParameters. -func (scup SourceControlUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scup.SourceControlUpdateProperties != nil { - objectMap["properties"] = scup.SourceControlUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlUpdateParameters struct. -func (scup *SourceControlUpdateParameters) 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 sourceControlUpdateProperties SourceControlUpdateProperties - err = json.Unmarshal(*v, &sourceControlUpdateProperties) - if err != nil { - return err - } - scup.SourceControlUpdateProperties = &sourceControlUpdateProperties - } - } - } - - return nil -} - -// SourceControlUpdateProperties the properties of the update source control -type SourceControlUpdateProperties struct { - // Branch - The repo branch of the source control. - Branch *string `json:"branch,omitempty"` - // FolderPath - The folder path of the source control. Path must be relative. - FolderPath *string `json:"folderPath,omitempty"` - // AutoSync - The auto sync of the source control. Default is false. - AutoSync *bool `json:"autoSync,omitempty"` - // PublishRunbook - The auto publish of the source control. Default is true. - PublishRunbook *bool `json:"publishRunbook,omitempty"` - // SecurityToken - The authorization token for the repo of the source control. - SecurityToken *SourceControlSecurityTokenProperties `json:"securityToken,omitempty"` - // Description - The user description of the source control. - Description *string `json:"description,omitempty"` -} - -// Statistics definition of the statistic. -type Statistics struct { - // CounterProperty - READ-ONLY; Gets the property value of the statistic. - CounterProperty *string `json:"counterProperty,omitempty"` - // CounterValue - READ-ONLY; Gets the value of the statistic. - CounterValue *int64 `json:"counterValue,omitempty"` - // StartTime - READ-ONLY; Gets the startTime of the statistic. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the endTime of the statistic. - EndTime *date.Time `json:"endTime,omitempty"` - // ID - READ-ONLY; Gets the id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for Statistics. -func (s Statistics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StatisticsListResult the response model for the list statistics operation. -type StatisticsListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of statistics. - Value *[]Statistics `json:"value,omitempty"` -} - -// String ... -type String struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// TagSettingsProperties tag filter information for the VM. -type TagSettingsProperties struct { - // Tags - Dictionary of tags with its list of values. - Tags map[string][]string `json:"tags"` - // FilterOperator - Filter VMs by Any or All specified tags. Possible values include: 'TagOperatorsAll', 'TagOperatorsAny' - FilterOperator TagOperators `json:"filterOperator,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagSettingsProperties. -func (tsp TagSettingsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsp.Tags != nil { - objectMap["tags"] = tsp.Tags - } - if tsp.FilterOperator != "" { - objectMap["filterOperator"] = tsp.FilterOperator - } - return json.Marshal(objectMap) -} - -// TargetProperties group specific to the update configuration. -type TargetProperties struct { - // AzureQueries - List of Azure queries in the software update configuration. - AzureQueries *[]AzureQueryProperties `json:"azureQueries,omitempty"` - // NonAzureQueries - List of non Azure queries in the software update configuration. - NonAzureQueries *[]NonAzureQueryProperties `json:"nonAzureQueries,omitempty"` -} - -// TaskProperties task properties of the software update configuration. -type TaskProperties struct { - // Parameters - Gets or sets the parameters of the task. - Parameters map[string]*string `json:"parameters"` - // Source - Gets or sets the name of the runbook. - Source *string `json:"source,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskProperties. -func (tp TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.Parameters != nil { - objectMap["parameters"] = tp.Parameters - } - if tp.Source != nil { - objectMap["source"] = tp.Source - } - return json.Marshal(objectMap) -} - -// TestJob definition of the test job. -type TestJob struct { - autorest.Response `json:"-"` - // CreationTime - Gets or sets the creation time of the test job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Status - Gets or sets the status of the test job. - Status *string `json:"status,omitempty"` - // StatusDetails - Gets or sets the status details of the test job. - StatusDetails *string `json:"statusDetails,omitempty"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` - // StartTime - Gets or sets the start time of the test job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Gets or sets the end time of the test job. - EndTime *date.Time `json:"endTime,omitempty"` - // Exception - Gets or sets the exception of the test job. - Exception *string `json:"exception,omitempty"` - // LastModifiedTime - Gets or sets the last modified time of the test job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastStatusModifiedTime - Gets or sets the last status modified time of the test job. - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - // Parameters - Gets or sets the parameters of the test job. - Parameters map[string]*string `json:"parameters"` - // LogActivityTrace - The activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// MarshalJSON is the custom marshaler for TestJob. -func (tj TestJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tj.CreationTime != nil { - objectMap["creationTime"] = tj.CreationTime - } - if tj.Status != nil { - objectMap["status"] = tj.Status - } - if tj.StatusDetails != nil { - objectMap["statusDetails"] = tj.StatusDetails - } - if tj.RunOn != nil { - objectMap["runOn"] = tj.RunOn - } - if tj.StartTime != nil { - objectMap["startTime"] = tj.StartTime - } - if tj.EndTime != nil { - objectMap["endTime"] = tj.EndTime - } - if tj.Exception != nil { - objectMap["exception"] = tj.Exception - } - if tj.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = tj.LastModifiedTime - } - if tj.LastStatusModifiedTime != nil { - objectMap["lastStatusModifiedTime"] = tj.LastStatusModifiedTime - } - if tj.Parameters != nil { - objectMap["parameters"] = tj.Parameters - } - if tj.LogActivityTrace != nil { - objectMap["logActivityTrace"] = tj.LogActivityTrace - } - return json.Marshal(objectMap) -} - -// TestJobCreateParameters the parameters supplied to the create test job operation. -type TestJobCreateParameters struct { - // Parameters - Gets or sets the parameters of the test job. - Parameters map[string]*string `json:"parameters"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for TestJobCreateParameters. -func (tjcp TestJobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tjcp.Parameters != nil { - objectMap["parameters"] = tjcp.Parameters - } - if tjcp.RunOn != nil { - objectMap["runOn"] = tjcp.RunOn - } - return json.Marshal(objectMap) -} - -// TrackedResource the resource model definition for a ARM tracked top level resource -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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) -} - -// TypeField information about a field of a type. -type TypeField struct { - // Name - Gets or sets the name of the field. - Name *string `json:"name,omitempty"` - // Type - Gets or sets the type of the field. - Type *string `json:"type,omitempty"` -} - -// TypeFieldListResult the response model for the list fields operation. -type TypeFieldListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of fields. - Value *[]TypeField `json:"value,omitempty"` -} - -// UpdateConfiguration update specific properties of the software update configuration. -type UpdateConfiguration struct { - // OperatingSystem - operating system of target machines. Possible values include: 'Windows', 'Linux' - OperatingSystem OperatingSystemType `json:"operatingSystem,omitempty"` - // Windows - Windows specific update configuration. - Windows *WindowsProperties `json:"windows,omitempty"` - // Linux - Linux specific update configuration. - Linux *LinuxProperties `json:"linux,omitempty"` - // Duration - Maximum time allowed for the software update configuration run. Duration needs to be specified using the format PT[n]H[n]M[n]S as per ISO8601 - Duration *string `json:"duration,omitempty"` - // AzureVirtualMachines - List of azure resource Ids for azure virtual machines targeted by the software update configuration. - AzureVirtualMachines *[]string `json:"azureVirtualMachines,omitempty"` - // NonAzureComputerNames - List of names of non-azure machines targeted by the software update configuration. - NonAzureComputerNames *[]string `json:"nonAzureComputerNames,omitempty"` - // Targets - Group targets for the software update configuration. - Targets *TargetProperties `json:"targets,omitempty"` -} - -// UpdateConfigurationMachineRunProperties software update configuration machine run properties. -type UpdateConfigurationMachineRunProperties struct { - // TargetComputer - READ-ONLY; name of the updated computer - TargetComputer *string `json:"targetComputer,omitempty"` - // TargetComputerType - READ-ONLY; type of the updated computer. - TargetComputerType *string `json:"targetComputerType,omitempty"` - // SoftwareUpdateConfiguration - software update configuration triggered this run - SoftwareUpdateConfiguration *UpdateConfigurationNavigation `json:"softwareUpdateConfiguration,omitempty"` - // Status - READ-ONLY; Status of the software update configuration machine run. - Status *string `json:"status,omitempty"` - // OsType - READ-ONLY; Operating system target of the software update configuration triggered this run - OsType *string `json:"osType,omitempty"` - // CorrelationID - READ-ONLY; correlation id of the software update configuration machine run - CorrelationID *uuid.UUID `json:"correlationId,omitempty"` - // SourceComputerID - READ-ONLY; source computer id of the software update configuration machine run - SourceComputerID *uuid.UUID `json:"sourceComputerId,omitempty"` - // StartTime - READ-ONLY; Start time of the software update configuration machine run. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; End time of the software update configuration machine run. - EndTime *date.Time `json:"endTime,omitempty"` - // ConfiguredDuration - READ-ONLY; configured duration for the software update configuration run. - ConfiguredDuration *string `json:"configuredDuration,omitempty"` - // Job - Job associated with the software update configuration machine run - Job *JobNavigation `json:"job,omitempty"` - // CreationTime - READ-ONLY; Creation time of the resource, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CreatedBy - READ-ONLY; createdBy property, which only appears in the response. - CreatedBy *string `json:"createdBy,omitempty"` - // LastModifiedTime - READ-ONLY; Last time resource was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; lastModifiedBy property, which only appears in the response. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Error - Details of provisioning error - Error *ErrorResponse `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpdateConfigurationMachineRunProperties. -func (ucmrp UpdateConfigurationMachineRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucmrp.SoftwareUpdateConfiguration != nil { - objectMap["softwareUpdateConfiguration"] = ucmrp.SoftwareUpdateConfiguration - } - if ucmrp.Job != nil { - objectMap["job"] = ucmrp.Job - } - if ucmrp.Error != nil { - objectMap["error"] = ucmrp.Error - } - return json.Marshal(objectMap) -} - -// UpdateConfigurationNavigation software update configuration Run Navigation model. -type UpdateConfigurationNavigation struct { - // Name - READ-ONLY; Name of the software update configuration triggered the software update configuration run - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpdateConfigurationNavigation. -func (ucn UpdateConfigurationNavigation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Usage definition of Usage. -type Usage struct { - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - Gets or sets the usage counter name. - Name *UsageCounterName `json:"name,omitempty"` - // Unit - Gets or sets the usage unit name. - Unit *string `json:"unit,omitempty"` - // CurrentValue - Gets or sets the current usage value. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - Gets or sets max limit. -1 for unlimited - Limit *int64 `json:"limit,omitempty"` - // ThrottleStatus - Gets or sets the throttle status. - ThrottleStatus *string `json:"throttleStatus,omitempty"` -} - -// UsageCounterName definition of usage counter name. -type UsageCounterName struct { - // Value - Gets or sets the usage counter name. - Value *string `json:"value,omitempty"` - // LocalizedValue - Gets or sets the localized usage counter name. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// UsageListResult the response model for the get usage operation. -type UsageListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets usage. - Value *[]Usage `json:"value,omitempty"` -} - -// Variable definition of the variable. -type Variable struct { - autorest.Response `json:"-"` - // VariableProperties - Gets or sets the properties of the variable. - *VariableProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Variable. -func (vVar Variable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.VariableProperties != nil { - objectMap["properties"] = vVar.VariableProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Variable struct. -func (vVar *Variable) 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 variableProperties VariableProperties - err = json.Unmarshal(*v, &variableProperties) - if err != nil { - return err - } - vVar.VariableProperties = &variableProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vVar.Type = &typeVar - } - } - } - - return nil -} - -// VariableCreateOrUpdateParameters the parameters supplied to the create or update variable operation. -type VariableCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the variable. - Name *string `json:"name,omitempty"` - // VariableCreateOrUpdateProperties - Gets or sets the properties of the variable. - *VariableCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VariableCreateOrUpdateParameters. -func (vcoup VariableCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcoup.Name != nil { - objectMap["name"] = vcoup.Name - } - if vcoup.VariableCreateOrUpdateProperties != nil { - objectMap["properties"] = vcoup.VariableCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VariableCreateOrUpdateParameters struct. -func (vcoup *VariableCreateOrUpdateParameters) 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 - } - vcoup.Name = &name - } - case "properties": - if v != nil { - var variableCreateOrUpdateProperties VariableCreateOrUpdateProperties - err = json.Unmarshal(*v, &variableCreateOrUpdateProperties) - if err != nil { - return err - } - vcoup.VariableCreateOrUpdateProperties = &variableCreateOrUpdateProperties - } - } - } - - return nil -} - -// VariableCreateOrUpdateProperties the properties of the create variable operation. -type VariableCreateOrUpdateProperties struct { - // Value - Gets or sets the value of the variable. - Value *string `json:"value,omitempty"` - // Description - Gets or sets the description of the variable. - Description *string `json:"description,omitempty"` - // IsEncrypted - Gets or sets the encrypted flag of the variable. - IsEncrypted *bool `json:"isEncrypted,omitempty"` -} - -// VariableListResult the response model for the list variables operation. -type VariableListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of variables. - Value *[]Variable `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// VariableListResultIterator provides access to a complete listing of Variable values. -type VariableListResultIterator struct { - i int - page VariableListResultPage -} - -// 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 *VariableListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultIterator.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 *VariableListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VariableListResultIterator) 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 VariableListResultIterator) Response() VariableListResult { - 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 VariableListResultIterator) Value() Variable { - if !iter.page.NotDone() { - return Variable{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VariableListResultIterator type. -func NewVariableListResultIterator(page VariableListResultPage) VariableListResultIterator { - return VariableListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vlr VariableListResult) IsEmpty() bool { - return vlr.Value == nil || len(*vlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vlr VariableListResult) hasNextLink() bool { - return vlr.NextLink != nil && len(*vlr.NextLink) != 0 -} - -// variableListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vlr VariableListResult) variableListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vlr.NextLink))) -} - -// VariableListResultPage contains a page of Variable values. -type VariableListResultPage struct { - fn func(context.Context, VariableListResult) (VariableListResult, error) - vlr VariableListResult -} - -// 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 *VariableListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultPage.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.vlr) - if err != nil { - return err - } - page.vlr = 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 *VariableListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VariableListResultPage) NotDone() bool { - return !page.vlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VariableListResultPage) Response() VariableListResult { - return page.vlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VariableListResultPage) Values() []Variable { - if page.vlr.IsEmpty() { - return nil - } - return *page.vlr.Value -} - -// Creates a new instance of the VariableListResultPage type. -func NewVariableListResultPage(cur VariableListResult, getNextPage func(context.Context, VariableListResult) (VariableListResult, error)) VariableListResultPage { - return VariableListResultPage{ - fn: getNextPage, - vlr: cur, - } -} - -// VariableProperties definition of the variable properties -type VariableProperties struct { - // Value - Gets or sets the value of the variable. - Value *string `json:"value,omitempty"` - // IsEncrypted - Gets or sets the encrypted flag of the variable. - IsEncrypted *bool `json:"isEncrypted,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// VariableUpdateParameters the parameters supplied to the update variable operation. -type VariableUpdateParameters struct { - // Name - Gets or sets the name of the variable. - Name *string `json:"name,omitempty"` - // VariableUpdateProperties - Gets or sets the value of the variable. - *VariableUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VariableUpdateParameters. -func (vup VariableUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vup.Name != nil { - objectMap["name"] = vup.Name - } - if vup.VariableUpdateProperties != nil { - objectMap["properties"] = vup.VariableUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VariableUpdateParameters struct. -func (vup *VariableUpdateParameters) 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 - } - vup.Name = &name - } - case "properties": - if v != nil { - var variableUpdateProperties VariableUpdateProperties - err = json.Unmarshal(*v, &variableUpdateProperties) - if err != nil { - return err - } - vup.VariableUpdateProperties = &variableUpdateProperties - } - } - } - - return nil -} - -// VariableUpdateProperties the properties of the update variable -type VariableUpdateProperties struct { - // Value - Gets or sets the value of the variable. - Value *string `json:"value,omitempty"` - // Description - Gets or sets the description of the variable. - Description *string `json:"description,omitempty"` -} - -// Webhook definition of the webhook type. -type Webhook struct { - autorest.Response `json:"-"` - // WebhookProperties - Gets or sets the webhook properties. - *WebhookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WebhookProperties != nil { - objectMap["properties"] = w.WebhookProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Webhook struct. -func (w *Webhook) 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 webhookProperties WebhookProperties - err = json.Unmarshal(*v, &webhookProperties) - if err != nil { - return err - } - w.WebhookProperties = &webhookProperties - } - 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 -} - -// WebhookCreateOrUpdateParameters the parameters supplied to the create or update webhook operation. -type WebhookCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the webhook. - Name *string `json:"name,omitempty"` - // WebhookCreateOrUpdateProperties - Gets or sets the properties of the webhook. - *WebhookCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateOrUpdateParameters. -func (wcoup WebhookCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcoup.Name != nil { - objectMap["name"] = wcoup.Name - } - if wcoup.WebhookCreateOrUpdateProperties != nil { - objectMap["properties"] = wcoup.WebhookCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookCreateOrUpdateParameters struct. -func (wcoup *WebhookCreateOrUpdateParameters) 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 - } - wcoup.Name = &name - } - case "properties": - if v != nil { - var webhookCreateOrUpdateProperties WebhookCreateOrUpdateProperties - err = json.Unmarshal(*v, &webhookCreateOrUpdateProperties) - if err != nil { - return err - } - wcoup.WebhookCreateOrUpdateProperties = &webhookCreateOrUpdateProperties - } - } - } - - return nil -} - -// WebhookCreateOrUpdateProperties the properties of the create webhook operation. -type WebhookCreateOrUpdateProperties struct { - // IsEnabled - Gets or sets the value of the enabled flag of webhook. - IsEnabled *bool `json:"isEnabled,omitempty"` - // URI - Gets or sets the uri. - URI *string `json:"uri,omitempty"` - // ExpiryTime - Gets or sets the expiry time. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the name of the hybrid worker group the webhook job will run on. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateOrUpdateProperties. -func (wcoup WebhookCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcoup.IsEnabled != nil { - objectMap["isEnabled"] = wcoup.IsEnabled - } - if wcoup.URI != nil { - objectMap["uri"] = wcoup.URI - } - if wcoup.ExpiryTime != nil { - objectMap["expiryTime"] = wcoup.ExpiryTime - } - if wcoup.Parameters != nil { - objectMap["parameters"] = wcoup.Parameters - } - if wcoup.Runbook != nil { - objectMap["runbook"] = wcoup.Runbook - } - if wcoup.RunOn != nil { - objectMap["runOn"] = wcoup.RunOn - } - return json.Marshal(objectMap) -} - -// WebhookListResult the response model for the list webhook operation. -type WebhookListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of webhooks. - Value *[]Webhook `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultIterator provides access to a complete listing of Webhook values. -type WebhookListResultIterator struct { - i int - page WebhookListResultPage -} - -// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { - 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 WebhookListResultIterator) Value() Webhook { - if !iter.page.NotDone() { - return Webhook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebhookListResultIterator type. -func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { - return WebhookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WebhookListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WebhookListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// webhookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WebhookListResult) webhookListResultPreparer(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))) -} - -// WebhookListResultPage contains a page of Webhook values. -type WebhookListResultPage struct { - fn func(context.Context, WebhookListResult) (WebhookListResult, error) - wlr WebhookListResult -} - -// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebhookListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebhookListResultPage) Response() WebhookListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebhookListResultPage) Values() []Webhook { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WebhookListResultPage type. -func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { - return WebhookListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WebhookProperties definition of the webhook properties -type WebhookProperties struct { - // IsEnabled - Gets or sets the value of the enabled flag of the webhook. - IsEnabled *bool `json:"isEnabled,omitempty"` - // URI - Gets or sets the webhook uri. - URI *string `json:"uri,omitempty"` - // ExpiryTime - Gets or sets the expiry time. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // LastInvokedTime - Gets or sets the last invoked time. - LastInvokedTime *date.Time `json:"lastInvokedTime,omitempty"` - // Parameters - Gets or sets the parameters of the job that is created when the webhook calls the runbook it is associated with. - Parameters map[string]*string `json:"parameters"` - // Runbook - Gets or sets the runbook the webhook is associated with. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the name of the hybrid worker group the webhook job will run on. - RunOn *string `json:"runOn,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - Details of the user who last modified the Webhook - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookProperties. -func (wp WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.IsEnabled != nil { - objectMap["isEnabled"] = wp.IsEnabled - } - if wp.URI != nil { - objectMap["uri"] = wp.URI - } - if wp.ExpiryTime != nil { - objectMap["expiryTime"] = wp.ExpiryTime - } - if wp.LastInvokedTime != nil { - objectMap["lastInvokedTime"] = wp.LastInvokedTime - } - if wp.Parameters != nil { - objectMap["parameters"] = wp.Parameters - } - if wp.Runbook != nil { - objectMap["runbook"] = wp.Runbook - } - if wp.RunOn != nil { - objectMap["runOn"] = wp.RunOn - } - if wp.CreationTime != nil { - objectMap["creationTime"] = wp.CreationTime - } - if wp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = wp.LastModifiedTime - } - if wp.LastModifiedBy != nil { - objectMap["lastModifiedBy"] = wp.LastModifiedBy - } - if wp.Description != nil { - objectMap["description"] = wp.Description - } - return json.Marshal(objectMap) -} - -// WebhookUpdateParameters the parameters supplied to the update webhook operation. -type WebhookUpdateParameters struct { - // Name - Gets or sets the name of the webhook. - Name *string `json:"name,omitempty"` - // WebhookUpdateProperties - Gets or sets the value of the webhook. - *WebhookUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateParameters. -func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.Name != nil { - objectMap["name"] = wup.Name - } - if wup.WebhookUpdateProperties != nil { - objectMap["properties"] = wup.WebhookUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. -func (wup *WebhookUpdateParameters) 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 - } - wup.Name = &name - } - case "properties": - if v != nil { - var webhookUpdateProperties WebhookUpdateProperties - err = json.Unmarshal(*v, &webhookUpdateProperties) - if err != nil { - return err - } - wup.WebhookUpdateProperties = &webhookUpdateProperties - } - } - } - - return nil -} - -// WebhookUpdateProperties the properties of the update webhook. -type WebhookUpdateProperties struct { - // IsEnabled - Gets or sets the value of the enabled flag of webhook. - IsEnabled *bool `json:"isEnabled,omitempty"` - // RunOn - Gets or sets the name of the hybrid worker group the webhook job will run on. - RunOn *string `json:"runOn,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // Description - Gets or sets the description of the webhook. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateProperties. -func (wup WebhookUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.IsEnabled != nil { - objectMap["isEnabled"] = wup.IsEnabled - } - if wup.RunOn != nil { - objectMap["runOn"] = wup.RunOn - } - if wup.Parameters != nil { - objectMap["parameters"] = wup.Parameters - } - if wup.Description != nil { - objectMap["description"] = wup.Description - } - return json.Marshal(objectMap) -} - -// WindowsProperties windows specific update configuration. -type WindowsProperties struct { - // IncludedUpdateClassifications - Update classification included in the software update configuration. A comma separated string with required values. Possible values include: 'WindowsUpdateClassesUnclassified', 'WindowsUpdateClassesCritical', 'WindowsUpdateClassesSecurity', 'WindowsUpdateClassesUpdateRollup', 'WindowsUpdateClassesFeaturePack', 'WindowsUpdateClassesServicePack', 'WindowsUpdateClassesDefinition', 'WindowsUpdateClassesTools', 'WindowsUpdateClassesUpdates' - IncludedUpdateClassifications WindowsUpdateClasses `json:"includedUpdateClassifications,omitempty"` - // ExcludedKbNumbers - KB numbers excluded from the software update configuration. - ExcludedKbNumbers *[]string `json:"excludedKbNumbers,omitempty"` - // IncludedKbNumbers - KB numbers included from the software update configuration. - IncludedKbNumbers *[]string `json:"includedKbNumbers,omitempty"` - // RebootSetting - Reboot setting for the software update configuration. - RebootSetting *string `json:"rebootSetting,omitempty"` -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/module.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/module.go deleted file mode 100644 index c7b8ebb8655a..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/module.go +++ /dev/null @@ -1,516 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ModuleClient is the automation Client -type ModuleClient struct { - BaseClient -} - -// NewModuleClient creates an instance of the ModuleClient client. -func NewModuleClient(subscriptionID string) ModuleClient { - return NewModuleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewModuleClientWithBaseURI creates an instance of the ModuleClient 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 NewModuleClientWithBaseURI(baseURI string, subscriptionID string) ModuleClient { - return ModuleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// parameters - the create or update parameters for module. -func (client ModuleClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.ModuleClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, moduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ModuleClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) CreateOrUpdateResponder(resp *http.Response) (result Module, 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 module by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the module name. -func (client ModuleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ModuleClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ModuleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the module name. -func (client ModuleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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("automation.ModuleClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ModuleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) GetResponder(resp *http.Response) (result Module, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of modules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ModuleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.mlr.Response.Response != nil { - sc = result.mlr.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("automation.ModuleClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.mlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.mlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.mlr.hasNextLink() && result.mlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ModuleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ModuleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ModuleClient) ListByAutomationAccountResponder(resp *http.Response) (result ModuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ModuleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ModuleListResult) (result ModuleListResult, err error) { - req, err := lastResults.moduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ModuleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// parameters - the update parameters for module. -func (client ModuleClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ModuleClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, moduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ModuleClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) UpdateResponder(resp *http.Response) (result Module, 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/automation/mgmt/2017-05-15-preview/automation/nodereports.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/nodereports.go deleted file mode 100644 index 21945867d8d0..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/nodereports.go +++ /dev/null @@ -1,340 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NodeReportsClient is the automation Client -type NodeReportsClient struct { - BaseClient -} - -// NewNodeReportsClient creates an instance of the NodeReportsClient client. -func NewNodeReportsClient(subscriptionID string) NodeReportsClient { - return NewNodeReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNodeReportsClientWithBaseURI creates an instance of the NodeReportsClient 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 NewNodeReportsClientWithBaseURI(baseURI string, subscriptionID string) NodeReportsClient { - return NodeReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the Dsc node report data by node id and report id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the Dsc node id. -// reportID - the report id. -func (client NodeReportsClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result DscNodeReport, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.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("automation.NodeReportsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, nodeID, reportID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NodeReportsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}", 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 NodeReportsClient) 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 NodeReportsClient) GetResponder(resp *http.Response) (result DscNodeReport, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the Dsc node reports by node id and report id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the Dsc node id. -// reportID - the report id. -func (client NodeReportsClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result SetObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.GetContent") - 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("automation.NodeReportsClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, nodeID, reportID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client NodeReportsClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client NodeReportsClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client NodeReportsClient) GetContentResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByNode retrieve the Dsc node report list by node id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the parameters supplied to the list operation. -// filter - the filter to apply on the operation. -func (client NodeReportsClient) ListByNode(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result DscNodeReportListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.ListByNode") - defer func() { - sc := -1 - if result.dnrlr.Response.Response != nil { - sc = result.dnrlr.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("automation.NodeReportsClient", "ListByNode", err.Error()) - } - - result.fn = client.listByNodeNextResults - req, err := client.ListByNodePreparer(ctx, resourceGroupName, automationAccountName, nodeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNodeSender(req) - if err != nil { - result.dnrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure sending request") - return - } - - result.dnrlr, err = client.ListByNodeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure responding to request") - return - } - if result.dnrlr.hasNextLink() && result.dnrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByNodePreparer prepares the ListByNode request. -func (client NodeReportsClient) ListByNodePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNodeSender sends the ListByNode request. The method will close the -// http.Response Body if it receives an error. -func (client NodeReportsClient) ListByNodeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNodeResponder handles the response to the ListByNode request. The method always -// closes the http.Response Body. -func (client NodeReportsClient) ListByNodeResponder(resp *http.Response) (result DscNodeReportListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByNodeNextResults retrieves the next set of results, if any. -func (client NodeReportsClient) listByNodeNextResults(ctx context.Context, lastResults DscNodeReportListResult) (result DscNodeReportListResult, err error) { - req, err := lastResults.dscNodeReportListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "listByNodeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByNodeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "listByNodeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByNodeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "listByNodeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByNodeComplete enumerates all values, automatically crossing page boundaries as required. -func (client NodeReportsClient) ListByNodeComplete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result DscNodeReportListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.ListByNode") - 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.ListByNode(ctx, resourceGroupName, automationAccountName, nodeID, filter) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/objectdatatypes.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/objectdatatypes.go deleted file mode 100644 index 7335603abd67..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/objectdatatypes.go +++ /dev/null @@ -1,206 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ObjectDataTypesClient is the automation Client -type ObjectDataTypesClient struct { - BaseClient -} - -// NewObjectDataTypesClient creates an instance of the ObjectDataTypesClient client. -func NewObjectDataTypesClient(subscriptionID string) ObjectDataTypesClient { - return NewObjectDataTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewObjectDataTypesClientWithBaseURI creates an instance of the ObjectDataTypesClient 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 NewObjectDataTypesClientWithBaseURI(baseURI string, subscriptionID string) ObjectDataTypesClient { - return ObjectDataTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListFieldsByModuleAndType retrieve a list of fields of a given type identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// typeName - the name of type. -func (client ObjectDataTypesClient) ListFieldsByModuleAndType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ObjectDataTypesClient.ListFieldsByModuleAndType") - 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("automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", err.Error()) - } - - req, err := client.ListFieldsByModuleAndTypePreparer(ctx, resourceGroupName, automationAccountName, moduleName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", nil, "Failure preparing request") - return - } - - resp, err := client.ListFieldsByModuleAndTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure sending request") - return - } - - result, err = client.ListFieldsByModuleAndTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure responding to request") - return - } - - return -} - -// ListFieldsByModuleAndTypePreparer prepares the ListFieldsByModuleAndType request. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListFieldsByModuleAndTypeSender sends the ListFieldsByModuleAndType request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListFieldsByModuleAndTypeResponder handles the response to the ListFieldsByModuleAndType request. The method always -// closes the http.Response Body. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeResponder(resp *http.Response) (result TypeFieldListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListFieldsByType retrieve a list of fields of a given type across all accessible modules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// typeName - the name of type. -func (client ObjectDataTypesClient) ListFieldsByType(ctx context.Context, resourceGroupName string, automationAccountName string, typeName string) (result TypeFieldListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ObjectDataTypesClient.ListFieldsByType") - 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("automation.ObjectDataTypesClient", "ListFieldsByType", err.Error()) - } - - req, err := client.ListFieldsByTypePreparer(ctx, resourceGroupName, automationAccountName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListFieldsByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure sending request") - return - } - - result, err = client.ListFieldsByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure responding to request") - return - } - - return -} - -// ListFieldsByTypePreparer prepares the ListFieldsByType request. -func (client ObjectDataTypesClient) ListFieldsByTypePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListFieldsByTypeSender sends the ListFieldsByType request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectDataTypesClient) ListFieldsByTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListFieldsByTypeResponder handles the response to the ListFieldsByType request. The method always -// closes the http.Response Body. -func (client ObjectDataTypesClient) ListFieldsByTypeResponder(resp *http.Response) (result TypeFieldListResult, 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/automation/mgmt/2017-05-15-preview/automation/operations.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/operations.go deleted file mode 100644 index 9b49ff7699af..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation 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 Automation REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Automation/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 -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/runbook.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/runbook.go deleted file mode 100644 index d2c21bc9e042..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/runbook.go +++ /dev/null @@ -1,610 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RunbookClient is the automation Client -type RunbookClient struct { - BaseClient -} - -// NewRunbookClient creates an instance of the RunbookClient client. -func NewRunbookClient(subscriptionID string) RunbookClient { - return NewRunbookClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunbookClientWithBaseURI creates an instance of the RunbookClient 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 NewRunbookClientWithBaseURI(baseURI string, subscriptionID string) RunbookClient { - return RunbookClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// parameters - the create or update parameters for runbook. Provide either content link for a published -// runbook or draft, not both. -func (client RunbookClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (result Runbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.RunbookClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RunbookClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) CreateOrUpdateResponder(resp *http.Response) (result Runbook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusBadRequest), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the runbook by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.RunbookClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RunbookClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) 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 the runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result Runbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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("automation.RunbookClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunbookClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) GetResponder(resp *http.Response) (result Runbook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the content of runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.GetContent") - 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("automation.RunbookClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client RunbookClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client RunbookClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of runbooks. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client RunbookClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result RunbookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.ListByAutomationAccount") - 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("automation.RunbookClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client RunbookClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client RunbookClient) ListByAutomationAccountResponder(resp *http.Response) (result RunbookListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client RunbookClient) listByAutomationAccountNextResults(ctx context.Context, lastResults RunbookListResult) (result RunbookListResult, err error) { - req, err := lastResults.runbookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client RunbookClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result RunbookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update the runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// parameters - the update parameters for runbook. -func (client RunbookClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (result Runbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.RunbookClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RunbookClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) UpdateResponder(resp *http.Response) (result Runbook, 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/automation/mgmt/2017-05-15-preview/automation/runbookdraft.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/runbookdraft.go deleted file mode 100644 index 06b6a1bc8556..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/runbookdraft.go +++ /dev/null @@ -1,470 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "io" - "net/http" -) - -// RunbookDraftClient is the automation Client -type RunbookDraftClient struct { - BaseClient -} - -// NewRunbookDraftClient creates an instance of the RunbookDraftClient client. -func NewRunbookDraftClient(subscriptionID string) RunbookDraftClient { - return NewRunbookDraftClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunbookDraftClientWithBaseURI creates an instance of the RunbookDraftClient 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 NewRunbookDraftClientWithBaseURI(baseURI string, subscriptionID string) RunbookDraftClient { - return RunbookDraftClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the runbook draft identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookDraftClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraft, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.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("automation.RunbookDraftClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunbookDraftClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft", 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 RunbookDraftClient) 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 RunbookDraftClient) GetResponder(resp *http.Response) (result RunbookDraft, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the content of runbook draft identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookDraftClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.GetContent") - 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("automation.RunbookDraftClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client RunbookDraftClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// Publish publish runbook draft. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the parameters supplied to the publish runbook operation. -func (client RunbookDraftClient) Publish(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraftPublishFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.Publish") - 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("automation.RunbookDraftClient", "Publish", err.Error()) - } - - req, err := client.PublishPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", nil, "Failure preparing request") - return - } - - result, err = client.PublishSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", result.Response(), "Failure sending request") - return - } - - return -} - -// PublishPreparer prepares the Publish request. -func (client RunbookDraftClient) PublishPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/publish", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PublishSender sends the Publish request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) PublishSender(req *http.Request) (future RunbookDraftPublishFuture, 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 -} - -// PublishResponder handles the response to the Publish request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) PublishResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ReplaceContent replaces the runbook draft content. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// runbookContent - the runbook draft content. -func (client RunbookDraftClient) ReplaceContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser) (result RunbookDraftReplaceContentFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.ReplaceContent") - 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("automation.RunbookDraftClient", "ReplaceContent", err.Error()) - } - - req, err := client.ReplaceContentPreparer(ctx, resourceGroupName, automationAccountName, runbookName, runbookContent) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "ReplaceContent", nil, "Failure preparing request") - return - } - - result, err = client.ReplaceContentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "ReplaceContent", result.Response(), "Failure sending request") - return - } - - return -} - -// ReplaceContentPreparer prepares the ReplaceContent request. -func (client RunbookDraftClient) ReplaceContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("text/powershell"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), - autorest.WithFile(runbookContent), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReplaceContentSender sends the ReplaceContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) ReplaceContentSender(req *http.Request) (future RunbookDraftReplaceContentFuture, 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 -} - -// ReplaceContentResponder handles the response to the ReplaceContent request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) ReplaceContentResponder(resp *http.Response) (result ReadCloser, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UndoEdit undo draft edit to last known published state identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookDraftClient) UndoEdit(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraftUndoEditResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.UndoEdit") - 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("automation.RunbookDraftClient", "UndoEdit", err.Error()) - } - - req, err := client.UndoEditPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", nil, "Failure preparing request") - return - } - - resp, err := client.UndoEditSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure sending request") - return - } - - result, err = client.UndoEditResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure responding to request") - return - } - - return -} - -// UndoEditPreparer prepares the UndoEdit request. -func (client RunbookDraftClient) UndoEditPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UndoEditSender sends the UndoEdit request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) UndoEditSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UndoEditResponder handles the response to the UndoEdit request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) UndoEditResponder(resp *http.Response) (result RunbookDraftUndoEditResult, 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/automation/mgmt/2017-05-15-preview/automation/schedule.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/schedule.go deleted file mode 100644 index 18ebbd426e1c..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/schedule.go +++ /dev/null @@ -1,511 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ScheduleClient is the automation Client -type ScheduleClient struct { - BaseClient -} - -// NewScheduleClient creates an instance of the ScheduleClient client. -func NewScheduleClient(subscriptionID string) ScheduleClient { - return NewScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduleClientWithBaseURI creates an instance of the ScheduleClient 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 NewScheduleClientWithBaseURI(baseURI string, subscriptionID string) ScheduleClient { - return ScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a schedule. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -// parameters - the parameters supplied to the create or update schedule operation. -func (client ScheduleClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ScheduleCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ScheduleCreateOrUpdateProperties.StartTime", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.ScheduleClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, scheduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduleClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the schedule identified by schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -func (client ScheduleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ScheduleClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, scheduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the schedule identified by schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -func (client ScheduleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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("automation.ScheduleClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, scheduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of schedules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ScheduleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ScheduleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.ListByAutomationAccount") - 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("automation.ScheduleClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ScheduleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result ScheduleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ScheduleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ScheduleListResult) (result ScheduleListResult, err error) { - req, err := lastResults.scheduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScheduleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ScheduleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update the schedule identified by schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -// parameters - the parameters supplied to the update schedule operation. -func (client ScheduleClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ScheduleClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, scheduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduleClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) UpdateResponder(resp *http.Response) (result Schedule, 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/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurationmachineruns.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurationmachineruns.go deleted file mode 100644 index d566079f385a..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurationmachineruns.go +++ /dev/null @@ -1,228 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SoftwareUpdateConfigurationMachineRunsClient is the automation Client -type SoftwareUpdateConfigurationMachineRunsClient struct { - BaseClient -} - -// NewSoftwareUpdateConfigurationMachineRunsClient creates an instance of the -// SoftwareUpdateConfigurationMachineRunsClient client. -func NewSoftwareUpdateConfigurationMachineRunsClient(subscriptionID string) SoftwareUpdateConfigurationMachineRunsClient { - return NewSoftwareUpdateConfigurationMachineRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSoftwareUpdateConfigurationMachineRunsClientWithBaseURI creates an instance of the -// SoftwareUpdateConfigurationMachineRunsClient 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 NewSoftwareUpdateConfigurationMachineRunsClientWithBaseURI(baseURI string, subscriptionID string) SoftwareUpdateConfigurationMachineRunsClient { - return SoftwareUpdateConfigurationMachineRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByID get a single software update configuration machine run by Id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationMachineRunID - the Id of the software update configuration machine run. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationMachineRunID uuid.UUID, clientRequestID string) (result SoftwareUpdateConfigurationMachineRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationMachineRunsClient.GetByID") - 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("automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", err.Error()) - } - - req, err := client.GetByIDPreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunID, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByIDPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationMachineRunID uuid.UUID, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationMachineRunId": autorest.Encode("path", softwareUpdateConfigurationMachineRunID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns/{softwareUpdateConfigurationMachineRunId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByIDResponder(resp *http.Response) (result SoftwareUpdateConfigurationMachineRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List return list of software update configuration machine runs -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// clientRequestID - identifies this specific client request. -// filter - the filter to apply on the operation. You can use the following filters: 'properties/osType', -// 'properties/status', 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' -// skip - number of entries you skip before returning results -// top - maximum number of entries returned in the results collection -func (client SoftwareUpdateConfigurationMachineRunsClient) List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result SoftwareUpdateConfigurationMachineRunListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationMachineRunsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationMachineRunsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, automationAccountName, clientRequestID, filter, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SoftwareUpdateConfigurationMachineRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skip) > 0 { - queryParameters["$skip"] = autorest.Encode("query", skip) - } - if len(top) > 0 { - queryParameters["$top"] = autorest.Encode("query", top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationMachineRunsClient) 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 SoftwareUpdateConfigurationMachineRunsClient) ListResponder(resp *http.Response) (result SoftwareUpdateConfigurationMachineRunListResult, 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/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurationruns.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurationruns.go deleted file mode 100644 index 09e9220a07a8..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurationruns.go +++ /dev/null @@ -1,227 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SoftwareUpdateConfigurationRunsClient is the automation Client -type SoftwareUpdateConfigurationRunsClient struct { - BaseClient -} - -// NewSoftwareUpdateConfigurationRunsClient creates an instance of the SoftwareUpdateConfigurationRunsClient client. -func NewSoftwareUpdateConfigurationRunsClient(subscriptionID string) SoftwareUpdateConfigurationRunsClient { - return NewSoftwareUpdateConfigurationRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSoftwareUpdateConfigurationRunsClientWithBaseURI creates an instance of the SoftwareUpdateConfigurationRunsClient -// 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 NewSoftwareUpdateConfigurationRunsClientWithBaseURI(baseURI string, subscriptionID string) SoftwareUpdateConfigurationRunsClient { - return SoftwareUpdateConfigurationRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByID get a single software update configuration Run by Id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationRunID - the Id of the software update configuration run. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationRunsClient) GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationRunID uuid.UUID, clientRequestID string) (result SoftwareUpdateConfigurationRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationRunsClient.GetByID") - 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("automation.SoftwareUpdateConfigurationRunsClient", "GetByID", err.Error()) - } - - req, err := client.GetByIDPreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationRunID, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client SoftwareUpdateConfigurationRunsClient) GetByIDPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationRunID uuid.UUID, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationRunId": autorest.Encode("path", softwareUpdateConfigurationRunID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns/{softwareUpdateConfigurationRunId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client SoftwareUpdateConfigurationRunsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client SoftwareUpdateConfigurationRunsClient) GetByIDResponder(resp *http.Response) (result SoftwareUpdateConfigurationRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List return list of software update configuration runs -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// clientRequestID - identifies this specific client request. -// filter - the filter to apply on the operation. You can use the following filters: 'properties/osType', -// 'properties/status', 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' -// skip - number of entries you skip before returning results -// top - maximum number of entries returned in the results collection -func (client SoftwareUpdateConfigurationRunsClient) List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result SoftwareUpdateConfigurationRunListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationRunsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationRunsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, automationAccountName, clientRequestID, filter, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SoftwareUpdateConfigurationRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skip) > 0 { - queryParameters["$skip"] = autorest.Encode("query", skip) - } - if len(top) > 0 { - queryParameters["$top"] = autorest.Encode("query", top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationRunsClient) 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 SoftwareUpdateConfigurationRunsClient) ListResponder(resp *http.Response) (result SoftwareUpdateConfigurationRunListResult, 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/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurations.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurations.go deleted file mode 100644 index 50de7018d6d1..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/softwareupdateconfigurations.go +++ /dev/null @@ -1,409 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SoftwareUpdateConfigurationsClient is the automation Client -type SoftwareUpdateConfigurationsClient struct { - BaseClient -} - -// NewSoftwareUpdateConfigurationsClient creates an instance of the SoftwareUpdateConfigurationsClient client. -func NewSoftwareUpdateConfigurationsClient(subscriptionID string) SoftwareUpdateConfigurationsClient { - return NewSoftwareUpdateConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSoftwareUpdateConfigurationsClientWithBaseURI creates an instance of the SoftwareUpdateConfigurationsClient -// 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 NewSoftwareUpdateConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SoftwareUpdateConfigurationsClient { - return SoftwareUpdateConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a new software update configuration with the name given in the URI. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationName - the name of the software update configuration to be created. -// parameters - request body. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationsClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, parameters SoftwareUpdateConfiguration, clientRequestID string) (result SoftwareUpdateConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SoftwareUpdateConfigurationProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SoftwareUpdateConfigurationProperties.UpdateConfiguration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SoftwareUpdateConfigurationProperties.ScheduleInfo", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SoftwareUpdateConfigurationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, parameters SoftwareUpdateConfiguration, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationName": autorest.Encode("path", softwareUpdateConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Name = nil - parameters.ID = nil - parameters.Type = 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationsClient) 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 SoftwareUpdateConfigurationsClient) CreateResponder(resp *http.Response) (result SoftwareUpdateConfiguration, 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 specific software update configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationName - the name of the software update configuration to be created. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SoftwareUpdateConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationName": autorest.Encode("path", softwareUpdateConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationsClient) 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 SoftwareUpdateConfigurationsClient) 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 -} - -// GetByName get a single software update configuration by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationName - the name of the software update configuration to be created. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationsClient) GetByName(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result SoftwareUpdateConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.GetByName") - 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("automation.SoftwareUpdateConfigurationsClient", "GetByName", err.Error()) - } - - req, err := client.GetByNamePreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "GetByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "GetByName", resp, "Failure sending request") - return - } - - result, err = client.GetByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "GetByName", resp, "Failure responding to request") - return - } - - return -} - -// GetByNamePreparer prepares the GetByName request. -func (client SoftwareUpdateConfigurationsClient) GetByNamePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationName": autorest.Encode("path", softwareUpdateConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByNameSender sends the GetByName request. The method will close the -// http.Response Body if it receives an error. -func (client SoftwareUpdateConfigurationsClient) GetByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByNameResponder handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (client SoftwareUpdateConfigurationsClient) GetByNameResponder(resp *http.Response) (result SoftwareUpdateConfiguration, 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 software update configurations for the account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// clientRequestID - identifies this specific client request. -// filter - the filter to apply on the operation. -func (client SoftwareUpdateConfigurationsClient) List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string) (result SoftwareUpdateConfigurationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, automationAccountName, clientRequestID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SoftwareUpdateConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationsClient) 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 SoftwareUpdateConfigurationsClient) ListResponder(resp *http.Response) (result SoftwareUpdateConfigurationListResult, 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/automation/mgmt/2017-05-15-preview/automation/sourcecontrol.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrol.go deleted file mode 100644 index 4acf374adbb9..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrol.go +++ /dev/null @@ -1,528 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation Client -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)} -} - -// CreateOrUpdate create a source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// parameters - the parameters supplied to the create or update source control operation. -func (client SourceControlClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlCreateOrUpdateParameters) (result SourceControl, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.RepoURL", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.RepoURL", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.Branch", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.Branch", Name: validation.MaxLength, Rule: 255, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.FolderPath", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.FolderPath", Name: validation.MaxLength, Rule: 255, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.AccessToken", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.AccessToken", Name: validation.MaxLength, Rule: 1024, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.RefreshToken", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.RefreshToken", Name: validation.MaxLength, Rule: 1024, Chain: nil}}}, - }}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.Description", Name: validation.MaxLength, Rule: 512, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("automation.SourceControlClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SourceControlClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) CreateOrUpdateResponder(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 the source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the name of source control. -func (client SourceControlClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SourceControlClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SourceControlClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the source control identified by source control name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the name of source control. -func (client SourceControlClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result SourceControl, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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("automation.SourceControlClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SourceControlClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) 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 -} - -// ListByAutomationAccount retrieve a list of source controls. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client SourceControlClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result SourceControlListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.sclr.Response.Response != nil { - sc = result.sclr.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("automation.SourceControlClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.sclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.sclr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.sclr.hasNextLink() && result.sclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client SourceControlClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/sourceControls", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client SourceControlClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client SourceControlClient) ListByAutomationAccountResponder(resp *http.Response) (result SourceControlListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client SourceControlClient) listByAutomationAccountNextResults(ctx context.Context, lastResults SourceControlListResult) (result SourceControlListResult, err error) { - req, err := lastResults.sourceControlListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.SourceControlClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.SourceControlClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client SourceControlClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result SourceControlListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update a source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// parameters - the parameters supplied to the update source control operation. -func (client SourceControlClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlUpdateParameters) (result SourceControl, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SourceControlClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SourceControlClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) UpdateResponder(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 -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrolsyncjob.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrolsyncjob.go deleted file mode 100644 index f7a08e39b86e..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrolsyncjob.go +++ /dev/null @@ -1,350 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SourceControlSyncJobClient is the automation Client -type SourceControlSyncJobClient struct { - BaseClient -} - -// NewSourceControlSyncJobClient creates an instance of the SourceControlSyncJobClient client. -func NewSourceControlSyncJobClient(subscriptionID string) SourceControlSyncJobClient { - return NewSourceControlSyncJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSourceControlSyncJobClientWithBaseURI creates an instance of the SourceControlSyncJobClient 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 NewSourceControlSyncJobClientWithBaseURI(baseURI string, subscriptionID string) SourceControlSyncJobClient { - return SourceControlSyncJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates the sync job for a source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -// parameters - the parameters supplied to the create source control sync job operation. -func (client SourceControlSyncJobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, parameters SourceControlSyncJobCreateParameters) (result SourceControlSyncJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SourceControlSyncJobCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SourceControlSyncJobCreateProperties.CommitID", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SourceControlSyncJobCreateProperties.CommitID", Name: validation.MinLength, Rule: 0, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("automation.SourceControlSyncJobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SourceControlSyncJobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, parameters SourceControlSyncJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}", 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 SourceControlSyncJobClient) 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 SourceControlSyncJobClient) CreateResponder(resp *http.Response) (result SourceControlSyncJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the source control sync job identified by job id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -func (client SourceControlSyncJobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID) (result SourceControlSyncJobByID, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.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("automation.SourceControlSyncJobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SourceControlSyncJobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}", 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 SourceControlSyncJobClient) 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 SourceControlSyncJobClient) GetResponder(resp *http.Response) (result SourceControlSyncJobByID, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of source control sync jobs. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// filter - the filter to apply on the operation. -func (client SourceControlSyncJobClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result SourceControlSyncJobListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.scsjlr.Response.Response != nil { - sc = result.scsjlr.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("automation.SourceControlSyncJobClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.scsjlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.scsjlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.scsjlr.hasNextLink() && result.scsjlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client SourceControlSyncJobClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client SourceControlSyncJobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client SourceControlSyncJobClient) ListByAutomationAccountResponder(resp *http.Response) (result SourceControlSyncJobListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client SourceControlSyncJobClient) listByAutomationAccountNextResults(ctx context.Context, lastResults SourceControlSyncJobListResult) (result SourceControlSyncJobListResult, err error) { - req, err := lastResults.sourceControlSyncJobListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client SourceControlSyncJobClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result SourceControlSyncJobListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, sourceControlName, filter) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrolsyncjobstreams.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrolsyncjobstreams.go deleted file mode 100644 index 56327b1605f8..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/sourcecontrolsyncjobstreams.go +++ /dev/null @@ -1,258 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SourceControlSyncJobStreamsClient is the automation Client -type SourceControlSyncJobStreamsClient struct { - BaseClient -} - -// NewSourceControlSyncJobStreamsClient creates an instance of the SourceControlSyncJobStreamsClient client. -func NewSourceControlSyncJobStreamsClient(subscriptionID string) SourceControlSyncJobStreamsClient { - return NewSourceControlSyncJobStreamsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSourceControlSyncJobStreamsClientWithBaseURI creates an instance of the SourceControlSyncJobStreamsClient 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 NewSourceControlSyncJobStreamsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlSyncJobStreamsClient { - return SourceControlSyncJobStreamsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve a sync job stream identified by stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -// streamID - the id of the sync job stream. -func (client SourceControlSyncJobStreamsClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, streamID string) (result SourceControlSyncJobStreamByID, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsClient.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("automation.SourceControlSyncJobStreamsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, streamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SourceControlSyncJobStreamsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, streamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "streamId": autorest.Encode("path", streamID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams/{streamId}", 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 SourceControlSyncJobStreamsClient) 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 SourceControlSyncJobStreamsClient) GetResponder(resp *http.Response) (result SourceControlSyncJobStreamByID, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySyncJob retrieve a list of sync job streams identified by sync job id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -// filter - the filter to apply on the operation. -func (client SourceControlSyncJobStreamsClient) ListBySyncJob(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result SourceControlSyncJobStreamsListBySyncJobPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsClient.ListBySyncJob") - defer func() { - sc := -1 - if result.scsjslbsj.Response.Response != nil { - sc = result.scsjslbsj.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("automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", err.Error()) - } - - result.fn = client.listBySyncJobNextResults - req, err := client.ListBySyncJobPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySyncJobSender(req) - if err != nil { - result.scsjslbsj.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", resp, "Failure sending request") - return - } - - result.scsjslbsj, err = client.ListBySyncJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", resp, "Failure responding to request") - return - } - if result.scsjslbsj.hasNextLink() && result.scsjslbsj.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySyncJobPreparer prepares the ListBySyncJob request. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySyncJobSender sends the ListBySyncJob request. The method will close the -// http.Response Body if it receives an error. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySyncJobResponder handles the response to the ListBySyncJob request. The method always -// closes the http.Response Body. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobResponder(resp *http.Response) (result SourceControlSyncJobStreamsListBySyncJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySyncJobNextResults retrieves the next set of results, if any. -func (client SourceControlSyncJobStreamsClient) listBySyncJobNextResults(ctx context.Context, lastResults SourceControlSyncJobStreamsListBySyncJob) (result SourceControlSyncJobStreamsListBySyncJob, err error) { - req, err := lastResults.sourceControlSyncJobStreamsListBySyncJobPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "listBySyncJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySyncJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "listBySyncJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySyncJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "listBySyncJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySyncJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result SourceControlSyncJobStreamsListBySyncJobIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsClient.ListBySyncJob") - 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.ListBySyncJob(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, filter) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/statistics.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/statistics.go deleted file mode 100644 index d7428a0f113e..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/statistics.go +++ /dev/null @@ -1,120 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// StatisticsClient is the automation Client -type StatisticsClient struct { - BaseClient -} - -// NewStatisticsClient creates an instance of the StatisticsClient client. -func NewStatisticsClient(subscriptionID string) StatisticsClient { - return NewStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewStatisticsClientWithBaseURI creates an instance of the StatisticsClient 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 NewStatisticsClientWithBaseURI(baseURI string, subscriptionID string) StatisticsClient { - return StatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the statistics for the account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client StatisticsClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result StatisticsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StatisticsClient.ListByAutomationAccount") - 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("automation.StatisticsClient", "ListByAutomationAccount", err.Error()) - } - - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client StatisticsClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/statistics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client StatisticsClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client StatisticsClient) ListByAutomationAccountResponder(resp *http.Response) (result StatisticsListResult, 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/automation/mgmt/2017-05-15-preview/automation/testjob.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/testjob.go deleted file mode 100644 index dc1d7eab727d..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/testjob.go +++ /dev/null @@ -1,462 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TestJobClient is the automation Client -type TestJobClient struct { - BaseClient -} - -// NewTestJobClient creates an instance of the TestJobClient client. -func NewTestJobClient(subscriptionID string) TestJobClient { - return NewTestJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTestJobClientWithBaseURI creates an instance of the TestJobClient 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 NewTestJobClientWithBaseURI(baseURI string, subscriptionID string) TestJobClient { - return TestJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a test job of the runbook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the parameters supplied to the create test job operation. -// parameters - the parameters supplied to the create test job operation. -func (client TestJobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (result TestJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.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("automation.TestJobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TestJobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", 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 TestJobClient) 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 TestJobClient) CreateResponder(resp *http.Response) (result TestJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the test job for the specified runbook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result TestJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.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("automation.TestJobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TestJobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", 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 TestJobClient) 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 TestJobClient) GetResponder(resp *http.Response) (result TestJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Resume resume the test job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Resume(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.Resume") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.TestJobClient", "Resume", err.Error()) - } - - req, err := client.ResumePreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Resume", resp, "Failure responding to request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client TestJobClient) ResumePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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 TestJobClient) ResumeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client TestJobClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop the test job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.Stop") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.TestJobClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client TestJobClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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 TestJobClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client TestJobClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Suspend suspend the test job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.Suspend") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.TestJobClient", "Suspend", err.Error()) - } - - req, err := client.SuspendPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Suspend", resp, "Failure responding to request") - return - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client TestJobClient) SuspendPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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 TestJobClient) SuspendSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client TestJobClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/testjobstreams.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/testjobstreams.go deleted file mode 100644 index 4d3cfe0c34bc..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/testjobstreams.go +++ /dev/null @@ -1,252 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TestJobStreamsClient is the automation Client -type TestJobStreamsClient struct { - BaseClient -} - -// NewTestJobStreamsClient creates an instance of the TestJobStreamsClient client. -func NewTestJobStreamsClient(subscriptionID string) TestJobStreamsClient { - return NewTestJobStreamsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTestJobStreamsClientWithBaseURI creates an instance of the TestJobStreamsClient 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 NewTestJobStreamsClientWithBaseURI(baseURI string, subscriptionID string) TestJobStreamsClient { - return TestJobStreamsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve a test job stream of the test job identified by runbook name and stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// jobStreamID - the job stream id. -func (client TestJobStreamsClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (result JobStream, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobStreamsClient.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("automation.TestJobStreamsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName, jobStreamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TestJobStreamsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}", 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 TestJobStreamsClient) 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 TestJobStreamsClient) GetResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByTestJob retrieve a list of test job streams identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// filter - the filter to apply on the operation. -func (client TestJobStreamsClient) ListByTestJob(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result JobStreamListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobStreamsClient.ListByTestJob") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.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("automation.TestJobStreamsClient", "ListByTestJob", err.Error()) - } - - result.fn = client.listByTestJobNextResults - req, err := client.ListByTestJobPreparer(ctx, resourceGroupName, automationAccountName, runbookName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTestJobSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByTestJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTestJobPreparer prepares the ListByTestJob request. -func (client TestJobStreamsClient) ListByTestJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTestJobSender sends the ListByTestJob request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobStreamsClient) ListByTestJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTestJobResponder handles the response to the ListByTestJob request. The method always -// closes the http.Response Body. -func (client TestJobStreamsClient) ListByTestJobResponder(resp *http.Response) (result JobStreamListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTestJobNextResults retrieves the next set of results, if any. -func (client TestJobStreamsClient) listByTestJobNextResults(ctx context.Context, lastResults JobStreamListResult) (result JobStreamListResult, err error) { - req, err := lastResults.jobStreamListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "listByTestJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTestJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "listByTestJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTestJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "listByTestJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTestJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client TestJobStreamsClient) ListByTestJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result JobStreamListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobStreamsClient.ListByTestJob") - 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.ListByTestJob(ctx, resourceGroupName, automationAccountName, runbookName, filter) - return -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/usages.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/usages.go deleted file mode 100644 index ee9027e720bc..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/usages.go +++ /dev/null @@ -1,116 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UsagesClient is the automation Client -type UsagesClient struct { - BaseClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient 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 NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the usage for the account id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client UsagesClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result UsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.ListByAutomationAccount") - 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("automation.UsagesClient", "ListByAutomationAccount", err.Error()) - } - - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client UsagesClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListByAutomationAccountResponder(resp *http.Response) (result UsageListResult, 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/automation/mgmt/2017-05-15-preview/automation/variable.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/variable.go deleted file mode 100644 index f1a905628f9f..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/variable.go +++ /dev/null @@ -1,510 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// VariableClient is the automation Client -type VariableClient struct { - BaseClient -} - -// NewVariableClient creates an instance of the VariableClient client. -func NewVariableClient(subscriptionID string) VariableClient { - return NewVariableClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVariableClientWithBaseURI creates an instance of the VariableClient 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 NewVariableClientWithBaseURI(baseURI string, subscriptionID string) VariableClient { - return VariableClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a variable. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the variable name. -// parameters - the parameters supplied to the create or update variable operation. -func (client VariableClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (result Variable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.VariableCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.VariableClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, variableName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VariableClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) CreateOrUpdateResponder(resp *http.Response) (result Variable, 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 variable. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the name of variable. -func (client VariableClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.VariableClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, variableName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VariableClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the variable identified by variable name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the name of variable. -func (client VariableClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result Variable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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("automation.VariableClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, variableName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VariableClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) GetResponder(resp *http.Response) (result Variable, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of variables. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client VariableClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result VariableListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.vlr.Response.Response != nil { - sc = result.vlr.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("automation.VariableClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.vlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.vlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.vlr.hasNextLink() && result.vlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client VariableClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client VariableClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client VariableClient) ListByAutomationAccountResponder(resp *http.Response) (result VariableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client VariableClient) listByAutomationAccountNextResults(ctx context.Context, lastResults VariableListResult) (result VariableListResult, err error) { - req, err := lastResults.variableListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.VariableClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.VariableClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client VariableClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result VariableListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a variable. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the variable name. -// parameters - the parameters supplied to the update variable operation. -func (client VariableClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (result Variable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.VariableClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, variableName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VariableClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) UpdateResponder(resp *http.Response) (result Variable, 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/automation/mgmt/2017-05-15-preview/automation/version.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/version.go deleted file mode 100644 index 581c524f009e..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package automation - -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() + " automation/2017-05-15-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/webhook.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/webhook.go deleted file mode 100644 index 302cfc5d2402..000000000000 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/webhook.go +++ /dev/null @@ -1,598 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WebhookClient is the automation Client -type WebhookClient struct { - BaseClient -} - -// NewWebhookClient creates an instance of the WebhookClient client. -func NewWebhookClient(subscriptionID string) WebhookClient { - return NewWebhookClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhookClientWithBaseURI creates an instance of the WebhookClient 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 NewWebhookClientWithBaseURI(baseURI string, subscriptionID string) WebhookClient { - return WebhookClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the webhook identified by webhook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -// parameters - the create or update parameters for webhook. -func (client WebhookClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WebhookCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WebhookClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, webhookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WebhookClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) CreateOrUpdateResponder(resp *http.Response) (result Webhook, 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 webhook by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -func (client WebhookClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WebhookClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhookClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateURI generates a Uri for use in creating a webhook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client WebhookClient) GenerateURI(ctx context.Context, resourceGroupName string, automationAccountName string) (result String, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.GenerateURI") - 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("automation.WebhookClient", "GenerateURI", err.Error()) - } - - req, err := client.GenerateURIPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateURISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure sending request") - return - } - - result, err = client.GenerateURIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure responding to request") - return - } - - return -} - -// GenerateURIPreparer prepares the GenerateURI request. -func (client WebhookClient) GenerateURIPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateURISender sends the GenerateURI request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) GenerateURISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateURIResponder handles the response to the GenerateURI request. The method always -// closes the http.Response Body. -func (client WebhookClient) GenerateURIResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the webhook identified by webhook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -func (client WebhookClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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("automation.WebhookClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhookClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of webhooks. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client WebhookClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.ListByAutomationAccount") - 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: 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("automation.WebhookClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client WebhookClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/webhooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client WebhookClient) ListByAutomationAccountResponder(resp *http.Response) (result WebhookListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client WebhookClient) listByAutomationAccountNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhookClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update the webhook identified by webhook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -// parameters - the update parameters for webhook. -func (client WebhookClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WebhookClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, webhookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhookClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) UpdateResponder(resp *http.Response) (result Webhook, 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/automation/mgmt/2018-01-15-preview/automation/CHANGELOG.md b/services/preview/automation/mgmt/2018-01-15-preview/automation/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/_meta.json b/services/preview/automation/mgmt/2018-01-15-preview/automation/_meta.json deleted file mode 100644 index e2c96ce4b527..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", - "tag": "package-2018-01-preview", - "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-2018-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/account.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/account.go deleted file mode 100644 index f9c7a69a123d..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/account.go +++ /dev/null @@ -1,610 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation 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)} -} - -// CreateOrUpdate create or update automation account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// parameters - parameters supplied to the create or update automation account. -func (client AccountClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.AccountClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AccountClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}", 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 AccountClient) 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 AccountClient) CreateOrUpdateResponder(resp *http.Response) (result Account, 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 an automation account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client AccountClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.AccountClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", 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) (*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 AccountClient) 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 information about an Automation Account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client AccountClient) Get(ctx context.Context, resourceGroupName string, automationAccountName 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: 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("automation.AccountClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.AccountClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", 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 -} - -// List retrieve a list of accounts within a given 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, "automation.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, "automation.AccountClient", "List", resp, "Failure sending request") - return - } - - result.alr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts", 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, "automation.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, "automation.AccountClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 retrieve a list of accounts within a given resource group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -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) - }() - } - 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("automation.AccountClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.AccountClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts", 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, "automation.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, "automation.AccountClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 -} - -// Update update an automation account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// parameters - parameters supplied to the update automation account. -func (client AccountClient) Update(ctx context.Context, resourceGroupName string, automationAccountName 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: 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("automation.AccountClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.AccountClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}", 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/preview/automation/mgmt/2018-01-15-preview/automation/activity.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/activity.go deleted file mode 100644 index 5612b8c1f186..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/activity.go +++ /dev/null @@ -1,248 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ActivityClient is the automation Client -type ActivityClient struct { - BaseClient -} - -// NewActivityClient creates an instance of the ActivityClient client. -func NewActivityClient(subscriptionID string) ActivityClient { - return NewActivityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityClientWithBaseURI creates an instance of the ActivityClient 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 NewActivityClientWithBaseURI(baseURI string, subscriptionID string) ActivityClient { - return ActivityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the activity in the module identified by module name and activity name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// activityName - the name of activity. -func (client ActivityClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, activityName string) (result Activity, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityClient.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("automation.ActivityClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, moduleName, activityName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, activityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityName": autorest.Encode("path", activityName), - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}", 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 ActivityClient) 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 ActivityClient) GetResponder(resp *http.Response) (result Activity, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByModule retrieve a list of activities in the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -func (client ActivityClient) ListByModule(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result ActivityListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityClient.ListByModule") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.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("automation.ActivityClient", "ListByModule", err.Error()) - } - - result.fn = client.listByModuleNextResults - req, err := client.ListByModulePreparer(ctx, resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByModuleSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByModuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByModulePreparer prepares the ListByModule request. -func (client ActivityClient) ListByModulePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByModuleSender sends the ListByModule request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityClient) ListByModuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByModuleResponder handles the response to the ListByModule request. The method always -// closes the http.Response Body. -func (client ActivityClient) ListByModuleResponder(resp *http.Response) (result ActivityListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByModuleNextResults retrieves the next set of results, if any. -func (client ActivityClient) listByModuleNextResults(ctx context.Context, lastResults ActivityListResult) (result ActivityListResult, err error) { - req, err := lastResults.activityListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "listByModuleNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByModuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "listByModuleNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByModuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "listByModuleNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByModuleComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityClient) ListByModuleComplete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result ActivityListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityClient.ListByModule") - 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.ListByModule(ctx, resourceGroupName, automationAccountName, moduleName) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/agentregistrationinformation.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/agentregistrationinformation.go deleted file mode 100644 index c7662bb837fc..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/agentregistrationinformation.go +++ /dev/null @@ -1,204 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AgentRegistrationInformationClient is the automation Client -type AgentRegistrationInformationClient struct { - BaseClient -} - -// NewAgentRegistrationInformationClient creates an instance of the AgentRegistrationInformationClient client. -func NewAgentRegistrationInformationClient(subscriptionID string) AgentRegistrationInformationClient { - return NewAgentRegistrationInformationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgentRegistrationInformationClientWithBaseURI creates an instance of the AgentRegistrationInformationClient -// 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 NewAgentRegistrationInformationClientWithBaseURI(baseURI string, subscriptionID string) AgentRegistrationInformationClient { - return AgentRegistrationInformationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the automation agent registration information. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client AgentRegistrationInformationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result AgentRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentRegistrationInformationClient.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("automation.AgentRegistrationInformationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgentRegistrationInformationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation", 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 AgentRegistrationInformationClient) 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 AgentRegistrationInformationClient) GetResponder(resp *http.Response) (result AgentRegistration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a primary or secondary agent registration key -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// parameters - the name of the agent registration key to be regenerated -func (client AgentRegistrationInformationClient) RegenerateKey(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (result AgentRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentRegistrationInformationClient.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: 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("automation.AgentRegistrationInformationClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AgentRegistrationInformationClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - 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.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey", 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 AgentRegistrationInformationClient) 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 AgentRegistrationInformationClient) RegenerateKeyResponder(resp *http.Response) (result AgentRegistration, 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/automation/mgmt/2018-01-15-preview/automation/automationapi/interfaces.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/automationapi/interfaces.go deleted file mode 100644 index 027988d1cfe8..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/automationapi/interfaces.go +++ /dev/null @@ -1,423 +0,0 @@ -package automationapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/automation/mgmt/2018-01-15-preview/automation" - "github.com/Azure/go-autorest/autorest" - "github.com/gofrs/uuid" - "io" -) - -// AccountClientAPI contains the set of methods on the AccountClient type. -type AccountClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, parameters automation.AccountCreateOrUpdateParameters) (result automation.Account, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.Account, err error) - List(ctx context.Context) (result automation.AccountListResultPage, err error) - ListComplete(ctx context.Context) (result automation.AccountListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result automation.AccountListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result automation.AccountListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, parameters automation.AccountUpdateParameters) (result automation.Account, err error) -} - -var _ AccountClientAPI = (*automation.AccountClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result automation.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*automation.OperationsClient)(nil) - -// StatisticsClientAPI contains the set of methods on the StatisticsClient type. -type StatisticsClientAPI interface { - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.StatisticsListResult, err error) -} - -var _ StatisticsClientAPI = (*automation.StatisticsClient)(nil) - -// UsagesClientAPI contains the set of methods on the UsagesClient type. -type UsagesClientAPI interface { - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.UsageListResult, err error) -} - -var _ UsagesClientAPI = (*automation.UsagesClient)(nil) - -// KeysClientAPI contains the set of methods on the KeysClient type. -type KeysClientAPI interface { - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.KeyListResult, err error) -} - -var _ KeysClientAPI = (*automation.KeysClient)(nil) - -// CertificateClientAPI contains the set of methods on the CertificateClient type. -type CertificateClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters automation.CertificateCreateOrUpdateParameters) (result automation.Certificate, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (result automation.Certificate, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CertificateListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CertificateListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters automation.CertificateUpdateParameters) (result automation.Certificate, err error) -} - -var _ CertificateClientAPI = (*automation.CertificateClient)(nil) - -// ConnectionClientAPI contains the set of methods on the ConnectionClient type. -type ConnectionClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters automation.ConnectionCreateOrUpdateParameters) (result automation.Connection, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result automation.Connection, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result automation.Connection, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters automation.ConnectionUpdateParameters) (result automation.Connection, err error) -} - -var _ ConnectionClientAPI = (*automation.ConnectionClient)(nil) - -// ConnectionTypeClientAPI contains the set of methods on the ConnectionTypeClient type. -type ConnectionTypeClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string, parameters automation.ConnectionTypeCreateOrUpdateParameters) (result automation.ConnectionType, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result automation.ConnectionType, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionTypeListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionTypeListResultIterator, err error) -} - -var _ ConnectionTypeClientAPI = (*automation.ConnectionTypeClient)(nil) - -// CredentialClientAPI contains the set of methods on the CredentialClient type. -type CredentialClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters automation.CredentialCreateOrUpdateParameters) (result automation.Credential, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result automation.Credential, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CredentialListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CredentialListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters automation.CredentialUpdateParameters) (result automation.Credential, err error) -} - -var _ CredentialClientAPI = (*automation.CredentialClient)(nil) - -// DscConfigurationClientAPI contains the set of methods on the DscConfigurationClient type. -type DscConfigurationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters automation.DscConfigurationCreateOrUpdateParameters) (result automation.DscConfiguration, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result automation.DscConfiguration, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result automation.ReadCloser, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscConfigurationListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscConfigurationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters *automation.DscConfigurationUpdateParameters) (result automation.DscConfiguration, err error) -} - -var _ DscConfigurationClientAPI = (*automation.DscConfigurationClient)(nil) - -// HybridRunbookWorkerGroupClientAPI contains the set of methods on the HybridRunbookWorkerGroupClient type. -type HybridRunbookWorkerGroupClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result automation.HybridRunbookWorkerGroup, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.HybridRunbookWorkerGroupsListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.HybridRunbookWorkerGroupsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters automation.HybridRunbookWorkerGroupUpdateParameters) (result automation.HybridRunbookWorkerGroup, err error) -} - -var _ HybridRunbookWorkerGroupClientAPI = (*automation.HybridRunbookWorkerGroupClient)(nil) - -// JobScheduleClientAPI contains the set of methods on the JobScheduleClient type. -type JobScheduleClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters automation.JobScheduleCreateParameters) (result automation.JobSchedule, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result automation.JobSchedule, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.JobScheduleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.JobScheduleListResultIterator, err error) -} - -var _ JobScheduleClientAPI = (*automation.JobScheduleClient)(nil) - -// LinkedWorkspaceClientAPI contains the set of methods on the LinkedWorkspaceClient type. -type LinkedWorkspaceClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.LinkedWorkspace, err error) -} - -var _ LinkedWorkspaceClientAPI = (*automation.LinkedWorkspaceClient)(nil) - -// ActivityClientAPI contains the set of methods on the ActivityClient type. -type ActivityClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, activityName string) (result automation.Activity, err error) - ListByModule(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result automation.ActivityListResultPage, err error) - ListByModuleComplete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result automation.ActivityListResultIterator, err error) -} - -var _ ActivityClientAPI = (*automation.ActivityClient)(nil) - -// ModuleClientAPI contains the set of methods on the ModuleClient type. -type ModuleClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters automation.ModuleCreateOrUpdateParameters) (result automation.Module, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result automation.Module, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ModuleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ModuleListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters automation.ModuleUpdateParameters) (result automation.Module, err error) -} - -var _ ModuleClientAPI = (*automation.ModuleClient)(nil) - -// ObjectDataTypesClientAPI contains the set of methods on the ObjectDataTypesClient type. -type ObjectDataTypesClientAPI interface { - ListFieldsByModuleAndType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result automation.TypeFieldListResult, err error) - ListFieldsByType(ctx context.Context, resourceGroupName string, automationAccountName string, typeName string) (result automation.TypeFieldListResult, err error) -} - -var _ ObjectDataTypesClientAPI = (*automation.ObjectDataTypesClient)(nil) - -// FieldsClientAPI contains the set of methods on the FieldsClient type. -type FieldsClientAPI interface { - ListByType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result automation.TypeFieldListResult, err error) -} - -var _ FieldsClientAPI = (*automation.FieldsClient)(nil) - -// RunbookDraftClientAPI contains the set of methods on the RunbookDraftClient type. -type RunbookDraftClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.RunbookDraft, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.ReadCloser, err error) - Publish(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.RunbookDraftPublishFuture, err error) - ReplaceContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser) (result automation.RunbookDraftReplaceContentFuture, err error) - UndoEdit(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.RunbookDraftUndoEditResult, err error) -} - -var _ RunbookDraftClientAPI = (*automation.RunbookDraftClient)(nil) - -// RunbookClientAPI contains the set of methods on the RunbookClient type. -type RunbookClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters automation.RunbookCreateOrUpdateParameters) (result automation.Runbook, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.Runbook, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.ReadCloser, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.RunbookListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.RunbookListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters automation.RunbookUpdateParameters) (result automation.Runbook, err error) -} - -var _ RunbookClientAPI = (*automation.RunbookClient)(nil) - -// TestJobStreamsClientAPI contains the set of methods on the TestJobStreamsClient type. -type TestJobStreamsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (result automation.JobStream, err error) - ListByTestJob(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result automation.JobStreamListResultPage, err error) - ListByTestJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result automation.JobStreamListResultIterator, err error) -} - -var _ TestJobStreamsClientAPI = (*automation.TestJobStreamsClient)(nil) - -// TestJobClientAPI contains the set of methods on the TestJobClient type. -type TestJobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters automation.TestJobCreateParameters) (result automation.TestJob, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.TestJob, err error) - Resume(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) - Stop(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) - Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) -} - -var _ TestJobClientAPI = (*automation.TestJobClient)(nil) - -// ScheduleClientAPI contains the set of methods on the ScheduleClient type. -type ScheduleClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters automation.ScheduleCreateOrUpdateParameters) (result automation.Schedule, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result automation.Schedule, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ScheduleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ScheduleListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters automation.ScheduleUpdateParameters) (result automation.Schedule, err error) -} - -var _ ScheduleClientAPI = (*automation.ScheduleClient)(nil) - -// VariableClientAPI contains the set of methods on the VariableClient type. -type VariableClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters automation.VariableCreateOrUpdateParameters) (result automation.Variable, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result automation.Variable, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.VariableListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.VariableListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters automation.VariableUpdateParameters) (result automation.Variable, err error) -} - -var _ VariableClientAPI = (*automation.VariableClient)(nil) - -// WebhookClientAPI contains the set of methods on the WebhookClient type. -type WebhookClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters automation.WebhookCreateOrUpdateParameters) (result automation.Webhook, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result autorest.Response, err error) - GenerateURI(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.String, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result automation.Webhook, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WebhookListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WebhookListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters automation.WebhookUpdateParameters) (result automation.Webhook, err error) -} - -var _ WebhookClientAPI = (*automation.WebhookClient)(nil) - -// WatcherClientAPI contains the set of methods on the WatcherClient type. -type WatcherClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters automation.Watcher) (result automation.Watcher, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result automation.Watcher, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WatcherListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WatcherListResultIterator, err error) - Start(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) - Stop(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters automation.WatcherUpdateParameters) (result automation.Watcher, err error) -} - -var _ WatcherClientAPI = (*automation.WatcherClient)(nil) - -// SoftwareUpdateConfigurationsClientAPI contains the set of methods on the SoftwareUpdateConfigurationsClient type. -type SoftwareUpdateConfigurationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, parameters automation.SoftwareUpdateConfiguration, clientRequestID string) (result automation.SoftwareUpdateConfiguration, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result autorest.Response, err error) - GetByName(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result automation.SoftwareUpdateConfiguration, err error) - List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string) (result automation.SoftwareUpdateConfigurationListResult, err error) -} - -var _ SoftwareUpdateConfigurationsClientAPI = (*automation.SoftwareUpdateConfigurationsClient)(nil) - -// SoftwareUpdateConfigurationRunsClientAPI contains the set of methods on the SoftwareUpdateConfigurationRunsClient type. -type SoftwareUpdateConfigurationRunsClientAPI interface { - GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationRunID uuid.UUID, clientRequestID string) (result automation.SoftwareUpdateConfigurationRun, err error) - List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result automation.SoftwareUpdateConfigurationRunListResult, err error) -} - -var _ SoftwareUpdateConfigurationRunsClientAPI = (*automation.SoftwareUpdateConfigurationRunsClient)(nil) - -// SoftwareUpdateConfigurationMachineRunsClientAPI contains the set of methods on the SoftwareUpdateConfigurationMachineRunsClient type. -type SoftwareUpdateConfigurationMachineRunsClientAPI interface { - GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationMachineRunID uuid.UUID, clientRequestID string) (result automation.SoftwareUpdateConfigurationMachineRun, err error) - List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result automation.SoftwareUpdateConfigurationMachineRunListResult, err error) -} - -var _ SoftwareUpdateConfigurationMachineRunsClientAPI = (*automation.SoftwareUpdateConfigurationMachineRunsClient)(nil) - -// SourceControlClientAPI contains the set of methods on the SourceControlClient type. -type SourceControlClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters automation.SourceControlCreateOrUpdateParameters) (result automation.SourceControl, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result automation.SourceControl, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.SourceControlListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.SourceControlListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters automation.SourceControlUpdateParameters) (result automation.SourceControl, err error) -} - -var _ SourceControlClientAPI = (*automation.SourceControlClient)(nil) - -// SourceControlSyncJobClientAPI contains the set of methods on the SourceControlSyncJobClient type. -type SourceControlSyncJobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, parameters automation.SourceControlSyncJobCreateParameters) (result automation.SourceControlSyncJob, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID) (result automation.SourceControlSyncJobByID, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result automation.SourceControlSyncJobListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result automation.SourceControlSyncJobListResultIterator, err error) -} - -var _ SourceControlSyncJobClientAPI = (*automation.SourceControlSyncJobClient)(nil) - -// SourceControlSyncJobStreamsClientAPI contains the set of methods on the SourceControlSyncJobStreamsClient type. -type SourceControlSyncJobStreamsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, streamID string) (result automation.SourceControlSyncJobStreamByID, err error) - ListBySyncJob(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result automation.SourceControlSyncJobStreamsListBySyncJobPage, err error) - ListBySyncJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result automation.SourceControlSyncJobStreamsListBySyncJobIterator, err error) -} - -var _ SourceControlSyncJobStreamsClientAPI = (*automation.SourceControlSyncJobStreamsClient)(nil) - -// JobClientAPI contains the set of methods on the JobClient type. -type JobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, parameters automation.JobCreateParameters, clientRequestID string) (result automation.Job, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result automation.Job, err error) - GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result automation.ReadCloser, err error) - GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result automation.ReadCloser, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result automation.JobListResultV2Page, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result automation.JobListResultV2Iterator, err error) - Resume(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) - Stop(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) - Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) -} - -var _ JobClientAPI = (*automation.JobClient)(nil) - -// JobStreamClientAPI contains the set of methods on the JobStreamClient type. -type JobStreamClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, jobStreamID string, clientRequestID string) (result automation.JobStream, err error) - ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result automation.JobStreamListResultPage, err error) - ListByJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result automation.JobStreamListResultIterator, err error) -} - -var _ JobStreamClientAPI = (*automation.JobStreamClient)(nil) - -// AgentRegistrationInformationClientAPI contains the set of methods on the AgentRegistrationInformationClient type. -type AgentRegistrationInformationClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.AgentRegistration, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, automationAccountName string, parameters automation.AgentRegistrationRegenerateKeyParameter) (result automation.AgentRegistration, err error) -} - -var _ AgentRegistrationInformationClientAPI = (*automation.AgentRegistrationInformationClient)(nil) - -// DscNodeClientAPI contains the set of methods on the DscNodeClient type. -type DscNodeClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result automation.DscNode, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result automation.DscNode, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscNodeListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscNodeListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, dscNodeUpdateParameters automation.DscNodeUpdateParameters) (result automation.DscNode, err error) -} - -var _ DscNodeClientAPI = (*automation.DscNodeClient)(nil) - -// NodeReportsClientAPI contains the set of methods on the NodeReportsClient type. -type NodeReportsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result automation.DscNodeReport, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result automation.SetObject, err error) - ListByNode(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result automation.DscNodeReportListResultPage, err error) - ListByNodeComplete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result automation.DscNodeReportListResultIterator, err error) -} - -var _ NodeReportsClientAPI = (*automation.NodeReportsClient)(nil) - -// DscCompilationJobClientAPI contains the set of methods on the DscCompilationJobClient type. -type DscCompilationJobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string, parameters automation.DscCompilationJobCreateParameters) (result automation.DscCompilationJobCreateFuture, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string) (result automation.DscCompilationJob, err error) - GetStream(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (result automation.JobStream, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscCompilationJobListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscCompilationJobListResultIterator, err error) -} - -var _ DscCompilationJobClientAPI = (*automation.DscCompilationJobClient)(nil) - -// DscCompilationJobStreamClientAPI contains the set of methods on the DscCompilationJobStreamClient type. -type DscCompilationJobStreamClientAPI interface { - ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result automation.JobStreamListResult, err error) -} - -var _ DscCompilationJobStreamClientAPI = (*automation.DscCompilationJobStreamClient)(nil) - -// DscNodeConfigurationClientAPI contains the set of methods on the DscNodeConfigurationClient type. -type DscNodeConfigurationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters automation.DscNodeConfigurationCreateOrUpdateParameters) (result automation.DscNodeConfigurationCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result automation.DscNodeConfiguration, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscNodeConfigurationListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscNodeConfigurationListResultIterator, err error) -} - -var _ DscNodeConfigurationClientAPI = (*automation.DscNodeConfigurationClient)(nil) - -// NodeCountInformationClientAPI contains the set of methods on the NodeCountInformationClient type. -type NodeCountInformationClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, countType automation.CountType) (result automation.NodeCounts, err error) -} - -var _ NodeCountInformationClientAPI = (*automation.NodeCountInformationClient)(nil) diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/certificate.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/certificate.go deleted file mode 100644 index 65ee261ec45f..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/certificate.go +++ /dev/null @@ -1,511 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation 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)} -} - -// CreateOrUpdate create a certificate. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the parameters supplied to the create or update certificate operation. -// parameters - the parameters supplied to the create or update certificate operation. -func (client CertificateClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CertificateCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties.Base64Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.CertificateClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", 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 CertificateClient) 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 CertificateClient) CreateOrUpdateResponder(resp *http.Response) (result Certificate, 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 certificate. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the name of certificate. -func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.CertificateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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) (*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 CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the certificate identified by certificate name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the name of certificate. -func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, automationAccountName 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: 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("automation.CertificateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.CertificateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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 -} - -// ListByAutomationAccount retrieve a list of certificates. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client CertificateClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result CertificateListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.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("automation.CertificateClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client CertificateClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client CertificateClient) ListByAutomationAccountResponder(resp *http.Response) (result CertificateListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client CertificateClient) listByAutomationAccountNextResults(ctx context.Context, lastResults CertificateListResult) (result CertificateListResult, err error) { - req, err := lastResults.certificateListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client CertificateClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result CertificateListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a certificate. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the parameters supplied to the update certificate operation. -// parameters - the parameters supplied to the update certificate operation. -func (client CertificateClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (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: 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("automation.CertificateClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.CertificateClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CertificateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", 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 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/preview/automation/mgmt/2018-01-15-preview/automation/client.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/client.go deleted file mode 100644 index e729ae544fd6..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package automation implements the Azure ARM Automation service API version . -// -// Automation Client -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Automation - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Automation. -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/automation/mgmt/2018-01-15-preview/automation/connection.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/connection.go deleted file mode 100644 index 9f867a8a089d..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/connection.go +++ /dev/null @@ -1,512 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ConnectionClient is the automation Client -type ConnectionClient struct { - BaseClient -} - -// NewConnectionClient creates an instance of the ConnectionClient client. -func NewConnectionClient(subscriptionID string) ConnectionClient { - return NewConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectionClientWithBaseURI creates an instance of the ConnectionClient 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 NewConnectionClientWithBaseURI(baseURI string, subscriptionID string) ConnectionClient { - return ConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a connection. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the parameters supplied to the create or update connection operation. -// parameters - the parameters supplied to the create or update connection operation. -func (client ConnectionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectionCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectionCreateOrUpdateProperties.ConnectionType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.ConnectionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, connectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) CreateOrUpdateResponder(resp *http.Response) (result Connection, 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 connection. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the name of connection. -func (client ConnectionClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ConnectionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, connectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectionClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) DeleteResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the connection identified by connection name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the name of connection. -func (client ConnectionClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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("automation.ConnectionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, connectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) GetResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of connections. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ConnectionClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.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("automation.ConnectionClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ConnectionClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ConnectionClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ConnectionClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ConnectionListResult) (result ConnectionListResult, err error) { - req, err := lastResults.connectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConnectionClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a connection. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the parameters supplied to the update a connection operation. -// parameters - the parameters supplied to the update a connection operation. -func (client ConnectionClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ConnectionClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, connectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ConnectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) UpdateResponder(resp *http.Response) (result Connection, 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/automation/mgmt/2018-01-15-preview/automation/connectiontype.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/connectiontype.go deleted file mode 100644 index 1fd5f23b2812..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/connectiontype.go +++ /dev/null @@ -1,422 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ConnectionTypeClient is the automation Client -type ConnectionTypeClient struct { - BaseClient -} - -// NewConnectionTypeClient creates an instance of the ConnectionTypeClient client. -func NewConnectionTypeClient(subscriptionID string) ConnectionTypeClient { - return NewConnectionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectionTypeClientWithBaseURI creates an instance of the ConnectionTypeClient 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 NewConnectionTypeClientWithBaseURI(baseURI string, subscriptionID string) ConnectionTypeClient { - return ConnectionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a connection type. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionTypeName - the parameters supplied to the create or update connection type operation. -// parameters - the parameters supplied to the create or update connection type operation. -func (client ConnectionTypeClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (result ConnectionType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectionTypeCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectionTypeCreateOrUpdateProperties.FieldDefinitions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.ConnectionTypeClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, connectionTypeName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectionTypeClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", 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 ConnectionTypeClient) 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 ConnectionTypeClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectionType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the connection type. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionTypeName - the name of connection type. -func (client ConnectionTypeClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ConnectionTypeClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, connectionTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectionTypeClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", 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 ConnectionTypeClient) 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 ConnectionTypeClient) 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 the connection type identified by connection type name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionTypeName - the name of connection type. -func (client ConnectionTypeClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result ConnectionType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.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("automation.ConnectionTypeClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, connectionTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", 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 ConnectionTypeClient) 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 ConnectionTypeClient) GetResponder(resp *http.Response) (result ConnectionType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of connection types. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ConnectionTypeClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionTypeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.ctlr.Response.Response != nil { - sc = result.ctlr.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("automation.ConnectionTypeClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.ctlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.ctlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.ctlr.hasNextLink() && result.ctlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ConnectionTypeClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionTypeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ConnectionTypeClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionTypeListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ConnectionTypeClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ConnectionTypeListResult) (result ConnectionTypeListResult, err error) { - req, err := lastResults.connectionTypeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConnectionTypeClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionTypeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/credential.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/credential.go deleted file mode 100644 index dc406e5626e3..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/credential.go +++ /dev/null @@ -1,513 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CredentialClient is the automation Client -type CredentialClient struct { - BaseClient -} - -// NewCredentialClient creates an instance of the CredentialClient client. -func NewCredentialClient(subscriptionID string) CredentialClient { - return NewCredentialClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCredentialClientWithBaseURI creates an instance of the CredentialClient 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 NewCredentialClientWithBaseURI(baseURI string, subscriptionID string) CredentialClient { - return CredentialClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a credential. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the parameters supplied to the create or update credential operation. -// parameters - the parameters supplied to the create or update credential operation. -func (client CredentialClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (result Credential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CredentialCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CredentialCreateOrUpdateProperties.UserName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CredentialCreateOrUpdateProperties.Password", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.CredentialClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, credentialName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CredentialClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) CreateOrUpdateResponder(resp *http.Response) (result Credential, 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 credential. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the name of credential. -func (client CredentialClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.CredentialClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CredentialClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the credential identified by credential name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the name of credential. -func (client CredentialClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result Credential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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("automation.CredentialClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CredentialClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) GetResponder(resp *http.Response) (result Credential, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of credentials. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client CredentialClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result CredentialListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.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("automation.CredentialClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client CredentialClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CredentialClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client CredentialClient) ListByAutomationAccountResponder(resp *http.Response) (result CredentialListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client CredentialClient) listByAutomationAccountNextResults(ctx context.Context, lastResults CredentialListResult) (result CredentialListResult, err error) { - req, err := lastResults.credentialListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client CredentialClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result CredentialListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a credential. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the parameters supplied to the Update credential operation. -// parameters - the parameters supplied to the Update credential operation. -func (client CredentialClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (result Credential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.CredentialClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, credentialName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CredentialClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) UpdateResponder(resp *http.Response) (result Credential, 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/automation/mgmt/2018-01-15-preview/automation/dsccompilationjob.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/dsccompilationjob.go deleted file mode 100644 index 03bc23b82033..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/dsccompilationjob.go +++ /dev/null @@ -1,433 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// DscCompilationJobClient is the automation Client -type DscCompilationJobClient struct { - BaseClient -} - -// NewDscCompilationJobClient creates an instance of the DscCompilationJobClient client. -func NewDscCompilationJobClient(subscriptionID string) DscCompilationJobClient { - return NewDscCompilationJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscCompilationJobClientWithBaseURI creates an instance of the DscCompilationJobClient 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 NewDscCompilationJobClientWithBaseURI(baseURI string, subscriptionID string) DscCompilationJobClient { - return DscCompilationJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates the Dsc compilation job of the configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// compilationJobName - the DSC configuration Id. -// parameters - the parameters supplied to the create compilation job operation. -func (client DscCompilationJobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string, parameters DscCompilationJobCreateParameters) (result DscCompilationJobCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties.Configuration", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.DscCompilationJobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, compilationJobName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DscCompilationJobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string, parameters DscCompilationJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "compilationJobName": autorest.Encode("path", compilationJobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - 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.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}", 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 DscCompilationJobClient) CreateSender(req *http.Request) (future DscCompilationJobCreateFuture, 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 DscCompilationJobClient) CreateResponder(resp *http.Response) (result DscCompilationJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the Dsc configuration compilation job identified by job id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// compilationJobName - the DSC configuration Id. -func (client DscCompilationJobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string) (result DscCompilationJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.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("automation.DscCompilationJobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, compilationJobName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscCompilationJobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "compilationJobName": autorest.Encode("path", compilationJobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}", 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 DscCompilationJobClient) 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 DscCompilationJobClient) GetResponder(resp *http.Response) (result DscCompilationJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStream retrieve the job stream identified by job stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobID - the job id. -// jobStreamID - the job stream id. -func (client DscCompilationJobClient) GetStream(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (result JobStream, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.GetStream") - 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("automation.DscCompilationJobClient", "GetStream", err.Error()) - } - - req, err := client.GetStreamPreparer(ctx, resourceGroupName, automationAccountName, jobID, jobStreamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", nil, "Failure preparing request") - return - } - - resp, err := client.GetStreamSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure sending request") - return - } - - result, err = client.GetStreamResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure responding to request") - return - } - - return -} - -// GetStreamPreparer prepares the GetStream request. -func (client DscCompilationJobClient) GetStreamPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetStreamSender sends the GetStream request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) GetStreamSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetStreamResponder handles the response to the GetStream request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) GetStreamResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc compilation jobs. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client DscCompilationJobClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscCompilationJobListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dcjlr.Response.Response != nil { - sc = result.dcjlr.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("automation.DscCompilationJobClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dcjlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dcjlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dcjlr.hasNextLink() && result.dcjlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscCompilationJobClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/compilationjobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) ListByAutomationAccountResponder(resp *http.Response) (result DscCompilationJobListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscCompilationJobClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscCompilationJobListResult) (result DscCompilationJobListResult, err error) { - req, err := lastResults.dscCompilationJobListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscCompilationJobClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscCompilationJobListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/dsccompilationjobstream.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/dsccompilationjobstream.go deleted file mode 100644 index e5c8326d8149..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/dsccompilationjobstream.go +++ /dev/null @@ -1,120 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// DscCompilationJobStreamClient is the automation Client -type DscCompilationJobStreamClient struct { - BaseClient -} - -// NewDscCompilationJobStreamClient creates an instance of the DscCompilationJobStreamClient client. -func NewDscCompilationJobStreamClient(subscriptionID string) DscCompilationJobStreamClient { - return NewDscCompilationJobStreamClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscCompilationJobStreamClientWithBaseURI creates an instance of the DscCompilationJobStreamClient 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 NewDscCompilationJobStreamClientWithBaseURI(baseURI string, subscriptionID string) DscCompilationJobStreamClient { - return DscCompilationJobStreamClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByJob retrieve all the job streams for the compilation Job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobID - the job id. -func (client DscCompilationJobStreamClient) ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result JobStreamListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobStreamClient.ListByJob") - 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("automation.DscCompilationJobStreamClient", "ListByJob", err.Error()) - } - - req, err := client.ListByJobPreparer(ctx, resourceGroupName, automationAccountName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobStreamClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobStreamClient", "ListByJob", resp, "Failure sending request") - return - } - - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobStreamClient", "ListByJob", resp, "Failure responding to request") - return - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client DscCompilationJobStreamClient) ListByJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobStreamClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client DscCompilationJobStreamClient) ListByJobResponder(resp *http.Response) (result JobStreamListResult, 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/automation/mgmt/2018-01-15-preview/automation/dscconfiguration.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/dscconfiguration.go deleted file mode 100644 index 8dd04d90454e..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/dscconfiguration.go +++ /dev/null @@ -1,621 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DscConfigurationClient is the automation Client -type DscConfigurationClient struct { - BaseClient -} - -// NewDscConfigurationClient creates an instance of the DscConfigurationClient client. -func NewDscConfigurationClient(subscriptionID string) DscConfigurationClient { - return NewDscConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscConfigurationClientWithBaseURI creates an instance of the DscConfigurationClient 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 NewDscConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscConfigurationClient { - return DscConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the create or update parameters for configuration. -// parameters - the create or update parameters for configuration. -func (client DscConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (result DscConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.DscConfigurationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DscConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", 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 DscConfigurationClient) 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 DscConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscConfiguration, 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 dsc configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the configuration name. -func (client DscConfigurationClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscConfigurationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", 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 DscConfigurationClient) 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 DscConfigurationClient) 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 the configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the configuration name. -func (client DscConfigurationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result DscConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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("automation.DscConfigurationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", 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 DscConfigurationClient) 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 DscConfigurationClient) GetResponder(resp *http.Response) (result DscConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the configuration script identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the configuration name. -func (client DscConfigurationClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.GetContent") - 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("automation.DscConfigurationClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client DscConfigurationClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of configurations. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// skip - the number of rows to skip. -// top - the number of rows to take. -// inlinecount - return total rows. -func (client DscConfigurationClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscConfigurationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dclr.Response.Response != nil { - sc = result.dclr.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("automation.DscConfigurationClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dclr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dclr.hasNextLink() && result.dclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscConfigurationClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(inlinecount) > 0 { - queryParameters["$inlinecount"] = autorest.Encode("query", inlinecount) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscConfigurationClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscConfigurationListResult) (result DscConfigurationListResult, err error) { - req, err := lastResults.dscConfigurationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscConfigurationClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscConfigurationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - return -} - -// Update create the configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the create or update parameters for configuration. -// parameters - the create or update parameters for configuration. -func (client DscConfigurationClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters *DscConfigurationUpdateParameters) (result DscConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscConfigurationClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DscConfigurationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters *DscConfigurationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - 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 DscConfigurationClient) 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 DscConfigurationClient) UpdateResponder(resp *http.Response) (result DscConfiguration, 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/automation/mgmt/2018-01-15-preview/automation/dscnode.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/dscnode.go deleted file mode 100644 index 9590e119ae44..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/dscnode.go +++ /dev/null @@ -1,435 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DscNodeClient is the automation Client -type DscNodeClient struct { - BaseClient -} - -// NewDscNodeClient creates an instance of the DscNodeClient client. -func NewDscNodeClient(subscriptionID string) DscNodeClient { - return NewDscNodeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscNodeClientWithBaseURI creates an instance of the DscNodeClient 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 NewDscNodeClientWithBaseURI(baseURI string, subscriptionID string) DscNodeClient { - return DscNodeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete the dsc node identified by node id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the node id. -func (client DscNodeClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, nodeID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscNodeClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", 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 DscNodeClient) 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 DscNodeClient) DeleteResponder(resp *http.Response) (result DscNode, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the dsc node identified by node id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the node id. -func (client DscNodeClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.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("automation.DscNodeClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, nodeID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscNodeClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", 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 DscNodeClient) 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 DscNodeClient) GetResponder(resp *http.Response) (result DscNode, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc nodes. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// skip - the number of rows to skip. -// top - the number of rows to take. -// inlinecount - return total rows. -func (client DscNodeClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscNodeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dnlr.Response.Response != nil { - sc = result.dnlr.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("automation.DscNodeClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dnlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dnlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dnlr.hasNextLink() && result.dnlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscNodeClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(inlinecount) > 0 { - queryParameters["$inlinecount"] = autorest.Encode("query", inlinecount) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscNodeClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscNodeClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscNodeListResult) (result DscNodeListResult, err error) { - req, err := lastResults.dscNodeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscNodeClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscNodeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - return -} - -// Update update the dsc node. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - parameters supplied to the update dsc node. -// dscNodeUpdateParameters - parameters supplied to the update dsc node. -func (client DscNodeClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, dscNodeUpdateParameters DscNodeUpdateParameters) (result DscNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, nodeID, dscNodeUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DscNodeClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, dscNodeUpdateParameters DscNodeUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - 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.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", pathParameters), - autorest.WithJSON(dscNodeUpdateParameters), - 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 DscNodeClient) 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 DscNodeClient) UpdateResponder(resp *http.Response) (result DscNode, 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/automation/mgmt/2018-01-15-preview/automation/dscnodeconfiguration.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/dscnodeconfiguration.go deleted file mode 100644 index 11327622dbec..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/dscnodeconfiguration.go +++ /dev/null @@ -1,448 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DscNodeConfigurationClient is the automation Client -type DscNodeConfigurationClient struct { - BaseClient -} - -// NewDscNodeConfigurationClient creates an instance of the DscNodeConfigurationClient client. -func NewDscNodeConfigurationClient(subscriptionID string) DscNodeConfigurationClient { - return NewDscNodeConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscNodeConfigurationClientWithBaseURI creates an instance of the DscNodeConfigurationClient 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 NewDscNodeConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscNodeConfigurationClient { - return DscNodeConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the node configuration identified by node configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeConfigurationName - the Dsc node configuration name. -// parameters - the create or update parameters for configuration. -func (client DscNodeConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (result DscNodeConfigurationCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.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: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Source.Hash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Configuration", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.DscNodeConfigurationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, nodeConfigurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DscNodeConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - 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.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", 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 DscNodeConfigurationClient) CreateOrUpdateSender(req *http.Request) (future DscNodeConfigurationCreateOrUpdateFuture, 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 DscNodeConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscNodeConfiguration, 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 Dsc node configurations by node configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeConfigurationName - the Dsc node configuration name. -func (client DscNodeConfigurationClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeConfigurationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, nodeConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscNodeConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", 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 DscNodeConfigurationClient) 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 DscNodeConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the Dsc node configurations by node configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeConfigurationName - the Dsc node configuration name. -func (client DscNodeConfigurationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result DscNodeConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.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("automation.DscNodeConfigurationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, nodeConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscNodeConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", 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 DscNodeConfigurationClient) 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 DscNodeConfigurationClient) GetResponder(resp *http.Response) (result DscNodeConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc node configurations. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// skip - the number of rows to skip. -// top - the number of rows to take. -// inlinecount - return total rows. -func (client DscNodeConfigurationClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscNodeConfigurationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dnclr.Response.Response != nil { - sc = result.dnclr.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("automation.DscNodeConfigurationClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dnclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dnclr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dnclr.hasNextLink() && result.dnclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscNodeConfigurationClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(inlinecount) > 0 { - queryParameters["$inlinecount"] = autorest.Encode("query", inlinecount) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscNodeConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscNodeConfigurationClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscNodeConfigurationListResult) (result DscNodeConfigurationListResult, err error) { - req, err := lastResults.dscNodeConfigurationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscNodeConfigurationClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscNodeConfigurationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/enums.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/enums.go deleted file mode 100644 index 9bfd432b8b85..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/enums.go +++ /dev/null @@ -1,646 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccountState enumerates the values for account state. -type AccountState string - -const ( - // Ok ... - Ok AccountState = "Ok" - // Suspended ... - Suspended AccountState = "Suspended" - // Unavailable ... - Unavailable AccountState = "Unavailable" -) - -// PossibleAccountStateValues returns an array of possible values for the AccountState const type. -func PossibleAccountStateValues() []AccountState { - return []AccountState{Ok, Suspended, Unavailable} -} - -// AgentRegistrationKeyName enumerates the values for agent registration key name. -type AgentRegistrationKeyName string - -const ( - // Primary ... - Primary AgentRegistrationKeyName = "primary" - // Secondary ... - Secondary AgentRegistrationKeyName = "secondary" -) - -// PossibleAgentRegistrationKeyNameValues returns an array of possible values for the AgentRegistrationKeyName const type. -func PossibleAgentRegistrationKeyNameValues() []AgentRegistrationKeyName { - return []AgentRegistrationKeyName{Primary, Secondary} -} - -// ContentSourceType enumerates the values for content source type. -type ContentSourceType string - -const ( - // EmbeddedContent ... - EmbeddedContent ContentSourceType = "embeddedContent" - // URI ... - URI ContentSourceType = "uri" -) - -// PossibleContentSourceTypeValues returns an array of possible values for the ContentSourceType const type. -func PossibleContentSourceTypeValues() []ContentSourceType { - return []ContentSourceType{EmbeddedContent, URI} -} - -// CountType enumerates the values for count type. -type CountType string - -const ( - // Nodeconfiguration ... - Nodeconfiguration CountType = "nodeconfiguration" - // Status ... - Status CountType = "status" -) - -// PossibleCountTypeValues returns an array of possible values for the CountType const type. -func PossibleCountTypeValues() []CountType { - return []CountType{Nodeconfiguration, Status} -} - -// DscConfigurationProvisioningState enumerates the values for dsc configuration provisioning state. -type DscConfigurationProvisioningState string - -const ( - // Succeeded ... - Succeeded DscConfigurationProvisioningState = "Succeeded" -) - -// PossibleDscConfigurationProvisioningStateValues returns an array of possible values for the DscConfigurationProvisioningState const type. -func PossibleDscConfigurationProvisioningStateValues() []DscConfigurationProvisioningState { - return []DscConfigurationProvisioningState{Succeeded} -} - -// DscConfigurationState enumerates the values for dsc configuration state. -type DscConfigurationState string - -const ( - // DscConfigurationStateEdit ... - DscConfigurationStateEdit DscConfigurationState = "Edit" - // DscConfigurationStateNew ... - DscConfigurationStateNew DscConfigurationState = "New" - // DscConfigurationStatePublished ... - DscConfigurationStatePublished DscConfigurationState = "Published" -) - -// PossibleDscConfigurationStateValues returns an array of possible values for the DscConfigurationState const type. -func PossibleDscConfigurationStateValues() []DscConfigurationState { - return []DscConfigurationState{DscConfigurationStateEdit, DscConfigurationStateNew, DscConfigurationStatePublished} -} - -// GroupTypeEnum enumerates the values for group type enum. -type GroupTypeEnum string - -const ( - // System ... - System GroupTypeEnum = "System" - // User ... - User GroupTypeEnum = "User" -) - -// PossibleGroupTypeEnumValues returns an array of possible values for the GroupTypeEnum const type. -func PossibleGroupTypeEnumValues() []GroupTypeEnum { - return []GroupTypeEnum{System, User} -} - -// HTTPStatusCode enumerates the values for http status code. -type HTTPStatusCode string - -const ( - // Accepted ... - Accepted HTTPStatusCode = "Accepted" - // Ambiguous ... - Ambiguous HTTPStatusCode = "Ambiguous" - // BadGateway ... - BadGateway HTTPStatusCode = "BadGateway" - // BadRequest ... - BadRequest HTTPStatusCode = "BadRequest" - // Conflict ... - Conflict HTTPStatusCode = "Conflict" - // Continue ... - Continue HTTPStatusCode = "Continue" - // Created ... - Created HTTPStatusCode = "Created" - // ExpectationFailed ... - ExpectationFailed HTTPStatusCode = "ExpectationFailed" - // Forbidden ... - Forbidden HTTPStatusCode = "Forbidden" - // Found ... - Found HTTPStatusCode = "Found" - // GatewayTimeout ... - GatewayTimeout HTTPStatusCode = "GatewayTimeout" - // Gone ... - Gone HTTPStatusCode = "Gone" - // HTTPVersionNotSupported ... - HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" - // InternalServerError ... - InternalServerError HTTPStatusCode = "InternalServerError" - // LengthRequired ... - LengthRequired HTTPStatusCode = "LengthRequired" - // MethodNotAllowed ... - MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" - // Moved ... - Moved HTTPStatusCode = "Moved" - // MovedPermanently ... - MovedPermanently HTTPStatusCode = "MovedPermanently" - // MultipleChoices ... - MultipleChoices HTTPStatusCode = "MultipleChoices" - // NoContent ... - NoContent HTTPStatusCode = "NoContent" - // NonAuthoritativeInformation ... - NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" - // NotAcceptable ... - NotAcceptable HTTPStatusCode = "NotAcceptable" - // NotFound ... - NotFound HTTPStatusCode = "NotFound" - // NotImplemented ... - NotImplemented HTTPStatusCode = "NotImplemented" - // NotModified ... - NotModified HTTPStatusCode = "NotModified" - // OK ... - OK HTTPStatusCode = "OK" - // PartialContent ... - PartialContent HTTPStatusCode = "PartialContent" - // PaymentRequired ... - PaymentRequired HTTPStatusCode = "PaymentRequired" - // PreconditionFailed ... - PreconditionFailed HTTPStatusCode = "PreconditionFailed" - // ProxyAuthenticationRequired ... - ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" - // Redirect ... - Redirect HTTPStatusCode = "Redirect" - // RedirectKeepVerb ... - RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" - // RedirectMethod ... - RedirectMethod HTTPStatusCode = "RedirectMethod" - // RequestedRangeNotSatisfiable ... - RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" - // RequestEntityTooLarge ... - RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" - // RequestTimeout ... - RequestTimeout HTTPStatusCode = "RequestTimeout" - // RequestURITooLong ... - RequestURITooLong HTTPStatusCode = "RequestUriTooLong" - // ResetContent ... - ResetContent HTTPStatusCode = "ResetContent" - // SeeOther ... - SeeOther HTTPStatusCode = "SeeOther" - // ServiceUnavailable ... - ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" - // SwitchingProtocols ... - SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" - // TemporaryRedirect ... - TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" - // Unauthorized ... - Unauthorized HTTPStatusCode = "Unauthorized" - // UnsupportedMediaType ... - UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" - // Unused ... - Unused HTTPStatusCode = "Unused" - // UpgradeRequired ... - UpgradeRequired HTTPStatusCode = "UpgradeRequired" - // UseProxy ... - UseProxy HTTPStatusCode = "UseProxy" -) - -// PossibleHTTPStatusCodeValues returns an array of possible values for the HTTPStatusCode const type. -func PossibleHTTPStatusCodeValues() []HTTPStatusCode { - return []HTTPStatusCode{Accepted, Ambiguous, BadGateway, BadRequest, Conflict, Continue, Created, ExpectationFailed, Forbidden, Found, GatewayTimeout, Gone, HTTPVersionNotSupported, InternalServerError, LengthRequired, MethodNotAllowed, Moved, MovedPermanently, MultipleChoices, NoContent, NonAuthoritativeInformation, NotAcceptable, NotFound, NotImplemented, NotModified, OK, PartialContent, PaymentRequired, PreconditionFailed, ProxyAuthenticationRequired, Redirect, RedirectKeepVerb, RedirectMethod, RequestedRangeNotSatisfiable, RequestEntityTooLarge, RequestTimeout, RequestURITooLong, ResetContent, SeeOther, ServiceUnavailable, SwitchingProtocols, TemporaryRedirect, Unauthorized, UnsupportedMediaType, Unused, UpgradeRequired, UseProxy} -} - -// JobProvisioningState enumerates the values for job provisioning state. -type JobProvisioningState string - -const ( - // JobProvisioningStateFailed ... - JobProvisioningStateFailed JobProvisioningState = "Failed" - // JobProvisioningStateProcessing ... - JobProvisioningStateProcessing JobProvisioningState = "Processing" - // JobProvisioningStateSucceeded ... - JobProvisioningStateSucceeded JobProvisioningState = "Succeeded" - // JobProvisioningStateSuspended ... - JobProvisioningStateSuspended JobProvisioningState = "Suspended" -) - -// PossibleJobProvisioningStateValues returns an array of possible values for the JobProvisioningState const type. -func PossibleJobProvisioningStateValues() []JobProvisioningState { - return []JobProvisioningState{JobProvisioningStateFailed, JobProvisioningStateProcessing, JobProvisioningStateSucceeded, JobProvisioningStateSuspended} -} - -// JobStatus enumerates the values for job status. -type JobStatus string - -const ( - // JobStatusActivating ... - JobStatusActivating JobStatus = "Activating" - // JobStatusBlocked ... - JobStatusBlocked JobStatus = "Blocked" - // JobStatusCompleted ... - JobStatusCompleted JobStatus = "Completed" - // JobStatusDisconnected ... - JobStatusDisconnected JobStatus = "Disconnected" - // JobStatusFailed ... - JobStatusFailed JobStatus = "Failed" - // JobStatusNew ... - JobStatusNew JobStatus = "New" - // JobStatusRemoving ... - JobStatusRemoving JobStatus = "Removing" - // JobStatusResuming ... - JobStatusResuming JobStatus = "Resuming" - // JobStatusRunning ... - JobStatusRunning JobStatus = "Running" - // JobStatusStopped ... - JobStatusStopped JobStatus = "Stopped" - // JobStatusStopping ... - JobStatusStopping JobStatus = "Stopping" - // JobStatusSuspended ... - JobStatusSuspended JobStatus = "Suspended" - // JobStatusSuspending ... - JobStatusSuspending JobStatus = "Suspending" -) - -// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. -func PossibleJobStatusValues() []JobStatus { - return []JobStatus{JobStatusActivating, JobStatusBlocked, JobStatusCompleted, JobStatusDisconnected, JobStatusFailed, JobStatusNew, JobStatusRemoving, JobStatusResuming, JobStatusRunning, JobStatusStopped, JobStatusStopping, JobStatusSuspended, JobStatusSuspending} -} - -// JobStreamType enumerates the values for job stream type. -type JobStreamType string - -const ( - // Any ... - Any JobStreamType = "Any" - // Debug ... - Debug JobStreamType = "Debug" - // Error ... - Error JobStreamType = "Error" - // Output ... - Output JobStreamType = "Output" - // Progress ... - Progress JobStreamType = "Progress" - // Verbose ... - Verbose JobStreamType = "Verbose" - // Warning ... - Warning JobStreamType = "Warning" -) - -// PossibleJobStreamTypeValues returns an array of possible values for the JobStreamType const type. -func PossibleJobStreamTypeValues() []JobStreamType { - return []JobStreamType{Any, Debug, Error, Output, Progress, Verbose, Warning} -} - -// KeyName enumerates the values for key name. -type KeyName string - -const ( - // KeyNamePrimary ... - KeyNamePrimary KeyName = "Primary" - // KeyNameSecondary ... - KeyNameSecondary KeyName = "Secondary" -) - -// PossibleKeyNameValues returns an array of possible values for the KeyName const type. -func PossibleKeyNameValues() []KeyName { - return []KeyName{KeyNamePrimary, KeyNameSecondary} -} - -// KeyPermissions enumerates the values for key permissions. -type KeyPermissions string - -const ( - // Full ... - Full KeyPermissions = "Full" - // Read ... - Read KeyPermissions = "Read" -) - -// PossibleKeyPermissionsValues returns an array of possible values for the KeyPermissions const type. -func PossibleKeyPermissionsValues() []KeyPermissions { - return []KeyPermissions{Full, Read} -} - -// LinuxUpdateClasses enumerates the values for linux update classes. -type LinuxUpdateClasses string - -const ( - // Critical ... - Critical LinuxUpdateClasses = "Critical" - // Other ... - Other LinuxUpdateClasses = "Other" - // Security ... - Security LinuxUpdateClasses = "Security" - // Unclassified ... - Unclassified LinuxUpdateClasses = "Unclassified" -) - -// PossibleLinuxUpdateClassesValues returns an array of possible values for the LinuxUpdateClasses const type. -func PossibleLinuxUpdateClassesValues() []LinuxUpdateClasses { - return []LinuxUpdateClasses{Critical, Other, Security, Unclassified} -} - -// ModuleProvisioningState enumerates the values for module provisioning state. -type ModuleProvisioningState string - -const ( - // ModuleProvisioningStateActivitiesStored ... - ModuleProvisioningStateActivitiesStored ModuleProvisioningState = "ActivitiesStored" - // ModuleProvisioningStateCancelled ... - ModuleProvisioningStateCancelled ModuleProvisioningState = "Cancelled" - // ModuleProvisioningStateConnectionTypeImported ... - ModuleProvisioningStateConnectionTypeImported ModuleProvisioningState = "ConnectionTypeImported" - // ModuleProvisioningStateContentDownloaded ... - ModuleProvisioningStateContentDownloaded ModuleProvisioningState = "ContentDownloaded" - // ModuleProvisioningStateContentRetrieved ... - ModuleProvisioningStateContentRetrieved ModuleProvisioningState = "ContentRetrieved" - // ModuleProvisioningStateContentStored ... - ModuleProvisioningStateContentStored ModuleProvisioningState = "ContentStored" - // ModuleProvisioningStateContentValidated ... - ModuleProvisioningStateContentValidated ModuleProvisioningState = "ContentValidated" - // ModuleProvisioningStateCreated ... - ModuleProvisioningStateCreated ModuleProvisioningState = "Created" - // ModuleProvisioningStateCreating ... - ModuleProvisioningStateCreating ModuleProvisioningState = "Creating" - // ModuleProvisioningStateFailed ... - ModuleProvisioningStateFailed ModuleProvisioningState = "Failed" - // ModuleProvisioningStateModuleDataStored ... - ModuleProvisioningStateModuleDataStored ModuleProvisioningState = "ModuleDataStored" - // ModuleProvisioningStateModuleImportRunbookComplete ... - ModuleProvisioningStateModuleImportRunbookComplete ModuleProvisioningState = "ModuleImportRunbookComplete" - // ModuleProvisioningStateRunningImportModuleRunbook ... - ModuleProvisioningStateRunningImportModuleRunbook ModuleProvisioningState = "RunningImportModuleRunbook" - // ModuleProvisioningStateStartingImportModuleRunbook ... - ModuleProvisioningStateStartingImportModuleRunbook ModuleProvisioningState = "StartingImportModuleRunbook" - // ModuleProvisioningStateSucceeded ... - ModuleProvisioningStateSucceeded ModuleProvisioningState = "Succeeded" - // ModuleProvisioningStateUpdating ... - ModuleProvisioningStateUpdating ModuleProvisioningState = "Updating" -) - -// PossibleModuleProvisioningStateValues returns an array of possible values for the ModuleProvisioningState const type. -func PossibleModuleProvisioningStateValues() []ModuleProvisioningState { - return []ModuleProvisioningState{ModuleProvisioningStateActivitiesStored, ModuleProvisioningStateCancelled, ModuleProvisioningStateConnectionTypeImported, ModuleProvisioningStateContentDownloaded, ModuleProvisioningStateContentRetrieved, ModuleProvisioningStateContentStored, ModuleProvisioningStateContentValidated, ModuleProvisioningStateCreated, ModuleProvisioningStateCreating, ModuleProvisioningStateFailed, ModuleProvisioningStateModuleDataStored, ModuleProvisioningStateModuleImportRunbookComplete, ModuleProvisioningStateRunningImportModuleRunbook, ModuleProvisioningStateStartingImportModuleRunbook, ModuleProvisioningStateSucceeded, ModuleProvisioningStateUpdating} -} - -// OperatingSystemType enumerates the values for operating system type. -type OperatingSystemType string - -const ( - // Linux ... - Linux OperatingSystemType = "Linux" - // Windows ... - Windows OperatingSystemType = "Windows" -) - -// PossibleOperatingSystemTypeValues returns an array of possible values for the OperatingSystemType const type. -func PossibleOperatingSystemTypeValues() []OperatingSystemType { - return []OperatingSystemType{Linux, Windows} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Completed ... - Completed ProvisioningState = "Completed" - // Failed ... - Failed ProvisioningState = "Failed" - // Running ... - Running ProvisioningState = "Running" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Completed, Failed, Running} -} - -// RunbookProvisioningState enumerates the values for runbook provisioning state. -type RunbookProvisioningState string - -const ( - // RunbookProvisioningStateSucceeded ... - RunbookProvisioningStateSucceeded RunbookProvisioningState = "Succeeded" -) - -// PossibleRunbookProvisioningStateValues returns an array of possible values for the RunbookProvisioningState const type. -func PossibleRunbookProvisioningStateValues() []RunbookProvisioningState { - return []RunbookProvisioningState{RunbookProvisioningStateSucceeded} -} - -// RunbookState enumerates the values for runbook state. -type RunbookState string - -const ( - // RunbookStateEdit ... - RunbookStateEdit RunbookState = "Edit" - // RunbookStateNew ... - RunbookStateNew RunbookState = "New" - // RunbookStatePublished ... - RunbookStatePublished RunbookState = "Published" -) - -// PossibleRunbookStateValues returns an array of possible values for the RunbookState const type. -func PossibleRunbookStateValues() []RunbookState { - return []RunbookState{RunbookStateEdit, RunbookStateNew, RunbookStatePublished} -} - -// RunbookTypeEnum enumerates the values for runbook type enum. -type RunbookTypeEnum string - -const ( - // Graph ... - Graph RunbookTypeEnum = "Graph" - // GraphPowerShell ... - GraphPowerShell RunbookTypeEnum = "GraphPowerShell" - // GraphPowerShellWorkflow ... - GraphPowerShellWorkflow RunbookTypeEnum = "GraphPowerShellWorkflow" - // PowerShell ... - PowerShell RunbookTypeEnum = "PowerShell" - // PowerShellWorkflow ... - PowerShellWorkflow RunbookTypeEnum = "PowerShellWorkflow" - // Script ... - Script RunbookTypeEnum = "Script" -) - -// PossibleRunbookTypeEnumValues returns an array of possible values for the RunbookTypeEnum const type. -func PossibleRunbookTypeEnumValues() []RunbookTypeEnum { - return []RunbookTypeEnum{Graph, GraphPowerShell, GraphPowerShellWorkflow, PowerShell, PowerShellWorkflow, Script} -} - -// ScheduleDay enumerates the values for schedule day. -type ScheduleDay string - -const ( - // Friday ... - Friday ScheduleDay = "Friday" - // Monday ... - Monday ScheduleDay = "Monday" - // Saturday ... - Saturday ScheduleDay = "Saturday" - // Sunday ... - Sunday ScheduleDay = "Sunday" - // Thursday ... - Thursday ScheduleDay = "Thursday" - // Tuesday ... - Tuesday ScheduleDay = "Tuesday" - // Wednesday ... - Wednesday ScheduleDay = "Wednesday" -) - -// PossibleScheduleDayValues returns an array of possible values for the ScheduleDay const type. -func PossibleScheduleDayValues() []ScheduleDay { - return []ScheduleDay{Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday} -} - -// ScheduleFrequency enumerates the values for schedule frequency. -type ScheduleFrequency string - -const ( - // Day ... - Day ScheduleFrequency = "Day" - // Hour ... - Hour ScheduleFrequency = "Hour" - // Minute The minimum allowed interval for Minute schedules is 15 minutes. - Minute ScheduleFrequency = "Minute" - // Month ... - Month ScheduleFrequency = "Month" - // OneTime ... - OneTime ScheduleFrequency = "OneTime" - // Week ... - Week ScheduleFrequency = "Week" -) - -// PossibleScheduleFrequencyValues returns an array of possible values for the ScheduleFrequency const type. -func PossibleScheduleFrequencyValues() []ScheduleFrequency { - return []ScheduleFrequency{Day, Hour, Minute, Month, OneTime, Week} -} - -// SkuNameEnum enumerates the values for sku name enum. -type SkuNameEnum string - -const ( - // Basic ... - Basic SkuNameEnum = "Basic" - // Free ... - Free SkuNameEnum = "Free" -) - -// PossibleSkuNameEnumValues returns an array of possible values for the SkuNameEnum const type. -func PossibleSkuNameEnumValues() []SkuNameEnum { - return []SkuNameEnum{Basic, Free} -} - -// SourceType enumerates the values for source type. -type SourceType string - -const ( - // GitHub ... - GitHub SourceType = "GitHub" - // VsoGit ... - VsoGit SourceType = "VsoGit" - // VsoTfvc ... - VsoTfvc SourceType = "VsoTfvc" -) - -// PossibleSourceTypeValues returns an array of possible values for the SourceType const type. -func PossibleSourceTypeValues() []SourceType { - return []SourceType{GitHub, VsoGit, VsoTfvc} -} - -// StreamType enumerates the values for stream type. -type StreamType string - -const ( - // StreamTypeError ... - StreamTypeError StreamType = "Error" - // StreamTypeOutput ... - StreamTypeOutput StreamType = "Output" -) - -// PossibleStreamTypeValues returns an array of possible values for the StreamType const type. -func PossibleStreamTypeValues() []StreamType { - return []StreamType{StreamTypeError, StreamTypeOutput} -} - -// SyncType enumerates the values for sync type. -type SyncType string - -const ( - // FullSync ... - FullSync SyncType = "FullSync" - // PartialSync ... - PartialSync SyncType = "PartialSync" -) - -// PossibleSyncTypeValues returns an array of possible values for the SyncType const type. -func PossibleSyncTypeValues() []SyncType { - return []SyncType{FullSync, PartialSync} -} - -// TagOperators enumerates the values for tag operators. -type TagOperators string - -const ( - // TagOperatorsAll ... - TagOperatorsAll TagOperators = "All" - // TagOperatorsAny ... - TagOperatorsAny TagOperators = "Any" -) - -// PossibleTagOperatorsValues returns an array of possible values for the TagOperators const type. -func PossibleTagOperatorsValues() []TagOperators { - return []TagOperators{TagOperatorsAll, TagOperatorsAny} -} - -// TokenType enumerates the values for token type. -type TokenType string - -const ( - // Oauth ... - Oauth TokenType = "Oauth" - // PersonalAccessToken ... - PersonalAccessToken TokenType = "PersonalAccessToken" -) - -// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. -func PossibleTokenTypeValues() []TokenType { - return []TokenType{Oauth, PersonalAccessToken} -} - -// WindowsUpdateClasses enumerates the values for windows update classes. -type WindowsUpdateClasses string - -const ( - // WindowsUpdateClassesCritical ... - WindowsUpdateClassesCritical WindowsUpdateClasses = "Critical" - // WindowsUpdateClassesDefinition ... - WindowsUpdateClassesDefinition WindowsUpdateClasses = "Definition" - // WindowsUpdateClassesFeaturePack ... - WindowsUpdateClassesFeaturePack WindowsUpdateClasses = "FeaturePack" - // WindowsUpdateClassesSecurity ... - WindowsUpdateClassesSecurity WindowsUpdateClasses = "Security" - // WindowsUpdateClassesServicePack ... - WindowsUpdateClassesServicePack WindowsUpdateClasses = "ServicePack" - // WindowsUpdateClassesTools ... - WindowsUpdateClassesTools WindowsUpdateClasses = "Tools" - // WindowsUpdateClassesUnclassified ... - WindowsUpdateClassesUnclassified WindowsUpdateClasses = "Unclassified" - // WindowsUpdateClassesUpdateRollup ... - WindowsUpdateClassesUpdateRollup WindowsUpdateClasses = "UpdateRollup" - // WindowsUpdateClassesUpdates ... - WindowsUpdateClassesUpdates WindowsUpdateClasses = "Updates" -) - -// PossibleWindowsUpdateClassesValues returns an array of possible values for the WindowsUpdateClasses const type. -func PossibleWindowsUpdateClassesValues() []WindowsUpdateClasses { - return []WindowsUpdateClasses{WindowsUpdateClassesCritical, WindowsUpdateClassesDefinition, WindowsUpdateClassesFeaturePack, WindowsUpdateClassesSecurity, WindowsUpdateClassesServicePack, WindowsUpdateClassesTools, WindowsUpdateClassesUnclassified, WindowsUpdateClassesUpdateRollup, WindowsUpdateClassesUpdates} -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/fields.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/fields.go deleted file mode 100644 index f695a854ec63..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/fields.go +++ /dev/null @@ -1,120 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// FieldsClient is the automation Client -type FieldsClient struct { - BaseClient -} - -// NewFieldsClient creates an instance of the FieldsClient client. -func NewFieldsClient(subscriptionID string) FieldsClient { - return NewFieldsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFieldsClientWithBaseURI creates an instance of the FieldsClient 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 NewFieldsClientWithBaseURI(baseURI string, subscriptionID string) FieldsClient { - return FieldsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByType retrieve a list of fields of a given type identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// typeName - the name of type. -func (client FieldsClient) ListByType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FieldsClient.ListByType") - 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("automation.FieldsClient", "ListByType", err.Error()) - } - - req, err := client.ListByTypePreparer(ctx, resourceGroupName, automationAccountName, moduleName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure sending request") - return - } - - result, err = client.ListByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure responding to request") - return - } - - return -} - -// ListByTypePreparer prepares the ListByType request. -func (client FieldsClient) ListByTypePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTypeSender sends the ListByType request. The method will close the -// http.Response Body if it receives an error. -func (client FieldsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTypeResponder handles the response to the ListByType request. The method always -// closes the http.Response Body. -func (client FieldsClient) ListByTypeResponder(resp *http.Response) (result TypeFieldListResult, 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/automation/mgmt/2018-01-15-preview/automation/hybridrunbookworkergroup.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/hybridrunbookworkergroup.go deleted file mode 100644 index 385234a5f13e..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/hybridrunbookworkergroup.go +++ /dev/null @@ -1,423 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// HybridRunbookWorkerGroupClient is the automation Client -type HybridRunbookWorkerGroupClient struct { - BaseClient -} - -// NewHybridRunbookWorkerGroupClient creates an instance of the HybridRunbookWorkerGroupClient client. -func NewHybridRunbookWorkerGroupClient(subscriptionID string) HybridRunbookWorkerGroupClient { - return NewHybridRunbookWorkerGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHybridRunbookWorkerGroupClientWithBaseURI creates an instance of the HybridRunbookWorkerGroupClient 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 NewHybridRunbookWorkerGroupClientWithBaseURI(baseURI string, subscriptionID string) HybridRunbookWorkerGroupClient { - return HybridRunbookWorkerGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete a hybrid runbook worker group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// hybridRunbookWorkerGroupName - the hybrid runbook worker group name -func (client HybridRunbookWorkerGroupClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.HybridRunbookWorkerGroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client HybridRunbookWorkerGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", 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 HybridRunbookWorkerGroupClient) 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 HybridRunbookWorkerGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve a hybrid runbook worker group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// hybridRunbookWorkerGroupName - the hybrid runbook worker group name -func (client HybridRunbookWorkerGroupClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result HybridRunbookWorkerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.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("automation.HybridRunbookWorkerGroupClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client HybridRunbookWorkerGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", 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 HybridRunbookWorkerGroupClient) 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 HybridRunbookWorkerGroupClient) GetResponder(resp *http.Response) (result HybridRunbookWorkerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of hybrid runbook worker groups. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result HybridRunbookWorkerGroupsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.hrwglr.Response.Response != nil { - sc = result.hrwglr.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("automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.hrwglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.hrwglr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.hrwglr.hasNextLink() && result.hrwglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountResponder(resp *http.Response) (result HybridRunbookWorkerGroupsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client HybridRunbookWorkerGroupClient) listByAutomationAccountNextResults(ctx context.Context, lastResults HybridRunbookWorkerGroupsListResult) (result HybridRunbookWorkerGroupsListResult, err error) { - req, err := lastResults.hybridRunbookWorkerGroupsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result HybridRunbookWorkerGroupsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update a hybrid runbook worker group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// hybridRunbookWorkerGroupName - the hybrid runbook worker group name -// parameters - the hybrid runbook worker group -func (client HybridRunbookWorkerGroupClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (result HybridRunbookWorkerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.HybridRunbookWorkerGroupClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client HybridRunbookWorkerGroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", 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 HybridRunbookWorkerGroupClient) 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 HybridRunbookWorkerGroupClient) UpdateResponder(resp *http.Response) (result HybridRunbookWorkerGroup, 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/automation/mgmt/2018-01-15-preview/automation/job.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/job.go deleted file mode 100644 index 725a6b5b0db2..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/job.go +++ /dev/null @@ -1,804 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobClient is the automation Client -type JobClient struct { - BaseClient -} - -// NewJobClient creates an instance of the JobClient client. -func NewJobClient(subscriptionID string) JobClient { - return NewJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobClientWithBaseURI creates an instance of the JobClient 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 NewJobClientWithBaseURI(baseURI string, subscriptionID string) JobClient { - return JobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a job of the runbook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// parameters - the parameters supplied to the create job operation. -// clientRequestID - identifies this specific client request. -func (client JobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, parameters JobCreateParameters, clientRequestID string) (result Job, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobCreateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, jobName, parameters, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client JobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, parameters JobCreateParameters, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) 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 JobClient) CreateResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the job identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result Job, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.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("automation.JobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) 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 JobClient) GetResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetOutput retrieve the job output identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the name of the job to be created. -// clientRequestID - identifies this specific client request. -func (client JobClient) GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.GetOutput") - 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("automation.JobClient", "GetOutput", err.Error()) - } - - req, err := client.GetOutputPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", nil, "Failure preparing request") - return - } - - resp, err := client.GetOutputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure sending request") - return - } - - result, err = client.GetOutputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure responding to request") - return - } - - return -} - -// GetOutputPreparer prepares the GetOutput request. -func (client JobClient) GetOutputPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOutputSender sends the GetOutput request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) GetOutputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetOutputResponder handles the response to the GetOutput request. The method always -// closes the http.Response Body. -func (client JobClient) GetOutputResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRunbookContent retrieve the runbook content of the job identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.GetRunbookContent") - 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("automation.JobClient", "GetRunbookContent", err.Error()) - } - - req, err := client.GetRunbookContentPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetRunbookContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure sending request") - return - } - - result, err = client.GetRunbookContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure responding to request") - return - } - - return -} - -// GetRunbookContentPreparer prepares the GetRunbookContent request. -func (client JobClient) GetRunbookContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetRunbookContentSender sends the GetRunbookContent request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) GetRunbookContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetRunbookContentResponder handles the response to the GetRunbookContent request. The method always -// closes the http.Response Body. -func (client JobClient) GetRunbookContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of jobs. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// clientRequestID - identifies this specific client request. -func (client JobClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result JobListResultV2Page, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.jlrv.Response.Response != nil { - sc = result.jlrv.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("automation.JobClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.jlrv.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.jlrv, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.jlrv.hasNextLink() && result.jlrv.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client JobClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/jobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client JobClient) ListByAutomationAccountResponder(resp *http.Response) (result JobListResultV2, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client JobClient) listByAutomationAccountNextResults(ctx context.Context, lastResults JobListResultV2) (result JobListResultV2, err error) { - req, err := lastResults.jobListResultV2Preparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result JobListResultV2Iterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, clientRequestID) - return -} - -// Resume resume the job identified by jobName. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Resume(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Resume") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Resume", err.Error()) - } - - req, err := client.ResumePreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure responding to request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client JobClient) ResumePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) ResumeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client JobClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop the job identified by jobName. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Stop") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client JobClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client JobClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Suspend suspend the job identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Suspend") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Suspend", err.Error()) - } - - req, err := client.SuspendPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure responding to request") - return - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client JobClient) SuspendPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) SuspendSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client JobClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/jobschedule.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/jobschedule.go deleted file mode 100644 index d21696e53076..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/jobschedule.go +++ /dev/null @@ -1,428 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// JobScheduleClient is the automation Client -type JobScheduleClient struct { - BaseClient -} - -// NewJobScheduleClient creates an instance of the JobScheduleClient client. -func NewJobScheduleClient(subscriptionID string) JobScheduleClient { - return NewJobScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobScheduleClientWithBaseURI creates an instance of the JobScheduleClient 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 NewJobScheduleClientWithBaseURI(baseURI string, subscriptionID string) JobScheduleClient { - return JobScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a job schedule. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobScheduleID - the job schedule name. -// parameters - the parameters supplied to the create job schedule operation. -func (client JobScheduleClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (result JobSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties.Schedule", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobScheduleCreateProperties.Runbook", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.JobScheduleClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, jobScheduleID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client JobScheduleClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", 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 JobScheduleClient) 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 JobScheduleClient) CreateResponder(resp *http.Response) (result JobSchedule, 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 job schedule identified by job schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobScheduleID - the job schedule name. -func (client JobScheduleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobScheduleClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, jobScheduleID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobScheduleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", 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 JobScheduleClient) 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 JobScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the job schedule identified by job schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobScheduleID - the job schedule name. -func (client JobScheduleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result JobSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.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("automation.JobScheduleClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, jobScheduleID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobScheduleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", 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 JobScheduleClient) 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 JobScheduleClient) GetResponder(resp *http.Response) (result JobSchedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of job schedules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client JobScheduleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result JobScheduleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.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("automation.JobScheduleClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client JobScheduleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/jobSchedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client JobScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client JobScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result JobScheduleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client JobScheduleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults JobScheduleListResult) (result JobScheduleListResult, err error) { - req, err := lastResults.jobScheduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobScheduleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result JobScheduleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/jobstream.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/jobstream.go deleted file mode 100644 index 519b6164746a..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/jobstream.go +++ /dev/null @@ -1,262 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobStreamClient is the automation Client -type JobStreamClient struct { - BaseClient -} - -// NewJobStreamClient creates an instance of the JobStreamClient client. -func NewJobStreamClient(subscriptionID string) JobStreamClient { - return NewJobStreamClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobStreamClientWithBaseURI creates an instance of the JobStreamClient 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 NewJobStreamClientWithBaseURI(baseURI string, subscriptionID string) JobStreamClient { - return JobStreamClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the job stream identified by job stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// jobStreamID - the job stream id. -// clientRequestID - identifies this specific client request. -func (client JobStreamClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, jobStreamID string, clientRequestID string) (result JobStream, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamClient.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("automation.JobStreamClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, jobName, jobStreamID, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobStreamClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, jobStreamID string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobStreamClient) 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 JobStreamClient) GetResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByJob retrieve a list of jobs streams identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// filter - the filter to apply on the operation. -// clientRequestID - identifies this specific client request. -func (client JobStreamClient) ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result JobStreamListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamClient.ListByJob") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.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("automation.JobStreamClient", "ListByJob", err.Error()) - } - - result.fn = client.listByJobNextResults - req, err := client.ListByJobPreparer(ctx, resourceGroupName, automationAccountName, jobName, filter, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client JobStreamClient) ListByJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client JobStreamClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client JobStreamClient) ListByJobResponder(resp *http.Response) (result JobStreamListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByJobNextResults retrieves the next set of results, if any. -func (client JobStreamClient) listByJobNextResults(ctx context.Context, lastResults JobStreamListResult) (result JobStreamListResult, err error) { - req, err := lastResults.jobStreamListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "listByJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "listByJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "listByJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobStreamClient) ListByJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result JobStreamListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamClient.ListByJob") - 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.ListByJob(ctx, resourceGroupName, automationAccountName, jobName, filter, clientRequestID) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/keys.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/keys.go deleted file mode 100644 index 3e6fb4e1d3cf..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/keys.go +++ /dev/null @@ -1,116 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// KeysClient is the automation Client -type KeysClient struct { - BaseClient -} - -// NewKeysClient creates an instance of the KeysClient client. -func NewKeysClient(subscriptionID string) KeysClient { - return NewKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewKeysClientWithBaseURI creates an instance of the KeysClient 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 NewKeysClientWithBaseURI(baseURI string, subscriptionID string) KeysClient { - return KeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the automation keys for an account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client KeysClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result KeyListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.ListByAutomationAccount") - 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("automation.KeysClient", "ListByAutomationAccount", err.Error()) - } - - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.KeysClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.KeysClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.KeysClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client KeysClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client KeysClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client KeysClient) ListByAutomationAccountResponder(resp *http.Response) (result KeyListResult, 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/automation/mgmt/2018-01-15-preview/automation/linkedworkspace.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/linkedworkspace.go deleted file mode 100644 index c29cf1ed93bc..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/linkedworkspace.go +++ /dev/null @@ -1,116 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LinkedWorkspaceClient is the automation Client -type LinkedWorkspaceClient struct { - BaseClient -} - -// NewLinkedWorkspaceClient creates an instance of the LinkedWorkspaceClient client. -func NewLinkedWorkspaceClient(subscriptionID string) LinkedWorkspaceClient { - return NewLinkedWorkspaceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLinkedWorkspaceClientWithBaseURI creates an instance of the LinkedWorkspaceClient 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 NewLinkedWorkspaceClientWithBaseURI(baseURI string, subscriptionID string) LinkedWorkspaceClient { - return LinkedWorkspaceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the linked workspace for the account id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client LinkedWorkspaceClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result LinkedWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedWorkspaceClient.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("automation.LinkedWorkspaceClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.LinkedWorkspaceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.LinkedWorkspaceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.LinkedWorkspaceClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LinkedWorkspaceClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/linkedWorkspace", 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 LinkedWorkspaceClient) 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 LinkedWorkspaceClient) GetResponder(resp *http.Response) (result LinkedWorkspace, 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/automation/mgmt/2018-01-15-preview/automation/models.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/models.go deleted file mode 100644 index 127c2c27849b..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/models.go +++ /dev/null @@ -1,10675 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "io" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2018-01-15-preview/automation" - -// Account definition of the automation account type. -type Account struct { - autorest.Response `json:"-"` - // AccountProperties - Gets or sets the automation account properties. - *AccountProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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.Etag != nil { - objectMap["etag"] = a.Etag - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - if a.Location != nil { - objectMap["location"] = a.Location - } - 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 "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - a.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - 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 - } - } - } - - return nil -} - -// AccountCreateOrUpdateParameters the parameters supplied to the create or update automation account -// operation. -type AccountCreateOrUpdateParameters struct { - // AccountCreateOrUpdateProperties - Gets or sets account create or update properties. - *AccountCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AccountCreateOrUpdateParameters. -func (acoup AccountCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acoup.AccountCreateOrUpdateProperties != nil { - objectMap["properties"] = acoup.AccountCreateOrUpdateProperties - } - if acoup.Name != nil { - objectMap["name"] = acoup.Name - } - if acoup.Location != nil { - objectMap["location"] = acoup.Location - } - if acoup.Tags != nil { - objectMap["tags"] = acoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountCreateOrUpdateParameters struct. -func (acoup *AccountCreateOrUpdateParameters) 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 accountCreateOrUpdateProperties AccountCreateOrUpdateProperties - err = json.Unmarshal(*v, &accountCreateOrUpdateProperties) - if err != nil { - return err - } - acoup.AccountCreateOrUpdateProperties = &accountCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - acoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - acoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - acoup.Tags = tags - } - } - } - - return nil -} - -// AccountCreateOrUpdateProperties the parameters supplied to the create or update account properties. -type AccountCreateOrUpdateProperties struct { - // Sku - Gets or sets account SKU. - Sku *Sku `json:"sku,omitempty"` -} - -// AccountListResult the response model for the list account operation. -type AccountListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets list of accounts. - Value *[]Account `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - 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 definition of the account property. -type AccountProperties struct { - // Sku - Gets or sets the SKU of account. - Sku *Sku `json:"sku,omitempty"` - // LastModifiedBy - Gets or sets the last modified by. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // State - READ-ONLY; Gets status of account. Possible values include: 'Ok', 'Unavailable', 'Suspended' - State AccountState `json:"state,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Sku != nil { - objectMap["sku"] = ap.Sku - } - if ap.LastModifiedBy != nil { - objectMap["lastModifiedBy"] = ap.LastModifiedBy - } - if ap.Description != nil { - objectMap["description"] = ap.Description - } - return json.Marshal(objectMap) -} - -// AccountUpdateParameters the parameters supplied to the update automation account operation. -type AccountUpdateParameters struct { - // AccountUpdateProperties - Gets or sets account update properties. - *AccountUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.AccountUpdateProperties != nil { - objectMap["properties"] = aup.AccountUpdateProperties - } - if aup.Name != nil { - objectMap["name"] = aup.Name - } - if aup.Location != nil { - objectMap["location"] = aup.Location - } - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - 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 "properties": - if v != nil { - var accountUpdateProperties AccountUpdateProperties - err = json.Unmarshal(*v, &accountUpdateProperties) - if err != nil { - return err - } - aup.AccountUpdateProperties = &accountUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - aup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aup.Tags = tags - } - } - } - - return nil -} - -// AccountUpdateProperties the parameters supplied to the update account properties. -type AccountUpdateProperties struct { - // Sku - Gets or sets account SKU. - Sku *Sku `json:"sku,omitempty"` -} - -// Activity definition of the activity. -type Activity struct { - autorest.Response `json:"-"` - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the name of the activity. - Name *string `json:"name,omitempty"` - // ActivityProperties - Gets or sets the properties of the activity. - *ActivityProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Activity. -func (a Activity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.ID != nil { - objectMap["id"] = a.ID - } - if a.ActivityProperties != nil { - objectMap["properties"] = a.ActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Activity struct. -func (a *Activity) 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 - } - 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 "properties": - if v != nil { - var activityProperties ActivityProperties - err = json.Unmarshal(*v, &activityProperties) - if err != nil { - return err - } - a.ActivityProperties = &activityProperties - } - } - } - - return nil -} - -// ActivityListResult the response model for the list activity operation. -type ActivityListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of activities. - Value *[]Activity `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityListResultIterator provides access to a complete listing of Activity values. -type ActivityListResultIterator struct { - i int - page ActivityListResultPage -} - -// 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 *ActivityListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityListResultIterator.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 *ActivityListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ActivityListResultIterator) 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 ActivityListResultIterator) Response() ActivityListResult { - 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 ActivityListResultIterator) Value() Activity { - if !iter.page.NotDone() { - return Activity{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ActivityListResultIterator type. -func NewActivityListResultIterator(page ActivityListResultPage) ActivityListResultIterator { - return ActivityListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr ActivityListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr ActivityListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// activityListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr ActivityListResult) activityListResultPreparer(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))) -} - -// ActivityListResultPage contains a page of Activity values. -type ActivityListResultPage struct { - fn func(context.Context, ActivityListResult) (ActivityListResult, error) - alr ActivityListResult -} - -// 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 *ActivityListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityListResultPage.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 *ActivityListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ActivityListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ActivityListResultPage) Response() ActivityListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ActivityListResultPage) Values() []Activity { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the ActivityListResultPage type. -func NewActivityListResultPage(cur ActivityListResult, getNextPage func(context.Context, ActivityListResult) (ActivityListResult, error)) ActivityListResultPage { - return ActivityListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// ActivityOutputType definition of the activity output type. -type ActivityOutputType struct { - // Name - Gets or sets the name of the activity output type. - Name *string `json:"name,omitempty"` - // Type - Gets or sets the type of the activity output type. - Type *string `json:"type,omitempty"` -} - -// ActivityParameter definition of the activity parameter. -type ActivityParameter struct { - // Name - Gets or sets the name of the activity parameter. - Name *string `json:"name,omitempty"` - // Type - Gets or sets the type of the activity parameter. - Type *string `json:"type,omitempty"` - // IsMandatory - Gets or sets a Boolean value that indicates true if the parameter is required. If the value is false, the parameter is optional. - IsMandatory *bool `json:"isMandatory,omitempty"` - // IsDynamic - Gets or sets a Boolean value that indicates true if the parameter is dynamic. - IsDynamic *bool `json:"isDynamic,omitempty"` - // Position - Gets or sets the position of the activity parameter. - Position *int64 `json:"position,omitempty"` - // ValueFromPipeline - Gets or sets a Boolean value that indicates true if the parameter can take values from the incoming pipeline objects. This setting is used if the cmdlet must access the complete input object. false indicates that the parameter cannot take values from the complete input object. - ValueFromPipeline *bool `json:"valueFromPipeline,omitempty"` - // ValueFromPipelineByPropertyName - Gets or sets a Boolean value that indicates true if the parameter can be filled from a property of the incoming pipeline object that has the same name as this parameter. false indicates that the parameter cannot be filled from the incoming pipeline object property with the same name. - ValueFromPipelineByPropertyName *bool `json:"valueFromPipelineByPropertyName,omitempty"` - // ValueFromRemainingArguments - Gets or sets a Boolean value that indicates true if the cmdlet parameter accepts all the remaining command-line arguments that are associated with this parameter in the form of an array. false if the cmdlet parameter does not accept all the remaining argument values. - ValueFromRemainingArguments *bool `json:"valueFromRemainingArguments,omitempty"` - // Description - Gets or sets the description of the activity parameter. - Description *string `json:"description,omitempty"` - // ValidationSet - Gets or sets the validation set of activity parameter. - ValidationSet *[]ActivityParameterValidationSet `json:"validationSet,omitempty"` -} - -// ActivityParameterSet definition of the activity parameter set. -type ActivityParameterSet struct { - // Name - Gets or sets the name of the activity parameter set. - Name *string `json:"name,omitempty"` - // Parameters - Gets or sets the parameters of the activity parameter set. - Parameters *[]ActivityParameter `json:"parameters,omitempty"` -} - -// ActivityParameterValidationSet definition of the activity parameter validation set. -type ActivityParameterValidationSet struct { - // MemberValue - Gets or sets the name of the activity parameter validation set member. - MemberValue *string `json:"memberValue,omitempty"` -} - -// ActivityProperties properties of the activity. -type ActivityProperties struct { - // Definition - Gets or sets the user name of the activity. - Definition *string `json:"definition,omitempty"` - // ParameterSets - Gets or sets the parameter sets of the activity. - ParameterSets *[]ActivityParameterSet `json:"parameterSets,omitempty"` - // OutputTypes - Gets or sets the output types of the activity. - OutputTypes *[]ActivityOutputType `json:"outputTypes,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// AdvancedSchedule the properties of the create Advanced Schedule. -type AdvancedSchedule struct { - // WeekDays - Days of the week that the job should execute on. - WeekDays *[]string `json:"weekDays,omitempty"` - // MonthDays - Days of the month that the job should execute on. Must be between 1 and 31. - MonthDays *[]int32 `json:"monthDays,omitempty"` - // MonthlyOccurrences - Occurrences of days within a month. - MonthlyOccurrences *[]AdvancedScheduleMonthlyOccurrence `json:"monthlyOccurrences,omitempty"` -} - -// AdvancedScheduleMonthlyOccurrence the properties of the create advanced schedule monthly occurrence. -type AdvancedScheduleMonthlyOccurrence struct { - // Occurrence - Occurrence of the week within the month. Must be between 1 and 5 - Occurrence *int32 `json:"occurrence,omitempty"` - // Day - Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday. Possible values include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' - Day ScheduleDay `json:"day,omitempty"` -} - -// AgentRegistration definition of the agent registration information type. -type AgentRegistration struct { - autorest.Response `json:"-"` - // DscMetaConfiguration - Gets or sets the dsc meta configuration. - DscMetaConfiguration *string `json:"dscMetaConfiguration,omitempty"` - // Endpoint - Gets or sets the dsc server endpoint. - Endpoint *string `json:"endpoint,omitempty"` - // Keys - Gets or sets the agent registration keys. - Keys *AgentRegistrationKeys `json:"keys,omitempty"` - // ID - Gets or sets the id. - ID *string `json:"id,omitempty"` -} - -// AgentRegistrationKeys definition of the agent registration keys. -type AgentRegistrationKeys struct { - // Primary - Gets or sets the primary key. - Primary *string `json:"primary,omitempty"` - // Secondary - Gets or sets the secondary key. - Secondary *string `json:"secondary,omitempty"` -} - -// AgentRegistrationRegenerateKeyParameter the parameters supplied to the regenerate keys operation. -type AgentRegistrationRegenerateKeyParameter struct { - // KeyName - Gets or sets the agent registration key name - primary or secondary. Possible values include: 'Primary', 'Secondary' - KeyName AgentRegistrationKeyName `json:"keyName,omitempty"` -} - -// AzureQueryProperties azure query for the update configuration. -type AzureQueryProperties struct { - // Scope - List of Subscription or Resource Group ARM Ids. - Scope *[]string `json:"scope,omitempty"` - // Locations - List of locations to scope the query to. - Locations *[]string `json:"locations,omitempty"` - // TagSettings - Tag settings for the VM. - TagSettings *TagSettingsProperties `json:"tagSettings,omitempty"` -} - -// Certificate definition of the certificate. -type Certificate struct { - autorest.Response `json:"-"` - // CertificateProperties - Gets or sets the properties of the certificate. - *CertificateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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 - } - } - } - - return nil -} - -// CertificateCreateOrUpdateParameters the parameters supplied to the create or update or replace -// certificate operation. -type CertificateCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the certificate. - Name *string `json:"name,omitempty"` - // CertificateCreateOrUpdateProperties - Gets or sets the properties of the certificate. - *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateCreateOrUpdateParameters. -func (ccoup CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Name != nil { - objectMap["name"] = ccoup.Name - } - 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 "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ccoup.Name = &name - } - case "properties": - if v != nil { - var certificateCreateOrUpdateProperties CertificateCreateOrUpdateProperties - err = json.Unmarshal(*v, &certificateCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.CertificateCreateOrUpdateProperties = &certificateCreateOrUpdateProperties - } - } - } - - return nil -} - -// CertificateCreateOrUpdateProperties the properties of the create certificate operation. -type CertificateCreateOrUpdateProperties struct { - // Base64Value - Gets or sets the base64 encoded value of the certificate. - Base64Value *string `json:"base64Value,omitempty"` - // Description - Gets or sets the description of the certificate. - Description *string `json:"description,omitempty"` - // Thumbprint - Gets or sets the thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // IsExportable - Gets or sets the is exportable flag of the certificate. - IsExportable *bool `json:"isExportable,omitempty"` -} - -// CertificateListResult the response model for the list certificate operation. -type CertificateListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of certificates. - Value *[]Certificate `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateListResultIterator provides access to a complete listing of Certificate values. -type CertificateListResultIterator struct { - i int - page CertificateListResultPage -} - -// 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 *CertificateListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultIterator.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 *CertificateListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CertificateListResultIterator) 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 CertificateListResultIterator) Response() CertificateListResult { - 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 CertificateListResultIterator) Value() Certificate { - if !iter.page.NotDone() { - return Certificate{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CertificateListResultIterator type. -func NewCertificateListResultIterator(page CertificateListResultPage) CertificateListResultIterator { - return CertificateListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr CertificateListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr CertificateListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// certificateListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr CertificateListResult) certificateListResultPreparer(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))) -} - -// CertificateListResultPage contains a page of Certificate values. -type CertificateListResultPage struct { - fn func(context.Context, CertificateListResult) (CertificateListResult, error) - clr CertificateListResult -} - -// 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 *CertificateListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultPage.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 *CertificateListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CertificateListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CertificateListResultPage) Response() CertificateListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CertificateListResultPage) Values() []Certificate { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the CertificateListResultPage type. -func NewCertificateListResultPage(cur CertificateListResult, getNextPage func(context.Context, CertificateListResult) (CertificateListResult, error)) CertificateListResultPage { - return CertificateListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// CertificateProperties properties of the certificate. -type CertificateProperties struct { - // Thumbprint - READ-ONLY; Gets the thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // ExpiryTime - READ-ONLY; Gets the expiry time of the certificate. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // IsExportable - READ-ONLY; Gets the is exportable flag of the certificate. - IsExportable *bool `json:"isExportable,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateProperties. -func (cp CertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Description != nil { - objectMap["description"] = cp.Description - } - return json.Marshal(objectMap) -} - -// CertificateUpdateParameters the parameters supplied to the update certificate operation. -type CertificateUpdateParameters struct { - // Name - Gets or sets the name of the certificate. - Name *string `json:"name,omitempty"` - // CertificateUpdateProperties - Gets or sets the properties of the certificate. - *CertificateUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateUpdateParameters. -func (cup CertificateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Name != nil { - objectMap["name"] = cup.Name - } - if cup.CertificateUpdateProperties != nil { - objectMap["properties"] = cup.CertificateUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateUpdateParameters struct. -func (cup *CertificateUpdateParameters) 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 - } - cup.Name = &name - } - case "properties": - if v != nil { - var certificateUpdateProperties CertificateUpdateProperties - err = json.Unmarshal(*v, &certificateUpdateProperties) - if err != nil { - return err - } - cup.CertificateUpdateProperties = &certificateUpdateProperties - } - } - } - - return nil -} - -// CertificateUpdateProperties the properties of the update certificate operation -type CertificateUpdateProperties struct { - // Description - Gets or sets the description of the certificate. - Description *string `json:"description,omitempty"` -} - -// CollectionItemUpdateConfiguration object returned when requesting a collection of software update -// configuration -type CollectionItemUpdateConfiguration struct { - // AzureVirtualMachines - List of azure resource Ids for azure virtual machines targeted by the software update configuration. - AzureVirtualMachines *[]string `json:"azureVirtualMachines,omitempty"` - // Duration - Maximum time allowed for the software update configuration run. Duration needs to be specified using the format PT[n]H[n]M[n]S as per ISO8601 - Duration *string `json:"duration,omitempty"` -} - -// Connection definition of the connection. -type Connection struct { - autorest.Response `json:"-"` - // ConnectionProperties - Gets or sets the properties of the connection. - *ConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Connection. -func (c Connection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ConnectionProperties != nil { - objectMap["properties"] = c.ConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Connection struct. -func (c *Connection) 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 connectionProperties ConnectionProperties - err = json.Unmarshal(*v, &connectionProperties) - if err != nil { - return err - } - c.ConnectionProperties = &connectionProperties - } - 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 - } - } - } - - return nil -} - -// ConnectionCreateOrUpdateParameters the parameters supplied to the create or update connection operation. -type ConnectionCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the connection. - Name *string `json:"name,omitempty"` - // ConnectionCreateOrUpdateProperties - Gets or sets the properties of the connection. - *ConnectionCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionCreateOrUpdateParameters. -func (ccoup ConnectionCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Name != nil { - objectMap["name"] = ccoup.Name - } - if ccoup.ConnectionCreateOrUpdateProperties != nil { - objectMap["properties"] = ccoup.ConnectionCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionCreateOrUpdateParameters struct. -func (ccoup *ConnectionCreateOrUpdateParameters) 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 - } - ccoup.Name = &name - } - case "properties": - if v != nil { - var connectionCreateOrUpdateProperties ConnectionCreateOrUpdateProperties - err = json.Unmarshal(*v, &connectionCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.ConnectionCreateOrUpdateProperties = &connectionCreateOrUpdateProperties - } - } - } - - return nil -} - -// ConnectionCreateOrUpdateProperties the properties of the create connection properties -type ConnectionCreateOrUpdateProperties struct { - // Description - Gets or sets the description of the connection. - Description *string `json:"description,omitempty"` - // ConnectionType - Gets or sets the connectionType of the connection. - ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` - // FieldDefinitionValues - Gets or sets the field definition properties of the connection. - FieldDefinitionValues map[string]*string `json:"fieldDefinitionValues"` -} - -// MarshalJSON is the custom marshaler for ConnectionCreateOrUpdateProperties. -func (ccoup ConnectionCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Description != nil { - objectMap["description"] = ccoup.Description - } - if ccoup.ConnectionType != nil { - objectMap["connectionType"] = ccoup.ConnectionType - } - if ccoup.FieldDefinitionValues != nil { - objectMap["fieldDefinitionValues"] = ccoup.FieldDefinitionValues - } - return json.Marshal(objectMap) -} - -// ConnectionListResult the response model for the list connection operation. -type ConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of connection. - Value *[]Connection `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectionListResultIterator provides access to a complete listing of Connection values. -type ConnectionListResultIterator struct { - i int - page ConnectionListResultPage -} - -// 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 *ConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionListResultIterator.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 *ConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectionListResultIterator) 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 ConnectionListResultIterator) Response() ConnectionListResult { - 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 ConnectionListResultIterator) Value() Connection { - if !iter.page.NotDone() { - return Connection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectionListResultIterator type. -func NewConnectionListResultIterator(page ConnectionListResultPage) ConnectionListResultIterator { - return ConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr ConnectionListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr ConnectionListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// connectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr ConnectionListResult) connectionListResultPreparer(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))) -} - -// ConnectionListResultPage contains a page of Connection values. -type ConnectionListResultPage struct { - fn func(context.Context, ConnectionListResult) (ConnectionListResult, error) - clr ConnectionListResult -} - -// 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 *ConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionListResultPage.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 *ConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectionListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectionListResultPage) Response() ConnectionListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectionListResultPage) Values() []Connection { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the ConnectionListResultPage type. -func NewConnectionListResultPage(cur ConnectionListResult, getNextPage func(context.Context, ConnectionListResult) (ConnectionListResult, error)) ConnectionListResultPage { - return ConnectionListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// ConnectionProperties definition of the connection properties. -type ConnectionProperties struct { - // ConnectionType - Gets or sets the connectionType of the connection. - ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` - // FieldDefinitionValues - READ-ONLY; Gets the field definition values of the connection. - FieldDefinitionValues map[string]*string `json:"fieldDefinitionValues"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionProperties. -func (cp ConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.ConnectionType != nil { - objectMap["connectionType"] = cp.ConnectionType - } - if cp.Description != nil { - objectMap["description"] = cp.Description - } - return json.Marshal(objectMap) -} - -// ConnectionType definition of the connection type. -type ConnectionType struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Gets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the name of the connection type. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // ConnectionTypeProperties - Gets or sets the properties of the connection type. - *ConnectionTypeProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionType. -func (ct ConnectionType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ct.ConnectionTypeProperties != nil { - objectMap["properties"] = ct.ConnectionTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionType struct. -func (ct *ConnectionType) 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 - } - ct.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ct.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ct.Type = &typeVar - } - case "properties": - if v != nil { - var connectionTypeProperties ConnectionTypeProperties - err = json.Unmarshal(*v, &connectionTypeProperties) - if err != nil { - return err - } - ct.ConnectionTypeProperties = &connectionTypeProperties - } - } - } - - return nil -} - -// ConnectionTypeAssociationProperty the connection type property associated with the entity. -type ConnectionTypeAssociationProperty struct { - // Name - Gets or sets the name of the connection type. - Name *string `json:"name,omitempty"` -} - -// ConnectionTypeCreateOrUpdateParameters the parameters supplied to the create or update connection type -// operation. -type ConnectionTypeCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the connection type. - Name *string `json:"name,omitempty"` - // ConnectionTypeCreateOrUpdateProperties - Gets or sets the value of the connection type. - *ConnectionTypeCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionTypeCreateOrUpdateParameters. -func (ctcoup ConnectionTypeCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcoup.Name != nil { - objectMap["name"] = ctcoup.Name - } - if ctcoup.ConnectionTypeCreateOrUpdateProperties != nil { - objectMap["properties"] = ctcoup.ConnectionTypeCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionTypeCreateOrUpdateParameters struct. -func (ctcoup *ConnectionTypeCreateOrUpdateParameters) 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 - } - ctcoup.Name = &name - } - case "properties": - if v != nil { - var connectionTypeCreateOrUpdateProperties ConnectionTypeCreateOrUpdateProperties - err = json.Unmarshal(*v, &connectionTypeCreateOrUpdateProperties) - if err != nil { - return err - } - ctcoup.ConnectionTypeCreateOrUpdateProperties = &connectionTypeCreateOrUpdateProperties - } - } - } - - return nil -} - -// ConnectionTypeCreateOrUpdateProperties the properties of the create connection type. -type ConnectionTypeCreateOrUpdateProperties struct { - // IsGlobal - Gets or sets a Boolean value to indicate if the connection type is global. - IsGlobal *bool `json:"isGlobal,omitempty"` - // FieldDefinitions - Gets or sets the field definitions of the connection type. - FieldDefinitions map[string]*FieldDefinition `json:"fieldDefinitions"` -} - -// MarshalJSON is the custom marshaler for ConnectionTypeCreateOrUpdateProperties. -func (ctcoup ConnectionTypeCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcoup.IsGlobal != nil { - objectMap["isGlobal"] = ctcoup.IsGlobal - } - if ctcoup.FieldDefinitions != nil { - objectMap["fieldDefinitions"] = ctcoup.FieldDefinitions - } - return json.Marshal(objectMap) -} - -// ConnectionTypeListResult the response model for the list connection type operation. -type ConnectionTypeListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of connection types. - Value *[]ConnectionType `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectionTypeListResultIterator provides access to a complete listing of ConnectionType values. -type ConnectionTypeListResultIterator struct { - i int - page ConnectionTypeListResultPage -} - -// 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 *ConnectionTypeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeListResultIterator.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 *ConnectionTypeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectionTypeListResultIterator) 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 ConnectionTypeListResultIterator) Response() ConnectionTypeListResult { - 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 ConnectionTypeListResultIterator) Value() ConnectionType { - if !iter.page.NotDone() { - return ConnectionType{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectionTypeListResultIterator type. -func NewConnectionTypeListResultIterator(page ConnectionTypeListResultPage) ConnectionTypeListResultIterator { - return ConnectionTypeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ctlr ConnectionTypeListResult) IsEmpty() bool { - return ctlr.Value == nil || len(*ctlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ctlr ConnectionTypeListResult) hasNextLink() bool { - return ctlr.NextLink != nil && len(*ctlr.NextLink) != 0 -} - -// connectionTypeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ctlr ConnectionTypeListResult) connectionTypeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ctlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ctlr.NextLink))) -} - -// ConnectionTypeListResultPage contains a page of ConnectionType values. -type ConnectionTypeListResultPage struct { - fn func(context.Context, ConnectionTypeListResult) (ConnectionTypeListResult, error) - ctlr ConnectionTypeListResult -} - -// 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 *ConnectionTypeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeListResultPage.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.ctlr) - if err != nil { - return err - } - page.ctlr = 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 *ConnectionTypeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectionTypeListResultPage) NotDone() bool { - return !page.ctlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectionTypeListResultPage) Response() ConnectionTypeListResult { - return page.ctlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectionTypeListResultPage) Values() []ConnectionType { - if page.ctlr.IsEmpty() { - return nil - } - return *page.ctlr.Value -} - -// Creates a new instance of the ConnectionTypeListResultPage type. -func NewConnectionTypeListResultPage(cur ConnectionTypeListResult, getNextPage func(context.Context, ConnectionTypeListResult) (ConnectionTypeListResult, error)) ConnectionTypeListResultPage { - return ConnectionTypeListResultPage{ - fn: getNextPage, - ctlr: cur, - } -} - -// ConnectionTypeProperties properties of the connection type. -type ConnectionTypeProperties struct { - // IsGlobal - Gets or sets a Boolean value to indicate if the connection type is global. - IsGlobal *bool `json:"isGlobal,omitempty"` - // FieldDefinitions - READ-ONLY; Gets the field definitions of the connection type. - FieldDefinitions map[string]*FieldDefinition `json:"fieldDefinitions"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionTypeProperties. -func (ctp ConnectionTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctp.IsGlobal != nil { - objectMap["isGlobal"] = ctp.IsGlobal - } - if ctp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = ctp.LastModifiedTime - } - if ctp.Description != nil { - objectMap["description"] = ctp.Description - } - return json.Marshal(objectMap) -} - -// ConnectionUpdateParameters the parameters supplied to the update connection operation. -type ConnectionUpdateParameters struct { - // Name - Gets or sets the name of the connection. - Name *string `json:"name,omitempty"` - // ConnectionUpdateProperties - Gets or sets the properties of the connection. - *ConnectionUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionUpdateParameters. -func (cup ConnectionUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Name != nil { - objectMap["name"] = cup.Name - } - if cup.ConnectionUpdateProperties != nil { - objectMap["properties"] = cup.ConnectionUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionUpdateParameters struct. -func (cup *ConnectionUpdateParameters) 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 - } - cup.Name = &name - } - case "properties": - if v != nil { - var connectionUpdateProperties ConnectionUpdateProperties - err = json.Unmarshal(*v, &connectionUpdateProperties) - if err != nil { - return err - } - cup.ConnectionUpdateProperties = &connectionUpdateProperties - } - } - } - - return nil -} - -// ConnectionUpdateProperties the properties of the update connection operation. -type ConnectionUpdateProperties struct { - // Description - Gets or sets the description of the connection. - Description *string `json:"description,omitempty"` - // FieldDefinitionValues - Gets or sets the field definition values of the connection. - FieldDefinitionValues map[string]*string `json:"fieldDefinitionValues"` -} - -// MarshalJSON is the custom marshaler for ConnectionUpdateProperties. -func (cup ConnectionUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Description != nil { - objectMap["description"] = cup.Description - } - if cup.FieldDefinitionValues != nil { - objectMap["fieldDefinitionValues"] = cup.FieldDefinitionValues - } - return json.Marshal(objectMap) -} - -// ContentHash definition of the runbook property type. -type ContentHash struct { - // Algorithm - Gets or sets the content hash algorithm used to hash the content. - Algorithm *string `json:"algorithm,omitempty"` - // Value - Gets or sets expected hash value of the content. - Value *string `json:"value,omitempty"` -} - -// ContentLink definition of the content link. -type ContentLink struct { - // URI - Gets or sets the uri of the runbook content. - URI *string `json:"uri,omitempty"` - // ContentHash - Gets or sets the hash. - ContentHash *ContentHash `json:"contentHash,omitempty"` - // Version - Gets or sets the version of the content. - Version *string `json:"version,omitempty"` -} - -// ContentSource definition of the content source. -type ContentSource struct { - // Hash - Gets or sets the hash. - Hash *ContentHash `json:"hash,omitempty"` - // Type - Gets or sets the content source type. Possible values include: 'EmbeddedContent', 'URI' - Type ContentSourceType `json:"type,omitempty"` - // Value - Gets or sets the value of the content. This is based on the content source type. - Value *string `json:"value,omitempty"` - // Version - Gets or sets the version of the content. - Version *string `json:"version,omitempty"` -} - -// Credential definition of the credential. -type Credential struct { - autorest.Response `json:"-"` - // CredentialProperties - Gets or sets the properties of the credential. - *CredentialProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Credential. -func (c Credential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.CredentialProperties != nil { - objectMap["properties"] = c.CredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Credential struct. -func (c *Credential) 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 credentialProperties CredentialProperties - err = json.Unmarshal(*v, &credentialProperties) - if err != nil { - return err - } - c.CredentialProperties = &credentialProperties - } - 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 - } - } - } - - return nil -} - -// CredentialCreateOrUpdateParameters the parameters supplied to the create or update credential operation. -type CredentialCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the credential. - Name *string `json:"name,omitempty"` - // CredentialCreateOrUpdateProperties - Gets or sets the properties of the credential. - *CredentialCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialCreateOrUpdateParameters. -func (ccoup CredentialCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Name != nil { - objectMap["name"] = ccoup.Name - } - if ccoup.CredentialCreateOrUpdateProperties != nil { - objectMap["properties"] = ccoup.CredentialCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CredentialCreateOrUpdateParameters struct. -func (ccoup *CredentialCreateOrUpdateParameters) 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 - } - ccoup.Name = &name - } - case "properties": - if v != nil { - var credentialCreateOrUpdateProperties CredentialCreateOrUpdateProperties - err = json.Unmarshal(*v, &credentialCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.CredentialCreateOrUpdateProperties = &credentialCreateOrUpdateProperties - } - } - } - - return nil -} - -// CredentialCreateOrUpdateProperties the properties of the create credential operation. -type CredentialCreateOrUpdateProperties struct { - // UserName - Gets or sets the user name of the credential. - UserName *string `json:"userName,omitempty"` - // Password - Gets or sets the password of the credential. - Password *string `json:"password,omitempty"` - // Description - Gets or sets the description of the credential. - Description *string `json:"description,omitempty"` -} - -// CredentialListResult the response model for the list credential operation. -type CredentialListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of credentials. - Value *[]Credential `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// CredentialListResultIterator provides access to a complete listing of Credential values. -type CredentialListResultIterator struct { - i int - page CredentialListResultPage -} - -// 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 *CredentialListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialListResultIterator.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 *CredentialListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CredentialListResultIterator) 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 CredentialListResultIterator) Response() CredentialListResult { - 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 CredentialListResultIterator) Value() Credential { - if !iter.page.NotDone() { - return Credential{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CredentialListResultIterator type. -func NewCredentialListResultIterator(page CredentialListResultPage) CredentialListResultIterator { - return CredentialListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr CredentialListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr CredentialListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// credentialListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr CredentialListResult) credentialListResultPreparer(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))) -} - -// CredentialListResultPage contains a page of Credential values. -type CredentialListResultPage struct { - fn func(context.Context, CredentialListResult) (CredentialListResult, error) - clr CredentialListResult -} - -// 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 *CredentialListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialListResultPage.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 *CredentialListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CredentialListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CredentialListResultPage) Response() CredentialListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CredentialListResultPage) Values() []Credential { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the CredentialListResultPage type. -func NewCredentialListResultPage(cur CredentialListResult, getNextPage func(context.Context, CredentialListResult) (CredentialListResult, error)) CredentialListResultPage { - return CredentialListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// CredentialProperties definition of the credential properties -type CredentialProperties struct { - // UserName - READ-ONLY; Gets the user name of the credential. - UserName *string `json:"userName,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialProperties. -func (cp CredentialProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Description != nil { - objectMap["description"] = cp.Description - } - return json.Marshal(objectMap) -} - -// CredentialUpdateParameters the parameters supplied to the Update credential operation. -type CredentialUpdateParameters struct { - // Name - Gets or sets the name of the credential. - Name *string `json:"name,omitempty"` - // CredentialUpdateProperties - Gets or sets the properties of the variable. - *CredentialUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialUpdateParameters. -func (cup CredentialUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Name != nil { - objectMap["name"] = cup.Name - } - if cup.CredentialUpdateProperties != nil { - objectMap["properties"] = cup.CredentialUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CredentialUpdateParameters struct. -func (cup *CredentialUpdateParameters) 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 - } - cup.Name = &name - } - case "properties": - if v != nil { - var credentialUpdateProperties CredentialUpdateProperties - err = json.Unmarshal(*v, &credentialUpdateProperties) - if err != nil { - return err - } - cup.CredentialUpdateProperties = &credentialUpdateProperties - } - } - } - - return nil -} - -// CredentialUpdateProperties the properties of the Update credential -type CredentialUpdateProperties struct { - // UserName - Gets or sets the user name of the credential. - UserName *string `json:"userName,omitempty"` - // Password - Gets or sets the password of the credential. - Password *string `json:"password,omitempty"` - // Description - Gets or sets the description of the credential. - Description *string `json:"description,omitempty"` -} - -// DscCompilationJob definition of the Dsc Compilation job. -type DscCompilationJob struct { - autorest.Response `json:"-"` - // DscCompilationJobProperties - Gets or sets the properties of the Dsc Compilation job. - *DscCompilationJobProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJob. -func (dcj DscCompilationJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcj.DscCompilationJobProperties != nil { - objectMap["properties"] = dcj.DscCompilationJobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscCompilationJob struct. -func (dcj *DscCompilationJob) 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 dscCompilationJobProperties DscCompilationJobProperties - err = json.Unmarshal(*v, &dscCompilationJobProperties) - if err != nil { - return err - } - dcj.DscCompilationJobProperties = &dscCompilationJobProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcj.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcj.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcj.Type = &typeVar - } - } - } - - return nil -} - -// DscCompilationJobCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DscCompilationJobCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DscCompilationJobClient) (DscCompilationJob, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DscCompilationJobCreateFuture) 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 DscCompilationJobCreateFuture.Result. -func (future *DscCompilationJobCreateFuture) result(client DscCompilationJobClient) (dcj DscCompilationJob, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcj.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.DscCompilationJobCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcj.Response.Response, err = future.GetResult(sender); err == nil && dcj.Response.Response.StatusCode != http.StatusNoContent { - dcj, err = client.CreateResponder(dcj.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobCreateFuture", "Result", dcj.Response.Response, "Failure responding to request") - } - } - return -} - -// DscCompilationJobCreateParameters the parameters supplied to the create compilation job operation. -type DscCompilationJobCreateParameters struct { - // DscCompilationJobCreateProperties - Gets or sets the list of compilation job properties. - *DscCompilationJobCreateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJobCreateParameters. -func (dcjcp DscCompilationJobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcjcp.DscCompilationJobCreateProperties != nil { - objectMap["properties"] = dcjcp.DscCompilationJobCreateProperties - } - if dcjcp.Name != nil { - objectMap["name"] = dcjcp.Name - } - if dcjcp.Location != nil { - objectMap["location"] = dcjcp.Location - } - if dcjcp.Tags != nil { - objectMap["tags"] = dcjcp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscCompilationJobCreateParameters struct. -func (dcjcp *DscCompilationJobCreateParameters) 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 dscCompilationJobCreateProperties DscCompilationJobCreateProperties - err = json.Unmarshal(*v, &dscCompilationJobCreateProperties) - if err != nil { - return err - } - dcjcp.DscCompilationJobCreateProperties = &dscCompilationJobCreateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcjcp.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dcjcp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcjcp.Tags = tags - } - } - } - - return nil -} - -// DscCompilationJobCreateProperties the parameters supplied to the create compilation job operation. -type DscCompilationJobCreateProperties struct { - // Configuration - Gets or sets the configuration. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // IncrementNodeConfigurationBuild - If a new build version of NodeConfiguration is required. - IncrementNodeConfigurationBuild *bool `json:"incrementNodeConfigurationBuild,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJobCreateProperties. -func (dcjcp DscCompilationJobCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcjcp.Configuration != nil { - objectMap["configuration"] = dcjcp.Configuration - } - if dcjcp.Parameters != nil { - objectMap["parameters"] = dcjcp.Parameters - } - if dcjcp.IncrementNodeConfigurationBuild != nil { - objectMap["incrementNodeConfigurationBuild"] = dcjcp.IncrementNodeConfigurationBuild - } - return json.Marshal(objectMap) -} - -// DscCompilationJobListResult the response model for the list job operation. -type DscCompilationJobListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of Dsc Compilation jobs. - Value *[]DscCompilationJob `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// DscCompilationJobListResultIterator provides access to a complete listing of DscCompilationJob values. -type DscCompilationJobListResultIterator struct { - i int - page DscCompilationJobListResultPage -} - -// 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 *DscCompilationJobListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobListResultIterator.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 *DscCompilationJobListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscCompilationJobListResultIterator) 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 DscCompilationJobListResultIterator) Response() DscCompilationJobListResult { - 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 DscCompilationJobListResultIterator) Value() DscCompilationJob { - if !iter.page.NotDone() { - return DscCompilationJob{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscCompilationJobListResultIterator type. -func NewDscCompilationJobListResultIterator(page DscCompilationJobListResultPage) DscCompilationJobListResultIterator { - return DscCompilationJobListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dcjlr DscCompilationJobListResult) IsEmpty() bool { - return dcjlr.Value == nil || len(*dcjlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dcjlr DscCompilationJobListResult) hasNextLink() bool { - return dcjlr.NextLink != nil && len(*dcjlr.NextLink) != 0 -} - -// dscCompilationJobListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dcjlr DscCompilationJobListResult) dscCompilationJobListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dcjlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dcjlr.NextLink))) -} - -// DscCompilationJobListResultPage contains a page of DscCompilationJob values. -type DscCompilationJobListResultPage struct { - fn func(context.Context, DscCompilationJobListResult) (DscCompilationJobListResult, error) - dcjlr DscCompilationJobListResult -} - -// 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 *DscCompilationJobListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobListResultPage.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.dcjlr) - if err != nil { - return err - } - page.dcjlr = 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 *DscCompilationJobListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscCompilationJobListResultPage) NotDone() bool { - return !page.dcjlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscCompilationJobListResultPage) Response() DscCompilationJobListResult { - return page.dcjlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscCompilationJobListResultPage) Values() []DscCompilationJob { - if page.dcjlr.IsEmpty() { - return nil - } - return *page.dcjlr.Value -} - -// Creates a new instance of the DscCompilationJobListResultPage type. -func NewDscCompilationJobListResultPage(cur DscCompilationJobListResult, getNextPage func(context.Context, DscCompilationJobListResult) (DscCompilationJobListResult, error)) DscCompilationJobListResultPage { - return DscCompilationJobListResultPage{ - fn: getNextPage, - dcjlr: cur, - } -} - -// DscCompilationJobProperties definition of Dsc Compilation job properties. -type DscCompilationJobProperties struct { - // Configuration - Gets or sets the configuration. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // StartedBy - READ-ONLY; Gets the compilation job started by. - StartedBy *string `json:"startedBy,omitempty"` - // JobID - READ-ONLY; Gets the id of the job. - JobID *uuid.UUID `json:"jobId,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - The current provisioning state of the job. Possible values include: 'JobProvisioningStateFailed', 'JobProvisioningStateSucceeded', 'JobProvisioningStateSuspended', 'JobProvisioningStateProcessing' - ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` - // Status - Gets or sets the status of the job. Possible values include: 'JobStatusNew', 'JobStatusActivating', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusStopped', 'JobStatusBlocked', 'JobStatusSuspended', 'JobStatusDisconnected', 'JobStatusSuspending', 'JobStatusStopping', 'JobStatusResuming', 'JobStatusRemoving' - Status JobStatus `json:"status,omitempty"` - // StatusDetails - Gets or sets the status details of the job. - StatusDetails *string `json:"statusDetails,omitempty"` - // StartTime - READ-ONLY; Gets the start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // Exception - READ-ONLY; Gets the exception of the job. - Exception *string `json:"exception,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time of the job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastStatusModifiedTime - READ-ONLY; Gets the last status modified time of the job. - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJobProperties. -func (dcjp DscCompilationJobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcjp.Configuration != nil { - objectMap["configuration"] = dcjp.Configuration - } - if dcjp.ProvisioningState != "" { - objectMap["provisioningState"] = dcjp.ProvisioningState - } - if dcjp.RunOn != nil { - objectMap["runOn"] = dcjp.RunOn - } - if dcjp.Status != "" { - objectMap["status"] = dcjp.Status - } - if dcjp.StatusDetails != nil { - objectMap["statusDetails"] = dcjp.StatusDetails - } - if dcjp.Parameters != nil { - objectMap["parameters"] = dcjp.Parameters - } - return json.Marshal(objectMap) -} - -// DscConfiguration definition of the configuration type. -type DscConfiguration struct { - autorest.Response `json:"-"` - // DscConfigurationProperties - Gets or sets the configuration properties. - *DscConfigurationProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscConfiguration. -func (dc DscConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dc.DscConfigurationProperties != nil { - objectMap["properties"] = dc.DscConfigurationProperties - } - if dc.Etag != nil { - objectMap["etag"] = dc.Etag - } - if dc.Tags != nil { - objectMap["tags"] = dc.Tags - } - if dc.Location != nil { - objectMap["location"] = dc.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscConfiguration struct. -func (dc *DscConfiguration) 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 dscConfigurationProperties DscConfigurationProperties - err = json.Unmarshal(*v, &dscConfigurationProperties) - if err != nil { - return err - } - dc.DscConfigurationProperties = &dscConfigurationProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dc.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dc.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dc.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dc.Type = &typeVar - } - } - } - - return nil -} - -// DscConfigurationAssociationProperty the Dsc configuration property associated with the entity. -type DscConfigurationAssociationProperty struct { - // Name - Gets or sets the name of the Dsc configuration. - Name *string `json:"name,omitempty"` -} - -// DscConfigurationCreateOrUpdateParameters the parameters supplied to the create or update configuration -// operation. -type DscConfigurationCreateOrUpdateParameters struct { - // DscConfigurationCreateOrUpdateProperties - Gets or sets configuration create or update properties. - *DscConfigurationCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationCreateOrUpdateParameters. -func (dccoup DscConfigurationCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dccoup.DscConfigurationCreateOrUpdateProperties != nil { - objectMap["properties"] = dccoup.DscConfigurationCreateOrUpdateProperties - } - if dccoup.Name != nil { - objectMap["name"] = dccoup.Name - } - if dccoup.Location != nil { - objectMap["location"] = dccoup.Location - } - if dccoup.Tags != nil { - objectMap["tags"] = dccoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscConfigurationCreateOrUpdateParameters struct. -func (dccoup *DscConfigurationCreateOrUpdateParameters) 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 dscConfigurationCreateOrUpdateProperties DscConfigurationCreateOrUpdateProperties - err = json.Unmarshal(*v, &dscConfigurationCreateOrUpdateProperties) - if err != nil { - return err - } - dccoup.DscConfigurationCreateOrUpdateProperties = &dscConfigurationCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dccoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dccoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dccoup.Tags = tags - } - } - } - - return nil -} - -// DscConfigurationCreateOrUpdateProperties the properties to create or update configuration. -type DscConfigurationCreateOrUpdateProperties struct { - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // Source - Gets or sets the source. - Source *ContentSource `json:"source,omitempty"` - // Parameters - Gets or sets the configuration parameters. - Parameters map[string]*DscConfigurationParameter `json:"parameters"` - // Description - Gets or sets the description of the configuration. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationCreateOrUpdateProperties. -func (dccoup DscConfigurationCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dccoup.LogVerbose != nil { - objectMap["logVerbose"] = dccoup.LogVerbose - } - if dccoup.LogProgress != nil { - objectMap["logProgress"] = dccoup.LogProgress - } - if dccoup.Source != nil { - objectMap["source"] = dccoup.Source - } - if dccoup.Parameters != nil { - objectMap["parameters"] = dccoup.Parameters - } - if dccoup.Description != nil { - objectMap["description"] = dccoup.Description - } - return json.Marshal(objectMap) -} - -// DscConfigurationListResult the response model for the list configuration operation. -type DscConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of configurations. - Value *[]DscConfiguration `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` - // TotalCount - Gets the total number of configurations matching filter criteria. - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// DscConfigurationListResultIterator provides access to a complete listing of DscConfiguration values. -type DscConfigurationListResultIterator struct { - i int - page DscConfigurationListResultPage -} - -// 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 *DscConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationListResultIterator.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 *DscConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscConfigurationListResultIterator) 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 DscConfigurationListResultIterator) Response() DscConfigurationListResult { - 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 DscConfigurationListResultIterator) Value() DscConfiguration { - if !iter.page.NotDone() { - return DscConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscConfigurationListResultIterator type. -func NewDscConfigurationListResultIterator(page DscConfigurationListResultPage) DscConfigurationListResultIterator { - return DscConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dclr DscConfigurationListResult) IsEmpty() bool { - return dclr.Value == nil || len(*dclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dclr DscConfigurationListResult) hasNextLink() bool { - return dclr.NextLink != nil && len(*dclr.NextLink) != 0 -} - -// dscConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dclr DscConfigurationListResult) dscConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dclr.NextLink))) -} - -// DscConfigurationListResultPage contains a page of DscConfiguration values. -type DscConfigurationListResultPage struct { - fn func(context.Context, DscConfigurationListResult) (DscConfigurationListResult, error) - dclr DscConfigurationListResult -} - -// 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 *DscConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationListResultPage.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.dclr) - if err != nil { - return err - } - page.dclr = 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 *DscConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscConfigurationListResultPage) NotDone() bool { - return !page.dclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscConfigurationListResultPage) Response() DscConfigurationListResult { - return page.dclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscConfigurationListResultPage) Values() []DscConfiguration { - if page.dclr.IsEmpty() { - return nil - } - return *page.dclr.Value -} - -// Creates a new instance of the DscConfigurationListResultPage type. -func NewDscConfigurationListResultPage(cur DscConfigurationListResult, getNextPage func(context.Context, DscConfigurationListResult) (DscConfigurationListResult, error)) DscConfigurationListResultPage { - return DscConfigurationListResultPage{ - fn: getNextPage, - dclr: cur, - } -} - -// DscConfigurationParameter definition of the configuration parameter type. -type DscConfigurationParameter struct { - // Type - Gets or sets the type of the parameter. - Type *string `json:"type,omitempty"` - // IsMandatory - Gets or sets a Boolean value to indicate whether the parameter is mandatory or not. - IsMandatory *bool `json:"isMandatory,omitempty"` - // Position - Get or sets the position of the parameter. - Position *int32 `json:"position,omitempty"` - // DefaultValue - Gets or sets the default value of parameter. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// DscConfigurationProperties definition of the configuration property type. -type DscConfigurationProperties struct { - // ProvisioningState - Gets or sets the provisioning state of the configuration. Possible values include: 'Succeeded' - ProvisioningState DscConfigurationProvisioningState `json:"provisioningState,omitempty"` - // JobCount - Gets or sets the job count of the configuration. - JobCount *int32 `json:"jobCount,omitempty"` - // Parameters - Gets or sets the configuration parameters. - Parameters map[string]*DscConfigurationParameter `json:"parameters"` - // Source - Gets or sets the source. - Source *ContentSource `json:"source,omitempty"` - // State - Gets or sets the state of the configuration. Possible values include: 'DscConfigurationStateNew', 'DscConfigurationStateEdit', 'DscConfigurationStatePublished' - State DscConfigurationState `json:"state,omitempty"` - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // NodeConfigurationCount - Gets the number of compiled node configurations. - NodeConfigurationCount *int32 `json:"nodeConfigurationCount,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationProperties. -func (dcp DscConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcp.ProvisioningState != "" { - objectMap["provisioningState"] = dcp.ProvisioningState - } - if dcp.JobCount != nil { - objectMap["jobCount"] = dcp.JobCount - } - if dcp.Parameters != nil { - objectMap["parameters"] = dcp.Parameters - } - if dcp.Source != nil { - objectMap["source"] = dcp.Source - } - if dcp.State != "" { - objectMap["state"] = dcp.State - } - if dcp.LogVerbose != nil { - objectMap["logVerbose"] = dcp.LogVerbose - } - if dcp.CreationTime != nil { - objectMap["creationTime"] = dcp.CreationTime - } - if dcp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = dcp.LastModifiedTime - } - if dcp.NodeConfigurationCount != nil { - objectMap["nodeConfigurationCount"] = dcp.NodeConfigurationCount - } - if dcp.Description != nil { - objectMap["description"] = dcp.Description - } - return json.Marshal(objectMap) -} - -// DscConfigurationUpdateParameters the parameters supplied to the create or update configuration -// operation. -type DscConfigurationUpdateParameters struct { - // DscConfigurationCreateOrUpdateProperties - Gets or sets configuration create or update properties. - *DscConfigurationCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationUpdateParameters. -func (dcup DscConfigurationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcup.DscConfigurationCreateOrUpdateProperties != nil { - objectMap["properties"] = dcup.DscConfigurationCreateOrUpdateProperties - } - if dcup.Name != nil { - objectMap["name"] = dcup.Name - } - if dcup.Tags != nil { - objectMap["tags"] = dcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscConfigurationUpdateParameters struct. -func (dcup *DscConfigurationUpdateParameters) 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 dscConfigurationCreateOrUpdateProperties DscConfigurationCreateOrUpdateProperties - err = json.Unmarshal(*v, &dscConfigurationCreateOrUpdateProperties) - if err != nil { - return err - } - dcup.DscConfigurationCreateOrUpdateProperties = &dscConfigurationCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcup.Name = &name - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcup.Tags = tags - } - } - } - - return nil -} - -// DscMetaConfiguration definition of the DSC Meta Configuration. -type DscMetaConfiguration struct { - // ConfigurationModeFrequencyMins - Gets or sets the ConfigurationModeFrequencyMins value of the meta configuration. - ConfigurationModeFrequencyMins *int32 `json:"configurationModeFrequencyMins,omitempty"` - // RebootNodeIfNeeded - Gets or sets the RebootNodeIfNeeded value of the meta configuration. - RebootNodeIfNeeded *bool `json:"rebootNodeIfNeeded,omitempty"` - // ConfigurationMode - Gets or sets the ConfigurationMode value of the meta configuration. - ConfigurationMode *string `json:"configurationMode,omitempty"` - // ActionAfterReboot - Gets or sets the ActionAfterReboot value of the meta configuration. - ActionAfterReboot *string `json:"actionAfterReboot,omitempty"` - // CertificateID - Gets or sets the CertificateId value of the meta configuration. - CertificateID *string `json:"certificateId,omitempty"` - // RefreshFrequencyMins - Gets or sets the RefreshFrequencyMins value of the meta configuration. - RefreshFrequencyMins *int32 `json:"refreshFrequencyMins,omitempty"` - // AllowModuleOverwrite - Gets or sets the AllowModuleOverwrite value of the meta configuration. - AllowModuleOverwrite *bool `json:"allowModuleOverwrite,omitempty"` -} - -// DscNode definition of a DscNode -type DscNode struct { - autorest.Response `json:"-"` - // DscNodeProperties - The properties of a DscNode. - *DscNodeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscNode. -func (dn DscNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dn.DscNodeProperties != nil { - objectMap["properties"] = dn.DscNodeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNode struct. -func (dn *DscNode) 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 dscNodeProperties DscNodeProperties - err = json.Unmarshal(*v, &dscNodeProperties) - if err != nil { - return err - } - dn.DscNodeProperties = &dscNodeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dn.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dn.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dn.Type = &typeVar - } - } - } - - return nil -} - -// DscNodeConfiguration definition of the dsc node configuration. -type DscNodeConfiguration struct { - autorest.Response `json:"-"` - // DscNodeConfigurationProperties - Gets or sets the configuration properties. - *DscNodeConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscNodeConfiguration. -func (dnc DscNodeConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dnc.DscNodeConfigurationProperties != nil { - objectMap["properties"] = dnc.DscNodeConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNodeConfiguration struct. -func (dnc *DscNodeConfiguration) 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 dscNodeConfigurationProperties DscNodeConfigurationProperties - err = json.Unmarshal(*v, &dscNodeConfigurationProperties) - if err != nil { - return err - } - dnc.DscNodeConfigurationProperties = &dscNodeConfigurationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dnc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dnc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dnc.Type = &typeVar - } - } - } - - return nil -} - -// DscNodeConfigurationAssociationProperty the dsc node configuration property associated with the entity. -type DscNodeConfigurationAssociationProperty struct { - // Name - Gets or sets the name of the dsc node configuration. - Name *string `json:"name,omitempty"` -} - -// DscNodeConfigurationCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DscNodeConfigurationCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DscNodeConfigurationClient) (DscNodeConfiguration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DscNodeConfigurationCreateOrUpdateFuture) 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 DscNodeConfigurationCreateOrUpdateFuture.Result. -func (future *DscNodeConfigurationCreateOrUpdateFuture) result(client DscNodeConfigurationClient) (dnc DscNodeConfiguration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dnc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.DscNodeConfigurationCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dnc.Response.Response, err = future.GetResult(sender); err == nil && dnc.Response.Response.StatusCode != http.StatusNoContent { - dnc, err = client.CreateOrUpdateResponder(dnc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationCreateOrUpdateFuture", "Result", dnc.Response.Response, "Failure responding to request") - } - } - return -} - -// DscNodeConfigurationCreateOrUpdateParameters the parameters supplied to the create or update node -// configuration operation. -type DscNodeConfigurationCreateOrUpdateParameters struct { - // DscNodeConfigurationCreateOrUpdateParametersProperties - Node configuration properties - *DscNodeConfigurationCreateOrUpdateParametersProperties `json:"properties,omitempty"` - // Name - Name of the node configuration. - Name *string `json:"name,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscNodeConfigurationCreateOrUpdateParameters. -func (dnccoup DscNodeConfigurationCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dnccoup.DscNodeConfigurationCreateOrUpdateParametersProperties != nil { - objectMap["properties"] = dnccoup.DscNodeConfigurationCreateOrUpdateParametersProperties - } - if dnccoup.Name != nil { - objectMap["name"] = dnccoup.Name - } - if dnccoup.Tags != nil { - objectMap["tags"] = dnccoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNodeConfigurationCreateOrUpdateParameters struct. -func (dnccoup *DscNodeConfigurationCreateOrUpdateParameters) 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 dscNodeConfigurationCreateOrUpdateParametersProperties DscNodeConfigurationCreateOrUpdateParametersProperties - err = json.Unmarshal(*v, &dscNodeConfigurationCreateOrUpdateParametersProperties) - if err != nil { - return err - } - dnccoup.DscNodeConfigurationCreateOrUpdateParametersProperties = &dscNodeConfigurationCreateOrUpdateParametersProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dnccoup.Name = &name - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dnccoup.Tags = tags - } - } - } - - return nil -} - -// DscNodeConfigurationCreateOrUpdateParametersProperties the parameter properties supplied to the create -// or update node configuration operation. -type DscNodeConfigurationCreateOrUpdateParametersProperties struct { - // Source - Gets or sets the source. - Source *ContentSource `json:"source,omitempty"` - // Configuration - Gets or sets the configuration of the node. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // IncrementNodeConfigurationBuild - If a new build version of NodeConfiguration is required. - IncrementNodeConfigurationBuild *bool `json:"incrementNodeConfigurationBuild,omitempty"` -} - -// DscNodeConfigurationListResult the response model for the list job operation. -type DscNodeConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of Dsc node configurations. - Value *[]DscNodeConfiguration `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` - // TotalCount - Gets or sets the total rows in query. - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// DscNodeConfigurationListResultIterator provides access to a complete listing of DscNodeConfiguration -// values. -type DscNodeConfigurationListResultIterator struct { - i int - page DscNodeConfigurationListResultPage -} - -// 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 *DscNodeConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationListResultIterator.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 *DscNodeConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscNodeConfigurationListResultIterator) 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 DscNodeConfigurationListResultIterator) Response() DscNodeConfigurationListResult { - 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 DscNodeConfigurationListResultIterator) Value() DscNodeConfiguration { - if !iter.page.NotDone() { - return DscNodeConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscNodeConfigurationListResultIterator type. -func NewDscNodeConfigurationListResultIterator(page DscNodeConfigurationListResultPage) DscNodeConfigurationListResultIterator { - return DscNodeConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dnclr DscNodeConfigurationListResult) IsEmpty() bool { - return dnclr.Value == nil || len(*dnclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dnclr DscNodeConfigurationListResult) hasNextLink() bool { - return dnclr.NextLink != nil && len(*dnclr.NextLink) != 0 -} - -// dscNodeConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dnclr DscNodeConfigurationListResult) dscNodeConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dnclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dnclr.NextLink))) -} - -// DscNodeConfigurationListResultPage contains a page of DscNodeConfiguration values. -type DscNodeConfigurationListResultPage struct { - fn func(context.Context, DscNodeConfigurationListResult) (DscNodeConfigurationListResult, error) - dnclr DscNodeConfigurationListResult -} - -// 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 *DscNodeConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationListResultPage.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.dnclr) - if err != nil { - return err - } - page.dnclr = 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 *DscNodeConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscNodeConfigurationListResultPage) NotDone() bool { - return !page.dnclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscNodeConfigurationListResultPage) Response() DscNodeConfigurationListResult { - return page.dnclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscNodeConfigurationListResultPage) Values() []DscNodeConfiguration { - if page.dnclr.IsEmpty() { - return nil - } - return *page.dnclr.Value -} - -// Creates a new instance of the DscNodeConfigurationListResultPage type. -func NewDscNodeConfigurationListResultPage(cur DscNodeConfigurationListResult, getNextPage func(context.Context, DscNodeConfigurationListResult) (DscNodeConfigurationListResult, error)) DscNodeConfigurationListResultPage { - return DscNodeConfigurationListResultPage{ - fn: getNextPage, - dnclr: cur, - } -} - -// DscNodeConfigurationProperties properties for the DscNodeConfiguration -type DscNodeConfigurationProperties struct { - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // CreationTime - Gets or sets creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Configuration - Gets or sets the configuration of the node. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // Source - Source of node configuration. - Source *string `json:"source,omitempty"` - // NodeCount - Number of nodes with this node configuration assigned - NodeCount *int64 `json:"nodeCount,omitempty"` - // IncrementNodeConfigurationBuild - If a new build version of NodeConfiguration is required. - IncrementNodeConfigurationBuild *bool `json:"incrementNodeConfigurationBuild,omitempty"` -} - -// DscNodeExtensionHandlerAssociationProperty the dsc extensionHandler property associated with the node -type DscNodeExtensionHandlerAssociationProperty struct { - // Name - Gets or sets the name of the extension handler. - Name *string `json:"name,omitempty"` - // Version - Gets or sets the version of the extension handler. - Version *string `json:"version,omitempty"` -} - -// DscNodeListResult the response model for the list dsc nodes operation. -type DscNodeListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of dsc nodes. - Value *[]DscNode `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` - // TotalCount - Gets the total number of nodes matching filter criteria. - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// DscNodeListResultIterator provides access to a complete listing of DscNode values. -type DscNodeListResultIterator struct { - i int - page DscNodeListResultPage -} - -// 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 *DscNodeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeListResultIterator.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 *DscNodeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscNodeListResultIterator) 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 DscNodeListResultIterator) Response() DscNodeListResult { - 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 DscNodeListResultIterator) Value() DscNode { - if !iter.page.NotDone() { - return DscNode{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscNodeListResultIterator type. -func NewDscNodeListResultIterator(page DscNodeListResultPage) DscNodeListResultIterator { - return DscNodeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dnlr DscNodeListResult) IsEmpty() bool { - return dnlr.Value == nil || len(*dnlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dnlr DscNodeListResult) hasNextLink() bool { - return dnlr.NextLink != nil && len(*dnlr.NextLink) != 0 -} - -// dscNodeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dnlr DscNodeListResult) dscNodeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dnlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dnlr.NextLink))) -} - -// DscNodeListResultPage contains a page of DscNode values. -type DscNodeListResultPage struct { - fn func(context.Context, DscNodeListResult) (DscNodeListResult, error) - dnlr DscNodeListResult -} - -// 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 *DscNodeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeListResultPage.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.dnlr) - if err != nil { - return err - } - page.dnlr = 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 *DscNodeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscNodeListResultPage) NotDone() bool { - return !page.dnlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscNodeListResultPage) Response() DscNodeListResult { - return page.dnlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscNodeListResultPage) Values() []DscNode { - if page.dnlr.IsEmpty() { - return nil - } - return *page.dnlr.Value -} - -// Creates a new instance of the DscNodeListResultPage type. -func NewDscNodeListResultPage(cur DscNodeListResult, getNextPage func(context.Context, DscNodeListResult) (DscNodeListResult, error)) DscNodeListResultPage { - return DscNodeListResultPage{ - fn: getNextPage, - dnlr: cur, - } -} - -// DscNodeProperties the properties of a DscNode -type DscNodeProperties struct { - // LastSeen - Gets or sets the last seen time of the node. - LastSeen *date.Time `json:"lastSeen,omitempty"` - // RegistrationTime - Gets or sets the registration time of the node. - RegistrationTime *date.Time `json:"registrationTime,omitempty"` - // IP - Gets or sets the ip of the node. - IP *string `json:"ip,omitempty"` - // AccountID - Gets or sets the account id of the node. - AccountID *string `json:"accountId,omitempty"` - // DscNodeConfigurationAssociationProperty - Gets or sets the configuration of the node. - *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` - // Status - Gets or sets the status of the node. - Status *string `json:"status,omitempty"` - // NodeID - Gets or sets the node id. - NodeID *string `json:"nodeId,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // TotalCount - Gets the total number of records matching filter criteria. - TotalCount *int32 `json:"totalCount,omitempty"` - // ExtensionHandler - Gets or sets the list of extensionHandler properties for a Node. - ExtensionHandler *[]DscNodeExtensionHandlerAssociationProperty `json:"extensionHandler,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscNodeProperties. -func (dnp DscNodeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dnp.LastSeen != nil { - objectMap["lastSeen"] = dnp.LastSeen - } - if dnp.RegistrationTime != nil { - objectMap["registrationTime"] = dnp.RegistrationTime - } - if dnp.IP != nil { - objectMap["ip"] = dnp.IP - } - if dnp.AccountID != nil { - objectMap["accountId"] = dnp.AccountID - } - if dnp.DscNodeConfigurationAssociationProperty != nil { - objectMap["nodeConfiguration"] = dnp.DscNodeConfigurationAssociationProperty - } - if dnp.Status != nil { - objectMap["status"] = dnp.Status - } - if dnp.NodeID != nil { - objectMap["nodeId"] = dnp.NodeID - } - if dnp.Etag != nil { - objectMap["etag"] = dnp.Etag - } - if dnp.TotalCount != nil { - objectMap["totalCount"] = dnp.TotalCount - } - if dnp.ExtensionHandler != nil { - objectMap["extensionHandler"] = dnp.ExtensionHandler - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNodeProperties struct. -func (dnp *DscNodeProperties) 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 "lastSeen": - if v != nil { - var lastSeen date.Time - err = json.Unmarshal(*v, &lastSeen) - if err != nil { - return err - } - dnp.LastSeen = &lastSeen - } - case "registrationTime": - if v != nil { - var registrationTime date.Time - err = json.Unmarshal(*v, ®istrationTime) - if err != nil { - return err - } - dnp.RegistrationTime = ®istrationTime - } - case "ip": - if v != nil { - var IP string - err = json.Unmarshal(*v, &IP) - if err != nil { - return err - } - dnp.IP = &IP - } - case "accountId": - if v != nil { - var accountID string - err = json.Unmarshal(*v, &accountID) - if err != nil { - return err - } - dnp.AccountID = &accountID - } - case "nodeConfiguration": - if v != nil { - var dscNodeConfigurationAssociationProperty DscNodeConfigurationAssociationProperty - err = json.Unmarshal(*v, &dscNodeConfigurationAssociationProperty) - if err != nil { - return err - } - dnp.DscNodeConfigurationAssociationProperty = &dscNodeConfigurationAssociationProperty - } - case "status": - if v != nil { - var status string - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - dnp.Status = &status - } - case "nodeId": - if v != nil { - var nodeID string - err = json.Unmarshal(*v, &nodeID) - if err != nil { - return err - } - dnp.NodeID = &nodeID - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dnp.Etag = &etag - } - case "totalCount": - if v != nil { - var totalCount int32 - err = json.Unmarshal(*v, &totalCount) - if err != nil { - return err - } - dnp.TotalCount = &totalCount - } - case "extensionHandler": - if v != nil { - var extensionHandler []DscNodeExtensionHandlerAssociationProperty - err = json.Unmarshal(*v, &extensionHandler) - if err != nil { - return err - } - dnp.ExtensionHandler = &extensionHandler - } - } - } - - return nil -} - -// DscNodeReport definition of the dsc node report type. -type DscNodeReport struct { - autorest.Response `json:"-"` - // EndTime - Gets or sets the end time of the node report. - EndTime *date.Time `json:"endTime,omitempty"` - // LastModifiedTime - Gets or sets the lastModifiedTime of the node report. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // StartTime - Gets or sets the start time of the node report. - StartTime *date.Time `json:"startTime,omitempty"` - // Type - Gets or sets the type of the node report. - Type *string `json:"type,omitempty"` - // ReportID - Gets or sets the id of the node report. - ReportID *string `json:"reportId,omitempty"` - // Status - Gets or sets the status of the node report. - Status *string `json:"status,omitempty"` - // RefreshMode - Gets or sets the refreshMode of the node report. - RefreshMode *string `json:"refreshMode,omitempty"` - // RebootRequested - Gets or sets the rebootRequested of the node report. - RebootRequested *string `json:"rebootRequested,omitempty"` - // ReportFormatVersion - Gets or sets the reportFormatVersion of the node report. - ReportFormatVersion *string `json:"reportFormatVersion,omitempty"` - // ConfigurationVersion - Gets or sets the configurationVersion of the node report. - ConfigurationVersion *string `json:"configurationVersion,omitempty"` - // ID - Gets or sets the id. - ID *string `json:"id,omitempty"` - // Errors - Gets or sets the errors for the node report. - Errors *[]DscReportError `json:"errors,omitempty"` - // Resources - Gets or sets the resource for the node report. - Resources *[]DscReportResource `json:"resources,omitempty"` - // MetaConfiguration - Gets or sets the metaConfiguration of the node at the time of the report. - MetaConfiguration *DscMetaConfiguration `json:"metaConfiguration,omitempty"` - // HostName - Gets or sets the hostname of the node that sent the report. - HostName *string `json:"hostName,omitempty"` - // IPV4Addresses - Gets or sets the IPv4 address of the node that sent the report. - IPV4Addresses *[]string `json:"iPV4Addresses,omitempty"` - // IPV6Addresses - Gets or sets the IPv6 address of the node that sent the report. - IPV6Addresses *[]string `json:"iPV6Addresses,omitempty"` - // NumberOfResources - Gets or sets the number of resource in the node report. - NumberOfResources *int32 `json:"numberOfResources,omitempty"` - // RawErrors - Gets or sets the unparsed errors for the node report. - RawErrors *string `json:"rawErrors,omitempty"` -} - -// DscNodeReportListResult the response model for the list dsc nodes operation. -type DscNodeReportListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of dsc node reports. - Value *[]DscNodeReport `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// DscNodeReportListResultIterator provides access to a complete listing of DscNodeReport values. -type DscNodeReportListResultIterator struct { - i int - page DscNodeReportListResultPage -} - -// 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 *DscNodeReportListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeReportListResultIterator.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 *DscNodeReportListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscNodeReportListResultIterator) 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 DscNodeReportListResultIterator) Response() DscNodeReportListResult { - 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 DscNodeReportListResultIterator) Value() DscNodeReport { - if !iter.page.NotDone() { - return DscNodeReport{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscNodeReportListResultIterator type. -func NewDscNodeReportListResultIterator(page DscNodeReportListResultPage) DscNodeReportListResultIterator { - return DscNodeReportListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dnrlr DscNodeReportListResult) IsEmpty() bool { - return dnrlr.Value == nil || len(*dnrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dnrlr DscNodeReportListResult) hasNextLink() bool { - return dnrlr.NextLink != nil && len(*dnrlr.NextLink) != 0 -} - -// dscNodeReportListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dnrlr DscNodeReportListResult) dscNodeReportListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dnrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dnrlr.NextLink))) -} - -// DscNodeReportListResultPage contains a page of DscNodeReport values. -type DscNodeReportListResultPage struct { - fn func(context.Context, DscNodeReportListResult) (DscNodeReportListResult, error) - dnrlr DscNodeReportListResult -} - -// 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 *DscNodeReportListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeReportListResultPage.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.dnrlr) - if err != nil { - return err - } - page.dnrlr = 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 *DscNodeReportListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscNodeReportListResultPage) NotDone() bool { - return !page.dnrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscNodeReportListResultPage) Response() DscNodeReportListResult { - return page.dnrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscNodeReportListResultPage) Values() []DscNodeReport { - if page.dnrlr.IsEmpty() { - return nil - } - return *page.dnrlr.Value -} - -// Creates a new instance of the DscNodeReportListResultPage type. -func NewDscNodeReportListResultPage(cur DscNodeReportListResult, getNextPage func(context.Context, DscNodeReportListResult) (DscNodeReportListResult, error)) DscNodeReportListResultPage { - return DscNodeReportListResultPage{ - fn: getNextPage, - dnrlr: cur, - } -} - -// DscNodeUpdateParameters the parameters supplied to the update dsc node operation. -type DscNodeUpdateParameters struct { - // NodeID - Gets or sets the id of the dsc node. - NodeID *string `json:"nodeId,omitempty"` - Properties *DscNodeUpdateParametersProperties `json:"properties,omitempty"` -} - -// DscNodeUpdateParametersProperties ... -type DscNodeUpdateParametersProperties struct { - // DscNodeConfigurationAssociationProperty - Gets or sets the configuration of the node. - *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscNodeUpdateParametersProperties. -func (dnup DscNodeUpdateParametersProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dnup.DscNodeConfigurationAssociationProperty != nil { - objectMap["nodeConfiguration"] = dnup.DscNodeConfigurationAssociationProperty - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNodeUpdateParametersProperties struct. -func (dnup *DscNodeUpdateParametersProperties) 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 "nodeConfiguration": - if v != nil { - var dscNodeConfigurationAssociationProperty DscNodeConfigurationAssociationProperty - err = json.Unmarshal(*v, &dscNodeConfigurationAssociationProperty) - if err != nil { - return err - } - dnup.DscNodeConfigurationAssociationProperty = &dscNodeConfigurationAssociationProperty - } - } - } - - return nil -} - -// DscReportError definition of the dsc node report error type. -type DscReportError struct { - // ErrorSource - Gets or sets the source of the error. - ErrorSource *string `json:"errorSource,omitempty"` - // ResourceID - Gets or sets the resource ID which generated the error. - ResourceID *string `json:"resourceId,omitempty"` - // ErrorCode - Gets or sets the error code. - ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Gets or sets the error message. - ErrorMessage *string `json:"errorMessage,omitempty"` - // Locale - Gets or sets the locale of the error. - Locale *string `json:"locale,omitempty"` - // ErrorDetails - Gets or sets the error details. - ErrorDetails *string `json:"errorDetails,omitempty"` -} - -// DscReportResource definition of the DSC Report Resource. -type DscReportResource struct { - // ResourceID - Gets or sets the ID of the resource. - ResourceID *string `json:"resourceId,omitempty"` - // SourceInfo - Gets or sets the source info of the resource. - SourceInfo *string `json:"sourceInfo,omitempty"` - // DependsOn - Gets or sets the Resource Navigation values for resources the resource depends on. - DependsOn *[]DscReportResourceNavigation `json:"dependsOn,omitempty"` - // ModuleName - Gets or sets the module name of the resource. - ModuleName *string `json:"moduleName,omitempty"` - // ModuleVersion - Gets or sets the module version of the resource. - ModuleVersion *string `json:"moduleVersion,omitempty"` - // ResourceName - Gets or sets the name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // Error - Gets or sets the error of the resource. - Error *string `json:"error,omitempty"` - // Status - Gets or sets the status of the resource. - Status *string `json:"status,omitempty"` - // DurationInSeconds - Gets or sets the duration in seconds for the resource. - DurationInSeconds *float64 `json:"durationInSeconds,omitempty"` - // StartDate - Gets or sets the start date of the resource. - StartDate *date.Time `json:"startDate,omitempty"` -} - -// DscReportResourceNavigation navigation for DSC Report Resource. -type DscReportResourceNavigation struct { - // ResourceID - Gets or sets the ID of the resource to navigate to. - ResourceID *string `json:"resourceId,omitempty"` -} - -// ErrorResponse error response of an operation failure -type ErrorResponse struct { - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// FieldDefinition definition of the connection fields. -type FieldDefinition struct { - // IsEncrypted - Gets or sets the isEncrypted flag of the connection field definition. - IsEncrypted *bool `json:"isEncrypted,omitempty"` - // IsOptional - Gets or sets the isOptional flag of the connection field definition. - IsOptional *bool `json:"isOptional,omitempty"` - // Type - Gets or sets the type of the connection field definition. - Type *string `json:"type,omitempty"` -} - -// HybridRunbookWorker definition of hybrid runbook worker. -type HybridRunbookWorker struct { - // Name - Gets or sets the worker machine name. - Name *string `json:"name,omitempty"` - // IP - Gets or sets the assigned machine IP address. - IP *string `json:"ip,omitempty"` - // RegistrationTime - Gets or sets the registration time of the worker machine. - RegistrationTime *date.Time `json:"registrationTime,omitempty"` - // LastSeenDateTime - Last Heartbeat from the Worker - LastSeenDateTime *date.Time `json:"lastSeenDateTime,omitempty"` -} - -// HybridRunbookWorkerGroup definition of hybrid runbook worker group. -type HybridRunbookWorkerGroup struct { - autorest.Response `json:"-"` - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - Gets or sets the name of the group. - Name *string `json:"name,omitempty"` - // HybridRunbookWorkers - Gets or sets the list of hybrid runbook workers. - HybridRunbookWorkers *[]HybridRunbookWorker `json:"hybridRunbookWorkers,omitempty"` - // Credential - Sets the credential of a worker group. - Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` - // GroupType - Type of the HybridWorkerGroup. Possible values include: 'User', 'System' - GroupType GroupTypeEnum `json:"groupType,omitempty"` -} - -// HybridRunbookWorkerGroupsListResult the response model for the list hybrid runbook worker groups. -type HybridRunbookWorkerGroupsListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of hybrid runbook worker groups. - Value *[]HybridRunbookWorkerGroup `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// HybridRunbookWorkerGroupsListResultIterator provides access to a complete listing of -// HybridRunbookWorkerGroup values. -type HybridRunbookWorkerGroupsListResultIterator struct { - i int - page HybridRunbookWorkerGroupsListResultPage -} - -// 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 *HybridRunbookWorkerGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupsListResultIterator.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 *HybridRunbookWorkerGroupsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter HybridRunbookWorkerGroupsListResultIterator) 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 HybridRunbookWorkerGroupsListResultIterator) Response() HybridRunbookWorkerGroupsListResult { - 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 HybridRunbookWorkerGroupsListResultIterator) Value() HybridRunbookWorkerGroup { - if !iter.page.NotDone() { - return HybridRunbookWorkerGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the HybridRunbookWorkerGroupsListResultIterator type. -func NewHybridRunbookWorkerGroupsListResultIterator(page HybridRunbookWorkerGroupsListResultPage) HybridRunbookWorkerGroupsListResultIterator { - return HybridRunbookWorkerGroupsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (hrwglr HybridRunbookWorkerGroupsListResult) IsEmpty() bool { - return hrwglr.Value == nil || len(*hrwglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (hrwglr HybridRunbookWorkerGroupsListResult) hasNextLink() bool { - return hrwglr.NextLink != nil && len(*hrwglr.NextLink) != 0 -} - -// hybridRunbookWorkerGroupsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (hrwglr HybridRunbookWorkerGroupsListResult) hybridRunbookWorkerGroupsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !hrwglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(hrwglr.NextLink))) -} - -// HybridRunbookWorkerGroupsListResultPage contains a page of HybridRunbookWorkerGroup values. -type HybridRunbookWorkerGroupsListResultPage struct { - fn func(context.Context, HybridRunbookWorkerGroupsListResult) (HybridRunbookWorkerGroupsListResult, error) - hrwglr HybridRunbookWorkerGroupsListResult -} - -// 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 *HybridRunbookWorkerGroupsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupsListResultPage.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.hrwglr) - if err != nil { - return err - } - page.hrwglr = 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 *HybridRunbookWorkerGroupsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page HybridRunbookWorkerGroupsListResultPage) NotDone() bool { - return !page.hrwglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page HybridRunbookWorkerGroupsListResultPage) Response() HybridRunbookWorkerGroupsListResult { - return page.hrwglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page HybridRunbookWorkerGroupsListResultPage) Values() []HybridRunbookWorkerGroup { - if page.hrwglr.IsEmpty() { - return nil - } - return *page.hrwglr.Value -} - -// Creates a new instance of the HybridRunbookWorkerGroupsListResultPage type. -func NewHybridRunbookWorkerGroupsListResultPage(cur HybridRunbookWorkerGroupsListResult, getNextPage func(context.Context, HybridRunbookWorkerGroupsListResult) (HybridRunbookWorkerGroupsListResult, error)) HybridRunbookWorkerGroupsListResultPage { - return HybridRunbookWorkerGroupsListResultPage{ - fn: getNextPage, - hrwglr: cur, - } -} - -// HybridRunbookWorkerGroupUpdateParameters parameters supplied to the update operation. -type HybridRunbookWorkerGroupUpdateParameters struct { - // Credential - Sets the credential of a worker group. - Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` -} - -// Job definition of the job. -type Job struct { - autorest.Response `json:"-"` - // JobProperties - The properties of the job. - *JobProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Job. -func (j Job) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if j.JobProperties != nil { - objectMap["properties"] = j.JobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Job struct. -func (j *Job) 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 jobProperties JobProperties - err = json.Unmarshal(*v, &jobProperties) - if err != nil { - return err - } - j.JobProperties = &jobProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - j.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - j.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - j.Type = &typeVar - } - } - } - - return nil -} - -// JobCollectionItem job collection item properties. -type JobCollectionItem struct { - // JobCollectionItemProperties - Job properties. - *JobCollectionItemProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for JobCollectionItem. -func (jci JobCollectionItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jci.JobCollectionItemProperties != nil { - objectMap["properties"] = jci.JobCollectionItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobCollectionItem struct. -func (jci *JobCollectionItem) 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 jobCollectionItemProperties JobCollectionItemProperties - err = json.Unmarshal(*v, &jobCollectionItemProperties) - if err != nil { - return err - } - jci.JobCollectionItemProperties = &jobCollectionItemProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - jci.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - jci.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - jci.Type = &typeVar - } - } - } - - return nil -} - -// JobCollectionItemProperties job collection item properties. -type JobCollectionItemProperties struct { - // Runbook - READ-ONLY; The runbook association. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // JobID - READ-ONLY; The id of the job. - JobID *uuid.UUID `json:"jobId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Status - READ-ONLY; The status of the job. Possible values include: 'JobStatusNew', 'JobStatusActivating', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusStopped', 'JobStatusBlocked', 'JobStatusSuspended', 'JobStatusDisconnected', 'JobStatusSuspending', 'JobStatusStopping', 'JobStatusResuming', 'JobStatusRemoving' - Status JobStatus `json:"status,omitempty"` - // StartTime - READ-ONLY; The start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // LastModifiedTime - READ-ONLY; The last modified time of the job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of a resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // RunOn - Specifies the runOn group name where the job was executed. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCollectionItemProperties. -func (jcip JobCollectionItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jcip.RunOn != nil { - objectMap["runOn"] = jcip.RunOn - } - return json.Marshal(objectMap) -} - -// JobCreateParameters the parameters supplied to the create job operation. -type JobCreateParameters struct { - // JobCreateProperties - Gets or sets the list of job properties. - *JobCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCreateParameters. -func (jcp JobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jcp.JobCreateProperties != nil { - objectMap["properties"] = jcp.JobCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobCreateParameters struct. -func (jcp *JobCreateParameters) 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 jobCreateProperties JobCreateProperties - err = json.Unmarshal(*v, &jobCreateProperties) - if err != nil { - return err - } - jcp.JobCreateProperties = &jobCreateProperties - } - } - } - - return nil -} - -// JobCreateProperties ... -type JobCreateProperties struct { - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCreateProperties. -func (jcp JobCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jcp.Runbook != nil { - objectMap["runbook"] = jcp.Runbook - } - if jcp.Parameters != nil { - objectMap["parameters"] = jcp.Parameters - } - if jcp.RunOn != nil { - objectMap["runOn"] = jcp.RunOn - } - return json.Marshal(objectMap) -} - -// JobListResultV2 the response model for the list job operation. -type JobListResultV2 struct { - autorest.Response `json:"-"` - // Value - List of jobs. - Value *[]JobCollectionItem `json:"value,omitempty"` - // NextLink - READ-ONLY; The link to the next page. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobListResultV2. -func (jlrv JobListResultV2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jlrv.Value != nil { - objectMap["value"] = jlrv.Value - } - return json.Marshal(objectMap) -} - -// JobListResultV2Iterator provides access to a complete listing of JobCollectionItem values. -type JobListResultV2Iterator struct { - i int - page JobListResultV2Page -} - -// 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 *JobListResultV2Iterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultV2Iterator.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 *JobListResultV2Iterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobListResultV2Iterator) 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 JobListResultV2Iterator) Response() JobListResultV2 { - 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 JobListResultV2Iterator) Value() JobCollectionItem { - if !iter.page.NotDone() { - return JobCollectionItem{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobListResultV2Iterator type. -func NewJobListResultV2Iterator(page JobListResultV2Page) JobListResultV2Iterator { - return JobListResultV2Iterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jlrv JobListResultV2) IsEmpty() bool { - return jlrv.Value == nil || len(*jlrv.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jlrv JobListResultV2) hasNextLink() bool { - return jlrv.NextLink != nil && len(*jlrv.NextLink) != 0 -} - -// jobListResultV2Preparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jlrv JobListResultV2) jobListResultV2Preparer(ctx context.Context) (*http.Request, error) { - if !jlrv.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jlrv.NextLink))) -} - -// JobListResultV2Page contains a page of JobCollectionItem values. -type JobListResultV2Page struct { - fn func(context.Context, JobListResultV2) (JobListResultV2, error) - jlrv JobListResultV2 -} - -// 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 *JobListResultV2Page) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultV2Page.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.jlrv) - if err != nil { - return err - } - page.jlrv = 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 *JobListResultV2Page) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobListResultV2Page) NotDone() bool { - return !page.jlrv.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobListResultV2Page) Response() JobListResultV2 { - return page.jlrv -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobListResultV2Page) Values() []JobCollectionItem { - if page.jlrv.IsEmpty() { - return nil - } - return *page.jlrv.Value -} - -// Creates a new instance of the JobListResultV2Page type. -func NewJobListResultV2Page(cur JobListResultV2, getNextPage func(context.Context, JobListResultV2) (JobListResultV2, error)) JobListResultV2Page { - return JobListResultV2Page{ - fn: getNextPage, - jlrv: cur, - } -} - -// JobNavigation software update configuration machine run job navigation properties. -type JobNavigation struct { - // ID - READ-ONLY; Id of the job associated with the software update configuration run - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobNavigation. -func (jn JobNavigation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobProperties definition of job properties. -type JobProperties struct { - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // StartedBy - Gets or sets the job started by. - StartedBy *string `json:"startedBy,omitempty"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` - // JobID - Gets or sets the id of the job. - JobID *uuid.UUID `json:"jobId,omitempty"` - // CreationTime - Gets or sets the creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Status - Gets or sets the status of the job. Possible values include: 'JobStatusNew', 'JobStatusActivating', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusStopped', 'JobStatusBlocked', 'JobStatusSuspended', 'JobStatusDisconnected', 'JobStatusSuspending', 'JobStatusStopping', 'JobStatusResuming', 'JobStatusRemoving' - Status JobStatus `json:"status,omitempty"` - // StatusDetails - Gets or sets the status details of the job. - StatusDetails *string `json:"statusDetails,omitempty"` - // StartTime - Gets or sets the start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Gets or sets the end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // Exception - Gets or sets the exception of the job. - Exception *string `json:"exception,omitempty"` - // LastModifiedTime - Gets or sets the last modified time of the job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastStatusModifiedTime - Gets or sets the last status modified time of the job. - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // ProvisioningState - The current provisioning state of the job. Possible values include: 'JobProvisioningStateFailed', 'JobProvisioningStateSucceeded', 'JobProvisioningStateSuspended', 'JobProvisioningStateProcessing' - ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobProperties. -func (jp JobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jp.Runbook != nil { - objectMap["runbook"] = jp.Runbook - } - if jp.StartedBy != nil { - objectMap["startedBy"] = jp.StartedBy - } - if jp.RunOn != nil { - objectMap["runOn"] = jp.RunOn - } - if jp.JobID != nil { - objectMap["jobId"] = jp.JobID - } - if jp.CreationTime != nil { - objectMap["creationTime"] = jp.CreationTime - } - if jp.Status != "" { - objectMap["status"] = jp.Status - } - if jp.StatusDetails != nil { - objectMap["statusDetails"] = jp.StatusDetails - } - if jp.StartTime != nil { - objectMap["startTime"] = jp.StartTime - } - if jp.EndTime != nil { - objectMap["endTime"] = jp.EndTime - } - if jp.Exception != nil { - objectMap["exception"] = jp.Exception - } - if jp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = jp.LastModifiedTime - } - if jp.LastStatusModifiedTime != nil { - objectMap["lastStatusModifiedTime"] = jp.LastStatusModifiedTime - } - if jp.Parameters != nil { - objectMap["parameters"] = jp.Parameters - } - if jp.ProvisioningState != "" { - objectMap["provisioningState"] = jp.ProvisioningState - } - return json.Marshal(objectMap) -} - -// JobSchedule definition of the job schedule. -type JobSchedule struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Gets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the name of the variable. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // JobScheduleProperties - Gets or sets the properties of the job schedule. - *JobScheduleProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobSchedule. -func (js JobSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if js.JobScheduleProperties != nil { - objectMap["properties"] = js.JobScheduleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobSchedule struct. -func (js *JobSchedule) 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 - } - js.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - js.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - js.Type = &typeVar - } - case "properties": - if v != nil { - var jobScheduleProperties JobScheduleProperties - err = json.Unmarshal(*v, &jobScheduleProperties) - if err != nil { - return err - } - js.JobScheduleProperties = &jobScheduleProperties - } - } - } - - return nil -} - -// JobScheduleCreateParameters the parameters supplied to the create job schedule operation. -type JobScheduleCreateParameters struct { - // JobScheduleCreateProperties - Gets or sets the list of job schedule properties. - *JobScheduleCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobScheduleCreateParameters. -func (jscp JobScheduleCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jscp.JobScheduleCreateProperties != nil { - objectMap["properties"] = jscp.JobScheduleCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobScheduleCreateParameters struct. -func (jscp *JobScheduleCreateParameters) 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 jobScheduleCreateProperties JobScheduleCreateProperties - err = json.Unmarshal(*v, &jobScheduleCreateProperties) - if err != nil { - return err - } - jscp.JobScheduleCreateProperties = &jobScheduleCreateProperties - } - } - } - - return nil -} - -// JobScheduleCreateProperties the parameters supplied to the create job schedule operation. -type JobScheduleCreateProperties struct { - // Schedule - Gets or sets the schedule. - Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the hybrid worker group that the scheduled job should run on. - RunOn *string `json:"runOn,omitempty"` - // Parameters - Gets or sets a list of job properties. - Parameters map[string]*string `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for JobScheduleCreateProperties. -func (jscp JobScheduleCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jscp.Schedule != nil { - objectMap["schedule"] = jscp.Schedule - } - if jscp.Runbook != nil { - objectMap["runbook"] = jscp.Runbook - } - if jscp.RunOn != nil { - objectMap["runOn"] = jscp.RunOn - } - if jscp.Parameters != nil { - objectMap["parameters"] = jscp.Parameters - } - return json.Marshal(objectMap) -} - -// JobScheduleListResult the response model for the list job schedule operation. -type JobScheduleListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of job schedules. - Value *[]JobSchedule `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// JobScheduleListResultIterator provides access to a complete listing of JobSchedule values. -type JobScheduleListResultIterator struct { - i int - page JobScheduleListResultPage -} - -// 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 *JobScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleListResultIterator.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 *JobScheduleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobScheduleListResultIterator) 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 JobScheduleListResultIterator) Response() JobScheduleListResult { - 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 JobScheduleListResultIterator) Value() JobSchedule { - if !iter.page.NotDone() { - return JobSchedule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobScheduleListResultIterator type. -func NewJobScheduleListResultIterator(page JobScheduleListResultPage) JobScheduleListResultIterator { - return JobScheduleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jslr JobScheduleListResult) IsEmpty() bool { - return jslr.Value == nil || len(*jslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jslr JobScheduleListResult) hasNextLink() bool { - return jslr.NextLink != nil && len(*jslr.NextLink) != 0 -} - -// jobScheduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jslr JobScheduleListResult) jobScheduleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jslr.NextLink))) -} - -// JobScheduleListResultPage contains a page of JobSchedule values. -type JobScheduleListResultPage struct { - fn func(context.Context, JobScheduleListResult) (JobScheduleListResult, error) - jslr JobScheduleListResult -} - -// 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 *JobScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleListResultPage.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.jslr) - if err != nil { - return err - } - page.jslr = 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 *JobScheduleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobScheduleListResultPage) NotDone() bool { - return !page.jslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobScheduleListResultPage) Response() JobScheduleListResult { - return page.jslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobScheduleListResultPage) Values() []JobSchedule { - if page.jslr.IsEmpty() { - return nil - } - return *page.jslr.Value -} - -// Creates a new instance of the JobScheduleListResultPage type. -func NewJobScheduleListResultPage(cur JobScheduleListResult, getNextPage func(context.Context, JobScheduleListResult) (JobScheduleListResult, error)) JobScheduleListResultPage { - return JobScheduleListResultPage{ - fn: getNextPage, - jslr: cur, - } -} - -// JobScheduleProperties definition of job schedule parameters. -type JobScheduleProperties struct { - // JobScheduleID - Gets or sets the id of job schedule. - JobScheduleID *string `json:"jobScheduleId,omitempty"` - // Schedule - Gets or sets the schedule. - Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the hybrid worker group that the scheduled job should run on. - RunOn *string `json:"runOn,omitempty"` - // Parameters - Gets or sets the parameters of the job schedule. - Parameters map[string]*string `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for JobScheduleProperties. -func (jsp JobScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jsp.JobScheduleID != nil { - objectMap["jobScheduleId"] = jsp.JobScheduleID - } - if jsp.Schedule != nil { - objectMap["schedule"] = jsp.Schedule - } - if jsp.Runbook != nil { - objectMap["runbook"] = jsp.Runbook - } - if jsp.RunOn != nil { - objectMap["runOn"] = jsp.RunOn - } - if jsp.Parameters != nil { - objectMap["parameters"] = jsp.Parameters - } - return json.Marshal(objectMap) -} - -// JobStream definition of the job stream. -type JobStream struct { - autorest.Response `json:"-"` - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // JobStreamProperties - Gets or sets the id of the job stream. - *JobStreamProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobStream. -func (js JobStream) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if js.ID != nil { - objectMap["id"] = js.ID - } - if js.JobStreamProperties != nil { - objectMap["properties"] = js.JobStreamProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobStream struct. -func (js *JobStream) 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 - } - js.ID = &ID - } - case "properties": - if v != nil { - var jobStreamProperties JobStreamProperties - err = json.Unmarshal(*v, &jobStreamProperties) - if err != nil { - return err - } - js.JobStreamProperties = &jobStreamProperties - } - } - } - - return nil -} - -// JobStreamListResult the response model for the list job stream operation. -type JobStreamListResult struct { - autorest.Response `json:"-"` - // Value - A list of job streams. - Value *[]JobStream `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// JobStreamListResultIterator provides access to a complete listing of JobStream values. -type JobStreamListResultIterator struct { - i int - page JobStreamListResultPage -} - -// 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 *JobStreamListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamListResultIterator.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 *JobStreamListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobStreamListResultIterator) 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 JobStreamListResultIterator) Response() JobStreamListResult { - 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 JobStreamListResultIterator) Value() JobStream { - if !iter.page.NotDone() { - return JobStream{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobStreamListResultIterator type. -func NewJobStreamListResultIterator(page JobStreamListResultPage) JobStreamListResultIterator { - return JobStreamListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jslr JobStreamListResult) IsEmpty() bool { - return jslr.Value == nil || len(*jslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jslr JobStreamListResult) hasNextLink() bool { - return jslr.NextLink != nil && len(*jslr.NextLink) != 0 -} - -// jobStreamListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jslr JobStreamListResult) jobStreamListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jslr.NextLink))) -} - -// JobStreamListResultPage contains a page of JobStream values. -type JobStreamListResultPage struct { - fn func(context.Context, JobStreamListResult) (JobStreamListResult, error) - jslr JobStreamListResult -} - -// 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 *JobStreamListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamListResultPage.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.jslr) - if err != nil { - return err - } - page.jslr = 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 *JobStreamListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobStreamListResultPage) NotDone() bool { - return !page.jslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobStreamListResultPage) Response() JobStreamListResult { - return page.jslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobStreamListResultPage) Values() []JobStream { - if page.jslr.IsEmpty() { - return nil - } - return *page.jslr.Value -} - -// Creates a new instance of the JobStreamListResultPage type. -func NewJobStreamListResultPage(cur JobStreamListResult, getNextPage func(context.Context, JobStreamListResult) (JobStreamListResult, error)) JobStreamListResultPage { - return JobStreamListResultPage{ - fn: getNextPage, - jslr: cur, - } -} - -// JobStreamProperties definition of the job stream. -type JobStreamProperties struct { - // JobStreamID - Gets or sets the id of the job stream. - JobStreamID *string `json:"jobStreamId,omitempty"` - // Time - Gets or sets the creation time of the job. - Time *date.Time `json:"time,omitempty"` - // StreamType - Gets or sets the stream type. Possible values include: 'Progress', 'Output', 'Warning', 'Error', 'Debug', 'Verbose', 'Any' - StreamType JobStreamType `json:"streamType,omitempty"` - // StreamText - Gets or sets the stream text. - StreamText *string `json:"streamText,omitempty"` - // Summary - Gets or sets the summary. - Summary *string `json:"summary,omitempty"` - // Value - Gets or sets the values of the job stream. - Value map[string]interface{} `json:"value"` -} - -// MarshalJSON is the custom marshaler for JobStreamProperties. -func (jsp JobStreamProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jsp.JobStreamID != nil { - objectMap["jobStreamId"] = jsp.JobStreamID - } - if jsp.Time != nil { - objectMap["time"] = jsp.Time - } - if jsp.StreamType != "" { - objectMap["streamType"] = jsp.StreamType - } - if jsp.StreamText != nil { - objectMap["streamText"] = jsp.StreamText - } - if jsp.Summary != nil { - objectMap["summary"] = jsp.Summary - } - if jsp.Value != nil { - objectMap["value"] = jsp.Value - } - return json.Marshal(objectMap) -} - -// Key automation key which is used to register a DSC Node -type Key struct { - // KeyName - READ-ONLY; Automation key name. Possible values include: 'KeyNamePrimary', 'KeyNameSecondary' - KeyName KeyName `json:"KeyName,omitempty"` - // Permissions - READ-ONLY; Automation key permissions. Possible values include: 'Read', 'Full' - Permissions KeyPermissions `json:"Permissions,omitempty"` - // Value - READ-ONLY; Value of the Automation Key used for registration. - Value *string `json:"Value,omitempty"` -} - -// MarshalJSON is the custom marshaler for Key. -func (kVar Key) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// KeyListResult ... -type KeyListResult struct { - autorest.Response `json:"-"` - // Keys - Lists the automation keys. - Keys *[]Key `json:"keys,omitempty"` -} - -// LinkedWorkspace definition of the linked workspace. -type LinkedWorkspace struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Gets the id of the linked workspace. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedWorkspace. -func (lw LinkedWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LinuxProperties linux specific update configuration. -type LinuxProperties struct { - // IncludedPackageClassifications - Update classifications included in the software update configuration. Possible values include: 'Unclassified', 'Critical', 'Security', 'Other' - IncludedPackageClassifications LinuxUpdateClasses `json:"includedPackageClassifications,omitempty"` - // ExcludedPackageNameMasks - packages excluded from the software update configuration. - ExcludedPackageNameMasks *[]string `json:"excludedPackageNameMasks,omitempty"` - // IncludedPackageNameMasks - packages included from the software update configuration. - IncludedPackageNameMasks *[]string `json:"includedPackageNameMasks,omitempty"` - // RebootSetting - Reboot setting for the software update configuration. - RebootSetting *string `json:"rebootSetting,omitempty"` -} - -// Module definition of the module type. -type Module struct { - autorest.Response `json:"-"` - // ModuleProperties - Gets or sets the module properties. - *ModuleProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Module. -func (mVar Module) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.ModuleProperties != nil { - objectMap["properties"] = mVar.ModuleProperties - } - if mVar.Etag != nil { - objectMap["etag"] = mVar.Etag - } - if mVar.Tags != nil { - objectMap["tags"] = mVar.Tags - } - if mVar.Location != nil { - objectMap["location"] = mVar.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Module struct. -func (mVar *Module) 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 moduleProperties ModuleProperties - err = json.Unmarshal(*v, &moduleProperties) - if err != nil { - return err - } - mVar.ModuleProperties = &moduleProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - mVar.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mVar.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mVar.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mVar.Type = &typeVar - } - } - } - - return nil -} - -// ModuleCreateOrUpdateParameters the parameters supplied to the create or update module operation. -type ModuleCreateOrUpdateParameters struct { - // ModuleCreateOrUpdateProperties - Gets or sets the module create properties. - *ModuleCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ModuleCreateOrUpdateParameters. -func (mcoup ModuleCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcoup.ModuleCreateOrUpdateProperties != nil { - objectMap["properties"] = mcoup.ModuleCreateOrUpdateProperties - } - if mcoup.Name != nil { - objectMap["name"] = mcoup.Name - } - if mcoup.Location != nil { - objectMap["location"] = mcoup.Location - } - if mcoup.Tags != nil { - objectMap["tags"] = mcoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ModuleCreateOrUpdateParameters struct. -func (mcoup *ModuleCreateOrUpdateParameters) 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 moduleCreateOrUpdateProperties ModuleCreateOrUpdateProperties - err = json.Unmarshal(*v, &moduleCreateOrUpdateProperties) - if err != nil { - return err - } - mcoup.ModuleCreateOrUpdateProperties = &moduleCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mcoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mcoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mcoup.Tags = tags - } - } - } - - return nil -} - -// ModuleCreateOrUpdateProperties the parameters supplied to the create or update module properties. -type ModuleCreateOrUpdateProperties struct { - // ContentLink - Gets or sets the module content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// ModuleErrorInfo definition of the module error info type. -type ModuleErrorInfo struct { - // Code - Gets or sets the error code. - Code *string `json:"code,omitempty"` - // Message - Gets or sets the error message. - Message *string `json:"message,omitempty"` -} - -// ModuleListResult the response model for the list module operation. -type ModuleListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of modules. - Value *[]Module `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ModuleListResultIterator provides access to a complete listing of Module values. -type ModuleListResultIterator struct { - i int - page ModuleListResultPage -} - -// 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 *ModuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleListResultIterator.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 *ModuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ModuleListResultIterator) 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 ModuleListResultIterator) Response() ModuleListResult { - 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 ModuleListResultIterator) Value() Module { - if !iter.page.NotDone() { - return Module{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ModuleListResultIterator type. -func NewModuleListResultIterator(page ModuleListResultPage) ModuleListResultIterator { - return ModuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mlr ModuleListResult) IsEmpty() bool { - return mlr.Value == nil || len(*mlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mlr ModuleListResult) hasNextLink() bool { - return mlr.NextLink != nil && len(*mlr.NextLink) != 0 -} - -// moduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mlr ModuleListResult) moduleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mlr.NextLink))) -} - -// ModuleListResultPage contains a page of Module values. -type ModuleListResultPage struct { - fn func(context.Context, ModuleListResult) (ModuleListResult, error) - mlr ModuleListResult -} - -// 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 *ModuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleListResultPage.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.mlr) - if err != nil { - return err - } - page.mlr = 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 *ModuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ModuleListResultPage) NotDone() bool { - return !page.mlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ModuleListResultPage) Response() ModuleListResult { - return page.mlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ModuleListResultPage) Values() []Module { - if page.mlr.IsEmpty() { - return nil - } - return *page.mlr.Value -} - -// Creates a new instance of the ModuleListResultPage type. -func NewModuleListResultPage(cur ModuleListResult, getNextPage func(context.Context, ModuleListResult) (ModuleListResult, error)) ModuleListResultPage { - return ModuleListResultPage{ - fn: getNextPage, - mlr: cur, - } -} - -// ModuleProperties definition of the module property type. -type ModuleProperties struct { - // IsGlobal - Gets or sets the isGlobal flag of the module. - IsGlobal *bool `json:"isGlobal,omitempty"` - // Version - Gets or sets the version of the module. - Version *string `json:"version,omitempty"` - // SizeInBytes - Gets or sets the size in bytes of the module. - SizeInBytes *int64 `json:"sizeInBytes,omitempty"` - // ActivityCount - Gets or sets the activity count of the module. - ActivityCount *int32 `json:"activityCount,omitempty"` - // ProvisioningState - Gets or sets the provisioning state of the module. Possible values include: 'ModuleProvisioningStateCreated', 'ModuleProvisioningStateCreating', 'ModuleProvisioningStateStartingImportModuleRunbook', 'ModuleProvisioningStateRunningImportModuleRunbook', 'ModuleProvisioningStateContentRetrieved', 'ModuleProvisioningStateContentDownloaded', 'ModuleProvisioningStateContentValidated', 'ModuleProvisioningStateConnectionTypeImported', 'ModuleProvisioningStateContentStored', 'ModuleProvisioningStateModuleDataStored', 'ModuleProvisioningStateActivitiesStored', 'ModuleProvisioningStateModuleImportRunbookComplete', 'ModuleProvisioningStateSucceeded', 'ModuleProvisioningStateFailed', 'ModuleProvisioningStateCancelled', 'ModuleProvisioningStateUpdating' - ProvisioningState ModuleProvisioningState `json:"provisioningState,omitempty"` - // ContentLink - Gets or sets the contentLink of the module. - ContentLink *ContentLink `json:"contentLink,omitempty"` - // Error - Gets or sets the error info of the module. - Error *ModuleErrorInfo `json:"error,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` - // IsComposite - Gets or sets type of module, if its composite or not. - IsComposite *bool `json:"isComposite,omitempty"` -} - -// ModuleUpdateParameters the parameters supplied to the update module operation. -type ModuleUpdateParameters struct { - // ModuleUpdateProperties - Gets or sets the module update properties. - *ModuleUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ModuleUpdateParameters. -func (mup ModuleUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mup.ModuleUpdateProperties != nil { - objectMap["properties"] = mup.ModuleUpdateProperties - } - if mup.Name != nil { - objectMap["name"] = mup.Name - } - if mup.Location != nil { - objectMap["location"] = mup.Location - } - if mup.Tags != nil { - objectMap["tags"] = mup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ModuleUpdateParameters struct. -func (mup *ModuleUpdateParameters) 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 moduleUpdateProperties ModuleUpdateProperties - err = json.Unmarshal(*v, &moduleUpdateProperties) - if err != nil { - return err - } - mup.ModuleUpdateProperties = &moduleUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mup.Tags = tags - } - } - } - - return nil -} - -// ModuleUpdateProperties the parameters supplied to the update properties. -type ModuleUpdateProperties struct { - // ContentLink - Gets or sets the module content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// NodeCount number of nodes based on the Filter -type NodeCount struct { - // Name - Gets the name of a count type - Name *string `json:"name,omitempty"` - Properties *NodeCountProperties `json:"properties,omitempty"` -} - -// NodeCountProperties ... -type NodeCountProperties struct { - // Count - Gets the count for the name - Count *int32 `json:"count,omitempty"` -} - -// NodeCounts gets the count of nodes by count type -type NodeCounts struct { - autorest.Response `json:"-"` - // Value - Gets an array of counts - Value *[]NodeCount `json:"value,omitempty"` - // TotalCount - Gets the total number of records matching countType criteria. - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// NonAzureQueryProperties non Azure query for the update configuration. -type NonAzureQueryProperties struct { - // FunctionAlias - Log Analytics Saved Search name. - FunctionAlias *string `json:"functionAlias,omitempty"` - // WorkspaceID - Workspace Id for Log Analytics in which the saved Search is resided. - WorkspaceID *string `json:"workspaceId,omitempty"` -} - -// Operation automation REST API operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Provider, Resource and Operation values - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay provider, Resource and Operation values -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Automation - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Runbooks, Jobs etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult the response model for the list of Automation operations -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Automation operations supported by the Automation resource provider. - Value *[]Operation `json:"value,omitempty"` -} - -// ProxyResource ARM proxy resource. -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReadCloser ... -type ReadCloser struct { - autorest.Response `json:"-"` - Value *io.ReadCloser `json:"value,omitempty"` -} - -// Resource the core properties of ARM resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RunAsCredentialAssociationProperty definition of RunAs credential to use for hybrid worker. -type RunAsCredentialAssociationProperty struct { - // Name - Gets or sets the name of the credential. - Name *string `json:"name,omitempty"` -} - -// Runbook definition of the runbook type. -type Runbook struct { - autorest.Response `json:"-"` - // RunbookProperties - Gets or sets the runbook properties. - *RunbookProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Runbook. -func (r Runbook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RunbookProperties != nil { - objectMap["properties"] = r.RunbookProperties - } - if r.Etag != nil { - objectMap["etag"] = r.Etag - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.Location != nil { - objectMap["location"] = r.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Runbook struct. -func (r *Runbook) 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 runbookProperties RunbookProperties - err = json.Unmarshal(*v, &runbookProperties) - if err != nil { - return err - } - r.RunbookProperties = &runbookProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - r.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - 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 - } - } - } - - return nil -} - -// RunbookAssociationProperty the runbook property associated with the entity. -type RunbookAssociationProperty struct { - // Name - Gets or sets the name of the runbook. - Name *string `json:"name,omitempty"` -} - -// RunbookCreateOrUpdateDraftParameters the parameters supplied to the create or update runbook operation. -type RunbookCreateOrUpdateDraftParameters struct { - // RunbookContent - Content of the Runbook. - RunbookContent *string `json:"runbookContent,omitempty"` -} - -// RunbookCreateOrUpdateDraftProperties the parameters supplied to the create or update draft runbook -// properties. -type RunbookCreateOrUpdateDraftProperties struct { - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // RunbookType - Gets or sets the type of the runbook. Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - // Draft - Gets or sets the draft runbook properties. - Draft *RunbookDraft `json:"draft,omitempty"` - // Description - Gets or sets the description of the runbook. - Description *string `json:"description,omitempty"` - // LogActivityTrace - Gets or sets the activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// RunbookCreateOrUpdateParameters the parameters supplied to the create or update runbook operation. -type RunbookCreateOrUpdateParameters struct { - // RunbookCreateOrUpdateProperties - Gets or sets runbook create or update properties. - *RunbookCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for RunbookCreateOrUpdateParameters. -func (rcoup RunbookCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rcoup.RunbookCreateOrUpdateProperties != nil { - objectMap["properties"] = rcoup.RunbookCreateOrUpdateProperties - } - if rcoup.Name != nil { - objectMap["name"] = rcoup.Name - } - if rcoup.Location != nil { - objectMap["location"] = rcoup.Location - } - if rcoup.Tags != nil { - objectMap["tags"] = rcoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RunbookCreateOrUpdateParameters struct. -func (rcoup *RunbookCreateOrUpdateParameters) 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 runbookCreateOrUpdateProperties RunbookCreateOrUpdateProperties - err = json.Unmarshal(*v, &runbookCreateOrUpdateProperties) - if err != nil { - return err - } - rcoup.RunbookCreateOrUpdateProperties = &runbookCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rcoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rcoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rcoup.Tags = tags - } - } - } - - return nil -} - -// RunbookCreateOrUpdateProperties the parameters supplied to the create or update runbook properties. -type RunbookCreateOrUpdateProperties struct { - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // RunbookType - Gets or sets the type of the runbook. Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - // Draft - Gets or sets the draft runbook properties. - Draft *RunbookDraft `json:"draft,omitempty"` - // PublishContentLink - Gets or sets the published runbook content link. - PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` - // Description - Gets or sets the description of the runbook. - Description *string `json:"description,omitempty"` - // LogActivityTrace - Gets or sets the activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// RunbookDraft ... -type RunbookDraft struct { - autorest.Response `json:"-"` - // InEdit - Gets or sets whether runbook is in edit mode. - InEdit *bool `json:"inEdit,omitempty"` - // DraftContentLink - Gets or sets the draft runbook content link. - DraftContentLink *ContentLink `json:"draftContentLink,omitempty"` - // CreationTime - Gets or sets the creation time of the runbook draft. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time of the runbook draft. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Parameters - Gets or sets the runbook draft parameters. - Parameters map[string]*RunbookParameter `json:"parameters"` - // OutputTypes - Gets or sets the runbook output types. - OutputTypes *[]string `json:"outputTypes,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunbookDraft. -func (rd RunbookDraft) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rd.InEdit != nil { - objectMap["inEdit"] = rd.InEdit - } - if rd.DraftContentLink != nil { - objectMap["draftContentLink"] = rd.DraftContentLink - } - if rd.CreationTime != nil { - objectMap["creationTime"] = rd.CreationTime - } - if rd.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = rd.LastModifiedTime - } - if rd.Parameters != nil { - objectMap["parameters"] = rd.Parameters - } - if rd.OutputTypes != nil { - objectMap["outputTypes"] = rd.OutputTypes - } - return json.Marshal(objectMap) -} - -// RunbookDraftPublishFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RunbookDraftPublishFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunbookDraftClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunbookDraftPublishFuture) 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 RunbookDraftPublishFuture.Result. -func (future *RunbookDraftPublishFuture) result(client RunbookDraftClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftPublishFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.RunbookDraftPublishFuture") - return - } - ar.Response = future.Response() - return -} - -// RunbookDraftReplaceContentFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RunbookDraftReplaceContentFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunbookDraftClient) (ReadCloser, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunbookDraftReplaceContentFuture) 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 RunbookDraftReplaceContentFuture.Result. -func (future *RunbookDraftReplaceContentFuture) result(client RunbookDraftClient) (rc ReadCloser, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.RunbookDraftReplaceContentFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rc.Response.Response, err = future.GetResult(sender); err == nil && rc.Response.Response.StatusCode != http.StatusNoContent { - rc, err = client.ReplaceContentResponder(rc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", rc.Response.Response, "Failure responding to request") - } - } - return -} - -// RunbookDraftUndoEditResult the response model for the undo edit runbook operation. -type RunbookDraftUndoEditResult struct { - autorest.Response `json:"-"` - // StatusCode - Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'Ambiguous', 'MovedPermanently', 'Moved', 'Found', 'Redirect', 'SeeOther', 'RedirectMethod', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'RedirectKeepVerb', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestURITooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HTTPVersionNotSupported' - StatusCode HTTPStatusCode `json:"statusCode,omitempty"` - RequestID *string `json:"requestId,omitempty"` -} - -// RunbookListResult the response model for the list runbook operation. -type RunbookListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of runbooks. - Value *[]Runbook `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// RunbookListResultIterator provides access to a complete listing of Runbook values. -type RunbookListResultIterator struct { - i int - page RunbookListResultPage -} - -// 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 *RunbookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookListResultIterator.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 *RunbookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RunbookListResultIterator) 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 RunbookListResultIterator) Response() RunbookListResult { - 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 RunbookListResultIterator) Value() Runbook { - if !iter.page.NotDone() { - return Runbook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RunbookListResultIterator type. -func NewRunbookListResultIterator(page RunbookListResultPage) RunbookListResultIterator { - return RunbookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RunbookListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RunbookListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// runbookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RunbookListResult) runbookListResultPreparer(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))) -} - -// RunbookListResultPage contains a page of Runbook values. -type RunbookListResultPage struct { - fn func(context.Context, RunbookListResult) (RunbookListResult, error) - rlr RunbookListResult -} - -// 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 *RunbookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookListResultPage.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 *RunbookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RunbookListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RunbookListResultPage) Response() RunbookListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RunbookListResultPage) Values() []Runbook { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RunbookListResultPage type. -func NewRunbookListResultPage(cur RunbookListResult, getNextPage func(context.Context, RunbookListResult) (RunbookListResult, error)) RunbookListResultPage { - return RunbookListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RunbookParameter definition of the runbook parameter type. -type RunbookParameter struct { - // Type - Gets or sets the type of the parameter. - Type *string `json:"type,omitempty"` - // IsMandatory - Gets or sets a Boolean value to indicate whether the parameter is mandatory or not. - IsMandatory *bool `json:"isMandatory,omitempty"` - // Position - Get or sets the position of the parameter. - Position *int32 `json:"position,omitempty"` - // DefaultValue - Gets or sets the default value of parameter. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// RunbookProperties definition of the runbook property type. -type RunbookProperties struct { - // RunbookType - Gets or sets the type of the runbook. Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - // PublishContentLink - Gets or sets the published runbook content link. - PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` - // State - Gets or sets the state of the runbook. Possible values include: 'RunbookStateNew', 'RunbookStateEdit', 'RunbookStatePublished' - State RunbookState `json:"state,omitempty"` - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // LogActivityTrace - Gets or sets the option to log activity trace of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` - // JobCount - Gets or sets the job count of the runbook. - JobCount *int32 `json:"jobCount,omitempty"` - // Parameters - Gets or sets the runbook parameters. - Parameters map[string]*RunbookParameter `json:"parameters"` - // OutputTypes - Gets or sets the runbook output types. - OutputTypes *[]string `json:"outputTypes,omitempty"` - // Draft - Gets or sets the draft runbook properties. - Draft *RunbookDraft `json:"draft,omitempty"` - // ProvisioningState - Gets or sets the provisioning state of the runbook. Possible values include: 'RunbookProvisioningStateSucceeded' - ProvisioningState RunbookProvisioningState `json:"provisioningState,omitempty"` - // LastModifiedBy - Gets or sets the last modified by. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunbookProperties. -func (rp RunbookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RunbookType != "" { - objectMap["runbookType"] = rp.RunbookType - } - if rp.PublishContentLink != nil { - objectMap["publishContentLink"] = rp.PublishContentLink - } - if rp.State != "" { - objectMap["state"] = rp.State - } - if rp.LogVerbose != nil { - objectMap["logVerbose"] = rp.LogVerbose - } - if rp.LogProgress != nil { - objectMap["logProgress"] = rp.LogProgress - } - if rp.LogActivityTrace != nil { - objectMap["logActivityTrace"] = rp.LogActivityTrace - } - if rp.JobCount != nil { - objectMap["jobCount"] = rp.JobCount - } - if rp.Parameters != nil { - objectMap["parameters"] = rp.Parameters - } - if rp.OutputTypes != nil { - objectMap["outputTypes"] = rp.OutputTypes - } - if rp.Draft != nil { - objectMap["draft"] = rp.Draft - } - if rp.ProvisioningState != "" { - objectMap["provisioningState"] = rp.ProvisioningState - } - if rp.LastModifiedBy != nil { - objectMap["lastModifiedBy"] = rp.LastModifiedBy - } - if rp.CreationTime != nil { - objectMap["creationTime"] = rp.CreationTime - } - if rp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = rp.LastModifiedTime - } - if rp.Description != nil { - objectMap["description"] = rp.Description - } - return json.Marshal(objectMap) -} - -// RunbookUpdateParameters the parameters supplied to the update runbook operation. -type RunbookUpdateParameters struct { - // RunbookUpdateProperties - Gets or sets the runbook update properties. - *RunbookUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for RunbookUpdateParameters. -func (rup RunbookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.RunbookUpdateProperties != nil { - objectMap["properties"] = rup.RunbookUpdateProperties - } - if rup.Name != nil { - objectMap["name"] = rup.Name - } - if rup.Location != nil { - objectMap["location"] = rup.Location - } - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RunbookUpdateParameters struct. -func (rup *RunbookUpdateParameters) 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 runbookUpdateProperties RunbookUpdateProperties - err = json.Unmarshal(*v, &runbookUpdateProperties) - if err != nil { - return err - } - rup.RunbookUpdateProperties = &runbookUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rup.Tags = tags - } - } - } - - return nil -} - -// RunbookUpdateProperties the parameters supplied to the update runbook properties. -type RunbookUpdateProperties struct { - // Description - Gets or sets the description of the runbook. - Description *string `json:"description,omitempty"` - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // LogActivityTrace - Gets or sets the activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// Schedule definition of the schedule. -type Schedule struct { - autorest.Response `json:"-"` - // ScheduleProperties - Gets or sets the properties of the schedule. - *ScheduleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Schedule. -func (s Schedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.ScheduleProperties != nil { - objectMap["properties"] = s.ScheduleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Schedule struct. -func (s *Schedule) 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 scheduleProperties ScheduleProperties - err = json.Unmarshal(*v, &scheduleProperties) - if err != nil { - return err - } - s.ScheduleProperties = &scheduleProperties - } - 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 - } - } - } - - return nil -} - -// ScheduleAssociationProperty the schedule property associated with the entity. -type ScheduleAssociationProperty struct { - // Name - Gets or sets the name of the Schedule. - Name *string `json:"name,omitempty"` -} - -// ScheduleCreateOrUpdateParameters the parameters supplied to the create or update schedule operation. -type ScheduleCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the Schedule. - Name *string `json:"name,omitempty"` - // ScheduleCreateOrUpdateProperties - Gets or sets the list of schedule properties. - *ScheduleCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleCreateOrUpdateParameters. -func (scoup ScheduleCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scoup.Name != nil { - objectMap["name"] = scoup.Name - } - if scoup.ScheduleCreateOrUpdateProperties != nil { - objectMap["properties"] = scoup.ScheduleCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScheduleCreateOrUpdateParameters struct. -func (scoup *ScheduleCreateOrUpdateParameters) 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 - } - scoup.Name = &name - } - case "properties": - if v != nil { - var scheduleCreateOrUpdateProperties ScheduleCreateOrUpdateProperties - err = json.Unmarshal(*v, &scheduleCreateOrUpdateProperties) - if err != nil { - return err - } - scoup.ScheduleCreateOrUpdateProperties = &scheduleCreateOrUpdateProperties - } - } - } - - return nil -} - -// ScheduleCreateOrUpdateProperties the parameters supplied to the create or update schedule operation. -type ScheduleCreateOrUpdateProperties struct { - // Description - Gets or sets the description of the schedule. - Description *string `json:"description,omitempty"` - // StartTime - Gets or sets the start time of the schedule. - StartTime *date.Time `json:"startTime,omitempty"` - // ExpiryTime - Gets or sets the end time of the schedule. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // Interval - Gets or sets the interval of the schedule. - Interval interface{} `json:"interval,omitempty"` - // Frequency - Gets or sets the frequency of the schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month', 'Minute' - Frequency ScheduleFrequency `json:"frequency,omitempty"` - // TimeZone - Gets or sets the time zone of the schedule. - TimeZone *string `json:"timeZone,omitempty"` - // AdvancedSchedule - Gets or sets the AdvancedSchedule. - AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` -} - -// ScheduleListResult the response model for the list schedule operation. -type ScheduleListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of schedules. - Value *[]Schedule `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ScheduleListResultIterator provides access to a complete listing of Schedule values. -type ScheduleListResultIterator struct { - i int - page ScheduleListResultPage -} - -// 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 *ScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleListResultIterator.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 *ScheduleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScheduleListResultIterator) 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 ScheduleListResultIterator) Response() ScheduleListResult { - 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 ScheduleListResultIterator) Value() Schedule { - if !iter.page.NotDone() { - return Schedule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScheduleListResultIterator type. -func NewScheduleListResultIterator(page ScheduleListResultPage) ScheduleListResultIterator { - return ScheduleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr ScheduleListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr ScheduleListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// scheduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr ScheduleListResult) scheduleListResultPreparer(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))) -} - -// ScheduleListResultPage contains a page of Schedule values. -type ScheduleListResultPage struct { - fn func(context.Context, ScheduleListResult) (ScheduleListResult, error) - slr ScheduleListResult -} - -// 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 *ScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleListResultPage.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 *ScheduleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScheduleListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScheduleListResultPage) Response() ScheduleListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScheduleListResultPage) Values() []Schedule { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the ScheduleListResultPage type. -func NewScheduleListResultPage(cur ScheduleListResult, getNextPage func(context.Context, ScheduleListResult) (ScheduleListResult, error)) ScheduleListResultPage { - return ScheduleListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// ScheduleProperties definition of schedule parameters. -type ScheduleProperties struct { - // StartTime - Gets or sets the start time of the schedule. - StartTime *date.Time `json:"startTime,omitempty"` - // StartTimeOffsetMinutes - READ-ONLY; Gets the start time's offset in minutes. - StartTimeOffsetMinutes *float64 `json:"startTimeOffsetMinutes,omitempty"` - // ExpiryTime - Gets or sets the end time of the schedule. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // ExpiryTimeOffsetMinutes - Gets or sets the expiry time's offset in minutes. - ExpiryTimeOffsetMinutes *float64 `json:"expiryTimeOffsetMinutes,omitempty"` - // IsEnabled - Gets or sets a value indicating whether this schedule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // NextRun - Gets or sets the next run time of the schedule. - NextRun *date.Time `json:"nextRun,omitempty"` - // NextRunOffsetMinutes - Gets or sets the next run time's offset in minutes. - NextRunOffsetMinutes *float64 `json:"nextRunOffsetMinutes,omitempty"` - // Interval - Gets or sets the interval of the schedule. - Interval *int32 `json:"interval,omitempty"` - // Frequency - Gets or sets the frequency of the schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month', 'Minute' - Frequency ScheduleFrequency `json:"frequency,omitempty"` - // TimeZone - Gets or sets the time zone of the schedule. - TimeZone *string `json:"timeZone,omitempty"` - // AdvancedSchedule - Gets or sets the advanced schedule. - AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleProperties. -func (sp ScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.StartTime != nil { - objectMap["startTime"] = sp.StartTime - } - if sp.ExpiryTime != nil { - objectMap["expiryTime"] = sp.ExpiryTime - } - if sp.ExpiryTimeOffsetMinutes != nil { - objectMap["expiryTimeOffsetMinutes"] = sp.ExpiryTimeOffsetMinutes - } - if sp.IsEnabled != nil { - objectMap["isEnabled"] = sp.IsEnabled - } - if sp.NextRun != nil { - objectMap["nextRun"] = sp.NextRun - } - if sp.NextRunOffsetMinutes != nil { - objectMap["nextRunOffsetMinutes"] = sp.NextRunOffsetMinutes - } - if sp.Interval != nil { - objectMap["interval"] = sp.Interval - } - if sp.Frequency != "" { - objectMap["frequency"] = sp.Frequency - } - if sp.TimeZone != nil { - objectMap["timeZone"] = sp.TimeZone - } - if sp.AdvancedSchedule != nil { - objectMap["advancedSchedule"] = sp.AdvancedSchedule - } - if sp.CreationTime != nil { - objectMap["creationTime"] = sp.CreationTime - } - if sp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = sp.LastModifiedTime - } - if sp.Description != nil { - objectMap["description"] = sp.Description - } - return json.Marshal(objectMap) -} - -// ScheduleUpdateParameters the parameters supplied to the update schedule operation. -type ScheduleUpdateParameters struct { - // Name - Gets or sets the name of the Schedule. - Name *string `json:"name,omitempty"` - // ScheduleUpdateProperties - Gets or sets the list of schedule properties. - *ScheduleUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleUpdateParameters. -func (sup ScheduleUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.Name != nil { - objectMap["name"] = sup.Name - } - if sup.ScheduleUpdateProperties != nil { - objectMap["properties"] = sup.ScheduleUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScheduleUpdateParameters struct. -func (sup *ScheduleUpdateParameters) 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 - } - sup.Name = &name - } - case "properties": - if v != nil { - var scheduleUpdateProperties ScheduleUpdateProperties - err = json.Unmarshal(*v, &scheduleUpdateProperties) - if err != nil { - return err - } - sup.ScheduleUpdateProperties = &scheduleUpdateProperties - } - } - } - - return nil -} - -// ScheduleUpdateProperties the parameters supplied to the update schedule operation. -type ScheduleUpdateProperties struct { - // Description - Gets or sets the description of the schedule. - Description *string `json:"description,omitempty"` - // IsEnabled - Gets or sets a value indicating whether this schedule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// SetObject ... -type SetObject struct { - autorest.Response `json:"-"` - Value interface{} `json:"value,omitempty"` -} - -// Sku the account SKU. -type Sku struct { - // Name - Gets or sets the SKU name of the account. Possible values include: 'Free', 'Basic' - Name SkuNameEnum `json:"name,omitempty"` - // Family - Gets or sets the SKU family. - Family *string `json:"family,omitempty"` - // Capacity - Gets or sets the SKU capacity. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SoftareUpdateConfigurationRunTaskProperties task properties of the software update configuration. -type SoftareUpdateConfigurationRunTaskProperties struct { - // Status - The status of the task. - Status *string `json:"status,omitempty"` - // Source - The name of the source of the task. - Source *string `json:"source,omitempty"` - // JobID - The job id of the task. - JobID *string `json:"jobId,omitempty"` -} - -// SoftareUpdateConfigurationRunTasks software update configuration run tasks model. -type SoftareUpdateConfigurationRunTasks struct { - // PreTask - Pre task properties. - PreTask *SoftareUpdateConfigurationRunTaskProperties `json:"preTask,omitempty"` - // PostTask - Post task properties. - PostTask *SoftareUpdateConfigurationRunTaskProperties `json:"postTask,omitempty"` -} - -// SoftwareUpdateConfiguration software update configuration properties. -type SoftwareUpdateConfiguration struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // SoftwareUpdateConfigurationProperties - Software update configuration properties. - *SoftwareUpdateConfigurationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfiguration. -func (suc SoftwareUpdateConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if suc.SoftwareUpdateConfigurationProperties != nil { - objectMap["properties"] = suc.SoftwareUpdateConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfiguration struct. -func (suc *SoftwareUpdateConfiguration) 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 - } - suc.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - suc.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - suc.Type = &typeVar - } - case "properties": - if v != nil { - var softwareUpdateConfigurationProperties SoftwareUpdateConfigurationProperties - err = json.Unmarshal(*v, &softwareUpdateConfigurationProperties) - if err != nil { - return err - } - suc.SoftwareUpdateConfigurationProperties = &softwareUpdateConfigurationProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationCollectionItem software update configuration collection item properties. -type SoftwareUpdateConfigurationCollectionItem struct { - // Name - READ-ONLY; Name of the software update configuration. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id of the software update configuration - ID *string `json:"id,omitempty"` - // SoftwareUpdateConfigurationCollectionItemProperties - Software update configuration properties. - *SoftwareUpdateConfigurationCollectionItemProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationCollectionItem. -func (succi SoftwareUpdateConfigurationCollectionItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if succi.SoftwareUpdateConfigurationCollectionItemProperties != nil { - objectMap["properties"] = succi.SoftwareUpdateConfigurationCollectionItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfigurationCollectionItem struct. -func (succi *SoftwareUpdateConfigurationCollectionItem) 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 - } - succi.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - succi.ID = &ID - } - case "properties": - if v != nil { - var softwareUpdateConfigurationCollectionItemProperties SoftwareUpdateConfigurationCollectionItemProperties - err = json.Unmarshal(*v, &softwareUpdateConfigurationCollectionItemProperties) - if err != nil { - return err - } - succi.SoftwareUpdateConfigurationCollectionItemProperties = &softwareUpdateConfigurationCollectionItemProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationCollectionItemProperties software update configuration collection item -// properties. -type SoftwareUpdateConfigurationCollectionItemProperties struct { - // UpdateConfiguration - Update specific properties of the software update configuration. - UpdateConfiguration *CollectionItemUpdateConfiguration `json:"updateConfiguration,omitempty"` - // Frequency - execution frequency of the schedule associated with the software update configuration. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month', 'Minute' - Frequency ScheduleFrequency `json:"frequency,omitempty"` - // StartTime - the start time of the update. - StartTime *date.Time `json:"startTime,omitempty"` - // CreationTime - READ-ONLY; Creation time of the software update configuration, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Last time software update configuration was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state for the software update configuration, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // NextRun - ext run time of the update. - NextRun *date.Time `json:"nextRun,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationCollectionItemProperties. -func (succip SoftwareUpdateConfigurationCollectionItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if succip.UpdateConfiguration != nil { - objectMap["updateConfiguration"] = succip.UpdateConfiguration - } - if succip.Frequency != "" { - objectMap["frequency"] = succip.Frequency - } - if succip.StartTime != nil { - objectMap["startTime"] = succip.StartTime - } - if succip.NextRun != nil { - objectMap["nextRun"] = succip.NextRun - } - return json.Marshal(objectMap) -} - -// SoftwareUpdateConfigurationListResult result of listing all software update configuration -type SoftwareUpdateConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - outer object returned when listing all software update configurations - Value *[]SoftwareUpdateConfigurationCollectionItem `json:"value,omitempty"` -} - -// SoftwareUpdateConfigurationMachineRun software update configuration machine run model. -type SoftwareUpdateConfigurationMachineRun struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Name of the software update configuration machine run - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id of the software update configuration machine run - ID *string `json:"id,omitempty"` - // UpdateConfigurationMachineRunProperties - Software update configuration machine run properties. - *UpdateConfigurationMachineRunProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationMachineRun. -func (sucmr SoftwareUpdateConfigurationMachineRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucmr.UpdateConfigurationMachineRunProperties != nil { - objectMap["properties"] = sucmr.UpdateConfigurationMachineRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfigurationMachineRun struct. -func (sucmr *SoftwareUpdateConfigurationMachineRun) 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 - } - sucmr.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sucmr.ID = &ID - } - case "properties": - if v != nil { - var updateConfigurationMachineRunProperties UpdateConfigurationMachineRunProperties - err = json.Unmarshal(*v, &updateConfigurationMachineRunProperties) - if err != nil { - return err - } - sucmr.UpdateConfigurationMachineRunProperties = &updateConfigurationMachineRunProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationMachineRunListResult result of listing all software update configuration -// machine runs -type SoftwareUpdateConfigurationMachineRunListResult struct { - autorest.Response `json:"-"` - // Value - outer object returned when listing all software update configuration machine runs - Value *[]SoftwareUpdateConfigurationMachineRun `json:"value,omitempty"` - // NextLink - link to next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SoftwareUpdateConfigurationProperties software update configuration properties. -type SoftwareUpdateConfigurationProperties struct { - // UpdateConfiguration - update specific properties for the Software update configuration - UpdateConfiguration *UpdateConfiguration `json:"updateConfiguration,omitempty"` - // ScheduleInfo - Schedule information for the Software update configuration - ScheduleInfo *ScheduleProperties `json:"scheduleInfo,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state for the software update configuration, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Error - Details of provisioning error - Error *ErrorResponse `json:"error,omitempty"` - // CreationTime - READ-ONLY; Creation time of the resource, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CreatedBy - READ-ONLY; CreatedBy property, which only appears in the response. - CreatedBy *string `json:"createdBy,omitempty"` - // LastModifiedTime - READ-ONLY; Last time resource was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; LastModifiedBy property, which only appears in the response. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Tasks - Tasks information for the Software update configuration. - Tasks *SoftwareUpdateConfigurationTasks `json:"tasks,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationProperties. -func (sucp SoftwareUpdateConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucp.UpdateConfiguration != nil { - objectMap["updateConfiguration"] = sucp.UpdateConfiguration - } - if sucp.ScheduleInfo != nil { - objectMap["scheduleInfo"] = sucp.ScheduleInfo - } - if sucp.Error != nil { - objectMap["error"] = sucp.Error - } - if sucp.Tasks != nil { - objectMap["tasks"] = sucp.Tasks - } - return json.Marshal(objectMap) -} - -// SoftwareUpdateConfigurationRun software update configuration Run properties. -type SoftwareUpdateConfigurationRun struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Name of the software update configuration run. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id of the software update configuration run - ID *string `json:"id,omitempty"` - // SoftwareUpdateConfigurationRunProperties - Software update configuration Run properties. - *SoftwareUpdateConfigurationRunProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationRun. -func (sucr SoftwareUpdateConfigurationRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucr.SoftwareUpdateConfigurationRunProperties != nil { - objectMap["properties"] = sucr.SoftwareUpdateConfigurationRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfigurationRun struct. -func (sucr *SoftwareUpdateConfigurationRun) 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 - } - sucr.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sucr.ID = &ID - } - case "properties": - if v != nil { - var softwareUpdateConfigurationRunProperties SoftwareUpdateConfigurationRunProperties - err = json.Unmarshal(*v, &softwareUpdateConfigurationRunProperties) - if err != nil { - return err - } - sucr.SoftwareUpdateConfigurationRunProperties = &softwareUpdateConfigurationRunProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationRunListResult result of listing all software update configuration runs -type SoftwareUpdateConfigurationRunListResult struct { - autorest.Response `json:"-"` - // Value - outer object returned when listing all software update configuration runs - Value *[]SoftwareUpdateConfigurationRun `json:"value,omitempty"` - // NextLink - link to next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SoftwareUpdateConfigurationRunProperties software update configuration properties. -type SoftwareUpdateConfigurationRunProperties struct { - // SoftwareUpdateConfiguration - software update configuration triggered this run - SoftwareUpdateConfiguration *UpdateConfigurationNavigation `json:"softwareUpdateConfiguration,omitempty"` - // Status - READ-ONLY; Status of the software update configuration run. - Status *string `json:"status,omitempty"` - // ConfiguredDuration - READ-ONLY; Configured duration for the software update configuration run. - ConfiguredDuration *string `json:"configuredDuration,omitempty"` - // OsType - READ-ONLY; Operating system target of the software update configuration triggered this run - OsType *string `json:"osType,omitempty"` - // StartTime - READ-ONLY; Start time of the software update configuration run. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; End time of the software update configuration run. - EndTime *date.Time `json:"endTime,omitempty"` - // ComputerCount - READ-ONLY; Number of computers in the software update configuration run. - ComputerCount *int32 `json:"computerCount,omitempty"` - // FailedCount - READ-ONLY; Number of computers with failed status. - FailedCount *int32 `json:"failedCount,omitempty"` - // CreationTime - READ-ONLY; Creation time of the resource, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CreatedBy - READ-ONLY; CreatedBy property, which only appears in the response. - CreatedBy *string `json:"createdBy,omitempty"` - // LastModifiedTime - READ-ONLY; Last time resource was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; LastModifiedBy property, which only appears in the response. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Tasks - Software update configuration tasks triggered in this run - Tasks *SoftareUpdateConfigurationRunTasks `json:"tasks,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationRunProperties. -func (sucrp SoftwareUpdateConfigurationRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucrp.SoftwareUpdateConfiguration != nil { - objectMap["softwareUpdateConfiguration"] = sucrp.SoftwareUpdateConfiguration - } - if sucrp.Tasks != nil { - objectMap["tasks"] = sucrp.Tasks - } - return json.Marshal(objectMap) -} - -// SoftwareUpdateConfigurationTasks task properties of the software update configuration. -type SoftwareUpdateConfigurationTasks struct { - // PreTask - Pre task properties. - PreTask *TaskProperties `json:"preTask,omitempty"` - // PostTask - Post task properties. - PostTask *TaskProperties `json:"postTask,omitempty"` -} - -// SourceControl definition of the source control. -type SourceControl struct { - autorest.Response `json:"-"` - // SourceControlProperties - The properties of the source control. - *SourceControlProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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 - } - 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 "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 - } - } - } - - return nil -} - -// SourceControlCreateOrUpdateParameters the parameters supplied to the create or update source control -// operation. -type SourceControlCreateOrUpdateParameters struct { - // SourceControlCreateOrUpdateProperties - The properties of the source control. - *SourceControlCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlCreateOrUpdateParameters. -func (sccoup SourceControlCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccoup.SourceControlCreateOrUpdateProperties != nil { - objectMap["properties"] = sccoup.SourceControlCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlCreateOrUpdateParameters struct. -func (sccoup *SourceControlCreateOrUpdateParameters) 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 sourceControlCreateOrUpdateProperties SourceControlCreateOrUpdateProperties - err = json.Unmarshal(*v, &sourceControlCreateOrUpdateProperties) - if err != nil { - return err - } - sccoup.SourceControlCreateOrUpdateProperties = &sourceControlCreateOrUpdateProperties - } - } - } - - return nil -} - -// SourceControlCreateOrUpdateProperties the properties of the create source control operation. -type SourceControlCreateOrUpdateProperties struct { - // RepoURL - The repo url of the source control. - RepoURL *string `json:"repoUrl,omitempty"` - // Branch - The repo branch of the source control. Include branch as empty string for VsoTfvc. - Branch *string `json:"branch,omitempty"` - // FolderPath - The folder path of the source control. Path must be relative. - FolderPath *string `json:"folderPath,omitempty"` - // AutoSync - The auto async of the source control. Default is false. - AutoSync *bool `json:"autoSync,omitempty"` - // PublishRunbook - The auto publish of the source control. Default is true. - PublishRunbook *bool `json:"publishRunbook,omitempty"` - // SourceType - The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' - SourceType SourceType `json:"sourceType,omitempty"` - // SecurityToken - The authorization token for the repo of the source control. - SecurityToken *SourceControlSecurityTokenProperties `json:"securityToken,omitempty"` - // Description - The user description of the source control. - Description *string `json:"description,omitempty"` -} - -// SourceControlListResult the response model for the list source controls operation. -type SourceControlListResult struct { - autorest.Response `json:"-"` - // Value - The list of source controls. - Value *[]SourceControl `json:"value,omitempty"` - // NextLink - The next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// SourceControlListResultIterator provides access to a complete listing of SourceControl values. -type SourceControlListResultIterator struct { - i int - page SourceControlListResultPage -} - -// 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 *SourceControlListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlListResultIterator.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 *SourceControlListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceControlListResultIterator) 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 SourceControlListResultIterator) Response() SourceControlListResult { - 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 SourceControlListResultIterator) Value() SourceControl { - if !iter.page.NotDone() { - return SourceControl{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceControlListResultIterator type. -func NewSourceControlListResultIterator(page SourceControlListResultPage) SourceControlListResultIterator { - return SourceControlListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sclr SourceControlListResult) IsEmpty() bool { - return sclr.Value == nil || len(*sclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sclr SourceControlListResult) hasNextLink() bool { - return sclr.NextLink != nil && len(*sclr.NextLink) != 0 -} - -// sourceControlListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sclr SourceControlListResult) sourceControlListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sclr.NextLink))) -} - -// SourceControlListResultPage contains a page of SourceControl values. -type SourceControlListResultPage struct { - fn func(context.Context, SourceControlListResult) (SourceControlListResult, error) - sclr SourceControlListResult -} - -// 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 *SourceControlListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlListResultPage.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.sclr) - if err != nil { - return err - } - page.sclr = 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 *SourceControlListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceControlListResultPage) NotDone() bool { - return !page.sclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceControlListResultPage) Response() SourceControlListResult { - return page.sclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceControlListResultPage) Values() []SourceControl { - if page.sclr.IsEmpty() { - return nil - } - return *page.sclr.Value -} - -// Creates a new instance of the SourceControlListResultPage type. -func NewSourceControlListResultPage(cur SourceControlListResult, getNextPage func(context.Context, SourceControlListResult) (SourceControlListResult, error)) SourceControlListResultPage { - return SourceControlListResultPage{ - fn: getNextPage, - sclr: cur, - } -} - -// SourceControlProperties definition of the source control properties -type SourceControlProperties struct { - // RepoURL - The repo url of the source control. - RepoURL *string `json:"repoUrl,omitempty"` - // Branch - The repo branch of the source control. Include branch as empty string for VsoTfvc. - Branch *string `json:"branch,omitempty"` - // FolderPath - The folder path of the source control. - FolderPath *string `json:"folderPath,omitempty"` - // AutoSync - The auto sync of the source control. Default is false. - AutoSync *bool `json:"autoSync,omitempty"` - // PublishRunbook - The auto publish of the source control. Default is true. - PublishRunbook *bool `json:"publishRunbook,omitempty"` - // SourceType - The source type. Must be one of VsoGit, VsoTfvc, GitHub. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' - SourceType SourceType `json:"sourceType,omitempty"` - // Description - The description. - Description *string `json:"description,omitempty"` - // CreationTime - The creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - The last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` -} - -// SourceControlSecurityTokenProperties ... -type SourceControlSecurityTokenProperties struct { - // AccessToken - The access token. - AccessToken *string `json:"accessToken,omitempty"` - // RefreshToken - The refresh token. - RefreshToken *string `json:"refreshToken,omitempty"` - // TokenType - The token type. Must be either PersonalAccessToken or Oauth. Possible values include: 'PersonalAccessToken', 'Oauth' - TokenType TokenType `json:"tokenType,omitempty"` -} - -// SourceControlSyncJob definition of the source control sync job. -type SourceControlSyncJob struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; Resource id. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobProperties - The properties of the source control sync job. - *SourceControlSyncJobProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJob. -func (scsj SourceControlSyncJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsj.SourceControlSyncJobProperties != nil { - objectMap["properties"] = scsj.SourceControlSyncJobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJob struct. -func (scsj *SourceControlSyncJob) 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 - } - scsj.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scsj.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scsj.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobProperties SourceControlSyncJobProperties - err = json.Unmarshal(*v, &sourceControlSyncJobProperties) - if err != nil { - return err - } - scsj.SourceControlSyncJobProperties = &sourceControlSyncJobProperties - } - } - } - - return nil -} - -// SourceControlSyncJobByID definition of the source control sync job. -type SourceControlSyncJobByID struct { - autorest.Response `json:"-"` - // ID - The id of the job. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobByIDProperties - The properties of the source control sync job. - *SourceControlSyncJobByIDProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobByID. -func (scsjbi SourceControlSyncJobByID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjbi.ID != nil { - objectMap["id"] = scsjbi.ID - } - if scsjbi.SourceControlSyncJobByIDProperties != nil { - objectMap["properties"] = scsjbi.SourceControlSyncJobByIDProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobByID struct. -func (scsjbi *SourceControlSyncJobByID) 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 - } - scsjbi.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobByIDProperties SourceControlSyncJobByIDProperties - err = json.Unmarshal(*v, &sourceControlSyncJobByIDProperties) - if err != nil { - return err - } - scsjbi.SourceControlSyncJobByIDProperties = &sourceControlSyncJobByIDProperties - } - } - } - - return nil -} - -// SourceControlSyncJobByIDProperties definition of source control sync job properties. -type SourceControlSyncJobByIDProperties struct { - // SourceControlSyncJobID - The source control sync job id. - SourceControlSyncJobID *string `json:"sourceControlSyncJobId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - The provisioning state of the job. Possible values include: 'Completed', 'Failed', 'Running' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // StartTime - READ-ONLY; The start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // SyncType - The sync type. Possible values include: 'PartialSync', 'FullSync' - SyncType SyncType `json:"syncType,omitempty"` - // Exception - The exceptions that occurred while running the sync job. - Exception *string `json:"exception,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobByIDProperties. -func (scsjbip SourceControlSyncJobByIDProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjbip.SourceControlSyncJobID != nil { - objectMap["sourceControlSyncJobId"] = scsjbip.SourceControlSyncJobID - } - if scsjbip.ProvisioningState != "" { - objectMap["provisioningState"] = scsjbip.ProvisioningState - } - if scsjbip.SyncType != "" { - objectMap["syncType"] = scsjbip.SyncType - } - if scsjbip.Exception != nil { - objectMap["exception"] = scsjbip.Exception - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobCreateParameters the parameters supplied to the create source control sync job -// operation. -type SourceControlSyncJobCreateParameters struct { - // SourceControlSyncJobCreateProperties - The properties of the source control sync job. - *SourceControlSyncJobCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobCreateParameters. -func (scsjcp SourceControlSyncJobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjcp.SourceControlSyncJobCreateProperties != nil { - objectMap["properties"] = scsjcp.SourceControlSyncJobCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobCreateParameters struct. -func (scsjcp *SourceControlSyncJobCreateParameters) 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 sourceControlSyncJobCreateProperties SourceControlSyncJobCreateProperties - err = json.Unmarshal(*v, &sourceControlSyncJobCreateProperties) - if err != nil { - return err - } - scsjcp.SourceControlSyncJobCreateProperties = &sourceControlSyncJobCreateProperties - } - } - } - - return nil -} - -// SourceControlSyncJobCreateProperties definition of create source control sync job properties. -type SourceControlSyncJobCreateProperties struct { - // CommitID - The commit id of the source control sync job. If not syncing to a commitId, enter an empty string. - CommitID *string `json:"commitId,omitempty"` -} - -// SourceControlSyncJobListResult the response model for the list source control sync jobs operation. -type SourceControlSyncJobListResult struct { - autorest.Response `json:"-"` - // Value - The list of source control sync jobs. - Value *[]SourceControlSyncJob `json:"value,omitempty"` - // NextLink - The next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// SourceControlSyncJobListResultIterator provides access to a complete listing of SourceControlSyncJob -// values. -type SourceControlSyncJobListResultIterator struct { - i int - page SourceControlSyncJobListResultPage -} - -// 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 *SourceControlSyncJobListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobListResultIterator.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 *SourceControlSyncJobListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceControlSyncJobListResultIterator) 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 SourceControlSyncJobListResultIterator) Response() SourceControlSyncJobListResult { - 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 SourceControlSyncJobListResultIterator) Value() SourceControlSyncJob { - if !iter.page.NotDone() { - return SourceControlSyncJob{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceControlSyncJobListResultIterator type. -func NewSourceControlSyncJobListResultIterator(page SourceControlSyncJobListResultPage) SourceControlSyncJobListResultIterator { - return SourceControlSyncJobListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (scsjlr SourceControlSyncJobListResult) IsEmpty() bool { - return scsjlr.Value == nil || len(*scsjlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (scsjlr SourceControlSyncJobListResult) hasNextLink() bool { - return scsjlr.NextLink != nil && len(*scsjlr.NextLink) != 0 -} - -// sourceControlSyncJobListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (scsjlr SourceControlSyncJobListResult) sourceControlSyncJobListResultPreparer(ctx context.Context) (*http.Request, error) { - if !scsjlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(scsjlr.NextLink))) -} - -// SourceControlSyncJobListResultPage contains a page of SourceControlSyncJob values. -type SourceControlSyncJobListResultPage struct { - fn func(context.Context, SourceControlSyncJobListResult) (SourceControlSyncJobListResult, error) - scsjlr SourceControlSyncJobListResult -} - -// 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 *SourceControlSyncJobListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobListResultPage.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.scsjlr) - if err != nil { - return err - } - page.scsjlr = 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 *SourceControlSyncJobListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceControlSyncJobListResultPage) NotDone() bool { - return !page.scsjlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceControlSyncJobListResultPage) Response() SourceControlSyncJobListResult { - return page.scsjlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceControlSyncJobListResultPage) Values() []SourceControlSyncJob { - if page.scsjlr.IsEmpty() { - return nil - } - return *page.scsjlr.Value -} - -// Creates a new instance of the SourceControlSyncJobListResultPage type. -func NewSourceControlSyncJobListResultPage(cur SourceControlSyncJobListResult, getNextPage func(context.Context, SourceControlSyncJobListResult) (SourceControlSyncJobListResult, error)) SourceControlSyncJobListResultPage { - return SourceControlSyncJobListResultPage{ - fn: getNextPage, - scsjlr: cur, - } -} - -// SourceControlSyncJobProperties definition of source control sync job properties. -type SourceControlSyncJobProperties struct { - // SourceControlSyncJobID - The source control sync job id. - SourceControlSyncJobID *string `json:"sourceControlSyncJobId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - The provisioning state of the job. Possible values include: 'Completed', 'Failed', 'Running' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // StartTime - READ-ONLY; The start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // SyncType - The sync type. Possible values include: 'PartialSync', 'FullSync' - SyncType SyncType `json:"syncType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobProperties. -func (scsjp SourceControlSyncJobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjp.SourceControlSyncJobID != nil { - objectMap["sourceControlSyncJobId"] = scsjp.SourceControlSyncJobID - } - if scsjp.ProvisioningState != "" { - objectMap["provisioningState"] = scsjp.ProvisioningState - } - if scsjp.SyncType != "" { - objectMap["syncType"] = scsjp.SyncType - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStream definition of the source control sync job stream. -type SourceControlSyncJobStream struct { - // ID - READ-ONLY; Resource id. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobStreamProperties - The properties of the source control sync job stream. - *SourceControlSyncJobStreamProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStream. -func (scsjs SourceControlSyncJobStream) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjs.SourceControlSyncJobStreamProperties != nil { - objectMap["properties"] = scsjs.SourceControlSyncJobStreamProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobStream struct. -func (scsjs *SourceControlSyncJobStream) 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 - } - scsjs.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobStreamProperties SourceControlSyncJobStreamProperties - err = json.Unmarshal(*v, &sourceControlSyncJobStreamProperties) - if err != nil { - return err - } - scsjs.SourceControlSyncJobStreamProperties = &sourceControlSyncJobStreamProperties - } - } - } - - return nil -} - -// SourceControlSyncJobStreamByID definition of the source control sync job stream by id. -type SourceControlSyncJobStreamByID struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Resource id. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobStreamByIDProperties - The properties of the source control sync job stream. - *SourceControlSyncJobStreamByIDProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamByID. -func (scsjsbi SourceControlSyncJobStreamByID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjsbi.SourceControlSyncJobStreamByIDProperties != nil { - objectMap["properties"] = scsjsbi.SourceControlSyncJobStreamByIDProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobStreamByID struct. -func (scsjsbi *SourceControlSyncJobStreamByID) 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 - } - scsjsbi.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobStreamByIDProperties SourceControlSyncJobStreamByIDProperties - err = json.Unmarshal(*v, &sourceControlSyncJobStreamByIDProperties) - if err != nil { - return err - } - scsjsbi.SourceControlSyncJobStreamByIDProperties = &sourceControlSyncJobStreamByIDProperties - } - } - } - - return nil -} - -// SourceControlSyncJobStreamByIDProperties definition of source control sync job stream by id properties. -type SourceControlSyncJobStreamByIDProperties struct { - // SourceControlSyncJobStreamID - The sync job stream id. - SourceControlSyncJobStreamID *string `json:"sourceControlSyncJobStreamId,omitempty"` - // Summary - The summary of the sync job stream. - Summary *string `json:"summary,omitempty"` - // Time - READ-ONLY; The time of the sync job stream. - Time *date.Time `json:"time,omitempty"` - // StreamType - The type of the sync job stream. Possible values include: 'StreamTypeError', 'StreamTypeOutput' - StreamType StreamType `json:"streamType,omitempty"` - // StreamText - The text of the sync job stream. - StreamText *string `json:"streamText,omitempty"` - // Value - The values of the job stream. - Value map[string]interface{} `json:"value"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamByIDProperties. -func (scsjsbip SourceControlSyncJobStreamByIDProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjsbip.SourceControlSyncJobStreamID != nil { - objectMap["sourceControlSyncJobStreamId"] = scsjsbip.SourceControlSyncJobStreamID - } - if scsjsbip.Summary != nil { - objectMap["summary"] = scsjsbip.Summary - } - if scsjsbip.StreamType != "" { - objectMap["streamType"] = scsjsbip.StreamType - } - if scsjsbip.StreamText != nil { - objectMap["streamText"] = scsjsbip.StreamText - } - if scsjsbip.Value != nil { - objectMap["value"] = scsjsbip.Value - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStreamProperties definition of source control sync job stream properties. -type SourceControlSyncJobStreamProperties struct { - // SourceControlSyncJobStreamID - The sync job stream id. - SourceControlSyncJobStreamID *string `json:"sourceControlSyncJobStreamId,omitempty"` - // Summary - The summary of the sync job stream. - Summary *string `json:"summary,omitempty"` - // Time - READ-ONLY; The time of the sync job stream. - Time *date.Time `json:"time,omitempty"` - // StreamType - The type of the sync job stream. Possible values include: 'StreamTypeError', 'StreamTypeOutput' - StreamType StreamType `json:"streamType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamProperties. -func (scsjsp SourceControlSyncJobStreamProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjsp.SourceControlSyncJobStreamID != nil { - objectMap["sourceControlSyncJobStreamId"] = scsjsp.SourceControlSyncJobStreamID - } - if scsjsp.Summary != nil { - objectMap["summary"] = scsjsp.Summary - } - if scsjsp.StreamType != "" { - objectMap["streamType"] = scsjsp.StreamType - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStreamsListBySyncJob the response model for the list source control sync job streams -// operation. -type SourceControlSyncJobStreamsListBySyncJob struct { - autorest.Response `json:"-"` - // Value - The list of source control sync job streams. - Value *[]SourceControlSyncJobStream `json:"value,omitempty"` - // NextLink - READ-ONLY; The next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamsListBySyncJob. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjslbsj.Value != nil { - objectMap["value"] = scsjslbsj.Value - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStreamsListBySyncJobIterator provides access to a complete listing of -// SourceControlSyncJobStream values. -type SourceControlSyncJobStreamsListBySyncJobIterator struct { - i int - page SourceControlSyncJobStreamsListBySyncJobPage -} - -// 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 *SourceControlSyncJobStreamsListBySyncJobIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsListBySyncJobIterator.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 *SourceControlSyncJobStreamsListBySyncJobIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceControlSyncJobStreamsListBySyncJobIterator) 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 SourceControlSyncJobStreamsListBySyncJobIterator) Response() SourceControlSyncJobStreamsListBySyncJob { - 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 SourceControlSyncJobStreamsListBySyncJobIterator) Value() SourceControlSyncJobStream { - if !iter.page.NotDone() { - return SourceControlSyncJobStream{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceControlSyncJobStreamsListBySyncJobIterator type. -func NewSourceControlSyncJobStreamsListBySyncJobIterator(page SourceControlSyncJobStreamsListBySyncJobPage) SourceControlSyncJobStreamsListBySyncJobIterator { - return SourceControlSyncJobStreamsListBySyncJobIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) IsEmpty() bool { - return scsjslbsj.Value == nil || len(*scsjslbsj.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) hasNextLink() bool { - return scsjslbsj.NextLink != nil && len(*scsjslbsj.NextLink) != 0 -} - -// sourceControlSyncJobStreamsListBySyncJobPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) sourceControlSyncJobStreamsListBySyncJobPreparer(ctx context.Context) (*http.Request, error) { - if !scsjslbsj.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(scsjslbsj.NextLink))) -} - -// SourceControlSyncJobStreamsListBySyncJobPage contains a page of SourceControlSyncJobStream values. -type SourceControlSyncJobStreamsListBySyncJobPage struct { - fn func(context.Context, SourceControlSyncJobStreamsListBySyncJob) (SourceControlSyncJobStreamsListBySyncJob, error) - scsjslbsj SourceControlSyncJobStreamsListBySyncJob -} - -// 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 *SourceControlSyncJobStreamsListBySyncJobPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsListBySyncJobPage.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.scsjslbsj) - if err != nil { - return err - } - page.scsjslbsj = 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 *SourceControlSyncJobStreamsListBySyncJobPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceControlSyncJobStreamsListBySyncJobPage) NotDone() bool { - return !page.scsjslbsj.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceControlSyncJobStreamsListBySyncJobPage) Response() SourceControlSyncJobStreamsListBySyncJob { - return page.scsjslbsj -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceControlSyncJobStreamsListBySyncJobPage) Values() []SourceControlSyncJobStream { - if page.scsjslbsj.IsEmpty() { - return nil - } - return *page.scsjslbsj.Value -} - -// Creates a new instance of the SourceControlSyncJobStreamsListBySyncJobPage type. -func NewSourceControlSyncJobStreamsListBySyncJobPage(cur SourceControlSyncJobStreamsListBySyncJob, getNextPage func(context.Context, SourceControlSyncJobStreamsListBySyncJob) (SourceControlSyncJobStreamsListBySyncJob, error)) SourceControlSyncJobStreamsListBySyncJobPage { - return SourceControlSyncJobStreamsListBySyncJobPage{ - fn: getNextPage, - scsjslbsj: cur, - } -} - -// SourceControlUpdateParameters the parameters supplied to the update source control operation. -type SourceControlUpdateParameters struct { - // SourceControlUpdateProperties - The value of the source control. - *SourceControlUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlUpdateParameters. -func (scup SourceControlUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scup.SourceControlUpdateProperties != nil { - objectMap["properties"] = scup.SourceControlUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlUpdateParameters struct. -func (scup *SourceControlUpdateParameters) 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 sourceControlUpdateProperties SourceControlUpdateProperties - err = json.Unmarshal(*v, &sourceControlUpdateProperties) - if err != nil { - return err - } - scup.SourceControlUpdateProperties = &sourceControlUpdateProperties - } - } - } - - return nil -} - -// SourceControlUpdateProperties the properties of the update source control -type SourceControlUpdateProperties struct { - // Branch - The repo branch of the source control. - Branch *string `json:"branch,omitempty"` - // FolderPath - The folder path of the source control. Path must be relative. - FolderPath *string `json:"folderPath,omitempty"` - // AutoSync - The auto sync of the source control. Default is false. - AutoSync *bool `json:"autoSync,omitempty"` - // PublishRunbook - The auto publish of the source control. Default is true. - PublishRunbook *bool `json:"publishRunbook,omitempty"` - // SecurityToken - The authorization token for the repo of the source control. - SecurityToken *SourceControlSecurityTokenProperties `json:"securityToken,omitempty"` - // Description - The user description of the source control. - Description *string `json:"description,omitempty"` -} - -// Statistics definition of the statistic. -type Statistics struct { - // CounterProperty - READ-ONLY; Gets the property value of the statistic. - CounterProperty *string `json:"counterProperty,omitempty"` - // CounterValue - READ-ONLY; Gets the value of the statistic. - CounterValue *int64 `json:"counterValue,omitempty"` - // StartTime - READ-ONLY; Gets the startTime of the statistic. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the endTime of the statistic. - EndTime *date.Time `json:"endTime,omitempty"` - // ID - READ-ONLY; Gets the id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for Statistics. -func (s Statistics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StatisticsListResult the response model for the list statistics operation. -type StatisticsListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of statistics. - Value *[]Statistics `json:"value,omitempty"` -} - -// String ... -type String struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// TagSettingsProperties tag filter information for the VM. -type TagSettingsProperties struct { - // Tags - Dictionary of tags with its list of values. - Tags map[string][]string `json:"tags"` - // FilterOperator - Filter VMs by Any or All specified tags. Possible values include: 'TagOperatorsAll', 'TagOperatorsAny' - FilterOperator TagOperators `json:"filterOperator,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagSettingsProperties. -func (tsp TagSettingsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsp.Tags != nil { - objectMap["tags"] = tsp.Tags - } - if tsp.FilterOperator != "" { - objectMap["filterOperator"] = tsp.FilterOperator - } - return json.Marshal(objectMap) -} - -// TargetProperties group specific to the update configuration. -type TargetProperties struct { - // AzureQueries - List of Azure queries in the software update configuration. - AzureQueries *[]AzureQueryProperties `json:"azureQueries,omitempty"` - // NonAzureQueries - List of non Azure queries in the software update configuration. - NonAzureQueries *[]NonAzureQueryProperties `json:"nonAzureQueries,omitempty"` -} - -// TaskProperties task properties of the software update configuration. -type TaskProperties struct { - // Parameters - Gets or sets the parameters of the task. - Parameters map[string]*string `json:"parameters"` - // Source - Gets or sets the name of the runbook. - Source *string `json:"source,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskProperties. -func (tp TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.Parameters != nil { - objectMap["parameters"] = tp.Parameters - } - if tp.Source != nil { - objectMap["source"] = tp.Source - } - return json.Marshal(objectMap) -} - -// TestJob definition of the test job. -type TestJob struct { - autorest.Response `json:"-"` - // CreationTime - Gets or sets the creation time of the test job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Status - Gets or sets the status of the test job. - Status *string `json:"status,omitempty"` - // StatusDetails - Gets or sets the status details of the test job. - StatusDetails *string `json:"statusDetails,omitempty"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` - // StartTime - Gets or sets the start time of the test job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Gets or sets the end time of the test job. - EndTime *date.Time `json:"endTime,omitempty"` - // Exception - Gets or sets the exception of the test job. - Exception *string `json:"exception,omitempty"` - // LastModifiedTime - Gets or sets the last modified time of the test job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastStatusModifiedTime - Gets or sets the last status modified time of the test job. - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - // Parameters - Gets or sets the parameters of the test job. - Parameters map[string]*string `json:"parameters"` - // LogActivityTrace - The activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// MarshalJSON is the custom marshaler for TestJob. -func (tj TestJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tj.CreationTime != nil { - objectMap["creationTime"] = tj.CreationTime - } - if tj.Status != nil { - objectMap["status"] = tj.Status - } - if tj.StatusDetails != nil { - objectMap["statusDetails"] = tj.StatusDetails - } - if tj.RunOn != nil { - objectMap["runOn"] = tj.RunOn - } - if tj.StartTime != nil { - objectMap["startTime"] = tj.StartTime - } - if tj.EndTime != nil { - objectMap["endTime"] = tj.EndTime - } - if tj.Exception != nil { - objectMap["exception"] = tj.Exception - } - if tj.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = tj.LastModifiedTime - } - if tj.LastStatusModifiedTime != nil { - objectMap["lastStatusModifiedTime"] = tj.LastStatusModifiedTime - } - if tj.Parameters != nil { - objectMap["parameters"] = tj.Parameters - } - if tj.LogActivityTrace != nil { - objectMap["logActivityTrace"] = tj.LogActivityTrace - } - return json.Marshal(objectMap) -} - -// TestJobCreateParameters the parameters supplied to the create test job operation. -type TestJobCreateParameters struct { - // Parameters - Gets or sets the parameters of the test job. - Parameters map[string]*string `json:"parameters"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for TestJobCreateParameters. -func (tjcp TestJobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tjcp.Parameters != nil { - objectMap["parameters"] = tjcp.Parameters - } - if tjcp.RunOn != nil { - objectMap["runOn"] = tjcp.RunOn - } - return json.Marshal(objectMap) -} - -// TrackedResource the resource model definition for a ARM tracked top level resource -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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) -} - -// TypeField information about a field of a type. -type TypeField struct { - // Name - Gets or sets the name of the field. - Name *string `json:"name,omitempty"` - // Type - Gets or sets the type of the field. - Type *string `json:"type,omitempty"` -} - -// TypeFieldListResult the response model for the list fields operation. -type TypeFieldListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of fields. - Value *[]TypeField `json:"value,omitempty"` -} - -// UpdateConfiguration update specific properties of the software update configuration. -type UpdateConfiguration struct { - // OperatingSystem - operating system of target machines. Possible values include: 'Windows', 'Linux' - OperatingSystem OperatingSystemType `json:"operatingSystem,omitempty"` - // Windows - Windows specific update configuration. - Windows *WindowsProperties `json:"windows,omitempty"` - // Linux - Linux specific update configuration. - Linux *LinuxProperties `json:"linux,omitempty"` - // Duration - Maximum time allowed for the software update configuration run. Duration needs to be specified using the format PT[n]H[n]M[n]S as per ISO8601 - Duration *string `json:"duration,omitempty"` - // AzureVirtualMachines - List of azure resource Ids for azure virtual machines targeted by the software update configuration. - AzureVirtualMachines *[]string `json:"azureVirtualMachines,omitempty"` - // NonAzureComputerNames - List of names of non-azure machines targeted by the software update configuration. - NonAzureComputerNames *[]string `json:"nonAzureComputerNames,omitempty"` - // Targets - Group targets for the software update configuration. - Targets *TargetProperties `json:"targets,omitempty"` -} - -// UpdateConfigurationMachineRunProperties software update configuration machine run properties. -type UpdateConfigurationMachineRunProperties struct { - // TargetComputer - READ-ONLY; name of the updated computer - TargetComputer *string `json:"targetComputer,omitempty"` - // TargetComputerType - READ-ONLY; type of the updated computer. - TargetComputerType *string `json:"targetComputerType,omitempty"` - // SoftwareUpdateConfiguration - software update configuration triggered this run - SoftwareUpdateConfiguration *UpdateConfigurationNavigation `json:"softwareUpdateConfiguration,omitempty"` - // Status - READ-ONLY; Status of the software update configuration machine run. - Status *string `json:"status,omitempty"` - // OsType - READ-ONLY; Operating system target of the software update configuration triggered this run - OsType *string `json:"osType,omitempty"` - // CorrelationID - READ-ONLY; correlation id of the software update configuration machine run - CorrelationID *uuid.UUID `json:"correlationId,omitempty"` - // SourceComputerID - READ-ONLY; source computer id of the software update configuration machine run - SourceComputerID *uuid.UUID `json:"sourceComputerId,omitempty"` - // StartTime - READ-ONLY; Start time of the software update configuration machine run. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; End time of the software update configuration machine run. - EndTime *date.Time `json:"endTime,omitempty"` - // ConfiguredDuration - READ-ONLY; configured duration for the software update configuration run. - ConfiguredDuration *string `json:"configuredDuration,omitempty"` - // Job - Job associated with the software update configuration machine run - Job *JobNavigation `json:"job,omitempty"` - // CreationTime - READ-ONLY; Creation time of the resource, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CreatedBy - READ-ONLY; createdBy property, which only appears in the response. - CreatedBy *string `json:"createdBy,omitempty"` - // LastModifiedTime - READ-ONLY; Last time resource was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; lastModifiedBy property, which only appears in the response. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Error - Details of provisioning error - Error *ErrorResponse `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpdateConfigurationMachineRunProperties. -func (ucmrp UpdateConfigurationMachineRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucmrp.SoftwareUpdateConfiguration != nil { - objectMap["softwareUpdateConfiguration"] = ucmrp.SoftwareUpdateConfiguration - } - if ucmrp.Job != nil { - objectMap["job"] = ucmrp.Job - } - if ucmrp.Error != nil { - objectMap["error"] = ucmrp.Error - } - return json.Marshal(objectMap) -} - -// UpdateConfigurationNavigation software update configuration Run Navigation model. -type UpdateConfigurationNavigation struct { - // Name - READ-ONLY; Name of the software update configuration triggered the software update configuration run - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpdateConfigurationNavigation. -func (ucn UpdateConfigurationNavigation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Usage definition of Usage. -type Usage struct { - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - Gets or sets the usage counter name. - Name *UsageCounterName `json:"name,omitempty"` - // Unit - Gets or sets the usage unit name. - Unit *string `json:"unit,omitempty"` - // CurrentValue - Gets or sets the current usage value. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - Gets or sets max limit. -1 for unlimited - Limit *int64 `json:"limit,omitempty"` - // ThrottleStatus - Gets or sets the throttle status. - ThrottleStatus *string `json:"throttleStatus,omitempty"` -} - -// UsageCounterName definition of usage counter name. -type UsageCounterName struct { - // Value - Gets or sets the usage counter name. - Value *string `json:"value,omitempty"` - // LocalizedValue - Gets or sets the localized usage counter name. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// UsageListResult the response model for the get usage operation. -type UsageListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets usage. - Value *[]Usage `json:"value,omitempty"` -} - -// Variable definition of the variable. -type Variable struct { - autorest.Response `json:"-"` - // VariableProperties - Gets or sets the properties of the variable. - *VariableProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Variable. -func (vVar Variable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.VariableProperties != nil { - objectMap["properties"] = vVar.VariableProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Variable struct. -func (vVar *Variable) 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 variableProperties VariableProperties - err = json.Unmarshal(*v, &variableProperties) - if err != nil { - return err - } - vVar.VariableProperties = &variableProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vVar.Type = &typeVar - } - } - } - - return nil -} - -// VariableCreateOrUpdateParameters the parameters supplied to the create or update variable operation. -type VariableCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the variable. - Name *string `json:"name,omitempty"` - // VariableCreateOrUpdateProperties - Gets or sets the properties of the variable. - *VariableCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VariableCreateOrUpdateParameters. -func (vcoup VariableCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcoup.Name != nil { - objectMap["name"] = vcoup.Name - } - if vcoup.VariableCreateOrUpdateProperties != nil { - objectMap["properties"] = vcoup.VariableCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VariableCreateOrUpdateParameters struct. -func (vcoup *VariableCreateOrUpdateParameters) 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 - } - vcoup.Name = &name - } - case "properties": - if v != nil { - var variableCreateOrUpdateProperties VariableCreateOrUpdateProperties - err = json.Unmarshal(*v, &variableCreateOrUpdateProperties) - if err != nil { - return err - } - vcoup.VariableCreateOrUpdateProperties = &variableCreateOrUpdateProperties - } - } - } - - return nil -} - -// VariableCreateOrUpdateProperties the properties of the create variable operation. -type VariableCreateOrUpdateProperties struct { - // Value - Gets or sets the value of the variable. - Value *string `json:"value,omitempty"` - // Description - Gets or sets the description of the variable. - Description *string `json:"description,omitempty"` - // IsEncrypted - Gets or sets the encrypted flag of the variable. - IsEncrypted *bool `json:"isEncrypted,omitempty"` -} - -// VariableListResult the response model for the list variables operation. -type VariableListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of variables. - Value *[]Variable `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// VariableListResultIterator provides access to a complete listing of Variable values. -type VariableListResultIterator struct { - i int - page VariableListResultPage -} - -// 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 *VariableListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultIterator.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 *VariableListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VariableListResultIterator) 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 VariableListResultIterator) Response() VariableListResult { - 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 VariableListResultIterator) Value() Variable { - if !iter.page.NotDone() { - return Variable{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VariableListResultIterator type. -func NewVariableListResultIterator(page VariableListResultPage) VariableListResultIterator { - return VariableListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vlr VariableListResult) IsEmpty() bool { - return vlr.Value == nil || len(*vlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vlr VariableListResult) hasNextLink() bool { - return vlr.NextLink != nil && len(*vlr.NextLink) != 0 -} - -// variableListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vlr VariableListResult) variableListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vlr.NextLink))) -} - -// VariableListResultPage contains a page of Variable values. -type VariableListResultPage struct { - fn func(context.Context, VariableListResult) (VariableListResult, error) - vlr VariableListResult -} - -// 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 *VariableListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultPage.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.vlr) - if err != nil { - return err - } - page.vlr = 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 *VariableListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VariableListResultPage) NotDone() bool { - return !page.vlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VariableListResultPage) Response() VariableListResult { - return page.vlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VariableListResultPage) Values() []Variable { - if page.vlr.IsEmpty() { - return nil - } - return *page.vlr.Value -} - -// Creates a new instance of the VariableListResultPage type. -func NewVariableListResultPage(cur VariableListResult, getNextPage func(context.Context, VariableListResult) (VariableListResult, error)) VariableListResultPage { - return VariableListResultPage{ - fn: getNextPage, - vlr: cur, - } -} - -// VariableProperties definition of the variable properties -type VariableProperties struct { - // Value - Gets or sets the value of the variable. - Value *string `json:"value,omitempty"` - // IsEncrypted - Gets or sets the encrypted flag of the variable. - IsEncrypted *bool `json:"isEncrypted,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// VariableUpdateParameters the parameters supplied to the update variable operation. -type VariableUpdateParameters struct { - // Name - Gets or sets the name of the variable. - Name *string `json:"name,omitempty"` - // VariableUpdateProperties - Gets or sets the value of the variable. - *VariableUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VariableUpdateParameters. -func (vup VariableUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vup.Name != nil { - objectMap["name"] = vup.Name - } - if vup.VariableUpdateProperties != nil { - objectMap["properties"] = vup.VariableUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VariableUpdateParameters struct. -func (vup *VariableUpdateParameters) 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 - } - vup.Name = &name - } - case "properties": - if v != nil { - var variableUpdateProperties VariableUpdateProperties - err = json.Unmarshal(*v, &variableUpdateProperties) - if err != nil { - return err - } - vup.VariableUpdateProperties = &variableUpdateProperties - } - } - } - - return nil -} - -// VariableUpdateProperties the properties of the update variable -type VariableUpdateProperties struct { - // Value - Gets or sets the value of the variable. - Value *string `json:"value,omitempty"` - // Description - Gets or sets the description of the variable. - Description *string `json:"description,omitempty"` -} - -// Watcher definition of the watcher type. -type Watcher struct { - autorest.Response `json:"-"` - // WatcherProperties - Gets or sets the watcher properties. - *WatcherProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Watcher. -func (w Watcher) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WatcherProperties != nil { - objectMap["properties"] = w.WatcherProperties - } - 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 Watcher struct. -func (w *Watcher) 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 watcherProperties WatcherProperties - err = json.Unmarshal(*v, &watcherProperties) - if err != nil { - return err - } - w.WatcherProperties = &watcherProperties - } - case "etag": - if v != nil { - var etag 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 -} - -// WatcherListResult the response model for the list watcher operation. -type WatcherListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of watchers. - Value *[]Watcher `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// WatcherListResultIterator provides access to a complete listing of Watcher values. -type WatcherListResultIterator struct { - i int - page WatcherListResultPage -} - -// 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 *WatcherListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherListResultIterator.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 *WatcherListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WatcherListResultIterator) 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 WatcherListResultIterator) Response() WatcherListResult { - 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 WatcherListResultIterator) Value() Watcher { - if !iter.page.NotDone() { - return Watcher{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WatcherListResultIterator type. -func NewWatcherListResultIterator(page WatcherListResultPage) WatcherListResultIterator { - return WatcherListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WatcherListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WatcherListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// watcherListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WatcherListResult) watcherListResultPreparer(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))) -} - -// WatcherListResultPage contains a page of Watcher values. -type WatcherListResultPage struct { - fn func(context.Context, WatcherListResult) (WatcherListResult, error) - wlr WatcherListResult -} - -// 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 *WatcherListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherListResultPage.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 *WatcherListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WatcherListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WatcherListResultPage) Response() WatcherListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WatcherListResultPage) Values() []Watcher { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WatcherListResultPage type. -func NewWatcherListResultPage(cur WatcherListResult, getNextPage func(context.Context, WatcherListResult) (WatcherListResult, error)) WatcherListResultPage { - return WatcherListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WatcherProperties definition of the watcher properties -type WatcherProperties struct { - // ExecutionFrequencyInSeconds - Gets or sets the frequency at which the watcher is invoked. - ExecutionFrequencyInSeconds *int64 `json:"executionFrequencyInSeconds,omitempty"` - // ScriptName - Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook. - ScriptName *string `json:"scriptName,omitempty"` - // ScriptParameters - Gets or sets the parameters of the script. - ScriptParameters map[string]*string `json:"scriptParameters"` - // ScriptRunOn - Gets or sets the name of the hybrid worker group the watcher will run on. - ScriptRunOn *string `json:"scriptRunOn,omitempty"` - // Status - READ-ONLY; Gets the current status of the watcher. - Status *string `json:"status,omitempty"` - // CreationTime - READ-ONLY; Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; Details of the user who last modified the watcher. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for WatcherProperties. -func (wp WatcherProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.ExecutionFrequencyInSeconds != nil { - objectMap["executionFrequencyInSeconds"] = wp.ExecutionFrequencyInSeconds - } - if wp.ScriptName != nil { - objectMap["scriptName"] = wp.ScriptName - } - if wp.ScriptParameters != nil { - objectMap["scriptParameters"] = wp.ScriptParameters - } - if wp.ScriptRunOn != nil { - objectMap["scriptRunOn"] = wp.ScriptRunOn - } - if wp.Description != nil { - objectMap["description"] = wp.Description - } - return json.Marshal(objectMap) -} - -// WatcherUpdateParameters ... -type WatcherUpdateParameters struct { - // WatcherUpdateProperties - Gets or sets the watcher update properties. - *WatcherUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for WatcherUpdateParameters. -func (wup WatcherUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.WatcherUpdateProperties != nil { - objectMap["properties"] = wup.WatcherUpdateProperties - } - if wup.Name != nil { - objectMap["name"] = wup.Name - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WatcherUpdateParameters struct. -func (wup *WatcherUpdateParameters) 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 watcherUpdateProperties WatcherUpdateProperties - err = json.Unmarshal(*v, &watcherUpdateProperties) - if err != nil { - return err - } - wup.WatcherUpdateProperties = &watcherUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wup.Name = &name - } - } - } - - return nil -} - -// WatcherUpdateProperties the properties of the update watcher operation. -type WatcherUpdateProperties struct { - // ExecutionFrequencyInSeconds - Gets or sets the frequency at which the watcher is invoked. - ExecutionFrequencyInSeconds *int64 `json:"executionFrequencyInSeconds,omitempty"` -} - -// Webhook definition of the webhook type. -type Webhook struct { - autorest.Response `json:"-"` - // WebhookProperties - Gets or sets the webhook properties. - *WebhookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WebhookProperties != nil { - objectMap["properties"] = w.WebhookProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Webhook struct. -func (w *Webhook) 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 webhookProperties WebhookProperties - err = json.Unmarshal(*v, &webhookProperties) - if err != nil { - return err - } - w.WebhookProperties = &webhookProperties - } - 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 -} - -// WebhookCreateOrUpdateParameters the parameters supplied to the create or update webhook operation. -type WebhookCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the webhook. - Name *string `json:"name,omitempty"` - // WebhookCreateOrUpdateProperties - Gets or sets the properties of the webhook. - *WebhookCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateOrUpdateParameters. -func (wcoup WebhookCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcoup.Name != nil { - objectMap["name"] = wcoup.Name - } - if wcoup.WebhookCreateOrUpdateProperties != nil { - objectMap["properties"] = wcoup.WebhookCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookCreateOrUpdateParameters struct. -func (wcoup *WebhookCreateOrUpdateParameters) 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 - } - wcoup.Name = &name - } - case "properties": - if v != nil { - var webhookCreateOrUpdateProperties WebhookCreateOrUpdateProperties - err = json.Unmarshal(*v, &webhookCreateOrUpdateProperties) - if err != nil { - return err - } - wcoup.WebhookCreateOrUpdateProperties = &webhookCreateOrUpdateProperties - } - } - } - - return nil -} - -// WebhookCreateOrUpdateProperties the properties of the create webhook operation. -type WebhookCreateOrUpdateProperties struct { - // IsEnabled - Gets or sets the value of the enabled flag of webhook. - IsEnabled *bool `json:"isEnabled,omitempty"` - // URI - Gets or sets the uri. - URI *string `json:"uri,omitempty"` - // ExpiryTime - Gets or sets the expiry time. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the name of the hybrid worker group the webhook job will run on. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateOrUpdateProperties. -func (wcoup WebhookCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcoup.IsEnabled != nil { - objectMap["isEnabled"] = wcoup.IsEnabled - } - if wcoup.URI != nil { - objectMap["uri"] = wcoup.URI - } - if wcoup.ExpiryTime != nil { - objectMap["expiryTime"] = wcoup.ExpiryTime - } - if wcoup.Parameters != nil { - objectMap["parameters"] = wcoup.Parameters - } - if wcoup.Runbook != nil { - objectMap["runbook"] = wcoup.Runbook - } - if wcoup.RunOn != nil { - objectMap["runOn"] = wcoup.RunOn - } - return json.Marshal(objectMap) -} - -// WebhookListResult the response model for the list webhook operation. -type WebhookListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of webhooks. - Value *[]Webhook `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultIterator provides access to a complete listing of Webhook values. -type WebhookListResultIterator struct { - i int - page WebhookListResultPage -} - -// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { - 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 WebhookListResultIterator) Value() Webhook { - if !iter.page.NotDone() { - return Webhook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebhookListResultIterator type. -func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { - return WebhookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WebhookListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WebhookListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// webhookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WebhookListResult) webhookListResultPreparer(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))) -} - -// WebhookListResultPage contains a page of Webhook values. -type WebhookListResultPage struct { - fn func(context.Context, WebhookListResult) (WebhookListResult, error) - wlr WebhookListResult -} - -// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebhookListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebhookListResultPage) Response() WebhookListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebhookListResultPage) Values() []Webhook { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WebhookListResultPage type. -func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { - return WebhookListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WebhookProperties definition of the webhook properties -type WebhookProperties struct { - // IsEnabled - Gets or sets the value of the enabled flag of the webhook. - IsEnabled *bool `json:"isEnabled,omitempty"` - // URI - Gets or sets the webhook uri. - URI *string `json:"uri,omitempty"` - // ExpiryTime - Gets or sets the expiry time. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // LastInvokedTime - Gets or sets the last invoked time. - LastInvokedTime *date.Time `json:"lastInvokedTime,omitempty"` - // Parameters - Gets or sets the parameters of the job that is created when the webhook calls the runbook it is associated with. - Parameters map[string]*string `json:"parameters"` - // Runbook - Gets or sets the runbook the webhook is associated with. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the name of the hybrid worker group the webhook job will run on. - RunOn *string `json:"runOn,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - Details of the user who last modified the Webhook - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookProperties. -func (wp WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.IsEnabled != nil { - objectMap["isEnabled"] = wp.IsEnabled - } - if wp.URI != nil { - objectMap["uri"] = wp.URI - } - if wp.ExpiryTime != nil { - objectMap["expiryTime"] = wp.ExpiryTime - } - if wp.LastInvokedTime != nil { - objectMap["lastInvokedTime"] = wp.LastInvokedTime - } - if wp.Parameters != nil { - objectMap["parameters"] = wp.Parameters - } - if wp.Runbook != nil { - objectMap["runbook"] = wp.Runbook - } - if wp.RunOn != nil { - objectMap["runOn"] = wp.RunOn - } - if wp.CreationTime != nil { - objectMap["creationTime"] = wp.CreationTime - } - if wp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = wp.LastModifiedTime - } - if wp.LastModifiedBy != nil { - objectMap["lastModifiedBy"] = wp.LastModifiedBy - } - if wp.Description != nil { - objectMap["description"] = wp.Description - } - return json.Marshal(objectMap) -} - -// WebhookUpdateParameters the parameters supplied to the update webhook operation. -type WebhookUpdateParameters struct { - // Name - Gets or sets the name of the webhook. - Name *string `json:"name,omitempty"` - // WebhookUpdateProperties - Gets or sets the value of the webhook. - *WebhookUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateParameters. -func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.Name != nil { - objectMap["name"] = wup.Name - } - if wup.WebhookUpdateProperties != nil { - objectMap["properties"] = wup.WebhookUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. -func (wup *WebhookUpdateParameters) 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 - } - wup.Name = &name - } - case "properties": - if v != nil { - var webhookUpdateProperties WebhookUpdateProperties - err = json.Unmarshal(*v, &webhookUpdateProperties) - if err != nil { - return err - } - wup.WebhookUpdateProperties = &webhookUpdateProperties - } - } - } - - return nil -} - -// WebhookUpdateProperties the properties of the update webhook. -type WebhookUpdateProperties struct { - // IsEnabled - Gets or sets the value of the enabled flag of webhook. - IsEnabled *bool `json:"isEnabled,omitempty"` - // RunOn - Gets or sets the name of the hybrid worker group the webhook job will run on. - RunOn *string `json:"runOn,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // Description - Gets or sets the description of the webhook. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateProperties. -func (wup WebhookUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.IsEnabled != nil { - objectMap["isEnabled"] = wup.IsEnabled - } - if wup.RunOn != nil { - objectMap["runOn"] = wup.RunOn - } - if wup.Parameters != nil { - objectMap["parameters"] = wup.Parameters - } - if wup.Description != nil { - objectMap["description"] = wup.Description - } - return json.Marshal(objectMap) -} - -// WindowsProperties windows specific update configuration. -type WindowsProperties struct { - // IncludedUpdateClassifications - Update classification included in the software update configuration. A comma separated string with required values. Possible values include: 'WindowsUpdateClassesUnclassified', 'WindowsUpdateClassesCritical', 'WindowsUpdateClassesSecurity', 'WindowsUpdateClassesUpdateRollup', 'WindowsUpdateClassesFeaturePack', 'WindowsUpdateClassesServicePack', 'WindowsUpdateClassesDefinition', 'WindowsUpdateClassesTools', 'WindowsUpdateClassesUpdates' - IncludedUpdateClassifications WindowsUpdateClasses `json:"includedUpdateClassifications,omitempty"` - // ExcludedKbNumbers - KB numbers excluded from the software update configuration. - ExcludedKbNumbers *[]string `json:"excludedKbNumbers,omitempty"` - // IncludedKbNumbers - KB numbers included from the software update configuration. - IncludedKbNumbers *[]string `json:"includedKbNumbers,omitempty"` - // RebootSetting - Reboot setting for the software update configuration. - RebootSetting *string `json:"rebootSetting,omitempty"` -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/module.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/module.go deleted file mode 100644 index c7b8ebb8655a..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/module.go +++ /dev/null @@ -1,516 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ModuleClient is the automation Client -type ModuleClient struct { - BaseClient -} - -// NewModuleClient creates an instance of the ModuleClient client. -func NewModuleClient(subscriptionID string) ModuleClient { - return NewModuleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewModuleClientWithBaseURI creates an instance of the ModuleClient 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 NewModuleClientWithBaseURI(baseURI string, subscriptionID string) ModuleClient { - return ModuleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// parameters - the create or update parameters for module. -func (client ModuleClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.ModuleClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, moduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ModuleClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) CreateOrUpdateResponder(resp *http.Response) (result Module, 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 module by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the module name. -func (client ModuleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ModuleClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ModuleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the module name. -func (client ModuleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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("automation.ModuleClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ModuleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) GetResponder(resp *http.Response) (result Module, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of modules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ModuleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.mlr.Response.Response != nil { - sc = result.mlr.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("automation.ModuleClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.mlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.mlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.mlr.hasNextLink() && result.mlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ModuleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ModuleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ModuleClient) ListByAutomationAccountResponder(resp *http.Response) (result ModuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ModuleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ModuleListResult) (result ModuleListResult, err error) { - req, err := lastResults.moduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ModuleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// parameters - the update parameters for module. -func (client ModuleClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ModuleClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, moduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ModuleClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) UpdateResponder(resp *http.Response) (result Module, 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/automation/mgmt/2018-01-15-preview/automation/nodecountinformation.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/nodecountinformation.go deleted file mode 100644 index 37a58f221c3d..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/nodecountinformation.go +++ /dev/null @@ -1,119 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NodeCountInformationClient is the automation Client -type NodeCountInformationClient struct { - BaseClient -} - -// NewNodeCountInformationClient creates an instance of the NodeCountInformationClient client. -func NewNodeCountInformationClient(subscriptionID string) NodeCountInformationClient { - return NewNodeCountInformationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNodeCountInformationClientWithBaseURI creates an instance of the NodeCountInformationClient 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 NewNodeCountInformationClientWithBaseURI(baseURI string, subscriptionID string) NodeCountInformationClient { - return NodeCountInformationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve counts for Dsc Nodes. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// countType - the type of counts to retrieve -func (client NodeCountInformationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, countType CountType) (result NodeCounts, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeCountInformationClient.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("automation.NodeCountInformationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, countType) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeCountInformationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeCountInformationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeCountInformationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NodeCountInformationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, countType CountType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "countType": autorest.Encode("path", countType), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodecounts/{countType}", 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 NodeCountInformationClient) 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 NodeCountInformationClient) GetResponder(resp *http.Response) (result NodeCounts, 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/automation/mgmt/2018-01-15-preview/automation/nodereports.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/nodereports.go deleted file mode 100644 index 7b83fcc63168..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/nodereports.go +++ /dev/null @@ -1,340 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NodeReportsClient is the automation Client -type NodeReportsClient struct { - BaseClient -} - -// NewNodeReportsClient creates an instance of the NodeReportsClient client. -func NewNodeReportsClient(subscriptionID string) NodeReportsClient { - return NewNodeReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNodeReportsClientWithBaseURI creates an instance of the NodeReportsClient 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 NewNodeReportsClientWithBaseURI(baseURI string, subscriptionID string) NodeReportsClient { - return NodeReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the Dsc node report data by node id and report id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the Dsc node id. -// reportID - the report id. -func (client NodeReportsClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result DscNodeReport, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.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("automation.NodeReportsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, nodeID, reportID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NodeReportsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}", 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 NodeReportsClient) 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 NodeReportsClient) GetResponder(resp *http.Response) (result DscNodeReport, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the Dsc node reports by node id and report id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the Dsc node id. -// reportID - the report id. -func (client NodeReportsClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result SetObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.GetContent") - 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("automation.NodeReportsClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, nodeID, reportID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client NodeReportsClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client NodeReportsClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client NodeReportsClient) GetContentResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByNode retrieve the Dsc node report list by node id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the parameters supplied to the list operation. -// filter - the filter to apply on the operation. -func (client NodeReportsClient) ListByNode(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result DscNodeReportListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.ListByNode") - defer func() { - sc := -1 - if result.dnrlr.Response.Response != nil { - sc = result.dnrlr.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("automation.NodeReportsClient", "ListByNode", err.Error()) - } - - result.fn = client.listByNodeNextResults - req, err := client.ListByNodePreparer(ctx, resourceGroupName, automationAccountName, nodeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNodeSender(req) - if err != nil { - result.dnrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure sending request") - return - } - - result.dnrlr, err = client.ListByNodeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure responding to request") - return - } - if result.dnrlr.hasNextLink() && result.dnrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByNodePreparer prepares the ListByNode request. -func (client NodeReportsClient) ListByNodePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNodeSender sends the ListByNode request. The method will close the -// http.Response Body if it receives an error. -func (client NodeReportsClient) ListByNodeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNodeResponder handles the response to the ListByNode request. The method always -// closes the http.Response Body. -func (client NodeReportsClient) ListByNodeResponder(resp *http.Response) (result DscNodeReportListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByNodeNextResults retrieves the next set of results, if any. -func (client NodeReportsClient) listByNodeNextResults(ctx context.Context, lastResults DscNodeReportListResult) (result DscNodeReportListResult, err error) { - req, err := lastResults.dscNodeReportListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "listByNodeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByNodeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "listByNodeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByNodeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "listByNodeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByNodeComplete enumerates all values, automatically crossing page boundaries as required. -func (client NodeReportsClient) ListByNodeComplete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result DscNodeReportListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.ListByNode") - 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.ListByNode(ctx, resourceGroupName, automationAccountName, nodeID, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/objectdatatypes.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/objectdatatypes.go deleted file mode 100644 index 7335603abd67..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/objectdatatypes.go +++ /dev/null @@ -1,206 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ObjectDataTypesClient is the automation Client -type ObjectDataTypesClient struct { - BaseClient -} - -// NewObjectDataTypesClient creates an instance of the ObjectDataTypesClient client. -func NewObjectDataTypesClient(subscriptionID string) ObjectDataTypesClient { - return NewObjectDataTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewObjectDataTypesClientWithBaseURI creates an instance of the ObjectDataTypesClient 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 NewObjectDataTypesClientWithBaseURI(baseURI string, subscriptionID string) ObjectDataTypesClient { - return ObjectDataTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListFieldsByModuleAndType retrieve a list of fields of a given type identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// typeName - the name of type. -func (client ObjectDataTypesClient) ListFieldsByModuleAndType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ObjectDataTypesClient.ListFieldsByModuleAndType") - 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("automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", err.Error()) - } - - req, err := client.ListFieldsByModuleAndTypePreparer(ctx, resourceGroupName, automationAccountName, moduleName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", nil, "Failure preparing request") - return - } - - resp, err := client.ListFieldsByModuleAndTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure sending request") - return - } - - result, err = client.ListFieldsByModuleAndTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure responding to request") - return - } - - return -} - -// ListFieldsByModuleAndTypePreparer prepares the ListFieldsByModuleAndType request. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListFieldsByModuleAndTypeSender sends the ListFieldsByModuleAndType request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListFieldsByModuleAndTypeResponder handles the response to the ListFieldsByModuleAndType request. The method always -// closes the http.Response Body. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeResponder(resp *http.Response) (result TypeFieldListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListFieldsByType retrieve a list of fields of a given type across all accessible modules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// typeName - the name of type. -func (client ObjectDataTypesClient) ListFieldsByType(ctx context.Context, resourceGroupName string, automationAccountName string, typeName string) (result TypeFieldListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ObjectDataTypesClient.ListFieldsByType") - 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("automation.ObjectDataTypesClient", "ListFieldsByType", err.Error()) - } - - req, err := client.ListFieldsByTypePreparer(ctx, resourceGroupName, automationAccountName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListFieldsByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure sending request") - return - } - - result, err = client.ListFieldsByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure responding to request") - return - } - - return -} - -// ListFieldsByTypePreparer prepares the ListFieldsByType request. -func (client ObjectDataTypesClient) ListFieldsByTypePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListFieldsByTypeSender sends the ListFieldsByType request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectDataTypesClient) ListFieldsByTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListFieldsByTypeResponder handles the response to the ListFieldsByType request. The method always -// closes the http.Response Body. -func (client ObjectDataTypesClient) ListFieldsByTypeResponder(resp *http.Response) (result TypeFieldListResult, 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/automation/mgmt/2018-01-15-preview/automation/operations.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/operations.go deleted file mode 100644 index 9b49ff7699af..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation 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 Automation REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Automation/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 -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/runbook.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/runbook.go deleted file mode 100644 index d2c21bc9e042..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/runbook.go +++ /dev/null @@ -1,610 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RunbookClient is the automation Client -type RunbookClient struct { - BaseClient -} - -// NewRunbookClient creates an instance of the RunbookClient client. -func NewRunbookClient(subscriptionID string) RunbookClient { - return NewRunbookClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunbookClientWithBaseURI creates an instance of the RunbookClient 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 NewRunbookClientWithBaseURI(baseURI string, subscriptionID string) RunbookClient { - return RunbookClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// parameters - the create or update parameters for runbook. Provide either content link for a published -// runbook or draft, not both. -func (client RunbookClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (result Runbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.RunbookClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RunbookClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) CreateOrUpdateResponder(resp *http.Response) (result Runbook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusBadRequest), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the runbook by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.RunbookClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RunbookClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) 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 the runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result Runbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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("automation.RunbookClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunbookClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) GetResponder(resp *http.Response) (result Runbook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the content of runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.GetContent") - 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("automation.RunbookClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client RunbookClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client RunbookClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of runbooks. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client RunbookClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result RunbookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.ListByAutomationAccount") - 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("automation.RunbookClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client RunbookClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client RunbookClient) ListByAutomationAccountResponder(resp *http.Response) (result RunbookListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client RunbookClient) listByAutomationAccountNextResults(ctx context.Context, lastResults RunbookListResult) (result RunbookListResult, err error) { - req, err := lastResults.runbookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client RunbookClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result RunbookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update the runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// parameters - the update parameters for runbook. -func (client RunbookClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (result Runbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.RunbookClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RunbookClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) UpdateResponder(resp *http.Response) (result Runbook, 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/automation/mgmt/2018-01-15-preview/automation/runbookdraft.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/runbookdraft.go deleted file mode 100644 index 06b6a1bc8556..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/runbookdraft.go +++ /dev/null @@ -1,470 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "io" - "net/http" -) - -// RunbookDraftClient is the automation Client -type RunbookDraftClient struct { - BaseClient -} - -// NewRunbookDraftClient creates an instance of the RunbookDraftClient client. -func NewRunbookDraftClient(subscriptionID string) RunbookDraftClient { - return NewRunbookDraftClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunbookDraftClientWithBaseURI creates an instance of the RunbookDraftClient 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 NewRunbookDraftClientWithBaseURI(baseURI string, subscriptionID string) RunbookDraftClient { - return RunbookDraftClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the runbook draft identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookDraftClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraft, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.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("automation.RunbookDraftClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunbookDraftClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft", 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 RunbookDraftClient) 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 RunbookDraftClient) GetResponder(resp *http.Response) (result RunbookDraft, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the content of runbook draft identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookDraftClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.GetContent") - 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("automation.RunbookDraftClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client RunbookDraftClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// Publish publish runbook draft. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the parameters supplied to the publish runbook operation. -func (client RunbookDraftClient) Publish(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraftPublishFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.Publish") - 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("automation.RunbookDraftClient", "Publish", err.Error()) - } - - req, err := client.PublishPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", nil, "Failure preparing request") - return - } - - result, err = client.PublishSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", result.Response(), "Failure sending request") - return - } - - return -} - -// PublishPreparer prepares the Publish request. -func (client RunbookDraftClient) PublishPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/publish", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PublishSender sends the Publish request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) PublishSender(req *http.Request) (future RunbookDraftPublishFuture, 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 -} - -// PublishResponder handles the response to the Publish request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) PublishResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ReplaceContent replaces the runbook draft content. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// runbookContent - the runbook draft content. -func (client RunbookDraftClient) ReplaceContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser) (result RunbookDraftReplaceContentFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.ReplaceContent") - 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("automation.RunbookDraftClient", "ReplaceContent", err.Error()) - } - - req, err := client.ReplaceContentPreparer(ctx, resourceGroupName, automationAccountName, runbookName, runbookContent) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "ReplaceContent", nil, "Failure preparing request") - return - } - - result, err = client.ReplaceContentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "ReplaceContent", result.Response(), "Failure sending request") - return - } - - return -} - -// ReplaceContentPreparer prepares the ReplaceContent request. -func (client RunbookDraftClient) ReplaceContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("text/powershell"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), - autorest.WithFile(runbookContent), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReplaceContentSender sends the ReplaceContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) ReplaceContentSender(req *http.Request) (future RunbookDraftReplaceContentFuture, 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 -} - -// ReplaceContentResponder handles the response to the ReplaceContent request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) ReplaceContentResponder(resp *http.Response) (result ReadCloser, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UndoEdit undo draft edit to last known published state identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookDraftClient) UndoEdit(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraftUndoEditResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.UndoEdit") - 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("automation.RunbookDraftClient", "UndoEdit", err.Error()) - } - - req, err := client.UndoEditPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", nil, "Failure preparing request") - return - } - - resp, err := client.UndoEditSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure sending request") - return - } - - result, err = client.UndoEditResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure responding to request") - return - } - - return -} - -// UndoEditPreparer prepares the UndoEdit request. -func (client RunbookDraftClient) UndoEditPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UndoEditSender sends the UndoEdit request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) UndoEditSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UndoEditResponder handles the response to the UndoEdit request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) UndoEditResponder(resp *http.Response) (result RunbookDraftUndoEditResult, 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/automation/mgmt/2018-01-15-preview/automation/schedule.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/schedule.go deleted file mode 100644 index 18ebbd426e1c..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/schedule.go +++ /dev/null @@ -1,511 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ScheduleClient is the automation Client -type ScheduleClient struct { - BaseClient -} - -// NewScheduleClient creates an instance of the ScheduleClient client. -func NewScheduleClient(subscriptionID string) ScheduleClient { - return NewScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduleClientWithBaseURI creates an instance of the ScheduleClient 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 NewScheduleClientWithBaseURI(baseURI string, subscriptionID string) ScheduleClient { - return ScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a schedule. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -// parameters - the parameters supplied to the create or update schedule operation. -func (client ScheduleClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ScheduleCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ScheduleCreateOrUpdateProperties.StartTime", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.ScheduleClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, scheduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduleClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the schedule identified by schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -func (client ScheduleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ScheduleClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, scheduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the schedule identified by schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -func (client ScheduleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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("automation.ScheduleClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, scheduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of schedules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ScheduleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ScheduleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.ListByAutomationAccount") - 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("automation.ScheduleClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ScheduleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result ScheduleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ScheduleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ScheduleListResult) (result ScheduleListResult, err error) { - req, err := lastResults.scheduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScheduleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ScheduleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update the schedule identified by schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -// parameters - the parameters supplied to the update schedule operation. -func (client ScheduleClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ScheduleClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, scheduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduleClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) UpdateResponder(resp *http.Response) (result Schedule, 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/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurationmachineruns.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurationmachineruns.go deleted file mode 100644 index d566079f385a..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurationmachineruns.go +++ /dev/null @@ -1,228 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SoftwareUpdateConfigurationMachineRunsClient is the automation Client -type SoftwareUpdateConfigurationMachineRunsClient struct { - BaseClient -} - -// NewSoftwareUpdateConfigurationMachineRunsClient creates an instance of the -// SoftwareUpdateConfigurationMachineRunsClient client. -func NewSoftwareUpdateConfigurationMachineRunsClient(subscriptionID string) SoftwareUpdateConfigurationMachineRunsClient { - return NewSoftwareUpdateConfigurationMachineRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSoftwareUpdateConfigurationMachineRunsClientWithBaseURI creates an instance of the -// SoftwareUpdateConfigurationMachineRunsClient 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 NewSoftwareUpdateConfigurationMachineRunsClientWithBaseURI(baseURI string, subscriptionID string) SoftwareUpdateConfigurationMachineRunsClient { - return SoftwareUpdateConfigurationMachineRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByID get a single software update configuration machine run by Id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationMachineRunID - the Id of the software update configuration machine run. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationMachineRunID uuid.UUID, clientRequestID string) (result SoftwareUpdateConfigurationMachineRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationMachineRunsClient.GetByID") - 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("automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", err.Error()) - } - - req, err := client.GetByIDPreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunID, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByIDPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationMachineRunID uuid.UUID, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationMachineRunId": autorest.Encode("path", softwareUpdateConfigurationMachineRunID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns/{softwareUpdateConfigurationMachineRunId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByIDResponder(resp *http.Response) (result SoftwareUpdateConfigurationMachineRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List return list of software update configuration machine runs -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// clientRequestID - identifies this specific client request. -// filter - the filter to apply on the operation. You can use the following filters: 'properties/osType', -// 'properties/status', 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' -// skip - number of entries you skip before returning results -// top - maximum number of entries returned in the results collection -func (client SoftwareUpdateConfigurationMachineRunsClient) List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result SoftwareUpdateConfigurationMachineRunListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationMachineRunsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationMachineRunsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, automationAccountName, clientRequestID, filter, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SoftwareUpdateConfigurationMachineRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skip) > 0 { - queryParameters["$skip"] = autorest.Encode("query", skip) - } - if len(top) > 0 { - queryParameters["$top"] = autorest.Encode("query", top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationMachineRunsClient) 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 SoftwareUpdateConfigurationMachineRunsClient) ListResponder(resp *http.Response) (result SoftwareUpdateConfigurationMachineRunListResult, 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/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurationruns.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurationruns.go deleted file mode 100644 index 09e9220a07a8..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurationruns.go +++ /dev/null @@ -1,227 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SoftwareUpdateConfigurationRunsClient is the automation Client -type SoftwareUpdateConfigurationRunsClient struct { - BaseClient -} - -// NewSoftwareUpdateConfigurationRunsClient creates an instance of the SoftwareUpdateConfigurationRunsClient client. -func NewSoftwareUpdateConfigurationRunsClient(subscriptionID string) SoftwareUpdateConfigurationRunsClient { - return NewSoftwareUpdateConfigurationRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSoftwareUpdateConfigurationRunsClientWithBaseURI creates an instance of the SoftwareUpdateConfigurationRunsClient -// 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 NewSoftwareUpdateConfigurationRunsClientWithBaseURI(baseURI string, subscriptionID string) SoftwareUpdateConfigurationRunsClient { - return SoftwareUpdateConfigurationRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByID get a single software update configuration Run by Id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationRunID - the Id of the software update configuration run. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationRunsClient) GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationRunID uuid.UUID, clientRequestID string) (result SoftwareUpdateConfigurationRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationRunsClient.GetByID") - 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("automation.SoftwareUpdateConfigurationRunsClient", "GetByID", err.Error()) - } - - req, err := client.GetByIDPreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationRunID, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client SoftwareUpdateConfigurationRunsClient) GetByIDPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationRunID uuid.UUID, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationRunId": autorest.Encode("path", softwareUpdateConfigurationRunID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns/{softwareUpdateConfigurationRunId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client SoftwareUpdateConfigurationRunsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client SoftwareUpdateConfigurationRunsClient) GetByIDResponder(resp *http.Response) (result SoftwareUpdateConfigurationRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List return list of software update configuration runs -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// clientRequestID - identifies this specific client request. -// filter - the filter to apply on the operation. You can use the following filters: 'properties/osType', -// 'properties/status', 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' -// skip - number of entries you skip before returning results -// top - maximum number of entries returned in the results collection -func (client SoftwareUpdateConfigurationRunsClient) List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result SoftwareUpdateConfigurationRunListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationRunsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationRunsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, automationAccountName, clientRequestID, filter, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SoftwareUpdateConfigurationRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skip) > 0 { - queryParameters["$skip"] = autorest.Encode("query", skip) - } - if len(top) > 0 { - queryParameters["$top"] = autorest.Encode("query", top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationRunsClient) 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 SoftwareUpdateConfigurationRunsClient) ListResponder(resp *http.Response) (result SoftwareUpdateConfigurationRunListResult, 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/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurations.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurations.go deleted file mode 100644 index 50de7018d6d1..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/softwareupdateconfigurations.go +++ /dev/null @@ -1,409 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SoftwareUpdateConfigurationsClient is the automation Client -type SoftwareUpdateConfigurationsClient struct { - BaseClient -} - -// NewSoftwareUpdateConfigurationsClient creates an instance of the SoftwareUpdateConfigurationsClient client. -func NewSoftwareUpdateConfigurationsClient(subscriptionID string) SoftwareUpdateConfigurationsClient { - return NewSoftwareUpdateConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSoftwareUpdateConfigurationsClientWithBaseURI creates an instance of the SoftwareUpdateConfigurationsClient -// 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 NewSoftwareUpdateConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SoftwareUpdateConfigurationsClient { - return SoftwareUpdateConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a new software update configuration with the name given in the URI. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationName - the name of the software update configuration to be created. -// parameters - request body. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationsClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, parameters SoftwareUpdateConfiguration, clientRequestID string) (result SoftwareUpdateConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SoftwareUpdateConfigurationProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SoftwareUpdateConfigurationProperties.UpdateConfiguration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SoftwareUpdateConfigurationProperties.ScheduleInfo", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SoftwareUpdateConfigurationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, parameters SoftwareUpdateConfiguration, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationName": autorest.Encode("path", softwareUpdateConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Name = nil - parameters.ID = nil - parameters.Type = 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationsClient) 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 SoftwareUpdateConfigurationsClient) CreateResponder(resp *http.Response) (result SoftwareUpdateConfiguration, 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 specific software update configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationName - the name of the software update configuration to be created. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SoftwareUpdateConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationName": autorest.Encode("path", softwareUpdateConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationsClient) 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 SoftwareUpdateConfigurationsClient) 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 -} - -// GetByName get a single software update configuration by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationName - the name of the software update configuration to be created. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationsClient) GetByName(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result SoftwareUpdateConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.GetByName") - 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("automation.SoftwareUpdateConfigurationsClient", "GetByName", err.Error()) - } - - req, err := client.GetByNamePreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "GetByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "GetByName", resp, "Failure sending request") - return - } - - result, err = client.GetByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "GetByName", resp, "Failure responding to request") - return - } - - return -} - -// GetByNamePreparer prepares the GetByName request. -func (client SoftwareUpdateConfigurationsClient) GetByNamePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationName": autorest.Encode("path", softwareUpdateConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByNameSender sends the GetByName request. The method will close the -// http.Response Body if it receives an error. -func (client SoftwareUpdateConfigurationsClient) GetByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByNameResponder handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (client SoftwareUpdateConfigurationsClient) GetByNameResponder(resp *http.Response) (result SoftwareUpdateConfiguration, 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 software update configurations for the account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// clientRequestID - identifies this specific client request. -// filter - the filter to apply on the operation. -func (client SoftwareUpdateConfigurationsClient) List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string) (result SoftwareUpdateConfigurationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, automationAccountName, clientRequestID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SoftwareUpdateConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationsClient) 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 SoftwareUpdateConfigurationsClient) ListResponder(resp *http.Response) (result SoftwareUpdateConfigurationListResult, 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/automation/mgmt/2018-01-15-preview/automation/sourcecontrol.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrol.go deleted file mode 100644 index 4acf374adbb9..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrol.go +++ /dev/null @@ -1,528 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation Client -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)} -} - -// CreateOrUpdate create a source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// parameters - the parameters supplied to the create or update source control operation. -func (client SourceControlClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlCreateOrUpdateParameters) (result SourceControl, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.RepoURL", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.RepoURL", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.Branch", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.Branch", Name: validation.MaxLength, Rule: 255, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.FolderPath", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.FolderPath", Name: validation.MaxLength, Rule: 255, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.AccessToken", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.AccessToken", Name: validation.MaxLength, Rule: 1024, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.RefreshToken", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.RefreshToken", Name: validation.MaxLength, Rule: 1024, Chain: nil}}}, - }}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.Description", Name: validation.MaxLength, Rule: 512, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("automation.SourceControlClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SourceControlClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) CreateOrUpdateResponder(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 the source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the name of source control. -func (client SourceControlClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SourceControlClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SourceControlClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the source control identified by source control name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the name of source control. -func (client SourceControlClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result SourceControl, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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("automation.SourceControlClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SourceControlClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) 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 -} - -// ListByAutomationAccount retrieve a list of source controls. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client SourceControlClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result SourceControlListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.sclr.Response.Response != nil { - sc = result.sclr.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("automation.SourceControlClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.sclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.sclr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.sclr.hasNextLink() && result.sclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client SourceControlClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/sourceControls", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client SourceControlClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client SourceControlClient) ListByAutomationAccountResponder(resp *http.Response) (result SourceControlListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client SourceControlClient) listByAutomationAccountNextResults(ctx context.Context, lastResults SourceControlListResult) (result SourceControlListResult, err error) { - req, err := lastResults.sourceControlListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.SourceControlClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.SourceControlClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client SourceControlClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result SourceControlListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update a source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// parameters - the parameters supplied to the update source control operation. -func (client SourceControlClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlUpdateParameters) (result SourceControl, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SourceControlClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SourceControlClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) UpdateResponder(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 -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrolsyncjob.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrolsyncjob.go deleted file mode 100644 index f7a08e39b86e..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrolsyncjob.go +++ /dev/null @@ -1,350 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SourceControlSyncJobClient is the automation Client -type SourceControlSyncJobClient struct { - BaseClient -} - -// NewSourceControlSyncJobClient creates an instance of the SourceControlSyncJobClient client. -func NewSourceControlSyncJobClient(subscriptionID string) SourceControlSyncJobClient { - return NewSourceControlSyncJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSourceControlSyncJobClientWithBaseURI creates an instance of the SourceControlSyncJobClient 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 NewSourceControlSyncJobClientWithBaseURI(baseURI string, subscriptionID string) SourceControlSyncJobClient { - return SourceControlSyncJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates the sync job for a source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -// parameters - the parameters supplied to the create source control sync job operation. -func (client SourceControlSyncJobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, parameters SourceControlSyncJobCreateParameters) (result SourceControlSyncJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SourceControlSyncJobCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SourceControlSyncJobCreateProperties.CommitID", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SourceControlSyncJobCreateProperties.CommitID", Name: validation.MinLength, Rule: 0, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("automation.SourceControlSyncJobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SourceControlSyncJobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, parameters SourceControlSyncJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}", 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 SourceControlSyncJobClient) 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 SourceControlSyncJobClient) CreateResponder(resp *http.Response) (result SourceControlSyncJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the source control sync job identified by job id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -func (client SourceControlSyncJobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID) (result SourceControlSyncJobByID, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.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("automation.SourceControlSyncJobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SourceControlSyncJobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}", 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 SourceControlSyncJobClient) 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 SourceControlSyncJobClient) GetResponder(resp *http.Response) (result SourceControlSyncJobByID, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of source control sync jobs. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// filter - the filter to apply on the operation. -func (client SourceControlSyncJobClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result SourceControlSyncJobListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.scsjlr.Response.Response != nil { - sc = result.scsjlr.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("automation.SourceControlSyncJobClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.scsjlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.scsjlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.scsjlr.hasNextLink() && result.scsjlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client SourceControlSyncJobClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client SourceControlSyncJobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client SourceControlSyncJobClient) ListByAutomationAccountResponder(resp *http.Response) (result SourceControlSyncJobListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client SourceControlSyncJobClient) listByAutomationAccountNextResults(ctx context.Context, lastResults SourceControlSyncJobListResult) (result SourceControlSyncJobListResult, err error) { - req, err := lastResults.sourceControlSyncJobListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client SourceControlSyncJobClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result SourceControlSyncJobListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, sourceControlName, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrolsyncjobstreams.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrolsyncjobstreams.go deleted file mode 100644 index 56327b1605f8..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/sourcecontrolsyncjobstreams.go +++ /dev/null @@ -1,258 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SourceControlSyncJobStreamsClient is the automation Client -type SourceControlSyncJobStreamsClient struct { - BaseClient -} - -// NewSourceControlSyncJobStreamsClient creates an instance of the SourceControlSyncJobStreamsClient client. -func NewSourceControlSyncJobStreamsClient(subscriptionID string) SourceControlSyncJobStreamsClient { - return NewSourceControlSyncJobStreamsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSourceControlSyncJobStreamsClientWithBaseURI creates an instance of the SourceControlSyncJobStreamsClient 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 NewSourceControlSyncJobStreamsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlSyncJobStreamsClient { - return SourceControlSyncJobStreamsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve a sync job stream identified by stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -// streamID - the id of the sync job stream. -func (client SourceControlSyncJobStreamsClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, streamID string) (result SourceControlSyncJobStreamByID, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsClient.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("automation.SourceControlSyncJobStreamsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, streamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SourceControlSyncJobStreamsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, streamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "streamId": autorest.Encode("path", streamID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams/{streamId}", 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 SourceControlSyncJobStreamsClient) 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 SourceControlSyncJobStreamsClient) GetResponder(resp *http.Response) (result SourceControlSyncJobStreamByID, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySyncJob retrieve a list of sync job streams identified by sync job id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -// filter - the filter to apply on the operation. -func (client SourceControlSyncJobStreamsClient) ListBySyncJob(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result SourceControlSyncJobStreamsListBySyncJobPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsClient.ListBySyncJob") - defer func() { - sc := -1 - if result.scsjslbsj.Response.Response != nil { - sc = result.scsjslbsj.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("automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", err.Error()) - } - - result.fn = client.listBySyncJobNextResults - req, err := client.ListBySyncJobPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySyncJobSender(req) - if err != nil { - result.scsjslbsj.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", resp, "Failure sending request") - return - } - - result.scsjslbsj, err = client.ListBySyncJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", resp, "Failure responding to request") - return - } - if result.scsjslbsj.hasNextLink() && result.scsjslbsj.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySyncJobPreparer prepares the ListBySyncJob request. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySyncJobSender sends the ListBySyncJob request. The method will close the -// http.Response Body if it receives an error. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySyncJobResponder handles the response to the ListBySyncJob request. The method always -// closes the http.Response Body. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobResponder(resp *http.Response) (result SourceControlSyncJobStreamsListBySyncJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySyncJobNextResults retrieves the next set of results, if any. -func (client SourceControlSyncJobStreamsClient) listBySyncJobNextResults(ctx context.Context, lastResults SourceControlSyncJobStreamsListBySyncJob) (result SourceControlSyncJobStreamsListBySyncJob, err error) { - req, err := lastResults.sourceControlSyncJobStreamsListBySyncJobPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "listBySyncJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySyncJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "listBySyncJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySyncJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "listBySyncJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySyncJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result SourceControlSyncJobStreamsListBySyncJobIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsClient.ListBySyncJob") - 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.ListBySyncJob(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/statistics.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/statistics.go deleted file mode 100644 index d7428a0f113e..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/statistics.go +++ /dev/null @@ -1,120 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// StatisticsClient is the automation Client -type StatisticsClient struct { - BaseClient -} - -// NewStatisticsClient creates an instance of the StatisticsClient client. -func NewStatisticsClient(subscriptionID string) StatisticsClient { - return NewStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewStatisticsClientWithBaseURI creates an instance of the StatisticsClient 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 NewStatisticsClientWithBaseURI(baseURI string, subscriptionID string) StatisticsClient { - return StatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the statistics for the account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client StatisticsClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result StatisticsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StatisticsClient.ListByAutomationAccount") - 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("automation.StatisticsClient", "ListByAutomationAccount", err.Error()) - } - - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client StatisticsClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/statistics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client StatisticsClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client StatisticsClient) ListByAutomationAccountResponder(resp *http.Response) (result StatisticsListResult, 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/automation/mgmt/2018-01-15-preview/automation/testjob.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/testjob.go deleted file mode 100644 index dc1d7eab727d..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/testjob.go +++ /dev/null @@ -1,462 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TestJobClient is the automation Client -type TestJobClient struct { - BaseClient -} - -// NewTestJobClient creates an instance of the TestJobClient client. -func NewTestJobClient(subscriptionID string) TestJobClient { - return NewTestJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTestJobClientWithBaseURI creates an instance of the TestJobClient 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 NewTestJobClientWithBaseURI(baseURI string, subscriptionID string) TestJobClient { - return TestJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a test job of the runbook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the parameters supplied to the create test job operation. -// parameters - the parameters supplied to the create test job operation. -func (client TestJobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (result TestJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.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("automation.TestJobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TestJobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", 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 TestJobClient) 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 TestJobClient) CreateResponder(resp *http.Response) (result TestJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the test job for the specified runbook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result TestJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.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("automation.TestJobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TestJobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", 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 TestJobClient) 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 TestJobClient) GetResponder(resp *http.Response) (result TestJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Resume resume the test job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Resume(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.Resume") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.TestJobClient", "Resume", err.Error()) - } - - req, err := client.ResumePreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Resume", resp, "Failure responding to request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client TestJobClient) ResumePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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 TestJobClient) ResumeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client TestJobClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop the test job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.Stop") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.TestJobClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client TestJobClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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 TestJobClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client TestJobClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Suspend suspend the test job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.Suspend") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.TestJobClient", "Suspend", err.Error()) - } - - req, err := client.SuspendPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Suspend", resp, "Failure responding to request") - return - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client TestJobClient) SuspendPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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 TestJobClient) SuspendSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client TestJobClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/testjobstreams.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/testjobstreams.go deleted file mode 100644 index 4d3cfe0c34bc..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/testjobstreams.go +++ /dev/null @@ -1,252 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TestJobStreamsClient is the automation Client -type TestJobStreamsClient struct { - BaseClient -} - -// NewTestJobStreamsClient creates an instance of the TestJobStreamsClient client. -func NewTestJobStreamsClient(subscriptionID string) TestJobStreamsClient { - return NewTestJobStreamsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTestJobStreamsClientWithBaseURI creates an instance of the TestJobStreamsClient 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 NewTestJobStreamsClientWithBaseURI(baseURI string, subscriptionID string) TestJobStreamsClient { - return TestJobStreamsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve a test job stream of the test job identified by runbook name and stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// jobStreamID - the job stream id. -func (client TestJobStreamsClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (result JobStream, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobStreamsClient.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("automation.TestJobStreamsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName, jobStreamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TestJobStreamsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}", 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 TestJobStreamsClient) 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 TestJobStreamsClient) GetResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByTestJob retrieve a list of test job streams identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// filter - the filter to apply on the operation. -func (client TestJobStreamsClient) ListByTestJob(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result JobStreamListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobStreamsClient.ListByTestJob") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.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("automation.TestJobStreamsClient", "ListByTestJob", err.Error()) - } - - result.fn = client.listByTestJobNextResults - req, err := client.ListByTestJobPreparer(ctx, resourceGroupName, automationAccountName, runbookName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTestJobSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByTestJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTestJobPreparer prepares the ListByTestJob request. -func (client TestJobStreamsClient) ListByTestJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTestJobSender sends the ListByTestJob request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobStreamsClient) ListByTestJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTestJobResponder handles the response to the ListByTestJob request. The method always -// closes the http.Response Body. -func (client TestJobStreamsClient) ListByTestJobResponder(resp *http.Response) (result JobStreamListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTestJobNextResults retrieves the next set of results, if any. -func (client TestJobStreamsClient) listByTestJobNextResults(ctx context.Context, lastResults JobStreamListResult) (result JobStreamListResult, err error) { - req, err := lastResults.jobStreamListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "listByTestJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTestJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "listByTestJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTestJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "listByTestJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTestJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client TestJobStreamsClient) ListByTestJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result JobStreamListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobStreamsClient.ListByTestJob") - 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.ListByTestJob(ctx, resourceGroupName, automationAccountName, runbookName, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/usages.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/usages.go deleted file mode 100644 index ee9027e720bc..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/usages.go +++ /dev/null @@ -1,116 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UsagesClient is the automation Client -type UsagesClient struct { - BaseClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient 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 NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the usage for the account id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client UsagesClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result UsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.ListByAutomationAccount") - 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("automation.UsagesClient", "ListByAutomationAccount", err.Error()) - } - - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client UsagesClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListByAutomationAccountResponder(resp *http.Response) (result UsageListResult, 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/automation/mgmt/2018-01-15-preview/automation/variable.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/variable.go deleted file mode 100644 index f1a905628f9f..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/variable.go +++ /dev/null @@ -1,510 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// VariableClient is the automation Client -type VariableClient struct { - BaseClient -} - -// NewVariableClient creates an instance of the VariableClient client. -func NewVariableClient(subscriptionID string) VariableClient { - return NewVariableClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVariableClientWithBaseURI creates an instance of the VariableClient 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 NewVariableClientWithBaseURI(baseURI string, subscriptionID string) VariableClient { - return VariableClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a variable. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the variable name. -// parameters - the parameters supplied to the create or update variable operation. -func (client VariableClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (result Variable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.VariableCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.VariableClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, variableName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VariableClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) CreateOrUpdateResponder(resp *http.Response) (result Variable, 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 variable. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the name of variable. -func (client VariableClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.VariableClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, variableName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VariableClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the variable identified by variable name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the name of variable. -func (client VariableClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result Variable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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("automation.VariableClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, variableName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VariableClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) GetResponder(resp *http.Response) (result Variable, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of variables. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client VariableClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result VariableListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.vlr.Response.Response != nil { - sc = result.vlr.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("automation.VariableClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.vlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.vlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.vlr.hasNextLink() && result.vlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client VariableClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client VariableClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client VariableClient) ListByAutomationAccountResponder(resp *http.Response) (result VariableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client VariableClient) listByAutomationAccountNextResults(ctx context.Context, lastResults VariableListResult) (result VariableListResult, err error) { - req, err := lastResults.variableListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.VariableClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.VariableClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client VariableClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result VariableListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a variable. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the variable name. -// parameters - the parameters supplied to the update variable operation. -func (client VariableClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (result Variable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.VariableClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, variableName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VariableClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) UpdateResponder(resp *http.Response) (result Variable, 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/automation/mgmt/2018-01-15-preview/automation/version.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/version.go deleted file mode 100644 index d894ed99d27e..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package automation - -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() + " automation/2018-01-15-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/watcher.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/watcher.go deleted file mode 100644 index f7ca3de8421f..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/watcher.go +++ /dev/null @@ -1,681 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WatcherClient is the automation Client -type WatcherClient struct { - BaseClient -} - -// NewWatcherClient creates an instance of the WatcherClient client. -func NewWatcherClient(subscriptionID string) WatcherClient { - return NewWatcherClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWatcherClientWithBaseURI creates an instance of the WatcherClient 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 NewWatcherClientWithBaseURI(baseURI string, subscriptionID string) WatcherClient { - return WatcherClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -// parameters - the create or update parameters for watcher. -func (client WatcherClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters Watcher) (result Watcher, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, watcherName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WatcherClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters Watcher) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) 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 WatcherClient) CreateOrUpdateResponder(resp *http.Response) (result Watcher, 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 watcher by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -func (client WatcherClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, watcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WatcherClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) 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 WatcherClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -func (client WatcherClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result Watcher, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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("automation.WatcherClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, watcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WatcherClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) 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 WatcherClient) GetResponder(resp *http.Response) (result Watcher, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of watchers. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client WatcherClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WatcherListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.ListByAutomationAccount") - 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: 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("automation.WatcherClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client WatcherClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/watchers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client WatcherClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client WatcherClient) ListByAutomationAccountResponder(resp *http.Response) (result WatcherListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client WatcherClient) listByAutomationAccountNextResults(ctx context.Context, lastResults WatcherListResult) (result WatcherListResult, err error) { - req, err := lastResults.watcherListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client WatcherClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WatcherListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Start resume the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -func (client WatcherClient) Start(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Start") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, automationAccountName, watcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", nil, "Failure preparing request") - return - } - - resp, err := client.StartSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", resp, "Failure sending request") - return - } - - result, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", resp, "Failure responding to request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client WatcherClient) StartPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/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 WatcherClient) StartSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client WatcherClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop resume the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -func (client WatcherClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Stop") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, watcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client WatcherClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/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 WatcherClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client WatcherClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -// parameters - the update parameters for watcher. -func (client WatcherClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters WatcherUpdateParameters) (result Watcher, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, watcherName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WatcherClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters WatcherUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) 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 WatcherClient) UpdateResponder(resp *http.Response) (result Watcher, 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/automation/mgmt/2018-01-15-preview/automation/webhook.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/webhook.go deleted file mode 100644 index 302cfc5d2402..000000000000 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/webhook.go +++ /dev/null @@ -1,598 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WebhookClient is the automation Client -type WebhookClient struct { - BaseClient -} - -// NewWebhookClient creates an instance of the WebhookClient client. -func NewWebhookClient(subscriptionID string) WebhookClient { - return NewWebhookClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhookClientWithBaseURI creates an instance of the WebhookClient 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 NewWebhookClientWithBaseURI(baseURI string, subscriptionID string) WebhookClient { - return WebhookClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the webhook identified by webhook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -// parameters - the create or update parameters for webhook. -func (client WebhookClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WebhookCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WebhookClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, webhookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WebhookClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) CreateOrUpdateResponder(resp *http.Response) (result Webhook, 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 webhook by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -func (client WebhookClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WebhookClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhookClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateURI generates a Uri for use in creating a webhook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client WebhookClient) GenerateURI(ctx context.Context, resourceGroupName string, automationAccountName string) (result String, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.GenerateURI") - 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("automation.WebhookClient", "GenerateURI", err.Error()) - } - - req, err := client.GenerateURIPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateURISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure sending request") - return - } - - result, err = client.GenerateURIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure responding to request") - return - } - - return -} - -// GenerateURIPreparer prepares the GenerateURI request. -func (client WebhookClient) GenerateURIPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateURISender sends the GenerateURI request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) GenerateURISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateURIResponder handles the response to the GenerateURI request. The method always -// closes the http.Response Body. -func (client WebhookClient) GenerateURIResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the webhook identified by webhook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -func (client WebhookClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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("automation.WebhookClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhookClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of webhooks. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client WebhookClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.ListByAutomationAccount") - 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: 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("automation.WebhookClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client WebhookClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/webhooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client WebhookClient) ListByAutomationAccountResponder(resp *http.Response) (result WebhookListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client WebhookClient) listByAutomationAccountNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhookClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update the webhook identified by webhook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -// parameters - the update parameters for webhook. -func (client WebhookClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WebhookClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, webhookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhookClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) UpdateResponder(resp *http.Response) (result Webhook, 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/automation/mgmt/2018-06-30-preview/automation/CHANGELOG.md b/services/preview/automation/mgmt/2018-06-30-preview/automation/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/_meta.json b/services/preview/automation/mgmt/2018-06-30-preview/automation/_meta.json deleted file mode 100644 index ba6fc4135afb..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", - "tag": "package-2018-06-preview", - "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-2018-06-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/account.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/account.go deleted file mode 100644 index f9c7a69a123d..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/account.go +++ /dev/null @@ -1,610 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation 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)} -} - -// CreateOrUpdate create or update automation account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// parameters - parameters supplied to the create or update automation account. -func (client AccountClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.AccountClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AccountClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}", 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 AccountClient) 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 AccountClient) CreateOrUpdateResponder(resp *http.Response) (result Account, 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 an automation account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client AccountClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.AccountClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", 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) (*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 AccountClient) 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 information about an Automation Account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client AccountClient) Get(ctx context.Context, resourceGroupName string, automationAccountName 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: 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("automation.AccountClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.AccountClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", 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 -} - -// List retrieve a list of accounts within a given 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, "automation.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, "automation.AccountClient", "List", resp, "Failure sending request") - return - } - - result.alr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts", 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, "automation.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, "automation.AccountClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 retrieve a list of accounts within a given resource group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -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) - }() - } - 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("automation.AccountClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.AccountClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts", 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, "automation.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, "automation.AccountClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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 -} - -// Update update an automation account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// parameters - parameters supplied to the update automation account. -func (client AccountClient) Update(ctx context.Context, resourceGroupName string, automationAccountName 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: 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("automation.AccountClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.AccountClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}", 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/preview/automation/mgmt/2018-06-30-preview/automation/activity.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/activity.go deleted file mode 100644 index 5612b8c1f186..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/activity.go +++ /dev/null @@ -1,248 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ActivityClient is the automation Client -type ActivityClient struct { - BaseClient -} - -// NewActivityClient creates an instance of the ActivityClient client. -func NewActivityClient(subscriptionID string) ActivityClient { - return NewActivityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityClientWithBaseURI creates an instance of the ActivityClient 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 NewActivityClientWithBaseURI(baseURI string, subscriptionID string) ActivityClient { - return ActivityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the activity in the module identified by module name and activity name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// activityName - the name of activity. -func (client ActivityClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, activityName string) (result Activity, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityClient.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("automation.ActivityClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, moduleName, activityName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, activityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityName": autorest.Encode("path", activityName), - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}", 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 ActivityClient) 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 ActivityClient) GetResponder(resp *http.Response) (result Activity, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByModule retrieve a list of activities in the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -func (client ActivityClient) ListByModule(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result ActivityListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityClient.ListByModule") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.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("automation.ActivityClient", "ListByModule", err.Error()) - } - - result.fn = client.listByModuleNextResults - req, err := client.ListByModulePreparer(ctx, resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByModuleSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByModuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByModulePreparer prepares the ListByModule request. -func (client ActivityClient) ListByModulePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByModuleSender sends the ListByModule request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityClient) ListByModuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByModuleResponder handles the response to the ListByModule request. The method always -// closes the http.Response Body. -func (client ActivityClient) ListByModuleResponder(resp *http.Response) (result ActivityListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByModuleNextResults retrieves the next set of results, if any. -func (client ActivityClient) listByModuleNextResults(ctx context.Context, lastResults ActivityListResult) (result ActivityListResult, err error) { - req, err := lastResults.activityListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "listByModuleNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByModuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "listByModuleNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByModuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "listByModuleNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByModuleComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityClient) ListByModuleComplete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result ActivityListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityClient.ListByModule") - 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.ListByModule(ctx, resourceGroupName, automationAccountName, moduleName) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/agentregistrationinformation.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/agentregistrationinformation.go deleted file mode 100644 index c7662bb837fc..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/agentregistrationinformation.go +++ /dev/null @@ -1,204 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AgentRegistrationInformationClient is the automation Client -type AgentRegistrationInformationClient struct { - BaseClient -} - -// NewAgentRegistrationInformationClient creates an instance of the AgentRegistrationInformationClient client. -func NewAgentRegistrationInformationClient(subscriptionID string) AgentRegistrationInformationClient { - return NewAgentRegistrationInformationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgentRegistrationInformationClientWithBaseURI creates an instance of the AgentRegistrationInformationClient -// 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 NewAgentRegistrationInformationClientWithBaseURI(baseURI string, subscriptionID string) AgentRegistrationInformationClient { - return AgentRegistrationInformationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the automation agent registration information. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client AgentRegistrationInformationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result AgentRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentRegistrationInformationClient.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("automation.AgentRegistrationInformationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgentRegistrationInformationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation", 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 AgentRegistrationInformationClient) 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 AgentRegistrationInformationClient) GetResponder(resp *http.Response) (result AgentRegistration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a primary or secondary agent registration key -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// parameters - the name of the agent registration key to be regenerated -func (client AgentRegistrationInformationClient) RegenerateKey(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (result AgentRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentRegistrationInformationClient.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: 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("automation.AgentRegistrationInformationClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AgentRegistrationInformationClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - 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.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey", 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 AgentRegistrationInformationClient) 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 AgentRegistrationInformationClient) RegenerateKeyResponder(resp *http.Response) (result AgentRegistration, 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/automation/mgmt/2018-06-30-preview/automation/automationapi/interfaces.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/automationapi/interfaces.go deleted file mode 100644 index afedbff3d9e3..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/automationapi/interfaces.go +++ /dev/null @@ -1,435 +0,0 @@ -package automationapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/automation/mgmt/2018-06-30-preview/automation" - "github.com/Azure/go-autorest/autorest" - "github.com/gofrs/uuid" - "io" -) - -// AccountClientAPI contains the set of methods on the AccountClient type. -type AccountClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, parameters automation.AccountCreateOrUpdateParameters) (result automation.Account, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.Account, err error) - List(ctx context.Context) (result automation.AccountListResultPage, err error) - ListComplete(ctx context.Context) (result automation.AccountListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result automation.AccountListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result automation.AccountListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, parameters automation.AccountUpdateParameters) (result automation.Account, err error) -} - -var _ AccountClientAPI = (*automation.AccountClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result automation.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*automation.OperationsClient)(nil) - -// StatisticsClientAPI contains the set of methods on the StatisticsClient type. -type StatisticsClientAPI interface { - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.StatisticsListResult, err error) -} - -var _ StatisticsClientAPI = (*automation.StatisticsClient)(nil) - -// UsagesClientAPI contains the set of methods on the UsagesClient type. -type UsagesClientAPI interface { - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.UsageListResult, err error) -} - -var _ UsagesClientAPI = (*automation.UsagesClient)(nil) - -// KeysClientAPI contains the set of methods on the KeysClient type. -type KeysClientAPI interface { - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.KeyListResult, err error) -} - -var _ KeysClientAPI = (*automation.KeysClient)(nil) - -// CertificateClientAPI contains the set of methods on the CertificateClient type. -type CertificateClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters automation.CertificateCreateOrUpdateParameters) (result automation.Certificate, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (result automation.Certificate, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CertificateListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CertificateListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters automation.CertificateUpdateParameters) (result automation.Certificate, err error) -} - -var _ CertificateClientAPI = (*automation.CertificateClient)(nil) - -// ConnectionClientAPI contains the set of methods on the ConnectionClient type. -type ConnectionClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters automation.ConnectionCreateOrUpdateParameters) (result automation.Connection, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result automation.Connection, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result automation.Connection, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters automation.ConnectionUpdateParameters) (result automation.Connection, err error) -} - -var _ ConnectionClientAPI = (*automation.ConnectionClient)(nil) - -// ConnectionTypeClientAPI contains the set of methods on the ConnectionTypeClient type. -type ConnectionTypeClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string, parameters automation.ConnectionTypeCreateOrUpdateParameters) (result automation.ConnectionType, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result automation.ConnectionType, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionTypeListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ConnectionTypeListResultIterator, err error) -} - -var _ ConnectionTypeClientAPI = (*automation.ConnectionTypeClient)(nil) - -// CredentialClientAPI contains the set of methods on the CredentialClient type. -type CredentialClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters automation.CredentialCreateOrUpdateParameters) (result automation.Credential, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result automation.Credential, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CredentialListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.CredentialListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters automation.CredentialUpdateParameters) (result automation.Credential, err error) -} - -var _ CredentialClientAPI = (*automation.CredentialClient)(nil) - -// DscConfigurationClientAPI contains the set of methods on the DscConfigurationClient type. -type DscConfigurationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters automation.DscConfigurationCreateOrUpdateParameters) (result automation.DscConfiguration, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result automation.DscConfiguration, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result automation.ReadCloser, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscConfigurationListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscConfigurationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters *automation.DscConfigurationUpdateParameters) (result automation.DscConfiguration, err error) -} - -var _ DscConfigurationClientAPI = (*automation.DscConfigurationClient)(nil) - -// HybridRunbookWorkerGroupClientAPI contains the set of methods on the HybridRunbookWorkerGroupClient type. -type HybridRunbookWorkerGroupClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result automation.HybridRunbookWorkerGroup, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.HybridRunbookWorkerGroupsListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.HybridRunbookWorkerGroupsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters automation.HybridRunbookWorkerGroupUpdateParameters) (result automation.HybridRunbookWorkerGroup, err error) -} - -var _ HybridRunbookWorkerGroupClientAPI = (*automation.HybridRunbookWorkerGroupClient)(nil) - -// JobScheduleClientAPI contains the set of methods on the JobScheduleClient type. -type JobScheduleClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters automation.JobScheduleCreateParameters) (result automation.JobSchedule, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result automation.JobSchedule, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.JobScheduleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.JobScheduleListResultIterator, err error) -} - -var _ JobScheduleClientAPI = (*automation.JobScheduleClient)(nil) - -// LinkedWorkspaceClientAPI contains the set of methods on the LinkedWorkspaceClient type. -type LinkedWorkspaceClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.LinkedWorkspace, err error) -} - -var _ LinkedWorkspaceClientAPI = (*automation.LinkedWorkspaceClient)(nil) - -// ActivityClientAPI contains the set of methods on the ActivityClient type. -type ActivityClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, activityName string) (result automation.Activity, err error) - ListByModule(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result automation.ActivityListResultPage, err error) - ListByModuleComplete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result automation.ActivityListResultIterator, err error) -} - -var _ ActivityClientAPI = (*automation.ActivityClient)(nil) - -// ModuleClientAPI contains the set of methods on the ModuleClient type. -type ModuleClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters automation.ModuleCreateOrUpdateParameters) (result automation.Module, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result automation.Module, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ModuleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ModuleListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters automation.ModuleUpdateParameters) (result automation.Module, err error) -} - -var _ ModuleClientAPI = (*automation.ModuleClient)(nil) - -// ObjectDataTypesClientAPI contains the set of methods on the ObjectDataTypesClient type. -type ObjectDataTypesClientAPI interface { - ListFieldsByModuleAndType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result automation.TypeFieldListResult, err error) - ListFieldsByType(ctx context.Context, resourceGroupName string, automationAccountName string, typeName string) (result automation.TypeFieldListResult, err error) -} - -var _ ObjectDataTypesClientAPI = (*automation.ObjectDataTypesClient)(nil) - -// FieldsClientAPI contains the set of methods on the FieldsClient type. -type FieldsClientAPI interface { - ListByType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result automation.TypeFieldListResult, err error) -} - -var _ FieldsClientAPI = (*automation.FieldsClient)(nil) - -// ScheduleClientAPI contains the set of methods on the ScheduleClient type. -type ScheduleClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters automation.ScheduleCreateOrUpdateParameters) (result automation.Schedule, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result automation.Schedule, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ScheduleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ScheduleListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters automation.ScheduleUpdateParameters) (result automation.Schedule, err error) -} - -var _ ScheduleClientAPI = (*automation.ScheduleClient)(nil) - -// VariableClientAPI contains the set of methods on the VariableClient type. -type VariableClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters automation.VariableCreateOrUpdateParameters) (result automation.Variable, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result automation.Variable, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.VariableListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.VariableListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters automation.VariableUpdateParameters) (result automation.Variable, err error) -} - -var _ VariableClientAPI = (*automation.VariableClient)(nil) - -// WebhookClientAPI contains the set of methods on the WebhookClient type. -type WebhookClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters automation.WebhookCreateOrUpdateParameters) (result automation.Webhook, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result autorest.Response, err error) - GenerateURI(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.String, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result automation.Webhook, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WebhookListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WebhookListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters automation.WebhookUpdateParameters) (result automation.Webhook, err error) -} - -var _ WebhookClientAPI = (*automation.WebhookClient)(nil) - -// WatcherClientAPI contains the set of methods on the WatcherClient type. -type WatcherClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters automation.Watcher) (result automation.Watcher, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result automation.Watcher, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WatcherListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WatcherListResultIterator, err error) - Start(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) - Stop(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters automation.WatcherUpdateParameters) (result automation.Watcher, err error) -} - -var _ WatcherClientAPI = (*automation.WatcherClient)(nil) - -// SoftwareUpdateConfigurationsClientAPI contains the set of methods on the SoftwareUpdateConfigurationsClient type. -type SoftwareUpdateConfigurationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, parameters automation.SoftwareUpdateConfiguration, clientRequestID string) (result automation.SoftwareUpdateConfiguration, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result autorest.Response, err error) - GetByName(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result automation.SoftwareUpdateConfiguration, err error) - List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string) (result automation.SoftwareUpdateConfigurationListResult, err error) -} - -var _ SoftwareUpdateConfigurationsClientAPI = (*automation.SoftwareUpdateConfigurationsClient)(nil) - -// SoftwareUpdateConfigurationRunsClientAPI contains the set of methods on the SoftwareUpdateConfigurationRunsClient type. -type SoftwareUpdateConfigurationRunsClientAPI interface { - GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationRunID uuid.UUID, clientRequestID string) (result automation.SoftwareUpdateConfigurationRun, err error) - List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result automation.SoftwareUpdateConfigurationRunListResult, err error) -} - -var _ SoftwareUpdateConfigurationRunsClientAPI = (*automation.SoftwareUpdateConfigurationRunsClient)(nil) - -// SoftwareUpdateConfigurationMachineRunsClientAPI contains the set of methods on the SoftwareUpdateConfigurationMachineRunsClient type. -type SoftwareUpdateConfigurationMachineRunsClientAPI interface { - GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationMachineRunID uuid.UUID, clientRequestID string) (result automation.SoftwareUpdateConfigurationMachineRun, err error) - List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result automation.SoftwareUpdateConfigurationMachineRunListResult, err error) -} - -var _ SoftwareUpdateConfigurationMachineRunsClientAPI = (*automation.SoftwareUpdateConfigurationMachineRunsClient)(nil) - -// SourceControlClientAPI contains the set of methods on the SourceControlClient type. -type SourceControlClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters automation.SourceControlCreateOrUpdateParameters) (result automation.SourceControl, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result automation.SourceControl, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.SourceControlListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.SourceControlListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters automation.SourceControlUpdateParameters) (result automation.SourceControl, err error) -} - -var _ SourceControlClientAPI = (*automation.SourceControlClient)(nil) - -// SourceControlSyncJobClientAPI contains the set of methods on the SourceControlSyncJobClient type. -type SourceControlSyncJobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, parameters automation.SourceControlSyncJobCreateParameters) (result automation.SourceControlSyncJob, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID) (result automation.SourceControlSyncJobByID, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result automation.SourceControlSyncJobListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result automation.SourceControlSyncJobListResultIterator, err error) -} - -var _ SourceControlSyncJobClientAPI = (*automation.SourceControlSyncJobClient)(nil) - -// SourceControlSyncJobStreamsClientAPI contains the set of methods on the SourceControlSyncJobStreamsClient type. -type SourceControlSyncJobStreamsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, streamID string) (result automation.SourceControlSyncJobStreamByID, err error) - ListBySyncJob(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result automation.SourceControlSyncJobStreamsListBySyncJobPage, err error) - ListBySyncJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result automation.SourceControlSyncJobStreamsListBySyncJobIterator, err error) -} - -var _ SourceControlSyncJobStreamsClientAPI = (*automation.SourceControlSyncJobStreamsClient)(nil) - -// JobClientAPI contains the set of methods on the JobClient type. -type JobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, parameters automation.JobCreateParameters, clientRequestID string) (result automation.Job, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result automation.Job, err error) - GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result automation.ReadCloser, err error) - GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result automation.ReadCloser, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result automation.JobListResultV2Page, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result automation.JobListResultV2Iterator, err error) - Resume(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) - Stop(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) - Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) -} - -var _ JobClientAPI = (*automation.JobClient)(nil) - -// JobStreamClientAPI contains the set of methods on the JobStreamClient type. -type JobStreamClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, jobStreamID string, clientRequestID string) (result automation.JobStream, err error) - ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result automation.JobStreamListResultPage, err error) - ListByJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result automation.JobStreamListResultIterator, err error) -} - -var _ JobStreamClientAPI = (*automation.JobStreamClient)(nil) - -// AgentRegistrationInformationClientAPI contains the set of methods on the AgentRegistrationInformationClient type. -type AgentRegistrationInformationClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.AgentRegistration, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, automationAccountName string, parameters automation.AgentRegistrationRegenerateKeyParameter) (result automation.AgentRegistration, err error) -} - -var _ AgentRegistrationInformationClientAPI = (*automation.AgentRegistrationInformationClient)(nil) - -// DscNodeClientAPI contains the set of methods on the DscNodeClient type. -type DscNodeClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result automation.DscNode, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result automation.DscNode, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscNodeListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscNodeListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, dscNodeUpdateParameters automation.DscNodeUpdateParameters) (result automation.DscNode, err error) -} - -var _ DscNodeClientAPI = (*automation.DscNodeClient)(nil) - -// NodeReportsClientAPI contains the set of methods on the NodeReportsClient type. -type NodeReportsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result automation.DscNodeReport, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result automation.SetObject, err error) - ListByNode(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result automation.DscNodeReportListResultPage, err error) - ListByNodeComplete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result automation.DscNodeReportListResultIterator, err error) -} - -var _ NodeReportsClientAPI = (*automation.NodeReportsClient)(nil) - -// DscCompilationJobClientAPI contains the set of methods on the DscCompilationJobClient type. -type DscCompilationJobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string, parameters automation.DscCompilationJobCreateParameters) (result automation.DscCompilationJobCreateFuture, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string) (result automation.DscCompilationJob, err error) - GetStream(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (result automation.JobStream, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscCompilationJobListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.DscCompilationJobListResultIterator, err error) -} - -var _ DscCompilationJobClientAPI = (*automation.DscCompilationJobClient)(nil) - -// DscCompilationJobStreamClientAPI contains the set of methods on the DscCompilationJobStreamClient type. -type DscCompilationJobStreamClientAPI interface { - ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result automation.JobStreamListResult, err error) -} - -var _ DscCompilationJobStreamClientAPI = (*automation.DscCompilationJobStreamClient)(nil) - -// DscNodeConfigurationClientAPI contains the set of methods on the DscNodeConfigurationClient type. -type DscNodeConfigurationClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters automation.DscNodeConfigurationCreateOrUpdateParameters) (result automation.DscNodeConfigurationCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result automation.DscNodeConfiguration, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscNodeConfigurationListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result automation.DscNodeConfigurationListResultIterator, err error) -} - -var _ DscNodeConfigurationClientAPI = (*automation.DscNodeConfigurationClient)(nil) - -// NodeCountInformationClientAPI contains the set of methods on the NodeCountInformationClient type. -type NodeCountInformationClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, countType automation.CountType) (result automation.NodeCounts, err error) -} - -var _ NodeCountInformationClientAPI = (*automation.NodeCountInformationClient)(nil) - -// RunbookDraftClientAPI contains the set of methods on the RunbookDraftClient type. -type RunbookDraftClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.RunbookDraft, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.ReadCloser, err error) - ReplaceContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser) (result automation.RunbookDraftReplaceContentFuture, err error) - UndoEdit(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.RunbookDraftUndoEditResult, err error) -} - -var _ RunbookDraftClientAPI = (*automation.RunbookDraftClient)(nil) - -// RunbookClientAPI contains the set of methods on the RunbookClient type. -type RunbookClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters automation.RunbookCreateOrUpdateParameters) (result automation.Runbook, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.Runbook, err error) - GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.ReadCloser, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.RunbookListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.RunbookListResultIterator, err error) - Publish(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.RunbookPublishFuture, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters automation.RunbookUpdateParameters) (result automation.Runbook, err error) -} - -var _ RunbookClientAPI = (*automation.RunbookClient)(nil) - -// TestJobStreamsClientAPI contains the set of methods on the TestJobStreamsClient type. -type TestJobStreamsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (result automation.JobStream, err error) - ListByTestJob(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result automation.JobStreamListResultPage, err error) - ListByTestJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result automation.JobStreamListResultIterator, err error) -} - -var _ TestJobStreamsClientAPI = (*automation.TestJobStreamsClient)(nil) - -// TestJobClientAPI contains the set of methods on the TestJobClient type. -type TestJobClientAPI interface { - Create(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters automation.TestJobCreateParameters) (result automation.TestJob, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result automation.TestJob, err error) - Resume(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) - Stop(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) - Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) -} - -var _ TestJobClientAPI = (*automation.TestJobClient)(nil) - -// Python2PackageClientAPI contains the set of methods on the Python2PackageClient type. -type Python2PackageClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string, parameters automation.PythonPackageCreateParameters) (result automation.Module, err error) - Delete(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string) (result automation.Module, err error) - ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ModuleListResultPage, err error) - ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result automation.ModuleListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string, parameters automation.PythonPackageUpdateParameters) (result automation.Module, err error) -} - -var _ Python2PackageClientAPI = (*automation.Python2PackageClient)(nil) diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/certificate.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/certificate.go deleted file mode 100644 index 65ee261ec45f..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/certificate.go +++ /dev/null @@ -1,511 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation 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)} -} - -// CreateOrUpdate create a certificate. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the parameters supplied to the create or update certificate operation. -// parameters - the parameters supplied to the create or update certificate operation. -func (client CertificateClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CertificateCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties.Base64Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.CertificateClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificateClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", 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 CertificateClient) 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 CertificateClient) CreateOrUpdateResponder(resp *http.Response) (result Certificate, 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 certificate. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the name of certificate. -func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.CertificateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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) (*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 CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the certificate identified by certificate name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the name of certificate. -func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, automationAccountName 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: 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("automation.CertificateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.CertificateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/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 -} - -// ListByAutomationAccount retrieve a list of certificates. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client CertificateClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result CertificateListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.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("automation.CertificateClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client CertificateClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client CertificateClient) ListByAutomationAccountResponder(resp *http.Response) (result CertificateListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client CertificateClient) listByAutomationAccountNextResults(ctx context.Context, lastResults CertificateListResult) (result CertificateListResult, err error) { - req, err := lastResults.certificateListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client CertificateClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result CertificateListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a certificate. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// certificateName - the parameters supplied to the update certificate operation. -// parameters - the parameters supplied to the update certificate operation. -func (client CertificateClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (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: 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("automation.CertificateClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.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, "automation.CertificateClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CertificateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", 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 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/preview/automation/mgmt/2018-06-30-preview/automation/client.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/client.go deleted file mode 100644 index e729ae544fd6..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package automation implements the Azure ARM Automation service API version . -// -// Automation Client -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Automation - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Automation. -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/automation/mgmt/2018-06-30-preview/automation/connection.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/connection.go deleted file mode 100644 index 9f867a8a089d..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/connection.go +++ /dev/null @@ -1,512 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ConnectionClient is the automation Client -type ConnectionClient struct { - BaseClient -} - -// NewConnectionClient creates an instance of the ConnectionClient client. -func NewConnectionClient(subscriptionID string) ConnectionClient { - return NewConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectionClientWithBaseURI creates an instance of the ConnectionClient 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 NewConnectionClientWithBaseURI(baseURI string, subscriptionID string) ConnectionClient { - return ConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a connection. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the parameters supplied to the create or update connection operation. -// parameters - the parameters supplied to the create or update connection operation. -func (client ConnectionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectionCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectionCreateOrUpdateProperties.ConnectionType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.ConnectionClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, connectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) CreateOrUpdateResponder(resp *http.Response) (result Connection, 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 connection. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the name of connection. -func (client ConnectionClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ConnectionClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, connectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectionClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) DeleteResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the connection identified by connection name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the name of connection. -func (client ConnectionClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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("automation.ConnectionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, connectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) GetResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of connections. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ConnectionClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.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("automation.ConnectionClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ConnectionClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ConnectionClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ConnectionClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ConnectionListResult) (result ConnectionListResult, err error) { - req, err := lastResults.connectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConnectionClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a connection. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionName - the parameters supplied to the update a connection operation. -// parameters - the parameters supplied to the update a connection operation. -func (client ConnectionClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (result Connection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ConnectionClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, connectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ConnectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", 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 ConnectionClient) 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 ConnectionClient) UpdateResponder(resp *http.Response) (result Connection, 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/automation/mgmt/2018-06-30-preview/automation/connectiontype.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/connectiontype.go deleted file mode 100644 index 1fd5f23b2812..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/connectiontype.go +++ /dev/null @@ -1,422 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ConnectionTypeClient is the automation Client -type ConnectionTypeClient struct { - BaseClient -} - -// NewConnectionTypeClient creates an instance of the ConnectionTypeClient client. -func NewConnectionTypeClient(subscriptionID string) ConnectionTypeClient { - return NewConnectionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectionTypeClientWithBaseURI creates an instance of the ConnectionTypeClient 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 NewConnectionTypeClientWithBaseURI(baseURI string, subscriptionID string) ConnectionTypeClient { - return ConnectionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a connection type. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionTypeName - the parameters supplied to the create or update connection type operation. -// parameters - the parameters supplied to the create or update connection type operation. -func (client ConnectionTypeClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (result ConnectionType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectionTypeCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectionTypeCreateOrUpdateProperties.FieldDefinitions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.ConnectionTypeClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, connectionTypeName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectionTypeClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", 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 ConnectionTypeClient) 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 ConnectionTypeClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectionType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the connection type. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionTypeName - the name of connection type. -func (client ConnectionTypeClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ConnectionTypeClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, connectionTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectionTypeClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", 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 ConnectionTypeClient) 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 ConnectionTypeClient) 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 the connection type identified by connection type name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// connectionTypeName - the name of connection type. -func (client ConnectionTypeClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (result ConnectionType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.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("automation.ConnectionTypeClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, connectionTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", 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 ConnectionTypeClient) 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 ConnectionTypeClient) GetResponder(resp *http.Response) (result ConnectionType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of connection types. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ConnectionTypeClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionTypeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.ctlr.Response.Response != nil { - sc = result.ctlr.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("automation.ConnectionTypeClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.ctlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.ctlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.ctlr.hasNextLink() && result.ctlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ConnectionTypeClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionTypeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ConnectionTypeClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionTypeListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ConnectionTypeClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ConnectionTypeListResult) (result ConnectionTypeListResult, err error) { - req, err := lastResults.connectionTypeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConnectionTypeClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ConnectionTypeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/credential.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/credential.go deleted file mode 100644 index dc406e5626e3..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/credential.go +++ /dev/null @@ -1,513 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CredentialClient is the automation Client -type CredentialClient struct { - BaseClient -} - -// NewCredentialClient creates an instance of the CredentialClient client. -func NewCredentialClient(subscriptionID string) CredentialClient { - return NewCredentialClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCredentialClientWithBaseURI creates an instance of the CredentialClient 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 NewCredentialClientWithBaseURI(baseURI string, subscriptionID string) CredentialClient { - return CredentialClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a credential. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the parameters supplied to the create or update credential operation. -// parameters - the parameters supplied to the create or update credential operation. -func (client CredentialClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (result Credential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CredentialCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CredentialCreateOrUpdateProperties.UserName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CredentialCreateOrUpdateProperties.Password", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.CredentialClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, credentialName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CredentialClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) CreateOrUpdateResponder(resp *http.Response) (result Credential, 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 credential. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the name of credential. -func (client CredentialClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.CredentialClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CredentialClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the credential identified by credential name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the name of credential. -func (client CredentialClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (result Credential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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("automation.CredentialClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CredentialClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) GetResponder(resp *http.Response) (result Credential, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of credentials. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client CredentialClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result CredentialListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.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("automation.CredentialClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client CredentialClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CredentialClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client CredentialClient) ListByAutomationAccountResponder(resp *http.Response) (result CredentialListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client CredentialClient) listByAutomationAccountNextResults(ctx context.Context, lastResults CredentialListResult) (result CredentialListResult, err error) { - req, err := lastResults.credentialListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client CredentialClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result CredentialListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a credential. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// credentialName - the parameters supplied to the Update credential operation. -// parameters - the parameters supplied to the Update credential operation. -func (client CredentialClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (result Credential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.CredentialClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, credentialName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CredentialClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", 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 CredentialClient) 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 CredentialClient) UpdateResponder(resp *http.Response) (result Credential, 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/automation/mgmt/2018-06-30-preview/automation/dsccompilationjob.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/dsccompilationjob.go deleted file mode 100644 index 03bc23b82033..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/dsccompilationjob.go +++ /dev/null @@ -1,433 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// DscCompilationJobClient is the automation Client -type DscCompilationJobClient struct { - BaseClient -} - -// NewDscCompilationJobClient creates an instance of the DscCompilationJobClient client. -func NewDscCompilationJobClient(subscriptionID string) DscCompilationJobClient { - return NewDscCompilationJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscCompilationJobClientWithBaseURI creates an instance of the DscCompilationJobClient 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 NewDscCompilationJobClientWithBaseURI(baseURI string, subscriptionID string) DscCompilationJobClient { - return DscCompilationJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates the Dsc compilation job of the configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// compilationJobName - the DSC configuration Id. -// parameters - the parameters supplied to the create compilation job operation. -func (client DscCompilationJobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string, parameters DscCompilationJobCreateParameters) (result DscCompilationJobCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties.Configuration", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.DscCompilationJobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, compilationJobName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DscCompilationJobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string, parameters DscCompilationJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "compilationJobName": autorest.Encode("path", compilationJobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - 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.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}", 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 DscCompilationJobClient) CreateSender(req *http.Request) (future DscCompilationJobCreateFuture, 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 DscCompilationJobClient) CreateResponder(resp *http.Response) (result DscCompilationJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the Dsc configuration compilation job identified by job id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// compilationJobName - the DSC configuration Id. -func (client DscCompilationJobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string) (result DscCompilationJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.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("automation.DscCompilationJobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, compilationJobName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscCompilationJobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, compilationJobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "compilationJobName": autorest.Encode("path", compilationJobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}", 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 DscCompilationJobClient) 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 DscCompilationJobClient) GetResponder(resp *http.Response) (result DscCompilationJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStream retrieve the job stream identified by job stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobID - the job id. -// jobStreamID - the job stream id. -func (client DscCompilationJobClient) GetStream(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (result JobStream, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.GetStream") - 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("automation.DscCompilationJobClient", "GetStream", err.Error()) - } - - req, err := client.GetStreamPreparer(ctx, resourceGroupName, automationAccountName, jobID, jobStreamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", nil, "Failure preparing request") - return - } - - resp, err := client.GetStreamSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure sending request") - return - } - - result, err = client.GetStreamResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure responding to request") - return - } - - return -} - -// GetStreamPreparer prepares the GetStream request. -func (client DscCompilationJobClient) GetStreamPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetStreamSender sends the GetStream request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) GetStreamSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetStreamResponder handles the response to the GetStream request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) GetStreamResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc compilation jobs. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client DscCompilationJobClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscCompilationJobListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dcjlr.Response.Response != nil { - sc = result.dcjlr.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("automation.DscCompilationJobClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dcjlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dcjlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dcjlr.hasNextLink() && result.dcjlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscCompilationJobClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/compilationjobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) ListByAutomationAccountResponder(resp *http.Response) (result DscCompilationJobListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscCompilationJobClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscCompilationJobListResult) (result DscCompilationJobListResult, err error) { - req, err := lastResults.dscCompilationJobListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscCompilationJobClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result DscCompilationJobListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/dsccompilationjobstream.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/dsccompilationjobstream.go deleted file mode 100644 index e5c8326d8149..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/dsccompilationjobstream.go +++ /dev/null @@ -1,120 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// DscCompilationJobStreamClient is the automation Client -type DscCompilationJobStreamClient struct { - BaseClient -} - -// NewDscCompilationJobStreamClient creates an instance of the DscCompilationJobStreamClient client. -func NewDscCompilationJobStreamClient(subscriptionID string) DscCompilationJobStreamClient { - return NewDscCompilationJobStreamClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscCompilationJobStreamClientWithBaseURI creates an instance of the DscCompilationJobStreamClient 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 NewDscCompilationJobStreamClientWithBaseURI(baseURI string, subscriptionID string) DscCompilationJobStreamClient { - return DscCompilationJobStreamClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByJob retrieve all the job streams for the compilation Job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobID - the job id. -func (client DscCompilationJobStreamClient) ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result JobStreamListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobStreamClient.ListByJob") - 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("automation.DscCompilationJobStreamClient", "ListByJob", err.Error()) - } - - req, err := client.ListByJobPreparer(ctx, resourceGroupName, automationAccountName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobStreamClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobStreamClient", "ListByJob", resp, "Failure sending request") - return - } - - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobStreamClient", "ListByJob", resp, "Failure responding to request") - return - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client DscCompilationJobStreamClient) ListByJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobStreamClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client DscCompilationJobStreamClient) ListByJobResponder(resp *http.Response) (result JobStreamListResult, 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/automation/mgmt/2018-06-30-preview/automation/dscconfiguration.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/dscconfiguration.go deleted file mode 100644 index 8dd04d90454e..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/dscconfiguration.go +++ /dev/null @@ -1,621 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DscConfigurationClient is the automation Client -type DscConfigurationClient struct { - BaseClient -} - -// NewDscConfigurationClient creates an instance of the DscConfigurationClient client. -func NewDscConfigurationClient(subscriptionID string) DscConfigurationClient { - return NewDscConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscConfigurationClientWithBaseURI creates an instance of the DscConfigurationClient 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 NewDscConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscConfigurationClient { - return DscConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the create or update parameters for configuration. -// parameters - the create or update parameters for configuration. -func (client DscConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (result DscConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.DscConfigurationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DscConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", 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 DscConfigurationClient) 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 DscConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscConfiguration, 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 dsc configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the configuration name. -func (client DscConfigurationClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscConfigurationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", 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 DscConfigurationClient) 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 DscConfigurationClient) 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 the configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the configuration name. -func (client DscConfigurationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result DscConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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("automation.DscConfigurationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", 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 DscConfigurationClient) 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 DscConfigurationClient) GetResponder(resp *http.Response) (result DscConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the configuration script identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the configuration name. -func (client DscConfigurationClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.GetContent") - 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("automation.DscConfigurationClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client DscConfigurationClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of configurations. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// skip - the number of rows to skip. -// top - the number of rows to take. -// inlinecount - return total rows. -func (client DscConfigurationClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscConfigurationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dclr.Response.Response != nil { - sc = result.dclr.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("automation.DscConfigurationClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dclr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dclr.hasNextLink() && result.dclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscConfigurationClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(inlinecount) > 0 { - queryParameters["$inlinecount"] = autorest.Encode("query", inlinecount) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscConfigurationClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscConfigurationListResult) (result DscConfigurationListResult, err error) { - req, err := lastResults.dscConfigurationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscConfigurationClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscConfigurationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - return -} - -// Update create the configuration identified by configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// configurationName - the create or update parameters for configuration. -// parameters - the create or update parameters for configuration. -func (client DscConfigurationClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters *DscConfigurationUpdateParameters) (result DscConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscConfigurationClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DscConfigurationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, configurationName string, parameters *DscConfigurationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - 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 DscConfigurationClient) 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 DscConfigurationClient) UpdateResponder(resp *http.Response) (result DscConfiguration, 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/automation/mgmt/2018-06-30-preview/automation/dscnode.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/dscnode.go deleted file mode 100644 index 9590e119ae44..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/dscnode.go +++ /dev/null @@ -1,435 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DscNodeClient is the automation Client -type DscNodeClient struct { - BaseClient -} - -// NewDscNodeClient creates an instance of the DscNodeClient client. -func NewDscNodeClient(subscriptionID string) DscNodeClient { - return NewDscNodeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscNodeClientWithBaseURI creates an instance of the DscNodeClient 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 NewDscNodeClientWithBaseURI(baseURI string, subscriptionID string) DscNodeClient { - return DscNodeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete the dsc node identified by node id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the node id. -func (client DscNodeClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, nodeID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscNodeClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", 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 DscNodeClient) 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 DscNodeClient) DeleteResponder(resp *http.Response) (result DscNode, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the dsc node identified by node id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the node id. -func (client DscNodeClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.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("automation.DscNodeClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, nodeID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscNodeClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", 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 DscNodeClient) 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 DscNodeClient) GetResponder(resp *http.Response) (result DscNode, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc nodes. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// skip - the number of rows to skip. -// top - the number of rows to take. -// inlinecount - return total rows. -func (client DscNodeClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscNodeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dnlr.Response.Response != nil { - sc = result.dnlr.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("automation.DscNodeClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dnlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dnlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dnlr.hasNextLink() && result.dnlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscNodeClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(inlinecount) > 0 { - queryParameters["$inlinecount"] = autorest.Encode("query", inlinecount) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscNodeClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscNodeClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscNodeListResult) (result DscNodeListResult, err error) { - req, err := lastResults.dscNodeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscNodeClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscNodeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - return -} - -// Update update the dsc node. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - parameters supplied to the update dsc node. -// dscNodeUpdateParameters - parameters supplied to the update dsc node. -func (client DscNodeClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, dscNodeUpdateParameters DscNodeUpdateParameters) (result DscNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, nodeID, dscNodeUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DscNodeClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, dscNodeUpdateParameters DscNodeUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - 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.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", pathParameters), - autorest.WithJSON(dscNodeUpdateParameters), - 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 DscNodeClient) 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 DscNodeClient) UpdateResponder(resp *http.Response) (result DscNode, 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/automation/mgmt/2018-06-30-preview/automation/dscnodeconfiguration.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/dscnodeconfiguration.go deleted file mode 100644 index 11327622dbec..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/dscnodeconfiguration.go +++ /dev/null @@ -1,448 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DscNodeConfigurationClient is the automation Client -type DscNodeConfigurationClient struct { - BaseClient -} - -// NewDscNodeConfigurationClient creates an instance of the DscNodeConfigurationClient client. -func NewDscNodeConfigurationClient(subscriptionID string) DscNodeConfigurationClient { - return NewDscNodeConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscNodeConfigurationClientWithBaseURI creates an instance of the DscNodeConfigurationClient 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 NewDscNodeConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscNodeConfigurationClient { - return DscNodeConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the node configuration identified by node configuration name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeConfigurationName - the Dsc node configuration name. -// parameters - the create or update parameters for configuration. -func (client DscNodeConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (result DscNodeConfigurationCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.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: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Source.Hash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "parameters.DscNodeConfigurationCreateOrUpdateParametersProperties.Configuration", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.DscNodeConfigurationClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, nodeConfigurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DscNodeConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - 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.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", 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 DscNodeConfigurationClient) CreateOrUpdateSender(req *http.Request) (future DscNodeConfigurationCreateOrUpdateFuture, 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 DscNodeConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscNodeConfiguration, 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 Dsc node configurations by node configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeConfigurationName - the Dsc node configuration name. -func (client DscNodeConfigurationClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.DscNodeConfigurationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, nodeConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscNodeConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", 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 DscNodeConfigurationClient) 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 DscNodeConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the Dsc node configurations by node configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeConfigurationName - the Dsc node configuration name. -func (client DscNodeConfigurationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result DscNodeConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.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("automation.DscNodeConfigurationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, nodeConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscNodeConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", 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 DscNodeConfigurationClient) 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 DscNodeConfigurationClient) GetResponder(resp *http.Response) (result DscNodeConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc node configurations. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// skip - the number of rows to skip. -// top - the number of rows to take. -// inlinecount - return total rows. -func (client DscNodeConfigurationClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscNodeConfigurationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.dnclr.Response.Response != nil { - sc = result.dnclr.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("automation.DscNodeConfigurationClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.dnclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.dnclr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.dnclr.hasNextLink() && result.dnclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscNodeConfigurationClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(inlinecount) > 0 { - queryParameters["$inlinecount"] = autorest.Encode("query", inlinecount) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscNodeConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscNodeConfigurationClient) listByAutomationAccountNextResults(ctx context.Context, lastResults DscNodeConfigurationListResult) (result DscNodeConfigurationListResult, err error) { - req, err := lastResults.dscNodeConfigurationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client DscNodeConfigurationClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, skip *int32, top *int32, inlinecount string) (result DscNodeConfigurationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, skip, top, inlinecount) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/enums.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/enums.go deleted file mode 100644 index 9bfd432b8b85..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/enums.go +++ /dev/null @@ -1,646 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccountState enumerates the values for account state. -type AccountState string - -const ( - // Ok ... - Ok AccountState = "Ok" - // Suspended ... - Suspended AccountState = "Suspended" - // Unavailable ... - Unavailable AccountState = "Unavailable" -) - -// PossibleAccountStateValues returns an array of possible values for the AccountState const type. -func PossibleAccountStateValues() []AccountState { - return []AccountState{Ok, Suspended, Unavailable} -} - -// AgentRegistrationKeyName enumerates the values for agent registration key name. -type AgentRegistrationKeyName string - -const ( - // Primary ... - Primary AgentRegistrationKeyName = "primary" - // Secondary ... - Secondary AgentRegistrationKeyName = "secondary" -) - -// PossibleAgentRegistrationKeyNameValues returns an array of possible values for the AgentRegistrationKeyName const type. -func PossibleAgentRegistrationKeyNameValues() []AgentRegistrationKeyName { - return []AgentRegistrationKeyName{Primary, Secondary} -} - -// ContentSourceType enumerates the values for content source type. -type ContentSourceType string - -const ( - // EmbeddedContent ... - EmbeddedContent ContentSourceType = "embeddedContent" - // URI ... - URI ContentSourceType = "uri" -) - -// PossibleContentSourceTypeValues returns an array of possible values for the ContentSourceType const type. -func PossibleContentSourceTypeValues() []ContentSourceType { - return []ContentSourceType{EmbeddedContent, URI} -} - -// CountType enumerates the values for count type. -type CountType string - -const ( - // Nodeconfiguration ... - Nodeconfiguration CountType = "nodeconfiguration" - // Status ... - Status CountType = "status" -) - -// PossibleCountTypeValues returns an array of possible values for the CountType const type. -func PossibleCountTypeValues() []CountType { - return []CountType{Nodeconfiguration, Status} -} - -// DscConfigurationProvisioningState enumerates the values for dsc configuration provisioning state. -type DscConfigurationProvisioningState string - -const ( - // Succeeded ... - Succeeded DscConfigurationProvisioningState = "Succeeded" -) - -// PossibleDscConfigurationProvisioningStateValues returns an array of possible values for the DscConfigurationProvisioningState const type. -func PossibleDscConfigurationProvisioningStateValues() []DscConfigurationProvisioningState { - return []DscConfigurationProvisioningState{Succeeded} -} - -// DscConfigurationState enumerates the values for dsc configuration state. -type DscConfigurationState string - -const ( - // DscConfigurationStateEdit ... - DscConfigurationStateEdit DscConfigurationState = "Edit" - // DscConfigurationStateNew ... - DscConfigurationStateNew DscConfigurationState = "New" - // DscConfigurationStatePublished ... - DscConfigurationStatePublished DscConfigurationState = "Published" -) - -// PossibleDscConfigurationStateValues returns an array of possible values for the DscConfigurationState const type. -func PossibleDscConfigurationStateValues() []DscConfigurationState { - return []DscConfigurationState{DscConfigurationStateEdit, DscConfigurationStateNew, DscConfigurationStatePublished} -} - -// GroupTypeEnum enumerates the values for group type enum. -type GroupTypeEnum string - -const ( - // System ... - System GroupTypeEnum = "System" - // User ... - User GroupTypeEnum = "User" -) - -// PossibleGroupTypeEnumValues returns an array of possible values for the GroupTypeEnum const type. -func PossibleGroupTypeEnumValues() []GroupTypeEnum { - return []GroupTypeEnum{System, User} -} - -// HTTPStatusCode enumerates the values for http status code. -type HTTPStatusCode string - -const ( - // Accepted ... - Accepted HTTPStatusCode = "Accepted" - // Ambiguous ... - Ambiguous HTTPStatusCode = "Ambiguous" - // BadGateway ... - BadGateway HTTPStatusCode = "BadGateway" - // BadRequest ... - BadRequest HTTPStatusCode = "BadRequest" - // Conflict ... - Conflict HTTPStatusCode = "Conflict" - // Continue ... - Continue HTTPStatusCode = "Continue" - // Created ... - Created HTTPStatusCode = "Created" - // ExpectationFailed ... - ExpectationFailed HTTPStatusCode = "ExpectationFailed" - // Forbidden ... - Forbidden HTTPStatusCode = "Forbidden" - // Found ... - Found HTTPStatusCode = "Found" - // GatewayTimeout ... - GatewayTimeout HTTPStatusCode = "GatewayTimeout" - // Gone ... - Gone HTTPStatusCode = "Gone" - // HTTPVersionNotSupported ... - HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" - // InternalServerError ... - InternalServerError HTTPStatusCode = "InternalServerError" - // LengthRequired ... - LengthRequired HTTPStatusCode = "LengthRequired" - // MethodNotAllowed ... - MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" - // Moved ... - Moved HTTPStatusCode = "Moved" - // MovedPermanently ... - MovedPermanently HTTPStatusCode = "MovedPermanently" - // MultipleChoices ... - MultipleChoices HTTPStatusCode = "MultipleChoices" - // NoContent ... - NoContent HTTPStatusCode = "NoContent" - // NonAuthoritativeInformation ... - NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" - // NotAcceptable ... - NotAcceptable HTTPStatusCode = "NotAcceptable" - // NotFound ... - NotFound HTTPStatusCode = "NotFound" - // NotImplemented ... - NotImplemented HTTPStatusCode = "NotImplemented" - // NotModified ... - NotModified HTTPStatusCode = "NotModified" - // OK ... - OK HTTPStatusCode = "OK" - // PartialContent ... - PartialContent HTTPStatusCode = "PartialContent" - // PaymentRequired ... - PaymentRequired HTTPStatusCode = "PaymentRequired" - // PreconditionFailed ... - PreconditionFailed HTTPStatusCode = "PreconditionFailed" - // ProxyAuthenticationRequired ... - ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" - // Redirect ... - Redirect HTTPStatusCode = "Redirect" - // RedirectKeepVerb ... - RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" - // RedirectMethod ... - RedirectMethod HTTPStatusCode = "RedirectMethod" - // RequestedRangeNotSatisfiable ... - RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" - // RequestEntityTooLarge ... - RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" - // RequestTimeout ... - RequestTimeout HTTPStatusCode = "RequestTimeout" - // RequestURITooLong ... - RequestURITooLong HTTPStatusCode = "RequestUriTooLong" - // ResetContent ... - ResetContent HTTPStatusCode = "ResetContent" - // SeeOther ... - SeeOther HTTPStatusCode = "SeeOther" - // ServiceUnavailable ... - ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" - // SwitchingProtocols ... - SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" - // TemporaryRedirect ... - TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" - // Unauthorized ... - Unauthorized HTTPStatusCode = "Unauthorized" - // UnsupportedMediaType ... - UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" - // Unused ... - Unused HTTPStatusCode = "Unused" - // UpgradeRequired ... - UpgradeRequired HTTPStatusCode = "UpgradeRequired" - // UseProxy ... - UseProxy HTTPStatusCode = "UseProxy" -) - -// PossibleHTTPStatusCodeValues returns an array of possible values for the HTTPStatusCode const type. -func PossibleHTTPStatusCodeValues() []HTTPStatusCode { - return []HTTPStatusCode{Accepted, Ambiguous, BadGateway, BadRequest, Conflict, Continue, Created, ExpectationFailed, Forbidden, Found, GatewayTimeout, Gone, HTTPVersionNotSupported, InternalServerError, LengthRequired, MethodNotAllowed, Moved, MovedPermanently, MultipleChoices, NoContent, NonAuthoritativeInformation, NotAcceptable, NotFound, NotImplemented, NotModified, OK, PartialContent, PaymentRequired, PreconditionFailed, ProxyAuthenticationRequired, Redirect, RedirectKeepVerb, RedirectMethod, RequestedRangeNotSatisfiable, RequestEntityTooLarge, RequestTimeout, RequestURITooLong, ResetContent, SeeOther, ServiceUnavailable, SwitchingProtocols, TemporaryRedirect, Unauthorized, UnsupportedMediaType, Unused, UpgradeRequired, UseProxy} -} - -// JobProvisioningState enumerates the values for job provisioning state. -type JobProvisioningState string - -const ( - // JobProvisioningStateFailed ... - JobProvisioningStateFailed JobProvisioningState = "Failed" - // JobProvisioningStateProcessing ... - JobProvisioningStateProcessing JobProvisioningState = "Processing" - // JobProvisioningStateSucceeded ... - JobProvisioningStateSucceeded JobProvisioningState = "Succeeded" - // JobProvisioningStateSuspended ... - JobProvisioningStateSuspended JobProvisioningState = "Suspended" -) - -// PossibleJobProvisioningStateValues returns an array of possible values for the JobProvisioningState const type. -func PossibleJobProvisioningStateValues() []JobProvisioningState { - return []JobProvisioningState{JobProvisioningStateFailed, JobProvisioningStateProcessing, JobProvisioningStateSucceeded, JobProvisioningStateSuspended} -} - -// JobStatus enumerates the values for job status. -type JobStatus string - -const ( - // JobStatusActivating ... - JobStatusActivating JobStatus = "Activating" - // JobStatusBlocked ... - JobStatusBlocked JobStatus = "Blocked" - // JobStatusCompleted ... - JobStatusCompleted JobStatus = "Completed" - // JobStatusDisconnected ... - JobStatusDisconnected JobStatus = "Disconnected" - // JobStatusFailed ... - JobStatusFailed JobStatus = "Failed" - // JobStatusNew ... - JobStatusNew JobStatus = "New" - // JobStatusRemoving ... - JobStatusRemoving JobStatus = "Removing" - // JobStatusResuming ... - JobStatusResuming JobStatus = "Resuming" - // JobStatusRunning ... - JobStatusRunning JobStatus = "Running" - // JobStatusStopped ... - JobStatusStopped JobStatus = "Stopped" - // JobStatusStopping ... - JobStatusStopping JobStatus = "Stopping" - // JobStatusSuspended ... - JobStatusSuspended JobStatus = "Suspended" - // JobStatusSuspending ... - JobStatusSuspending JobStatus = "Suspending" -) - -// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. -func PossibleJobStatusValues() []JobStatus { - return []JobStatus{JobStatusActivating, JobStatusBlocked, JobStatusCompleted, JobStatusDisconnected, JobStatusFailed, JobStatusNew, JobStatusRemoving, JobStatusResuming, JobStatusRunning, JobStatusStopped, JobStatusStopping, JobStatusSuspended, JobStatusSuspending} -} - -// JobStreamType enumerates the values for job stream type. -type JobStreamType string - -const ( - // Any ... - Any JobStreamType = "Any" - // Debug ... - Debug JobStreamType = "Debug" - // Error ... - Error JobStreamType = "Error" - // Output ... - Output JobStreamType = "Output" - // Progress ... - Progress JobStreamType = "Progress" - // Verbose ... - Verbose JobStreamType = "Verbose" - // Warning ... - Warning JobStreamType = "Warning" -) - -// PossibleJobStreamTypeValues returns an array of possible values for the JobStreamType const type. -func PossibleJobStreamTypeValues() []JobStreamType { - return []JobStreamType{Any, Debug, Error, Output, Progress, Verbose, Warning} -} - -// KeyName enumerates the values for key name. -type KeyName string - -const ( - // KeyNamePrimary ... - KeyNamePrimary KeyName = "Primary" - // KeyNameSecondary ... - KeyNameSecondary KeyName = "Secondary" -) - -// PossibleKeyNameValues returns an array of possible values for the KeyName const type. -func PossibleKeyNameValues() []KeyName { - return []KeyName{KeyNamePrimary, KeyNameSecondary} -} - -// KeyPermissions enumerates the values for key permissions. -type KeyPermissions string - -const ( - // Full ... - Full KeyPermissions = "Full" - // Read ... - Read KeyPermissions = "Read" -) - -// PossibleKeyPermissionsValues returns an array of possible values for the KeyPermissions const type. -func PossibleKeyPermissionsValues() []KeyPermissions { - return []KeyPermissions{Full, Read} -} - -// LinuxUpdateClasses enumerates the values for linux update classes. -type LinuxUpdateClasses string - -const ( - // Critical ... - Critical LinuxUpdateClasses = "Critical" - // Other ... - Other LinuxUpdateClasses = "Other" - // Security ... - Security LinuxUpdateClasses = "Security" - // Unclassified ... - Unclassified LinuxUpdateClasses = "Unclassified" -) - -// PossibleLinuxUpdateClassesValues returns an array of possible values for the LinuxUpdateClasses const type. -func PossibleLinuxUpdateClassesValues() []LinuxUpdateClasses { - return []LinuxUpdateClasses{Critical, Other, Security, Unclassified} -} - -// ModuleProvisioningState enumerates the values for module provisioning state. -type ModuleProvisioningState string - -const ( - // ModuleProvisioningStateActivitiesStored ... - ModuleProvisioningStateActivitiesStored ModuleProvisioningState = "ActivitiesStored" - // ModuleProvisioningStateCancelled ... - ModuleProvisioningStateCancelled ModuleProvisioningState = "Cancelled" - // ModuleProvisioningStateConnectionTypeImported ... - ModuleProvisioningStateConnectionTypeImported ModuleProvisioningState = "ConnectionTypeImported" - // ModuleProvisioningStateContentDownloaded ... - ModuleProvisioningStateContentDownloaded ModuleProvisioningState = "ContentDownloaded" - // ModuleProvisioningStateContentRetrieved ... - ModuleProvisioningStateContentRetrieved ModuleProvisioningState = "ContentRetrieved" - // ModuleProvisioningStateContentStored ... - ModuleProvisioningStateContentStored ModuleProvisioningState = "ContentStored" - // ModuleProvisioningStateContentValidated ... - ModuleProvisioningStateContentValidated ModuleProvisioningState = "ContentValidated" - // ModuleProvisioningStateCreated ... - ModuleProvisioningStateCreated ModuleProvisioningState = "Created" - // ModuleProvisioningStateCreating ... - ModuleProvisioningStateCreating ModuleProvisioningState = "Creating" - // ModuleProvisioningStateFailed ... - ModuleProvisioningStateFailed ModuleProvisioningState = "Failed" - // ModuleProvisioningStateModuleDataStored ... - ModuleProvisioningStateModuleDataStored ModuleProvisioningState = "ModuleDataStored" - // ModuleProvisioningStateModuleImportRunbookComplete ... - ModuleProvisioningStateModuleImportRunbookComplete ModuleProvisioningState = "ModuleImportRunbookComplete" - // ModuleProvisioningStateRunningImportModuleRunbook ... - ModuleProvisioningStateRunningImportModuleRunbook ModuleProvisioningState = "RunningImportModuleRunbook" - // ModuleProvisioningStateStartingImportModuleRunbook ... - ModuleProvisioningStateStartingImportModuleRunbook ModuleProvisioningState = "StartingImportModuleRunbook" - // ModuleProvisioningStateSucceeded ... - ModuleProvisioningStateSucceeded ModuleProvisioningState = "Succeeded" - // ModuleProvisioningStateUpdating ... - ModuleProvisioningStateUpdating ModuleProvisioningState = "Updating" -) - -// PossibleModuleProvisioningStateValues returns an array of possible values for the ModuleProvisioningState const type. -func PossibleModuleProvisioningStateValues() []ModuleProvisioningState { - return []ModuleProvisioningState{ModuleProvisioningStateActivitiesStored, ModuleProvisioningStateCancelled, ModuleProvisioningStateConnectionTypeImported, ModuleProvisioningStateContentDownloaded, ModuleProvisioningStateContentRetrieved, ModuleProvisioningStateContentStored, ModuleProvisioningStateContentValidated, ModuleProvisioningStateCreated, ModuleProvisioningStateCreating, ModuleProvisioningStateFailed, ModuleProvisioningStateModuleDataStored, ModuleProvisioningStateModuleImportRunbookComplete, ModuleProvisioningStateRunningImportModuleRunbook, ModuleProvisioningStateStartingImportModuleRunbook, ModuleProvisioningStateSucceeded, ModuleProvisioningStateUpdating} -} - -// OperatingSystemType enumerates the values for operating system type. -type OperatingSystemType string - -const ( - // Linux ... - Linux OperatingSystemType = "Linux" - // Windows ... - Windows OperatingSystemType = "Windows" -) - -// PossibleOperatingSystemTypeValues returns an array of possible values for the OperatingSystemType const type. -func PossibleOperatingSystemTypeValues() []OperatingSystemType { - return []OperatingSystemType{Linux, Windows} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Completed ... - Completed ProvisioningState = "Completed" - // Failed ... - Failed ProvisioningState = "Failed" - // Running ... - Running ProvisioningState = "Running" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Completed, Failed, Running} -} - -// RunbookProvisioningState enumerates the values for runbook provisioning state. -type RunbookProvisioningState string - -const ( - // RunbookProvisioningStateSucceeded ... - RunbookProvisioningStateSucceeded RunbookProvisioningState = "Succeeded" -) - -// PossibleRunbookProvisioningStateValues returns an array of possible values for the RunbookProvisioningState const type. -func PossibleRunbookProvisioningStateValues() []RunbookProvisioningState { - return []RunbookProvisioningState{RunbookProvisioningStateSucceeded} -} - -// RunbookState enumerates the values for runbook state. -type RunbookState string - -const ( - // RunbookStateEdit ... - RunbookStateEdit RunbookState = "Edit" - // RunbookStateNew ... - RunbookStateNew RunbookState = "New" - // RunbookStatePublished ... - RunbookStatePublished RunbookState = "Published" -) - -// PossibleRunbookStateValues returns an array of possible values for the RunbookState const type. -func PossibleRunbookStateValues() []RunbookState { - return []RunbookState{RunbookStateEdit, RunbookStateNew, RunbookStatePublished} -} - -// RunbookTypeEnum enumerates the values for runbook type enum. -type RunbookTypeEnum string - -const ( - // Graph ... - Graph RunbookTypeEnum = "Graph" - // GraphPowerShell ... - GraphPowerShell RunbookTypeEnum = "GraphPowerShell" - // GraphPowerShellWorkflow ... - GraphPowerShellWorkflow RunbookTypeEnum = "GraphPowerShellWorkflow" - // PowerShell ... - PowerShell RunbookTypeEnum = "PowerShell" - // PowerShellWorkflow ... - PowerShellWorkflow RunbookTypeEnum = "PowerShellWorkflow" - // Script ... - Script RunbookTypeEnum = "Script" -) - -// PossibleRunbookTypeEnumValues returns an array of possible values for the RunbookTypeEnum const type. -func PossibleRunbookTypeEnumValues() []RunbookTypeEnum { - return []RunbookTypeEnum{Graph, GraphPowerShell, GraphPowerShellWorkflow, PowerShell, PowerShellWorkflow, Script} -} - -// ScheduleDay enumerates the values for schedule day. -type ScheduleDay string - -const ( - // Friday ... - Friday ScheduleDay = "Friday" - // Monday ... - Monday ScheduleDay = "Monday" - // Saturday ... - Saturday ScheduleDay = "Saturday" - // Sunday ... - Sunday ScheduleDay = "Sunday" - // Thursday ... - Thursday ScheduleDay = "Thursday" - // Tuesday ... - Tuesday ScheduleDay = "Tuesday" - // Wednesday ... - Wednesday ScheduleDay = "Wednesday" -) - -// PossibleScheduleDayValues returns an array of possible values for the ScheduleDay const type. -func PossibleScheduleDayValues() []ScheduleDay { - return []ScheduleDay{Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday} -} - -// ScheduleFrequency enumerates the values for schedule frequency. -type ScheduleFrequency string - -const ( - // Day ... - Day ScheduleFrequency = "Day" - // Hour ... - Hour ScheduleFrequency = "Hour" - // Minute The minimum allowed interval for Minute schedules is 15 minutes. - Minute ScheduleFrequency = "Minute" - // Month ... - Month ScheduleFrequency = "Month" - // OneTime ... - OneTime ScheduleFrequency = "OneTime" - // Week ... - Week ScheduleFrequency = "Week" -) - -// PossibleScheduleFrequencyValues returns an array of possible values for the ScheduleFrequency const type. -func PossibleScheduleFrequencyValues() []ScheduleFrequency { - return []ScheduleFrequency{Day, Hour, Minute, Month, OneTime, Week} -} - -// SkuNameEnum enumerates the values for sku name enum. -type SkuNameEnum string - -const ( - // Basic ... - Basic SkuNameEnum = "Basic" - // Free ... - Free SkuNameEnum = "Free" -) - -// PossibleSkuNameEnumValues returns an array of possible values for the SkuNameEnum const type. -func PossibleSkuNameEnumValues() []SkuNameEnum { - return []SkuNameEnum{Basic, Free} -} - -// SourceType enumerates the values for source type. -type SourceType string - -const ( - // GitHub ... - GitHub SourceType = "GitHub" - // VsoGit ... - VsoGit SourceType = "VsoGit" - // VsoTfvc ... - VsoTfvc SourceType = "VsoTfvc" -) - -// PossibleSourceTypeValues returns an array of possible values for the SourceType const type. -func PossibleSourceTypeValues() []SourceType { - return []SourceType{GitHub, VsoGit, VsoTfvc} -} - -// StreamType enumerates the values for stream type. -type StreamType string - -const ( - // StreamTypeError ... - StreamTypeError StreamType = "Error" - // StreamTypeOutput ... - StreamTypeOutput StreamType = "Output" -) - -// PossibleStreamTypeValues returns an array of possible values for the StreamType const type. -func PossibleStreamTypeValues() []StreamType { - return []StreamType{StreamTypeError, StreamTypeOutput} -} - -// SyncType enumerates the values for sync type. -type SyncType string - -const ( - // FullSync ... - FullSync SyncType = "FullSync" - // PartialSync ... - PartialSync SyncType = "PartialSync" -) - -// PossibleSyncTypeValues returns an array of possible values for the SyncType const type. -func PossibleSyncTypeValues() []SyncType { - return []SyncType{FullSync, PartialSync} -} - -// TagOperators enumerates the values for tag operators. -type TagOperators string - -const ( - // TagOperatorsAll ... - TagOperatorsAll TagOperators = "All" - // TagOperatorsAny ... - TagOperatorsAny TagOperators = "Any" -) - -// PossibleTagOperatorsValues returns an array of possible values for the TagOperators const type. -func PossibleTagOperatorsValues() []TagOperators { - return []TagOperators{TagOperatorsAll, TagOperatorsAny} -} - -// TokenType enumerates the values for token type. -type TokenType string - -const ( - // Oauth ... - Oauth TokenType = "Oauth" - // PersonalAccessToken ... - PersonalAccessToken TokenType = "PersonalAccessToken" -) - -// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. -func PossibleTokenTypeValues() []TokenType { - return []TokenType{Oauth, PersonalAccessToken} -} - -// WindowsUpdateClasses enumerates the values for windows update classes. -type WindowsUpdateClasses string - -const ( - // WindowsUpdateClassesCritical ... - WindowsUpdateClassesCritical WindowsUpdateClasses = "Critical" - // WindowsUpdateClassesDefinition ... - WindowsUpdateClassesDefinition WindowsUpdateClasses = "Definition" - // WindowsUpdateClassesFeaturePack ... - WindowsUpdateClassesFeaturePack WindowsUpdateClasses = "FeaturePack" - // WindowsUpdateClassesSecurity ... - WindowsUpdateClassesSecurity WindowsUpdateClasses = "Security" - // WindowsUpdateClassesServicePack ... - WindowsUpdateClassesServicePack WindowsUpdateClasses = "ServicePack" - // WindowsUpdateClassesTools ... - WindowsUpdateClassesTools WindowsUpdateClasses = "Tools" - // WindowsUpdateClassesUnclassified ... - WindowsUpdateClassesUnclassified WindowsUpdateClasses = "Unclassified" - // WindowsUpdateClassesUpdateRollup ... - WindowsUpdateClassesUpdateRollup WindowsUpdateClasses = "UpdateRollup" - // WindowsUpdateClassesUpdates ... - WindowsUpdateClassesUpdates WindowsUpdateClasses = "Updates" -) - -// PossibleWindowsUpdateClassesValues returns an array of possible values for the WindowsUpdateClasses const type. -func PossibleWindowsUpdateClassesValues() []WindowsUpdateClasses { - return []WindowsUpdateClasses{WindowsUpdateClassesCritical, WindowsUpdateClassesDefinition, WindowsUpdateClassesFeaturePack, WindowsUpdateClassesSecurity, WindowsUpdateClassesServicePack, WindowsUpdateClassesTools, WindowsUpdateClassesUnclassified, WindowsUpdateClassesUpdateRollup, WindowsUpdateClassesUpdates} -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/fields.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/fields.go deleted file mode 100644 index f695a854ec63..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/fields.go +++ /dev/null @@ -1,120 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// FieldsClient is the automation Client -type FieldsClient struct { - BaseClient -} - -// NewFieldsClient creates an instance of the FieldsClient client. -func NewFieldsClient(subscriptionID string) FieldsClient { - return NewFieldsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFieldsClientWithBaseURI creates an instance of the FieldsClient 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 NewFieldsClientWithBaseURI(baseURI string, subscriptionID string) FieldsClient { - return FieldsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByType retrieve a list of fields of a given type identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// typeName - the name of type. -func (client FieldsClient) ListByType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FieldsClient.ListByType") - 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("automation.FieldsClient", "ListByType", err.Error()) - } - - req, err := client.ListByTypePreparer(ctx, resourceGroupName, automationAccountName, moduleName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure sending request") - return - } - - result, err = client.ListByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure responding to request") - return - } - - return -} - -// ListByTypePreparer prepares the ListByType request. -func (client FieldsClient) ListByTypePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTypeSender sends the ListByType request. The method will close the -// http.Response Body if it receives an error. -func (client FieldsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTypeResponder handles the response to the ListByType request. The method always -// closes the http.Response Body. -func (client FieldsClient) ListByTypeResponder(resp *http.Response) (result TypeFieldListResult, 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/automation/mgmt/2018-06-30-preview/automation/hybridrunbookworkergroup.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/hybridrunbookworkergroup.go deleted file mode 100644 index 385234a5f13e..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/hybridrunbookworkergroup.go +++ /dev/null @@ -1,423 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// HybridRunbookWorkerGroupClient is the automation Client -type HybridRunbookWorkerGroupClient struct { - BaseClient -} - -// NewHybridRunbookWorkerGroupClient creates an instance of the HybridRunbookWorkerGroupClient client. -func NewHybridRunbookWorkerGroupClient(subscriptionID string) HybridRunbookWorkerGroupClient { - return NewHybridRunbookWorkerGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHybridRunbookWorkerGroupClientWithBaseURI creates an instance of the HybridRunbookWorkerGroupClient 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 NewHybridRunbookWorkerGroupClientWithBaseURI(baseURI string, subscriptionID string) HybridRunbookWorkerGroupClient { - return HybridRunbookWorkerGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete a hybrid runbook worker group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// hybridRunbookWorkerGroupName - the hybrid runbook worker group name -func (client HybridRunbookWorkerGroupClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.HybridRunbookWorkerGroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client HybridRunbookWorkerGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", 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 HybridRunbookWorkerGroupClient) 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 HybridRunbookWorkerGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve a hybrid runbook worker group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// hybridRunbookWorkerGroupName - the hybrid runbook worker group name -func (client HybridRunbookWorkerGroupClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result HybridRunbookWorkerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.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("automation.HybridRunbookWorkerGroupClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client HybridRunbookWorkerGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", 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 HybridRunbookWorkerGroupClient) 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 HybridRunbookWorkerGroupClient) GetResponder(resp *http.Response) (result HybridRunbookWorkerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of hybrid runbook worker groups. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result HybridRunbookWorkerGroupsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.hrwglr.Response.Response != nil { - sc = result.hrwglr.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("automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.hrwglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.hrwglr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.hrwglr.hasNextLink() && result.hrwglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountResponder(resp *http.Response) (result HybridRunbookWorkerGroupsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client HybridRunbookWorkerGroupClient) listByAutomationAccountNextResults(ctx context.Context, lastResults HybridRunbookWorkerGroupsListResult) (result HybridRunbookWorkerGroupsListResult, err error) { - req, err := lastResults.hybridRunbookWorkerGroupsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result HybridRunbookWorkerGroupsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update a hybrid runbook worker group. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// hybridRunbookWorkerGroupName - the hybrid runbook worker group name -// parameters - the hybrid runbook worker group -func (client HybridRunbookWorkerGroupClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (result HybridRunbookWorkerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.HybridRunbookWorkerGroupClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client HybridRunbookWorkerGroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", 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 HybridRunbookWorkerGroupClient) 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 HybridRunbookWorkerGroupClient) UpdateResponder(resp *http.Response) (result HybridRunbookWorkerGroup, 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/automation/mgmt/2018-06-30-preview/automation/job.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/job.go deleted file mode 100644 index 725a6b5b0db2..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/job.go +++ /dev/null @@ -1,804 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobClient is the automation Client -type JobClient struct { - BaseClient -} - -// NewJobClient creates an instance of the JobClient client. -func NewJobClient(subscriptionID string) JobClient { - return NewJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobClientWithBaseURI creates an instance of the JobClient 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 NewJobClientWithBaseURI(baseURI string, subscriptionID string) JobClient { - return JobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a job of the runbook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// parameters - the parameters supplied to the create job operation. -// clientRequestID - identifies this specific client request. -func (client JobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, parameters JobCreateParameters, clientRequestID string) (result Job, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobCreateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, jobName, parameters, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client JobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, parameters JobCreateParameters, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) 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 JobClient) CreateResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the job identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result Job, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.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("automation.JobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) 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 JobClient) GetResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetOutput retrieve the job output identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the name of the job to be created. -// clientRequestID - identifies this specific client request. -func (client JobClient) GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.GetOutput") - 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("automation.JobClient", "GetOutput", err.Error()) - } - - req, err := client.GetOutputPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", nil, "Failure preparing request") - return - } - - resp, err := client.GetOutputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure sending request") - return - } - - result, err = client.GetOutputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure responding to request") - return - } - - return -} - -// GetOutputPreparer prepares the GetOutput request. -func (client JobClient) GetOutputPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOutputSender sends the GetOutput request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) GetOutputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetOutputResponder handles the response to the GetOutput request. The method always -// closes the http.Response Body. -func (client JobClient) GetOutputResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRunbookContent retrieve the runbook content of the job identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.GetRunbookContent") - 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("automation.JobClient", "GetRunbookContent", err.Error()) - } - - req, err := client.GetRunbookContentPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetRunbookContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure sending request") - return - } - - result, err = client.GetRunbookContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure responding to request") - return - } - - return -} - -// GetRunbookContentPreparer prepares the GetRunbookContent request. -func (client JobClient) GetRunbookContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetRunbookContentSender sends the GetRunbookContent request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) GetRunbookContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetRunbookContentResponder handles the response to the GetRunbookContent request. The method always -// closes the http.Response Body. -func (client JobClient) GetRunbookContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of jobs. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -// clientRequestID - identifies this specific client request. -func (client JobClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result JobListResultV2Page, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.jlrv.Response.Response != nil { - sc = result.jlrv.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("automation.JobClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.jlrv.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.jlrv, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.jlrv.hasNextLink() && result.jlrv.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client JobClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/jobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client JobClient) ListByAutomationAccountResponder(resp *http.Response) (result JobListResultV2, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client JobClient) listByAutomationAccountNextResults(ctx context.Context, lastResults JobListResultV2) (result JobListResultV2, err error) { - req, err := lastResults.jobListResultV2Preparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string, clientRequestID string) (result JobListResultV2Iterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter, clientRequestID) - return -} - -// Resume resume the job identified by jobName. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Resume(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Resume") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Resume", err.Error()) - } - - req, err := client.ResumePreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure responding to request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client JobClient) ResumePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) ResumeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client JobClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop the job identified by jobName. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Stop") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client JobClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client JobClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Suspend suspend the job identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// clientRequestID - identifies this specific client request. -func (client JobClient) Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Suspend") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobClient", "Suspend", err.Error()) - } - - req, err := client.SuspendPreparer(ctx, resourceGroupName, automationAccountName, jobName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure responding to request") - return - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client JobClient) SuspendPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobClient) SuspendSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client JobClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/jobschedule.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/jobschedule.go deleted file mode 100644 index d21696e53076..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/jobschedule.go +++ /dev/null @@ -1,428 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// JobScheduleClient is the automation Client -type JobScheduleClient struct { - BaseClient -} - -// NewJobScheduleClient creates an instance of the JobScheduleClient client. -func NewJobScheduleClient(subscriptionID string) JobScheduleClient { - return NewJobScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobScheduleClientWithBaseURI creates an instance of the JobScheduleClient 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 NewJobScheduleClientWithBaseURI(baseURI string, subscriptionID string) JobScheduleClient { - return JobScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a job schedule. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobScheduleID - the job schedule name. -// parameters - the parameters supplied to the create job schedule operation. -func (client JobScheduleClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (result JobSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties.Schedule", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobScheduleCreateProperties.Runbook", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.JobScheduleClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, jobScheduleID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client JobScheduleClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", 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 JobScheduleClient) 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 JobScheduleClient) CreateResponder(resp *http.Response) (result JobSchedule, 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 job schedule identified by job schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobScheduleID - the job schedule name. -func (client JobScheduleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.JobScheduleClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, jobScheduleID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobScheduleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", 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 JobScheduleClient) 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 JobScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the job schedule identified by job schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobScheduleID - the job schedule name. -func (client JobScheduleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result JobSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.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("automation.JobScheduleClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, jobScheduleID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobScheduleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", 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 JobScheduleClient) 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 JobScheduleClient) GetResponder(resp *http.Response) (result JobSchedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of job schedules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client JobScheduleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result JobScheduleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.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("automation.JobScheduleClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client JobScheduleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/jobSchedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client JobScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client JobScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result JobScheduleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client JobScheduleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults JobScheduleListResult) (result JobScheduleListResult, err error) { - req, err := lastResults.jobScheduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobScheduleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result JobScheduleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/jobstream.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/jobstream.go deleted file mode 100644 index 519b6164746a..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/jobstream.go +++ /dev/null @@ -1,262 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobStreamClient is the automation Client -type JobStreamClient struct { - BaseClient -} - -// NewJobStreamClient creates an instance of the JobStreamClient client. -func NewJobStreamClient(subscriptionID string) JobStreamClient { - return NewJobStreamClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobStreamClientWithBaseURI creates an instance of the JobStreamClient 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 NewJobStreamClientWithBaseURI(baseURI string, subscriptionID string) JobStreamClient { - return JobStreamClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the job stream identified by job stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// jobStreamID - the job stream id. -// clientRequestID - identifies this specific client request. -func (client JobStreamClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, jobStreamID string, clientRequestID string) (result JobStream, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamClient.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("automation.JobStreamClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, jobName, jobStreamID, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobStreamClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, jobStreamID string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 JobStreamClient) 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 JobStreamClient) GetResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByJob retrieve a list of jobs streams identified by job name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// jobName - the job name. -// filter - the filter to apply on the operation. -// clientRequestID - identifies this specific client request. -func (client JobStreamClient) ListByJob(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result JobStreamListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamClient.ListByJob") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.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("automation.JobStreamClient", "ListByJob", err.Error()) - } - - result.fn = client.listByJobNextResults - req, err := client.ListByJobPreparer(ctx, resourceGroupName, automationAccountName, jobName, filter, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client JobStreamClient) ListByJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client JobStreamClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client JobStreamClient) ListByJobResponder(resp *http.Response) (result JobStreamListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByJobNextResults retrieves the next set of results, if any. -func (client JobStreamClient) listByJobNextResults(ctx context.Context, lastResults JobStreamListResult) (result JobStreamListResult, err error) { - req, err := lastResults.jobStreamListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "listByJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "listByJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "listByJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobStreamClient) ListByJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, filter string, clientRequestID string) (result JobStreamListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamClient.ListByJob") - 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.ListByJob(ctx, resourceGroupName, automationAccountName, jobName, filter, clientRequestID) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/keys.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/keys.go deleted file mode 100644 index 3e6fb4e1d3cf..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/keys.go +++ /dev/null @@ -1,116 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// KeysClient is the automation Client -type KeysClient struct { - BaseClient -} - -// NewKeysClient creates an instance of the KeysClient client. -func NewKeysClient(subscriptionID string) KeysClient { - return NewKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewKeysClientWithBaseURI creates an instance of the KeysClient 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 NewKeysClientWithBaseURI(baseURI string, subscriptionID string) KeysClient { - return KeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the automation keys for an account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client KeysClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result KeyListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.ListByAutomationAccount") - 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("automation.KeysClient", "ListByAutomationAccount", err.Error()) - } - - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.KeysClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.KeysClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.KeysClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client KeysClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client KeysClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client KeysClient) ListByAutomationAccountResponder(resp *http.Response) (result KeyListResult, 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/automation/mgmt/2018-06-30-preview/automation/linkedworkspace.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/linkedworkspace.go deleted file mode 100644 index c29cf1ed93bc..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/linkedworkspace.go +++ /dev/null @@ -1,116 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LinkedWorkspaceClient is the automation Client -type LinkedWorkspaceClient struct { - BaseClient -} - -// NewLinkedWorkspaceClient creates an instance of the LinkedWorkspaceClient client. -func NewLinkedWorkspaceClient(subscriptionID string) LinkedWorkspaceClient { - return NewLinkedWorkspaceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLinkedWorkspaceClientWithBaseURI creates an instance of the LinkedWorkspaceClient 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 NewLinkedWorkspaceClientWithBaseURI(baseURI string, subscriptionID string) LinkedWorkspaceClient { - return LinkedWorkspaceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the linked workspace for the account id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client LinkedWorkspaceClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string) (result LinkedWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedWorkspaceClient.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("automation.LinkedWorkspaceClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.LinkedWorkspaceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.LinkedWorkspaceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.LinkedWorkspaceClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LinkedWorkspaceClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/linkedWorkspace", 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 LinkedWorkspaceClient) 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 LinkedWorkspaceClient) GetResponder(resp *http.Response) (result LinkedWorkspace, 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/automation/mgmt/2018-06-30-preview/automation/models.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/models.go deleted file mode 100644 index 0835ff70f645..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/models.go +++ /dev/null @@ -1,10749 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "io" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2018-06-30-preview/automation" - -// Account definition of the automation account type. -type Account struct { - autorest.Response `json:"-"` - // AccountProperties - Gets or sets the automation account properties. - *AccountProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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.Etag != nil { - objectMap["etag"] = a.Etag - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - if a.Location != nil { - objectMap["location"] = a.Location - } - 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 "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - a.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - 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 - } - } - } - - return nil -} - -// AccountCreateOrUpdateParameters the parameters supplied to the create or update automation account -// operation. -type AccountCreateOrUpdateParameters struct { - // AccountCreateOrUpdateProperties - Gets or sets account create or update properties. - *AccountCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AccountCreateOrUpdateParameters. -func (acoup AccountCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acoup.AccountCreateOrUpdateProperties != nil { - objectMap["properties"] = acoup.AccountCreateOrUpdateProperties - } - if acoup.Name != nil { - objectMap["name"] = acoup.Name - } - if acoup.Location != nil { - objectMap["location"] = acoup.Location - } - if acoup.Tags != nil { - objectMap["tags"] = acoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountCreateOrUpdateParameters struct. -func (acoup *AccountCreateOrUpdateParameters) 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 accountCreateOrUpdateProperties AccountCreateOrUpdateProperties - err = json.Unmarshal(*v, &accountCreateOrUpdateProperties) - if err != nil { - return err - } - acoup.AccountCreateOrUpdateProperties = &accountCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - acoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - acoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - acoup.Tags = tags - } - } - } - - return nil -} - -// AccountCreateOrUpdateProperties the parameters supplied to the create or update account properties. -type AccountCreateOrUpdateProperties struct { - // Sku - Gets or sets account SKU. - Sku *Sku `json:"sku,omitempty"` -} - -// AccountListResult the response model for the list account operation. -type AccountListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets list of accounts. - Value *[]Account `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - 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 definition of the account property. -type AccountProperties struct { - // Sku - Gets or sets the SKU of account. - Sku *Sku `json:"sku,omitempty"` - // LastModifiedBy - Gets or sets the last modified by. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // State - READ-ONLY; Gets status of account. Possible values include: 'Ok', 'Unavailable', 'Suspended' - State AccountState `json:"state,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Sku != nil { - objectMap["sku"] = ap.Sku - } - if ap.LastModifiedBy != nil { - objectMap["lastModifiedBy"] = ap.LastModifiedBy - } - if ap.Description != nil { - objectMap["description"] = ap.Description - } - return json.Marshal(objectMap) -} - -// AccountUpdateParameters the parameters supplied to the update automation account operation. -type AccountUpdateParameters struct { - // AccountUpdateProperties - Gets or sets account update properties. - *AccountUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.AccountUpdateProperties != nil { - objectMap["properties"] = aup.AccountUpdateProperties - } - if aup.Name != nil { - objectMap["name"] = aup.Name - } - if aup.Location != nil { - objectMap["location"] = aup.Location - } - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - 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 "properties": - if v != nil { - var accountUpdateProperties AccountUpdateProperties - err = json.Unmarshal(*v, &accountUpdateProperties) - if err != nil { - return err - } - aup.AccountUpdateProperties = &accountUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - aup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aup.Tags = tags - } - } - } - - return nil -} - -// AccountUpdateProperties the parameters supplied to the update account properties. -type AccountUpdateProperties struct { - // Sku - Gets or sets account SKU. - Sku *Sku `json:"sku,omitempty"` -} - -// Activity definition of the activity. -type Activity struct { - autorest.Response `json:"-"` - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the name of the activity. - Name *string `json:"name,omitempty"` - // ActivityProperties - Gets or sets the properties of the activity. - *ActivityProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Activity. -func (a Activity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.ID != nil { - objectMap["id"] = a.ID - } - if a.ActivityProperties != nil { - objectMap["properties"] = a.ActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Activity struct. -func (a *Activity) 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 - } - 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 "properties": - if v != nil { - var activityProperties ActivityProperties - err = json.Unmarshal(*v, &activityProperties) - if err != nil { - return err - } - a.ActivityProperties = &activityProperties - } - } - } - - return nil -} - -// ActivityListResult the response model for the list activity operation. -type ActivityListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of activities. - Value *[]Activity `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityListResultIterator provides access to a complete listing of Activity values. -type ActivityListResultIterator struct { - i int - page ActivityListResultPage -} - -// 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 *ActivityListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityListResultIterator.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 *ActivityListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ActivityListResultIterator) 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 ActivityListResultIterator) Response() ActivityListResult { - 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 ActivityListResultIterator) Value() Activity { - if !iter.page.NotDone() { - return Activity{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ActivityListResultIterator type. -func NewActivityListResultIterator(page ActivityListResultPage) ActivityListResultIterator { - return ActivityListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr ActivityListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr ActivityListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// activityListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr ActivityListResult) activityListResultPreparer(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))) -} - -// ActivityListResultPage contains a page of Activity values. -type ActivityListResultPage struct { - fn func(context.Context, ActivityListResult) (ActivityListResult, error) - alr ActivityListResult -} - -// 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 *ActivityListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityListResultPage.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 *ActivityListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ActivityListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ActivityListResultPage) Response() ActivityListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ActivityListResultPage) Values() []Activity { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the ActivityListResultPage type. -func NewActivityListResultPage(cur ActivityListResult, getNextPage func(context.Context, ActivityListResult) (ActivityListResult, error)) ActivityListResultPage { - return ActivityListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// ActivityOutputType definition of the activity output type. -type ActivityOutputType struct { - // Name - Gets or sets the name of the activity output type. - Name *string `json:"name,omitempty"` - // Type - Gets or sets the type of the activity output type. - Type *string `json:"type,omitempty"` -} - -// ActivityParameter definition of the activity parameter. -type ActivityParameter struct { - // Name - Gets or sets the name of the activity parameter. - Name *string `json:"name,omitempty"` - // Type - Gets or sets the type of the activity parameter. - Type *string `json:"type,omitempty"` - // IsMandatory - Gets or sets a Boolean value that indicates true if the parameter is required. If the value is false, the parameter is optional. - IsMandatory *bool `json:"isMandatory,omitempty"` - // IsDynamic - Gets or sets a Boolean value that indicates true if the parameter is dynamic. - IsDynamic *bool `json:"isDynamic,omitempty"` - // Position - Gets or sets the position of the activity parameter. - Position *int64 `json:"position,omitempty"` - // ValueFromPipeline - Gets or sets a Boolean value that indicates true if the parameter can take values from the incoming pipeline objects. This setting is used if the cmdlet must access the complete input object. false indicates that the parameter cannot take values from the complete input object. - ValueFromPipeline *bool `json:"valueFromPipeline,omitempty"` - // ValueFromPipelineByPropertyName - Gets or sets a Boolean value that indicates true if the parameter can be filled from a property of the incoming pipeline object that has the same name as this parameter. false indicates that the parameter cannot be filled from the incoming pipeline object property with the same name. - ValueFromPipelineByPropertyName *bool `json:"valueFromPipelineByPropertyName,omitempty"` - // ValueFromRemainingArguments - Gets or sets a Boolean value that indicates true if the cmdlet parameter accepts all the remaining command-line arguments that are associated with this parameter in the form of an array. false if the cmdlet parameter does not accept all the remaining argument values. - ValueFromRemainingArguments *bool `json:"valueFromRemainingArguments,omitempty"` - // Description - Gets or sets the description of the activity parameter. - Description *string `json:"description,omitempty"` - // ValidationSet - Gets or sets the validation set of activity parameter. - ValidationSet *[]ActivityParameterValidationSet `json:"validationSet,omitempty"` -} - -// ActivityParameterSet definition of the activity parameter set. -type ActivityParameterSet struct { - // Name - Gets or sets the name of the activity parameter set. - Name *string `json:"name,omitempty"` - // Parameters - Gets or sets the parameters of the activity parameter set. - Parameters *[]ActivityParameter `json:"parameters,omitempty"` -} - -// ActivityParameterValidationSet definition of the activity parameter validation set. -type ActivityParameterValidationSet struct { - // MemberValue - Gets or sets the name of the activity parameter validation set member. - MemberValue *string `json:"memberValue,omitempty"` -} - -// ActivityProperties properties of the activity. -type ActivityProperties struct { - // Definition - Gets or sets the user name of the activity. - Definition *string `json:"definition,omitempty"` - // ParameterSets - Gets or sets the parameter sets of the activity. - ParameterSets *[]ActivityParameterSet `json:"parameterSets,omitempty"` - // OutputTypes - Gets or sets the output types of the activity. - OutputTypes *[]ActivityOutputType `json:"outputTypes,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// AdvancedSchedule the properties of the create Advanced Schedule. -type AdvancedSchedule struct { - // WeekDays - Days of the week that the job should execute on. - WeekDays *[]string `json:"weekDays,omitempty"` - // MonthDays - Days of the month that the job should execute on. Must be between 1 and 31. - MonthDays *[]int32 `json:"monthDays,omitempty"` - // MonthlyOccurrences - Occurrences of days within a month. - MonthlyOccurrences *[]AdvancedScheduleMonthlyOccurrence `json:"monthlyOccurrences,omitempty"` -} - -// AdvancedScheduleMonthlyOccurrence the properties of the create advanced schedule monthly occurrence. -type AdvancedScheduleMonthlyOccurrence struct { - // Occurrence - Occurrence of the week within the month. Must be between 1 and 5 - Occurrence *int32 `json:"occurrence,omitempty"` - // Day - Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday. Possible values include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' - Day ScheduleDay `json:"day,omitempty"` -} - -// AgentRegistration definition of the agent registration information type. -type AgentRegistration struct { - autorest.Response `json:"-"` - // DscMetaConfiguration - Gets or sets the dsc meta configuration. - DscMetaConfiguration *string `json:"dscMetaConfiguration,omitempty"` - // Endpoint - Gets or sets the dsc server endpoint. - Endpoint *string `json:"endpoint,omitempty"` - // Keys - Gets or sets the agent registration keys. - Keys *AgentRegistrationKeys `json:"keys,omitempty"` - // ID - Gets or sets the id. - ID *string `json:"id,omitempty"` -} - -// AgentRegistrationKeys definition of the agent registration keys. -type AgentRegistrationKeys struct { - // Primary - Gets or sets the primary key. - Primary *string `json:"primary,omitempty"` - // Secondary - Gets or sets the secondary key. - Secondary *string `json:"secondary,omitempty"` -} - -// AgentRegistrationRegenerateKeyParameter the parameters supplied to the regenerate keys operation. -type AgentRegistrationRegenerateKeyParameter struct { - // KeyName - Gets or sets the agent registration key name - primary or secondary. Possible values include: 'Primary', 'Secondary' - KeyName AgentRegistrationKeyName `json:"keyName,omitempty"` -} - -// AzureQueryProperties azure query for the update configuration. -type AzureQueryProperties struct { - // Scope - List of Subscription or Resource Group ARM Ids. - Scope *[]string `json:"scope,omitempty"` - // Locations - List of locations to scope the query to. - Locations *[]string `json:"locations,omitempty"` - // TagSettings - Tag settings for the VM. - TagSettings *TagSettingsProperties `json:"tagSettings,omitempty"` -} - -// Certificate definition of the certificate. -type Certificate struct { - autorest.Response `json:"-"` - // CertificateProperties - Gets or sets the properties of the certificate. - *CertificateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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 - } - } - } - - return nil -} - -// CertificateCreateOrUpdateParameters the parameters supplied to the create or update or replace -// certificate operation. -type CertificateCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the certificate. - Name *string `json:"name,omitempty"` - // CertificateCreateOrUpdateProperties - Gets or sets the properties of the certificate. - *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateCreateOrUpdateParameters. -func (ccoup CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Name != nil { - objectMap["name"] = ccoup.Name - } - 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 "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ccoup.Name = &name - } - case "properties": - if v != nil { - var certificateCreateOrUpdateProperties CertificateCreateOrUpdateProperties - err = json.Unmarshal(*v, &certificateCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.CertificateCreateOrUpdateProperties = &certificateCreateOrUpdateProperties - } - } - } - - return nil -} - -// CertificateCreateOrUpdateProperties the properties of the create certificate operation. -type CertificateCreateOrUpdateProperties struct { - // Base64Value - Gets or sets the base64 encoded value of the certificate. - Base64Value *string `json:"base64Value,omitempty"` - // Description - Gets or sets the description of the certificate. - Description *string `json:"description,omitempty"` - // Thumbprint - Gets or sets the thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // IsExportable - Gets or sets the is exportable flag of the certificate. - IsExportable *bool `json:"isExportable,omitempty"` -} - -// CertificateListResult the response model for the list certificate operation. -type CertificateListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of certificates. - Value *[]Certificate `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateListResultIterator provides access to a complete listing of Certificate values. -type CertificateListResultIterator struct { - i int - page CertificateListResultPage -} - -// 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 *CertificateListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultIterator.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 *CertificateListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CertificateListResultIterator) 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 CertificateListResultIterator) Response() CertificateListResult { - 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 CertificateListResultIterator) Value() Certificate { - if !iter.page.NotDone() { - return Certificate{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CertificateListResultIterator type. -func NewCertificateListResultIterator(page CertificateListResultPage) CertificateListResultIterator { - return CertificateListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr CertificateListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr CertificateListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// certificateListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr CertificateListResult) certificateListResultPreparer(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))) -} - -// CertificateListResultPage contains a page of Certificate values. -type CertificateListResultPage struct { - fn func(context.Context, CertificateListResult) (CertificateListResult, error) - clr CertificateListResult -} - -// 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 *CertificateListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultPage.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 *CertificateListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CertificateListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CertificateListResultPage) Response() CertificateListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CertificateListResultPage) Values() []Certificate { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the CertificateListResultPage type. -func NewCertificateListResultPage(cur CertificateListResult, getNextPage func(context.Context, CertificateListResult) (CertificateListResult, error)) CertificateListResultPage { - return CertificateListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// CertificateProperties properties of the certificate. -type CertificateProperties struct { - // Thumbprint - READ-ONLY; Gets the thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // ExpiryTime - READ-ONLY; Gets the expiry time of the certificate. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // IsExportable - READ-ONLY; Gets the is exportable flag of the certificate. - IsExportable *bool `json:"isExportable,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateProperties. -func (cp CertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Description != nil { - objectMap["description"] = cp.Description - } - return json.Marshal(objectMap) -} - -// CertificateUpdateParameters the parameters supplied to the update certificate operation. -type CertificateUpdateParameters struct { - // Name - Gets or sets the name of the certificate. - Name *string `json:"name,omitempty"` - // CertificateUpdateProperties - Gets or sets the properties of the certificate. - *CertificateUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateUpdateParameters. -func (cup CertificateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Name != nil { - objectMap["name"] = cup.Name - } - if cup.CertificateUpdateProperties != nil { - objectMap["properties"] = cup.CertificateUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateUpdateParameters struct. -func (cup *CertificateUpdateParameters) 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 - } - cup.Name = &name - } - case "properties": - if v != nil { - var certificateUpdateProperties CertificateUpdateProperties - err = json.Unmarshal(*v, &certificateUpdateProperties) - if err != nil { - return err - } - cup.CertificateUpdateProperties = &certificateUpdateProperties - } - } - } - - return nil -} - -// CertificateUpdateProperties the properties of the update certificate operation -type CertificateUpdateProperties struct { - // Description - Gets or sets the description of the certificate. - Description *string `json:"description,omitempty"` -} - -// CollectionItemUpdateConfiguration object returned when requesting a collection of software update -// configuration -type CollectionItemUpdateConfiguration struct { - // AzureVirtualMachines - List of azure resource Ids for azure virtual machines targeted by the software update configuration. - AzureVirtualMachines *[]string `json:"azureVirtualMachines,omitempty"` - // Duration - Maximum time allowed for the software update configuration run. Duration needs to be specified using the format PT[n]H[n]M[n]S as per ISO8601 - Duration *string `json:"duration,omitempty"` -} - -// Connection definition of the connection. -type Connection struct { - autorest.Response `json:"-"` - // ConnectionProperties - Gets or sets the properties of the connection. - *ConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Connection. -func (c Connection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ConnectionProperties != nil { - objectMap["properties"] = c.ConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Connection struct. -func (c *Connection) 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 connectionProperties ConnectionProperties - err = json.Unmarshal(*v, &connectionProperties) - if err != nil { - return err - } - c.ConnectionProperties = &connectionProperties - } - 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 - } - } - } - - return nil -} - -// ConnectionCreateOrUpdateParameters the parameters supplied to the create or update connection operation. -type ConnectionCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the connection. - Name *string `json:"name,omitempty"` - // ConnectionCreateOrUpdateProperties - Gets or sets the properties of the connection. - *ConnectionCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionCreateOrUpdateParameters. -func (ccoup ConnectionCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Name != nil { - objectMap["name"] = ccoup.Name - } - if ccoup.ConnectionCreateOrUpdateProperties != nil { - objectMap["properties"] = ccoup.ConnectionCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionCreateOrUpdateParameters struct. -func (ccoup *ConnectionCreateOrUpdateParameters) 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 - } - ccoup.Name = &name - } - case "properties": - if v != nil { - var connectionCreateOrUpdateProperties ConnectionCreateOrUpdateProperties - err = json.Unmarshal(*v, &connectionCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.ConnectionCreateOrUpdateProperties = &connectionCreateOrUpdateProperties - } - } - } - - return nil -} - -// ConnectionCreateOrUpdateProperties the properties of the create connection properties -type ConnectionCreateOrUpdateProperties struct { - // Description - Gets or sets the description of the connection. - Description *string `json:"description,omitempty"` - // ConnectionType - Gets or sets the connectionType of the connection. - ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` - // FieldDefinitionValues - Gets or sets the field definition properties of the connection. - FieldDefinitionValues map[string]*string `json:"fieldDefinitionValues"` -} - -// MarshalJSON is the custom marshaler for ConnectionCreateOrUpdateProperties. -func (ccoup ConnectionCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Description != nil { - objectMap["description"] = ccoup.Description - } - if ccoup.ConnectionType != nil { - objectMap["connectionType"] = ccoup.ConnectionType - } - if ccoup.FieldDefinitionValues != nil { - objectMap["fieldDefinitionValues"] = ccoup.FieldDefinitionValues - } - return json.Marshal(objectMap) -} - -// ConnectionListResult the response model for the list connection operation. -type ConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of connection. - Value *[]Connection `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectionListResultIterator provides access to a complete listing of Connection values. -type ConnectionListResultIterator struct { - i int - page ConnectionListResultPage -} - -// 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 *ConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionListResultIterator.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 *ConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectionListResultIterator) 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 ConnectionListResultIterator) Response() ConnectionListResult { - 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 ConnectionListResultIterator) Value() Connection { - if !iter.page.NotDone() { - return Connection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectionListResultIterator type. -func NewConnectionListResultIterator(page ConnectionListResultPage) ConnectionListResultIterator { - return ConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr ConnectionListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr ConnectionListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// connectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr ConnectionListResult) connectionListResultPreparer(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))) -} - -// ConnectionListResultPage contains a page of Connection values. -type ConnectionListResultPage struct { - fn func(context.Context, ConnectionListResult) (ConnectionListResult, error) - clr ConnectionListResult -} - -// 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 *ConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionListResultPage.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 *ConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectionListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectionListResultPage) Response() ConnectionListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectionListResultPage) Values() []Connection { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the ConnectionListResultPage type. -func NewConnectionListResultPage(cur ConnectionListResult, getNextPage func(context.Context, ConnectionListResult) (ConnectionListResult, error)) ConnectionListResultPage { - return ConnectionListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// ConnectionProperties definition of the connection properties. -type ConnectionProperties struct { - // ConnectionType - Gets or sets the connectionType of the connection. - ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` - // FieldDefinitionValues - READ-ONLY; Gets the field definition values of the connection. - FieldDefinitionValues map[string]*string `json:"fieldDefinitionValues"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionProperties. -func (cp ConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.ConnectionType != nil { - objectMap["connectionType"] = cp.ConnectionType - } - if cp.Description != nil { - objectMap["description"] = cp.Description - } - return json.Marshal(objectMap) -} - -// ConnectionType definition of the connection type. -type ConnectionType struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Gets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the name of the connection type. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // ConnectionTypeProperties - Gets or sets the properties of the connection type. - *ConnectionTypeProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionType. -func (ct ConnectionType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ct.ConnectionTypeProperties != nil { - objectMap["properties"] = ct.ConnectionTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionType struct. -func (ct *ConnectionType) 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 - } - ct.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ct.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ct.Type = &typeVar - } - case "properties": - if v != nil { - var connectionTypeProperties ConnectionTypeProperties - err = json.Unmarshal(*v, &connectionTypeProperties) - if err != nil { - return err - } - ct.ConnectionTypeProperties = &connectionTypeProperties - } - } - } - - return nil -} - -// ConnectionTypeAssociationProperty the connection type property associated with the entity. -type ConnectionTypeAssociationProperty struct { - // Name - Gets or sets the name of the connection type. - Name *string `json:"name,omitempty"` -} - -// ConnectionTypeCreateOrUpdateParameters the parameters supplied to the create or update connection type -// operation. -type ConnectionTypeCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the connection type. - Name *string `json:"name,omitempty"` - // ConnectionTypeCreateOrUpdateProperties - Gets or sets the value of the connection type. - *ConnectionTypeCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionTypeCreateOrUpdateParameters. -func (ctcoup ConnectionTypeCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcoup.Name != nil { - objectMap["name"] = ctcoup.Name - } - if ctcoup.ConnectionTypeCreateOrUpdateProperties != nil { - objectMap["properties"] = ctcoup.ConnectionTypeCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionTypeCreateOrUpdateParameters struct. -func (ctcoup *ConnectionTypeCreateOrUpdateParameters) 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 - } - ctcoup.Name = &name - } - case "properties": - if v != nil { - var connectionTypeCreateOrUpdateProperties ConnectionTypeCreateOrUpdateProperties - err = json.Unmarshal(*v, &connectionTypeCreateOrUpdateProperties) - if err != nil { - return err - } - ctcoup.ConnectionTypeCreateOrUpdateProperties = &connectionTypeCreateOrUpdateProperties - } - } - } - - return nil -} - -// ConnectionTypeCreateOrUpdateProperties the properties of the create connection type. -type ConnectionTypeCreateOrUpdateProperties struct { - // IsGlobal - Gets or sets a Boolean value to indicate if the connection type is global. - IsGlobal *bool `json:"isGlobal,omitempty"` - // FieldDefinitions - Gets or sets the field definitions of the connection type. - FieldDefinitions map[string]*FieldDefinition `json:"fieldDefinitions"` -} - -// MarshalJSON is the custom marshaler for ConnectionTypeCreateOrUpdateProperties. -func (ctcoup ConnectionTypeCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcoup.IsGlobal != nil { - objectMap["isGlobal"] = ctcoup.IsGlobal - } - if ctcoup.FieldDefinitions != nil { - objectMap["fieldDefinitions"] = ctcoup.FieldDefinitions - } - return json.Marshal(objectMap) -} - -// ConnectionTypeListResult the response model for the list connection type operation. -type ConnectionTypeListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of connection types. - Value *[]ConnectionType `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectionTypeListResultIterator provides access to a complete listing of ConnectionType values. -type ConnectionTypeListResultIterator struct { - i int - page ConnectionTypeListResultPage -} - -// 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 *ConnectionTypeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeListResultIterator.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 *ConnectionTypeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectionTypeListResultIterator) 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 ConnectionTypeListResultIterator) Response() ConnectionTypeListResult { - 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 ConnectionTypeListResultIterator) Value() ConnectionType { - if !iter.page.NotDone() { - return ConnectionType{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectionTypeListResultIterator type. -func NewConnectionTypeListResultIterator(page ConnectionTypeListResultPage) ConnectionTypeListResultIterator { - return ConnectionTypeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ctlr ConnectionTypeListResult) IsEmpty() bool { - return ctlr.Value == nil || len(*ctlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ctlr ConnectionTypeListResult) hasNextLink() bool { - return ctlr.NextLink != nil && len(*ctlr.NextLink) != 0 -} - -// connectionTypeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ctlr ConnectionTypeListResult) connectionTypeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ctlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ctlr.NextLink))) -} - -// ConnectionTypeListResultPage contains a page of ConnectionType values. -type ConnectionTypeListResultPage struct { - fn func(context.Context, ConnectionTypeListResult) (ConnectionTypeListResult, error) - ctlr ConnectionTypeListResult -} - -// 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 *ConnectionTypeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionTypeListResultPage.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.ctlr) - if err != nil { - return err - } - page.ctlr = 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 *ConnectionTypeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectionTypeListResultPage) NotDone() bool { - return !page.ctlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectionTypeListResultPage) Response() ConnectionTypeListResult { - return page.ctlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectionTypeListResultPage) Values() []ConnectionType { - if page.ctlr.IsEmpty() { - return nil - } - return *page.ctlr.Value -} - -// Creates a new instance of the ConnectionTypeListResultPage type. -func NewConnectionTypeListResultPage(cur ConnectionTypeListResult, getNextPage func(context.Context, ConnectionTypeListResult) (ConnectionTypeListResult, error)) ConnectionTypeListResultPage { - return ConnectionTypeListResultPage{ - fn: getNextPage, - ctlr: cur, - } -} - -// ConnectionTypeProperties properties of the connection type. -type ConnectionTypeProperties struct { - // IsGlobal - Gets or sets a Boolean value to indicate if the connection type is global. - IsGlobal *bool `json:"isGlobal,omitempty"` - // FieldDefinitions - READ-ONLY; Gets the field definitions of the connection type. - FieldDefinitions map[string]*FieldDefinition `json:"fieldDefinitions"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionTypeProperties. -func (ctp ConnectionTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctp.IsGlobal != nil { - objectMap["isGlobal"] = ctp.IsGlobal - } - if ctp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = ctp.LastModifiedTime - } - if ctp.Description != nil { - objectMap["description"] = ctp.Description - } - return json.Marshal(objectMap) -} - -// ConnectionUpdateParameters the parameters supplied to the update connection operation. -type ConnectionUpdateParameters struct { - // Name - Gets or sets the name of the connection. - Name *string `json:"name,omitempty"` - // ConnectionUpdateProperties - Gets or sets the properties of the connection. - *ConnectionUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionUpdateParameters. -func (cup ConnectionUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Name != nil { - objectMap["name"] = cup.Name - } - if cup.ConnectionUpdateProperties != nil { - objectMap["properties"] = cup.ConnectionUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionUpdateParameters struct. -func (cup *ConnectionUpdateParameters) 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 - } - cup.Name = &name - } - case "properties": - if v != nil { - var connectionUpdateProperties ConnectionUpdateProperties - err = json.Unmarshal(*v, &connectionUpdateProperties) - if err != nil { - return err - } - cup.ConnectionUpdateProperties = &connectionUpdateProperties - } - } - } - - return nil -} - -// ConnectionUpdateProperties the properties of the update connection operation. -type ConnectionUpdateProperties struct { - // Description - Gets or sets the description of the connection. - Description *string `json:"description,omitempty"` - // FieldDefinitionValues - Gets or sets the field definition values of the connection. - FieldDefinitionValues map[string]*string `json:"fieldDefinitionValues"` -} - -// MarshalJSON is the custom marshaler for ConnectionUpdateProperties. -func (cup ConnectionUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Description != nil { - objectMap["description"] = cup.Description - } - if cup.FieldDefinitionValues != nil { - objectMap["fieldDefinitionValues"] = cup.FieldDefinitionValues - } - return json.Marshal(objectMap) -} - -// ContentHash definition of the runbook property type. -type ContentHash struct { - // Algorithm - Gets or sets the content hash algorithm used to hash the content. - Algorithm *string `json:"algorithm,omitempty"` - // Value - Gets or sets expected hash value of the content. - Value *string `json:"value,omitempty"` -} - -// ContentLink definition of the content link. -type ContentLink struct { - // URI - Gets or sets the uri of the runbook content. - URI *string `json:"uri,omitempty"` - // ContentHash - Gets or sets the hash. - ContentHash *ContentHash `json:"contentHash,omitempty"` - // Version - Gets or sets the version of the content. - Version *string `json:"version,omitempty"` -} - -// ContentSource definition of the content source. -type ContentSource struct { - // Hash - Gets or sets the hash. - Hash *ContentHash `json:"hash,omitempty"` - // Type - Gets or sets the content source type. Possible values include: 'EmbeddedContent', 'URI' - Type ContentSourceType `json:"type,omitempty"` - // Value - Gets or sets the value of the content. This is based on the content source type. - Value *string `json:"value,omitempty"` - // Version - Gets or sets the version of the content. - Version *string `json:"version,omitempty"` -} - -// Credential definition of the credential. -type Credential struct { - autorest.Response `json:"-"` - // CredentialProperties - Gets or sets the properties of the credential. - *CredentialProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Credential. -func (c Credential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.CredentialProperties != nil { - objectMap["properties"] = c.CredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Credential struct. -func (c *Credential) 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 credentialProperties CredentialProperties - err = json.Unmarshal(*v, &credentialProperties) - if err != nil { - return err - } - c.CredentialProperties = &credentialProperties - } - 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 - } - } - } - - return nil -} - -// CredentialCreateOrUpdateParameters the parameters supplied to the create or update credential operation. -type CredentialCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the credential. - Name *string `json:"name,omitempty"` - // CredentialCreateOrUpdateProperties - Gets or sets the properties of the credential. - *CredentialCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialCreateOrUpdateParameters. -func (ccoup CredentialCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.Name != nil { - objectMap["name"] = ccoup.Name - } - if ccoup.CredentialCreateOrUpdateProperties != nil { - objectMap["properties"] = ccoup.CredentialCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CredentialCreateOrUpdateParameters struct. -func (ccoup *CredentialCreateOrUpdateParameters) 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 - } - ccoup.Name = &name - } - case "properties": - if v != nil { - var credentialCreateOrUpdateProperties CredentialCreateOrUpdateProperties - err = json.Unmarshal(*v, &credentialCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.CredentialCreateOrUpdateProperties = &credentialCreateOrUpdateProperties - } - } - } - - return nil -} - -// CredentialCreateOrUpdateProperties the properties of the create credential operation. -type CredentialCreateOrUpdateProperties struct { - // UserName - Gets or sets the user name of the credential. - UserName *string `json:"userName,omitempty"` - // Password - Gets or sets the password of the credential. - Password *string `json:"password,omitempty"` - // Description - Gets or sets the description of the credential. - Description *string `json:"description,omitempty"` -} - -// CredentialListResult the response model for the list credential operation. -type CredentialListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of credentials. - Value *[]Credential `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// CredentialListResultIterator provides access to a complete listing of Credential values. -type CredentialListResultIterator struct { - i int - page CredentialListResultPage -} - -// 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 *CredentialListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialListResultIterator.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 *CredentialListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CredentialListResultIterator) 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 CredentialListResultIterator) Response() CredentialListResult { - 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 CredentialListResultIterator) Value() Credential { - if !iter.page.NotDone() { - return Credential{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CredentialListResultIterator type. -func NewCredentialListResultIterator(page CredentialListResultPage) CredentialListResultIterator { - return CredentialListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr CredentialListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr CredentialListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// credentialListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr CredentialListResult) credentialListResultPreparer(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))) -} - -// CredentialListResultPage contains a page of Credential values. -type CredentialListResultPage struct { - fn func(context.Context, CredentialListResult) (CredentialListResult, error) - clr CredentialListResult -} - -// 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 *CredentialListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CredentialListResultPage.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 *CredentialListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CredentialListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CredentialListResultPage) Response() CredentialListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CredentialListResultPage) Values() []Credential { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the CredentialListResultPage type. -func NewCredentialListResultPage(cur CredentialListResult, getNextPage func(context.Context, CredentialListResult) (CredentialListResult, error)) CredentialListResultPage { - return CredentialListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// CredentialProperties definition of the credential properties -type CredentialProperties struct { - // UserName - READ-ONLY; Gets the user name of the credential. - UserName *string `json:"userName,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialProperties. -func (cp CredentialProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Description != nil { - objectMap["description"] = cp.Description - } - return json.Marshal(objectMap) -} - -// CredentialUpdateParameters the parameters supplied to the Update credential operation. -type CredentialUpdateParameters struct { - // Name - Gets or sets the name of the credential. - Name *string `json:"name,omitempty"` - // CredentialUpdateProperties - Gets or sets the properties of the variable. - *CredentialUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialUpdateParameters. -func (cup CredentialUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Name != nil { - objectMap["name"] = cup.Name - } - if cup.CredentialUpdateProperties != nil { - objectMap["properties"] = cup.CredentialUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CredentialUpdateParameters struct. -func (cup *CredentialUpdateParameters) 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 - } - cup.Name = &name - } - case "properties": - if v != nil { - var credentialUpdateProperties CredentialUpdateProperties - err = json.Unmarshal(*v, &credentialUpdateProperties) - if err != nil { - return err - } - cup.CredentialUpdateProperties = &credentialUpdateProperties - } - } - } - - return nil -} - -// CredentialUpdateProperties the properties of the Update credential -type CredentialUpdateProperties struct { - // UserName - Gets or sets the user name of the credential. - UserName *string `json:"userName,omitempty"` - // Password - Gets or sets the password of the credential. - Password *string `json:"password,omitempty"` - // Description - Gets or sets the description of the credential. - Description *string `json:"description,omitempty"` -} - -// DscCompilationJob definition of the Dsc Compilation job. -type DscCompilationJob struct { - autorest.Response `json:"-"` - // DscCompilationJobProperties - Gets or sets the properties of the Dsc Compilation job. - *DscCompilationJobProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJob. -func (dcj DscCompilationJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcj.DscCompilationJobProperties != nil { - objectMap["properties"] = dcj.DscCompilationJobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscCompilationJob struct. -func (dcj *DscCompilationJob) 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 dscCompilationJobProperties DscCompilationJobProperties - err = json.Unmarshal(*v, &dscCompilationJobProperties) - if err != nil { - return err - } - dcj.DscCompilationJobProperties = &dscCompilationJobProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcj.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcj.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcj.Type = &typeVar - } - } - } - - return nil -} - -// DscCompilationJobCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DscCompilationJobCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DscCompilationJobClient) (DscCompilationJob, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DscCompilationJobCreateFuture) 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 DscCompilationJobCreateFuture.Result. -func (future *DscCompilationJobCreateFuture) result(client DscCompilationJobClient) (dcj DscCompilationJob, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcj.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.DscCompilationJobCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcj.Response.Response, err = future.GetResult(sender); err == nil && dcj.Response.Response.StatusCode != http.StatusNoContent { - dcj, err = client.CreateResponder(dcj.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobCreateFuture", "Result", dcj.Response.Response, "Failure responding to request") - } - } - return -} - -// DscCompilationJobCreateParameters the parameters supplied to the create compilation job operation. -type DscCompilationJobCreateParameters struct { - // DscCompilationJobCreateProperties - Gets or sets the list of compilation job properties. - *DscCompilationJobCreateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJobCreateParameters. -func (dcjcp DscCompilationJobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcjcp.DscCompilationJobCreateProperties != nil { - objectMap["properties"] = dcjcp.DscCompilationJobCreateProperties - } - if dcjcp.Name != nil { - objectMap["name"] = dcjcp.Name - } - if dcjcp.Location != nil { - objectMap["location"] = dcjcp.Location - } - if dcjcp.Tags != nil { - objectMap["tags"] = dcjcp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscCompilationJobCreateParameters struct. -func (dcjcp *DscCompilationJobCreateParameters) 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 dscCompilationJobCreateProperties DscCompilationJobCreateProperties - err = json.Unmarshal(*v, &dscCompilationJobCreateProperties) - if err != nil { - return err - } - dcjcp.DscCompilationJobCreateProperties = &dscCompilationJobCreateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcjcp.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dcjcp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcjcp.Tags = tags - } - } - } - - return nil -} - -// DscCompilationJobCreateProperties the parameters supplied to the create compilation job operation. -type DscCompilationJobCreateProperties struct { - // Configuration - Gets or sets the configuration. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // IncrementNodeConfigurationBuild - If a new build version of NodeConfiguration is required. - IncrementNodeConfigurationBuild *bool `json:"incrementNodeConfigurationBuild,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJobCreateProperties. -func (dcjcp DscCompilationJobCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcjcp.Configuration != nil { - objectMap["configuration"] = dcjcp.Configuration - } - if dcjcp.Parameters != nil { - objectMap["parameters"] = dcjcp.Parameters - } - if dcjcp.IncrementNodeConfigurationBuild != nil { - objectMap["incrementNodeConfigurationBuild"] = dcjcp.IncrementNodeConfigurationBuild - } - return json.Marshal(objectMap) -} - -// DscCompilationJobListResult the response model for the list job operation. -type DscCompilationJobListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of Dsc Compilation jobs. - Value *[]DscCompilationJob `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// DscCompilationJobListResultIterator provides access to a complete listing of DscCompilationJob values. -type DscCompilationJobListResultIterator struct { - i int - page DscCompilationJobListResultPage -} - -// 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 *DscCompilationJobListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobListResultIterator.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 *DscCompilationJobListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscCompilationJobListResultIterator) 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 DscCompilationJobListResultIterator) Response() DscCompilationJobListResult { - 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 DscCompilationJobListResultIterator) Value() DscCompilationJob { - if !iter.page.NotDone() { - return DscCompilationJob{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscCompilationJobListResultIterator type. -func NewDscCompilationJobListResultIterator(page DscCompilationJobListResultPage) DscCompilationJobListResultIterator { - return DscCompilationJobListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dcjlr DscCompilationJobListResult) IsEmpty() bool { - return dcjlr.Value == nil || len(*dcjlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dcjlr DscCompilationJobListResult) hasNextLink() bool { - return dcjlr.NextLink != nil && len(*dcjlr.NextLink) != 0 -} - -// dscCompilationJobListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dcjlr DscCompilationJobListResult) dscCompilationJobListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dcjlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dcjlr.NextLink))) -} - -// DscCompilationJobListResultPage contains a page of DscCompilationJob values. -type DscCompilationJobListResultPage struct { - fn func(context.Context, DscCompilationJobListResult) (DscCompilationJobListResult, error) - dcjlr DscCompilationJobListResult -} - -// 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 *DscCompilationJobListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscCompilationJobListResultPage.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.dcjlr) - if err != nil { - return err - } - page.dcjlr = 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 *DscCompilationJobListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscCompilationJobListResultPage) NotDone() bool { - return !page.dcjlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscCompilationJobListResultPage) Response() DscCompilationJobListResult { - return page.dcjlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscCompilationJobListResultPage) Values() []DscCompilationJob { - if page.dcjlr.IsEmpty() { - return nil - } - return *page.dcjlr.Value -} - -// Creates a new instance of the DscCompilationJobListResultPage type. -func NewDscCompilationJobListResultPage(cur DscCompilationJobListResult, getNextPage func(context.Context, DscCompilationJobListResult) (DscCompilationJobListResult, error)) DscCompilationJobListResultPage { - return DscCompilationJobListResultPage{ - fn: getNextPage, - dcjlr: cur, - } -} - -// DscCompilationJobProperties definition of Dsc Compilation job properties. -type DscCompilationJobProperties struct { - // Configuration - Gets or sets the configuration. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // StartedBy - READ-ONLY; Gets the compilation job started by. - StartedBy *string `json:"startedBy,omitempty"` - // JobID - READ-ONLY; Gets the id of the job. - JobID *uuid.UUID `json:"jobId,omitempty"` - // CreationTime - READ-ONLY; Gets the creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - The current provisioning state of the job. Possible values include: 'JobProvisioningStateFailed', 'JobProvisioningStateSucceeded', 'JobProvisioningStateSuspended', 'JobProvisioningStateProcessing' - ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` - // Status - Gets or sets the status of the job. Possible values include: 'JobStatusNew', 'JobStatusActivating', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusStopped', 'JobStatusBlocked', 'JobStatusSuspended', 'JobStatusDisconnected', 'JobStatusSuspending', 'JobStatusStopping', 'JobStatusResuming', 'JobStatusRemoving' - Status JobStatus `json:"status,omitempty"` - // StatusDetails - Gets or sets the status details of the job. - StatusDetails *string `json:"statusDetails,omitempty"` - // StartTime - READ-ONLY; Gets the start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // Exception - READ-ONLY; Gets the exception of the job. - Exception *string `json:"exception,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modified time of the job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastStatusModifiedTime - READ-ONLY; Gets the last status modified time of the job. - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for DscCompilationJobProperties. -func (dcjp DscCompilationJobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcjp.Configuration != nil { - objectMap["configuration"] = dcjp.Configuration - } - if dcjp.ProvisioningState != "" { - objectMap["provisioningState"] = dcjp.ProvisioningState - } - if dcjp.RunOn != nil { - objectMap["runOn"] = dcjp.RunOn - } - if dcjp.Status != "" { - objectMap["status"] = dcjp.Status - } - if dcjp.StatusDetails != nil { - objectMap["statusDetails"] = dcjp.StatusDetails - } - if dcjp.Parameters != nil { - objectMap["parameters"] = dcjp.Parameters - } - return json.Marshal(objectMap) -} - -// DscConfiguration definition of the configuration type. -type DscConfiguration struct { - autorest.Response `json:"-"` - // DscConfigurationProperties - Gets or sets the configuration properties. - *DscConfigurationProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscConfiguration. -func (dc DscConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dc.DscConfigurationProperties != nil { - objectMap["properties"] = dc.DscConfigurationProperties - } - if dc.Etag != nil { - objectMap["etag"] = dc.Etag - } - if dc.Tags != nil { - objectMap["tags"] = dc.Tags - } - if dc.Location != nil { - objectMap["location"] = dc.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscConfiguration struct. -func (dc *DscConfiguration) 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 dscConfigurationProperties DscConfigurationProperties - err = json.Unmarshal(*v, &dscConfigurationProperties) - if err != nil { - return err - } - dc.DscConfigurationProperties = &dscConfigurationProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dc.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dc.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dc.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dc.Type = &typeVar - } - } - } - - return nil -} - -// DscConfigurationAssociationProperty the Dsc configuration property associated with the entity. -type DscConfigurationAssociationProperty struct { - // Name - Gets or sets the name of the Dsc configuration. - Name *string `json:"name,omitempty"` -} - -// DscConfigurationCreateOrUpdateParameters the parameters supplied to the create or update configuration -// operation. -type DscConfigurationCreateOrUpdateParameters struct { - // DscConfigurationCreateOrUpdateProperties - Gets or sets configuration create or update properties. - *DscConfigurationCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationCreateOrUpdateParameters. -func (dccoup DscConfigurationCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dccoup.DscConfigurationCreateOrUpdateProperties != nil { - objectMap["properties"] = dccoup.DscConfigurationCreateOrUpdateProperties - } - if dccoup.Name != nil { - objectMap["name"] = dccoup.Name - } - if dccoup.Location != nil { - objectMap["location"] = dccoup.Location - } - if dccoup.Tags != nil { - objectMap["tags"] = dccoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscConfigurationCreateOrUpdateParameters struct. -func (dccoup *DscConfigurationCreateOrUpdateParameters) 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 dscConfigurationCreateOrUpdateProperties DscConfigurationCreateOrUpdateProperties - err = json.Unmarshal(*v, &dscConfigurationCreateOrUpdateProperties) - if err != nil { - return err - } - dccoup.DscConfigurationCreateOrUpdateProperties = &dscConfigurationCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dccoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dccoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dccoup.Tags = tags - } - } - } - - return nil -} - -// DscConfigurationCreateOrUpdateProperties the properties to create or update configuration. -type DscConfigurationCreateOrUpdateProperties struct { - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // Source - Gets or sets the source. - Source *ContentSource `json:"source,omitempty"` - // Parameters - Gets or sets the configuration parameters. - Parameters map[string]*DscConfigurationParameter `json:"parameters"` - // Description - Gets or sets the description of the configuration. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationCreateOrUpdateProperties. -func (dccoup DscConfigurationCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dccoup.LogVerbose != nil { - objectMap["logVerbose"] = dccoup.LogVerbose - } - if dccoup.LogProgress != nil { - objectMap["logProgress"] = dccoup.LogProgress - } - if dccoup.Source != nil { - objectMap["source"] = dccoup.Source - } - if dccoup.Parameters != nil { - objectMap["parameters"] = dccoup.Parameters - } - if dccoup.Description != nil { - objectMap["description"] = dccoup.Description - } - return json.Marshal(objectMap) -} - -// DscConfigurationListResult the response model for the list configuration operation. -type DscConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of configurations. - Value *[]DscConfiguration `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` - // TotalCount - Gets the total number of configurations matching filter criteria. - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// DscConfigurationListResultIterator provides access to a complete listing of DscConfiguration values. -type DscConfigurationListResultIterator struct { - i int - page DscConfigurationListResultPage -} - -// 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 *DscConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationListResultIterator.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 *DscConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscConfigurationListResultIterator) 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 DscConfigurationListResultIterator) Response() DscConfigurationListResult { - 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 DscConfigurationListResultIterator) Value() DscConfiguration { - if !iter.page.NotDone() { - return DscConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscConfigurationListResultIterator type. -func NewDscConfigurationListResultIterator(page DscConfigurationListResultPage) DscConfigurationListResultIterator { - return DscConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dclr DscConfigurationListResult) IsEmpty() bool { - return dclr.Value == nil || len(*dclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dclr DscConfigurationListResult) hasNextLink() bool { - return dclr.NextLink != nil && len(*dclr.NextLink) != 0 -} - -// dscConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dclr DscConfigurationListResult) dscConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dclr.NextLink))) -} - -// DscConfigurationListResultPage contains a page of DscConfiguration values. -type DscConfigurationListResultPage struct { - fn func(context.Context, DscConfigurationListResult) (DscConfigurationListResult, error) - dclr DscConfigurationListResult -} - -// 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 *DscConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscConfigurationListResultPage.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.dclr) - if err != nil { - return err - } - page.dclr = 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 *DscConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscConfigurationListResultPage) NotDone() bool { - return !page.dclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscConfigurationListResultPage) Response() DscConfigurationListResult { - return page.dclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscConfigurationListResultPage) Values() []DscConfiguration { - if page.dclr.IsEmpty() { - return nil - } - return *page.dclr.Value -} - -// Creates a new instance of the DscConfigurationListResultPage type. -func NewDscConfigurationListResultPage(cur DscConfigurationListResult, getNextPage func(context.Context, DscConfigurationListResult) (DscConfigurationListResult, error)) DscConfigurationListResultPage { - return DscConfigurationListResultPage{ - fn: getNextPage, - dclr: cur, - } -} - -// DscConfigurationParameter definition of the configuration parameter type. -type DscConfigurationParameter struct { - // Type - Gets or sets the type of the parameter. - Type *string `json:"type,omitempty"` - // IsMandatory - Gets or sets a Boolean value to indicate whether the parameter is mandatory or not. - IsMandatory *bool `json:"isMandatory,omitempty"` - // Position - Get or sets the position of the parameter. - Position *int32 `json:"position,omitempty"` - // DefaultValue - Gets or sets the default value of parameter. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// DscConfigurationProperties definition of the configuration property type. -type DscConfigurationProperties struct { - // ProvisioningState - Gets or sets the provisioning state of the configuration. Possible values include: 'Succeeded' - ProvisioningState DscConfigurationProvisioningState `json:"provisioningState,omitempty"` - // JobCount - Gets or sets the job count of the configuration. - JobCount *int32 `json:"jobCount,omitempty"` - // Parameters - Gets or sets the configuration parameters. - Parameters map[string]*DscConfigurationParameter `json:"parameters"` - // Source - Gets or sets the source. - Source *ContentSource `json:"source,omitempty"` - // State - Gets or sets the state of the configuration. Possible values include: 'DscConfigurationStateNew', 'DscConfigurationStateEdit', 'DscConfigurationStatePublished' - State DscConfigurationState `json:"state,omitempty"` - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // NodeConfigurationCount - Gets the number of compiled node configurations. - NodeConfigurationCount *int32 `json:"nodeConfigurationCount,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationProperties. -func (dcp DscConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcp.ProvisioningState != "" { - objectMap["provisioningState"] = dcp.ProvisioningState - } - if dcp.JobCount != nil { - objectMap["jobCount"] = dcp.JobCount - } - if dcp.Parameters != nil { - objectMap["parameters"] = dcp.Parameters - } - if dcp.Source != nil { - objectMap["source"] = dcp.Source - } - if dcp.State != "" { - objectMap["state"] = dcp.State - } - if dcp.LogVerbose != nil { - objectMap["logVerbose"] = dcp.LogVerbose - } - if dcp.CreationTime != nil { - objectMap["creationTime"] = dcp.CreationTime - } - if dcp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = dcp.LastModifiedTime - } - if dcp.NodeConfigurationCount != nil { - objectMap["nodeConfigurationCount"] = dcp.NodeConfigurationCount - } - if dcp.Description != nil { - objectMap["description"] = dcp.Description - } - return json.Marshal(objectMap) -} - -// DscConfigurationUpdateParameters the parameters supplied to the create or update configuration -// operation. -type DscConfigurationUpdateParameters struct { - // DscConfigurationCreateOrUpdateProperties - Gets or sets configuration create or update properties. - *DscConfigurationCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscConfigurationUpdateParameters. -func (dcup DscConfigurationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcup.DscConfigurationCreateOrUpdateProperties != nil { - objectMap["properties"] = dcup.DscConfigurationCreateOrUpdateProperties - } - if dcup.Name != nil { - objectMap["name"] = dcup.Name - } - if dcup.Tags != nil { - objectMap["tags"] = dcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscConfigurationUpdateParameters struct. -func (dcup *DscConfigurationUpdateParameters) 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 dscConfigurationCreateOrUpdateProperties DscConfigurationCreateOrUpdateProperties - err = json.Unmarshal(*v, &dscConfigurationCreateOrUpdateProperties) - if err != nil { - return err - } - dcup.DscConfigurationCreateOrUpdateProperties = &dscConfigurationCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcup.Name = &name - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcup.Tags = tags - } - } - } - - return nil -} - -// DscMetaConfiguration definition of the DSC Meta Configuration. -type DscMetaConfiguration struct { - // ConfigurationModeFrequencyMins - Gets or sets the ConfigurationModeFrequencyMins value of the meta configuration. - ConfigurationModeFrequencyMins *int32 `json:"configurationModeFrequencyMins,omitempty"` - // RebootNodeIfNeeded - Gets or sets the RebootNodeIfNeeded value of the meta configuration. - RebootNodeIfNeeded *bool `json:"rebootNodeIfNeeded,omitempty"` - // ConfigurationMode - Gets or sets the ConfigurationMode value of the meta configuration. - ConfigurationMode *string `json:"configurationMode,omitempty"` - // ActionAfterReboot - Gets or sets the ActionAfterReboot value of the meta configuration. - ActionAfterReboot *string `json:"actionAfterReboot,omitempty"` - // CertificateID - Gets or sets the CertificateId value of the meta configuration. - CertificateID *string `json:"certificateId,omitempty"` - // RefreshFrequencyMins - Gets or sets the RefreshFrequencyMins value of the meta configuration. - RefreshFrequencyMins *int32 `json:"refreshFrequencyMins,omitempty"` - // AllowModuleOverwrite - Gets or sets the AllowModuleOverwrite value of the meta configuration. - AllowModuleOverwrite *bool `json:"allowModuleOverwrite,omitempty"` -} - -// DscNode definition of a DscNode -type DscNode struct { - autorest.Response `json:"-"` - // DscNodeProperties - The properties of a DscNode. - *DscNodeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscNode. -func (dn DscNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dn.DscNodeProperties != nil { - objectMap["properties"] = dn.DscNodeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNode struct. -func (dn *DscNode) 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 dscNodeProperties DscNodeProperties - err = json.Unmarshal(*v, &dscNodeProperties) - if err != nil { - return err - } - dn.DscNodeProperties = &dscNodeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dn.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dn.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dn.Type = &typeVar - } - } - } - - return nil -} - -// DscNodeConfiguration definition of the dsc node configuration. -type DscNodeConfiguration struct { - autorest.Response `json:"-"` - // DscNodeConfigurationProperties - Gets or sets the configuration properties. - *DscNodeConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for DscNodeConfiguration. -func (dnc DscNodeConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dnc.DscNodeConfigurationProperties != nil { - objectMap["properties"] = dnc.DscNodeConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNodeConfiguration struct. -func (dnc *DscNodeConfiguration) 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 dscNodeConfigurationProperties DscNodeConfigurationProperties - err = json.Unmarshal(*v, &dscNodeConfigurationProperties) - if err != nil { - return err - } - dnc.DscNodeConfigurationProperties = &dscNodeConfigurationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dnc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dnc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dnc.Type = &typeVar - } - } - } - - return nil -} - -// DscNodeConfigurationAssociationProperty the dsc node configuration property associated with the entity. -type DscNodeConfigurationAssociationProperty struct { - // Name - Gets or sets the name of the dsc node configuration. - Name *string `json:"name,omitempty"` -} - -// DscNodeConfigurationCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DscNodeConfigurationCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DscNodeConfigurationClient) (DscNodeConfiguration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DscNodeConfigurationCreateOrUpdateFuture) 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 DscNodeConfigurationCreateOrUpdateFuture.Result. -func (future *DscNodeConfigurationCreateOrUpdateFuture) result(client DscNodeConfigurationClient) (dnc DscNodeConfiguration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dnc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.DscNodeConfigurationCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dnc.Response.Response, err = future.GetResult(sender); err == nil && dnc.Response.Response.StatusCode != http.StatusNoContent { - dnc, err = client.CreateOrUpdateResponder(dnc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationCreateOrUpdateFuture", "Result", dnc.Response.Response, "Failure responding to request") - } - } - return -} - -// DscNodeConfigurationCreateOrUpdateParameters the parameters supplied to the create or update node -// configuration operation. -type DscNodeConfigurationCreateOrUpdateParameters struct { - // DscNodeConfigurationCreateOrUpdateParametersProperties - Node configuration properties - *DscNodeConfigurationCreateOrUpdateParametersProperties `json:"properties,omitempty"` - // Name - Name of the node configuration. - Name *string `json:"name,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscNodeConfigurationCreateOrUpdateParameters. -func (dnccoup DscNodeConfigurationCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dnccoup.DscNodeConfigurationCreateOrUpdateParametersProperties != nil { - objectMap["properties"] = dnccoup.DscNodeConfigurationCreateOrUpdateParametersProperties - } - if dnccoup.Name != nil { - objectMap["name"] = dnccoup.Name - } - if dnccoup.Tags != nil { - objectMap["tags"] = dnccoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNodeConfigurationCreateOrUpdateParameters struct. -func (dnccoup *DscNodeConfigurationCreateOrUpdateParameters) 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 dscNodeConfigurationCreateOrUpdateParametersProperties DscNodeConfigurationCreateOrUpdateParametersProperties - err = json.Unmarshal(*v, &dscNodeConfigurationCreateOrUpdateParametersProperties) - if err != nil { - return err - } - dnccoup.DscNodeConfigurationCreateOrUpdateParametersProperties = &dscNodeConfigurationCreateOrUpdateParametersProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dnccoup.Name = &name - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dnccoup.Tags = tags - } - } - } - - return nil -} - -// DscNodeConfigurationCreateOrUpdateParametersProperties the parameter properties supplied to the create -// or update node configuration operation. -type DscNodeConfigurationCreateOrUpdateParametersProperties struct { - // Source - Gets or sets the source. - Source *ContentSource `json:"source,omitempty"` - // Configuration - Gets or sets the configuration of the node. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // IncrementNodeConfigurationBuild - If a new build version of NodeConfiguration is required. - IncrementNodeConfigurationBuild *bool `json:"incrementNodeConfigurationBuild,omitempty"` -} - -// DscNodeConfigurationListResult the response model for the list job operation. -type DscNodeConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of Dsc node configurations. - Value *[]DscNodeConfiguration `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` - // TotalCount - Gets or sets the total rows in query. - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// DscNodeConfigurationListResultIterator provides access to a complete listing of DscNodeConfiguration -// values. -type DscNodeConfigurationListResultIterator struct { - i int - page DscNodeConfigurationListResultPage -} - -// 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 *DscNodeConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationListResultIterator.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 *DscNodeConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscNodeConfigurationListResultIterator) 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 DscNodeConfigurationListResultIterator) Response() DscNodeConfigurationListResult { - 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 DscNodeConfigurationListResultIterator) Value() DscNodeConfiguration { - if !iter.page.NotDone() { - return DscNodeConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscNodeConfigurationListResultIterator type. -func NewDscNodeConfigurationListResultIterator(page DscNodeConfigurationListResultPage) DscNodeConfigurationListResultIterator { - return DscNodeConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dnclr DscNodeConfigurationListResult) IsEmpty() bool { - return dnclr.Value == nil || len(*dnclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dnclr DscNodeConfigurationListResult) hasNextLink() bool { - return dnclr.NextLink != nil && len(*dnclr.NextLink) != 0 -} - -// dscNodeConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dnclr DscNodeConfigurationListResult) dscNodeConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dnclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dnclr.NextLink))) -} - -// DscNodeConfigurationListResultPage contains a page of DscNodeConfiguration values. -type DscNodeConfigurationListResultPage struct { - fn func(context.Context, DscNodeConfigurationListResult) (DscNodeConfigurationListResult, error) - dnclr DscNodeConfigurationListResult -} - -// 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 *DscNodeConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeConfigurationListResultPage.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.dnclr) - if err != nil { - return err - } - page.dnclr = 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 *DscNodeConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscNodeConfigurationListResultPage) NotDone() bool { - return !page.dnclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscNodeConfigurationListResultPage) Response() DscNodeConfigurationListResult { - return page.dnclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscNodeConfigurationListResultPage) Values() []DscNodeConfiguration { - if page.dnclr.IsEmpty() { - return nil - } - return *page.dnclr.Value -} - -// Creates a new instance of the DscNodeConfigurationListResultPage type. -func NewDscNodeConfigurationListResultPage(cur DscNodeConfigurationListResult, getNextPage func(context.Context, DscNodeConfigurationListResult) (DscNodeConfigurationListResult, error)) DscNodeConfigurationListResultPage { - return DscNodeConfigurationListResultPage{ - fn: getNextPage, - dnclr: cur, - } -} - -// DscNodeConfigurationProperties properties for the DscNodeConfiguration -type DscNodeConfigurationProperties struct { - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // CreationTime - Gets or sets creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Configuration - Gets or sets the configuration of the node. - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - // Source - Source of node configuration. - Source *string `json:"source,omitempty"` - // NodeCount - Number of nodes with this node configuration assigned - NodeCount *int64 `json:"nodeCount,omitempty"` - // IncrementNodeConfigurationBuild - If a new build version of NodeConfiguration is required. - IncrementNodeConfigurationBuild *bool `json:"incrementNodeConfigurationBuild,omitempty"` -} - -// DscNodeExtensionHandlerAssociationProperty the dsc extensionHandler property associated with the node -type DscNodeExtensionHandlerAssociationProperty struct { - // Name - Gets or sets the name of the extension handler. - Name *string `json:"name,omitempty"` - // Version - Gets or sets the version of the extension handler. - Version *string `json:"version,omitempty"` -} - -// DscNodeListResult the response model for the list dsc nodes operation. -type DscNodeListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of dsc nodes. - Value *[]DscNode `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` - // TotalCount - Gets the total number of nodes matching filter criteria. - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// DscNodeListResultIterator provides access to a complete listing of DscNode values. -type DscNodeListResultIterator struct { - i int - page DscNodeListResultPage -} - -// 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 *DscNodeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeListResultIterator.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 *DscNodeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscNodeListResultIterator) 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 DscNodeListResultIterator) Response() DscNodeListResult { - 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 DscNodeListResultIterator) Value() DscNode { - if !iter.page.NotDone() { - return DscNode{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscNodeListResultIterator type. -func NewDscNodeListResultIterator(page DscNodeListResultPage) DscNodeListResultIterator { - return DscNodeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dnlr DscNodeListResult) IsEmpty() bool { - return dnlr.Value == nil || len(*dnlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dnlr DscNodeListResult) hasNextLink() bool { - return dnlr.NextLink != nil && len(*dnlr.NextLink) != 0 -} - -// dscNodeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dnlr DscNodeListResult) dscNodeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dnlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dnlr.NextLink))) -} - -// DscNodeListResultPage contains a page of DscNode values. -type DscNodeListResultPage struct { - fn func(context.Context, DscNodeListResult) (DscNodeListResult, error) - dnlr DscNodeListResult -} - -// 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 *DscNodeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeListResultPage.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.dnlr) - if err != nil { - return err - } - page.dnlr = 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 *DscNodeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscNodeListResultPage) NotDone() bool { - return !page.dnlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscNodeListResultPage) Response() DscNodeListResult { - return page.dnlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscNodeListResultPage) Values() []DscNode { - if page.dnlr.IsEmpty() { - return nil - } - return *page.dnlr.Value -} - -// Creates a new instance of the DscNodeListResultPage type. -func NewDscNodeListResultPage(cur DscNodeListResult, getNextPage func(context.Context, DscNodeListResult) (DscNodeListResult, error)) DscNodeListResultPage { - return DscNodeListResultPage{ - fn: getNextPage, - dnlr: cur, - } -} - -// DscNodeProperties the properties of a DscNode -type DscNodeProperties struct { - // LastSeen - Gets or sets the last seen time of the node. - LastSeen *date.Time `json:"lastSeen,omitempty"` - // RegistrationTime - Gets or sets the registration time of the node. - RegistrationTime *date.Time `json:"registrationTime,omitempty"` - // IP - Gets or sets the ip of the node. - IP *string `json:"ip,omitempty"` - // AccountID - Gets or sets the account id of the node. - AccountID *string `json:"accountId,omitempty"` - // DscNodeConfigurationAssociationProperty - Gets or sets the configuration of the node. - *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` - // Status - Gets or sets the status of the node. - Status *string `json:"status,omitempty"` - // NodeID - Gets or sets the node id. - NodeID *string `json:"nodeId,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // TotalCount - Gets the total number of records matching filter criteria. - TotalCount *int32 `json:"totalCount,omitempty"` - // ExtensionHandler - Gets or sets the list of extensionHandler properties for a Node. - ExtensionHandler *[]DscNodeExtensionHandlerAssociationProperty `json:"extensionHandler,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscNodeProperties. -func (dnp DscNodeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dnp.LastSeen != nil { - objectMap["lastSeen"] = dnp.LastSeen - } - if dnp.RegistrationTime != nil { - objectMap["registrationTime"] = dnp.RegistrationTime - } - if dnp.IP != nil { - objectMap["ip"] = dnp.IP - } - if dnp.AccountID != nil { - objectMap["accountId"] = dnp.AccountID - } - if dnp.DscNodeConfigurationAssociationProperty != nil { - objectMap["nodeConfiguration"] = dnp.DscNodeConfigurationAssociationProperty - } - if dnp.Status != nil { - objectMap["status"] = dnp.Status - } - if dnp.NodeID != nil { - objectMap["nodeId"] = dnp.NodeID - } - if dnp.Etag != nil { - objectMap["etag"] = dnp.Etag - } - if dnp.TotalCount != nil { - objectMap["totalCount"] = dnp.TotalCount - } - if dnp.ExtensionHandler != nil { - objectMap["extensionHandler"] = dnp.ExtensionHandler - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNodeProperties struct. -func (dnp *DscNodeProperties) 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 "lastSeen": - if v != nil { - var lastSeen date.Time - err = json.Unmarshal(*v, &lastSeen) - if err != nil { - return err - } - dnp.LastSeen = &lastSeen - } - case "registrationTime": - if v != nil { - var registrationTime date.Time - err = json.Unmarshal(*v, ®istrationTime) - if err != nil { - return err - } - dnp.RegistrationTime = ®istrationTime - } - case "ip": - if v != nil { - var IP string - err = json.Unmarshal(*v, &IP) - if err != nil { - return err - } - dnp.IP = &IP - } - case "accountId": - if v != nil { - var accountID string - err = json.Unmarshal(*v, &accountID) - if err != nil { - return err - } - dnp.AccountID = &accountID - } - case "nodeConfiguration": - if v != nil { - var dscNodeConfigurationAssociationProperty DscNodeConfigurationAssociationProperty - err = json.Unmarshal(*v, &dscNodeConfigurationAssociationProperty) - if err != nil { - return err - } - dnp.DscNodeConfigurationAssociationProperty = &dscNodeConfigurationAssociationProperty - } - case "status": - if v != nil { - var status string - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - dnp.Status = &status - } - case "nodeId": - if v != nil { - var nodeID string - err = json.Unmarshal(*v, &nodeID) - if err != nil { - return err - } - dnp.NodeID = &nodeID - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dnp.Etag = &etag - } - case "totalCount": - if v != nil { - var totalCount int32 - err = json.Unmarshal(*v, &totalCount) - if err != nil { - return err - } - dnp.TotalCount = &totalCount - } - case "extensionHandler": - if v != nil { - var extensionHandler []DscNodeExtensionHandlerAssociationProperty - err = json.Unmarshal(*v, &extensionHandler) - if err != nil { - return err - } - dnp.ExtensionHandler = &extensionHandler - } - } - } - - return nil -} - -// DscNodeReport definition of the dsc node report type. -type DscNodeReport struct { - autorest.Response `json:"-"` - // EndTime - Gets or sets the end time of the node report. - EndTime *date.Time `json:"endTime,omitempty"` - // LastModifiedTime - Gets or sets the lastModifiedTime of the node report. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // StartTime - Gets or sets the start time of the node report. - StartTime *date.Time `json:"startTime,omitempty"` - // Type - Gets or sets the type of the node report. - Type *string `json:"type,omitempty"` - // ReportID - Gets or sets the id of the node report. - ReportID *string `json:"reportId,omitempty"` - // Status - Gets or sets the status of the node report. - Status *string `json:"status,omitempty"` - // RefreshMode - Gets or sets the refreshMode of the node report. - RefreshMode *string `json:"refreshMode,omitempty"` - // RebootRequested - Gets or sets the rebootRequested of the node report. - RebootRequested *string `json:"rebootRequested,omitempty"` - // ReportFormatVersion - Gets or sets the reportFormatVersion of the node report. - ReportFormatVersion *string `json:"reportFormatVersion,omitempty"` - // ConfigurationVersion - Gets or sets the configurationVersion of the node report. - ConfigurationVersion *string `json:"configurationVersion,omitempty"` - // ID - Gets or sets the id. - ID *string `json:"id,omitempty"` - // Errors - Gets or sets the errors for the node report. - Errors *[]DscReportError `json:"errors,omitempty"` - // Resources - Gets or sets the resource for the node report. - Resources *[]DscReportResource `json:"resources,omitempty"` - // MetaConfiguration - Gets or sets the metaConfiguration of the node at the time of the report. - MetaConfiguration *DscMetaConfiguration `json:"metaConfiguration,omitempty"` - // HostName - Gets or sets the hostname of the node that sent the report. - HostName *string `json:"hostName,omitempty"` - // IPV4Addresses - Gets or sets the IPv4 address of the node that sent the report. - IPV4Addresses *[]string `json:"iPV4Addresses,omitempty"` - // IPV6Addresses - Gets or sets the IPv6 address of the node that sent the report. - IPV6Addresses *[]string `json:"iPV6Addresses,omitempty"` - // NumberOfResources - Gets or sets the number of resource in the node report. - NumberOfResources *int32 `json:"numberOfResources,omitempty"` - // RawErrors - Gets or sets the unparsed errors for the node report. - RawErrors *string `json:"rawErrors,omitempty"` -} - -// DscNodeReportListResult the response model for the list dsc nodes operation. -type DscNodeReportListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of dsc node reports. - Value *[]DscNodeReport `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// DscNodeReportListResultIterator provides access to a complete listing of DscNodeReport values. -type DscNodeReportListResultIterator struct { - i int - page DscNodeReportListResultPage -} - -// 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 *DscNodeReportListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeReportListResultIterator.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 *DscNodeReportListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscNodeReportListResultIterator) 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 DscNodeReportListResultIterator) Response() DscNodeReportListResult { - 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 DscNodeReportListResultIterator) Value() DscNodeReport { - if !iter.page.NotDone() { - return DscNodeReport{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscNodeReportListResultIterator type. -func NewDscNodeReportListResultIterator(page DscNodeReportListResultPage) DscNodeReportListResultIterator { - return DscNodeReportListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dnrlr DscNodeReportListResult) IsEmpty() bool { - return dnrlr.Value == nil || len(*dnrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dnrlr DscNodeReportListResult) hasNextLink() bool { - return dnrlr.NextLink != nil && len(*dnrlr.NextLink) != 0 -} - -// dscNodeReportListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dnrlr DscNodeReportListResult) dscNodeReportListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dnrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dnrlr.NextLink))) -} - -// DscNodeReportListResultPage contains a page of DscNodeReport values. -type DscNodeReportListResultPage struct { - fn func(context.Context, DscNodeReportListResult) (DscNodeReportListResult, error) - dnrlr DscNodeReportListResult -} - -// 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 *DscNodeReportListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscNodeReportListResultPage.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.dnrlr) - if err != nil { - return err - } - page.dnrlr = 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 *DscNodeReportListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscNodeReportListResultPage) NotDone() bool { - return !page.dnrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscNodeReportListResultPage) Response() DscNodeReportListResult { - return page.dnrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscNodeReportListResultPage) Values() []DscNodeReport { - if page.dnrlr.IsEmpty() { - return nil - } - return *page.dnrlr.Value -} - -// Creates a new instance of the DscNodeReportListResultPage type. -func NewDscNodeReportListResultPage(cur DscNodeReportListResult, getNextPage func(context.Context, DscNodeReportListResult) (DscNodeReportListResult, error)) DscNodeReportListResultPage { - return DscNodeReportListResultPage{ - fn: getNextPage, - dnrlr: cur, - } -} - -// DscNodeUpdateParameters the parameters supplied to the update dsc node operation. -type DscNodeUpdateParameters struct { - // NodeID - Gets or sets the id of the dsc node. - NodeID *string `json:"nodeId,omitempty"` - Properties *DscNodeUpdateParametersProperties `json:"properties,omitempty"` -} - -// DscNodeUpdateParametersProperties ... -type DscNodeUpdateParametersProperties struct { - // DscNodeConfigurationAssociationProperty - Gets or sets the configuration of the node. - *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscNodeUpdateParametersProperties. -func (dnup DscNodeUpdateParametersProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dnup.DscNodeConfigurationAssociationProperty != nil { - objectMap["nodeConfiguration"] = dnup.DscNodeConfigurationAssociationProperty - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscNodeUpdateParametersProperties struct. -func (dnup *DscNodeUpdateParametersProperties) 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 "nodeConfiguration": - if v != nil { - var dscNodeConfigurationAssociationProperty DscNodeConfigurationAssociationProperty - err = json.Unmarshal(*v, &dscNodeConfigurationAssociationProperty) - if err != nil { - return err - } - dnup.DscNodeConfigurationAssociationProperty = &dscNodeConfigurationAssociationProperty - } - } - } - - return nil -} - -// DscReportError definition of the dsc node report error type. -type DscReportError struct { - // ErrorSource - Gets or sets the source of the error. - ErrorSource *string `json:"errorSource,omitempty"` - // ResourceID - Gets or sets the resource ID which generated the error. - ResourceID *string `json:"resourceId,omitempty"` - // ErrorCode - Gets or sets the error code. - ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Gets or sets the error message. - ErrorMessage *string `json:"errorMessage,omitempty"` - // Locale - Gets or sets the locale of the error. - Locale *string `json:"locale,omitempty"` - // ErrorDetails - Gets or sets the error details. - ErrorDetails *string `json:"errorDetails,omitempty"` -} - -// DscReportResource definition of the DSC Report Resource. -type DscReportResource struct { - // ResourceID - Gets or sets the ID of the resource. - ResourceID *string `json:"resourceId,omitempty"` - // SourceInfo - Gets or sets the source info of the resource. - SourceInfo *string `json:"sourceInfo,omitempty"` - // DependsOn - Gets or sets the Resource Navigation values for resources the resource depends on. - DependsOn *[]DscReportResourceNavigation `json:"dependsOn,omitempty"` - // ModuleName - Gets or sets the module name of the resource. - ModuleName *string `json:"moduleName,omitempty"` - // ModuleVersion - Gets or sets the module version of the resource. - ModuleVersion *string `json:"moduleVersion,omitempty"` - // ResourceName - Gets or sets the name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // Error - Gets or sets the error of the resource. - Error *string `json:"error,omitempty"` - // Status - Gets or sets the status of the resource. - Status *string `json:"status,omitempty"` - // DurationInSeconds - Gets or sets the duration in seconds for the resource. - DurationInSeconds *float64 `json:"durationInSeconds,omitempty"` - // StartDate - Gets or sets the start date of the resource. - StartDate *date.Time `json:"startDate,omitempty"` -} - -// DscReportResourceNavigation navigation for DSC Report Resource. -type DscReportResourceNavigation struct { - // ResourceID - Gets or sets the ID of the resource to navigate to. - ResourceID *string `json:"resourceId,omitempty"` -} - -// ErrorResponse error response of an operation failure -type ErrorResponse struct { - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// FieldDefinition definition of the connection fields. -type FieldDefinition struct { - // IsEncrypted - Gets or sets the isEncrypted flag of the connection field definition. - IsEncrypted *bool `json:"isEncrypted,omitempty"` - // IsOptional - Gets or sets the isOptional flag of the connection field definition. - IsOptional *bool `json:"isOptional,omitempty"` - // Type - Gets or sets the type of the connection field definition. - Type *string `json:"type,omitempty"` -} - -// HybridRunbookWorker definition of hybrid runbook worker. -type HybridRunbookWorker struct { - // Name - Gets or sets the worker machine name. - Name *string `json:"name,omitempty"` - // IP - Gets or sets the assigned machine IP address. - IP *string `json:"ip,omitempty"` - // RegistrationTime - Gets or sets the registration time of the worker machine. - RegistrationTime *date.Time `json:"registrationTime,omitempty"` - // LastSeenDateTime - Last Heartbeat from the Worker - LastSeenDateTime *date.Time `json:"lastSeenDateTime,omitempty"` -} - -// HybridRunbookWorkerGroup definition of hybrid runbook worker group. -type HybridRunbookWorkerGroup struct { - autorest.Response `json:"-"` - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - Gets or sets the name of the group. - Name *string `json:"name,omitempty"` - // HybridRunbookWorkers - Gets or sets the list of hybrid runbook workers. - HybridRunbookWorkers *[]HybridRunbookWorker `json:"hybridRunbookWorkers,omitempty"` - // Credential - Sets the credential of a worker group. - Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` - // GroupType - Type of the HybridWorkerGroup. Possible values include: 'User', 'System' - GroupType GroupTypeEnum `json:"groupType,omitempty"` -} - -// HybridRunbookWorkerGroupsListResult the response model for the list hybrid runbook worker groups. -type HybridRunbookWorkerGroupsListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of hybrid runbook worker groups. - Value *[]HybridRunbookWorkerGroup `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// HybridRunbookWorkerGroupsListResultIterator provides access to a complete listing of -// HybridRunbookWorkerGroup values. -type HybridRunbookWorkerGroupsListResultIterator struct { - i int - page HybridRunbookWorkerGroupsListResultPage -} - -// 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 *HybridRunbookWorkerGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupsListResultIterator.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 *HybridRunbookWorkerGroupsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter HybridRunbookWorkerGroupsListResultIterator) 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 HybridRunbookWorkerGroupsListResultIterator) Response() HybridRunbookWorkerGroupsListResult { - 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 HybridRunbookWorkerGroupsListResultIterator) Value() HybridRunbookWorkerGroup { - if !iter.page.NotDone() { - return HybridRunbookWorkerGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the HybridRunbookWorkerGroupsListResultIterator type. -func NewHybridRunbookWorkerGroupsListResultIterator(page HybridRunbookWorkerGroupsListResultPage) HybridRunbookWorkerGroupsListResultIterator { - return HybridRunbookWorkerGroupsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (hrwglr HybridRunbookWorkerGroupsListResult) IsEmpty() bool { - return hrwglr.Value == nil || len(*hrwglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (hrwglr HybridRunbookWorkerGroupsListResult) hasNextLink() bool { - return hrwglr.NextLink != nil && len(*hrwglr.NextLink) != 0 -} - -// hybridRunbookWorkerGroupsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (hrwglr HybridRunbookWorkerGroupsListResult) hybridRunbookWorkerGroupsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !hrwglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(hrwglr.NextLink))) -} - -// HybridRunbookWorkerGroupsListResultPage contains a page of HybridRunbookWorkerGroup values. -type HybridRunbookWorkerGroupsListResultPage struct { - fn func(context.Context, HybridRunbookWorkerGroupsListResult) (HybridRunbookWorkerGroupsListResult, error) - hrwglr HybridRunbookWorkerGroupsListResult -} - -// 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 *HybridRunbookWorkerGroupsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HybridRunbookWorkerGroupsListResultPage.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.hrwglr) - if err != nil { - return err - } - page.hrwglr = 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 *HybridRunbookWorkerGroupsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page HybridRunbookWorkerGroupsListResultPage) NotDone() bool { - return !page.hrwglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page HybridRunbookWorkerGroupsListResultPage) Response() HybridRunbookWorkerGroupsListResult { - return page.hrwglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page HybridRunbookWorkerGroupsListResultPage) Values() []HybridRunbookWorkerGroup { - if page.hrwglr.IsEmpty() { - return nil - } - return *page.hrwglr.Value -} - -// Creates a new instance of the HybridRunbookWorkerGroupsListResultPage type. -func NewHybridRunbookWorkerGroupsListResultPage(cur HybridRunbookWorkerGroupsListResult, getNextPage func(context.Context, HybridRunbookWorkerGroupsListResult) (HybridRunbookWorkerGroupsListResult, error)) HybridRunbookWorkerGroupsListResultPage { - return HybridRunbookWorkerGroupsListResultPage{ - fn: getNextPage, - hrwglr: cur, - } -} - -// HybridRunbookWorkerGroupUpdateParameters parameters supplied to the update operation. -type HybridRunbookWorkerGroupUpdateParameters struct { - // Credential - Sets the credential of a worker group. - Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` -} - -// Job definition of the job. -type Job struct { - autorest.Response `json:"-"` - // JobProperties - The properties of the job. - *JobProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Job. -func (j Job) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if j.JobProperties != nil { - objectMap["properties"] = j.JobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Job struct. -func (j *Job) 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 jobProperties JobProperties - err = json.Unmarshal(*v, &jobProperties) - if err != nil { - return err - } - j.JobProperties = &jobProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - j.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - j.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - j.Type = &typeVar - } - } - } - - return nil -} - -// JobCollectionItem job collection item properties. -type JobCollectionItem struct { - // JobCollectionItemProperties - Job properties. - *JobCollectionItemProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for JobCollectionItem. -func (jci JobCollectionItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jci.JobCollectionItemProperties != nil { - objectMap["properties"] = jci.JobCollectionItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobCollectionItem struct. -func (jci *JobCollectionItem) 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 jobCollectionItemProperties JobCollectionItemProperties - err = json.Unmarshal(*v, &jobCollectionItemProperties) - if err != nil { - return err - } - jci.JobCollectionItemProperties = &jobCollectionItemProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - jci.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - jci.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - jci.Type = &typeVar - } - } - } - - return nil -} - -// JobCollectionItemProperties job collection item properties. -type JobCollectionItemProperties struct { - // Runbook - READ-ONLY; The runbook association. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // JobID - READ-ONLY; The id of the job. - JobID *uuid.UUID `json:"jobId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Status - READ-ONLY; The status of the job. Possible values include: 'JobStatusNew', 'JobStatusActivating', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusStopped', 'JobStatusBlocked', 'JobStatusSuspended', 'JobStatusDisconnected', 'JobStatusSuspending', 'JobStatusStopping', 'JobStatusResuming', 'JobStatusRemoving' - Status JobStatus `json:"status,omitempty"` - // StartTime - READ-ONLY; The start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // LastModifiedTime - READ-ONLY; The last modified time of the job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of a resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // RunOn - Specifies the runOn group name where the job was executed. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCollectionItemProperties. -func (jcip JobCollectionItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jcip.RunOn != nil { - objectMap["runOn"] = jcip.RunOn - } - return json.Marshal(objectMap) -} - -// JobCreateParameters the parameters supplied to the create job operation. -type JobCreateParameters struct { - // JobCreateProperties - Gets or sets the list of job properties. - *JobCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCreateParameters. -func (jcp JobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jcp.JobCreateProperties != nil { - objectMap["properties"] = jcp.JobCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobCreateParameters struct. -func (jcp *JobCreateParameters) 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 jobCreateProperties JobCreateProperties - err = json.Unmarshal(*v, &jobCreateProperties) - if err != nil { - return err - } - jcp.JobCreateProperties = &jobCreateProperties - } - } - } - - return nil -} - -// JobCreateProperties ... -type JobCreateProperties struct { - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCreateProperties. -func (jcp JobCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jcp.Runbook != nil { - objectMap["runbook"] = jcp.Runbook - } - if jcp.Parameters != nil { - objectMap["parameters"] = jcp.Parameters - } - if jcp.RunOn != nil { - objectMap["runOn"] = jcp.RunOn - } - return json.Marshal(objectMap) -} - -// JobListResultV2 the response model for the list job operation. -type JobListResultV2 struct { - autorest.Response `json:"-"` - // Value - List of jobs. - Value *[]JobCollectionItem `json:"value,omitempty"` - // NextLink - READ-ONLY; The link to the next page. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobListResultV2. -func (jlrv JobListResultV2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jlrv.Value != nil { - objectMap["value"] = jlrv.Value - } - return json.Marshal(objectMap) -} - -// JobListResultV2Iterator provides access to a complete listing of JobCollectionItem values. -type JobListResultV2Iterator struct { - i int - page JobListResultV2Page -} - -// 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 *JobListResultV2Iterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultV2Iterator.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 *JobListResultV2Iterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobListResultV2Iterator) 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 JobListResultV2Iterator) Response() JobListResultV2 { - 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 JobListResultV2Iterator) Value() JobCollectionItem { - if !iter.page.NotDone() { - return JobCollectionItem{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobListResultV2Iterator type. -func NewJobListResultV2Iterator(page JobListResultV2Page) JobListResultV2Iterator { - return JobListResultV2Iterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jlrv JobListResultV2) IsEmpty() bool { - return jlrv.Value == nil || len(*jlrv.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jlrv JobListResultV2) hasNextLink() bool { - return jlrv.NextLink != nil && len(*jlrv.NextLink) != 0 -} - -// jobListResultV2Preparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jlrv JobListResultV2) jobListResultV2Preparer(ctx context.Context) (*http.Request, error) { - if !jlrv.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jlrv.NextLink))) -} - -// JobListResultV2Page contains a page of JobCollectionItem values. -type JobListResultV2Page struct { - fn func(context.Context, JobListResultV2) (JobListResultV2, error) - jlrv JobListResultV2 -} - -// 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 *JobListResultV2Page) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultV2Page.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.jlrv) - if err != nil { - return err - } - page.jlrv = 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 *JobListResultV2Page) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobListResultV2Page) NotDone() bool { - return !page.jlrv.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobListResultV2Page) Response() JobListResultV2 { - return page.jlrv -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobListResultV2Page) Values() []JobCollectionItem { - if page.jlrv.IsEmpty() { - return nil - } - return *page.jlrv.Value -} - -// Creates a new instance of the JobListResultV2Page type. -func NewJobListResultV2Page(cur JobListResultV2, getNextPage func(context.Context, JobListResultV2) (JobListResultV2, error)) JobListResultV2Page { - return JobListResultV2Page{ - fn: getNextPage, - jlrv: cur, - } -} - -// JobNavigation software update configuration machine run job navigation properties. -type JobNavigation struct { - // ID - READ-ONLY; Id of the job associated with the software update configuration run - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobNavigation. -func (jn JobNavigation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobProperties definition of job properties. -type JobProperties struct { - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // StartedBy - Gets or sets the job started by. - StartedBy *string `json:"startedBy,omitempty"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` - // JobID - Gets or sets the id of the job. - JobID *uuid.UUID `json:"jobId,omitempty"` - // CreationTime - Gets or sets the creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Status - Gets or sets the status of the job. Possible values include: 'JobStatusNew', 'JobStatusActivating', 'JobStatusRunning', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusStopped', 'JobStatusBlocked', 'JobStatusSuspended', 'JobStatusDisconnected', 'JobStatusSuspending', 'JobStatusStopping', 'JobStatusResuming', 'JobStatusRemoving' - Status JobStatus `json:"status,omitempty"` - // StatusDetails - Gets or sets the status details of the job. - StatusDetails *string `json:"statusDetails,omitempty"` - // StartTime - Gets or sets the start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Gets or sets the end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // Exception - Gets or sets the exception of the job. - Exception *string `json:"exception,omitempty"` - // LastModifiedTime - Gets or sets the last modified time of the job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastStatusModifiedTime - Gets or sets the last status modified time of the job. - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // ProvisioningState - The current provisioning state of the job. Possible values include: 'JobProvisioningStateFailed', 'JobProvisioningStateSucceeded', 'JobProvisioningStateSuspended', 'JobProvisioningStateProcessing' - ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobProperties. -func (jp JobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jp.Runbook != nil { - objectMap["runbook"] = jp.Runbook - } - if jp.StartedBy != nil { - objectMap["startedBy"] = jp.StartedBy - } - if jp.RunOn != nil { - objectMap["runOn"] = jp.RunOn - } - if jp.JobID != nil { - objectMap["jobId"] = jp.JobID - } - if jp.CreationTime != nil { - objectMap["creationTime"] = jp.CreationTime - } - if jp.Status != "" { - objectMap["status"] = jp.Status - } - if jp.StatusDetails != nil { - objectMap["statusDetails"] = jp.StatusDetails - } - if jp.StartTime != nil { - objectMap["startTime"] = jp.StartTime - } - if jp.EndTime != nil { - objectMap["endTime"] = jp.EndTime - } - if jp.Exception != nil { - objectMap["exception"] = jp.Exception - } - if jp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = jp.LastModifiedTime - } - if jp.LastStatusModifiedTime != nil { - objectMap["lastStatusModifiedTime"] = jp.LastStatusModifiedTime - } - if jp.Parameters != nil { - objectMap["parameters"] = jp.Parameters - } - if jp.ProvisioningState != "" { - objectMap["provisioningState"] = jp.ProvisioningState - } - return json.Marshal(objectMap) -} - -// JobSchedule definition of the job schedule. -type JobSchedule struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Gets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the name of the variable. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // JobScheduleProperties - Gets or sets the properties of the job schedule. - *JobScheduleProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobSchedule. -func (js JobSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if js.JobScheduleProperties != nil { - objectMap["properties"] = js.JobScheduleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobSchedule struct. -func (js *JobSchedule) 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 - } - js.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - js.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - js.Type = &typeVar - } - case "properties": - if v != nil { - var jobScheduleProperties JobScheduleProperties - err = json.Unmarshal(*v, &jobScheduleProperties) - if err != nil { - return err - } - js.JobScheduleProperties = &jobScheduleProperties - } - } - } - - return nil -} - -// JobScheduleCreateParameters the parameters supplied to the create job schedule operation. -type JobScheduleCreateParameters struct { - // JobScheduleCreateProperties - Gets or sets the list of job schedule properties. - *JobScheduleCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobScheduleCreateParameters. -func (jscp JobScheduleCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jscp.JobScheduleCreateProperties != nil { - objectMap["properties"] = jscp.JobScheduleCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobScheduleCreateParameters struct. -func (jscp *JobScheduleCreateParameters) 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 jobScheduleCreateProperties JobScheduleCreateProperties - err = json.Unmarshal(*v, &jobScheduleCreateProperties) - if err != nil { - return err - } - jscp.JobScheduleCreateProperties = &jobScheduleCreateProperties - } - } - } - - return nil -} - -// JobScheduleCreateProperties the parameters supplied to the create job schedule operation. -type JobScheduleCreateProperties struct { - // Schedule - Gets or sets the schedule. - Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the hybrid worker group that the scheduled job should run on. - RunOn *string `json:"runOn,omitempty"` - // Parameters - Gets or sets a list of job properties. - Parameters map[string]*string `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for JobScheduleCreateProperties. -func (jscp JobScheduleCreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jscp.Schedule != nil { - objectMap["schedule"] = jscp.Schedule - } - if jscp.Runbook != nil { - objectMap["runbook"] = jscp.Runbook - } - if jscp.RunOn != nil { - objectMap["runOn"] = jscp.RunOn - } - if jscp.Parameters != nil { - objectMap["parameters"] = jscp.Parameters - } - return json.Marshal(objectMap) -} - -// JobScheduleListResult the response model for the list job schedule operation. -type JobScheduleListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of job schedules. - Value *[]JobSchedule `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// JobScheduleListResultIterator provides access to a complete listing of JobSchedule values. -type JobScheduleListResultIterator struct { - i int - page JobScheduleListResultPage -} - -// 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 *JobScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleListResultIterator.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 *JobScheduleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobScheduleListResultIterator) 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 JobScheduleListResultIterator) Response() JobScheduleListResult { - 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 JobScheduleListResultIterator) Value() JobSchedule { - if !iter.page.NotDone() { - return JobSchedule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobScheduleListResultIterator type. -func NewJobScheduleListResultIterator(page JobScheduleListResultPage) JobScheduleListResultIterator { - return JobScheduleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jslr JobScheduleListResult) IsEmpty() bool { - return jslr.Value == nil || len(*jslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jslr JobScheduleListResult) hasNextLink() bool { - return jslr.NextLink != nil && len(*jslr.NextLink) != 0 -} - -// jobScheduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jslr JobScheduleListResult) jobScheduleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jslr.NextLink))) -} - -// JobScheduleListResultPage contains a page of JobSchedule values. -type JobScheduleListResultPage struct { - fn func(context.Context, JobScheduleListResult) (JobScheduleListResult, error) - jslr JobScheduleListResult -} - -// 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 *JobScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleListResultPage.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.jslr) - if err != nil { - return err - } - page.jslr = 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 *JobScheduleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobScheduleListResultPage) NotDone() bool { - return !page.jslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobScheduleListResultPage) Response() JobScheduleListResult { - return page.jslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobScheduleListResultPage) Values() []JobSchedule { - if page.jslr.IsEmpty() { - return nil - } - return *page.jslr.Value -} - -// Creates a new instance of the JobScheduleListResultPage type. -func NewJobScheduleListResultPage(cur JobScheduleListResult, getNextPage func(context.Context, JobScheduleListResult) (JobScheduleListResult, error)) JobScheduleListResultPage { - return JobScheduleListResultPage{ - fn: getNextPage, - jslr: cur, - } -} - -// JobScheduleProperties definition of job schedule parameters. -type JobScheduleProperties struct { - // JobScheduleID - Gets or sets the id of job schedule. - JobScheduleID *string `json:"jobScheduleId,omitempty"` - // Schedule - Gets or sets the schedule. - Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the hybrid worker group that the scheduled job should run on. - RunOn *string `json:"runOn,omitempty"` - // Parameters - Gets or sets the parameters of the job schedule. - Parameters map[string]*string `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for JobScheduleProperties. -func (jsp JobScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jsp.JobScheduleID != nil { - objectMap["jobScheduleId"] = jsp.JobScheduleID - } - if jsp.Schedule != nil { - objectMap["schedule"] = jsp.Schedule - } - if jsp.Runbook != nil { - objectMap["runbook"] = jsp.Runbook - } - if jsp.RunOn != nil { - objectMap["runOn"] = jsp.RunOn - } - if jsp.Parameters != nil { - objectMap["parameters"] = jsp.Parameters - } - return json.Marshal(objectMap) -} - -// JobStream definition of the job stream. -type JobStream struct { - autorest.Response `json:"-"` - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // JobStreamProperties - Gets or sets the id of the job stream. - *JobStreamProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobStream. -func (js JobStream) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if js.ID != nil { - objectMap["id"] = js.ID - } - if js.JobStreamProperties != nil { - objectMap["properties"] = js.JobStreamProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobStream struct. -func (js *JobStream) 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 - } - js.ID = &ID - } - case "properties": - if v != nil { - var jobStreamProperties JobStreamProperties - err = json.Unmarshal(*v, &jobStreamProperties) - if err != nil { - return err - } - js.JobStreamProperties = &jobStreamProperties - } - } - } - - return nil -} - -// JobStreamListResult the response model for the list job stream operation. -type JobStreamListResult struct { - autorest.Response `json:"-"` - // Value - A list of job streams. - Value *[]JobStream `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// JobStreamListResultIterator provides access to a complete listing of JobStream values. -type JobStreamListResultIterator struct { - i int - page JobStreamListResultPage -} - -// 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 *JobStreamListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamListResultIterator.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 *JobStreamListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobStreamListResultIterator) 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 JobStreamListResultIterator) Response() JobStreamListResult { - 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 JobStreamListResultIterator) Value() JobStream { - if !iter.page.NotDone() { - return JobStream{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobStreamListResultIterator type. -func NewJobStreamListResultIterator(page JobStreamListResultPage) JobStreamListResultIterator { - return JobStreamListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jslr JobStreamListResult) IsEmpty() bool { - return jslr.Value == nil || len(*jslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jslr JobStreamListResult) hasNextLink() bool { - return jslr.NextLink != nil && len(*jslr.NextLink) != 0 -} - -// jobStreamListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jslr JobStreamListResult) jobStreamListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jslr.NextLink))) -} - -// JobStreamListResultPage contains a page of JobStream values. -type JobStreamListResultPage struct { - fn func(context.Context, JobStreamListResult) (JobStreamListResult, error) - jslr JobStreamListResult -} - -// 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 *JobStreamListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStreamListResultPage.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.jslr) - if err != nil { - return err - } - page.jslr = 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 *JobStreamListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobStreamListResultPage) NotDone() bool { - return !page.jslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobStreamListResultPage) Response() JobStreamListResult { - return page.jslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobStreamListResultPage) Values() []JobStream { - if page.jslr.IsEmpty() { - return nil - } - return *page.jslr.Value -} - -// Creates a new instance of the JobStreamListResultPage type. -func NewJobStreamListResultPage(cur JobStreamListResult, getNextPage func(context.Context, JobStreamListResult) (JobStreamListResult, error)) JobStreamListResultPage { - return JobStreamListResultPage{ - fn: getNextPage, - jslr: cur, - } -} - -// JobStreamProperties definition of the job stream. -type JobStreamProperties struct { - // JobStreamID - Gets or sets the id of the job stream. - JobStreamID *string `json:"jobStreamId,omitempty"` - // Time - Gets or sets the creation time of the job. - Time *date.Time `json:"time,omitempty"` - // StreamType - Gets or sets the stream type. Possible values include: 'Progress', 'Output', 'Warning', 'Error', 'Debug', 'Verbose', 'Any' - StreamType JobStreamType `json:"streamType,omitempty"` - // StreamText - Gets or sets the stream text. - StreamText *string `json:"streamText,omitempty"` - // Summary - Gets or sets the summary. - Summary *string `json:"summary,omitempty"` - // Value - Gets or sets the values of the job stream. - Value map[string]interface{} `json:"value"` -} - -// MarshalJSON is the custom marshaler for JobStreamProperties. -func (jsp JobStreamProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jsp.JobStreamID != nil { - objectMap["jobStreamId"] = jsp.JobStreamID - } - if jsp.Time != nil { - objectMap["time"] = jsp.Time - } - if jsp.StreamType != "" { - objectMap["streamType"] = jsp.StreamType - } - if jsp.StreamText != nil { - objectMap["streamText"] = jsp.StreamText - } - if jsp.Summary != nil { - objectMap["summary"] = jsp.Summary - } - if jsp.Value != nil { - objectMap["value"] = jsp.Value - } - return json.Marshal(objectMap) -} - -// Key automation key which is used to register a DSC Node -type Key struct { - // KeyName - READ-ONLY; Automation key name. Possible values include: 'KeyNamePrimary', 'KeyNameSecondary' - KeyName KeyName `json:"KeyName,omitempty"` - // Permissions - READ-ONLY; Automation key permissions. Possible values include: 'Read', 'Full' - Permissions KeyPermissions `json:"Permissions,omitempty"` - // Value - READ-ONLY; Value of the Automation Key used for registration. - Value *string `json:"Value,omitempty"` -} - -// MarshalJSON is the custom marshaler for Key. -func (kVar Key) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// KeyListResult ... -type KeyListResult struct { - autorest.Response `json:"-"` - // Keys - Lists the automation keys. - Keys *[]Key `json:"keys,omitempty"` -} - -// LinkedWorkspace definition of the linked workspace. -type LinkedWorkspace struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Gets the id of the linked workspace. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedWorkspace. -func (lw LinkedWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LinuxProperties linux specific update configuration. -type LinuxProperties struct { - // IncludedPackageClassifications - Update classifications included in the software update configuration. Possible values include: 'Unclassified', 'Critical', 'Security', 'Other' - IncludedPackageClassifications LinuxUpdateClasses `json:"includedPackageClassifications,omitempty"` - // ExcludedPackageNameMasks - packages excluded from the software update configuration. - ExcludedPackageNameMasks *[]string `json:"excludedPackageNameMasks,omitempty"` - // IncludedPackageNameMasks - packages included from the software update configuration. - IncludedPackageNameMasks *[]string `json:"includedPackageNameMasks,omitempty"` - // RebootSetting - Reboot setting for the software update configuration. - RebootSetting *string `json:"rebootSetting,omitempty"` -} - -// Module definition of the module type. -type Module struct { - autorest.Response `json:"-"` - // ModuleProperties - Gets or sets the module properties. - *ModuleProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Module. -func (mVar Module) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.ModuleProperties != nil { - objectMap["properties"] = mVar.ModuleProperties - } - if mVar.Etag != nil { - objectMap["etag"] = mVar.Etag - } - if mVar.Tags != nil { - objectMap["tags"] = mVar.Tags - } - if mVar.Location != nil { - objectMap["location"] = mVar.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Module struct. -func (mVar *Module) 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 moduleProperties ModuleProperties - err = json.Unmarshal(*v, &moduleProperties) - if err != nil { - return err - } - mVar.ModuleProperties = &moduleProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - mVar.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mVar.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mVar.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mVar.Type = &typeVar - } - } - } - - return nil -} - -// ModuleCreateOrUpdateParameters the parameters supplied to the create or update module operation. -type ModuleCreateOrUpdateParameters struct { - // ModuleCreateOrUpdateProperties - Gets or sets the module create properties. - *ModuleCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ModuleCreateOrUpdateParameters. -func (mcoup ModuleCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcoup.ModuleCreateOrUpdateProperties != nil { - objectMap["properties"] = mcoup.ModuleCreateOrUpdateProperties - } - if mcoup.Name != nil { - objectMap["name"] = mcoup.Name - } - if mcoup.Location != nil { - objectMap["location"] = mcoup.Location - } - if mcoup.Tags != nil { - objectMap["tags"] = mcoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ModuleCreateOrUpdateParameters struct. -func (mcoup *ModuleCreateOrUpdateParameters) 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 moduleCreateOrUpdateProperties ModuleCreateOrUpdateProperties - err = json.Unmarshal(*v, &moduleCreateOrUpdateProperties) - if err != nil { - return err - } - mcoup.ModuleCreateOrUpdateProperties = &moduleCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mcoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mcoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mcoup.Tags = tags - } - } - } - - return nil -} - -// ModuleCreateOrUpdateProperties the parameters supplied to the create or update module properties. -type ModuleCreateOrUpdateProperties struct { - // ContentLink - Gets or sets the module content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// ModuleErrorInfo definition of the module error info type. -type ModuleErrorInfo struct { - // Code - Gets or sets the error code. - Code *string `json:"code,omitempty"` - // Message - Gets or sets the error message. - Message *string `json:"message,omitempty"` -} - -// ModuleListResult the response model for the list module operation. -type ModuleListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of modules. - Value *[]Module `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ModuleListResultIterator provides access to a complete listing of Module values. -type ModuleListResultIterator struct { - i int - page ModuleListResultPage -} - -// 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 *ModuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleListResultIterator.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 *ModuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ModuleListResultIterator) 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 ModuleListResultIterator) Response() ModuleListResult { - 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 ModuleListResultIterator) Value() Module { - if !iter.page.NotDone() { - return Module{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ModuleListResultIterator type. -func NewModuleListResultIterator(page ModuleListResultPage) ModuleListResultIterator { - return ModuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mlr ModuleListResult) IsEmpty() bool { - return mlr.Value == nil || len(*mlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mlr ModuleListResult) hasNextLink() bool { - return mlr.NextLink != nil && len(*mlr.NextLink) != 0 -} - -// moduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mlr ModuleListResult) moduleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mlr.NextLink))) -} - -// ModuleListResultPage contains a page of Module values. -type ModuleListResultPage struct { - fn func(context.Context, ModuleListResult) (ModuleListResult, error) - mlr ModuleListResult -} - -// 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 *ModuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleListResultPage.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.mlr) - if err != nil { - return err - } - page.mlr = 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 *ModuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ModuleListResultPage) NotDone() bool { - return !page.mlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ModuleListResultPage) Response() ModuleListResult { - return page.mlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ModuleListResultPage) Values() []Module { - if page.mlr.IsEmpty() { - return nil - } - return *page.mlr.Value -} - -// Creates a new instance of the ModuleListResultPage type. -func NewModuleListResultPage(cur ModuleListResult, getNextPage func(context.Context, ModuleListResult) (ModuleListResult, error)) ModuleListResultPage { - return ModuleListResultPage{ - fn: getNextPage, - mlr: cur, - } -} - -// ModuleProperties definition of the module property type. -type ModuleProperties struct { - // IsGlobal - Gets or sets the isGlobal flag of the module. - IsGlobal *bool `json:"isGlobal,omitempty"` - // Version - Gets or sets the version of the module. - Version *string `json:"version,omitempty"` - // SizeInBytes - Gets or sets the size in bytes of the module. - SizeInBytes *int64 `json:"sizeInBytes,omitempty"` - // ActivityCount - Gets or sets the activity count of the module. - ActivityCount *int32 `json:"activityCount,omitempty"` - // ProvisioningState - Gets or sets the provisioning state of the module. Possible values include: 'ModuleProvisioningStateCreated', 'ModuleProvisioningStateCreating', 'ModuleProvisioningStateStartingImportModuleRunbook', 'ModuleProvisioningStateRunningImportModuleRunbook', 'ModuleProvisioningStateContentRetrieved', 'ModuleProvisioningStateContentDownloaded', 'ModuleProvisioningStateContentValidated', 'ModuleProvisioningStateConnectionTypeImported', 'ModuleProvisioningStateContentStored', 'ModuleProvisioningStateModuleDataStored', 'ModuleProvisioningStateActivitiesStored', 'ModuleProvisioningStateModuleImportRunbookComplete', 'ModuleProvisioningStateSucceeded', 'ModuleProvisioningStateFailed', 'ModuleProvisioningStateCancelled', 'ModuleProvisioningStateUpdating' - ProvisioningState ModuleProvisioningState `json:"provisioningState,omitempty"` - // ContentLink - Gets or sets the contentLink of the module. - ContentLink *ContentLink `json:"contentLink,omitempty"` - // Error - Gets or sets the error info of the module. - Error *ModuleErrorInfo `json:"error,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` - // IsComposite - Gets or sets type of module, if its composite or not. - IsComposite *bool `json:"isComposite,omitempty"` -} - -// ModuleUpdateParameters the parameters supplied to the update module operation. -type ModuleUpdateParameters struct { - // ModuleUpdateProperties - Gets or sets the module update properties. - *ModuleUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ModuleUpdateParameters. -func (mup ModuleUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mup.ModuleUpdateProperties != nil { - objectMap["properties"] = mup.ModuleUpdateProperties - } - if mup.Name != nil { - objectMap["name"] = mup.Name - } - if mup.Location != nil { - objectMap["location"] = mup.Location - } - if mup.Tags != nil { - objectMap["tags"] = mup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ModuleUpdateParameters struct. -func (mup *ModuleUpdateParameters) 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 moduleUpdateProperties ModuleUpdateProperties - err = json.Unmarshal(*v, &moduleUpdateProperties) - if err != nil { - return err - } - mup.ModuleUpdateProperties = &moduleUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mup.Tags = tags - } - } - } - - return nil -} - -// ModuleUpdateProperties the parameters supplied to the update properties. -type ModuleUpdateProperties struct { - // ContentLink - Gets or sets the module content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// NodeCount number of nodes based on the Filter -type NodeCount struct { - // Name - Gets the name of a count type - Name *string `json:"name,omitempty"` - Properties *NodeCountProperties `json:"properties,omitempty"` -} - -// NodeCountProperties ... -type NodeCountProperties struct { - // Count - Gets the count for the name - Count *int32 `json:"count,omitempty"` -} - -// NodeCounts gets the count of nodes by count type -type NodeCounts struct { - autorest.Response `json:"-"` - // Value - Gets an array of counts - Value *[]NodeCount `json:"value,omitempty"` - // TotalCount - Gets the total number of records matching countType criteria. - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// NonAzureQueryProperties non Azure query for the update configuration. -type NonAzureQueryProperties struct { - // FunctionAlias - Log Analytics Saved Search name. - FunctionAlias *string `json:"functionAlias,omitempty"` - // WorkspaceID - Workspace Id for Log Analytics in which the saved Search is resided. - WorkspaceID *string `json:"workspaceId,omitempty"` -} - -// Operation automation REST API operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Provider, Resource and Operation values - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay provider, Resource and Operation values -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Automation - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Runbooks, Jobs etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult the response model for the list of Automation operations -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Automation operations supported by the Automation resource provider. - Value *[]Operation `json:"value,omitempty"` -} - -// ProxyResource ARM proxy resource. -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PythonPackageCreateParameters the parameters supplied to the create or update module operation. -type PythonPackageCreateParameters struct { - // PythonPackageCreateProperties - Gets or sets the module create properties. - *PythonPackageCreateProperties `json:"properties,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PythonPackageCreateParameters. -func (ppcp PythonPackageCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ppcp.PythonPackageCreateProperties != nil { - objectMap["properties"] = ppcp.PythonPackageCreateProperties - } - if ppcp.Tags != nil { - objectMap["tags"] = ppcp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PythonPackageCreateParameters struct. -func (ppcp *PythonPackageCreateParameters) 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 pythonPackageCreateProperties PythonPackageCreateProperties - err = json.Unmarshal(*v, &pythonPackageCreateProperties) - if err != nil { - return err - } - ppcp.PythonPackageCreateProperties = &pythonPackageCreateProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ppcp.Tags = tags - } - } - } - - return nil -} - -// PythonPackageCreateProperties the parameters supplied to the create or update module properties. -type PythonPackageCreateProperties struct { - // ContentLink - Gets or sets the module content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// PythonPackageUpdateParameters the parameters supplied to the update module operation. -type PythonPackageUpdateParameters struct { - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PythonPackageUpdateParameters. -func (ppup PythonPackageUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ppup.Tags != nil { - objectMap["tags"] = ppup.Tags - } - return json.Marshal(objectMap) -} - -// ReadCloser ... -type ReadCloser struct { - autorest.Response `json:"-"` - Value *io.ReadCloser `json:"value,omitempty"` -} - -// Resource the core properties of ARM resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RunAsCredentialAssociationProperty definition of RunAs credential to use for hybrid worker. -type RunAsCredentialAssociationProperty struct { - // Name - Gets or sets the name of the credential. - Name *string `json:"name,omitempty"` -} - -// Runbook definition of the runbook type. -type Runbook struct { - autorest.Response `json:"-"` - // RunbookProperties - Gets or sets the runbook properties. - *RunbookProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Runbook. -func (r Runbook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RunbookProperties != nil { - objectMap["properties"] = r.RunbookProperties - } - if r.Etag != nil { - objectMap["etag"] = r.Etag - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.Location != nil { - objectMap["location"] = r.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Runbook struct. -func (r *Runbook) 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 runbookProperties RunbookProperties - err = json.Unmarshal(*v, &runbookProperties) - if err != nil { - return err - } - r.RunbookProperties = &runbookProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - r.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - 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 - } - } - } - - return nil -} - -// RunbookAssociationProperty the runbook property associated with the entity. -type RunbookAssociationProperty struct { - // Name - Gets or sets the name of the runbook. - Name *string `json:"name,omitempty"` -} - -// RunbookCreateOrUpdateDraftParameters the parameters supplied to the create or update runbook operation. -type RunbookCreateOrUpdateDraftParameters struct { - // RunbookContent - Content of the Runbook. - RunbookContent *string `json:"runbookContent,omitempty"` -} - -// RunbookCreateOrUpdateDraftProperties the parameters supplied to the create or update draft runbook -// properties. -type RunbookCreateOrUpdateDraftProperties struct { - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // RunbookType - Gets or sets the type of the runbook. Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - // Draft - Gets or sets the draft runbook properties. - Draft *RunbookDraft `json:"draft,omitempty"` - // Description - Gets or sets the description of the runbook. - Description *string `json:"description,omitempty"` - // LogActivityTrace - Gets or sets the activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// RunbookCreateOrUpdateParameters the parameters supplied to the create or update runbook operation. -type RunbookCreateOrUpdateParameters struct { - // RunbookCreateOrUpdateProperties - Gets or sets runbook create or update properties. - *RunbookCreateOrUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for RunbookCreateOrUpdateParameters. -func (rcoup RunbookCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rcoup.RunbookCreateOrUpdateProperties != nil { - objectMap["properties"] = rcoup.RunbookCreateOrUpdateProperties - } - if rcoup.Name != nil { - objectMap["name"] = rcoup.Name - } - if rcoup.Location != nil { - objectMap["location"] = rcoup.Location - } - if rcoup.Tags != nil { - objectMap["tags"] = rcoup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RunbookCreateOrUpdateParameters struct. -func (rcoup *RunbookCreateOrUpdateParameters) 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 runbookCreateOrUpdateProperties RunbookCreateOrUpdateProperties - err = json.Unmarshal(*v, &runbookCreateOrUpdateProperties) - if err != nil { - return err - } - rcoup.RunbookCreateOrUpdateProperties = &runbookCreateOrUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rcoup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rcoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rcoup.Tags = tags - } - } - } - - return nil -} - -// RunbookCreateOrUpdateProperties the parameters supplied to the create or update runbook properties. -type RunbookCreateOrUpdateProperties struct { - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // RunbookType - Gets or sets the type of the runbook. Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - // Draft - Gets or sets the draft runbook properties. - Draft *RunbookDraft `json:"draft,omitempty"` - // PublishContentLink - Gets or sets the published runbook content link. - PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` - // Description - Gets or sets the description of the runbook. - Description *string `json:"description,omitempty"` - // LogActivityTrace - Gets or sets the activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// RunbookDraft ... -type RunbookDraft struct { - autorest.Response `json:"-"` - // InEdit - Gets or sets whether runbook is in edit mode. - InEdit *bool `json:"inEdit,omitempty"` - // DraftContentLink - Gets or sets the draft runbook content link. - DraftContentLink *ContentLink `json:"draftContentLink,omitempty"` - // CreationTime - Gets or sets the creation time of the runbook draft. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time of the runbook draft. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Parameters - Gets or sets the runbook draft parameters. - Parameters map[string]*RunbookParameter `json:"parameters"` - // OutputTypes - Gets or sets the runbook output types. - OutputTypes *[]string `json:"outputTypes,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunbookDraft. -func (rd RunbookDraft) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rd.InEdit != nil { - objectMap["inEdit"] = rd.InEdit - } - if rd.DraftContentLink != nil { - objectMap["draftContentLink"] = rd.DraftContentLink - } - if rd.CreationTime != nil { - objectMap["creationTime"] = rd.CreationTime - } - if rd.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = rd.LastModifiedTime - } - if rd.Parameters != nil { - objectMap["parameters"] = rd.Parameters - } - if rd.OutputTypes != nil { - objectMap["outputTypes"] = rd.OutputTypes - } - return json.Marshal(objectMap) -} - -// RunbookDraftReplaceContentFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RunbookDraftReplaceContentFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunbookDraftClient) (ReadCloser, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunbookDraftReplaceContentFuture) 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 RunbookDraftReplaceContentFuture.Result. -func (future *RunbookDraftReplaceContentFuture) result(client RunbookDraftClient) (rc ReadCloser, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.RunbookDraftReplaceContentFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rc.Response.Response, err = future.GetResult(sender); err == nil && rc.Response.Response.StatusCode != http.StatusNoContent { - rc, err = client.ReplaceContentResponder(rc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", rc.Response.Response, "Failure responding to request") - } - } - return -} - -// RunbookDraftUndoEditResult the response model for the undo edit runbook operation. -type RunbookDraftUndoEditResult struct { - autorest.Response `json:"-"` - // StatusCode - Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'Ambiguous', 'MovedPermanently', 'Moved', 'Found', 'Redirect', 'SeeOther', 'RedirectMethod', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'RedirectKeepVerb', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestURITooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HTTPVersionNotSupported' - StatusCode HTTPStatusCode `json:"statusCode,omitempty"` - RequestID *string `json:"requestId,omitempty"` -} - -// RunbookListResult the response model for the list runbook operation. -type RunbookListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of runbooks. - Value *[]Runbook `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// RunbookListResultIterator provides access to a complete listing of Runbook values. -type RunbookListResultIterator struct { - i int - page RunbookListResultPage -} - -// 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 *RunbookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookListResultIterator.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 *RunbookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RunbookListResultIterator) 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 RunbookListResultIterator) Response() RunbookListResult { - 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 RunbookListResultIterator) Value() Runbook { - if !iter.page.NotDone() { - return Runbook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RunbookListResultIterator type. -func NewRunbookListResultIterator(page RunbookListResultPage) RunbookListResultIterator { - return RunbookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RunbookListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RunbookListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// runbookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RunbookListResult) runbookListResultPreparer(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))) -} - -// RunbookListResultPage contains a page of Runbook values. -type RunbookListResultPage struct { - fn func(context.Context, RunbookListResult) (RunbookListResult, error) - rlr RunbookListResult -} - -// 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 *RunbookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookListResultPage.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 *RunbookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RunbookListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RunbookListResultPage) Response() RunbookListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RunbookListResultPage) Values() []Runbook { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RunbookListResultPage type. -func NewRunbookListResultPage(cur RunbookListResult, getNextPage func(context.Context, RunbookListResult) (RunbookListResult, error)) RunbookListResultPage { - return RunbookListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RunbookParameter definition of the runbook parameter type. -type RunbookParameter struct { - // Type - Gets or sets the type of the parameter. - Type *string `json:"type,omitempty"` - // IsMandatory - Gets or sets a Boolean value to indicate whether the parameter is mandatory or not. - IsMandatory *bool `json:"isMandatory,omitempty"` - // Position - Get or sets the position of the parameter. - Position *int32 `json:"position,omitempty"` - // DefaultValue - Gets or sets the default value of parameter. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// RunbookProperties definition of the runbook property type. -type RunbookProperties struct { - // RunbookType - Gets or sets the type of the runbook. Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - // PublishContentLink - Gets or sets the published runbook content link. - PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` - // State - Gets or sets the state of the runbook. Possible values include: 'RunbookStateNew', 'RunbookStateEdit', 'RunbookStatePublished' - State RunbookState `json:"state,omitempty"` - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // LogActivityTrace - Gets or sets the option to log activity trace of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` - // JobCount - Gets or sets the job count of the runbook. - JobCount *int32 `json:"jobCount,omitempty"` - // Parameters - Gets or sets the runbook parameters. - Parameters map[string]*RunbookParameter `json:"parameters"` - // OutputTypes - Gets or sets the runbook output types. - OutputTypes *[]string `json:"outputTypes,omitempty"` - // Draft - Gets or sets the draft runbook properties. - Draft *RunbookDraft `json:"draft,omitempty"` - // ProvisioningState - Gets or sets the provisioning state of the runbook. Possible values include: 'RunbookProvisioningStateSucceeded' - ProvisioningState RunbookProvisioningState `json:"provisioningState,omitempty"` - // LastModifiedBy - Gets or sets the last modified by. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunbookProperties. -func (rp RunbookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RunbookType != "" { - objectMap["runbookType"] = rp.RunbookType - } - if rp.PublishContentLink != nil { - objectMap["publishContentLink"] = rp.PublishContentLink - } - if rp.State != "" { - objectMap["state"] = rp.State - } - if rp.LogVerbose != nil { - objectMap["logVerbose"] = rp.LogVerbose - } - if rp.LogProgress != nil { - objectMap["logProgress"] = rp.LogProgress - } - if rp.LogActivityTrace != nil { - objectMap["logActivityTrace"] = rp.LogActivityTrace - } - if rp.JobCount != nil { - objectMap["jobCount"] = rp.JobCount - } - if rp.Parameters != nil { - objectMap["parameters"] = rp.Parameters - } - if rp.OutputTypes != nil { - objectMap["outputTypes"] = rp.OutputTypes - } - if rp.Draft != nil { - objectMap["draft"] = rp.Draft - } - if rp.ProvisioningState != "" { - objectMap["provisioningState"] = rp.ProvisioningState - } - if rp.LastModifiedBy != nil { - objectMap["lastModifiedBy"] = rp.LastModifiedBy - } - if rp.CreationTime != nil { - objectMap["creationTime"] = rp.CreationTime - } - if rp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = rp.LastModifiedTime - } - if rp.Description != nil { - objectMap["description"] = rp.Description - } - return json.Marshal(objectMap) -} - -// RunbookPublishFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RunbookPublishFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunbookClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunbookPublishFuture) 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 RunbookPublishFuture.Result. -func (future *RunbookPublishFuture) result(client RunbookClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookPublishFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("automation.RunbookPublishFuture") - return - } - ar.Response = future.Response() - return -} - -// RunbookUpdateParameters the parameters supplied to the update runbook operation. -type RunbookUpdateParameters struct { - // RunbookUpdateProperties - Gets or sets the runbook update properties. - *RunbookUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Gets or sets the location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets the tags attached to the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for RunbookUpdateParameters. -func (rup RunbookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.RunbookUpdateProperties != nil { - objectMap["properties"] = rup.RunbookUpdateProperties - } - if rup.Name != nil { - objectMap["name"] = rup.Name - } - if rup.Location != nil { - objectMap["location"] = rup.Location - } - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RunbookUpdateParameters struct. -func (rup *RunbookUpdateParameters) 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 runbookUpdateProperties RunbookUpdateProperties - err = json.Unmarshal(*v, &runbookUpdateProperties) - if err != nil { - return err - } - rup.RunbookUpdateProperties = &runbookUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rup.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rup.Tags = tags - } - } - } - - return nil -} - -// RunbookUpdateProperties the parameters supplied to the update runbook properties. -type RunbookUpdateProperties struct { - // Description - Gets or sets the description of the runbook. - Description *string `json:"description,omitempty"` - // LogVerbose - Gets or sets verbose log option. - LogVerbose *bool `json:"logVerbose,omitempty"` - // LogProgress - Gets or sets progress log option. - LogProgress *bool `json:"logProgress,omitempty"` - // LogActivityTrace - Gets or sets the activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// Schedule definition of the schedule. -type Schedule struct { - autorest.Response `json:"-"` - // ScheduleProperties - Gets or sets the properties of the schedule. - *ScheduleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Schedule. -func (s Schedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.ScheduleProperties != nil { - objectMap["properties"] = s.ScheduleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Schedule struct. -func (s *Schedule) 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 scheduleProperties ScheduleProperties - err = json.Unmarshal(*v, &scheduleProperties) - if err != nil { - return err - } - s.ScheduleProperties = &scheduleProperties - } - 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 - } - } - } - - return nil -} - -// ScheduleAssociationProperty the schedule property associated with the entity. -type ScheduleAssociationProperty struct { - // Name - Gets or sets the name of the Schedule. - Name *string `json:"name,omitempty"` -} - -// ScheduleCreateOrUpdateParameters the parameters supplied to the create or update schedule operation. -type ScheduleCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the Schedule. - Name *string `json:"name,omitempty"` - // ScheduleCreateOrUpdateProperties - Gets or sets the list of schedule properties. - *ScheduleCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleCreateOrUpdateParameters. -func (scoup ScheduleCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scoup.Name != nil { - objectMap["name"] = scoup.Name - } - if scoup.ScheduleCreateOrUpdateProperties != nil { - objectMap["properties"] = scoup.ScheduleCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScheduleCreateOrUpdateParameters struct. -func (scoup *ScheduleCreateOrUpdateParameters) 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 - } - scoup.Name = &name - } - case "properties": - if v != nil { - var scheduleCreateOrUpdateProperties ScheduleCreateOrUpdateProperties - err = json.Unmarshal(*v, &scheduleCreateOrUpdateProperties) - if err != nil { - return err - } - scoup.ScheduleCreateOrUpdateProperties = &scheduleCreateOrUpdateProperties - } - } - } - - return nil -} - -// ScheduleCreateOrUpdateProperties the parameters supplied to the create or update schedule operation. -type ScheduleCreateOrUpdateProperties struct { - // Description - Gets or sets the description of the schedule. - Description *string `json:"description,omitempty"` - // StartTime - Gets or sets the start time of the schedule. - StartTime *date.Time `json:"startTime,omitempty"` - // ExpiryTime - Gets or sets the end time of the schedule. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // Interval - Gets or sets the interval of the schedule. - Interval interface{} `json:"interval,omitempty"` - // Frequency - Gets or sets the frequency of the schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month', 'Minute' - Frequency ScheduleFrequency `json:"frequency,omitempty"` - // TimeZone - Gets or sets the time zone of the schedule. - TimeZone *string `json:"timeZone,omitempty"` - // AdvancedSchedule - Gets or sets the AdvancedSchedule. - AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` -} - -// ScheduleListResult the response model for the list schedule operation. -type ScheduleListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of schedules. - Value *[]Schedule `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// ScheduleListResultIterator provides access to a complete listing of Schedule values. -type ScheduleListResultIterator struct { - i int - page ScheduleListResultPage -} - -// 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 *ScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleListResultIterator.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 *ScheduleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScheduleListResultIterator) 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 ScheduleListResultIterator) Response() ScheduleListResult { - 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 ScheduleListResultIterator) Value() Schedule { - if !iter.page.NotDone() { - return Schedule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScheduleListResultIterator type. -func NewScheduleListResultIterator(page ScheduleListResultPage) ScheduleListResultIterator { - return ScheduleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr ScheduleListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr ScheduleListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// scheduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr ScheduleListResult) scheduleListResultPreparer(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))) -} - -// ScheduleListResultPage contains a page of Schedule values. -type ScheduleListResultPage struct { - fn func(context.Context, ScheduleListResult) (ScheduleListResult, error) - slr ScheduleListResult -} - -// 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 *ScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleListResultPage.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 *ScheduleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScheduleListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScheduleListResultPage) Response() ScheduleListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScheduleListResultPage) Values() []Schedule { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the ScheduleListResultPage type. -func NewScheduleListResultPage(cur ScheduleListResult, getNextPage func(context.Context, ScheduleListResult) (ScheduleListResult, error)) ScheduleListResultPage { - return ScheduleListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// ScheduleProperties definition of schedule parameters. -type ScheduleProperties struct { - // StartTime - Gets or sets the start time of the schedule. - StartTime *date.Time `json:"startTime,omitempty"` - // StartTimeOffsetMinutes - READ-ONLY; Gets the start time's offset in minutes. - StartTimeOffsetMinutes *float64 `json:"startTimeOffsetMinutes,omitempty"` - // ExpiryTime - Gets or sets the end time of the schedule. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // ExpiryTimeOffsetMinutes - Gets or sets the expiry time's offset in minutes. - ExpiryTimeOffsetMinutes *float64 `json:"expiryTimeOffsetMinutes,omitempty"` - // IsEnabled - Gets or sets a value indicating whether this schedule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // NextRun - Gets or sets the next run time of the schedule. - NextRun *date.Time `json:"nextRun,omitempty"` - // NextRunOffsetMinutes - Gets or sets the next run time's offset in minutes. - NextRunOffsetMinutes *float64 `json:"nextRunOffsetMinutes,omitempty"` - // Interval - Gets or sets the interval of the schedule. - Interval *int32 `json:"interval,omitempty"` - // Frequency - Gets or sets the frequency of the schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month', 'Minute' - Frequency ScheduleFrequency `json:"frequency,omitempty"` - // TimeZone - Gets or sets the time zone of the schedule. - TimeZone *string `json:"timeZone,omitempty"` - // AdvancedSchedule - Gets or sets the advanced schedule. - AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleProperties. -func (sp ScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.StartTime != nil { - objectMap["startTime"] = sp.StartTime - } - if sp.ExpiryTime != nil { - objectMap["expiryTime"] = sp.ExpiryTime - } - if sp.ExpiryTimeOffsetMinutes != nil { - objectMap["expiryTimeOffsetMinutes"] = sp.ExpiryTimeOffsetMinutes - } - if sp.IsEnabled != nil { - objectMap["isEnabled"] = sp.IsEnabled - } - if sp.NextRun != nil { - objectMap["nextRun"] = sp.NextRun - } - if sp.NextRunOffsetMinutes != nil { - objectMap["nextRunOffsetMinutes"] = sp.NextRunOffsetMinutes - } - if sp.Interval != nil { - objectMap["interval"] = sp.Interval - } - if sp.Frequency != "" { - objectMap["frequency"] = sp.Frequency - } - if sp.TimeZone != nil { - objectMap["timeZone"] = sp.TimeZone - } - if sp.AdvancedSchedule != nil { - objectMap["advancedSchedule"] = sp.AdvancedSchedule - } - if sp.CreationTime != nil { - objectMap["creationTime"] = sp.CreationTime - } - if sp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = sp.LastModifiedTime - } - if sp.Description != nil { - objectMap["description"] = sp.Description - } - return json.Marshal(objectMap) -} - -// ScheduleUpdateParameters the parameters supplied to the update schedule operation. -type ScheduleUpdateParameters struct { - // Name - Gets or sets the name of the Schedule. - Name *string `json:"name,omitempty"` - // ScheduleUpdateProperties - Gets or sets the list of schedule properties. - *ScheduleUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleUpdateParameters. -func (sup ScheduleUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.Name != nil { - objectMap["name"] = sup.Name - } - if sup.ScheduleUpdateProperties != nil { - objectMap["properties"] = sup.ScheduleUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScheduleUpdateParameters struct. -func (sup *ScheduleUpdateParameters) 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 - } - sup.Name = &name - } - case "properties": - if v != nil { - var scheduleUpdateProperties ScheduleUpdateProperties - err = json.Unmarshal(*v, &scheduleUpdateProperties) - if err != nil { - return err - } - sup.ScheduleUpdateProperties = &scheduleUpdateProperties - } - } - } - - return nil -} - -// ScheduleUpdateProperties the parameters supplied to the update schedule operation. -type ScheduleUpdateProperties struct { - // Description - Gets or sets the description of the schedule. - Description *string `json:"description,omitempty"` - // IsEnabled - Gets or sets a value indicating whether this schedule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// SetObject ... -type SetObject struct { - autorest.Response `json:"-"` - Value interface{} `json:"value,omitempty"` -} - -// Sku the account SKU. -type Sku struct { - // Name - Gets or sets the SKU name of the account. Possible values include: 'Free', 'Basic' - Name SkuNameEnum `json:"name,omitempty"` - // Family - Gets or sets the SKU family. - Family *string `json:"family,omitempty"` - // Capacity - Gets or sets the SKU capacity. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SoftareUpdateConfigurationRunTaskProperties task properties of the software update configuration. -type SoftareUpdateConfigurationRunTaskProperties struct { - // Status - The status of the task. - Status *string `json:"status,omitempty"` - // Source - The name of the source of the task. - Source *string `json:"source,omitempty"` - // JobID - The job id of the task. - JobID *string `json:"jobId,omitempty"` -} - -// SoftareUpdateConfigurationRunTasks software update configuration run tasks model. -type SoftareUpdateConfigurationRunTasks struct { - // PreTask - Pre task properties. - PreTask *SoftareUpdateConfigurationRunTaskProperties `json:"preTask,omitempty"` - // PostTask - Post task properties. - PostTask *SoftareUpdateConfigurationRunTaskProperties `json:"postTask,omitempty"` -} - -// SoftwareUpdateConfiguration software update configuration properties. -type SoftwareUpdateConfiguration struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // SoftwareUpdateConfigurationProperties - Software update configuration properties. - *SoftwareUpdateConfigurationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfiguration. -func (suc SoftwareUpdateConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if suc.SoftwareUpdateConfigurationProperties != nil { - objectMap["properties"] = suc.SoftwareUpdateConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfiguration struct. -func (suc *SoftwareUpdateConfiguration) 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 - } - suc.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - suc.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - suc.Type = &typeVar - } - case "properties": - if v != nil { - var softwareUpdateConfigurationProperties SoftwareUpdateConfigurationProperties - err = json.Unmarshal(*v, &softwareUpdateConfigurationProperties) - if err != nil { - return err - } - suc.SoftwareUpdateConfigurationProperties = &softwareUpdateConfigurationProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationCollectionItem software update configuration collection item properties. -type SoftwareUpdateConfigurationCollectionItem struct { - // Name - READ-ONLY; Name of the software update configuration. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id of the software update configuration - ID *string `json:"id,omitempty"` - // SoftwareUpdateConfigurationCollectionItemProperties - Software update configuration properties. - *SoftwareUpdateConfigurationCollectionItemProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationCollectionItem. -func (succi SoftwareUpdateConfigurationCollectionItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if succi.SoftwareUpdateConfigurationCollectionItemProperties != nil { - objectMap["properties"] = succi.SoftwareUpdateConfigurationCollectionItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfigurationCollectionItem struct. -func (succi *SoftwareUpdateConfigurationCollectionItem) 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 - } - succi.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - succi.ID = &ID - } - case "properties": - if v != nil { - var softwareUpdateConfigurationCollectionItemProperties SoftwareUpdateConfigurationCollectionItemProperties - err = json.Unmarshal(*v, &softwareUpdateConfigurationCollectionItemProperties) - if err != nil { - return err - } - succi.SoftwareUpdateConfigurationCollectionItemProperties = &softwareUpdateConfigurationCollectionItemProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationCollectionItemProperties software update configuration collection item -// properties. -type SoftwareUpdateConfigurationCollectionItemProperties struct { - // UpdateConfiguration - Update specific properties of the software update configuration. - UpdateConfiguration *CollectionItemUpdateConfiguration `json:"updateConfiguration,omitempty"` - // Frequency - execution frequency of the schedule associated with the software update configuration. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month', 'Minute' - Frequency ScheduleFrequency `json:"frequency,omitempty"` - // StartTime - the start time of the update. - StartTime *date.Time `json:"startTime,omitempty"` - // CreationTime - READ-ONLY; Creation time of the software update configuration, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Last time software update configuration was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state for the software update configuration, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // NextRun - ext run time of the update. - NextRun *date.Time `json:"nextRun,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationCollectionItemProperties. -func (succip SoftwareUpdateConfigurationCollectionItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if succip.UpdateConfiguration != nil { - objectMap["updateConfiguration"] = succip.UpdateConfiguration - } - if succip.Frequency != "" { - objectMap["frequency"] = succip.Frequency - } - if succip.StartTime != nil { - objectMap["startTime"] = succip.StartTime - } - if succip.NextRun != nil { - objectMap["nextRun"] = succip.NextRun - } - return json.Marshal(objectMap) -} - -// SoftwareUpdateConfigurationListResult result of listing all software update configuration -type SoftwareUpdateConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - outer object returned when listing all software update configurations - Value *[]SoftwareUpdateConfigurationCollectionItem `json:"value,omitempty"` -} - -// SoftwareUpdateConfigurationMachineRun software update configuration machine run model. -type SoftwareUpdateConfigurationMachineRun struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Name of the software update configuration machine run - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id of the software update configuration machine run - ID *string `json:"id,omitempty"` - // UpdateConfigurationMachineRunProperties - Software update configuration machine run properties. - *UpdateConfigurationMachineRunProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationMachineRun. -func (sucmr SoftwareUpdateConfigurationMachineRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucmr.UpdateConfigurationMachineRunProperties != nil { - objectMap["properties"] = sucmr.UpdateConfigurationMachineRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfigurationMachineRun struct. -func (sucmr *SoftwareUpdateConfigurationMachineRun) 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 - } - sucmr.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sucmr.ID = &ID - } - case "properties": - if v != nil { - var updateConfigurationMachineRunProperties UpdateConfigurationMachineRunProperties - err = json.Unmarshal(*v, &updateConfigurationMachineRunProperties) - if err != nil { - return err - } - sucmr.UpdateConfigurationMachineRunProperties = &updateConfigurationMachineRunProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationMachineRunListResult result of listing all software update configuration -// machine runs -type SoftwareUpdateConfigurationMachineRunListResult struct { - autorest.Response `json:"-"` - // Value - outer object returned when listing all software update configuration machine runs - Value *[]SoftwareUpdateConfigurationMachineRun `json:"value,omitempty"` - // NextLink - link to next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SoftwareUpdateConfigurationProperties software update configuration properties. -type SoftwareUpdateConfigurationProperties struct { - // UpdateConfiguration - update specific properties for the Software update configuration - UpdateConfiguration *UpdateConfiguration `json:"updateConfiguration,omitempty"` - // ScheduleInfo - Schedule information for the Software update configuration - ScheduleInfo *ScheduleProperties `json:"scheduleInfo,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state for the software update configuration, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Error - Details of provisioning error - Error *ErrorResponse `json:"error,omitempty"` - // CreationTime - READ-ONLY; Creation time of the resource, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CreatedBy - READ-ONLY; CreatedBy property, which only appears in the response. - CreatedBy *string `json:"createdBy,omitempty"` - // LastModifiedTime - READ-ONLY; Last time resource was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; LastModifiedBy property, which only appears in the response. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Tasks - Tasks information for the Software update configuration. - Tasks *SoftwareUpdateConfigurationTasks `json:"tasks,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationProperties. -func (sucp SoftwareUpdateConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucp.UpdateConfiguration != nil { - objectMap["updateConfiguration"] = sucp.UpdateConfiguration - } - if sucp.ScheduleInfo != nil { - objectMap["scheduleInfo"] = sucp.ScheduleInfo - } - if sucp.Error != nil { - objectMap["error"] = sucp.Error - } - if sucp.Tasks != nil { - objectMap["tasks"] = sucp.Tasks - } - return json.Marshal(objectMap) -} - -// SoftwareUpdateConfigurationRun software update configuration Run properties. -type SoftwareUpdateConfigurationRun struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Name of the software update configuration run. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Resource Id of the software update configuration run - ID *string `json:"id,omitempty"` - // SoftwareUpdateConfigurationRunProperties - Software update configuration Run properties. - *SoftwareUpdateConfigurationRunProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationRun. -func (sucr SoftwareUpdateConfigurationRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucr.SoftwareUpdateConfigurationRunProperties != nil { - objectMap["properties"] = sucr.SoftwareUpdateConfigurationRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SoftwareUpdateConfigurationRun struct. -func (sucr *SoftwareUpdateConfigurationRun) 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 - } - sucr.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sucr.ID = &ID - } - case "properties": - if v != nil { - var softwareUpdateConfigurationRunProperties SoftwareUpdateConfigurationRunProperties - err = json.Unmarshal(*v, &softwareUpdateConfigurationRunProperties) - if err != nil { - return err - } - sucr.SoftwareUpdateConfigurationRunProperties = &softwareUpdateConfigurationRunProperties - } - } - } - - return nil -} - -// SoftwareUpdateConfigurationRunListResult result of listing all software update configuration runs -type SoftwareUpdateConfigurationRunListResult struct { - autorest.Response `json:"-"` - // Value - outer object returned when listing all software update configuration runs - Value *[]SoftwareUpdateConfigurationRun `json:"value,omitempty"` - // NextLink - link to next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SoftwareUpdateConfigurationRunProperties software update configuration properties. -type SoftwareUpdateConfigurationRunProperties struct { - // SoftwareUpdateConfiguration - software update configuration triggered this run - SoftwareUpdateConfiguration *UpdateConfigurationNavigation `json:"softwareUpdateConfiguration,omitempty"` - // Status - READ-ONLY; Status of the software update configuration run. - Status *string `json:"status,omitempty"` - // ConfiguredDuration - READ-ONLY; Configured duration for the software update configuration run. - ConfiguredDuration *string `json:"configuredDuration,omitempty"` - // OsType - READ-ONLY; Operating system target of the software update configuration triggered this run - OsType *string `json:"osType,omitempty"` - // StartTime - READ-ONLY; Start time of the software update configuration run. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; End time of the software update configuration run. - EndTime *date.Time `json:"endTime,omitempty"` - // ComputerCount - READ-ONLY; Number of computers in the software update configuration run. - ComputerCount *int32 `json:"computerCount,omitempty"` - // FailedCount - READ-ONLY; Number of computers with failed status. - FailedCount *int32 `json:"failedCount,omitempty"` - // CreationTime - READ-ONLY; Creation time of the resource, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CreatedBy - READ-ONLY; CreatedBy property, which only appears in the response. - CreatedBy *string `json:"createdBy,omitempty"` - // LastModifiedTime - READ-ONLY; Last time resource was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; LastModifiedBy property, which only appears in the response. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Tasks - Software update configuration tasks triggered in this run - Tasks *SoftareUpdateConfigurationRunTasks `json:"tasks,omitempty"` -} - -// MarshalJSON is the custom marshaler for SoftwareUpdateConfigurationRunProperties. -func (sucrp SoftwareUpdateConfigurationRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sucrp.SoftwareUpdateConfiguration != nil { - objectMap["softwareUpdateConfiguration"] = sucrp.SoftwareUpdateConfiguration - } - if sucrp.Tasks != nil { - objectMap["tasks"] = sucrp.Tasks - } - return json.Marshal(objectMap) -} - -// SoftwareUpdateConfigurationTasks task properties of the software update configuration. -type SoftwareUpdateConfigurationTasks struct { - // PreTask - Pre task properties. - PreTask *TaskProperties `json:"preTask,omitempty"` - // PostTask - Post task properties. - PostTask *TaskProperties `json:"postTask,omitempty"` -} - -// SourceControl definition of the source control. -type SourceControl struct { - autorest.Response `json:"-"` - // SourceControlProperties - The properties of the source control. - *SourceControlProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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 - } - 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 "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 - } - } - } - - return nil -} - -// SourceControlCreateOrUpdateParameters the parameters supplied to the create or update source control -// operation. -type SourceControlCreateOrUpdateParameters struct { - // SourceControlCreateOrUpdateProperties - The properties of the source control. - *SourceControlCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlCreateOrUpdateParameters. -func (sccoup SourceControlCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccoup.SourceControlCreateOrUpdateProperties != nil { - objectMap["properties"] = sccoup.SourceControlCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlCreateOrUpdateParameters struct. -func (sccoup *SourceControlCreateOrUpdateParameters) 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 sourceControlCreateOrUpdateProperties SourceControlCreateOrUpdateProperties - err = json.Unmarshal(*v, &sourceControlCreateOrUpdateProperties) - if err != nil { - return err - } - sccoup.SourceControlCreateOrUpdateProperties = &sourceControlCreateOrUpdateProperties - } - } - } - - return nil -} - -// SourceControlCreateOrUpdateProperties the properties of the create source control operation. -type SourceControlCreateOrUpdateProperties struct { - // RepoURL - The repo url of the source control. - RepoURL *string `json:"repoUrl,omitempty"` - // Branch - The repo branch of the source control. Include branch as empty string for VsoTfvc. - Branch *string `json:"branch,omitempty"` - // FolderPath - The folder path of the source control. Path must be relative. - FolderPath *string `json:"folderPath,omitempty"` - // AutoSync - The auto async of the source control. Default is false. - AutoSync *bool `json:"autoSync,omitempty"` - // PublishRunbook - The auto publish of the source control. Default is true. - PublishRunbook *bool `json:"publishRunbook,omitempty"` - // SourceType - The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' - SourceType SourceType `json:"sourceType,omitempty"` - // SecurityToken - The authorization token for the repo of the source control. - SecurityToken *SourceControlSecurityTokenProperties `json:"securityToken,omitempty"` - // Description - The user description of the source control. - Description *string `json:"description,omitempty"` -} - -// SourceControlListResult the response model for the list source controls operation. -type SourceControlListResult struct { - autorest.Response `json:"-"` - // Value - The list of source controls. - Value *[]SourceControl `json:"value,omitempty"` - // NextLink - The next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// SourceControlListResultIterator provides access to a complete listing of SourceControl values. -type SourceControlListResultIterator struct { - i int - page SourceControlListResultPage -} - -// 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 *SourceControlListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlListResultIterator.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 *SourceControlListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceControlListResultIterator) 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 SourceControlListResultIterator) Response() SourceControlListResult { - 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 SourceControlListResultIterator) Value() SourceControl { - if !iter.page.NotDone() { - return SourceControl{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceControlListResultIterator type. -func NewSourceControlListResultIterator(page SourceControlListResultPage) SourceControlListResultIterator { - return SourceControlListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sclr SourceControlListResult) IsEmpty() bool { - return sclr.Value == nil || len(*sclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sclr SourceControlListResult) hasNextLink() bool { - return sclr.NextLink != nil && len(*sclr.NextLink) != 0 -} - -// sourceControlListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sclr SourceControlListResult) sourceControlListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sclr.NextLink))) -} - -// SourceControlListResultPage contains a page of SourceControl values. -type SourceControlListResultPage struct { - fn func(context.Context, SourceControlListResult) (SourceControlListResult, error) - sclr SourceControlListResult -} - -// 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 *SourceControlListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlListResultPage.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.sclr) - if err != nil { - return err - } - page.sclr = 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 *SourceControlListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceControlListResultPage) NotDone() bool { - return !page.sclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceControlListResultPage) Response() SourceControlListResult { - return page.sclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceControlListResultPage) Values() []SourceControl { - if page.sclr.IsEmpty() { - return nil - } - return *page.sclr.Value -} - -// Creates a new instance of the SourceControlListResultPage type. -func NewSourceControlListResultPage(cur SourceControlListResult, getNextPage func(context.Context, SourceControlListResult) (SourceControlListResult, error)) SourceControlListResultPage { - return SourceControlListResultPage{ - fn: getNextPage, - sclr: cur, - } -} - -// SourceControlProperties definition of the source control properties -type SourceControlProperties struct { - // RepoURL - The repo url of the source control. - RepoURL *string `json:"repoUrl,omitempty"` - // Branch - The repo branch of the source control. Include branch as empty string for VsoTfvc. - Branch *string `json:"branch,omitempty"` - // FolderPath - The folder path of the source control. - FolderPath *string `json:"folderPath,omitempty"` - // AutoSync - The auto sync of the source control. Default is false. - AutoSync *bool `json:"autoSync,omitempty"` - // PublishRunbook - The auto publish of the source control. Default is true. - PublishRunbook *bool `json:"publishRunbook,omitempty"` - // SourceType - The source type. Must be one of VsoGit, VsoTfvc, GitHub. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' - SourceType SourceType `json:"sourceType,omitempty"` - // Description - The description. - Description *string `json:"description,omitempty"` - // CreationTime - The creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - The last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` -} - -// SourceControlSecurityTokenProperties ... -type SourceControlSecurityTokenProperties struct { - // AccessToken - The access token. - AccessToken *string `json:"accessToken,omitempty"` - // RefreshToken - The refresh token. - RefreshToken *string `json:"refreshToken,omitempty"` - // TokenType - The token type. Must be either PersonalAccessToken or Oauth. Possible values include: 'PersonalAccessToken', 'Oauth' - TokenType TokenType `json:"tokenType,omitempty"` -} - -// SourceControlSyncJob definition of the source control sync job. -type SourceControlSyncJob struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; Resource id. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobProperties - The properties of the source control sync job. - *SourceControlSyncJobProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJob. -func (scsj SourceControlSyncJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsj.SourceControlSyncJobProperties != nil { - objectMap["properties"] = scsj.SourceControlSyncJobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJob struct. -func (scsj *SourceControlSyncJob) 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 - } - scsj.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scsj.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scsj.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobProperties SourceControlSyncJobProperties - err = json.Unmarshal(*v, &sourceControlSyncJobProperties) - if err != nil { - return err - } - scsj.SourceControlSyncJobProperties = &sourceControlSyncJobProperties - } - } - } - - return nil -} - -// SourceControlSyncJobByID definition of the source control sync job. -type SourceControlSyncJobByID struct { - autorest.Response `json:"-"` - // ID - The id of the job. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobByIDProperties - The properties of the source control sync job. - *SourceControlSyncJobByIDProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobByID. -func (scsjbi SourceControlSyncJobByID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjbi.ID != nil { - objectMap["id"] = scsjbi.ID - } - if scsjbi.SourceControlSyncJobByIDProperties != nil { - objectMap["properties"] = scsjbi.SourceControlSyncJobByIDProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobByID struct. -func (scsjbi *SourceControlSyncJobByID) 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 - } - scsjbi.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobByIDProperties SourceControlSyncJobByIDProperties - err = json.Unmarshal(*v, &sourceControlSyncJobByIDProperties) - if err != nil { - return err - } - scsjbi.SourceControlSyncJobByIDProperties = &sourceControlSyncJobByIDProperties - } - } - } - - return nil -} - -// SourceControlSyncJobByIDProperties definition of source control sync job properties. -type SourceControlSyncJobByIDProperties struct { - // SourceControlSyncJobID - The source control sync job id. - SourceControlSyncJobID *string `json:"sourceControlSyncJobId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - The provisioning state of the job. Possible values include: 'Completed', 'Failed', 'Running' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // StartTime - READ-ONLY; The start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // SyncType - The sync type. Possible values include: 'PartialSync', 'FullSync' - SyncType SyncType `json:"syncType,omitempty"` - // Exception - The exceptions that occurred while running the sync job. - Exception *string `json:"exception,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobByIDProperties. -func (scsjbip SourceControlSyncJobByIDProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjbip.SourceControlSyncJobID != nil { - objectMap["sourceControlSyncJobId"] = scsjbip.SourceControlSyncJobID - } - if scsjbip.ProvisioningState != "" { - objectMap["provisioningState"] = scsjbip.ProvisioningState - } - if scsjbip.SyncType != "" { - objectMap["syncType"] = scsjbip.SyncType - } - if scsjbip.Exception != nil { - objectMap["exception"] = scsjbip.Exception - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobCreateParameters the parameters supplied to the create source control sync job -// operation. -type SourceControlSyncJobCreateParameters struct { - // SourceControlSyncJobCreateProperties - The properties of the source control sync job. - *SourceControlSyncJobCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobCreateParameters. -func (scsjcp SourceControlSyncJobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjcp.SourceControlSyncJobCreateProperties != nil { - objectMap["properties"] = scsjcp.SourceControlSyncJobCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobCreateParameters struct. -func (scsjcp *SourceControlSyncJobCreateParameters) 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 sourceControlSyncJobCreateProperties SourceControlSyncJobCreateProperties - err = json.Unmarshal(*v, &sourceControlSyncJobCreateProperties) - if err != nil { - return err - } - scsjcp.SourceControlSyncJobCreateProperties = &sourceControlSyncJobCreateProperties - } - } - } - - return nil -} - -// SourceControlSyncJobCreateProperties definition of create source control sync job properties. -type SourceControlSyncJobCreateProperties struct { - // CommitID - The commit id of the source control sync job. If not syncing to a commitId, enter an empty string. - CommitID *string `json:"commitId,omitempty"` -} - -// SourceControlSyncJobListResult the response model for the list source control sync jobs operation. -type SourceControlSyncJobListResult struct { - autorest.Response `json:"-"` - // Value - The list of source control sync jobs. - Value *[]SourceControlSyncJob `json:"value,omitempty"` - // NextLink - The next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// SourceControlSyncJobListResultIterator provides access to a complete listing of SourceControlSyncJob -// values. -type SourceControlSyncJobListResultIterator struct { - i int - page SourceControlSyncJobListResultPage -} - -// 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 *SourceControlSyncJobListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobListResultIterator.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 *SourceControlSyncJobListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceControlSyncJobListResultIterator) 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 SourceControlSyncJobListResultIterator) Response() SourceControlSyncJobListResult { - 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 SourceControlSyncJobListResultIterator) Value() SourceControlSyncJob { - if !iter.page.NotDone() { - return SourceControlSyncJob{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceControlSyncJobListResultIterator type. -func NewSourceControlSyncJobListResultIterator(page SourceControlSyncJobListResultPage) SourceControlSyncJobListResultIterator { - return SourceControlSyncJobListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (scsjlr SourceControlSyncJobListResult) IsEmpty() bool { - return scsjlr.Value == nil || len(*scsjlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (scsjlr SourceControlSyncJobListResult) hasNextLink() bool { - return scsjlr.NextLink != nil && len(*scsjlr.NextLink) != 0 -} - -// sourceControlSyncJobListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (scsjlr SourceControlSyncJobListResult) sourceControlSyncJobListResultPreparer(ctx context.Context) (*http.Request, error) { - if !scsjlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(scsjlr.NextLink))) -} - -// SourceControlSyncJobListResultPage contains a page of SourceControlSyncJob values. -type SourceControlSyncJobListResultPage struct { - fn func(context.Context, SourceControlSyncJobListResult) (SourceControlSyncJobListResult, error) - scsjlr SourceControlSyncJobListResult -} - -// 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 *SourceControlSyncJobListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobListResultPage.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.scsjlr) - if err != nil { - return err - } - page.scsjlr = 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 *SourceControlSyncJobListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceControlSyncJobListResultPage) NotDone() bool { - return !page.scsjlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceControlSyncJobListResultPage) Response() SourceControlSyncJobListResult { - return page.scsjlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceControlSyncJobListResultPage) Values() []SourceControlSyncJob { - if page.scsjlr.IsEmpty() { - return nil - } - return *page.scsjlr.Value -} - -// Creates a new instance of the SourceControlSyncJobListResultPage type. -func NewSourceControlSyncJobListResultPage(cur SourceControlSyncJobListResult, getNextPage func(context.Context, SourceControlSyncJobListResult) (SourceControlSyncJobListResult, error)) SourceControlSyncJobListResultPage { - return SourceControlSyncJobListResultPage{ - fn: getNextPage, - scsjlr: cur, - } -} - -// SourceControlSyncJobProperties definition of source control sync job properties. -type SourceControlSyncJobProperties struct { - // SourceControlSyncJobID - The source control sync job id. - SourceControlSyncJobID *string `json:"sourceControlSyncJobId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - The provisioning state of the job. Possible values include: 'Completed', 'Failed', 'Running' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // StartTime - READ-ONLY; The start time of the job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the job. - EndTime *date.Time `json:"endTime,omitempty"` - // SyncType - The sync type. Possible values include: 'PartialSync', 'FullSync' - SyncType SyncType `json:"syncType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobProperties. -func (scsjp SourceControlSyncJobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjp.SourceControlSyncJobID != nil { - objectMap["sourceControlSyncJobId"] = scsjp.SourceControlSyncJobID - } - if scsjp.ProvisioningState != "" { - objectMap["provisioningState"] = scsjp.ProvisioningState - } - if scsjp.SyncType != "" { - objectMap["syncType"] = scsjp.SyncType - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStream definition of the source control sync job stream. -type SourceControlSyncJobStream struct { - // ID - READ-ONLY; Resource id. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobStreamProperties - The properties of the source control sync job stream. - *SourceControlSyncJobStreamProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStream. -func (scsjs SourceControlSyncJobStream) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjs.SourceControlSyncJobStreamProperties != nil { - objectMap["properties"] = scsjs.SourceControlSyncJobStreamProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobStream struct. -func (scsjs *SourceControlSyncJobStream) 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 - } - scsjs.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobStreamProperties SourceControlSyncJobStreamProperties - err = json.Unmarshal(*v, &sourceControlSyncJobStreamProperties) - if err != nil { - return err - } - scsjs.SourceControlSyncJobStreamProperties = &sourceControlSyncJobStreamProperties - } - } - } - - return nil -} - -// SourceControlSyncJobStreamByID definition of the source control sync job stream by id. -type SourceControlSyncJobStreamByID struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Resource id. - ID *string `json:"id,omitempty"` - // SourceControlSyncJobStreamByIDProperties - The properties of the source control sync job stream. - *SourceControlSyncJobStreamByIDProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamByID. -func (scsjsbi SourceControlSyncJobStreamByID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjsbi.SourceControlSyncJobStreamByIDProperties != nil { - objectMap["properties"] = scsjsbi.SourceControlSyncJobStreamByIDProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlSyncJobStreamByID struct. -func (scsjsbi *SourceControlSyncJobStreamByID) 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 - } - scsjsbi.ID = &ID - } - case "properties": - if v != nil { - var sourceControlSyncJobStreamByIDProperties SourceControlSyncJobStreamByIDProperties - err = json.Unmarshal(*v, &sourceControlSyncJobStreamByIDProperties) - if err != nil { - return err - } - scsjsbi.SourceControlSyncJobStreamByIDProperties = &sourceControlSyncJobStreamByIDProperties - } - } - } - - return nil -} - -// SourceControlSyncJobStreamByIDProperties definition of source control sync job stream by id properties. -type SourceControlSyncJobStreamByIDProperties struct { - // SourceControlSyncJobStreamID - The sync job stream id. - SourceControlSyncJobStreamID *string `json:"sourceControlSyncJobStreamId,omitempty"` - // Summary - The summary of the sync job stream. - Summary *string `json:"summary,omitempty"` - // Time - READ-ONLY; The time of the sync job stream. - Time *date.Time `json:"time,omitempty"` - // StreamType - The type of the sync job stream. Possible values include: 'StreamTypeError', 'StreamTypeOutput' - StreamType StreamType `json:"streamType,omitempty"` - // StreamText - The text of the sync job stream. - StreamText *string `json:"streamText,omitempty"` - // Value - The values of the job stream. - Value map[string]interface{} `json:"value"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamByIDProperties. -func (scsjsbip SourceControlSyncJobStreamByIDProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjsbip.SourceControlSyncJobStreamID != nil { - objectMap["sourceControlSyncJobStreamId"] = scsjsbip.SourceControlSyncJobStreamID - } - if scsjsbip.Summary != nil { - objectMap["summary"] = scsjsbip.Summary - } - if scsjsbip.StreamType != "" { - objectMap["streamType"] = scsjsbip.StreamType - } - if scsjsbip.StreamText != nil { - objectMap["streamText"] = scsjsbip.StreamText - } - if scsjsbip.Value != nil { - objectMap["value"] = scsjsbip.Value - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStreamProperties definition of source control sync job stream properties. -type SourceControlSyncJobStreamProperties struct { - // SourceControlSyncJobStreamID - The sync job stream id. - SourceControlSyncJobStreamID *string `json:"sourceControlSyncJobStreamId,omitempty"` - // Summary - The summary of the sync job stream. - Summary *string `json:"summary,omitempty"` - // Time - READ-ONLY; The time of the sync job stream. - Time *date.Time `json:"time,omitempty"` - // StreamType - The type of the sync job stream. Possible values include: 'StreamTypeError', 'StreamTypeOutput' - StreamType StreamType `json:"streamType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamProperties. -func (scsjsp SourceControlSyncJobStreamProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjsp.SourceControlSyncJobStreamID != nil { - objectMap["sourceControlSyncJobStreamId"] = scsjsp.SourceControlSyncJobStreamID - } - if scsjsp.Summary != nil { - objectMap["summary"] = scsjsp.Summary - } - if scsjsp.StreamType != "" { - objectMap["streamType"] = scsjsp.StreamType - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStreamsListBySyncJob the response model for the list source control sync job streams -// operation. -type SourceControlSyncJobStreamsListBySyncJob struct { - autorest.Response `json:"-"` - // Value - The list of source control sync job streams. - Value *[]SourceControlSyncJobStream `json:"value,omitempty"` - // NextLink - READ-ONLY; The next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlSyncJobStreamsListBySyncJob. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scsjslbsj.Value != nil { - objectMap["value"] = scsjslbsj.Value - } - return json.Marshal(objectMap) -} - -// SourceControlSyncJobStreamsListBySyncJobIterator provides access to a complete listing of -// SourceControlSyncJobStream values. -type SourceControlSyncJobStreamsListBySyncJobIterator struct { - i int - page SourceControlSyncJobStreamsListBySyncJobPage -} - -// 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 *SourceControlSyncJobStreamsListBySyncJobIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsListBySyncJobIterator.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 *SourceControlSyncJobStreamsListBySyncJobIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceControlSyncJobStreamsListBySyncJobIterator) 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 SourceControlSyncJobStreamsListBySyncJobIterator) Response() SourceControlSyncJobStreamsListBySyncJob { - 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 SourceControlSyncJobStreamsListBySyncJobIterator) Value() SourceControlSyncJobStream { - if !iter.page.NotDone() { - return SourceControlSyncJobStream{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceControlSyncJobStreamsListBySyncJobIterator type. -func NewSourceControlSyncJobStreamsListBySyncJobIterator(page SourceControlSyncJobStreamsListBySyncJobPage) SourceControlSyncJobStreamsListBySyncJobIterator { - return SourceControlSyncJobStreamsListBySyncJobIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) IsEmpty() bool { - return scsjslbsj.Value == nil || len(*scsjslbsj.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) hasNextLink() bool { - return scsjslbsj.NextLink != nil && len(*scsjslbsj.NextLink) != 0 -} - -// sourceControlSyncJobStreamsListBySyncJobPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (scsjslbsj SourceControlSyncJobStreamsListBySyncJob) sourceControlSyncJobStreamsListBySyncJobPreparer(ctx context.Context) (*http.Request, error) { - if !scsjslbsj.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(scsjslbsj.NextLink))) -} - -// SourceControlSyncJobStreamsListBySyncJobPage contains a page of SourceControlSyncJobStream values. -type SourceControlSyncJobStreamsListBySyncJobPage struct { - fn func(context.Context, SourceControlSyncJobStreamsListBySyncJob) (SourceControlSyncJobStreamsListBySyncJob, error) - scsjslbsj SourceControlSyncJobStreamsListBySyncJob -} - -// 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 *SourceControlSyncJobStreamsListBySyncJobPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsListBySyncJobPage.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.scsjslbsj) - if err != nil { - return err - } - page.scsjslbsj = 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 *SourceControlSyncJobStreamsListBySyncJobPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceControlSyncJobStreamsListBySyncJobPage) NotDone() bool { - return !page.scsjslbsj.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceControlSyncJobStreamsListBySyncJobPage) Response() SourceControlSyncJobStreamsListBySyncJob { - return page.scsjslbsj -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceControlSyncJobStreamsListBySyncJobPage) Values() []SourceControlSyncJobStream { - if page.scsjslbsj.IsEmpty() { - return nil - } - return *page.scsjslbsj.Value -} - -// Creates a new instance of the SourceControlSyncJobStreamsListBySyncJobPage type. -func NewSourceControlSyncJobStreamsListBySyncJobPage(cur SourceControlSyncJobStreamsListBySyncJob, getNextPage func(context.Context, SourceControlSyncJobStreamsListBySyncJob) (SourceControlSyncJobStreamsListBySyncJob, error)) SourceControlSyncJobStreamsListBySyncJobPage { - return SourceControlSyncJobStreamsListBySyncJobPage{ - fn: getNextPage, - scsjslbsj: cur, - } -} - -// SourceControlUpdateParameters the parameters supplied to the update source control operation. -type SourceControlUpdateParameters struct { - // SourceControlUpdateProperties - The value of the source control. - *SourceControlUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceControlUpdateParameters. -func (scup SourceControlUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scup.SourceControlUpdateProperties != nil { - objectMap["properties"] = scup.SourceControlUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SourceControlUpdateParameters struct. -func (scup *SourceControlUpdateParameters) 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 sourceControlUpdateProperties SourceControlUpdateProperties - err = json.Unmarshal(*v, &sourceControlUpdateProperties) - if err != nil { - return err - } - scup.SourceControlUpdateProperties = &sourceControlUpdateProperties - } - } - } - - return nil -} - -// SourceControlUpdateProperties the properties of the update source control -type SourceControlUpdateProperties struct { - // Branch - The repo branch of the source control. - Branch *string `json:"branch,omitempty"` - // FolderPath - The folder path of the source control. Path must be relative. - FolderPath *string `json:"folderPath,omitempty"` - // AutoSync - The auto sync of the source control. Default is false. - AutoSync *bool `json:"autoSync,omitempty"` - // PublishRunbook - The auto publish of the source control. Default is true. - PublishRunbook *bool `json:"publishRunbook,omitempty"` - // SecurityToken - The authorization token for the repo of the source control. - SecurityToken *SourceControlSecurityTokenProperties `json:"securityToken,omitempty"` - // Description - The user description of the source control. - Description *string `json:"description,omitempty"` -} - -// Statistics definition of the statistic. -type Statistics struct { - // CounterProperty - READ-ONLY; Gets the property value of the statistic. - CounterProperty *string `json:"counterProperty,omitempty"` - // CounterValue - READ-ONLY; Gets the value of the statistic. - CounterValue *int64 `json:"counterValue,omitempty"` - // StartTime - READ-ONLY; Gets the startTime of the statistic. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the endTime of the statistic. - EndTime *date.Time `json:"endTime,omitempty"` - // ID - READ-ONLY; Gets the id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for Statistics. -func (s Statistics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StatisticsListResult the response model for the list statistics operation. -type StatisticsListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of statistics. - Value *[]Statistics `json:"value,omitempty"` -} - -// String ... -type String struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// TagSettingsProperties tag filter information for the VM. -type TagSettingsProperties struct { - // Tags - Dictionary of tags with its list of values. - Tags map[string][]string `json:"tags"` - // FilterOperator - Filter VMs by Any or All specified tags. Possible values include: 'TagOperatorsAll', 'TagOperatorsAny' - FilterOperator TagOperators `json:"filterOperator,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagSettingsProperties. -func (tsp TagSettingsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsp.Tags != nil { - objectMap["tags"] = tsp.Tags - } - if tsp.FilterOperator != "" { - objectMap["filterOperator"] = tsp.FilterOperator - } - return json.Marshal(objectMap) -} - -// TargetProperties group specific to the update configuration. -type TargetProperties struct { - // AzureQueries - List of Azure queries in the software update configuration. - AzureQueries *[]AzureQueryProperties `json:"azureQueries,omitempty"` - // NonAzureQueries - List of non Azure queries in the software update configuration. - NonAzureQueries *[]NonAzureQueryProperties `json:"nonAzureQueries,omitempty"` -} - -// TaskProperties task properties of the software update configuration. -type TaskProperties struct { - // Parameters - Gets or sets the parameters of the task. - Parameters map[string]*string `json:"parameters"` - // Source - Gets or sets the name of the runbook. - Source *string `json:"source,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskProperties. -func (tp TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.Parameters != nil { - objectMap["parameters"] = tp.Parameters - } - if tp.Source != nil { - objectMap["source"] = tp.Source - } - return json.Marshal(objectMap) -} - -// TestJob definition of the test job. -type TestJob struct { - autorest.Response `json:"-"` - // CreationTime - Gets or sets the creation time of the test job. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Status - Gets or sets the status of the test job. - Status *string `json:"status,omitempty"` - // StatusDetails - Gets or sets the status details of the test job. - StatusDetails *string `json:"statusDetails,omitempty"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` - // StartTime - Gets or sets the start time of the test job. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Gets or sets the end time of the test job. - EndTime *date.Time `json:"endTime,omitempty"` - // Exception - Gets or sets the exception of the test job. - Exception *string `json:"exception,omitempty"` - // LastModifiedTime - Gets or sets the last modified time of the test job. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastStatusModifiedTime - Gets or sets the last status modified time of the test job. - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - // Parameters - Gets or sets the parameters of the test job. - Parameters map[string]*string `json:"parameters"` - // LogActivityTrace - The activity-level tracing options of the runbook. - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// MarshalJSON is the custom marshaler for TestJob. -func (tj TestJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tj.CreationTime != nil { - objectMap["creationTime"] = tj.CreationTime - } - if tj.Status != nil { - objectMap["status"] = tj.Status - } - if tj.StatusDetails != nil { - objectMap["statusDetails"] = tj.StatusDetails - } - if tj.RunOn != nil { - objectMap["runOn"] = tj.RunOn - } - if tj.StartTime != nil { - objectMap["startTime"] = tj.StartTime - } - if tj.EndTime != nil { - objectMap["endTime"] = tj.EndTime - } - if tj.Exception != nil { - objectMap["exception"] = tj.Exception - } - if tj.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = tj.LastModifiedTime - } - if tj.LastStatusModifiedTime != nil { - objectMap["lastStatusModifiedTime"] = tj.LastStatusModifiedTime - } - if tj.Parameters != nil { - objectMap["parameters"] = tj.Parameters - } - if tj.LogActivityTrace != nil { - objectMap["logActivityTrace"] = tj.LogActivityTrace - } - return json.Marshal(objectMap) -} - -// TestJobCreateParameters the parameters supplied to the create test job operation. -type TestJobCreateParameters struct { - // Parameters - Gets or sets the parameters of the test job. - Parameters map[string]*string `json:"parameters"` - // RunOn - Gets or sets the runOn which specifies the group name where the job is to be executed. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for TestJobCreateParameters. -func (tjcp TestJobCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tjcp.Parameters != nil { - objectMap["parameters"] = tjcp.Parameters - } - if tjcp.RunOn != nil { - objectMap["runOn"] = tjcp.RunOn - } - return json.Marshal(objectMap) -} - -// TrackedResource the resource model definition for a ARM tracked top level resource -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// 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) -} - -// TypeField information about a field of a type. -type TypeField struct { - // Name - Gets or sets the name of the field. - Name *string `json:"name,omitempty"` - // Type - Gets or sets the type of the field. - Type *string `json:"type,omitempty"` -} - -// TypeFieldListResult the response model for the list fields operation. -type TypeFieldListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of fields. - Value *[]TypeField `json:"value,omitempty"` -} - -// UpdateConfiguration update specific properties of the software update configuration. -type UpdateConfiguration struct { - // OperatingSystem - operating system of target machines. Possible values include: 'Windows', 'Linux' - OperatingSystem OperatingSystemType `json:"operatingSystem,omitempty"` - // Windows - Windows specific update configuration. - Windows *WindowsProperties `json:"windows,omitempty"` - // Linux - Linux specific update configuration. - Linux *LinuxProperties `json:"linux,omitempty"` - // Duration - Maximum time allowed for the software update configuration run. Duration needs to be specified using the format PT[n]H[n]M[n]S as per ISO8601 - Duration *string `json:"duration,omitempty"` - // AzureVirtualMachines - List of azure resource Ids for azure virtual machines targeted by the software update configuration. - AzureVirtualMachines *[]string `json:"azureVirtualMachines,omitempty"` - // NonAzureComputerNames - List of names of non-azure machines targeted by the software update configuration. - NonAzureComputerNames *[]string `json:"nonAzureComputerNames,omitempty"` - // Targets - Group targets for the software update configuration. - Targets *TargetProperties `json:"targets,omitempty"` -} - -// UpdateConfigurationMachineRunProperties software update configuration machine run properties. -type UpdateConfigurationMachineRunProperties struct { - // TargetComputer - READ-ONLY; name of the updated computer - TargetComputer *string `json:"targetComputer,omitempty"` - // TargetComputerType - READ-ONLY; type of the updated computer. - TargetComputerType *string `json:"targetComputerType,omitempty"` - // SoftwareUpdateConfiguration - software update configuration triggered this run - SoftwareUpdateConfiguration *UpdateConfigurationNavigation `json:"softwareUpdateConfiguration,omitempty"` - // Status - READ-ONLY; Status of the software update configuration machine run. - Status *string `json:"status,omitempty"` - // OsType - READ-ONLY; Operating system target of the software update configuration triggered this run - OsType *string `json:"osType,omitempty"` - // CorrelationID - READ-ONLY; correlation id of the software update configuration machine run - CorrelationID *uuid.UUID `json:"correlationId,omitempty"` - // SourceComputerID - READ-ONLY; source computer id of the software update configuration machine run - SourceComputerID *uuid.UUID `json:"sourceComputerId,omitempty"` - // StartTime - READ-ONLY; Start time of the software update configuration machine run. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; End time of the software update configuration machine run. - EndTime *date.Time `json:"endTime,omitempty"` - // ConfiguredDuration - READ-ONLY; configured duration for the software update configuration run. - ConfiguredDuration *string `json:"configuredDuration,omitempty"` - // Job - Job associated with the software update configuration machine run - Job *JobNavigation `json:"job,omitempty"` - // CreationTime - READ-ONLY; Creation time of the resource, which only appears in the response. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CreatedBy - READ-ONLY; createdBy property, which only appears in the response. - CreatedBy *string `json:"createdBy,omitempty"` - // LastModifiedTime - READ-ONLY; Last time resource was modified, which only appears in the response. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; lastModifiedBy property, which only appears in the response. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Error - Details of provisioning error - Error *ErrorResponse `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpdateConfigurationMachineRunProperties. -func (ucmrp UpdateConfigurationMachineRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucmrp.SoftwareUpdateConfiguration != nil { - objectMap["softwareUpdateConfiguration"] = ucmrp.SoftwareUpdateConfiguration - } - if ucmrp.Job != nil { - objectMap["job"] = ucmrp.Job - } - if ucmrp.Error != nil { - objectMap["error"] = ucmrp.Error - } - return json.Marshal(objectMap) -} - -// UpdateConfigurationNavigation software update configuration Run Navigation model. -type UpdateConfigurationNavigation struct { - // Name - READ-ONLY; Name of the software update configuration triggered the software update configuration run - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpdateConfigurationNavigation. -func (ucn UpdateConfigurationNavigation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Usage definition of Usage. -type Usage struct { - // ID - Gets or sets the id of the resource. - ID *string `json:"id,omitempty"` - // Name - Gets or sets the usage counter name. - Name *UsageCounterName `json:"name,omitempty"` - // Unit - Gets or sets the usage unit name. - Unit *string `json:"unit,omitempty"` - // CurrentValue - Gets or sets the current usage value. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - Gets or sets max limit. -1 for unlimited - Limit *int64 `json:"limit,omitempty"` - // ThrottleStatus - Gets or sets the throttle status. - ThrottleStatus *string `json:"throttleStatus,omitempty"` -} - -// UsageCounterName definition of usage counter name. -type UsageCounterName struct { - // Value - Gets or sets the usage counter name. - Value *string `json:"value,omitempty"` - // LocalizedValue - Gets or sets the localized usage counter name. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// UsageListResult the response model for the get usage operation. -type UsageListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets usage. - Value *[]Usage `json:"value,omitempty"` -} - -// Variable definition of the variable. -type Variable struct { - autorest.Response `json:"-"` - // VariableProperties - Gets or sets the properties of the variable. - *VariableProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Variable. -func (vVar Variable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.VariableProperties != nil { - objectMap["properties"] = vVar.VariableProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Variable struct. -func (vVar *Variable) 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 variableProperties VariableProperties - err = json.Unmarshal(*v, &variableProperties) - if err != nil { - return err - } - vVar.VariableProperties = &variableProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vVar.Type = &typeVar - } - } - } - - return nil -} - -// VariableCreateOrUpdateParameters the parameters supplied to the create or update variable operation. -type VariableCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the variable. - Name *string `json:"name,omitempty"` - // VariableCreateOrUpdateProperties - Gets or sets the properties of the variable. - *VariableCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VariableCreateOrUpdateParameters. -func (vcoup VariableCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcoup.Name != nil { - objectMap["name"] = vcoup.Name - } - if vcoup.VariableCreateOrUpdateProperties != nil { - objectMap["properties"] = vcoup.VariableCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VariableCreateOrUpdateParameters struct. -func (vcoup *VariableCreateOrUpdateParameters) 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 - } - vcoup.Name = &name - } - case "properties": - if v != nil { - var variableCreateOrUpdateProperties VariableCreateOrUpdateProperties - err = json.Unmarshal(*v, &variableCreateOrUpdateProperties) - if err != nil { - return err - } - vcoup.VariableCreateOrUpdateProperties = &variableCreateOrUpdateProperties - } - } - } - - return nil -} - -// VariableCreateOrUpdateProperties the properties of the create variable operation. -type VariableCreateOrUpdateProperties struct { - // Value - Gets or sets the value of the variable. - Value *string `json:"value,omitempty"` - // Description - Gets or sets the description of the variable. - Description *string `json:"description,omitempty"` - // IsEncrypted - Gets or sets the encrypted flag of the variable. - IsEncrypted *bool `json:"isEncrypted,omitempty"` -} - -// VariableListResult the response model for the list variables operation. -type VariableListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of variables. - Value *[]Variable `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// VariableListResultIterator provides access to a complete listing of Variable values. -type VariableListResultIterator struct { - i int - page VariableListResultPage -} - -// 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 *VariableListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultIterator.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 *VariableListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VariableListResultIterator) 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 VariableListResultIterator) Response() VariableListResult { - 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 VariableListResultIterator) Value() Variable { - if !iter.page.NotDone() { - return Variable{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VariableListResultIterator type. -func NewVariableListResultIterator(page VariableListResultPage) VariableListResultIterator { - return VariableListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vlr VariableListResult) IsEmpty() bool { - return vlr.Value == nil || len(*vlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vlr VariableListResult) hasNextLink() bool { - return vlr.NextLink != nil && len(*vlr.NextLink) != 0 -} - -// variableListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vlr VariableListResult) variableListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vlr.NextLink))) -} - -// VariableListResultPage contains a page of Variable values. -type VariableListResultPage struct { - fn func(context.Context, VariableListResult) (VariableListResult, error) - vlr VariableListResult -} - -// 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 *VariableListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableListResultPage.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.vlr) - if err != nil { - return err - } - page.vlr = 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 *VariableListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VariableListResultPage) NotDone() bool { - return !page.vlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VariableListResultPage) Response() VariableListResult { - return page.vlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VariableListResultPage) Values() []Variable { - if page.vlr.IsEmpty() { - return nil - } - return *page.vlr.Value -} - -// Creates a new instance of the VariableListResultPage type. -func NewVariableListResultPage(cur VariableListResult, getNextPage func(context.Context, VariableListResult) (VariableListResult, error)) VariableListResultPage { - return VariableListResultPage{ - fn: getNextPage, - vlr: cur, - } -} - -// VariableProperties definition of the variable properties -type VariableProperties struct { - // Value - Gets or sets the value of the variable. - Value *string `json:"value,omitempty"` - // IsEncrypted - Gets or sets the encrypted flag of the variable. - IsEncrypted *bool `json:"isEncrypted,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// VariableUpdateParameters the parameters supplied to the update variable operation. -type VariableUpdateParameters struct { - // Name - Gets or sets the name of the variable. - Name *string `json:"name,omitempty"` - // VariableUpdateProperties - Gets or sets the value of the variable. - *VariableUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VariableUpdateParameters. -func (vup VariableUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vup.Name != nil { - objectMap["name"] = vup.Name - } - if vup.VariableUpdateProperties != nil { - objectMap["properties"] = vup.VariableUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VariableUpdateParameters struct. -func (vup *VariableUpdateParameters) 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 - } - vup.Name = &name - } - case "properties": - if v != nil { - var variableUpdateProperties VariableUpdateProperties - err = json.Unmarshal(*v, &variableUpdateProperties) - if err != nil { - return err - } - vup.VariableUpdateProperties = &variableUpdateProperties - } - } - } - - return nil -} - -// VariableUpdateProperties the properties of the update variable -type VariableUpdateProperties struct { - // Value - Gets or sets the value of the variable. - Value *string `json:"value,omitempty"` - // Description - Gets or sets the description of the variable. - Description *string `json:"description,omitempty"` -} - -// Watcher definition of the watcher type. -type Watcher struct { - autorest.Response `json:"-"` - // WatcherProperties - Gets or sets the watcher properties. - *WatcherProperties `json:"properties,omitempty"` - // Etag - Gets or sets the etag of the resource. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The Azure Region where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Watcher. -func (w Watcher) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WatcherProperties != nil { - objectMap["properties"] = w.WatcherProperties - } - 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 Watcher struct. -func (w *Watcher) 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 watcherProperties WatcherProperties - err = json.Unmarshal(*v, &watcherProperties) - if err != nil { - return err - } - w.WatcherProperties = &watcherProperties - } - case "etag": - if v != nil { - var etag 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 -} - -// WatcherListResult the response model for the list watcher operation. -type WatcherListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of watchers. - Value *[]Watcher `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// WatcherListResultIterator provides access to a complete listing of Watcher values. -type WatcherListResultIterator struct { - i int - page WatcherListResultPage -} - -// 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 *WatcherListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherListResultIterator.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 *WatcherListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WatcherListResultIterator) 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 WatcherListResultIterator) Response() WatcherListResult { - 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 WatcherListResultIterator) Value() Watcher { - if !iter.page.NotDone() { - return Watcher{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WatcherListResultIterator type. -func NewWatcherListResultIterator(page WatcherListResultPage) WatcherListResultIterator { - return WatcherListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WatcherListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WatcherListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// watcherListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WatcherListResult) watcherListResultPreparer(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))) -} - -// WatcherListResultPage contains a page of Watcher values. -type WatcherListResultPage struct { - fn func(context.Context, WatcherListResult) (WatcherListResult, error) - wlr WatcherListResult -} - -// 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 *WatcherListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherListResultPage.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 *WatcherListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WatcherListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WatcherListResultPage) Response() WatcherListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WatcherListResultPage) Values() []Watcher { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WatcherListResultPage type. -func NewWatcherListResultPage(cur WatcherListResult, getNextPage func(context.Context, WatcherListResult) (WatcherListResult, error)) WatcherListResultPage { - return WatcherListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WatcherProperties definition of the watcher properties -type WatcherProperties struct { - // ExecutionFrequencyInSeconds - Gets or sets the frequency at which the watcher is invoked. - ExecutionFrequencyInSeconds *int64 `json:"executionFrequencyInSeconds,omitempty"` - // ScriptName - Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook. - ScriptName *string `json:"scriptName,omitempty"` - // ScriptParameters - Gets or sets the parameters of the script. - ScriptParameters map[string]*string `json:"scriptParameters"` - // ScriptRunOn - Gets or sets the name of the hybrid worker group the watcher will run on. - ScriptRunOn *string `json:"scriptRunOn,omitempty"` - // Status - READ-ONLY; Gets the current status of the watcher. - Status *string `json:"status,omitempty"` - // CreationTime - READ-ONLY; Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - READ-ONLY; Details of the user who last modified the watcher. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for WatcherProperties. -func (wp WatcherProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.ExecutionFrequencyInSeconds != nil { - objectMap["executionFrequencyInSeconds"] = wp.ExecutionFrequencyInSeconds - } - if wp.ScriptName != nil { - objectMap["scriptName"] = wp.ScriptName - } - if wp.ScriptParameters != nil { - objectMap["scriptParameters"] = wp.ScriptParameters - } - if wp.ScriptRunOn != nil { - objectMap["scriptRunOn"] = wp.ScriptRunOn - } - if wp.Description != nil { - objectMap["description"] = wp.Description - } - return json.Marshal(objectMap) -} - -// WatcherUpdateParameters ... -type WatcherUpdateParameters struct { - // WatcherUpdateProperties - Gets or sets the watcher update properties. - *WatcherUpdateProperties `json:"properties,omitempty"` - // Name - Gets or sets the name of the resource. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for WatcherUpdateParameters. -func (wup WatcherUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.WatcherUpdateProperties != nil { - objectMap["properties"] = wup.WatcherUpdateProperties - } - if wup.Name != nil { - objectMap["name"] = wup.Name - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WatcherUpdateParameters struct. -func (wup *WatcherUpdateParameters) 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 watcherUpdateProperties WatcherUpdateProperties - err = json.Unmarshal(*v, &watcherUpdateProperties) - if err != nil { - return err - } - wup.WatcherUpdateProperties = &watcherUpdateProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wup.Name = &name - } - } - } - - return nil -} - -// WatcherUpdateProperties the properties of the update watcher operation. -type WatcherUpdateProperties struct { - // ExecutionFrequencyInSeconds - Gets or sets the frequency at which the watcher is invoked. - ExecutionFrequencyInSeconds *int64 `json:"executionFrequencyInSeconds,omitempty"` -} - -// Webhook definition of the webhook type. -type Webhook struct { - autorest.Response `json:"-"` - // WebhookProperties - Gets or sets the webhook properties. - *WebhookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for 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"` -} - -// MarshalJSON is the custom marshaler for Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WebhookProperties != nil { - objectMap["properties"] = w.WebhookProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Webhook struct. -func (w *Webhook) 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 webhookProperties WebhookProperties - err = json.Unmarshal(*v, &webhookProperties) - if err != nil { - return err - } - w.WebhookProperties = &webhookProperties - } - 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 -} - -// WebhookCreateOrUpdateParameters the parameters supplied to the create or update webhook operation. -type WebhookCreateOrUpdateParameters struct { - // Name - Gets or sets the name of the webhook. - Name *string `json:"name,omitempty"` - // WebhookCreateOrUpdateProperties - Gets or sets the properties of the webhook. - *WebhookCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateOrUpdateParameters. -func (wcoup WebhookCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcoup.Name != nil { - objectMap["name"] = wcoup.Name - } - if wcoup.WebhookCreateOrUpdateProperties != nil { - objectMap["properties"] = wcoup.WebhookCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookCreateOrUpdateParameters struct. -func (wcoup *WebhookCreateOrUpdateParameters) 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 - } - wcoup.Name = &name - } - case "properties": - if v != nil { - var webhookCreateOrUpdateProperties WebhookCreateOrUpdateProperties - err = json.Unmarshal(*v, &webhookCreateOrUpdateProperties) - if err != nil { - return err - } - wcoup.WebhookCreateOrUpdateProperties = &webhookCreateOrUpdateProperties - } - } - } - - return nil -} - -// WebhookCreateOrUpdateProperties the properties of the create webhook operation. -type WebhookCreateOrUpdateProperties struct { - // IsEnabled - Gets or sets the value of the enabled flag of webhook. - IsEnabled *bool `json:"isEnabled,omitempty"` - // URI - Gets or sets the uri. - URI *string `json:"uri,omitempty"` - // ExpiryTime - Gets or sets the expiry time. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // Runbook - Gets or sets the runbook. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the name of the hybrid worker group the webhook job will run on. - RunOn *string `json:"runOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateOrUpdateProperties. -func (wcoup WebhookCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcoup.IsEnabled != nil { - objectMap["isEnabled"] = wcoup.IsEnabled - } - if wcoup.URI != nil { - objectMap["uri"] = wcoup.URI - } - if wcoup.ExpiryTime != nil { - objectMap["expiryTime"] = wcoup.ExpiryTime - } - if wcoup.Parameters != nil { - objectMap["parameters"] = wcoup.Parameters - } - if wcoup.Runbook != nil { - objectMap["runbook"] = wcoup.Runbook - } - if wcoup.RunOn != nil { - objectMap["runOn"] = wcoup.RunOn - } - return json.Marshal(objectMap) -} - -// WebhookListResult the response model for the list webhook operation. -type WebhookListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets a list of webhooks. - Value *[]Webhook `json:"value,omitempty"` - // NextLink - Gets or sets the next link. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultIterator provides access to a complete listing of Webhook values. -type WebhookListResultIterator struct { - i int - page WebhookListResultPage -} - -// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { - 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 WebhookListResultIterator) Value() Webhook { - if !iter.page.NotDone() { - return Webhook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebhookListResultIterator type. -func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { - return WebhookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WebhookListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WebhookListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// webhookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WebhookListResult) webhookListResultPreparer(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))) -} - -// WebhookListResultPage contains a page of Webhook values. -type WebhookListResultPage struct { - fn func(context.Context, WebhookListResult) (WebhookListResult, error) - wlr WebhookListResult -} - -// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebhookListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebhookListResultPage) Response() WebhookListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebhookListResultPage) Values() []Webhook { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WebhookListResultPage type. -func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { - return WebhookListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WebhookProperties definition of the webhook properties -type WebhookProperties struct { - // IsEnabled - Gets or sets the value of the enabled flag of the webhook. - IsEnabled *bool `json:"isEnabled,omitempty"` - // URI - Gets or sets the webhook uri. - URI *string `json:"uri,omitempty"` - // ExpiryTime - Gets or sets the expiry time. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // LastInvokedTime - Gets or sets the last invoked time. - LastInvokedTime *date.Time `json:"lastInvokedTime,omitempty"` - // Parameters - Gets or sets the parameters of the job that is created when the webhook calls the runbook it is associated with. - Parameters map[string]*string `json:"parameters"` - // Runbook - Gets or sets the runbook the webhook is associated with. - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - // RunOn - Gets or sets the name of the hybrid worker group the webhook job will run on. - RunOn *string `json:"runOn,omitempty"` - // CreationTime - Gets or sets the creation time. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - Gets or sets the last modified time. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LastModifiedBy - Details of the user who last modified the Webhook - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Description - Gets or sets the description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookProperties. -func (wp WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.IsEnabled != nil { - objectMap["isEnabled"] = wp.IsEnabled - } - if wp.URI != nil { - objectMap["uri"] = wp.URI - } - if wp.ExpiryTime != nil { - objectMap["expiryTime"] = wp.ExpiryTime - } - if wp.LastInvokedTime != nil { - objectMap["lastInvokedTime"] = wp.LastInvokedTime - } - if wp.Parameters != nil { - objectMap["parameters"] = wp.Parameters - } - if wp.Runbook != nil { - objectMap["runbook"] = wp.Runbook - } - if wp.RunOn != nil { - objectMap["runOn"] = wp.RunOn - } - if wp.CreationTime != nil { - objectMap["creationTime"] = wp.CreationTime - } - if wp.LastModifiedTime != nil { - objectMap["lastModifiedTime"] = wp.LastModifiedTime - } - if wp.LastModifiedBy != nil { - objectMap["lastModifiedBy"] = wp.LastModifiedBy - } - if wp.Description != nil { - objectMap["description"] = wp.Description - } - return json.Marshal(objectMap) -} - -// WebhookUpdateParameters the parameters supplied to the update webhook operation. -type WebhookUpdateParameters struct { - // Name - Gets or sets the name of the webhook. - Name *string `json:"name,omitempty"` - // WebhookUpdateProperties - Gets or sets the value of the webhook. - *WebhookUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateParameters. -func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.Name != nil { - objectMap["name"] = wup.Name - } - if wup.WebhookUpdateProperties != nil { - objectMap["properties"] = wup.WebhookUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. -func (wup *WebhookUpdateParameters) 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 - } - wup.Name = &name - } - case "properties": - if v != nil { - var webhookUpdateProperties WebhookUpdateProperties - err = json.Unmarshal(*v, &webhookUpdateProperties) - if err != nil { - return err - } - wup.WebhookUpdateProperties = &webhookUpdateProperties - } - } - } - - return nil -} - -// WebhookUpdateProperties the properties of the update webhook. -type WebhookUpdateProperties struct { - // IsEnabled - Gets or sets the value of the enabled flag of webhook. - IsEnabled *bool `json:"isEnabled,omitempty"` - // RunOn - Gets or sets the name of the hybrid worker group the webhook job will run on. - RunOn *string `json:"runOn,omitempty"` - // Parameters - Gets or sets the parameters of the job. - Parameters map[string]*string `json:"parameters"` - // Description - Gets or sets the description of the webhook. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateProperties. -func (wup WebhookUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.IsEnabled != nil { - objectMap["isEnabled"] = wup.IsEnabled - } - if wup.RunOn != nil { - objectMap["runOn"] = wup.RunOn - } - if wup.Parameters != nil { - objectMap["parameters"] = wup.Parameters - } - if wup.Description != nil { - objectMap["description"] = wup.Description - } - return json.Marshal(objectMap) -} - -// WindowsProperties windows specific update configuration. -type WindowsProperties struct { - // IncludedUpdateClassifications - Update classification included in the software update configuration. A comma separated string with required values. Possible values include: 'WindowsUpdateClassesUnclassified', 'WindowsUpdateClassesCritical', 'WindowsUpdateClassesSecurity', 'WindowsUpdateClassesUpdateRollup', 'WindowsUpdateClassesFeaturePack', 'WindowsUpdateClassesServicePack', 'WindowsUpdateClassesDefinition', 'WindowsUpdateClassesTools', 'WindowsUpdateClassesUpdates' - IncludedUpdateClassifications WindowsUpdateClasses `json:"includedUpdateClassifications,omitempty"` - // ExcludedKbNumbers - KB numbers excluded from the software update configuration. - ExcludedKbNumbers *[]string `json:"excludedKbNumbers,omitempty"` - // IncludedKbNumbers - KB numbers included from the software update configuration. - IncludedKbNumbers *[]string `json:"includedKbNumbers,omitempty"` - // RebootSetting - Reboot setting for the software update configuration. - RebootSetting *string `json:"rebootSetting,omitempty"` -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/module.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/module.go deleted file mode 100644 index c7b8ebb8655a..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/module.go +++ /dev/null @@ -1,516 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ModuleClient is the automation Client -type ModuleClient struct { - BaseClient -} - -// NewModuleClient creates an instance of the ModuleClient client. -func NewModuleClient(subscriptionID string) ModuleClient { - return NewModuleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewModuleClientWithBaseURI creates an instance of the ModuleClient 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 NewModuleClientWithBaseURI(baseURI string, subscriptionID string) ModuleClient { - return ModuleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// parameters - the create or update parameters for module. -func (client ModuleClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.ModuleClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, moduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ModuleClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) CreateOrUpdateResponder(resp *http.Response) (result Module, 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 module by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the module name. -func (client ModuleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ModuleClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ModuleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the module name. -func (client ModuleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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("automation.ModuleClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ModuleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) GetResponder(resp *http.Response) (result Module, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of modules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ModuleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.mlr.Response.Response != nil { - sc = result.mlr.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("automation.ModuleClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.mlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.mlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.mlr.hasNextLink() && result.mlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ModuleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ModuleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ModuleClient) ListByAutomationAccountResponder(resp *http.Response) (result ModuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ModuleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ModuleListResult) (result ModuleListResult, err error) { - req, err := lastResults.moduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ModuleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update the module identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// parameters - the update parameters for module. -func (client ModuleClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ModuleClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, moduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ModuleClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", 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 ModuleClient) 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 ModuleClient) UpdateResponder(resp *http.Response) (result Module, 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/automation/mgmt/2018-06-30-preview/automation/nodecountinformation.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/nodecountinformation.go deleted file mode 100644 index 37a58f221c3d..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/nodecountinformation.go +++ /dev/null @@ -1,119 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NodeCountInformationClient is the automation Client -type NodeCountInformationClient struct { - BaseClient -} - -// NewNodeCountInformationClient creates an instance of the NodeCountInformationClient client. -func NewNodeCountInformationClient(subscriptionID string) NodeCountInformationClient { - return NewNodeCountInformationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNodeCountInformationClientWithBaseURI creates an instance of the NodeCountInformationClient 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 NewNodeCountInformationClientWithBaseURI(baseURI string, subscriptionID string) NodeCountInformationClient { - return NodeCountInformationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve counts for Dsc Nodes. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// countType - the type of counts to retrieve -func (client NodeCountInformationClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, countType CountType) (result NodeCounts, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeCountInformationClient.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("automation.NodeCountInformationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, countType) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeCountInformationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeCountInformationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeCountInformationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NodeCountInformationClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, countType CountType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "countType": autorest.Encode("path", countType), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodecounts/{countType}", 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 NodeCountInformationClient) 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 NodeCountInformationClient) GetResponder(resp *http.Response) (result NodeCounts, 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/automation/mgmt/2018-06-30-preview/automation/nodereports.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/nodereports.go deleted file mode 100644 index 7b83fcc63168..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/nodereports.go +++ /dev/null @@ -1,340 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NodeReportsClient is the automation Client -type NodeReportsClient struct { - BaseClient -} - -// NewNodeReportsClient creates an instance of the NodeReportsClient client. -func NewNodeReportsClient(subscriptionID string) NodeReportsClient { - return NewNodeReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNodeReportsClientWithBaseURI creates an instance of the NodeReportsClient 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 NewNodeReportsClientWithBaseURI(baseURI string, subscriptionID string) NodeReportsClient { - return NodeReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the Dsc node report data by node id and report id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the Dsc node id. -// reportID - the report id. -func (client NodeReportsClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result DscNodeReport, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.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("automation.NodeReportsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, nodeID, reportID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NodeReportsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}", 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 NodeReportsClient) 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 NodeReportsClient) GetResponder(resp *http.Response) (result DscNodeReport, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the Dsc node reports by node id and report id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the Dsc node id. -// reportID - the report id. -func (client NodeReportsClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result SetObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.GetContent") - 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("automation.NodeReportsClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, nodeID, reportID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client NodeReportsClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client NodeReportsClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client NodeReportsClient) GetContentResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByNode retrieve the Dsc node report list by node id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// nodeID - the parameters supplied to the list operation. -// filter - the filter to apply on the operation. -func (client NodeReportsClient) ListByNode(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result DscNodeReportListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.ListByNode") - defer func() { - sc := -1 - if result.dnrlr.Response.Response != nil { - sc = result.dnrlr.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("automation.NodeReportsClient", "ListByNode", err.Error()) - } - - result.fn = client.listByNodeNextResults - req, err := client.ListByNodePreparer(ctx, resourceGroupName, automationAccountName, nodeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNodeSender(req) - if err != nil { - result.dnrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure sending request") - return - } - - result.dnrlr, err = client.ListByNodeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure responding to request") - return - } - if result.dnrlr.hasNextLink() && result.dnrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByNodePreparer prepares the ListByNode request. -func (client NodeReportsClient) ListByNodePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNodeSender sends the ListByNode request. The method will close the -// http.Response Body if it receives an error. -func (client NodeReportsClient) ListByNodeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNodeResponder handles the response to the ListByNode request. The method always -// closes the http.Response Body. -func (client NodeReportsClient) ListByNodeResponder(resp *http.Response) (result DscNodeReportListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByNodeNextResults retrieves the next set of results, if any. -func (client NodeReportsClient) listByNodeNextResults(ctx context.Context, lastResults DscNodeReportListResult) (result DscNodeReportListResult, err error) { - req, err := lastResults.dscNodeReportListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "listByNodeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByNodeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "listByNodeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByNodeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "listByNodeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByNodeComplete enumerates all values, automatically crossing page boundaries as required. -func (client NodeReportsClient) ListByNodeComplete(ctx context.Context, resourceGroupName string, automationAccountName string, nodeID string, filter string) (result DscNodeReportListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NodeReportsClient.ListByNode") - 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.ListByNode(ctx, resourceGroupName, automationAccountName, nodeID, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/objectdatatypes.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/objectdatatypes.go deleted file mode 100644 index 7335603abd67..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/objectdatatypes.go +++ /dev/null @@ -1,206 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ObjectDataTypesClient is the automation Client -type ObjectDataTypesClient struct { - BaseClient -} - -// NewObjectDataTypesClient creates an instance of the ObjectDataTypesClient client. -func NewObjectDataTypesClient(subscriptionID string) ObjectDataTypesClient { - return NewObjectDataTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewObjectDataTypesClientWithBaseURI creates an instance of the ObjectDataTypesClient 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 NewObjectDataTypesClientWithBaseURI(baseURI string, subscriptionID string) ObjectDataTypesClient { - return ObjectDataTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListFieldsByModuleAndType retrieve a list of fields of a given type identified by module name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// moduleName - the name of module. -// typeName - the name of type. -func (client ObjectDataTypesClient) ListFieldsByModuleAndType(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ObjectDataTypesClient.ListFieldsByModuleAndType") - 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("automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", err.Error()) - } - - req, err := client.ListFieldsByModuleAndTypePreparer(ctx, resourceGroupName, automationAccountName, moduleName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", nil, "Failure preparing request") - return - } - - resp, err := client.ListFieldsByModuleAndTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure sending request") - return - } - - result, err = client.ListFieldsByModuleAndTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure responding to request") - return - } - - return -} - -// ListFieldsByModuleAndTypePreparer prepares the ListFieldsByModuleAndType request. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListFieldsByModuleAndTypeSender sends the ListFieldsByModuleAndType request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListFieldsByModuleAndTypeResponder handles the response to the ListFieldsByModuleAndType request. The method always -// closes the http.Response Body. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeResponder(resp *http.Response) (result TypeFieldListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListFieldsByType retrieve a list of fields of a given type across all accessible modules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// typeName - the name of type. -func (client ObjectDataTypesClient) ListFieldsByType(ctx context.Context, resourceGroupName string, automationAccountName string, typeName string) (result TypeFieldListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ObjectDataTypesClient.ListFieldsByType") - 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("automation.ObjectDataTypesClient", "ListFieldsByType", err.Error()) - } - - req, err := client.ListFieldsByTypePreparer(ctx, resourceGroupName, automationAccountName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListFieldsByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure sending request") - return - } - - result, err = client.ListFieldsByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure responding to request") - return - } - - return -} - -// ListFieldsByTypePreparer prepares the ListFieldsByType request. -func (client ObjectDataTypesClient) ListFieldsByTypePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListFieldsByTypeSender sends the ListFieldsByType request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectDataTypesClient) ListFieldsByTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListFieldsByTypeResponder handles the response to the ListFieldsByType request. The method always -// closes the http.Response Body. -func (client ObjectDataTypesClient) ListFieldsByTypeResponder(resp *http.Response) (result TypeFieldListResult, 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/automation/mgmt/2018-06-30-preview/automation/operations.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/operations.go deleted file mode 100644 index 9b49ff7699af..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation 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 Automation REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Automation/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 -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/python2package.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/python2package.go deleted file mode 100644 index 25a0e6465c46..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/python2package.go +++ /dev/null @@ -1,516 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// Python2PackageClient is the automation Client -type Python2PackageClient struct { - BaseClient -} - -// NewPython2PackageClient creates an instance of the Python2PackageClient client. -func NewPython2PackageClient(subscriptionID string) Python2PackageClient { - return NewPython2PackageClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPython2PackageClientWithBaseURI creates an instance of the Python2PackageClient 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 NewPython2PackageClientWithBaseURI(baseURI string, subscriptionID string) Python2PackageClient { - return Python2PackageClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update the python 2 package identified by package name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// packageName - the name of python package. -// parameters - the create or update parameters for python package. -func (client Python2PackageClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string, parameters PythonPackageCreateParameters) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Python2PackageClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PythonPackageCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.PythonPackageCreateProperties.ContentLink", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.PythonPackageCreateProperties.ContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PythonPackageCreateProperties.ContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PythonPackageCreateProperties.ContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.Python2PackageClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, packageName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client Python2PackageClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string, parameters PythonPackageCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "packageName": autorest.Encode("path", packageName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - 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.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}", 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 Python2PackageClient) 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 Python2PackageClient) CreateOrUpdateResponder(resp *http.Response) (result Module, 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 python 2 package by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// packageName - the python package name. -func (client Python2PackageClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Python2PackageClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.Python2PackageClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, packageName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client Python2PackageClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "packageName": autorest.Encode("path", packageName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}", 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 Python2PackageClient) 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 Python2PackageClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the python 2 package identified by package name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// packageName - the python package name. -func (client Python2PackageClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Python2PackageClient.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("automation.Python2PackageClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, packageName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client Python2PackageClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "packageName": autorest.Encode("path", packageName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}", 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 Python2PackageClient) 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 Python2PackageClient) GetResponder(resp *http.Response) (result Module, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of python 2 packages. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client Python2PackageClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Python2PackageClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.mlr.Response.Response != nil { - sc = result.mlr.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("automation.Python2PackageClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.mlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.mlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.mlr.hasNextLink() && result.mlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client Python2PackageClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client Python2PackageClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client Python2PackageClient) ListByAutomationAccountResponder(resp *http.Response) (result ModuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client Python2PackageClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ModuleListResult) (result ModuleListResult, err error) { - req, err := lastResults.moduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.Python2PackageClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.Python2PackageClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client Python2PackageClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Python2PackageClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update the python 2 package identified by package name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// packageName - the name of python package. -// parameters - the update parameters for python package. -func (client Python2PackageClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string, parameters PythonPackageUpdateParameters) (result Module, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Python2PackageClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.Python2PackageClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, packageName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.Python2PackageClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client Python2PackageClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, packageName string, parameters PythonPackageUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "packageName": autorest.Encode("path", packageName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - 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.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}", 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 Python2PackageClient) 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 Python2PackageClient) UpdateResponder(resp *http.Response) (result Module, 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/automation/mgmt/2018-06-30-preview/automation/runbook.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/runbook.go deleted file mode 100644 index d6727e0dbcc5..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/runbook.go +++ /dev/null @@ -1,698 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RunbookClient is the automation Client -type RunbookClient struct { - BaseClient -} - -// NewRunbookClient creates an instance of the RunbookClient client. -func NewRunbookClient(subscriptionID string) RunbookClient { - return NewRunbookClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunbookClientWithBaseURI creates an instance of the RunbookClient 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 NewRunbookClientWithBaseURI(baseURI string, subscriptionID string) RunbookClient { - return RunbookClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// parameters - the create or update parameters for runbook. Provide either content link for a published -// runbook or draft, not both. -func (client RunbookClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (result Runbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("automation.RunbookClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RunbookClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) CreateOrUpdateResponder(resp *http.Response) (result Runbook, 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 runbook by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.RunbookClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RunbookClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) 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 the runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result Runbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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("automation.RunbookClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunbookClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) GetResponder(resp *http.Response) (result Runbook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the content of runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.GetContent") - 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("automation.RunbookClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client RunbookClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client RunbookClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of runbooks. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client RunbookClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result RunbookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.ListByAutomationAccount") - 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("automation.RunbookClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client RunbookClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client RunbookClient) ListByAutomationAccountResponder(resp *http.Response) (result RunbookListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client RunbookClient) listByAutomationAccountNextResults(ctx context.Context, lastResults RunbookListResult) (result RunbookListResult, err error) { - req, err := lastResults.runbookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client RunbookClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result RunbookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Publish publish runbook draft. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the parameters supplied to the publish runbook operation. -func (client RunbookClient) Publish(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result RunbookPublishFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.Publish") - 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("automation.RunbookClient", "Publish", err.Error()) - } - - req, err := client.PublishPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Publish", nil, "Failure preparing request") - return - } - - result, err = client.PublishSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Publish", result.Response(), "Failure sending request") - return - } - - return -} - -// PublishPreparer prepares the Publish request. -func (client RunbookClient) PublishPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/publish", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PublishSender sends the Publish request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) PublishSender(req *http.Request) (future RunbookPublishFuture, 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 -} - -// PublishResponder handles the response to the Publish request. The method always -// closes the http.Response Body. -func (client RunbookClient) PublishResponder(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 update the runbook identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// parameters - the update parameters for runbook. -func (client RunbookClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (result Runbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.RunbookClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RunbookClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", 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 RunbookClient) 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 RunbookClient) UpdateResponder(resp *http.Response) (result Runbook, 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/automation/mgmt/2018-06-30-preview/automation/runbookdraft.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/runbookdraft.go deleted file mode 100644 index 221d6347b4ef..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/runbookdraft.go +++ /dev/null @@ -1,382 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "io" - "net/http" -) - -// RunbookDraftClient is the automation Client -type RunbookDraftClient struct { - BaseClient -} - -// NewRunbookDraftClient creates an instance of the RunbookDraftClient client. -func NewRunbookDraftClient(subscriptionID string) RunbookDraftClient { - return NewRunbookDraftClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunbookDraftClientWithBaseURI creates an instance of the RunbookDraftClient 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 NewRunbookDraftClientWithBaseURI(baseURI string, subscriptionID string) RunbookDraftClient { - return RunbookDraftClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the runbook draft identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookDraftClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraft, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.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("automation.RunbookDraftClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunbookDraftClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft", 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 RunbookDraftClient) 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 RunbookDraftClient) GetResponder(resp *http.Response) (result RunbookDraft, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the content of runbook draft identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookDraftClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.GetContent") - 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("automation.RunbookDraftClient", "GetContent", err.Error()) - } - - req, err := client.GetContentPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure responding to request") - return - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client RunbookDraftClient) GetContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) GetContentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ReplaceContent replaces the runbook draft content. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// runbookContent - the runbook draft content. -func (client RunbookDraftClient) ReplaceContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser) (result RunbookDraftReplaceContentFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.ReplaceContent") - 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("automation.RunbookDraftClient", "ReplaceContent", err.Error()) - } - - req, err := client.ReplaceContentPreparer(ctx, resourceGroupName, automationAccountName, runbookName, runbookContent) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "ReplaceContent", nil, "Failure preparing request") - return - } - - result, err = client.ReplaceContentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "ReplaceContent", result.Response(), "Failure sending request") - return - } - - return -} - -// ReplaceContentPreparer prepares the ReplaceContent request. -func (client RunbookDraftClient) ReplaceContentPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("text/powershell"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), - autorest.WithFile(runbookContent), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReplaceContentSender sends the ReplaceContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) ReplaceContentSender(req *http.Request) (future RunbookDraftReplaceContentFuture, 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 -} - -// ReplaceContentResponder handles the response to the ReplaceContent request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) ReplaceContentResponder(resp *http.Response) (result ReadCloser, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UndoEdit undo draft edit to last known published state identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client RunbookDraftClient) UndoEdit(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraftUndoEditResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunbookDraftClient.UndoEdit") - 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("automation.RunbookDraftClient", "UndoEdit", err.Error()) - } - - req, err := client.UndoEditPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", nil, "Failure preparing request") - return - } - - resp, err := client.UndoEditSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure sending request") - return - } - - result, err = client.UndoEditResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure responding to request") - return - } - - return -} - -// UndoEditPreparer prepares the UndoEdit request. -func (client RunbookDraftClient) UndoEditPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UndoEditSender sends the UndoEdit request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) UndoEditSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UndoEditResponder handles the response to the UndoEdit request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) UndoEditResponder(resp *http.Response) (result RunbookDraftUndoEditResult, 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/automation/mgmt/2018-06-30-preview/automation/schedule.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/schedule.go deleted file mode 100644 index 18ebbd426e1c..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/schedule.go +++ /dev/null @@ -1,511 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ScheduleClient is the automation Client -type ScheduleClient struct { - BaseClient -} - -// NewScheduleClient creates an instance of the ScheduleClient client. -func NewScheduleClient(subscriptionID string) ScheduleClient { - return NewScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduleClientWithBaseURI creates an instance of the ScheduleClient 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 NewScheduleClientWithBaseURI(baseURI string, subscriptionID string) ScheduleClient { - return ScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a schedule. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -// parameters - the parameters supplied to the create or update schedule operation. -func (client ScheduleClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ScheduleCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ScheduleCreateOrUpdateProperties.StartTime", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("automation.ScheduleClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, scheduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduleClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the schedule identified by schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -func (client ScheduleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ScheduleClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, scheduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the schedule identified by schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -func (client ScheduleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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("automation.ScheduleClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, scheduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of schedules. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client ScheduleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ScheduleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.ListByAutomationAccount") - 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("automation.ScheduleClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ScheduleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result ScheduleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ScheduleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ScheduleListResult) (result ScheduleListResult, err error) { - req, err := lastResults.scheduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScheduleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ScheduleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update the schedule identified by schedule name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// scheduleName - the schedule name. -// parameters - the parameters supplied to the update schedule operation. -func (client ScheduleClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.ScheduleClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, scheduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduleClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", 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 ScheduleClient) 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 ScheduleClient) UpdateResponder(resp *http.Response) (result Schedule, 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/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurationmachineruns.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurationmachineruns.go deleted file mode 100644 index d566079f385a..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurationmachineruns.go +++ /dev/null @@ -1,228 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SoftwareUpdateConfigurationMachineRunsClient is the automation Client -type SoftwareUpdateConfigurationMachineRunsClient struct { - BaseClient -} - -// NewSoftwareUpdateConfigurationMachineRunsClient creates an instance of the -// SoftwareUpdateConfigurationMachineRunsClient client. -func NewSoftwareUpdateConfigurationMachineRunsClient(subscriptionID string) SoftwareUpdateConfigurationMachineRunsClient { - return NewSoftwareUpdateConfigurationMachineRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSoftwareUpdateConfigurationMachineRunsClientWithBaseURI creates an instance of the -// SoftwareUpdateConfigurationMachineRunsClient 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 NewSoftwareUpdateConfigurationMachineRunsClientWithBaseURI(baseURI string, subscriptionID string) SoftwareUpdateConfigurationMachineRunsClient { - return SoftwareUpdateConfigurationMachineRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByID get a single software update configuration machine run by Id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationMachineRunID - the Id of the software update configuration machine run. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationMachineRunID uuid.UUID, clientRequestID string) (result SoftwareUpdateConfigurationMachineRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationMachineRunsClient.GetByID") - 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("automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", err.Error()) - } - - req, err := client.GetByIDPreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunID, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByIDPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationMachineRunID uuid.UUID, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationMachineRunId": autorest.Encode("path", softwareUpdateConfigurationMachineRunID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns/{softwareUpdateConfigurationMachineRunId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client SoftwareUpdateConfigurationMachineRunsClient) GetByIDResponder(resp *http.Response) (result SoftwareUpdateConfigurationMachineRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List return list of software update configuration machine runs -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// clientRequestID - identifies this specific client request. -// filter - the filter to apply on the operation. You can use the following filters: 'properties/osType', -// 'properties/status', 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' -// skip - number of entries you skip before returning results -// top - maximum number of entries returned in the results collection -func (client SoftwareUpdateConfigurationMachineRunsClient) List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result SoftwareUpdateConfigurationMachineRunListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationMachineRunsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationMachineRunsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, automationAccountName, clientRequestID, filter, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationMachineRunsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SoftwareUpdateConfigurationMachineRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skip) > 0 { - queryParameters["$skip"] = autorest.Encode("query", skip) - } - if len(top) > 0 { - queryParameters["$top"] = autorest.Encode("query", top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationMachineRunsClient) 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 SoftwareUpdateConfigurationMachineRunsClient) ListResponder(resp *http.Response) (result SoftwareUpdateConfigurationMachineRunListResult, 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/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurationruns.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurationruns.go deleted file mode 100644 index 09e9220a07a8..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurationruns.go +++ /dev/null @@ -1,227 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SoftwareUpdateConfigurationRunsClient is the automation Client -type SoftwareUpdateConfigurationRunsClient struct { - BaseClient -} - -// NewSoftwareUpdateConfigurationRunsClient creates an instance of the SoftwareUpdateConfigurationRunsClient client. -func NewSoftwareUpdateConfigurationRunsClient(subscriptionID string) SoftwareUpdateConfigurationRunsClient { - return NewSoftwareUpdateConfigurationRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSoftwareUpdateConfigurationRunsClientWithBaseURI creates an instance of the SoftwareUpdateConfigurationRunsClient -// 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 NewSoftwareUpdateConfigurationRunsClientWithBaseURI(baseURI string, subscriptionID string) SoftwareUpdateConfigurationRunsClient { - return SoftwareUpdateConfigurationRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByID get a single software update configuration Run by Id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationRunID - the Id of the software update configuration run. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationRunsClient) GetByID(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationRunID uuid.UUID, clientRequestID string) (result SoftwareUpdateConfigurationRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationRunsClient.GetByID") - 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("automation.SoftwareUpdateConfigurationRunsClient", "GetByID", err.Error()) - } - - req, err := client.GetByIDPreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationRunID, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client SoftwareUpdateConfigurationRunsClient) GetByIDPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationRunID uuid.UUID, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationRunId": autorest.Encode("path", softwareUpdateConfigurationRunID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns/{softwareUpdateConfigurationRunId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client SoftwareUpdateConfigurationRunsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client SoftwareUpdateConfigurationRunsClient) GetByIDResponder(resp *http.Response) (result SoftwareUpdateConfigurationRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List return list of software update configuration runs -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// clientRequestID - identifies this specific client request. -// filter - the filter to apply on the operation. You can use the following filters: 'properties/osType', -// 'properties/status', 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' -// skip - number of entries you skip before returning results -// top - maximum number of entries returned in the results collection -func (client SoftwareUpdateConfigurationRunsClient) List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (result SoftwareUpdateConfigurationRunListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationRunsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationRunsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, automationAccountName, clientRequestID, filter, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationRunsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SoftwareUpdateConfigurationRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string, skip string, top string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skip) > 0 { - queryParameters["$skip"] = autorest.Encode("query", skip) - } - if len(top) > 0 { - queryParameters["$top"] = autorest.Encode("query", top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationRunsClient) 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 SoftwareUpdateConfigurationRunsClient) ListResponder(resp *http.Response) (result SoftwareUpdateConfigurationRunListResult, 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/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurations.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurations.go deleted file mode 100644 index 50de7018d6d1..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/softwareupdateconfigurations.go +++ /dev/null @@ -1,409 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SoftwareUpdateConfigurationsClient is the automation Client -type SoftwareUpdateConfigurationsClient struct { - BaseClient -} - -// NewSoftwareUpdateConfigurationsClient creates an instance of the SoftwareUpdateConfigurationsClient client. -func NewSoftwareUpdateConfigurationsClient(subscriptionID string) SoftwareUpdateConfigurationsClient { - return NewSoftwareUpdateConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSoftwareUpdateConfigurationsClientWithBaseURI creates an instance of the SoftwareUpdateConfigurationsClient -// 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 NewSoftwareUpdateConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SoftwareUpdateConfigurationsClient { - return SoftwareUpdateConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a new software update configuration with the name given in the URI. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationName - the name of the software update configuration to be created. -// parameters - request body. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationsClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, parameters SoftwareUpdateConfiguration, clientRequestID string) (result SoftwareUpdateConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SoftwareUpdateConfigurationProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SoftwareUpdateConfigurationProperties.UpdateConfiguration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SoftwareUpdateConfigurationProperties.ScheduleInfo", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SoftwareUpdateConfigurationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, parameters SoftwareUpdateConfiguration, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationName": autorest.Encode("path", softwareUpdateConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Name = nil - parameters.ID = nil - parameters.Type = 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationsClient) 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 SoftwareUpdateConfigurationsClient) CreateResponder(resp *http.Response) (result SoftwareUpdateConfiguration, 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 specific software update configuration. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationName - the name of the software update configuration to be created. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SoftwareUpdateConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationName": autorest.Encode("path", softwareUpdateConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationsClient) 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 SoftwareUpdateConfigurationsClient) 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 -} - -// GetByName get a single software update configuration by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// softwareUpdateConfigurationName - the name of the software update configuration to be created. -// clientRequestID - identifies this specific client request. -func (client SoftwareUpdateConfigurationsClient) GetByName(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (result SoftwareUpdateConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.GetByName") - 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("automation.SoftwareUpdateConfigurationsClient", "GetByName", err.Error()) - } - - req, err := client.GetByNamePreparer(ctx, resourceGroupName, automationAccountName, softwareUpdateConfigurationName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "GetByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "GetByName", resp, "Failure sending request") - return - } - - result, err = client.GetByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "GetByName", resp, "Failure responding to request") - return - } - - return -} - -// GetByNamePreparer prepares the GetByName request. -func (client SoftwareUpdateConfigurationsClient) GetByNamePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, softwareUpdateConfigurationName string, clientRequestID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "softwareUpdateConfigurationName": autorest.Encode("path", softwareUpdateConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByNameSender sends the GetByName request. The method will close the -// http.Response Body if it receives an error. -func (client SoftwareUpdateConfigurationsClient) GetByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByNameResponder handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (client SoftwareUpdateConfigurationsClient) GetByNameResponder(resp *http.Response) (result SoftwareUpdateConfiguration, 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 software update configurations for the account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// clientRequestID - identifies this specific client request. -// filter - the filter to apply on the operation. -func (client SoftwareUpdateConfigurationsClient) List(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string) (result SoftwareUpdateConfigurationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareUpdateConfigurationsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SoftwareUpdateConfigurationsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, automationAccountName, clientRequestID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SoftwareUpdateConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SoftwareUpdateConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, clientRequestID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(clientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("clientRequestId", autorest.String(clientRequestID))) - } - 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 SoftwareUpdateConfigurationsClient) 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 SoftwareUpdateConfigurationsClient) ListResponder(resp *http.Response) (result SoftwareUpdateConfigurationListResult, 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/automation/mgmt/2018-06-30-preview/automation/sourcecontrol.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrol.go deleted file mode 100644 index 4acf374adbb9..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrol.go +++ /dev/null @@ -1,528 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 automation Client -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)} -} - -// CreateOrUpdate create a source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// parameters - the parameters supplied to the create or update source control operation. -func (client SourceControlClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlCreateOrUpdateParameters) (result SourceControl, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.RepoURL", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.RepoURL", Name: validation.MaxLength, Rule: 2000, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.Branch", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.Branch", Name: validation.MaxLength, Rule: 255, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.FolderPath", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.FolderPath", Name: validation.MaxLength, Rule: 255, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.AccessToken", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.AccessToken", Name: validation.MaxLength, Rule: 1024, Chain: nil}}}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.RefreshToken", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.SecurityToken.RefreshToken", Name: validation.MaxLength, Rule: 1024, Chain: nil}}}, - }}, - {Target: "parameters.SourceControlCreateOrUpdateProperties.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SourceControlCreateOrUpdateProperties.Description", Name: validation.MaxLength, Rule: 512, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("automation.SourceControlClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SourceControlClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) CreateOrUpdateResponder(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 the source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the name of source control. -func (client SourceControlClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SourceControlClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SourceControlClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the source control identified by source control name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the name of source control. -func (client SourceControlClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (result SourceControl, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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("automation.SourceControlClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SourceControlClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) 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 -} - -// ListByAutomationAccount retrieve a list of source controls. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client SourceControlClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result SourceControlListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.sclr.Response.Response != nil { - sc = result.sclr.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("automation.SourceControlClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.sclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.sclr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.sclr.hasNextLink() && result.sclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client SourceControlClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/sourceControls", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client SourceControlClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client SourceControlClient) ListByAutomationAccountResponder(resp *http.Response) (result SourceControlListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client SourceControlClient) listByAutomationAccountNextResults(ctx context.Context, lastResults SourceControlListResult) (result SourceControlListResult, err error) { - req, err := lastResults.sourceControlListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.SourceControlClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.SourceControlClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client SourceControlClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result SourceControlListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update a source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// parameters - the parameters supplied to the update source control operation. -func (client SourceControlClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlUpdateParameters) (result SourceControl, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.SourceControlClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SourceControlClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, parameters SourceControlUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}", 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 SourceControlClient) 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 SourceControlClient) UpdateResponder(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 -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrolsyncjob.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrolsyncjob.go deleted file mode 100644 index f7a08e39b86e..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrolsyncjob.go +++ /dev/null @@ -1,350 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SourceControlSyncJobClient is the automation Client -type SourceControlSyncJobClient struct { - BaseClient -} - -// NewSourceControlSyncJobClient creates an instance of the SourceControlSyncJobClient client. -func NewSourceControlSyncJobClient(subscriptionID string) SourceControlSyncJobClient { - return NewSourceControlSyncJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSourceControlSyncJobClientWithBaseURI creates an instance of the SourceControlSyncJobClient 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 NewSourceControlSyncJobClientWithBaseURI(baseURI string, subscriptionID string) SourceControlSyncJobClient { - return SourceControlSyncJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates the sync job for a source control. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -// parameters - the parameters supplied to the create source control sync job operation. -func (client SourceControlSyncJobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, parameters SourceControlSyncJobCreateParameters) (result SourceControlSyncJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.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}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SourceControlSyncJobCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SourceControlSyncJobCreateProperties.CommitID", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.SourceControlSyncJobCreateProperties.CommitID", Name: validation.MinLength, Rule: 0, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("automation.SourceControlSyncJobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SourceControlSyncJobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, parameters SourceControlSyncJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}", 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 SourceControlSyncJobClient) 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 SourceControlSyncJobClient) CreateResponder(resp *http.Response) (result SourceControlSyncJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the source control sync job identified by job id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -func (client SourceControlSyncJobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID) (result SourceControlSyncJobByID, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.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("automation.SourceControlSyncJobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SourceControlSyncJobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}", 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 SourceControlSyncJobClient) 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 SourceControlSyncJobClient) GetResponder(resp *http.Response) (result SourceControlSyncJobByID, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of source control sync jobs. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// filter - the filter to apply on the operation. -func (client SourceControlSyncJobClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result SourceControlSyncJobListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.scsjlr.Response.Response != nil { - sc = result.scsjlr.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("automation.SourceControlSyncJobClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.scsjlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.scsjlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.scsjlr.hasNextLink() && result.scsjlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client SourceControlSyncJobClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client SourceControlSyncJobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client SourceControlSyncJobClient) ListByAutomationAccountResponder(resp *http.Response) (result SourceControlSyncJobListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client SourceControlSyncJobClient) listByAutomationAccountNextResults(ctx context.Context, lastResults SourceControlSyncJobListResult) (result SourceControlSyncJobListResult, err error) { - req, err := lastResults.sourceControlSyncJobListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client SourceControlSyncJobClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, filter string) (result SourceControlSyncJobListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, sourceControlName, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrolsyncjobstreams.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrolsyncjobstreams.go deleted file mode 100644 index 56327b1605f8..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/sourcecontrolsyncjobstreams.go +++ /dev/null @@ -1,258 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// SourceControlSyncJobStreamsClient is the automation Client -type SourceControlSyncJobStreamsClient struct { - BaseClient -} - -// NewSourceControlSyncJobStreamsClient creates an instance of the SourceControlSyncJobStreamsClient client. -func NewSourceControlSyncJobStreamsClient(subscriptionID string) SourceControlSyncJobStreamsClient { - return NewSourceControlSyncJobStreamsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSourceControlSyncJobStreamsClientWithBaseURI creates an instance of the SourceControlSyncJobStreamsClient 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 NewSourceControlSyncJobStreamsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlSyncJobStreamsClient { - return SourceControlSyncJobStreamsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve a sync job stream identified by stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -// streamID - the id of the sync job stream. -func (client SourceControlSyncJobStreamsClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, streamID string) (result SourceControlSyncJobStreamByID, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsClient.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("automation.SourceControlSyncJobStreamsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, streamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SourceControlSyncJobStreamsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, streamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "streamId": autorest.Encode("path", streamID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams/{streamId}", 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 SourceControlSyncJobStreamsClient) 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 SourceControlSyncJobStreamsClient) GetResponder(resp *http.Response) (result SourceControlSyncJobStreamByID, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySyncJob retrieve a list of sync job streams identified by sync job id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// sourceControlName - the source control name. -// sourceControlSyncJobID - the source control sync job id. -// filter - the filter to apply on the operation. -func (client SourceControlSyncJobStreamsClient) ListBySyncJob(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result SourceControlSyncJobStreamsListBySyncJobPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsClient.ListBySyncJob") - defer func() { - sc := -1 - if result.scsjslbsj.Response.Response != nil { - sc = result.scsjslbsj.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("automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", err.Error()) - } - - result.fn = client.listBySyncJobNextResults - req, err := client.ListBySyncJobPreparer(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySyncJobSender(req) - if err != nil { - result.scsjslbsj.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", resp, "Failure sending request") - return - } - - result.scsjslbsj, err = client.ListBySyncJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "ListBySyncJob", resp, "Failure responding to request") - return - } - if result.scsjslbsj.hasNextLink() && result.scsjslbsj.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySyncJobPreparer prepares the ListBySyncJob request. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceControlName": autorest.Encode("path", sourceControlName), - "sourceControlSyncJobId": autorest.Encode("path", sourceControlSyncJobID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySyncJobSender sends the ListBySyncJob request. The method will close the -// http.Response Body if it receives an error. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySyncJobResponder handles the response to the ListBySyncJob request. The method always -// closes the http.Response Body. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobResponder(resp *http.Response) (result SourceControlSyncJobStreamsListBySyncJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySyncJobNextResults retrieves the next set of results, if any. -func (client SourceControlSyncJobStreamsClient) listBySyncJobNextResults(ctx context.Context, lastResults SourceControlSyncJobStreamsListBySyncJob) (result SourceControlSyncJobStreamsListBySyncJob, err error) { - req, err := lastResults.sourceControlSyncJobStreamsListBySyncJobPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "listBySyncJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySyncJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "listBySyncJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySyncJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.SourceControlSyncJobStreamsClient", "listBySyncJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySyncJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client SourceControlSyncJobStreamsClient) ListBySyncJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, sourceControlName string, sourceControlSyncJobID uuid.UUID, filter string) (result SourceControlSyncJobStreamsListBySyncJobIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlSyncJobStreamsClient.ListBySyncJob") - 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.ListBySyncJob(ctx, resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobID, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/statistics.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/statistics.go deleted file mode 100644 index d7428a0f113e..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/statistics.go +++ /dev/null @@ -1,120 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// StatisticsClient is the automation Client -type StatisticsClient struct { - BaseClient -} - -// NewStatisticsClient creates an instance of the StatisticsClient client. -func NewStatisticsClient(subscriptionID string) StatisticsClient { - return NewStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewStatisticsClientWithBaseURI creates an instance of the StatisticsClient 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 NewStatisticsClientWithBaseURI(baseURI string, subscriptionID string) StatisticsClient { - return StatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the statistics for the account. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client StatisticsClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result StatisticsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StatisticsClient.ListByAutomationAccount") - 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("automation.StatisticsClient", "ListByAutomationAccount", err.Error()) - } - - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client StatisticsClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/statistics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client StatisticsClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client StatisticsClient) ListByAutomationAccountResponder(resp *http.Response) (result StatisticsListResult, 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/automation/mgmt/2018-06-30-preview/automation/testjob.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/testjob.go deleted file mode 100644 index 661e65bdee11..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/testjob.go +++ /dev/null @@ -1,462 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TestJobClient is the automation Client -type TestJobClient struct { - BaseClient -} - -// NewTestJobClient creates an instance of the TestJobClient client. -func NewTestJobClient(subscriptionID string) TestJobClient { - return NewTestJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTestJobClientWithBaseURI creates an instance of the TestJobClient 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 NewTestJobClientWithBaseURI(baseURI string, subscriptionID string) TestJobClient { - return TestJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a test job of the runbook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the parameters supplied to the create test job operation. -// parameters - the parameters supplied to the create test job operation. -func (client TestJobClient) Create(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (result TestJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.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("automation.TestJobClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TestJobClient) CreatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", 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 TestJobClient) 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 TestJobClient) CreateResponder(resp *http.Response) (result TestJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the test job for the specified runbook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result TestJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.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("automation.TestJobClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TestJobClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", 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 TestJobClient) 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 TestJobClient) GetResponder(resp *http.Response) (result TestJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Resume resume the test job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Resume(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.Resume") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.TestJobClient", "Resume", err.Error()) - } - - req, err := client.ResumePreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Resume", resp, "Failure responding to request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client TestJobClient) ResumePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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 TestJobClient) ResumeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client TestJobClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop the test job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.Stop") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.TestJobClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client TestJobClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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 TestJobClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client TestJobClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Suspend suspend the test job. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -func (client TestJobClient) Suspend(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobClient.Suspend") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.TestJobClient", "Suspend", err.Error()) - } - - req, err := client.SuspendPreparer(ctx, resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobClient", "Suspend", resp, "Failure responding to request") - return - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client TestJobClient) SuspendPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/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 TestJobClient) SuspendSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client TestJobClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/testjobstreams.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/testjobstreams.go deleted file mode 100644 index 0fe6f2525e87..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/testjobstreams.go +++ /dev/null @@ -1,252 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TestJobStreamsClient is the automation Client -type TestJobStreamsClient struct { - BaseClient -} - -// NewTestJobStreamsClient creates an instance of the TestJobStreamsClient client. -func NewTestJobStreamsClient(subscriptionID string) TestJobStreamsClient { - return NewTestJobStreamsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTestJobStreamsClientWithBaseURI creates an instance of the TestJobStreamsClient 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 NewTestJobStreamsClientWithBaseURI(baseURI string, subscriptionID string) TestJobStreamsClient { - return TestJobStreamsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve a test job stream of the test job identified by runbook name and stream id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// jobStreamID - the job stream id. -func (client TestJobStreamsClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (result JobStream, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobStreamsClient.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("automation.TestJobStreamsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, runbookName, jobStreamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TestJobStreamsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}", 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 TestJobStreamsClient) 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 TestJobStreamsClient) GetResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByTestJob retrieve a list of test job streams identified by runbook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// runbookName - the runbook name. -// filter - the filter to apply on the operation. -func (client TestJobStreamsClient) ListByTestJob(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result JobStreamListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobStreamsClient.ListByTestJob") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.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("automation.TestJobStreamsClient", "ListByTestJob", err.Error()) - } - - result.fn = client.listByTestJobNextResults - req, err := client.ListByTestJobPreparer(ctx, resourceGroupName, automationAccountName, runbookName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTestJobSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByTestJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTestJobPreparer prepares the ListByTestJob request. -func (client TestJobStreamsClient) ListByTestJobPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTestJobSender sends the ListByTestJob request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobStreamsClient) ListByTestJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTestJobResponder handles the response to the ListByTestJob request. The method always -// closes the http.Response Body. -func (client TestJobStreamsClient) ListByTestJobResponder(resp *http.Response) (result JobStreamListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTestJobNextResults retrieves the next set of results, if any. -func (client TestJobStreamsClient) listByTestJobNextResults(ctx context.Context, lastResults JobStreamListResult) (result JobStreamListResult, err error) { - req, err := lastResults.jobStreamListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "listByTestJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTestJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "listByTestJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTestJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "listByTestJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTestJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client TestJobStreamsClient) ListByTestJobComplete(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, filter string) (result JobStreamListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TestJobStreamsClient.ListByTestJob") - 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.ListByTestJob(ctx, resourceGroupName, automationAccountName, runbookName, filter) - return -} diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/usages.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/usages.go deleted file mode 100644 index ee9027e720bc..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/usages.go +++ /dev/null @@ -1,116 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UsagesClient is the automation Client -type UsagesClient struct { - BaseClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient 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 NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the usage for the account id. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client UsagesClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result UsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.ListByAutomationAccount") - 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("automation.UsagesClient", "ListByAutomationAccount", err.Error()) - } - - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client UsagesClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListByAutomationAccountResponder(resp *http.Response) (result UsageListResult, 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/automation/mgmt/2018-06-30-preview/automation/variable.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/variable.go deleted file mode 100644 index f1a905628f9f..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/variable.go +++ /dev/null @@ -1,510 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// VariableClient is the automation Client -type VariableClient struct { - BaseClient -} - -// NewVariableClient creates an instance of the VariableClient client. -func NewVariableClient(subscriptionID string) VariableClient { - return NewVariableClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVariableClientWithBaseURI creates an instance of the VariableClient 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 NewVariableClientWithBaseURI(baseURI string, subscriptionID string) VariableClient { - return VariableClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a variable. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the variable name. -// parameters - the parameters supplied to the create or update variable operation. -func (client VariableClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (result Variable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.VariableCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.VariableClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, variableName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VariableClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) CreateOrUpdateResponder(resp *http.Response) (result Variable, 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 variable. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the name of variable. -func (client VariableClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.VariableClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, variableName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VariableClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the variable identified by variable name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the name of variable. -func (client VariableClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (result Variable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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("automation.VariableClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, variableName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VariableClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) GetResponder(resp *http.Response) (result Variable, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of variables. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client VariableClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result VariableListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.ListByAutomationAccount") - defer func() { - sc := -1 - if result.vlr.Response.Response != nil { - sc = result.vlr.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("automation.VariableClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.vlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.vlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.vlr.hasNextLink() && result.vlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client VariableClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client VariableClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client VariableClient) ListByAutomationAccountResponder(resp *http.Response) (result VariableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client VariableClient) listByAutomationAccountNextResults(ctx context.Context, lastResults VariableListResult) (result VariableListResult, err error) { - req, err := lastResults.variableListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.VariableClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.VariableClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client VariableClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result VariableListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) - return -} - -// Update update a variable. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// variableName - the variable name. -// parameters - the parameters supplied to the update variable operation. -func (client VariableClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (result Variable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VariableClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.VariableClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, variableName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VariableClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", 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 VariableClient) 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 VariableClient) UpdateResponder(resp *http.Response) (result Variable, 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/automation/mgmt/2018-06-30-preview/automation/version.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/version.go deleted file mode 100644 index 8378f00e2f3a..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package automation - -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() + " automation/2018-06-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/automation/mgmt/2018-06-30-preview/automation/watcher.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/watcher.go deleted file mode 100644 index f7ca3de8421f..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/watcher.go +++ /dev/null @@ -1,681 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WatcherClient is the automation Client -type WatcherClient struct { - BaseClient -} - -// NewWatcherClient creates an instance of the WatcherClient client. -func NewWatcherClient(subscriptionID string) WatcherClient { - return NewWatcherClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWatcherClientWithBaseURI creates an instance of the WatcherClient 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 NewWatcherClientWithBaseURI(baseURI string, subscriptionID string) WatcherClient { - return WatcherClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -// parameters - the create or update parameters for watcher. -func (client WatcherClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters Watcher) (result Watcher, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, watcherName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WatcherClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters Watcher) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) 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 WatcherClient) CreateOrUpdateResponder(resp *http.Response) (result Watcher, 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 watcher by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -func (client WatcherClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, watcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WatcherClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) 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 WatcherClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -func (client WatcherClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result Watcher, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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("automation.WatcherClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, watcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WatcherClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) 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 WatcherClient) GetResponder(resp *http.Response) (result Watcher, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of watchers. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client WatcherClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WatcherListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.ListByAutomationAccount") - 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: 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("automation.WatcherClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client WatcherClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/watchers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client WatcherClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client WatcherClient) ListByAutomationAccountResponder(resp *http.Response) (result WatcherListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client WatcherClient) listByAutomationAccountNextResults(ctx context.Context, lastResults WatcherListResult) (result WatcherListResult, err error) { - req, err := lastResults.watcherListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client WatcherClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WatcherListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Start resume the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -func (client WatcherClient) Start(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Start") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, automationAccountName, watcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", nil, "Failure preparing request") - return - } - - resp, err := client.StartSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", resp, "Failure sending request") - return - } - - result, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", resp, "Failure responding to request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client WatcherClient) StartPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/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 WatcherClient) StartSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client WatcherClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop resume the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -func (client WatcherClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Stop") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, watcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client WatcherClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/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 WatcherClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client WatcherClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update the watcher identified by watcher name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// watcherName - the watcher name. -// parameters - the update parameters for watcher. -func (client WatcherClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters WatcherUpdateParameters) (result Watcher, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WatcherClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, watcherName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WatcherClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters WatcherUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "watcherName": autorest.Encode("path", watcherName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) 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 WatcherClient) UpdateResponder(resp *http.Response) (result Watcher, 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/automation/mgmt/2018-06-30-preview/automation/webhook.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/webhook.go deleted file mode 100644 index 302cfc5d2402..000000000000 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/webhook.go +++ /dev/null @@ -1,598 +0,0 @@ -package automation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WebhookClient is the automation Client -type WebhookClient struct { - BaseClient -} - -// NewWebhookClient creates an instance of the WebhookClient client. -func NewWebhookClient(subscriptionID string) WebhookClient { - return NewWebhookClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhookClientWithBaseURI creates an instance of the WebhookClient 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 NewWebhookClientWithBaseURI(baseURI string, subscriptionID string) WebhookClient { - return WebhookClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the webhook identified by webhook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -// parameters - the create or update parameters for webhook. -func (client WebhookClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WebhookCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WebhookClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, webhookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WebhookClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) CreateOrUpdateResponder(resp *http.Response) (result Webhook, 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 webhook by name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -func (client WebhookClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WebhookClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhookClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateURI generates a Uri for use in creating a webhook. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -func (client WebhookClient) GenerateURI(ctx context.Context, resourceGroupName string, automationAccountName string) (result String, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.GenerateURI") - 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("automation.WebhookClient", "GenerateURI", err.Error()) - } - - req, err := client.GenerateURIPreparer(ctx, resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateURISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure sending request") - return - } - - result, err = client.GenerateURIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure responding to request") - return - } - - return -} - -// GenerateURIPreparer prepares the GenerateURI request. -func (client WebhookClient) GenerateURIPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateURISender sends the GenerateURI request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) GenerateURISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateURIResponder handles the response to the GenerateURI request. The method always -// closes the http.Response Body. -func (client WebhookClient) GenerateURIResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the webhook identified by webhook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -func (client WebhookClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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("automation.WebhookClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhookClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of webhooks. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// filter - the filter to apply on the operation. -func (client WebhookClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.ListByAutomationAccount") - 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: 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("automation.WebhookClient", "ListByAutomationAccount", err.Error()) - } - - result.fn = client.listByAutomationAccountNextResults - req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client WebhookClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Automation/automationAccounts/{automationAccountName}/webhooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client WebhookClient) ListByAutomationAccountResponder(resp *http.Response) (result WebhookListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAutomationAccountNextResults retrieves the next set of results, if any. -func (client WebhookClient) listByAutomationAccountNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhookClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.ListByAutomationAccount") - 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) - return -} - -// Update update the webhook identified by webhook name. -// Parameters: -// resourceGroupName - name of an Azure Resource group. -// automationAccountName - the name of the automation account. -// webhookName - the webhook name. -// parameters - the update parameters for webhook. -func (client WebhookClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("automation.WebhookClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, webhookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhookClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - 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.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", 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 WebhookClient) 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 WebhookClient) UpdateResponder(resp *http.Response) (result Webhook, 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/containerregistry/mgmt/2016-06-27-preview/containerregistry/CHANGELOG.md b/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/_meta.json b/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/_meta.json deleted file mode 100644 index ea26f8bceb81..000000000000 --- a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "tag": "package-2016-06-preview", - "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-2016-06-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/client.go b/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/client.go deleted file mode 100644 index 79dc6dd5accd..000000000000 --- a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerregistry implements the Azure ARM Containerregistry service API version 2016-06-27-preview. -// -// -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Containerregistry - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerregistry. -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/containerregistry/mgmt/2016-06-27-preview/containerregistry/containerregistryapi/interfaces.go b/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/containerregistryapi/interfaces.go deleted file mode 100644 index c52044773fd7..000000000000 --- a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/containerregistryapi/interfaces.go +++ /dev/null @@ -1,30 +0,0 @@ -package containerregistryapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/containerregistry/mgmt/2016-06-27-preview/containerregistry" - "github.com/Azure/go-autorest/autorest" -) - -// RegistriesClientAPI contains the set of methods on the RegistriesClient type. -type RegistriesClientAPI interface { - CheckNameAvailability(ctx context.Context, registryNameCheckRequest containerregistry.RegistryNameCheckRequest) (result containerregistry.RegistryNameStatus, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, registry containerregistry.Registry) (result containerregistry.Registry, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string) (result autorest.Response, err error) - GetCredentials(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryCredentials, err error) - GetProperties(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.Registry, err error) - List(ctx context.Context) (result containerregistry.RegistryListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.RegistryListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultIterator, err error) - RegenerateCredentials(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryCredentials, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters containerregistry.RegistryUpdateParameters) (result containerregistry.Registry, err error) -} - -var _ RegistriesClientAPI = (*containerregistry.RegistriesClient)(nil) diff --git a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/models.go b/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/models.go deleted file mode 100644 index adc8e22b9c3f..000000000000 --- a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/models.go +++ /dev/null @@ -1,428 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry" - -// Registry an object that represents a container registry. -type Registry struct { - autorest.Response `json:"-"` - // RegistryProperties - The properties of the container registry. - *RegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Registry. -func (r Registry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RegistryProperties != nil { - objectMap["properties"] = r.RegistryProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Registry struct. -func (r *Registry) 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 registryProperties RegistryProperties - err = json.Unmarshal(*v, ®istryProperties) - if err != nil { - return err - } - r.RegistryProperties = ®istryProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - } - } - - return nil -} - -// RegistryCredentials the result of a request to get the administrator login credentials for a container -// registry. -type RegistryCredentials struct { - autorest.Response `json:"-"` - // Username - The administrator username. - Username *string `json:"username,omitempty"` - // Password - The administrator password. - Password *string `json:"password,omitempty"` -} - -// RegistryListResult the result of a request to list container registries. -type RegistryListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - Value *[]Registry `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registries. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegistryListResultIterator provides access to a complete listing of Registry values. -type RegistryListResultIterator struct { - i int - page RegistryListResultPage -} - -// 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 *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.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 *RegistryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegistryListResultIterator) 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 RegistryListResultIterator) Response() RegistryListResult { - 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 RegistryListResultIterator) Value() Registry { - if !iter.page.NotDone() { - return Registry{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegistryListResultIterator type. -func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { - return RegistryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegistryListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegistryListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// registryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegistryListResult) registryListResultPreparer(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))) -} - -// RegistryListResultPage contains a page of Registry values. -type RegistryListResultPage struct { - fn func(context.Context, RegistryListResult) (RegistryListResult, error) - rlr RegistryListResult -} - -// 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 *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.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 *RegistryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegistryListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegistryListResultPage) Response() RegistryListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegistryListResultPage) Values() []Registry { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegistryListResultPage type. -func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { - return RegistryListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistryNameCheckRequest a request to check whether the container registry name is available. -type RegistryNameCheckRequest struct { - // Name - The name of the container registry. - Name *string `json:"name,omitempty"` - // Type - The resource type of the container registry. This field must be set to "Microsoft.ContainerRegistry/registries". - Type *string `json:"type,omitempty"` -} - -// RegistryNameStatus the result of a request to check the availability of a container registry name. -type RegistryNameStatus struct { - autorest.Response `json:"-"` - // NameAvailable - The value that indicates whether the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - If any, the reason that the name is not available. - Reason *string `json:"reason,omitempty"` - // Message - If any, the error message that provides more detail for the reason that the name is not available. - Message *string `json:"message,omitempty"` -} - -// RegistryProperties the properties of a container registry. -type RegistryProperties struct { - // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. - LoginServer *string `json:"loginServer,omitempty"` - // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. - CreationDate *date.Time `json:"creationDate,omitempty"` - // AdminUserEnabled - The value that indicates whether the admin user is enabled. This value is false by default. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // StorageAccount - The properties of the storage account for the container registry. If specified, the storage account must be in the same physical location as the container registry. - StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryProperties. -func (rp RegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.AdminUserEnabled != nil { - objectMap["adminUserEnabled"] = rp.AdminUserEnabled - } - if rp.StorageAccount != nil { - objectMap["storageAccount"] = rp.StorageAccount - } - return json.Marshal(objectMap) -} - -// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. -type RegistryPropertiesUpdateParameters struct { - // AdminUserEnabled - The value that indicates whether the admin user is enabled. This value is false by default. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // StorageAccount - The properties of a storage account for the container registry. If specified, the storage account must be in the same physical location as the container registry. - StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` -} - -// RegistryUpdateParameters the parameters for updating a container registry. -type RegistryUpdateParameters struct { - // Tags - The resource tags for the container registry. - Tags map[string]*string `json:"tags"` - // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. - *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryUpdateParameters. -func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.RegistryPropertiesUpdateParameters != nil { - objectMap["properties"] = rup.RegistryPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. -func (rup *RegistryUpdateParameters) 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 - } - rup.Tags = tags - } - case "properties": - if v != nil { - var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters - err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) - if err != nil { - return err - } - rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters - } - } - } - - return nil -} - -// Resource an Azure resource. -type Resource struct { - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - 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{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// StorageAccountProperties the properties of a storage account for a container registry. -type StorageAccountProperties struct { - // Name - The name of the storage account. - Name *string `json:"name,omitempty"` - // AccessKey - The access key to the storage account. - AccessKey *string `json:"accessKey,omitempty"` -} diff --git a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/registries.go b/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/registries.go deleted file mode 100644 index 1d02dad70d29..000000000000 --- a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/registries.go +++ /dev/null @@ -1,816 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RegistriesClient is the client for the Registries methods of the Containerregistry service. -type RegistriesClient struct { - BaseClient -} - -// NewRegistriesClient creates an instance of the RegistriesClient client. -func NewRegistriesClient(subscriptionID string) RegistriesClient { - return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient 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 NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { - return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only -// alphanumeric characters, be globally unique, and between 5 and 60 characters in length. -// Parameters: -// registryNameCheckRequest - the object containing information for the availability request. -func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryNameCheckRequest, - Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-27-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}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters), - autorest.WithJSON(registryNameCheckRequest), - 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 RegistriesClient) 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 RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registry - the parameters for creating or updating a container registry. -func (client RegistriesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result Registry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registry, - Constraints: []validation.Constraint{{Target: "registry.RegistryProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "registry.RegistryProperties.StorageAccount.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, registryName, registry) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RegistriesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-27-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registry), - 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 RegistriesClient) 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 RegistriesClient) CreateOrUpdateResponder(resp *http.Response) (result Registry, 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 a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-27-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) 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 RegistriesClient) 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 -} - -// GetCredentials gets the administrator login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) GetCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryCredentials, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GetCredentials") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetCredentialsPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.GetCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", resp, "Failure sending request") - return - } - - result, err = client.GetCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", resp, "Failure responding to request") - return - } - - return -} - -// GetCredentialsPreparer prepares the GetCredentials request. -func (client RegistriesClient) GetCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-27-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.ContainerRegistry/registries/{registryName}/getCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCredentialsSender sends the GetCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GetCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCredentialsResponder handles the response to the GetCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GetCredentialsResponder(resp *http.Response) (result RegistryCredentials, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetProperties gets the properties of the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) GetProperties(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GetProperties") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPropertiesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", nil, "Failure preparing request") - return - } - - resp, err := client.GetPropertiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", resp, "Failure sending request") - return - } - - result, err = client.GetPropertiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", resp, "Failure responding to request") - return - } - - return -} - -// GetPropertiesPreparer prepares the GetProperties request. -func (client RegistriesClient) GetPropertiesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-27-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetPropertiesSender sends the GetProperties request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GetPropertiesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetPropertiesResponder handles the response to the GetProperties request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GetPropertiesResponder(resp *http.Response) (result Registry, 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 the available container registries under the specified subscription. -func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-27-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 the available container registries under the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.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, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RegistriesClient) 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 = "2016-06-27-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.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 -} - -// RegenerateCredentials regenerates the administrator login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) RegenerateCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryCredentials, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.RegenerateCredentials") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RegenerateCredentialsPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", resp, "Failure sending request") - return - } - - result, err = client.RegenerateCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateCredentialsPreparer prepares the RegenerateCredentials request. -func (client RegistriesClient) RegenerateCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-27-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.ContainerRegistry/registries/{registryName}/regenerateCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateCredentialsSender sends the RegenerateCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) RegenerateCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateCredentialsResponder handles the response to the RegenerateCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) RegenerateCredentialsResponder(resp *http.Response) (result RegistryCredentials, 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 container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registryUpdateParameters - the parameters for updating a container registry. -func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result Registry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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, registryName, registryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-27-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registryUpdateParameters), - 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 RegistriesClient) 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 RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, 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/containerregistry/mgmt/2016-06-27-preview/containerregistry/version.go b/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/version.go deleted file mode 100644 index 0626f86ceb24..000000000000 --- a/services/preview/containerregistry/mgmt/2016-06-27-preview/containerregistry/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerregistry - -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() + " containerregistry/2016-06-27-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/CHANGELOG.md b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/_meta.json b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/_meta.json deleted file mode 100644 index 27ffa5fcfb8b..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "tag": "package-2017-06-preview", - "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-2017-06-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/client.go b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/client.go deleted file mode 100644 index 9f37fd56f6b3..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerregistry implements the Azure ARM Containerregistry service API version 2017-06-01-preview. -// -// -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Containerregistry - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerregistry. -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/containerregistry/mgmt/2017-06-01-preview/containerregistry/containerregistryapi/interfaces.go b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/containerregistryapi/interfaces.go deleted file mode 100644 index cf35b7af7dcc..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/containerregistryapi/interfaces.go +++ /dev/null @@ -1,66 +0,0 @@ -package containerregistryapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/containerregistry/mgmt/2017-06-01-preview/containerregistry" -) - -// RegistriesClientAPI contains the set of methods on the RegistriesClient type. -type RegistriesClientAPI interface { - CheckNameAvailability(ctx context.Context, registryNameCheckRequest containerregistry.RegistryNameCheckRequest) (result containerregistry.RegistryNameStatus, err error) - Create(ctx context.Context, resourceGroupName string, registryName string, registry containerregistry.Registry) (result containerregistry.RegistriesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistriesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.Registry, err error) - List(ctx context.Context) (result containerregistry.RegistryListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.RegistryListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultIterator, err error) - ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryListCredentialsResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryUsageListResult, err error) - RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters containerregistry.RegenerateCredentialParameters) (result containerregistry.RegistryListCredentialsResult, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters containerregistry.RegistryUpdateParameters) (result containerregistry.RegistriesUpdateFuture, err error) -} - -var _ RegistriesClientAPI = (*containerregistry.RegistriesClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result containerregistry.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*containerregistry.OperationsClient)(nil) - -// ReplicationsClientAPI contains the set of methods on the ReplicationsClient type. -type ReplicationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication containerregistry.Replication) (result containerregistry.ReplicationsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.ReplicationsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.Replication, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters containerregistry.ReplicationUpdateParameters) (result containerregistry.ReplicationsUpdateFuture, err error) -} - -var _ ReplicationsClientAPI = (*containerregistry.ReplicationsClient)(nil) - -// WebhooksClientAPI contains the set of methods on the WebhooksClient type. -type WebhooksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters containerregistry.WebhookCreateParameters) (result containerregistry.WebhooksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.WebhooksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.Webhook, err error) - GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.CallbackConfig, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultIterator, err error) - ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultPage, err error) - ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultIterator, err error) - Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventInfo, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters containerregistry.WebhookUpdateParameters) (result containerregistry.WebhooksUpdateFuture, err error) -} - -var _ WebhooksClientAPI = (*containerregistry.WebhooksClient)(nil) diff --git a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/enums.go b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/enums.go deleted file mode 100644 index 39dd638be714..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/enums.go +++ /dev/null @@ -1,124 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PasswordName enumerates the values for password name. -type PasswordName string - -const ( - // Password ... - Password PasswordName = "password" - // Password2 ... - Password2 PasswordName = "password2" -) - -// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type. -func PossiblePasswordNameValues() []PasswordName { - return []PasswordName{Password, Password2} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Creating ... - Creating ProvisioningState = "Creating" - // Deleting ... - Deleting ProvisioningState = "Deleting" - // Failed ... - Failed ProvisioningState = "Failed" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" - // Updating ... - Updating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// RegistryUsageUnit enumerates the values for registry usage unit. -type RegistryUsageUnit string - -const ( - // Bytes ... - Bytes RegistryUsageUnit = "Bytes" - // Count ... - Count RegistryUsageUnit = "Count" -) - -// PossibleRegistryUsageUnitValues returns an array of possible values for the RegistryUsageUnit const type. -func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { - return []RegistryUsageUnit{Bytes, Count} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Basic ... - Basic SkuName = "Basic" - // ManagedBasic ... - ManagedBasic SkuName = "Managed_Basic" - // ManagedPremium ... - ManagedPremium SkuName = "Managed_Premium" - // ManagedStandard ... - ManagedStandard SkuName = "Managed_Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{Basic, ManagedBasic, ManagedPremium, ManagedStandard} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic ... - SkuTierBasic SkuTier = "Basic" - // SkuTierManaged ... - SkuTierManaged SkuTier = "Managed" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBasic, SkuTierManaged} -} - -// WebhookAction enumerates the values for webhook action. -type WebhookAction string - -const ( - // Delete ... - Delete WebhookAction = "delete" - // Push ... - Push WebhookAction = "push" -) - -// PossibleWebhookActionValues returns an array of possible values for the WebhookAction const type. -func PossibleWebhookActionValues() []WebhookAction { - return []WebhookAction{Delete, Push} -} - -// WebhookStatus enumerates the values for webhook status. -type WebhookStatus string - -const ( - // Disabled ... - Disabled WebhookStatus = "disabled" - // Enabled ... - Enabled WebhookStatus = "enabled" -) - -// PossibleWebhookStatusValues returns an array of possible values for the WebhookStatus const type. -func PossibleWebhookStatusValues() []WebhookStatus { - return []WebhookStatus{Disabled, Enabled} -} diff --git a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/models.go b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/models.go deleted file mode 100644 index 9fe655d6a8cc..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/models.go +++ /dev/null @@ -1,2172 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry" - -// Actor the agent that initiated the event. For most situations, this could be from the authorization -// context of the request. -type Actor struct { - // Name - The subject or username associated with the request context that generated the event. - Name *string `json:"name,omitempty"` -} - -// CallbackConfig the configuration of service URI and custom headers for the webhook. -type CallbackConfig struct { - autorest.Response `json:"-"` - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` -} - -// MarshalJSON is the custom marshaler for CallbackConfig. -func (cc CallbackConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.ServiceURI != nil { - objectMap["serviceUri"] = cc.ServiceURI - } - if cc.CustomHeaders != nil { - objectMap["customHeaders"] = cc.CustomHeaders - } - return json.Marshal(objectMap) -} - -// Event the event for a webhook. -type Event struct { - // EventRequestMessage - The event request message sent to the service URI. - EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` - // EventResponseMessage - The event response message received from the service URI. - EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventContent the content of the event request message. -type EventContent struct { - // ID - The event ID. - ID *string `json:"id,omitempty"` - // Timestamp - The time at which the event occurred. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Action - The action that encompasses the provided event. - Action *string `json:"action,omitempty"` - // Target - The target of the event. - Target *Target `json:"target,omitempty"` - // Request - The request that generated the event. - Request *Request `json:"request,omitempty"` - // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. - Actor *Actor `json:"actor,omitempty"` - // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - Source *Source `json:"source,omitempty"` -} - -// EventInfo the basic information of an event. -type EventInfo struct { - autorest.Response `json:"-"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventListResult the result of a request to list events for a webhook. -type EventListResult struct { - autorest.Response `json:"-"` - // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - Value *[]Event `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventListResultIterator provides access to a complete listing of Event values. -type EventListResultIterator struct { - i int - page EventListResultPage -} - -// 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 *EventListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.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 *EventListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventListResultIterator) 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 EventListResultIterator) Response() EventListResult { - 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 EventListResultIterator) Value() Event { - if !iter.page.NotDone() { - return Event{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventListResultIterator type. -func NewEventListResultIterator(page EventListResultPage) EventListResultIterator { - return EventListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (elr EventListResult) IsEmpty() bool { - return elr.Value == nil || len(*elr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (elr EventListResult) hasNextLink() bool { - return elr.NextLink != nil && len(*elr.NextLink) != 0 -} - -// eventListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (elr EventListResult) eventListResultPreparer(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))) -} - -// EventListResultPage contains a page of Event values. -type EventListResultPage struct { - fn func(context.Context, EventListResult) (EventListResult, error) - elr EventListResult -} - -// 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 *EventListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.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 *EventListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventListResultPage) NotDone() bool { - return !page.elr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventListResultPage) Response() EventListResult { - return page.elr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventListResultPage) Values() []Event { - if page.elr.IsEmpty() { - return nil - } - return *page.elr.Value -} - -// Creates a new instance of the EventListResultPage type. -func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage { - return EventListResultPage{ - fn: getNextPage, - elr: cur, - } -} - -// EventRequestMessage the event request message sent to the service URI. -type EventRequestMessage struct { - // Content - The content of the event request message. - Content *EventContent `json:"content,omitempty"` - // Headers - The headers of the event request message. - Headers map[string]*string `json:"headers"` - // Method - The HTTP method used to send the event request message. - Method *string `json:"method,omitempty"` - // RequestURI - The URI used to send the event request message. - RequestURI *string `json:"requestUri,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventRequestMessage. -func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.Method != nil { - objectMap["method"] = erm.Method - } - if erm.RequestURI != nil { - objectMap["requestUri"] = erm.RequestURI - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// EventResponseMessage the event response message received from the service URI. -type EventResponseMessage struct { - // Content - The content of the event response message. - Content *string `json:"content,omitempty"` - // Headers - The headers of the event response message. - Headers map[string]*string `json:"headers"` - // ReasonPhrase - The reason phrase of the event response message. - ReasonPhrase *string `json:"reasonPhrase,omitempty"` - // StatusCode - The status code of the event response message. - StatusCode *string `json:"statusCode,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventResponseMessage. -func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.ReasonPhrase != nil { - objectMap["reasonPhrase"] = erm.ReasonPhrase - } - if erm.StatusCode != nil { - objectMap["statusCode"] = erm.StatusCode - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// OperationDefinition the definition of a container registry operation. -type OperationDefinition struct { - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The display information for the container registry operation. - Display *OperationDisplayDefinition `json:"display,omitempty"` -} - -// OperationDisplayDefinition the display information for a container registry operation. -type OperationDisplayDefinition struct { - // Provider - The resource provider name: Microsoft.ContainerRegistry. - Provider *string `json:"provider,omitempty"` - // Resource - The resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - The operation that users can perform. - Operation *string `json:"operation,omitempty"` - // Description - The description for the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult the result of a request to list container registry operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - Value *[]OperationDefinition `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registry operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of OperationDefinition 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() OperationDefinition { - if !iter.page.NotDone() { - return OperationDefinition{} - } - 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 OperationDefinition 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() []OperationDefinition { - 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, - } -} - -// RegenerateCredentialParameters the parameters used to regenerate the login credential. -type RegenerateCredentialParameters struct { - // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2' - Name PasswordName `json:"name,omitempty"` -} - -// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesCreateFuture) 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 RegistriesCreateFuture.Result. -func (future *RegistriesCreateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture") - 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, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesDeleteFuture) 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 RegistriesDeleteFuture.Result. -func (future *RegistriesDeleteFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesUpdateFuture) 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 RegistriesUpdateFuture.Result. -func (future *RegistriesUpdateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture") - 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, "containerregistry.RegistriesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// Registry an object that represents a container registry. -type Registry struct { - autorest.Response `json:"-"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // RegistryProperties - The properties of the container registry. - *RegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Registry. -func (r Registry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - if r.RegistryProperties != nil { - objectMap["properties"] = r.RegistryProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Registry struct. -func (r *Registry) 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 - } - r.Sku = &sku - } - case "properties": - if v != nil { - var registryProperties RegistryProperties - err = json.Unmarshal(*v, ®istryProperties) - if err != nil { - return err - } - r.RegistryProperties = ®istryProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - } - } - - return nil -} - -// RegistryListCredentialsResult the response from the ListCredentials operation. -type RegistryListCredentialsResult struct { - autorest.Response `json:"-"` - // Username - The username for a container registry. - Username *string `json:"username,omitempty"` - // Passwords - The list of passwords for a container registry. - Passwords *[]RegistryPassword `json:"passwords,omitempty"` -} - -// RegistryListResult the result of a request to list container registries. -type RegistryListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - Value *[]Registry `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registries. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegistryListResultIterator provides access to a complete listing of Registry values. -type RegistryListResultIterator struct { - i int - page RegistryListResultPage -} - -// 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 *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.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 *RegistryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegistryListResultIterator) 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 RegistryListResultIterator) Response() RegistryListResult { - 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 RegistryListResultIterator) Value() Registry { - if !iter.page.NotDone() { - return Registry{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegistryListResultIterator type. -func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { - return RegistryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegistryListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegistryListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// registryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegistryListResult) registryListResultPreparer(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))) -} - -// RegistryListResultPage contains a page of Registry values. -type RegistryListResultPage struct { - fn func(context.Context, RegistryListResult) (RegistryListResult, error) - rlr RegistryListResult -} - -// 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 *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.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 *RegistryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegistryListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegistryListResultPage) Response() RegistryListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegistryListResultPage) Values() []Registry { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegistryListResultPage type. -func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { - return RegistryListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistryNameCheckRequest a request to check whether a container registry name is available. -type RegistryNameCheckRequest struct { - // Name - The name of the container registry. - Name *string `json:"name,omitempty"` - // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. - Type *string `json:"type,omitempty"` -} - -// RegistryNameStatus the result of a request to check the availability of a container registry name. -type RegistryNameStatus struct { - autorest.Response `json:"-"` - // NameAvailable - The value that indicates whether the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - If any, the reason that the name is not available. - Reason *string `json:"reason,omitempty"` - // Message - If any, the error message that provides more detail for the reason that the name is not available. - Message *string `json:"message,omitempty"` -} - -// RegistryPassword the login password for the container registry. -type RegistryPassword struct { - // Name - The password name. Possible values include: 'Password', 'Password2' - Name PasswordName `json:"name,omitempty"` - // Value - The password value. - Value *string `json:"value,omitempty"` -} - -// RegistryProperties the properties of a container registry. -type RegistryProperties struct { - // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. - LoginServer *string `json:"loginServer,omitempty"` - // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the container registry at the time the operation was called. - Status *Status `json:"status,omitempty"` - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // StorageAccount - The properties of the storage account for the container registry. Only applicable to Basic SKU. - StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryProperties. -func (rp RegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.AdminUserEnabled != nil { - objectMap["adminUserEnabled"] = rp.AdminUserEnabled - } - if rp.StorageAccount != nil { - objectMap["storageAccount"] = rp.StorageAccount - } - return json.Marshal(objectMap) -} - -// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. -type RegistryPropertiesUpdateParameters struct { - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // StorageAccount - The parameters of a storage account for the container registry. Only applicable to Basic SKU. If specified, the storage account must be in the same physical location as the container registry. - StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` -} - -// RegistryUpdateParameters the parameters for updating a container registry. -type RegistryUpdateParameters struct { - // Tags - The tags for the container registry. - Tags map[string]*string `json:"tags"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. - *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryUpdateParameters. -func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.Sku != nil { - objectMap["sku"] = rup.Sku - } - if rup.RegistryPropertiesUpdateParameters != nil { - objectMap["properties"] = rup.RegistryPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. -func (rup *RegistryUpdateParameters) 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 - } - rup.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - rup.Sku = &sku - } - case "properties": - if v != nil { - var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters - err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) - if err != nil { - return err - } - rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters - } - } - } - - return nil -} - -// RegistryUsage the quota usage for a container registry. -type RegistryUsage struct { - // Name - The name of the usage. - Name *string `json:"name,omitempty"` - // Limit - The limit of the usage. - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - The current value of the usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - // Unit - The unit of measurement. Possible values include: 'Count', 'Bytes' - Unit RegistryUsageUnit `json:"unit,omitempty"` -} - -// RegistryUsageListResult the result of a request to get container registry quota usages. -type RegistryUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry quota usages. - Value *[]RegistryUsage `json:"value,omitempty"` -} - -// Replication an object that represents a replication for a container registry. -type Replication struct { - autorest.Response `json:"-"` - // ReplicationProperties - The properties of the replication. - *ReplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Replication. -func (r Replication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.ReplicationProperties != nil { - objectMap["properties"] = r.ReplicationProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Replication struct. -func (r *Replication) 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 replicationProperties ReplicationProperties - err = json.Unmarshal(*v, &replicationProperties) - if err != nil { - return err - } - r.ReplicationProperties = &replicationProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - } - } - - return nil -} - -// ReplicationListResult the result of a request to list replications for a container registry. -type ReplicationListResult struct { - autorest.Response `json:"-"` - // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - Value *[]Replication `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of replications. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReplicationListResultIterator provides access to a complete listing of Replication values. -type ReplicationListResultIterator struct { - i int - page ReplicationListResultPage -} - -// 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 *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.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 *ReplicationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReplicationListResultIterator) 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 ReplicationListResultIterator) Response() ReplicationListResult { - 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 ReplicationListResultIterator) Value() Replication { - if !iter.page.NotDone() { - return Replication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReplicationListResultIterator type. -func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { - return ReplicationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr ReplicationListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr ReplicationListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// replicationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr ReplicationListResult) replicationListResultPreparer(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))) -} - -// ReplicationListResultPage contains a page of Replication values. -type ReplicationListResultPage struct { - fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) - rlr ReplicationListResult -} - -// 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 *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.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 *ReplicationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReplicationListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReplicationListResultPage) Response() ReplicationListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReplicationListResultPage) Values() []Replication { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the ReplicationListResultPage type. -func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { - return ReplicationListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// ReplicationProperties the properties of a replication. -type ReplicationProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the replication at the time the operation was called. - Status *Status `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationProperties. -func (rp ReplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsCreateFuture) 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 ReplicationsCreateFuture.Result. -func (future *ReplicationsCreateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture") - 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, "containerregistry.ReplicationsCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsDeleteFuture) 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 ReplicationsDeleteFuture.Result. -func (future *ReplicationsDeleteFuture) result(client ReplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsUpdateFuture) 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 ReplicationsUpdateFuture.Result. -func (future *ReplicationsUpdateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture") - 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, "containerregistry.ReplicationsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationUpdateParameters the parameters for updating a replication. -type ReplicationUpdateParameters struct { - // Tags - The tags for the replication. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. -func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - return json.Marshal(objectMap) -} - -// Request the request that generated the event. -type Request struct { - // ID - The ID of the request that initiated the event. - ID *string `json:"id,omitempty"` - // Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - Addr *string `json:"addr,omitempty"` - // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - Host *string `json:"host,omitempty"` - // Method - The request method that generated the event. - Method *string `json:"method,omitempty"` - // Useragent - The user agent header of the request. - Useragent *string `json:"useragent,omitempty"` -} - -// Resource an Azure resource. -type Resource struct { - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - 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{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Sku the SKU of a container registry. -type Sku struct { - // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Basic', 'ManagedBasic', 'ManagedStandard', 'ManagedPremium' - Name SkuName `json:"name,omitempty"` - // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierBasic', 'SkuTierManaged' - Tier SkuTier `json:"tier,omitempty"` -} - -// MarshalJSON is the custom marshaler for Sku. -func (s Sku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Name != "" { - objectMap["name"] = s.Name - } - return json.Marshal(objectMap) -} - -// Source the registry node that generated the event. Put differently, while the actor initiates the event, -// the source generates it. -type Source struct { - // Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - Addr *string `json:"addr,omitempty"` - // InstanceID - The running instance of an application. Changes after each restart. - InstanceID *string `json:"instanceID,omitempty"` -} - -// Status the status of an Azure resource at the time the operation was called. -type Status struct { - // DisplayStatus - READ-ONLY; The short label for the status. - DisplayStatus *string `json:"displayStatus,omitempty"` - // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. - Message *string `json:"message,omitempty"` - // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for Status. -func (s Status) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StorageAccountProperties the properties of a storage account for a container registry. Only applicable -// to Basic SKU. -type StorageAccountProperties struct { - // ID - The resource ID of the storage account. - ID *string `json:"id,omitempty"` -} - -// Target the target of the event. -type Target struct { - // MediaType - The MIME type of the referenced object. - MediaType *string `json:"mediaType,omitempty"` - // Size - The number of bytes of the content. Same as Length field. - Size *int64 `json:"size,omitempty"` - // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. - Digest *string `json:"digest,omitempty"` - // Length - The number of bytes of the content. Same as Size field. - Length *int64 `json:"length,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // URL - The direct URL to the content. - URL *string `json:"url,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` -} - -// Webhook an object that represents a webhook for a container registry. -type Webhook struct { - autorest.Response `json:"-"` - // WebhookProperties - The properties of the webhook. - *WebhookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WebhookProperties != nil { - objectMap["properties"] = w.WebhookProperties - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Webhook struct. -func (w *Webhook) 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 webhookProperties WebhookProperties - err = json.Unmarshal(*v, &webhookProperties) - if err != nil { - return err - } - w.WebhookProperties = &webhookProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - } - } - - return nil -} - -// WebhookCreateParameters the parameters for creating a webhook. -type WebhookCreateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // Location - The location of the webhook. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. - *WebhookPropertiesCreateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateParameters. -func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcp.Tags != nil { - objectMap["tags"] = wcp.Tags - } - if wcp.Location != nil { - objectMap["location"] = wcp.Location - } - if wcp.WebhookPropertiesCreateParameters != nil { - objectMap["properties"] = wcp.WebhookPropertiesCreateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. -func (wcp *WebhookCreateParameters) 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 - } - wcp.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wcp.Location = &location - } - case "properties": - if v != nil { - var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters - err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) - if err != nil { - return err - } - wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters - } - } - } - - return nil -} - -// WebhookListResult the result of a request to list webhooks for a container registry. -type WebhookListResult struct { - autorest.Response `json:"-"` - // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. - Value *[]Webhook `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of webhooks. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultIterator provides access to a complete listing of Webhook values. -type WebhookListResultIterator struct { - i int - page WebhookListResultPage -} - -// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { - 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 WebhookListResultIterator) Value() Webhook { - if !iter.page.NotDone() { - return Webhook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebhookListResultIterator type. -func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { - return WebhookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WebhookListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WebhookListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// webhookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WebhookListResult) webhookListResultPreparer(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))) -} - -// WebhookListResultPage contains a page of Webhook values. -type WebhookListResultPage struct { - fn func(context.Context, WebhookListResult) (WebhookListResult, error) - wlr WebhookListResult -} - -// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebhookListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebhookListResultPage) Response() WebhookListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebhookListResultPage) Values() []Webhook { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WebhookListResultPage type. -func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { - return WebhookListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WebhookProperties the properties of a webhook. -type WebhookProperties struct { - // Status - The status of the webhook at the time the operation was called. Possible values include: 'Enabled', 'Disabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookProperties. -func (wp WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Status != "" { - objectMap["status"] = wp.Status - } - if wp.Scope != nil { - objectMap["scope"] = wp.Scope - } - if wp.Actions != nil { - objectMap["actions"] = wp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. -type WebhookPropertiesCreateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'Enabled', 'Disabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. -func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpcp.ServiceURI != nil { - objectMap["serviceUri"] = wpcp.ServiceURI - } - if wpcp.CustomHeaders != nil { - objectMap["customHeaders"] = wpcp.CustomHeaders - } - if wpcp.Status != "" { - objectMap["status"] = wpcp.Status - } - if wpcp.Scope != nil { - objectMap["scope"] = wpcp.Scope - } - if wpcp.Actions != nil { - objectMap["actions"] = wpcp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. -type WebhookPropertiesUpdateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'Enabled', 'Disabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. -func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpup.ServiceURI != nil { - objectMap["serviceUri"] = wpup.ServiceURI - } - if wpup.CustomHeaders != nil { - objectMap["customHeaders"] = wpup.CustomHeaders - } - if wpup.Status != "" { - objectMap["status"] = wpup.Status - } - if wpup.Scope != nil { - objectMap["scope"] = wpup.Scope - } - if wpup.Actions != nil { - objectMap["actions"] = wpup.Actions - } - return json.Marshal(objectMap) -} - -// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksCreateFuture) 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 WebhooksCreateFuture.Result. -func (future *WebhooksCreateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.CreateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksDeleteFuture) 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 WebhooksDeleteFuture.Result. -func (future *WebhooksDeleteFuture) result(client WebhooksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksUpdateFuture) 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 WebhooksUpdateFuture.Result. -func (future *WebhooksUpdateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.UpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhookUpdateParameters the parameters for updating a webhook. -type WebhookUpdateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. - *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateParameters. -func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.Tags != nil { - objectMap["tags"] = wup.Tags - } - if wup.WebhookPropertiesUpdateParameters != nil { - objectMap["properties"] = wup.WebhookPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. -func (wup *WebhookUpdateParameters) 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 - } - wup.Tags = tags - } - case "properties": - if v != nil { - var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters - err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) - if err != nil { - return err - } - wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters - } - } - } - - return nil -} diff --git a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/operations.go b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/operations.go deleted file mode 100644 index 7b273dae25a8..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 client for the Operations methods of the Containerregistry service. -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 Azure Container Registry 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, "containerregistry.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, "containerregistry.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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 = "2017-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerRegistry/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, "containerregistry.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, "containerregistry.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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/containerregistry/mgmt/2017-06-01-preview/containerregistry/registries.go b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/registries.go deleted file mode 100644 index b8bfe81f5751..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/registries.go +++ /dev/null @@ -1,960 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RegistriesClient is the client for the Registries methods of the Containerregistry service. -type RegistriesClient struct { - BaseClient -} - -// NewRegistriesClient creates an instance of the RegistriesClient client. -func NewRegistriesClient(subscriptionID string) RegistriesClient { - return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient 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 NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { - return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only -// alphanumeric characters, be globally unique, and between 5 and 50 characters in length. -// Parameters: -// registryNameCheckRequest - the object containing information for the availability request. -func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryNameCheckRequest, - Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}, - }}, - {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters), - autorest.WithJSON(registryNameCheckRequest), - 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 RegistriesClient) 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 RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, 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 container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registry - the parameters for creating a container registry. -func (client RegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result RegistriesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: registry, - Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "registry.RegistryProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, registry) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registry), - 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 RegistriesClient) CreateSender(req *http.Request) (future RegistriesCreateFuture, 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 RegistriesClient) CreateResponder(resp *http.Response) (result Registry, 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 a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result RegistriesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) DeleteSender(req *http.Request) (future RegistriesDeleteFuture, 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 RegistriesClient) 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 the properties of the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) 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 RegistriesClient) GetResponder(resp *http.Response) (result Registry, 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 the container registries under the specified subscription. -func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 the container registries under the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.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, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RegistriesClient) 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 = "2017-06-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.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 -} - -// ListCredentials lists the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListCredentials") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListCredentials", err.Error()) - } - - req, err := client.ListCredentialsPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListCredentialsPreparer prepares the ListCredentials request. -func (client RegistriesClient) ListCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCredentialsSender sends the ListCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCredentialsResponder handles the response to the ListCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages gets the quota usages for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result RegistryUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListUsages") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client RegistriesClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/listUsages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListUsagesResponder(resp *http.Response) (result RegistryUsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateCredential regenerates one of the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// regenerateCredentialParameters - specifies name of the password which should be regenerated -- password or -// password2. -func (client RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.RegenerateCredential") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "RegenerateCredential", err.Error()) - } - - req, err := client.RegenerateCredentialPreparer(ctx, resourceGroupName, registryName, regenerateCredentialParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateCredentialSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request") - return - } - - result, err = client.RegenerateCredentialResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateCredentialPreparer prepares the RegenerateCredential request. -func (client RegistriesClient) RegenerateCredentialPreparer(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters), - autorest.WithJSON(regenerateCredentialParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always -// closes the http.Response Body. -func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, 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 container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registryUpdateParameters - the parameters for updating a container registry. -func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result RegistriesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, registryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registryUpdateParameters), - 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 RegistriesClient) UpdateSender(req *http.Request) (future RegistriesUpdateFuture, 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 RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, 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/containerregistry/mgmt/2017-06-01-preview/containerregistry/replications.go b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/replications.go deleted file mode 100644 index a70f6bff5577..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/replications.go +++ /dev/null @@ -1,532 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReplicationsClient is the client for the Replications methods of the Containerregistry service. -type ReplicationsClient struct { - BaseClient -} - -// NewReplicationsClient creates an instance of the ReplicationsClient client. -func NewReplicationsClient(subscriptionID string) ReplicationsClient { - return NewReplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationsClientWithBaseURI creates an instance of the ReplicationsClient 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 NewReplicationsClientWithBaseURI(baseURI string, subscriptionID string) ReplicationsClient { - return ReplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replication - the parameters for creating a replication. -func (client ReplicationsClient) Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (result ReplicationsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, replicationName, replication) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ReplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replication), - 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 ReplicationsClient) CreateSender(req *http.Request) (future ReplicationsCreateFuture, 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 ReplicationsClient) CreateResponder(resp *http.Response) (result Replication, 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 a replication from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result ReplicationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ReplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) DeleteSender(req *http.Request) (future ReplicationsDeleteFuture, 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 ReplicationsClient) 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 the properties of the specified replication. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result Replication, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) 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 ReplicationsClient) GetResponder(resp *http.Response) (result Replication, 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 the replications for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ReplicationsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.List") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ReplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/replications", 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 ReplicationsClient) 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 ReplicationsClient) ListResponder(resp *http.Response) (result ReplicationListResult, 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 ReplicationsClient) listNextResults(ctx context.Context, lastResults ReplicationListResult) (result ReplicationListResult, err error) { - req, err := lastResults.replicationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "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, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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, registryName) - return -} - -// Update updates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replicationUpdateParameters - the parameters for updating a replication. -func (client ReplicationsClient) Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (result ReplicationsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ReplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replicationUpdateParameters), - 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 ReplicationsClient) UpdateSender(req *http.Request) (future ReplicationsUpdateFuture, 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 ReplicationsClient) UpdateResponder(resp *http.Response) (result Replication, 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/containerregistry/mgmt/2017-06-01-preview/containerregistry/version.go b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/version.go deleted file mode 100644 index 77f79e548129..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerregistry - -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() + " containerregistry/2017-06-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/containerregistry/mgmt/2017-06-01-preview/containerregistry/webhooks.go b/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/webhooks.go deleted file mode 100644 index a21cef63f7ae..000000000000 --- a/services/preview/containerregistry/mgmt/2017-06-01-preview/containerregistry/webhooks.go +++ /dev/null @@ -1,850 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WebhooksClient is the client for the Webhooks methods of the Containerregistry service. -type WebhooksClient struct { - BaseClient -} - -// NewWebhooksClient creates an instance of the WebhooksClient client. -func NewWebhooksClient(subscriptionID string) WebhooksClient { - return NewWebhooksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhooksClientWithBaseURI creates an instance of the WebhooksClient 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 NewWebhooksClientWithBaseURI(baseURI string, subscriptionID string) WebhooksClient { - return WebhooksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a webhook for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookCreateParameters - the parameters for creating a webhook. -func (client WebhooksClient) Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (result WebhooksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookCreateParameters, - Constraints: []validation.Constraint{{Target: "webhookCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.ServiceURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client WebhooksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookCreateParameters), - 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 WebhooksClient) CreateSender(req *http.Request) (future WebhooksCreateFuture, 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 WebhooksClient) CreateResponder(resp *http.Response) (result Webhook, 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 a webhook from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result WebhooksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) DeleteSender(req *http.Request) (future WebhooksDeleteFuture, 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 WebhooksClient) 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 the properties of the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhooksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) 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 WebhooksClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCallbackConfig gets the configuration of service URI and custom headers for the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result CallbackConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.GetCallbackConfig") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "GetCallbackConfig", err.Error()) - } - - req, err := client.GetCallbackConfigPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", nil, "Failure preparing request") - return - } - - resp, err := client.GetCallbackConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure sending request") - return - } - - result, err = client.GetCallbackConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure responding to request") - return - } - - return -} - -// GetCallbackConfigPreparer prepares the GetCallbackConfig request. -func (client WebhooksClient) GetCallbackConfigPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCallbackConfigSender sends the GetCallbackConfig request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) GetCallbackConfigSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCallbackConfigResponder handles the response to the GetCallbackConfig request. The method always -// closes the http.Response Body. -func (client WebhooksClient) GetCallbackConfigResponder(resp *http.Response) (result CallbackConfig, 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 the webhooks for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client WebhooksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.List") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WebhooksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/webhooks", 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 WebhooksClient) 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 WebhooksClient) ListResponder(resp *http.Response) (result WebhookListResult, 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 WebhooksClient) listNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "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, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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, registryName) - return -} - -// ListEvents lists recent events for the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "ListEvents", err.Error()) - } - - result.fn = client.listEventsNextResults - req, err := client.ListEventsPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventsSender(req) - if err != nil { - result.elr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure sending request") - return - } - - result.elr, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure responding to request") - return - } - if result.elr.hasNextLink() && result.elr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListEventsPreparer prepares the ListEvents request. -func (client WebhooksClient) ListEventsPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventsSender sends the ListEvents request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) ListEventsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventsResponder handles the response to the ListEvents request. The method always -// closes the http.Response Body. -func (client WebhooksClient) ListEventsResponder(resp *http.Response) (result EventListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listEventsNextResults retrieves the next set of results, if any. -func (client WebhooksClient) listEventsNextResults(ctx context.Context, lastResults EventListResult) (result EventListResult, err error) { - req, err := lastResults.eventListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListEventsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListEventsComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.ListEvents(ctx, resourceGroupName, registryName, webhookName) - return -} - -// Ping triggers a ping event to be sent to the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Ping") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Ping", err.Error()) - } - - req, err := client.PingPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", nil, "Failure preparing request") - return - } - - resp, err := client.PingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure sending request") - return - } - - result, err = client.PingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure responding to request") - return - } - - return -} - -// PingPreparer prepares the Ping request. -func (client WebhooksClient) PingPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PingSender sends the Ping request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) PingSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PingResponder handles the response to the Ping request. The method always -// closes the http.Response Body. -func (client WebhooksClient) PingResponder(resp *http.Response) (result EventInfo, 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 webhook with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookUpdateParameters - the parameters for updating a webhook. -func (client WebhooksClient) Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (result WebhooksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookUpdateParameters), - 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 WebhooksClient) UpdateSender(req *http.Request) (future WebhooksUpdateFuture, 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 WebhooksClient) UpdateResponder(resp *http.Response) (result Webhook, 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/containerregistry/mgmt/2018-02-01/containerregistry/CHANGELOG.md b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/_meta.json b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/_meta.json deleted file mode 100644 index cccf92872d11..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "tag": "package-2018-02-preview", - "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-2018-02-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/builds.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/builds.go deleted file mode 100644 index eaa994b47b60..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/builds.go +++ /dev/null @@ -1,523 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BuildsClient is the client for the Builds methods of the Containerregistry service. -type BuildsClient struct { - BaseClient -} - -// NewBuildsClient creates an instance of the BuildsClient client. -func NewBuildsClient(subscriptionID string) BuildsClient { - return NewBuildsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBuildsClientWithBaseURI creates an instance of the BuildsClient 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 NewBuildsClientWithBaseURI(baseURI string, subscriptionID string) BuildsClient { - return BuildsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancel an existing build. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildID - the build ID. -func (client BuildsClient) Cancel(ctx context.Context, resourceGroupName string, registryName string, buildID string) (result BuildsCancelFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildsClient.Cancel") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildsClient", "Cancel", err.Error()) - } - - req, err := client.CancelPreparer(ctx, resourceGroupName, registryName, buildID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "Cancel", nil, "Failure preparing request") - return - } - - result, err = client.CancelSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "Cancel", result.Response(), "Failure sending request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client BuildsClient) CancelPreparer(ctx context.Context, resourceGroupName string, registryName string, buildID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildId": autorest.Encode("path", buildID), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client BuildsClient) CancelSender(req *http.Request) (future BuildsCancelFuture, 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 -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client BuildsClient) CancelResponder(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 gets the detailed information for a given build. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildID - the build ID. -func (client BuildsClient) Get(ctx context.Context, resourceGroupName string, registryName string, buildID string) (result Build, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, buildID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BuildsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, buildID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildId": autorest.Encode("path", buildID), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/builds/{buildId}", 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 BuildsClient) 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 BuildsClient) GetResponder(resp *http.Response) (result Build, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLogLink gets a link to download the build logs. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildID - the build ID. -func (client BuildsClient) GetLogLink(ctx context.Context, resourceGroupName string, registryName string, buildID string) (result BuildGetLogResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildsClient.GetLogLink") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildsClient", "GetLogLink", err.Error()) - } - - req, err := client.GetLogLinkPreparer(ctx, resourceGroupName, registryName, buildID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "GetLogLink", nil, "Failure preparing request") - return - } - - resp, err := client.GetLogLinkSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "GetLogLink", resp, "Failure sending request") - return - } - - result, err = client.GetLogLinkResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "GetLogLink", resp, "Failure responding to request") - return - } - - return -} - -// GetLogLinkPreparer prepares the GetLogLink request. -func (client BuildsClient) GetLogLinkPreparer(ctx context.Context, resourceGroupName string, registryName string, buildID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildId": autorest.Encode("path", buildID), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/builds/{buildId}/getLogLink", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLogLinkSender sends the GetLogLink request. The method will close the -// http.Response Body if it receives an error. -func (client BuildsClient) GetLogLinkSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLogLinkResponder handles the response to the GetLogLink request. The method always -// closes the http.Response Body. -func (client BuildsClient) GetLogLinkResponder(resp *http.Response) (result BuildGetLogResult, 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 the builds for a registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// filter - the builds filter to apply on the operation. -// top - $top is supported for get list of builds, which limits the maximum number of builds to return. -// skipToken - $skipToken is supported on get list of builds, which provides the next page in the list of -// builds. -func (client BuildsClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32, skipToken string) (result BuildListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildsClient.List") - defer func() { - sc := -1 - if result.blr.Response.Response != nil { - sc = result.blr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter, top, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.blr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "List", resp, "Failure sending request") - return - } - - result.blr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "List", resp, "Failure responding to request") - return - } - if result.blr.hasNextLink() && result.blr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BuildsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ContainerRegistry/registries/{registryName}/builds", 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 BuildsClient) 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 BuildsClient) ListResponder(resp *http.Response) (result BuildListResult, 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 BuildsClient) listNextResults(ctx context.Context, lastResults BuildListResult) (result BuildListResult, err error) { - req, err := lastResults.buildListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "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, "containerregistry.BuildsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client BuildsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32, skipToken string) (result BuildListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildsClient.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, registryName, filter, top, skipToken) - return -} - -// Update patch the build properties. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildID - the build ID. -// buildUpdateParameters - the build update properties. -func (client BuildsClient) Update(ctx context.Context, resourceGroupName string, registryName string, buildID string, buildUpdateParameters BuildUpdateParameters) (result BuildsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, buildID, buildUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BuildsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, buildID string, buildUpdateParameters BuildUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildId": autorest.Encode("path", buildID), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/builds/{buildId}", pathParameters), - autorest.WithJSON(buildUpdateParameters), - 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 BuildsClient) UpdateSender(req *http.Request) (future BuildsUpdateFuture, 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 BuildsClient) UpdateResponder(resp *http.Response) (result Build, 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/containerregistry/mgmt/2018-02-01/containerregistry/buildsteps.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/buildsteps.go deleted file mode 100644 index e1d2dceae072..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/buildsteps.go +++ /dev/null @@ -1,700 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BuildStepsClient is the client for the BuildSteps methods of the Containerregistry service. -type BuildStepsClient struct { - BaseClient -} - -// NewBuildStepsClient creates an instance of the BuildStepsClient client. -func NewBuildStepsClient(subscriptionID string) BuildStepsClient { - return NewBuildStepsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBuildStepsClientWithBaseURI creates an instance of the BuildStepsClient 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 NewBuildStepsClientWithBaseURI(baseURI string, subscriptionID string) BuildStepsClient { - return BuildStepsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a build step for a build task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -// stepName - the name of a build step for a container registry build task. -// buildStepCreateParameters - the parameters for creating a build step. -func (client BuildStepsClient) Create(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string, buildStepCreateParameters BuildStep) (result BuildStepsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: stepName, - Constraints: []validation.Constraint{{Target: "stepName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "stepName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "stepName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildStepsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, buildTaskName, stepName, buildStepCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client BuildStepsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string, buildStepCreateParameters BuildStep) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}", pathParameters), - autorest.WithJSON(buildStepCreateParameters), - 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 BuildStepsClient) CreateSender(req *http.Request) (future BuildStepsCreateFuture, 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 BuildStepsClient) CreateResponder(resp *http.Response) (result BuildStep, 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 a build step from the build task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -// stepName - the name of a build step for a container registry build task. -func (client BuildStepsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (result BuildStepsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: stepName, - Constraints: []validation.Constraint{{Target: "stepName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "stepName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "stepName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildStepsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, buildTaskName, stepName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BuildStepsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}", 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 BuildStepsClient) DeleteSender(req *http.Request) (future BuildStepsDeleteFuture, 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 BuildStepsClient) DeleteResponder(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 gets the build step for a build task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -// stepName - the name of a build step for a container registry build task. -func (client BuildStepsClient) Get(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (result BuildStep, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: stepName, - Constraints: []validation.Constraint{{Target: "stepName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "stepName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "stepName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildStepsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, buildTaskName, stepName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BuildStepsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}", 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 BuildStepsClient) 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 BuildStepsClient) GetResponder(resp *http.Response) (result BuildStep, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all the build steps for a given build task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -func (client BuildStepsClient) List(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result BuildStepListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepsClient.List") - defer func() { - sc := -1 - if result.bsl.Response.Response != nil { - sc = result.bsl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildStepsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName, buildTaskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.bsl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "List", resp, "Failure sending request") - return - } - - result.bsl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "List", resp, "Failure responding to request") - return - } - if result.bsl.hasNextLink() && result.bsl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BuildStepsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps", 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 BuildStepsClient) 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 BuildStepsClient) ListResponder(resp *http.Response) (result BuildStepList, 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 BuildStepsClient) listNextResults(ctx context.Context, lastResults BuildStepList) (result BuildStepList, err error) { - req, err := lastResults.buildStepListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "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, "containerregistry.BuildStepsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client BuildStepsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result BuildStepListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepsClient.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, registryName, buildTaskName) - return -} - -// ListBuildArguments list the build arguments for a step including the secret arguments. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -// stepName - the name of a build step for a container registry build task. -func (client BuildStepsClient) ListBuildArguments(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (result BuildArgumentListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepsClient.ListBuildArguments") - defer func() { - sc := -1 - if result.bal.Response.Response != nil { - sc = result.bal.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: stepName, - Constraints: []validation.Constraint{{Target: "stepName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "stepName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "stepName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildStepsClient", "ListBuildArguments", err.Error()) - } - - result.fn = client.listBuildArgumentsNextResults - req, err := client.ListBuildArgumentsPreparer(ctx, resourceGroupName, registryName, buildTaskName, stepName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "ListBuildArguments", nil, "Failure preparing request") - return - } - - resp, err := client.ListBuildArgumentsSender(req) - if err != nil { - result.bal.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "ListBuildArguments", resp, "Failure sending request") - return - } - - result.bal, err = client.ListBuildArgumentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "ListBuildArguments", resp, "Failure responding to request") - return - } - if result.bal.hasNextLink() && result.bal.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBuildArgumentsPreparer prepares the ListBuildArguments request. -func (client BuildStepsClient) ListBuildArgumentsPreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}/listBuildArguments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBuildArgumentsSender sends the ListBuildArguments request. The method will close the -// http.Response Body if it receives an error. -func (client BuildStepsClient) ListBuildArgumentsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBuildArgumentsResponder handles the response to the ListBuildArguments request. The method always -// closes the http.Response Body. -func (client BuildStepsClient) ListBuildArgumentsResponder(resp *http.Response) (result BuildArgumentList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBuildArgumentsNextResults retrieves the next set of results, if any. -func (client BuildStepsClient) listBuildArgumentsNextResults(ctx context.Context, lastResults BuildArgumentList) (result BuildArgumentList, err error) { - req, err := lastResults.buildArgumentListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "listBuildArgumentsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBuildArgumentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "listBuildArgumentsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBuildArgumentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "listBuildArgumentsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBuildArgumentsComplete enumerates all values, automatically crossing page boundaries as required. -func (client BuildStepsClient) ListBuildArgumentsComplete(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (result BuildArgumentListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepsClient.ListBuildArguments") - 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.ListBuildArguments(ctx, resourceGroupName, registryName, buildTaskName, stepName) - return -} - -// Update updates a build step in a build task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -// stepName - the name of a build step for a container registry build task. -// buildStepUpdateParameters - the parameters for updating a build step. -func (client BuildStepsClient) Update(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string, buildStepUpdateParameters BuildStepUpdateParameters) (result BuildStepsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepsClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: stepName, - Constraints: []validation.Constraint{{Target: "stepName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "stepName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "stepName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildStepsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BuildStepsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string, buildStepUpdateParameters BuildStepUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}", pathParameters), - autorest.WithJSON(buildStepUpdateParameters), - 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 BuildStepsClient) UpdateSender(req *http.Request) (future BuildStepsUpdateFuture, 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 BuildStepsClient) UpdateResponder(resp *http.Response) (result BuildStep, 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/containerregistry/mgmt/2018-02-01/containerregistry/buildtasks.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/buildtasks.go deleted file mode 100644 index 3a0d677eb7c7..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/buildtasks.go +++ /dev/null @@ -1,645 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BuildTasksClient is the client for the BuildTasks methods of the Containerregistry service. -type BuildTasksClient struct { - BaseClient -} - -// NewBuildTasksClient creates an instance of the BuildTasksClient client. -func NewBuildTasksClient(subscriptionID string) BuildTasksClient { - return NewBuildTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBuildTasksClientWithBaseURI creates an instance of the BuildTasksClient 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 NewBuildTasksClientWithBaseURI(baseURI string, subscriptionID string) BuildTasksClient { - return BuildTasksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a build task for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -// buildTaskCreateParameters - the parameters for creating a build task. -func (client BuildTasksClient) Create(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, buildTaskCreateParameters BuildTask) (result BuildTasksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildTasksClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskCreateParameters, - Constraints: []validation.Constraint{{Target: "buildTaskCreateParameters.BuildTaskProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "buildTaskCreateParameters.BuildTaskProperties.Alias", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "buildTaskCreateParameters.BuildTaskProperties.SourceRepository", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "buildTaskCreateParameters.BuildTaskProperties.SourceRepository.RepositoryURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "buildTaskCreateParameters.BuildTaskProperties.SourceRepository.SourceControlAuthProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "buildTaskCreateParameters.BuildTaskProperties.SourceRepository.SourceControlAuthProperties.Token", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "buildTaskCreateParameters.BuildTaskProperties.Platform", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "buildTaskCreateParameters.BuildTaskProperties.Timeout", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "buildTaskCreateParameters.BuildTaskProperties.Timeout", Name: validation.InclusiveMaximum, Rule: int64(28800), Chain: nil}, - {Target: "buildTaskCreateParameters.BuildTaskProperties.Timeout", Name: validation.InclusiveMinimum, Rule: int64(300), Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildTasksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client BuildTasksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, buildTaskCreateParameters BuildTask) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}", pathParameters), - autorest.WithJSON(buildTaskCreateParameters), - 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 BuildTasksClient) CreateSender(req *http.Request) (future BuildTasksCreateFuture, 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 BuildTasksClient) CreateResponder(resp *http.Response) (result BuildTask, 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 a specified build task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -func (client BuildTasksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result BuildTasksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildTasksClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildTasksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, buildTaskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BuildTasksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}", 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 BuildTasksClient) DeleteSender(req *http.Request) (future BuildTasksDeleteFuture, 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 BuildTasksClient) 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 get the properties of a specified build task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -func (client BuildTasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result BuildTask, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildTasksClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildTasksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, buildTaskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BuildTasksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}", 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 BuildTasksClient) 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 BuildTasksClient) GetResponder(resp *http.Response) (result BuildTask, 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 the build tasks for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// filter - the build task filter to apply on the operation. -// skipToken - $skipToken is supported on get list of build tasks, which provides the next page in the list of -// tasks. -func (client BuildTasksClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string, skipToken string) (result BuildTaskListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildTasksClient.List") - defer func() { - sc := -1 - if result.btlr.Response.Response != nil { - sc = result.btlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildTasksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.btlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "List", resp, "Failure sending request") - return - } - - result.btlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "List", resp, "Failure responding to request") - return - } - if result.btlr.hasNextLink() && result.btlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BuildTasksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - 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.ContainerRegistry/registries/{registryName}/buildTasks", 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 BuildTasksClient) 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 BuildTasksClient) ListResponder(resp *http.Response) (result BuildTaskListResult, 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 BuildTasksClient) listNextResults(ctx context.Context, lastResults BuildTaskListResult) (result BuildTaskListResult, err error) { - req, err := lastResults.buildTaskListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "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, "containerregistry.BuildTasksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client BuildTasksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, skipToken string) (result BuildTaskListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildTasksClient.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, registryName, filter, skipToken) - return -} - -// ListSourceRepositoryProperties get the source control properties for a build task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -func (client BuildTasksClient) ListSourceRepositoryProperties(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result SourceRepositoryProperties, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildTasksClient.ListSourceRepositoryProperties") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildTasksClient", "ListSourceRepositoryProperties", err.Error()) - } - - req, err := client.ListSourceRepositoryPropertiesPreparer(ctx, resourceGroupName, registryName, buildTaskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "ListSourceRepositoryProperties", nil, "Failure preparing request") - return - } - - resp, err := client.ListSourceRepositoryPropertiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "ListSourceRepositoryProperties", resp, "Failure sending request") - return - } - - result, err = client.ListSourceRepositoryPropertiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "ListSourceRepositoryProperties", resp, "Failure responding to request") - return - } - - return -} - -// ListSourceRepositoryPropertiesPreparer prepares the ListSourceRepositoryProperties request. -func (client BuildTasksClient) ListSourceRepositoryPropertiesPreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/listSourceRepositoryProperties", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSourceRepositoryPropertiesSender sends the ListSourceRepositoryProperties request. The method will close the -// http.Response Body if it receives an error. -func (client BuildTasksClient) ListSourceRepositoryPropertiesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSourceRepositoryPropertiesResponder handles the response to the ListSourceRepositoryProperties request. The method always -// closes the http.Response Body. -func (client BuildTasksClient) ListSourceRepositoryPropertiesResponder(resp *http.Response) (result SourceRepositoryProperties, 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 build task with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildTaskName - the name of the container registry build task. -// buildTaskUpdateParameters - the parameters for updating a build task. -func (client BuildTasksClient) Update(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, buildTaskUpdateParameters BuildTaskUpdateParameters) (result BuildTasksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildTasksClient.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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: buildTaskName, - Constraints: []validation.Constraint{{Target: "buildTaskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "buildTaskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "buildTaskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.BuildTasksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BuildTasksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, buildTaskUpdateParameters BuildTaskUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "buildTaskName": autorest.Encode("path", buildTaskName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}", pathParameters), - autorest.WithJSON(buildTaskUpdateParameters), - 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 BuildTasksClient) UpdateSender(req *http.Request) (future BuildTasksUpdateFuture, 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 BuildTasksClient) UpdateResponder(resp *http.Response) (result BuildTask, 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/containerregistry/mgmt/2018-02-01/containerregistry/client.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/client.go deleted file mode 100644 index 79937e123765..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerregistry implements the Azure ARM Containerregistry service API version . -// -// -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Containerregistry - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerregistry. -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/containerregistry/mgmt/2018-02-01/containerregistry/containerregistryapi/interfaces.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/containerregistryapi/interfaces.go deleted file mode 100644 index e4ed48cc1853..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/containerregistryapi/interfaces.go +++ /dev/null @@ -1,110 +0,0 @@ -package containerregistryapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/containerregistry/mgmt/2018-02-01/containerregistry" -) - -// RegistriesClientAPI contains the set of methods on the RegistriesClient type. -type RegistriesClientAPI interface { - CheckNameAvailability(ctx context.Context, registryNameCheckRequest containerregistry.RegistryNameCheckRequest) (result containerregistry.RegistryNameStatus, err error) - Create(ctx context.Context, resourceGroupName string, registryName string, registry containerregistry.Registry) (result containerregistry.RegistriesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistriesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.Registry, err error) - GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.SourceUploadDefinition, err error) - ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters containerregistry.ImportImageParameters) (result containerregistry.RegistriesImportImageFuture, err error) - List(ctx context.Context) (result containerregistry.RegistryListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.RegistryListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultIterator, err error) - ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryListCredentialsResult, err error) - ListPolicies(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryPolicies, err error) - ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryUsageListResult, err error) - QueueBuild(ctx context.Context, resourceGroupName string, registryName string, buildRequest containerregistry.BasicQueueBuildRequest) (result containerregistry.RegistriesQueueBuildFuture, err error) - RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters containerregistry.RegenerateCredentialParameters) (result containerregistry.RegistryListCredentialsResult, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters containerregistry.RegistryUpdateParameters) (result containerregistry.RegistriesUpdateFuture, err error) - UpdatePolicies(ctx context.Context, resourceGroupName string, registryName string, registryPoliciesUpdateParameters containerregistry.RegistryPolicies) (result containerregistry.RegistriesUpdatePoliciesFuture, err error) -} - -var _ RegistriesClientAPI = (*containerregistry.RegistriesClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result containerregistry.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*containerregistry.OperationsClient)(nil) - -// ReplicationsClientAPI contains the set of methods on the ReplicationsClient type. -type ReplicationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication containerregistry.Replication) (result containerregistry.ReplicationsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.ReplicationsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.Replication, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters containerregistry.ReplicationUpdateParameters) (result containerregistry.ReplicationsUpdateFuture, err error) -} - -var _ ReplicationsClientAPI = (*containerregistry.ReplicationsClient)(nil) - -// WebhooksClientAPI contains the set of methods on the WebhooksClient type. -type WebhooksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters containerregistry.WebhookCreateParameters) (result containerregistry.WebhooksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.WebhooksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.Webhook, err error) - GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.CallbackConfig, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultIterator, err error) - ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultPage, err error) - ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultIterator, err error) - Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventInfo, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters containerregistry.WebhookUpdateParameters) (result containerregistry.WebhooksUpdateFuture, err error) -} - -var _ WebhooksClientAPI = (*containerregistry.WebhooksClient)(nil) - -// BuildsClientAPI contains the set of methods on the BuildsClient type. -type BuildsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, registryName string, buildID string) (result containerregistry.BuildsCancelFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, buildID string) (result containerregistry.Build, err error) - GetLogLink(ctx context.Context, resourceGroupName string, registryName string, buildID string) (result containerregistry.BuildGetLogResult, err error) - List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32, skipToken string) (result containerregistry.BuildListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32, skipToken string) (result containerregistry.BuildListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, buildID string, buildUpdateParameters containerregistry.BuildUpdateParameters) (result containerregistry.BuildsUpdateFuture, err error) -} - -var _ BuildsClientAPI = (*containerregistry.BuildsClient)(nil) - -// BuildStepsClientAPI contains the set of methods on the BuildStepsClient type. -type BuildStepsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string, buildStepCreateParameters containerregistry.BuildStep) (result containerregistry.BuildStepsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (result containerregistry.BuildStepsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (result containerregistry.BuildStep, err error) - List(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result containerregistry.BuildStepListPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result containerregistry.BuildStepListIterator, err error) - ListBuildArguments(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (result containerregistry.BuildArgumentListPage, err error) - ListBuildArgumentsComplete(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string) (result containerregistry.BuildArgumentListIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, stepName string, buildStepUpdateParameters containerregistry.BuildStepUpdateParameters) (result containerregistry.BuildStepsUpdateFuture, err error) -} - -var _ BuildStepsClientAPI = (*containerregistry.BuildStepsClient)(nil) - -// BuildTasksClientAPI contains the set of methods on the BuildTasksClient type. -type BuildTasksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, buildTaskCreateParameters containerregistry.BuildTask) (result containerregistry.BuildTasksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result containerregistry.BuildTasksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result containerregistry.BuildTask, err error) - List(ctx context.Context, resourceGroupName string, registryName string, filter string, skipToken string) (result containerregistry.BuildTaskListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, skipToken string) (result containerregistry.BuildTaskListResultIterator, err error) - ListSourceRepositoryProperties(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string) (result containerregistry.SourceRepositoryProperties, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, buildTaskName string, buildTaskUpdateParameters containerregistry.BuildTaskUpdateParameters) (result containerregistry.BuildTasksUpdateFuture, err error) -} - -var _ BuildTasksClientAPI = (*containerregistry.BuildTasksClient)(nil) diff --git a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/enums.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/enums.go deleted file mode 100644 index f3d8fa6225c9..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/enums.go +++ /dev/null @@ -1,387 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Action enumerates the values for action. -type Action string - -const ( - // Allow ... - Allow Action = "Allow" -) - -// PossibleActionValues returns an array of possible values for the Action const type. -func PossibleActionValues() []Action { - return []Action{Allow} -} - -// BaseImageDependencyType enumerates the values for base image dependency type. -type BaseImageDependencyType string - -const ( - // BuildTime ... - BuildTime BaseImageDependencyType = "BuildTime" - // RunTime ... - RunTime BaseImageDependencyType = "RunTime" -) - -// PossibleBaseImageDependencyTypeValues returns an array of possible values for the BaseImageDependencyType const type. -func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { - return []BaseImageDependencyType{BuildTime, RunTime} -} - -// BaseImageTriggerType enumerates the values for base image trigger type. -type BaseImageTriggerType string - -const ( - // All ... - All BaseImageTriggerType = "All" - // None ... - None BaseImageTriggerType = "None" - // Runtime ... - Runtime BaseImageTriggerType = "Runtime" -) - -// PossibleBaseImageTriggerTypeValues returns an array of possible values for the BaseImageTriggerType const type. -func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { - return []BaseImageTriggerType{All, None, Runtime} -} - -// BuildStatus enumerates the values for build status. -type BuildStatus string - -const ( - // Canceled ... - Canceled BuildStatus = "Canceled" - // Error ... - Error BuildStatus = "Error" - // Failed ... - Failed BuildStatus = "Failed" - // Queued ... - Queued BuildStatus = "Queued" - // Running ... - Running BuildStatus = "Running" - // Started ... - Started BuildStatus = "Started" - // Succeeded ... - Succeeded BuildStatus = "Succeeded" - // Timeout ... - Timeout BuildStatus = "Timeout" -) - -// PossibleBuildStatusValues returns an array of possible values for the BuildStatus const type. -func PossibleBuildStatusValues() []BuildStatus { - return []BuildStatus{Canceled, Error, Failed, Queued, Running, Started, Succeeded, Timeout} -} - -// BuildTaskStatus enumerates the values for build task status. -type BuildTaskStatus string - -const ( - // Disabled ... - Disabled BuildTaskStatus = "Disabled" - // Enabled ... - Enabled BuildTaskStatus = "Enabled" -) - -// PossibleBuildTaskStatusValues returns an array of possible values for the BuildTaskStatus const type. -func PossibleBuildTaskStatusValues() []BuildTaskStatus { - return []BuildTaskStatus{Disabled, Enabled} -} - -// BuildType enumerates the values for build type. -type BuildType string - -const ( - // AutoBuild ... - AutoBuild BuildType = "AutoBuild" - // QuickBuild ... - QuickBuild BuildType = "QuickBuild" -) - -// PossibleBuildTypeValues returns an array of possible values for the BuildType const type. -func PossibleBuildTypeValues() []BuildType { - return []BuildType{AutoBuild, QuickBuild} -} - -// DefaultAction enumerates the values for default action. -type DefaultAction string - -const ( - // DefaultActionAllow ... - DefaultActionAllow DefaultAction = "Allow" - // DefaultActionDeny ... - DefaultActionDeny DefaultAction = "Deny" -) - -// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. -func PossibleDefaultActionValues() []DefaultAction { - return []DefaultAction{DefaultActionAllow, DefaultActionDeny} -} - -// ImportMode enumerates the values for import mode. -type ImportMode string - -const ( - // Force ... - Force ImportMode = "Force" - // NoForce ... - NoForce ImportMode = "NoForce" -) - -// PossibleImportModeValues returns an array of possible values for the ImportMode const type. -func PossibleImportModeValues() []ImportMode { - return []ImportMode{Force, NoForce} -} - -// OsType enumerates the values for os type. -type OsType string - -const ( - // Linux ... - Linux OsType = "Linux" - // Windows ... - Windows OsType = "Windows" -) - -// PossibleOsTypeValues returns an array of possible values for the OsType const type. -func PossibleOsTypeValues() []OsType { - return []OsType{Linux, Windows} -} - -// PasswordName enumerates the values for password name. -type PasswordName string - -const ( - // Password ... - Password PasswordName = "password" - // Password2 ... - Password2 PasswordName = "password2" -) - -// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type. -func PossiblePasswordNameValues() []PasswordName { - return []PasswordName{Password, Password2} -} - -// PolicyStatus enumerates the values for policy status. -type PolicyStatus string - -const ( - // PolicyStatusDisabled ... - PolicyStatusDisabled PolicyStatus = "disabled" - // PolicyStatusEnabled ... - PolicyStatusEnabled PolicyStatus = "enabled" -) - -// PossiblePolicyStatusValues returns an array of possible values for the PolicyStatus const type. -func PossiblePolicyStatusValues() []PolicyStatus { - return []PolicyStatus{PolicyStatusDisabled, PolicyStatusEnabled} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// RegistryUsageUnit enumerates the values for registry usage unit. -type RegistryUsageUnit string - -const ( - // Bytes ... - Bytes RegistryUsageUnit = "Bytes" - // Count ... - Count RegistryUsageUnit = "Count" -) - -// PossibleRegistryUsageUnitValues returns an array of possible values for the RegistryUsageUnit const type. -func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { - return []RegistryUsageUnit{Bytes, Count} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Basic ... - Basic SkuName = "Basic" - // Classic ... - Classic SkuName = "Classic" - // Premium ... - Premium SkuName = "Premium" - // Standard ... - Standard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{Basic, Classic, Premium, Standard} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic ... - SkuTierBasic SkuTier = "Basic" - // SkuTierClassic ... - SkuTierClassic SkuTier = "Classic" - // SkuTierPremium ... - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBasic, SkuTierClassic, SkuTierPremium, SkuTierStandard} -} - -// SourceControlType enumerates the values for source control type. -type SourceControlType string - -const ( - // Github ... - Github SourceControlType = "Github" - // VisualStudioTeamService ... - VisualStudioTeamService SourceControlType = "VisualStudioTeamService" -) - -// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. -func PossibleSourceControlTypeValues() []SourceControlType { - return []SourceControlType{Github, VisualStudioTeamService} -} - -// TokenType enumerates the values for token type. -type TokenType string - -const ( - // OAuth ... - OAuth TokenType = "OAuth" - // PAT ... - PAT TokenType = "PAT" -) - -// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. -func PossibleTokenTypeValues() []TokenType { - return []TokenType{OAuth, PAT} -} - -// TrustPolicyType enumerates the values for trust policy type. -type TrustPolicyType string - -const ( - // Notary ... - Notary TrustPolicyType = "Notary" -) - -// PossibleTrustPolicyTypeValues returns an array of possible values for the TrustPolicyType const type. -func PossibleTrustPolicyTypeValues() []TrustPolicyType { - return []TrustPolicyType{Notary} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeBuildStepProperties ... - TypeBuildStepProperties Type = "BuildStepProperties" - // TypeDocker ... - TypeDocker Type = "Docker" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeBuildStepProperties, TypeDocker} -} - -// TypeBasicBuildStepPropertiesUpdateParameters enumerates the values for type basic build step properties -// update parameters. -type TypeBasicBuildStepPropertiesUpdateParameters string - -const ( - // TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters ... - TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters TypeBasicBuildStepPropertiesUpdateParameters = "BuildStepPropertiesUpdateParameters" - // TypeBasicBuildStepPropertiesUpdateParametersTypeDocker ... - TypeBasicBuildStepPropertiesUpdateParametersTypeDocker TypeBasicBuildStepPropertiesUpdateParameters = "Docker" -) - -// PossibleTypeBasicBuildStepPropertiesUpdateParametersValues returns an array of possible values for the TypeBasicBuildStepPropertiesUpdateParameters const type. -func PossibleTypeBasicBuildStepPropertiesUpdateParametersValues() []TypeBasicBuildStepPropertiesUpdateParameters { - return []TypeBasicBuildStepPropertiesUpdateParameters{TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters, TypeBasicBuildStepPropertiesUpdateParametersTypeDocker} -} - -// TypeBasicQueueBuildRequest enumerates the values for type basic queue build request. -type TypeBasicQueueBuildRequest string - -const ( - // TypeBuildTask ... - TypeBuildTask TypeBasicQueueBuildRequest = "BuildTask" - // TypeQueueBuildRequest ... - TypeQueueBuildRequest TypeBasicQueueBuildRequest = "QueueBuildRequest" - // TypeQuickBuild ... - TypeQuickBuild TypeBasicQueueBuildRequest = "QuickBuild" -) - -// PossibleTypeBasicQueueBuildRequestValues returns an array of possible values for the TypeBasicQueueBuildRequest const type. -func PossibleTypeBasicQueueBuildRequestValues() []TypeBasicQueueBuildRequest { - return []TypeBasicQueueBuildRequest{TypeBuildTask, TypeQueueBuildRequest, TypeQuickBuild} -} - -// WebhookAction enumerates the values for webhook action. -type WebhookAction string - -const ( - // ChartDelete ... - ChartDelete WebhookAction = "chart_delete" - // ChartPush ... - ChartPush WebhookAction = "chart_push" - // Delete ... - Delete WebhookAction = "delete" - // Push ... - Push WebhookAction = "push" - // Quarantine ... - Quarantine WebhookAction = "quarantine" -) - -// PossibleWebhookActionValues returns an array of possible values for the WebhookAction const type. -func PossibleWebhookActionValues() []WebhookAction { - return []WebhookAction{ChartDelete, ChartPush, Delete, Push, Quarantine} -} - -// WebhookStatus enumerates the values for webhook status. -type WebhookStatus string - -const ( - // WebhookStatusDisabled ... - WebhookStatusDisabled WebhookStatus = "disabled" - // WebhookStatusEnabled ... - WebhookStatusEnabled WebhookStatus = "enabled" -) - -// PossibleWebhookStatusValues returns an array of possible values for the WebhookStatus const type. -func PossibleWebhookStatusValues() []WebhookStatus { - return []WebhookStatus{WebhookStatusDisabled, WebhookStatusEnabled} -} diff --git a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/models.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/models.go deleted file mode 100644 index 5ff664e860c3..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/models.go +++ /dev/null @@ -1,4552 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/containerregistry/mgmt/2018-02-01/containerregistry" - -// Actor the agent that initiated the event. For most situations, this could be from the authorization -// context of the request. -type Actor struct { - // Name - The subject or username associated with the request context that generated the event. - Name *string `json:"name,omitempty"` -} - -// BaseImageDependency properties that describe a base image dependency. -type BaseImageDependency struct { - // Type - The type of the base image dependency. Possible values include: 'BuildTime', 'RunTime' - Type BaseImageDependencyType `json:"type,omitempty"` - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// Build build resource properties -type Build struct { - autorest.Response `json:"-"` - // BuildProperties - The properties of a build. - *BuildProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` -} - -// MarshalJSON is the custom marshaler for Build. -func (b Build) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if b.BuildProperties != nil { - objectMap["properties"] = b.BuildProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Build struct. -func (b *Build) 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 buildProperties BuildProperties - err = json.Unmarshal(*v, &buildProperties) - if err != nil { - return err - } - b.BuildProperties = &buildProperties - } - 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 - } - } - } - - return nil -} - -// BuildArgument properties of a build argument. -type BuildArgument struct { - // Type - The type of the argument. - Type *string `json:"type,omitempty"` - // Name - The name of the argument. - Name *string `json:"name,omitempty"` - // Value - The value of the argument. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// BuildArgumentList the list of build arguments for a build step. -type BuildArgumentList struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]BuildArgument `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuildArgumentListIterator provides access to a complete listing of BuildArgument values. -type BuildArgumentListIterator struct { - i int - page BuildArgumentListPage -} - -// 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 *BuildArgumentListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildArgumentListIterator.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 *BuildArgumentListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuildArgumentListIterator) 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 BuildArgumentListIterator) Response() BuildArgumentList { - 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 BuildArgumentListIterator) Value() BuildArgument { - if !iter.page.NotDone() { - return BuildArgument{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuildArgumentListIterator type. -func NewBuildArgumentListIterator(page BuildArgumentListPage) BuildArgumentListIterator { - return BuildArgumentListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bal BuildArgumentList) IsEmpty() bool { - return bal.Value == nil || len(*bal.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bal BuildArgumentList) hasNextLink() bool { - return bal.NextLink != nil && len(*bal.NextLink) != 0 -} - -// buildArgumentListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bal BuildArgumentList) buildArgumentListPreparer(ctx context.Context) (*http.Request, error) { - if !bal.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bal.NextLink))) -} - -// BuildArgumentListPage contains a page of BuildArgument values. -type BuildArgumentListPage struct { - fn func(context.Context, BuildArgumentList) (BuildArgumentList, error) - bal BuildArgumentList -} - -// 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 *BuildArgumentListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildArgumentListPage.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.bal) - if err != nil { - return err - } - page.bal = 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 *BuildArgumentListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuildArgumentListPage) NotDone() bool { - return !page.bal.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuildArgumentListPage) Response() BuildArgumentList { - return page.bal -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuildArgumentListPage) Values() []BuildArgument { - if page.bal.IsEmpty() { - return nil - } - return *page.bal.Value -} - -// Creates a new instance of the BuildArgumentListPage type. -func NewBuildArgumentListPage(cur BuildArgumentList, getNextPage func(context.Context, BuildArgumentList) (BuildArgumentList, error)) BuildArgumentListPage { - return BuildArgumentListPage{ - fn: getNextPage, - bal: cur, - } -} - -// BuildFilter properties that are enabled for Odata querying. -type BuildFilter struct { - // BuildID - The unique identifier for the build. - BuildID *string `json:"buildId,omitempty"` - // BuildType - The type of build. Possible values include: 'AutoBuild', 'QuickBuild' - BuildType BuildType `json:"buildType,omitempty"` - // Status - The current status of the build. Possible values include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', 'Canceled', 'Error', 'Timeout' - Status BuildStatus `json:"status,omitempty"` - // CreateTime - The create time for a build. - CreateTime *date.Time `json:"createTime,omitempty"` - // FinishTime - The time the build finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImageManifests - The list of comma-separated image manifests that were generated from the build. - OutputImageManifests *string `json:"outputImageManifests,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // BuildTaskName - The name of the build task that the build corresponds to. - BuildTaskName *string `json:"buildTaskName,omitempty"` -} - -// BuildGetLogResult the result of get log link operation. -type BuildGetLogResult struct { - autorest.Response `json:"-"` - // LogLink - The link to logs for a azure container registry build. - LogLink *string `json:"logLink,omitempty"` -} - -// BuildListResult collection of builds. -type BuildListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Build `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuildListResultIterator provides access to a complete listing of Build values. -type BuildListResultIterator struct { - i int - page BuildListResultPage -} - -// 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 *BuildListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildListResultIterator.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 *BuildListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuildListResultIterator) 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 BuildListResultIterator) Response() BuildListResult { - 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 BuildListResultIterator) Value() Build { - if !iter.page.NotDone() { - return Build{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuildListResultIterator type. -func NewBuildListResultIterator(page BuildListResultPage) BuildListResultIterator { - return BuildListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (blr BuildListResult) IsEmpty() bool { - return blr.Value == nil || len(*blr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (blr BuildListResult) hasNextLink() bool { - return blr.NextLink != nil && len(*blr.NextLink) != 0 -} - -// buildListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (blr BuildListResult) buildListResultPreparer(ctx context.Context) (*http.Request, error) { - if !blr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(blr.NextLink))) -} - -// BuildListResultPage contains a page of Build values. -type BuildListResultPage struct { - fn func(context.Context, BuildListResult) (BuildListResult, error) - blr BuildListResult -} - -// 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 *BuildListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildListResultPage.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.blr) - if err != nil { - return err - } - page.blr = 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 *BuildListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuildListResultPage) NotDone() bool { - return !page.blr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuildListResultPage) Response() BuildListResult { - return page.blr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuildListResultPage) Values() []Build { - if page.blr.IsEmpty() { - return nil - } - return *page.blr.Value -} - -// Creates a new instance of the BuildListResultPage type. -func NewBuildListResultPage(cur BuildListResult, getNextPage func(context.Context, BuildListResult) (BuildListResult, error)) BuildListResultPage { - return BuildListResultPage{ - fn: getNextPage, - blr: cur, - } -} - -// BuildProperties the properties for a build. -type BuildProperties struct { - // BuildID - The unique identifier for the build. - BuildID *string `json:"buildId,omitempty"` - // Status - The current status of the build. Possible values include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', 'Canceled', 'Error', 'Timeout' - Status BuildStatus `json:"status,omitempty"` - // LastUpdatedTime - The last updated time for the build. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // BuildType - The type of build. Possible values include: 'AutoBuild', 'QuickBuild' - BuildType BuildType `json:"buildType,omitempty"` - // CreateTime - The time the build was created. - CreateTime *date.Time `json:"createTime,omitempty"` - // StartTime - The time the build started. - StartTime *date.Time `json:"startTime,omitempty"` - // FinishTime - The time the build finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImages - The list of all images that were generated from the build. - OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` - // BuildTask - The build task with which the build was started. - BuildTask *string `json:"buildTask,omitempty"` - // ImageUpdateTrigger - The image update trigger that caused the build. - ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` - // GitCommitTrigger - The git commit trigger that caused the build. - GitCommitTrigger *GitCommitTrigger `json:"gitCommitTrigger,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // Platform - The platform properties against which the build will happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // ProvisioningState - The provisioning state of a build. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// BuildsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type BuildsCancelFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildsCancelFuture) 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 BuildsCancelFuture.Result. -func (future *BuildsCancelFuture) result(client BuildsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsCancelFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.BuildsCancelFuture") - return - } - ar.Response = future.Response() - return -} - -// BuildStep build step resource properties -type BuildStep struct { - autorest.Response `json:"-"` - // Properties - The properties of a build step. - Properties BasicBuildStepProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` -} - -// MarshalJSON is the custom marshaler for BuildStep. -func (bs BuildStep) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = bs.Properties - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BuildStep struct. -func (bs *BuildStep) 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 { - properties, err := unmarshalBasicBuildStepProperties(*v) - if err != nil { - return err - } - bs.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bs.Type = &typeVar - } - } - } - - return nil -} - -// BuildStepList the collection of build items. -type BuildStepList struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]BuildStep `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuildStepListIterator provides access to a complete listing of BuildStep values. -type BuildStepListIterator struct { - i int - page BuildStepListPage -} - -// 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 *BuildStepListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepListIterator.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 *BuildStepListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuildStepListIterator) 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 BuildStepListIterator) Response() BuildStepList { - 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 BuildStepListIterator) Value() BuildStep { - if !iter.page.NotDone() { - return BuildStep{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuildStepListIterator type. -func NewBuildStepListIterator(page BuildStepListPage) BuildStepListIterator { - return BuildStepListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bsl BuildStepList) IsEmpty() bool { - return bsl.Value == nil || len(*bsl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bsl BuildStepList) hasNextLink() bool { - return bsl.NextLink != nil && len(*bsl.NextLink) != 0 -} - -// buildStepListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bsl BuildStepList) buildStepListPreparer(ctx context.Context) (*http.Request, error) { - if !bsl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bsl.NextLink))) -} - -// BuildStepListPage contains a page of BuildStep values. -type BuildStepListPage struct { - fn func(context.Context, BuildStepList) (BuildStepList, error) - bsl BuildStepList -} - -// 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 *BuildStepListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildStepListPage.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.bsl) - if err != nil { - return err - } - page.bsl = 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 *BuildStepListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuildStepListPage) NotDone() bool { - return !page.bsl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuildStepListPage) Response() BuildStepList { - return page.bsl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuildStepListPage) Values() []BuildStep { - if page.bsl.IsEmpty() { - return nil - } - return *page.bsl.Value -} - -// Creates a new instance of the BuildStepListPage type. -func NewBuildStepListPage(cur BuildStepList, getNextPage func(context.Context, BuildStepList) (BuildStepList, error)) BuildStepListPage { - return BuildStepListPage{ - fn: getNextPage, - bsl: cur, - } -} - -// BasicBuildStepProperties base properties for any build step. -type BasicBuildStepProperties interface { - AsDockerBuildStep() (*DockerBuildStep, bool) - AsBuildStepProperties() (*BuildStepProperties, bool) -} - -// BuildStepProperties base properties for any build step. -type BuildStepProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the build step. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Type - Possible values include: 'TypeBuildStepProperties', 'TypeDocker' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicBuildStepProperties(body []byte) (BasicBuildStepProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeDocker): - var dbs DockerBuildStep - err := json.Unmarshal(body, &dbs) - return dbs, err - default: - var bsp BuildStepProperties - err := json.Unmarshal(body, &bsp) - return bsp, err - } -} -func unmarshalBasicBuildStepPropertiesArray(body []byte) ([]BasicBuildStepProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - bspArray := make([]BasicBuildStepProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bsp, err := unmarshalBasicBuildStepProperties(*rawMessage) - if err != nil { - return nil, err - } - bspArray[index] = bsp - } - return bspArray, nil -} - -// MarshalJSON is the custom marshaler for BuildStepProperties. -func (bsp BuildStepProperties) MarshalJSON() ([]byte, error) { - bsp.Type = TypeBuildStepProperties - objectMap := make(map[string]interface{}) - if bsp.Type != "" { - objectMap["type"] = bsp.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicBuildStepProperties implementation for BuildStepProperties. -func (bsp BuildStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsBuildStepProperties is the BasicBuildStepProperties implementation for BuildStepProperties. -func (bsp BuildStepProperties) AsBuildStepProperties() (*BuildStepProperties, bool) { - return &bsp, true -} - -// AsBasicBuildStepProperties is the BasicBuildStepProperties implementation for BuildStepProperties. -func (bsp BuildStepProperties) AsBasicBuildStepProperties() (BasicBuildStepProperties, bool) { - return &bsp, true -} - -// BasicBuildStepPropertiesUpdateParameters the properties for updating a build step. -type BasicBuildStepPropertiesUpdateParameters interface { - AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) - AsBuildStepPropertiesUpdateParameters() (*BuildStepPropertiesUpdateParameters, bool) -} - -// BuildStepPropertiesUpdateParameters the properties for updating a build step. -type BuildStepPropertiesUpdateParameters struct { - // Type - Possible values include: 'TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters', 'TypeBasicBuildStepPropertiesUpdateParametersTypeDocker' - Type TypeBasicBuildStepPropertiesUpdateParameters `json:"type,omitempty"` -} - -func unmarshalBasicBuildStepPropertiesUpdateParameters(body []byte) (BasicBuildStepPropertiesUpdateParameters, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicBuildStepPropertiesUpdateParametersTypeDocker): - var dbsup DockerBuildStepUpdateParameters - err := json.Unmarshal(body, &dbsup) - return dbsup, err - default: - var bspup BuildStepPropertiesUpdateParameters - err := json.Unmarshal(body, &bspup) - return bspup, err - } -} -func unmarshalBasicBuildStepPropertiesUpdateParametersArray(body []byte) ([]BasicBuildStepPropertiesUpdateParameters, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - bspupArray := make([]BasicBuildStepPropertiesUpdateParameters, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bspup, err := unmarshalBasicBuildStepPropertiesUpdateParameters(*rawMessage) - if err != nil { - return nil, err - } - bspupArray[index] = bspup - } - return bspupArray, nil -} - -// MarshalJSON is the custom marshaler for BuildStepPropertiesUpdateParameters. -func (bspup BuildStepPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - bspup.Type = TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters - objectMap := make(map[string]interface{}) - if bspup.Type != "" { - objectMap["type"] = bspup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for BuildStepPropertiesUpdateParameters. -func (bspup BuildStepPropertiesUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for BuildStepPropertiesUpdateParameters. -func (bspup BuildStepPropertiesUpdateParameters) AsBuildStepPropertiesUpdateParameters() (*BuildStepPropertiesUpdateParameters, bool) { - return &bspup, true -} - -// AsBasicBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for BuildStepPropertiesUpdateParameters. -func (bspup BuildStepPropertiesUpdateParameters) AsBasicBuildStepPropertiesUpdateParameters() (BasicBuildStepPropertiesUpdateParameters, bool) { - return &bspup, true -} - -// BuildStepsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BuildStepsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildStepsClient) (BuildStep, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildStepsCreateFuture) 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 BuildStepsCreateFuture.Result. -func (future *BuildStepsCreateFuture) result(client BuildStepsClient) (bs BuildStep, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bs.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.BuildStepsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bs.Response.Response, err = future.GetResult(sender); err == nil && bs.Response.Response.StatusCode != http.StatusNoContent { - bs, err = client.CreateResponder(bs.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsCreateFuture", "Result", bs.Response.Response, "Failure responding to request") - } - } - return -} - -// BuildStepsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BuildStepsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildStepsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildStepsDeleteFuture) 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 BuildStepsDeleteFuture.Result. -func (future *BuildStepsDeleteFuture) result(client BuildStepsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.BuildStepsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BuildStepsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BuildStepsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildStepsClient) (BuildStep, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildStepsUpdateFuture) 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 BuildStepsUpdateFuture.Result. -func (future *BuildStepsUpdateFuture) result(client BuildStepsClient) (bs BuildStep, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bs.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.BuildStepsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bs.Response.Response, err = future.GetResult(sender); err == nil && bs.Response.Response.StatusCode != http.StatusNoContent { - bs, err = client.UpdateResponder(bs.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsUpdateFuture", "Result", bs.Response.Response, "Failure responding to request") - } - } - return -} - -// BuildStepUpdateParameters the parameters for updating a build step. -type BuildStepUpdateParameters struct { - // Properties - The properties for updating a build step. - Properties BasicBuildStepPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for BuildStepUpdateParameters. -func (bsup BuildStepUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = bsup.Properties - if bsup.Tags != nil { - objectMap["tags"] = bsup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BuildStepUpdateParameters struct. -func (bsup *BuildStepUpdateParameters) 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 { - properties, err := unmarshalBasicBuildStepPropertiesUpdateParameters(*v) - if err != nil { - return err - } - bsup.Properties = properties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bsup.Tags = tags - } - } - } - - return nil -} - -// BuildsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type BuildsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildsClient) (Build, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildsUpdateFuture) 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 BuildsUpdateFuture.Result. -func (future *BuildsUpdateFuture) result(client BuildsClient) (b Build, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - b.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.BuildsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { - b, err = client.UpdateResponder(b.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildsUpdateFuture", "Result", b.Response.Response, "Failure responding to request") - } - } - return -} - -// BuildTask the build task that has the resource properties and all build items. The build task will have -// all information to schedule a build against it. -type BuildTask struct { - autorest.Response `json:"-"` - // BuildTaskProperties - The properties of a build task. - *BuildTaskProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for BuildTask. -func (bt BuildTask) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bt.BuildTaskProperties != nil { - objectMap["properties"] = bt.BuildTaskProperties - } - if bt.Location != nil { - objectMap["location"] = bt.Location - } - if bt.Tags != nil { - objectMap["tags"] = bt.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BuildTask struct. -func (bt *BuildTask) 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 buildTaskProperties BuildTaskProperties - err = json.Unmarshal(*v, &buildTaskProperties) - if err != nil { - return err - } - bt.BuildTaskProperties = &buildTaskProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bt.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bt.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bt.Tags = tags - } - } - } - - return nil -} - -// BuildTaskBuildRequest the queue build parameters based on a build task. -type BuildTaskBuildRequest struct { - // BuildTaskName - The name of build task against which build has to be queued. - BuildTaskName *string `json:"buildTaskName,omitempty"` - // Type - Possible values include: 'TypeQueueBuildRequest', 'TypeBuildTask', 'TypeQuickBuild' - Type TypeBasicQueueBuildRequest `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildTaskBuildRequest. -func (btbr BuildTaskBuildRequest) MarshalJSON() ([]byte, error) { - btbr.Type = TypeBuildTask - objectMap := make(map[string]interface{}) - if btbr.BuildTaskName != nil { - objectMap["buildTaskName"] = btbr.BuildTaskName - } - if btbr.Type != "" { - objectMap["type"] = btbr.Type - } - return json.Marshal(objectMap) -} - -// AsBuildTaskBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest. -func (btbr BuildTaskBuildRequest) AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) { - return &btbr, true -} - -// AsQuickBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest. -func (btbr BuildTaskBuildRequest) AsQuickBuildRequest() (*QuickBuildRequest, bool) { - return nil, false -} - -// AsQueueBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest. -func (btbr BuildTaskBuildRequest) AsQueueBuildRequest() (*QueueBuildRequest, bool) { - return nil, false -} - -// AsBasicQueueBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest. -func (btbr BuildTaskBuildRequest) AsBasicQueueBuildRequest() (BasicQueueBuildRequest, bool) { - return &btbr, true -} - -// BuildTaskFilter the filter that can be used for listing build tasks. -type BuildTaskFilter struct { - // Alias - The alternative name for build task. - Alias *string `json:"alias,omitempty"` -} - -// BuildTaskListResult the collection of build tasks. -type BuildTaskListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]BuildTask `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuildTaskListResultIterator provides access to a complete listing of BuildTask values. -type BuildTaskListResultIterator struct { - i int - page BuildTaskListResultPage -} - -// 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 *BuildTaskListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildTaskListResultIterator.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 *BuildTaskListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuildTaskListResultIterator) 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 BuildTaskListResultIterator) Response() BuildTaskListResult { - 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 BuildTaskListResultIterator) Value() BuildTask { - if !iter.page.NotDone() { - return BuildTask{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuildTaskListResultIterator type. -func NewBuildTaskListResultIterator(page BuildTaskListResultPage) BuildTaskListResultIterator { - return BuildTaskListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (btlr BuildTaskListResult) IsEmpty() bool { - return btlr.Value == nil || len(*btlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (btlr BuildTaskListResult) hasNextLink() bool { - return btlr.NextLink != nil && len(*btlr.NextLink) != 0 -} - -// buildTaskListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (btlr BuildTaskListResult) buildTaskListResultPreparer(ctx context.Context) (*http.Request, error) { - if !btlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(btlr.NextLink))) -} - -// BuildTaskListResultPage contains a page of BuildTask values. -type BuildTaskListResultPage struct { - fn func(context.Context, BuildTaskListResult) (BuildTaskListResult, error) - btlr BuildTaskListResult -} - -// 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 *BuildTaskListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildTaskListResultPage.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.btlr) - if err != nil { - return err - } - page.btlr = 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 *BuildTaskListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuildTaskListResultPage) NotDone() bool { - return !page.btlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuildTaskListResultPage) Response() BuildTaskListResult { - return page.btlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuildTaskListResultPage) Values() []BuildTask { - if page.btlr.IsEmpty() { - return nil - } - return *page.btlr.Value -} - -// Creates a new instance of the BuildTaskListResultPage type. -func NewBuildTaskListResultPage(cur BuildTaskListResult, getNextPage func(context.Context, BuildTaskListResult) (BuildTaskListResult, error)) BuildTaskListResultPage { - return BuildTaskListResultPage{ - fn: getNextPage, - btlr: cur, - } -} - -// BuildTaskProperties the properties of a build task. -type BuildTaskProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the build task. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CreationDate - READ-ONLY; The creation date of build task. - CreationDate *date.Time `json:"creationDate,omitempty"` - // Alias - The alternative updatable name for a build task. - Alias *string `json:"alias,omitempty"` - // Status - The current status of build task. Possible values include: 'Disabled', 'Enabled' - Status BuildTaskStatus `json:"status,omitempty"` - // SourceRepository - The properties that describes the source(code) for the build task. - SourceRepository *SourceRepositoryProperties `json:"sourceRepository,omitempty"` - // Platform - The platform properties against which the build has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // Timeout - Build timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildTaskProperties. -func (btp BuildTaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if btp.Alias != nil { - objectMap["alias"] = btp.Alias - } - if btp.Status != "" { - objectMap["status"] = btp.Status - } - if btp.SourceRepository != nil { - objectMap["sourceRepository"] = btp.SourceRepository - } - if btp.Platform != nil { - objectMap["platform"] = btp.Platform - } - if btp.Timeout != nil { - objectMap["timeout"] = btp.Timeout - } - return json.Marshal(objectMap) -} - -// BuildTaskPropertiesUpdateParameters the properties for updating a build task. -type BuildTaskPropertiesUpdateParameters struct { - // Alias - The alternative updatable name for a build task. - Alias *string `json:"alias,omitempty"` - // Status - The current status of build task. Possible values include: 'Disabled', 'Enabled' - Status BuildTaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the build has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // Timeout - Build timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // SourceRepository - The properties that describes the source(code) for the build task. - SourceRepository *SourceRepositoryUpdateParameters `json:"sourceRepository,omitempty"` -} - -// BuildTasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BuildTasksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildTasksClient) (BuildTask, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildTasksCreateFuture) 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 BuildTasksCreateFuture.Result. -func (future *BuildTasksCreateFuture) result(client BuildTasksClient) (bt BuildTask, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.BuildTasksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bt.Response.Response, err = future.GetResult(sender); err == nil && bt.Response.Response.StatusCode != http.StatusNoContent { - bt, err = client.CreateResponder(bt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksCreateFuture", "Result", bt.Response.Response, "Failure responding to request") - } - } - return -} - -// BuildTasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BuildTasksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildTasksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildTasksDeleteFuture) 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 BuildTasksDeleteFuture.Result. -func (future *BuildTasksDeleteFuture) result(client BuildTasksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.BuildTasksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BuildTasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BuildTasksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildTasksClient) (BuildTask, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildTasksUpdateFuture) 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 BuildTasksUpdateFuture.Result. -func (future *BuildTasksUpdateFuture) result(client BuildTasksClient) (bt BuildTask, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.BuildTasksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bt.Response.Response, err = future.GetResult(sender); err == nil && bt.Response.Response.StatusCode != http.StatusNoContent { - bt, err = client.UpdateResponder(bt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksUpdateFuture", "Result", bt.Response.Response, "Failure responding to request") - } - } - return -} - -// BuildTaskUpdateParameters the parameters for updating a build task. -type BuildTaskUpdateParameters struct { - // BuildTaskPropertiesUpdateParameters - The properties for updating a build task. - *BuildTaskPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for BuildTaskUpdateParameters. -func (btup BuildTaskUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if btup.BuildTaskPropertiesUpdateParameters != nil { - objectMap["properties"] = btup.BuildTaskPropertiesUpdateParameters - } - if btup.Tags != nil { - objectMap["tags"] = btup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BuildTaskUpdateParameters struct. -func (btup *BuildTaskUpdateParameters) 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 buildTaskPropertiesUpdateParameters BuildTaskPropertiesUpdateParameters - err = json.Unmarshal(*v, &buildTaskPropertiesUpdateParameters) - if err != nil { - return err - } - btup.BuildTaskPropertiesUpdateParameters = &buildTaskPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - btup.Tags = tags - } - } - } - - return nil -} - -// BuildUpdateParameters the set of build properties that can be updated. -type BuildUpdateParameters struct { - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` -} - -// CallbackConfig the configuration of service URI and custom headers for the webhook. -type CallbackConfig struct { - autorest.Response `json:"-"` - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` -} - -// MarshalJSON is the custom marshaler for CallbackConfig. -func (cc CallbackConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.ServiceURI != nil { - objectMap["serviceUri"] = cc.ServiceURI - } - if cc.CustomHeaders != nil { - objectMap["customHeaders"] = cc.CustomHeaders - } - return json.Marshal(objectMap) -} - -// DockerBuildStep the Docker build step. -type DockerBuildStep struct { - // Branch - The repository branch name. - Branch *string `json:"branch,omitempty"` - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source control root. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // ContextPath - The relative context path for a docker build in the source. - ContextPath *string `json:"contextPath,omitempty"` - // BuildArguments - The custom arguments for building this build step. - BuildArguments *[]BuildArgument `json:"buildArguments,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // BaseImageTrigger - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime', 'None' - BaseImageTrigger BaseImageTriggerType `json:"baseImageTrigger,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the build step. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Type - Possible values include: 'TypeBuildStepProperties', 'TypeDocker' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStep. -func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) { - dbs.Type = TypeDocker - objectMap := make(map[string]interface{}) - if dbs.Branch != nil { - objectMap["branch"] = dbs.Branch - } - if dbs.ImageNames != nil { - objectMap["imageNames"] = dbs.ImageNames - } - if dbs.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbs.IsPushEnabled - } - if dbs.NoCache != nil { - objectMap["noCache"] = dbs.NoCache - } - if dbs.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbs.DockerFilePath - } - if dbs.ContextPath != nil { - objectMap["contextPath"] = dbs.ContextPath - } - if dbs.BuildArguments != nil { - objectMap["buildArguments"] = dbs.BuildArguments - } - if dbs.BaseImageTrigger != "" { - objectMap["baseImageTrigger"] = dbs.BaseImageTrigger - } - if dbs.Type != "" { - objectMap["type"] = dbs.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicBuildStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return &dbs, true -} - -// AsBuildStepProperties is the BasicBuildStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsBuildStepProperties() (*BuildStepProperties, bool) { - return nil, false -} - -// AsBasicBuildStepProperties is the BasicBuildStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsBasicBuildStepProperties() (BasicBuildStepProperties, bool) { - return &dbs, true -} - -// DockerBuildStepUpdateParameters the properties for updating a docker build step. -type DockerBuildStepUpdateParameters struct { - // Branch - The repository branch name. - Branch *string `json:"branch,omitempty"` - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source control root. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // ContextPath - The relative context path for a docker build in the source. - ContextPath *string `json:"contextPath,omitempty"` - // BuildArguments - The custom arguments for building this build step. - BuildArguments *[]BuildArgument `json:"buildArguments,omitempty"` - // BaseImageTrigger - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime', 'None' - BaseImageTrigger BaseImageTriggerType `json:"baseImageTrigger,omitempty"` - // Type - Possible values include: 'TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters', 'TypeBasicBuildStepPropertiesUpdateParametersTypeDocker' - Type TypeBasicBuildStepPropertiesUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { - dbsup.Type = TypeBasicBuildStepPropertiesUpdateParametersTypeDocker - objectMap := make(map[string]interface{}) - if dbsup.Branch != nil { - objectMap["branch"] = dbsup.Branch - } - if dbsup.ImageNames != nil { - objectMap["imageNames"] = dbsup.ImageNames - } - if dbsup.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbsup.IsPushEnabled - } - if dbsup.NoCache != nil { - objectMap["noCache"] = dbsup.NoCache - } - if dbsup.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbsup.DockerFilePath - } - if dbsup.ContextPath != nil { - objectMap["contextPath"] = dbsup.ContextPath - } - if dbsup.BuildArguments != nil { - objectMap["buildArguments"] = dbsup.BuildArguments - } - if dbsup.BaseImageTrigger != "" { - objectMap["baseImageTrigger"] = dbsup.BaseImageTrigger - } - if dbsup.Type != "" { - objectMap["type"] = dbsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return &dbsup, true -} - -// AsBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsBuildStepPropertiesUpdateParameters() (*BuildStepPropertiesUpdateParameters, bool) { - return nil, false -} - -// AsBasicBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsBasicBuildStepPropertiesUpdateParameters() (BasicBuildStepPropertiesUpdateParameters, bool) { - return &dbsup, true -} - -// Event the event for a webhook. -type Event struct { - // EventRequestMessage - The event request message sent to the service URI. - EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` - // EventResponseMessage - The event response message received from the service URI. - EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventContent the content of the event request message. -type EventContent struct { - // ID - The event ID. - ID *string `json:"id,omitempty"` - // Timestamp - The time at which the event occurred. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Action - The action that encompasses the provided event. - Action *string `json:"action,omitempty"` - // Target - The target of the event. - Target *Target `json:"target,omitempty"` - // Request - The request that generated the event. - Request *Request `json:"request,omitempty"` - // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. - Actor *Actor `json:"actor,omitempty"` - // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - Source *Source `json:"source,omitempty"` -} - -// EventInfo the basic information of an event. -type EventInfo struct { - autorest.Response `json:"-"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventListResult the result of a request to list events for a webhook. -type EventListResult struct { - autorest.Response `json:"-"` - // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - Value *[]Event `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventListResultIterator provides access to a complete listing of Event values. -type EventListResultIterator struct { - i int - page EventListResultPage -} - -// 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 *EventListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.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 *EventListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventListResultIterator) 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 EventListResultIterator) Response() EventListResult { - 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 EventListResultIterator) Value() Event { - if !iter.page.NotDone() { - return Event{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventListResultIterator type. -func NewEventListResultIterator(page EventListResultPage) EventListResultIterator { - return EventListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (elr EventListResult) IsEmpty() bool { - return elr.Value == nil || len(*elr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (elr EventListResult) hasNextLink() bool { - return elr.NextLink != nil && len(*elr.NextLink) != 0 -} - -// eventListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (elr EventListResult) eventListResultPreparer(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))) -} - -// EventListResultPage contains a page of Event values. -type EventListResultPage struct { - fn func(context.Context, EventListResult) (EventListResult, error) - elr EventListResult -} - -// 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 *EventListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.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 *EventListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventListResultPage) NotDone() bool { - return !page.elr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventListResultPage) Response() EventListResult { - return page.elr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventListResultPage) Values() []Event { - if page.elr.IsEmpty() { - return nil - } - return *page.elr.Value -} - -// Creates a new instance of the EventListResultPage type. -func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage { - return EventListResultPage{ - fn: getNextPage, - elr: cur, - } -} - -// EventRequestMessage the event request message sent to the service URI. -type EventRequestMessage struct { - // Content - The content of the event request message. - Content *EventContent `json:"content,omitempty"` - // Headers - The headers of the event request message. - Headers map[string]*string `json:"headers"` - // Method - The HTTP method used to send the event request message. - Method *string `json:"method,omitempty"` - // RequestURI - The URI used to send the event request message. - RequestURI *string `json:"requestUri,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventRequestMessage. -func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.Method != nil { - objectMap["method"] = erm.Method - } - if erm.RequestURI != nil { - objectMap["requestUri"] = erm.RequestURI - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// EventResponseMessage the event response message received from the service URI. -type EventResponseMessage struct { - // Content - The content of the event response message. - Content *string `json:"content,omitempty"` - // Headers - The headers of the event response message. - Headers map[string]*string `json:"headers"` - // ReasonPhrase - The reason phrase of the event response message. - ReasonPhrase *string `json:"reasonPhrase,omitempty"` - // StatusCode - The status code of the event response message. - StatusCode *string `json:"statusCode,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventResponseMessage. -func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.ReasonPhrase != nil { - objectMap["reasonPhrase"] = erm.ReasonPhrase - } - if erm.StatusCode != nil { - objectMap["statusCode"] = erm.StatusCode - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// GitCommitTrigger the git commit trigger that caused a build. -type GitCommitTrigger struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // CommitID - The unique ID that identifies a commit. - CommitID *string `json:"commitId,omitempty"` - // RepositoryURL - The repository URL. - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // BranchName - The branch name in the repository. - BranchName *string `json:"branchName,omitempty"` - // ProviderType - The source control provider type. - ProviderType *string `json:"providerType,omitempty"` -} - -// ImageDescriptor properties for a registry image. -type ImageDescriptor struct { - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// ImageUpdateTrigger the image update trigger that caused a build. -type ImageUpdateTrigger struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // Timestamp - The timestamp when the image update happened. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Images - The list of image updates that caused the build. - Images *[]ImageDescriptor `json:"images,omitempty"` -} - -// ImportImageParameters ... -type ImportImageParameters struct { - // Source - The source of the image. - Source *ImportSource `json:"source,omitempty"` - // TargetTags - List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - TargetTags *[]string `json:"targetTags,omitempty"` - // UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created. - UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"` - // Mode - When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'NoForce', 'Force' - Mode ImportMode `json:"mode,omitempty"` -} - -// ImportSource ... -type ImportSource struct { - // ResourceID - The resource identifier of the source Azure Container Registry. - ResourceID *string `json:"resourceId,omitempty"` - // RegistryURI - The address of the source registry (e.g. 'mcr.microsoft.com'). - RegistryURI *string `json:"registryUri,omitempty"` - // Credentials - Credentials used when importing from a registry uri. - Credentials *ImportSourceCredentials `json:"credentials,omitempty"` - // SourceImage - Repository name of the source image. - // Specify an image by repository ('hello-world'). This will use the 'latest' tag. - // Specify an image by tag ('hello-world:latest'). - // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - SourceImage *string `json:"sourceImage,omitempty"` -} - -// ImportSourceCredentials ... -type ImportSourceCredentials struct { - // Username - The username to authenticate with the source registry. - Username *string `json:"username,omitempty"` - // Password - The password used to authenticate with the source registry. - Password *string `json:"password,omitempty"` -} - -// IPRule IP rule with specific IP or IP range in CIDR format. -type IPRule struct { - // Action - The action of IP ACL rule. Possible values include: 'Allow' - Action Action `json:"action,omitempty"` - // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - IPAddressOrRange *string `json:"value,omitempty"` -} - -// NetworkRuleSet the network rule set for a container registry. -type NetworkRuleSet struct { - // DefaultAction - The default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' - DefaultAction DefaultAction `json:"defaultAction,omitempty"` - // VirtualNetworkRules - The virtual network rules. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // IPRules - The IP ACL rules. - IPRules *[]IPRule `json:"ipRules,omitempty"` -} - -// OperationDefinition the definition of a container registry operation. -type OperationDefinition struct { - // Origin - The origin information of the container registry operation. - Origin *string `json:"origin,omitempty"` - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The display information for the container registry operation. - Display *OperationDisplayDefinition `json:"display,omitempty"` - // OperationPropertiesDefinition - The properties information for the container registry operation. - *OperationPropertiesDefinition `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDefinition. -func (od OperationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if od.Origin != nil { - objectMap["origin"] = od.Origin - } - if od.Name != nil { - objectMap["name"] = od.Name - } - if od.Display != nil { - objectMap["display"] = od.Display - } - if od.OperationPropertiesDefinition != nil { - objectMap["properties"] = od.OperationPropertiesDefinition - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationDefinition struct. -func (od *OperationDefinition) 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 "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - od.Origin = &origin - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - od.Name = &name - } - case "display": - if v != nil { - var display OperationDisplayDefinition - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - od.Display = &display - } - case "properties": - if v != nil { - var operationPropertiesDefinition OperationPropertiesDefinition - err = json.Unmarshal(*v, &operationPropertiesDefinition) - if err != nil { - return err - } - od.OperationPropertiesDefinition = &operationPropertiesDefinition - } - } - } - - return nil -} - -// OperationDisplayDefinition the display information for a container registry operation. -type OperationDisplayDefinition struct { - // Provider - The resource provider name: Microsoft.ContainerRegistry. - Provider *string `json:"provider,omitempty"` - // Resource - The resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - The operation that users can perform. - Operation *string `json:"operation,omitempty"` - // Description - The description for the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult the result of a request to list container registry operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - Value *[]OperationDefinition `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registry operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of OperationDefinition 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() OperationDefinition { - if !iter.page.NotDone() { - return OperationDefinition{} - } - 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 OperationDefinition 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() []OperationDefinition { - 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, - } -} - -// OperationMetricSpecificationDefinition the definition of Azure Monitoring metric. -type OperationMetricSpecificationDefinition struct { - // Name - Metric name. - Name *string `json:"name,omitempty"` - // DisplayName - Metric display name. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Metric description. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Metric unit. - Unit *string `json:"unit,omitempty"` - // AggregationType - Metric aggregation type. - AggregationType *string `json:"aggregationType,omitempty"` - // InternalMetricName - Internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` -} - -// OperationPropertiesDefinition the definition of Azure Monitoring properties. -type OperationPropertiesDefinition struct { - // ServiceSpecification - The definition of Azure Monitoring service. - ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` -} - -// OperationServiceSpecificationDefinition the definition of Azure Monitoring metrics list. -type OperationServiceSpecificationDefinition struct { - // MetricSpecifications - A list of Azure Monitoring metrics definition. - MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` -} - -// PlatformProperties the platform properties against which the build has to happen. -type PlatformProperties struct { - // OsType - The operating system type required for the build. Possible values include: 'Windows', 'Linux' - OsType OsType `json:"osType,omitempty"` - // CPU - The CPU configuration in terms of number of cores required for the build. - CPU *int32 `json:"cpu,omitempty"` -} - -// 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; The resource ID. - 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QuarantinePolicy an object that represents quarantine policy for a container registry. -type QuarantinePolicy struct { - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// BasicQueueBuildRequest the queue build request parameters. -type BasicQueueBuildRequest interface { - AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) - AsQuickBuildRequest() (*QuickBuildRequest, bool) - AsQueueBuildRequest() (*QueueBuildRequest, bool) -} - -// QueueBuildRequest the queue build request parameters. -type QueueBuildRequest struct { - // Type - Possible values include: 'TypeQueueBuildRequest', 'TypeBuildTask', 'TypeQuickBuild' - Type TypeBasicQueueBuildRequest `json:"type,omitempty"` -} - -func unmarshalBasicQueueBuildRequest(body []byte) (BasicQueueBuildRequest, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBuildTask): - var btbr BuildTaskBuildRequest - err := json.Unmarshal(body, &btbr) - return btbr, err - case string(TypeQuickBuild): - var qbr QuickBuildRequest - err := json.Unmarshal(body, &qbr) - return qbr, err - default: - var qbr QueueBuildRequest - err := json.Unmarshal(body, &qbr) - return qbr, err - } -} -func unmarshalBasicQueueBuildRequestArray(body []byte) ([]BasicQueueBuildRequest, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - qbrArray := make([]BasicQueueBuildRequest, len(rawMessages)) - - for index, rawMessage := range rawMessages { - qbr, err := unmarshalBasicQueueBuildRequest(*rawMessage) - if err != nil { - return nil, err - } - qbrArray[index] = qbr - } - return qbrArray, nil -} - -// MarshalJSON is the custom marshaler for QueueBuildRequest. -func (qbr QueueBuildRequest) MarshalJSON() ([]byte, error) { - qbr.Type = TypeQueueBuildRequest - objectMap := make(map[string]interface{}) - if qbr.Type != "" { - objectMap["type"] = qbr.Type - } - return json.Marshal(objectMap) -} - -// AsBuildTaskBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest. -func (qbr QueueBuildRequest) AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) { - return nil, false -} - -// AsQuickBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest. -func (qbr QueueBuildRequest) AsQuickBuildRequest() (*QuickBuildRequest, bool) { - return nil, false -} - -// AsQueueBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest. -func (qbr QueueBuildRequest) AsQueueBuildRequest() (*QueueBuildRequest, bool) { - return &qbr, true -} - -// AsBasicQueueBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest. -func (qbr QueueBuildRequest) AsBasicQueueBuildRequest() (BasicQueueBuildRequest, bool) { - return &qbr, true -} - -// QuickBuildRequest the queue build request parameters for a quick build. -type QuickBuildRequest struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source that needs to be built. For Docker build, it can be an URL to a tar or github repository as supported by Docker. - // If it is relative URL, the relative path should be obtained from calling getSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // BuildArguments - The collection of build arguments to be used. - BuildArguments *[]BuildArgument `json:"buildArguments,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // Timeout - Build timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the build will happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // DockerFilePath - The Docker file path relative to the source location. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Type - Possible values include: 'TypeQueueBuildRequest', 'TypeBuildTask', 'TypeQuickBuild' - Type TypeBasicQueueBuildRequest `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for QuickBuildRequest. -func (qbr QuickBuildRequest) MarshalJSON() ([]byte, error) { - qbr.Type = TypeQuickBuild - objectMap := make(map[string]interface{}) - if qbr.ImageNames != nil { - objectMap["imageNames"] = qbr.ImageNames - } - if qbr.SourceLocation != nil { - objectMap["sourceLocation"] = qbr.SourceLocation - } - if qbr.BuildArguments != nil { - objectMap["buildArguments"] = qbr.BuildArguments - } - if qbr.IsPushEnabled != nil { - objectMap["isPushEnabled"] = qbr.IsPushEnabled - } - if qbr.NoCache != nil { - objectMap["noCache"] = qbr.NoCache - } - if qbr.Timeout != nil { - objectMap["timeout"] = qbr.Timeout - } - if qbr.Platform != nil { - objectMap["platform"] = qbr.Platform - } - if qbr.DockerFilePath != nil { - objectMap["dockerFilePath"] = qbr.DockerFilePath - } - if qbr.Type != "" { - objectMap["type"] = qbr.Type - } - return json.Marshal(objectMap) -} - -// AsBuildTaskBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest. -func (qbr QuickBuildRequest) AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) { - return nil, false -} - -// AsQuickBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest. -func (qbr QuickBuildRequest) AsQuickBuildRequest() (*QuickBuildRequest, bool) { - return &qbr, true -} - -// AsQueueBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest. -func (qbr QuickBuildRequest) AsQueueBuildRequest() (*QueueBuildRequest, bool) { - return nil, false -} - -// AsBasicQueueBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest. -func (qbr QuickBuildRequest) AsBasicQueueBuildRequest() (BasicQueueBuildRequest, bool) { - return &qbr, true -} - -// RegenerateCredentialParameters the parameters used to regenerate the login credential. -type RegenerateCredentialParameters struct { - // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2' - Name PasswordName `json:"name,omitempty"` -} - -// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesCreateFuture) 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 RegistriesCreateFuture.Result. -func (future *RegistriesCreateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture") - 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, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesDeleteFuture) 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 RegistriesDeleteFuture.Result. -func (future *RegistriesDeleteFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesImportImageFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesImportImageFuture) 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 RegistriesImportImageFuture.Result. -func (future *RegistriesImportImageFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesImportImageFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesQueueBuildFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesQueueBuildFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Build, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesQueueBuildFuture) 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 RegistriesQueueBuildFuture.Result. -func (future *RegistriesQueueBuildFuture) result(client RegistriesClient) (b Build, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesQueueBuildFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - b.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesQueueBuildFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { - b, err = client.QueueBuildResponder(b.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesQueueBuildFuture", "Result", b.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesUpdateFuture) 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 RegistriesUpdateFuture.Result. -func (future *RegistriesUpdateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture") - 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, "containerregistry.RegistriesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesUpdatePoliciesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RegistriesUpdatePoliciesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (RegistryPolicies, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesUpdatePoliciesFuture) 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 RegistriesUpdatePoliciesFuture.Result. -func (future *RegistriesUpdatePoliciesFuture) result(client RegistriesClient) (rp RegistryPolicies, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdatePoliciesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdatePoliciesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rp.Response.Response, err = future.GetResult(sender); err == nil && rp.Response.Response.StatusCode != http.StatusNoContent { - rp, err = client.UpdatePoliciesResponder(rp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdatePoliciesFuture", "Result", rp.Response.Response, "Failure responding to request") - } - } - return -} - -// Registry an object that represents a container registry. -type Registry struct { - autorest.Response `json:"-"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // RegistryProperties - The properties of the container registry. - *RegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Registry. -func (r Registry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - if r.RegistryProperties != nil { - objectMap["properties"] = r.RegistryProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Registry struct. -func (r *Registry) 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 - } - r.Sku = &sku - } - case "properties": - if v != nil { - var registryProperties RegistryProperties - err = json.Unmarshal(*v, ®istryProperties) - if err != nil { - return err - } - r.RegistryProperties = ®istryProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - } - } - - return nil -} - -// RegistryListCredentialsResult the response from the ListCredentials operation. -type RegistryListCredentialsResult struct { - autorest.Response `json:"-"` - // Username - The username for a container registry. - Username *string `json:"username,omitempty"` - // Passwords - The list of passwords for a container registry. - Passwords *[]RegistryPassword `json:"passwords,omitempty"` -} - -// RegistryListResult the result of a request to list container registries. -type RegistryListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - Value *[]Registry `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registries. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegistryListResultIterator provides access to a complete listing of Registry values. -type RegistryListResultIterator struct { - i int - page RegistryListResultPage -} - -// 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 *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.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 *RegistryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegistryListResultIterator) 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 RegistryListResultIterator) Response() RegistryListResult { - 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 RegistryListResultIterator) Value() Registry { - if !iter.page.NotDone() { - return Registry{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegistryListResultIterator type. -func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { - return RegistryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegistryListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegistryListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// registryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegistryListResult) registryListResultPreparer(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))) -} - -// RegistryListResultPage contains a page of Registry values. -type RegistryListResultPage struct { - fn func(context.Context, RegistryListResult) (RegistryListResult, error) - rlr RegistryListResult -} - -// 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 *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.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 *RegistryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegistryListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegistryListResultPage) Response() RegistryListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegistryListResultPage) Values() []Registry { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegistryListResultPage type. -func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { - return RegistryListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistryNameCheckRequest a request to check whether a container registry name is available. -type RegistryNameCheckRequest struct { - // Name - The name of the container registry. - Name *string `json:"name,omitempty"` - // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. - Type *string `json:"type,omitempty"` -} - -// RegistryNameStatus the result of a request to check the availability of a container registry name. -type RegistryNameStatus struct { - autorest.Response `json:"-"` - // NameAvailable - The value that indicates whether the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - If any, the reason that the name is not available. - Reason *string `json:"reason,omitempty"` - // Message - If any, the error message that provides more detail for the reason that the name is not available. - Message *string `json:"message,omitempty"` -} - -// RegistryPassword the login password for the container registry. -type RegistryPassword struct { - // Name - The password name. Possible values include: 'Password', 'Password2' - Name PasswordName `json:"name,omitempty"` - // Value - The password value. - Value *string `json:"value,omitempty"` -} - -// RegistryPolicies an object that represents policies for a container registry. -type RegistryPolicies struct { - autorest.Response `json:"-"` - // QuarantinePolicy - An object that represents quarantine policy for a container registry. - QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"` - // TrustPolicy - An object that represents content trust policy for a container registry. - TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"` -} - -// RegistryProperties the properties of a container registry. -type RegistryProperties struct { - // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. - LoginServer *string `json:"loginServer,omitempty"` - // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the container registry at the time the operation was called. - Status *Status `json:"status,omitempty"` - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // StorageAccount - The properties of the storage account for the container registry. Only applicable to Classic SKU. - StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryProperties. -func (rp RegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.AdminUserEnabled != nil { - objectMap["adminUserEnabled"] = rp.AdminUserEnabled - } - if rp.StorageAccount != nil { - objectMap["storageAccount"] = rp.StorageAccount - } - if rp.NetworkRuleSet != nil { - objectMap["networkRuleSet"] = rp.NetworkRuleSet - } - return json.Marshal(objectMap) -} - -// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. -type RegistryPropertiesUpdateParameters struct { - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // StorageAccount - The parameters of a storage account for the container registry. Only applicable to Classic SKU. If specified, the storage account must be in the same physical location as the container registry. - StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` -} - -// RegistryUpdateParameters the parameters for updating a container registry. -type RegistryUpdateParameters struct { - // Tags - The tags for the container registry. - Tags map[string]*string `json:"tags"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. - *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryUpdateParameters. -func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.Sku != nil { - objectMap["sku"] = rup.Sku - } - if rup.RegistryPropertiesUpdateParameters != nil { - objectMap["properties"] = rup.RegistryPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. -func (rup *RegistryUpdateParameters) 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 - } - rup.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - rup.Sku = &sku - } - case "properties": - if v != nil { - var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters - err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) - if err != nil { - return err - } - rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters - } - } - } - - return nil -} - -// RegistryUsage the quota usage for a container registry. -type RegistryUsage struct { - // Name - The name of the usage. - Name *string `json:"name,omitempty"` - // Limit - The limit of the usage. - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - The current value of the usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - // Unit - The unit of measurement. Possible values include: 'Count', 'Bytes' - Unit RegistryUsageUnit `json:"unit,omitempty"` -} - -// RegistryUsageListResult the result of a request to get container registry quota usages. -type RegistryUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry quota usages. - Value *[]RegistryUsage `json:"value,omitempty"` -} - -// Replication an object that represents a replication for a container registry. -type Replication struct { - autorest.Response `json:"-"` - // ReplicationProperties - The properties of the replication. - *ReplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Replication. -func (r Replication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.ReplicationProperties != nil { - objectMap["properties"] = r.ReplicationProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Replication struct. -func (r *Replication) 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 replicationProperties ReplicationProperties - err = json.Unmarshal(*v, &replicationProperties) - if err != nil { - return err - } - r.ReplicationProperties = &replicationProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - } - } - - return nil -} - -// ReplicationListResult the result of a request to list replications for a container registry. -type ReplicationListResult struct { - autorest.Response `json:"-"` - // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - Value *[]Replication `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of replications. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReplicationListResultIterator provides access to a complete listing of Replication values. -type ReplicationListResultIterator struct { - i int - page ReplicationListResultPage -} - -// 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 *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.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 *ReplicationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReplicationListResultIterator) 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 ReplicationListResultIterator) Response() ReplicationListResult { - 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 ReplicationListResultIterator) Value() Replication { - if !iter.page.NotDone() { - return Replication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReplicationListResultIterator type. -func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { - return ReplicationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr ReplicationListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr ReplicationListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// replicationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr ReplicationListResult) replicationListResultPreparer(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))) -} - -// ReplicationListResultPage contains a page of Replication values. -type ReplicationListResultPage struct { - fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) - rlr ReplicationListResult -} - -// 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 *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.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 *ReplicationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReplicationListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReplicationListResultPage) Response() ReplicationListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReplicationListResultPage) Values() []Replication { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the ReplicationListResultPage type. -func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { - return ReplicationListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// ReplicationProperties the properties of a replication. -type ReplicationProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the replication at the time the operation was called. - Status *Status `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationProperties. -func (rp ReplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsCreateFuture) 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 ReplicationsCreateFuture.Result. -func (future *ReplicationsCreateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture") - 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, "containerregistry.ReplicationsCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsDeleteFuture) 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 ReplicationsDeleteFuture.Result. -func (future *ReplicationsDeleteFuture) result(client ReplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsUpdateFuture) 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 ReplicationsUpdateFuture.Result. -func (future *ReplicationsUpdateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture") - 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, "containerregistry.ReplicationsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationUpdateParameters the parameters for updating a replication. -type ReplicationUpdateParameters struct { - // Tags - The tags for the replication. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. -func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - return json.Marshal(objectMap) -} - -// Request the request that generated the event. -type Request struct { - // ID - The ID of the request that initiated the event. - ID *string `json:"id,omitempty"` - // Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - Addr *string `json:"addr,omitempty"` - // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - Host *string `json:"host,omitempty"` - // Method - The request method that generated the event. - Method *string `json:"method,omitempty"` - // Useragent - The user agent header of the request. - Useragent *string `json:"useragent,omitempty"` -} - -// Resource an Azure resource. -type Resource struct { - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - 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{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Sku the SKU of a container registry. -type Sku struct { - // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium' - Name SkuName `json:"name,omitempty"` - // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` -} - -// MarshalJSON is the custom marshaler for Sku. -func (s Sku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Name != "" { - objectMap["name"] = s.Name - } - return json.Marshal(objectMap) -} - -// Source the registry node that generated the event. Put differently, while the actor initiates the event, -// the source generates it. -type Source struct { - // Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - Addr *string `json:"addr,omitempty"` - // InstanceID - The running instance of an application. Changes after each restart. - InstanceID *string `json:"instanceID,omitempty"` -} - -// SourceControlAuthInfo the authorization properties for accessing the source code repository. -type SourceControlAuthInfo struct { - // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' - TokenType TokenType `json:"tokenType,omitempty"` - // Token - The access token used to access the source control provider. - Token *string `json:"token,omitempty"` - // RefreshToken - The refresh token used to refresh the access token. - RefreshToken *string `json:"refreshToken,omitempty"` - // Scope - The scope of the access token. - Scope *string `json:"scope,omitempty"` - // ExpiresIn - Time in seconds that the token remains valid - ExpiresIn *int32 `json:"expiresIn,omitempty"` -} - -// SourceRepositoryProperties the properties of the source code repository. -type SourceRepositoryProperties struct { - autorest.Response `json:"-"` - // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // IsCommitTriggerEnabled - The value of this property indicates whether the source control commit trigger is enabled or not. - IsCommitTriggerEnabled *bool `json:"isCommitTriggerEnabled,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository. - SourceControlAuthProperties *SourceControlAuthInfo `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceRepositoryUpdateParameters the properties for updating the source code repository configuration. -type SourceRepositoryUpdateParameters struct { - // SourceControlAuthProperties - The authorization properties for accessing the source code repository. - SourceControlAuthProperties *SourceControlAuthInfo `json:"sourceControlAuthProperties,omitempty"` - // IsCommitTriggerEnabled - The value of this property indicates whether the source control commit trigger is enabled or not. - IsCommitTriggerEnabled *bool `json:"isCommitTriggerEnabled,omitempty"` -} - -// SourceUploadDefinition the properties of a response to source upload request. -type SourceUploadDefinition struct { - autorest.Response `json:"-"` - // UploadURL - The URL where the client can upload the source. - UploadURL *string `json:"uploadUrl,omitempty"` - // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. - RelativePath *string `json:"relativePath,omitempty"` -} - -// Status the status of an Azure resource at the time the operation was called. -type Status struct { - // DisplayStatus - READ-ONLY; The short label for the status. - DisplayStatus *string `json:"displayStatus,omitempty"` - // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. - Message *string `json:"message,omitempty"` - // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for Status. -func (s Status) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StorageAccountProperties the properties of a storage account for a container registry. Only applicable -// to Classic SKU. -type StorageAccountProperties struct { - // ID - The resource ID of the storage account. - ID *string `json:"id,omitempty"` -} - -// Target the target of the event. -type Target struct { - // MediaType - The MIME type of the referenced object. - MediaType *string `json:"mediaType,omitempty"` - // Size - The number of bytes of the content. Same as Length field. - Size *int64 `json:"size,omitempty"` - // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. - Digest *string `json:"digest,omitempty"` - // Length - The number of bytes of the content. Same as Size field. - Length *int64 `json:"length,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // URL - The direct URL to the content. - URL *string `json:"url,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Name - The name of the artifact. - Name *string `json:"name,omitempty"` - // Version - The version of the artifact. - Version *string `json:"version,omitempty"` -} - -// TrustPolicy an object that represents content trust policy for a container registry. -type TrustPolicy struct { - // Type - The type of trust policy. Possible values include: 'Notary' - Type TrustPolicyType `json:"type,omitempty"` - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// VirtualNetworkRule virtual network rule. -type VirtualNetworkRule struct { - // Action - The action of virtual network rule. Possible values include: 'Allow' - Action Action `json:"action,omitempty"` - // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - VirtualNetworkResourceID *string `json:"id,omitempty"` -} - -// Webhook an object that represents a webhook for a container registry. -type Webhook struct { - autorest.Response `json:"-"` - // WebhookProperties - The properties of the webhook. - *WebhookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WebhookProperties != nil { - objectMap["properties"] = w.WebhookProperties - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Webhook struct. -func (w *Webhook) 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 webhookProperties WebhookProperties - err = json.Unmarshal(*v, &webhookProperties) - if err != nil { - return err - } - w.WebhookProperties = &webhookProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - } - } - - return nil -} - -// WebhookCreateParameters the parameters for creating a webhook. -type WebhookCreateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // Location - The location of the webhook. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. - *WebhookPropertiesCreateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateParameters. -func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcp.Tags != nil { - objectMap["tags"] = wcp.Tags - } - if wcp.Location != nil { - objectMap["location"] = wcp.Location - } - if wcp.WebhookPropertiesCreateParameters != nil { - objectMap["properties"] = wcp.WebhookPropertiesCreateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. -func (wcp *WebhookCreateParameters) 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 - } - wcp.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wcp.Location = &location - } - case "properties": - if v != nil { - var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters - err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) - if err != nil { - return err - } - wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters - } - } - } - - return nil -} - -// WebhookListResult the result of a request to list webhooks for a container registry. -type WebhookListResult struct { - autorest.Response `json:"-"` - // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. - Value *[]Webhook `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of webhooks. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultIterator provides access to a complete listing of Webhook values. -type WebhookListResultIterator struct { - i int - page WebhookListResultPage -} - -// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { - 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 WebhookListResultIterator) Value() Webhook { - if !iter.page.NotDone() { - return Webhook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebhookListResultIterator type. -func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { - return WebhookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WebhookListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WebhookListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// webhookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WebhookListResult) webhookListResultPreparer(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))) -} - -// WebhookListResultPage contains a page of Webhook values. -type WebhookListResultPage struct { - fn func(context.Context, WebhookListResult) (WebhookListResult, error) - wlr WebhookListResult -} - -// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebhookListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebhookListResultPage) Response() WebhookListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebhookListResultPage) Values() []Webhook { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WebhookListResultPage type. -func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { - return WebhookListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WebhookProperties the properties of a webhook. -type WebhookProperties struct { - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookProperties. -func (wp WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Status != "" { - objectMap["status"] = wp.Status - } - if wp.Scope != nil { - objectMap["scope"] = wp.Scope - } - if wp.Actions != nil { - objectMap["actions"] = wp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. -type WebhookPropertiesCreateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. -func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpcp.ServiceURI != nil { - objectMap["serviceUri"] = wpcp.ServiceURI - } - if wpcp.CustomHeaders != nil { - objectMap["customHeaders"] = wpcp.CustomHeaders - } - if wpcp.Status != "" { - objectMap["status"] = wpcp.Status - } - if wpcp.Scope != nil { - objectMap["scope"] = wpcp.Scope - } - if wpcp.Actions != nil { - objectMap["actions"] = wpcp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. -type WebhookPropertiesUpdateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. -func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpup.ServiceURI != nil { - objectMap["serviceUri"] = wpup.ServiceURI - } - if wpup.CustomHeaders != nil { - objectMap["customHeaders"] = wpup.CustomHeaders - } - if wpup.Status != "" { - objectMap["status"] = wpup.Status - } - if wpup.Scope != nil { - objectMap["scope"] = wpup.Scope - } - if wpup.Actions != nil { - objectMap["actions"] = wpup.Actions - } - return json.Marshal(objectMap) -} - -// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksCreateFuture) 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 WebhooksCreateFuture.Result. -func (future *WebhooksCreateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.CreateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksDeleteFuture) 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 WebhooksDeleteFuture.Result. -func (future *WebhooksDeleteFuture) result(client WebhooksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksUpdateFuture) 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 WebhooksUpdateFuture.Result. -func (future *WebhooksUpdateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.UpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhookUpdateParameters the parameters for updating a webhook. -type WebhookUpdateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. - *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateParameters. -func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.Tags != nil { - objectMap["tags"] = wup.Tags - } - if wup.WebhookPropertiesUpdateParameters != nil { - objectMap["properties"] = wup.WebhookPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. -func (wup *WebhookUpdateParameters) 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 - } - wup.Tags = tags - } - case "properties": - if v != nil { - var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters - err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) - if err != nil { - return err - } - wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters - } - } - } - - return nil -} diff --git a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/operations.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/operations.go deleted file mode 100644 index e195d43c77d5..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 client for the Operations methods of the Containerregistry service. -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 Azure Container Registry 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, "containerregistry.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, "containerregistry.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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 = "2017-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerRegistry/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, "containerregistry.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, "containerregistry.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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/containerregistry/mgmt/2018-02-01/containerregistry/registries.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/registries.go deleted file mode 100644 index 1ecaca441f75..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/registries.go +++ /dev/null @@ -1,1429 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RegistriesClient is the client for the Registries methods of the Containerregistry service. -type RegistriesClient struct { - BaseClient -} - -// NewRegistriesClient creates an instance of the RegistriesClient client. -func NewRegistriesClient(subscriptionID string) RegistriesClient { - return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient 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 NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { - return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only -// alphanumeric characters, be globally unique, and between 5 and 50 characters in length. -// Parameters: -// registryNameCheckRequest - the object containing information for the availability request. -func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryNameCheckRequest, - Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}, - }}, - {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/checkNameAvailability", pathParameters), - autorest.WithJSON(registryNameCheckRequest), - 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 RegistriesClient) 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 RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, 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 container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registry - the parameters for creating a container registry. -func (client RegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result RegistriesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: registry, - Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "registry.RegistryProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, registry) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registry), - 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 RegistriesClient) CreateSender(req *http.Request) (future RegistriesCreateFuture, 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 RegistriesClient) CreateResponder(resp *http.Response) (result Registry, 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 a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result RegistriesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) DeleteSender(req *http.Request) (future RegistriesDeleteFuture, 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 RegistriesClient) 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 the properties of the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) 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 RegistriesClient) GetResponder(resp *http.Response) (result Registry, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBuildSourceUploadURL get the upload location for the user to be able to upload the source. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result SourceUploadDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GetBuildSourceUploadURL") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "GetBuildSourceUploadURL", err.Error()) - } - - req, err := client.GetBuildSourceUploadURLPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetBuildSourceUploadURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure sending request") - return - } - - result, err = client.GetBuildSourceUploadURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure responding to request") - return - } - - return -} - -// GetBuildSourceUploadURLPreparer prepares the GetBuildSourceUploadURL request. -func (client RegistriesClient) GetBuildSourceUploadURLPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/getBuildSourceUploadUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBuildSourceUploadURLSender sends the GetBuildSourceUploadURL request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GetBuildSourceUploadURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetBuildSourceUploadURLResponder handles the response to the GetBuildSourceUploadURL request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GetBuildSourceUploadURLResponder(resp *http.Response) (result SourceUploadDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ImportImage copies an image to this container registry from the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// parameters - the parameters specifying the image to copy and the source container registry. -func (client RegistriesClient) ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (result RegistriesImportImageFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ImportImage") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials.Password", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Source.SourceImage", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ImportImage", err.Error()) - } - - req, err := client.ImportImagePreparer(ctx, resourceGroupName, registryName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", nil, "Failure preparing request") - return - } - - result, err = client.ImportImageSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportImagePreparer prepares the ImportImage request. -func (client RegistriesClient) ImportImagePreparer(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/importImage", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportImageSender sends the ImportImage request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ImportImageSender(req *http.Request) (future RegistriesImportImageFuture, 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 -} - -// ImportImageResponder handles the response to the ImportImage request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ImportImageResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all the container registries under the specified subscription. -func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 the container registries under the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup") - 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.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RegistriesClient) 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 = "2017-10-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.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 -} - -// ListCredentials lists the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListCredentials") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListCredentials", err.Error()) - } - - req, err := client.ListCredentialsPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListCredentialsPreparer prepares the ListCredentials request. -func (client RegistriesClient) ListCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCredentialsSender sends the ListCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCredentialsResponder handles the response to the ListCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPolicies lists the policies for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListPolicies(ctx context.Context, resourceGroupName string, registryName string) (result RegistryPolicies, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPolicies") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListPolicies", err.Error()) - } - - req, err := client.ListPoliciesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPolicies", nil, "Failure preparing request") - return - } - - resp, err := client.ListPoliciesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPolicies", resp, "Failure sending request") - return - } - - result, err = client.ListPoliciesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPolicies", resp, "Failure responding to request") - return - } - - return -} - -// ListPoliciesPreparer prepares the ListPolicies request. -func (client RegistriesClient) ListPoliciesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/listPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPoliciesSender sends the ListPolicies request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListPoliciesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListPoliciesResponder handles the response to the ListPolicies request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListPoliciesResponder(resp *http.Response) (result RegistryPolicies, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages gets the quota usages for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result RegistryUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListUsages") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client RegistriesClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/listUsages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListUsagesResponder(resp *http.Response) (result RegistryUsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// QueueBuild creates a new build based on the request parameters and add it to the build queue. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// buildRequest - the parameters of a build that needs to queued. -func (client RegistriesClient) QueueBuild(ctx context.Context, resourceGroupName string, registryName string, buildRequest BasicQueueBuildRequest) (result RegistriesQueueBuildFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.QueueBuild") - 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: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "QueueBuild", err.Error()) - } - - req, err := client.QueueBuildPreparer(ctx, resourceGroupName, registryName, buildRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "QueueBuild", nil, "Failure preparing request") - return - } - - result, err = client.QueueBuildSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "QueueBuild", result.Response(), "Failure sending request") - return - } - - return -} - -// QueueBuildPreparer prepares the QueueBuild request. -func (client RegistriesClient) QueueBuildPreparer(ctx context.Context, resourceGroupName string, registryName string, buildRequest BasicQueueBuildRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-02-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.ContainerRegistry/registries/{registryName}/queueBuild", pathParameters), - autorest.WithJSON(buildRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// QueueBuildSender sends the QueueBuild request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) QueueBuildSender(req *http.Request) (future RegistriesQueueBuildFuture, 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 -} - -// QueueBuildResponder handles the response to the QueueBuild request. The method always -// closes the http.Response Body. -func (client RegistriesClient) QueueBuildResponder(resp *http.Response) (result Build, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateCredential regenerates one of the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// regenerateCredentialParameters - specifies name of the password which should be regenerated -- password or -// password2. -func (client RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.RegenerateCredential") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "RegenerateCredential", err.Error()) - } - - req, err := client.RegenerateCredentialPreparer(ctx, resourceGroupName, registryName, regenerateCredentialParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateCredentialSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request") - return - } - - result, err = client.RegenerateCredentialResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateCredentialPreparer prepares the RegenerateCredential request. -func (client RegistriesClient) RegenerateCredentialPreparer(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters), - autorest.WithJSON(regenerateCredentialParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always -// closes the http.Response Body. -func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, 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 container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registryUpdateParameters - the parameters for updating a container registry. -func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result RegistriesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, registryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registryUpdateParameters), - 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 RegistriesClient) UpdateSender(req *http.Request) (future RegistriesUpdateFuture, 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 RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdatePolicies updates the policies for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registryPoliciesUpdateParameters - the parameters for updating policies of a container registry. -func (client RegistriesClient) UpdatePolicies(ctx context.Context, resourceGroupName string, registryName string, registryPoliciesUpdateParameters RegistryPolicies) (result RegistriesUpdatePoliciesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.UpdatePolicies") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "UpdatePolicies", err.Error()) - } - - req, err := client.UpdatePoliciesPreparer(ctx, resourceGroupName, registryName, registryPoliciesUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "UpdatePolicies", nil, "Failure preparing request") - return - } - - result, err = client.UpdatePoliciesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "UpdatePolicies", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePoliciesPreparer prepares the UpdatePolicies request. -func (client RegistriesClient) UpdatePoliciesPreparer(ctx context.Context, resourceGroupName string, registryName string, registryPoliciesUpdateParameters RegistryPolicies) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/updatePolicies", pathParameters), - autorest.WithJSON(registryPoliciesUpdateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdatePoliciesSender sends the UpdatePolicies request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) UpdatePoliciesSender(req *http.Request) (future RegistriesUpdatePoliciesFuture, 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 -} - -// UpdatePoliciesResponder handles the response to the UpdatePolicies request. The method always -// closes the http.Response Body. -func (client RegistriesClient) UpdatePoliciesResponder(resp *http.Response) (result RegistryPolicies, 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/preview/containerregistry/mgmt/2018-02-01/containerregistry/replications.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/replications.go deleted file mode 100644 index 9214789f4500..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/replications.go +++ /dev/null @@ -1,542 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReplicationsClient is the client for the Replications methods of the Containerregistry service. -type ReplicationsClient struct { - BaseClient -} - -// NewReplicationsClient creates an instance of the ReplicationsClient client. -func NewReplicationsClient(subscriptionID string) ReplicationsClient { - return NewReplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationsClientWithBaseURI creates an instance of the ReplicationsClient 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 NewReplicationsClientWithBaseURI(baseURI string, subscriptionID string) ReplicationsClient { - return ReplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replication - the parameters for creating a replication. -func (client ReplicationsClient) Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (result ReplicationsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, replicationName, replication) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ReplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replication), - 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 ReplicationsClient) CreateSender(req *http.Request) (future ReplicationsCreateFuture, 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 ReplicationsClient) CreateResponder(resp *http.Response) (result Replication, 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 a replication from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result ReplicationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ReplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) DeleteSender(req *http.Request) (future ReplicationsDeleteFuture, 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 ReplicationsClient) 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 the properties of the specified replication. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result Replication, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) 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 ReplicationsClient) GetResponder(resp *http.Response) (result Replication, 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 the replications for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ReplicationsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.List") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ReplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/replications", 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 ReplicationsClient) 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 ReplicationsClient) ListResponder(resp *http.Response) (result ReplicationListResult, 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 ReplicationsClient) listNextResults(ctx context.Context, lastResults ReplicationListResult) (result ReplicationListResult, err error) { - req, err := lastResults.replicationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "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, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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, registryName) - return -} - -// Update updates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replicationUpdateParameters - the parameters for updating a replication. -func (client ReplicationsClient) Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (result ReplicationsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ReplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replicationUpdateParameters), - 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 ReplicationsClient) UpdateSender(req *http.Request) (future ReplicationsUpdateFuture, 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 ReplicationsClient) UpdateResponder(resp *http.Response) (result Replication, 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/containerregistry/mgmt/2018-02-01/containerregistry/version.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/version.go deleted file mode 100644 index 3d05c9a0e82d..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerregistry - -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() + " containerregistry/2018-02-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/webhooks.go b/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/webhooks.go deleted file mode 100644 index f914e6ad16b6..000000000000 --- a/services/preview/containerregistry/mgmt/2018-02-01/containerregistry/webhooks.go +++ /dev/null @@ -1,866 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WebhooksClient is the client for the Webhooks methods of the Containerregistry service. -type WebhooksClient struct { - BaseClient -} - -// NewWebhooksClient creates an instance of the WebhooksClient client. -func NewWebhooksClient(subscriptionID string) WebhooksClient { - return NewWebhooksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhooksClientWithBaseURI creates an instance of the WebhooksClient 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 NewWebhooksClientWithBaseURI(baseURI string, subscriptionID string) WebhooksClient { - return WebhooksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a webhook for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookCreateParameters - the parameters for creating a webhook. -func (client WebhooksClient) Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (result WebhooksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookCreateParameters, - Constraints: []validation.Constraint{{Target: "webhookCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.ServiceURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client WebhooksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookCreateParameters), - 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 WebhooksClient) CreateSender(req *http.Request) (future WebhooksCreateFuture, 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 WebhooksClient) CreateResponder(resp *http.Response) (result Webhook, 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 a webhook from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result WebhooksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) DeleteSender(req *http.Request) (future WebhooksDeleteFuture, 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 WebhooksClient) 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 the properties of the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhooksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) 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 WebhooksClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCallbackConfig gets the configuration of service URI and custom headers for the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result CallbackConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.GetCallbackConfig") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "GetCallbackConfig", err.Error()) - } - - req, err := client.GetCallbackConfigPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", nil, "Failure preparing request") - return - } - - resp, err := client.GetCallbackConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure sending request") - return - } - - result, err = client.GetCallbackConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure responding to request") - return - } - - return -} - -// GetCallbackConfigPreparer prepares the GetCallbackConfig request. -func (client WebhooksClient) GetCallbackConfigPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCallbackConfigSender sends the GetCallbackConfig request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) GetCallbackConfigSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCallbackConfigResponder handles the response to the GetCallbackConfig request. The method always -// closes the http.Response Body. -func (client WebhooksClient) GetCallbackConfigResponder(resp *http.Response) (result CallbackConfig, 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 the webhooks for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client WebhooksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.List") - 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: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WebhooksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/webhooks", 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 WebhooksClient) 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 WebhooksClient) ListResponder(resp *http.Response) (result WebhookListResult, 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 WebhooksClient) listNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "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, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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, registryName) - return -} - -// ListEvents lists recent events for the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "ListEvents", err.Error()) - } - - result.fn = client.listEventsNextResults - req, err := client.ListEventsPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventsSender(req) - if err != nil { - result.elr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure sending request") - return - } - - result.elr, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure responding to request") - return - } - if result.elr.hasNextLink() && result.elr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListEventsPreparer prepares the ListEvents request. -func (client WebhooksClient) ListEventsPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventsSender sends the ListEvents request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) ListEventsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventsResponder handles the response to the ListEvents request. The method always -// closes the http.Response Body. -func (client WebhooksClient) ListEventsResponder(resp *http.Response) (result EventListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listEventsNextResults retrieves the next set of results, if any. -func (client WebhooksClient) listEventsNextResults(ctx context.Context, lastResults EventListResult) (result EventListResult, err error) { - req, err := lastResults.eventListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListEventsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListEventsComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.ListEvents(ctx, resourceGroupName, registryName, webhookName) - return -} - -// Ping triggers a ping event to be sent to the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Ping") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Ping", err.Error()) - } - - req, err := client.PingPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", nil, "Failure preparing request") - return - } - - resp, err := client.PingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure sending request") - return - } - - result, err = client.PingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure responding to request") - return - } - - return -} - -// PingPreparer prepares the Ping request. -func (client WebhooksClient) PingPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PingSender sends the Ping request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) PingSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PingResponder handles the response to the Ping request. The method always -// closes the http.Response Body. -func (client WebhooksClient) PingResponder(resp *http.Response) (result EventInfo, 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 webhook with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookUpdateParameters - the parameters for updating a webhook. -func (client WebhooksClient) Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (result WebhooksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2017-10-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookUpdateParameters), - 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 WebhooksClient) UpdateSender(req *http.Request) (future WebhooksUpdateFuture, 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 WebhooksClient) UpdateResponder(resp *http.Response) (result Webhook, 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/containerregistry/mgmt/2019-12-01-preview/containerregistry/CHANGELOG.md b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/_meta.json b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/_meta.json deleted file mode 100644 index 85ab52af79ba..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "tag": "package-2019-12-preview", - "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-2019-12-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/agentpools.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/agentpools.go deleted file mode 100644 index 1ae5928434f8..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/agentpools.go +++ /dev/null @@ -1,634 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AgentPoolsClient is the client for the AgentPools methods of the Containerregistry service. -type AgentPoolsClient struct { - BaseClient -} - -// NewAgentPoolsClient creates an instance of the AgentPoolsClient client. -func NewAgentPoolsClient(subscriptionID string) AgentPoolsClient { - return NewAgentPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgentPoolsClientWithBaseURI creates an instance of the AgentPoolsClient 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 NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) AgentPoolsClient { - return AgentPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an agent pool for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -// agentPool - the parameters of an agent pool that needs to scheduled. -func (client AgentPoolsClient) Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (result AgentPoolsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, agentPoolName, agentPool) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AgentPoolsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(agentPool), - 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 AgentPoolsClient) CreateSender(req *http.Request) (future AgentPoolsCreateFuture, 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 AgentPoolsClient) CreateResponder(resp *http.Response) (result AgentPool, 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 a specified agent pool resource. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) DeleteSender(req *http.Request) (future AgentPoolsDeleteFuture, 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 AgentPoolsClient) 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 the detailed information for a given agent pool. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) 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 AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetQueueStatus gets the count of queued runs for a given agent pool. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolQueueStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetQueueStatus") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "GetQueueStatus", err.Error()) - } - - req, err := client.GetQueueStatusPreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetQueueStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure sending request") - return - } - - result, err = client.GetQueueStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetQueueStatusPreparer prepares the GetQueueStatus request. -func (client AgentPoolsClient) GetQueueStatusPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetQueueStatusSender sends the GetQueueStatus request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) GetQueueStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetQueueStatusResponder handles the response to the GetQueueStatus request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) GetQueueStatusResponder(resp *http.Response) (result AgentPoolQueueStatus, 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 the agent pools for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") - defer func() { - sc := -1 - if result.aplr.Response.Response != nil { - sc = result.aplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.aplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure sending request") - return - } - - result.aplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure responding to request") - return - } - if result.aplr.hasNextLink() && result.aplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools", 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 AgentPoolsClient) 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 AgentPoolsClient) ListResponder(resp *http.Response) (result AgentPoolListResult, 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 AgentPoolsClient) listNextResults(ctx context.Context, lastResults AgentPoolListResult) (result AgentPoolListResult, err error) { - req, err := lastResults.agentPoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "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, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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, registryName) - return -} - -// Update updates an agent pool with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -// updateParameters - the parameters for updating an agent pool. -func (client AgentPoolsClient) Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (result AgentPoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, agentPoolName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AgentPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 AgentPoolsClient) UpdateSender(req *http.Request) (future AgentPoolsUpdateFuture, 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 AgentPoolsClient) UpdateResponder(resp *http.Response) (result AgentPool, 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/containerregistry/mgmt/2019-12-01-preview/containerregistry/client.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/client.go deleted file mode 100644 index 79937e123765..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerregistry implements the Azure ARM Containerregistry service API version . -// -// -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Containerregistry - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerregistry. -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/containerregistry/mgmt/2019-12-01-preview/containerregistry/containerregistryapi/interfaces.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/containerregistryapi/interfaces.go deleted file mode 100644 index 837c302dade3..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/containerregistryapi/interfaces.go +++ /dev/null @@ -1,191 +0,0 @@ -package containerregistryapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/containerregistry/mgmt/2019-12-01-preview/containerregistry" -) - -// ExportPipelinesClientAPI contains the set of methods on the ExportPipelinesClient type. -type ExportPipelinesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters containerregistry.ExportPipeline) (result containerregistry.ExportPipelinesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result containerregistry.ExportPipelinesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result containerregistry.ExportPipeline, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ExportPipelineListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ExportPipelineListResultIterator, err error) -} - -var _ ExportPipelinesClientAPI = (*containerregistry.ExportPipelinesClient)(nil) - -// RegistriesClientAPI contains the set of methods on the RegistriesClient type. -type RegistriesClientAPI interface { - CheckNameAvailability(ctx context.Context, registryNameCheckRequest containerregistry.RegistryNameCheckRequest) (result containerregistry.RegistryNameStatus, err error) - Create(ctx context.Context, resourceGroupName string, registryName string, registry containerregistry.Registry) (result containerregistry.RegistriesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistriesDeleteFuture, err error) - GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters containerregistry.GenerateCredentialsParameters) (result containerregistry.RegistriesGenerateCredentialsFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.Registry, err error) - GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.SourceUploadDefinition, err error) - ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters containerregistry.ImportImageParameters) (result containerregistry.RegistriesImportImageFuture, err error) - List(ctx context.Context) (result containerregistry.RegistryListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.RegistryListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultIterator, err error) - ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryListCredentialsResult, err error) - ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultPage, err error) - ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultIterator, err error) - ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryUsageListResult, err error) - RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters containerregistry.RegenerateCredentialParameters) (result containerregistry.RegistryListCredentialsResult, err error) - ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest containerregistry.BasicRunRequest) (result containerregistry.RegistriesScheduleRunFuture, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters containerregistry.RegistryUpdateParameters) (result containerregistry.RegistriesUpdateFuture, err error) -} - -var _ RegistriesClientAPI = (*containerregistry.RegistriesClient)(nil) - -// ImportPipelinesClientAPI contains the set of methods on the ImportPipelinesClient type. -type ImportPipelinesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters containerregistry.ImportPipeline) (result containerregistry.ImportPipelinesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result containerregistry.ImportPipelinesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result containerregistry.ImportPipeline, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ImportPipelineListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ImportPipelineListResultIterator, err error) -} - -var _ ImportPipelinesClientAPI = (*containerregistry.ImportPipelinesClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result containerregistry.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*containerregistry.OperationsClient)(nil) - -// PipelineRunsClientAPI contains the set of methods on the PipelineRunsClient type. -type PipelineRunsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters containerregistry.PipelineRun) (result containerregistry.PipelineRunsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result containerregistry.PipelineRunsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result containerregistry.PipelineRun, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PipelineRunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PipelineRunListResultIterator, err error) -} - -var _ PipelineRunsClientAPI = (*containerregistry.PipelineRunsClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection containerregistry.PrivateEndpointConnection) (result containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnection, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*containerregistry.PrivateEndpointConnectionsClient)(nil) - -// ReplicationsClientAPI contains the set of methods on the ReplicationsClient type. -type ReplicationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication containerregistry.Replication) (result containerregistry.ReplicationsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.ReplicationsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.Replication, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters containerregistry.ReplicationUpdateParameters) (result containerregistry.ReplicationsUpdateFuture, err error) -} - -var _ ReplicationsClientAPI = (*containerregistry.ReplicationsClient)(nil) - -// WebhooksClientAPI contains the set of methods on the WebhooksClient type. -type WebhooksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters containerregistry.WebhookCreateParameters) (result containerregistry.WebhooksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.WebhooksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.Webhook, err error) - GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.CallbackConfig, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultIterator, err error) - ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultPage, err error) - ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultIterator, err error) - Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventInfo, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters containerregistry.WebhookUpdateParameters) (result containerregistry.WebhooksUpdateFuture, err error) -} - -var _ WebhooksClientAPI = (*containerregistry.WebhooksClient)(nil) - -// AgentPoolsClientAPI contains the set of methods on the AgentPoolsClient type. -type AgentPoolsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool containerregistry.AgentPool) (result containerregistry.AgentPoolsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPool, err error) - GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolQueueStatus, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters containerregistry.AgentPoolUpdateParameters) (result containerregistry.AgentPoolsUpdateFuture, err error) -} - -var _ AgentPoolsClientAPI = (*containerregistry.AgentPoolsClient)(nil) - -// RunsClientAPI contains the set of methods on the RunsClient type. -type RunsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunsCancelFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.Run, err error) - GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunGetLogResult, err error) - List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters containerregistry.RunUpdateParameters) (result containerregistry.RunsUpdateFuture, err error) -} - -var _ RunsClientAPI = (*containerregistry.RunsClient)(nil) - -// TaskRunsClientAPI contains the set of methods on the TaskRunsClient type. -type TaskRunsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun containerregistry.TaskRun) (result containerregistry.TaskRunsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRunsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) - GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters containerregistry.TaskRunUpdateParameters) (result containerregistry.TaskRunsUpdateFuture, err error) -} - -var _ TaskRunsClientAPI = (*containerregistry.TaskRunsClient)(nil) - -// TasksClientAPI contains the set of methods on the TasksClient type. -type TasksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters containerregistry.Task) (result containerregistry.TasksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.TasksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) - GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters containerregistry.TaskUpdateParameters) (result containerregistry.TasksUpdateFuture, err error) -} - -var _ TasksClientAPI = (*containerregistry.TasksClient)(nil) - -// ScopeMapsClientAPI contains the set of methods on the ScopeMapsClient type. -type ScopeMapsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters containerregistry.ScopeMap) (result containerregistry.ScopeMapsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMapsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMap, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ScopeMapListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ScopeMapListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters containerregistry.ScopeMapUpdateParameters) (result containerregistry.ScopeMapsUpdateFuture, err error) -} - -var _ ScopeMapsClientAPI = (*containerregistry.ScopeMapsClient)(nil) - -// TokensClientAPI contains the set of methods on the TokensClient type. -type TokensClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters containerregistry.Token) (result containerregistry.TokensCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.TokensDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.Token, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TokenListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TokenListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters containerregistry.TokenUpdateParameters) (result containerregistry.TokensUpdateFuture, err error) -} - -var _ TokensClientAPI = (*containerregistry.TokensClient)(nil) diff --git a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/enums.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/enums.go deleted file mode 100644 index c9545f0009ae..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/enums.go +++ /dev/null @@ -1,737 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Action enumerates the values for action. -type Action string - -const ( - // Allow ... - Allow Action = "Allow" -) - -// PossibleActionValues returns an array of possible values for the Action const type. -func PossibleActionValues() []Action { - return []Action{Allow} -} - -// ActionsRequired enumerates the values for actions required. -type ActionsRequired string - -const ( - // None ... - None ActionsRequired = "None" - // Recreate ... - Recreate ActionsRequired = "Recreate" -) - -// PossibleActionsRequiredValues returns an array of possible values for the ActionsRequired const type. -func PossibleActionsRequiredValues() []ActionsRequired { - return []ActionsRequired{None, Recreate} -} - -// Architecture enumerates the values for architecture. -type Architecture string - -const ( - // Amd64 ... - Amd64 Architecture = "amd64" - // Arm ... - Arm Architecture = "arm" - // Arm64 ... - Arm64 Architecture = "arm64" - // ThreeEightSix ... - ThreeEightSix Architecture = "386" - // X86 ... - X86 Architecture = "x86" -) - -// PossibleArchitectureValues returns an array of possible values for the Architecture const type. -func PossibleArchitectureValues() []Architecture { - return []Architecture{Amd64, Arm, Arm64, ThreeEightSix, X86} -} - -// BaseImageDependencyType enumerates the values for base image dependency type. -type BaseImageDependencyType string - -const ( - // BuildTime ... - BuildTime BaseImageDependencyType = "BuildTime" - // RunTime ... - RunTime BaseImageDependencyType = "RunTime" -) - -// PossibleBaseImageDependencyTypeValues returns an array of possible values for the BaseImageDependencyType const type. -func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { - return []BaseImageDependencyType{BuildTime, RunTime} -} - -// BaseImageTriggerType enumerates the values for base image trigger type. -type BaseImageTriggerType string - -const ( - // All ... - All BaseImageTriggerType = "All" - // Runtime ... - Runtime BaseImageTriggerType = "Runtime" -) - -// PossibleBaseImageTriggerTypeValues returns an array of possible values for the BaseImageTriggerType const type. -func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { - return []BaseImageTriggerType{All, Runtime} -} - -// ConnectionStatus enumerates the values for connection status. -type ConnectionStatus string - -const ( - // Approved ... - Approved ConnectionStatus = "Approved" - // Disconnected ... - Disconnected ConnectionStatus = "Disconnected" - // Pending ... - Pending ConnectionStatus = "Pending" - // Rejected ... - Rejected ConnectionStatus = "Rejected" -) - -// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. -func PossibleConnectionStatusValues() []ConnectionStatus { - return []ConnectionStatus{Approved, Disconnected, Pending, Rejected} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // Application ... - Application CreatedByType = "Application" - // Key ... - Key CreatedByType = "Key" - // ManagedIdentity ... - ManagedIdentity CreatedByType = "ManagedIdentity" - // User ... - User CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{Application, Key, ManagedIdentity, User} -} - -// DefaultAction enumerates the values for default action. -type DefaultAction string - -const ( - // DefaultActionAllow ... - DefaultActionAllow DefaultAction = "Allow" - // DefaultActionDeny ... - DefaultActionDeny DefaultAction = "Deny" -) - -// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. -func PossibleDefaultActionValues() []DefaultAction { - return []DefaultAction{DefaultActionAllow, DefaultActionDeny} -} - -// EncryptionStatus enumerates the values for encryption status. -type EncryptionStatus string - -const ( - // Disabled ... - Disabled EncryptionStatus = "disabled" - // Enabled ... - Enabled EncryptionStatus = "enabled" -) - -// PossibleEncryptionStatusValues returns an array of possible values for the EncryptionStatus const type. -func PossibleEncryptionStatusValues() []EncryptionStatus { - return []EncryptionStatus{Disabled, Enabled} -} - -// ImportMode enumerates the values for import mode. -type ImportMode string - -const ( - // Force ... - Force ImportMode = "Force" - // NoForce ... - NoForce ImportMode = "NoForce" -) - -// PossibleImportModeValues returns an array of possible values for the ImportMode const type. -func PossibleImportModeValues() []ImportMode { - return []ImportMode{Force, NoForce} -} - -// LastModifiedByType enumerates the values for last modified by type. -type LastModifiedByType string - -const ( - // LastModifiedByTypeApplication ... - LastModifiedByTypeApplication LastModifiedByType = "Application" - // LastModifiedByTypeKey ... - LastModifiedByTypeKey LastModifiedByType = "Key" - // LastModifiedByTypeManagedIdentity ... - LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" - // LastModifiedByTypeUser ... - LastModifiedByTypeUser LastModifiedByType = "User" -) - -// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. -func PossibleLastModifiedByTypeValues() []LastModifiedByType { - return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} -} - -// OS enumerates the values for os. -type OS string - -const ( - // Linux ... - Linux OS = "Linux" - // Windows ... - Windows OS = "Windows" -) - -// PossibleOSValues returns an array of possible values for the OS const type. -func PossibleOSValues() []OS { - return []OS{Linux, Windows} -} - -// PasswordName enumerates the values for password name. -type PasswordName string - -const ( - // Password ... - Password PasswordName = "password" - // Password2 ... - Password2 PasswordName = "password2" -) - -// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type. -func PossiblePasswordNameValues() []PasswordName { - return []PasswordName{Password, Password2} -} - -// PipelineOptions enumerates the values for pipeline options. -type PipelineOptions string - -const ( - // ContinueOnErrors ... - ContinueOnErrors PipelineOptions = "ContinueOnErrors" - // DeleteSourceBlobOnSuccess ... - DeleteSourceBlobOnSuccess PipelineOptions = "DeleteSourceBlobOnSuccess" - // OverwriteBlobs ... - OverwriteBlobs PipelineOptions = "OverwriteBlobs" - // OverwriteTags ... - OverwriteTags PipelineOptions = "OverwriteTags" -) - -// PossiblePipelineOptionsValues returns an array of possible values for the PipelineOptions const type. -func PossiblePipelineOptionsValues() []PipelineOptions { - return []PipelineOptions{ContinueOnErrors, DeleteSourceBlobOnSuccess, OverwriteBlobs, OverwriteTags} -} - -// PipelineRunSourceType enumerates the values for pipeline run source type. -type PipelineRunSourceType string - -const ( - // AzureStorageBlob ... - AzureStorageBlob PipelineRunSourceType = "AzureStorageBlob" -) - -// PossiblePipelineRunSourceTypeValues returns an array of possible values for the PipelineRunSourceType const type. -func PossiblePipelineRunSourceTypeValues() []PipelineRunSourceType { - return []PipelineRunSourceType{AzureStorageBlob} -} - -// PipelineRunTargetType enumerates the values for pipeline run target type. -type PipelineRunTargetType string - -const ( - // PipelineRunTargetTypeAzureStorageBlob ... - PipelineRunTargetTypeAzureStorageBlob PipelineRunTargetType = "AzureStorageBlob" -) - -// PossiblePipelineRunTargetTypeValues returns an array of possible values for the PipelineRunTargetType const type. -func PossiblePipelineRunTargetTypeValues() []PipelineRunTargetType { - return []PipelineRunTargetType{PipelineRunTargetTypeAzureStorageBlob} -} - -// PipelineSourceType enumerates the values for pipeline source type. -type PipelineSourceType string - -const ( - // AzureStorageBlobContainer ... - AzureStorageBlobContainer PipelineSourceType = "AzureStorageBlobContainer" -) - -// PossiblePipelineSourceTypeValues returns an array of possible values for the PipelineSourceType const type. -func PossiblePipelineSourceTypeValues() []PipelineSourceType { - return []PipelineSourceType{AzureStorageBlobContainer} -} - -// PolicyStatus enumerates the values for policy status. -type PolicyStatus string - -const ( - // PolicyStatusDisabled ... - PolicyStatusDisabled PolicyStatus = "disabled" - // PolicyStatusEnabled ... - PolicyStatusEnabled PolicyStatus = "enabled" -) - -// PossiblePolicyStatusValues returns an array of possible values for the PolicyStatus const type. -func PossiblePolicyStatusValues() []PolicyStatus { - return []PolicyStatus{PolicyStatusDisabled, PolicyStatusEnabled} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Creating ... - Creating ProvisioningState = "Creating" - // Deleting ... - Deleting ProvisioningState = "Deleting" - // Failed ... - Failed ProvisioningState = "Failed" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" - // Updating ... - Updating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// RegistryUsageUnit enumerates the values for registry usage unit. -type RegistryUsageUnit string - -const ( - // Bytes ... - Bytes RegistryUsageUnit = "Bytes" - // Count ... - Count RegistryUsageUnit = "Count" -) - -// PossibleRegistryUsageUnitValues returns an array of possible values for the RegistryUsageUnit const type. -func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { - return []RegistryUsageUnit{Bytes, Count} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// RunStatus enumerates the values for run status. -type RunStatus string - -const ( - // RunStatusCanceled ... - RunStatusCanceled RunStatus = "Canceled" - // RunStatusError ... - RunStatusError RunStatus = "Error" - // RunStatusFailed ... - RunStatusFailed RunStatus = "Failed" - // RunStatusQueued ... - RunStatusQueued RunStatus = "Queued" - // RunStatusRunning ... - RunStatusRunning RunStatus = "Running" - // RunStatusStarted ... - RunStatusStarted RunStatus = "Started" - // RunStatusSucceeded ... - RunStatusSucceeded RunStatus = "Succeeded" - // RunStatusTimeout ... - RunStatusTimeout RunStatus = "Timeout" -) - -// PossibleRunStatusValues returns an array of possible values for the RunStatus const type. -func PossibleRunStatusValues() []RunStatus { - return []RunStatus{RunStatusCanceled, RunStatusError, RunStatusFailed, RunStatusQueued, RunStatusRunning, RunStatusStarted, RunStatusSucceeded, RunStatusTimeout} -} - -// RunType enumerates the values for run type. -type RunType string - -const ( - // AutoBuild ... - AutoBuild RunType = "AutoBuild" - // AutoRun ... - AutoRun RunType = "AutoRun" - // QuickBuild ... - QuickBuild RunType = "QuickBuild" - // QuickRun ... - QuickRun RunType = "QuickRun" -) - -// PossibleRunTypeValues returns an array of possible values for the RunType const type. -func PossibleRunTypeValues() []RunType { - return []RunType{AutoBuild, AutoRun, QuickBuild, QuickRun} -} - -// SecretObjectType enumerates the values for secret object type. -type SecretObjectType string - -const ( - // Opaque ... - Opaque SecretObjectType = "Opaque" - // Vaultsecret ... - Vaultsecret SecretObjectType = "Vaultsecret" -) - -// PossibleSecretObjectTypeValues returns an array of possible values for the SecretObjectType const type. -func PossibleSecretObjectTypeValues() []SecretObjectType { - return []SecretObjectType{Opaque, Vaultsecret} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Basic ... - Basic SkuName = "Basic" - // Classic ... - Classic SkuName = "Classic" - // Premium ... - Premium SkuName = "Premium" - // Standard ... - Standard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{Basic, Classic, Premium, Standard} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic ... - SkuTierBasic SkuTier = "Basic" - // SkuTierClassic ... - SkuTierClassic SkuTier = "Classic" - // SkuTierPremium ... - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBasic, SkuTierClassic, SkuTierPremium, SkuTierStandard} -} - -// SourceControlType enumerates the values for source control type. -type SourceControlType string - -const ( - // Github ... - Github SourceControlType = "Github" - // VisualStudioTeamService ... - VisualStudioTeamService SourceControlType = "VisualStudioTeamService" -) - -// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. -func PossibleSourceControlTypeValues() []SourceControlType { - return []SourceControlType{Github, VisualStudioTeamService} -} - -// SourceRegistryLoginMode enumerates the values for source registry login mode. -type SourceRegistryLoginMode string - -const ( - // SourceRegistryLoginModeDefault ... - SourceRegistryLoginModeDefault SourceRegistryLoginMode = "Default" - // SourceRegistryLoginModeNone ... - SourceRegistryLoginModeNone SourceRegistryLoginMode = "None" -) - -// PossibleSourceRegistryLoginModeValues returns an array of possible values for the SourceRegistryLoginMode const type. -func PossibleSourceRegistryLoginModeValues() []SourceRegistryLoginMode { - return []SourceRegistryLoginMode{SourceRegistryLoginModeDefault, SourceRegistryLoginModeNone} -} - -// SourceTriggerEvent enumerates the values for source trigger event. -type SourceTriggerEvent string - -const ( - // Commit ... - Commit SourceTriggerEvent = "commit" - // Pullrequest ... - Pullrequest SourceTriggerEvent = "pullrequest" -) - -// PossibleSourceTriggerEventValues returns an array of possible values for the SourceTriggerEvent const type. -func PossibleSourceTriggerEventValues() []SourceTriggerEvent { - return []SourceTriggerEvent{Commit, Pullrequest} -} - -// TaskStatus enumerates the values for task status. -type TaskStatus string - -const ( - // TaskStatusDisabled ... - TaskStatusDisabled TaskStatus = "Disabled" - // TaskStatusEnabled ... - TaskStatusEnabled TaskStatus = "Enabled" -) - -// PossibleTaskStatusValues returns an array of possible values for the TaskStatus const type. -func PossibleTaskStatusValues() []TaskStatus { - return []TaskStatus{TaskStatusDisabled, TaskStatusEnabled} -} - -// TokenCertificateName enumerates the values for token certificate name. -type TokenCertificateName string - -const ( - // Certificate1 ... - Certificate1 TokenCertificateName = "certificate1" - // Certificate2 ... - Certificate2 TokenCertificateName = "certificate2" -) - -// PossibleTokenCertificateNameValues returns an array of possible values for the TokenCertificateName const type. -func PossibleTokenCertificateNameValues() []TokenCertificateName { - return []TokenCertificateName{Certificate1, Certificate2} -} - -// TokenPasswordName enumerates the values for token password name. -type TokenPasswordName string - -const ( - // TokenPasswordNamePassword1 ... - TokenPasswordNamePassword1 TokenPasswordName = "password1" - // TokenPasswordNamePassword2 ... - TokenPasswordNamePassword2 TokenPasswordName = "password2" -) - -// PossibleTokenPasswordNameValues returns an array of possible values for the TokenPasswordName const type. -func PossibleTokenPasswordNameValues() []TokenPasswordName { - return []TokenPasswordName{TokenPasswordNamePassword1, TokenPasswordNamePassword2} -} - -// TokenStatus enumerates the values for token status. -type TokenStatus string - -const ( - // TokenStatusDisabled ... - TokenStatusDisabled TokenStatus = "disabled" - // TokenStatusEnabled ... - TokenStatusEnabled TokenStatus = "enabled" -) - -// PossibleTokenStatusValues returns an array of possible values for the TokenStatus const type. -func PossibleTokenStatusValues() []TokenStatus { - return []TokenStatus{TokenStatusDisabled, TokenStatusEnabled} -} - -// TokenType enumerates the values for token type. -type TokenType string - -const ( - // OAuth ... - OAuth TokenType = "OAuth" - // PAT ... - PAT TokenType = "PAT" -) - -// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. -func PossibleTokenTypeValues() []TokenType { - return []TokenType{OAuth, PAT} -} - -// TriggerStatus enumerates the values for trigger status. -type TriggerStatus string - -const ( - // TriggerStatusDisabled ... - TriggerStatusDisabled TriggerStatus = "Disabled" - // TriggerStatusEnabled ... - TriggerStatusEnabled TriggerStatus = "Enabled" -) - -// PossibleTriggerStatusValues returns an array of possible values for the TriggerStatus const type. -func PossibleTriggerStatusValues() []TriggerStatus { - return []TriggerStatus{TriggerStatusDisabled, TriggerStatusEnabled} -} - -// TrustPolicyType enumerates the values for trust policy type. -type TrustPolicyType string - -const ( - // Notary ... - Notary TrustPolicyType = "Notary" -) - -// PossibleTrustPolicyTypeValues returns an array of possible values for the TrustPolicyType const type. -func PossibleTrustPolicyTypeValues() []TrustPolicyType { - return []TrustPolicyType{Notary} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeDockerBuildRequest ... - TypeDockerBuildRequest Type = "DockerBuildRequest" - // TypeEncodedTaskRunRequest ... - TypeEncodedTaskRunRequest Type = "EncodedTaskRunRequest" - // TypeFileTaskRunRequest ... - TypeFileTaskRunRequest Type = "FileTaskRunRequest" - // TypeRunRequest ... - TypeRunRequest Type = "RunRequest" - // TypeTaskRunRequest ... - TypeTaskRunRequest Type = "TaskRunRequest" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeDockerBuildRequest, TypeEncodedTaskRunRequest, TypeFileTaskRunRequest, TypeRunRequest, TypeTaskRunRequest} -} - -// TypeBasicTaskStepProperties enumerates the values for type basic task step properties. -type TypeBasicTaskStepProperties string - -const ( - // TypeDocker ... - TypeDocker TypeBasicTaskStepProperties = "Docker" - // TypeEncodedTask ... - TypeEncodedTask TypeBasicTaskStepProperties = "EncodedTask" - // TypeFileTask ... - TypeFileTask TypeBasicTaskStepProperties = "FileTask" - // TypeTaskStepProperties ... - TypeTaskStepProperties TypeBasicTaskStepProperties = "TaskStepProperties" -) - -// PossibleTypeBasicTaskStepPropertiesValues returns an array of possible values for the TypeBasicTaskStepProperties const type. -func PossibleTypeBasicTaskStepPropertiesValues() []TypeBasicTaskStepProperties { - return []TypeBasicTaskStepProperties{TypeDocker, TypeEncodedTask, TypeFileTask, TypeTaskStepProperties} -} - -// TypeBasicTaskStepUpdateParameters enumerates the values for type basic task step update parameters. -type TypeBasicTaskStepUpdateParameters string - -const ( - // TypeBasicTaskStepUpdateParametersTypeDocker ... - TypeBasicTaskStepUpdateParametersTypeDocker TypeBasicTaskStepUpdateParameters = "Docker" - // TypeBasicTaskStepUpdateParametersTypeEncodedTask ... - TypeBasicTaskStepUpdateParametersTypeEncodedTask TypeBasicTaskStepUpdateParameters = "EncodedTask" - // TypeBasicTaskStepUpdateParametersTypeFileTask ... - TypeBasicTaskStepUpdateParametersTypeFileTask TypeBasicTaskStepUpdateParameters = "FileTask" - // TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters ... - TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters TypeBasicTaskStepUpdateParameters = "TaskStepUpdateParameters" -) - -// PossibleTypeBasicTaskStepUpdateParametersValues returns an array of possible values for the TypeBasicTaskStepUpdateParameters const type. -func PossibleTypeBasicTaskStepUpdateParametersValues() []TypeBasicTaskStepUpdateParameters { - return []TypeBasicTaskStepUpdateParameters{TypeBasicTaskStepUpdateParametersTypeDocker, TypeBasicTaskStepUpdateParametersTypeEncodedTask, TypeBasicTaskStepUpdateParametersTypeFileTask, TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters} -} - -// UpdateTriggerPayloadType enumerates the values for update trigger payload type. -type UpdateTriggerPayloadType string - -const ( - // UpdateTriggerPayloadTypeDefault ... - UpdateTriggerPayloadTypeDefault UpdateTriggerPayloadType = "Default" - // UpdateTriggerPayloadTypeToken ... - UpdateTriggerPayloadTypeToken UpdateTriggerPayloadType = "Token" -) - -// PossibleUpdateTriggerPayloadTypeValues returns an array of possible values for the UpdateTriggerPayloadType const type. -func PossibleUpdateTriggerPayloadTypeValues() []UpdateTriggerPayloadType { - return []UpdateTriggerPayloadType{UpdateTriggerPayloadTypeDefault, UpdateTriggerPayloadTypeToken} -} - -// Variant enumerates the values for variant. -type Variant string - -const ( - // V6 ... - V6 Variant = "v6" - // V7 ... - V7 Variant = "v7" - // V8 ... - V8 Variant = "v8" -) - -// PossibleVariantValues returns an array of possible values for the Variant const type. -func PossibleVariantValues() []Variant { - return []Variant{V6, V7, V8} -} - -// WebhookAction enumerates the values for webhook action. -type WebhookAction string - -const ( - // ChartDelete ... - ChartDelete WebhookAction = "chart_delete" - // ChartPush ... - ChartPush WebhookAction = "chart_push" - // Delete ... - Delete WebhookAction = "delete" - // Push ... - Push WebhookAction = "push" - // Quarantine ... - Quarantine WebhookAction = "quarantine" -) - -// PossibleWebhookActionValues returns an array of possible values for the WebhookAction const type. -func PossibleWebhookActionValues() []WebhookAction { - return []WebhookAction{ChartDelete, ChartPush, Delete, Push, Quarantine} -} - -// WebhookStatus enumerates the values for webhook status. -type WebhookStatus string - -const ( - // WebhookStatusDisabled ... - WebhookStatusDisabled WebhookStatus = "disabled" - // WebhookStatusEnabled ... - WebhookStatusEnabled WebhookStatus = "enabled" -) - -// PossibleWebhookStatusValues returns an array of possible values for the WebhookStatus const type. -func PossibleWebhookStatusValues() []WebhookStatus { - return []WebhookStatus{WebhookStatusDisabled, WebhookStatusEnabled} -} diff --git a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/exportpipelines.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/exportpipelines.go deleted file mode 100644 index f66a8690c0f1..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/exportpipelines.go +++ /dev/null @@ -1,449 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ExportPipelinesClient is the client for the ExportPipelines methods of the Containerregistry service. -type ExportPipelinesClient struct { - BaseClient -} - -// NewExportPipelinesClient creates an instance of the ExportPipelinesClient client. -func NewExportPipelinesClient(subscriptionID string) ExportPipelinesClient { - return NewExportPipelinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExportPipelinesClientWithBaseURI creates an instance of the ExportPipelinesClient 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 NewExportPipelinesClientWithBaseURI(baseURI string, subscriptionID string) ExportPipelinesClient { - return ExportPipelinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an export pipeline for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// exportPipelineName - the name of the export pipeline. -// exportPipelineCreateParameters - the parameters for creating an export pipeline. -func (client ExportPipelinesClient) Create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline) (result ExportPipelinesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineName, - Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineCreateParameters, - Constraints: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties.Target", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties.Target.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ExportPipelinesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportPipelineName": autorest.Encode("path", exportPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", pathParameters), - autorest.WithJSON(exportPipelineCreateParameters), - 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 ExportPipelinesClient) CreateSender(req *http.Request) (future ExportPipelinesCreateFuture, 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 ExportPipelinesClient) CreateResponder(resp *http.Response) (result ExportPipeline, 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 export pipeline from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// exportPipelineName - the name of the export pipeline. -func (client ExportPipelinesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result ExportPipelinesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineName, - Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, exportPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ExportPipelinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportPipelineName": autorest.Encode("path", exportPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", 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 ExportPipelinesClient) DeleteSender(req *http.Request) (future ExportPipelinesDeleteFuture, 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 ExportPipelinesClient) 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 the properties of the export pipeline. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// exportPipelineName - the name of the export pipeline. -func (client ExportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result ExportPipeline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineName, - Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, exportPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExportPipelinesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportPipelineName": autorest.Encode("path", exportPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", 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 ExportPipelinesClient) 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 ExportPipelinesClient) GetResponder(resp *http.Response) (result ExportPipeline, 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 export pipelines for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ExportPipelinesClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ExportPipelineListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.List") - defer func() { - sc := -1 - if result.eplr.Response.Response != nil { - sc = result.eplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.eplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", resp, "Failure sending request") - return - } - - result.eplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", resp, "Failure responding to request") - return - } - if result.eplr.hasNextLink() && result.eplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ExportPipelinesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/exportPipelines", 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 ExportPipelinesClient) 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 ExportPipelinesClient) ListResponder(resp *http.Response) (result ExportPipelineListResult, 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 ExportPipelinesClient) listNextResults(ctx context.Context, lastResults ExportPipelineListResult) (result ExportPipelineListResult, err error) { - req, err := lastResults.exportPipelineListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "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, "containerregistry.ExportPipelinesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExportPipelinesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ExportPipelineListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/importpipelines.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/importpipelines.go deleted file mode 100644 index 344cfa2427aa..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/importpipelines.go +++ /dev/null @@ -1,449 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ImportPipelinesClient is the client for the ImportPipelines methods of the Containerregistry service. -type ImportPipelinesClient struct { - BaseClient -} - -// NewImportPipelinesClient creates an instance of the ImportPipelinesClient client. -func NewImportPipelinesClient(subscriptionID string) ImportPipelinesClient { - return NewImportPipelinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewImportPipelinesClientWithBaseURI creates an instance of the ImportPipelinesClient 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 NewImportPipelinesClientWithBaseURI(baseURI string, subscriptionID string) ImportPipelinesClient { - return ImportPipelinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an import pipeline for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// importPipelineName - the name of the import pipeline. -// importPipelineCreateParameters - the parameters for creating an import pipeline. -func (client ImportPipelinesClient) Create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline) (result ImportPipelinesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineName, - Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineCreateParameters, - Constraints: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties.Source.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ImportPipelinesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "importPipelineName": autorest.Encode("path", importPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", pathParameters), - autorest.WithJSON(importPipelineCreateParameters), - 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 ImportPipelinesClient) CreateSender(req *http.Request) (future ImportPipelinesCreateFuture, 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 ImportPipelinesClient) CreateResponder(resp *http.Response) (result ImportPipeline, 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 import pipeline from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// importPipelineName - the name of the import pipeline. -func (client ImportPipelinesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result ImportPipelinesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineName, - Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, importPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ImportPipelinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "importPipelineName": autorest.Encode("path", importPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", 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 ImportPipelinesClient) DeleteSender(req *http.Request) (future ImportPipelinesDeleteFuture, 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 ImportPipelinesClient) 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 the properties of the import pipeline. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// importPipelineName - the name of the import pipeline. -func (client ImportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result ImportPipeline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineName, - Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, importPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ImportPipelinesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "importPipelineName": autorest.Encode("path", importPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", 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 ImportPipelinesClient) 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 ImportPipelinesClient) GetResponder(resp *http.Response) (result ImportPipeline, 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 import pipelines for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ImportPipelinesClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ImportPipelineListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.List") - defer func() { - sc := -1 - if result.iplr.Response.Response != nil { - sc = result.iplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", resp, "Failure sending request") - return - } - - result.iplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", resp, "Failure responding to request") - return - } - if result.iplr.hasNextLink() && result.iplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ImportPipelinesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/importPipelines", 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 ImportPipelinesClient) 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 ImportPipelinesClient) ListResponder(resp *http.Response) (result ImportPipelineListResult, 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 ImportPipelinesClient) listNextResults(ctx context.Context, lastResults ImportPipelineListResult) (result ImportPipelineListResult, err error) { - req, err := lastResults.importPipelineListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "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, "containerregistry.ImportPipelinesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ImportPipelinesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ImportPipelineListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/models.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/models.go deleted file mode 100644 index 4218f9802d6e..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/models.go +++ /dev/null @@ -1,9394 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry" - -// ActiveDirectoryObject the Active Directory Object that will be used for authenticating the token of a -// container registry. -type ActiveDirectoryObject struct { - // ObjectID - The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container registry. - ObjectID *string `json:"objectId,omitempty"` - // TenantID - The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of a container registry. - TenantID *string `json:"tenantId,omitempty"` -} - -// Actor the agent that initiated the event. For most situations, this could be from the authorization -// context of the request. -type Actor struct { - // Name - The subject or username associated with the request context that generated the event. - Name *string `json:"name,omitempty"` -} - -// AgentPool the agentpool that has the ARM resource and properties. -// The agentpool will have all information to create an agent pool. -type AgentPool struct { - autorest.Response `json:"-"` - // AgentPoolProperties - The properties associated with the agent pool - *AgentPoolProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPool. -func (ap AgentPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.AgentPoolProperties != nil { - objectMap["properties"] = ap.AgentPoolProperties - } - if ap.Location != nil { - objectMap["location"] = ap.Location - } - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPool struct. -func (ap *AgentPool) 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 agentPoolProperties AgentPoolProperties - err = json.Unmarshal(*v, &agentPoolProperties) - if err != nil { - return err - } - ap.AgentPoolProperties = &agentPoolProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ap.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ap.SystemData = &systemData - } - } - } - - return nil -} - -// AgentPoolListResult the collection of agent pools. -type AgentPoolListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]AgentPool `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. -type AgentPoolListResultIterator struct { - i int - page AgentPoolListResultPage -} - -// 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 *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.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 *AgentPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AgentPoolListResultIterator) 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 AgentPoolListResultIterator) Response() AgentPoolListResult { - 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 AgentPoolListResultIterator) Value() AgentPool { - if !iter.page.NotDone() { - return AgentPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AgentPoolListResultIterator type. -func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { - return AgentPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aplr AgentPoolListResult) IsEmpty() bool { - return aplr.Value == nil || len(*aplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aplr AgentPoolListResult) hasNextLink() bool { - return aplr.NextLink != nil && len(*aplr.NextLink) != 0 -} - -// agentPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aplr.NextLink))) -} - -// AgentPoolListResultPage contains a page of AgentPool values. -type AgentPoolListResultPage struct { - fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) - aplr AgentPoolListResult -} - -// 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 *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.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.aplr) - if err != nil { - return err - } - page.aplr = 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 *AgentPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AgentPoolListResultPage) NotDone() bool { - return !page.aplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AgentPoolListResultPage) Response() AgentPoolListResult { - return page.aplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AgentPoolListResultPage) Values() []AgentPool { - if page.aplr.IsEmpty() { - return nil - } - return *page.aplr.Value -} - -// Creates a new instance of the AgentPoolListResultPage type. -func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { - return AgentPoolListResultPage{ - fn: getNextPage, - aplr: cur, - } -} - -// AgentPoolProperties the properties of agent pool. -type AgentPoolProperties struct { - // Count - The count of agent machine - Count *int32 `json:"count,omitempty"` - // Tier - The Tier of agent machine - Tier *string `json:"tier,omitempty"` - // Os - The OS of agent machine. Possible values include: 'Windows', 'Linux' - Os OS `json:"os,omitempty"` - // VirtualNetworkSubnetResourceID - The Virtual Network Subnet Resource Id of the agent machine - VirtualNetworkSubnetResourceID *string `json:"virtualNetworkSubnetResourceId,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of this agent pool. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolProperties. -func (app AgentPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if app.Count != nil { - objectMap["count"] = app.Count - } - if app.Tier != nil { - objectMap["tier"] = app.Tier - } - if app.Os != "" { - objectMap["os"] = app.Os - } - if app.VirtualNetworkSubnetResourceID != nil { - objectMap["virtualNetworkSubnetResourceId"] = app.VirtualNetworkSubnetResourceID - } - return json.Marshal(objectMap) -} - -// AgentPoolPropertiesUpdateParameters ... -type AgentPoolPropertiesUpdateParameters struct { - // Count - The count of agent machine - Count *int32 `json:"count,omitempty"` -} - -// AgentPoolQueueStatus the QueueStatus of Agent Pool -type AgentPoolQueueStatus struct { - autorest.Response `json:"-"` - // Count - The number of pending runs in the queue - Count *int32 `json:"count,omitempty"` -} - -// AgentPoolsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsCreateFuture) 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 AgentPoolsCreateFuture.Result. -func (future *AgentPoolsCreateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.CreateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsDeleteFuture) 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 AgentPoolsDeleteFuture.Result. -func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AgentPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsUpdateFuture) 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 AgentPoolsUpdateFuture.Result. -func (future *AgentPoolsUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.UpdateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolUpdateParameters the parameters for updating an agent pool. -type AgentPoolUpdateParameters struct { - // AgentPoolPropertiesUpdateParameters - The properties associated with the agent pool - *AgentPoolPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AgentPoolUpdateParameters. -func (apup AgentPoolUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apup.AgentPoolPropertiesUpdateParameters != nil { - objectMap["properties"] = apup.AgentPoolPropertiesUpdateParameters - } - if apup.Tags != nil { - objectMap["tags"] = apup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPoolUpdateParameters struct. -func (apup *AgentPoolUpdateParameters) 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 agentPoolPropertiesUpdateParameters AgentPoolPropertiesUpdateParameters - err = json.Unmarshal(*v, &agentPoolPropertiesUpdateParameters) - if err != nil { - return err - } - apup.AgentPoolPropertiesUpdateParameters = &agentPoolPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - apup.Tags = tags - } - } - } - - return nil -} - -// AgentProperties the properties that determine the run agent configuration. -type AgentProperties struct { - // CPU - The CPU configuration in terms of number of cores required for the run. - CPU *int32 `json:"cpu,omitempty"` -} - -// Argument the properties of a run argument. -type Argument struct { - // Name - The name of the argument. - Name *string `json:"name,omitempty"` - // Value - The value of the argument. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// AuthInfo the authorization properties for accessing the source code repository. -type AuthInfo struct { - // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' - TokenType TokenType `json:"tokenType,omitempty"` - // Token - The access token used to access the source control provider. - Token *string `json:"token,omitempty"` - // RefreshToken - The refresh token used to refresh the access token. - RefreshToken *string `json:"refreshToken,omitempty"` - // Scope - The scope of the access token. - Scope *string `json:"scope,omitempty"` - // ExpiresIn - Time in seconds that the token remains valid - ExpiresIn *int32 `json:"expiresIn,omitempty"` -} - -// AuthInfoUpdateParameters the authorization properties for accessing the source code repository. -type AuthInfoUpdateParameters struct { - // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' - TokenType TokenType `json:"tokenType,omitempty"` - // Token - The access token used to access the source control provider. - Token *string `json:"token,omitempty"` - // RefreshToken - The refresh token used to refresh the access token. - RefreshToken *string `json:"refreshToken,omitempty"` - // Scope - The scope of the access token. - Scope *string `json:"scope,omitempty"` - // ExpiresIn - Time in seconds that the token remains valid - ExpiresIn *int32 `json:"expiresIn,omitempty"` -} - -// BaseImageDependency properties that describe a base image dependency. -type BaseImageDependency struct { - // Type - The type of the base image dependency. Possible values include: 'BuildTime', 'RunTime' - Type BaseImageDependencyType `json:"type,omitempty"` - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// BaseImageTrigger the trigger based on base image dependency. -type BaseImageTrigger struct { - // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime' - BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` - // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' - UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// BaseImageTriggerUpdateParameters the properties for updating base image dependency trigger. -type BaseImageTriggerUpdateParameters struct { - // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime' - BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` - // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' - UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// CallbackConfig the configuration of service URI and custom headers for the webhook. -type CallbackConfig struct { - autorest.Response `json:"-"` - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` -} - -// MarshalJSON is the custom marshaler for CallbackConfig. -func (cc CallbackConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.ServiceURI != nil { - objectMap["serviceUri"] = cc.ServiceURI - } - if cc.CustomHeaders != nil { - objectMap["customHeaders"] = cc.CustomHeaders - } - return json.Marshal(objectMap) -} - -// Credentials the parameters that describes a set of credentials that will be used when a run is invoked. -type Credentials struct { - // SourceRegistry - Describes the credential parameters for accessing the source registry. - SourceRegistry *SourceRegistryCredentials `json:"sourceRegistry,omitempty"` - // CustomRegistries - Describes the credential parameters for accessing other custom registries. The key - // for the dictionary item will be the registry login server (myregistry.azurecr.io) and - // the value of the item will be the registry credentials for accessing the registry. - CustomRegistries map[string]*CustomRegistryCredentials `json:"customRegistries"` -} - -// MarshalJSON is the custom marshaler for Credentials. -func (c Credentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.SourceRegistry != nil { - objectMap["sourceRegistry"] = c.SourceRegistry - } - if c.CustomRegistries != nil { - objectMap["customRegistries"] = c.CustomRegistries - } - return json.Marshal(objectMap) -} - -// CustomRegistryCredentials describes the credentials that will be used to access a custom registry during -// a run. -type CustomRegistryCredentials struct { - // UserName - The username for logging into the custom registry. - UserName *SecretObject `json:"userName,omitempty"` - // Password - The password for logging into the custom registry. The password is a secret - // object that allows multiple ways of providing the value for it. - Password *SecretObject `json:"password,omitempty"` - // Identity - Indicates the managed identity assigned to the custom credential. If a user-assigned identity - // this value is the Client ID. If a system-assigned identity, the value will be `system`. In - // the case of a system-assigned identity, the Client ID will be determined by the runner. This - // identity may be used to authenticate to key vault to retrieve credentials or it may be the only - // source of authentication used for accessing the registry. - Identity *string `json:"identity,omitempty"` -} - -// DockerBuildRequest the parameters for a docker quick build. -type DockerBuildRequest struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source location. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Arguments - The collection of override arguments to be used when executing the run. - Arguments *[]Argument `json:"arguments,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildRequest. -func (dbr DockerBuildRequest) MarshalJSON() ([]byte, error) { - dbr.Type = TypeDockerBuildRequest - objectMap := make(map[string]interface{}) - if dbr.ImageNames != nil { - objectMap["imageNames"] = dbr.ImageNames - } - if dbr.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbr.IsPushEnabled - } - if dbr.NoCache != nil { - objectMap["noCache"] = dbr.NoCache - } - if dbr.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbr.DockerFilePath - } - if dbr.Target != nil { - objectMap["target"] = dbr.Target - } - if dbr.Arguments != nil { - objectMap["arguments"] = dbr.Arguments - } - if dbr.Timeout != nil { - objectMap["timeout"] = dbr.Timeout - } - if dbr.Platform != nil { - objectMap["platform"] = dbr.Platform - } - if dbr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = dbr.AgentConfiguration - } - if dbr.SourceLocation != nil { - objectMap["sourceLocation"] = dbr.SourceLocation - } - if dbr.Credentials != nil { - objectMap["credentials"] = dbr.Credentials - } - if dbr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = dbr.IsArchiveEnabled - } - if dbr.AgentPoolName != nil { - objectMap["agentPoolName"] = dbr.AgentPoolName - } - if dbr.LogTemplate != nil { - objectMap["logTemplate"] = dbr.LogTemplate - } - if dbr.Type != "" { - objectMap["type"] = dbr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return &dbr, true -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &dbr, true -} - -// DockerBuildStep the Docker build step. -type DockerBuildStep struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source context. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Arguments - The collection of override arguments to be used when executing this build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStep. -func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) { - dbs.Type = TypeDocker - objectMap := make(map[string]interface{}) - if dbs.ImageNames != nil { - objectMap["imageNames"] = dbs.ImageNames - } - if dbs.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbs.IsPushEnabled - } - if dbs.NoCache != nil { - objectMap["noCache"] = dbs.NoCache - } - if dbs.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbs.DockerFilePath - } - if dbs.Target != nil { - objectMap["target"] = dbs.Target - } - if dbs.Arguments != nil { - objectMap["arguments"] = dbs.Arguments - } - if dbs.ContextPath != nil { - objectMap["contextPath"] = dbs.ContextPath - } - if dbs.ContextAccessToken != nil { - objectMap["contextAccessToken"] = dbs.ContextAccessToken - } - if dbs.Type != "" { - objectMap["type"] = dbs.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return &dbs, true -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &dbs, true -} - -// DockerBuildStepUpdateParameters the properties for updating a docker build step. -type DockerBuildStepUpdateParameters struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source context. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Arguments - The collection of override arguments to be used when executing this build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { - dbsup.Type = TypeBasicTaskStepUpdateParametersTypeDocker - objectMap := make(map[string]interface{}) - if dbsup.ImageNames != nil { - objectMap["imageNames"] = dbsup.ImageNames - } - if dbsup.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbsup.IsPushEnabled - } - if dbsup.NoCache != nil { - objectMap["noCache"] = dbsup.NoCache - } - if dbsup.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbsup.DockerFilePath - } - if dbsup.Arguments != nil { - objectMap["arguments"] = dbsup.Arguments - } - if dbsup.Target != nil { - objectMap["target"] = dbsup.Target - } - if dbsup.ContextPath != nil { - objectMap["contextPath"] = dbsup.ContextPath - } - if dbsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = dbsup.ContextAccessToken - } - if dbsup.Type != "" { - objectMap["type"] = dbsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return &dbsup, true -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &dbsup, true -} - -// EncodedTaskRunRequest the parameters for a quick task run request. -type EncodedTaskRunRequest struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { - etrr.Type = TypeEncodedTaskRunRequest - objectMap := make(map[string]interface{}) - if etrr.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = etrr.EncodedTaskContent - } - if etrr.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = etrr.EncodedValuesContent - } - if etrr.Values != nil { - objectMap["values"] = etrr.Values - } - if etrr.Timeout != nil { - objectMap["timeout"] = etrr.Timeout - } - if etrr.Platform != nil { - objectMap["platform"] = etrr.Platform - } - if etrr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = etrr.AgentConfiguration - } - if etrr.SourceLocation != nil { - objectMap["sourceLocation"] = etrr.SourceLocation - } - if etrr.Credentials != nil { - objectMap["credentials"] = etrr.Credentials - } - if etrr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = etrr.IsArchiveEnabled - } - if etrr.AgentPoolName != nil { - objectMap["agentPoolName"] = etrr.AgentPoolName - } - if etrr.LogTemplate != nil { - objectMap["logTemplate"] = etrr.LogTemplate - } - if etrr.Type != "" { - objectMap["type"] = etrr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return &etrr, true -} - -// AsRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &etrr, true -} - -// EncodedTaskStep the properties of a encoded task step. -type EncodedTaskStep struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskStep. -func (ets EncodedTaskStep) MarshalJSON() ([]byte, error) { - ets.Type = TypeEncodedTask - objectMap := make(map[string]interface{}) - if ets.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = ets.EncodedTaskContent - } - if ets.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = ets.EncodedValuesContent - } - if ets.Values != nil { - objectMap["values"] = ets.Values - } - if ets.ContextPath != nil { - objectMap["contextPath"] = ets.ContextPath - } - if ets.ContextAccessToken != nil { - objectMap["contextAccessToken"] = ets.ContextAccessToken - } - if ets.Type != "" { - objectMap["type"] = ets.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return &ets, true -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &ets, true -} - -// EncodedTaskStepUpdateParameters the properties for updating encoded task step. -type EncodedTaskStepUpdateParameters struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - etsup.Type = TypeBasicTaskStepUpdateParametersTypeEncodedTask - objectMap := make(map[string]interface{}) - if etsup.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = etsup.EncodedTaskContent - } - if etsup.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = etsup.EncodedValuesContent - } - if etsup.Values != nil { - objectMap["values"] = etsup.Values - } - if etsup.ContextPath != nil { - objectMap["contextPath"] = etsup.ContextPath - } - if etsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = etsup.ContextAccessToken - } - if etsup.Type != "" { - objectMap["type"] = etsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return &etsup, true -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &etsup, true -} - -// EncryptionProperty ... -type EncryptionProperty struct { - // Status - Indicates whether or not the encryption is enabled for container registry. Possible values include: 'Enabled', 'Disabled' - Status EncryptionStatus `json:"status,omitempty"` - // KeyVaultProperties - Key vault properties. - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} - -// ErrorResponse an error response from the Azure Container Registry service. -type ErrorResponse struct { - // Error - Azure container registry build API error body. - Error *ErrorResponseBody `json:"error,omitempty"` -} - -// ErrorResponseBody an error response from the Azure Container Registry service. -type ErrorResponseBody struct { - // Code - error code. - Code *string `json:"code,omitempty"` - // Message - error message. - Message *string `json:"message,omitempty"` - // Target - target of the particular error. - Target *string `json:"target,omitempty"` - // Details - an array of additional nested error response info objects, as described by this contract. - Details *InnerErrorDescription `json:"details,omitempty"` -} - -// Event the event for a webhook. -type Event struct { - // EventRequestMessage - The event request message sent to the service URI. - EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` - // EventResponseMessage - The event response message received from the service URI. - EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventContent the content of the event request message. -type EventContent struct { - // ID - The event ID. - ID *string `json:"id,omitempty"` - // Timestamp - The time at which the event occurred. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Action - The action that encompasses the provided event. - Action *string `json:"action,omitempty"` - // Target - The target of the event. - Target *Target `json:"target,omitempty"` - // Request - The request that generated the event. - Request *Request `json:"request,omitempty"` - // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. - Actor *Actor `json:"actor,omitempty"` - // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - Source *Source `json:"source,omitempty"` -} - -// EventInfo the basic information of an event. -type EventInfo struct { - autorest.Response `json:"-"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventListResult the result of a request to list events for a webhook. -type EventListResult struct { - autorest.Response `json:"-"` - // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - Value *[]Event `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventListResultIterator provides access to a complete listing of Event values. -type EventListResultIterator struct { - i int - page EventListResultPage -} - -// 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 *EventListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.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 *EventListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventListResultIterator) 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 EventListResultIterator) Response() EventListResult { - 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 EventListResultIterator) Value() Event { - if !iter.page.NotDone() { - return Event{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventListResultIterator type. -func NewEventListResultIterator(page EventListResultPage) EventListResultIterator { - return EventListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (elr EventListResult) IsEmpty() bool { - return elr.Value == nil || len(*elr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (elr EventListResult) hasNextLink() bool { - return elr.NextLink != nil && len(*elr.NextLink) != 0 -} - -// eventListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (elr EventListResult) eventListResultPreparer(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))) -} - -// EventListResultPage contains a page of Event values. -type EventListResultPage struct { - fn func(context.Context, EventListResult) (EventListResult, error) - elr EventListResult -} - -// 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 *EventListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.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 *EventListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventListResultPage) NotDone() bool { - return !page.elr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventListResultPage) Response() EventListResult { - return page.elr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventListResultPage) Values() []Event { - if page.elr.IsEmpty() { - return nil - } - return *page.elr.Value -} - -// Creates a new instance of the EventListResultPage type. -func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage { - return EventListResultPage{ - fn: getNextPage, - elr: cur, - } -} - -// EventRequestMessage the event request message sent to the service URI. -type EventRequestMessage struct { - // Content - The content of the event request message. - Content *EventContent `json:"content,omitempty"` - // Headers - The headers of the event request message. - Headers map[string]*string `json:"headers"` - // Method - The HTTP method used to send the event request message. - Method *string `json:"method,omitempty"` - // RequestURI - The URI used to send the event request message. - RequestURI *string `json:"requestUri,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventRequestMessage. -func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.Method != nil { - objectMap["method"] = erm.Method - } - if erm.RequestURI != nil { - objectMap["requestUri"] = erm.RequestURI - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// EventResponseMessage the event response message received from the service URI. -type EventResponseMessage struct { - // Content - The content of the event response message. - Content *string `json:"content,omitempty"` - // Headers - The headers of the event response message. - Headers map[string]*string `json:"headers"` - // ReasonPhrase - The reason phrase of the event response message. - ReasonPhrase *string `json:"reasonPhrase,omitempty"` - // StatusCode - The status code of the event response message. - StatusCode *string `json:"statusCode,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventResponseMessage. -func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.ReasonPhrase != nil { - objectMap["reasonPhrase"] = erm.ReasonPhrase - } - if erm.StatusCode != nil { - objectMap["statusCode"] = erm.StatusCode - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// ExportPipeline an object that represents an export pipeline for a container registry. -type ExportPipeline struct { - autorest.Response `json:"-"` - // Location - The location of the export pipeline. - Location *string `json:"location,omitempty"` - // Identity - The identity of the export pipeline. - Identity *IdentityProperties `json:"identity,omitempty"` - // ExportPipelineProperties - The properties of the export pipeline. - *ExportPipelineProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportPipeline. -func (ep ExportPipeline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.Location != nil { - objectMap["location"] = ep.Location - } - if ep.Identity != nil { - objectMap["identity"] = ep.Identity - } - if ep.ExportPipelineProperties != nil { - objectMap["properties"] = ep.ExportPipelineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExportPipeline struct. -func (ep *ExportPipeline) 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 - } - ep.Location = &location - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ep.Identity = &identity - } - case "properties": - if v != nil { - var exportPipelineProperties ExportPipelineProperties - err = json.Unmarshal(*v, &exportPipelineProperties) - if err != nil { - return err - } - ep.ExportPipelineProperties = &exportPipelineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ep.SystemData = &systemData - } - } - } - - return nil -} - -// ExportPipelineListResult the result of a request to list export pipelines for a container registry. -type ExportPipelineListResult struct { - autorest.Response `json:"-"` - // Value - The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of export pipelines. - Value *[]ExportPipeline `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of pipeline runs. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExportPipelineListResultIterator provides access to a complete listing of ExportPipeline values. -type ExportPipelineListResultIterator struct { - i int - page ExportPipelineListResultPage -} - -// 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 *ExportPipelineListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelineListResultIterator.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 *ExportPipelineListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExportPipelineListResultIterator) 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 ExportPipelineListResultIterator) Response() ExportPipelineListResult { - 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 ExportPipelineListResultIterator) Value() ExportPipeline { - if !iter.page.NotDone() { - return ExportPipeline{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExportPipelineListResultIterator type. -func NewExportPipelineListResultIterator(page ExportPipelineListResultPage) ExportPipelineListResultIterator { - return ExportPipelineListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eplr ExportPipelineListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eplr ExportPipelineListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 -} - -// exportPipelineListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eplr ExportPipelineListResult) exportPipelineListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) -} - -// ExportPipelineListResultPage contains a page of ExportPipeline values. -type ExportPipelineListResultPage struct { - fn func(context.Context, ExportPipelineListResult) (ExportPipelineListResult, error) - eplr ExportPipelineListResult -} - -// 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 *ExportPipelineListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelineListResultPage.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.eplr) - if err != nil { - return err - } - page.eplr = 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 *ExportPipelineListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExportPipelineListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExportPipelineListResultPage) Response() ExportPipelineListResult { - return page.eplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExportPipelineListResultPage) Values() []ExportPipeline { - if page.eplr.IsEmpty() { - return nil - } - return *page.eplr.Value -} - -// Creates a new instance of the ExportPipelineListResultPage type. -func NewExportPipelineListResultPage(cur ExportPipelineListResult, getNextPage func(context.Context, ExportPipelineListResult) (ExportPipelineListResult, error)) ExportPipelineListResultPage { - return ExportPipelineListResultPage{ - fn: getNextPage, - eplr: cur, - } -} - -// ExportPipelineProperties the properties of an export pipeline. -type ExportPipelineProperties struct { - // Target - The target properties of the export pipeline. - Target *ExportPipelineTargetProperties `json:"target,omitempty"` - // Options - The list of all options configured for the pipeline. - Options *[]PipelineOptions `json:"options,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the pipeline at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportPipelineProperties. -func (epp ExportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epp.Target != nil { - objectMap["target"] = epp.Target - } - if epp.Options != nil { - objectMap["options"] = epp.Options - } - return json.Marshal(objectMap) -} - -// ExportPipelinesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExportPipelinesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExportPipelinesClient) (ExportPipeline, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExportPipelinesCreateFuture) 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 ExportPipelinesCreateFuture.Result. -func (future *ExportPipelinesCreateFuture) result(client ExportPipelinesClient) (ep ExportPipeline, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ExportPipelinesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesCreateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ExportPipelinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExportPipelinesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExportPipelinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExportPipelinesDeleteFuture) 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 ExportPipelinesDeleteFuture.Result. -func (future *ExportPipelinesDeleteFuture) result(client ExportPipelinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ExportPipelinesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExportPipelineTargetProperties the properties of the export pipeline target. -type ExportPipelineTargetProperties struct { - // Type - The type of target for the export pipeline. - Type *string `json:"type,omitempty"` - // URI - The target uri of the export pipeline. - // When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName" - URI *string `json:"uri,omitempty"` - // KeyVaultURI - They key vault secret uri to obtain the target storage SAS token. - KeyVaultURI *string `json:"keyVaultUri,omitempty"` -} - -// FileTaskRunRequest the request parameters for a scheduling run against a task file. -type FileTaskRunRequest struct { - // TaskFilePath - The template/definition file path relative to the source. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The values/parameters file path relative to the source. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) MarshalJSON() ([]byte, error) { - ftrr.Type = TypeFileTaskRunRequest - objectMap := make(map[string]interface{}) - if ftrr.TaskFilePath != nil { - objectMap["taskFilePath"] = ftrr.TaskFilePath - } - if ftrr.ValuesFilePath != nil { - objectMap["valuesFilePath"] = ftrr.ValuesFilePath - } - if ftrr.Values != nil { - objectMap["values"] = ftrr.Values - } - if ftrr.Timeout != nil { - objectMap["timeout"] = ftrr.Timeout - } - if ftrr.Platform != nil { - objectMap["platform"] = ftrr.Platform - } - if ftrr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = ftrr.AgentConfiguration - } - if ftrr.SourceLocation != nil { - objectMap["sourceLocation"] = ftrr.SourceLocation - } - if ftrr.Credentials != nil { - objectMap["credentials"] = ftrr.Credentials - } - if ftrr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = ftrr.IsArchiveEnabled - } - if ftrr.AgentPoolName != nil { - objectMap["agentPoolName"] = ftrr.AgentPoolName - } - if ftrr.LogTemplate != nil { - objectMap["logTemplate"] = ftrr.LogTemplate - } - if ftrr.Type != "" { - objectMap["type"] = ftrr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return &ftrr, true -} - -// AsTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &ftrr, true -} - -// FileTaskStep the properties of a task step. -type FileTaskStep struct { - // TaskFilePath - The task template/definition file path relative to the source context. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The task values/parameters file path relative to the source context. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskStep. -func (fts FileTaskStep) MarshalJSON() ([]byte, error) { - fts.Type = TypeFileTask - objectMap := make(map[string]interface{}) - if fts.TaskFilePath != nil { - objectMap["taskFilePath"] = fts.TaskFilePath - } - if fts.ValuesFilePath != nil { - objectMap["valuesFilePath"] = fts.ValuesFilePath - } - if fts.Values != nil { - objectMap["values"] = fts.Values - } - if fts.ContextPath != nil { - objectMap["contextPath"] = fts.ContextPath - } - if fts.ContextAccessToken != nil { - objectMap["contextAccessToken"] = fts.ContextAccessToken - } - if fts.Type != "" { - objectMap["type"] = fts.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { - return &fts, true -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &fts, true -} - -// FileTaskStepUpdateParameters the properties of updating a task step. -type FileTaskStepUpdateParameters struct { - // TaskFilePath - The task template/definition file path relative to the source context. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The values/parameters file path relative to the source context. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - ftsup.Type = TypeBasicTaskStepUpdateParametersTypeFileTask - objectMap := make(map[string]interface{}) - if ftsup.TaskFilePath != nil { - objectMap["taskFilePath"] = ftsup.TaskFilePath - } - if ftsup.ValuesFilePath != nil { - objectMap["valuesFilePath"] = ftsup.ValuesFilePath - } - if ftsup.Values != nil { - objectMap["values"] = ftsup.Values - } - if ftsup.ContextPath != nil { - objectMap["contextPath"] = ftsup.ContextPath - } - if ftsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = ftsup.ContextAccessToken - } - if ftsup.Type != "" { - objectMap["type"] = ftsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return &ftsup, true -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &ftsup, true -} - -// GenerateCredentialsParameters the parameters used to generate credentials for a specified token or user -// of a container registry. -type GenerateCredentialsParameters struct { - // TokenID - The resource ID of the token for which credentials have to be generated. - TokenID *string `json:"tokenId,omitempty"` - // Expiry - The expiry date of the generated credentials after which the credentials become invalid. - Expiry *date.Time `json:"expiry,omitempty"` - // Name - Specifies name of the password which should be regenerated if any -- password1 or password2. Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' - Name TokenPasswordName `json:"name,omitempty"` -} - -// GenerateCredentialsResult the response from the GenerateCredentials operation. -type GenerateCredentialsResult struct { - autorest.Response `json:"-"` - // Username - The username for a container registry. - Username *string `json:"username,omitempty"` - // Passwords - The list of passwords for a container registry. - Passwords *[]TokenPassword `json:"passwords,omitempty"` -} - -// IdentityProperties managed identity for the resource. -type IdentityProperties struct { - // PrincipalID - The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the resource. The user identity - // dictionary key references will be ARM resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - // providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for IdentityProperties. -func (IP IdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.PrincipalID != nil { - objectMap["principalId"] = IP.PrincipalID - } - if IP.TenantID != nil { - objectMap["tenantId"] = IP.TenantID - } - if IP.Type != "" { - objectMap["type"] = IP.Type - } - if IP.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = IP.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ImageDescriptor properties for a registry image. -type ImageDescriptor struct { - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// ImageUpdateTrigger the image update trigger that caused a build. -type ImageUpdateTrigger struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // Timestamp - The timestamp when the image update happened. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Images - The list of image updates that caused the build. - Images *[]ImageDescriptor `json:"images,omitempty"` -} - -// ImportImageParameters ... -type ImportImageParameters struct { - // Source - The source of the image. - Source *ImportSource `json:"source,omitempty"` - // TargetTags - List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - TargetTags *[]string `json:"targetTags,omitempty"` - // UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created. - UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"` - // Mode - When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'NoForce', 'Force' - Mode ImportMode `json:"mode,omitempty"` -} - -// ImportPipeline an object that represents an import pipeline for a container registry. -type ImportPipeline struct { - autorest.Response `json:"-"` - // Location - The location of the import pipeline. - Location *string `json:"location,omitempty"` - // Identity - The identity of the import pipeline. - Identity *IdentityProperties `json:"identity,omitempty"` - // ImportPipelineProperties - The properties of the import pipeline. - *ImportPipelineProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImportPipeline. -func (IP ImportPipeline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.Location != nil { - objectMap["location"] = IP.Location - } - if IP.Identity != nil { - objectMap["identity"] = IP.Identity - } - if IP.ImportPipelineProperties != nil { - objectMap["properties"] = IP.ImportPipelineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ImportPipeline struct. -func (IP *ImportPipeline) 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 - } - IP.Location = &location - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - IP.Identity = &identity - } - case "properties": - if v != nil { - var importPipelineProperties ImportPipelineProperties - err = json.Unmarshal(*v, &importPipelineProperties) - if err != nil { - return err - } - IP.ImportPipelineProperties = &importPipelineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - IP.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - IP.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - IP.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - IP.SystemData = &systemData - } - } - } - - return nil -} - -// ImportPipelineListResult the result of a request to list import pipelines for a container registry. -type ImportPipelineListResult struct { - autorest.Response `json:"-"` - // Value - The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of import pipelines. - Value *[]ImportPipeline `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of pipeline runs. - NextLink *string `json:"nextLink,omitempty"` -} - -// ImportPipelineListResultIterator provides access to a complete listing of ImportPipeline values. -type ImportPipelineListResultIterator struct { - i int - page ImportPipelineListResultPage -} - -// 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 *ImportPipelineListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelineListResultIterator.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 *ImportPipelineListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ImportPipelineListResultIterator) 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 ImportPipelineListResultIterator) Response() ImportPipelineListResult { - 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 ImportPipelineListResultIterator) Value() ImportPipeline { - if !iter.page.NotDone() { - return ImportPipeline{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ImportPipelineListResultIterator type. -func NewImportPipelineListResultIterator(page ImportPipelineListResultPage) ImportPipelineListResultIterator { - return ImportPipelineListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iplr ImportPipelineListResult) IsEmpty() bool { - return iplr.Value == nil || len(*iplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iplr ImportPipelineListResult) hasNextLink() bool { - return iplr.NextLink != nil && len(*iplr.NextLink) != 0 -} - -// importPipelineListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iplr ImportPipelineListResult) importPipelineListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iplr.NextLink))) -} - -// ImportPipelineListResultPage contains a page of ImportPipeline values. -type ImportPipelineListResultPage struct { - fn func(context.Context, ImportPipelineListResult) (ImportPipelineListResult, error) - iplr ImportPipelineListResult -} - -// 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 *ImportPipelineListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelineListResultPage.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.iplr) - if err != nil { - return err - } - page.iplr = 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 *ImportPipelineListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ImportPipelineListResultPage) NotDone() bool { - return !page.iplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ImportPipelineListResultPage) Response() ImportPipelineListResult { - return page.iplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ImportPipelineListResultPage) Values() []ImportPipeline { - if page.iplr.IsEmpty() { - return nil - } - return *page.iplr.Value -} - -// Creates a new instance of the ImportPipelineListResultPage type. -func NewImportPipelineListResultPage(cur ImportPipelineListResult, getNextPage func(context.Context, ImportPipelineListResult) (ImportPipelineListResult, error)) ImportPipelineListResultPage { - return ImportPipelineListResultPage{ - fn: getNextPage, - iplr: cur, - } -} - -// ImportPipelineProperties the properties of an import pipeline. -type ImportPipelineProperties struct { - // Source - The source properties of the import pipeline. - Source *ImportPipelineSourceProperties `json:"source,omitempty"` - // Trigger - The properties that describe the trigger of the import pipeline. - Trigger *PipelineTriggerProperties `json:"trigger,omitempty"` - // Options - The list of all options configured for the pipeline. - Options *[]PipelineOptions `json:"options,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the pipeline at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImportPipelineProperties. -func (ipp ImportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipp.Source != nil { - objectMap["source"] = ipp.Source - } - if ipp.Trigger != nil { - objectMap["trigger"] = ipp.Trigger - } - if ipp.Options != nil { - objectMap["options"] = ipp.Options - } - return json.Marshal(objectMap) -} - -// ImportPipelinesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ImportPipelinesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ImportPipelinesClient) (ImportPipeline, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ImportPipelinesCreateFuture) 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 ImportPipelinesCreateFuture.Result. -func (future *ImportPipelinesCreateFuture) result(client ImportPipelinesClient) (IP ImportPipeline, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - IP.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ImportPipelinesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { - IP, err = client.CreateResponder(IP.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesCreateFuture", "Result", IP.Response.Response, "Failure responding to request") - } - } - return -} - -// ImportPipelinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ImportPipelinesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ImportPipelinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ImportPipelinesDeleteFuture) 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 ImportPipelinesDeleteFuture.Result. -func (future *ImportPipelinesDeleteFuture) result(client ImportPipelinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ImportPipelinesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ImportPipelineSourceProperties the properties of the import pipeline source. -type ImportPipelineSourceProperties struct { - // Type - The type of source for the import pipeline. Possible values include: 'AzureStorageBlobContainer' - Type PipelineSourceType `json:"type,omitempty"` - // URI - The source uri of the import pipeline. - // When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName" - URI *string `json:"uri,omitempty"` - // KeyVaultURI - They key vault secret uri to obtain the source storage SAS token. - KeyVaultURI *string `json:"keyVaultUri,omitempty"` -} - -// ImportSource ... -type ImportSource struct { - // ResourceID - The resource identifier of the source Azure Container Registry. - ResourceID *string `json:"resourceId,omitempty"` - // RegistryURI - The address of the source registry (e.g. 'mcr.microsoft.com'). - RegistryURI *string `json:"registryUri,omitempty"` - // Credentials - Credentials used when importing from a registry uri. - Credentials *ImportSourceCredentials `json:"credentials,omitempty"` - // SourceImage - Repository name of the source image. - // Specify an image by repository ('hello-world'). This will use the 'latest' tag. - // Specify an image by tag ('hello-world:latest'). - // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - SourceImage *string `json:"sourceImage,omitempty"` -} - -// ImportSourceCredentials ... -type ImportSourceCredentials struct { - // Username - The username to authenticate with the source registry. - Username *string `json:"username,omitempty"` - // Password - The password used to authenticate with the source registry. - Password *string `json:"password,omitempty"` -} - -// InnerErrorDescription inner error. -type InnerErrorDescription struct { - // Code - error code. - Code *string `json:"code,omitempty"` - // Message - error message. - Message *string `json:"message,omitempty"` - // Target - target of the particular error. - Target *string `json:"target,omitempty"` -} - -// IPRule IP rule with specific IP or IP range in CIDR format. -type IPRule struct { - // Action - The action of IP ACL rule. Possible values include: 'Allow' - Action Action `json:"action,omitempty"` - // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - IPAddressOrRange *string `json:"value,omitempty"` -} - -// KeyVaultProperties ... -type KeyVaultProperties struct { - // KeyIdentifier - Key vault uri to access the encryption key. - KeyIdentifier *string `json:"keyIdentifier,omitempty"` - // VersionedKeyIdentifier - READ-ONLY; The fully qualified key identifier that includes the version of the key that is actually used for encryption. - VersionedKeyIdentifier *string `json:"versionedKeyIdentifier,omitempty"` - // Identity - The client id of the identity which will be used to access key vault. - Identity *string `json:"identity,omitempty"` - // KeyRotationEnabled - READ-ONLY; Auto key rotation status for a CMK enabled registry. - KeyRotationEnabled *bool `json:"keyRotationEnabled,omitempty"` - // LastKeyRotationTimestamp - READ-ONLY; Timestamp of the last successful key rotation. - LastKeyRotationTimestamp *date.Time `json:"lastKeyRotationTimestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for KeyVaultProperties. -func (kvp KeyVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kvp.KeyIdentifier != nil { - objectMap["keyIdentifier"] = kvp.KeyIdentifier - } - if kvp.Identity != nil { - objectMap["identity"] = kvp.Identity - } - return json.Marshal(objectMap) -} - -// NetworkRuleSet the network rule set for a container registry. -type NetworkRuleSet struct { - // DefaultAction - The default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' - DefaultAction DefaultAction `json:"defaultAction,omitempty"` - // VirtualNetworkRules - The virtual network rules. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // IPRules - The IP ACL rules. - IPRules *[]IPRule `json:"ipRules,omitempty"` -} - -// OperationDefinition the definition of a container registry operation. -type OperationDefinition struct { - // Origin - The origin information of the container registry operation. - Origin *string `json:"origin,omitempty"` - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The display information for the container registry operation. - Display *OperationDisplayDefinition `json:"display,omitempty"` - // OperationPropertiesDefinition - The properties information for the container registry operation. - *OperationPropertiesDefinition `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDefinition. -func (od OperationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if od.Origin != nil { - objectMap["origin"] = od.Origin - } - if od.Name != nil { - objectMap["name"] = od.Name - } - if od.Display != nil { - objectMap["display"] = od.Display - } - if od.OperationPropertiesDefinition != nil { - objectMap["properties"] = od.OperationPropertiesDefinition - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationDefinition struct. -func (od *OperationDefinition) 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 "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - od.Origin = &origin - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - od.Name = &name - } - case "display": - if v != nil { - var display OperationDisplayDefinition - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - od.Display = &display - } - case "properties": - if v != nil { - var operationPropertiesDefinition OperationPropertiesDefinition - err = json.Unmarshal(*v, &operationPropertiesDefinition) - if err != nil { - return err - } - od.OperationPropertiesDefinition = &operationPropertiesDefinition - } - } - } - - return nil -} - -// OperationDisplayDefinition the display information for a container registry operation. -type OperationDisplayDefinition struct { - // Provider - The resource provider name: Microsoft.ContainerRegistry. - Provider *string `json:"provider,omitempty"` - // Resource - The resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - The operation that users can perform. - Operation *string `json:"operation,omitempty"` - // Description - The description for the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult the result of a request to list container registry operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - Value *[]OperationDefinition `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registry operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of OperationDefinition 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() OperationDefinition { - if !iter.page.NotDone() { - return OperationDefinition{} - } - 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 OperationDefinition 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() []OperationDefinition { - 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, - } -} - -// OperationMetricSpecificationDefinition the definition of Azure Monitoring metric. -type OperationMetricSpecificationDefinition struct { - // Name - Metric name. - Name *string `json:"name,omitempty"` - // DisplayName - Metric display name. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Metric description. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Metric unit. - Unit *string `json:"unit,omitempty"` - // AggregationType - Metric aggregation type. - AggregationType *string `json:"aggregationType,omitempty"` - // InternalMetricName - Internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` -} - -// OperationPropertiesDefinition the definition of Azure Monitoring properties. -type OperationPropertiesDefinition struct { - // ServiceSpecification - The definition of Azure Monitoring service. - ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` -} - -// OperationServiceSpecificationDefinition the definition of Azure Monitoring list. -type OperationServiceSpecificationDefinition struct { - // MetricSpecifications - A list of Azure Monitoring metrics definition. - MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` -} - -// OverrideTaskStepProperties ... -type OverrideTaskStepProperties struct { - // ContextPath - The source context against which run has to be queued. - ContextPath *string `json:"contextPath,omitempty"` - // File - The file against which run has to be queued. - File *string `json:"file,omitempty"` - // Arguments - Gets or sets the collection of override arguments to be used when - // executing a build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Values - The collection of overridable values that can be passed when running a Task. - Values *[]SetValue `json:"values,omitempty"` - // UpdateTriggerToken - Base64 encoded update trigger token that will be attached with the base image trigger webhook. - UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` -} - -// PipelineRun an object that represents a pipeline run for a container registry. -type PipelineRun struct { - autorest.Response `json:"-"` - // PipelineRunProperties - The properties of a pipeline run. - *PipelineRunProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for PipelineRun. -func (pr PipelineRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.PipelineRunProperties != nil { - objectMap["properties"] = pr.PipelineRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PipelineRun struct. -func (pr *PipelineRun) 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 pipelineRunProperties PipelineRunProperties - err = json.Unmarshal(*v, &pipelineRunProperties) - if err != nil { - return err - } - pr.PipelineRunProperties = &pipelineRunProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pr.SystemData = &systemData - } - } - } - - return nil -} - -// PipelineRunListResult the result of a request to list pipeline runs for a container registry. -type PipelineRunListResult struct { - autorest.Response `json:"-"` - // Value - The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list of pipeline runs. - Value *[]PipelineRun `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of pipeline runs. - NextLink *string `json:"nextLink,omitempty"` -} - -// PipelineRunListResultIterator provides access to a complete listing of PipelineRun values. -type PipelineRunListResultIterator struct { - i int - page PipelineRunListResultPage -} - -// 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 *PipelineRunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunListResultIterator.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 *PipelineRunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PipelineRunListResultIterator) 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 PipelineRunListResultIterator) Response() PipelineRunListResult { - 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 PipelineRunListResultIterator) Value() PipelineRun { - if !iter.page.NotDone() { - return PipelineRun{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PipelineRunListResultIterator type. -func NewPipelineRunListResultIterator(page PipelineRunListResultPage) PipelineRunListResultIterator { - return PipelineRunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (prlr PipelineRunListResult) IsEmpty() bool { - return prlr.Value == nil || len(*prlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (prlr PipelineRunListResult) hasNextLink() bool { - return prlr.NextLink != nil && len(*prlr.NextLink) != 0 -} - -// pipelineRunListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (prlr PipelineRunListResult) pipelineRunListResultPreparer(ctx context.Context) (*http.Request, error) { - if !prlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(prlr.NextLink))) -} - -// PipelineRunListResultPage contains a page of PipelineRun values. -type PipelineRunListResultPage struct { - fn func(context.Context, PipelineRunListResult) (PipelineRunListResult, error) - prlr PipelineRunListResult -} - -// 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 *PipelineRunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunListResultPage.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.prlr) - if err != nil { - return err - } - page.prlr = 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 *PipelineRunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PipelineRunListResultPage) NotDone() bool { - return !page.prlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PipelineRunListResultPage) Response() PipelineRunListResult { - return page.prlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PipelineRunListResultPage) Values() []PipelineRun { - if page.prlr.IsEmpty() { - return nil - } - return *page.prlr.Value -} - -// Creates a new instance of the PipelineRunListResultPage type. -func NewPipelineRunListResultPage(cur PipelineRunListResult, getNextPage func(context.Context, PipelineRunListResult) (PipelineRunListResult, error)) PipelineRunListResultPage { - return PipelineRunListResultPage{ - fn: getNextPage, - prlr: cur, - } -} - -// PipelineRunProperties the properties of a pipeline run. -type PipelineRunProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of a pipeline run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Request - The request parameters for a pipeline run. - Request *PipelineRunRequest `json:"request,omitempty"` - // Response - READ-ONLY; The response of a pipeline run. - Response *PipelineRunResponse `json:"response,omitempty"` - // ForceUpdateTag - How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PipelineRunProperties. -func (prp PipelineRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prp.Request != nil { - objectMap["request"] = prp.Request - } - if prp.ForceUpdateTag != nil { - objectMap["forceUpdateTag"] = prp.ForceUpdateTag - } - return json.Marshal(objectMap) -} - -// PipelineRunRequest the request properties provided for a pipeline run. -type PipelineRunRequest struct { - // PipelineResourceID - The resource ID of the pipeline to run. - PipelineResourceID *string `json:"pipelineResourceId,omitempty"` - // Artifacts - List of source artifacts to be transferred by the pipeline. - // Specify an image by repository ('hello-world'). This will use the 'latest' tag. - // Specify an image by tag ('hello-world:latest'). - // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - Artifacts *[]string `json:"artifacts,omitempty"` - // Source - The source properties of the pipeline run. - Source *PipelineRunSourceProperties `json:"source,omitempty"` - // Target - The target properties of the pipeline run. - Target *PipelineRunTargetProperties `json:"target,omitempty"` - // CatalogDigest - The digest of the tar used to transfer the artifacts. - CatalogDigest *string `json:"catalogDigest,omitempty"` -} - -// PipelineRunResponse the response properties returned for a pipeline run. -type PipelineRunResponse struct { - // Status - The current status of the pipeline run. - Status *string `json:"status,omitempty"` - // ImportedArtifacts - The artifacts imported in the pipeline run. - ImportedArtifacts *[]string `json:"importedArtifacts,omitempty"` - // Progress - The current progress of the copy operation. - Progress *ProgressProperties `json:"progress,omitempty"` - // StartTime - The time the pipeline run started. - StartTime *date.Time `json:"startTime,omitempty"` - // FinishTime - The time the pipeline run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // Source - The source of the pipeline run. - Source *ImportPipelineSourceProperties `json:"source,omitempty"` - // Target - The target of the pipeline run. - Target *ExportPipelineTargetProperties `json:"target,omitempty"` - // CatalogDigest - The digest of the tar used to transfer the artifacts. - CatalogDigest *string `json:"catalogDigest,omitempty"` - // Trigger - The trigger that caused the pipeline run. - Trigger *PipelineTriggerDescriptor `json:"trigger,omitempty"` - // PipelineRunErrorMessage - The detailed error message for the pipeline run in the case of failure. - PipelineRunErrorMessage *string `json:"pipelineRunErrorMessage,omitempty"` -} - -// PipelineRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PipelineRunsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PipelineRunsClient) (PipelineRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PipelineRunsCreateFuture) 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 PipelineRunsCreateFuture.Result. -func (future *PipelineRunsCreateFuture) result(client PipelineRunsClient) (pr PipelineRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PipelineRunsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pr.Response.Response, err = future.GetResult(sender); err == nil && pr.Response.Response.StatusCode != http.StatusNoContent { - pr, err = client.CreateResponder(pr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsCreateFuture", "Result", pr.Response.Response, "Failure responding to request") - } - } - return -} - -// PipelineRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PipelineRunsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PipelineRunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PipelineRunsDeleteFuture) 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 PipelineRunsDeleteFuture.Result. -func (future *PipelineRunsDeleteFuture) result(client PipelineRunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PipelineRunsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PipelineRunSourceProperties ... -type PipelineRunSourceProperties struct { - // Type - The type of the source. Possible values include: 'AzureStorageBlob' - Type PipelineRunSourceType `json:"type,omitempty"` - // Name - The name of the source. - Name *string `json:"name,omitempty"` -} - -// PipelineRunTargetProperties ... -type PipelineRunTargetProperties struct { - // Type - The type of the target. Possible values include: 'PipelineRunTargetTypeAzureStorageBlob' - Type PipelineRunTargetType `json:"type,omitempty"` - // Name - The name of the target. - Name *string `json:"name,omitempty"` -} - -// PipelineSourceTriggerDescriptor ... -type PipelineSourceTriggerDescriptor struct { - // Timestamp - The timestamp when the source update happened. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// PipelineSourceTriggerProperties ... -type PipelineSourceTriggerProperties struct { - // Status - The current status of the source trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` -} - -// PipelineTriggerDescriptor ... -type PipelineTriggerDescriptor struct { - // SourceTrigger - The source trigger that caused the pipeline run. - SourceTrigger *PipelineSourceTriggerDescriptor `json:"sourceTrigger,omitempty"` -} - -// PipelineTriggerProperties ... -type PipelineTriggerProperties struct { - // SourceTrigger - The source trigger properties of the pipeline. - SourceTrigger *PipelineSourceTriggerProperties `json:"sourceTrigger,omitempty"` -} - -// PlatformProperties the platform properties against which the run has to happen. -type PlatformProperties struct { - // Os - The operating system type required for the run. Possible values include: 'Windows', 'Linux' - Os OS `json:"os,omitempty"` - // Architecture - The OS architecture. Possible values include: 'Amd64', 'X86', 'ThreeEightSix', 'Arm', 'Arm64' - Architecture Architecture `json:"architecture,omitempty"` - // Variant - Variant of the CPU. Possible values include: 'V6', 'V7', 'V8' - Variant Variant `json:"variant,omitempty"` -} - -// PlatformUpdateParameters the properties for updating the platform configuration. -type PlatformUpdateParameters struct { - // Os - The operating system type required for the run. Possible values include: 'Windows', 'Linux' - Os OS `json:"os,omitempty"` - // Architecture - The OS architecture. Possible values include: 'Amd64', 'X86', 'ThreeEightSix', 'Arm', 'Arm64' - Architecture Architecture `json:"architecture,omitempty"` - // Variant - Variant of the CPU. Possible values include: 'V6', 'V7', 'V8' - Variant Variant `json:"variant,omitempty"` -} - -// Policies the policies for a container registry. -type Policies struct { - // QuarantinePolicy - The quarantine policy for a container registry. - QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"` - // TrustPolicy - The content trust policy for a container registry. - TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"` - // RetentionPolicy - The retention policy for a container registry. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - This is private endpoint resource created with Microsoft.Network resource provider. - ID *string `json:"id,omitempty"` -} - -// PrivateEndpointConnection an object that represents a private endpoint connection for a container -// registry. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,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 "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pec.SystemData = &systemData - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult the result of a request to list private endpoint connections for a -// container registry. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of private endpoint connections. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) - if err != nil { - return err - } - page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties the properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private endpoint. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of private endpoint connection resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,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) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource a resource that supports private link capabilities. -type PrivateLinkResource struct { - // Type - READ-ONLY; The resource type is private link resource. - Type *string `json:"type,omitempty"` - // ID - The resource ID. - ID *string `json:"id,omitempty"` - // Name - The name of the resource. - Name *string `json:"name,omitempty"` - // PrivateLinkResourceProperties - A resource that supports private link capabilities. - *PrivateLinkResourceProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.ID != nil { - objectMap["id"] = plr.ID - } - if plr.Name != nil { - objectMap["name"] = plr.Name - } - 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 "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - 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 "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - } - } - - return nil -} - -// PrivateLinkResourceListResult the result of a request to list private link resources for a container -// registry. -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of private link resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties the properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// PrivateLinkServiceConnectionState the state of a private link service connection. -type PrivateLinkServiceConnectionState struct { - // Status - The private link service connection status. Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' - Status ConnectionStatus `json:"status,omitempty"` - // Description - The description for connection status. For example if connection is rejected it can indicate reason for rejection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. Possible values include: 'None', 'Recreate' - ActionsRequired ActionsRequired `json:"actionsRequired,omitempty"` -} - -// ProgressProperties ... -type ProgressProperties struct { - // Percentage - The percentage complete of the copy operation. - Percentage *string `json:"percentage,omitempty"` -} - -// 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; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - 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) -} - -// QuarantinePolicy the quarantine policy for a container registry. -type QuarantinePolicy struct { - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// RegenerateCredentialParameters the parameters used to regenerate the login credential. -type RegenerateCredentialParameters struct { - // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2' - Name PasswordName `json:"name,omitempty"` -} - -// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesCreateFuture) 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 RegistriesCreateFuture.Result. -func (future *RegistriesCreateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture") - 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, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesDeleteFuture) 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 RegistriesDeleteFuture.Result. -func (future *RegistriesDeleteFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesGenerateCredentialsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RegistriesGenerateCredentialsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (GenerateCredentialsResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesGenerateCredentialsFuture) 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 RegistriesGenerateCredentialsFuture.Result. -func (future *RegistriesGenerateCredentialsFuture) result(client RegistriesClient) (gcr GenerateCredentialsResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gcr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesGenerateCredentialsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gcr.Response.Response, err = future.GetResult(sender); err == nil && gcr.Response.Response.StatusCode != http.StatusNoContent { - gcr, err = client.GenerateCredentialsResponder(gcr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", gcr.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesImportImageFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesImportImageFuture) 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 RegistriesImportImageFuture.Result. -func (future *RegistriesImportImageFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesImportImageFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesScheduleRunFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesScheduleRunFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Run, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesScheduleRunFuture) 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 RegistriesScheduleRunFuture.Result. -func (future *RegistriesScheduleRunFuture) result(client RegistriesClient) (r Run, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesScheduleRunFuture") - 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.ScheduleRunResponder(r.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesUpdateFuture) 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 RegistriesUpdateFuture.Result. -func (future *RegistriesUpdateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture") - 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, "containerregistry.RegistriesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// Registry an object that represents a container registry. -type Registry struct { - autorest.Response `json:"-"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // Identity - The identity of the container registry. - Identity *IdentityProperties `json:"identity,omitempty"` - // RegistryProperties - The properties of the container registry. - *RegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Registry. -func (r Registry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - if r.Identity != nil { - objectMap["identity"] = r.Identity - } - if r.RegistryProperties != nil { - objectMap["properties"] = r.RegistryProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Registry struct. -func (r *Registry) 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 - } - r.Sku = &sku - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - r.Identity = &identity - } - case "properties": - if v != nil { - var registryProperties RegistryProperties - err = json.Unmarshal(*v, ®istryProperties) - if err != nil { - return err - } - r.RegistryProperties = ®istryProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - r.SystemData = &systemData - } - } - } - - return nil -} - -// RegistryListCredentialsResult the response from the ListCredentials operation. -type RegistryListCredentialsResult struct { - autorest.Response `json:"-"` - // Username - The username for a container registry. - Username *string `json:"username,omitempty"` - // Passwords - The list of passwords for a container registry. - Passwords *[]RegistryPassword `json:"passwords,omitempty"` -} - -// RegistryListResult the result of a request to list container registries. -type RegistryListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - Value *[]Registry `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registries. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegistryListResultIterator provides access to a complete listing of Registry values. -type RegistryListResultIterator struct { - i int - page RegistryListResultPage -} - -// 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 *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.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 *RegistryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegistryListResultIterator) 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 RegistryListResultIterator) Response() RegistryListResult { - 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 RegistryListResultIterator) Value() Registry { - if !iter.page.NotDone() { - return Registry{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegistryListResultIterator type. -func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { - return RegistryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegistryListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegistryListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// registryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegistryListResult) registryListResultPreparer(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))) -} - -// RegistryListResultPage contains a page of Registry values. -type RegistryListResultPage struct { - fn func(context.Context, RegistryListResult) (RegistryListResult, error) - rlr RegistryListResult -} - -// 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 *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.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 *RegistryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegistryListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegistryListResultPage) Response() RegistryListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegistryListResultPage) Values() []Registry { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegistryListResultPage type. -func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { - return RegistryListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistryNameCheckRequest a request to check whether a container registry name is available. -type RegistryNameCheckRequest struct { - // Name - The name of the container registry. - Name *string `json:"name,omitempty"` - // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. - Type *string `json:"type,omitempty"` -} - -// RegistryNameStatus the result of a request to check the availability of a container registry name. -type RegistryNameStatus struct { - autorest.Response `json:"-"` - // NameAvailable - The value that indicates whether the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - If any, the reason that the name is not available. - Reason *string `json:"reason,omitempty"` - // Message - If any, the error message that provides more detail for the reason that the name is not available. - Message *string `json:"message,omitempty"` -} - -// RegistryPassword the login password for the container registry. -type RegistryPassword struct { - // Name - The password name. Possible values include: 'Password', 'Password2' - Name PasswordName `json:"name,omitempty"` - // Value - The password value. - Value *string `json:"value,omitempty"` -} - -// RegistryProperties the properties of a container registry. -type RegistryProperties struct { - // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. - LoginServer *string `json:"loginServer,omitempty"` - // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the container registry at the time the operation was called. - Status *Status `json:"status,omitempty"` - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // StorageAccount - The properties of the storage account for the container registry. Only applicable to Classic SKU. - StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` - // Policies - The policies for a container registry. - Policies *Policies `json:"policies,omitempty"` - // Encryption - The encryption settings of container registry. - Encryption *EncryptionProperty `json:"encryption,omitempty"` - // DataEndpointEnabled - Enable a single data endpoint per region for serving data. - DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` - // DataEndpointHostNames - READ-ONLY; List of host names that will serve data when dataEndpointEnabled is true. - DataEndpointHostNames *[]string `json:"dataEndpointHostNames,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections for a container registry. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryProperties. -func (rp RegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.AdminUserEnabled != nil { - objectMap["adminUserEnabled"] = rp.AdminUserEnabled - } - if rp.StorageAccount != nil { - objectMap["storageAccount"] = rp.StorageAccount - } - if rp.NetworkRuleSet != nil { - objectMap["networkRuleSet"] = rp.NetworkRuleSet - } - if rp.Policies != nil { - objectMap["policies"] = rp.Policies - } - if rp.Encryption != nil { - objectMap["encryption"] = rp.Encryption - } - if rp.DataEndpointEnabled != nil { - objectMap["dataEndpointEnabled"] = rp.DataEndpointEnabled - } - if rp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = rp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. -type RegistryPropertiesUpdateParameters struct { - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` - // Policies - The policies for a container registry. - Policies *Policies `json:"policies,omitempty"` - // Encryption - The encryption settings of container registry. - Encryption *EncryptionProperty `json:"encryption,omitempty"` - // DataEndpointEnabled - Enable a single data endpoint per region for serving data. - DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// RegistryUpdateParameters the parameters for updating a container registry. -type RegistryUpdateParameters struct { - // Tags - The tags for the container registry. - Tags map[string]*string `json:"tags"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // Identity - The identity of the container registry. - Identity *IdentityProperties `json:"identity,omitempty"` - // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. - *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryUpdateParameters. -func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.Sku != nil { - objectMap["sku"] = rup.Sku - } - if rup.Identity != nil { - objectMap["identity"] = rup.Identity - } - if rup.RegistryPropertiesUpdateParameters != nil { - objectMap["properties"] = rup.RegistryPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. -func (rup *RegistryUpdateParameters) 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 - } - rup.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - rup.Sku = &sku - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rup.Identity = &identity - } - case "properties": - if v != nil { - var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters - err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) - if err != nil { - return err - } - rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters - } - } - } - - return nil -} - -// RegistryUsage the quota usage for a container registry. -type RegistryUsage struct { - // Name - The name of the usage. - Name *string `json:"name,omitempty"` - // Limit - The limit of the usage. - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - The current value of the usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - // Unit - The unit of measurement. Possible values include: 'Count', 'Bytes' - Unit RegistryUsageUnit `json:"unit,omitempty"` -} - -// RegistryUsageListResult the result of a request to get container registry quota usages. -type RegistryUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry quota usages. - Value *[]RegistryUsage `json:"value,omitempty"` -} - -// Replication an object that represents a replication for a container registry. -type Replication struct { - autorest.Response `json:"-"` - // ReplicationProperties - The properties of the replication. - *ReplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Replication. -func (r Replication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.ReplicationProperties != nil { - objectMap["properties"] = r.ReplicationProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Replication struct. -func (r *Replication) 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 replicationProperties ReplicationProperties - err = json.Unmarshal(*v, &replicationProperties) - if err != nil { - return err - } - r.ReplicationProperties = &replicationProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - r.SystemData = &systemData - } - } - } - - return nil -} - -// ReplicationListResult the result of a request to list replications for a container registry. -type ReplicationListResult struct { - autorest.Response `json:"-"` - // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - Value *[]Replication `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of replications. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReplicationListResultIterator provides access to a complete listing of Replication values. -type ReplicationListResultIterator struct { - i int - page ReplicationListResultPage -} - -// 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 *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.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 *ReplicationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReplicationListResultIterator) 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 ReplicationListResultIterator) Response() ReplicationListResult { - 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 ReplicationListResultIterator) Value() Replication { - if !iter.page.NotDone() { - return Replication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReplicationListResultIterator type. -func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { - return ReplicationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr ReplicationListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr ReplicationListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// replicationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr ReplicationListResult) replicationListResultPreparer(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))) -} - -// ReplicationListResultPage contains a page of Replication values. -type ReplicationListResultPage struct { - fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) - rlr ReplicationListResult -} - -// 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 *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.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 *ReplicationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReplicationListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReplicationListResultPage) Response() ReplicationListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReplicationListResultPage) Values() []Replication { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the ReplicationListResultPage type. -func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { - return ReplicationListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// ReplicationProperties the properties of a replication. -type ReplicationProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the replication at the time the operation was called. - Status *Status `json:"status,omitempty"` - // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationProperties. -func (rp ReplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RegionEndpointEnabled != nil { - objectMap["regionEndpointEnabled"] = rp.RegionEndpointEnabled - } - return json.Marshal(objectMap) -} - -// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsCreateFuture) 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 ReplicationsCreateFuture.Result. -func (future *ReplicationsCreateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture") - 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, "containerregistry.ReplicationsCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsDeleteFuture) 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 ReplicationsDeleteFuture.Result. -func (future *ReplicationsDeleteFuture) result(client ReplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsUpdateFuture) 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 ReplicationsUpdateFuture.Result. -func (future *ReplicationsUpdateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture") - 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, "containerregistry.ReplicationsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationUpdateParameters the parameters for updating a replication. -type ReplicationUpdateParameters struct { - // Tags - The tags for the replication. - Tags map[string]*string `json:"tags"` - // ReplicationUpdateParametersProperties - The parameters for updating a replication's properties - *ReplicationUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. -func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.ReplicationUpdateParametersProperties != nil { - objectMap["properties"] = rup.ReplicationUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ReplicationUpdateParameters struct. -func (rup *ReplicationUpdateParameters) 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 - } - rup.Tags = tags - } - case "properties": - if v != nil { - var replicationUpdateParametersProperties ReplicationUpdateParametersProperties - err = json.Unmarshal(*v, &replicationUpdateParametersProperties) - if err != nil { - return err - } - rup.ReplicationUpdateParametersProperties = &replicationUpdateParametersProperties - } - } - } - - return nil -} - -// ReplicationUpdateParametersProperties ... -type ReplicationUpdateParametersProperties struct { - // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` -} - -// Request the request that generated the event. -type Request struct { - // ID - The ID of the request that initiated the event. - ID *string `json:"id,omitempty"` - // Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - Addr *string `json:"addr,omitempty"` - // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - Host *string `json:"host,omitempty"` - // Method - The request method that generated the event. - Method *string `json:"method,omitempty"` - // Useragent - The user agent header of the request. - Useragent *string `json:"useragent,omitempty"` -} - -// Resource an Azure resource. -type Resource struct { - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// RetentionPolicy the retention policy for a container registry. -type RetentionPolicy struct { - // Days - The number of days to retain an untagged manifest after which it gets purged. - Days *int32 `json:"days,omitempty"` - // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for RetentionPolicy. -func (rp RetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.Days != nil { - objectMap["days"] = rp.Days - } - if rp.Status != "" { - objectMap["status"] = rp.Status - } - return json.Marshal(objectMap) -} - -// Run run resource properties -type Run struct { - autorest.Response `json:"-"` - // RunProperties - The properties of a run. - *RunProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Run. -func (r Run) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RunProperties != nil { - objectMap["properties"] = r.RunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Run struct. -func (r *Run) 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 runProperties RunProperties - err = json.Unmarshal(*v, &runProperties) - if err != nil { - return err - } - r.RunProperties = &runProperties - } - 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 -} - -// RunFilter properties that are enabled for Odata querying on runs. -type RunFilter struct { - // RunID - The unique identifier for the run. - RunID *string `json:"runId,omitempty"` - // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' - RunType RunType `json:"runType,omitempty"` - // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' - Status RunStatus `json:"status,omitempty"` - // CreateTime - The create time for a run. - CreateTime *date.Time `json:"createTime,omitempty"` - // FinishTime - The time the run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImageManifests - The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of - // build type. - OutputImageManifests *string `json:"outputImageManifests,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // TaskName - The name of the task that the run corresponds to. - TaskName *string `json:"taskName,omitempty"` - // AgentPoolName - The name of the agent pool that the run corresponds to. - AgentPoolName *string `json:"agentPoolName,omitempty"` -} - -// RunGetLogResult the result of get log link operation. -type RunGetLogResult struct { - autorest.Response `json:"-"` - // LogLink - The link to logs for a run on a azure container registry. - LogLink *string `json:"logLink,omitempty"` - // LogArtifactLink - The link to logs in registry for a run on a azure container registry. - LogArtifactLink *string `json:"logArtifactLink,omitempty"` -} - -// RunListResult collection of runs. -type RunListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Run `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RunListResultIterator provides access to a complete listing of Run values. -type RunListResultIterator struct { - i int - page RunListResultPage -} - -// 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 *RunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultIterator.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 *RunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RunListResultIterator) 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 RunListResultIterator) Response() RunListResult { - 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 RunListResultIterator) Value() Run { - if !iter.page.NotDone() { - return Run{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RunListResultIterator type. -func NewRunListResultIterator(page RunListResultPage) RunListResultIterator { - return RunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RunListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RunListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// runListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RunListResult) runListResultPreparer(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))) -} - -// RunListResultPage contains a page of Run values. -type RunListResultPage struct { - fn func(context.Context, RunListResult) (RunListResult, error) - rlr RunListResult -} - -// 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 *RunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultPage.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 *RunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RunListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RunListResultPage) Response() RunListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RunListResultPage) Values() []Run { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RunListResultPage type. -func NewRunListResultPage(cur RunListResult, getNextPage func(context.Context, RunListResult) (RunListResult, error)) RunListResultPage { - return RunListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RunProperties the properties for a run. -type RunProperties struct { - // RunID - The unique identifier for the run. - RunID *string `json:"runId,omitempty"` - // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' - Status RunStatus `json:"status,omitempty"` - // LastUpdatedTime - The last updated time for the run. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' - RunType RunType `json:"runType,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // CreateTime - The time the run was scheduled. - CreateTime *date.Time `json:"createTime,omitempty"` - // StartTime - The time the run started. - StartTime *date.Time `json:"startTime,omitempty"` - // FinishTime - The time the run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImages - The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. - OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` - // Task - The task against which run was scheduled. - Task *string `json:"task,omitempty"` - // ImageUpdateTrigger - The image update trigger that caused the run. This is applicable if the task has base image trigger configured. - ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` - // SourceTrigger - The source trigger that caused the run. - SourceTrigger *SourceTriggerDescriptor `json:"sourceTrigger,omitempty"` - // TimerTrigger - The timer trigger that caused the run. - TimerTrigger *TimerTriggerDescriptor `json:"timerTrigger,omitempty"` - // Platform - The platform properties against which the run will happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceRegistryAuth - The scope of the credentials that were used to login to the source registry during this run. - SourceRegistryAuth *string `json:"sourceRegistryAuth,omitempty"` - // CustomRegistries - The list of custom registries that were logged in during this run. - CustomRegistries *[]string `json:"customRegistries,omitempty"` - // RunErrorMessage - READ-ONLY; The error message received from backend systems after the run is scheduled. - RunErrorMessage *string `json:"runErrorMessage,omitempty"` - // UpdateTriggerToken - The update trigger token passed for the Run. - UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` - // LogArtifact - READ-ONLY; The image description for the log artifact. - LogArtifact *ImageDescriptor `json:"logArtifact,omitempty"` - // ProvisioningState - The provisioning state of a run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunProperties. -func (rp RunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RunID != nil { - objectMap["runId"] = rp.RunID - } - if rp.Status != "" { - objectMap["status"] = rp.Status - } - if rp.LastUpdatedTime != nil { - objectMap["lastUpdatedTime"] = rp.LastUpdatedTime - } - if rp.RunType != "" { - objectMap["runType"] = rp.RunType - } - if rp.AgentPoolName != nil { - objectMap["agentPoolName"] = rp.AgentPoolName - } - if rp.CreateTime != nil { - objectMap["createTime"] = rp.CreateTime - } - if rp.StartTime != nil { - objectMap["startTime"] = rp.StartTime - } - if rp.FinishTime != nil { - objectMap["finishTime"] = rp.FinishTime - } - if rp.OutputImages != nil { - objectMap["outputImages"] = rp.OutputImages - } - if rp.Task != nil { - objectMap["task"] = rp.Task - } - if rp.ImageUpdateTrigger != nil { - objectMap["imageUpdateTrigger"] = rp.ImageUpdateTrigger - } - if rp.SourceTrigger != nil { - objectMap["sourceTrigger"] = rp.SourceTrigger - } - if rp.TimerTrigger != nil { - objectMap["timerTrigger"] = rp.TimerTrigger - } - if rp.Platform != nil { - objectMap["platform"] = rp.Platform - } - if rp.AgentConfiguration != nil { - objectMap["agentConfiguration"] = rp.AgentConfiguration - } - if rp.SourceRegistryAuth != nil { - objectMap["sourceRegistryAuth"] = rp.SourceRegistryAuth - } - if rp.CustomRegistries != nil { - objectMap["customRegistries"] = rp.CustomRegistries - } - if rp.UpdateTriggerToken != nil { - objectMap["updateTriggerToken"] = rp.UpdateTriggerToken - } - if rp.ProvisioningState != "" { - objectMap["provisioningState"] = rp.ProvisioningState - } - if rp.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = rp.IsArchiveEnabled - } - return json.Marshal(objectMap) -} - -// BasicRunRequest the request parameters for scheduling a run. -type BasicRunRequest interface { - AsDockerBuildRequest() (*DockerBuildRequest, bool) - AsFileTaskRunRequest() (*FileTaskRunRequest, bool) - AsTaskRunRequest() (*TaskRunRequest, bool) - AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) - AsRunRequest() (*RunRequest, bool) -} - -// RunRequest the request parameters for scheduling a run. -type RunRequest struct { - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicRunRequest(body []byte) (BasicRunRequest, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeDockerBuildRequest): - var dbr DockerBuildRequest - err := json.Unmarshal(body, &dbr) - return dbr, err - case string(TypeFileTaskRunRequest): - var ftrr FileTaskRunRequest - err := json.Unmarshal(body, &ftrr) - return ftrr, err - case string(TypeTaskRunRequest): - var trr TaskRunRequest - err := json.Unmarshal(body, &trr) - return trr, err - case string(TypeEncodedTaskRunRequest): - var etrr EncodedTaskRunRequest - err := json.Unmarshal(body, &etrr) - return etrr, err - default: - var rr RunRequest - err := json.Unmarshal(body, &rr) - return rr, err - } -} -func unmarshalBasicRunRequestArray(body []byte) ([]BasicRunRequest, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rrArray := make([]BasicRunRequest, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rr, err := unmarshalBasicRunRequest(*rawMessage) - if err != nil { - return nil, err - } - rrArray[index] = rr - } - return rrArray, nil -} - -// MarshalJSON is the custom marshaler for RunRequest. -func (rr RunRequest) MarshalJSON() ([]byte, error) { - rr.Type = TypeRunRequest - objectMap := make(map[string]interface{}) - if rr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = rr.IsArchiveEnabled - } - if rr.AgentPoolName != nil { - objectMap["agentPoolName"] = rr.AgentPoolName - } - if rr.LogTemplate != nil { - objectMap["logTemplate"] = rr.LogTemplate - } - if rr.Type != "" { - objectMap["type"] = rr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsRunRequest() (*RunRequest, bool) { - return &rr, true -} - -// AsBasicRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &rr, true -} - -// RunsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type RunsCancelFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunsCancelFuture) 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 RunsCancelFuture.Result. -func (future *RunsCancelFuture) result(client RunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsCancelFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RunsCancelFuture") - return - } - ar.Response = future.Response() - return -} - -// RunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type RunsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunsClient) (Run, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunsUpdateFuture) 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 RunsUpdateFuture.Result. -func (future *RunsUpdateFuture) result(client RunsClient) (r Run, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RunsUpdateFuture") - 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, "containerregistry.RunsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RunUpdateParameters the set of run properties that can be updated. -type RunUpdateParameters struct { - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` -} - -// ScopeMap an object that represents a scope map for a container registry. -type ScopeMap struct { - autorest.Response `json:"-"` - // ScopeMapProperties - The properties of the scope map. - *ScopeMapProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeMap. -func (sm ScopeMap) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sm.ScopeMapProperties != nil { - objectMap["properties"] = sm.ScopeMapProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopeMap struct. -func (sm *ScopeMap) 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 scopeMapProperties ScopeMapProperties - err = json.Unmarshal(*v, &scopeMapProperties) - if err != nil { - return err - } - sm.ScopeMapProperties = &scopeMapProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sm.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sm.SystemData = &systemData - } - } - } - - return nil -} - -// ScopeMapListResult the result of a request to list scope maps for a container registry. -type ScopeMapListResult struct { - autorest.Response `json:"-"` - // Value - The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. - Value *[]ScopeMap `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of scope maps. - NextLink *string `json:"nextLink,omitempty"` -} - -// ScopeMapListResultIterator provides access to a complete listing of ScopeMap values. -type ScopeMapListResultIterator struct { - i int - page ScopeMapListResultPage -} - -// 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 *ScopeMapListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultIterator.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 *ScopeMapListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScopeMapListResultIterator) 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 ScopeMapListResultIterator) Response() ScopeMapListResult { - 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 ScopeMapListResultIterator) Value() ScopeMap { - if !iter.page.NotDone() { - return ScopeMap{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScopeMapListResultIterator type. -func NewScopeMapListResultIterator(page ScopeMapListResultPage) ScopeMapListResultIterator { - return ScopeMapListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (smlr ScopeMapListResult) IsEmpty() bool { - return smlr.Value == nil || len(*smlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (smlr ScopeMapListResult) hasNextLink() bool { - return smlr.NextLink != nil && len(*smlr.NextLink) != 0 -} - -// scopeMapListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (smlr ScopeMapListResult) scopeMapListResultPreparer(ctx context.Context) (*http.Request, error) { - if !smlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(smlr.NextLink))) -} - -// ScopeMapListResultPage contains a page of ScopeMap values. -type ScopeMapListResultPage struct { - fn func(context.Context, ScopeMapListResult) (ScopeMapListResult, error) - smlr ScopeMapListResult -} - -// 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 *ScopeMapListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultPage.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.smlr) - if err != nil { - return err - } - page.smlr = 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 *ScopeMapListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScopeMapListResultPage) NotDone() bool { - return !page.smlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScopeMapListResultPage) Response() ScopeMapListResult { - return page.smlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScopeMapListResultPage) Values() []ScopeMap { - if page.smlr.IsEmpty() { - return nil - } - return *page.smlr.Value -} - -// Creates a new instance of the ScopeMapListResultPage type. -func NewScopeMapListResultPage(cur ScopeMapListResult, getNextPage func(context.Context, ScopeMapListResult) (ScopeMapListResult, error)) ScopeMapListResultPage { - return ScopeMapListResultPage{ - fn: getNextPage, - smlr: cur, - } -} - -// ScopeMapProperties the properties of a scope map. -type ScopeMapProperties struct { - // Description - The user friendly description of the scope map. - Description *string `json:"description,omitempty"` - // Type - READ-ONLY; The type of the scope map. E.g. BuildIn scope map. - Type *string `json:"type,omitempty"` - // CreationDate - READ-ONLY; The creation date of scope map. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Actions - The list of scoped permissions for registry artifacts. - // E.g. repositories/repository-name/content/read, - // repositories/repository-name/metadata/write - Actions *[]string `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeMapProperties. -func (smp ScopeMapProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smp.Description != nil { - objectMap["description"] = smp.Description - } - if smp.Actions != nil { - objectMap["actions"] = smp.Actions - } - return json.Marshal(objectMap) -} - -// ScopeMapPropertiesUpdateParameters the update parameters for scope map properties. -type ScopeMapPropertiesUpdateParameters struct { - // Description - The user friendly description of the scope map. - Description *string `json:"description,omitempty"` - // Actions - The list of scope permissions for registry artifacts. - // E.g. repositories/repository-name/pull, - // repositories/repository-name/delete - Actions *[]string `json:"actions,omitempty"` -} - -// ScopeMapsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScopeMapsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScopeMapsClient) (ScopeMap, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScopeMapsCreateFuture) 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 ScopeMapsCreateFuture.Result. -func (future *ScopeMapsCreateFuture) result(client ScopeMapsClient) (sm ScopeMap, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.CreateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// ScopeMapsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScopeMapsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScopeMapsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScopeMapsDeleteFuture) 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 ScopeMapsDeleteFuture.Result. -func (future *ScopeMapsDeleteFuture) result(client ScopeMapsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ScopeMapsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScopeMapsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScopeMapsClient) (ScopeMap, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScopeMapsUpdateFuture) 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 ScopeMapsUpdateFuture.Result. -func (future *ScopeMapsUpdateFuture) result(client ScopeMapsClient) (sm ScopeMap, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.UpdateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// ScopeMapUpdateParameters the properties for updating the scope map. -type ScopeMapUpdateParameters struct { - // ScopeMapPropertiesUpdateParameters - The update parameters for scope map properties. - *ScopeMapPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeMapUpdateParameters. -func (smup ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smup.ScopeMapPropertiesUpdateParameters != nil { - objectMap["properties"] = smup.ScopeMapPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopeMapUpdateParameters struct. -func (smup *ScopeMapUpdateParameters) 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 scopeMapPropertiesUpdateParameters ScopeMapPropertiesUpdateParameters - err = json.Unmarshal(*v, &scopeMapPropertiesUpdateParameters) - if err != nil { - return err - } - smup.ScopeMapPropertiesUpdateParameters = &scopeMapPropertiesUpdateParameters - } - } - } - - return nil -} - -// SecretObject describes the properties of a secret object value. -type SecretObject struct { - // Value - The value of the secret. The format of this value will be determined - // based on the type of the secret object. If the type is Opaque, the value will be - // used as is without any modification. - Value *string `json:"value,omitempty"` - // Type - The type of the secret object which determines how the value of the secret object has to be - // interpreted. Possible values include: 'Opaque', 'Vaultsecret' - Type SecretObjectType `json:"type,omitempty"` -} - -// SetValue the properties of a overridable value that can be passed to a task template. -type SetValue struct { - // Name - The name of the overridable value. - Name *string `json:"name,omitempty"` - // Value - The overridable value. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the value represents a secret or not. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// Sku the SKU of a container registry. -type Sku struct { - // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium' - Name SkuName `json:"name,omitempty"` - // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` -} - -// MarshalJSON is the custom marshaler for Sku. -func (s Sku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Name != "" { - objectMap["name"] = s.Name - } - return json.Marshal(objectMap) -} - -// Source the registry node that generated the event. Put differently, while the actor initiates the event, -// the source generates it. -type Source struct { - // Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - Addr *string `json:"addr,omitempty"` - // InstanceID - The running instance of an application. Changes after each restart. - InstanceID *string `json:"instanceID,omitempty"` -} - -// SourceProperties the properties of the source code repository. -type SourceProperties struct { - // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceRegistryCredentials describes the credential parameters for accessing the source registry. -type SourceRegistryCredentials struct { - // LoginMode - The authentication mode which determines the source registry login scope. The credentials for the source registry - // will be generated using the given scope. These credentials will be used to login to - // the source registry during the run. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' - LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` -} - -// SourceTrigger the properties of a source based trigger. -type SourceTrigger struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceTriggerDescriptor the source trigger that caused a run. -type SourceTriggerDescriptor struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // EventType - The event type of the trigger. - EventType *string `json:"eventType,omitempty"` - // CommitID - The unique ID that identifies a commit. - CommitID *string `json:"commitId,omitempty"` - // PullRequestID - The unique ID that identifies pull request. - PullRequestID *string `json:"pullRequestId,omitempty"` - // RepositoryURL - The repository URL. - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // BranchName - The branch name in the repository. - BranchName *string `json:"branchName,omitempty"` - // ProviderType - The source control provider type. - ProviderType *string `json:"providerType,omitempty"` -} - -// SourceTriggerUpdateParameters the properties for updating a source based trigger. -type SourceTriggerUpdateParameters struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceUpdateParameters the properties for updating the source code repository. -type SourceUpdateParameters struct { - // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceUploadDefinition the properties of a response to source upload request. -type SourceUploadDefinition struct { - autorest.Response `json:"-"` - // UploadURL - The URL where the client can upload the source. - UploadURL *string `json:"uploadUrl,omitempty"` - // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. - RelativePath *string `json:"relativePath,omitempty"` -} - -// Status the status of an Azure resource at the time the operation was called. -type Status struct { - // DisplayStatus - READ-ONLY; The short label for the status. - DisplayStatus *string `json:"displayStatus,omitempty"` - // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. - Message *string `json:"message,omitempty"` - // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for Status. -func (s Status) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StorageAccountProperties the properties of a storage account for a container registry. Only applicable -// to Classic SKU. -type StorageAccountProperties struct { - // ID - The resource ID of the storage account. - ID *string `json:"id,omitempty"` -} - -// 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: 'User', 'Application', 'ManagedIdentity', 'Key' - 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: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' - LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource modification (UTC). - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// Target the target of the event. -type Target struct { - // MediaType - The MIME type of the referenced object. - MediaType *string `json:"mediaType,omitempty"` - // Size - The number of bytes of the content. Same as Length field. - Size *int64 `json:"size,omitempty"` - // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. - Digest *string `json:"digest,omitempty"` - // Length - The number of bytes of the content. Same as Size field. - Length *int64 `json:"length,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // URL - The direct URL to the content. - URL *string `json:"url,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Name - The name of the artifact. - Name *string `json:"name,omitempty"` - // Version - The version of the artifact. - Version *string `json:"version,omitempty"` -} - -// Task the task that has the ARM resource and task properties. -// The task will have all information to schedule a run against it. -type Task struct { - autorest.Response `json:"-"` - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskProperties - The properties of a task. - *TaskProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Task. -func (t Task) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.Identity != nil { - objectMap["identity"] = t.Identity - } - if t.TaskProperties != nil { - objectMap["properties"] = t.TaskProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Task struct. -func (t *Task) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - t.Identity = &identity - } - case "properties": - if v != nil { - var taskProperties TaskProperties - err = json.Unmarshal(*v, &taskProperties) - if err != nil { - return err - } - t.TaskProperties = &taskProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - t.SystemData = &systemData - } - } - } - - return nil -} - -// TaskListResult the collection of tasks. -type TaskListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Task `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// TaskListResultIterator provides access to a complete listing of Task values. -type TaskListResultIterator struct { - i int - page TaskListResultPage -} - -// 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 *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.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 *TaskListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskListResultIterator) 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 TaskListResultIterator) Response() TaskListResult { - 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 TaskListResultIterator) Value() Task { - if !iter.page.NotDone() { - return Task{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TaskListResultIterator type. -func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { - return TaskListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TaskListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TaskListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// taskListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TaskListResult) taskListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TaskListResultPage contains a page of Task values. -type TaskListResultPage struct { - fn func(context.Context, TaskListResult) (TaskListResult, error) - tlr TaskListResult -} - -// 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 *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TaskListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TaskListResultPage) Response() TaskListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TaskListResultPage) Values() []Task { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TaskListResultPage type. -func NewTaskListResultPage(cur TaskListResult, getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { - return TaskListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TaskProperties the properties of a task. -type TaskProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CreationDate - READ-ONLY; The creation date of task. - CreationDate *date.Time `json:"creationDate,omitempty"` - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // AgentPoolName - The dedicated agent pool for the task. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties of a task step. - Step BasicTaskStepProperties `json:"step,omitempty"` - // Trigger - The properties that describe all triggers for the task. - Trigger *TriggerProperties `json:"trigger,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // IsSystemTask - The value of this property indicates whether the task resource is system task or not. - IsSystemTask *bool `json:"isSystemTask,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskProperties. -func (tp TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.Status != "" { - objectMap["status"] = tp.Status - } - if tp.Platform != nil { - objectMap["platform"] = tp.Platform - } - if tp.AgentConfiguration != nil { - objectMap["agentConfiguration"] = tp.AgentConfiguration - } - if tp.AgentPoolName != nil { - objectMap["agentPoolName"] = tp.AgentPoolName - } - if tp.Timeout != nil { - objectMap["timeout"] = tp.Timeout - } - objectMap["step"] = tp.Step - if tp.Trigger != nil { - objectMap["trigger"] = tp.Trigger - } - if tp.Credentials != nil { - objectMap["credentials"] = tp.Credentials - } - if tp.LogTemplate != nil { - objectMap["logTemplate"] = tp.LogTemplate - } - if tp.IsSystemTask != nil { - objectMap["isSystemTask"] = tp.IsSystemTask - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. -func (tp *TaskProperties) 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 "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "creationDate": - if v != nil { - var creationDate date.Time - err = json.Unmarshal(*v, &creationDate) - if err != nil { - return err - } - tp.CreationDate = &creationDate - } - case "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tp.Status = status - } - case "platform": - if v != nil { - var platform PlatformProperties - err = json.Unmarshal(*v, &platform) - if err != nil { - return err - } - tp.Platform = &platform - } - case "agentConfiguration": - if v != nil { - var agentConfiguration AgentProperties - err = json.Unmarshal(*v, &agentConfiguration) - if err != nil { - return err - } - tp.AgentConfiguration = &agentConfiguration - } - case "agentPoolName": - if v != nil { - var agentPoolName string - err = json.Unmarshal(*v, &agentPoolName) - if err != nil { - return err - } - tp.AgentPoolName = &agentPoolName - } - case "timeout": - if v != nil { - var timeout int32 - err = json.Unmarshal(*v, &timeout) - if err != nil { - return err - } - tp.Timeout = &timeout - } - case "step": - if v != nil { - step, err := unmarshalBasicTaskStepProperties(*v) - if err != nil { - return err - } - tp.Step = step - } - case "trigger": - if v != nil { - var trigger TriggerProperties - err = json.Unmarshal(*v, &trigger) - if err != nil { - return err - } - tp.Trigger = &trigger - } - case "credentials": - if v != nil { - var credentials Credentials - err = json.Unmarshal(*v, &credentials) - if err != nil { - return err - } - tp.Credentials = &credentials - } - case "logTemplate": - if v != nil { - var logTemplate string - err = json.Unmarshal(*v, &logTemplate) - if err != nil { - return err - } - tp.LogTemplate = &logTemplate - } - case "isSystemTask": - if v != nil { - var isSystemTask bool - err = json.Unmarshal(*v, &isSystemTask) - if err != nil { - return err - } - tp.IsSystemTask = &isSystemTask - } - } - } - - return nil -} - -// TaskPropertiesUpdateParameters the properties for updating a task. -type TaskPropertiesUpdateParameters struct { - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformUpdateParameters `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // AgentPoolName - The dedicated agent pool for the task. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties for updating a task step. - Step BasicTaskStepUpdateParameters `json:"step,omitempty"` - // Trigger - The properties for updating trigger properties. - Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` - // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. -func (tpup *TaskPropertiesUpdateParameters) 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 "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tpup.Status = status - } - case "platform": - if v != nil { - var platform PlatformUpdateParameters - err = json.Unmarshal(*v, &platform) - if err != nil { - return err - } - tpup.Platform = &platform - } - case "agentConfiguration": - if v != nil { - var agentConfiguration AgentProperties - err = json.Unmarshal(*v, &agentConfiguration) - if err != nil { - return err - } - tpup.AgentConfiguration = &agentConfiguration - } - case "agentPoolName": - if v != nil { - var agentPoolName string - err = json.Unmarshal(*v, &agentPoolName) - if err != nil { - return err - } - tpup.AgentPoolName = &agentPoolName - } - case "timeout": - if v != nil { - var timeout int32 - err = json.Unmarshal(*v, &timeout) - if err != nil { - return err - } - tpup.Timeout = &timeout - } - case "step": - if v != nil { - step, err := unmarshalBasicTaskStepUpdateParameters(*v) - if err != nil { - return err - } - tpup.Step = step - } - case "trigger": - if v != nil { - var trigger TriggerUpdateParameters - err = json.Unmarshal(*v, &trigger) - if err != nil { - return err - } - tpup.Trigger = &trigger - } - case "credentials": - if v != nil { - var credentials Credentials - err = json.Unmarshal(*v, &credentials) - if err != nil { - return err - } - tpup.Credentials = &credentials - } - case "logTemplate": - if v != nil { - var logTemplate string - err = json.Unmarshal(*v, &logTemplate) - if err != nil { - return err - } - tpup.LogTemplate = &logTemplate - } - } - } - - return nil -} - -// TaskRun the task run that has the ARM resource and properties. -// The task run will have the information of request and result of a run. -type TaskRun struct { - autorest.Response `json:"-"` - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunProperties - The properties associated with the task run, i.e., request and result of the run - *TaskRunProperties `json:"properties,omitempty"` - // Location - The location of the resource - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRun. -func (tr TaskRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Identity != nil { - objectMap["identity"] = tr.Identity - } - if tr.TaskRunProperties != nil { - objectMap["properties"] = tr.TaskRunProperties - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRun struct. -func (tr *TaskRun) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tr.Identity = &identity - } - case "properties": - if v != nil { - var taskRunProperties TaskRunProperties - err = json.Unmarshal(*v, &taskRunProperties) - if err != nil { - return err - } - tr.TaskRunProperties = &taskRunProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tr.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - tr.SystemData = &systemData - } - } - } - - return nil -} - -// TaskRunListResult the collection of task runs. -type TaskRunListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]TaskRun `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// TaskRunListResultIterator provides access to a complete listing of TaskRun values. -type TaskRunListResultIterator struct { - i int - page TaskRunListResultPage -} - -// 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 *TaskRunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultIterator.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 *TaskRunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskRunListResultIterator) 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 TaskRunListResultIterator) Response() TaskRunListResult { - 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 TaskRunListResultIterator) Value() TaskRun { - if !iter.page.NotDone() { - return TaskRun{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TaskRunListResultIterator type. -func NewTaskRunListResultIterator(page TaskRunListResultPage) TaskRunListResultIterator { - return TaskRunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (trlr TaskRunListResult) IsEmpty() bool { - return trlr.Value == nil || len(*trlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (trlr TaskRunListResult) hasNextLink() bool { - return trlr.NextLink != nil && len(*trlr.NextLink) != 0 -} - -// taskRunListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (trlr TaskRunListResult) taskRunListResultPreparer(ctx context.Context) (*http.Request, error) { - if !trlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(trlr.NextLink))) -} - -// TaskRunListResultPage contains a page of TaskRun values. -type TaskRunListResultPage struct { - fn func(context.Context, TaskRunListResult) (TaskRunListResult, error) - trlr TaskRunListResult -} - -// 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 *TaskRunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultPage.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.trlr) - if err != nil { - return err - } - page.trlr = 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 *TaskRunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskRunListResultPage) NotDone() bool { - return !page.trlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TaskRunListResultPage) Response() TaskRunListResult { - return page.trlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TaskRunListResultPage) Values() []TaskRun { - if page.trlr.IsEmpty() { - return nil - } - return *page.trlr.Value -} - -// Creates a new instance of the TaskRunListResultPage type. -func NewTaskRunListResultPage(cur TaskRunListResult, getNextPage func(context.Context, TaskRunListResult) (TaskRunListResult, error)) TaskRunListResultPage { - return TaskRunListResultPage{ - fn: getNextPage, - trlr: cur, - } -} - -// TaskRunProperties the properties of task run. -type TaskRunProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of this task run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // RunRequest - The request (parameters) for the run - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // RunResult - READ-ONLY; The result of this task run - RunResult *Run `json:"runResult,omitempty"` - // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRunProperties. -func (trp TaskRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["runRequest"] = trp.RunRequest - if trp.ForceUpdateTag != nil { - objectMap["forceUpdateTag"] = trp.ForceUpdateTag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunProperties struct. -func (trp *TaskRunProperties) 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 "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - trp.ProvisioningState = provisioningState - } - case "runRequest": - if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) - if err != nil { - return err - } - trp.RunRequest = runRequest - } - case "runResult": - if v != nil { - var runResult Run - err = json.Unmarshal(*v, &runResult) - if err != nil { - return err - } - trp.RunResult = &runResult - } - case "forceUpdateTag": - if v != nil { - var forceUpdateTag string - err = json.Unmarshal(*v, &forceUpdateTag) - if err != nil { - return err - } - trp.ForceUpdateTag = &forceUpdateTag - } - } - } - - return nil -} - -// TaskRunPropertiesUpdateParameters the properties of a task run update parameters. -type TaskRunPropertiesUpdateParameters struct { - // RunRequest - The request (parameters) for the new run - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunPropertiesUpdateParameters struct. -func (trpup *TaskRunPropertiesUpdateParameters) 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 "runRequest": - if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) - if err != nil { - return err - } - trpup.RunRequest = runRequest - } - case "forceUpdateTag": - if v != nil { - var forceUpdateTag string - err = json.Unmarshal(*v, &forceUpdateTag) - if err != nil { - return err - } - trpup.ForceUpdateTag = &forceUpdateTag - } - } - } - - return nil -} - -// TaskRunRequest the parameters for a task run request. -type TaskRunRequest struct { - // TaskID - The resource ID of task against which run has to be queued. - TaskID *string `json:"taskId,omitempty"` - // OverrideTaskStepProperties - Set of overridable parameters that can be passed when running a Task. - OverrideTaskStepProperties *OverrideTaskStepProperties `json:"overrideTaskStepProperties,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRunRequest. -func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { - trr.Type = TypeTaskRunRequest - objectMap := make(map[string]interface{}) - if trr.TaskID != nil { - objectMap["taskId"] = trr.TaskID - } - if trr.OverrideTaskStepProperties != nil { - objectMap["overrideTaskStepProperties"] = trr.OverrideTaskStepProperties - } - if trr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled - } - if trr.AgentPoolName != nil { - objectMap["agentPoolName"] = trr.AgentPoolName - } - if trr.LogTemplate != nil { - objectMap["logTemplate"] = trr.LogTemplate - } - if trr.Type != "" { - objectMap["type"] = trr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return &trr, true -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &trr, true -} - -// TaskRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (TaskRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsCreateFuture) 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 TaskRunsCreateFuture.Result. -func (future *TaskRunsCreateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.CreateResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsDeleteFuture) 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 TaskRunsDeleteFuture.Result. -func (future *TaskRunsDeleteFuture) result(client TaskRunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TaskRunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (TaskRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsUpdateFuture) 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 TaskRunsUpdateFuture.Result. -func (future *TaskRunsUpdateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.UpdateResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskRunUpdateParameters the parameters for updating a task run. -type TaskRunUpdateParameters struct { - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunPropertiesUpdateParameters - The properties for updating a task run. - *TaskRunPropertiesUpdateParameters `json:"properties,omitempty"` - // Location - The location of the resource - Location *string `json:"location,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TaskRunUpdateParameters. -func (trup TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if trup.Identity != nil { - objectMap["identity"] = trup.Identity - } - if trup.TaskRunPropertiesUpdateParameters != nil { - objectMap["properties"] = trup.TaskRunPropertiesUpdateParameters - } - if trup.Location != nil { - objectMap["location"] = trup.Location - } - if trup.Tags != nil { - objectMap["tags"] = trup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunUpdateParameters struct. -func (trup *TaskRunUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - trup.Identity = &identity - } - case "properties": - if v != nil { - var taskRunPropertiesUpdateParameters TaskRunPropertiesUpdateParameters - err = json.Unmarshal(*v, &taskRunPropertiesUpdateParameters) - if err != nil { - return err - } - trup.TaskRunPropertiesUpdateParameters = &taskRunPropertiesUpdateParameters - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - trup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - trup.Tags = tags - } - } - } - - return nil -} - -// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (Task, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksCreateFuture) 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 TasksCreateFuture.Result. -func (future *TasksCreateFuture) result(client TasksClient) (t Task, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksDeleteFuture) 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 TasksDeleteFuture.Result. -func (future *TasksDeleteFuture) result(client TasksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BasicTaskStepProperties base properties for any task step. -type BasicTaskStepProperties interface { - AsDockerBuildStep() (*DockerBuildStep, bool) - AsFileTaskStep() (*FileTaskStep, bool) - AsEncodedTaskStep() (*EncodedTaskStep, bool) - AsTaskStepProperties() (*TaskStepProperties, bool) -} - -// TaskStepProperties base properties for any task step. -type TaskStepProperties struct { - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeDocker): - var dbs DockerBuildStep - err := json.Unmarshal(body, &dbs) - return dbs, err - case string(TypeFileTask): - var fts FileTaskStep - err := json.Unmarshal(body, &fts) - return fts, err - case string(TypeEncodedTask): - var ets EncodedTaskStep - err := json.Unmarshal(body, &ets) - return ets, err - default: - var tsp TaskStepProperties - err := json.Unmarshal(body, &tsp) - return tsp, err - } -} -func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tspArray := make([]BasicTaskStepProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) - if err != nil { - return nil, err - } - tspArray[index] = tsp - } - return tspArray, nil -} - -// MarshalJSON is the custom marshaler for TaskStepProperties. -func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { - tsp.Type = TypeTaskStepProperties - objectMap := make(map[string]interface{}) - if tsp.ContextPath != nil { - objectMap["contextPath"] = tsp.ContextPath - } - if tsp.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsp.ContextAccessToken - } - if tsp.Type != "" { - objectMap["type"] = tsp.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { - return &tsp, true -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &tsp, true -} - -// BasicTaskStepUpdateParameters base properties for updating any task step. -type BasicTaskStepUpdateParameters interface { - AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) - AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) - AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) - AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) -} - -// TaskStepUpdateParameters base properties for updating any task step. -type TaskStepUpdateParameters struct { - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicTaskStepUpdateParametersTypeDocker): - var dbsup DockerBuildStepUpdateParameters - err := json.Unmarshal(body, &dbsup) - return dbsup, err - case string(TypeBasicTaskStepUpdateParametersTypeFileTask): - var ftsup FileTaskStepUpdateParameters - err := json.Unmarshal(body, &ftsup) - return ftsup, err - case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): - var etsup EncodedTaskStepUpdateParameters - err := json.Unmarshal(body, &etsup) - return etsup, err - default: - var tsup TaskStepUpdateParameters - err := json.Unmarshal(body, &tsup) - return tsup, err - } -} -func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) - if err != nil { - return nil, err - } - tsupArray[index] = tsup - } - return tsupArray, nil -} - -// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters - objectMap := make(map[string]interface{}) - if tsup.ContextPath != nil { - objectMap["contextPath"] = tsup.ContextPath - } - if tsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsup.ContextAccessToken - } - if tsup.Type != "" { - objectMap["type"] = tsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return &tsup, true -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &tsup, true -} - -// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (Task, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksUpdateFuture) 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 TasksUpdateFuture.Result. -func (future *TasksUpdateFuture) result(client TasksClient) (t Task, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskUpdateParameters the parameters for updating a task. -type TaskUpdateParameters struct { - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskPropertiesUpdateParameters - The properties for updating a task. - *TaskPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TaskUpdateParameters. -func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Identity != nil { - objectMap["identity"] = tup.Identity - } - if tup.TaskPropertiesUpdateParameters != nil { - objectMap["properties"] = tup.TaskPropertiesUpdateParameters - } - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. -func (tup *TaskUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tup.Identity = &identity - } - case "properties": - if v != nil { - var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters - err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) - if err != nil { - return err - } - tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tup.Tags = tags - } - } - } - - return nil -} - -// TimerTrigger the properties of a timer trigger. -type TimerTrigger struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// TimerTriggerDescriptor ... -type TimerTriggerDescriptor struct { - // TimerTriggerName - The timer trigger name that caused the run. - TimerTriggerName *string `json:"timerTriggerName,omitempty"` - // ScheduleOccurrence - The occurrence that triggered the run. - ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` -} - -// TimerTriggerUpdateParameters the properties for updating a timer trigger. -type TimerTriggerUpdateParameters struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// Token an object that represents a token for a container registry. -type Token struct { - autorest.Response `json:"-"` - // TokenProperties - The properties of the token. - *TokenProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Token. -func (t Token) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TokenProperties != nil { - objectMap["properties"] = t.TokenProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Token struct. -func (t *Token) 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 tokenProperties TokenProperties - err = json.Unmarshal(*v, &tokenProperties) - if err != nil { - return err - } - t.TokenProperties = &tokenProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - t.SystemData = &systemData - } - } - } - - return nil -} - -// TokenCertificate the properties of a certificate used for authenticating a token. -type TokenCertificate struct { - // Name - Possible values include: 'Certificate1', 'Certificate2' - Name TokenCertificateName `json:"name,omitempty"` - // Expiry - The expiry datetime of the certificate. - Expiry *date.Time `json:"expiry,omitempty"` - // Thumbprint - The thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // EncodedPemCertificate - Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. - EncodedPemCertificate *string `json:"encodedPemCertificate,omitempty"` -} - -// TokenCredentialsProperties the properties of the credentials that can be used for authenticating the -// token. -type TokenCredentialsProperties struct { - ActiveDirectoryObject *ActiveDirectoryObject `json:"activeDirectoryObject,omitempty"` - Certificates *[]TokenCertificate `json:"certificates,omitempty"` - Passwords *[]TokenPassword `json:"passwords,omitempty"` -} - -// TokenListResult the result of a request to list tokens for a container registry. -type TokenListResult struct { - autorest.Response `json:"-"` - // Value - The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. - Value *[]Token `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of tokens. - NextLink *string `json:"nextLink,omitempty"` -} - -// TokenListResultIterator provides access to a complete listing of Token values. -type TokenListResultIterator struct { - i int - page TokenListResultPage -} - -// 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 *TokenListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultIterator.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 *TokenListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TokenListResultIterator) 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 TokenListResultIterator) Response() TokenListResult { - 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 TokenListResultIterator) Value() Token { - if !iter.page.NotDone() { - return Token{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TokenListResultIterator type. -func NewTokenListResultIterator(page TokenListResultPage) TokenListResultIterator { - return TokenListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TokenListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TokenListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// tokenListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TokenListResult) tokenListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TokenListResultPage contains a page of Token values. -type TokenListResultPage struct { - fn func(context.Context, TokenListResult) (TokenListResult, error) - tlr TokenListResult -} - -// 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 *TokenListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TokenListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TokenListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TokenListResultPage) Response() TokenListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TokenListResultPage) Values() []Token { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TokenListResultPage type. -func NewTokenListResultPage(cur TokenListResult, getNextPage func(context.Context, TokenListResult) (TokenListResult, error)) TokenListResultPage { - return TokenListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TokenPassword the password that will be used for authenticating the token of a container registry. -type TokenPassword struct { - // CreationTime - The creation datetime of the password. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Expiry - The expiry datetime of the password. - Expiry *date.Time `json:"expiry,omitempty"` - // Name - The password name "password1" or "password2". Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' - Name TokenPasswordName `json:"name,omitempty"` - // Value - READ-ONLY; The password value. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TokenPassword. -func (tp TokenPassword) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.CreationTime != nil { - objectMap["creationTime"] = tp.CreationTime - } - if tp.Expiry != nil { - objectMap["expiry"] = tp.Expiry - } - if tp.Name != "" { - objectMap["name"] = tp.Name - } - return json.Marshal(objectMap) -} - -// TokenProperties the properties of a token. -type TokenProperties struct { - // CreationDate - READ-ONLY; The creation date of scope map. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ScopeMapID - The resource ID of the scope map to which the token will be associated with. - ScopeMapID *string `json:"scopeMapId,omitempty"` - // Credentials - The credentials that can be used for authenticating the token. - Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` - // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' - Status TokenStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for TokenProperties. -func (tp TokenProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.ScopeMapID != nil { - objectMap["scopeMapId"] = tp.ScopeMapID - } - if tp.Credentials != nil { - objectMap["credentials"] = tp.Credentials - } - if tp.Status != "" { - objectMap["status"] = tp.Status - } - return json.Marshal(objectMap) -} - -// TokensCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TokensCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TokensClient) (Token, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TokensCreateFuture) 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 TokensCreateFuture.Result. -func (future *TokensCreateFuture) result(client TokensClient) (t Token, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TokensCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TokensDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TokensDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TokensClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TokensDeleteFuture) 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 TokensDeleteFuture.Result. -func (future *TokensDeleteFuture) result(client TokensClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TokensDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TokensUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TokensUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TokensClient) (Token, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TokensUpdateFuture) 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 TokensUpdateFuture.Result. -func (future *TokensUpdateFuture) result(client TokensClient) (t Token, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TokensUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TokenUpdateParameters the parameters for updating a token. -type TokenUpdateParameters struct { - // TokenUpdateProperties - The properties of the token update parameters. - *TokenUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TokenUpdateParameters. -func (tup TokenUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.TokenUpdateProperties != nil { - objectMap["properties"] = tup.TokenUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TokenUpdateParameters struct. -func (tup *TokenUpdateParameters) 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 tokenUpdateProperties TokenUpdateProperties - err = json.Unmarshal(*v, &tokenUpdateProperties) - if err != nil { - return err - } - tup.TokenUpdateProperties = &tokenUpdateProperties - } - } - } - - return nil -} - -// TokenUpdateProperties the parameters for updating token properties. -type TokenUpdateProperties struct { - // ScopeMapID - The resource ID of the scope map to which the token will be associated with. - ScopeMapID *string `json:"scopeMapId,omitempty"` - // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' - Status TokenStatus `json:"status,omitempty"` - // Credentials - The credentials that can be used for authenticating the token. - Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` -} - -// TriggerProperties the properties of a trigger. -type TriggerProperties struct { - // TimerTriggers - The collection of timer triggers. - TimerTriggers *[]TimerTrigger `json:"timerTriggers,omitempty"` - // SourceTriggers - The collection of triggers based on source code repository. - SourceTriggers *[]SourceTrigger `json:"sourceTriggers,omitempty"` - // BaseImageTrigger - The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTrigger `json:"baseImageTrigger,omitempty"` -} - -// TriggerUpdateParameters the properties for updating triggers. -type TriggerUpdateParameters struct { - // TimerTriggers - The collection of timer triggers. - TimerTriggers *[]TimerTriggerUpdateParameters `json:"timerTriggers,omitempty"` - // SourceTriggers - The collection of triggers based on source code repository. - SourceTriggers *[]SourceTriggerUpdateParameters `json:"sourceTriggers,omitempty"` - // BaseImageTrigger - The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTriggerUpdateParameters `json:"baseImageTrigger,omitempty"` -} - -// TrustPolicy the content trust policy for a container registry. -type TrustPolicy struct { - // Type - The type of trust policy. Possible values include: 'Notary' - Type TrustPolicyType `json:"type,omitempty"` - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// UserIdentityProperties ... -type UserIdentityProperties struct { - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// VirtualNetworkRule virtual network rule. -type VirtualNetworkRule struct { - // Action - The action of virtual network rule. Possible values include: 'Allow' - Action Action `json:"action,omitempty"` - // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - VirtualNetworkResourceID *string `json:"id,omitempty"` -} - -// Webhook an object that represents a webhook for a container registry. -type Webhook struct { - autorest.Response `json:"-"` - // WebhookProperties - The properties of the webhook. - *WebhookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WebhookProperties != nil { - objectMap["properties"] = w.WebhookProperties - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Webhook struct. -func (w *Webhook) 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 webhookProperties WebhookProperties - err = json.Unmarshal(*v, &webhookProperties) - if err != nil { - return err - } - w.WebhookProperties = &webhookProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - w.SystemData = &systemData - } - } - } - - return nil -} - -// WebhookCreateParameters the parameters for creating a webhook. -type WebhookCreateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // Location - The location of the webhook. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. - *WebhookPropertiesCreateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateParameters. -func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcp.Tags != nil { - objectMap["tags"] = wcp.Tags - } - if wcp.Location != nil { - objectMap["location"] = wcp.Location - } - if wcp.WebhookPropertiesCreateParameters != nil { - objectMap["properties"] = wcp.WebhookPropertiesCreateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. -func (wcp *WebhookCreateParameters) 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 - } - wcp.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wcp.Location = &location - } - case "properties": - if v != nil { - var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters - err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) - if err != nil { - return err - } - wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters - } - } - } - - return nil -} - -// WebhookListResult the result of a request to list webhooks for a container registry. -type WebhookListResult struct { - autorest.Response `json:"-"` - // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. - Value *[]Webhook `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of webhooks. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultIterator provides access to a complete listing of Webhook values. -type WebhookListResultIterator struct { - i int - page WebhookListResultPage -} - -// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { - 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 WebhookListResultIterator) Value() Webhook { - if !iter.page.NotDone() { - return Webhook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebhookListResultIterator type. -func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { - return WebhookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WebhookListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WebhookListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// webhookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WebhookListResult) webhookListResultPreparer(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))) -} - -// WebhookListResultPage contains a page of Webhook values. -type WebhookListResultPage struct { - fn func(context.Context, WebhookListResult) (WebhookListResult, error) - wlr WebhookListResult -} - -// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebhookListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebhookListResultPage) Response() WebhookListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebhookListResultPage) Values() []Webhook { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WebhookListResultPage type. -func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { - return WebhookListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WebhookProperties the properties of a webhook. -type WebhookProperties struct { - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookProperties. -func (wp WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Status != "" { - objectMap["status"] = wp.Status - } - if wp.Scope != nil { - objectMap["scope"] = wp.Scope - } - if wp.Actions != nil { - objectMap["actions"] = wp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. -type WebhookPropertiesCreateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. -func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpcp.ServiceURI != nil { - objectMap["serviceUri"] = wpcp.ServiceURI - } - if wpcp.CustomHeaders != nil { - objectMap["customHeaders"] = wpcp.CustomHeaders - } - if wpcp.Status != "" { - objectMap["status"] = wpcp.Status - } - if wpcp.Scope != nil { - objectMap["scope"] = wpcp.Scope - } - if wpcp.Actions != nil { - objectMap["actions"] = wpcp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. -type WebhookPropertiesUpdateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. -func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpup.ServiceURI != nil { - objectMap["serviceUri"] = wpup.ServiceURI - } - if wpup.CustomHeaders != nil { - objectMap["customHeaders"] = wpup.CustomHeaders - } - if wpup.Status != "" { - objectMap["status"] = wpup.Status - } - if wpup.Scope != nil { - objectMap["scope"] = wpup.Scope - } - if wpup.Actions != nil { - objectMap["actions"] = wpup.Actions - } - return json.Marshal(objectMap) -} - -// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksCreateFuture) 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 WebhooksCreateFuture.Result. -func (future *WebhooksCreateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.CreateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksDeleteFuture) 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 WebhooksDeleteFuture.Result. -func (future *WebhooksDeleteFuture) result(client WebhooksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksUpdateFuture) 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 WebhooksUpdateFuture.Result. -func (future *WebhooksUpdateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.UpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhookUpdateParameters the parameters for updating a webhook. -type WebhookUpdateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. - *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateParameters. -func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.Tags != nil { - objectMap["tags"] = wup.Tags - } - if wup.WebhookPropertiesUpdateParameters != nil { - objectMap["properties"] = wup.WebhookPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. -func (wup *WebhookUpdateParameters) 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 - } - wup.Tags = tags - } - case "properties": - if v != nil { - var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters - err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) - if err != nil { - return err - } - wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters - } - } - } - - return nil -} diff --git a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/operations.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/operations.go deleted file mode 100644 index e8791b2ad881..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 client for the Operations methods of the Containerregistry service. -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 Azure Container Registry 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, "containerregistry.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, "containerregistry.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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 = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerRegistry/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, "containerregistry.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, "containerregistry.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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/containerregistry/mgmt/2019-12-01-preview/containerregistry/pipelineruns.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/pipelineruns.go deleted file mode 100644 index a1abbe838f6a..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/pipelineruns.go +++ /dev/null @@ -1,453 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PipelineRunsClient is the client for the PipelineRuns methods of the Containerregistry service. -type PipelineRunsClient struct { - BaseClient -} - -// NewPipelineRunsClient creates an instance of the PipelineRunsClient client. -func NewPipelineRunsClient(subscriptionID string) PipelineRunsClient { - return NewPipelineRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPipelineRunsClientWithBaseURI creates an instance of the PipelineRunsClient 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 NewPipelineRunsClientWithBaseURI(baseURI string, subscriptionID string) PipelineRunsClient { - return PipelineRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a pipeline run for a container registry with the specified parameters -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// pipelineRunName - the name of the pipeline run. -// pipelineRunCreateParameters - the parameters for creating a pipeline run. -func (client PipelineRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun) (result PipelineRunsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunName, - Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunCreateParameters, - Constraints: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Source", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Source.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Target", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Target.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, pipelineRunName, pipelineRunCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client PipelineRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "pipelineRunName": autorest.Encode("path", pipelineRunName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", pathParameters), - autorest.WithJSON(pipelineRunCreateParameters), - 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 PipelineRunsClient) CreateSender(req *http.Request) (future PipelineRunsCreateFuture, 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 PipelineRunsClient) CreateResponder(resp *http.Response) (result PipelineRun, 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 a pipeline run from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// pipelineRunName - the name of the pipeline run. -func (client PipelineRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result PipelineRunsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunName, - Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, pipelineRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PipelineRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "pipelineRunName": autorest.Encode("path", pipelineRunName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", 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 PipelineRunsClient) DeleteSender(req *http.Request) (future PipelineRunsDeleteFuture, 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 PipelineRunsClient) 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 the detailed information for a given pipeline run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// pipelineRunName - the name of the pipeline run. -func (client PipelineRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result PipelineRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunName, - Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, pipelineRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PipelineRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "pipelineRunName": autorest.Encode("path", pipelineRunName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", 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 PipelineRunsClient) 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 PipelineRunsClient) GetResponder(resp *http.Response) (result PipelineRun, 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 the pipeline runs for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client PipelineRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result PipelineRunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.List") - defer func() { - sc := -1 - if result.prlr.Response.Response != nil { - sc = result.prlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.prlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", resp, "Failure sending request") - return - } - - result.prlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", resp, "Failure responding to request") - return - } - if result.prlr.hasNextLink() && result.prlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PipelineRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/pipelineRuns", 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 PipelineRunsClient) 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 PipelineRunsClient) ListResponder(resp *http.Response) (result PipelineRunListResult, 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 PipelineRunsClient) listNextResults(ctx context.Context, lastResults PipelineRunListResult) (result PipelineRunListResult, err error) { - req, err := lastResults.pipelineRunListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "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, "containerregistry.PipelineRunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PipelineRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result PipelineRunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/privateendpointconnections.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/privateendpointconnections.go deleted file mode 100644 index 41989593be28..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/privateendpointconnections.go +++ /dev/null @@ -1,434 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the Containerregistry -// service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate update the state of specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -// privateEndpointConnection - the parameters for creating a private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName, privateEndpointConnection) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(privateEndpointConnection), - 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 get the specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// List list all private endpoint connections in a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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 PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "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, "containerregistry.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/registries.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/registries.go deleted file mode 100644 index b339935fa111..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/registries.go +++ /dev/null @@ -1,1475 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RegistriesClient is the client for the Registries methods of the Containerregistry service. -type RegistriesClient struct { - BaseClient -} - -// NewRegistriesClient creates an instance of the RegistriesClient client. -func NewRegistriesClient(subscriptionID string) RegistriesClient { - return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient 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 NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { - return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only -// alphanumeric characters, be globally unique, and between 5 and 50 characters in length. -// Parameters: -// registryNameCheckRequest - the object containing information for the availability request. -func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryNameCheckRequest, - Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}, - }}, - {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters), - autorest.WithJSON(registryNameCheckRequest), - 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 RegistriesClient) 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 RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, 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 container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registry - the parameters for creating a container registry. -func (client RegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result RegistriesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: registry, - Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "registry.RegistryProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, registry) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registry), - 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 RegistriesClient) CreateSender(req *http.Request) (future RegistriesCreateFuture, 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 RegistriesClient) CreateResponder(resp *http.Response) (result Registry, 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 a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result RegistriesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) DeleteSender(req *http.Request) (future RegistriesDeleteFuture, 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 RegistriesClient) 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 -} - -// GenerateCredentials generate keys for a token of a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// generateCredentialsParameters - the parameters for generating credentials. -func (client RegistriesClient) GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (result RegistriesGenerateCredentialsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GenerateCredentials") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "GenerateCredentials", err.Error()) - } - - req, err := client.GenerateCredentialsPreparer(ctx, resourceGroupName, registryName, generateCredentialsParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", nil, "Failure preparing request") - return - } - - result, err = client.GenerateCredentialsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", result.Response(), "Failure sending request") - return - } - - return -} - -// GenerateCredentialsPreparer prepares the GenerateCredentials request. -func (client RegistriesClient) GenerateCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/generateCredentials", pathParameters), - autorest.WithJSON(generateCredentialsParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateCredentialsSender sends the GenerateCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GenerateCredentialsSender(req *http.Request) (future RegistriesGenerateCredentialsFuture, 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 -} - -// GenerateCredentialsResponder handles the response to the GenerateCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GenerateCredentialsResponder(resp *http.Response) (result GenerateCredentialsResult, 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 the properties of the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) 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 RegistriesClient) GetResponder(resp *http.Response) (result Registry, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBuildSourceUploadURL get the upload location for the user to be able to upload the source. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result SourceUploadDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GetBuildSourceUploadURL") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "GetBuildSourceUploadURL", err.Error()) - } - - req, err := client.GetBuildSourceUploadURLPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetBuildSourceUploadURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure sending request") - return - } - - result, err = client.GetBuildSourceUploadURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure responding to request") - return - } - - return -} - -// GetBuildSourceUploadURLPreparer prepares the GetBuildSourceUploadURL request. -func (client RegistriesClient) GetBuildSourceUploadURLPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBuildSourceUploadURLSender sends the GetBuildSourceUploadURL request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GetBuildSourceUploadURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetBuildSourceUploadURLResponder handles the response to the GetBuildSourceUploadURL request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GetBuildSourceUploadURLResponder(resp *http.Response) (result SourceUploadDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ImportImage copies an image to this container registry from the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// parameters - the parameters specifying the image to copy and the source container registry. -func (client RegistriesClient) ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (result RegistriesImportImageFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ImportImage") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials.Password", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Source.SourceImage", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ImportImage", err.Error()) - } - - req, err := client.ImportImagePreparer(ctx, resourceGroupName, registryName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", nil, "Failure preparing request") - return - } - - result, err = client.ImportImageSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportImagePreparer prepares the ImportImage request. -func (client RegistriesClient) ImportImagePreparer(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/importImage", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportImageSender sends the ImportImage request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ImportImageSender(req *http.Request) (future RegistriesImportImageFuture, 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 -} - -// ImportImageResponder handles the response to the ImportImage request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ImportImageResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all the container registries under the specified subscription. -func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 the container registries under the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup") - 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.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RegistriesClient) 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 = "2019-12-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.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 -} - -// ListCredentials lists the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListCredentials") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListCredentials", err.Error()) - } - - req, err := client.ListCredentialsPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListCredentialsPreparer prepares the ListCredentials request. -func (client RegistriesClient) ListCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCredentialsSender sends the ListCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCredentialsResponder handles the response to the ListCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPrivateLinkResources lists the private link resources for a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListPrivateLinkResources", err.Error()) - } - - result.fn = client.listPrivateLinkResourcesNextResults - req, err := client.ListPrivateLinkResourcesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", nil, "Failure preparing request") - return - } - - resp, err := client.ListPrivateLinkResourcesSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListPrivateLinkResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPrivateLinkResourcesPreparer prepares the ListPrivateLinkResources request. -func (client RegistriesClient) ListPrivateLinkResourcesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPrivateLinkResourcesSender sends the ListPrivateLinkResources request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListPrivateLinkResourcesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListPrivateLinkResourcesResponder handles the response to the ListPrivateLinkResources request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListPrivateLinkResourcesResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listPrivateLinkResourcesNextResults retrieves the next set of results, if any. -func (client RegistriesClient) listPrivateLinkResourcesNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListPrivateLinkResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListPrivateLinkResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListPrivateLinkResourcesComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") - 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.ListPrivateLinkResources(ctx, resourceGroupName, registryName) - return -} - -// ListUsages gets the quota usages for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result RegistryUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListUsages") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client RegistriesClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/listUsages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListUsagesResponder(resp *http.Response) (result RegistryUsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateCredential regenerates one of the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// regenerateCredentialParameters - specifies name of the password which should be regenerated -- password or -// password2. -func (client RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.RegenerateCredential") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "RegenerateCredential", err.Error()) - } - - req, err := client.RegenerateCredentialPreparer(ctx, resourceGroupName, registryName, regenerateCredentialParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateCredentialSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request") - return - } - - result, err = client.RegenerateCredentialResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateCredentialPreparer prepares the RegenerateCredential request. -func (client RegistriesClient) RegenerateCredentialPreparer(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters), - autorest.WithJSON(regenerateCredentialParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always -// closes the http.Response Body. -func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ScheduleRun schedules a new run based on the request parameters and add it to the run queue. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runRequest - the parameters of a run that needs to scheduled. -func (client RegistriesClient) ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (result RegistriesScheduleRunFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ScheduleRun") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ScheduleRun", err.Error()) - } - - req, err := client.ScheduleRunPreparer(ctx, resourceGroupName, registryName, runRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", nil, "Failure preparing request") - return - } - - result, err = client.ScheduleRunSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", result.Response(), "Failure sending request") - return - } - - return -} - -// ScheduleRunPreparer prepares the ScheduleRun request. -func (client RegistriesClient) ScheduleRunPreparer(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/scheduleRun", pathParameters), - autorest.WithJSON(runRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ScheduleRunSender sends the ScheduleRun request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ScheduleRunSender(req *http.Request) (future RegistriesScheduleRunFuture, 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 -} - -// ScheduleRunResponder handles the response to the ScheduleRun request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ScheduleRunResponder(resp *http.Response) (result Run, 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 a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registryUpdateParameters - the parameters for updating a container registry. -func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result RegistriesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, registryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registryUpdateParameters), - 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 RegistriesClient) UpdateSender(req *http.Request) (future RegistriesUpdateFuture, 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 RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, 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/containerregistry/mgmt/2019-12-01-preview/containerregistry/replications.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/replications.go deleted file mode 100644 index ea1f217bad92..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/replications.go +++ /dev/null @@ -1,542 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReplicationsClient is the client for the Replications methods of the Containerregistry service. -type ReplicationsClient struct { - BaseClient -} - -// NewReplicationsClient creates an instance of the ReplicationsClient client. -func NewReplicationsClient(subscriptionID string) ReplicationsClient { - return NewReplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationsClientWithBaseURI creates an instance of the ReplicationsClient 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 NewReplicationsClientWithBaseURI(baseURI string, subscriptionID string) ReplicationsClient { - return ReplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replication - the parameters for creating a replication. -func (client ReplicationsClient) Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (result ReplicationsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, replicationName, replication) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ReplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replication), - 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 ReplicationsClient) CreateSender(req *http.Request) (future ReplicationsCreateFuture, 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 ReplicationsClient) CreateResponder(resp *http.Response) (result Replication, 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 a replication from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result ReplicationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ReplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) DeleteSender(req *http.Request) (future ReplicationsDeleteFuture, 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 ReplicationsClient) 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 the properties of the specified replication. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result Replication, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) 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 ReplicationsClient) GetResponder(resp *http.Response) (result Replication, 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 the replications for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ReplicationsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.List") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ReplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/replications", 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 ReplicationsClient) 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 ReplicationsClient) ListResponder(resp *http.Response) (result ReplicationListResult, 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 ReplicationsClient) listNextResults(ctx context.Context, lastResults ReplicationListResult) (result ReplicationListResult, err error) { - req, err := lastResults.replicationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "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, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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, registryName) - return -} - -// Update updates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replicationUpdateParameters - the parameters for updating a replication. -func (client ReplicationsClient) Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (result ReplicationsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ReplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replicationUpdateParameters), - 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 ReplicationsClient) UpdateSender(req *http.Request) (future ReplicationsUpdateFuture, 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 ReplicationsClient) UpdateResponder(resp *http.Response) (result Replication, 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/containerregistry/mgmt/2019-12-01-preview/containerregistry/runs.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/runs.go deleted file mode 100644 index 7035b1e3c4f3..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/runs.go +++ /dev/null @@ -1,529 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RunsClient is the client for the Runs methods of the Containerregistry service. -type RunsClient struct { - BaseClient -} - -// NewRunsClient creates an instance of the RunsClient client. -func NewRunsClient(subscriptionID string) RunsClient { - return NewRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunsClientWithBaseURI creates an instance of the RunsClient 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 NewRunsClientWithBaseURI(baseURI string, subscriptionID string) RunsClient { - return RunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancel an existing run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunsCancelFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.Cancel") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Cancel", err.Error()) - } - - req, err := client.CancelPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", nil, "Failure preparing request") - return - } - - result, err = client.CancelSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", result.Response(), "Failure sending request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client RunsClient) CancelPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client RunsClient) CancelSender(req *http.Request) (future RunsCancelFuture, 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 -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client RunsClient) CancelResponder(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 gets the detailed information for a given run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result Run, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}", 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 RunsClient) 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 RunsClient) GetResponder(resp *http.Response) (result Run, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLogSasURL gets a link to download the run logs. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunGetLogResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.GetLogSasURL") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "GetLogSasURL", err.Error()) - } - - req, err := client.GetLogSasURLPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetLogSasURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure sending request") - return - } - - result, err = client.GetLogSasURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure responding to request") - return - } - - return -} - -// GetLogSasURLPreparer prepares the GetLogSasURL request. -func (client RunsClient) GetLogSasURLPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLogSasURLSender sends the GetLogSasURL request. The method will close the -// http.Response Body if it receives an error. -func (client RunsClient) GetLogSasURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLogSasURLResponder handles the response to the GetLogSasURL request. The method always -// closes the http.Response Body. -func (client RunsClient) GetLogSasURLResponder(resp *http.Response) (result RunGetLogResult, 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 the runs for a registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// filter - the runs filter to apply on the operation. Arithmetic operators are not supported. The allowed -// string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. -// top - $top is supported for get list of runs, which limits the maximum number of runs to return. -func (client RunsClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.List") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs", 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 RunsClient) 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 RunsClient) ListResponder(resp *http.Response) (result RunListResult, 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 RunsClient) listNextResults(ctx context.Context, lastResults RunListResult) (result RunListResult, err error) { - req, err := lastResults.runListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RunsClient", "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, "containerregistry.RunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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, registryName, filter, top) - return -} - -// Update patch the run properties. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -// runUpdateParameters - the run update properties. -func (client RunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (result RunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, runID, runUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}", pathParameters), - autorest.WithJSON(runUpdateParameters), - 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 RunsClient) UpdateSender(req *http.Request) (future RunsUpdateFuture, 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 RunsClient) UpdateResponder(resp *http.Response) (result Run, 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/containerregistry/mgmt/2019-12-01-preview/containerregistry/scopemaps.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/scopemaps.go deleted file mode 100644 index f22da284db00..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/scopemaps.go +++ /dev/null @@ -1,545 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ScopeMapsClient is the client for the ScopeMaps methods of the Containerregistry service. -type ScopeMapsClient struct { - BaseClient -} - -// NewScopeMapsClient creates an instance of the ScopeMapsClient client. -func NewScopeMapsClient(subscriptionID string) ScopeMapsClient { - return NewScopeMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScopeMapsClientWithBaseURI creates an instance of the ScopeMapsClient 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 NewScopeMapsClientWithBaseURI(baseURI string, subscriptionID string) ScopeMapsClient { - return ScopeMapsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a scope map for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -// scopeMapCreateParameters - the parameters for creating a scope map. -func (client ScopeMapsClient) Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (result ScopeMapsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, - {TargetValue: scopeMapCreateParameters, - Constraints: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties.Actions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ScopeMapsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), - autorest.WithJSON(scopeMapCreateParameters), - 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 ScopeMapsClient) CreateSender(req *http.Request) (future ScopeMapsCreateFuture, 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 ScopeMapsClient) CreateResponder(resp *http.Response) (result ScopeMap, 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 a scope map from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -func (client ScopeMapsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMapsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, scopeMapName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScopeMapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", 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 ScopeMapsClient) DeleteSender(req *http.Request) (future ScopeMapsDeleteFuture, 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 ScopeMapsClient) 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 the properties of the specified scope map. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -func (client ScopeMapsClient) Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMap, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, scopeMapName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScopeMapsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", 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 ScopeMapsClient) 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 ScopeMapsClient) GetResponder(resp *http.Response) (result ScopeMap, 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 the scope maps for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ScopeMapsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.List") - defer func() { - sc := -1 - if result.smlr.Response.Response != nil { - sc = result.smlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.smlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure sending request") - return - } - - result.smlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure responding to request") - return - } - if result.smlr.hasNextLink() && result.smlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ScopeMapsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/scopeMaps", 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 ScopeMapsClient) 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 ScopeMapsClient) ListResponder(resp *http.Response) (result ScopeMapListResult, 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 ScopeMapsClient) listNextResults(ctx context.Context, lastResults ScopeMapListResult) (result ScopeMapListResult, err error) { - req, err := lastResults.scopeMapListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "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, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScopeMapsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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, registryName) - return -} - -// Update updates a scope map with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -// scopeMapUpdateParameters - the parameters for updating a scope map. -func (client ScopeMapsClient) Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (result ScopeMapsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScopeMapsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), - autorest.WithJSON(scopeMapUpdateParameters), - 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 ScopeMapsClient) UpdateSender(req *http.Request) (future ScopeMapsUpdateFuture, 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 ScopeMapsClient) UpdateResponder(resp *http.Response) (result ScopeMap, 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/containerregistry/mgmt/2019-12-01-preview/containerregistry/taskruns.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/taskruns.go deleted file mode 100644 index ee13d4b2d14f..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/taskruns.go +++ /dev/null @@ -1,634 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TaskRunsClient is the client for the TaskRuns methods of the Containerregistry service. -type TaskRunsClient struct { - BaseClient -} - -// NewTaskRunsClient creates an instance of the TaskRunsClient client. -func NewTaskRunsClient(subscriptionID string) TaskRunsClient { - return NewTaskRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTaskRunsClientWithBaseURI creates an instance of the TaskRunsClient 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 NewTaskRunsClientWithBaseURI(baseURI string, subscriptionID string) TaskRunsClient { - return TaskRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task run for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -// taskRun - the parameters of a run that needs to scheduled. -func (client TaskRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (result TaskRunsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskRunName, taskRun) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TaskRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(taskRun), - 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 TaskRunsClient) CreateSender(req *http.Request) (future TaskRunsCreateFuture, 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 TaskRunsClient) CreateResponder(resp *http.Response) (result TaskRun, 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 a specified task run resource. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRunsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TaskRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) DeleteSender(req *http.Request) (future TaskRunsDeleteFuture, 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 TaskRunsClient) 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 the detailed information for a given task run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TaskRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) 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 TaskRunsClient) GetResponder(resp *http.Response) (result TaskRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails gets the detailed information for a given task run that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.GetDetails") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TaskRunsClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TaskRunsClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) GetDetailsResponder(resp *http.Response) (result TaskRun, 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 the task runs for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TaskRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.List") - defer func() { - sc := -1 - if result.trlr.Response.Response != nil { - sc = result.trlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.trlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure sending request") - return - } - - result.trlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure responding to request") - return - } - if result.trlr.hasNextLink() && result.trlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TaskRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns", 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 TaskRunsClient) 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 TaskRunsClient) ListResponder(resp *http.Response) (result TaskRunListResult, 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 TaskRunsClient) listNextResults(ctx context.Context, lastResults TaskRunListResult) (result TaskRunListResult, err error) { - req, err := lastResults.taskRunListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "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, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TaskRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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, registryName) - return -} - -// Update updates a task run with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -// updateParameters - the parameters for updating a task run. -func (client TaskRunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (result TaskRunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskRunName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TaskRunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 TaskRunsClient) UpdateSender(req *http.Request) (future TaskRunsUpdateFuture, 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 TaskRunsClient) UpdateResponder(resp *http.Response) (result TaskRun, 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/containerregistry/mgmt/2019-12-01-preview/containerregistry/tasks.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/tasks.go deleted file mode 100644 index 3af51765a125..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/tasks.go +++ /dev/null @@ -1,645 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TasksClient is the client for the Tasks methods of the Containerregistry service. -type TasksClient struct { - BaseClient -} - -// NewTasksClient creates an instance of the TasksClient client. -func NewTasksClient(subscriptionID string) TasksClient { - return NewTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTasksClientWithBaseURI creates an instance of the TasksClient 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 NewTasksClientWithBaseURI(baseURI string, subscriptionID string) TasksClient { - return TasksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -// taskCreateParameters - the parameters for creating a task. -func (client TasksClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (result TasksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, - {TargetValue: taskCreateParameters, - Constraints: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMaximum, Rule: int64(28800), Chain: nil}, - {Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMinimum, Rule: int64(300), Chain: nil}, - }}, - {Target: "taskCreateParameters.TaskProperties.Trigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskName, taskCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TasksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskCreateParameters), - 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 TasksClient) CreateSender(req *http.Request) (future TasksCreateFuture, 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 TasksClient) CreateResponder(resp *http.Response) (result Task, 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 a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result TasksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TasksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) DeleteSender(req *http.Request) (future TasksDeleteFuture, 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 TasksClient) 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 get the properties of a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TasksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) 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 TasksClient) GetResponder(resp *http.Response) (result Task, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails returns a task with extended information that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.GetDetails") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TasksClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TasksClient) GetDetailsResponder(resp *http.Response) (result Task, 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 the tasks for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TasksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.List") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TasksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks", 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 TasksClient) 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 TasksClient) ListResponder(resp *http.Response) (result TaskListResult, 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 TasksClient) listNextResults(ctx context.Context, lastResults TaskListResult) (result TaskListResult, err error) { - req, err := lastResults.taskListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TasksClient", "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, "containerregistry.TasksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TasksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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, registryName) - return -} - -// Update updates a task with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -// taskUpdateParameters - the parameters for updating a task. -func (client TasksClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (result TasksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TasksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskUpdateParameters), - 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 TasksClient) UpdateSender(req *http.Request) (future TasksUpdateFuture, 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 TasksClient) UpdateResponder(resp *http.Response) (result Task, 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/containerregistry/mgmt/2019-12-01-preview/containerregistry/tokens.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/tokens.go deleted file mode 100644 index cee1b1d5e0be..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/tokens.go +++ /dev/null @@ -1,542 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TokensClient is the client for the Tokens methods of the Containerregistry service. -type TokensClient struct { - BaseClient -} - -// NewTokensClient creates an instance of the TokensClient client. -func NewTokensClient(subscriptionID string) TokensClient { - return NewTokensClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTokensClientWithBaseURI creates an instance of the TokensClient 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 NewTokensClientWithBaseURI(baseURI string, subscriptionID string) TokensClient { - return TokensClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a token for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -// tokenCreateParameters - the parameters for creating a token. -func (client TokensClient) Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (result TokensCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TokensClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), - autorest.WithJSON(tokenCreateParameters), - 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 TokensClient) CreateSender(req *http.Request) (future TokensCreateFuture, 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 TokensClient) CreateResponder(resp *http.Response) (result Token, 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 a token from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -func (client TokensClient) Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result TokensDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, tokenName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TokensClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", 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 TokensClient) DeleteSender(req *http.Request) (future TokensDeleteFuture, 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 TokensClient) 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 the properties of the specified token. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -func (client TokensClient) Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result Token, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, tokenName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TokensClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", 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 TokensClient) 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 TokensClient) GetResponder(resp *http.Response) (result Token, 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 the tokens for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TokensClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.List") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TokensClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/tokens", 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 TokensClient) 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 TokensClient) ListResponder(resp *http.Response) (result TokenListResult, 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 TokensClient) listNextResults(ctx context.Context, lastResults TokenListResult) (result TokenListResult, err error) { - req, err := lastResults.tokenListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TokensClient", "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, "containerregistry.TokensClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TokensClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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, registryName) - return -} - -// Update updates a token with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -// tokenUpdateParameters - the parameters for updating a token. -func (client TokensClient) Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (result TokensUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TokensClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2019-05-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), - autorest.WithJSON(tokenUpdateParameters), - 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 TokensClient) UpdateSender(req *http.Request) (future TokensUpdateFuture, 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 TokensClient) UpdateResponder(resp *http.Response) (result Token, 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/containerregistry/mgmt/2019-12-01-preview/containerregistry/version.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/version.go deleted file mode 100644 index 9c8e207d3e4f..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerregistry - -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() + " containerregistry/2019-12-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/containerregistry/mgmt/2019-12-01-preview/containerregistry/webhooks.go b/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/webhooks.go deleted file mode 100644 index 2fabe05bb7a9..000000000000 --- a/services/preview/containerregistry/mgmt/2019-12-01-preview/containerregistry/webhooks.go +++ /dev/null @@ -1,866 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WebhooksClient is the client for the Webhooks methods of the Containerregistry service. -type WebhooksClient struct { - BaseClient -} - -// NewWebhooksClient creates an instance of the WebhooksClient client. -func NewWebhooksClient(subscriptionID string) WebhooksClient { - return NewWebhooksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhooksClientWithBaseURI creates an instance of the WebhooksClient 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 NewWebhooksClientWithBaseURI(baseURI string, subscriptionID string) WebhooksClient { - return WebhooksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a webhook for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookCreateParameters - the parameters for creating a webhook. -func (client WebhooksClient) Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (result WebhooksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookCreateParameters, - Constraints: []validation.Constraint{{Target: "webhookCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.ServiceURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client WebhooksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookCreateParameters), - 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 WebhooksClient) CreateSender(req *http.Request) (future WebhooksCreateFuture, 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 WebhooksClient) CreateResponder(resp *http.Response) (result Webhook, 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 a webhook from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result WebhooksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) DeleteSender(req *http.Request) (future WebhooksDeleteFuture, 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 WebhooksClient) 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 the properties of the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhooksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) 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 WebhooksClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCallbackConfig gets the configuration of service URI and custom headers for the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result CallbackConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.GetCallbackConfig") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "GetCallbackConfig", err.Error()) - } - - req, err := client.GetCallbackConfigPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", nil, "Failure preparing request") - return - } - - resp, err := client.GetCallbackConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure sending request") - return - } - - result, err = client.GetCallbackConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure responding to request") - return - } - - return -} - -// GetCallbackConfigPreparer prepares the GetCallbackConfig request. -func (client WebhooksClient) GetCallbackConfigPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCallbackConfigSender sends the GetCallbackConfig request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) GetCallbackConfigSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCallbackConfigResponder handles the response to the GetCallbackConfig request. The method always -// closes the http.Response Body. -func (client WebhooksClient) GetCallbackConfigResponder(resp *http.Response) (result CallbackConfig, 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 the webhooks for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client WebhooksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.List") - 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: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WebhooksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/webhooks", 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 WebhooksClient) 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 WebhooksClient) ListResponder(resp *http.Response) (result WebhookListResult, 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 WebhooksClient) listNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "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, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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, registryName) - return -} - -// ListEvents lists recent events for the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "ListEvents", err.Error()) - } - - result.fn = client.listEventsNextResults - req, err := client.ListEventsPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventsSender(req) - if err != nil { - result.elr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure sending request") - return - } - - result.elr, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure responding to request") - return - } - if result.elr.hasNextLink() && result.elr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListEventsPreparer prepares the ListEvents request. -func (client WebhooksClient) ListEventsPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventsSender sends the ListEvents request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) ListEventsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventsResponder handles the response to the ListEvents request. The method always -// closes the http.Response Body. -func (client WebhooksClient) ListEventsResponder(resp *http.Response) (result EventListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listEventsNextResults retrieves the next set of results, if any. -func (client WebhooksClient) listEventsNextResults(ctx context.Context, lastResults EventListResult) (result EventListResult, err error) { - req, err := lastResults.eventListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListEventsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListEventsComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.ListEvents(ctx, resourceGroupName, registryName, webhookName) - return -} - -// Ping triggers a ping event to be sent to the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Ping") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Ping", err.Error()) - } - - req, err := client.PingPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", nil, "Failure preparing request") - return - } - - resp, err := client.PingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure sending request") - return - } - - result, err = client.PingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure responding to request") - return - } - - return -} - -// PingPreparer prepares the Ping request. -func (client WebhooksClient) PingPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PingSender sends the Ping request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) PingSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PingResponder handles the response to the Ping request. The method always -// closes the http.Response Body. -func (client WebhooksClient) PingResponder(resp *http.Response) (result EventInfo, 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 webhook with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookUpdateParameters - the parameters for updating a webhook. -func (client WebhooksClient) Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (result WebhooksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-12-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookUpdateParameters), - 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 WebhooksClient) UpdateSender(req *http.Request) (future WebhooksUpdateFuture, 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 WebhooksClient) UpdateResponder(resp *http.Response) (result Webhook, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/CHANGELOG.md b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/CHANGELOG.md deleted file mode 100644 index 0712386d8839..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# Change History - -## Breaking Changes - -### Struct Changes - -#### Removed Structs - -1. StorageAccountProperties - -#### Removed Struct Fields - -1. RegistryProperties.StorageAccount - -## Additive Changes - -### Struct Changes - -#### New Structs - -1. OperationLogSpecificationDefinition - -#### New Struct Fields - -1. OperationServiceSpecificationDefinition.LogSpecifications -1. RegistryProperties.AnonymousPullEnabled -1. RegistryPropertiesUpdateParameters.AnonymousPullEnabled diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/_meta.json b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/_meta.json deleted file mode 100644 index 27c4c018e1d0..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "769e09cac92c50b1f9fa6468775b7cb7de16bb06", - "readme": "/_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "tag": "package-2020-11-preview", - "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-2020-11-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/agentpools.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/agentpools.go deleted file mode 100644 index 1ae5928434f8..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/agentpools.go +++ /dev/null @@ -1,634 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AgentPoolsClient is the client for the AgentPools methods of the Containerregistry service. -type AgentPoolsClient struct { - BaseClient -} - -// NewAgentPoolsClient creates an instance of the AgentPoolsClient client. -func NewAgentPoolsClient(subscriptionID string) AgentPoolsClient { - return NewAgentPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgentPoolsClientWithBaseURI creates an instance of the AgentPoolsClient 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 NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) AgentPoolsClient { - return AgentPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an agent pool for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -// agentPool - the parameters of an agent pool that needs to scheduled. -func (client AgentPoolsClient) Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (result AgentPoolsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, agentPoolName, agentPool) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AgentPoolsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(agentPool), - 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 AgentPoolsClient) CreateSender(req *http.Request) (future AgentPoolsCreateFuture, 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 AgentPoolsClient) CreateResponder(resp *http.Response) (result AgentPool, 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 a specified agent pool resource. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) DeleteSender(req *http.Request) (future AgentPoolsDeleteFuture, 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 AgentPoolsClient) 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 the detailed information for a given agent pool. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) 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 AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetQueueStatus gets the count of queued runs for a given agent pool. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolQueueStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetQueueStatus") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "GetQueueStatus", err.Error()) - } - - req, err := client.GetQueueStatusPreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetQueueStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure sending request") - return - } - - result, err = client.GetQueueStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetQueueStatusPreparer prepares the GetQueueStatus request. -func (client AgentPoolsClient) GetQueueStatusPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetQueueStatusSender sends the GetQueueStatus request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) GetQueueStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetQueueStatusResponder handles the response to the GetQueueStatus request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) GetQueueStatusResponder(resp *http.Response) (result AgentPoolQueueStatus, 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 the agent pools for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") - defer func() { - sc := -1 - if result.aplr.Response.Response != nil { - sc = result.aplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.aplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure sending request") - return - } - - result.aplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure responding to request") - return - } - if result.aplr.hasNextLink() && result.aplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools", 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 AgentPoolsClient) 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 AgentPoolsClient) ListResponder(resp *http.Response) (result AgentPoolListResult, 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 AgentPoolsClient) listNextResults(ctx context.Context, lastResults AgentPoolListResult) (result AgentPoolListResult, err error) { - req, err := lastResults.agentPoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "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, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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, registryName) - return -} - -// Update updates an agent pool with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -// updateParameters - the parameters for updating an agent pool. -func (client AgentPoolsClient) Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (result AgentPoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, agentPoolName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AgentPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 AgentPoolsClient) UpdateSender(req *http.Request) (future AgentPoolsUpdateFuture, 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 AgentPoolsClient) UpdateResponder(resp *http.Response) (result AgentPool, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/client.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/client.go deleted file mode 100644 index 79937e123765..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerregistry implements the Azure ARM Containerregistry service API version . -// -// -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Containerregistry - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerregistry. -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/containerregistry/mgmt/2020-11-01-preview/containerregistry/connectedregistries.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/connectedregistries.go deleted file mode 100644 index 308db53b0c13..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/connectedregistries.go +++ /dev/null @@ -1,652 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ConnectedRegistriesClient is the client for the ConnectedRegistries methods of the Containerregistry service. -type ConnectedRegistriesClient struct { - BaseClient -} - -// NewConnectedRegistriesClient creates an instance of the ConnectedRegistriesClient client. -func NewConnectedRegistriesClient(subscriptionID string) ConnectedRegistriesClient { - return NewConnectedRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectedRegistriesClientWithBaseURI creates an instance of the ConnectedRegistriesClient 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 NewConnectedRegistriesClientWithBaseURI(baseURI string, subscriptionID string) ConnectedRegistriesClient { - return ConnectedRegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a connected registry for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -// connectedRegistryCreateParameters - the parameters for creating a connectedRegistry. -func (client ConnectedRegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry) (result ConnectedRegistriesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryCreateParameters, - Constraints: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent.SyncProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent.SyncProperties.TokenID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent.SyncProperties.MessageTTL", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ConnectedRegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", pathParameters), - autorest.WithJSON(connectedRegistryCreateParameters), - 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 ConnectedRegistriesClient) CreateSender(req *http.Request) (future ConnectedRegistriesCreateFuture, 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 ConnectedRegistriesClient) CreateResponder(resp *http.Response) (result ConnectedRegistry, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Deactivate deactivates the connected registry instance. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -func (client ConnectedRegistriesClient) Deactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result ConnectedRegistriesDeactivateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.Deactivate") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Deactivate", err.Error()) - } - - req, err := client.DeactivatePreparer(ctx, resourceGroupName, registryName, connectedRegistryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Deactivate", nil, "Failure preparing request") - return - } - - result, err = client.DeactivateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Deactivate", result.Response(), "Failure sending request") - return - } - - return -} - -// DeactivatePreparer prepares the Deactivate request. -func (client ConnectedRegistriesClient) DeactivatePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeactivateSender sends the Deactivate request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectedRegistriesClient) DeactivateSender(req *http.Request) (future ConnectedRegistriesDeactivateFuture, 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 -} - -// DeactivateResponder handles the response to the Deactivate request. The method always -// closes the http.Response Body. -func (client ConnectedRegistriesClient) DeactivateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes a connected registry from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -func (client ConnectedRegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result ConnectedRegistriesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, connectedRegistryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectedRegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", 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 ConnectedRegistriesClient) DeleteSender(req *http.Request) (future ConnectedRegistriesDeleteFuture, 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 ConnectedRegistriesClient) 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 the properties of the connected registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -func (client ConnectedRegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result ConnectedRegistry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, connectedRegistryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectedRegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", 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 ConnectedRegistriesClient) 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 ConnectedRegistriesClient) GetResponder(resp *http.Response) (result ConnectedRegistry, 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 connected registries for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// filter - an OData filter expression that describes a subset of connectedRegistries to return. The parameters -// that can be filtered are parent.id (the resource id of the connectedRegistry parent), mode, and -// connectionState. The supported operator is eq. -func (client ConnectedRegistriesClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string) (result ConnectedRegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.List") - defer func() { - sc := -1 - if result.crlr.Response.Response != nil { - sc = result.crlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.crlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "List", resp, "Failure sending request") - return - } - - result.crlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "List", resp, "Failure responding to request") - return - } - if result.crlr.hasNextLink() && result.crlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ConnectedRegistriesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.ContainerRegistry/registries/{registryName}/connectedRegistries", 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 ConnectedRegistriesClient) 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 ConnectedRegistriesClient) ListResponder(resp *http.Response) (result ConnectedRegistryListResult, 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 ConnectedRegistriesClient) listNextResults(ctx context.Context, lastResults ConnectedRegistryListResult) (result ConnectedRegistryListResult, err error) { - req, err := lastResults.connectedRegistryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "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, "containerregistry.ConnectedRegistriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConnectedRegistriesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string) (result ConnectedRegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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, registryName, filter) - return -} - -// Update updates a connected registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -// connectedRegistryUpdateParameters - the parameters for updating a connectedRegistry. -func (client ConnectedRegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters) (result ConnectedRegistriesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ConnectedRegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", pathParameters), - autorest.WithJSON(connectedRegistryUpdateParameters), - 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 ConnectedRegistriesClient) UpdateSender(req *http.Request) (future ConnectedRegistriesUpdateFuture, 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 ConnectedRegistriesClient) UpdateResponder(resp *http.Response) (result ConnectedRegistry, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/containerregistryapi/interfaces.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/containerregistryapi/interfaces.go deleted file mode 100644 index 8e1d81951eb4..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/containerregistryapi/interfaces.go +++ /dev/null @@ -1,204 +0,0 @@ -package containerregistryapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/containerregistry/mgmt/2020-11-01-preview/containerregistry" -) - -// ConnectedRegistriesClientAPI contains the set of methods on the ConnectedRegistriesClient type. -type ConnectedRegistriesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters containerregistry.ConnectedRegistry) (result containerregistry.ConnectedRegistriesCreateFuture, err error) - Deactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result containerregistry.ConnectedRegistriesDeactivateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result containerregistry.ConnectedRegistriesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result containerregistry.ConnectedRegistry, err error) - List(ctx context.Context, resourceGroupName string, registryName string, filter string) (result containerregistry.ConnectedRegistryListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string) (result containerregistry.ConnectedRegistryListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters containerregistry.ConnectedRegistryUpdateParameters) (result containerregistry.ConnectedRegistriesUpdateFuture, err error) -} - -var _ ConnectedRegistriesClientAPI = (*containerregistry.ConnectedRegistriesClient)(nil) - -// ExportPipelinesClientAPI contains the set of methods on the ExportPipelinesClient type. -type ExportPipelinesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters containerregistry.ExportPipeline) (result containerregistry.ExportPipelinesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result containerregistry.ExportPipelinesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result containerregistry.ExportPipeline, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ExportPipelineListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ExportPipelineListResultIterator, err error) -} - -var _ ExportPipelinesClientAPI = (*containerregistry.ExportPipelinesClient)(nil) - -// RegistriesClientAPI contains the set of methods on the RegistriesClient type. -type RegistriesClientAPI interface { - CheckNameAvailability(ctx context.Context, registryNameCheckRequest containerregistry.RegistryNameCheckRequest) (result containerregistry.RegistryNameStatus, err error) - Create(ctx context.Context, resourceGroupName string, registryName string, registry containerregistry.Registry) (result containerregistry.RegistriesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistriesDeleteFuture, err error) - GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters containerregistry.GenerateCredentialsParameters) (result containerregistry.RegistriesGenerateCredentialsFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.Registry, err error) - GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.SourceUploadDefinition, err error) - ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters containerregistry.ImportImageParameters) (result containerregistry.RegistriesImportImageFuture, err error) - List(ctx context.Context) (result containerregistry.RegistryListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.RegistryListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultIterator, err error) - ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryListCredentialsResult, err error) - ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultPage, err error) - ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultIterator, err error) - ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryUsageListResult, err error) - RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters containerregistry.RegenerateCredentialParameters) (result containerregistry.RegistryListCredentialsResult, err error) - ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest containerregistry.BasicRunRequest) (result containerregistry.RegistriesScheduleRunFuture, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters containerregistry.RegistryUpdateParameters) (result containerregistry.RegistriesUpdateFuture, err error) -} - -var _ RegistriesClientAPI = (*containerregistry.RegistriesClient)(nil) - -// ImportPipelinesClientAPI contains the set of methods on the ImportPipelinesClient type. -type ImportPipelinesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters containerregistry.ImportPipeline) (result containerregistry.ImportPipelinesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result containerregistry.ImportPipelinesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result containerregistry.ImportPipeline, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ImportPipelineListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ImportPipelineListResultIterator, err error) -} - -var _ ImportPipelinesClientAPI = (*containerregistry.ImportPipelinesClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result containerregistry.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*containerregistry.OperationsClient)(nil) - -// PipelineRunsClientAPI contains the set of methods on the PipelineRunsClient type. -type PipelineRunsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters containerregistry.PipelineRun) (result containerregistry.PipelineRunsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result containerregistry.PipelineRunsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result containerregistry.PipelineRun, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PipelineRunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PipelineRunListResultIterator, err error) -} - -var _ PipelineRunsClientAPI = (*containerregistry.PipelineRunsClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection containerregistry.PrivateEndpointConnection) (result containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnection, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*containerregistry.PrivateEndpointConnectionsClient)(nil) - -// ReplicationsClientAPI contains the set of methods on the ReplicationsClient type. -type ReplicationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication containerregistry.Replication) (result containerregistry.ReplicationsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.ReplicationsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.Replication, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters containerregistry.ReplicationUpdateParameters) (result containerregistry.ReplicationsUpdateFuture, err error) -} - -var _ ReplicationsClientAPI = (*containerregistry.ReplicationsClient)(nil) - -// ScopeMapsClientAPI contains the set of methods on the ScopeMapsClient type. -type ScopeMapsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters containerregistry.ScopeMap) (result containerregistry.ScopeMapsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMapsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMap, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ScopeMapListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ScopeMapListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters containerregistry.ScopeMapUpdateParameters) (result containerregistry.ScopeMapsUpdateFuture, err error) -} - -var _ ScopeMapsClientAPI = (*containerregistry.ScopeMapsClient)(nil) - -// TokensClientAPI contains the set of methods on the TokensClient type. -type TokensClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters containerregistry.Token) (result containerregistry.TokensCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.TokensDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.Token, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TokenListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TokenListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters containerregistry.TokenUpdateParameters) (result containerregistry.TokensUpdateFuture, err error) -} - -var _ TokensClientAPI = (*containerregistry.TokensClient)(nil) - -// WebhooksClientAPI contains the set of methods on the WebhooksClient type. -type WebhooksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters containerregistry.WebhookCreateParameters) (result containerregistry.WebhooksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.WebhooksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.Webhook, err error) - GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.CallbackConfig, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultIterator, err error) - ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultPage, err error) - ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultIterator, err error) - Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventInfo, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters containerregistry.WebhookUpdateParameters) (result containerregistry.WebhooksUpdateFuture, err error) -} - -var _ WebhooksClientAPI = (*containerregistry.WebhooksClient)(nil) - -// AgentPoolsClientAPI contains the set of methods on the AgentPoolsClient type. -type AgentPoolsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool containerregistry.AgentPool) (result containerregistry.AgentPoolsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPool, err error) - GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolQueueStatus, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters containerregistry.AgentPoolUpdateParameters) (result containerregistry.AgentPoolsUpdateFuture, err error) -} - -var _ AgentPoolsClientAPI = (*containerregistry.AgentPoolsClient)(nil) - -// RunsClientAPI contains the set of methods on the RunsClient type. -type RunsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunsCancelFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.Run, err error) - GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunGetLogResult, err error) - List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters containerregistry.RunUpdateParameters) (result containerregistry.RunsUpdateFuture, err error) -} - -var _ RunsClientAPI = (*containerregistry.RunsClient)(nil) - -// TaskRunsClientAPI contains the set of methods on the TaskRunsClient type. -type TaskRunsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun containerregistry.TaskRun) (result containerregistry.TaskRunsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRunsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) - GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters containerregistry.TaskRunUpdateParameters) (result containerregistry.TaskRunsUpdateFuture, err error) -} - -var _ TaskRunsClientAPI = (*containerregistry.TaskRunsClient)(nil) - -// TasksClientAPI contains the set of methods on the TasksClient type. -type TasksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters containerregistry.Task) (result containerregistry.TasksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.TasksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) - GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters containerregistry.TaskUpdateParameters) (result containerregistry.TasksUpdateFuture, err error) -} - -var _ TasksClientAPI = (*containerregistry.TasksClient)(nil) diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/enums.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/enums.go deleted file mode 100644 index 809d217b24e2..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/enums.go +++ /dev/null @@ -1,880 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Action enumerates the values for action. -type Action string - -const ( - // Allow ... - Allow Action = "Allow" -) - -// PossibleActionValues returns an array of possible values for the Action const type. -func PossibleActionValues() []Action { - return []Action{Allow} -} - -// ActionsRequired enumerates the values for actions required. -type ActionsRequired string - -const ( - // None ... - None ActionsRequired = "None" - // Recreate ... - Recreate ActionsRequired = "Recreate" -) - -// PossibleActionsRequiredValues returns an array of possible values for the ActionsRequired const type. -func PossibleActionsRequiredValues() []ActionsRequired { - return []ActionsRequired{None, Recreate} -} - -// ActivationStatus enumerates the values for activation status. -type ActivationStatus string - -const ( - // Active ... - Active ActivationStatus = "Active" - // Inactive ... - Inactive ActivationStatus = "Inactive" -) - -// PossibleActivationStatusValues returns an array of possible values for the ActivationStatus const type. -func PossibleActivationStatusValues() []ActivationStatus { - return []ActivationStatus{Active, Inactive} -} - -// Architecture enumerates the values for architecture. -type Architecture string - -const ( - // Amd64 ... - Amd64 Architecture = "amd64" - // Arm ... - Arm Architecture = "arm" - // Arm64 ... - Arm64 Architecture = "arm64" - // ThreeEightSix ... - ThreeEightSix Architecture = "386" - // X86 ... - X86 Architecture = "x86" -) - -// PossibleArchitectureValues returns an array of possible values for the Architecture const type. -func PossibleArchitectureValues() []Architecture { - return []Architecture{Amd64, Arm, Arm64, ThreeEightSix, X86} -} - -// AuditLogStatus enumerates the values for audit log status. -type AuditLogStatus string - -const ( - // Disabled ... - Disabled AuditLogStatus = "Disabled" - // Enabled ... - Enabled AuditLogStatus = "Enabled" -) - -// PossibleAuditLogStatusValues returns an array of possible values for the AuditLogStatus const type. -func PossibleAuditLogStatusValues() []AuditLogStatus { - return []AuditLogStatus{Disabled, Enabled} -} - -// BaseImageDependencyType enumerates the values for base image dependency type. -type BaseImageDependencyType string - -const ( - // BuildTime ... - BuildTime BaseImageDependencyType = "BuildTime" - // RunTime ... - RunTime BaseImageDependencyType = "RunTime" -) - -// PossibleBaseImageDependencyTypeValues returns an array of possible values for the BaseImageDependencyType const type. -func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { - return []BaseImageDependencyType{BuildTime, RunTime} -} - -// BaseImageTriggerType enumerates the values for base image trigger type. -type BaseImageTriggerType string - -const ( - // All ... - All BaseImageTriggerType = "All" - // Runtime ... - Runtime BaseImageTriggerType = "Runtime" -) - -// PossibleBaseImageTriggerTypeValues returns an array of possible values for the BaseImageTriggerType const type. -func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { - return []BaseImageTriggerType{All, Runtime} -} - -// CertificateType enumerates the values for certificate type. -type CertificateType string - -const ( - // LocalDirectory ... - LocalDirectory CertificateType = "LocalDirectory" -) - -// PossibleCertificateTypeValues returns an array of possible values for the CertificateType const type. -func PossibleCertificateTypeValues() []CertificateType { - return []CertificateType{LocalDirectory} -} - -// ConnectedRegistryMode enumerates the values for connected registry mode. -type ConnectedRegistryMode string - -const ( - // ConnectedRegistryModeMirror ... - ConnectedRegistryModeMirror ConnectedRegistryMode = "Mirror" - // ConnectedRegistryModeRegistry ... - ConnectedRegistryModeRegistry ConnectedRegistryMode = "Registry" -) - -// PossibleConnectedRegistryModeValues returns an array of possible values for the ConnectedRegistryMode const type. -func PossibleConnectedRegistryModeValues() []ConnectedRegistryMode { - return []ConnectedRegistryMode{ConnectedRegistryModeMirror, ConnectedRegistryModeRegistry} -} - -// ConnectionState enumerates the values for connection state. -type ConnectionState string - -const ( - // Offline ... - Offline ConnectionState = "Offline" - // Online ... - Online ConnectionState = "Online" - // Syncing ... - Syncing ConnectionState = "Syncing" - // Unhealthy ... - Unhealthy ConnectionState = "Unhealthy" -) - -// PossibleConnectionStateValues returns an array of possible values for the ConnectionState const type. -func PossibleConnectionStateValues() []ConnectionState { - return []ConnectionState{Offline, Online, Syncing, Unhealthy} -} - -// ConnectionStatus enumerates the values for connection status. -type ConnectionStatus string - -const ( - // Approved ... - Approved ConnectionStatus = "Approved" - // Disconnected ... - Disconnected ConnectionStatus = "Disconnected" - // Pending ... - Pending ConnectionStatus = "Pending" - // Rejected ... - Rejected ConnectionStatus = "Rejected" -) - -// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. -func PossibleConnectionStatusValues() []ConnectionStatus { - return []ConnectionStatus{Approved, Disconnected, Pending, Rejected} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // Application ... - Application CreatedByType = "Application" - // Key ... - Key CreatedByType = "Key" - // ManagedIdentity ... - ManagedIdentity CreatedByType = "ManagedIdentity" - // User ... - User CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{Application, Key, ManagedIdentity, User} -} - -// DefaultAction enumerates the values for default action. -type DefaultAction string - -const ( - // DefaultActionAllow ... - DefaultActionAllow DefaultAction = "Allow" - // DefaultActionDeny ... - DefaultActionDeny DefaultAction = "Deny" -) - -// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. -func PossibleDefaultActionValues() []DefaultAction { - return []DefaultAction{DefaultActionAllow, DefaultActionDeny} -} - -// EncryptionStatus enumerates the values for encryption status. -type EncryptionStatus string - -const ( - // EncryptionStatusDisabled ... - EncryptionStatusDisabled EncryptionStatus = "disabled" - // EncryptionStatusEnabled ... - EncryptionStatusEnabled EncryptionStatus = "enabled" -) - -// PossibleEncryptionStatusValues returns an array of possible values for the EncryptionStatus const type. -func PossibleEncryptionStatusValues() []EncryptionStatus { - return []EncryptionStatus{EncryptionStatusDisabled, EncryptionStatusEnabled} -} - -// ImportMode enumerates the values for import mode. -type ImportMode string - -const ( - // Force ... - Force ImportMode = "Force" - // NoForce ... - NoForce ImportMode = "NoForce" -) - -// PossibleImportModeValues returns an array of possible values for the ImportMode const type. -func PossibleImportModeValues() []ImportMode { - return []ImportMode{Force, NoForce} -} - -// LastModifiedByType enumerates the values for last modified by type. -type LastModifiedByType string - -const ( - // LastModifiedByTypeApplication ... - LastModifiedByTypeApplication LastModifiedByType = "Application" - // LastModifiedByTypeKey ... - LastModifiedByTypeKey LastModifiedByType = "Key" - // LastModifiedByTypeManagedIdentity ... - LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" - // LastModifiedByTypeUser ... - LastModifiedByTypeUser LastModifiedByType = "User" -) - -// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. -func PossibleLastModifiedByTypeValues() []LastModifiedByType { - return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} -} - -// LogLevel enumerates the values for log level. -type LogLevel string - -const ( - // LogLevelDebug ... - LogLevelDebug LogLevel = "Debug" - // LogLevelError ... - LogLevelError LogLevel = "Error" - // LogLevelInformation ... - LogLevelInformation LogLevel = "Information" - // LogLevelNone ... - LogLevelNone LogLevel = "None" - // LogLevelWarning ... - LogLevelWarning LogLevel = "Warning" -) - -// PossibleLogLevelValues returns an array of possible values for the LogLevel const type. -func PossibleLogLevelValues() []LogLevel { - return []LogLevel{LogLevelDebug, LogLevelError, LogLevelInformation, LogLevelNone, LogLevelWarning} -} - -// NetworkRuleBypassOptions enumerates the values for network rule bypass options. -type NetworkRuleBypassOptions string - -const ( - // NetworkRuleBypassOptionsAzureServices ... - NetworkRuleBypassOptionsAzureServices NetworkRuleBypassOptions = "AzureServices" - // NetworkRuleBypassOptionsNone ... - NetworkRuleBypassOptionsNone NetworkRuleBypassOptions = "None" -) - -// PossibleNetworkRuleBypassOptionsValues returns an array of possible values for the NetworkRuleBypassOptions const type. -func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { - return []NetworkRuleBypassOptions{NetworkRuleBypassOptionsAzureServices, NetworkRuleBypassOptionsNone} -} - -// OS enumerates the values for os. -type OS string - -const ( - // Linux ... - Linux OS = "Linux" - // Windows ... - Windows OS = "Windows" -) - -// PossibleOSValues returns an array of possible values for the OS const type. -func PossibleOSValues() []OS { - return []OS{Linux, Windows} -} - -// PasswordName enumerates the values for password name. -type PasswordName string - -const ( - // Password ... - Password PasswordName = "password" - // Password2 ... - Password2 PasswordName = "password2" -) - -// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type. -func PossiblePasswordNameValues() []PasswordName { - return []PasswordName{Password, Password2} -} - -// PipelineOptions enumerates the values for pipeline options. -type PipelineOptions string - -const ( - // ContinueOnErrors ... - ContinueOnErrors PipelineOptions = "ContinueOnErrors" - // DeleteSourceBlobOnSuccess ... - DeleteSourceBlobOnSuccess PipelineOptions = "DeleteSourceBlobOnSuccess" - // OverwriteBlobs ... - OverwriteBlobs PipelineOptions = "OverwriteBlobs" - // OverwriteTags ... - OverwriteTags PipelineOptions = "OverwriteTags" -) - -// PossiblePipelineOptionsValues returns an array of possible values for the PipelineOptions const type. -func PossiblePipelineOptionsValues() []PipelineOptions { - return []PipelineOptions{ContinueOnErrors, DeleteSourceBlobOnSuccess, OverwriteBlobs, OverwriteTags} -} - -// PipelineRunSourceType enumerates the values for pipeline run source type. -type PipelineRunSourceType string - -const ( - // AzureStorageBlob ... - AzureStorageBlob PipelineRunSourceType = "AzureStorageBlob" -) - -// PossiblePipelineRunSourceTypeValues returns an array of possible values for the PipelineRunSourceType const type. -func PossiblePipelineRunSourceTypeValues() []PipelineRunSourceType { - return []PipelineRunSourceType{AzureStorageBlob} -} - -// PipelineRunTargetType enumerates the values for pipeline run target type. -type PipelineRunTargetType string - -const ( - // PipelineRunTargetTypeAzureStorageBlob ... - PipelineRunTargetTypeAzureStorageBlob PipelineRunTargetType = "AzureStorageBlob" -) - -// PossiblePipelineRunTargetTypeValues returns an array of possible values for the PipelineRunTargetType const type. -func PossiblePipelineRunTargetTypeValues() []PipelineRunTargetType { - return []PipelineRunTargetType{PipelineRunTargetTypeAzureStorageBlob} -} - -// PipelineSourceType enumerates the values for pipeline source type. -type PipelineSourceType string - -const ( - // AzureStorageBlobContainer ... - AzureStorageBlobContainer PipelineSourceType = "AzureStorageBlobContainer" -) - -// PossiblePipelineSourceTypeValues returns an array of possible values for the PipelineSourceType const type. -func PossiblePipelineSourceTypeValues() []PipelineSourceType { - return []PipelineSourceType{AzureStorageBlobContainer} -} - -// PolicyStatus enumerates the values for policy status. -type PolicyStatus string - -const ( - // PolicyStatusDisabled ... - PolicyStatusDisabled PolicyStatus = "disabled" - // PolicyStatusEnabled ... - PolicyStatusEnabled PolicyStatus = "enabled" -) - -// PossiblePolicyStatusValues returns an array of possible values for the PolicyStatus const type. -func PossiblePolicyStatusValues() []PolicyStatus { - return []PolicyStatus{PolicyStatusDisabled, PolicyStatusEnabled} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Creating ... - Creating ProvisioningState = "Creating" - // Deleting ... - Deleting ProvisioningState = "Deleting" - // Failed ... - Failed ProvisioningState = "Failed" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" - // Updating ... - Updating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// RegistryUsageUnit enumerates the values for registry usage unit. -type RegistryUsageUnit string - -const ( - // Bytes ... - Bytes RegistryUsageUnit = "Bytes" - // Count ... - Count RegistryUsageUnit = "Count" -) - -// PossibleRegistryUsageUnitValues returns an array of possible values for the RegistryUsageUnit const type. -func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { - return []RegistryUsageUnit{Bytes, Count} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// RunStatus enumerates the values for run status. -type RunStatus string - -const ( - // RunStatusCanceled ... - RunStatusCanceled RunStatus = "Canceled" - // RunStatusError ... - RunStatusError RunStatus = "Error" - // RunStatusFailed ... - RunStatusFailed RunStatus = "Failed" - // RunStatusQueued ... - RunStatusQueued RunStatus = "Queued" - // RunStatusRunning ... - RunStatusRunning RunStatus = "Running" - // RunStatusStarted ... - RunStatusStarted RunStatus = "Started" - // RunStatusSucceeded ... - RunStatusSucceeded RunStatus = "Succeeded" - // RunStatusTimeout ... - RunStatusTimeout RunStatus = "Timeout" -) - -// PossibleRunStatusValues returns an array of possible values for the RunStatus const type. -func PossibleRunStatusValues() []RunStatus { - return []RunStatus{RunStatusCanceled, RunStatusError, RunStatusFailed, RunStatusQueued, RunStatusRunning, RunStatusStarted, RunStatusSucceeded, RunStatusTimeout} -} - -// RunType enumerates the values for run type. -type RunType string - -const ( - // AutoBuild ... - AutoBuild RunType = "AutoBuild" - // AutoRun ... - AutoRun RunType = "AutoRun" - // QuickBuild ... - QuickBuild RunType = "QuickBuild" - // QuickRun ... - QuickRun RunType = "QuickRun" -) - -// PossibleRunTypeValues returns an array of possible values for the RunType const type. -func PossibleRunTypeValues() []RunType { - return []RunType{AutoBuild, AutoRun, QuickBuild, QuickRun} -} - -// SecretObjectType enumerates the values for secret object type. -type SecretObjectType string - -const ( - // Opaque ... - Opaque SecretObjectType = "Opaque" - // Vaultsecret ... - Vaultsecret SecretObjectType = "Vaultsecret" -) - -// PossibleSecretObjectTypeValues returns an array of possible values for the SecretObjectType const type. -func PossibleSecretObjectTypeValues() []SecretObjectType { - return []SecretObjectType{Opaque, Vaultsecret} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Basic ... - Basic SkuName = "Basic" - // Classic ... - Classic SkuName = "Classic" - // Premium ... - Premium SkuName = "Premium" - // Standard ... - Standard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{Basic, Classic, Premium, Standard} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic ... - SkuTierBasic SkuTier = "Basic" - // SkuTierClassic ... - SkuTierClassic SkuTier = "Classic" - // SkuTierPremium ... - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBasic, SkuTierClassic, SkuTierPremium, SkuTierStandard} -} - -// SourceControlType enumerates the values for source control type. -type SourceControlType string - -const ( - // Github ... - Github SourceControlType = "Github" - // VisualStudioTeamService ... - VisualStudioTeamService SourceControlType = "VisualStudioTeamService" -) - -// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. -func PossibleSourceControlTypeValues() []SourceControlType { - return []SourceControlType{Github, VisualStudioTeamService} -} - -// SourceRegistryLoginMode enumerates the values for source registry login mode. -type SourceRegistryLoginMode string - -const ( - // SourceRegistryLoginModeDefault ... - SourceRegistryLoginModeDefault SourceRegistryLoginMode = "Default" - // SourceRegistryLoginModeNone ... - SourceRegistryLoginModeNone SourceRegistryLoginMode = "None" -) - -// PossibleSourceRegistryLoginModeValues returns an array of possible values for the SourceRegistryLoginMode const type. -func PossibleSourceRegistryLoginModeValues() []SourceRegistryLoginMode { - return []SourceRegistryLoginMode{SourceRegistryLoginModeDefault, SourceRegistryLoginModeNone} -} - -// SourceTriggerEvent enumerates the values for source trigger event. -type SourceTriggerEvent string - -const ( - // Commit ... - Commit SourceTriggerEvent = "commit" - // Pullrequest ... - Pullrequest SourceTriggerEvent = "pullrequest" -) - -// PossibleSourceTriggerEventValues returns an array of possible values for the SourceTriggerEvent const type. -func PossibleSourceTriggerEventValues() []SourceTriggerEvent { - return []SourceTriggerEvent{Commit, Pullrequest} -} - -// TaskStatus enumerates the values for task status. -type TaskStatus string - -const ( - // TaskStatusDisabled ... - TaskStatusDisabled TaskStatus = "Disabled" - // TaskStatusEnabled ... - TaskStatusEnabled TaskStatus = "Enabled" -) - -// PossibleTaskStatusValues returns an array of possible values for the TaskStatus const type. -func PossibleTaskStatusValues() []TaskStatus { - return []TaskStatus{TaskStatusDisabled, TaskStatusEnabled} -} - -// TLSStatus enumerates the values for tls status. -type TLSStatus string - -const ( - // TLSStatusDisabled ... - TLSStatusDisabled TLSStatus = "Disabled" - // TLSStatusEnabled ... - TLSStatusEnabled TLSStatus = "Enabled" -) - -// PossibleTLSStatusValues returns an array of possible values for the TLSStatus const type. -func PossibleTLSStatusValues() []TLSStatus { - return []TLSStatus{TLSStatusDisabled, TLSStatusEnabled} -} - -// TokenCertificateName enumerates the values for token certificate name. -type TokenCertificateName string - -const ( - // Certificate1 ... - Certificate1 TokenCertificateName = "certificate1" - // Certificate2 ... - Certificate2 TokenCertificateName = "certificate2" -) - -// PossibleTokenCertificateNameValues returns an array of possible values for the TokenCertificateName const type. -func PossibleTokenCertificateNameValues() []TokenCertificateName { - return []TokenCertificateName{Certificate1, Certificate2} -} - -// TokenPasswordName enumerates the values for token password name. -type TokenPasswordName string - -const ( - // TokenPasswordNamePassword1 ... - TokenPasswordNamePassword1 TokenPasswordName = "password1" - // TokenPasswordNamePassword2 ... - TokenPasswordNamePassword2 TokenPasswordName = "password2" -) - -// PossibleTokenPasswordNameValues returns an array of possible values for the TokenPasswordName const type. -func PossibleTokenPasswordNameValues() []TokenPasswordName { - return []TokenPasswordName{TokenPasswordNamePassword1, TokenPasswordNamePassword2} -} - -// TokenStatus enumerates the values for token status. -type TokenStatus string - -const ( - // TokenStatusDisabled ... - TokenStatusDisabled TokenStatus = "disabled" - // TokenStatusEnabled ... - TokenStatusEnabled TokenStatus = "enabled" -) - -// PossibleTokenStatusValues returns an array of possible values for the TokenStatus const type. -func PossibleTokenStatusValues() []TokenStatus { - return []TokenStatus{TokenStatusDisabled, TokenStatusEnabled} -} - -// TokenType enumerates the values for token type. -type TokenType string - -const ( - // OAuth ... - OAuth TokenType = "OAuth" - // PAT ... - PAT TokenType = "PAT" -) - -// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. -func PossibleTokenTypeValues() []TokenType { - return []TokenType{OAuth, PAT} -} - -// TriggerStatus enumerates the values for trigger status. -type TriggerStatus string - -const ( - // TriggerStatusDisabled ... - TriggerStatusDisabled TriggerStatus = "Disabled" - // TriggerStatusEnabled ... - TriggerStatusEnabled TriggerStatus = "Enabled" -) - -// PossibleTriggerStatusValues returns an array of possible values for the TriggerStatus const type. -func PossibleTriggerStatusValues() []TriggerStatus { - return []TriggerStatus{TriggerStatusDisabled, TriggerStatusEnabled} -} - -// TrustPolicyType enumerates the values for trust policy type. -type TrustPolicyType string - -const ( - // Notary ... - Notary TrustPolicyType = "Notary" -) - -// PossibleTrustPolicyTypeValues returns an array of possible values for the TrustPolicyType const type. -func PossibleTrustPolicyTypeValues() []TrustPolicyType { - return []TrustPolicyType{Notary} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeDockerBuildRequest ... - TypeDockerBuildRequest Type = "DockerBuildRequest" - // TypeEncodedTaskRunRequest ... - TypeEncodedTaskRunRequest Type = "EncodedTaskRunRequest" - // TypeFileTaskRunRequest ... - TypeFileTaskRunRequest Type = "FileTaskRunRequest" - // TypeRunRequest ... - TypeRunRequest Type = "RunRequest" - // TypeTaskRunRequest ... - TypeTaskRunRequest Type = "TaskRunRequest" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeDockerBuildRequest, TypeEncodedTaskRunRequest, TypeFileTaskRunRequest, TypeRunRequest, TypeTaskRunRequest} -} - -// TypeBasicTaskStepProperties enumerates the values for type basic task step properties. -type TypeBasicTaskStepProperties string - -const ( - // TypeDocker ... - TypeDocker TypeBasicTaskStepProperties = "Docker" - // TypeEncodedTask ... - TypeEncodedTask TypeBasicTaskStepProperties = "EncodedTask" - // TypeFileTask ... - TypeFileTask TypeBasicTaskStepProperties = "FileTask" - // TypeTaskStepProperties ... - TypeTaskStepProperties TypeBasicTaskStepProperties = "TaskStepProperties" -) - -// PossibleTypeBasicTaskStepPropertiesValues returns an array of possible values for the TypeBasicTaskStepProperties const type. -func PossibleTypeBasicTaskStepPropertiesValues() []TypeBasicTaskStepProperties { - return []TypeBasicTaskStepProperties{TypeDocker, TypeEncodedTask, TypeFileTask, TypeTaskStepProperties} -} - -// TypeBasicTaskStepUpdateParameters enumerates the values for type basic task step update parameters. -type TypeBasicTaskStepUpdateParameters string - -const ( - // TypeBasicTaskStepUpdateParametersTypeDocker ... - TypeBasicTaskStepUpdateParametersTypeDocker TypeBasicTaskStepUpdateParameters = "Docker" - // TypeBasicTaskStepUpdateParametersTypeEncodedTask ... - TypeBasicTaskStepUpdateParametersTypeEncodedTask TypeBasicTaskStepUpdateParameters = "EncodedTask" - // TypeBasicTaskStepUpdateParametersTypeFileTask ... - TypeBasicTaskStepUpdateParametersTypeFileTask TypeBasicTaskStepUpdateParameters = "FileTask" - // TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters ... - TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters TypeBasicTaskStepUpdateParameters = "TaskStepUpdateParameters" -) - -// PossibleTypeBasicTaskStepUpdateParametersValues returns an array of possible values for the TypeBasicTaskStepUpdateParameters const type. -func PossibleTypeBasicTaskStepUpdateParametersValues() []TypeBasicTaskStepUpdateParameters { - return []TypeBasicTaskStepUpdateParameters{TypeBasicTaskStepUpdateParametersTypeDocker, TypeBasicTaskStepUpdateParametersTypeEncodedTask, TypeBasicTaskStepUpdateParametersTypeFileTask, TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters} -} - -// UpdateTriggerPayloadType enumerates the values for update trigger payload type. -type UpdateTriggerPayloadType string - -const ( - // UpdateTriggerPayloadTypeDefault ... - UpdateTriggerPayloadTypeDefault UpdateTriggerPayloadType = "Default" - // UpdateTriggerPayloadTypeToken ... - UpdateTriggerPayloadTypeToken UpdateTriggerPayloadType = "Token" -) - -// PossibleUpdateTriggerPayloadTypeValues returns an array of possible values for the UpdateTriggerPayloadType const type. -func PossibleUpdateTriggerPayloadTypeValues() []UpdateTriggerPayloadType { - return []UpdateTriggerPayloadType{UpdateTriggerPayloadTypeDefault, UpdateTriggerPayloadTypeToken} -} - -// Variant enumerates the values for variant. -type Variant string - -const ( - // V6 ... - V6 Variant = "v6" - // V7 ... - V7 Variant = "v7" - // V8 ... - V8 Variant = "v8" -) - -// PossibleVariantValues returns an array of possible values for the Variant const type. -func PossibleVariantValues() []Variant { - return []Variant{V6, V7, V8} -} - -// WebhookAction enumerates the values for webhook action. -type WebhookAction string - -const ( - // ChartDelete ... - ChartDelete WebhookAction = "chart_delete" - // ChartPush ... - ChartPush WebhookAction = "chart_push" - // Delete ... - Delete WebhookAction = "delete" - // Push ... - Push WebhookAction = "push" - // Quarantine ... - Quarantine WebhookAction = "quarantine" -) - -// PossibleWebhookActionValues returns an array of possible values for the WebhookAction const type. -func PossibleWebhookActionValues() []WebhookAction { - return []WebhookAction{ChartDelete, ChartPush, Delete, Push, Quarantine} -} - -// WebhookStatus enumerates the values for webhook status. -type WebhookStatus string - -const ( - // WebhookStatusDisabled ... - WebhookStatusDisabled WebhookStatus = "disabled" - // WebhookStatusEnabled ... - WebhookStatusEnabled WebhookStatus = "enabled" -) - -// PossibleWebhookStatusValues returns an array of possible values for the WebhookStatus const type. -func PossibleWebhookStatusValues() []WebhookStatus { - return []WebhookStatus{WebhookStatusDisabled, WebhookStatusEnabled} -} - -// ZoneRedundancy enumerates the values for zone redundancy. -type ZoneRedundancy string - -const ( - // ZoneRedundancyDisabled ... - ZoneRedundancyDisabled ZoneRedundancy = "Disabled" - // ZoneRedundancyEnabled ... - ZoneRedundancyEnabled ZoneRedundancy = "Enabled" -) - -// PossibleZoneRedundancyValues returns an array of possible values for the ZoneRedundancy const type. -func PossibleZoneRedundancyValues() []ZoneRedundancy { - return []ZoneRedundancy{ZoneRedundancyDisabled, ZoneRedundancyEnabled} -} diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/exportpipelines.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/exportpipelines.go deleted file mode 100644 index 10c15f94fc54..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/exportpipelines.go +++ /dev/null @@ -1,449 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ExportPipelinesClient is the client for the ExportPipelines methods of the Containerregistry service. -type ExportPipelinesClient struct { - BaseClient -} - -// NewExportPipelinesClient creates an instance of the ExportPipelinesClient client. -func NewExportPipelinesClient(subscriptionID string) ExportPipelinesClient { - return NewExportPipelinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExportPipelinesClientWithBaseURI creates an instance of the ExportPipelinesClient 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 NewExportPipelinesClientWithBaseURI(baseURI string, subscriptionID string) ExportPipelinesClient { - return ExportPipelinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an export pipeline for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// exportPipelineName - the name of the export pipeline. -// exportPipelineCreateParameters - the parameters for creating an export pipeline. -func (client ExportPipelinesClient) Create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline) (result ExportPipelinesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineName, - Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineCreateParameters, - Constraints: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties.Target", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties.Target.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ExportPipelinesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportPipelineName": autorest.Encode("path", exportPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", pathParameters), - autorest.WithJSON(exportPipelineCreateParameters), - 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 ExportPipelinesClient) CreateSender(req *http.Request) (future ExportPipelinesCreateFuture, 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 ExportPipelinesClient) CreateResponder(resp *http.Response) (result ExportPipeline, 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 export pipeline from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// exportPipelineName - the name of the export pipeline. -func (client ExportPipelinesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result ExportPipelinesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineName, - Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, exportPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ExportPipelinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportPipelineName": autorest.Encode("path", exportPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", 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 ExportPipelinesClient) DeleteSender(req *http.Request) (future ExportPipelinesDeleteFuture, 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 ExportPipelinesClient) 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 the properties of the export pipeline. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// exportPipelineName - the name of the export pipeline. -func (client ExportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result ExportPipeline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineName, - Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, exportPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExportPipelinesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportPipelineName": autorest.Encode("path", exportPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", 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 ExportPipelinesClient) 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 ExportPipelinesClient) GetResponder(resp *http.Response) (result ExportPipeline, 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 export pipelines for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ExportPipelinesClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ExportPipelineListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.List") - defer func() { - sc := -1 - if result.eplr.Response.Response != nil { - sc = result.eplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.eplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", resp, "Failure sending request") - return - } - - result.eplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", resp, "Failure responding to request") - return - } - if result.eplr.hasNextLink() && result.eplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ExportPipelinesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/exportPipelines", 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 ExportPipelinesClient) 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 ExportPipelinesClient) ListResponder(resp *http.Response) (result ExportPipelineListResult, 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 ExportPipelinesClient) listNextResults(ctx context.Context, lastResults ExportPipelineListResult) (result ExportPipelineListResult, err error) { - req, err := lastResults.exportPipelineListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "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, "containerregistry.ExportPipelinesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExportPipelinesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ExportPipelineListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/importpipelines.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/importpipelines.go deleted file mode 100644 index ced88f5ab70d..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/importpipelines.go +++ /dev/null @@ -1,449 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ImportPipelinesClient is the client for the ImportPipelines methods of the Containerregistry service. -type ImportPipelinesClient struct { - BaseClient -} - -// NewImportPipelinesClient creates an instance of the ImportPipelinesClient client. -func NewImportPipelinesClient(subscriptionID string) ImportPipelinesClient { - return NewImportPipelinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewImportPipelinesClientWithBaseURI creates an instance of the ImportPipelinesClient 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 NewImportPipelinesClientWithBaseURI(baseURI string, subscriptionID string) ImportPipelinesClient { - return ImportPipelinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an import pipeline for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// importPipelineName - the name of the import pipeline. -// importPipelineCreateParameters - the parameters for creating an import pipeline. -func (client ImportPipelinesClient) Create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline) (result ImportPipelinesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineName, - Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineCreateParameters, - Constraints: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties.Source.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ImportPipelinesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "importPipelineName": autorest.Encode("path", importPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", pathParameters), - autorest.WithJSON(importPipelineCreateParameters), - 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 ImportPipelinesClient) CreateSender(req *http.Request) (future ImportPipelinesCreateFuture, 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 ImportPipelinesClient) CreateResponder(resp *http.Response) (result ImportPipeline, 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 import pipeline from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// importPipelineName - the name of the import pipeline. -func (client ImportPipelinesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result ImportPipelinesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineName, - Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, importPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ImportPipelinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "importPipelineName": autorest.Encode("path", importPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", 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 ImportPipelinesClient) DeleteSender(req *http.Request) (future ImportPipelinesDeleteFuture, 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 ImportPipelinesClient) 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 the properties of the import pipeline. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// importPipelineName - the name of the import pipeline. -func (client ImportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result ImportPipeline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineName, - Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, importPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ImportPipelinesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "importPipelineName": autorest.Encode("path", importPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", 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 ImportPipelinesClient) 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 ImportPipelinesClient) GetResponder(resp *http.Response) (result ImportPipeline, 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 import pipelines for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ImportPipelinesClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ImportPipelineListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.List") - defer func() { - sc := -1 - if result.iplr.Response.Response != nil { - sc = result.iplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", resp, "Failure sending request") - return - } - - result.iplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", resp, "Failure responding to request") - return - } - if result.iplr.hasNextLink() && result.iplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ImportPipelinesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/importPipelines", 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 ImportPipelinesClient) 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 ImportPipelinesClient) ListResponder(resp *http.Response) (result ImportPipelineListResult, 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 ImportPipelinesClient) listNextResults(ctx context.Context, lastResults ImportPipelineListResult) (result ImportPipelineListResult, err error) { - req, err := lastResults.importPipelineListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "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, "containerregistry.ImportPipelinesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ImportPipelinesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ImportPipelineListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/models.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/models.go deleted file mode 100644 index 5bbd67e27655..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/models.go +++ /dev/null @@ -1,10052 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry" - -// ActivationProperties the activation properties of the connected registry. -type ActivationProperties struct { - // Status - READ-ONLY; The activation status of the connected registry. Possible values include: 'Active', 'Inactive' - Status ActivationStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivationProperties. -func (ap ActivationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ActiveDirectoryObject the Active Directory Object that will be used for authenticating the token of a -// container registry. -type ActiveDirectoryObject struct { - // ObjectID - The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container registry. - ObjectID *string `json:"objectId,omitempty"` - // TenantID - The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of a container registry. - TenantID *string `json:"tenantId,omitempty"` -} - -// Actor the agent that initiated the event. For most situations, this could be from the authorization -// context of the request. -type Actor struct { - // Name - The subject or username associated with the request context that generated the event. - Name *string `json:"name,omitempty"` -} - -// AgentPool the agentpool that has the ARM resource and properties. -// The agentpool will have all information to create an agent pool. -type AgentPool struct { - autorest.Response `json:"-"` - // AgentPoolProperties - The properties associated with the agent pool - *AgentPoolProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPool. -func (ap AgentPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.AgentPoolProperties != nil { - objectMap["properties"] = ap.AgentPoolProperties - } - if ap.Location != nil { - objectMap["location"] = ap.Location - } - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPool struct. -func (ap *AgentPool) 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 agentPoolProperties AgentPoolProperties - err = json.Unmarshal(*v, &agentPoolProperties) - if err != nil { - return err - } - ap.AgentPoolProperties = &agentPoolProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ap.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ap.SystemData = &systemData - } - } - } - - return nil -} - -// AgentPoolListResult the collection of agent pools. -type AgentPoolListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]AgentPool `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. -type AgentPoolListResultIterator struct { - i int - page AgentPoolListResultPage -} - -// 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 *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.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 *AgentPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AgentPoolListResultIterator) 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 AgentPoolListResultIterator) Response() AgentPoolListResult { - 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 AgentPoolListResultIterator) Value() AgentPool { - if !iter.page.NotDone() { - return AgentPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AgentPoolListResultIterator type. -func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { - return AgentPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aplr AgentPoolListResult) IsEmpty() bool { - return aplr.Value == nil || len(*aplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aplr AgentPoolListResult) hasNextLink() bool { - return aplr.NextLink != nil && len(*aplr.NextLink) != 0 -} - -// agentPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aplr.NextLink))) -} - -// AgentPoolListResultPage contains a page of AgentPool values. -type AgentPoolListResultPage struct { - fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) - aplr AgentPoolListResult -} - -// 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 *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.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.aplr) - if err != nil { - return err - } - page.aplr = 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 *AgentPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AgentPoolListResultPage) NotDone() bool { - return !page.aplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AgentPoolListResultPage) Response() AgentPoolListResult { - return page.aplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AgentPoolListResultPage) Values() []AgentPool { - if page.aplr.IsEmpty() { - return nil - } - return *page.aplr.Value -} - -// Creates a new instance of the AgentPoolListResultPage type. -func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { - return AgentPoolListResultPage{ - fn: getNextPage, - aplr: cur, - } -} - -// AgentPoolProperties the properties of agent pool. -type AgentPoolProperties struct { - // Count - The count of agent machine - Count *int32 `json:"count,omitempty"` - // Tier - The Tier of agent machine - Tier *string `json:"tier,omitempty"` - // Os - The OS of agent machine. Possible values include: 'Windows', 'Linux' - Os OS `json:"os,omitempty"` - // VirtualNetworkSubnetResourceID - The Virtual Network Subnet Resource Id of the agent machine - VirtualNetworkSubnetResourceID *string `json:"virtualNetworkSubnetResourceId,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of this agent pool. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolProperties. -func (app AgentPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if app.Count != nil { - objectMap["count"] = app.Count - } - if app.Tier != nil { - objectMap["tier"] = app.Tier - } - if app.Os != "" { - objectMap["os"] = app.Os - } - if app.VirtualNetworkSubnetResourceID != nil { - objectMap["virtualNetworkSubnetResourceId"] = app.VirtualNetworkSubnetResourceID - } - return json.Marshal(objectMap) -} - -// AgentPoolPropertiesUpdateParameters ... -type AgentPoolPropertiesUpdateParameters struct { - // Count - The count of agent machine - Count *int32 `json:"count,omitempty"` -} - -// AgentPoolQueueStatus the QueueStatus of Agent Pool -type AgentPoolQueueStatus struct { - autorest.Response `json:"-"` - // Count - The number of pending runs in the queue - Count *int32 `json:"count,omitempty"` -} - -// AgentPoolsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsCreateFuture) 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 AgentPoolsCreateFuture.Result. -func (future *AgentPoolsCreateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.CreateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsDeleteFuture) 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 AgentPoolsDeleteFuture.Result. -func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AgentPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsUpdateFuture) 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 AgentPoolsUpdateFuture.Result. -func (future *AgentPoolsUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.UpdateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolUpdateParameters the parameters for updating an agent pool. -type AgentPoolUpdateParameters struct { - // AgentPoolPropertiesUpdateParameters - The properties associated with the agent pool - *AgentPoolPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AgentPoolUpdateParameters. -func (apup AgentPoolUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apup.AgentPoolPropertiesUpdateParameters != nil { - objectMap["properties"] = apup.AgentPoolPropertiesUpdateParameters - } - if apup.Tags != nil { - objectMap["tags"] = apup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPoolUpdateParameters struct. -func (apup *AgentPoolUpdateParameters) 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 agentPoolPropertiesUpdateParameters AgentPoolPropertiesUpdateParameters - err = json.Unmarshal(*v, &agentPoolPropertiesUpdateParameters) - if err != nil { - return err - } - apup.AgentPoolPropertiesUpdateParameters = &agentPoolPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - apup.Tags = tags - } - } - } - - return nil -} - -// AgentProperties the properties that determine the run agent configuration. -type AgentProperties struct { - // CPU - The CPU configuration in terms of number of cores required for the run. - CPU *int32 `json:"cpu,omitempty"` -} - -// Argument the properties of a run argument. -type Argument struct { - // Name - The name of the argument. - Name *string `json:"name,omitempty"` - // Value - The value of the argument. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// AuthInfo the authorization properties for accessing the source code repository. -type AuthInfo struct { - // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' - TokenType TokenType `json:"tokenType,omitempty"` - // Token - The access token used to access the source control provider. - Token *string `json:"token,omitempty"` - // RefreshToken - The refresh token used to refresh the access token. - RefreshToken *string `json:"refreshToken,omitempty"` - // Scope - The scope of the access token. - Scope *string `json:"scope,omitempty"` - // ExpiresIn - Time in seconds that the token remains valid - ExpiresIn *int32 `json:"expiresIn,omitempty"` -} - -// AuthInfoUpdateParameters the authorization properties for accessing the source code repository. -type AuthInfoUpdateParameters struct { - // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' - TokenType TokenType `json:"tokenType,omitempty"` - // Token - The access token used to access the source control provider. - Token *string `json:"token,omitempty"` - // RefreshToken - The refresh token used to refresh the access token. - RefreshToken *string `json:"refreshToken,omitempty"` - // Scope - The scope of the access token. - Scope *string `json:"scope,omitempty"` - // ExpiresIn - Time in seconds that the token remains valid - ExpiresIn *int32 `json:"expiresIn,omitempty"` -} - -// BaseImageDependency properties that describe a base image dependency. -type BaseImageDependency struct { - // Type - The type of the base image dependency. Possible values include: 'BuildTime', 'RunTime' - Type BaseImageDependencyType `json:"type,omitempty"` - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// BaseImageTrigger the trigger based on base image dependency. -type BaseImageTrigger struct { - // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime' - BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` - // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' - UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// BaseImageTriggerUpdateParameters the properties for updating base image dependency trigger. -type BaseImageTriggerUpdateParameters struct { - // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime' - BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` - // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' - UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// CallbackConfig the configuration of service URI and custom headers for the webhook. -type CallbackConfig struct { - autorest.Response `json:"-"` - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` -} - -// MarshalJSON is the custom marshaler for CallbackConfig. -func (cc CallbackConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.ServiceURI != nil { - objectMap["serviceUri"] = cc.ServiceURI - } - if cc.CustomHeaders != nil { - objectMap["customHeaders"] = cc.CustomHeaders - } - return json.Marshal(objectMap) -} - -// ConnectedRegistriesCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectedRegistriesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectedRegistriesClient) (ConnectedRegistry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectedRegistriesCreateFuture) 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 ConnectedRegistriesCreateFuture.Result. -func (future *ConnectedRegistriesCreateFuture) result(client ConnectedRegistriesClient) (cr ConnectedRegistry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { - cr, err = client.CreateResponder(cr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesCreateFuture", "Result", cr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConnectedRegistriesDeactivateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectedRegistriesDeactivateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectedRegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectedRegistriesDeactivateFuture) 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 ConnectedRegistriesDeactivateFuture.Result. -func (future *ConnectedRegistriesDeactivateFuture) result(client ConnectedRegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesDeactivateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesDeactivateFuture") - return - } - ar.Response = future.Response() - return -} - -// ConnectedRegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectedRegistriesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectedRegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectedRegistriesDeleteFuture) 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 ConnectedRegistriesDeleteFuture.Result. -func (future *ConnectedRegistriesDeleteFuture) result(client ConnectedRegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ConnectedRegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectedRegistriesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectedRegistriesClient) (ConnectedRegistry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectedRegistriesUpdateFuture) 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 ConnectedRegistriesUpdateFuture.Result. -func (future *ConnectedRegistriesUpdateFuture) result(client ConnectedRegistriesClient) (cr ConnectedRegistry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { - cr, err = client.UpdateResponder(cr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConnectedRegistry an object that represents a connected registry for a container registry. -type ConnectedRegistry struct { - autorest.Response `json:"-"` - // ConnectedRegistryProperties - The properties of the connected registry. - *ConnectedRegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectedRegistry. -func (cr ConnectedRegistry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cr.ConnectedRegistryProperties != nil { - objectMap["properties"] = cr.ConnectedRegistryProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectedRegistry struct. -func (cr *ConnectedRegistry) 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 connectedRegistryProperties ConnectedRegistryProperties - err = json.Unmarshal(*v, &connectedRegistryProperties) - if err != nil { - return err - } - cr.ConnectedRegistryProperties = &connectedRegistryProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - cr.SystemData = &systemData - } - } - } - - return nil -} - -// ConnectedRegistryListResult the result of a request to list connected registries for a container -// registry. -type ConnectedRegistryListResult struct { - autorest.Response `json:"-"` - // Value - The list of connected registries. Since this list may be incomplete, the nextLink field should be used to request the next list of connected registries. - Value *[]ConnectedRegistry `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of connected registries. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectedRegistryListResultIterator provides access to a complete listing of ConnectedRegistry values. -type ConnectedRegistryListResultIterator struct { - i int - page ConnectedRegistryListResultPage -} - -// 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 *ConnectedRegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistryListResultIterator.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 *ConnectedRegistryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectedRegistryListResultIterator) 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 ConnectedRegistryListResultIterator) Response() ConnectedRegistryListResult { - 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 ConnectedRegistryListResultIterator) Value() ConnectedRegistry { - if !iter.page.NotDone() { - return ConnectedRegistry{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectedRegistryListResultIterator type. -func NewConnectedRegistryListResultIterator(page ConnectedRegistryListResultPage) ConnectedRegistryListResultIterator { - return ConnectedRegistryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (crlr ConnectedRegistryListResult) IsEmpty() bool { - return crlr.Value == nil || len(*crlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (crlr ConnectedRegistryListResult) hasNextLink() bool { - return crlr.NextLink != nil && len(*crlr.NextLink) != 0 -} - -// connectedRegistryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (crlr ConnectedRegistryListResult) connectedRegistryListResultPreparer(ctx context.Context) (*http.Request, error) { - if !crlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(crlr.NextLink))) -} - -// ConnectedRegistryListResultPage contains a page of ConnectedRegistry values. -type ConnectedRegistryListResultPage struct { - fn func(context.Context, ConnectedRegistryListResult) (ConnectedRegistryListResult, error) - crlr ConnectedRegistryListResult -} - -// 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 *ConnectedRegistryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistryListResultPage.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.crlr) - if err != nil { - return err - } - page.crlr = 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 *ConnectedRegistryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectedRegistryListResultPage) NotDone() bool { - return !page.crlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectedRegistryListResultPage) Response() ConnectedRegistryListResult { - return page.crlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectedRegistryListResultPage) Values() []ConnectedRegistry { - if page.crlr.IsEmpty() { - return nil - } - return *page.crlr.Value -} - -// Creates a new instance of the ConnectedRegistryListResultPage type. -func NewConnectedRegistryListResultPage(cur ConnectedRegistryListResult, getNextPage func(context.Context, ConnectedRegistryListResult) (ConnectedRegistryListResult, error)) ConnectedRegistryListResultPage { - return ConnectedRegistryListResultPage{ - fn: getNextPage, - crlr: cur, - } -} - -// ConnectedRegistryProperties the properties of a connected registry. -type ConnectedRegistryProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Mode - The mode of the connected registry resource that indicates the permissions of the registry. Possible values include: 'ConnectedRegistryModeRegistry', 'ConnectedRegistryModeMirror' - Mode ConnectedRegistryMode `json:"mode,omitempty"` - // Version - READ-ONLY; The current version of ACR runtime on the connected registry. - Version *string `json:"version,omitempty"` - // ConnectionState - READ-ONLY; The current connection state of the connected registry. Possible values include: 'Online', 'Offline', 'Syncing', 'Unhealthy' - ConnectionState ConnectionState `json:"connectionState,omitempty"` - // LastActivityTime - READ-ONLY; The last activity time of the connected registry. - LastActivityTime *date.Time `json:"lastActivityTime,omitempty"` - // Activation - READ-ONLY; The activation properties of the connected registry. - Activation *ActivationProperties `json:"activation,omitempty"` - // Parent - The parent of the connected registry. - Parent *ParentProperties `json:"parent,omitempty"` - // ClientTokenIds - The list of the ACR token resource IDs used to authenticate clients to the connected registry. - ClientTokenIds *[]string `json:"clientTokenIds,omitempty"` - // LoginServer - The login server properties of the connected registry. - LoginServer *LoginServerProperties `json:"loginServer,omitempty"` - // Logging - The logging properties of the connected registry. - Logging *LoggingProperties `json:"logging,omitempty"` - // StatusDetails - READ-ONLY; The list of current statuses of the connected registry. - StatusDetails *[]StatusDetailProperties `json:"statusDetails,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectedRegistryProperties. -func (crp ConnectedRegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if crp.Mode != "" { - objectMap["mode"] = crp.Mode - } - if crp.Parent != nil { - objectMap["parent"] = crp.Parent - } - if crp.ClientTokenIds != nil { - objectMap["clientTokenIds"] = crp.ClientTokenIds - } - if crp.LoginServer != nil { - objectMap["loginServer"] = crp.LoginServer - } - if crp.Logging != nil { - objectMap["logging"] = crp.Logging - } - return json.Marshal(objectMap) -} - -// ConnectedRegistryUpdateParameters the parameters for updating a connected registry. -type ConnectedRegistryUpdateParameters struct { - // ConnectedRegistryUpdateProperties - The properties of the connected registry update parameters. - *ConnectedRegistryUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectedRegistryUpdateParameters. -func (crup ConnectedRegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if crup.ConnectedRegistryUpdateProperties != nil { - objectMap["properties"] = crup.ConnectedRegistryUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectedRegistryUpdateParameters struct. -func (crup *ConnectedRegistryUpdateParameters) 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 connectedRegistryUpdateProperties ConnectedRegistryUpdateProperties - err = json.Unmarshal(*v, &connectedRegistryUpdateProperties) - if err != nil { - return err - } - crup.ConnectedRegistryUpdateProperties = &connectedRegistryUpdateProperties - } - } - } - - return nil -} - -// ConnectedRegistryUpdateProperties the parameters for updating token properties. -type ConnectedRegistryUpdateProperties struct { - // SyncProperties - The sync properties of the connected registry with its parent. - SyncProperties *SyncUpdateProperties `json:"syncProperties,omitempty"` - // Logging - The logging properties of the connected registry. - Logging *LoggingProperties `json:"logging,omitempty"` - // ClientTokenIds - The list of the ACR token resource IDs used to authenticate clients to the connected registry. - ClientTokenIds *[]string `json:"clientTokenIds,omitempty"` -} - -// Credentials the parameters that describes a set of credentials that will be used when a run is invoked. -type Credentials struct { - // SourceRegistry - Describes the credential parameters for accessing the source registry. - SourceRegistry *SourceRegistryCredentials `json:"sourceRegistry,omitempty"` - // CustomRegistries - Describes the credential parameters for accessing other custom registries. The key - // for the dictionary item will be the registry login server (myregistry.azurecr.io) and - // the value of the item will be the registry credentials for accessing the registry. - CustomRegistries map[string]*CustomRegistryCredentials `json:"customRegistries"` -} - -// MarshalJSON is the custom marshaler for Credentials. -func (c Credentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.SourceRegistry != nil { - objectMap["sourceRegistry"] = c.SourceRegistry - } - if c.CustomRegistries != nil { - objectMap["customRegistries"] = c.CustomRegistries - } - return json.Marshal(objectMap) -} - -// CustomRegistryCredentials describes the credentials that will be used to access a custom registry during -// a run. -type CustomRegistryCredentials struct { - // UserName - The username for logging into the custom registry. - UserName *SecretObject `json:"userName,omitempty"` - // Password - The password for logging into the custom registry. The password is a secret - // object that allows multiple ways of providing the value for it. - Password *SecretObject `json:"password,omitempty"` - // Identity - Indicates the managed identity assigned to the custom credential. If a user-assigned identity - // this value is the Client ID. If a system-assigned identity, the value will be `system`. In - // the case of a system-assigned identity, the Client ID will be determined by the runner. This - // identity may be used to authenticate to key vault to retrieve credentials or it may be the only - // source of authentication used for accessing the registry. - Identity *string `json:"identity,omitempty"` -} - -// DockerBuildRequest the parameters for a docker quick build. -type DockerBuildRequest struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source location. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Arguments - The collection of override arguments to be used when executing the run. - Arguments *[]Argument `json:"arguments,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildRequest. -func (dbr DockerBuildRequest) MarshalJSON() ([]byte, error) { - dbr.Type = TypeDockerBuildRequest - objectMap := make(map[string]interface{}) - if dbr.ImageNames != nil { - objectMap["imageNames"] = dbr.ImageNames - } - if dbr.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbr.IsPushEnabled - } - if dbr.NoCache != nil { - objectMap["noCache"] = dbr.NoCache - } - if dbr.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbr.DockerFilePath - } - if dbr.Target != nil { - objectMap["target"] = dbr.Target - } - if dbr.Arguments != nil { - objectMap["arguments"] = dbr.Arguments - } - if dbr.Timeout != nil { - objectMap["timeout"] = dbr.Timeout - } - if dbr.Platform != nil { - objectMap["platform"] = dbr.Platform - } - if dbr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = dbr.AgentConfiguration - } - if dbr.SourceLocation != nil { - objectMap["sourceLocation"] = dbr.SourceLocation - } - if dbr.Credentials != nil { - objectMap["credentials"] = dbr.Credentials - } - if dbr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = dbr.IsArchiveEnabled - } - if dbr.AgentPoolName != nil { - objectMap["agentPoolName"] = dbr.AgentPoolName - } - if dbr.LogTemplate != nil { - objectMap["logTemplate"] = dbr.LogTemplate - } - if dbr.Type != "" { - objectMap["type"] = dbr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return &dbr, true -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &dbr, true -} - -// DockerBuildStep the Docker build step. -type DockerBuildStep struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source context. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Arguments - The collection of override arguments to be used when executing this build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStep. -func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) { - dbs.Type = TypeDocker - objectMap := make(map[string]interface{}) - if dbs.ImageNames != nil { - objectMap["imageNames"] = dbs.ImageNames - } - if dbs.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbs.IsPushEnabled - } - if dbs.NoCache != nil { - objectMap["noCache"] = dbs.NoCache - } - if dbs.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbs.DockerFilePath - } - if dbs.Target != nil { - objectMap["target"] = dbs.Target - } - if dbs.Arguments != nil { - objectMap["arguments"] = dbs.Arguments - } - if dbs.ContextPath != nil { - objectMap["contextPath"] = dbs.ContextPath - } - if dbs.ContextAccessToken != nil { - objectMap["contextAccessToken"] = dbs.ContextAccessToken - } - if dbs.Type != "" { - objectMap["type"] = dbs.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return &dbs, true -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &dbs, true -} - -// DockerBuildStepUpdateParameters the properties for updating a docker build step. -type DockerBuildStepUpdateParameters struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source context. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Arguments - The collection of override arguments to be used when executing this build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { - dbsup.Type = TypeBasicTaskStepUpdateParametersTypeDocker - objectMap := make(map[string]interface{}) - if dbsup.ImageNames != nil { - objectMap["imageNames"] = dbsup.ImageNames - } - if dbsup.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbsup.IsPushEnabled - } - if dbsup.NoCache != nil { - objectMap["noCache"] = dbsup.NoCache - } - if dbsup.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbsup.DockerFilePath - } - if dbsup.Arguments != nil { - objectMap["arguments"] = dbsup.Arguments - } - if dbsup.Target != nil { - objectMap["target"] = dbsup.Target - } - if dbsup.ContextPath != nil { - objectMap["contextPath"] = dbsup.ContextPath - } - if dbsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = dbsup.ContextAccessToken - } - if dbsup.Type != "" { - objectMap["type"] = dbsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return &dbsup, true -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &dbsup, true -} - -// EncodedTaskRunRequest the parameters for a quick task run request. -type EncodedTaskRunRequest struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { - etrr.Type = TypeEncodedTaskRunRequest - objectMap := make(map[string]interface{}) - if etrr.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = etrr.EncodedTaskContent - } - if etrr.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = etrr.EncodedValuesContent - } - if etrr.Values != nil { - objectMap["values"] = etrr.Values - } - if etrr.Timeout != nil { - objectMap["timeout"] = etrr.Timeout - } - if etrr.Platform != nil { - objectMap["platform"] = etrr.Platform - } - if etrr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = etrr.AgentConfiguration - } - if etrr.SourceLocation != nil { - objectMap["sourceLocation"] = etrr.SourceLocation - } - if etrr.Credentials != nil { - objectMap["credentials"] = etrr.Credentials - } - if etrr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = etrr.IsArchiveEnabled - } - if etrr.AgentPoolName != nil { - objectMap["agentPoolName"] = etrr.AgentPoolName - } - if etrr.LogTemplate != nil { - objectMap["logTemplate"] = etrr.LogTemplate - } - if etrr.Type != "" { - objectMap["type"] = etrr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return &etrr, true -} - -// AsRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &etrr, true -} - -// EncodedTaskStep the properties of a encoded task step. -type EncodedTaskStep struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskStep. -func (ets EncodedTaskStep) MarshalJSON() ([]byte, error) { - ets.Type = TypeEncodedTask - objectMap := make(map[string]interface{}) - if ets.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = ets.EncodedTaskContent - } - if ets.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = ets.EncodedValuesContent - } - if ets.Values != nil { - objectMap["values"] = ets.Values - } - if ets.ContextPath != nil { - objectMap["contextPath"] = ets.ContextPath - } - if ets.ContextAccessToken != nil { - objectMap["contextAccessToken"] = ets.ContextAccessToken - } - if ets.Type != "" { - objectMap["type"] = ets.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return &ets, true -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &ets, true -} - -// EncodedTaskStepUpdateParameters the properties for updating encoded task step. -type EncodedTaskStepUpdateParameters struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - etsup.Type = TypeBasicTaskStepUpdateParametersTypeEncodedTask - objectMap := make(map[string]interface{}) - if etsup.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = etsup.EncodedTaskContent - } - if etsup.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = etsup.EncodedValuesContent - } - if etsup.Values != nil { - objectMap["values"] = etsup.Values - } - if etsup.ContextPath != nil { - objectMap["contextPath"] = etsup.ContextPath - } - if etsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = etsup.ContextAccessToken - } - if etsup.Type != "" { - objectMap["type"] = etsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return &etsup, true -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &etsup, true -} - -// EncryptionProperty ... -type EncryptionProperty struct { - // Status - Indicates whether or not the encryption is enabled for container registry. Possible values include: 'EncryptionStatusEnabled', 'EncryptionStatusDisabled' - Status EncryptionStatus `json:"status,omitempty"` - // KeyVaultProperties - Key vault properties. - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} - -// ErrorResponse an error response from the Azure Container Registry service. -type ErrorResponse struct { - // Error - Azure container registry build API error body. - Error *ErrorResponseBody `json:"error,omitempty"` -} - -// ErrorResponseBody an error response from the Azure Container Registry service. -type ErrorResponseBody struct { - // Code - error code. - Code *string `json:"code,omitempty"` - // Message - error message. - Message *string `json:"message,omitempty"` - // Target - target of the particular error. - Target *string `json:"target,omitempty"` - // Details - an array of additional nested error response info objects, as described by this contract. - Details *InnerErrorDescription `json:"details,omitempty"` -} - -// Event the event for a webhook. -type Event struct { - // EventRequestMessage - The event request message sent to the service URI. - EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` - // EventResponseMessage - The event response message received from the service URI. - EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventContent the content of the event request message. -type EventContent struct { - // ID - The event ID. - ID *string `json:"id,omitempty"` - // Timestamp - The time at which the event occurred. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Action - The action that encompasses the provided event. - Action *string `json:"action,omitempty"` - // Target - The target of the event. - Target *Target `json:"target,omitempty"` - // Request - The request that generated the event. - Request *Request `json:"request,omitempty"` - // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. - Actor *Actor `json:"actor,omitempty"` - // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - Source *Source `json:"source,omitempty"` -} - -// EventInfo the basic information of an event. -type EventInfo struct { - autorest.Response `json:"-"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventListResult the result of a request to list events for a webhook. -type EventListResult struct { - autorest.Response `json:"-"` - // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - Value *[]Event `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventListResultIterator provides access to a complete listing of Event values. -type EventListResultIterator struct { - i int - page EventListResultPage -} - -// 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 *EventListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.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 *EventListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventListResultIterator) 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 EventListResultIterator) Response() EventListResult { - 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 EventListResultIterator) Value() Event { - if !iter.page.NotDone() { - return Event{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventListResultIterator type. -func NewEventListResultIterator(page EventListResultPage) EventListResultIterator { - return EventListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (elr EventListResult) IsEmpty() bool { - return elr.Value == nil || len(*elr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (elr EventListResult) hasNextLink() bool { - return elr.NextLink != nil && len(*elr.NextLink) != 0 -} - -// eventListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (elr EventListResult) eventListResultPreparer(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))) -} - -// EventListResultPage contains a page of Event values. -type EventListResultPage struct { - fn func(context.Context, EventListResult) (EventListResult, error) - elr EventListResult -} - -// 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 *EventListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.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 *EventListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventListResultPage) NotDone() bool { - return !page.elr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventListResultPage) Response() EventListResult { - return page.elr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventListResultPage) Values() []Event { - if page.elr.IsEmpty() { - return nil - } - return *page.elr.Value -} - -// Creates a new instance of the EventListResultPage type. -func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage { - return EventListResultPage{ - fn: getNextPage, - elr: cur, - } -} - -// EventRequestMessage the event request message sent to the service URI. -type EventRequestMessage struct { - // Content - The content of the event request message. - Content *EventContent `json:"content,omitempty"` - // Headers - The headers of the event request message. - Headers map[string]*string `json:"headers"` - // Method - The HTTP method used to send the event request message. - Method *string `json:"method,omitempty"` - // RequestURI - The URI used to send the event request message. - RequestURI *string `json:"requestUri,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventRequestMessage. -func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.Method != nil { - objectMap["method"] = erm.Method - } - if erm.RequestURI != nil { - objectMap["requestUri"] = erm.RequestURI - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// EventResponseMessage the event response message received from the service URI. -type EventResponseMessage struct { - // Content - The content of the event response message. - Content *string `json:"content,omitempty"` - // Headers - The headers of the event response message. - Headers map[string]*string `json:"headers"` - // ReasonPhrase - The reason phrase of the event response message. - ReasonPhrase *string `json:"reasonPhrase,omitempty"` - // StatusCode - The status code of the event response message. - StatusCode *string `json:"statusCode,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventResponseMessage. -func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.ReasonPhrase != nil { - objectMap["reasonPhrase"] = erm.ReasonPhrase - } - if erm.StatusCode != nil { - objectMap["statusCode"] = erm.StatusCode - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// ExportPipeline an object that represents an export pipeline for a container registry. -type ExportPipeline struct { - autorest.Response `json:"-"` - // Location - The location of the export pipeline. - Location *string `json:"location,omitempty"` - // Identity - The identity of the export pipeline. - Identity *IdentityProperties `json:"identity,omitempty"` - // ExportPipelineProperties - The properties of the export pipeline. - *ExportPipelineProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportPipeline. -func (ep ExportPipeline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.Location != nil { - objectMap["location"] = ep.Location - } - if ep.Identity != nil { - objectMap["identity"] = ep.Identity - } - if ep.ExportPipelineProperties != nil { - objectMap["properties"] = ep.ExportPipelineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExportPipeline struct. -func (ep *ExportPipeline) 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 - } - ep.Location = &location - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ep.Identity = &identity - } - case "properties": - if v != nil { - var exportPipelineProperties ExportPipelineProperties - err = json.Unmarshal(*v, &exportPipelineProperties) - if err != nil { - return err - } - ep.ExportPipelineProperties = &exportPipelineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ep.SystemData = &systemData - } - } - } - - return nil -} - -// ExportPipelineListResult the result of a request to list export pipelines for a container registry. -type ExportPipelineListResult struct { - autorest.Response `json:"-"` - // Value - The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of export pipelines. - Value *[]ExportPipeline `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of pipeline runs. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExportPipelineListResultIterator provides access to a complete listing of ExportPipeline values. -type ExportPipelineListResultIterator struct { - i int - page ExportPipelineListResultPage -} - -// 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 *ExportPipelineListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelineListResultIterator.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 *ExportPipelineListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExportPipelineListResultIterator) 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 ExportPipelineListResultIterator) Response() ExportPipelineListResult { - 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 ExportPipelineListResultIterator) Value() ExportPipeline { - if !iter.page.NotDone() { - return ExportPipeline{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExportPipelineListResultIterator type. -func NewExportPipelineListResultIterator(page ExportPipelineListResultPage) ExportPipelineListResultIterator { - return ExportPipelineListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eplr ExportPipelineListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eplr ExportPipelineListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 -} - -// exportPipelineListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eplr ExportPipelineListResult) exportPipelineListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) -} - -// ExportPipelineListResultPage contains a page of ExportPipeline values. -type ExportPipelineListResultPage struct { - fn func(context.Context, ExportPipelineListResult) (ExportPipelineListResult, error) - eplr ExportPipelineListResult -} - -// 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 *ExportPipelineListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelineListResultPage.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.eplr) - if err != nil { - return err - } - page.eplr = 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 *ExportPipelineListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExportPipelineListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExportPipelineListResultPage) Response() ExportPipelineListResult { - return page.eplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExportPipelineListResultPage) Values() []ExportPipeline { - if page.eplr.IsEmpty() { - return nil - } - return *page.eplr.Value -} - -// Creates a new instance of the ExportPipelineListResultPage type. -func NewExportPipelineListResultPage(cur ExportPipelineListResult, getNextPage func(context.Context, ExportPipelineListResult) (ExportPipelineListResult, error)) ExportPipelineListResultPage { - return ExportPipelineListResultPage{ - fn: getNextPage, - eplr: cur, - } -} - -// ExportPipelineProperties the properties of an export pipeline. -type ExportPipelineProperties struct { - // Target - The target properties of the export pipeline. - Target *ExportPipelineTargetProperties `json:"target,omitempty"` - // Options - The list of all options configured for the pipeline. - Options *[]PipelineOptions `json:"options,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the pipeline at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportPipelineProperties. -func (epp ExportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epp.Target != nil { - objectMap["target"] = epp.Target - } - if epp.Options != nil { - objectMap["options"] = epp.Options - } - return json.Marshal(objectMap) -} - -// ExportPipelinesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExportPipelinesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExportPipelinesClient) (ExportPipeline, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExportPipelinesCreateFuture) 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 ExportPipelinesCreateFuture.Result. -func (future *ExportPipelinesCreateFuture) result(client ExportPipelinesClient) (ep ExportPipeline, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ExportPipelinesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesCreateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ExportPipelinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExportPipelinesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExportPipelinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExportPipelinesDeleteFuture) 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 ExportPipelinesDeleteFuture.Result. -func (future *ExportPipelinesDeleteFuture) result(client ExportPipelinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ExportPipelinesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExportPipelineTargetProperties the properties of the export pipeline target. -type ExportPipelineTargetProperties struct { - // Type - The type of target for the export pipeline. - Type *string `json:"type,omitempty"` - // URI - The target uri of the export pipeline. - // When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName" - URI *string `json:"uri,omitempty"` - // KeyVaultURI - They key vault secret uri to obtain the target storage SAS token. - KeyVaultURI *string `json:"keyVaultUri,omitempty"` -} - -// FileTaskRunRequest the request parameters for a scheduling run against a task file. -type FileTaskRunRequest struct { - // TaskFilePath - The template/definition file path relative to the source. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The values/parameters file path relative to the source. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) MarshalJSON() ([]byte, error) { - ftrr.Type = TypeFileTaskRunRequest - objectMap := make(map[string]interface{}) - if ftrr.TaskFilePath != nil { - objectMap["taskFilePath"] = ftrr.TaskFilePath - } - if ftrr.ValuesFilePath != nil { - objectMap["valuesFilePath"] = ftrr.ValuesFilePath - } - if ftrr.Values != nil { - objectMap["values"] = ftrr.Values - } - if ftrr.Timeout != nil { - objectMap["timeout"] = ftrr.Timeout - } - if ftrr.Platform != nil { - objectMap["platform"] = ftrr.Platform - } - if ftrr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = ftrr.AgentConfiguration - } - if ftrr.SourceLocation != nil { - objectMap["sourceLocation"] = ftrr.SourceLocation - } - if ftrr.Credentials != nil { - objectMap["credentials"] = ftrr.Credentials - } - if ftrr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = ftrr.IsArchiveEnabled - } - if ftrr.AgentPoolName != nil { - objectMap["agentPoolName"] = ftrr.AgentPoolName - } - if ftrr.LogTemplate != nil { - objectMap["logTemplate"] = ftrr.LogTemplate - } - if ftrr.Type != "" { - objectMap["type"] = ftrr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return &ftrr, true -} - -// AsTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &ftrr, true -} - -// FileTaskStep the properties of a task step. -type FileTaskStep struct { - // TaskFilePath - The task template/definition file path relative to the source context. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The task values/parameters file path relative to the source context. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskStep. -func (fts FileTaskStep) MarshalJSON() ([]byte, error) { - fts.Type = TypeFileTask - objectMap := make(map[string]interface{}) - if fts.TaskFilePath != nil { - objectMap["taskFilePath"] = fts.TaskFilePath - } - if fts.ValuesFilePath != nil { - objectMap["valuesFilePath"] = fts.ValuesFilePath - } - if fts.Values != nil { - objectMap["values"] = fts.Values - } - if fts.ContextPath != nil { - objectMap["contextPath"] = fts.ContextPath - } - if fts.ContextAccessToken != nil { - objectMap["contextAccessToken"] = fts.ContextAccessToken - } - if fts.Type != "" { - objectMap["type"] = fts.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { - return &fts, true -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &fts, true -} - -// FileTaskStepUpdateParameters the properties of updating a task step. -type FileTaskStepUpdateParameters struct { - // TaskFilePath - The task template/definition file path relative to the source context. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The values/parameters file path relative to the source context. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - ftsup.Type = TypeBasicTaskStepUpdateParametersTypeFileTask - objectMap := make(map[string]interface{}) - if ftsup.TaskFilePath != nil { - objectMap["taskFilePath"] = ftsup.TaskFilePath - } - if ftsup.ValuesFilePath != nil { - objectMap["valuesFilePath"] = ftsup.ValuesFilePath - } - if ftsup.Values != nil { - objectMap["values"] = ftsup.Values - } - if ftsup.ContextPath != nil { - objectMap["contextPath"] = ftsup.ContextPath - } - if ftsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = ftsup.ContextAccessToken - } - if ftsup.Type != "" { - objectMap["type"] = ftsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return &ftsup, true -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &ftsup, true -} - -// GenerateCredentialsParameters the parameters used to generate credentials for a specified token or user -// of a container registry. -type GenerateCredentialsParameters struct { - // TokenID - The resource ID of the token for which credentials have to be generated. - TokenID *string `json:"tokenId,omitempty"` - // Expiry - The expiry date of the generated credentials after which the credentials become invalid. - Expiry *date.Time `json:"expiry,omitempty"` - // Name - Specifies name of the password which should be regenerated if any -- password1 or password2. Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' - Name TokenPasswordName `json:"name,omitempty"` -} - -// GenerateCredentialsResult the response from the GenerateCredentials operation. -type GenerateCredentialsResult struct { - autorest.Response `json:"-"` - // Username - The username for a container registry. - Username *string `json:"username,omitempty"` - // Passwords - The list of passwords for a container registry. - Passwords *[]TokenPassword `json:"passwords,omitempty"` -} - -// IdentityProperties managed identity for the resource. -type IdentityProperties struct { - // PrincipalID - The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the resource. The user identity - // dictionary key references will be ARM resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - // providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for IdentityProperties. -func (IP IdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.PrincipalID != nil { - objectMap["principalId"] = IP.PrincipalID - } - if IP.TenantID != nil { - objectMap["tenantId"] = IP.TenantID - } - if IP.Type != "" { - objectMap["type"] = IP.Type - } - if IP.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = IP.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ImageDescriptor properties for a registry image. -type ImageDescriptor struct { - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// ImageUpdateTrigger the image update trigger that caused a build. -type ImageUpdateTrigger struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // Timestamp - The timestamp when the image update happened. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Images - The list of image updates that caused the build. - Images *[]ImageDescriptor `json:"images,omitempty"` -} - -// ImportImageParameters ... -type ImportImageParameters struct { - // Source - The source of the image. - Source *ImportSource `json:"source,omitempty"` - // TargetTags - List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - TargetTags *[]string `json:"targetTags,omitempty"` - // UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created. - UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"` - // Mode - When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'NoForce', 'Force' - Mode ImportMode `json:"mode,omitempty"` -} - -// ImportPipeline an object that represents an import pipeline for a container registry. -type ImportPipeline struct { - autorest.Response `json:"-"` - // Location - The location of the import pipeline. - Location *string `json:"location,omitempty"` - // Identity - The identity of the import pipeline. - Identity *IdentityProperties `json:"identity,omitempty"` - // ImportPipelineProperties - The properties of the import pipeline. - *ImportPipelineProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImportPipeline. -func (IP ImportPipeline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.Location != nil { - objectMap["location"] = IP.Location - } - if IP.Identity != nil { - objectMap["identity"] = IP.Identity - } - if IP.ImportPipelineProperties != nil { - objectMap["properties"] = IP.ImportPipelineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ImportPipeline struct. -func (IP *ImportPipeline) 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 - } - IP.Location = &location - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - IP.Identity = &identity - } - case "properties": - if v != nil { - var importPipelineProperties ImportPipelineProperties - err = json.Unmarshal(*v, &importPipelineProperties) - if err != nil { - return err - } - IP.ImportPipelineProperties = &importPipelineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - IP.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - IP.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - IP.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - IP.SystemData = &systemData - } - } - } - - return nil -} - -// ImportPipelineListResult the result of a request to list import pipelines for a container registry. -type ImportPipelineListResult struct { - autorest.Response `json:"-"` - // Value - The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of import pipelines. - Value *[]ImportPipeline `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of pipeline runs. - NextLink *string `json:"nextLink,omitempty"` -} - -// ImportPipelineListResultIterator provides access to a complete listing of ImportPipeline values. -type ImportPipelineListResultIterator struct { - i int - page ImportPipelineListResultPage -} - -// 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 *ImportPipelineListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelineListResultIterator.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 *ImportPipelineListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ImportPipelineListResultIterator) 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 ImportPipelineListResultIterator) Response() ImportPipelineListResult { - 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 ImportPipelineListResultIterator) Value() ImportPipeline { - if !iter.page.NotDone() { - return ImportPipeline{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ImportPipelineListResultIterator type. -func NewImportPipelineListResultIterator(page ImportPipelineListResultPage) ImportPipelineListResultIterator { - return ImportPipelineListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iplr ImportPipelineListResult) IsEmpty() bool { - return iplr.Value == nil || len(*iplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iplr ImportPipelineListResult) hasNextLink() bool { - return iplr.NextLink != nil && len(*iplr.NextLink) != 0 -} - -// importPipelineListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iplr ImportPipelineListResult) importPipelineListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iplr.NextLink))) -} - -// ImportPipelineListResultPage contains a page of ImportPipeline values. -type ImportPipelineListResultPage struct { - fn func(context.Context, ImportPipelineListResult) (ImportPipelineListResult, error) - iplr ImportPipelineListResult -} - -// 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 *ImportPipelineListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelineListResultPage.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.iplr) - if err != nil { - return err - } - page.iplr = 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 *ImportPipelineListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ImportPipelineListResultPage) NotDone() bool { - return !page.iplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ImportPipelineListResultPage) Response() ImportPipelineListResult { - return page.iplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ImportPipelineListResultPage) Values() []ImportPipeline { - if page.iplr.IsEmpty() { - return nil - } - return *page.iplr.Value -} - -// Creates a new instance of the ImportPipelineListResultPage type. -func NewImportPipelineListResultPage(cur ImportPipelineListResult, getNextPage func(context.Context, ImportPipelineListResult) (ImportPipelineListResult, error)) ImportPipelineListResultPage { - return ImportPipelineListResultPage{ - fn: getNextPage, - iplr: cur, - } -} - -// ImportPipelineProperties the properties of an import pipeline. -type ImportPipelineProperties struct { - // Source - The source properties of the import pipeline. - Source *ImportPipelineSourceProperties `json:"source,omitempty"` - // Trigger - The properties that describe the trigger of the import pipeline. - Trigger *PipelineTriggerProperties `json:"trigger,omitempty"` - // Options - The list of all options configured for the pipeline. - Options *[]PipelineOptions `json:"options,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the pipeline at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImportPipelineProperties. -func (ipp ImportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipp.Source != nil { - objectMap["source"] = ipp.Source - } - if ipp.Trigger != nil { - objectMap["trigger"] = ipp.Trigger - } - if ipp.Options != nil { - objectMap["options"] = ipp.Options - } - return json.Marshal(objectMap) -} - -// ImportPipelinesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ImportPipelinesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ImportPipelinesClient) (ImportPipeline, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ImportPipelinesCreateFuture) 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 ImportPipelinesCreateFuture.Result. -func (future *ImportPipelinesCreateFuture) result(client ImportPipelinesClient) (IP ImportPipeline, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - IP.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ImportPipelinesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { - IP, err = client.CreateResponder(IP.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesCreateFuture", "Result", IP.Response.Response, "Failure responding to request") - } - } - return -} - -// ImportPipelinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ImportPipelinesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ImportPipelinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ImportPipelinesDeleteFuture) 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 ImportPipelinesDeleteFuture.Result. -func (future *ImportPipelinesDeleteFuture) result(client ImportPipelinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ImportPipelinesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ImportPipelineSourceProperties the properties of the import pipeline source. -type ImportPipelineSourceProperties struct { - // Type - The type of source for the import pipeline. Possible values include: 'AzureStorageBlobContainer' - Type PipelineSourceType `json:"type,omitempty"` - // URI - The source uri of the import pipeline. - // When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName" - URI *string `json:"uri,omitempty"` - // KeyVaultURI - They key vault secret uri to obtain the source storage SAS token. - KeyVaultURI *string `json:"keyVaultUri,omitempty"` -} - -// ImportSource ... -type ImportSource struct { - // ResourceID - The resource identifier of the source Azure Container Registry. - ResourceID *string `json:"resourceId,omitempty"` - // RegistryURI - The address of the source registry (e.g. 'mcr.microsoft.com'). - RegistryURI *string `json:"registryUri,omitempty"` - // Credentials - Credentials used when importing from a registry uri. - Credentials *ImportSourceCredentials `json:"credentials,omitempty"` - // SourceImage - Repository name of the source image. - // Specify an image by repository ('hello-world'). This will use the 'latest' tag. - // Specify an image by tag ('hello-world:latest'). - // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - SourceImage *string `json:"sourceImage,omitempty"` -} - -// ImportSourceCredentials ... -type ImportSourceCredentials struct { - // Username - The username to authenticate with the source registry. - Username *string `json:"username,omitempty"` - // Password - The password used to authenticate with the source registry. - Password *string `json:"password,omitempty"` -} - -// InnerErrorDescription inner error. -type InnerErrorDescription struct { - // Code - error code. - Code *string `json:"code,omitempty"` - // Message - error message. - Message *string `json:"message,omitempty"` - // Target - target of the particular error. - Target *string `json:"target,omitempty"` -} - -// IPRule IP rule with specific IP or IP range in CIDR format. -type IPRule struct { - // Action - The action of IP ACL rule. Possible values include: 'Allow' - Action Action `json:"action,omitempty"` - // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - IPAddressOrRange *string `json:"value,omitempty"` -} - -// KeyVaultProperties ... -type KeyVaultProperties struct { - // KeyIdentifier - Key vault uri to access the encryption key. - KeyIdentifier *string `json:"keyIdentifier,omitempty"` - // VersionedKeyIdentifier - READ-ONLY; The fully qualified key identifier that includes the version of the key that is actually used for encryption. - VersionedKeyIdentifier *string `json:"versionedKeyIdentifier,omitempty"` - // Identity - The client id of the identity which will be used to access key vault. - Identity *string `json:"identity,omitempty"` - // KeyRotationEnabled - READ-ONLY; Auto key rotation status for a CMK enabled registry. - KeyRotationEnabled *bool `json:"keyRotationEnabled,omitempty"` - // LastKeyRotationTimestamp - READ-ONLY; Timestamp of the last successful key rotation. - LastKeyRotationTimestamp *date.Time `json:"lastKeyRotationTimestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for KeyVaultProperties. -func (kvp KeyVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kvp.KeyIdentifier != nil { - objectMap["keyIdentifier"] = kvp.KeyIdentifier - } - if kvp.Identity != nil { - objectMap["identity"] = kvp.Identity - } - return json.Marshal(objectMap) -} - -// LoggingProperties the logging properties of the connected registry. -type LoggingProperties struct { - // LogLevel - The verbosity of logs persisted on the connected registry. Possible values include: 'LogLevelDebug', 'LogLevelInformation', 'LogLevelWarning', 'LogLevelError', 'LogLevelNone' - LogLevel LogLevel `json:"logLevel,omitempty"` - // AuditLogStatus - Indicates whether audit logs are enabled on the connected registry. Possible values include: 'Enabled', 'Disabled' - AuditLogStatus AuditLogStatus `json:"auditLogStatus,omitempty"` -} - -// LoginServerProperties the login server properties of the connected registry. -type LoginServerProperties struct { - // Host - READ-ONLY; The host of the connected registry. Can be FQDN or IP. - Host *string `json:"host,omitempty"` - // TLS - READ-ONLY; The TLS properties of the connected registry login server. - TLS *TLSProperties `json:"tls,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoginServerProperties. -func (lsp LoginServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NetworkRuleSet the network rule set for a container registry. -type NetworkRuleSet struct { - // DefaultAction - The default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' - DefaultAction DefaultAction `json:"defaultAction,omitempty"` - // VirtualNetworkRules - The virtual network rules. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // IPRules - The IP ACL rules. - IPRules *[]IPRule `json:"ipRules,omitempty"` -} - -// OperationDefinition the definition of a container registry operation. -type OperationDefinition struct { - // Origin - The origin information of the container registry operation. - Origin *string `json:"origin,omitempty"` - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The display information for the container registry operation. - Display *OperationDisplayDefinition `json:"display,omitempty"` - // OperationPropertiesDefinition - The properties information for the container registry operation. - *OperationPropertiesDefinition `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDefinition. -func (od OperationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if od.Origin != nil { - objectMap["origin"] = od.Origin - } - if od.Name != nil { - objectMap["name"] = od.Name - } - if od.Display != nil { - objectMap["display"] = od.Display - } - if od.OperationPropertiesDefinition != nil { - objectMap["properties"] = od.OperationPropertiesDefinition - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationDefinition struct. -func (od *OperationDefinition) 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 "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - od.Origin = &origin - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - od.Name = &name - } - case "display": - if v != nil { - var display OperationDisplayDefinition - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - od.Display = &display - } - case "properties": - if v != nil { - var operationPropertiesDefinition OperationPropertiesDefinition - err = json.Unmarshal(*v, &operationPropertiesDefinition) - if err != nil { - return err - } - od.OperationPropertiesDefinition = &operationPropertiesDefinition - } - } - } - - return nil -} - -// OperationDisplayDefinition the display information for a container registry operation. -type OperationDisplayDefinition struct { - // Provider - The resource provider name: Microsoft.ContainerRegistry. - Provider *string `json:"provider,omitempty"` - // Resource - The resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - The operation that users can perform. - Operation *string `json:"operation,omitempty"` - // Description - The description for the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult the result of a request to list container registry operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - Value *[]OperationDefinition `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registry operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of OperationDefinition 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() OperationDefinition { - if !iter.page.NotDone() { - return OperationDefinition{} - } - 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 OperationDefinition 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() []OperationDefinition { - 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, - } -} - -// OperationLogSpecificationDefinition the definition of Azure Monitoring log. -type OperationLogSpecificationDefinition struct { - // Name - Log name. - Name *string `json:"name,omitempty"` - // DisplayName - Log display name. - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Log blob duration. - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// OperationMetricSpecificationDefinition the definition of Azure Monitoring metric. -type OperationMetricSpecificationDefinition struct { - // Name - Metric name. - Name *string `json:"name,omitempty"` - // DisplayName - Metric display name. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Metric description. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Metric unit. - Unit *string `json:"unit,omitempty"` - // AggregationType - Metric aggregation type. - AggregationType *string `json:"aggregationType,omitempty"` - // InternalMetricName - Internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` -} - -// OperationPropertiesDefinition the definition of Azure Monitoring properties. -type OperationPropertiesDefinition struct { - // ServiceSpecification - The definition of Azure Monitoring service. - ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` -} - -// OperationServiceSpecificationDefinition the definition of Azure Monitoring list. -type OperationServiceSpecificationDefinition struct { - // MetricSpecifications - A list of Azure Monitoring metrics definition. - MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` - // LogSpecifications - A list of Azure Monitoring log definitions. - LogSpecifications *[]OperationLogSpecificationDefinition `json:"logSpecifications,omitempty"` -} - -// OverrideTaskStepProperties ... -type OverrideTaskStepProperties struct { - // ContextPath - The source context against which run has to be queued. - ContextPath *string `json:"contextPath,omitempty"` - // File - The file against which run has to be queued. - File *string `json:"file,omitempty"` - // Arguments - Gets or sets the collection of override arguments to be used when - // executing a build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Values - The collection of overridable values that can be passed when running a Task. - Values *[]SetValue `json:"values,omitempty"` - // UpdateTriggerToken - Base64 encoded update trigger token that will be attached with the base image trigger webhook. - UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` -} - -// ParentProperties the properties of the connected registry parent. -type ParentProperties struct { - // ID - The resource ID of the parent to which the connected registry will be associated. - ID *string `json:"id,omitempty"` - // SyncProperties - The sync properties of the connected registry with its parent. - SyncProperties *SyncProperties `json:"syncProperties,omitempty"` -} - -// PipelineRun an object that represents a pipeline run for a container registry. -type PipelineRun struct { - autorest.Response `json:"-"` - // PipelineRunProperties - The properties of a pipeline run. - *PipelineRunProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for PipelineRun. -func (pr PipelineRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.PipelineRunProperties != nil { - objectMap["properties"] = pr.PipelineRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PipelineRun struct. -func (pr *PipelineRun) 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 pipelineRunProperties PipelineRunProperties - err = json.Unmarshal(*v, &pipelineRunProperties) - if err != nil { - return err - } - pr.PipelineRunProperties = &pipelineRunProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pr.SystemData = &systemData - } - } - } - - return nil -} - -// PipelineRunListResult the result of a request to list pipeline runs for a container registry. -type PipelineRunListResult struct { - autorest.Response `json:"-"` - // Value - The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list of pipeline runs. - Value *[]PipelineRun `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of pipeline runs. - NextLink *string `json:"nextLink,omitempty"` -} - -// PipelineRunListResultIterator provides access to a complete listing of PipelineRun values. -type PipelineRunListResultIterator struct { - i int - page PipelineRunListResultPage -} - -// 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 *PipelineRunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunListResultIterator.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 *PipelineRunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PipelineRunListResultIterator) 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 PipelineRunListResultIterator) Response() PipelineRunListResult { - 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 PipelineRunListResultIterator) Value() PipelineRun { - if !iter.page.NotDone() { - return PipelineRun{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PipelineRunListResultIterator type. -func NewPipelineRunListResultIterator(page PipelineRunListResultPage) PipelineRunListResultIterator { - return PipelineRunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (prlr PipelineRunListResult) IsEmpty() bool { - return prlr.Value == nil || len(*prlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (prlr PipelineRunListResult) hasNextLink() bool { - return prlr.NextLink != nil && len(*prlr.NextLink) != 0 -} - -// pipelineRunListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (prlr PipelineRunListResult) pipelineRunListResultPreparer(ctx context.Context) (*http.Request, error) { - if !prlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(prlr.NextLink))) -} - -// PipelineRunListResultPage contains a page of PipelineRun values. -type PipelineRunListResultPage struct { - fn func(context.Context, PipelineRunListResult) (PipelineRunListResult, error) - prlr PipelineRunListResult -} - -// 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 *PipelineRunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunListResultPage.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.prlr) - if err != nil { - return err - } - page.prlr = 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 *PipelineRunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PipelineRunListResultPage) NotDone() bool { - return !page.prlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PipelineRunListResultPage) Response() PipelineRunListResult { - return page.prlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PipelineRunListResultPage) Values() []PipelineRun { - if page.prlr.IsEmpty() { - return nil - } - return *page.prlr.Value -} - -// Creates a new instance of the PipelineRunListResultPage type. -func NewPipelineRunListResultPage(cur PipelineRunListResult, getNextPage func(context.Context, PipelineRunListResult) (PipelineRunListResult, error)) PipelineRunListResultPage { - return PipelineRunListResultPage{ - fn: getNextPage, - prlr: cur, - } -} - -// PipelineRunProperties the properties of a pipeline run. -type PipelineRunProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of a pipeline run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Request - The request parameters for a pipeline run. - Request *PipelineRunRequest `json:"request,omitempty"` - // Response - READ-ONLY; The response of a pipeline run. - Response *PipelineRunResponse `json:"response,omitempty"` - // ForceUpdateTag - How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PipelineRunProperties. -func (prp PipelineRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prp.Request != nil { - objectMap["request"] = prp.Request - } - if prp.ForceUpdateTag != nil { - objectMap["forceUpdateTag"] = prp.ForceUpdateTag - } - return json.Marshal(objectMap) -} - -// PipelineRunRequest the request properties provided for a pipeline run. -type PipelineRunRequest struct { - // PipelineResourceID - The resource ID of the pipeline to run. - PipelineResourceID *string `json:"pipelineResourceId,omitempty"` - // Artifacts - List of source artifacts to be transferred by the pipeline. - // Specify an image by repository ('hello-world'). This will use the 'latest' tag. - // Specify an image by tag ('hello-world:latest'). - // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - Artifacts *[]string `json:"artifacts,omitempty"` - // Source - The source properties of the pipeline run. - Source *PipelineRunSourceProperties `json:"source,omitempty"` - // Target - The target properties of the pipeline run. - Target *PipelineRunTargetProperties `json:"target,omitempty"` - // CatalogDigest - The digest of the tar used to transfer the artifacts. - CatalogDigest *string `json:"catalogDigest,omitempty"` -} - -// PipelineRunResponse the response properties returned for a pipeline run. -type PipelineRunResponse struct { - // Status - The current status of the pipeline run. - Status *string `json:"status,omitempty"` - // ImportedArtifacts - The artifacts imported in the pipeline run. - ImportedArtifacts *[]string `json:"importedArtifacts,omitempty"` - // Progress - The current progress of the copy operation. - Progress *ProgressProperties `json:"progress,omitempty"` - // StartTime - The time the pipeline run started. - StartTime *date.Time `json:"startTime,omitempty"` - // FinishTime - The time the pipeline run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // Source - The source of the pipeline run. - Source *ImportPipelineSourceProperties `json:"source,omitempty"` - // Target - The target of the pipeline run. - Target *ExportPipelineTargetProperties `json:"target,omitempty"` - // CatalogDigest - The digest of the tar used to transfer the artifacts. - CatalogDigest *string `json:"catalogDigest,omitempty"` - // Trigger - The trigger that caused the pipeline run. - Trigger *PipelineTriggerDescriptor `json:"trigger,omitempty"` - // PipelineRunErrorMessage - The detailed error message for the pipeline run in the case of failure. - PipelineRunErrorMessage *string `json:"pipelineRunErrorMessage,omitempty"` -} - -// PipelineRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PipelineRunsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PipelineRunsClient) (PipelineRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PipelineRunsCreateFuture) 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 PipelineRunsCreateFuture.Result. -func (future *PipelineRunsCreateFuture) result(client PipelineRunsClient) (pr PipelineRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PipelineRunsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pr.Response.Response, err = future.GetResult(sender); err == nil && pr.Response.Response.StatusCode != http.StatusNoContent { - pr, err = client.CreateResponder(pr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsCreateFuture", "Result", pr.Response.Response, "Failure responding to request") - } - } - return -} - -// PipelineRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PipelineRunsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PipelineRunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PipelineRunsDeleteFuture) 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 PipelineRunsDeleteFuture.Result. -func (future *PipelineRunsDeleteFuture) result(client PipelineRunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PipelineRunsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PipelineRunSourceProperties ... -type PipelineRunSourceProperties struct { - // Type - The type of the source. Possible values include: 'AzureStorageBlob' - Type PipelineRunSourceType `json:"type,omitempty"` - // Name - The name of the source. - Name *string `json:"name,omitempty"` -} - -// PipelineRunTargetProperties ... -type PipelineRunTargetProperties struct { - // Type - The type of the target. Possible values include: 'PipelineRunTargetTypeAzureStorageBlob' - Type PipelineRunTargetType `json:"type,omitempty"` - // Name - The name of the target. - Name *string `json:"name,omitempty"` -} - -// PipelineSourceTriggerDescriptor ... -type PipelineSourceTriggerDescriptor struct { - // Timestamp - The timestamp when the source update happened. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// PipelineSourceTriggerProperties ... -type PipelineSourceTriggerProperties struct { - // Status - The current status of the source trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` -} - -// PipelineTriggerDescriptor ... -type PipelineTriggerDescriptor struct { - // SourceTrigger - The source trigger that caused the pipeline run. - SourceTrigger *PipelineSourceTriggerDescriptor `json:"sourceTrigger,omitempty"` -} - -// PipelineTriggerProperties ... -type PipelineTriggerProperties struct { - // SourceTrigger - The source trigger properties of the pipeline. - SourceTrigger *PipelineSourceTriggerProperties `json:"sourceTrigger,omitempty"` -} - -// PlatformProperties the platform properties against which the run has to happen. -type PlatformProperties struct { - // Os - The operating system type required for the run. Possible values include: 'Windows', 'Linux' - Os OS `json:"os,omitempty"` - // Architecture - The OS architecture. Possible values include: 'Amd64', 'X86', 'ThreeEightSix', 'Arm', 'Arm64' - Architecture Architecture `json:"architecture,omitempty"` - // Variant - Variant of the CPU. Possible values include: 'V6', 'V7', 'V8' - Variant Variant `json:"variant,omitempty"` -} - -// PlatformUpdateParameters the properties for updating the platform configuration. -type PlatformUpdateParameters struct { - // Os - The operating system type required for the run. Possible values include: 'Windows', 'Linux' - Os OS `json:"os,omitempty"` - // Architecture - The OS architecture. Possible values include: 'Amd64', 'X86', 'ThreeEightSix', 'Arm', 'Arm64' - Architecture Architecture `json:"architecture,omitempty"` - // Variant - Variant of the CPU. Possible values include: 'V6', 'V7', 'V8' - Variant Variant `json:"variant,omitempty"` -} - -// Policies the policies for a container registry. -type Policies struct { - // QuarantinePolicy - The quarantine policy for a container registry. - QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"` - // TrustPolicy - The content trust policy for a container registry. - TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"` - // RetentionPolicy - The retention policy for a container registry. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - This is private endpoint resource created with Microsoft.Network resource provider. - ID *string `json:"id,omitempty"` -} - -// PrivateEndpointConnection an object that represents a private endpoint connection for a container -// registry. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,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 "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pec.SystemData = &systemData - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult the result of a request to list private endpoint connections for a -// container registry. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of private endpoint connections. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) - if err != nil { - return err - } - page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties the properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private endpoint. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of private endpoint connection resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,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) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource a resource that supports private link capabilities. -type PrivateLinkResource struct { - // Type - READ-ONLY; The resource type is private link resource. - Type *string `json:"type,omitempty"` - // ID - The resource ID. - ID *string `json:"id,omitempty"` - // Name - The name of the resource. - Name *string `json:"name,omitempty"` - // PrivateLinkResourceProperties - A resource that supports private link capabilities. - *PrivateLinkResourceProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.ID != nil { - objectMap["id"] = plr.ID - } - if plr.Name != nil { - objectMap["name"] = plr.Name - } - 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 "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - 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 "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - } - } - - return nil -} - -// PrivateLinkResourceListResult the result of a request to list private link resources for a container -// registry. -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of private link resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties the properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// PrivateLinkServiceConnectionState the state of a private link service connection. -type PrivateLinkServiceConnectionState struct { - // Status - The private link service connection status. Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' - Status ConnectionStatus `json:"status,omitempty"` - // Description - The description for connection status. For example if connection is rejected it can indicate reason for rejection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. Possible values include: 'None', 'Recreate' - ActionsRequired ActionsRequired `json:"actionsRequired,omitempty"` -} - -// ProgressProperties ... -type ProgressProperties struct { - // Percentage - The percentage complete of the copy operation. - Percentage *string `json:"percentage,omitempty"` -} - -// 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; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - 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) -} - -// QuarantinePolicy the quarantine policy for a container registry. -type QuarantinePolicy struct { - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// RegenerateCredentialParameters the parameters used to regenerate the login credential. -type RegenerateCredentialParameters struct { - // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2' - Name PasswordName `json:"name,omitempty"` -} - -// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesCreateFuture) 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 RegistriesCreateFuture.Result. -func (future *RegistriesCreateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture") - 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, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesDeleteFuture) 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 RegistriesDeleteFuture.Result. -func (future *RegistriesDeleteFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesGenerateCredentialsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RegistriesGenerateCredentialsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (GenerateCredentialsResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesGenerateCredentialsFuture) 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 RegistriesGenerateCredentialsFuture.Result. -func (future *RegistriesGenerateCredentialsFuture) result(client RegistriesClient) (gcr GenerateCredentialsResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gcr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesGenerateCredentialsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gcr.Response.Response, err = future.GetResult(sender); err == nil && gcr.Response.Response.StatusCode != http.StatusNoContent { - gcr, err = client.GenerateCredentialsResponder(gcr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", gcr.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesImportImageFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesImportImageFuture) 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 RegistriesImportImageFuture.Result. -func (future *RegistriesImportImageFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesImportImageFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesScheduleRunFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesScheduleRunFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Run, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesScheduleRunFuture) 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 RegistriesScheduleRunFuture.Result. -func (future *RegistriesScheduleRunFuture) result(client RegistriesClient) (r Run, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesScheduleRunFuture") - 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.ScheduleRunResponder(r.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesUpdateFuture) 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 RegistriesUpdateFuture.Result. -func (future *RegistriesUpdateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture") - 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, "containerregistry.RegistriesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// Registry an object that represents a container registry. -type Registry struct { - autorest.Response `json:"-"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // Identity - The identity of the container registry. - Identity *IdentityProperties `json:"identity,omitempty"` - // RegistryProperties - The properties of the container registry. - *RegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Registry. -func (r Registry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - if r.Identity != nil { - objectMap["identity"] = r.Identity - } - if r.RegistryProperties != nil { - objectMap["properties"] = r.RegistryProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Registry struct. -func (r *Registry) 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 - } - r.Sku = &sku - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - r.Identity = &identity - } - case "properties": - if v != nil { - var registryProperties RegistryProperties - err = json.Unmarshal(*v, ®istryProperties) - if err != nil { - return err - } - r.RegistryProperties = ®istryProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - r.SystemData = &systemData - } - } - } - - return nil -} - -// RegistryListCredentialsResult the response from the ListCredentials operation. -type RegistryListCredentialsResult struct { - autorest.Response `json:"-"` - // Username - The username for a container registry. - Username *string `json:"username,omitempty"` - // Passwords - The list of passwords for a container registry. - Passwords *[]RegistryPassword `json:"passwords,omitempty"` -} - -// RegistryListResult the result of a request to list container registries. -type RegistryListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - Value *[]Registry `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registries. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegistryListResultIterator provides access to a complete listing of Registry values. -type RegistryListResultIterator struct { - i int - page RegistryListResultPage -} - -// 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 *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.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 *RegistryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegistryListResultIterator) 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 RegistryListResultIterator) Response() RegistryListResult { - 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 RegistryListResultIterator) Value() Registry { - if !iter.page.NotDone() { - return Registry{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegistryListResultIterator type. -func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { - return RegistryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegistryListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegistryListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// registryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegistryListResult) registryListResultPreparer(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))) -} - -// RegistryListResultPage contains a page of Registry values. -type RegistryListResultPage struct { - fn func(context.Context, RegistryListResult) (RegistryListResult, error) - rlr RegistryListResult -} - -// 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 *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.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 *RegistryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegistryListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegistryListResultPage) Response() RegistryListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegistryListResultPage) Values() []Registry { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegistryListResultPage type. -func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { - return RegistryListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistryNameCheckRequest a request to check whether a container registry name is available. -type RegistryNameCheckRequest struct { - // Name - The name of the container registry. - Name *string `json:"name,omitempty"` - // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. - Type *string `json:"type,omitempty"` -} - -// RegistryNameStatus the result of a request to check the availability of a container registry name. -type RegistryNameStatus struct { - autorest.Response `json:"-"` - // NameAvailable - The value that indicates whether the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - If any, the reason that the name is not available. - Reason *string `json:"reason,omitempty"` - // Message - If any, the error message that provides more detail for the reason that the name is not available. - Message *string `json:"message,omitempty"` -} - -// RegistryPassword the login password for the container registry. -type RegistryPassword struct { - // Name - The password name. Possible values include: 'Password', 'Password2' - Name PasswordName `json:"name,omitempty"` - // Value - The password value. - Value *string `json:"value,omitempty"` -} - -// RegistryProperties the properties of a container registry. -type RegistryProperties struct { - // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. - LoginServer *string `json:"loginServer,omitempty"` - // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the container registry at the time the operation was called. - Status *Status `json:"status,omitempty"` - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` - // Policies - The policies for a container registry. - Policies *Policies `json:"policies,omitempty"` - // Encryption - The encryption settings of container registry. - Encryption *EncryptionProperty `json:"encryption,omitempty"` - // DataEndpointEnabled - Enable a single data endpoint per region for serving data. - DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` - // DataEndpointHostNames - READ-ONLY; List of host names that will serve data when dataEndpointEnabled is true. - DataEndpointHostNames *[]string `json:"dataEndpointHostNames,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections for a container registry. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' - NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` - // ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry. Possible values include: 'ZoneRedundancyEnabled', 'ZoneRedundancyDisabled' - ZoneRedundancy ZoneRedundancy `json:"zoneRedundancy,omitempty"` - // AnonymousPullEnabled - Enables registry-wide pull from unauthenticated clients. - AnonymousPullEnabled *bool `json:"anonymousPullEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryProperties. -func (rp RegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.AdminUserEnabled != nil { - objectMap["adminUserEnabled"] = rp.AdminUserEnabled - } - if rp.NetworkRuleSet != nil { - objectMap["networkRuleSet"] = rp.NetworkRuleSet - } - if rp.Policies != nil { - objectMap["policies"] = rp.Policies - } - if rp.Encryption != nil { - objectMap["encryption"] = rp.Encryption - } - if rp.DataEndpointEnabled != nil { - objectMap["dataEndpointEnabled"] = rp.DataEndpointEnabled - } - if rp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = rp.PublicNetworkAccess - } - if rp.NetworkRuleBypassOptions != "" { - objectMap["networkRuleBypassOptions"] = rp.NetworkRuleBypassOptions - } - if rp.ZoneRedundancy != "" { - objectMap["zoneRedundancy"] = rp.ZoneRedundancy - } - if rp.AnonymousPullEnabled != nil { - objectMap["anonymousPullEnabled"] = rp.AnonymousPullEnabled - } - return json.Marshal(objectMap) -} - -// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. -type RegistryPropertiesUpdateParameters struct { - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` - // Policies - The policies for a container registry. - Policies *Policies `json:"policies,omitempty"` - // Encryption - The encryption settings of container registry. - Encryption *EncryptionProperty `json:"encryption,omitempty"` - // DataEndpointEnabled - Enable a single data endpoint per region for serving data. - DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' - NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` - // AnonymousPullEnabled - Enables registry-wide pull from unauthenticated clients. - AnonymousPullEnabled *bool `json:"anonymousPullEnabled,omitempty"` -} - -// RegistryUpdateParameters the parameters for updating a container registry. -type RegistryUpdateParameters struct { - // Identity - The identity of the container registry. - Identity *IdentityProperties `json:"identity,omitempty"` - // Tags - The tags for the container registry. - Tags map[string]*string `json:"tags"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. - *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryUpdateParameters. -func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Identity != nil { - objectMap["identity"] = rup.Identity - } - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.Sku != nil { - objectMap["sku"] = rup.Sku - } - if rup.RegistryPropertiesUpdateParameters != nil { - objectMap["properties"] = rup.RegistryPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. -func (rup *RegistryUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rup.Identity = &identity - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rup.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - rup.Sku = &sku - } - case "properties": - if v != nil { - var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters - err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) - if err != nil { - return err - } - rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters - } - } - } - - return nil -} - -// RegistryUsage the quota usage for a container registry. -type RegistryUsage struct { - // Name - The name of the usage. - Name *string `json:"name,omitempty"` - // Limit - The limit of the usage. - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - The current value of the usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - // Unit - The unit of measurement. Possible values include: 'Count', 'Bytes' - Unit RegistryUsageUnit `json:"unit,omitempty"` -} - -// RegistryUsageListResult the result of a request to get container registry quota usages. -type RegistryUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry quota usages. - Value *[]RegistryUsage `json:"value,omitempty"` -} - -// Replication an object that represents a replication for a container registry. -type Replication struct { - autorest.Response `json:"-"` - // ReplicationProperties - The properties of the replication. - *ReplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Replication. -func (r Replication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.ReplicationProperties != nil { - objectMap["properties"] = r.ReplicationProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Replication struct. -func (r *Replication) 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 replicationProperties ReplicationProperties - err = json.Unmarshal(*v, &replicationProperties) - if err != nil { - return err - } - r.ReplicationProperties = &replicationProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - r.SystemData = &systemData - } - } - } - - return nil -} - -// ReplicationListResult the result of a request to list replications for a container registry. -type ReplicationListResult struct { - autorest.Response `json:"-"` - // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - Value *[]Replication `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of replications. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReplicationListResultIterator provides access to a complete listing of Replication values. -type ReplicationListResultIterator struct { - i int - page ReplicationListResultPage -} - -// 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 *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.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 *ReplicationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReplicationListResultIterator) 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 ReplicationListResultIterator) Response() ReplicationListResult { - 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 ReplicationListResultIterator) Value() Replication { - if !iter.page.NotDone() { - return Replication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReplicationListResultIterator type. -func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { - return ReplicationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr ReplicationListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr ReplicationListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// replicationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr ReplicationListResult) replicationListResultPreparer(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))) -} - -// ReplicationListResultPage contains a page of Replication values. -type ReplicationListResultPage struct { - fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) - rlr ReplicationListResult -} - -// 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 *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.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 *ReplicationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReplicationListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReplicationListResultPage) Response() ReplicationListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReplicationListResultPage) Values() []Replication { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the ReplicationListResultPage type. -func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { - return ReplicationListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// ReplicationProperties the properties of a replication. -type ReplicationProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the replication at the time the operation was called. - Status *Status `json:"status,omitempty"` - // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` - // ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry replication. Possible values include: 'ZoneRedundancyEnabled', 'ZoneRedundancyDisabled' - ZoneRedundancy ZoneRedundancy `json:"zoneRedundancy,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationProperties. -func (rp ReplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RegionEndpointEnabled != nil { - objectMap["regionEndpointEnabled"] = rp.RegionEndpointEnabled - } - if rp.ZoneRedundancy != "" { - objectMap["zoneRedundancy"] = rp.ZoneRedundancy - } - return json.Marshal(objectMap) -} - -// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsCreateFuture) 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 ReplicationsCreateFuture.Result. -func (future *ReplicationsCreateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture") - 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, "containerregistry.ReplicationsCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsDeleteFuture) 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 ReplicationsDeleteFuture.Result. -func (future *ReplicationsDeleteFuture) result(client ReplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsUpdateFuture) 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 ReplicationsUpdateFuture.Result. -func (future *ReplicationsUpdateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture") - 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, "containerregistry.ReplicationsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationUpdateParameters the parameters for updating a replication. -type ReplicationUpdateParameters struct { - // Tags - The tags for the replication. - Tags map[string]*string `json:"tags"` - // ReplicationUpdateParametersProperties - The parameters for updating a replication's properties - *ReplicationUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. -func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.ReplicationUpdateParametersProperties != nil { - objectMap["properties"] = rup.ReplicationUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ReplicationUpdateParameters struct. -func (rup *ReplicationUpdateParameters) 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 - } - rup.Tags = tags - } - case "properties": - if v != nil { - var replicationUpdateParametersProperties ReplicationUpdateParametersProperties - err = json.Unmarshal(*v, &replicationUpdateParametersProperties) - if err != nil { - return err - } - rup.ReplicationUpdateParametersProperties = &replicationUpdateParametersProperties - } - } - } - - return nil -} - -// ReplicationUpdateParametersProperties ... -type ReplicationUpdateParametersProperties struct { - // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` -} - -// Request the request that generated the event. -type Request struct { - // ID - The ID of the request that initiated the event. - ID *string `json:"id,omitempty"` - // Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - Addr *string `json:"addr,omitempty"` - // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - Host *string `json:"host,omitempty"` - // Method - The request method that generated the event. - Method *string `json:"method,omitempty"` - // Useragent - The user agent header of the request. - Useragent *string `json:"useragent,omitempty"` -} - -// Resource an Azure resource. -type Resource struct { - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// RetentionPolicy the retention policy for a container registry. -type RetentionPolicy struct { - // Days - The number of days to retain an untagged manifest after which it gets purged. - Days *int32 `json:"days,omitempty"` - // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for RetentionPolicy. -func (rp RetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.Days != nil { - objectMap["days"] = rp.Days - } - if rp.Status != "" { - objectMap["status"] = rp.Status - } - return json.Marshal(objectMap) -} - -// Run run resource properties -type Run struct { - autorest.Response `json:"-"` - // RunProperties - The properties of a run. - *RunProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Run. -func (r Run) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RunProperties != nil { - objectMap["properties"] = r.RunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Run struct. -func (r *Run) 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 runProperties RunProperties - err = json.Unmarshal(*v, &runProperties) - if err != nil { - return err - } - r.RunProperties = &runProperties - } - 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 -} - -// RunFilter properties that are enabled for Odata querying on runs. -type RunFilter struct { - // RunID - The unique identifier for the run. - RunID *string `json:"runId,omitempty"` - // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' - RunType RunType `json:"runType,omitempty"` - // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' - Status RunStatus `json:"status,omitempty"` - // CreateTime - The create time for a run. - CreateTime *date.Time `json:"createTime,omitempty"` - // FinishTime - The time the run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImageManifests - The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of - // build type. - OutputImageManifests *string `json:"outputImageManifests,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // TaskName - The name of the task that the run corresponds to. - TaskName *string `json:"taskName,omitempty"` - // AgentPoolName - The name of the agent pool that the run corresponds to. - AgentPoolName *string `json:"agentPoolName,omitempty"` -} - -// RunGetLogResult the result of get log link operation. -type RunGetLogResult struct { - autorest.Response `json:"-"` - // LogLink - The link to logs for a run on a azure container registry. - LogLink *string `json:"logLink,omitempty"` - // LogArtifactLink - The link to logs in registry for a run on a azure container registry. - LogArtifactLink *string `json:"logArtifactLink,omitempty"` -} - -// RunListResult collection of runs. -type RunListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Run `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RunListResultIterator provides access to a complete listing of Run values. -type RunListResultIterator struct { - i int - page RunListResultPage -} - -// 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 *RunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultIterator.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 *RunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RunListResultIterator) 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 RunListResultIterator) Response() RunListResult { - 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 RunListResultIterator) Value() Run { - if !iter.page.NotDone() { - return Run{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RunListResultIterator type. -func NewRunListResultIterator(page RunListResultPage) RunListResultIterator { - return RunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RunListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RunListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// runListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RunListResult) runListResultPreparer(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))) -} - -// RunListResultPage contains a page of Run values. -type RunListResultPage struct { - fn func(context.Context, RunListResult) (RunListResult, error) - rlr RunListResult -} - -// 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 *RunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultPage.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 *RunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RunListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RunListResultPage) Response() RunListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RunListResultPage) Values() []Run { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RunListResultPage type. -func NewRunListResultPage(cur RunListResult, getNextPage func(context.Context, RunListResult) (RunListResult, error)) RunListResultPage { - return RunListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RunProperties the properties for a run. -type RunProperties struct { - // RunID - The unique identifier for the run. - RunID *string `json:"runId,omitempty"` - // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' - Status RunStatus `json:"status,omitempty"` - // LastUpdatedTime - The last updated time for the run. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' - RunType RunType `json:"runType,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // CreateTime - The time the run was scheduled. - CreateTime *date.Time `json:"createTime,omitempty"` - // StartTime - The time the run started. - StartTime *date.Time `json:"startTime,omitempty"` - // FinishTime - The time the run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImages - The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. - OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` - // Task - The task against which run was scheduled. - Task *string `json:"task,omitempty"` - // ImageUpdateTrigger - The image update trigger that caused the run. This is applicable if the task has base image trigger configured. - ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` - // SourceTrigger - The source trigger that caused the run. - SourceTrigger *SourceTriggerDescriptor `json:"sourceTrigger,omitempty"` - // TimerTrigger - The timer trigger that caused the run. - TimerTrigger *TimerTriggerDescriptor `json:"timerTrigger,omitempty"` - // Platform - The platform properties against which the run will happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceRegistryAuth - The scope of the credentials that were used to login to the source registry during this run. - SourceRegistryAuth *string `json:"sourceRegistryAuth,omitempty"` - // CustomRegistries - The list of custom registries that were logged in during this run. - CustomRegistries *[]string `json:"customRegistries,omitempty"` - // RunErrorMessage - READ-ONLY; The error message received from backend systems after the run is scheduled. - RunErrorMessage *string `json:"runErrorMessage,omitempty"` - // UpdateTriggerToken - The update trigger token passed for the Run. - UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` - // LogArtifact - READ-ONLY; The image description for the log artifact. - LogArtifact *ImageDescriptor `json:"logArtifact,omitempty"` - // ProvisioningState - The provisioning state of a run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunProperties. -func (rp RunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RunID != nil { - objectMap["runId"] = rp.RunID - } - if rp.Status != "" { - objectMap["status"] = rp.Status - } - if rp.LastUpdatedTime != nil { - objectMap["lastUpdatedTime"] = rp.LastUpdatedTime - } - if rp.RunType != "" { - objectMap["runType"] = rp.RunType - } - if rp.AgentPoolName != nil { - objectMap["agentPoolName"] = rp.AgentPoolName - } - if rp.CreateTime != nil { - objectMap["createTime"] = rp.CreateTime - } - if rp.StartTime != nil { - objectMap["startTime"] = rp.StartTime - } - if rp.FinishTime != nil { - objectMap["finishTime"] = rp.FinishTime - } - if rp.OutputImages != nil { - objectMap["outputImages"] = rp.OutputImages - } - if rp.Task != nil { - objectMap["task"] = rp.Task - } - if rp.ImageUpdateTrigger != nil { - objectMap["imageUpdateTrigger"] = rp.ImageUpdateTrigger - } - if rp.SourceTrigger != nil { - objectMap["sourceTrigger"] = rp.SourceTrigger - } - if rp.TimerTrigger != nil { - objectMap["timerTrigger"] = rp.TimerTrigger - } - if rp.Platform != nil { - objectMap["platform"] = rp.Platform - } - if rp.AgentConfiguration != nil { - objectMap["agentConfiguration"] = rp.AgentConfiguration - } - if rp.SourceRegistryAuth != nil { - objectMap["sourceRegistryAuth"] = rp.SourceRegistryAuth - } - if rp.CustomRegistries != nil { - objectMap["customRegistries"] = rp.CustomRegistries - } - if rp.UpdateTriggerToken != nil { - objectMap["updateTriggerToken"] = rp.UpdateTriggerToken - } - if rp.ProvisioningState != "" { - objectMap["provisioningState"] = rp.ProvisioningState - } - if rp.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = rp.IsArchiveEnabled - } - return json.Marshal(objectMap) -} - -// BasicRunRequest the request parameters for scheduling a run. -type BasicRunRequest interface { - AsDockerBuildRequest() (*DockerBuildRequest, bool) - AsFileTaskRunRequest() (*FileTaskRunRequest, bool) - AsTaskRunRequest() (*TaskRunRequest, bool) - AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) - AsRunRequest() (*RunRequest, bool) -} - -// RunRequest the request parameters for scheduling a run. -type RunRequest struct { - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicRunRequest(body []byte) (BasicRunRequest, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeDockerBuildRequest): - var dbr DockerBuildRequest - err := json.Unmarshal(body, &dbr) - return dbr, err - case string(TypeFileTaskRunRequest): - var ftrr FileTaskRunRequest - err := json.Unmarshal(body, &ftrr) - return ftrr, err - case string(TypeTaskRunRequest): - var trr TaskRunRequest - err := json.Unmarshal(body, &trr) - return trr, err - case string(TypeEncodedTaskRunRequest): - var etrr EncodedTaskRunRequest - err := json.Unmarshal(body, &etrr) - return etrr, err - default: - var rr RunRequest - err := json.Unmarshal(body, &rr) - return rr, err - } -} -func unmarshalBasicRunRequestArray(body []byte) ([]BasicRunRequest, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rrArray := make([]BasicRunRequest, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rr, err := unmarshalBasicRunRequest(*rawMessage) - if err != nil { - return nil, err - } - rrArray[index] = rr - } - return rrArray, nil -} - -// MarshalJSON is the custom marshaler for RunRequest. -func (rr RunRequest) MarshalJSON() ([]byte, error) { - rr.Type = TypeRunRequest - objectMap := make(map[string]interface{}) - if rr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = rr.IsArchiveEnabled - } - if rr.AgentPoolName != nil { - objectMap["agentPoolName"] = rr.AgentPoolName - } - if rr.LogTemplate != nil { - objectMap["logTemplate"] = rr.LogTemplate - } - if rr.Type != "" { - objectMap["type"] = rr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsRunRequest() (*RunRequest, bool) { - return &rr, true -} - -// AsBasicRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &rr, true -} - -// RunsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type RunsCancelFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunsCancelFuture) 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 RunsCancelFuture.Result. -func (future *RunsCancelFuture) result(client RunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsCancelFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RunsCancelFuture") - return - } - ar.Response = future.Response() - return -} - -// RunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type RunsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunsClient) (Run, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunsUpdateFuture) 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 RunsUpdateFuture.Result. -func (future *RunsUpdateFuture) result(client RunsClient) (r Run, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RunsUpdateFuture") - 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, "containerregistry.RunsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RunUpdateParameters the set of run properties that can be updated. -type RunUpdateParameters struct { - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` -} - -// ScopeMap an object that represents a scope map for a container registry. -type ScopeMap struct { - autorest.Response `json:"-"` - // ScopeMapProperties - The properties of the scope map. - *ScopeMapProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeMap. -func (sm ScopeMap) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sm.ScopeMapProperties != nil { - objectMap["properties"] = sm.ScopeMapProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopeMap struct. -func (sm *ScopeMap) 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 scopeMapProperties ScopeMapProperties - err = json.Unmarshal(*v, &scopeMapProperties) - if err != nil { - return err - } - sm.ScopeMapProperties = &scopeMapProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sm.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sm.SystemData = &systemData - } - } - } - - return nil -} - -// ScopeMapListResult the result of a request to list scope maps for a container registry. -type ScopeMapListResult struct { - autorest.Response `json:"-"` - // Value - The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. - Value *[]ScopeMap `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of scope maps. - NextLink *string `json:"nextLink,omitempty"` -} - -// ScopeMapListResultIterator provides access to a complete listing of ScopeMap values. -type ScopeMapListResultIterator struct { - i int - page ScopeMapListResultPage -} - -// 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 *ScopeMapListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultIterator.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 *ScopeMapListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScopeMapListResultIterator) 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 ScopeMapListResultIterator) Response() ScopeMapListResult { - 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 ScopeMapListResultIterator) Value() ScopeMap { - if !iter.page.NotDone() { - return ScopeMap{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScopeMapListResultIterator type. -func NewScopeMapListResultIterator(page ScopeMapListResultPage) ScopeMapListResultIterator { - return ScopeMapListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (smlr ScopeMapListResult) IsEmpty() bool { - return smlr.Value == nil || len(*smlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (smlr ScopeMapListResult) hasNextLink() bool { - return smlr.NextLink != nil && len(*smlr.NextLink) != 0 -} - -// scopeMapListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (smlr ScopeMapListResult) scopeMapListResultPreparer(ctx context.Context) (*http.Request, error) { - if !smlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(smlr.NextLink))) -} - -// ScopeMapListResultPage contains a page of ScopeMap values. -type ScopeMapListResultPage struct { - fn func(context.Context, ScopeMapListResult) (ScopeMapListResult, error) - smlr ScopeMapListResult -} - -// 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 *ScopeMapListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultPage.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.smlr) - if err != nil { - return err - } - page.smlr = 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 *ScopeMapListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScopeMapListResultPage) NotDone() bool { - return !page.smlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScopeMapListResultPage) Response() ScopeMapListResult { - return page.smlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScopeMapListResultPage) Values() []ScopeMap { - if page.smlr.IsEmpty() { - return nil - } - return *page.smlr.Value -} - -// Creates a new instance of the ScopeMapListResultPage type. -func NewScopeMapListResultPage(cur ScopeMapListResult, getNextPage func(context.Context, ScopeMapListResult) (ScopeMapListResult, error)) ScopeMapListResultPage { - return ScopeMapListResultPage{ - fn: getNextPage, - smlr: cur, - } -} - -// ScopeMapProperties the properties of a scope map. -type ScopeMapProperties struct { - // Description - The user friendly description of the scope map. - Description *string `json:"description,omitempty"` - // Type - READ-ONLY; The type of the scope map. E.g. BuildIn scope map. - Type *string `json:"type,omitempty"` - // CreationDate - READ-ONLY; The creation date of scope map. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Actions - The list of scoped permissions for registry artifacts. - // E.g. repositories/repository-name/content/read, - // repositories/repository-name/metadata/write - Actions *[]string `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeMapProperties. -func (smp ScopeMapProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smp.Description != nil { - objectMap["description"] = smp.Description - } - if smp.Actions != nil { - objectMap["actions"] = smp.Actions - } - return json.Marshal(objectMap) -} - -// ScopeMapPropertiesUpdateParameters the update parameters for scope map properties. -type ScopeMapPropertiesUpdateParameters struct { - // Description - The user friendly description of the scope map. - Description *string `json:"description,omitempty"` - // Actions - The list of scope permissions for registry artifacts. - // E.g. repositories/repository-name/pull, - // repositories/repository-name/delete - Actions *[]string `json:"actions,omitempty"` -} - -// ScopeMapsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScopeMapsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScopeMapsClient) (ScopeMap, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScopeMapsCreateFuture) 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 ScopeMapsCreateFuture.Result. -func (future *ScopeMapsCreateFuture) result(client ScopeMapsClient) (sm ScopeMap, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.CreateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// ScopeMapsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScopeMapsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScopeMapsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScopeMapsDeleteFuture) 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 ScopeMapsDeleteFuture.Result. -func (future *ScopeMapsDeleteFuture) result(client ScopeMapsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ScopeMapsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScopeMapsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScopeMapsClient) (ScopeMap, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScopeMapsUpdateFuture) 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 ScopeMapsUpdateFuture.Result. -func (future *ScopeMapsUpdateFuture) result(client ScopeMapsClient) (sm ScopeMap, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.UpdateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// ScopeMapUpdateParameters the properties for updating the scope map. -type ScopeMapUpdateParameters struct { - // ScopeMapPropertiesUpdateParameters - The update parameters for scope map properties. - *ScopeMapPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeMapUpdateParameters. -func (smup ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smup.ScopeMapPropertiesUpdateParameters != nil { - objectMap["properties"] = smup.ScopeMapPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopeMapUpdateParameters struct. -func (smup *ScopeMapUpdateParameters) 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 scopeMapPropertiesUpdateParameters ScopeMapPropertiesUpdateParameters - err = json.Unmarshal(*v, &scopeMapPropertiesUpdateParameters) - if err != nil { - return err - } - smup.ScopeMapPropertiesUpdateParameters = &scopeMapPropertiesUpdateParameters - } - } - } - - return nil -} - -// SecretObject describes the properties of a secret object value. -type SecretObject struct { - // Value - The value of the secret. The format of this value will be determined - // based on the type of the secret object. If the type is Opaque, the value will be - // used as is without any modification. - Value *string `json:"value,omitempty"` - // Type - The type of the secret object which determines how the value of the secret object has to be - // interpreted. Possible values include: 'Opaque', 'Vaultsecret' - Type SecretObjectType `json:"type,omitempty"` -} - -// SetValue the properties of a overridable value that can be passed to a task template. -type SetValue struct { - // Name - The name of the overridable value. - Name *string `json:"name,omitempty"` - // Value - The overridable value. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the value represents a secret or not. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// Sku the SKU of a container registry. -type Sku struct { - // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium' - Name SkuName `json:"name,omitempty"` - // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` -} - -// MarshalJSON is the custom marshaler for Sku. -func (s Sku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Name != "" { - objectMap["name"] = s.Name - } - return json.Marshal(objectMap) -} - -// Source the registry node that generated the event. Put differently, while the actor initiates the event, -// the source generates it. -type Source struct { - // Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - Addr *string `json:"addr,omitempty"` - // InstanceID - The running instance of an application. Changes after each restart. - InstanceID *string `json:"instanceID,omitempty"` -} - -// SourceProperties the properties of the source code repository. -type SourceProperties struct { - // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceRegistryCredentials describes the credential parameters for accessing the source registry. -type SourceRegistryCredentials struct { - // LoginMode - The authentication mode which determines the source registry login scope. The credentials for the source registry - // will be generated using the given scope. These credentials will be used to login to - // the source registry during the run. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' - LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` -} - -// SourceTrigger the properties of a source based trigger. -type SourceTrigger struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceTriggerDescriptor the source trigger that caused a run. -type SourceTriggerDescriptor struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // EventType - The event type of the trigger. - EventType *string `json:"eventType,omitempty"` - // CommitID - The unique ID that identifies a commit. - CommitID *string `json:"commitId,omitempty"` - // PullRequestID - The unique ID that identifies pull request. - PullRequestID *string `json:"pullRequestId,omitempty"` - // RepositoryURL - The repository URL. - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // BranchName - The branch name in the repository. - BranchName *string `json:"branchName,omitempty"` - // ProviderType - The source control provider type. - ProviderType *string `json:"providerType,omitempty"` -} - -// SourceTriggerUpdateParameters the properties for updating a source based trigger. -type SourceTriggerUpdateParameters struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceUpdateParameters the properties for updating the source code repository. -type SourceUpdateParameters struct { - // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceUploadDefinition the properties of a response to source upload request. -type SourceUploadDefinition struct { - autorest.Response `json:"-"` - // UploadURL - The URL where the client can upload the source. - UploadURL *string `json:"uploadUrl,omitempty"` - // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. - RelativePath *string `json:"relativePath,omitempty"` -} - -// Status the status of an Azure resource at the time the operation was called. -type Status struct { - // DisplayStatus - READ-ONLY; The short label for the status. - DisplayStatus *string `json:"displayStatus,omitempty"` - // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. - Message *string `json:"message,omitempty"` - // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for Status. -func (s Status) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StatusDetailProperties the status detail properties of the connected registry. -type StatusDetailProperties struct { - // Type - READ-ONLY; The component of the connected registry corresponding to the status. - Type *string `json:"type,omitempty"` - // Code - READ-ONLY; The code of the status. - Code *string `json:"code,omitempty"` - // Description - READ-ONLY; The description of the status. - Description *string `json:"description,omitempty"` - // Timestamp - READ-ONLY; The timestamp of the status. - Timestamp *date.Time `json:"timestamp,omitempty"` - // CorrelationID - READ-ONLY; The correlation ID of the status. - CorrelationID *string `json:"correlationId,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatusDetailProperties. -func (sdp StatusDetailProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncProperties the sync properties of the connected registry with its parent. -type SyncProperties struct { - // TokenID - The resource ID of the ACR token used to authenticate the connected registry to its parent during sync. - TokenID *string `json:"tokenId,omitempty"` - // Schedule - The cron expression indicating the schedule that the connected registry will sync with its parent. - Schedule *string `json:"schedule,omitempty"` - // SyncWindow - The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - SyncWindow *string `json:"syncWindow,omitempty"` - // MessageTTL - The period of time for which a message is available to sync before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - MessageTTL *string `json:"messageTtl,omitempty"` - // LastSyncTime - READ-ONLY; The last time a sync occurred between the connected registry and its parent. - LastSyncTime *date.Time `json:"lastSyncTime,omitempty"` - // GatewayEndpoint - READ-ONLY; The gateway endpoint used by the connected registry to communicate with its parent. - GatewayEndpoint *string `json:"gatewayEndpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncProperties. -func (sp SyncProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.TokenID != nil { - objectMap["tokenId"] = sp.TokenID - } - if sp.Schedule != nil { - objectMap["schedule"] = sp.Schedule - } - if sp.SyncWindow != nil { - objectMap["syncWindow"] = sp.SyncWindow - } - if sp.MessageTTL != nil { - objectMap["messageTtl"] = sp.MessageTTL - } - return json.Marshal(objectMap) -} - -// SyncUpdateProperties the parameters for updating the sync properties of the connected registry with its -// parent. -type SyncUpdateProperties struct { - // Schedule - The cron expression indicating the schedule that the connected registry will sync with its parent. - Schedule *string `json:"schedule,omitempty"` - // SyncWindow - The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - SyncWindow *string `json:"syncWindow,omitempty"` - // MessageTTL - The period of time for which a message is available to sync before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - MessageTTL *string `json:"messageTtl,omitempty"` -} - -// 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: 'User', 'Application', 'ManagedIdentity', 'Key' - 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: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' - LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource modification (UTC). - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// Target the target of the event. -type Target struct { - // MediaType - The MIME type of the referenced object. - MediaType *string `json:"mediaType,omitempty"` - // Size - The number of bytes of the content. Same as Length field. - Size *int64 `json:"size,omitempty"` - // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. - Digest *string `json:"digest,omitempty"` - // Length - The number of bytes of the content. Same as Size field. - Length *int64 `json:"length,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // URL - The direct URL to the content. - URL *string `json:"url,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Name - The name of the artifact. - Name *string `json:"name,omitempty"` - // Version - The version of the artifact. - Version *string `json:"version,omitempty"` -} - -// Task the task that has the ARM resource and task properties. -// The task will have all information to schedule a run against it. -type Task struct { - autorest.Response `json:"-"` - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskProperties - The properties of a task. - *TaskProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Task. -func (t Task) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.Identity != nil { - objectMap["identity"] = t.Identity - } - if t.TaskProperties != nil { - objectMap["properties"] = t.TaskProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Task struct. -func (t *Task) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - t.Identity = &identity - } - case "properties": - if v != nil { - var taskProperties TaskProperties - err = json.Unmarshal(*v, &taskProperties) - if err != nil { - return err - } - t.TaskProperties = &taskProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - t.SystemData = &systemData - } - } - } - - return nil -} - -// TaskListResult the collection of tasks. -type TaskListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Task `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// TaskListResultIterator provides access to a complete listing of Task values. -type TaskListResultIterator struct { - i int - page TaskListResultPage -} - -// 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 *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.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 *TaskListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskListResultIterator) 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 TaskListResultIterator) Response() TaskListResult { - 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 TaskListResultIterator) Value() Task { - if !iter.page.NotDone() { - return Task{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TaskListResultIterator type. -func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { - return TaskListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TaskListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TaskListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// taskListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TaskListResult) taskListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TaskListResultPage contains a page of Task values. -type TaskListResultPage struct { - fn func(context.Context, TaskListResult) (TaskListResult, error) - tlr TaskListResult -} - -// 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 *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TaskListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TaskListResultPage) Response() TaskListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TaskListResultPage) Values() []Task { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TaskListResultPage type. -func NewTaskListResultPage(cur TaskListResult, getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { - return TaskListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TaskProperties the properties of a task. -type TaskProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CreationDate - READ-ONLY; The creation date of task. - CreationDate *date.Time `json:"creationDate,omitempty"` - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // AgentPoolName - The dedicated agent pool for the task. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties of a task step. - Step BasicTaskStepProperties `json:"step,omitempty"` - // Trigger - The properties that describe all triggers for the task. - Trigger *TriggerProperties `json:"trigger,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // IsSystemTask - The value of this property indicates whether the task resource is system task or not. - IsSystemTask *bool `json:"isSystemTask,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskProperties. -func (tp TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.Status != "" { - objectMap["status"] = tp.Status - } - if tp.Platform != nil { - objectMap["platform"] = tp.Platform - } - if tp.AgentConfiguration != nil { - objectMap["agentConfiguration"] = tp.AgentConfiguration - } - if tp.AgentPoolName != nil { - objectMap["agentPoolName"] = tp.AgentPoolName - } - if tp.Timeout != nil { - objectMap["timeout"] = tp.Timeout - } - objectMap["step"] = tp.Step - if tp.Trigger != nil { - objectMap["trigger"] = tp.Trigger - } - if tp.Credentials != nil { - objectMap["credentials"] = tp.Credentials - } - if tp.LogTemplate != nil { - objectMap["logTemplate"] = tp.LogTemplate - } - if tp.IsSystemTask != nil { - objectMap["isSystemTask"] = tp.IsSystemTask - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. -func (tp *TaskProperties) 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 "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "creationDate": - if v != nil { - var creationDate date.Time - err = json.Unmarshal(*v, &creationDate) - if err != nil { - return err - } - tp.CreationDate = &creationDate - } - case "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tp.Status = status - } - case "platform": - if v != nil { - var platform PlatformProperties - err = json.Unmarshal(*v, &platform) - if err != nil { - return err - } - tp.Platform = &platform - } - case "agentConfiguration": - if v != nil { - var agentConfiguration AgentProperties - err = json.Unmarshal(*v, &agentConfiguration) - if err != nil { - return err - } - tp.AgentConfiguration = &agentConfiguration - } - case "agentPoolName": - if v != nil { - var agentPoolName string - err = json.Unmarshal(*v, &agentPoolName) - if err != nil { - return err - } - tp.AgentPoolName = &agentPoolName - } - case "timeout": - if v != nil { - var timeout int32 - err = json.Unmarshal(*v, &timeout) - if err != nil { - return err - } - tp.Timeout = &timeout - } - case "step": - if v != nil { - step, err := unmarshalBasicTaskStepProperties(*v) - if err != nil { - return err - } - tp.Step = step - } - case "trigger": - if v != nil { - var trigger TriggerProperties - err = json.Unmarshal(*v, &trigger) - if err != nil { - return err - } - tp.Trigger = &trigger - } - case "credentials": - if v != nil { - var credentials Credentials - err = json.Unmarshal(*v, &credentials) - if err != nil { - return err - } - tp.Credentials = &credentials - } - case "logTemplate": - if v != nil { - var logTemplate string - err = json.Unmarshal(*v, &logTemplate) - if err != nil { - return err - } - tp.LogTemplate = &logTemplate - } - case "isSystemTask": - if v != nil { - var isSystemTask bool - err = json.Unmarshal(*v, &isSystemTask) - if err != nil { - return err - } - tp.IsSystemTask = &isSystemTask - } - } - } - - return nil -} - -// TaskPropertiesUpdateParameters the properties for updating a task. -type TaskPropertiesUpdateParameters struct { - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformUpdateParameters `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // AgentPoolName - The dedicated agent pool for the task. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties for updating a task step. - Step BasicTaskStepUpdateParameters `json:"step,omitempty"` - // Trigger - The properties for updating trigger properties. - Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` - // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. -func (tpup *TaskPropertiesUpdateParameters) 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 "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tpup.Status = status - } - case "platform": - if v != nil { - var platform PlatformUpdateParameters - err = json.Unmarshal(*v, &platform) - if err != nil { - return err - } - tpup.Platform = &platform - } - case "agentConfiguration": - if v != nil { - var agentConfiguration AgentProperties - err = json.Unmarshal(*v, &agentConfiguration) - if err != nil { - return err - } - tpup.AgentConfiguration = &agentConfiguration - } - case "agentPoolName": - if v != nil { - var agentPoolName string - err = json.Unmarshal(*v, &agentPoolName) - if err != nil { - return err - } - tpup.AgentPoolName = &agentPoolName - } - case "timeout": - if v != nil { - var timeout int32 - err = json.Unmarshal(*v, &timeout) - if err != nil { - return err - } - tpup.Timeout = &timeout - } - case "step": - if v != nil { - step, err := unmarshalBasicTaskStepUpdateParameters(*v) - if err != nil { - return err - } - tpup.Step = step - } - case "trigger": - if v != nil { - var trigger TriggerUpdateParameters - err = json.Unmarshal(*v, &trigger) - if err != nil { - return err - } - tpup.Trigger = &trigger - } - case "credentials": - if v != nil { - var credentials Credentials - err = json.Unmarshal(*v, &credentials) - if err != nil { - return err - } - tpup.Credentials = &credentials - } - case "logTemplate": - if v != nil { - var logTemplate string - err = json.Unmarshal(*v, &logTemplate) - if err != nil { - return err - } - tpup.LogTemplate = &logTemplate - } - } - } - - return nil -} - -// TaskRun the task run that has the ARM resource and properties. -// The task run will have the information of request and result of a run. -type TaskRun struct { - autorest.Response `json:"-"` - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunProperties - The properties associated with the task run, i.e., request and result of the run - *TaskRunProperties `json:"properties,omitempty"` - // Location - The location of the resource - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRun. -func (tr TaskRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Identity != nil { - objectMap["identity"] = tr.Identity - } - if tr.TaskRunProperties != nil { - objectMap["properties"] = tr.TaskRunProperties - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRun struct. -func (tr *TaskRun) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tr.Identity = &identity - } - case "properties": - if v != nil { - var taskRunProperties TaskRunProperties - err = json.Unmarshal(*v, &taskRunProperties) - if err != nil { - return err - } - tr.TaskRunProperties = &taskRunProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tr.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - tr.SystemData = &systemData - } - } - } - - return nil -} - -// TaskRunListResult the collection of task runs. -type TaskRunListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]TaskRun `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// TaskRunListResultIterator provides access to a complete listing of TaskRun values. -type TaskRunListResultIterator struct { - i int - page TaskRunListResultPage -} - -// 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 *TaskRunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultIterator.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 *TaskRunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskRunListResultIterator) 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 TaskRunListResultIterator) Response() TaskRunListResult { - 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 TaskRunListResultIterator) Value() TaskRun { - if !iter.page.NotDone() { - return TaskRun{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TaskRunListResultIterator type. -func NewTaskRunListResultIterator(page TaskRunListResultPage) TaskRunListResultIterator { - return TaskRunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (trlr TaskRunListResult) IsEmpty() bool { - return trlr.Value == nil || len(*trlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (trlr TaskRunListResult) hasNextLink() bool { - return trlr.NextLink != nil && len(*trlr.NextLink) != 0 -} - -// taskRunListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (trlr TaskRunListResult) taskRunListResultPreparer(ctx context.Context) (*http.Request, error) { - if !trlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(trlr.NextLink))) -} - -// TaskRunListResultPage contains a page of TaskRun values. -type TaskRunListResultPage struct { - fn func(context.Context, TaskRunListResult) (TaskRunListResult, error) - trlr TaskRunListResult -} - -// 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 *TaskRunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultPage.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.trlr) - if err != nil { - return err - } - page.trlr = 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 *TaskRunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskRunListResultPage) NotDone() bool { - return !page.trlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TaskRunListResultPage) Response() TaskRunListResult { - return page.trlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TaskRunListResultPage) Values() []TaskRun { - if page.trlr.IsEmpty() { - return nil - } - return *page.trlr.Value -} - -// Creates a new instance of the TaskRunListResultPage type. -func NewTaskRunListResultPage(cur TaskRunListResult, getNextPage func(context.Context, TaskRunListResult) (TaskRunListResult, error)) TaskRunListResultPage { - return TaskRunListResultPage{ - fn: getNextPage, - trlr: cur, - } -} - -// TaskRunProperties the properties of task run. -type TaskRunProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of this task run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // RunRequest - The request (parameters) for the run - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // RunResult - READ-ONLY; The result of this task run - RunResult *Run `json:"runResult,omitempty"` - // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRunProperties. -func (trp TaskRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["runRequest"] = trp.RunRequest - if trp.ForceUpdateTag != nil { - objectMap["forceUpdateTag"] = trp.ForceUpdateTag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunProperties struct. -func (trp *TaskRunProperties) 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 "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - trp.ProvisioningState = provisioningState - } - case "runRequest": - if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) - if err != nil { - return err - } - trp.RunRequest = runRequest - } - case "runResult": - if v != nil { - var runResult Run - err = json.Unmarshal(*v, &runResult) - if err != nil { - return err - } - trp.RunResult = &runResult - } - case "forceUpdateTag": - if v != nil { - var forceUpdateTag string - err = json.Unmarshal(*v, &forceUpdateTag) - if err != nil { - return err - } - trp.ForceUpdateTag = &forceUpdateTag - } - } - } - - return nil -} - -// TaskRunPropertiesUpdateParameters the properties of a task run update parameters. -type TaskRunPropertiesUpdateParameters struct { - // RunRequest - The request (parameters) for the new run - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunPropertiesUpdateParameters struct. -func (trpup *TaskRunPropertiesUpdateParameters) 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 "runRequest": - if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) - if err != nil { - return err - } - trpup.RunRequest = runRequest - } - case "forceUpdateTag": - if v != nil { - var forceUpdateTag string - err = json.Unmarshal(*v, &forceUpdateTag) - if err != nil { - return err - } - trpup.ForceUpdateTag = &forceUpdateTag - } - } - } - - return nil -} - -// TaskRunRequest the parameters for a task run request. -type TaskRunRequest struct { - // TaskID - The resource ID of task against which run has to be queued. - TaskID *string `json:"taskId,omitempty"` - // OverrideTaskStepProperties - Set of overridable parameters that can be passed when running a Task. - OverrideTaskStepProperties *OverrideTaskStepProperties `json:"overrideTaskStepProperties,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRunRequest. -func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { - trr.Type = TypeTaskRunRequest - objectMap := make(map[string]interface{}) - if trr.TaskID != nil { - objectMap["taskId"] = trr.TaskID - } - if trr.OverrideTaskStepProperties != nil { - objectMap["overrideTaskStepProperties"] = trr.OverrideTaskStepProperties - } - if trr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled - } - if trr.AgentPoolName != nil { - objectMap["agentPoolName"] = trr.AgentPoolName - } - if trr.LogTemplate != nil { - objectMap["logTemplate"] = trr.LogTemplate - } - if trr.Type != "" { - objectMap["type"] = trr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return &trr, true -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &trr, true -} - -// TaskRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (TaskRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsCreateFuture) 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 TaskRunsCreateFuture.Result. -func (future *TaskRunsCreateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.CreateResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsDeleteFuture) 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 TaskRunsDeleteFuture.Result. -func (future *TaskRunsDeleteFuture) result(client TaskRunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TaskRunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (TaskRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsUpdateFuture) 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 TaskRunsUpdateFuture.Result. -func (future *TaskRunsUpdateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.UpdateResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskRunUpdateParameters the parameters for updating a task run. -type TaskRunUpdateParameters struct { - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunPropertiesUpdateParameters - The properties for updating a task run. - *TaskRunPropertiesUpdateParameters `json:"properties,omitempty"` - // Location - The location of the resource - Location *string `json:"location,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TaskRunUpdateParameters. -func (trup TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if trup.Identity != nil { - objectMap["identity"] = trup.Identity - } - if trup.TaskRunPropertiesUpdateParameters != nil { - objectMap["properties"] = trup.TaskRunPropertiesUpdateParameters - } - if trup.Location != nil { - objectMap["location"] = trup.Location - } - if trup.Tags != nil { - objectMap["tags"] = trup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunUpdateParameters struct. -func (trup *TaskRunUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - trup.Identity = &identity - } - case "properties": - if v != nil { - var taskRunPropertiesUpdateParameters TaskRunPropertiesUpdateParameters - err = json.Unmarshal(*v, &taskRunPropertiesUpdateParameters) - if err != nil { - return err - } - trup.TaskRunPropertiesUpdateParameters = &taskRunPropertiesUpdateParameters - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - trup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - trup.Tags = tags - } - } - } - - return nil -} - -// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (Task, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksCreateFuture) 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 TasksCreateFuture.Result. -func (future *TasksCreateFuture) result(client TasksClient) (t Task, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksDeleteFuture) 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 TasksDeleteFuture.Result. -func (future *TasksDeleteFuture) result(client TasksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BasicTaskStepProperties base properties for any task step. -type BasicTaskStepProperties interface { - AsDockerBuildStep() (*DockerBuildStep, bool) - AsFileTaskStep() (*FileTaskStep, bool) - AsEncodedTaskStep() (*EncodedTaskStep, bool) - AsTaskStepProperties() (*TaskStepProperties, bool) -} - -// TaskStepProperties base properties for any task step. -type TaskStepProperties struct { - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeDocker): - var dbs DockerBuildStep - err := json.Unmarshal(body, &dbs) - return dbs, err - case string(TypeFileTask): - var fts FileTaskStep - err := json.Unmarshal(body, &fts) - return fts, err - case string(TypeEncodedTask): - var ets EncodedTaskStep - err := json.Unmarshal(body, &ets) - return ets, err - default: - var tsp TaskStepProperties - err := json.Unmarshal(body, &tsp) - return tsp, err - } -} -func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tspArray := make([]BasicTaskStepProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) - if err != nil { - return nil, err - } - tspArray[index] = tsp - } - return tspArray, nil -} - -// MarshalJSON is the custom marshaler for TaskStepProperties. -func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { - tsp.Type = TypeTaskStepProperties - objectMap := make(map[string]interface{}) - if tsp.ContextPath != nil { - objectMap["contextPath"] = tsp.ContextPath - } - if tsp.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsp.ContextAccessToken - } - if tsp.Type != "" { - objectMap["type"] = tsp.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { - return &tsp, true -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &tsp, true -} - -// BasicTaskStepUpdateParameters base properties for updating any task step. -type BasicTaskStepUpdateParameters interface { - AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) - AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) - AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) - AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) -} - -// TaskStepUpdateParameters base properties for updating any task step. -type TaskStepUpdateParameters struct { - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicTaskStepUpdateParametersTypeDocker): - var dbsup DockerBuildStepUpdateParameters - err := json.Unmarshal(body, &dbsup) - return dbsup, err - case string(TypeBasicTaskStepUpdateParametersTypeFileTask): - var ftsup FileTaskStepUpdateParameters - err := json.Unmarshal(body, &ftsup) - return ftsup, err - case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): - var etsup EncodedTaskStepUpdateParameters - err := json.Unmarshal(body, &etsup) - return etsup, err - default: - var tsup TaskStepUpdateParameters - err := json.Unmarshal(body, &tsup) - return tsup, err - } -} -func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) - if err != nil { - return nil, err - } - tsupArray[index] = tsup - } - return tsupArray, nil -} - -// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters - objectMap := make(map[string]interface{}) - if tsup.ContextPath != nil { - objectMap["contextPath"] = tsup.ContextPath - } - if tsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsup.ContextAccessToken - } - if tsup.Type != "" { - objectMap["type"] = tsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return &tsup, true -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &tsup, true -} - -// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (Task, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksUpdateFuture) 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 TasksUpdateFuture.Result. -func (future *TasksUpdateFuture) result(client TasksClient) (t Task, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskUpdateParameters the parameters for updating a task. -type TaskUpdateParameters struct { - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskPropertiesUpdateParameters - The properties for updating a task. - *TaskPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TaskUpdateParameters. -func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Identity != nil { - objectMap["identity"] = tup.Identity - } - if tup.TaskPropertiesUpdateParameters != nil { - objectMap["properties"] = tup.TaskPropertiesUpdateParameters - } - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. -func (tup *TaskUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tup.Identity = &identity - } - case "properties": - if v != nil { - var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters - err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) - if err != nil { - return err - } - tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tup.Tags = tags - } - } - } - - return nil -} - -// TimerTrigger the properties of a timer trigger. -type TimerTrigger struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// TimerTriggerDescriptor ... -type TimerTriggerDescriptor struct { - // TimerTriggerName - The timer trigger name that caused the run. - TimerTriggerName *string `json:"timerTriggerName,omitempty"` - // ScheduleOccurrence - The occurrence that triggered the run. - ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` -} - -// TimerTriggerUpdateParameters the properties for updating a timer trigger. -type TimerTriggerUpdateParameters struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// TLSCertificateProperties the TLS certificate properties of the connected registry login server. -type TLSCertificateProperties struct { - // Type - READ-ONLY; The type of certificate location. Possible values include: 'LocalDirectory' - Type CertificateType `json:"type,omitempty"` - // Location - READ-ONLY; Indicates the location of the certificates. - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for TLSCertificateProperties. -func (TCP TLSCertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TLSProperties the TLS properties of the connected registry login server. -type TLSProperties struct { - // Status - READ-ONLY; Indicates whether HTTPS is enabled for the login server. Possible values include: 'TLSStatusEnabled', 'TLSStatusDisabled' - Status TLSStatus `json:"status,omitempty"` - // Certificate - READ-ONLY; The certificate used to configure HTTPS for the login server. - Certificate *TLSCertificateProperties `json:"certificate,omitempty"` -} - -// MarshalJSON is the custom marshaler for TLSProperties. -func (tp TLSProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Token an object that represents a token for a container registry. -type Token struct { - autorest.Response `json:"-"` - // TokenProperties - The properties of the token. - *TokenProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Token. -func (t Token) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TokenProperties != nil { - objectMap["properties"] = t.TokenProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Token struct. -func (t *Token) 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 tokenProperties TokenProperties - err = json.Unmarshal(*v, &tokenProperties) - if err != nil { - return err - } - t.TokenProperties = &tokenProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - t.SystemData = &systemData - } - } - } - - return nil -} - -// TokenCertificate the properties of a certificate used for authenticating a token. -type TokenCertificate struct { - // Name - Possible values include: 'Certificate1', 'Certificate2' - Name TokenCertificateName `json:"name,omitempty"` - // Expiry - The expiry datetime of the certificate. - Expiry *date.Time `json:"expiry,omitempty"` - // Thumbprint - The thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // EncodedPemCertificate - Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. - EncodedPemCertificate *string `json:"encodedPemCertificate,omitempty"` -} - -// TokenCredentialsProperties the properties of the credentials that can be used for authenticating the -// token. -type TokenCredentialsProperties struct { - Certificates *[]TokenCertificate `json:"certificates,omitempty"` - Passwords *[]TokenPassword `json:"passwords,omitempty"` -} - -// TokenListResult the result of a request to list tokens for a container registry. -type TokenListResult struct { - autorest.Response `json:"-"` - // Value - The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. - Value *[]Token `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of tokens. - NextLink *string `json:"nextLink,omitempty"` -} - -// TokenListResultIterator provides access to a complete listing of Token values. -type TokenListResultIterator struct { - i int - page TokenListResultPage -} - -// 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 *TokenListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultIterator.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 *TokenListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TokenListResultIterator) 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 TokenListResultIterator) Response() TokenListResult { - 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 TokenListResultIterator) Value() Token { - if !iter.page.NotDone() { - return Token{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TokenListResultIterator type. -func NewTokenListResultIterator(page TokenListResultPage) TokenListResultIterator { - return TokenListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TokenListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TokenListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// tokenListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TokenListResult) tokenListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TokenListResultPage contains a page of Token values. -type TokenListResultPage struct { - fn func(context.Context, TokenListResult) (TokenListResult, error) - tlr TokenListResult -} - -// 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 *TokenListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TokenListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TokenListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TokenListResultPage) Response() TokenListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TokenListResultPage) Values() []Token { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TokenListResultPage type. -func NewTokenListResultPage(cur TokenListResult, getNextPage func(context.Context, TokenListResult) (TokenListResult, error)) TokenListResultPage { - return TokenListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TokenPassword the password that will be used for authenticating the token of a container registry. -type TokenPassword struct { - // CreationTime - The creation datetime of the password. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Expiry - The expiry datetime of the password. - Expiry *date.Time `json:"expiry,omitempty"` - // Name - The password name "password1" or "password2". Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' - Name TokenPasswordName `json:"name,omitempty"` - // Value - READ-ONLY; The password value. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TokenPassword. -func (tp TokenPassword) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.CreationTime != nil { - objectMap["creationTime"] = tp.CreationTime - } - if tp.Expiry != nil { - objectMap["expiry"] = tp.Expiry - } - if tp.Name != "" { - objectMap["name"] = tp.Name - } - return json.Marshal(objectMap) -} - -// TokenProperties the properties of a token. -type TokenProperties struct { - // CreationDate - READ-ONLY; The creation date of scope map. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ScopeMapID - The resource ID of the scope map to which the token will be associated with. - ScopeMapID *string `json:"scopeMapId,omitempty"` - // Credentials - The credentials that can be used for authenticating the token. - Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` - // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' - Status TokenStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for TokenProperties. -func (tp TokenProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.ScopeMapID != nil { - objectMap["scopeMapId"] = tp.ScopeMapID - } - if tp.Credentials != nil { - objectMap["credentials"] = tp.Credentials - } - if tp.Status != "" { - objectMap["status"] = tp.Status - } - return json.Marshal(objectMap) -} - -// TokensCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TokensCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TokensClient) (Token, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TokensCreateFuture) 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 TokensCreateFuture.Result. -func (future *TokensCreateFuture) result(client TokensClient) (t Token, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TokensCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TokensDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TokensDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TokensClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TokensDeleteFuture) 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 TokensDeleteFuture.Result. -func (future *TokensDeleteFuture) result(client TokensClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TokensDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TokensUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TokensUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TokensClient) (Token, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TokensUpdateFuture) 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 TokensUpdateFuture.Result. -func (future *TokensUpdateFuture) result(client TokensClient) (t Token, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TokensUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TokenUpdateParameters the parameters for updating a token. -type TokenUpdateParameters struct { - // TokenUpdateProperties - The properties of the token update parameters. - *TokenUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TokenUpdateParameters. -func (tup TokenUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.TokenUpdateProperties != nil { - objectMap["properties"] = tup.TokenUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TokenUpdateParameters struct. -func (tup *TokenUpdateParameters) 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 tokenUpdateProperties TokenUpdateProperties - err = json.Unmarshal(*v, &tokenUpdateProperties) - if err != nil { - return err - } - tup.TokenUpdateProperties = &tokenUpdateProperties - } - } - } - - return nil -} - -// TokenUpdateProperties the parameters for updating token properties. -type TokenUpdateProperties struct { - // ScopeMapID - The resource ID of the scope map to which the token will be associated with. - ScopeMapID *string `json:"scopeMapId,omitempty"` - // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' - Status TokenStatus `json:"status,omitempty"` - // Credentials - The credentials that can be used for authenticating the token. - Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` -} - -// TriggerProperties the properties of a trigger. -type TriggerProperties struct { - // TimerTriggers - The collection of timer triggers. - TimerTriggers *[]TimerTrigger `json:"timerTriggers,omitempty"` - // SourceTriggers - The collection of triggers based on source code repository. - SourceTriggers *[]SourceTrigger `json:"sourceTriggers,omitempty"` - // BaseImageTrigger - The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTrigger `json:"baseImageTrigger,omitempty"` -} - -// TriggerUpdateParameters the properties for updating triggers. -type TriggerUpdateParameters struct { - // TimerTriggers - The collection of timer triggers. - TimerTriggers *[]TimerTriggerUpdateParameters `json:"timerTriggers,omitempty"` - // SourceTriggers - The collection of triggers based on source code repository. - SourceTriggers *[]SourceTriggerUpdateParameters `json:"sourceTriggers,omitempty"` - // BaseImageTrigger - The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTriggerUpdateParameters `json:"baseImageTrigger,omitempty"` -} - -// TrustPolicy the content trust policy for a container registry. -type TrustPolicy struct { - // Type - The type of trust policy. Possible values include: 'Notary' - Type TrustPolicyType `json:"type,omitempty"` - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// UserIdentityProperties ... -type UserIdentityProperties struct { - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// VirtualNetworkRule virtual network rule. -type VirtualNetworkRule struct { - // Action - The action of virtual network rule. Possible values include: 'Allow' - Action Action `json:"action,omitempty"` - // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - VirtualNetworkResourceID *string `json:"id,omitempty"` -} - -// Webhook an object that represents a webhook for a container registry. -type Webhook struct { - autorest.Response `json:"-"` - // WebhookProperties - The properties of the webhook. - *WebhookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WebhookProperties != nil { - objectMap["properties"] = w.WebhookProperties - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Webhook struct. -func (w *Webhook) 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 webhookProperties WebhookProperties - err = json.Unmarshal(*v, &webhookProperties) - if err != nil { - return err - } - w.WebhookProperties = &webhookProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - w.SystemData = &systemData - } - } - } - - return nil -} - -// WebhookCreateParameters the parameters for creating a webhook. -type WebhookCreateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // Location - The location of the webhook. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. - *WebhookPropertiesCreateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateParameters. -func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcp.Tags != nil { - objectMap["tags"] = wcp.Tags - } - if wcp.Location != nil { - objectMap["location"] = wcp.Location - } - if wcp.WebhookPropertiesCreateParameters != nil { - objectMap["properties"] = wcp.WebhookPropertiesCreateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. -func (wcp *WebhookCreateParameters) 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 - } - wcp.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wcp.Location = &location - } - case "properties": - if v != nil { - var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters - err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) - if err != nil { - return err - } - wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters - } - } - } - - return nil -} - -// WebhookListResult the result of a request to list webhooks for a container registry. -type WebhookListResult struct { - autorest.Response `json:"-"` - // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. - Value *[]Webhook `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of webhooks. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultIterator provides access to a complete listing of Webhook values. -type WebhookListResultIterator struct { - i int - page WebhookListResultPage -} - -// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { - 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 WebhookListResultIterator) Value() Webhook { - if !iter.page.NotDone() { - return Webhook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebhookListResultIterator type. -func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { - return WebhookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WebhookListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WebhookListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// webhookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WebhookListResult) webhookListResultPreparer(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))) -} - -// WebhookListResultPage contains a page of Webhook values. -type WebhookListResultPage struct { - fn func(context.Context, WebhookListResult) (WebhookListResult, error) - wlr WebhookListResult -} - -// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebhookListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebhookListResultPage) Response() WebhookListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebhookListResultPage) Values() []Webhook { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WebhookListResultPage type. -func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { - return WebhookListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WebhookProperties the properties of a webhook. -type WebhookProperties struct { - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookProperties. -func (wp WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Status != "" { - objectMap["status"] = wp.Status - } - if wp.Scope != nil { - objectMap["scope"] = wp.Scope - } - if wp.Actions != nil { - objectMap["actions"] = wp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. -type WebhookPropertiesCreateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. -func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpcp.ServiceURI != nil { - objectMap["serviceUri"] = wpcp.ServiceURI - } - if wpcp.CustomHeaders != nil { - objectMap["customHeaders"] = wpcp.CustomHeaders - } - if wpcp.Status != "" { - objectMap["status"] = wpcp.Status - } - if wpcp.Scope != nil { - objectMap["scope"] = wpcp.Scope - } - if wpcp.Actions != nil { - objectMap["actions"] = wpcp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. -type WebhookPropertiesUpdateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. -func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpup.ServiceURI != nil { - objectMap["serviceUri"] = wpup.ServiceURI - } - if wpup.CustomHeaders != nil { - objectMap["customHeaders"] = wpup.CustomHeaders - } - if wpup.Status != "" { - objectMap["status"] = wpup.Status - } - if wpup.Scope != nil { - objectMap["scope"] = wpup.Scope - } - if wpup.Actions != nil { - objectMap["actions"] = wpup.Actions - } - return json.Marshal(objectMap) -} - -// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksCreateFuture) 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 WebhooksCreateFuture.Result. -func (future *WebhooksCreateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.CreateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksDeleteFuture) 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 WebhooksDeleteFuture.Result. -func (future *WebhooksDeleteFuture) result(client WebhooksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksUpdateFuture) 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 WebhooksUpdateFuture.Result. -func (future *WebhooksUpdateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.UpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhookUpdateParameters the parameters for updating a webhook. -type WebhookUpdateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. - *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateParameters. -func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.Tags != nil { - objectMap["tags"] = wup.Tags - } - if wup.WebhookPropertiesUpdateParameters != nil { - objectMap["properties"] = wup.WebhookPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. -func (wup *WebhookUpdateParameters) 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 - } - wup.Tags = tags - } - case "properties": - if v != nil { - var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters - err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) - if err != nil { - return err - } - wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters - } - } - } - - return nil -} diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/operations.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/operations.go deleted file mode 100644 index dd925b7a80ad..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 client for the Operations methods of the Containerregistry service. -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 Azure Container Registry 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, "containerregistry.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, "containerregistry.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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 = "2020-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerRegistry/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, "containerregistry.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, "containerregistry.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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/containerregistry/mgmt/2020-11-01-preview/containerregistry/pipelineruns.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/pipelineruns.go deleted file mode 100644 index 17aac203bf22..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/pipelineruns.go +++ /dev/null @@ -1,453 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PipelineRunsClient is the client for the PipelineRuns methods of the Containerregistry service. -type PipelineRunsClient struct { - BaseClient -} - -// NewPipelineRunsClient creates an instance of the PipelineRunsClient client. -func NewPipelineRunsClient(subscriptionID string) PipelineRunsClient { - return NewPipelineRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPipelineRunsClientWithBaseURI creates an instance of the PipelineRunsClient 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 NewPipelineRunsClientWithBaseURI(baseURI string, subscriptionID string) PipelineRunsClient { - return PipelineRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a pipeline run for a container registry with the specified parameters -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// pipelineRunName - the name of the pipeline run. -// pipelineRunCreateParameters - the parameters for creating a pipeline run. -func (client PipelineRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun) (result PipelineRunsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunName, - Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunCreateParameters, - Constraints: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Source", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Source.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Target", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Target.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, pipelineRunName, pipelineRunCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client PipelineRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "pipelineRunName": autorest.Encode("path", pipelineRunName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", pathParameters), - autorest.WithJSON(pipelineRunCreateParameters), - 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 PipelineRunsClient) CreateSender(req *http.Request) (future PipelineRunsCreateFuture, 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 PipelineRunsClient) CreateResponder(resp *http.Response) (result PipelineRun, 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 a pipeline run from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// pipelineRunName - the name of the pipeline run. -func (client PipelineRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result PipelineRunsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunName, - Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, pipelineRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PipelineRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "pipelineRunName": autorest.Encode("path", pipelineRunName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", 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 PipelineRunsClient) DeleteSender(req *http.Request) (future PipelineRunsDeleteFuture, 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 PipelineRunsClient) 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 the detailed information for a given pipeline run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// pipelineRunName - the name of the pipeline run. -func (client PipelineRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result PipelineRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunName, - Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, pipelineRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PipelineRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "pipelineRunName": autorest.Encode("path", pipelineRunName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", 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 PipelineRunsClient) 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 PipelineRunsClient) GetResponder(resp *http.Response) (result PipelineRun, 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 the pipeline runs for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client PipelineRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result PipelineRunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.List") - defer func() { - sc := -1 - if result.prlr.Response.Response != nil { - sc = result.prlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.prlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", resp, "Failure sending request") - return - } - - result.prlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", resp, "Failure responding to request") - return - } - if result.prlr.hasNextLink() && result.prlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PipelineRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/pipelineRuns", 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 PipelineRunsClient) 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 PipelineRunsClient) ListResponder(resp *http.Response) (result PipelineRunListResult, 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 PipelineRunsClient) listNextResults(ctx context.Context, lastResults PipelineRunListResult) (result PipelineRunListResult, err error) { - req, err := lastResults.pipelineRunListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "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, "containerregistry.PipelineRunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PipelineRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result PipelineRunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/privateendpointconnections.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/privateendpointconnections.go deleted file mode 100644 index 4421ba8db80e..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/privateendpointconnections.go +++ /dev/null @@ -1,434 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the Containerregistry -// service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate update the state of specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -// privateEndpointConnection - the parameters for creating a private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName, privateEndpointConnection) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(privateEndpointConnection), - 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 get the specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// List list all private endpoint connections in a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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 PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "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, "containerregistry.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/registries.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/registries.go deleted file mode 100644 index 9545b6f84de4..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/registries.go +++ /dev/null @@ -1,1471 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RegistriesClient is the client for the Registries methods of the Containerregistry service. -type RegistriesClient struct { - BaseClient -} - -// NewRegistriesClient creates an instance of the RegistriesClient client. -func NewRegistriesClient(subscriptionID string) RegistriesClient { - return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient 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 NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { - return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only -// alphanumeric characters, be globally unique, and between 5 and 50 characters in length. -// Parameters: -// registryNameCheckRequest - the object containing information for the availability request. -func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryNameCheckRequest, - Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}, - }}, - {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters), - autorest.WithJSON(registryNameCheckRequest), - 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 RegistriesClient) 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 RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, 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 container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registry - the parameters for creating a container registry. -func (client RegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result RegistriesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: registry, - Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, registry) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registry), - 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 RegistriesClient) CreateSender(req *http.Request) (future RegistriesCreateFuture, 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 RegistriesClient) CreateResponder(resp *http.Response) (result Registry, 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 a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result RegistriesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) DeleteSender(req *http.Request) (future RegistriesDeleteFuture, 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 RegistriesClient) 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 -} - -// GenerateCredentials generate keys for a token of a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// generateCredentialsParameters - the parameters for generating credentials. -func (client RegistriesClient) GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (result RegistriesGenerateCredentialsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GenerateCredentials") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "GenerateCredentials", err.Error()) - } - - req, err := client.GenerateCredentialsPreparer(ctx, resourceGroupName, registryName, generateCredentialsParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", nil, "Failure preparing request") - return - } - - result, err = client.GenerateCredentialsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", result.Response(), "Failure sending request") - return - } - - return -} - -// GenerateCredentialsPreparer prepares the GenerateCredentials request. -func (client RegistriesClient) GenerateCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/generateCredentials", pathParameters), - autorest.WithJSON(generateCredentialsParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateCredentialsSender sends the GenerateCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GenerateCredentialsSender(req *http.Request) (future RegistriesGenerateCredentialsFuture, 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 -} - -// GenerateCredentialsResponder handles the response to the GenerateCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GenerateCredentialsResponder(resp *http.Response) (result GenerateCredentialsResult, 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 the properties of the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) 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 RegistriesClient) GetResponder(resp *http.Response) (result Registry, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBuildSourceUploadURL get the upload location for the user to be able to upload the source. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result SourceUploadDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GetBuildSourceUploadURL") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "GetBuildSourceUploadURL", err.Error()) - } - - req, err := client.GetBuildSourceUploadURLPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetBuildSourceUploadURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure sending request") - return - } - - result, err = client.GetBuildSourceUploadURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure responding to request") - return - } - - return -} - -// GetBuildSourceUploadURLPreparer prepares the GetBuildSourceUploadURL request. -func (client RegistriesClient) GetBuildSourceUploadURLPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBuildSourceUploadURLSender sends the GetBuildSourceUploadURL request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GetBuildSourceUploadURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetBuildSourceUploadURLResponder handles the response to the GetBuildSourceUploadURL request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GetBuildSourceUploadURLResponder(resp *http.Response) (result SourceUploadDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ImportImage copies an image to this container registry from the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// parameters - the parameters specifying the image to copy and the source container registry. -func (client RegistriesClient) ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (result RegistriesImportImageFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ImportImage") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials.Password", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Source.SourceImage", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ImportImage", err.Error()) - } - - req, err := client.ImportImagePreparer(ctx, resourceGroupName, registryName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", nil, "Failure preparing request") - return - } - - result, err = client.ImportImageSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportImagePreparer prepares the ImportImage request. -func (client RegistriesClient) ImportImagePreparer(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/importImage", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportImageSender sends the ImportImage request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ImportImageSender(req *http.Request) (future RegistriesImportImageFuture, 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 -} - -// ImportImageResponder handles the response to the ImportImage request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ImportImageResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all the container registries under the specified subscription. -func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 the container registries under the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup") - 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.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RegistriesClient) 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-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.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 -} - -// ListCredentials lists the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListCredentials") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListCredentials", err.Error()) - } - - req, err := client.ListCredentialsPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListCredentialsPreparer prepares the ListCredentials request. -func (client RegistriesClient) ListCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCredentialsSender sends the ListCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCredentialsResponder handles the response to the ListCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPrivateLinkResources lists the private link resources for a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListPrivateLinkResources", err.Error()) - } - - result.fn = client.listPrivateLinkResourcesNextResults - req, err := client.ListPrivateLinkResourcesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", nil, "Failure preparing request") - return - } - - resp, err := client.ListPrivateLinkResourcesSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListPrivateLinkResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPrivateLinkResourcesPreparer prepares the ListPrivateLinkResources request. -func (client RegistriesClient) ListPrivateLinkResourcesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPrivateLinkResourcesSender sends the ListPrivateLinkResources request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListPrivateLinkResourcesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListPrivateLinkResourcesResponder handles the response to the ListPrivateLinkResources request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListPrivateLinkResourcesResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listPrivateLinkResourcesNextResults retrieves the next set of results, if any. -func (client RegistriesClient) listPrivateLinkResourcesNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListPrivateLinkResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListPrivateLinkResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListPrivateLinkResourcesComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") - 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.ListPrivateLinkResources(ctx, resourceGroupName, registryName) - return -} - -// ListUsages gets the quota usages for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result RegistryUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListUsages") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client RegistriesClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/listUsages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListUsagesResponder(resp *http.Response) (result RegistryUsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateCredential regenerates one of the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// regenerateCredentialParameters - specifies name of the password which should be regenerated -- password or -// password2. -func (client RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.RegenerateCredential") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "RegenerateCredential", err.Error()) - } - - req, err := client.RegenerateCredentialPreparer(ctx, resourceGroupName, registryName, regenerateCredentialParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateCredentialSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request") - return - } - - result, err = client.RegenerateCredentialResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateCredentialPreparer prepares the RegenerateCredential request. -func (client RegistriesClient) RegenerateCredentialPreparer(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters), - autorest.WithJSON(regenerateCredentialParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always -// closes the http.Response Body. -func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ScheduleRun schedules a new run based on the request parameters and add it to the run queue. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runRequest - the parameters of a run that needs to scheduled. -func (client RegistriesClient) ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (result RegistriesScheduleRunFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ScheduleRun") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ScheduleRun", err.Error()) - } - - req, err := client.ScheduleRunPreparer(ctx, resourceGroupName, registryName, runRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", nil, "Failure preparing request") - return - } - - result, err = client.ScheduleRunSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", result.Response(), "Failure sending request") - return - } - - return -} - -// ScheduleRunPreparer prepares the ScheduleRun request. -func (client RegistriesClient) ScheduleRunPreparer(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/scheduleRun", pathParameters), - autorest.WithJSON(runRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ScheduleRunSender sends the ScheduleRun request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ScheduleRunSender(req *http.Request) (future RegistriesScheduleRunFuture, 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 -} - -// ScheduleRunResponder handles the response to the ScheduleRun request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ScheduleRunResponder(resp *http.Response) (result Run, 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 a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registryUpdateParameters - the parameters for updating a container registry. -func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result RegistriesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, registryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registryUpdateParameters), - 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 RegistriesClient) UpdateSender(req *http.Request) (future RegistriesUpdateFuture, 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 RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/replications.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/replications.go deleted file mode 100644 index 889fa7f3b58b..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/replications.go +++ /dev/null @@ -1,542 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReplicationsClient is the client for the Replications methods of the Containerregistry service. -type ReplicationsClient struct { - BaseClient -} - -// NewReplicationsClient creates an instance of the ReplicationsClient client. -func NewReplicationsClient(subscriptionID string) ReplicationsClient { - return NewReplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationsClientWithBaseURI creates an instance of the ReplicationsClient 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 NewReplicationsClientWithBaseURI(baseURI string, subscriptionID string) ReplicationsClient { - return ReplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replication - the parameters for creating a replication. -func (client ReplicationsClient) Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (result ReplicationsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, replicationName, replication) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ReplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replication), - 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 ReplicationsClient) CreateSender(req *http.Request) (future ReplicationsCreateFuture, 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 ReplicationsClient) CreateResponder(resp *http.Response) (result Replication, 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 a replication from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result ReplicationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ReplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) DeleteSender(req *http.Request) (future ReplicationsDeleteFuture, 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 ReplicationsClient) 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 the properties of the specified replication. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result Replication, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) 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 ReplicationsClient) GetResponder(resp *http.Response) (result Replication, 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 the replications for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ReplicationsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.List") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ReplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/replications", 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 ReplicationsClient) 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 ReplicationsClient) ListResponder(resp *http.Response) (result ReplicationListResult, 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 ReplicationsClient) listNextResults(ctx context.Context, lastResults ReplicationListResult) (result ReplicationListResult, err error) { - req, err := lastResults.replicationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "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, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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, registryName) - return -} - -// Update updates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replicationUpdateParameters - the parameters for updating a replication. -func (client ReplicationsClient) Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (result ReplicationsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ReplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replicationUpdateParameters), - 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 ReplicationsClient) UpdateSender(req *http.Request) (future ReplicationsUpdateFuture, 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 ReplicationsClient) UpdateResponder(resp *http.Response) (result Replication, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/runs.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/runs.go deleted file mode 100644 index 7035b1e3c4f3..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/runs.go +++ /dev/null @@ -1,529 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RunsClient is the client for the Runs methods of the Containerregistry service. -type RunsClient struct { - BaseClient -} - -// NewRunsClient creates an instance of the RunsClient client. -func NewRunsClient(subscriptionID string) RunsClient { - return NewRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunsClientWithBaseURI creates an instance of the RunsClient 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 NewRunsClientWithBaseURI(baseURI string, subscriptionID string) RunsClient { - return RunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancel an existing run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunsCancelFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.Cancel") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Cancel", err.Error()) - } - - req, err := client.CancelPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", nil, "Failure preparing request") - return - } - - result, err = client.CancelSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", result.Response(), "Failure sending request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client RunsClient) CancelPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client RunsClient) CancelSender(req *http.Request) (future RunsCancelFuture, 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 -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client RunsClient) CancelResponder(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 gets the detailed information for a given run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result Run, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}", 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 RunsClient) 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 RunsClient) GetResponder(resp *http.Response) (result Run, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLogSasURL gets a link to download the run logs. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunGetLogResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.GetLogSasURL") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "GetLogSasURL", err.Error()) - } - - req, err := client.GetLogSasURLPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetLogSasURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure sending request") - return - } - - result, err = client.GetLogSasURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure responding to request") - return - } - - return -} - -// GetLogSasURLPreparer prepares the GetLogSasURL request. -func (client RunsClient) GetLogSasURLPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLogSasURLSender sends the GetLogSasURL request. The method will close the -// http.Response Body if it receives an error. -func (client RunsClient) GetLogSasURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLogSasURLResponder handles the response to the GetLogSasURL request. The method always -// closes the http.Response Body. -func (client RunsClient) GetLogSasURLResponder(resp *http.Response) (result RunGetLogResult, 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 the runs for a registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// filter - the runs filter to apply on the operation. Arithmetic operators are not supported. The allowed -// string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. -// top - $top is supported for get list of runs, which limits the maximum number of runs to return. -func (client RunsClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.List") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs", 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 RunsClient) 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 RunsClient) ListResponder(resp *http.Response) (result RunListResult, 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 RunsClient) listNextResults(ctx context.Context, lastResults RunListResult) (result RunListResult, err error) { - req, err := lastResults.runListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RunsClient", "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, "containerregistry.RunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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, registryName, filter, top) - return -} - -// Update patch the run properties. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -// runUpdateParameters - the run update properties. -func (client RunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (result RunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, runID, runUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}", pathParameters), - autorest.WithJSON(runUpdateParameters), - 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 RunsClient) UpdateSender(req *http.Request) (future RunsUpdateFuture, 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 RunsClient) UpdateResponder(resp *http.Response) (result Run, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/scopemaps.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/scopemaps.go deleted file mode 100644 index 66c41d8354d9..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/scopemaps.go +++ /dev/null @@ -1,545 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ScopeMapsClient is the client for the ScopeMaps methods of the Containerregistry service. -type ScopeMapsClient struct { - BaseClient -} - -// NewScopeMapsClient creates an instance of the ScopeMapsClient client. -func NewScopeMapsClient(subscriptionID string) ScopeMapsClient { - return NewScopeMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScopeMapsClientWithBaseURI creates an instance of the ScopeMapsClient 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 NewScopeMapsClientWithBaseURI(baseURI string, subscriptionID string) ScopeMapsClient { - return ScopeMapsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a scope map for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -// scopeMapCreateParameters - the parameters for creating a scope map. -func (client ScopeMapsClient) Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (result ScopeMapsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, - {TargetValue: scopeMapCreateParameters, - Constraints: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties.Actions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ScopeMapsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), - autorest.WithJSON(scopeMapCreateParameters), - 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 ScopeMapsClient) CreateSender(req *http.Request) (future ScopeMapsCreateFuture, 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 ScopeMapsClient) CreateResponder(resp *http.Response) (result ScopeMap, 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 a scope map from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -func (client ScopeMapsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMapsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, scopeMapName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScopeMapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", 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 ScopeMapsClient) DeleteSender(req *http.Request) (future ScopeMapsDeleteFuture, 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 ScopeMapsClient) 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 the properties of the specified scope map. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -func (client ScopeMapsClient) Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMap, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, scopeMapName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScopeMapsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", 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 ScopeMapsClient) 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 ScopeMapsClient) GetResponder(resp *http.Response) (result ScopeMap, 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 the scope maps for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ScopeMapsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.List") - defer func() { - sc := -1 - if result.smlr.Response.Response != nil { - sc = result.smlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.smlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure sending request") - return - } - - result.smlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure responding to request") - return - } - if result.smlr.hasNextLink() && result.smlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ScopeMapsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/scopeMaps", 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 ScopeMapsClient) 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 ScopeMapsClient) ListResponder(resp *http.Response) (result ScopeMapListResult, 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 ScopeMapsClient) listNextResults(ctx context.Context, lastResults ScopeMapListResult) (result ScopeMapListResult, err error) { - req, err := lastResults.scopeMapListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "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, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScopeMapsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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, registryName) - return -} - -// Update updates a scope map with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -// scopeMapUpdateParameters - the parameters for updating a scope map. -func (client ScopeMapsClient) Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (result ScopeMapsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScopeMapsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), - autorest.WithJSON(scopeMapUpdateParameters), - 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 ScopeMapsClient) UpdateSender(req *http.Request) (future ScopeMapsUpdateFuture, 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 ScopeMapsClient) UpdateResponder(resp *http.Response) (result ScopeMap, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/taskruns.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/taskruns.go deleted file mode 100644 index ee13d4b2d14f..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/taskruns.go +++ /dev/null @@ -1,634 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TaskRunsClient is the client for the TaskRuns methods of the Containerregistry service. -type TaskRunsClient struct { - BaseClient -} - -// NewTaskRunsClient creates an instance of the TaskRunsClient client. -func NewTaskRunsClient(subscriptionID string) TaskRunsClient { - return NewTaskRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTaskRunsClientWithBaseURI creates an instance of the TaskRunsClient 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 NewTaskRunsClientWithBaseURI(baseURI string, subscriptionID string) TaskRunsClient { - return TaskRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task run for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -// taskRun - the parameters of a run that needs to scheduled. -func (client TaskRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (result TaskRunsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskRunName, taskRun) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TaskRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(taskRun), - 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 TaskRunsClient) CreateSender(req *http.Request) (future TaskRunsCreateFuture, 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 TaskRunsClient) CreateResponder(resp *http.Response) (result TaskRun, 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 a specified task run resource. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRunsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TaskRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) DeleteSender(req *http.Request) (future TaskRunsDeleteFuture, 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 TaskRunsClient) 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 the detailed information for a given task run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TaskRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) 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 TaskRunsClient) GetResponder(resp *http.Response) (result TaskRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails gets the detailed information for a given task run that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.GetDetails") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TaskRunsClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TaskRunsClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) GetDetailsResponder(resp *http.Response) (result TaskRun, 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 the task runs for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TaskRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.List") - defer func() { - sc := -1 - if result.trlr.Response.Response != nil { - sc = result.trlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.trlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure sending request") - return - } - - result.trlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure responding to request") - return - } - if result.trlr.hasNextLink() && result.trlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TaskRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns", 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 TaskRunsClient) 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 TaskRunsClient) ListResponder(resp *http.Response) (result TaskRunListResult, 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 TaskRunsClient) listNextResults(ctx context.Context, lastResults TaskRunListResult) (result TaskRunListResult, err error) { - req, err := lastResults.taskRunListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "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, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TaskRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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, registryName) - return -} - -// Update updates a task run with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -// updateParameters - the parameters for updating a task run. -func (client TaskRunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (result TaskRunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskRunName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TaskRunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 TaskRunsClient) UpdateSender(req *http.Request) (future TaskRunsUpdateFuture, 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 TaskRunsClient) UpdateResponder(resp *http.Response) (result TaskRun, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/tasks.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/tasks.go deleted file mode 100644 index 3af51765a125..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/tasks.go +++ /dev/null @@ -1,645 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TasksClient is the client for the Tasks methods of the Containerregistry service. -type TasksClient struct { - BaseClient -} - -// NewTasksClient creates an instance of the TasksClient client. -func NewTasksClient(subscriptionID string) TasksClient { - return NewTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTasksClientWithBaseURI creates an instance of the TasksClient 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 NewTasksClientWithBaseURI(baseURI string, subscriptionID string) TasksClient { - return TasksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -// taskCreateParameters - the parameters for creating a task. -func (client TasksClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (result TasksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, - {TargetValue: taskCreateParameters, - Constraints: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMaximum, Rule: int64(28800), Chain: nil}, - {Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMinimum, Rule: int64(300), Chain: nil}, - }}, - {Target: "taskCreateParameters.TaskProperties.Trigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskName, taskCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TasksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskCreateParameters), - 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 TasksClient) CreateSender(req *http.Request) (future TasksCreateFuture, 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 TasksClient) CreateResponder(resp *http.Response) (result Task, 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 a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result TasksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TasksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) DeleteSender(req *http.Request) (future TasksDeleteFuture, 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 TasksClient) 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 get the properties of a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TasksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) 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 TasksClient) GetResponder(resp *http.Response) (result Task, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails returns a task with extended information that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.GetDetails") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TasksClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TasksClient) GetDetailsResponder(resp *http.Response) (result Task, 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 the tasks for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TasksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.List") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TasksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks", 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 TasksClient) 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 TasksClient) ListResponder(resp *http.Response) (result TaskListResult, 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 TasksClient) listNextResults(ctx context.Context, lastResults TaskListResult) (result TaskListResult, err error) { - req, err := lastResults.taskListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TasksClient", "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, "containerregistry.TasksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TasksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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, registryName) - return -} - -// Update updates a task with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -// taskUpdateParameters - the parameters for updating a task. -func (client TasksClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (result TasksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TasksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskUpdateParameters), - 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 TasksClient) UpdateSender(req *http.Request) (future TasksUpdateFuture, 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 TasksClient) UpdateResponder(resp *http.Response) (result Task, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/tokens.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/tokens.go deleted file mode 100644 index 6a2f114708a4..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/tokens.go +++ /dev/null @@ -1,542 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TokensClient is the client for the Tokens methods of the Containerregistry service. -type TokensClient struct { - BaseClient -} - -// NewTokensClient creates an instance of the TokensClient client. -func NewTokensClient(subscriptionID string) TokensClient { - return NewTokensClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTokensClientWithBaseURI creates an instance of the TokensClient 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 NewTokensClientWithBaseURI(baseURI string, subscriptionID string) TokensClient { - return TokensClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a token for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -// tokenCreateParameters - the parameters for creating a token. -func (client TokensClient) Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (result TokensCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TokensClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), - autorest.WithJSON(tokenCreateParameters), - 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 TokensClient) CreateSender(req *http.Request) (future TokensCreateFuture, 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 TokensClient) CreateResponder(resp *http.Response) (result Token, 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 a token from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -func (client TokensClient) Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result TokensDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, tokenName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TokensClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", 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 TokensClient) DeleteSender(req *http.Request) (future TokensDeleteFuture, 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 TokensClient) 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 the properties of the specified token. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -func (client TokensClient) Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result Token, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, tokenName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TokensClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", 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 TokensClient) 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 TokensClient) GetResponder(resp *http.Response) (result Token, 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 the tokens for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TokensClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.List") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TokensClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/tokens", 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 TokensClient) 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 TokensClient) ListResponder(resp *http.Response) (result TokenListResult, 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 TokensClient) listNextResults(ctx context.Context, lastResults TokenListResult) (result TokenListResult, err error) { - req, err := lastResults.tokenListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TokensClient", "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, "containerregistry.TokensClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TokensClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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, registryName) - return -} - -// Update updates a token with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -// tokenUpdateParameters - the parameters for updating a token. -func (client TokensClient) Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (result TokensUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TokensClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), - autorest.WithJSON(tokenUpdateParameters), - 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 TokensClient) UpdateSender(req *http.Request) (future TokensUpdateFuture, 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 TokensClient) UpdateResponder(resp *http.Response) (result Token, 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/containerregistry/mgmt/2020-11-01-preview/containerregistry/version.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/version.go deleted file mode 100644 index a4ef593a99ec..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerregistry - -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() + " containerregistry/2020-11-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/containerregistry/mgmt/2020-11-01-preview/containerregistry/webhooks.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/webhooks.go deleted file mode 100644 index dadae7936a38..000000000000 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/webhooks.go +++ /dev/null @@ -1,866 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WebhooksClient is the client for the Webhooks methods of the Containerregistry service. -type WebhooksClient struct { - BaseClient -} - -// NewWebhooksClient creates an instance of the WebhooksClient client. -func NewWebhooksClient(subscriptionID string) WebhooksClient { - return NewWebhooksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhooksClientWithBaseURI creates an instance of the WebhooksClient 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 NewWebhooksClientWithBaseURI(baseURI string, subscriptionID string) WebhooksClient { - return WebhooksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a webhook for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookCreateParameters - the parameters for creating a webhook. -func (client WebhooksClient) Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (result WebhooksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookCreateParameters, - Constraints: []validation.Constraint{{Target: "webhookCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.ServiceURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client WebhooksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookCreateParameters), - 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 WebhooksClient) CreateSender(req *http.Request) (future WebhooksCreateFuture, 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 WebhooksClient) CreateResponder(resp *http.Response) (result Webhook, 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 a webhook from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result WebhooksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) DeleteSender(req *http.Request) (future WebhooksDeleteFuture, 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 WebhooksClient) 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 the properties of the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhooksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) 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 WebhooksClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCallbackConfig gets the configuration of service URI and custom headers for the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result CallbackConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.GetCallbackConfig") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "GetCallbackConfig", err.Error()) - } - - req, err := client.GetCallbackConfigPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", nil, "Failure preparing request") - return - } - - resp, err := client.GetCallbackConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure sending request") - return - } - - result, err = client.GetCallbackConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure responding to request") - return - } - - return -} - -// GetCallbackConfigPreparer prepares the GetCallbackConfig request. -func (client WebhooksClient) GetCallbackConfigPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCallbackConfigSender sends the GetCallbackConfig request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) GetCallbackConfigSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCallbackConfigResponder handles the response to the GetCallbackConfig request. The method always -// closes the http.Response Body. -func (client WebhooksClient) GetCallbackConfigResponder(resp *http.Response) (result CallbackConfig, 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 the webhooks for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client WebhooksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.List") - 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: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WebhooksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/webhooks", 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 WebhooksClient) 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 WebhooksClient) ListResponder(resp *http.Response) (result WebhookListResult, 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 WebhooksClient) listNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "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, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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, registryName) - return -} - -// ListEvents lists recent events for the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "ListEvents", err.Error()) - } - - result.fn = client.listEventsNextResults - req, err := client.ListEventsPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventsSender(req) - if err != nil { - result.elr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure sending request") - return - } - - result.elr, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure responding to request") - return - } - if result.elr.hasNextLink() && result.elr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListEventsPreparer prepares the ListEvents request. -func (client WebhooksClient) ListEventsPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventsSender sends the ListEvents request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) ListEventsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventsResponder handles the response to the ListEvents request. The method always -// closes the http.Response Body. -func (client WebhooksClient) ListEventsResponder(resp *http.Response) (result EventListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listEventsNextResults retrieves the next set of results, if any. -func (client WebhooksClient) listEventsNextResults(ctx context.Context, lastResults EventListResult) (result EventListResult, err error) { - req, err := lastResults.eventListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListEventsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListEventsComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.ListEvents(ctx, resourceGroupName, registryName, webhookName) - return -} - -// Ping triggers a ping event to be sent to the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Ping") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Ping", err.Error()) - } - - req, err := client.PingPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", nil, "Failure preparing request") - return - } - - resp, err := client.PingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure sending request") - return - } - - result, err = client.PingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure responding to request") - return - } - - return -} - -// PingPreparer prepares the Ping request. -func (client WebhooksClient) PingPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PingSender sends the Ping request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) PingSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PingResponder handles the response to the Ping request. The method always -// closes the http.Response Body. -func (client WebhooksClient) PingResponder(resp *http.Response) (result EventInfo, 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 webhook with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookUpdateParameters - the parameters for updating a webhook. -func (client WebhooksClient) Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (result WebhooksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2020-11-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookUpdateParameters), - 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 WebhooksClient) UpdateSender(req *http.Request) (future WebhooksUpdateFuture, 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 WebhooksClient) UpdateResponder(resp *http.Response) (result Webhook, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/CHANGELOG.md b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/_meta.json b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/_meta.json deleted file mode 100644 index 517844c30a07..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "769e09cac92c50b1f9fa6468775b7cb7de16bb06", - "readme": "/_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "tag": "package-2021-06-preview", - "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-preview --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/containerregistry/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/containerregistry/mgmt/2021-06-01-preview/containerregistry/agentpools.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/agentpools.go deleted file mode 100644 index 1ae5928434f8..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/agentpools.go +++ /dev/null @@ -1,634 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AgentPoolsClient is the client for the AgentPools methods of the Containerregistry service. -type AgentPoolsClient struct { - BaseClient -} - -// NewAgentPoolsClient creates an instance of the AgentPoolsClient client. -func NewAgentPoolsClient(subscriptionID string) AgentPoolsClient { - return NewAgentPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgentPoolsClientWithBaseURI creates an instance of the AgentPoolsClient 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 NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) AgentPoolsClient { - return AgentPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an agent pool for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -// agentPool - the parameters of an agent pool that needs to scheduled. -func (client AgentPoolsClient) Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (result AgentPoolsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, agentPoolName, agentPool) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AgentPoolsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(agentPool), - 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 AgentPoolsClient) CreateSender(req *http.Request) (future AgentPoolsCreateFuture, 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 AgentPoolsClient) CreateResponder(resp *http.Response) (result AgentPool, 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 a specified agent pool resource. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) DeleteSender(req *http.Request) (future AgentPoolsDeleteFuture, 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 AgentPoolsClient) 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 the detailed information for a given agent pool. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) 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 AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetQueueStatus gets the count of queued runs for a given agent pool. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolQueueStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetQueueStatus") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "GetQueueStatus", err.Error()) - } - - req, err := client.GetQueueStatusPreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetQueueStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure sending request") - return - } - - result, err = client.GetQueueStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetQueueStatusPreparer prepares the GetQueueStatus request. -func (client AgentPoolsClient) GetQueueStatusPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetQueueStatusSender sends the GetQueueStatus request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) GetQueueStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetQueueStatusResponder handles the response to the GetQueueStatus request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) GetQueueStatusResponder(resp *http.Response) (result AgentPoolQueueStatus, 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 the agent pools for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") - defer func() { - sc := -1 - if result.aplr.Response.Response != nil { - sc = result.aplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.aplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure sending request") - return - } - - result.aplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure responding to request") - return - } - if result.aplr.hasNextLink() && result.aplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools", 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 AgentPoolsClient) 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 AgentPoolsClient) ListResponder(resp *http.Response) (result AgentPoolListResult, 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 AgentPoolsClient) listNextResults(ctx context.Context, lastResults AgentPoolListResult) (result AgentPoolListResult, err error) { - req, err := lastResults.agentPoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "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, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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, registryName) - return -} - -// Update updates an agent pool with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -// updateParameters - the parameters for updating an agent pool. -func (client AgentPoolsClient) Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (result AgentPoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, agentPoolName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AgentPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 AgentPoolsClient) UpdateSender(req *http.Request) (future AgentPoolsUpdateFuture, 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 AgentPoolsClient) UpdateResponder(resp *http.Response) (result AgentPool, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/client.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/client.go deleted file mode 100644 index 79937e123765..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerregistry implements the Azure ARM Containerregistry service API version . -// -// -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Containerregistry - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerregistry. -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/containerregistry/mgmt/2021-06-01-preview/containerregistry/connectedregistries.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/connectedregistries.go deleted file mode 100644 index ebdb3001cd94..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/connectedregistries.go +++ /dev/null @@ -1,652 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ConnectedRegistriesClient is the client for the ConnectedRegistries methods of the Containerregistry service. -type ConnectedRegistriesClient struct { - BaseClient -} - -// NewConnectedRegistriesClient creates an instance of the ConnectedRegistriesClient client. -func NewConnectedRegistriesClient(subscriptionID string) ConnectedRegistriesClient { - return NewConnectedRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectedRegistriesClientWithBaseURI creates an instance of the ConnectedRegistriesClient 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 NewConnectedRegistriesClientWithBaseURI(baseURI string, subscriptionID string) ConnectedRegistriesClient { - return ConnectedRegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a connected registry for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -// connectedRegistryCreateParameters - the parameters for creating a connectedRegistry. -func (client ConnectedRegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry) (result ConnectedRegistriesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryCreateParameters, - Constraints: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent.SyncProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent.SyncProperties.TokenID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent.SyncProperties.MessageTTL", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ConnectedRegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", pathParameters), - autorest.WithJSON(connectedRegistryCreateParameters), - 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 ConnectedRegistriesClient) CreateSender(req *http.Request) (future ConnectedRegistriesCreateFuture, 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 ConnectedRegistriesClient) CreateResponder(resp *http.Response) (result ConnectedRegistry, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Deactivate deactivates the connected registry instance. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -func (client ConnectedRegistriesClient) Deactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result ConnectedRegistriesDeactivateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.Deactivate") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Deactivate", err.Error()) - } - - req, err := client.DeactivatePreparer(ctx, resourceGroupName, registryName, connectedRegistryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Deactivate", nil, "Failure preparing request") - return - } - - result, err = client.DeactivateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Deactivate", result.Response(), "Failure sending request") - return - } - - return -} - -// DeactivatePreparer prepares the Deactivate request. -func (client ConnectedRegistriesClient) DeactivatePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeactivateSender sends the Deactivate request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectedRegistriesClient) DeactivateSender(req *http.Request) (future ConnectedRegistriesDeactivateFuture, 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 -} - -// DeactivateResponder handles the response to the Deactivate request. The method always -// closes the http.Response Body. -func (client ConnectedRegistriesClient) DeactivateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes a connected registry from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -func (client ConnectedRegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result ConnectedRegistriesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, connectedRegistryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectedRegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", 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 ConnectedRegistriesClient) DeleteSender(req *http.Request) (future ConnectedRegistriesDeleteFuture, 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 ConnectedRegistriesClient) 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 the properties of the connected registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -func (client ConnectedRegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result ConnectedRegistry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, connectedRegistryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectedRegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", 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 ConnectedRegistriesClient) 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 ConnectedRegistriesClient) GetResponder(resp *http.Response) (result ConnectedRegistry, 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 connected registries for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// filter - an OData filter expression that describes a subset of connectedRegistries to return. The parameters -// that can be filtered are parent.id (the resource id of the connectedRegistry parent), mode, and -// connectionState. The supported operator is eq. -func (client ConnectedRegistriesClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string) (result ConnectedRegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.List") - defer func() { - sc := -1 - if result.crlr.Response.Response != nil { - sc = result.crlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.crlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "List", resp, "Failure sending request") - return - } - - result.crlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "List", resp, "Failure responding to request") - return - } - if result.crlr.hasNextLink() && result.crlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ConnectedRegistriesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.ContainerRegistry/registries/{registryName}/connectedRegistries", 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 ConnectedRegistriesClient) 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 ConnectedRegistriesClient) ListResponder(resp *http.Response) (result ConnectedRegistryListResult, 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 ConnectedRegistriesClient) listNextResults(ctx context.Context, lastResults ConnectedRegistryListResult) (result ConnectedRegistryListResult, err error) { - req, err := lastResults.connectedRegistryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "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, "containerregistry.ConnectedRegistriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConnectedRegistriesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string) (result ConnectedRegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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, registryName, filter) - return -} - -// Update updates a connected registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// connectedRegistryName - the name of the connected registry. -// connectedRegistryUpdateParameters - the parameters for updating a connectedRegistry. -func (client ConnectedRegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters) (result ConnectedRegistriesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: connectedRegistryName, - Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ConnectedRegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectedRegistryName": autorest.Encode("path", connectedRegistryName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", pathParameters), - autorest.WithJSON(connectedRegistryUpdateParameters), - 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 ConnectedRegistriesClient) UpdateSender(req *http.Request) (future ConnectedRegistriesUpdateFuture, 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 ConnectedRegistriesClient) UpdateResponder(resp *http.Response) (result ConnectedRegistry, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/containerregistryapi/interfaces.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/containerregistryapi/interfaces.go deleted file mode 100644 index d822af89deb3..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/containerregistryapi/interfaces.go +++ /dev/null @@ -1,204 +0,0 @@ -package containerregistryapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/containerregistry/mgmt/2021-06-01-preview/containerregistry" -) - -// ConnectedRegistriesClientAPI contains the set of methods on the ConnectedRegistriesClient type. -type ConnectedRegistriesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters containerregistry.ConnectedRegistry) (result containerregistry.ConnectedRegistriesCreateFuture, err error) - Deactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result containerregistry.ConnectedRegistriesDeactivateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result containerregistry.ConnectedRegistriesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result containerregistry.ConnectedRegistry, err error) - List(ctx context.Context, resourceGroupName string, registryName string, filter string) (result containerregistry.ConnectedRegistryListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string) (result containerregistry.ConnectedRegistryListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters containerregistry.ConnectedRegistryUpdateParameters) (result containerregistry.ConnectedRegistriesUpdateFuture, err error) -} - -var _ ConnectedRegistriesClientAPI = (*containerregistry.ConnectedRegistriesClient)(nil) - -// ExportPipelinesClientAPI contains the set of methods on the ExportPipelinesClient type. -type ExportPipelinesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters containerregistry.ExportPipeline) (result containerregistry.ExportPipelinesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result containerregistry.ExportPipelinesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result containerregistry.ExportPipeline, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ExportPipelineListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ExportPipelineListResultIterator, err error) -} - -var _ ExportPipelinesClientAPI = (*containerregistry.ExportPipelinesClient)(nil) - -// RegistriesClientAPI contains the set of methods on the RegistriesClient type. -type RegistriesClientAPI interface { - CheckNameAvailability(ctx context.Context, registryNameCheckRequest containerregistry.RegistryNameCheckRequest) (result containerregistry.RegistryNameStatus, err error) - Create(ctx context.Context, resourceGroupName string, registryName string, registry containerregistry.Registry) (result containerregistry.RegistriesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistriesDeleteFuture, err error) - GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters containerregistry.GenerateCredentialsParameters) (result containerregistry.RegistriesGenerateCredentialsFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.Registry, err error) - GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.SourceUploadDefinition, err error) - ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters containerregistry.ImportImageParameters) (result containerregistry.RegistriesImportImageFuture, err error) - List(ctx context.Context) (result containerregistry.RegistryListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.RegistryListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultIterator, err error) - ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryListCredentialsResult, err error) - ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultPage, err error) - ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultIterator, err error) - ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryUsageListResult, err error) - RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters containerregistry.RegenerateCredentialParameters) (result containerregistry.RegistryListCredentialsResult, err error) - ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest containerregistry.BasicRunRequest) (result containerregistry.RegistriesScheduleRunFuture, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters containerregistry.RegistryUpdateParameters) (result containerregistry.RegistriesUpdateFuture, err error) -} - -var _ RegistriesClientAPI = (*containerregistry.RegistriesClient)(nil) - -// ImportPipelinesClientAPI contains the set of methods on the ImportPipelinesClient type. -type ImportPipelinesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters containerregistry.ImportPipeline) (result containerregistry.ImportPipelinesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result containerregistry.ImportPipelinesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result containerregistry.ImportPipeline, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ImportPipelineListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ImportPipelineListResultIterator, err error) -} - -var _ ImportPipelinesClientAPI = (*containerregistry.ImportPipelinesClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result containerregistry.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*containerregistry.OperationsClient)(nil) - -// PipelineRunsClientAPI contains the set of methods on the PipelineRunsClient type. -type PipelineRunsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters containerregistry.PipelineRun) (result containerregistry.PipelineRunsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result containerregistry.PipelineRunsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result containerregistry.PipelineRun, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PipelineRunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PipelineRunListResultIterator, err error) -} - -var _ PipelineRunsClientAPI = (*containerregistry.PipelineRunsClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection containerregistry.PrivateEndpointConnection) (result containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnection, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*containerregistry.PrivateEndpointConnectionsClient)(nil) - -// ReplicationsClientAPI contains the set of methods on the ReplicationsClient type. -type ReplicationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication containerregistry.Replication) (result containerregistry.ReplicationsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.ReplicationsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.Replication, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters containerregistry.ReplicationUpdateParameters) (result containerregistry.ReplicationsUpdateFuture, err error) -} - -var _ ReplicationsClientAPI = (*containerregistry.ReplicationsClient)(nil) - -// ScopeMapsClientAPI contains the set of methods on the ScopeMapsClient type. -type ScopeMapsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters containerregistry.ScopeMap) (result containerregistry.ScopeMapsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMapsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMap, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ScopeMapListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ScopeMapListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters containerregistry.ScopeMapUpdateParameters) (result containerregistry.ScopeMapsUpdateFuture, err error) -} - -var _ ScopeMapsClientAPI = (*containerregistry.ScopeMapsClient)(nil) - -// TokensClientAPI contains the set of methods on the TokensClient type. -type TokensClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters containerregistry.Token) (result containerregistry.TokensCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.TokensDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.Token, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TokenListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TokenListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters containerregistry.TokenUpdateParameters) (result containerregistry.TokensUpdateFuture, err error) -} - -var _ TokensClientAPI = (*containerregistry.TokensClient)(nil) - -// WebhooksClientAPI contains the set of methods on the WebhooksClient type. -type WebhooksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters containerregistry.WebhookCreateParameters) (result containerregistry.WebhooksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.WebhooksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.Webhook, err error) - GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.CallbackConfig, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultIterator, err error) - ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultPage, err error) - ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultIterator, err error) - Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventInfo, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters containerregistry.WebhookUpdateParameters) (result containerregistry.WebhooksUpdateFuture, err error) -} - -var _ WebhooksClientAPI = (*containerregistry.WebhooksClient)(nil) - -// AgentPoolsClientAPI contains the set of methods on the AgentPoolsClient type. -type AgentPoolsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool containerregistry.AgentPool) (result containerregistry.AgentPoolsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPool, err error) - GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolQueueStatus, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters containerregistry.AgentPoolUpdateParameters) (result containerregistry.AgentPoolsUpdateFuture, err error) -} - -var _ AgentPoolsClientAPI = (*containerregistry.AgentPoolsClient)(nil) - -// RunsClientAPI contains the set of methods on the RunsClient type. -type RunsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunsCancelFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.Run, err error) - GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunGetLogResult, err error) - List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters containerregistry.RunUpdateParameters) (result containerregistry.RunsUpdateFuture, err error) -} - -var _ RunsClientAPI = (*containerregistry.RunsClient)(nil) - -// TaskRunsClientAPI contains the set of methods on the TaskRunsClient type. -type TaskRunsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun containerregistry.TaskRun) (result containerregistry.TaskRunsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRunsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) - GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters containerregistry.TaskRunUpdateParameters) (result containerregistry.TaskRunsUpdateFuture, err error) -} - -var _ TaskRunsClientAPI = (*containerregistry.TaskRunsClient)(nil) - -// TasksClientAPI contains the set of methods on the TasksClient type. -type TasksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters containerregistry.Task) (result containerregistry.TasksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.TasksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) - GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters containerregistry.TaskUpdateParameters) (result containerregistry.TasksUpdateFuture, err error) -} - -var _ TasksClientAPI = (*containerregistry.TasksClient)(nil) diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/enums.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/enums.go deleted file mode 100644 index 0719013c14e9..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/enums.go +++ /dev/null @@ -1,895 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Action enumerates the values for action. -type Action string - -const ( - // ActionAllow ... - ActionAllow Action = "Allow" -) - -// PossibleActionValues returns an array of possible values for the Action const type. -func PossibleActionValues() []Action { - return []Action{ActionAllow} -} - -// ActionsRequired enumerates the values for actions required. -type ActionsRequired string - -const ( - // ActionsRequiredNone ... - ActionsRequiredNone ActionsRequired = "None" - // ActionsRequiredRecreate ... - ActionsRequiredRecreate ActionsRequired = "Recreate" -) - -// PossibleActionsRequiredValues returns an array of possible values for the ActionsRequired const type. -func PossibleActionsRequiredValues() []ActionsRequired { - return []ActionsRequired{ActionsRequiredNone, ActionsRequiredRecreate} -} - -// ActivationStatus enumerates the values for activation status. -type ActivationStatus string - -const ( - // ActivationStatusActive ... - ActivationStatusActive ActivationStatus = "Active" - // ActivationStatusInactive ... - ActivationStatusInactive ActivationStatus = "Inactive" -) - -// PossibleActivationStatusValues returns an array of possible values for the ActivationStatus const type. -func PossibleActivationStatusValues() []ActivationStatus { - return []ActivationStatus{ActivationStatusActive, ActivationStatusInactive} -} - -// Architecture enumerates the values for architecture. -type Architecture string - -const ( - // ArchitectureAmd64 ... - ArchitectureAmd64 Architecture = "amd64" - // ArchitectureArm ... - ArchitectureArm Architecture = "arm" - // ArchitectureArm64 ... - ArchitectureArm64 Architecture = "arm64" - // ArchitectureThreeEightSix ... - ArchitectureThreeEightSix Architecture = "386" - // ArchitectureX86 ... - ArchitectureX86 Architecture = "x86" -) - -// PossibleArchitectureValues returns an array of possible values for the Architecture const type. -func PossibleArchitectureValues() []Architecture { - return []Architecture{ArchitectureAmd64, ArchitectureArm, ArchitectureArm64, ArchitectureThreeEightSix, ArchitectureX86} -} - -// AuditLogStatus enumerates the values for audit log status. -type AuditLogStatus string - -const ( - // AuditLogStatusDisabled ... - AuditLogStatusDisabled AuditLogStatus = "Disabled" - // AuditLogStatusEnabled ... - AuditLogStatusEnabled AuditLogStatus = "Enabled" -) - -// PossibleAuditLogStatusValues returns an array of possible values for the AuditLogStatus const type. -func PossibleAuditLogStatusValues() []AuditLogStatus { - return []AuditLogStatus{AuditLogStatusDisabled, AuditLogStatusEnabled} -} - -// BaseImageDependencyType enumerates the values for base image dependency type. -type BaseImageDependencyType string - -const ( - // BaseImageDependencyTypeBuildTime ... - BaseImageDependencyTypeBuildTime BaseImageDependencyType = "BuildTime" - // BaseImageDependencyTypeRunTime ... - BaseImageDependencyTypeRunTime BaseImageDependencyType = "RunTime" -) - -// PossibleBaseImageDependencyTypeValues returns an array of possible values for the BaseImageDependencyType const type. -func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { - return []BaseImageDependencyType{BaseImageDependencyTypeBuildTime, BaseImageDependencyTypeRunTime} -} - -// BaseImageTriggerType enumerates the values for base image trigger type. -type BaseImageTriggerType string - -const ( - // BaseImageTriggerTypeAll ... - BaseImageTriggerTypeAll BaseImageTriggerType = "All" - // BaseImageTriggerTypeRuntime ... - BaseImageTriggerTypeRuntime BaseImageTriggerType = "Runtime" -) - -// PossibleBaseImageTriggerTypeValues returns an array of possible values for the BaseImageTriggerType const type. -func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { - return []BaseImageTriggerType{BaseImageTriggerTypeAll, BaseImageTriggerTypeRuntime} -} - -// CertificateType enumerates the values for certificate type. -type CertificateType string - -const ( - // CertificateTypeLocalDirectory ... - CertificateTypeLocalDirectory CertificateType = "LocalDirectory" -) - -// PossibleCertificateTypeValues returns an array of possible values for the CertificateType const type. -func PossibleCertificateTypeValues() []CertificateType { - return []CertificateType{CertificateTypeLocalDirectory} -} - -// ConnectedRegistryMode enumerates the values for connected registry mode. -type ConnectedRegistryMode string - -const ( - // ConnectedRegistryModeMirror ... - ConnectedRegistryModeMirror ConnectedRegistryMode = "Mirror" - // ConnectedRegistryModeRegistry ... - ConnectedRegistryModeRegistry ConnectedRegistryMode = "Registry" -) - -// PossibleConnectedRegistryModeValues returns an array of possible values for the ConnectedRegistryMode const type. -func PossibleConnectedRegistryModeValues() []ConnectedRegistryMode { - return []ConnectedRegistryMode{ConnectedRegistryModeMirror, ConnectedRegistryModeRegistry} -} - -// ConnectionState enumerates the values for connection state. -type ConnectionState string - -const ( - // ConnectionStateOffline ... - ConnectionStateOffline ConnectionState = "Offline" - // ConnectionStateOnline ... - ConnectionStateOnline ConnectionState = "Online" - // ConnectionStateSyncing ... - ConnectionStateSyncing ConnectionState = "Syncing" - // ConnectionStateUnhealthy ... - ConnectionStateUnhealthy ConnectionState = "Unhealthy" -) - -// PossibleConnectionStateValues returns an array of possible values for the ConnectionState const type. -func PossibleConnectionStateValues() []ConnectionState { - return []ConnectionState{ConnectionStateOffline, ConnectionStateOnline, ConnectionStateSyncing, ConnectionStateUnhealthy} -} - -// ConnectionStatus enumerates the values for connection status. -type ConnectionStatus string - -const ( - // ConnectionStatusApproved ... - ConnectionStatusApproved ConnectionStatus = "Approved" - // ConnectionStatusDisconnected ... - ConnectionStatusDisconnected ConnectionStatus = "Disconnected" - // ConnectionStatusPending ... - ConnectionStatusPending ConnectionStatus = "Pending" - // ConnectionStatusRejected ... - ConnectionStatusRejected ConnectionStatus = "Rejected" -) - -// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. -func PossibleConnectionStatusValues() []ConnectionStatus { - return []ConnectionStatus{ConnectionStatusApproved, ConnectionStatusDisconnected, ConnectionStatusPending, ConnectionStatusRejected} -} - -// 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} -} - -// DefaultAction enumerates the values for default action. -type DefaultAction string - -const ( - // DefaultActionAllow ... - DefaultActionAllow DefaultAction = "Allow" - // DefaultActionDeny ... - DefaultActionDeny DefaultAction = "Deny" -) - -// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. -func PossibleDefaultActionValues() []DefaultAction { - return []DefaultAction{DefaultActionAllow, DefaultActionDeny} -} - -// EncryptionStatus enumerates the values for encryption status. -type EncryptionStatus string - -const ( - // EncryptionStatusDisabled ... - EncryptionStatusDisabled EncryptionStatus = "disabled" - // EncryptionStatusEnabled ... - EncryptionStatusEnabled EncryptionStatus = "enabled" -) - -// PossibleEncryptionStatusValues returns an array of possible values for the EncryptionStatus const type. -func PossibleEncryptionStatusValues() []EncryptionStatus { - return []EncryptionStatus{EncryptionStatusDisabled, EncryptionStatusEnabled} -} - -// ExportPolicyStatus enumerates the values for export policy status. -type ExportPolicyStatus string - -const ( - // ExportPolicyStatusDisabled ... - ExportPolicyStatusDisabled ExportPolicyStatus = "disabled" - // ExportPolicyStatusEnabled ... - ExportPolicyStatusEnabled ExportPolicyStatus = "enabled" -) - -// PossibleExportPolicyStatusValues returns an array of possible values for the ExportPolicyStatus const type. -func PossibleExportPolicyStatusValues() []ExportPolicyStatus { - return []ExportPolicyStatus{ExportPolicyStatusDisabled, ExportPolicyStatusEnabled} -} - -// ImportMode enumerates the values for import mode. -type ImportMode string - -const ( - // ImportModeForce ... - ImportModeForce ImportMode = "Force" - // ImportModeNoForce ... - ImportModeNoForce ImportMode = "NoForce" -) - -// PossibleImportModeValues returns an array of possible values for the ImportMode const type. -func PossibleImportModeValues() []ImportMode { - return []ImportMode{ImportModeForce, ImportModeNoForce} -} - -// LastModifiedByType enumerates the values for last modified by type. -type LastModifiedByType string - -const ( - // LastModifiedByTypeApplication ... - LastModifiedByTypeApplication LastModifiedByType = "Application" - // LastModifiedByTypeKey ... - LastModifiedByTypeKey LastModifiedByType = "Key" - // LastModifiedByTypeManagedIdentity ... - LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" - // LastModifiedByTypeUser ... - LastModifiedByTypeUser LastModifiedByType = "User" -) - -// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. -func PossibleLastModifiedByTypeValues() []LastModifiedByType { - return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} -} - -// LogLevel enumerates the values for log level. -type LogLevel string - -const ( - // LogLevelDebug ... - LogLevelDebug LogLevel = "Debug" - // LogLevelError ... - LogLevelError LogLevel = "Error" - // LogLevelInformation ... - LogLevelInformation LogLevel = "Information" - // LogLevelNone ... - LogLevelNone LogLevel = "None" - // LogLevelWarning ... - LogLevelWarning LogLevel = "Warning" -) - -// PossibleLogLevelValues returns an array of possible values for the LogLevel const type. -func PossibleLogLevelValues() []LogLevel { - return []LogLevel{LogLevelDebug, LogLevelError, LogLevelInformation, LogLevelNone, LogLevelWarning} -} - -// NetworkRuleBypassOptions enumerates the values for network rule bypass options. -type NetworkRuleBypassOptions string - -const ( - // NetworkRuleBypassOptionsAzureServices ... - NetworkRuleBypassOptionsAzureServices NetworkRuleBypassOptions = "AzureServices" - // NetworkRuleBypassOptionsNone ... - NetworkRuleBypassOptionsNone NetworkRuleBypassOptions = "None" -) - -// PossibleNetworkRuleBypassOptionsValues returns an array of possible values for the NetworkRuleBypassOptions const type. -func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { - return []NetworkRuleBypassOptions{NetworkRuleBypassOptionsAzureServices, NetworkRuleBypassOptionsNone} -} - -// OS enumerates the values for os. -type OS string - -const ( - // OSLinux ... - OSLinux OS = "Linux" - // OSWindows ... - OSWindows OS = "Windows" -) - -// PossibleOSValues returns an array of possible values for the OS const type. -func PossibleOSValues() []OS { - return []OS{OSLinux, OSWindows} -} - -// PasswordName enumerates the values for password name. -type PasswordName string - -const ( - // PasswordNamePassword ... - PasswordNamePassword PasswordName = "password" - // PasswordNamePassword2 ... - PasswordNamePassword2 PasswordName = "password2" -) - -// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type. -func PossiblePasswordNameValues() []PasswordName { - return []PasswordName{PasswordNamePassword, PasswordNamePassword2} -} - -// PipelineOptions enumerates the values for pipeline options. -type PipelineOptions string - -const ( - // PipelineOptionsContinueOnErrors ... - PipelineOptionsContinueOnErrors PipelineOptions = "ContinueOnErrors" - // PipelineOptionsDeleteSourceBlobOnSuccess ... - PipelineOptionsDeleteSourceBlobOnSuccess PipelineOptions = "DeleteSourceBlobOnSuccess" - // PipelineOptionsOverwriteBlobs ... - PipelineOptionsOverwriteBlobs PipelineOptions = "OverwriteBlobs" - // PipelineOptionsOverwriteTags ... - PipelineOptionsOverwriteTags PipelineOptions = "OverwriteTags" -) - -// PossiblePipelineOptionsValues returns an array of possible values for the PipelineOptions const type. -func PossiblePipelineOptionsValues() []PipelineOptions { - return []PipelineOptions{PipelineOptionsContinueOnErrors, PipelineOptionsDeleteSourceBlobOnSuccess, PipelineOptionsOverwriteBlobs, PipelineOptionsOverwriteTags} -} - -// PipelineRunSourceType enumerates the values for pipeline run source type. -type PipelineRunSourceType string - -const ( - // PipelineRunSourceTypeAzureStorageBlob ... - PipelineRunSourceTypeAzureStorageBlob PipelineRunSourceType = "AzureStorageBlob" -) - -// PossiblePipelineRunSourceTypeValues returns an array of possible values for the PipelineRunSourceType const type. -func PossiblePipelineRunSourceTypeValues() []PipelineRunSourceType { - return []PipelineRunSourceType{PipelineRunSourceTypeAzureStorageBlob} -} - -// PipelineRunTargetType enumerates the values for pipeline run target type. -type PipelineRunTargetType string - -const ( - // PipelineRunTargetTypeAzureStorageBlob ... - PipelineRunTargetTypeAzureStorageBlob PipelineRunTargetType = "AzureStorageBlob" -) - -// PossiblePipelineRunTargetTypeValues returns an array of possible values for the PipelineRunTargetType const type. -func PossiblePipelineRunTargetTypeValues() []PipelineRunTargetType { - return []PipelineRunTargetType{PipelineRunTargetTypeAzureStorageBlob} -} - -// PipelineSourceType enumerates the values for pipeline source type. -type PipelineSourceType string - -const ( - // PipelineSourceTypeAzureStorageBlobContainer ... - PipelineSourceTypeAzureStorageBlobContainer PipelineSourceType = "AzureStorageBlobContainer" -) - -// PossiblePipelineSourceTypeValues returns an array of possible values for the PipelineSourceType const type. -func PossiblePipelineSourceTypeValues() []PipelineSourceType { - return []PipelineSourceType{PipelineSourceTypeAzureStorageBlobContainer} -} - -// PolicyStatus enumerates the values for policy status. -type PolicyStatus string - -const ( - // PolicyStatusDisabled ... - PolicyStatusDisabled PolicyStatus = "disabled" - // PolicyStatusEnabled ... - PolicyStatusEnabled PolicyStatus = "enabled" -) - -// PossiblePolicyStatusValues returns an array of possible values for the PolicyStatus const type. -func PossiblePolicyStatusValues() []PolicyStatus { - return []PolicyStatus{PolicyStatusDisabled, PolicyStatusEnabled} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// RegistryUsageUnit enumerates the values for registry usage unit. -type RegistryUsageUnit string - -const ( - // RegistryUsageUnitBytes ... - RegistryUsageUnitBytes RegistryUsageUnit = "Bytes" - // RegistryUsageUnitCount ... - RegistryUsageUnitCount RegistryUsageUnit = "Count" -) - -// PossibleRegistryUsageUnitValues returns an array of possible values for the RegistryUsageUnit const type. -func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { - return []RegistryUsageUnit{RegistryUsageUnitBytes, RegistryUsageUnitCount} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// RunStatus enumerates the values for run status. -type RunStatus string - -const ( - // RunStatusCanceled ... - RunStatusCanceled RunStatus = "Canceled" - // RunStatusError ... - RunStatusError RunStatus = "Error" - // RunStatusFailed ... - RunStatusFailed RunStatus = "Failed" - // RunStatusQueued ... - RunStatusQueued RunStatus = "Queued" - // RunStatusRunning ... - RunStatusRunning RunStatus = "Running" - // RunStatusStarted ... - RunStatusStarted RunStatus = "Started" - // RunStatusSucceeded ... - RunStatusSucceeded RunStatus = "Succeeded" - // RunStatusTimeout ... - RunStatusTimeout RunStatus = "Timeout" -) - -// PossibleRunStatusValues returns an array of possible values for the RunStatus const type. -func PossibleRunStatusValues() []RunStatus { - return []RunStatus{RunStatusCanceled, RunStatusError, RunStatusFailed, RunStatusQueued, RunStatusRunning, RunStatusStarted, RunStatusSucceeded, RunStatusTimeout} -} - -// RunType enumerates the values for run type. -type RunType string - -const ( - // RunTypeAutoBuild ... - RunTypeAutoBuild RunType = "AutoBuild" - // RunTypeAutoRun ... - RunTypeAutoRun RunType = "AutoRun" - // RunTypeQuickBuild ... - RunTypeQuickBuild RunType = "QuickBuild" - // RunTypeQuickRun ... - RunTypeQuickRun RunType = "QuickRun" -) - -// PossibleRunTypeValues returns an array of possible values for the RunType const type. -func PossibleRunTypeValues() []RunType { - return []RunType{RunTypeAutoBuild, RunTypeAutoRun, RunTypeQuickBuild, RunTypeQuickRun} -} - -// SecretObjectType enumerates the values for secret object type. -type SecretObjectType string - -const ( - // SecretObjectTypeOpaque ... - SecretObjectTypeOpaque SecretObjectType = "Opaque" - // SecretObjectTypeVaultsecret ... - SecretObjectTypeVaultsecret SecretObjectType = "Vaultsecret" -) - -// PossibleSecretObjectTypeValues returns an array of possible values for the SecretObjectType const type. -func PossibleSecretObjectTypeValues() []SecretObjectType { - return []SecretObjectType{SecretObjectTypeOpaque, SecretObjectTypeVaultsecret} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameBasic ... - SkuNameBasic SkuName = "Basic" - // SkuNameClassic ... - SkuNameClassic SkuName = "Classic" - // SkuNamePremium ... - SkuNamePremium SkuName = "Premium" - // SkuNameStandard ... - SkuNameStandard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameBasic, SkuNameClassic, SkuNamePremium, SkuNameStandard} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic ... - SkuTierBasic SkuTier = "Basic" - // SkuTierClassic ... - SkuTierClassic SkuTier = "Classic" - // SkuTierPremium ... - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBasic, SkuTierClassic, SkuTierPremium, SkuTierStandard} -} - -// SourceControlType enumerates the values for source control type. -type SourceControlType string - -const ( - // SourceControlTypeGithub ... - SourceControlTypeGithub SourceControlType = "Github" - // SourceControlTypeVisualStudioTeamService ... - SourceControlTypeVisualStudioTeamService SourceControlType = "VisualStudioTeamService" -) - -// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. -func PossibleSourceControlTypeValues() []SourceControlType { - return []SourceControlType{SourceControlTypeGithub, SourceControlTypeVisualStudioTeamService} -} - -// SourceRegistryLoginMode enumerates the values for source registry login mode. -type SourceRegistryLoginMode string - -const ( - // SourceRegistryLoginModeDefault ... - SourceRegistryLoginModeDefault SourceRegistryLoginMode = "Default" - // SourceRegistryLoginModeNone ... - SourceRegistryLoginModeNone SourceRegistryLoginMode = "None" -) - -// PossibleSourceRegistryLoginModeValues returns an array of possible values for the SourceRegistryLoginMode const type. -func PossibleSourceRegistryLoginModeValues() []SourceRegistryLoginMode { - return []SourceRegistryLoginMode{SourceRegistryLoginModeDefault, SourceRegistryLoginModeNone} -} - -// SourceTriggerEvent enumerates the values for source trigger event. -type SourceTriggerEvent string - -const ( - // SourceTriggerEventCommit ... - SourceTriggerEventCommit SourceTriggerEvent = "commit" - // SourceTriggerEventPullrequest ... - SourceTriggerEventPullrequest SourceTriggerEvent = "pullrequest" -) - -// PossibleSourceTriggerEventValues returns an array of possible values for the SourceTriggerEvent const type. -func PossibleSourceTriggerEventValues() []SourceTriggerEvent { - return []SourceTriggerEvent{SourceTriggerEventCommit, SourceTriggerEventPullrequest} -} - -// TaskStatus enumerates the values for task status. -type TaskStatus string - -const ( - // TaskStatusDisabled ... - TaskStatusDisabled TaskStatus = "Disabled" - // TaskStatusEnabled ... - TaskStatusEnabled TaskStatus = "Enabled" -) - -// PossibleTaskStatusValues returns an array of possible values for the TaskStatus const type. -func PossibleTaskStatusValues() []TaskStatus { - return []TaskStatus{TaskStatusDisabled, TaskStatusEnabled} -} - -// TLSStatus enumerates the values for tls status. -type TLSStatus string - -const ( - // TLSStatusDisabled ... - TLSStatusDisabled TLSStatus = "Disabled" - // TLSStatusEnabled ... - TLSStatusEnabled TLSStatus = "Enabled" -) - -// PossibleTLSStatusValues returns an array of possible values for the TLSStatus const type. -func PossibleTLSStatusValues() []TLSStatus { - return []TLSStatus{TLSStatusDisabled, TLSStatusEnabled} -} - -// TokenCertificateName enumerates the values for token certificate name. -type TokenCertificateName string - -const ( - // TokenCertificateNameCertificate1 ... - TokenCertificateNameCertificate1 TokenCertificateName = "certificate1" - // TokenCertificateNameCertificate2 ... - TokenCertificateNameCertificate2 TokenCertificateName = "certificate2" -) - -// PossibleTokenCertificateNameValues returns an array of possible values for the TokenCertificateName const type. -func PossibleTokenCertificateNameValues() []TokenCertificateName { - return []TokenCertificateName{TokenCertificateNameCertificate1, TokenCertificateNameCertificate2} -} - -// TokenPasswordName enumerates the values for token password name. -type TokenPasswordName string - -const ( - // TokenPasswordNamePassword1 ... - TokenPasswordNamePassword1 TokenPasswordName = "password1" - // TokenPasswordNamePassword2 ... - TokenPasswordNamePassword2 TokenPasswordName = "password2" -) - -// PossibleTokenPasswordNameValues returns an array of possible values for the TokenPasswordName const type. -func PossibleTokenPasswordNameValues() []TokenPasswordName { - return []TokenPasswordName{TokenPasswordNamePassword1, TokenPasswordNamePassword2} -} - -// TokenStatus enumerates the values for token status. -type TokenStatus string - -const ( - // TokenStatusDisabled ... - TokenStatusDisabled TokenStatus = "disabled" - // TokenStatusEnabled ... - TokenStatusEnabled TokenStatus = "enabled" -) - -// PossibleTokenStatusValues returns an array of possible values for the TokenStatus const type. -func PossibleTokenStatusValues() []TokenStatus { - return []TokenStatus{TokenStatusDisabled, TokenStatusEnabled} -} - -// TokenType enumerates the values for token type. -type TokenType string - -const ( - // TokenTypeOAuth ... - TokenTypeOAuth TokenType = "OAuth" - // TokenTypePAT ... - TokenTypePAT TokenType = "PAT" -) - -// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. -func PossibleTokenTypeValues() []TokenType { - return []TokenType{TokenTypeOAuth, TokenTypePAT} -} - -// TriggerStatus enumerates the values for trigger status. -type TriggerStatus string - -const ( - // TriggerStatusDisabled ... - TriggerStatusDisabled TriggerStatus = "Disabled" - // TriggerStatusEnabled ... - TriggerStatusEnabled TriggerStatus = "Enabled" -) - -// PossibleTriggerStatusValues returns an array of possible values for the TriggerStatus const type. -func PossibleTriggerStatusValues() []TriggerStatus { - return []TriggerStatus{TriggerStatusDisabled, TriggerStatusEnabled} -} - -// TrustPolicyType enumerates the values for trust policy type. -type TrustPolicyType string - -const ( - // TrustPolicyTypeNotary ... - TrustPolicyTypeNotary TrustPolicyType = "Notary" -) - -// PossibleTrustPolicyTypeValues returns an array of possible values for the TrustPolicyType const type. -func PossibleTrustPolicyTypeValues() []TrustPolicyType { - return []TrustPolicyType{TrustPolicyTypeNotary} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeDockerBuildRequest ... - TypeDockerBuildRequest Type = "DockerBuildRequest" - // TypeEncodedTaskRunRequest ... - TypeEncodedTaskRunRequest Type = "EncodedTaskRunRequest" - // TypeFileTaskRunRequest ... - TypeFileTaskRunRequest Type = "FileTaskRunRequest" - // TypeRunRequest ... - TypeRunRequest Type = "RunRequest" - // TypeTaskRunRequest ... - TypeTaskRunRequest Type = "TaskRunRequest" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeDockerBuildRequest, TypeEncodedTaskRunRequest, TypeFileTaskRunRequest, TypeRunRequest, TypeTaskRunRequest} -} - -// TypeBasicTaskStepProperties enumerates the values for type basic task step properties. -type TypeBasicTaskStepProperties string - -const ( - // TypeBasicTaskStepPropertiesTypeDocker ... - TypeBasicTaskStepPropertiesTypeDocker TypeBasicTaskStepProperties = "Docker" - // TypeBasicTaskStepPropertiesTypeEncodedTask ... - TypeBasicTaskStepPropertiesTypeEncodedTask TypeBasicTaskStepProperties = "EncodedTask" - // TypeBasicTaskStepPropertiesTypeFileTask ... - TypeBasicTaskStepPropertiesTypeFileTask TypeBasicTaskStepProperties = "FileTask" - // TypeBasicTaskStepPropertiesTypeTaskStepProperties ... - TypeBasicTaskStepPropertiesTypeTaskStepProperties TypeBasicTaskStepProperties = "TaskStepProperties" -) - -// PossibleTypeBasicTaskStepPropertiesValues returns an array of possible values for the TypeBasicTaskStepProperties const type. -func PossibleTypeBasicTaskStepPropertiesValues() []TypeBasicTaskStepProperties { - return []TypeBasicTaskStepProperties{TypeBasicTaskStepPropertiesTypeDocker, TypeBasicTaskStepPropertiesTypeEncodedTask, TypeBasicTaskStepPropertiesTypeFileTask, TypeBasicTaskStepPropertiesTypeTaskStepProperties} -} - -// TypeBasicTaskStepUpdateParameters enumerates the values for type basic task step update parameters. -type TypeBasicTaskStepUpdateParameters string - -const ( - // TypeBasicTaskStepUpdateParametersTypeDocker ... - TypeBasicTaskStepUpdateParametersTypeDocker TypeBasicTaskStepUpdateParameters = "Docker" - // TypeBasicTaskStepUpdateParametersTypeEncodedTask ... - TypeBasicTaskStepUpdateParametersTypeEncodedTask TypeBasicTaskStepUpdateParameters = "EncodedTask" - // TypeBasicTaskStepUpdateParametersTypeFileTask ... - TypeBasicTaskStepUpdateParametersTypeFileTask TypeBasicTaskStepUpdateParameters = "FileTask" - // TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters ... - TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters TypeBasicTaskStepUpdateParameters = "TaskStepUpdateParameters" -) - -// PossibleTypeBasicTaskStepUpdateParametersValues returns an array of possible values for the TypeBasicTaskStepUpdateParameters const type. -func PossibleTypeBasicTaskStepUpdateParametersValues() []TypeBasicTaskStepUpdateParameters { - return []TypeBasicTaskStepUpdateParameters{TypeBasicTaskStepUpdateParametersTypeDocker, TypeBasicTaskStepUpdateParametersTypeEncodedTask, TypeBasicTaskStepUpdateParametersTypeFileTask, TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters} -} - -// UpdateTriggerPayloadType enumerates the values for update trigger payload type. -type UpdateTriggerPayloadType string - -const ( - // UpdateTriggerPayloadTypeDefault ... - UpdateTriggerPayloadTypeDefault UpdateTriggerPayloadType = "Default" - // UpdateTriggerPayloadTypeToken ... - UpdateTriggerPayloadTypeToken UpdateTriggerPayloadType = "Token" -) - -// PossibleUpdateTriggerPayloadTypeValues returns an array of possible values for the UpdateTriggerPayloadType const type. -func PossibleUpdateTriggerPayloadTypeValues() []UpdateTriggerPayloadType { - return []UpdateTriggerPayloadType{UpdateTriggerPayloadTypeDefault, UpdateTriggerPayloadTypeToken} -} - -// Variant enumerates the values for variant. -type Variant string - -const ( - // VariantV6 ... - VariantV6 Variant = "v6" - // VariantV7 ... - VariantV7 Variant = "v7" - // VariantV8 ... - VariantV8 Variant = "v8" -) - -// PossibleVariantValues returns an array of possible values for the Variant const type. -func PossibleVariantValues() []Variant { - return []Variant{VariantV6, VariantV7, VariantV8} -} - -// WebhookAction enumerates the values for webhook action. -type WebhookAction string - -const ( - // WebhookActionChartDelete ... - WebhookActionChartDelete WebhookAction = "chart_delete" - // WebhookActionChartPush ... - WebhookActionChartPush WebhookAction = "chart_push" - // WebhookActionDelete ... - WebhookActionDelete WebhookAction = "delete" - // WebhookActionPush ... - WebhookActionPush WebhookAction = "push" - // WebhookActionQuarantine ... - WebhookActionQuarantine WebhookAction = "quarantine" -) - -// PossibleWebhookActionValues returns an array of possible values for the WebhookAction const type. -func PossibleWebhookActionValues() []WebhookAction { - return []WebhookAction{WebhookActionChartDelete, WebhookActionChartPush, WebhookActionDelete, WebhookActionPush, WebhookActionQuarantine} -} - -// WebhookStatus enumerates the values for webhook status. -type WebhookStatus string - -const ( - // WebhookStatusDisabled ... - WebhookStatusDisabled WebhookStatus = "disabled" - // WebhookStatusEnabled ... - WebhookStatusEnabled WebhookStatus = "enabled" -) - -// PossibleWebhookStatusValues returns an array of possible values for the WebhookStatus const type. -func PossibleWebhookStatusValues() []WebhookStatus { - return []WebhookStatus{WebhookStatusDisabled, WebhookStatusEnabled} -} - -// ZoneRedundancy enumerates the values for zone redundancy. -type ZoneRedundancy string - -const ( - // ZoneRedundancyDisabled ... - ZoneRedundancyDisabled ZoneRedundancy = "Disabled" - // ZoneRedundancyEnabled ... - ZoneRedundancyEnabled ZoneRedundancy = "Enabled" -) - -// PossibleZoneRedundancyValues returns an array of possible values for the ZoneRedundancy const type. -func PossibleZoneRedundancyValues() []ZoneRedundancy { - return []ZoneRedundancy{ZoneRedundancyDisabled, ZoneRedundancyEnabled} -} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/exportpipelines.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/exportpipelines.go deleted file mode 100644 index 9c05b9b9f82d..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/exportpipelines.go +++ /dev/null @@ -1,449 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ExportPipelinesClient is the client for the ExportPipelines methods of the Containerregistry service. -type ExportPipelinesClient struct { - BaseClient -} - -// NewExportPipelinesClient creates an instance of the ExportPipelinesClient client. -func NewExportPipelinesClient(subscriptionID string) ExportPipelinesClient { - return NewExportPipelinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExportPipelinesClientWithBaseURI creates an instance of the ExportPipelinesClient 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 NewExportPipelinesClientWithBaseURI(baseURI string, subscriptionID string) ExportPipelinesClient { - return ExportPipelinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an export pipeline for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// exportPipelineName - the name of the export pipeline. -// exportPipelineCreateParameters - the parameters for creating an export pipeline. -func (client ExportPipelinesClient) Create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline) (result ExportPipelinesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineName, - Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineCreateParameters, - Constraints: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties.Target", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties.Target.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ExportPipelinesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportPipelineName": autorest.Encode("path", exportPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", pathParameters), - autorest.WithJSON(exportPipelineCreateParameters), - 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 ExportPipelinesClient) CreateSender(req *http.Request) (future ExportPipelinesCreateFuture, 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 ExportPipelinesClient) CreateResponder(resp *http.Response) (result ExportPipeline, 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 export pipeline from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// exportPipelineName - the name of the export pipeline. -func (client ExportPipelinesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result ExportPipelinesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineName, - Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, exportPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ExportPipelinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportPipelineName": autorest.Encode("path", exportPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", 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 ExportPipelinesClient) DeleteSender(req *http.Request) (future ExportPipelinesDeleteFuture, 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 ExportPipelinesClient) 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 the properties of the export pipeline. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// exportPipelineName - the name of the export pipeline. -func (client ExportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result ExportPipeline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: exportPipelineName, - Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, exportPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExportPipelinesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportPipelineName": autorest.Encode("path", exportPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", 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 ExportPipelinesClient) 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 ExportPipelinesClient) GetResponder(resp *http.Response) (result ExportPipeline, 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 export pipelines for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ExportPipelinesClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ExportPipelineListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.List") - defer func() { - sc := -1 - if result.eplr.Response.Response != nil { - sc = result.eplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ExportPipelinesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.eplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", resp, "Failure sending request") - return - } - - result.eplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", resp, "Failure responding to request") - return - } - if result.eplr.hasNextLink() && result.eplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ExportPipelinesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/exportPipelines", 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 ExportPipelinesClient) 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 ExportPipelinesClient) ListResponder(resp *http.Response) (result ExportPipelineListResult, 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 ExportPipelinesClient) listNextResults(ctx context.Context, lastResults ExportPipelineListResult) (result ExportPipelineListResult, err error) { - req, err := lastResults.exportPipelineListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "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, "containerregistry.ExportPipelinesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExportPipelinesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ExportPipelineListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/importpipelines.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/importpipelines.go deleted file mode 100644 index 0ddc4126b720..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/importpipelines.go +++ /dev/null @@ -1,449 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ImportPipelinesClient is the client for the ImportPipelines methods of the Containerregistry service. -type ImportPipelinesClient struct { - BaseClient -} - -// NewImportPipelinesClient creates an instance of the ImportPipelinesClient client. -func NewImportPipelinesClient(subscriptionID string) ImportPipelinesClient { - return NewImportPipelinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewImportPipelinesClientWithBaseURI creates an instance of the ImportPipelinesClient 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 NewImportPipelinesClientWithBaseURI(baseURI string, subscriptionID string) ImportPipelinesClient { - return ImportPipelinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an import pipeline for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// importPipelineName - the name of the import pipeline. -// importPipelineCreateParameters - the parameters for creating an import pipeline. -func (client ImportPipelinesClient) Create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline) (result ImportPipelinesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineName, - Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineCreateParameters, - Constraints: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties.Source.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ImportPipelinesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "importPipelineName": autorest.Encode("path", importPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", pathParameters), - autorest.WithJSON(importPipelineCreateParameters), - 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 ImportPipelinesClient) CreateSender(req *http.Request) (future ImportPipelinesCreateFuture, 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 ImportPipelinesClient) CreateResponder(resp *http.Response) (result ImportPipeline, 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 import pipeline from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// importPipelineName - the name of the import pipeline. -func (client ImportPipelinesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result ImportPipelinesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineName, - Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, importPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ImportPipelinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "importPipelineName": autorest.Encode("path", importPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", 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 ImportPipelinesClient) DeleteSender(req *http.Request) (future ImportPipelinesDeleteFuture, 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 ImportPipelinesClient) 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 the properties of the import pipeline. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// importPipelineName - the name of the import pipeline. -func (client ImportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result ImportPipeline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: importPipelineName, - Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, importPipelineName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ImportPipelinesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "importPipelineName": autorest.Encode("path", importPipelineName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", 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 ImportPipelinesClient) 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 ImportPipelinesClient) GetResponder(resp *http.Response) (result ImportPipeline, 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 import pipelines for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ImportPipelinesClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ImportPipelineListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.List") - defer func() { - sc := -1 - if result.iplr.Response.Response != nil { - sc = result.iplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ImportPipelinesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", resp, "Failure sending request") - return - } - - result.iplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", resp, "Failure responding to request") - return - } - if result.iplr.hasNextLink() && result.iplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ImportPipelinesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/importPipelines", 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 ImportPipelinesClient) 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 ImportPipelinesClient) ListResponder(resp *http.Response) (result ImportPipelineListResult, 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 ImportPipelinesClient) listNextResults(ctx context.Context, lastResults ImportPipelineListResult) (result ImportPipelineListResult, err error) { - req, err := lastResults.importPipelineListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "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, "containerregistry.ImportPipelinesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ImportPipelinesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ImportPipelineListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/models.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/models.go deleted file mode 100644 index 37f38718b481..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/models.go +++ /dev/null @@ -1,10075 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry" - -// ActivationProperties the activation properties of the connected registry. -type ActivationProperties struct { - // Status - READ-ONLY; The activation status of the connected registry. Possible values include: 'ActivationStatusActive', 'ActivationStatusInactive' - Status ActivationStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivationProperties. -func (ap ActivationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ActiveDirectoryObject the Active Directory Object that will be used for authenticating the token of a -// container registry. -type ActiveDirectoryObject struct { - // ObjectID - The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container registry. - ObjectID *string `json:"objectId,omitempty"` - // TenantID - The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of a container registry. - TenantID *string `json:"tenantId,omitempty"` -} - -// Actor the agent that initiated the event. For most situations, this could be from the authorization -// context of the request. -type Actor struct { - // Name - The subject or username associated with the request context that generated the event. - Name *string `json:"name,omitempty"` -} - -// AgentPool the agentpool that has the ARM resource and properties. -// The agentpool will have all information to create an agent pool. -type AgentPool struct { - autorest.Response `json:"-"` - // AgentPoolProperties - The properties associated with the agent pool - *AgentPoolProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPool. -func (ap AgentPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.AgentPoolProperties != nil { - objectMap["properties"] = ap.AgentPoolProperties - } - if ap.Location != nil { - objectMap["location"] = ap.Location - } - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPool struct. -func (ap *AgentPool) 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 agentPoolProperties AgentPoolProperties - err = json.Unmarshal(*v, &agentPoolProperties) - if err != nil { - return err - } - ap.AgentPoolProperties = &agentPoolProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ap.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ap.SystemData = &systemData - } - } - } - - return nil -} - -// AgentPoolListResult the collection of agent pools. -type AgentPoolListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]AgentPool `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. -type AgentPoolListResultIterator struct { - i int - page AgentPoolListResultPage -} - -// 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 *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.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 *AgentPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AgentPoolListResultIterator) 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 AgentPoolListResultIterator) Response() AgentPoolListResult { - 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 AgentPoolListResultIterator) Value() AgentPool { - if !iter.page.NotDone() { - return AgentPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AgentPoolListResultIterator type. -func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { - return AgentPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aplr AgentPoolListResult) IsEmpty() bool { - return aplr.Value == nil || len(*aplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aplr AgentPoolListResult) hasNextLink() bool { - return aplr.NextLink != nil && len(*aplr.NextLink) != 0 -} - -// agentPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aplr.NextLink))) -} - -// AgentPoolListResultPage contains a page of AgentPool values. -type AgentPoolListResultPage struct { - fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) - aplr AgentPoolListResult -} - -// 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 *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.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.aplr) - if err != nil { - return err - } - page.aplr = 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 *AgentPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AgentPoolListResultPage) NotDone() bool { - return !page.aplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AgentPoolListResultPage) Response() AgentPoolListResult { - return page.aplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AgentPoolListResultPage) Values() []AgentPool { - if page.aplr.IsEmpty() { - return nil - } - return *page.aplr.Value -} - -// Creates a new instance of the AgentPoolListResultPage type. -func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { - return AgentPoolListResultPage{ - fn: getNextPage, - aplr: cur, - } -} - -// AgentPoolProperties the properties of agent pool. -type AgentPoolProperties struct { - // Count - The count of agent machine - Count *int32 `json:"count,omitempty"` - // Tier - The Tier of agent machine - Tier *string `json:"tier,omitempty"` - // Os - The OS of agent machine. Possible values include: 'OSWindows', 'OSLinux' - Os OS `json:"os,omitempty"` - // VirtualNetworkSubnetResourceID - The Virtual Network Subnet Resource Id of the agent machine - VirtualNetworkSubnetResourceID *string `json:"virtualNetworkSubnetResourceId,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of this agent pool. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolProperties. -func (app AgentPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if app.Count != nil { - objectMap["count"] = app.Count - } - if app.Tier != nil { - objectMap["tier"] = app.Tier - } - if app.Os != "" { - objectMap["os"] = app.Os - } - if app.VirtualNetworkSubnetResourceID != nil { - objectMap["virtualNetworkSubnetResourceId"] = app.VirtualNetworkSubnetResourceID - } - return json.Marshal(objectMap) -} - -// AgentPoolPropertiesUpdateParameters ... -type AgentPoolPropertiesUpdateParameters struct { - // Count - The count of agent machine - Count *int32 `json:"count,omitempty"` -} - -// AgentPoolQueueStatus the QueueStatus of Agent Pool -type AgentPoolQueueStatus struct { - autorest.Response `json:"-"` - // Count - The number of pending runs in the queue - Count *int32 `json:"count,omitempty"` -} - -// AgentPoolsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsCreateFuture) 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 AgentPoolsCreateFuture.Result. -func (future *AgentPoolsCreateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.CreateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsDeleteFuture) 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 AgentPoolsDeleteFuture.Result. -func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AgentPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsUpdateFuture) 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 AgentPoolsUpdateFuture.Result. -func (future *AgentPoolsUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.UpdateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolUpdateParameters the parameters for updating an agent pool. -type AgentPoolUpdateParameters struct { - // AgentPoolPropertiesUpdateParameters - The properties associated with the agent pool - *AgentPoolPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AgentPoolUpdateParameters. -func (apup AgentPoolUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apup.AgentPoolPropertiesUpdateParameters != nil { - objectMap["properties"] = apup.AgentPoolPropertiesUpdateParameters - } - if apup.Tags != nil { - objectMap["tags"] = apup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPoolUpdateParameters struct. -func (apup *AgentPoolUpdateParameters) 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 agentPoolPropertiesUpdateParameters AgentPoolPropertiesUpdateParameters - err = json.Unmarshal(*v, &agentPoolPropertiesUpdateParameters) - if err != nil { - return err - } - apup.AgentPoolPropertiesUpdateParameters = &agentPoolPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - apup.Tags = tags - } - } - } - - return nil -} - -// AgentProperties the properties that determine the run agent configuration. -type AgentProperties struct { - // CPU - The CPU configuration in terms of number of cores required for the run. - CPU *int32 `json:"cpu,omitempty"` -} - -// Argument the properties of a run argument. -type Argument struct { - // Name - The name of the argument. - Name *string `json:"name,omitempty"` - // Value - The value of the argument. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// AuthInfo the authorization properties for accessing the source code repository. -type AuthInfo struct { - // TokenType - The type of Auth token. Possible values include: 'TokenTypePAT', 'TokenTypeOAuth' - TokenType TokenType `json:"tokenType,omitempty"` - // Token - The access token used to access the source control provider. - Token *string `json:"token,omitempty"` - // RefreshToken - The refresh token used to refresh the access token. - RefreshToken *string `json:"refreshToken,omitempty"` - // Scope - The scope of the access token. - Scope *string `json:"scope,omitempty"` - // ExpiresIn - Time in seconds that the token remains valid - ExpiresIn *int32 `json:"expiresIn,omitempty"` -} - -// AuthInfoUpdateParameters the authorization properties for accessing the source code repository. -type AuthInfoUpdateParameters struct { - // TokenType - The type of Auth token. Possible values include: 'TokenTypePAT', 'TokenTypeOAuth' - TokenType TokenType `json:"tokenType,omitempty"` - // Token - The access token used to access the source control provider. - Token *string `json:"token,omitempty"` - // RefreshToken - The refresh token used to refresh the access token. - RefreshToken *string `json:"refreshToken,omitempty"` - // Scope - The scope of the access token. - Scope *string `json:"scope,omitempty"` - // ExpiresIn - Time in seconds that the token remains valid - ExpiresIn *int32 `json:"expiresIn,omitempty"` -} - -// BaseImageDependency properties that describe a base image dependency. -type BaseImageDependency struct { - // Type - The type of the base image dependency. Possible values include: 'BaseImageDependencyTypeBuildTime', 'BaseImageDependencyTypeRunTime' - Type BaseImageDependencyType `json:"type,omitempty"` - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// BaseImageTrigger the trigger based on base image dependency. -type BaseImageTrigger struct { - // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'BaseImageTriggerTypeAll', 'BaseImageTriggerTypeRuntime' - BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` - // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' - UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// BaseImageTriggerUpdateParameters the properties for updating base image dependency trigger. -type BaseImageTriggerUpdateParameters struct { - // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'BaseImageTriggerTypeAll', 'BaseImageTriggerTypeRuntime' - BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` - // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' - UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// CallbackConfig the configuration of service URI and custom headers for the webhook. -type CallbackConfig struct { - autorest.Response `json:"-"` - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` -} - -// MarshalJSON is the custom marshaler for CallbackConfig. -func (cc CallbackConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.ServiceURI != nil { - objectMap["serviceUri"] = cc.ServiceURI - } - if cc.CustomHeaders != nil { - objectMap["customHeaders"] = cc.CustomHeaders - } - return json.Marshal(objectMap) -} - -// ConnectedRegistriesCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectedRegistriesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectedRegistriesClient) (ConnectedRegistry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectedRegistriesCreateFuture) 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 ConnectedRegistriesCreateFuture.Result. -func (future *ConnectedRegistriesCreateFuture) result(client ConnectedRegistriesClient) (cr ConnectedRegistry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { - cr, err = client.CreateResponder(cr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesCreateFuture", "Result", cr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConnectedRegistriesDeactivateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectedRegistriesDeactivateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectedRegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectedRegistriesDeactivateFuture) 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 ConnectedRegistriesDeactivateFuture.Result. -func (future *ConnectedRegistriesDeactivateFuture) result(client ConnectedRegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesDeactivateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesDeactivateFuture") - return - } - ar.Response = future.Response() - return -} - -// ConnectedRegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectedRegistriesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectedRegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectedRegistriesDeleteFuture) 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 ConnectedRegistriesDeleteFuture.Result. -func (future *ConnectedRegistriesDeleteFuture) result(client ConnectedRegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ConnectedRegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectedRegistriesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectedRegistriesClient) (ConnectedRegistry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectedRegistriesUpdateFuture) 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 ConnectedRegistriesUpdateFuture.Result. -func (future *ConnectedRegistriesUpdateFuture) result(client ConnectedRegistriesClient) (cr ConnectedRegistry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { - cr, err = client.UpdateResponder(cr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConnectedRegistry an object that represents a connected registry for a container registry. -type ConnectedRegistry struct { - autorest.Response `json:"-"` - // ConnectedRegistryProperties - The properties of the connected registry. - *ConnectedRegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectedRegistry. -func (cr ConnectedRegistry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cr.ConnectedRegistryProperties != nil { - objectMap["properties"] = cr.ConnectedRegistryProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectedRegistry struct. -func (cr *ConnectedRegistry) 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 connectedRegistryProperties ConnectedRegistryProperties - err = json.Unmarshal(*v, &connectedRegistryProperties) - if err != nil { - return err - } - cr.ConnectedRegistryProperties = &connectedRegistryProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - cr.SystemData = &systemData - } - } - } - - return nil -} - -// ConnectedRegistryListResult the result of a request to list connected registries for a container -// registry. -type ConnectedRegistryListResult struct { - autorest.Response `json:"-"` - // Value - The list of connected registries. Since this list may be incomplete, the nextLink field should be used to request the next list of connected registries. - Value *[]ConnectedRegistry `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of connected registries. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectedRegistryListResultIterator provides access to a complete listing of ConnectedRegistry values. -type ConnectedRegistryListResultIterator struct { - i int - page ConnectedRegistryListResultPage -} - -// 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 *ConnectedRegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistryListResultIterator.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 *ConnectedRegistryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectedRegistryListResultIterator) 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 ConnectedRegistryListResultIterator) Response() ConnectedRegistryListResult { - 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 ConnectedRegistryListResultIterator) Value() ConnectedRegistry { - if !iter.page.NotDone() { - return ConnectedRegistry{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectedRegistryListResultIterator type. -func NewConnectedRegistryListResultIterator(page ConnectedRegistryListResultPage) ConnectedRegistryListResultIterator { - return ConnectedRegistryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (crlr ConnectedRegistryListResult) IsEmpty() bool { - return crlr.Value == nil || len(*crlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (crlr ConnectedRegistryListResult) hasNextLink() bool { - return crlr.NextLink != nil && len(*crlr.NextLink) != 0 -} - -// connectedRegistryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (crlr ConnectedRegistryListResult) connectedRegistryListResultPreparer(ctx context.Context) (*http.Request, error) { - if !crlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(crlr.NextLink))) -} - -// ConnectedRegistryListResultPage contains a page of ConnectedRegistry values. -type ConnectedRegistryListResultPage struct { - fn func(context.Context, ConnectedRegistryListResult) (ConnectedRegistryListResult, error) - crlr ConnectedRegistryListResult -} - -// 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 *ConnectedRegistryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistryListResultPage.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.crlr) - if err != nil { - return err - } - page.crlr = 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 *ConnectedRegistryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectedRegistryListResultPage) NotDone() bool { - return !page.crlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectedRegistryListResultPage) Response() ConnectedRegistryListResult { - return page.crlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectedRegistryListResultPage) Values() []ConnectedRegistry { - if page.crlr.IsEmpty() { - return nil - } - return *page.crlr.Value -} - -// Creates a new instance of the ConnectedRegistryListResultPage type. -func NewConnectedRegistryListResultPage(cur ConnectedRegistryListResult, getNextPage func(context.Context, ConnectedRegistryListResult) (ConnectedRegistryListResult, error)) ConnectedRegistryListResultPage { - return ConnectedRegistryListResultPage{ - fn: getNextPage, - crlr: cur, - } -} - -// ConnectedRegistryProperties the properties of a connected registry. -type ConnectedRegistryProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Mode - The mode of the connected registry resource that indicates the permissions of the registry. Possible values include: 'ConnectedRegistryModeRegistry', 'ConnectedRegistryModeMirror' - Mode ConnectedRegistryMode `json:"mode,omitempty"` - // Version - READ-ONLY; The current version of ACR runtime on the connected registry. - Version *string `json:"version,omitempty"` - // ConnectionState - READ-ONLY; The current connection state of the connected registry. Possible values include: 'ConnectionStateOnline', 'ConnectionStateOffline', 'ConnectionStateSyncing', 'ConnectionStateUnhealthy' - ConnectionState ConnectionState `json:"connectionState,omitempty"` - // LastActivityTime - READ-ONLY; The last activity time of the connected registry. - LastActivityTime *date.Time `json:"lastActivityTime,omitempty"` - // Activation - READ-ONLY; The activation properties of the connected registry. - Activation *ActivationProperties `json:"activation,omitempty"` - // Parent - The parent of the connected registry. - Parent *ParentProperties `json:"parent,omitempty"` - // ClientTokenIds - The list of the ACR token resource IDs used to authenticate clients to the connected registry. - ClientTokenIds *[]string `json:"clientTokenIds,omitempty"` - // LoginServer - The login server properties of the connected registry. - LoginServer *LoginServerProperties `json:"loginServer,omitempty"` - // Logging - The logging properties of the connected registry. - Logging *LoggingProperties `json:"logging,omitempty"` - // StatusDetails - READ-ONLY; The list of current statuses of the connected registry. - StatusDetails *[]StatusDetailProperties `json:"statusDetails,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectedRegistryProperties. -func (crp ConnectedRegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if crp.Mode != "" { - objectMap["mode"] = crp.Mode - } - if crp.Parent != nil { - objectMap["parent"] = crp.Parent - } - if crp.ClientTokenIds != nil { - objectMap["clientTokenIds"] = crp.ClientTokenIds - } - if crp.LoginServer != nil { - objectMap["loginServer"] = crp.LoginServer - } - if crp.Logging != nil { - objectMap["logging"] = crp.Logging - } - return json.Marshal(objectMap) -} - -// ConnectedRegistryUpdateParameters the parameters for updating a connected registry. -type ConnectedRegistryUpdateParameters struct { - // ConnectedRegistryUpdateProperties - The properties of the connected registry update parameters. - *ConnectedRegistryUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectedRegistryUpdateParameters. -func (crup ConnectedRegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if crup.ConnectedRegistryUpdateProperties != nil { - objectMap["properties"] = crup.ConnectedRegistryUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectedRegistryUpdateParameters struct. -func (crup *ConnectedRegistryUpdateParameters) 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 connectedRegistryUpdateProperties ConnectedRegistryUpdateProperties - err = json.Unmarshal(*v, &connectedRegistryUpdateProperties) - if err != nil { - return err - } - crup.ConnectedRegistryUpdateProperties = &connectedRegistryUpdateProperties - } - } - } - - return nil -} - -// ConnectedRegistryUpdateProperties the parameters for updating token properties. -type ConnectedRegistryUpdateProperties struct { - // SyncProperties - The sync properties of the connected registry with its parent. - SyncProperties *SyncUpdateProperties `json:"syncProperties,omitempty"` - // Logging - The logging properties of the connected registry. - Logging *LoggingProperties `json:"logging,omitempty"` - // ClientTokenIds - The list of the ACR token resource IDs used to authenticate clients to the connected registry. - ClientTokenIds *[]string `json:"clientTokenIds,omitempty"` -} - -// Credentials the parameters that describes a set of credentials that will be used when a run is invoked. -type Credentials struct { - // SourceRegistry - Describes the credential parameters for accessing the source registry. - SourceRegistry *SourceRegistryCredentials `json:"sourceRegistry,omitempty"` - // CustomRegistries - Describes the credential parameters for accessing other custom registries. The key - // for the dictionary item will be the registry login server (myregistry.azurecr.io) and - // the value of the item will be the registry credentials for accessing the registry. - CustomRegistries map[string]*CustomRegistryCredentials `json:"customRegistries"` -} - -// MarshalJSON is the custom marshaler for Credentials. -func (c Credentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.SourceRegistry != nil { - objectMap["sourceRegistry"] = c.SourceRegistry - } - if c.CustomRegistries != nil { - objectMap["customRegistries"] = c.CustomRegistries - } - return json.Marshal(objectMap) -} - -// CustomRegistryCredentials describes the credentials that will be used to access a custom registry during -// a run. -type CustomRegistryCredentials struct { - // UserName - The username for logging into the custom registry. - UserName *SecretObject `json:"userName,omitempty"` - // Password - The password for logging into the custom registry. The password is a secret - // object that allows multiple ways of providing the value for it. - Password *SecretObject `json:"password,omitempty"` - // Identity - Indicates the managed identity assigned to the custom credential. If a user-assigned identity - // this value is the Client ID. If a system-assigned identity, the value will be `system`. In - // the case of a system-assigned identity, the Client ID will be determined by the runner. This - // identity may be used to authenticate to key vault to retrieve credentials or it may be the only - // source of authentication used for accessing the registry. - Identity *string `json:"identity,omitempty"` -} - -// DockerBuildRequest the parameters for a docker quick build. -type DockerBuildRequest struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source location. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Arguments - The collection of override arguments to be used when executing the run. - Arguments *[]Argument `json:"arguments,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildRequest. -func (dbr DockerBuildRequest) MarshalJSON() ([]byte, error) { - dbr.Type = TypeDockerBuildRequest - objectMap := make(map[string]interface{}) - if dbr.ImageNames != nil { - objectMap["imageNames"] = dbr.ImageNames - } - if dbr.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbr.IsPushEnabled - } - if dbr.NoCache != nil { - objectMap["noCache"] = dbr.NoCache - } - if dbr.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbr.DockerFilePath - } - if dbr.Target != nil { - objectMap["target"] = dbr.Target - } - if dbr.Arguments != nil { - objectMap["arguments"] = dbr.Arguments - } - if dbr.Timeout != nil { - objectMap["timeout"] = dbr.Timeout - } - if dbr.Platform != nil { - objectMap["platform"] = dbr.Platform - } - if dbr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = dbr.AgentConfiguration - } - if dbr.SourceLocation != nil { - objectMap["sourceLocation"] = dbr.SourceLocation - } - if dbr.Credentials != nil { - objectMap["credentials"] = dbr.Credentials - } - if dbr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = dbr.IsArchiveEnabled - } - if dbr.AgentPoolName != nil { - objectMap["agentPoolName"] = dbr.AgentPoolName - } - if dbr.LogTemplate != nil { - objectMap["logTemplate"] = dbr.LogTemplate - } - if dbr.Type != "" { - objectMap["type"] = dbr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return &dbr, true -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &dbr, true -} - -// DockerBuildStep the Docker build step. -type DockerBuildStep struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source context. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Arguments - The collection of override arguments to be used when executing this build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStep. -func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) { - dbs.Type = TypeBasicTaskStepPropertiesTypeDocker - objectMap := make(map[string]interface{}) - if dbs.ImageNames != nil { - objectMap["imageNames"] = dbs.ImageNames - } - if dbs.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbs.IsPushEnabled - } - if dbs.NoCache != nil { - objectMap["noCache"] = dbs.NoCache - } - if dbs.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbs.DockerFilePath - } - if dbs.Target != nil { - objectMap["target"] = dbs.Target - } - if dbs.Arguments != nil { - objectMap["arguments"] = dbs.Arguments - } - if dbs.ContextPath != nil { - objectMap["contextPath"] = dbs.ContextPath - } - if dbs.ContextAccessToken != nil { - objectMap["contextAccessToken"] = dbs.ContextAccessToken - } - if dbs.Type != "" { - objectMap["type"] = dbs.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return &dbs, true -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &dbs, true -} - -// DockerBuildStepUpdateParameters the properties for updating a docker build step. -type DockerBuildStepUpdateParameters struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source context. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Arguments - The collection of override arguments to be used when executing this build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { - dbsup.Type = TypeBasicTaskStepUpdateParametersTypeDocker - objectMap := make(map[string]interface{}) - if dbsup.ImageNames != nil { - objectMap["imageNames"] = dbsup.ImageNames - } - if dbsup.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbsup.IsPushEnabled - } - if dbsup.NoCache != nil { - objectMap["noCache"] = dbsup.NoCache - } - if dbsup.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbsup.DockerFilePath - } - if dbsup.Arguments != nil { - objectMap["arguments"] = dbsup.Arguments - } - if dbsup.Target != nil { - objectMap["target"] = dbsup.Target - } - if dbsup.ContextPath != nil { - objectMap["contextPath"] = dbsup.ContextPath - } - if dbsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = dbsup.ContextAccessToken - } - if dbsup.Type != "" { - objectMap["type"] = dbsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return &dbsup, true -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &dbsup, true -} - -// EncodedTaskRunRequest the parameters for a quick task run request. -type EncodedTaskRunRequest struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { - etrr.Type = TypeEncodedTaskRunRequest - objectMap := make(map[string]interface{}) - if etrr.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = etrr.EncodedTaskContent - } - if etrr.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = etrr.EncodedValuesContent - } - if etrr.Values != nil { - objectMap["values"] = etrr.Values - } - if etrr.Timeout != nil { - objectMap["timeout"] = etrr.Timeout - } - if etrr.Platform != nil { - objectMap["platform"] = etrr.Platform - } - if etrr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = etrr.AgentConfiguration - } - if etrr.SourceLocation != nil { - objectMap["sourceLocation"] = etrr.SourceLocation - } - if etrr.Credentials != nil { - objectMap["credentials"] = etrr.Credentials - } - if etrr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = etrr.IsArchiveEnabled - } - if etrr.AgentPoolName != nil { - objectMap["agentPoolName"] = etrr.AgentPoolName - } - if etrr.LogTemplate != nil { - objectMap["logTemplate"] = etrr.LogTemplate - } - if etrr.Type != "" { - objectMap["type"] = etrr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return &etrr, true -} - -// AsRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &etrr, true -} - -// EncodedTaskStep the properties of a encoded task step. -type EncodedTaskStep struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskStep. -func (ets EncodedTaskStep) MarshalJSON() ([]byte, error) { - ets.Type = TypeBasicTaskStepPropertiesTypeEncodedTask - objectMap := make(map[string]interface{}) - if ets.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = ets.EncodedTaskContent - } - if ets.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = ets.EncodedValuesContent - } - if ets.Values != nil { - objectMap["values"] = ets.Values - } - if ets.ContextPath != nil { - objectMap["contextPath"] = ets.ContextPath - } - if ets.ContextAccessToken != nil { - objectMap["contextAccessToken"] = ets.ContextAccessToken - } - if ets.Type != "" { - objectMap["type"] = ets.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return &ets, true -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &ets, true -} - -// EncodedTaskStepUpdateParameters the properties for updating encoded task step. -type EncodedTaskStepUpdateParameters struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - etsup.Type = TypeBasicTaskStepUpdateParametersTypeEncodedTask - objectMap := make(map[string]interface{}) - if etsup.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = etsup.EncodedTaskContent - } - if etsup.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = etsup.EncodedValuesContent - } - if etsup.Values != nil { - objectMap["values"] = etsup.Values - } - if etsup.ContextPath != nil { - objectMap["contextPath"] = etsup.ContextPath - } - if etsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = etsup.ContextAccessToken - } - if etsup.Type != "" { - objectMap["type"] = etsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return &etsup, true -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &etsup, true -} - -// EncryptionProperty ... -type EncryptionProperty struct { - // Status - Indicates whether or not the encryption is enabled for container registry. Possible values include: 'EncryptionStatusEnabled', 'EncryptionStatusDisabled' - Status EncryptionStatus `json:"status,omitempty"` - // KeyVaultProperties - Key vault properties. - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} - -// ErrorResponse an error response from the Azure Container Registry service. -type ErrorResponse struct { - // Error - Azure container registry build API error body. - Error *ErrorResponseBody `json:"error,omitempty"` -} - -// ErrorResponseBody an error response from the Azure Container Registry service. -type ErrorResponseBody struct { - // Code - error code. - Code *string `json:"code,omitempty"` - // Message - error message. - Message *string `json:"message,omitempty"` - // Target - target of the particular error. - Target *string `json:"target,omitempty"` - // Details - an array of additional nested error response info objects, as described by this contract. - Details *InnerErrorDescription `json:"details,omitempty"` -} - -// Event the event for a webhook. -type Event struct { - // EventRequestMessage - The event request message sent to the service URI. - EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` - // EventResponseMessage - The event response message received from the service URI. - EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventContent the content of the event request message. -type EventContent struct { - // ID - The event ID. - ID *string `json:"id,omitempty"` - // Timestamp - The time at which the event occurred. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Action - The action that encompasses the provided event. - Action *string `json:"action,omitempty"` - // Target - The target of the event. - Target *Target `json:"target,omitempty"` - // Request - The request that generated the event. - Request *Request `json:"request,omitempty"` - // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. - Actor *Actor `json:"actor,omitempty"` - // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - Source *Source `json:"source,omitempty"` -} - -// EventInfo the basic information of an event. -type EventInfo struct { - autorest.Response `json:"-"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventListResult the result of a request to list events for a webhook. -type EventListResult struct { - autorest.Response `json:"-"` - // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - Value *[]Event `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventListResultIterator provides access to a complete listing of Event values. -type EventListResultIterator struct { - i int - page EventListResultPage -} - -// 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 *EventListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.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 *EventListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventListResultIterator) 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 EventListResultIterator) Response() EventListResult { - 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 EventListResultIterator) Value() Event { - if !iter.page.NotDone() { - return Event{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventListResultIterator type. -func NewEventListResultIterator(page EventListResultPage) EventListResultIterator { - return EventListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (elr EventListResult) IsEmpty() bool { - return elr.Value == nil || len(*elr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (elr EventListResult) hasNextLink() bool { - return elr.NextLink != nil && len(*elr.NextLink) != 0 -} - -// eventListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (elr EventListResult) eventListResultPreparer(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))) -} - -// EventListResultPage contains a page of Event values. -type EventListResultPage struct { - fn func(context.Context, EventListResult) (EventListResult, error) - elr EventListResult -} - -// 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 *EventListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.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 *EventListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventListResultPage) NotDone() bool { - return !page.elr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventListResultPage) Response() EventListResult { - return page.elr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventListResultPage) Values() []Event { - if page.elr.IsEmpty() { - return nil - } - return *page.elr.Value -} - -// Creates a new instance of the EventListResultPage type. -func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage { - return EventListResultPage{ - fn: getNextPage, - elr: cur, - } -} - -// EventRequestMessage the event request message sent to the service URI. -type EventRequestMessage struct { - // Content - The content of the event request message. - Content *EventContent `json:"content,omitempty"` - // Headers - The headers of the event request message. - Headers map[string]*string `json:"headers"` - // Method - The HTTP method used to send the event request message. - Method *string `json:"method,omitempty"` - // RequestURI - The URI used to send the event request message. - RequestURI *string `json:"requestUri,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventRequestMessage. -func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.Method != nil { - objectMap["method"] = erm.Method - } - if erm.RequestURI != nil { - objectMap["requestUri"] = erm.RequestURI - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// EventResponseMessage the event response message received from the service URI. -type EventResponseMessage struct { - // Content - The content of the event response message. - Content *string `json:"content,omitempty"` - // Headers - The headers of the event response message. - Headers map[string]*string `json:"headers"` - // ReasonPhrase - The reason phrase of the event response message. - ReasonPhrase *string `json:"reasonPhrase,omitempty"` - // StatusCode - The status code of the event response message. - StatusCode *string `json:"statusCode,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventResponseMessage. -func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.ReasonPhrase != nil { - objectMap["reasonPhrase"] = erm.ReasonPhrase - } - if erm.StatusCode != nil { - objectMap["statusCode"] = erm.StatusCode - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// ExportPipeline an object that represents an export pipeline for a container registry. -type ExportPipeline struct { - autorest.Response `json:"-"` - // Location - The location of the export pipeline. - Location *string `json:"location,omitempty"` - // Identity - The identity of the export pipeline. - Identity *IdentityProperties `json:"identity,omitempty"` - // ExportPipelineProperties - The properties of the export pipeline. - *ExportPipelineProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportPipeline. -func (ep ExportPipeline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.Location != nil { - objectMap["location"] = ep.Location - } - if ep.Identity != nil { - objectMap["identity"] = ep.Identity - } - if ep.ExportPipelineProperties != nil { - objectMap["properties"] = ep.ExportPipelineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExportPipeline struct. -func (ep *ExportPipeline) 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 - } - ep.Location = &location - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ep.Identity = &identity - } - case "properties": - if v != nil { - var exportPipelineProperties ExportPipelineProperties - err = json.Unmarshal(*v, &exportPipelineProperties) - if err != nil { - return err - } - ep.ExportPipelineProperties = &exportPipelineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ep.SystemData = &systemData - } - } - } - - return nil -} - -// ExportPipelineListResult the result of a request to list export pipelines for a container registry. -type ExportPipelineListResult struct { - autorest.Response `json:"-"` - // Value - The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of export pipelines. - Value *[]ExportPipeline `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of pipeline runs. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExportPipelineListResultIterator provides access to a complete listing of ExportPipeline values. -type ExportPipelineListResultIterator struct { - i int - page ExportPipelineListResultPage -} - -// 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 *ExportPipelineListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelineListResultIterator.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 *ExportPipelineListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExportPipelineListResultIterator) 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 ExportPipelineListResultIterator) Response() ExportPipelineListResult { - 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 ExportPipelineListResultIterator) Value() ExportPipeline { - if !iter.page.NotDone() { - return ExportPipeline{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExportPipelineListResultIterator type. -func NewExportPipelineListResultIterator(page ExportPipelineListResultPage) ExportPipelineListResultIterator { - return ExportPipelineListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eplr ExportPipelineListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eplr ExportPipelineListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 -} - -// exportPipelineListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eplr ExportPipelineListResult) exportPipelineListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) -} - -// ExportPipelineListResultPage contains a page of ExportPipeline values. -type ExportPipelineListResultPage struct { - fn func(context.Context, ExportPipelineListResult) (ExportPipelineListResult, error) - eplr ExportPipelineListResult -} - -// 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 *ExportPipelineListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelineListResultPage.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.eplr) - if err != nil { - return err - } - page.eplr = 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 *ExportPipelineListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExportPipelineListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExportPipelineListResultPage) Response() ExportPipelineListResult { - return page.eplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExportPipelineListResultPage) Values() []ExportPipeline { - if page.eplr.IsEmpty() { - return nil - } - return *page.eplr.Value -} - -// Creates a new instance of the ExportPipelineListResultPage type. -func NewExportPipelineListResultPage(cur ExportPipelineListResult, getNextPage func(context.Context, ExportPipelineListResult) (ExportPipelineListResult, error)) ExportPipelineListResultPage { - return ExportPipelineListResultPage{ - fn: getNextPage, - eplr: cur, - } -} - -// ExportPipelineProperties the properties of an export pipeline. -type ExportPipelineProperties struct { - // Target - The target properties of the export pipeline. - Target *ExportPipelineTargetProperties `json:"target,omitempty"` - // Options - The list of all options configured for the pipeline. - Options *[]PipelineOptions `json:"options,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the pipeline at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportPipelineProperties. -func (epp ExportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epp.Target != nil { - objectMap["target"] = epp.Target - } - if epp.Options != nil { - objectMap["options"] = epp.Options - } - return json.Marshal(objectMap) -} - -// ExportPipelinesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExportPipelinesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExportPipelinesClient) (ExportPipeline, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExportPipelinesCreateFuture) 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 ExportPipelinesCreateFuture.Result. -func (future *ExportPipelinesCreateFuture) result(client ExportPipelinesClient) (ep ExportPipeline, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ExportPipelinesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesCreateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ExportPipelinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExportPipelinesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExportPipelinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExportPipelinesDeleteFuture) 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 ExportPipelinesDeleteFuture.Result. -func (future *ExportPipelinesDeleteFuture) result(client ExportPipelinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ExportPipelinesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExportPipelineTargetProperties the properties of the export pipeline target. -type ExportPipelineTargetProperties struct { - // Type - The type of target for the export pipeline. - Type *string `json:"type,omitempty"` - // URI - The target uri of the export pipeline. - // When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName" - URI *string `json:"uri,omitempty"` - // KeyVaultURI - They key vault secret uri to obtain the target storage SAS token. - KeyVaultURI *string `json:"keyVaultUri,omitempty"` -} - -// ExportPolicy the export policy for a container registry. -type ExportPolicy struct { - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'ExportPolicyStatusEnabled', 'ExportPolicyStatusDisabled' - Status ExportPolicyStatus `json:"status,omitempty"` -} - -// FileTaskRunRequest the request parameters for a scheduling run against a task file. -type FileTaskRunRequest struct { - // TaskFilePath - The template/definition file path relative to the source. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The values/parameters file path relative to the source. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) MarshalJSON() ([]byte, error) { - ftrr.Type = TypeFileTaskRunRequest - objectMap := make(map[string]interface{}) - if ftrr.TaskFilePath != nil { - objectMap["taskFilePath"] = ftrr.TaskFilePath - } - if ftrr.ValuesFilePath != nil { - objectMap["valuesFilePath"] = ftrr.ValuesFilePath - } - if ftrr.Values != nil { - objectMap["values"] = ftrr.Values - } - if ftrr.Timeout != nil { - objectMap["timeout"] = ftrr.Timeout - } - if ftrr.Platform != nil { - objectMap["platform"] = ftrr.Platform - } - if ftrr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = ftrr.AgentConfiguration - } - if ftrr.SourceLocation != nil { - objectMap["sourceLocation"] = ftrr.SourceLocation - } - if ftrr.Credentials != nil { - objectMap["credentials"] = ftrr.Credentials - } - if ftrr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = ftrr.IsArchiveEnabled - } - if ftrr.AgentPoolName != nil { - objectMap["agentPoolName"] = ftrr.AgentPoolName - } - if ftrr.LogTemplate != nil { - objectMap["logTemplate"] = ftrr.LogTemplate - } - if ftrr.Type != "" { - objectMap["type"] = ftrr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return &ftrr, true -} - -// AsTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &ftrr, true -} - -// FileTaskStep the properties of a task step. -type FileTaskStep struct { - // TaskFilePath - The task template/definition file path relative to the source context. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The task values/parameters file path relative to the source context. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskStep. -func (fts FileTaskStep) MarshalJSON() ([]byte, error) { - fts.Type = TypeBasicTaskStepPropertiesTypeFileTask - objectMap := make(map[string]interface{}) - if fts.TaskFilePath != nil { - objectMap["taskFilePath"] = fts.TaskFilePath - } - if fts.ValuesFilePath != nil { - objectMap["valuesFilePath"] = fts.ValuesFilePath - } - if fts.Values != nil { - objectMap["values"] = fts.Values - } - if fts.ContextPath != nil { - objectMap["contextPath"] = fts.ContextPath - } - if fts.ContextAccessToken != nil { - objectMap["contextAccessToken"] = fts.ContextAccessToken - } - if fts.Type != "" { - objectMap["type"] = fts.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { - return &fts, true -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &fts, true -} - -// FileTaskStepUpdateParameters the properties of updating a task step. -type FileTaskStepUpdateParameters struct { - // TaskFilePath - The task template/definition file path relative to the source context. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The values/parameters file path relative to the source context. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - ftsup.Type = TypeBasicTaskStepUpdateParametersTypeFileTask - objectMap := make(map[string]interface{}) - if ftsup.TaskFilePath != nil { - objectMap["taskFilePath"] = ftsup.TaskFilePath - } - if ftsup.ValuesFilePath != nil { - objectMap["valuesFilePath"] = ftsup.ValuesFilePath - } - if ftsup.Values != nil { - objectMap["values"] = ftsup.Values - } - if ftsup.ContextPath != nil { - objectMap["contextPath"] = ftsup.ContextPath - } - if ftsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = ftsup.ContextAccessToken - } - if ftsup.Type != "" { - objectMap["type"] = ftsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return &ftsup, true -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &ftsup, true -} - -// GenerateCredentialsParameters the parameters used to generate credentials for a specified token or user -// of a container registry. -type GenerateCredentialsParameters struct { - // TokenID - The resource ID of the token for which credentials have to be generated. - TokenID *string `json:"tokenId,omitempty"` - // Expiry - The expiry date of the generated credentials after which the credentials become invalid. - Expiry *date.Time `json:"expiry,omitempty"` - // Name - Specifies name of the password which should be regenerated if any -- password1 or password2. Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' - Name TokenPasswordName `json:"name,omitempty"` -} - -// GenerateCredentialsResult the response from the GenerateCredentials operation. -type GenerateCredentialsResult struct { - autorest.Response `json:"-"` - // Username - The username for a container registry. - Username *string `json:"username,omitempty"` - // Passwords - The list of passwords for a container registry. - Passwords *[]TokenPassword `json:"passwords,omitempty"` -} - -// IdentityProperties managed identity for the resource. -type IdentityProperties struct { - // PrincipalID - The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the resource. The user identity - // dictionary key references will be ARM resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - // providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for IdentityProperties. -func (IP IdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.PrincipalID != nil { - objectMap["principalId"] = IP.PrincipalID - } - if IP.TenantID != nil { - objectMap["tenantId"] = IP.TenantID - } - if IP.Type != "" { - objectMap["type"] = IP.Type - } - if IP.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = IP.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ImageDescriptor properties for a registry image. -type ImageDescriptor struct { - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// ImageUpdateTrigger the image update trigger that caused a build. -type ImageUpdateTrigger struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // Timestamp - The timestamp when the image update happened. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Images - The list of image updates that caused the build. - Images *[]ImageDescriptor `json:"images,omitempty"` -} - -// ImportImageParameters ... -type ImportImageParameters struct { - // Source - The source of the image. - Source *ImportSource `json:"source,omitempty"` - // TargetTags - List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - TargetTags *[]string `json:"targetTags,omitempty"` - // UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created. - UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"` - // Mode - When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'ImportModeNoForce', 'ImportModeForce' - Mode ImportMode `json:"mode,omitempty"` -} - -// ImportPipeline an object that represents an import pipeline for a container registry. -type ImportPipeline struct { - autorest.Response `json:"-"` - // Location - The location of the import pipeline. - Location *string `json:"location,omitempty"` - // Identity - The identity of the import pipeline. - Identity *IdentityProperties `json:"identity,omitempty"` - // ImportPipelineProperties - The properties of the import pipeline. - *ImportPipelineProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImportPipeline. -func (IP ImportPipeline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.Location != nil { - objectMap["location"] = IP.Location - } - if IP.Identity != nil { - objectMap["identity"] = IP.Identity - } - if IP.ImportPipelineProperties != nil { - objectMap["properties"] = IP.ImportPipelineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ImportPipeline struct. -func (IP *ImportPipeline) 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 - } - IP.Location = &location - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - IP.Identity = &identity - } - case "properties": - if v != nil { - var importPipelineProperties ImportPipelineProperties - err = json.Unmarshal(*v, &importPipelineProperties) - if err != nil { - return err - } - IP.ImportPipelineProperties = &importPipelineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - IP.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - IP.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - IP.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - IP.SystemData = &systemData - } - } - } - - return nil -} - -// ImportPipelineListResult the result of a request to list import pipelines for a container registry. -type ImportPipelineListResult struct { - autorest.Response `json:"-"` - // Value - The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of import pipelines. - Value *[]ImportPipeline `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of pipeline runs. - NextLink *string `json:"nextLink,omitempty"` -} - -// ImportPipelineListResultIterator provides access to a complete listing of ImportPipeline values. -type ImportPipelineListResultIterator struct { - i int - page ImportPipelineListResultPage -} - -// 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 *ImportPipelineListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelineListResultIterator.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 *ImportPipelineListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ImportPipelineListResultIterator) 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 ImportPipelineListResultIterator) Response() ImportPipelineListResult { - 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 ImportPipelineListResultIterator) Value() ImportPipeline { - if !iter.page.NotDone() { - return ImportPipeline{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ImportPipelineListResultIterator type. -func NewImportPipelineListResultIterator(page ImportPipelineListResultPage) ImportPipelineListResultIterator { - return ImportPipelineListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iplr ImportPipelineListResult) IsEmpty() bool { - return iplr.Value == nil || len(*iplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iplr ImportPipelineListResult) hasNextLink() bool { - return iplr.NextLink != nil && len(*iplr.NextLink) != 0 -} - -// importPipelineListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iplr ImportPipelineListResult) importPipelineListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iplr.NextLink))) -} - -// ImportPipelineListResultPage contains a page of ImportPipeline values. -type ImportPipelineListResultPage struct { - fn func(context.Context, ImportPipelineListResult) (ImportPipelineListResult, error) - iplr ImportPipelineListResult -} - -// 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 *ImportPipelineListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelineListResultPage.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.iplr) - if err != nil { - return err - } - page.iplr = 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 *ImportPipelineListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ImportPipelineListResultPage) NotDone() bool { - return !page.iplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ImportPipelineListResultPage) Response() ImportPipelineListResult { - return page.iplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ImportPipelineListResultPage) Values() []ImportPipeline { - if page.iplr.IsEmpty() { - return nil - } - return *page.iplr.Value -} - -// Creates a new instance of the ImportPipelineListResultPage type. -func NewImportPipelineListResultPage(cur ImportPipelineListResult, getNextPage func(context.Context, ImportPipelineListResult) (ImportPipelineListResult, error)) ImportPipelineListResultPage { - return ImportPipelineListResultPage{ - fn: getNextPage, - iplr: cur, - } -} - -// ImportPipelineProperties the properties of an import pipeline. -type ImportPipelineProperties struct { - // Source - The source properties of the import pipeline. - Source *ImportPipelineSourceProperties `json:"source,omitempty"` - // Trigger - The properties that describe the trigger of the import pipeline. - Trigger *PipelineTriggerProperties `json:"trigger,omitempty"` - // Options - The list of all options configured for the pipeline. - Options *[]PipelineOptions `json:"options,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the pipeline at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImportPipelineProperties. -func (ipp ImportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipp.Source != nil { - objectMap["source"] = ipp.Source - } - if ipp.Trigger != nil { - objectMap["trigger"] = ipp.Trigger - } - if ipp.Options != nil { - objectMap["options"] = ipp.Options - } - return json.Marshal(objectMap) -} - -// ImportPipelinesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ImportPipelinesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ImportPipelinesClient) (ImportPipeline, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ImportPipelinesCreateFuture) 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 ImportPipelinesCreateFuture.Result. -func (future *ImportPipelinesCreateFuture) result(client ImportPipelinesClient) (IP ImportPipeline, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - IP.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ImportPipelinesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { - IP, err = client.CreateResponder(IP.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesCreateFuture", "Result", IP.Response.Response, "Failure responding to request") - } - } - return -} - -// ImportPipelinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ImportPipelinesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ImportPipelinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ImportPipelinesDeleteFuture) 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 ImportPipelinesDeleteFuture.Result. -func (future *ImportPipelinesDeleteFuture) result(client ImportPipelinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ImportPipelinesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ImportPipelineSourceProperties the properties of the import pipeline source. -type ImportPipelineSourceProperties struct { - // Type - The type of source for the import pipeline. Possible values include: 'PipelineSourceTypeAzureStorageBlobContainer' - Type PipelineSourceType `json:"type,omitempty"` - // URI - The source uri of the import pipeline. - // When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName" - URI *string `json:"uri,omitempty"` - // KeyVaultURI - They key vault secret uri to obtain the source storage SAS token. - KeyVaultURI *string `json:"keyVaultUri,omitempty"` -} - -// ImportSource ... -type ImportSource struct { - // ResourceID - The resource identifier of the source Azure Container Registry. - ResourceID *string `json:"resourceId,omitempty"` - // RegistryURI - The address of the source registry (e.g. 'mcr.microsoft.com'). - RegistryURI *string `json:"registryUri,omitempty"` - // Credentials - Credentials used when importing from a registry uri. - Credentials *ImportSourceCredentials `json:"credentials,omitempty"` - // SourceImage - Repository name of the source image. - // Specify an image by repository ('hello-world'). This will use the 'latest' tag. - // Specify an image by tag ('hello-world:latest'). - // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - SourceImage *string `json:"sourceImage,omitempty"` -} - -// ImportSourceCredentials ... -type ImportSourceCredentials struct { - // Username - The username to authenticate with the source registry. - Username *string `json:"username,omitempty"` - // Password - The password used to authenticate with the source registry. - Password *string `json:"password,omitempty"` -} - -// InnerErrorDescription inner error. -type InnerErrorDescription struct { - // Code - error code. - Code *string `json:"code,omitempty"` - // Message - error message. - Message *string `json:"message,omitempty"` - // Target - target of the particular error. - Target *string `json:"target,omitempty"` -} - -// IPRule IP rule with specific IP or IP range in CIDR format. -type IPRule struct { - // Action - The action of IP ACL rule. Possible values include: 'ActionAllow' - Action Action `json:"action,omitempty"` - // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - IPAddressOrRange *string `json:"value,omitempty"` -} - -// KeyVaultProperties ... -type KeyVaultProperties struct { - // KeyIdentifier - Key vault uri to access the encryption key. - KeyIdentifier *string `json:"keyIdentifier,omitempty"` - // VersionedKeyIdentifier - READ-ONLY; The fully qualified key identifier that includes the version of the key that is actually used for encryption. - VersionedKeyIdentifier *string `json:"versionedKeyIdentifier,omitempty"` - // Identity - The client id of the identity which will be used to access key vault. - Identity *string `json:"identity,omitempty"` - // KeyRotationEnabled - READ-ONLY; Auto key rotation status for a CMK enabled registry. - KeyRotationEnabled *bool `json:"keyRotationEnabled,omitempty"` - // LastKeyRotationTimestamp - READ-ONLY; Timestamp of the last successful key rotation. - LastKeyRotationTimestamp *date.Time `json:"lastKeyRotationTimestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for KeyVaultProperties. -func (kvp KeyVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kvp.KeyIdentifier != nil { - objectMap["keyIdentifier"] = kvp.KeyIdentifier - } - if kvp.Identity != nil { - objectMap["identity"] = kvp.Identity - } - return json.Marshal(objectMap) -} - -// LoggingProperties the logging properties of the connected registry. -type LoggingProperties struct { - // LogLevel - The verbosity of logs persisted on the connected registry. Possible values include: 'LogLevelDebug', 'LogLevelInformation', 'LogLevelWarning', 'LogLevelError', 'LogLevelNone' - LogLevel LogLevel `json:"logLevel,omitempty"` - // AuditLogStatus - Indicates whether audit logs are enabled on the connected registry. Possible values include: 'AuditLogStatusEnabled', 'AuditLogStatusDisabled' - AuditLogStatus AuditLogStatus `json:"auditLogStatus,omitempty"` -} - -// LoginServerProperties the login server properties of the connected registry. -type LoginServerProperties struct { - // Host - READ-ONLY; The host of the connected registry. Can be FQDN or IP. - Host *string `json:"host,omitempty"` - // TLS - READ-ONLY; The TLS properties of the connected registry login server. - TLS *TLSProperties `json:"tls,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoginServerProperties. -func (lsp LoginServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NetworkRuleSet the network rule set for a container registry. -type NetworkRuleSet struct { - // DefaultAction - The default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' - DefaultAction DefaultAction `json:"defaultAction,omitempty"` - // VirtualNetworkRules - The virtual network rules. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // IPRules - The IP ACL rules. - IPRules *[]IPRule `json:"ipRules,omitempty"` -} - -// OperationDefinition the definition of a container registry operation. -type OperationDefinition struct { - // Origin - The origin information of the container registry operation. - Origin *string `json:"origin,omitempty"` - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The display information for the container registry operation. - Display *OperationDisplayDefinition `json:"display,omitempty"` - // OperationPropertiesDefinition - The properties information for the container registry operation. - *OperationPropertiesDefinition `json:"properties,omitempty"` - // IsDataAction - This property indicates if the operation is an action or a data action - // ref: https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations - IsDataAction *bool `json:"isDataAction,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDefinition. -func (od OperationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if od.Origin != nil { - objectMap["origin"] = od.Origin - } - if od.Name != nil { - objectMap["name"] = od.Name - } - if od.Display != nil { - objectMap["display"] = od.Display - } - if od.OperationPropertiesDefinition != nil { - objectMap["properties"] = od.OperationPropertiesDefinition - } - if od.IsDataAction != nil { - objectMap["isDataAction"] = od.IsDataAction - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationDefinition struct. -func (od *OperationDefinition) 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 "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - od.Origin = &origin - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - od.Name = &name - } - case "display": - if v != nil { - var display OperationDisplayDefinition - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - od.Display = &display - } - case "properties": - if v != nil { - var operationPropertiesDefinition OperationPropertiesDefinition - err = json.Unmarshal(*v, &operationPropertiesDefinition) - if err != nil { - return err - } - od.OperationPropertiesDefinition = &operationPropertiesDefinition - } - case "isDataAction": - if v != nil { - var isDataAction bool - err = json.Unmarshal(*v, &isDataAction) - if err != nil { - return err - } - od.IsDataAction = &isDataAction - } - } - } - - return nil -} - -// OperationDisplayDefinition the display information for a container registry operation. -type OperationDisplayDefinition struct { - // Provider - The resource provider name: Microsoft.ContainerRegistry. - Provider *string `json:"provider,omitempty"` - // Resource - The resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - The operation that users can perform. - Operation *string `json:"operation,omitempty"` - // Description - The description for the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult the result of a request to list container registry operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - Value *[]OperationDefinition `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registry operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of OperationDefinition 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() OperationDefinition { - if !iter.page.NotDone() { - return OperationDefinition{} - } - 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 OperationDefinition 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() []OperationDefinition { - 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, - } -} - -// OperationLogSpecificationDefinition the definition of Azure Monitoring log. -type OperationLogSpecificationDefinition struct { - // Name - Log name. - Name *string `json:"name,omitempty"` - // DisplayName - Log display name. - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Log blob duration. - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// OperationMetricSpecificationDefinition the definition of Azure Monitoring metric. -type OperationMetricSpecificationDefinition struct { - // Name - Metric name. - Name *string `json:"name,omitempty"` - // DisplayName - Metric display name. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Metric description. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Metric unit. - Unit *string `json:"unit,omitempty"` - // AggregationType - Metric aggregation type. - AggregationType *string `json:"aggregationType,omitempty"` - // InternalMetricName - Internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` -} - -// OperationPropertiesDefinition the definition of Azure Monitoring properties. -type OperationPropertiesDefinition struct { - // ServiceSpecification - The definition of Azure Monitoring service. - ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` -} - -// OperationServiceSpecificationDefinition the definition of Azure Monitoring list. -type OperationServiceSpecificationDefinition struct { - // MetricSpecifications - A list of Azure Monitoring metrics definition. - MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` - // LogSpecifications - A list of Azure Monitoring log definitions. - LogSpecifications *[]OperationLogSpecificationDefinition `json:"logSpecifications,omitempty"` -} - -// OverrideTaskStepProperties ... -type OverrideTaskStepProperties struct { - // ContextPath - The source context against which run has to be queued. - ContextPath *string `json:"contextPath,omitempty"` - // File - The file against which run has to be queued. - File *string `json:"file,omitempty"` - // Arguments - Gets or sets the collection of override arguments to be used when - // executing a build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Values - The collection of overridable values that can be passed when running a Task. - Values *[]SetValue `json:"values,omitempty"` - // UpdateTriggerToken - Base64 encoded update trigger token that will be attached with the base image trigger webhook. - UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` -} - -// ParentProperties the properties of the connected registry parent. -type ParentProperties struct { - // ID - The resource ID of the parent to which the connected registry will be associated. - ID *string `json:"id,omitempty"` - // SyncProperties - The sync properties of the connected registry with its parent. - SyncProperties *SyncProperties `json:"syncProperties,omitempty"` -} - -// PipelineRun an object that represents a pipeline run for a container registry. -type PipelineRun struct { - autorest.Response `json:"-"` - // PipelineRunProperties - The properties of a pipeline run. - *PipelineRunProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for PipelineRun. -func (pr PipelineRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.PipelineRunProperties != nil { - objectMap["properties"] = pr.PipelineRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PipelineRun struct. -func (pr *PipelineRun) 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 pipelineRunProperties PipelineRunProperties - err = json.Unmarshal(*v, &pipelineRunProperties) - if err != nil { - return err - } - pr.PipelineRunProperties = &pipelineRunProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pr.SystemData = &systemData - } - } - } - - return nil -} - -// PipelineRunListResult the result of a request to list pipeline runs for a container registry. -type PipelineRunListResult struct { - autorest.Response `json:"-"` - // Value - The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list of pipeline runs. - Value *[]PipelineRun `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of pipeline runs. - NextLink *string `json:"nextLink,omitempty"` -} - -// PipelineRunListResultIterator provides access to a complete listing of PipelineRun values. -type PipelineRunListResultIterator struct { - i int - page PipelineRunListResultPage -} - -// 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 *PipelineRunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunListResultIterator.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 *PipelineRunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PipelineRunListResultIterator) 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 PipelineRunListResultIterator) Response() PipelineRunListResult { - 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 PipelineRunListResultIterator) Value() PipelineRun { - if !iter.page.NotDone() { - return PipelineRun{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PipelineRunListResultIterator type. -func NewPipelineRunListResultIterator(page PipelineRunListResultPage) PipelineRunListResultIterator { - return PipelineRunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (prlr PipelineRunListResult) IsEmpty() bool { - return prlr.Value == nil || len(*prlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (prlr PipelineRunListResult) hasNextLink() bool { - return prlr.NextLink != nil && len(*prlr.NextLink) != 0 -} - -// pipelineRunListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (prlr PipelineRunListResult) pipelineRunListResultPreparer(ctx context.Context) (*http.Request, error) { - if !prlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(prlr.NextLink))) -} - -// PipelineRunListResultPage contains a page of PipelineRun values. -type PipelineRunListResultPage struct { - fn func(context.Context, PipelineRunListResult) (PipelineRunListResult, error) - prlr PipelineRunListResult -} - -// 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 *PipelineRunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunListResultPage.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.prlr) - if err != nil { - return err - } - page.prlr = 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 *PipelineRunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PipelineRunListResultPage) NotDone() bool { - return !page.prlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PipelineRunListResultPage) Response() PipelineRunListResult { - return page.prlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PipelineRunListResultPage) Values() []PipelineRun { - if page.prlr.IsEmpty() { - return nil - } - return *page.prlr.Value -} - -// Creates a new instance of the PipelineRunListResultPage type. -func NewPipelineRunListResultPage(cur PipelineRunListResult, getNextPage func(context.Context, PipelineRunListResult) (PipelineRunListResult, error)) PipelineRunListResultPage { - return PipelineRunListResultPage{ - fn: getNextPage, - prlr: cur, - } -} - -// PipelineRunProperties the properties of a pipeline run. -type PipelineRunProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of a pipeline run. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Request - The request parameters for a pipeline run. - Request *PipelineRunRequest `json:"request,omitempty"` - // Response - READ-ONLY; The response of a pipeline run. - Response *PipelineRunResponse `json:"response,omitempty"` - // ForceUpdateTag - How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PipelineRunProperties. -func (prp PipelineRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prp.Request != nil { - objectMap["request"] = prp.Request - } - if prp.ForceUpdateTag != nil { - objectMap["forceUpdateTag"] = prp.ForceUpdateTag - } - return json.Marshal(objectMap) -} - -// PipelineRunRequest the request properties provided for a pipeline run. -type PipelineRunRequest struct { - // PipelineResourceID - The resource ID of the pipeline to run. - PipelineResourceID *string `json:"pipelineResourceId,omitempty"` - // Artifacts - List of source artifacts to be transferred by the pipeline. - // Specify an image by repository ('hello-world'). This will use the 'latest' tag. - // Specify an image by tag ('hello-world:latest'). - // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - Artifacts *[]string `json:"artifacts,omitempty"` - // Source - The source properties of the pipeline run. - Source *PipelineRunSourceProperties `json:"source,omitempty"` - // Target - The target properties of the pipeline run. - Target *PipelineRunTargetProperties `json:"target,omitempty"` - // CatalogDigest - The digest of the tar used to transfer the artifacts. - CatalogDigest *string `json:"catalogDigest,omitempty"` -} - -// PipelineRunResponse the response properties returned for a pipeline run. -type PipelineRunResponse struct { - // Status - The current status of the pipeline run. - Status *string `json:"status,omitempty"` - // ImportedArtifacts - The artifacts imported in the pipeline run. - ImportedArtifacts *[]string `json:"importedArtifacts,omitempty"` - // Progress - The current progress of the copy operation. - Progress *ProgressProperties `json:"progress,omitempty"` - // StartTime - The time the pipeline run started. - StartTime *date.Time `json:"startTime,omitempty"` - // FinishTime - The time the pipeline run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // Source - The source of the pipeline run. - Source *ImportPipelineSourceProperties `json:"source,omitempty"` - // Target - The target of the pipeline run. - Target *ExportPipelineTargetProperties `json:"target,omitempty"` - // CatalogDigest - The digest of the tar used to transfer the artifacts. - CatalogDigest *string `json:"catalogDigest,omitempty"` - // Trigger - The trigger that caused the pipeline run. - Trigger *PipelineTriggerDescriptor `json:"trigger,omitempty"` - // PipelineRunErrorMessage - The detailed error message for the pipeline run in the case of failure. - PipelineRunErrorMessage *string `json:"pipelineRunErrorMessage,omitempty"` -} - -// PipelineRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PipelineRunsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PipelineRunsClient) (PipelineRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PipelineRunsCreateFuture) 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 PipelineRunsCreateFuture.Result. -func (future *PipelineRunsCreateFuture) result(client PipelineRunsClient) (pr PipelineRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PipelineRunsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pr.Response.Response, err = future.GetResult(sender); err == nil && pr.Response.Response.StatusCode != http.StatusNoContent { - pr, err = client.CreateResponder(pr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsCreateFuture", "Result", pr.Response.Response, "Failure responding to request") - } - } - return -} - -// PipelineRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PipelineRunsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PipelineRunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PipelineRunsDeleteFuture) 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 PipelineRunsDeleteFuture.Result. -func (future *PipelineRunsDeleteFuture) result(client PipelineRunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PipelineRunsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PipelineRunSourceProperties ... -type PipelineRunSourceProperties struct { - // Type - The type of the source. Possible values include: 'PipelineRunSourceTypeAzureStorageBlob' - Type PipelineRunSourceType `json:"type,omitempty"` - // Name - The name of the source. - Name *string `json:"name,omitempty"` -} - -// PipelineRunTargetProperties ... -type PipelineRunTargetProperties struct { - // Type - The type of the target. Possible values include: 'PipelineRunTargetTypeAzureStorageBlob' - Type PipelineRunTargetType `json:"type,omitempty"` - // Name - The name of the target. - Name *string `json:"name,omitempty"` -} - -// PipelineSourceTriggerDescriptor ... -type PipelineSourceTriggerDescriptor struct { - // Timestamp - The timestamp when the source update happened. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// PipelineSourceTriggerProperties ... -type PipelineSourceTriggerProperties struct { - // Status - The current status of the source trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` -} - -// PipelineTriggerDescriptor ... -type PipelineTriggerDescriptor struct { - // SourceTrigger - The source trigger that caused the pipeline run. - SourceTrigger *PipelineSourceTriggerDescriptor `json:"sourceTrigger,omitempty"` -} - -// PipelineTriggerProperties ... -type PipelineTriggerProperties struct { - // SourceTrigger - The source trigger properties of the pipeline. - SourceTrigger *PipelineSourceTriggerProperties `json:"sourceTrigger,omitempty"` -} - -// PlatformProperties the platform properties against which the run has to happen. -type PlatformProperties struct { - // Os - The operating system type required for the run. Possible values include: 'OSWindows', 'OSLinux' - Os OS `json:"os,omitempty"` - // Architecture - The OS architecture. Possible values include: 'ArchitectureAmd64', 'ArchitectureX86', 'ArchitectureThreeEightSix', 'ArchitectureArm', 'ArchitectureArm64' - Architecture Architecture `json:"architecture,omitempty"` - // Variant - Variant of the CPU. Possible values include: 'VariantV6', 'VariantV7', 'VariantV8' - Variant Variant `json:"variant,omitempty"` -} - -// PlatformUpdateParameters the properties for updating the platform configuration. -type PlatformUpdateParameters struct { - // Os - The operating system type required for the run. Possible values include: 'OSWindows', 'OSLinux' - Os OS `json:"os,omitempty"` - // Architecture - The OS architecture. Possible values include: 'ArchitectureAmd64', 'ArchitectureX86', 'ArchitectureThreeEightSix', 'ArchitectureArm', 'ArchitectureArm64' - Architecture Architecture `json:"architecture,omitempty"` - // Variant - Variant of the CPU. Possible values include: 'VariantV6', 'VariantV7', 'VariantV8' - Variant Variant `json:"variant,omitempty"` -} - -// Policies the policies for a container registry. -type Policies struct { - // QuarantinePolicy - The quarantine policy for a container registry. - QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"` - // TrustPolicy - The content trust policy for a container registry. - TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"` - // RetentionPolicy - The retention policy for a container registry. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` - // ExportPolicy - The export policy for a container registry. - ExportPolicy *ExportPolicy `json:"exportPolicy,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - This is private endpoint resource created with Microsoft.Network resource provider. - ID *string `json:"id,omitempty"` -} - -// PrivateEndpointConnection an object that represents a private endpoint connection for a container -// registry. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,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 "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pec.SystemData = &systemData - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult the result of a request to list private endpoint connections for a -// container registry. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of private endpoint connections. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) - if err != nil { - return err - } - page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties the properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private endpoint. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of private endpoint connection resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,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) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource a resource that supports private link capabilities. -type PrivateLinkResource struct { - // Type - READ-ONLY; The resource type is private link resource. - Type *string `json:"type,omitempty"` - // ID - The resource ID. - ID *string `json:"id,omitempty"` - // Name - The name of the resource. - Name *string `json:"name,omitempty"` - // PrivateLinkResourceProperties - A resource that supports private link capabilities. - *PrivateLinkResourceProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.ID != nil { - objectMap["id"] = plr.ID - } - if plr.Name != nil { - objectMap["name"] = plr.Name - } - 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 "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - 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 "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - } - } - - return nil -} - -// PrivateLinkResourceListResult the result of a request to list private link resources for a container -// registry. -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of private link resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties the properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// PrivateLinkServiceConnectionState the state of a private link service connection. -type PrivateLinkServiceConnectionState struct { - // Status - The private link service connection status. Possible values include: 'ConnectionStatusApproved', 'ConnectionStatusPending', 'ConnectionStatusRejected', 'ConnectionStatusDisconnected' - Status ConnectionStatus `json:"status,omitempty"` - // Description - The description for connection status. For example if connection is rejected it can indicate reason for rejection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. Possible values include: 'ActionsRequiredNone', 'ActionsRequiredRecreate' - ActionsRequired ActionsRequired `json:"actionsRequired,omitempty"` -} - -// ProgressProperties ... -type ProgressProperties struct { - // Percentage - The percentage complete of the copy operation. - Percentage *string `json:"percentage,omitempty"` -} - -// 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; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - 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) -} - -// QuarantinePolicy the quarantine policy for a container registry. -type QuarantinePolicy struct { - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// RegenerateCredentialParameters the parameters used to regenerate the login credential. -type RegenerateCredentialParameters struct { - // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'PasswordNamePassword', 'PasswordNamePassword2' - Name PasswordName `json:"name,omitempty"` -} - -// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesCreateFuture) 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 RegistriesCreateFuture.Result. -func (future *RegistriesCreateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture") - 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, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesDeleteFuture) 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 RegistriesDeleteFuture.Result. -func (future *RegistriesDeleteFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesGenerateCredentialsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RegistriesGenerateCredentialsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (GenerateCredentialsResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesGenerateCredentialsFuture) 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 RegistriesGenerateCredentialsFuture.Result. -func (future *RegistriesGenerateCredentialsFuture) result(client RegistriesClient) (gcr GenerateCredentialsResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gcr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesGenerateCredentialsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gcr.Response.Response, err = future.GetResult(sender); err == nil && gcr.Response.Response.StatusCode != http.StatusNoContent { - gcr, err = client.GenerateCredentialsResponder(gcr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", gcr.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesImportImageFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesImportImageFuture) 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 RegistriesImportImageFuture.Result. -func (future *RegistriesImportImageFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesImportImageFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesScheduleRunFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesScheduleRunFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Run, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesScheduleRunFuture) 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 RegistriesScheduleRunFuture.Result. -func (future *RegistriesScheduleRunFuture) result(client RegistriesClient) (r Run, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesScheduleRunFuture") - 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.ScheduleRunResponder(r.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesUpdateFuture) 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 RegistriesUpdateFuture.Result. -func (future *RegistriesUpdateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture") - 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, "containerregistry.RegistriesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// Registry an object that represents a container registry. -type Registry struct { - autorest.Response `json:"-"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // Identity - The identity of the container registry. - Identity *IdentityProperties `json:"identity,omitempty"` - // RegistryProperties - The properties of the container registry. - *RegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Registry. -func (r Registry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - if r.Identity != nil { - objectMap["identity"] = r.Identity - } - if r.RegistryProperties != nil { - objectMap["properties"] = r.RegistryProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Registry struct. -func (r *Registry) 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 - } - r.Sku = &sku - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - r.Identity = &identity - } - case "properties": - if v != nil { - var registryProperties RegistryProperties - err = json.Unmarshal(*v, ®istryProperties) - if err != nil { - return err - } - r.RegistryProperties = ®istryProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - r.SystemData = &systemData - } - } - } - - return nil -} - -// RegistryListCredentialsResult the response from the ListCredentials operation. -type RegistryListCredentialsResult struct { - autorest.Response `json:"-"` - // Username - The username for a container registry. - Username *string `json:"username,omitempty"` - // Passwords - The list of passwords for a container registry. - Passwords *[]RegistryPassword `json:"passwords,omitempty"` -} - -// RegistryListResult the result of a request to list container registries. -type RegistryListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - Value *[]Registry `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registries. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegistryListResultIterator provides access to a complete listing of Registry values. -type RegistryListResultIterator struct { - i int - page RegistryListResultPage -} - -// 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 *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.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 *RegistryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegistryListResultIterator) 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 RegistryListResultIterator) Response() RegistryListResult { - 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 RegistryListResultIterator) Value() Registry { - if !iter.page.NotDone() { - return Registry{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegistryListResultIterator type. -func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { - return RegistryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegistryListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegistryListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// registryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegistryListResult) registryListResultPreparer(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))) -} - -// RegistryListResultPage contains a page of Registry values. -type RegistryListResultPage struct { - fn func(context.Context, RegistryListResult) (RegistryListResult, error) - rlr RegistryListResult -} - -// 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 *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.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 *RegistryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegistryListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegistryListResultPage) Response() RegistryListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegistryListResultPage) Values() []Registry { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegistryListResultPage type. -func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { - return RegistryListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistryNameCheckRequest a request to check whether a container registry name is available. -type RegistryNameCheckRequest struct { - // Name - The name of the container registry. - Name *string `json:"name,omitempty"` - // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. - Type *string `json:"type,omitempty"` -} - -// RegistryNameStatus the result of a request to check the availability of a container registry name. -type RegistryNameStatus struct { - autorest.Response `json:"-"` - // NameAvailable - The value that indicates whether the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - If any, the reason that the name is not available. - Reason *string `json:"reason,omitempty"` - // Message - If any, the error message that provides more detail for the reason that the name is not available. - Message *string `json:"message,omitempty"` -} - -// RegistryPassword the login password for the container registry. -type RegistryPassword struct { - // Name - The password name. Possible values include: 'PasswordNamePassword', 'PasswordNamePassword2' - Name PasswordName `json:"name,omitempty"` - // Value - The password value. - Value *string `json:"value,omitempty"` -} - -// RegistryProperties the properties of a container registry. -type RegistryProperties struct { - // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. - LoginServer *string `json:"loginServer,omitempty"` - // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the container registry at the time the operation was called. - Status *Status `json:"status,omitempty"` - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` - // Policies - The policies for a container registry. - Policies *Policies `json:"policies,omitempty"` - // Encryption - The encryption settings of container registry. - Encryption *EncryptionProperty `json:"encryption,omitempty"` - // DataEndpointEnabled - Enable a single data endpoint per region for serving data. - DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` - // DataEndpointHostNames - READ-ONLY; List of host names that will serve data when dataEndpointEnabled is true. - DataEndpointHostNames *[]string `json:"dataEndpointHostNames,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections for a container registry. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' - NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` - // ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry. Possible values include: 'ZoneRedundancyEnabled', 'ZoneRedundancyDisabled' - ZoneRedundancy ZoneRedundancy `json:"zoneRedundancy,omitempty"` - // AnonymousPullEnabled - Enables registry-wide pull from unauthenticated clients. - AnonymousPullEnabled *bool `json:"anonymousPullEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryProperties. -func (rp RegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.AdminUserEnabled != nil { - objectMap["adminUserEnabled"] = rp.AdminUserEnabled - } - if rp.NetworkRuleSet != nil { - objectMap["networkRuleSet"] = rp.NetworkRuleSet - } - if rp.Policies != nil { - objectMap["policies"] = rp.Policies - } - if rp.Encryption != nil { - objectMap["encryption"] = rp.Encryption - } - if rp.DataEndpointEnabled != nil { - objectMap["dataEndpointEnabled"] = rp.DataEndpointEnabled - } - if rp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = rp.PublicNetworkAccess - } - if rp.NetworkRuleBypassOptions != "" { - objectMap["networkRuleBypassOptions"] = rp.NetworkRuleBypassOptions - } - if rp.ZoneRedundancy != "" { - objectMap["zoneRedundancy"] = rp.ZoneRedundancy - } - if rp.AnonymousPullEnabled != nil { - objectMap["anonymousPullEnabled"] = rp.AnonymousPullEnabled - } - return json.Marshal(objectMap) -} - -// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. -type RegistryPropertiesUpdateParameters struct { - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` - // Policies - The policies for a container registry. - Policies *Policies `json:"policies,omitempty"` - // Encryption - The encryption settings of container registry. - Encryption *EncryptionProperty `json:"encryption,omitempty"` - // DataEndpointEnabled - Enable a single data endpoint per region for serving data. - DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' - NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` - // AnonymousPullEnabled - Enables registry-wide pull from unauthenticated clients. - AnonymousPullEnabled *bool `json:"anonymousPullEnabled,omitempty"` -} - -// RegistryUpdateParameters the parameters for updating a container registry. -type RegistryUpdateParameters struct { - // Identity - The identity of the container registry. - Identity *IdentityProperties `json:"identity,omitempty"` - // Tags - The tags for the container registry. - Tags map[string]*string `json:"tags"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. - *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryUpdateParameters. -func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Identity != nil { - objectMap["identity"] = rup.Identity - } - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.Sku != nil { - objectMap["sku"] = rup.Sku - } - if rup.RegistryPropertiesUpdateParameters != nil { - objectMap["properties"] = rup.RegistryPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. -func (rup *RegistryUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rup.Identity = &identity - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rup.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - rup.Sku = &sku - } - case "properties": - if v != nil { - var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters - err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) - if err != nil { - return err - } - rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters - } - } - } - - return nil -} - -// RegistryUsage the quota usage for a container registry. -type RegistryUsage struct { - // Name - The name of the usage. - Name *string `json:"name,omitempty"` - // Limit - The limit of the usage. - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - The current value of the usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - // Unit - The unit of measurement. Possible values include: 'RegistryUsageUnitCount', 'RegistryUsageUnitBytes' - Unit RegistryUsageUnit `json:"unit,omitempty"` -} - -// RegistryUsageListResult the result of a request to get container registry quota usages. -type RegistryUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry quota usages. - Value *[]RegistryUsage `json:"value,omitempty"` -} - -// Replication an object that represents a replication for a container registry. -type Replication struct { - autorest.Response `json:"-"` - // ReplicationProperties - The properties of the replication. - *ReplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Replication. -func (r Replication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.ReplicationProperties != nil { - objectMap["properties"] = r.ReplicationProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Replication struct. -func (r *Replication) 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 replicationProperties ReplicationProperties - err = json.Unmarshal(*v, &replicationProperties) - if err != nil { - return err - } - r.ReplicationProperties = &replicationProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - r.SystemData = &systemData - } - } - } - - return nil -} - -// ReplicationListResult the result of a request to list replications for a container registry. -type ReplicationListResult struct { - autorest.Response `json:"-"` - // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - Value *[]Replication `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of replications. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReplicationListResultIterator provides access to a complete listing of Replication values. -type ReplicationListResultIterator struct { - i int - page ReplicationListResultPage -} - -// 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 *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.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 *ReplicationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReplicationListResultIterator) 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 ReplicationListResultIterator) Response() ReplicationListResult { - 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 ReplicationListResultIterator) Value() Replication { - if !iter.page.NotDone() { - return Replication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReplicationListResultIterator type. -func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { - return ReplicationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr ReplicationListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr ReplicationListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// replicationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr ReplicationListResult) replicationListResultPreparer(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))) -} - -// ReplicationListResultPage contains a page of Replication values. -type ReplicationListResultPage struct { - fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) - rlr ReplicationListResult -} - -// 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 *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.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 *ReplicationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReplicationListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReplicationListResultPage) Response() ReplicationListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReplicationListResultPage) Values() []Replication { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the ReplicationListResultPage type. -func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { - return ReplicationListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// ReplicationProperties the properties of a replication. -type ReplicationProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the replication at the time the operation was called. - Status *Status `json:"status,omitempty"` - // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` - // ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry replication. Possible values include: 'ZoneRedundancyEnabled', 'ZoneRedundancyDisabled' - ZoneRedundancy ZoneRedundancy `json:"zoneRedundancy,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationProperties. -func (rp ReplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RegionEndpointEnabled != nil { - objectMap["regionEndpointEnabled"] = rp.RegionEndpointEnabled - } - if rp.ZoneRedundancy != "" { - objectMap["zoneRedundancy"] = rp.ZoneRedundancy - } - return json.Marshal(objectMap) -} - -// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsCreateFuture) 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 ReplicationsCreateFuture.Result. -func (future *ReplicationsCreateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture") - 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, "containerregistry.ReplicationsCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsDeleteFuture) 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 ReplicationsDeleteFuture.Result. -func (future *ReplicationsDeleteFuture) result(client ReplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsUpdateFuture) 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 ReplicationsUpdateFuture.Result. -func (future *ReplicationsUpdateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture") - 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, "containerregistry.ReplicationsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationUpdateParameters the parameters for updating a replication. -type ReplicationUpdateParameters struct { - // Tags - The tags for the replication. - Tags map[string]*string `json:"tags"` - // ReplicationUpdateParametersProperties - The parameters for updating a replication's properties - *ReplicationUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. -func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.ReplicationUpdateParametersProperties != nil { - objectMap["properties"] = rup.ReplicationUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ReplicationUpdateParameters struct. -func (rup *ReplicationUpdateParameters) 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 - } - rup.Tags = tags - } - case "properties": - if v != nil { - var replicationUpdateParametersProperties ReplicationUpdateParametersProperties - err = json.Unmarshal(*v, &replicationUpdateParametersProperties) - if err != nil { - return err - } - rup.ReplicationUpdateParametersProperties = &replicationUpdateParametersProperties - } - } - } - - return nil -} - -// ReplicationUpdateParametersProperties ... -type ReplicationUpdateParametersProperties struct { - // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` -} - -// Request the request that generated the event. -type Request struct { - // ID - The ID of the request that initiated the event. - ID *string `json:"id,omitempty"` - // Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - Addr *string `json:"addr,omitempty"` - // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - Host *string `json:"host,omitempty"` - // Method - The request method that generated the event. - Method *string `json:"method,omitempty"` - // Useragent - The user agent header of the request. - Useragent *string `json:"useragent,omitempty"` -} - -// Resource an Azure resource. -type Resource struct { - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// RetentionPolicy the retention policy for a container registry. -type RetentionPolicy struct { - // Days - The number of days to retain an untagged manifest after which it gets purged. - Days *int32 `json:"days,omitempty"` - // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for RetentionPolicy. -func (rp RetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.Days != nil { - objectMap["days"] = rp.Days - } - if rp.Status != "" { - objectMap["status"] = rp.Status - } - return json.Marshal(objectMap) -} - -// Run run resource properties -type Run struct { - autorest.Response `json:"-"` - // RunProperties - The properties of a run. - *RunProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Run. -func (r Run) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RunProperties != nil { - objectMap["properties"] = r.RunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Run struct. -func (r *Run) 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 runProperties RunProperties - err = json.Unmarshal(*v, &runProperties) - if err != nil { - return err - } - r.RunProperties = &runProperties - } - 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 -} - -// RunFilter properties that are enabled for Odata querying on runs. -type RunFilter struct { - // RunID - The unique identifier for the run. - RunID *string `json:"runId,omitempty"` - // RunType - The type of run. Possible values include: 'RunTypeQuickBuild', 'RunTypeQuickRun', 'RunTypeAutoBuild', 'RunTypeAutoRun' - RunType RunType `json:"runType,omitempty"` - // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' - Status RunStatus `json:"status,omitempty"` - // CreateTime - The create time for a run. - CreateTime *date.Time `json:"createTime,omitempty"` - // FinishTime - The time the run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImageManifests - The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of - // build type. - OutputImageManifests *string `json:"outputImageManifests,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // TaskName - The name of the task that the run corresponds to. - TaskName *string `json:"taskName,omitempty"` - // AgentPoolName - The name of the agent pool that the run corresponds to. - AgentPoolName *string `json:"agentPoolName,omitempty"` -} - -// RunGetLogResult the result of get log link operation. -type RunGetLogResult struct { - autorest.Response `json:"-"` - // LogLink - The link to logs for a run on a azure container registry. - LogLink *string `json:"logLink,omitempty"` - // LogArtifactLink - The link to logs in registry for a run on a azure container registry. - LogArtifactLink *string `json:"logArtifactLink,omitempty"` -} - -// RunListResult collection of runs. -type RunListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Run `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RunListResultIterator provides access to a complete listing of Run values. -type RunListResultIterator struct { - i int - page RunListResultPage -} - -// 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 *RunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultIterator.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 *RunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RunListResultIterator) 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 RunListResultIterator) Response() RunListResult { - 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 RunListResultIterator) Value() Run { - if !iter.page.NotDone() { - return Run{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RunListResultIterator type. -func NewRunListResultIterator(page RunListResultPage) RunListResultIterator { - return RunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RunListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RunListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// runListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RunListResult) runListResultPreparer(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))) -} - -// RunListResultPage contains a page of Run values. -type RunListResultPage struct { - fn func(context.Context, RunListResult) (RunListResult, error) - rlr RunListResult -} - -// 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 *RunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultPage.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 *RunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RunListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RunListResultPage) Response() RunListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RunListResultPage) Values() []Run { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RunListResultPage type. -func NewRunListResultPage(cur RunListResult, getNextPage func(context.Context, RunListResult) (RunListResult, error)) RunListResultPage { - return RunListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RunProperties the properties for a run. -type RunProperties struct { - // RunID - The unique identifier for the run. - RunID *string `json:"runId,omitempty"` - // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' - Status RunStatus `json:"status,omitempty"` - // LastUpdatedTime - The last updated time for the run. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // RunType - The type of run. Possible values include: 'RunTypeQuickBuild', 'RunTypeQuickRun', 'RunTypeAutoBuild', 'RunTypeAutoRun' - RunType RunType `json:"runType,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // CreateTime - The time the run was scheduled. - CreateTime *date.Time `json:"createTime,omitempty"` - // StartTime - The time the run started. - StartTime *date.Time `json:"startTime,omitempty"` - // FinishTime - The time the run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImages - The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. - OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` - // Task - The task against which run was scheduled. - Task *string `json:"task,omitempty"` - // ImageUpdateTrigger - The image update trigger that caused the run. This is applicable if the task has base image trigger configured. - ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` - // SourceTrigger - The source trigger that caused the run. - SourceTrigger *SourceTriggerDescriptor `json:"sourceTrigger,omitempty"` - // TimerTrigger - The timer trigger that caused the run. - TimerTrigger *TimerTriggerDescriptor `json:"timerTrigger,omitempty"` - // Platform - The platform properties against which the run will happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceRegistryAuth - The scope of the credentials that were used to login to the source registry during this run. - SourceRegistryAuth *string `json:"sourceRegistryAuth,omitempty"` - // CustomRegistries - The list of custom registries that were logged in during this run. - CustomRegistries *[]string `json:"customRegistries,omitempty"` - // RunErrorMessage - READ-ONLY; The error message received from backend systems after the run is scheduled. - RunErrorMessage *string `json:"runErrorMessage,omitempty"` - // UpdateTriggerToken - The update trigger token passed for the Run. - UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` - // LogArtifact - READ-ONLY; The image description for the log artifact. - LogArtifact *ImageDescriptor `json:"logArtifact,omitempty"` - // ProvisioningState - The provisioning state of a run. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunProperties. -func (rp RunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RunID != nil { - objectMap["runId"] = rp.RunID - } - if rp.Status != "" { - objectMap["status"] = rp.Status - } - if rp.LastUpdatedTime != nil { - objectMap["lastUpdatedTime"] = rp.LastUpdatedTime - } - if rp.RunType != "" { - objectMap["runType"] = rp.RunType - } - if rp.AgentPoolName != nil { - objectMap["agentPoolName"] = rp.AgentPoolName - } - if rp.CreateTime != nil { - objectMap["createTime"] = rp.CreateTime - } - if rp.StartTime != nil { - objectMap["startTime"] = rp.StartTime - } - if rp.FinishTime != nil { - objectMap["finishTime"] = rp.FinishTime - } - if rp.OutputImages != nil { - objectMap["outputImages"] = rp.OutputImages - } - if rp.Task != nil { - objectMap["task"] = rp.Task - } - if rp.ImageUpdateTrigger != nil { - objectMap["imageUpdateTrigger"] = rp.ImageUpdateTrigger - } - if rp.SourceTrigger != nil { - objectMap["sourceTrigger"] = rp.SourceTrigger - } - if rp.TimerTrigger != nil { - objectMap["timerTrigger"] = rp.TimerTrigger - } - if rp.Platform != nil { - objectMap["platform"] = rp.Platform - } - if rp.AgentConfiguration != nil { - objectMap["agentConfiguration"] = rp.AgentConfiguration - } - if rp.SourceRegistryAuth != nil { - objectMap["sourceRegistryAuth"] = rp.SourceRegistryAuth - } - if rp.CustomRegistries != nil { - objectMap["customRegistries"] = rp.CustomRegistries - } - if rp.UpdateTriggerToken != nil { - objectMap["updateTriggerToken"] = rp.UpdateTriggerToken - } - if rp.ProvisioningState != "" { - objectMap["provisioningState"] = rp.ProvisioningState - } - if rp.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = rp.IsArchiveEnabled - } - return json.Marshal(objectMap) -} - -// BasicRunRequest the request parameters for scheduling a run. -type BasicRunRequest interface { - AsDockerBuildRequest() (*DockerBuildRequest, bool) - AsFileTaskRunRequest() (*FileTaskRunRequest, bool) - AsTaskRunRequest() (*TaskRunRequest, bool) - AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) - AsRunRequest() (*RunRequest, bool) -} - -// RunRequest the request parameters for scheduling a run. -type RunRequest struct { - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicRunRequest(body []byte) (BasicRunRequest, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeDockerBuildRequest): - var dbr DockerBuildRequest - err := json.Unmarshal(body, &dbr) - return dbr, err - case string(TypeFileTaskRunRequest): - var ftrr FileTaskRunRequest - err := json.Unmarshal(body, &ftrr) - return ftrr, err - case string(TypeTaskRunRequest): - var trr TaskRunRequest - err := json.Unmarshal(body, &trr) - return trr, err - case string(TypeEncodedTaskRunRequest): - var etrr EncodedTaskRunRequest - err := json.Unmarshal(body, &etrr) - return etrr, err - default: - var rr RunRequest - err := json.Unmarshal(body, &rr) - return rr, err - } -} -func unmarshalBasicRunRequestArray(body []byte) ([]BasicRunRequest, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rrArray := make([]BasicRunRequest, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rr, err := unmarshalBasicRunRequest(*rawMessage) - if err != nil { - return nil, err - } - rrArray[index] = rr - } - return rrArray, nil -} - -// MarshalJSON is the custom marshaler for RunRequest. -func (rr RunRequest) MarshalJSON() ([]byte, error) { - rr.Type = TypeRunRequest - objectMap := make(map[string]interface{}) - if rr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = rr.IsArchiveEnabled - } - if rr.AgentPoolName != nil { - objectMap["agentPoolName"] = rr.AgentPoolName - } - if rr.LogTemplate != nil { - objectMap["logTemplate"] = rr.LogTemplate - } - if rr.Type != "" { - objectMap["type"] = rr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsRunRequest() (*RunRequest, bool) { - return &rr, true -} - -// AsBasicRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &rr, true -} - -// RunsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type RunsCancelFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunsCancelFuture) 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 RunsCancelFuture.Result. -func (future *RunsCancelFuture) result(client RunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsCancelFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RunsCancelFuture") - return - } - ar.Response = future.Response() - return -} - -// RunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type RunsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunsClient) (Run, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunsUpdateFuture) 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 RunsUpdateFuture.Result. -func (future *RunsUpdateFuture) result(client RunsClient) (r Run, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RunsUpdateFuture") - 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, "containerregistry.RunsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RunUpdateParameters the set of run properties that can be updated. -type RunUpdateParameters struct { - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` -} - -// ScopeMap an object that represents a scope map for a container registry. -type ScopeMap struct { - autorest.Response `json:"-"` - // ScopeMapProperties - The properties of the scope map. - *ScopeMapProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeMap. -func (sm ScopeMap) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sm.ScopeMapProperties != nil { - objectMap["properties"] = sm.ScopeMapProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopeMap struct. -func (sm *ScopeMap) 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 scopeMapProperties ScopeMapProperties - err = json.Unmarshal(*v, &scopeMapProperties) - if err != nil { - return err - } - sm.ScopeMapProperties = &scopeMapProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sm.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sm.SystemData = &systemData - } - } - } - - return nil -} - -// ScopeMapListResult the result of a request to list scope maps for a container registry. -type ScopeMapListResult struct { - autorest.Response `json:"-"` - // Value - The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. - Value *[]ScopeMap `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of scope maps. - NextLink *string `json:"nextLink,omitempty"` -} - -// ScopeMapListResultIterator provides access to a complete listing of ScopeMap values. -type ScopeMapListResultIterator struct { - i int - page ScopeMapListResultPage -} - -// 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 *ScopeMapListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultIterator.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 *ScopeMapListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScopeMapListResultIterator) 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 ScopeMapListResultIterator) Response() ScopeMapListResult { - 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 ScopeMapListResultIterator) Value() ScopeMap { - if !iter.page.NotDone() { - return ScopeMap{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScopeMapListResultIterator type. -func NewScopeMapListResultIterator(page ScopeMapListResultPage) ScopeMapListResultIterator { - return ScopeMapListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (smlr ScopeMapListResult) IsEmpty() bool { - return smlr.Value == nil || len(*smlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (smlr ScopeMapListResult) hasNextLink() bool { - return smlr.NextLink != nil && len(*smlr.NextLink) != 0 -} - -// scopeMapListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (smlr ScopeMapListResult) scopeMapListResultPreparer(ctx context.Context) (*http.Request, error) { - if !smlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(smlr.NextLink))) -} - -// ScopeMapListResultPage contains a page of ScopeMap values. -type ScopeMapListResultPage struct { - fn func(context.Context, ScopeMapListResult) (ScopeMapListResult, error) - smlr ScopeMapListResult -} - -// 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 *ScopeMapListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultPage.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.smlr) - if err != nil { - return err - } - page.smlr = 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 *ScopeMapListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScopeMapListResultPage) NotDone() bool { - return !page.smlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScopeMapListResultPage) Response() ScopeMapListResult { - return page.smlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScopeMapListResultPage) Values() []ScopeMap { - if page.smlr.IsEmpty() { - return nil - } - return *page.smlr.Value -} - -// Creates a new instance of the ScopeMapListResultPage type. -func NewScopeMapListResultPage(cur ScopeMapListResult, getNextPage func(context.Context, ScopeMapListResult) (ScopeMapListResult, error)) ScopeMapListResultPage { - return ScopeMapListResultPage{ - fn: getNextPage, - smlr: cur, - } -} - -// ScopeMapProperties the properties of a scope map. -type ScopeMapProperties struct { - // Description - The user friendly description of the scope map. - Description *string `json:"description,omitempty"` - // Type - READ-ONLY; The type of the scope map. E.g. BuildIn scope map. - Type *string `json:"type,omitempty"` - // CreationDate - READ-ONLY; The creation date of scope map. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Actions - The list of scoped permissions for registry artifacts. - // E.g. repositories/repository-name/content/read, - // repositories/repository-name/metadata/write - Actions *[]string `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeMapProperties. -func (smp ScopeMapProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smp.Description != nil { - objectMap["description"] = smp.Description - } - if smp.Actions != nil { - objectMap["actions"] = smp.Actions - } - return json.Marshal(objectMap) -} - -// ScopeMapPropertiesUpdateParameters the update parameters for scope map properties. -type ScopeMapPropertiesUpdateParameters struct { - // Description - The user friendly description of the scope map. - Description *string `json:"description,omitempty"` - // Actions - The list of scope permissions for registry artifacts. - // E.g. repositories/repository-name/pull, - // repositories/repository-name/delete - Actions *[]string `json:"actions,omitempty"` -} - -// ScopeMapsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScopeMapsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScopeMapsClient) (ScopeMap, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScopeMapsCreateFuture) 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 ScopeMapsCreateFuture.Result. -func (future *ScopeMapsCreateFuture) result(client ScopeMapsClient) (sm ScopeMap, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.CreateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// ScopeMapsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScopeMapsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScopeMapsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScopeMapsDeleteFuture) 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 ScopeMapsDeleteFuture.Result. -func (future *ScopeMapsDeleteFuture) result(client ScopeMapsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ScopeMapsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScopeMapsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScopeMapsClient) (ScopeMap, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScopeMapsUpdateFuture) 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 ScopeMapsUpdateFuture.Result. -func (future *ScopeMapsUpdateFuture) result(client ScopeMapsClient) (sm ScopeMap, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.UpdateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// ScopeMapUpdateParameters the properties for updating the scope map. -type ScopeMapUpdateParameters struct { - // ScopeMapPropertiesUpdateParameters - The update parameters for scope map properties. - *ScopeMapPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeMapUpdateParameters. -func (smup ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smup.ScopeMapPropertiesUpdateParameters != nil { - objectMap["properties"] = smup.ScopeMapPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopeMapUpdateParameters struct. -func (smup *ScopeMapUpdateParameters) 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 scopeMapPropertiesUpdateParameters ScopeMapPropertiesUpdateParameters - err = json.Unmarshal(*v, &scopeMapPropertiesUpdateParameters) - if err != nil { - return err - } - smup.ScopeMapPropertiesUpdateParameters = &scopeMapPropertiesUpdateParameters - } - } - } - - return nil -} - -// SecretObject describes the properties of a secret object value. -type SecretObject struct { - // Value - The value of the secret. The format of this value will be determined - // based on the type of the secret object. If the type is Opaque, the value will be - // used as is without any modification. - Value *string `json:"value,omitempty"` - // Type - The type of the secret object which determines how the value of the secret object has to be - // interpreted. Possible values include: 'SecretObjectTypeOpaque', 'SecretObjectTypeVaultsecret' - Type SecretObjectType `json:"type,omitempty"` -} - -// SetValue the properties of a overridable value that can be passed to a task template. -type SetValue struct { - // Name - The name of the overridable value. - Name *string `json:"name,omitempty"` - // Value - The overridable value. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the value represents a secret or not. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// Sku the SKU of a container registry. -type Sku struct { - // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'SkuNameClassic', 'SkuNameBasic', 'SkuNameStandard', 'SkuNamePremium' - Name SkuName `json:"name,omitempty"` - // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` -} - -// MarshalJSON is the custom marshaler for Sku. -func (s Sku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Name != "" { - objectMap["name"] = s.Name - } - return json.Marshal(objectMap) -} - -// Source the registry node that generated the event. Put differently, while the actor initiates the event, -// the source generates it. -type Source struct { - // Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - Addr *string `json:"addr,omitempty"` - // InstanceID - The running instance of an application. Changes after each restart. - InstanceID *string `json:"instanceID,omitempty"` -} - -// SourceProperties the properties of the source code repository. -type SourceProperties struct { - // SourceControlType - The type of source control service. Possible values include: 'SourceControlTypeGithub', 'SourceControlTypeVisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceRegistryCredentials describes the credential parameters for accessing the source registry. -type SourceRegistryCredentials struct { - // LoginMode - The authentication mode which determines the source registry login scope. The credentials for the source registry - // will be generated using the given scope. These credentials will be used to login to - // the source registry during the run. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' - LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` -} - -// SourceTrigger the properties of a source based trigger. -type SourceTrigger struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceTriggerDescriptor the source trigger that caused a run. -type SourceTriggerDescriptor struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // EventType - The event type of the trigger. - EventType *string `json:"eventType,omitempty"` - // CommitID - The unique ID that identifies a commit. - CommitID *string `json:"commitId,omitempty"` - // PullRequestID - The unique ID that identifies pull request. - PullRequestID *string `json:"pullRequestId,omitempty"` - // RepositoryURL - The repository URL. - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // BranchName - The branch name in the repository. - BranchName *string `json:"branchName,omitempty"` - // ProviderType - The source control provider type. - ProviderType *string `json:"providerType,omitempty"` -} - -// SourceTriggerUpdateParameters the properties for updating a source based trigger. -type SourceTriggerUpdateParameters struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceUpdateParameters the properties for updating the source code repository. -type SourceUpdateParameters struct { - // SourceControlType - The type of source control service. Possible values include: 'SourceControlTypeGithub', 'SourceControlTypeVisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceUploadDefinition the properties of a response to source upload request. -type SourceUploadDefinition struct { - autorest.Response `json:"-"` - // UploadURL - The URL where the client can upload the source. - UploadURL *string `json:"uploadUrl,omitempty"` - // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. - RelativePath *string `json:"relativePath,omitempty"` -} - -// Status the status of an Azure resource at the time the operation was called. -type Status struct { - // DisplayStatus - READ-ONLY; The short label for the status. - DisplayStatus *string `json:"displayStatus,omitempty"` - // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. - Message *string `json:"message,omitempty"` - // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for Status. -func (s Status) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StatusDetailProperties the status detail properties of the connected registry. -type StatusDetailProperties struct { - // Type - READ-ONLY; The component of the connected registry corresponding to the status. - Type *string `json:"type,omitempty"` - // Code - READ-ONLY; The code of the status. - Code *string `json:"code,omitempty"` - // Description - READ-ONLY; The description of the status. - Description *string `json:"description,omitempty"` - // Timestamp - READ-ONLY; The timestamp of the status. - Timestamp *date.Time `json:"timestamp,omitempty"` - // CorrelationID - READ-ONLY; The correlation ID of the status. - CorrelationID *string `json:"correlationId,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatusDetailProperties. -func (sdp StatusDetailProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncProperties the sync properties of the connected registry with its parent. -type SyncProperties struct { - // TokenID - The resource ID of the ACR token used to authenticate the connected registry to its parent during sync. - TokenID *string `json:"tokenId,omitempty"` - // Schedule - The cron expression indicating the schedule that the connected registry will sync with its parent. - Schedule *string `json:"schedule,omitempty"` - // SyncWindow - The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - SyncWindow *string `json:"syncWindow,omitempty"` - // MessageTTL - The period of time for which a message is available to sync before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - MessageTTL *string `json:"messageTtl,omitempty"` - // LastSyncTime - READ-ONLY; The last time a sync occurred between the connected registry and its parent. - LastSyncTime *date.Time `json:"lastSyncTime,omitempty"` - // GatewayEndpoint - READ-ONLY; The gateway endpoint used by the connected registry to communicate with its parent. - GatewayEndpoint *string `json:"gatewayEndpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncProperties. -func (sp SyncProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.TokenID != nil { - objectMap["tokenId"] = sp.TokenID - } - if sp.Schedule != nil { - objectMap["schedule"] = sp.Schedule - } - if sp.SyncWindow != nil { - objectMap["syncWindow"] = sp.SyncWindow - } - if sp.MessageTTL != nil { - objectMap["messageTtl"] = sp.MessageTTL - } - return json.Marshal(objectMap) -} - -// SyncUpdateProperties the parameters for updating the sync properties of the connected registry with its -// parent. -type SyncUpdateProperties struct { - // Schedule - The cron expression indicating the schedule that the connected registry will sync with its parent. - Schedule *string `json:"schedule,omitempty"` - // SyncWindow - The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - SyncWindow *string `json:"syncWindow,omitempty"` - // MessageTTL - The period of time for which a message is available to sync before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - MessageTTL *string `json:"messageTtl,omitempty"` -} - -// 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: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' - LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource modification (UTC). - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// Target the target of the event. -type Target struct { - // MediaType - The MIME type of the referenced object. - MediaType *string `json:"mediaType,omitempty"` - // Size - The number of bytes of the content. Same as Length field. - Size *int64 `json:"size,omitempty"` - // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. - Digest *string `json:"digest,omitempty"` - // Length - The number of bytes of the content. Same as Size field. - Length *int64 `json:"length,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // URL - The direct URL to the content. - URL *string `json:"url,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Name - The name of the artifact. - Name *string `json:"name,omitempty"` - // Version - The version of the artifact. - Version *string `json:"version,omitempty"` -} - -// Task the task that has the ARM resource and task properties. -// The task will have all information to schedule a run against it. -type Task struct { - autorest.Response `json:"-"` - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskProperties - The properties of a task. - *TaskProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Task. -func (t Task) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.Identity != nil { - objectMap["identity"] = t.Identity - } - if t.TaskProperties != nil { - objectMap["properties"] = t.TaskProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Task struct. -func (t *Task) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - t.Identity = &identity - } - case "properties": - if v != nil { - var taskProperties TaskProperties - err = json.Unmarshal(*v, &taskProperties) - if err != nil { - return err - } - t.TaskProperties = &taskProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - t.SystemData = &systemData - } - } - } - - return nil -} - -// TaskListResult the collection of tasks. -type TaskListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Task `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// TaskListResultIterator provides access to a complete listing of Task values. -type TaskListResultIterator struct { - i int - page TaskListResultPage -} - -// 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 *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.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 *TaskListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskListResultIterator) 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 TaskListResultIterator) Response() TaskListResult { - 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 TaskListResultIterator) Value() Task { - if !iter.page.NotDone() { - return Task{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TaskListResultIterator type. -func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { - return TaskListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TaskListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TaskListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// taskListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TaskListResult) taskListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TaskListResultPage contains a page of Task values. -type TaskListResultPage struct { - fn func(context.Context, TaskListResult) (TaskListResult, error) - tlr TaskListResult -} - -// 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 *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TaskListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TaskListResultPage) Response() TaskListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TaskListResultPage) Values() []Task { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TaskListResultPage type. -func NewTaskListResultPage(cur TaskListResult, getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { - return TaskListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TaskProperties the properties of a task. -type TaskProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CreationDate - READ-ONLY; The creation date of task. - CreationDate *date.Time `json:"creationDate,omitempty"` - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // AgentPoolName - The dedicated agent pool for the task. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties of a task step. - Step BasicTaskStepProperties `json:"step,omitempty"` - // Trigger - The properties that describe all triggers for the task. - Trigger *TriggerProperties `json:"trigger,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // IsSystemTask - The value of this property indicates whether the task resource is system task or not. - IsSystemTask *bool `json:"isSystemTask,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskProperties. -func (tp TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.Status != "" { - objectMap["status"] = tp.Status - } - if tp.Platform != nil { - objectMap["platform"] = tp.Platform - } - if tp.AgentConfiguration != nil { - objectMap["agentConfiguration"] = tp.AgentConfiguration - } - if tp.AgentPoolName != nil { - objectMap["agentPoolName"] = tp.AgentPoolName - } - if tp.Timeout != nil { - objectMap["timeout"] = tp.Timeout - } - objectMap["step"] = tp.Step - if tp.Trigger != nil { - objectMap["trigger"] = tp.Trigger - } - if tp.Credentials != nil { - objectMap["credentials"] = tp.Credentials - } - if tp.LogTemplate != nil { - objectMap["logTemplate"] = tp.LogTemplate - } - if tp.IsSystemTask != nil { - objectMap["isSystemTask"] = tp.IsSystemTask - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. -func (tp *TaskProperties) 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 "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "creationDate": - if v != nil { - var creationDate date.Time - err = json.Unmarshal(*v, &creationDate) - if err != nil { - return err - } - tp.CreationDate = &creationDate - } - case "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tp.Status = status - } - case "platform": - if v != nil { - var platform PlatformProperties - err = json.Unmarshal(*v, &platform) - if err != nil { - return err - } - tp.Platform = &platform - } - case "agentConfiguration": - if v != nil { - var agentConfiguration AgentProperties - err = json.Unmarshal(*v, &agentConfiguration) - if err != nil { - return err - } - tp.AgentConfiguration = &agentConfiguration - } - case "agentPoolName": - if v != nil { - var agentPoolName string - err = json.Unmarshal(*v, &agentPoolName) - if err != nil { - return err - } - tp.AgentPoolName = &agentPoolName - } - case "timeout": - if v != nil { - var timeout int32 - err = json.Unmarshal(*v, &timeout) - if err != nil { - return err - } - tp.Timeout = &timeout - } - case "step": - if v != nil { - step, err := unmarshalBasicTaskStepProperties(*v) - if err != nil { - return err - } - tp.Step = step - } - case "trigger": - if v != nil { - var trigger TriggerProperties - err = json.Unmarshal(*v, &trigger) - if err != nil { - return err - } - tp.Trigger = &trigger - } - case "credentials": - if v != nil { - var credentials Credentials - err = json.Unmarshal(*v, &credentials) - if err != nil { - return err - } - tp.Credentials = &credentials - } - case "logTemplate": - if v != nil { - var logTemplate string - err = json.Unmarshal(*v, &logTemplate) - if err != nil { - return err - } - tp.LogTemplate = &logTemplate - } - case "isSystemTask": - if v != nil { - var isSystemTask bool - err = json.Unmarshal(*v, &isSystemTask) - if err != nil { - return err - } - tp.IsSystemTask = &isSystemTask - } - } - } - - return nil -} - -// TaskPropertiesUpdateParameters the properties for updating a task. -type TaskPropertiesUpdateParameters struct { - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformUpdateParameters `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // AgentPoolName - The dedicated agent pool for the task. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties for updating a task step. - Step BasicTaskStepUpdateParameters `json:"step,omitempty"` - // Trigger - The properties for updating trigger properties. - Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` - // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. -func (tpup *TaskPropertiesUpdateParameters) 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 "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tpup.Status = status - } - case "platform": - if v != nil { - var platform PlatformUpdateParameters - err = json.Unmarshal(*v, &platform) - if err != nil { - return err - } - tpup.Platform = &platform - } - case "agentConfiguration": - if v != nil { - var agentConfiguration AgentProperties - err = json.Unmarshal(*v, &agentConfiguration) - if err != nil { - return err - } - tpup.AgentConfiguration = &agentConfiguration - } - case "agentPoolName": - if v != nil { - var agentPoolName string - err = json.Unmarshal(*v, &agentPoolName) - if err != nil { - return err - } - tpup.AgentPoolName = &agentPoolName - } - case "timeout": - if v != nil { - var timeout int32 - err = json.Unmarshal(*v, &timeout) - if err != nil { - return err - } - tpup.Timeout = &timeout - } - case "step": - if v != nil { - step, err := unmarshalBasicTaskStepUpdateParameters(*v) - if err != nil { - return err - } - tpup.Step = step - } - case "trigger": - if v != nil { - var trigger TriggerUpdateParameters - err = json.Unmarshal(*v, &trigger) - if err != nil { - return err - } - tpup.Trigger = &trigger - } - case "credentials": - if v != nil { - var credentials Credentials - err = json.Unmarshal(*v, &credentials) - if err != nil { - return err - } - tpup.Credentials = &credentials - } - case "logTemplate": - if v != nil { - var logTemplate string - err = json.Unmarshal(*v, &logTemplate) - if err != nil { - return err - } - tpup.LogTemplate = &logTemplate - } - } - } - - return nil -} - -// TaskRun the task run that has the ARM resource and properties. -// The task run will have the information of request and result of a run. -type TaskRun struct { - autorest.Response `json:"-"` - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunProperties - The properties associated with the task run, i.e., request and result of the run - *TaskRunProperties `json:"properties,omitempty"` - // Location - The location of the resource - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRun. -func (tr TaskRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Identity != nil { - objectMap["identity"] = tr.Identity - } - if tr.TaskRunProperties != nil { - objectMap["properties"] = tr.TaskRunProperties - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRun struct. -func (tr *TaskRun) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tr.Identity = &identity - } - case "properties": - if v != nil { - var taskRunProperties TaskRunProperties - err = json.Unmarshal(*v, &taskRunProperties) - if err != nil { - return err - } - tr.TaskRunProperties = &taskRunProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tr.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - tr.SystemData = &systemData - } - } - } - - return nil -} - -// TaskRunListResult the collection of task runs. -type TaskRunListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]TaskRun `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// TaskRunListResultIterator provides access to a complete listing of TaskRun values. -type TaskRunListResultIterator struct { - i int - page TaskRunListResultPage -} - -// 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 *TaskRunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultIterator.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 *TaskRunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskRunListResultIterator) 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 TaskRunListResultIterator) Response() TaskRunListResult { - 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 TaskRunListResultIterator) Value() TaskRun { - if !iter.page.NotDone() { - return TaskRun{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TaskRunListResultIterator type. -func NewTaskRunListResultIterator(page TaskRunListResultPage) TaskRunListResultIterator { - return TaskRunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (trlr TaskRunListResult) IsEmpty() bool { - return trlr.Value == nil || len(*trlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (trlr TaskRunListResult) hasNextLink() bool { - return trlr.NextLink != nil && len(*trlr.NextLink) != 0 -} - -// taskRunListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (trlr TaskRunListResult) taskRunListResultPreparer(ctx context.Context) (*http.Request, error) { - if !trlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(trlr.NextLink))) -} - -// TaskRunListResultPage contains a page of TaskRun values. -type TaskRunListResultPage struct { - fn func(context.Context, TaskRunListResult) (TaskRunListResult, error) - trlr TaskRunListResult -} - -// 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 *TaskRunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultPage.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.trlr) - if err != nil { - return err - } - page.trlr = 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 *TaskRunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskRunListResultPage) NotDone() bool { - return !page.trlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TaskRunListResultPage) Response() TaskRunListResult { - return page.trlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TaskRunListResultPage) Values() []TaskRun { - if page.trlr.IsEmpty() { - return nil - } - return *page.trlr.Value -} - -// Creates a new instance of the TaskRunListResultPage type. -func NewTaskRunListResultPage(cur TaskRunListResult, getNextPage func(context.Context, TaskRunListResult) (TaskRunListResult, error)) TaskRunListResultPage { - return TaskRunListResultPage{ - fn: getNextPage, - trlr: cur, - } -} - -// TaskRunProperties the properties of task run. -type TaskRunProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of this task run. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // RunRequest - The request (parameters) for the run - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // RunResult - READ-ONLY; The result of this task run - RunResult *Run `json:"runResult,omitempty"` - // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRunProperties. -func (trp TaskRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["runRequest"] = trp.RunRequest - if trp.ForceUpdateTag != nil { - objectMap["forceUpdateTag"] = trp.ForceUpdateTag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunProperties struct. -func (trp *TaskRunProperties) 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 "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - trp.ProvisioningState = provisioningState - } - case "runRequest": - if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) - if err != nil { - return err - } - trp.RunRequest = runRequest - } - case "runResult": - if v != nil { - var runResult Run - err = json.Unmarshal(*v, &runResult) - if err != nil { - return err - } - trp.RunResult = &runResult - } - case "forceUpdateTag": - if v != nil { - var forceUpdateTag string - err = json.Unmarshal(*v, &forceUpdateTag) - if err != nil { - return err - } - trp.ForceUpdateTag = &forceUpdateTag - } - } - } - - return nil -} - -// TaskRunPropertiesUpdateParameters the properties of a task run update parameters. -type TaskRunPropertiesUpdateParameters struct { - // RunRequest - The request (parameters) for the new run - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunPropertiesUpdateParameters struct. -func (trpup *TaskRunPropertiesUpdateParameters) 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 "runRequest": - if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) - if err != nil { - return err - } - trpup.RunRequest = runRequest - } - case "forceUpdateTag": - if v != nil { - var forceUpdateTag string - err = json.Unmarshal(*v, &forceUpdateTag) - if err != nil { - return err - } - trpup.ForceUpdateTag = &forceUpdateTag - } - } - } - - return nil -} - -// TaskRunRequest the parameters for a task run request. -type TaskRunRequest struct { - // TaskID - The resource ID of task against which run has to be queued. - TaskID *string `json:"taskId,omitempty"` - // OverrideTaskStepProperties - Set of overridable parameters that can be passed when running a Task. - OverrideTaskStepProperties *OverrideTaskStepProperties `json:"overrideTaskStepProperties,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRunRequest. -func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { - trr.Type = TypeTaskRunRequest - objectMap := make(map[string]interface{}) - if trr.TaskID != nil { - objectMap["taskId"] = trr.TaskID - } - if trr.OverrideTaskStepProperties != nil { - objectMap["overrideTaskStepProperties"] = trr.OverrideTaskStepProperties - } - if trr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled - } - if trr.AgentPoolName != nil { - objectMap["agentPoolName"] = trr.AgentPoolName - } - if trr.LogTemplate != nil { - objectMap["logTemplate"] = trr.LogTemplate - } - if trr.Type != "" { - objectMap["type"] = trr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return &trr, true -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &trr, true -} - -// TaskRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (TaskRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsCreateFuture) 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 TaskRunsCreateFuture.Result. -func (future *TaskRunsCreateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.CreateResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsDeleteFuture) 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 TaskRunsDeleteFuture.Result. -func (future *TaskRunsDeleteFuture) result(client TaskRunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TaskRunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (TaskRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsUpdateFuture) 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 TaskRunsUpdateFuture.Result. -func (future *TaskRunsUpdateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.UpdateResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskRunUpdateParameters the parameters for updating a task run. -type TaskRunUpdateParameters struct { - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunPropertiesUpdateParameters - The properties for updating a task run. - *TaskRunPropertiesUpdateParameters `json:"properties,omitempty"` - // Location - The location of the resource - Location *string `json:"location,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TaskRunUpdateParameters. -func (trup TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if trup.Identity != nil { - objectMap["identity"] = trup.Identity - } - if trup.TaskRunPropertiesUpdateParameters != nil { - objectMap["properties"] = trup.TaskRunPropertiesUpdateParameters - } - if trup.Location != nil { - objectMap["location"] = trup.Location - } - if trup.Tags != nil { - objectMap["tags"] = trup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunUpdateParameters struct. -func (trup *TaskRunUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - trup.Identity = &identity - } - case "properties": - if v != nil { - var taskRunPropertiesUpdateParameters TaskRunPropertiesUpdateParameters - err = json.Unmarshal(*v, &taskRunPropertiesUpdateParameters) - if err != nil { - return err - } - trup.TaskRunPropertiesUpdateParameters = &taskRunPropertiesUpdateParameters - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - trup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - trup.Tags = tags - } - } - } - - return nil -} - -// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (Task, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksCreateFuture) 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 TasksCreateFuture.Result. -func (future *TasksCreateFuture) result(client TasksClient) (t Task, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksDeleteFuture) 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 TasksDeleteFuture.Result. -func (future *TasksDeleteFuture) result(client TasksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BasicTaskStepProperties base properties for any task step. -type BasicTaskStepProperties interface { - AsDockerBuildStep() (*DockerBuildStep, bool) - AsFileTaskStep() (*FileTaskStep, bool) - AsEncodedTaskStep() (*EncodedTaskStep, bool) - AsTaskStepProperties() (*TaskStepProperties, bool) -} - -// TaskStepProperties base properties for any task step. -type TaskStepProperties struct { - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicTaskStepPropertiesTypeDocker): - var dbs DockerBuildStep - err := json.Unmarshal(body, &dbs) - return dbs, err - case string(TypeBasicTaskStepPropertiesTypeFileTask): - var fts FileTaskStep - err := json.Unmarshal(body, &fts) - return fts, err - case string(TypeBasicTaskStepPropertiesTypeEncodedTask): - var ets EncodedTaskStep - err := json.Unmarshal(body, &ets) - return ets, err - default: - var tsp TaskStepProperties - err := json.Unmarshal(body, &tsp) - return tsp, err - } -} -func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tspArray := make([]BasicTaskStepProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) - if err != nil { - return nil, err - } - tspArray[index] = tsp - } - return tspArray, nil -} - -// MarshalJSON is the custom marshaler for TaskStepProperties. -func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { - tsp.Type = TypeBasicTaskStepPropertiesTypeTaskStepProperties - objectMap := make(map[string]interface{}) - if tsp.ContextPath != nil { - objectMap["contextPath"] = tsp.ContextPath - } - if tsp.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsp.ContextAccessToken - } - if tsp.Type != "" { - objectMap["type"] = tsp.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { - return &tsp, true -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &tsp, true -} - -// BasicTaskStepUpdateParameters base properties for updating any task step. -type BasicTaskStepUpdateParameters interface { - AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) - AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) - AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) - AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) -} - -// TaskStepUpdateParameters base properties for updating any task step. -type TaskStepUpdateParameters struct { - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicTaskStepUpdateParametersTypeDocker): - var dbsup DockerBuildStepUpdateParameters - err := json.Unmarshal(body, &dbsup) - return dbsup, err - case string(TypeBasicTaskStepUpdateParametersTypeFileTask): - var ftsup FileTaskStepUpdateParameters - err := json.Unmarshal(body, &ftsup) - return ftsup, err - case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): - var etsup EncodedTaskStepUpdateParameters - err := json.Unmarshal(body, &etsup) - return etsup, err - default: - var tsup TaskStepUpdateParameters - err := json.Unmarshal(body, &tsup) - return tsup, err - } -} -func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) - if err != nil { - return nil, err - } - tsupArray[index] = tsup - } - return tsupArray, nil -} - -// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters - objectMap := make(map[string]interface{}) - if tsup.ContextPath != nil { - objectMap["contextPath"] = tsup.ContextPath - } - if tsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsup.ContextAccessToken - } - if tsup.Type != "" { - objectMap["type"] = tsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return &tsup, true -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &tsup, true -} - -// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (Task, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksUpdateFuture) 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 TasksUpdateFuture.Result. -func (future *TasksUpdateFuture) result(client TasksClient) (t Task, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskUpdateParameters the parameters for updating a task. -type TaskUpdateParameters struct { - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskPropertiesUpdateParameters - The properties for updating a task. - *TaskPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TaskUpdateParameters. -func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Identity != nil { - objectMap["identity"] = tup.Identity - } - if tup.TaskPropertiesUpdateParameters != nil { - objectMap["properties"] = tup.TaskPropertiesUpdateParameters - } - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. -func (tup *TaskUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tup.Identity = &identity - } - case "properties": - if v != nil { - var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters - err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) - if err != nil { - return err - } - tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tup.Tags = tags - } - } - } - - return nil -} - -// TimerTrigger the properties of a timer trigger. -type TimerTrigger struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// TimerTriggerDescriptor ... -type TimerTriggerDescriptor struct { - // TimerTriggerName - The timer trigger name that caused the run. - TimerTriggerName *string `json:"timerTriggerName,omitempty"` - // ScheduleOccurrence - The occurrence that triggered the run. - ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` -} - -// TimerTriggerUpdateParameters the properties for updating a timer trigger. -type TimerTriggerUpdateParameters struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// TLSCertificateProperties the TLS certificate properties of the connected registry login server. -type TLSCertificateProperties struct { - // Type - READ-ONLY; The type of certificate location. Possible values include: 'CertificateTypeLocalDirectory' - Type CertificateType `json:"type,omitempty"` - // Location - READ-ONLY; Indicates the location of the certificates. - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for TLSCertificateProperties. -func (TCP TLSCertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TLSProperties the TLS properties of the connected registry login server. -type TLSProperties struct { - // Status - READ-ONLY; Indicates whether HTTPS is enabled for the login server. Possible values include: 'TLSStatusEnabled', 'TLSStatusDisabled' - Status TLSStatus `json:"status,omitempty"` - // Certificate - READ-ONLY; The certificate used to configure HTTPS for the login server. - Certificate *TLSCertificateProperties `json:"certificate,omitempty"` -} - -// MarshalJSON is the custom marshaler for TLSProperties. -func (tp TLSProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Token an object that represents a token for a container registry. -type Token struct { - autorest.Response `json:"-"` - // TokenProperties - The properties of the token. - *TokenProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Token. -func (t Token) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TokenProperties != nil { - objectMap["properties"] = t.TokenProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Token struct. -func (t *Token) 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 tokenProperties TokenProperties - err = json.Unmarshal(*v, &tokenProperties) - if err != nil { - return err - } - t.TokenProperties = &tokenProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - t.SystemData = &systemData - } - } - } - - return nil -} - -// TokenCertificate the properties of a certificate used for authenticating a token. -type TokenCertificate struct { - // Name - Possible values include: 'TokenCertificateNameCertificate1', 'TokenCertificateNameCertificate2' - Name TokenCertificateName `json:"name,omitempty"` - // Expiry - The expiry datetime of the certificate. - Expiry *date.Time `json:"expiry,omitempty"` - // Thumbprint - The thumbprint of the certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // EncodedPemCertificate - Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. - EncodedPemCertificate *string `json:"encodedPemCertificate,omitempty"` -} - -// TokenCredentialsProperties the properties of the credentials that can be used for authenticating the -// token. -type TokenCredentialsProperties struct { - Certificates *[]TokenCertificate `json:"certificates,omitempty"` - Passwords *[]TokenPassword `json:"passwords,omitempty"` -} - -// TokenListResult the result of a request to list tokens for a container registry. -type TokenListResult struct { - autorest.Response `json:"-"` - // Value - The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. - Value *[]Token `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of tokens. - NextLink *string `json:"nextLink,omitempty"` -} - -// TokenListResultIterator provides access to a complete listing of Token values. -type TokenListResultIterator struct { - i int - page TokenListResultPage -} - -// 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 *TokenListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultIterator.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 *TokenListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TokenListResultIterator) 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 TokenListResultIterator) Response() TokenListResult { - 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 TokenListResultIterator) Value() Token { - if !iter.page.NotDone() { - return Token{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TokenListResultIterator type. -func NewTokenListResultIterator(page TokenListResultPage) TokenListResultIterator { - return TokenListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TokenListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TokenListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// tokenListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TokenListResult) tokenListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TokenListResultPage contains a page of Token values. -type TokenListResultPage struct { - fn func(context.Context, TokenListResult) (TokenListResult, error) - tlr TokenListResult -} - -// 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 *TokenListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TokenListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TokenListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TokenListResultPage) Response() TokenListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TokenListResultPage) Values() []Token { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TokenListResultPage type. -func NewTokenListResultPage(cur TokenListResult, getNextPage func(context.Context, TokenListResult) (TokenListResult, error)) TokenListResultPage { - return TokenListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TokenPassword the password that will be used for authenticating the token of a container registry. -type TokenPassword struct { - // CreationTime - The creation datetime of the password. - CreationTime *date.Time `json:"creationTime,omitempty"` - // Expiry - The expiry datetime of the password. - Expiry *date.Time `json:"expiry,omitempty"` - // Name - The password name "password1" or "password2". Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' - Name TokenPasswordName `json:"name,omitempty"` - // Value - READ-ONLY; The password value. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TokenPassword. -func (tp TokenPassword) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.CreationTime != nil { - objectMap["creationTime"] = tp.CreationTime - } - if tp.Expiry != nil { - objectMap["expiry"] = tp.Expiry - } - if tp.Name != "" { - objectMap["name"] = tp.Name - } - return json.Marshal(objectMap) -} - -// TokenProperties the properties of a token. -type TokenProperties struct { - // CreationDate - READ-ONLY; The creation date of scope map. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ScopeMapID - The resource ID of the scope map to which the token will be associated with. - ScopeMapID *string `json:"scopeMapId,omitempty"` - // Credentials - The credentials that can be used for authenticating the token. - Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` - // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' - Status TokenStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for TokenProperties. -func (tp TokenProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.ScopeMapID != nil { - objectMap["scopeMapId"] = tp.ScopeMapID - } - if tp.Credentials != nil { - objectMap["credentials"] = tp.Credentials - } - if tp.Status != "" { - objectMap["status"] = tp.Status - } - return json.Marshal(objectMap) -} - -// TokensCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TokensCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TokensClient) (Token, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TokensCreateFuture) 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 TokensCreateFuture.Result. -func (future *TokensCreateFuture) result(client TokensClient) (t Token, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TokensCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TokensDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TokensDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TokensClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TokensDeleteFuture) 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 TokensDeleteFuture.Result. -func (future *TokensDeleteFuture) result(client TokensClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TokensDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TokensUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TokensUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TokensClient) (Token, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TokensUpdateFuture) 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 TokensUpdateFuture.Result. -func (future *TokensUpdateFuture) result(client TokensClient) (t Token, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TokensUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TokenUpdateParameters the parameters for updating a token. -type TokenUpdateParameters struct { - // TokenUpdateProperties - The properties of the token update parameters. - *TokenUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TokenUpdateParameters. -func (tup TokenUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.TokenUpdateProperties != nil { - objectMap["properties"] = tup.TokenUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TokenUpdateParameters struct. -func (tup *TokenUpdateParameters) 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 tokenUpdateProperties TokenUpdateProperties - err = json.Unmarshal(*v, &tokenUpdateProperties) - if err != nil { - return err - } - tup.TokenUpdateProperties = &tokenUpdateProperties - } - } - } - - return nil -} - -// TokenUpdateProperties the parameters for updating token properties. -type TokenUpdateProperties struct { - // ScopeMapID - The resource ID of the scope map to which the token will be associated with. - ScopeMapID *string `json:"scopeMapId,omitempty"` - // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' - Status TokenStatus `json:"status,omitempty"` - // Credentials - The credentials that can be used for authenticating the token. - Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` -} - -// TriggerProperties the properties of a trigger. -type TriggerProperties struct { - // TimerTriggers - The collection of timer triggers. - TimerTriggers *[]TimerTrigger `json:"timerTriggers,omitempty"` - // SourceTriggers - The collection of triggers based on source code repository. - SourceTriggers *[]SourceTrigger `json:"sourceTriggers,omitempty"` - // BaseImageTrigger - The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTrigger `json:"baseImageTrigger,omitempty"` -} - -// TriggerUpdateParameters the properties for updating triggers. -type TriggerUpdateParameters struct { - // TimerTriggers - The collection of timer triggers. - TimerTriggers *[]TimerTriggerUpdateParameters `json:"timerTriggers,omitempty"` - // SourceTriggers - The collection of triggers based on source code repository. - SourceTriggers *[]SourceTriggerUpdateParameters `json:"sourceTriggers,omitempty"` - // BaseImageTrigger - The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTriggerUpdateParameters `json:"baseImageTrigger,omitempty"` -} - -// TrustPolicy the content trust policy for a container registry. -type TrustPolicy struct { - // Type - The type of trust policy. Possible values include: 'TrustPolicyTypeNotary' - Type TrustPolicyType `json:"type,omitempty"` - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// UserIdentityProperties ... -type UserIdentityProperties struct { - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// VirtualNetworkRule virtual network rule. -type VirtualNetworkRule struct { - // Action - The action of virtual network rule. Possible values include: 'ActionAllow' - Action Action `json:"action,omitempty"` - // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - VirtualNetworkResourceID *string `json:"id,omitempty"` -} - -// Webhook an object that represents a webhook for a container registry. -type Webhook struct { - autorest.Response `json:"-"` - // WebhookProperties - The properties of the webhook. - *WebhookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WebhookProperties != nil { - objectMap["properties"] = w.WebhookProperties - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Webhook struct. -func (w *Webhook) 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 webhookProperties WebhookProperties - err = json.Unmarshal(*v, &webhookProperties) - if err != nil { - return err - } - w.WebhookProperties = &webhookProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - w.SystemData = &systemData - } - } - } - - return nil -} - -// WebhookCreateParameters the parameters for creating a webhook. -type WebhookCreateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // Location - The location of the webhook. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. - *WebhookPropertiesCreateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateParameters. -func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcp.Tags != nil { - objectMap["tags"] = wcp.Tags - } - if wcp.Location != nil { - objectMap["location"] = wcp.Location - } - if wcp.WebhookPropertiesCreateParameters != nil { - objectMap["properties"] = wcp.WebhookPropertiesCreateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. -func (wcp *WebhookCreateParameters) 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 - } - wcp.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wcp.Location = &location - } - case "properties": - if v != nil { - var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters - err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) - if err != nil { - return err - } - wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters - } - } - } - - return nil -} - -// WebhookListResult the result of a request to list webhooks for a container registry. -type WebhookListResult struct { - autorest.Response `json:"-"` - // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. - Value *[]Webhook `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of webhooks. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultIterator provides access to a complete listing of Webhook values. -type WebhookListResultIterator struct { - i int - page WebhookListResultPage -} - -// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { - 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 WebhookListResultIterator) Value() Webhook { - if !iter.page.NotDone() { - return Webhook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebhookListResultIterator type. -func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { - return WebhookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WebhookListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WebhookListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// webhookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WebhookListResult) webhookListResultPreparer(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))) -} - -// WebhookListResultPage contains a page of Webhook values. -type WebhookListResultPage struct { - fn func(context.Context, WebhookListResult) (WebhookListResult, error) - wlr WebhookListResult -} - -// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebhookListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebhookListResultPage) Response() WebhookListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebhookListResultPage) Values() []Webhook { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WebhookListResultPage type. -func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { - return WebhookListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WebhookProperties the properties of a webhook. -type WebhookProperties struct { - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookProperties. -func (wp WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Status != "" { - objectMap["status"] = wp.Status - } - if wp.Scope != nil { - objectMap["scope"] = wp.Scope - } - if wp.Actions != nil { - objectMap["actions"] = wp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. -type WebhookPropertiesCreateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. -func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpcp.ServiceURI != nil { - objectMap["serviceUri"] = wpcp.ServiceURI - } - if wpcp.CustomHeaders != nil { - objectMap["customHeaders"] = wpcp.CustomHeaders - } - if wpcp.Status != "" { - objectMap["status"] = wpcp.Status - } - if wpcp.Scope != nil { - objectMap["scope"] = wpcp.Scope - } - if wpcp.Actions != nil { - objectMap["actions"] = wpcp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. -type WebhookPropertiesUpdateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. -func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpup.ServiceURI != nil { - objectMap["serviceUri"] = wpup.ServiceURI - } - if wpup.CustomHeaders != nil { - objectMap["customHeaders"] = wpup.CustomHeaders - } - if wpup.Status != "" { - objectMap["status"] = wpup.Status - } - if wpup.Scope != nil { - objectMap["scope"] = wpup.Scope - } - if wpup.Actions != nil { - objectMap["actions"] = wpup.Actions - } - return json.Marshal(objectMap) -} - -// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksCreateFuture) 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 WebhooksCreateFuture.Result. -func (future *WebhooksCreateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.CreateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksDeleteFuture) 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 WebhooksDeleteFuture.Result. -func (future *WebhooksDeleteFuture) result(client WebhooksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksUpdateFuture) 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 WebhooksUpdateFuture.Result. -func (future *WebhooksUpdateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.UpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhookUpdateParameters the parameters for updating a webhook. -type WebhookUpdateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. - *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateParameters. -func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.Tags != nil { - objectMap["tags"] = wup.Tags - } - if wup.WebhookPropertiesUpdateParameters != nil { - objectMap["properties"] = wup.WebhookPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. -func (wup *WebhookUpdateParameters) 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 - } - wup.Tags = tags - } - case "properties": - if v != nil { - var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters - err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) - if err != nil { - return err - } - wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters - } - } - } - - return nil -} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/operations.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/operations.go deleted file mode 100644 index 16590f60f57d..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 client for the Operations methods of the Containerregistry service. -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 Azure Container Registry 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, "containerregistry.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, "containerregistry.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerRegistry/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, "containerregistry.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, "containerregistry.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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/containerregistry/mgmt/2021-06-01-preview/containerregistry/pipelineruns.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/pipelineruns.go deleted file mode 100644 index ea4acd04b823..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/pipelineruns.go +++ /dev/null @@ -1,453 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PipelineRunsClient is the client for the PipelineRuns methods of the Containerregistry service. -type PipelineRunsClient struct { - BaseClient -} - -// NewPipelineRunsClient creates an instance of the PipelineRunsClient client. -func NewPipelineRunsClient(subscriptionID string) PipelineRunsClient { - return NewPipelineRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPipelineRunsClientWithBaseURI creates an instance of the PipelineRunsClient 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 NewPipelineRunsClientWithBaseURI(baseURI string, subscriptionID string) PipelineRunsClient { - return PipelineRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a pipeline run for a container registry with the specified parameters -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// pipelineRunName - the name of the pipeline run. -// pipelineRunCreateParameters - the parameters for creating a pipeline run. -func (client PipelineRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun) (result PipelineRunsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunName, - Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunCreateParameters, - Constraints: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Source", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Source.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Target", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Target.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, pipelineRunName, pipelineRunCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client PipelineRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "pipelineRunName": autorest.Encode("path", pipelineRunName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", pathParameters), - autorest.WithJSON(pipelineRunCreateParameters), - 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 PipelineRunsClient) CreateSender(req *http.Request) (future PipelineRunsCreateFuture, 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 PipelineRunsClient) CreateResponder(resp *http.Response) (result PipelineRun, 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 a pipeline run from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// pipelineRunName - the name of the pipeline run. -func (client PipelineRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result PipelineRunsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunName, - Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, pipelineRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PipelineRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "pipelineRunName": autorest.Encode("path", pipelineRunName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", 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 PipelineRunsClient) DeleteSender(req *http.Request) (future PipelineRunsDeleteFuture, 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 PipelineRunsClient) 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 the detailed information for a given pipeline run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// pipelineRunName - the name of the pipeline run. -func (client PipelineRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result PipelineRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: pipelineRunName, - Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, pipelineRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PipelineRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "pipelineRunName": autorest.Encode("path", pipelineRunName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", 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 PipelineRunsClient) 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 PipelineRunsClient) GetResponder(resp *http.Response) (result PipelineRun, 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 the pipeline runs for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client PipelineRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result PipelineRunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.List") - defer func() { - sc := -1 - if result.prlr.Response.Response != nil { - sc = result.prlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PipelineRunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.prlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", resp, "Failure sending request") - return - } - - result.prlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", resp, "Failure responding to request") - return - } - if result.prlr.hasNextLink() && result.prlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PipelineRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/pipelineRuns", 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 PipelineRunsClient) 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 PipelineRunsClient) ListResponder(resp *http.Response) (result PipelineRunListResult, 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 PipelineRunsClient) listNextResults(ctx context.Context, lastResults PipelineRunListResult) (result PipelineRunListResult, err error) { - req, err := lastResults.pipelineRunListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "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, "containerregistry.PipelineRunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PipelineRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result PipelineRunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/privateendpointconnections.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/privateendpointconnections.go deleted file mode 100644 index d29eca10078f..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/privateendpointconnections.go +++ /dev/null @@ -1,434 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the Containerregistry -// service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate update the state of specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -// privateEndpointConnection - the parameters for creating a private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName, privateEndpointConnection) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(privateEndpointConnection), - 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 get the specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// List list all private endpoint connections in a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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 PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "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, "containerregistry.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/registries.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/registries.go deleted file mode 100644 index 6dc9fed42eea..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/registries.go +++ /dev/null @@ -1,1471 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RegistriesClient is the client for the Registries methods of the Containerregistry service. -type RegistriesClient struct { - BaseClient -} - -// NewRegistriesClient creates an instance of the RegistriesClient client. -func NewRegistriesClient(subscriptionID string) RegistriesClient { - return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient 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 NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { - return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only -// alphanumeric characters, be globally unique, and between 5 and 50 characters in length. -// Parameters: -// registryNameCheckRequest - the object containing information for the availability request. -func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryNameCheckRequest, - Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}, - }}, - {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters), - autorest.WithJSON(registryNameCheckRequest), - 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 RegistriesClient) 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 RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, 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 container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registry - the parameters for creating a container registry. -func (client RegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result RegistriesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: registry, - Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, registry) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registry), - 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 RegistriesClient) CreateSender(req *http.Request) (future RegistriesCreateFuture, 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 RegistriesClient) CreateResponder(resp *http.Response) (result Registry, 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 a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result RegistriesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) DeleteSender(req *http.Request) (future RegistriesDeleteFuture, 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 RegistriesClient) 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 -} - -// GenerateCredentials generate keys for a token of a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// generateCredentialsParameters - the parameters for generating credentials. -func (client RegistriesClient) GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (result RegistriesGenerateCredentialsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GenerateCredentials") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "GenerateCredentials", err.Error()) - } - - req, err := client.GenerateCredentialsPreparer(ctx, resourceGroupName, registryName, generateCredentialsParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", nil, "Failure preparing request") - return - } - - result, err = client.GenerateCredentialsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", result.Response(), "Failure sending request") - return - } - - return -} - -// GenerateCredentialsPreparer prepares the GenerateCredentials request. -func (client RegistriesClient) GenerateCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/generateCredentials", pathParameters), - autorest.WithJSON(generateCredentialsParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateCredentialsSender sends the GenerateCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GenerateCredentialsSender(req *http.Request) (future RegistriesGenerateCredentialsFuture, 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 -} - -// GenerateCredentialsResponder handles the response to the GenerateCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GenerateCredentialsResponder(resp *http.Response) (result GenerateCredentialsResult, 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 the properties of the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) 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 RegistriesClient) GetResponder(resp *http.Response) (result Registry, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBuildSourceUploadURL get the upload location for the user to be able to upload the source. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result SourceUploadDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GetBuildSourceUploadURL") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "GetBuildSourceUploadURL", err.Error()) - } - - req, err := client.GetBuildSourceUploadURLPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetBuildSourceUploadURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure sending request") - return - } - - result, err = client.GetBuildSourceUploadURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure responding to request") - return - } - - return -} - -// GetBuildSourceUploadURLPreparer prepares the GetBuildSourceUploadURL request. -func (client RegistriesClient) GetBuildSourceUploadURLPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBuildSourceUploadURLSender sends the GetBuildSourceUploadURL request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GetBuildSourceUploadURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetBuildSourceUploadURLResponder handles the response to the GetBuildSourceUploadURL request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GetBuildSourceUploadURLResponder(resp *http.Response) (result SourceUploadDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ImportImage copies an image to this container registry from the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// parameters - the parameters specifying the image to copy and the source container registry. -func (client RegistriesClient) ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (result RegistriesImportImageFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ImportImage") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials.Password", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Source.SourceImage", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ImportImage", err.Error()) - } - - req, err := client.ImportImagePreparer(ctx, resourceGroupName, registryName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", nil, "Failure preparing request") - return - } - - result, err = client.ImportImageSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportImagePreparer prepares the ImportImage request. -func (client RegistriesClient) ImportImagePreparer(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/importImage", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportImageSender sends the ImportImage request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ImportImageSender(req *http.Request) (future RegistriesImportImageFuture, 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 -} - -// ImportImageResponder handles the response to the ImportImage request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ImportImageResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all the container registries under the specified subscription. -func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 the container registries under the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup") - 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.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RegistriesClient) 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-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.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 -} - -// ListCredentials lists the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListCredentials") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListCredentials", err.Error()) - } - - req, err := client.ListCredentialsPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListCredentialsPreparer prepares the ListCredentials request. -func (client RegistriesClient) ListCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCredentialsSender sends the ListCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCredentialsResponder handles the response to the ListCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPrivateLinkResources lists the private link resources for a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListPrivateLinkResources", err.Error()) - } - - result.fn = client.listPrivateLinkResourcesNextResults - req, err := client.ListPrivateLinkResourcesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", nil, "Failure preparing request") - return - } - - resp, err := client.ListPrivateLinkResourcesSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListPrivateLinkResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPrivateLinkResourcesPreparer prepares the ListPrivateLinkResources request. -func (client RegistriesClient) ListPrivateLinkResourcesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPrivateLinkResourcesSender sends the ListPrivateLinkResources request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListPrivateLinkResourcesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListPrivateLinkResourcesResponder handles the response to the ListPrivateLinkResources request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListPrivateLinkResourcesResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listPrivateLinkResourcesNextResults retrieves the next set of results, if any. -func (client RegistriesClient) listPrivateLinkResourcesNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListPrivateLinkResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListPrivateLinkResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListPrivateLinkResourcesComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") - 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.ListPrivateLinkResources(ctx, resourceGroupName, registryName) - return -} - -// ListUsages gets the quota usages for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result RegistryUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListUsages") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client RegistriesClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/listUsages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListUsagesResponder(resp *http.Response) (result RegistryUsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateCredential regenerates one of the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// regenerateCredentialParameters - specifies name of the password which should be regenerated -- password or -// password2. -func (client RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.RegenerateCredential") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "RegenerateCredential", err.Error()) - } - - req, err := client.RegenerateCredentialPreparer(ctx, resourceGroupName, registryName, regenerateCredentialParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateCredentialSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request") - return - } - - result, err = client.RegenerateCredentialResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateCredentialPreparer prepares the RegenerateCredential request. -func (client RegistriesClient) RegenerateCredentialPreparer(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters), - autorest.WithJSON(regenerateCredentialParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always -// closes the http.Response Body. -func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ScheduleRun schedules a new run based on the request parameters and add it to the run queue. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runRequest - the parameters of a run that needs to scheduled. -func (client RegistriesClient) ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (result RegistriesScheduleRunFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ScheduleRun") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ScheduleRun", err.Error()) - } - - req, err := client.ScheduleRunPreparer(ctx, resourceGroupName, registryName, runRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", nil, "Failure preparing request") - return - } - - result, err = client.ScheduleRunSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", result.Response(), "Failure sending request") - return - } - - return -} - -// ScheduleRunPreparer prepares the ScheduleRun request. -func (client RegistriesClient) ScheduleRunPreparer(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/scheduleRun", pathParameters), - autorest.WithJSON(runRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ScheduleRunSender sends the ScheduleRun request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ScheduleRunSender(req *http.Request) (future RegistriesScheduleRunFuture, 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 -} - -// ScheduleRunResponder handles the response to the ScheduleRun request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ScheduleRunResponder(resp *http.Response) (result Run, 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 a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registryUpdateParameters - the parameters for updating a container registry. -func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result RegistriesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, registryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registryUpdateParameters), - 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 RegistriesClient) UpdateSender(req *http.Request) (future RegistriesUpdateFuture, 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 RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/replications.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/replications.go deleted file mode 100644 index ee0f554df5a7..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/replications.go +++ /dev/null @@ -1,542 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReplicationsClient is the client for the Replications methods of the Containerregistry service. -type ReplicationsClient struct { - BaseClient -} - -// NewReplicationsClient creates an instance of the ReplicationsClient client. -func NewReplicationsClient(subscriptionID string) ReplicationsClient { - return NewReplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationsClientWithBaseURI creates an instance of the ReplicationsClient 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 NewReplicationsClientWithBaseURI(baseURI string, subscriptionID string) ReplicationsClient { - return ReplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replication - the parameters for creating a replication. -func (client ReplicationsClient) Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (result ReplicationsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, replicationName, replication) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ReplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replication), - 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 ReplicationsClient) CreateSender(req *http.Request) (future ReplicationsCreateFuture, 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 ReplicationsClient) CreateResponder(resp *http.Response) (result Replication, 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 a replication from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result ReplicationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ReplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) DeleteSender(req *http.Request) (future ReplicationsDeleteFuture, 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 ReplicationsClient) 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 the properties of the specified replication. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result Replication, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) 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 ReplicationsClient) GetResponder(resp *http.Response) (result Replication, 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 the replications for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ReplicationsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.List") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ReplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/replications", 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 ReplicationsClient) 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 ReplicationsClient) ListResponder(resp *http.Response) (result ReplicationListResult, 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 ReplicationsClient) listNextResults(ctx context.Context, lastResults ReplicationListResult) (result ReplicationListResult, err error) { - req, err := lastResults.replicationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "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, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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, registryName) - return -} - -// Update updates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replicationUpdateParameters - the parameters for updating a replication. -func (client ReplicationsClient) Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (result ReplicationsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ReplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replicationUpdateParameters), - 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 ReplicationsClient) UpdateSender(req *http.Request) (future ReplicationsUpdateFuture, 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 ReplicationsClient) UpdateResponder(resp *http.Response) (result Replication, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/runs.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/runs.go deleted file mode 100644 index 7035b1e3c4f3..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/runs.go +++ /dev/null @@ -1,529 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RunsClient is the client for the Runs methods of the Containerregistry service. -type RunsClient struct { - BaseClient -} - -// NewRunsClient creates an instance of the RunsClient client. -func NewRunsClient(subscriptionID string) RunsClient { - return NewRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunsClientWithBaseURI creates an instance of the RunsClient 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 NewRunsClientWithBaseURI(baseURI string, subscriptionID string) RunsClient { - return RunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancel an existing run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunsCancelFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.Cancel") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Cancel", err.Error()) - } - - req, err := client.CancelPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", nil, "Failure preparing request") - return - } - - result, err = client.CancelSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", result.Response(), "Failure sending request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client RunsClient) CancelPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client RunsClient) CancelSender(req *http.Request) (future RunsCancelFuture, 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 -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client RunsClient) CancelResponder(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 gets the detailed information for a given run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result Run, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}", 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 RunsClient) 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 RunsClient) GetResponder(resp *http.Response) (result Run, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLogSasURL gets a link to download the run logs. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunGetLogResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.GetLogSasURL") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "GetLogSasURL", err.Error()) - } - - req, err := client.GetLogSasURLPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetLogSasURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure sending request") - return - } - - result, err = client.GetLogSasURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure responding to request") - return - } - - return -} - -// GetLogSasURLPreparer prepares the GetLogSasURL request. -func (client RunsClient) GetLogSasURLPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLogSasURLSender sends the GetLogSasURL request. The method will close the -// http.Response Body if it receives an error. -func (client RunsClient) GetLogSasURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLogSasURLResponder handles the response to the GetLogSasURL request. The method always -// closes the http.Response Body. -func (client RunsClient) GetLogSasURLResponder(resp *http.Response) (result RunGetLogResult, 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 the runs for a registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// filter - the runs filter to apply on the operation. Arithmetic operators are not supported. The allowed -// string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. -// top - $top is supported for get list of runs, which limits the maximum number of runs to return. -func (client RunsClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.List") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs", 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 RunsClient) 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 RunsClient) ListResponder(resp *http.Response) (result RunListResult, 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 RunsClient) listNextResults(ctx context.Context, lastResults RunListResult) (result RunListResult, err error) { - req, err := lastResults.runListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RunsClient", "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, "containerregistry.RunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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, registryName, filter, top) - return -} - -// Update patch the run properties. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -// runUpdateParameters - the run update properties. -func (client RunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (result RunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, runID, runUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}", pathParameters), - autorest.WithJSON(runUpdateParameters), - 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 RunsClient) UpdateSender(req *http.Request) (future RunsUpdateFuture, 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 RunsClient) UpdateResponder(resp *http.Response) (result Run, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/scopemaps.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/scopemaps.go deleted file mode 100644 index 70bdde72ab12..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/scopemaps.go +++ /dev/null @@ -1,545 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ScopeMapsClient is the client for the ScopeMaps methods of the Containerregistry service. -type ScopeMapsClient struct { - BaseClient -} - -// NewScopeMapsClient creates an instance of the ScopeMapsClient client. -func NewScopeMapsClient(subscriptionID string) ScopeMapsClient { - return NewScopeMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScopeMapsClientWithBaseURI creates an instance of the ScopeMapsClient 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 NewScopeMapsClientWithBaseURI(baseURI string, subscriptionID string) ScopeMapsClient { - return ScopeMapsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a scope map for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -// scopeMapCreateParameters - the parameters for creating a scope map. -func (client ScopeMapsClient) Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (result ScopeMapsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, - {TargetValue: scopeMapCreateParameters, - Constraints: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties.Actions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ScopeMapsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), - autorest.WithJSON(scopeMapCreateParameters), - 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 ScopeMapsClient) CreateSender(req *http.Request) (future ScopeMapsCreateFuture, 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 ScopeMapsClient) CreateResponder(resp *http.Response) (result ScopeMap, 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 a scope map from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -func (client ScopeMapsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMapsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, scopeMapName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScopeMapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", 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 ScopeMapsClient) DeleteSender(req *http.Request) (future ScopeMapsDeleteFuture, 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 ScopeMapsClient) 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 the properties of the specified scope map. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -func (client ScopeMapsClient) Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMap, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, scopeMapName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScopeMapsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", 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 ScopeMapsClient) 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 ScopeMapsClient) GetResponder(resp *http.Response) (result ScopeMap, 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 the scope maps for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ScopeMapsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.List") - defer func() { - sc := -1 - if result.smlr.Response.Response != nil { - sc = result.smlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.smlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure sending request") - return - } - - result.smlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure responding to request") - return - } - if result.smlr.hasNextLink() && result.smlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ScopeMapsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/scopeMaps", 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 ScopeMapsClient) 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 ScopeMapsClient) ListResponder(resp *http.Response) (result ScopeMapListResult, 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 ScopeMapsClient) listNextResults(ctx context.Context, lastResults ScopeMapListResult) (result ScopeMapListResult, err error) { - req, err := lastResults.scopeMapListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "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, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScopeMapsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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, registryName) - return -} - -// Update updates a scope map with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// scopeMapName - the name of the scope map. -// scopeMapUpdateParameters - the parameters for updating a scope map. -func (client ScopeMapsClient) Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (result ScopeMapsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: scopeMapName, - Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ScopeMapsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScopeMapsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeMapName": autorest.Encode("path", scopeMapName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), - autorest.WithJSON(scopeMapUpdateParameters), - 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 ScopeMapsClient) UpdateSender(req *http.Request) (future ScopeMapsUpdateFuture, 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 ScopeMapsClient) UpdateResponder(resp *http.Response) (result ScopeMap, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/taskruns.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/taskruns.go deleted file mode 100644 index ee13d4b2d14f..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/taskruns.go +++ /dev/null @@ -1,634 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TaskRunsClient is the client for the TaskRuns methods of the Containerregistry service. -type TaskRunsClient struct { - BaseClient -} - -// NewTaskRunsClient creates an instance of the TaskRunsClient client. -func NewTaskRunsClient(subscriptionID string) TaskRunsClient { - return NewTaskRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTaskRunsClientWithBaseURI creates an instance of the TaskRunsClient 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 NewTaskRunsClientWithBaseURI(baseURI string, subscriptionID string) TaskRunsClient { - return TaskRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task run for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -// taskRun - the parameters of a run that needs to scheduled. -func (client TaskRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (result TaskRunsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskRunName, taskRun) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TaskRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(taskRun), - 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 TaskRunsClient) CreateSender(req *http.Request) (future TaskRunsCreateFuture, 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 TaskRunsClient) CreateResponder(resp *http.Response) (result TaskRun, 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 a specified task run resource. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRunsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TaskRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) DeleteSender(req *http.Request) (future TaskRunsDeleteFuture, 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 TaskRunsClient) 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 the detailed information for a given task run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TaskRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) 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 TaskRunsClient) GetResponder(resp *http.Response) (result TaskRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails gets the detailed information for a given task run that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.GetDetails") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TaskRunsClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TaskRunsClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) GetDetailsResponder(resp *http.Response) (result TaskRun, 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 the task runs for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TaskRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.List") - defer func() { - sc := -1 - if result.trlr.Response.Response != nil { - sc = result.trlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.trlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure sending request") - return - } - - result.trlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure responding to request") - return - } - if result.trlr.hasNextLink() && result.trlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TaskRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns", 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 TaskRunsClient) 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 TaskRunsClient) ListResponder(resp *http.Response) (result TaskRunListResult, 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 TaskRunsClient) listNextResults(ctx context.Context, lastResults TaskRunListResult) (result TaskRunListResult, err error) { - req, err := lastResults.taskRunListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "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, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TaskRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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, registryName) - return -} - -// Update updates a task run with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -// updateParameters - the parameters for updating a task run. -func (client TaskRunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (result TaskRunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskRunName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TaskRunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 TaskRunsClient) UpdateSender(req *http.Request) (future TaskRunsUpdateFuture, 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 TaskRunsClient) UpdateResponder(resp *http.Response) (result TaskRun, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/tasks.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tasks.go deleted file mode 100644 index 3af51765a125..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tasks.go +++ /dev/null @@ -1,645 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TasksClient is the client for the Tasks methods of the Containerregistry service. -type TasksClient struct { - BaseClient -} - -// NewTasksClient creates an instance of the TasksClient client. -func NewTasksClient(subscriptionID string) TasksClient { - return NewTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTasksClientWithBaseURI creates an instance of the TasksClient 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 NewTasksClientWithBaseURI(baseURI string, subscriptionID string) TasksClient { - return TasksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -// taskCreateParameters - the parameters for creating a task. -func (client TasksClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (result TasksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, - {TargetValue: taskCreateParameters, - Constraints: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMaximum, Rule: int64(28800), Chain: nil}, - {Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMinimum, Rule: int64(300), Chain: nil}, - }}, - {Target: "taskCreateParameters.TaskProperties.Trigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskName, taskCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TasksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskCreateParameters), - 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 TasksClient) CreateSender(req *http.Request) (future TasksCreateFuture, 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 TasksClient) CreateResponder(resp *http.Response) (result Task, 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 a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result TasksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TasksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) DeleteSender(req *http.Request) (future TasksDeleteFuture, 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 TasksClient) 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 get the properties of a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TasksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) 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 TasksClient) GetResponder(resp *http.Response) (result Task, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails returns a task with extended information that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.GetDetails") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TasksClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TasksClient) GetDetailsResponder(resp *http.Response) (result Task, 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 the tasks for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TasksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.List") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TasksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks", 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 TasksClient) 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 TasksClient) ListResponder(resp *http.Response) (result TaskListResult, 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 TasksClient) listNextResults(ctx context.Context, lastResults TaskListResult) (result TaskListResult, err error) { - req, err := lastResults.taskListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TasksClient", "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, "containerregistry.TasksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TasksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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, registryName) - return -} - -// Update updates a task with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -// taskUpdateParameters - the parameters for updating a task. -func (client TasksClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (result TasksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TasksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskUpdateParameters), - 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 TasksClient) UpdateSender(req *http.Request) (future TasksUpdateFuture, 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 TasksClient) UpdateResponder(resp *http.Response) (result Task, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/tokens.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tokens.go deleted file mode 100644 index 82cf405d1dd8..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tokens.go +++ /dev/null @@ -1,542 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TokensClient is the client for the Tokens methods of the Containerregistry service. -type TokensClient struct { - BaseClient -} - -// NewTokensClient creates an instance of the TokensClient client. -func NewTokensClient(subscriptionID string) TokensClient { - return NewTokensClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTokensClientWithBaseURI creates an instance of the TokensClient 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 NewTokensClientWithBaseURI(baseURI string, subscriptionID string) TokensClient { - return TokensClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a token for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -// tokenCreateParameters - the parameters for creating a token. -func (client TokensClient) Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (result TokensCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TokensClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), - autorest.WithJSON(tokenCreateParameters), - 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 TokensClient) CreateSender(req *http.Request) (future TokensCreateFuture, 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 TokensClient) CreateResponder(resp *http.Response) (result Token, 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 a token from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -func (client TokensClient) Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result TokensDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, tokenName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TokensClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", 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 TokensClient) DeleteSender(req *http.Request) (future TokensDeleteFuture, 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 TokensClient) 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 the properties of the specified token. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -func (client TokensClient) Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result Token, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, tokenName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TokensClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", 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 TokensClient) 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 TokensClient) GetResponder(resp *http.Response) (result Token, 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 the tokens for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TokensClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.List") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TokensClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/tokens", 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 TokensClient) 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 TokensClient) ListResponder(resp *http.Response) (result TokenListResult, 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 TokensClient) listNextResults(ctx context.Context, lastResults TokenListResult) (result TokenListResult, err error) { - req, err := lastResults.tokenListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TokensClient", "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, "containerregistry.TokensClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TokensClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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, registryName) - return -} - -// Update updates a token with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// tokenName - the name of the token. -// tokenUpdateParameters - the parameters for updating a token. -func (client TokensClient) Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (result TokensUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: tokenName, - Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TokensClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TokensClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tokenName": autorest.Encode("path", tokenName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), - autorest.WithJSON(tokenUpdateParameters), - 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 TokensClient) UpdateSender(req *http.Request) (future TokensUpdateFuture, 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 TokensClient) UpdateResponder(resp *http.Response) (result Token, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/version.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/version.go deleted file mode 100644 index 72dd28110325..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerregistry - -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() + " containerregistry/2021-06-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/containerregistry/mgmt/2021-06-01-preview/containerregistry/webhooks.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/webhooks.go deleted file mode 100644 index 4229a1cc1dfc..000000000000 --- a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/webhooks.go +++ /dev/null @@ -1,866 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WebhooksClient is the client for the Webhooks methods of the Containerregistry service. -type WebhooksClient struct { - BaseClient -} - -// NewWebhooksClient creates an instance of the WebhooksClient client. -func NewWebhooksClient(subscriptionID string) WebhooksClient { - return NewWebhooksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhooksClientWithBaseURI creates an instance of the WebhooksClient 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 NewWebhooksClientWithBaseURI(baseURI string, subscriptionID string) WebhooksClient { - return WebhooksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a webhook for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookCreateParameters - the parameters for creating a webhook. -func (client WebhooksClient) Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (result WebhooksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookCreateParameters, - Constraints: []validation.Constraint{{Target: "webhookCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.ServiceURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client WebhooksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookCreateParameters), - 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 WebhooksClient) CreateSender(req *http.Request) (future WebhooksCreateFuture, 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 WebhooksClient) CreateResponder(resp *http.Response) (result Webhook, 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 a webhook from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result WebhooksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) DeleteSender(req *http.Request) (future WebhooksDeleteFuture, 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 WebhooksClient) 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 the properties of the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhooksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) 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 WebhooksClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCallbackConfig gets the configuration of service URI and custom headers for the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result CallbackConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.GetCallbackConfig") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "GetCallbackConfig", err.Error()) - } - - req, err := client.GetCallbackConfigPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", nil, "Failure preparing request") - return - } - - resp, err := client.GetCallbackConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure sending request") - return - } - - result, err = client.GetCallbackConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure responding to request") - return - } - - return -} - -// GetCallbackConfigPreparer prepares the GetCallbackConfig request. -func (client WebhooksClient) GetCallbackConfigPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCallbackConfigSender sends the GetCallbackConfig request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) GetCallbackConfigSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCallbackConfigResponder handles the response to the GetCallbackConfig request. The method always -// closes the http.Response Body. -func (client WebhooksClient) GetCallbackConfigResponder(resp *http.Response) (result CallbackConfig, 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 the webhooks for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client WebhooksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.List") - 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: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WebhooksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/webhooks", 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 WebhooksClient) 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 WebhooksClient) ListResponder(resp *http.Response) (result WebhookListResult, 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 WebhooksClient) listNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "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, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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, registryName) - return -} - -// ListEvents lists recent events for the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "ListEvents", err.Error()) - } - - result.fn = client.listEventsNextResults - req, err := client.ListEventsPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventsSender(req) - if err != nil { - result.elr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure sending request") - return - } - - result.elr, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure responding to request") - return - } - if result.elr.hasNextLink() && result.elr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListEventsPreparer prepares the ListEvents request. -func (client WebhooksClient) ListEventsPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventsSender sends the ListEvents request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) ListEventsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventsResponder handles the response to the ListEvents request. The method always -// closes the http.Response Body. -func (client WebhooksClient) ListEventsResponder(resp *http.Response) (result EventListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listEventsNextResults retrieves the next set of results, if any. -func (client WebhooksClient) listEventsNextResults(ctx context.Context, lastResults EventListResult) (result EventListResult, err error) { - req, err := lastResults.eventListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListEventsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListEventsComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.ListEvents(ctx, resourceGroupName, registryName, webhookName) - return -} - -// Ping triggers a ping event to be sent to the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Ping") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Ping", err.Error()) - } - - req, err := client.PingPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", nil, "Failure preparing request") - return - } - - resp, err := client.PingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure sending request") - return - } - - result, err = client.PingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure responding to request") - return - } - - return -} - -// PingPreparer prepares the Ping request. -func (client WebhooksClient) PingPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PingSender sends the Ping request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) PingSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PingResponder handles the response to the Ping request. The method always -// closes the http.Response Body. -func (client WebhooksClient) PingResponder(resp *http.Response) (result EventInfo, 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 webhook with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookUpdateParameters - the parameters for updating a webhook. -func (client WebhooksClient) Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (result WebhooksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-06-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookUpdateParameters), - 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 WebhooksClient) UpdateSender(req *http.Request) (future WebhooksUpdateFuture, 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 WebhooksClient) UpdateResponder(resp *http.Response) (result Webhook, 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/containerregistry/mgmt/2021-09-01/containerregistry/CHANGELOG.md b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/_meta.json b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/_meta.json deleted file mode 100644 index a4ba9a1b9d7e..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3587a60ea8f18e76a41e4b56b72aeddce879aae9", - "readme": "/_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "tag": "package-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-2021-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --pass-thru:schema-validator-swagger --enum-prefix /_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --pass-thru:schema-validator-swagger --enum-prefix" - } -} \ No newline at end of file diff --git a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/agentpools.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/agentpools.go deleted file mode 100644 index 1ae5928434f8..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/agentpools.go +++ /dev/null @@ -1,634 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AgentPoolsClient is the client for the AgentPools methods of the Containerregistry service. -type AgentPoolsClient struct { - BaseClient -} - -// NewAgentPoolsClient creates an instance of the AgentPoolsClient client. -func NewAgentPoolsClient(subscriptionID string) AgentPoolsClient { - return NewAgentPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgentPoolsClientWithBaseURI creates an instance of the AgentPoolsClient 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 NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) AgentPoolsClient { - return AgentPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates an agent pool for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -// agentPool - the parameters of an agent pool that needs to scheduled. -func (client AgentPoolsClient) Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (result AgentPoolsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, agentPoolName, agentPool) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AgentPoolsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(agentPool), - 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 AgentPoolsClient) CreateSender(req *http.Request) (future AgentPoolsCreateFuture, 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 AgentPoolsClient) CreateResponder(resp *http.Response) (result AgentPool, 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 a specified agent pool resource. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) DeleteSender(req *http.Request) (future AgentPoolsDeleteFuture, 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 AgentPoolsClient) 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 the detailed information for a given agent pool. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) 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 AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetQueueStatus gets the count of queued runs for a given agent pool. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolQueueStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetQueueStatus") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "GetQueueStatus", err.Error()) - } - - req, err := client.GetQueueStatusPreparer(ctx, resourceGroupName, registryName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetQueueStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure sending request") - return - } - - result, err = client.GetQueueStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetQueueStatusPreparer prepares the GetQueueStatus request. -func (client AgentPoolsClient) GetQueueStatusPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetQueueStatusSender sends the GetQueueStatus request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) GetQueueStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetQueueStatusResponder handles the response to the GetQueueStatus request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) GetQueueStatusResponder(resp *http.Response) (result AgentPoolQueueStatus, 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 the agent pools for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") - defer func() { - sc := -1 - if result.aplr.Response.Response != nil { - sc = result.aplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.aplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure sending request") - return - } - - result.aplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure responding to request") - return - } - if result.aplr.hasNextLink() && result.aplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools", 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 AgentPoolsClient) 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 AgentPoolsClient) ListResponder(resp *http.Response) (result AgentPoolListResult, 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 AgentPoolsClient) listNextResults(ctx context.Context, lastResults AgentPoolListResult) (result AgentPoolListResult, err error) { - req, err := lastResults.agentPoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "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, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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, registryName) - return -} - -// Update updates an agent pool with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// agentPoolName - the name of the agent pool. -// updateParameters - the parameters for updating an agent pool. -func (client AgentPoolsClient) Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (result AgentPoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: agentPoolName, - Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, - {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.AgentPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, agentPoolName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AgentPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 AgentPoolsClient) UpdateSender(req *http.Request) (future AgentPoolsUpdateFuture, 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 AgentPoolsClient) UpdateResponder(resp *http.Response) (result AgentPool, 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/containerregistry/mgmt/2021-09-01/containerregistry/client.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/client.go deleted file mode 100644 index 79937e123765..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerregistry implements the Azure ARM Containerregistry service API version . -// -// -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Containerregistry - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerregistry. -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/containerregistry/mgmt/2021-09-01/containerregistry/containerregistryapi/interfaces.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/containerregistryapi/interfaces.go deleted file mode 100644 index 4f36398c2b39..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/containerregistryapi/interfaces.go +++ /dev/null @@ -1,134 +0,0 @@ -package containerregistryapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/containerregistry/mgmt/2021-09-01/containerregistry" -) - -// RegistriesClientAPI contains the set of methods on the RegistriesClient type. -type RegistriesClientAPI interface { - CheckNameAvailability(ctx context.Context, registryNameCheckRequest containerregistry.RegistryNameCheckRequest) (result containerregistry.RegistryNameStatus, err error) - Create(ctx context.Context, resourceGroupName string, registryName string, registry containerregistry.Registry) (result containerregistry.RegistriesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistriesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.Registry, err error) - GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.SourceUploadDefinition, err error) - GetPrivateLinkResource(ctx context.Context, resourceGroupName string, registryName string, groupName string) (result containerregistry.PrivateLinkResource, err error) - ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters containerregistry.ImportImageParameters) (result containerregistry.RegistriesImportImageFuture, err error) - List(ctx context.Context) (result containerregistry.RegistryListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.RegistryListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultIterator, err error) - ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryListCredentialsResult, err error) - ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultPage, err error) - ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultIterator, err error) - ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryUsageListResult, err error) - RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters containerregistry.RegenerateCredentialParameters) (result containerregistry.RegistryListCredentialsResult, err error) - ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest containerregistry.BasicRunRequest) (result containerregistry.RegistriesScheduleRunFuture, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters containerregistry.RegistryUpdateParameters) (result containerregistry.RegistriesUpdateFuture, err error) -} - -var _ RegistriesClientAPI = (*containerregistry.RegistriesClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result containerregistry.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result containerregistry.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*containerregistry.OperationsClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection containerregistry.PrivateEndpointConnection) (result containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnection, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*containerregistry.PrivateEndpointConnectionsClient)(nil) - -// ReplicationsClientAPI contains the set of methods on the ReplicationsClient type. -type ReplicationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication containerregistry.Replication) (result containerregistry.ReplicationsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.ReplicationsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.Replication, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters containerregistry.ReplicationUpdateParameters) (result containerregistry.ReplicationsUpdateFuture, err error) -} - -var _ ReplicationsClientAPI = (*containerregistry.ReplicationsClient)(nil) - -// WebhooksClientAPI contains the set of methods on the WebhooksClient type. -type WebhooksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters containerregistry.WebhookCreateParameters) (result containerregistry.WebhooksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.WebhooksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.Webhook, err error) - GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.CallbackConfig, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultIterator, err error) - ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultPage, err error) - ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultIterator, err error) - Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventInfo, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters containerregistry.WebhookUpdateParameters) (result containerregistry.WebhooksUpdateFuture, err error) -} - -var _ WebhooksClientAPI = (*containerregistry.WebhooksClient)(nil) - -// AgentPoolsClientAPI contains the set of methods on the AgentPoolsClient type. -type AgentPoolsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool containerregistry.AgentPool) (result containerregistry.AgentPoolsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPool, err error) - GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolQueueStatus, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters containerregistry.AgentPoolUpdateParameters) (result containerregistry.AgentPoolsUpdateFuture, err error) -} - -var _ AgentPoolsClientAPI = (*containerregistry.AgentPoolsClient)(nil) - -// RunsClientAPI contains the set of methods on the RunsClient type. -type RunsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunsCancelFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.Run, err error) - GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunGetLogResult, err error) - List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters containerregistry.RunUpdateParameters) (result containerregistry.RunsUpdateFuture, err error) -} - -var _ RunsClientAPI = (*containerregistry.RunsClient)(nil) - -// TaskRunsClientAPI contains the set of methods on the TaskRunsClient type. -type TaskRunsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun containerregistry.TaskRun) (result containerregistry.TaskRunsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRunsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) - GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters containerregistry.TaskRunUpdateParameters) (result containerregistry.TaskRunsUpdateFuture, err error) -} - -var _ TaskRunsClientAPI = (*containerregistry.TaskRunsClient)(nil) - -// TasksClientAPI contains the set of methods on the TasksClient type. -type TasksClientAPI interface { - Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters containerregistry.Task) (result containerregistry.TasksCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.TasksDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) - GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) - List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters containerregistry.TaskUpdateParameters) (result containerregistry.TasksUpdateFuture, err error) -} - -var _ TasksClientAPI = (*containerregistry.TasksClient)(nil) diff --git a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/enums.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/enums.go deleted file mode 100644 index 52aef98384d4..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/enums.go +++ /dev/null @@ -1,679 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Action enumerates the values for action. -type Action string - -const ( - // ActionAllow ... - ActionAllow Action = "Allow" -) - -// PossibleActionValues returns an array of possible values for the Action const type. -func PossibleActionValues() []Action { - return []Action{ActionAllow} -} - -// ActionsRequired enumerates the values for actions required. -type ActionsRequired string - -const ( - // ActionsRequiredNone ... - ActionsRequiredNone ActionsRequired = "None" - // ActionsRequiredRecreate ... - ActionsRequiredRecreate ActionsRequired = "Recreate" -) - -// PossibleActionsRequiredValues returns an array of possible values for the ActionsRequired const type. -func PossibleActionsRequiredValues() []ActionsRequired { - return []ActionsRequired{ActionsRequiredNone, ActionsRequiredRecreate} -} - -// Architecture enumerates the values for architecture. -type Architecture string - -const ( - // ArchitectureAmd64 ... - ArchitectureAmd64 Architecture = "amd64" - // ArchitectureArm ... - ArchitectureArm Architecture = "arm" - // ArchitectureArm64 ... - ArchitectureArm64 Architecture = "arm64" - // ArchitectureThreeEightSix ... - ArchitectureThreeEightSix Architecture = "386" - // ArchitectureX86 ... - ArchitectureX86 Architecture = "x86" -) - -// PossibleArchitectureValues returns an array of possible values for the Architecture const type. -func PossibleArchitectureValues() []Architecture { - return []Architecture{ArchitectureAmd64, ArchitectureArm, ArchitectureArm64, ArchitectureThreeEightSix, ArchitectureX86} -} - -// BaseImageDependencyType enumerates the values for base image dependency type. -type BaseImageDependencyType string - -const ( - // BaseImageDependencyTypeBuildTime ... - BaseImageDependencyTypeBuildTime BaseImageDependencyType = "BuildTime" - // BaseImageDependencyTypeRunTime ... - BaseImageDependencyTypeRunTime BaseImageDependencyType = "RunTime" -) - -// PossibleBaseImageDependencyTypeValues returns an array of possible values for the BaseImageDependencyType const type. -func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { - return []BaseImageDependencyType{BaseImageDependencyTypeBuildTime, BaseImageDependencyTypeRunTime} -} - -// BaseImageTriggerType enumerates the values for base image trigger type. -type BaseImageTriggerType string - -const ( - // BaseImageTriggerTypeAll ... - BaseImageTriggerTypeAll BaseImageTriggerType = "All" - // BaseImageTriggerTypeRuntime ... - BaseImageTriggerTypeRuntime BaseImageTriggerType = "Runtime" -) - -// PossibleBaseImageTriggerTypeValues returns an array of possible values for the BaseImageTriggerType const type. -func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { - return []BaseImageTriggerType{BaseImageTriggerTypeAll, BaseImageTriggerTypeRuntime} -} - -// ConnectionStatus enumerates the values for connection status. -type ConnectionStatus string - -const ( - // ConnectionStatusApproved ... - ConnectionStatusApproved ConnectionStatus = "Approved" - // ConnectionStatusDisconnected ... - ConnectionStatusDisconnected ConnectionStatus = "Disconnected" - // ConnectionStatusPending ... - ConnectionStatusPending ConnectionStatus = "Pending" - // ConnectionStatusRejected ... - ConnectionStatusRejected ConnectionStatus = "Rejected" -) - -// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. -func PossibleConnectionStatusValues() []ConnectionStatus { - return []ConnectionStatus{ConnectionStatusApproved, ConnectionStatusDisconnected, ConnectionStatusPending, ConnectionStatusRejected} -} - -// 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} -} - -// DefaultAction enumerates the values for default action. -type DefaultAction string - -const ( - // DefaultActionAllow ... - DefaultActionAllow DefaultAction = "Allow" - // DefaultActionDeny ... - DefaultActionDeny DefaultAction = "Deny" -) - -// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. -func PossibleDefaultActionValues() []DefaultAction { - return []DefaultAction{DefaultActionAllow, DefaultActionDeny} -} - -// EncryptionStatus enumerates the values for encryption status. -type EncryptionStatus string - -const ( - // EncryptionStatusDisabled ... - EncryptionStatusDisabled EncryptionStatus = "disabled" - // EncryptionStatusEnabled ... - EncryptionStatusEnabled EncryptionStatus = "enabled" -) - -// PossibleEncryptionStatusValues returns an array of possible values for the EncryptionStatus const type. -func PossibleEncryptionStatusValues() []EncryptionStatus { - return []EncryptionStatus{EncryptionStatusDisabled, EncryptionStatusEnabled} -} - -// ExportPolicyStatus enumerates the values for export policy status. -type ExportPolicyStatus string - -const ( - // ExportPolicyStatusDisabled ... - ExportPolicyStatusDisabled ExportPolicyStatus = "disabled" - // ExportPolicyStatusEnabled ... - ExportPolicyStatusEnabled ExportPolicyStatus = "enabled" -) - -// PossibleExportPolicyStatusValues returns an array of possible values for the ExportPolicyStatus const type. -func PossibleExportPolicyStatusValues() []ExportPolicyStatus { - return []ExportPolicyStatus{ExportPolicyStatusDisabled, ExportPolicyStatusEnabled} -} - -// ImportMode enumerates the values for import mode. -type ImportMode string - -const ( - // ImportModeForce ... - ImportModeForce ImportMode = "Force" - // ImportModeNoForce ... - ImportModeNoForce ImportMode = "NoForce" -) - -// PossibleImportModeValues returns an array of possible values for the ImportMode const type. -func PossibleImportModeValues() []ImportMode { - return []ImportMode{ImportModeForce, ImportModeNoForce} -} - -// LastModifiedByType enumerates the values for last modified by type. -type LastModifiedByType string - -const ( - // LastModifiedByTypeApplication ... - LastModifiedByTypeApplication LastModifiedByType = "Application" - // LastModifiedByTypeKey ... - LastModifiedByTypeKey LastModifiedByType = "Key" - // LastModifiedByTypeManagedIdentity ... - LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" - // LastModifiedByTypeUser ... - LastModifiedByTypeUser LastModifiedByType = "User" -) - -// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. -func PossibleLastModifiedByTypeValues() []LastModifiedByType { - return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} -} - -// NetworkRuleBypassOptions enumerates the values for network rule bypass options. -type NetworkRuleBypassOptions string - -const ( - // NetworkRuleBypassOptionsAzureServices ... - NetworkRuleBypassOptionsAzureServices NetworkRuleBypassOptions = "AzureServices" - // NetworkRuleBypassOptionsNone ... - NetworkRuleBypassOptionsNone NetworkRuleBypassOptions = "None" -) - -// PossibleNetworkRuleBypassOptionsValues returns an array of possible values for the NetworkRuleBypassOptions const type. -func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { - return []NetworkRuleBypassOptions{NetworkRuleBypassOptionsAzureServices, NetworkRuleBypassOptionsNone} -} - -// OS enumerates the values for os. -type OS string - -const ( - // OSLinux ... - OSLinux OS = "Linux" - // OSWindows ... - OSWindows OS = "Windows" -) - -// PossibleOSValues returns an array of possible values for the OS const type. -func PossibleOSValues() []OS { - return []OS{OSLinux, OSWindows} -} - -// PasswordName enumerates the values for password name. -type PasswordName string - -const ( - // PasswordNamePassword ... - PasswordNamePassword PasswordName = "password" - // PasswordNamePassword2 ... - PasswordNamePassword2 PasswordName = "password2" -) - -// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type. -func PossiblePasswordNameValues() []PasswordName { - return []PasswordName{PasswordNamePassword, PasswordNamePassword2} -} - -// PolicyStatus enumerates the values for policy status. -type PolicyStatus string - -const ( - // PolicyStatusDisabled ... - PolicyStatusDisabled PolicyStatus = "disabled" - // PolicyStatusEnabled ... - PolicyStatusEnabled PolicyStatus = "enabled" -) - -// PossiblePolicyStatusValues returns an array of possible values for the PolicyStatus const type. -func PossiblePolicyStatusValues() []PolicyStatus { - return []PolicyStatus{PolicyStatusDisabled, PolicyStatusEnabled} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// RegistryUsageUnit enumerates the values for registry usage unit. -type RegistryUsageUnit string - -const ( - // RegistryUsageUnitBytes ... - RegistryUsageUnitBytes RegistryUsageUnit = "Bytes" - // RegistryUsageUnitCount ... - RegistryUsageUnitCount RegistryUsageUnit = "Count" -) - -// PossibleRegistryUsageUnitValues returns an array of possible values for the RegistryUsageUnit const type. -func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { - return []RegistryUsageUnit{RegistryUsageUnitBytes, RegistryUsageUnitCount} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// RunStatus enumerates the values for run status. -type RunStatus string - -const ( - // RunStatusCanceled ... - RunStatusCanceled RunStatus = "Canceled" - // RunStatusError ... - RunStatusError RunStatus = "Error" - // RunStatusFailed ... - RunStatusFailed RunStatus = "Failed" - // RunStatusQueued ... - RunStatusQueued RunStatus = "Queued" - // RunStatusRunning ... - RunStatusRunning RunStatus = "Running" - // RunStatusStarted ... - RunStatusStarted RunStatus = "Started" - // RunStatusSucceeded ... - RunStatusSucceeded RunStatus = "Succeeded" - // RunStatusTimeout ... - RunStatusTimeout RunStatus = "Timeout" -) - -// PossibleRunStatusValues returns an array of possible values for the RunStatus const type. -func PossibleRunStatusValues() []RunStatus { - return []RunStatus{RunStatusCanceled, RunStatusError, RunStatusFailed, RunStatusQueued, RunStatusRunning, RunStatusStarted, RunStatusSucceeded, RunStatusTimeout} -} - -// RunType enumerates the values for run type. -type RunType string - -const ( - // RunTypeAutoBuild ... - RunTypeAutoBuild RunType = "AutoBuild" - // RunTypeAutoRun ... - RunTypeAutoRun RunType = "AutoRun" - // RunTypeQuickBuild ... - RunTypeQuickBuild RunType = "QuickBuild" - // RunTypeQuickRun ... - RunTypeQuickRun RunType = "QuickRun" -) - -// PossibleRunTypeValues returns an array of possible values for the RunType const type. -func PossibleRunTypeValues() []RunType { - return []RunType{RunTypeAutoBuild, RunTypeAutoRun, RunTypeQuickBuild, RunTypeQuickRun} -} - -// SecretObjectType enumerates the values for secret object type. -type SecretObjectType string - -const ( - // SecretObjectTypeOpaque ... - SecretObjectTypeOpaque SecretObjectType = "Opaque" - // SecretObjectTypeVaultsecret ... - SecretObjectTypeVaultsecret SecretObjectType = "Vaultsecret" -) - -// PossibleSecretObjectTypeValues returns an array of possible values for the SecretObjectType const type. -func PossibleSecretObjectTypeValues() []SecretObjectType { - return []SecretObjectType{SecretObjectTypeOpaque, SecretObjectTypeVaultsecret} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameBasic ... - SkuNameBasic SkuName = "Basic" - // SkuNameClassic ... - SkuNameClassic SkuName = "Classic" - // SkuNamePremium ... - SkuNamePremium SkuName = "Premium" - // SkuNameStandard ... - SkuNameStandard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameBasic, SkuNameClassic, SkuNamePremium, SkuNameStandard} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic ... - SkuTierBasic SkuTier = "Basic" - // SkuTierClassic ... - SkuTierClassic SkuTier = "Classic" - // SkuTierPremium ... - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBasic, SkuTierClassic, SkuTierPremium, SkuTierStandard} -} - -// SourceControlType enumerates the values for source control type. -type SourceControlType string - -const ( - // SourceControlTypeGithub ... - SourceControlTypeGithub SourceControlType = "Github" - // SourceControlTypeVisualStudioTeamService ... - SourceControlTypeVisualStudioTeamService SourceControlType = "VisualStudioTeamService" -) - -// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. -func PossibleSourceControlTypeValues() []SourceControlType { - return []SourceControlType{SourceControlTypeGithub, SourceControlTypeVisualStudioTeamService} -} - -// SourceRegistryLoginMode enumerates the values for source registry login mode. -type SourceRegistryLoginMode string - -const ( - // SourceRegistryLoginModeDefault ... - SourceRegistryLoginModeDefault SourceRegistryLoginMode = "Default" - // SourceRegistryLoginModeNone ... - SourceRegistryLoginModeNone SourceRegistryLoginMode = "None" -) - -// PossibleSourceRegistryLoginModeValues returns an array of possible values for the SourceRegistryLoginMode const type. -func PossibleSourceRegistryLoginModeValues() []SourceRegistryLoginMode { - return []SourceRegistryLoginMode{SourceRegistryLoginModeDefault, SourceRegistryLoginModeNone} -} - -// SourceTriggerEvent enumerates the values for source trigger event. -type SourceTriggerEvent string - -const ( - // SourceTriggerEventCommit ... - SourceTriggerEventCommit SourceTriggerEvent = "commit" - // SourceTriggerEventPullrequest ... - SourceTriggerEventPullrequest SourceTriggerEvent = "pullrequest" -) - -// PossibleSourceTriggerEventValues returns an array of possible values for the SourceTriggerEvent const type. -func PossibleSourceTriggerEventValues() []SourceTriggerEvent { - return []SourceTriggerEvent{SourceTriggerEventCommit, SourceTriggerEventPullrequest} -} - -// TaskStatus enumerates the values for task status. -type TaskStatus string - -const ( - // TaskStatusDisabled ... - TaskStatusDisabled TaskStatus = "Disabled" - // TaskStatusEnabled ... - TaskStatusEnabled TaskStatus = "Enabled" -) - -// PossibleTaskStatusValues returns an array of possible values for the TaskStatus const type. -func PossibleTaskStatusValues() []TaskStatus { - return []TaskStatus{TaskStatusDisabled, TaskStatusEnabled} -} - -// TokenType enumerates the values for token type. -type TokenType string - -const ( - // TokenTypeOAuth ... - TokenTypeOAuth TokenType = "OAuth" - // TokenTypePAT ... - TokenTypePAT TokenType = "PAT" -) - -// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. -func PossibleTokenTypeValues() []TokenType { - return []TokenType{TokenTypeOAuth, TokenTypePAT} -} - -// TriggerStatus enumerates the values for trigger status. -type TriggerStatus string - -const ( - // TriggerStatusDisabled ... - TriggerStatusDisabled TriggerStatus = "Disabled" - // TriggerStatusEnabled ... - TriggerStatusEnabled TriggerStatus = "Enabled" -) - -// PossibleTriggerStatusValues returns an array of possible values for the TriggerStatus const type. -func PossibleTriggerStatusValues() []TriggerStatus { - return []TriggerStatus{TriggerStatusDisabled, TriggerStatusEnabled} -} - -// TrustPolicyType enumerates the values for trust policy type. -type TrustPolicyType string - -const ( - // TrustPolicyTypeNotary ... - TrustPolicyTypeNotary TrustPolicyType = "Notary" -) - -// PossibleTrustPolicyTypeValues returns an array of possible values for the TrustPolicyType const type. -func PossibleTrustPolicyTypeValues() []TrustPolicyType { - return []TrustPolicyType{TrustPolicyTypeNotary} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeDockerBuildRequest ... - TypeDockerBuildRequest Type = "DockerBuildRequest" - // TypeEncodedTaskRunRequest ... - TypeEncodedTaskRunRequest Type = "EncodedTaskRunRequest" - // TypeFileTaskRunRequest ... - TypeFileTaskRunRequest Type = "FileTaskRunRequest" - // TypeRunRequest ... - TypeRunRequest Type = "RunRequest" - // TypeTaskRunRequest ... - TypeTaskRunRequest Type = "TaskRunRequest" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeDockerBuildRequest, TypeEncodedTaskRunRequest, TypeFileTaskRunRequest, TypeRunRequest, TypeTaskRunRequest} -} - -// TypeBasicTaskStepProperties enumerates the values for type basic task step properties. -type TypeBasicTaskStepProperties string - -const ( - // TypeBasicTaskStepPropertiesTypeDocker ... - TypeBasicTaskStepPropertiesTypeDocker TypeBasicTaskStepProperties = "Docker" - // TypeBasicTaskStepPropertiesTypeEncodedTask ... - TypeBasicTaskStepPropertiesTypeEncodedTask TypeBasicTaskStepProperties = "EncodedTask" - // TypeBasicTaskStepPropertiesTypeFileTask ... - TypeBasicTaskStepPropertiesTypeFileTask TypeBasicTaskStepProperties = "FileTask" - // TypeBasicTaskStepPropertiesTypeTaskStepProperties ... - TypeBasicTaskStepPropertiesTypeTaskStepProperties TypeBasicTaskStepProperties = "TaskStepProperties" -) - -// PossibleTypeBasicTaskStepPropertiesValues returns an array of possible values for the TypeBasicTaskStepProperties const type. -func PossibleTypeBasicTaskStepPropertiesValues() []TypeBasicTaskStepProperties { - return []TypeBasicTaskStepProperties{TypeBasicTaskStepPropertiesTypeDocker, TypeBasicTaskStepPropertiesTypeEncodedTask, TypeBasicTaskStepPropertiesTypeFileTask, TypeBasicTaskStepPropertiesTypeTaskStepProperties} -} - -// TypeBasicTaskStepUpdateParameters enumerates the values for type basic task step update parameters. -type TypeBasicTaskStepUpdateParameters string - -const ( - // TypeBasicTaskStepUpdateParametersTypeDocker ... - TypeBasicTaskStepUpdateParametersTypeDocker TypeBasicTaskStepUpdateParameters = "Docker" - // TypeBasicTaskStepUpdateParametersTypeEncodedTask ... - TypeBasicTaskStepUpdateParametersTypeEncodedTask TypeBasicTaskStepUpdateParameters = "EncodedTask" - // TypeBasicTaskStepUpdateParametersTypeFileTask ... - TypeBasicTaskStepUpdateParametersTypeFileTask TypeBasicTaskStepUpdateParameters = "FileTask" - // TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters ... - TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters TypeBasicTaskStepUpdateParameters = "TaskStepUpdateParameters" -) - -// PossibleTypeBasicTaskStepUpdateParametersValues returns an array of possible values for the TypeBasicTaskStepUpdateParameters const type. -func PossibleTypeBasicTaskStepUpdateParametersValues() []TypeBasicTaskStepUpdateParameters { - return []TypeBasicTaskStepUpdateParameters{TypeBasicTaskStepUpdateParametersTypeDocker, TypeBasicTaskStepUpdateParametersTypeEncodedTask, TypeBasicTaskStepUpdateParametersTypeFileTask, TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters} -} - -// UpdateTriggerPayloadType enumerates the values for update trigger payload type. -type UpdateTriggerPayloadType string - -const ( - // UpdateTriggerPayloadTypeDefault ... - UpdateTriggerPayloadTypeDefault UpdateTriggerPayloadType = "Default" - // UpdateTriggerPayloadTypeToken ... - UpdateTriggerPayloadTypeToken UpdateTriggerPayloadType = "Token" -) - -// PossibleUpdateTriggerPayloadTypeValues returns an array of possible values for the UpdateTriggerPayloadType const type. -func PossibleUpdateTriggerPayloadTypeValues() []UpdateTriggerPayloadType { - return []UpdateTriggerPayloadType{UpdateTriggerPayloadTypeDefault, UpdateTriggerPayloadTypeToken} -} - -// Variant enumerates the values for variant. -type Variant string - -const ( - // VariantV6 ... - VariantV6 Variant = "v6" - // VariantV7 ... - VariantV7 Variant = "v7" - // VariantV8 ... - VariantV8 Variant = "v8" -) - -// PossibleVariantValues returns an array of possible values for the Variant const type. -func PossibleVariantValues() []Variant { - return []Variant{VariantV6, VariantV7, VariantV8} -} - -// WebhookAction enumerates the values for webhook action. -type WebhookAction string - -const ( - // WebhookActionChartDelete ... - WebhookActionChartDelete WebhookAction = "chart_delete" - // WebhookActionChartPush ... - WebhookActionChartPush WebhookAction = "chart_push" - // WebhookActionDelete ... - WebhookActionDelete WebhookAction = "delete" - // WebhookActionPush ... - WebhookActionPush WebhookAction = "push" - // WebhookActionQuarantine ... - WebhookActionQuarantine WebhookAction = "quarantine" -) - -// PossibleWebhookActionValues returns an array of possible values for the WebhookAction const type. -func PossibleWebhookActionValues() []WebhookAction { - return []WebhookAction{WebhookActionChartDelete, WebhookActionChartPush, WebhookActionDelete, WebhookActionPush, WebhookActionQuarantine} -} - -// WebhookStatus enumerates the values for webhook status. -type WebhookStatus string - -const ( - // WebhookStatusDisabled ... - WebhookStatusDisabled WebhookStatus = "disabled" - // WebhookStatusEnabled ... - WebhookStatusEnabled WebhookStatus = "enabled" -) - -// PossibleWebhookStatusValues returns an array of possible values for the WebhookStatus const type. -func PossibleWebhookStatusValues() []WebhookStatus { - return []WebhookStatus{WebhookStatusDisabled, WebhookStatusEnabled} -} - -// ZoneRedundancy enumerates the values for zone redundancy. -type ZoneRedundancy string - -const ( - // ZoneRedundancyDisabled ... - ZoneRedundancyDisabled ZoneRedundancy = "Disabled" - // ZoneRedundancyEnabled ... - ZoneRedundancyEnabled ZoneRedundancy = "Enabled" -) - -// PossibleZoneRedundancyValues returns an array of possible values for the ZoneRedundancy const type. -func PossibleZoneRedundancyValues() []ZoneRedundancy { - return []ZoneRedundancy{ZoneRedundancyDisabled, ZoneRedundancyEnabled} -} diff --git a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/models.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/models.go deleted file mode 100644 index beb6f400d613..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/models.go +++ /dev/null @@ -1,7237 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/containerregistry/mgmt/2021-09-01/containerregistry" - -// Actor the agent that initiated the event. For most situations, this could be from the authorization -// context of the request. -type Actor struct { - // Name - The subject or username associated with the request context that generated the event. - Name *string `json:"name,omitempty"` -} - -// AgentPool the agentpool that has the ARM resource and properties. -// The agentpool will have all information to create an agent pool. -type AgentPool struct { - autorest.Response `json:"-"` - // AgentPoolProperties - The properties associated with the agent pool - *AgentPoolProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPool. -func (ap AgentPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.AgentPoolProperties != nil { - objectMap["properties"] = ap.AgentPoolProperties - } - if ap.Location != nil { - objectMap["location"] = ap.Location - } - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPool struct. -func (ap *AgentPool) 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 agentPoolProperties AgentPoolProperties - err = json.Unmarshal(*v, &agentPoolProperties) - if err != nil { - return err - } - ap.AgentPoolProperties = &agentPoolProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ap.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ap.SystemData = &systemData - } - } - } - - return nil -} - -// AgentPoolListResult the collection of agent pools. -type AgentPoolListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]AgentPool `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. -type AgentPoolListResultIterator struct { - i int - page AgentPoolListResultPage -} - -// 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 *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.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 *AgentPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AgentPoolListResultIterator) 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 AgentPoolListResultIterator) Response() AgentPoolListResult { - 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 AgentPoolListResultIterator) Value() AgentPool { - if !iter.page.NotDone() { - return AgentPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AgentPoolListResultIterator type. -func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { - return AgentPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aplr AgentPoolListResult) IsEmpty() bool { - return aplr.Value == nil || len(*aplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aplr AgentPoolListResult) hasNextLink() bool { - return aplr.NextLink != nil && len(*aplr.NextLink) != 0 -} - -// agentPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aplr.NextLink))) -} - -// AgentPoolListResultPage contains a page of AgentPool values. -type AgentPoolListResultPage struct { - fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) - aplr AgentPoolListResult -} - -// 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 *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.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.aplr) - if err != nil { - return err - } - page.aplr = 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 *AgentPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AgentPoolListResultPage) NotDone() bool { - return !page.aplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AgentPoolListResultPage) Response() AgentPoolListResult { - return page.aplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AgentPoolListResultPage) Values() []AgentPool { - if page.aplr.IsEmpty() { - return nil - } - return *page.aplr.Value -} - -// Creates a new instance of the AgentPoolListResultPage type. -func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { - return AgentPoolListResultPage{ - fn: getNextPage, - aplr: cur, - } -} - -// AgentPoolProperties the properties of agent pool. -type AgentPoolProperties struct { - // Count - The count of agent machine - Count *int32 `json:"count,omitempty"` - // Tier - The Tier of agent machine - Tier *string `json:"tier,omitempty"` - // Os - The OS of agent machine. Possible values include: 'OSWindows', 'OSLinux' - Os OS `json:"os,omitempty"` - // VirtualNetworkSubnetResourceID - The Virtual Network Subnet Resource Id of the agent machine - VirtualNetworkSubnetResourceID *string `json:"virtualNetworkSubnetResourceId,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of this agent pool. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolProperties. -func (app AgentPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if app.Count != nil { - objectMap["count"] = app.Count - } - if app.Tier != nil { - objectMap["tier"] = app.Tier - } - if app.Os != "" { - objectMap["os"] = app.Os - } - if app.VirtualNetworkSubnetResourceID != nil { - objectMap["virtualNetworkSubnetResourceId"] = app.VirtualNetworkSubnetResourceID - } - return json.Marshal(objectMap) -} - -// AgentPoolPropertiesUpdateParameters ... -type AgentPoolPropertiesUpdateParameters struct { - // Count - The count of agent machine - Count *int32 `json:"count,omitempty"` -} - -// AgentPoolQueueStatus the QueueStatus of Agent Pool -type AgentPoolQueueStatus struct { - autorest.Response `json:"-"` - // Count - The number of pending runs in the queue - Count *int32 `json:"count,omitempty"` -} - -// AgentPoolsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsCreateFuture) 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 AgentPoolsCreateFuture.Result. -func (future *AgentPoolsCreateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.CreateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsDeleteFuture) 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 AgentPoolsDeleteFuture.Result. -func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AgentPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsUpdateFuture) 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 AgentPoolsUpdateFuture.Result. -func (future *AgentPoolsUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.UpdateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolUpdateParameters the parameters for updating an agent pool. -type AgentPoolUpdateParameters struct { - // AgentPoolPropertiesUpdateParameters - The properties associated with the agent pool - *AgentPoolPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AgentPoolUpdateParameters. -func (apup AgentPoolUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apup.AgentPoolPropertiesUpdateParameters != nil { - objectMap["properties"] = apup.AgentPoolPropertiesUpdateParameters - } - if apup.Tags != nil { - objectMap["tags"] = apup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPoolUpdateParameters struct. -func (apup *AgentPoolUpdateParameters) 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 agentPoolPropertiesUpdateParameters AgentPoolPropertiesUpdateParameters - err = json.Unmarshal(*v, &agentPoolPropertiesUpdateParameters) - if err != nil { - return err - } - apup.AgentPoolPropertiesUpdateParameters = &agentPoolPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - apup.Tags = tags - } - } - } - - return nil -} - -// AgentProperties the properties that determine the run agent configuration. -type AgentProperties struct { - // CPU - The CPU configuration in terms of number of cores required for the run. - CPU *int32 `json:"cpu,omitempty"` -} - -// Argument the properties of a run argument. -type Argument struct { - // Name - The name of the argument. - Name *string `json:"name,omitempty"` - // Value - The value of the argument. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// AuthInfo the authorization properties for accessing the source code repository. -type AuthInfo struct { - // TokenType - The type of Auth token. Possible values include: 'TokenTypePAT', 'TokenTypeOAuth' - TokenType TokenType `json:"tokenType,omitempty"` - // Token - The access token used to access the source control provider. - Token *string `json:"token,omitempty"` - // RefreshToken - The refresh token used to refresh the access token. - RefreshToken *string `json:"refreshToken,omitempty"` - // Scope - The scope of the access token. - Scope *string `json:"scope,omitempty"` - // ExpiresIn - Time in seconds that the token remains valid - ExpiresIn *int32 `json:"expiresIn,omitempty"` -} - -// AuthInfoUpdateParameters the authorization properties for accessing the source code repository. -type AuthInfoUpdateParameters struct { - // TokenType - The type of Auth token. Possible values include: 'TokenTypePAT', 'TokenTypeOAuth' - TokenType TokenType `json:"tokenType,omitempty"` - // Token - The access token used to access the source control provider. - Token *string `json:"token,omitempty"` - // RefreshToken - The refresh token used to refresh the access token. - RefreshToken *string `json:"refreshToken,omitempty"` - // Scope - The scope of the access token. - Scope *string `json:"scope,omitempty"` - // ExpiresIn - Time in seconds that the token remains valid - ExpiresIn *int32 `json:"expiresIn,omitempty"` -} - -// BaseImageDependency properties that describe a base image dependency. -type BaseImageDependency struct { - // Type - The type of the base image dependency. Possible values include: 'BaseImageDependencyTypeBuildTime', 'BaseImageDependencyTypeRunTime' - Type BaseImageDependencyType `json:"type,omitempty"` - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// BaseImageTrigger the trigger based on base image dependency. -type BaseImageTrigger struct { - // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'BaseImageTriggerTypeAll', 'BaseImageTriggerTypeRuntime' - BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` - // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' - UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// BaseImageTriggerUpdateParameters the properties for updating base image dependency trigger. -type BaseImageTriggerUpdateParameters struct { - // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'BaseImageTriggerTypeAll', 'BaseImageTriggerTypeRuntime' - BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` - // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' - UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// CallbackConfig the configuration of service URI and custom headers for the webhook. -type CallbackConfig struct { - autorest.Response `json:"-"` - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` -} - -// MarshalJSON is the custom marshaler for CallbackConfig. -func (cc CallbackConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.ServiceURI != nil { - objectMap["serviceUri"] = cc.ServiceURI - } - if cc.CustomHeaders != nil { - objectMap["customHeaders"] = cc.CustomHeaders - } - return json.Marshal(objectMap) -} - -// Credentials the parameters that describes a set of credentials that will be used when a run is invoked. -type Credentials struct { - // SourceRegistry - Describes the credential parameters for accessing the source registry. - SourceRegistry *SourceRegistryCredentials `json:"sourceRegistry,omitempty"` - // CustomRegistries - Describes the credential parameters for accessing other custom registries. The key - // for the dictionary item will be the registry login server (myregistry.azurecr.io) and - // the value of the item will be the registry credentials for accessing the registry. - CustomRegistries map[string]*CustomRegistryCredentials `json:"customRegistries"` -} - -// MarshalJSON is the custom marshaler for Credentials. -func (c Credentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.SourceRegistry != nil { - objectMap["sourceRegistry"] = c.SourceRegistry - } - if c.CustomRegistries != nil { - objectMap["customRegistries"] = c.CustomRegistries - } - return json.Marshal(objectMap) -} - -// CustomRegistryCredentials describes the credentials that will be used to access a custom registry during -// a run. -type CustomRegistryCredentials struct { - // UserName - The username for logging into the custom registry. - UserName *SecretObject `json:"userName,omitempty"` - // Password - The password for logging into the custom registry. The password is a secret - // object that allows multiple ways of providing the value for it. - Password *SecretObject `json:"password,omitempty"` - // Identity - Indicates the managed identity assigned to the custom credential. If a user-assigned identity - // this value is the Client ID. If a system-assigned identity, the value will be `system`. In - // the case of a system-assigned identity, the Client ID will be determined by the runner. This - // identity may be used to authenticate to key vault to retrieve credentials or it may be the only - // source of authentication used for accessing the registry. - Identity *string `json:"identity,omitempty"` -} - -// DockerBuildRequest the parameters for a docker quick build. -type DockerBuildRequest struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source location. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Arguments - The collection of override arguments to be used when executing the run. - Arguments *[]Argument `json:"arguments,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildRequest. -func (dbr DockerBuildRequest) MarshalJSON() ([]byte, error) { - dbr.Type = TypeDockerBuildRequest - objectMap := make(map[string]interface{}) - if dbr.ImageNames != nil { - objectMap["imageNames"] = dbr.ImageNames - } - if dbr.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbr.IsPushEnabled - } - if dbr.NoCache != nil { - objectMap["noCache"] = dbr.NoCache - } - if dbr.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbr.DockerFilePath - } - if dbr.Target != nil { - objectMap["target"] = dbr.Target - } - if dbr.Arguments != nil { - objectMap["arguments"] = dbr.Arguments - } - if dbr.Timeout != nil { - objectMap["timeout"] = dbr.Timeout - } - if dbr.Platform != nil { - objectMap["platform"] = dbr.Platform - } - if dbr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = dbr.AgentConfiguration - } - if dbr.SourceLocation != nil { - objectMap["sourceLocation"] = dbr.SourceLocation - } - if dbr.Credentials != nil { - objectMap["credentials"] = dbr.Credentials - } - if dbr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = dbr.IsArchiveEnabled - } - if dbr.AgentPoolName != nil { - objectMap["agentPoolName"] = dbr.AgentPoolName - } - if dbr.LogTemplate != nil { - objectMap["logTemplate"] = dbr.LogTemplate - } - if dbr.Type != "" { - objectMap["type"] = dbr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return &dbr, true -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for DockerBuildRequest. -func (dbr DockerBuildRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &dbr, true -} - -// DockerBuildStep the Docker build step. -type DockerBuildStep struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source context. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Arguments - The collection of override arguments to be used when executing this build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStep. -func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) { - dbs.Type = TypeBasicTaskStepPropertiesTypeDocker - objectMap := make(map[string]interface{}) - if dbs.ImageNames != nil { - objectMap["imageNames"] = dbs.ImageNames - } - if dbs.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbs.IsPushEnabled - } - if dbs.NoCache != nil { - objectMap["noCache"] = dbs.NoCache - } - if dbs.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbs.DockerFilePath - } - if dbs.Target != nil { - objectMap["target"] = dbs.Target - } - if dbs.Arguments != nil { - objectMap["arguments"] = dbs.Arguments - } - if dbs.ContextPath != nil { - objectMap["contextPath"] = dbs.ContextPath - } - if dbs.ContextAccessToken != nil { - objectMap["contextAccessToken"] = dbs.ContextAccessToken - } - if dbs.Type != "" { - objectMap["type"] = dbs.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return &dbs, true -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. -func (dbs DockerBuildStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &dbs, true -} - -// DockerBuildStepUpdateParameters the properties for updating a docker build step. -type DockerBuildStepUpdateParameters struct { - // ImageNames - The fully qualified image names including the repository and tag. - ImageNames *[]string `json:"imageNames,omitempty"` - // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - // NoCache - The value of this property indicates whether the image cache is enabled or not. - NoCache *bool `json:"noCache,omitempty"` - // DockerFilePath - The Docker file path relative to the source context. - DockerFilePath *string `json:"dockerFilePath,omitempty"` - // Arguments - The collection of override arguments to be used when executing this build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { - dbsup.Type = TypeBasicTaskStepUpdateParametersTypeDocker - objectMap := make(map[string]interface{}) - if dbsup.ImageNames != nil { - objectMap["imageNames"] = dbsup.ImageNames - } - if dbsup.IsPushEnabled != nil { - objectMap["isPushEnabled"] = dbsup.IsPushEnabled - } - if dbsup.NoCache != nil { - objectMap["noCache"] = dbsup.NoCache - } - if dbsup.DockerFilePath != nil { - objectMap["dockerFilePath"] = dbsup.DockerFilePath - } - if dbsup.Arguments != nil { - objectMap["arguments"] = dbsup.Arguments - } - if dbsup.Target != nil { - objectMap["target"] = dbsup.Target - } - if dbsup.ContextPath != nil { - objectMap["contextPath"] = dbsup.ContextPath - } - if dbsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = dbsup.ContextAccessToken - } - if dbsup.Type != "" { - objectMap["type"] = dbsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return &dbsup, true -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. -func (dbsup DockerBuildStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &dbsup, true -} - -// EncodedTaskRunRequest the parameters for a quick task run request. -type EncodedTaskRunRequest struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { - etrr.Type = TypeEncodedTaskRunRequest - objectMap := make(map[string]interface{}) - if etrr.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = etrr.EncodedTaskContent - } - if etrr.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = etrr.EncodedValuesContent - } - if etrr.Values != nil { - objectMap["values"] = etrr.Values - } - if etrr.Timeout != nil { - objectMap["timeout"] = etrr.Timeout - } - if etrr.Platform != nil { - objectMap["platform"] = etrr.Platform - } - if etrr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = etrr.AgentConfiguration - } - if etrr.SourceLocation != nil { - objectMap["sourceLocation"] = etrr.SourceLocation - } - if etrr.Credentials != nil { - objectMap["credentials"] = etrr.Credentials - } - if etrr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = etrr.IsArchiveEnabled - } - if etrr.AgentPoolName != nil { - objectMap["agentPoolName"] = etrr.AgentPoolName - } - if etrr.LogTemplate != nil { - objectMap["logTemplate"] = etrr.LogTemplate - } - if etrr.Type != "" { - objectMap["type"] = etrr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return &etrr, true -} - -// AsRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. -func (etrr EncodedTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &etrr, true -} - -// EncodedTaskStep the properties of a encoded task step. -type EncodedTaskStep struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskStep. -func (ets EncodedTaskStep) MarshalJSON() ([]byte, error) { - ets.Type = TypeBasicTaskStepPropertiesTypeEncodedTask - objectMap := make(map[string]interface{}) - if ets.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = ets.EncodedTaskContent - } - if ets.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = ets.EncodedValuesContent - } - if ets.Values != nil { - objectMap["values"] = ets.Values - } - if ets.ContextPath != nil { - objectMap["contextPath"] = ets.ContextPath - } - if ets.ContextAccessToken != nil { - objectMap["contextAccessToken"] = ets.ContextAccessToken - } - if ets.Type != "" { - objectMap["type"] = ets.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return &ets, true -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. -func (ets EncodedTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &ets, true -} - -// EncodedTaskStepUpdateParameters the properties for updating encoded task step. -type EncodedTaskStepUpdateParameters struct { - // EncodedTaskContent - Base64 encoded value of the template/definition file content. - EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` - // EncodedValuesContent - Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - etsup.Type = TypeBasicTaskStepUpdateParametersTypeEncodedTask - objectMap := make(map[string]interface{}) - if etsup.EncodedTaskContent != nil { - objectMap["encodedTaskContent"] = etsup.EncodedTaskContent - } - if etsup.EncodedValuesContent != nil { - objectMap["encodedValuesContent"] = etsup.EncodedValuesContent - } - if etsup.Values != nil { - objectMap["values"] = etsup.Values - } - if etsup.ContextPath != nil { - objectMap["contextPath"] = etsup.ContextPath - } - if etsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = etsup.ContextAccessToken - } - if etsup.Type != "" { - objectMap["type"] = etsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return &etsup, true -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. -func (etsup EncodedTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &etsup, true -} - -// EncryptionProperty ... -type EncryptionProperty struct { - // Status - Indicates whether or not the encryption is enabled for container registry. Possible values include: 'EncryptionStatusEnabled', 'EncryptionStatusDisabled' - Status EncryptionStatus `json:"status,omitempty"` - // KeyVaultProperties - Key vault properties. - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} - -// ErrorResponse an error response from the Azure Container Registry service. -type ErrorResponse struct { - // Error - Azure container registry build API error body. - Error *ErrorResponseBody `json:"error,omitempty"` -} - -// ErrorResponseBody an error response from the Azure Container Registry service. -type ErrorResponseBody struct { - // Code - error code. - Code *string `json:"code,omitempty"` - // Message - error message. - Message *string `json:"message,omitempty"` - // Target - target of the particular error. - Target *string `json:"target,omitempty"` - // Details - an array of additional nested error response info objects, as described by this contract. - Details *[]InnerErrorDescription `json:"details,omitempty"` -} - -// Event the event for a webhook. -type Event struct { - // EventRequestMessage - The event request message sent to the service URI. - EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` - // EventResponseMessage - The event response message received from the service URI. - EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventContent the content of the event request message. -type EventContent struct { - // ID - The event ID. - ID *string `json:"id,omitempty"` - // Timestamp - The time at which the event occurred. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Action - The action that encompasses the provided event. - Action *string `json:"action,omitempty"` - // Target - The target of the event. - Target *Target `json:"target,omitempty"` - // Request - The request that generated the event. - Request *Request `json:"request,omitempty"` - // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. - Actor *Actor `json:"actor,omitempty"` - // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - Source *Source `json:"source,omitempty"` -} - -// EventInfo the basic information of an event. -type EventInfo struct { - autorest.Response `json:"-"` - // ID - The event ID. - ID *string `json:"id,omitempty"` -} - -// EventListResult the result of a request to list events for a webhook. -type EventListResult struct { - autorest.Response `json:"-"` - // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - Value *[]Event `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventListResultIterator provides access to a complete listing of Event values. -type EventListResultIterator struct { - i int - page EventListResultPage -} - -// 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 *EventListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.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 *EventListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventListResultIterator) 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 EventListResultIterator) Response() EventListResult { - 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 EventListResultIterator) Value() Event { - if !iter.page.NotDone() { - return Event{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventListResultIterator type. -func NewEventListResultIterator(page EventListResultPage) EventListResultIterator { - return EventListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (elr EventListResult) IsEmpty() bool { - return elr.Value == nil || len(*elr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (elr EventListResult) hasNextLink() bool { - return elr.NextLink != nil && len(*elr.NextLink) != 0 -} - -// eventListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (elr EventListResult) eventListResultPreparer(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))) -} - -// EventListResultPage contains a page of Event values. -type EventListResultPage struct { - fn func(context.Context, EventListResult) (EventListResult, error) - elr EventListResult -} - -// 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 *EventListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.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 *EventListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventListResultPage) NotDone() bool { - return !page.elr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventListResultPage) Response() EventListResult { - return page.elr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventListResultPage) Values() []Event { - if page.elr.IsEmpty() { - return nil - } - return *page.elr.Value -} - -// Creates a new instance of the EventListResultPage type. -func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage { - return EventListResultPage{ - fn: getNextPage, - elr: cur, - } -} - -// EventRequestMessage the event request message sent to the service URI. -type EventRequestMessage struct { - // Content - The content of the event request message. - Content *EventContent `json:"content,omitempty"` - // Headers - The headers of the event request message. - Headers map[string]*string `json:"headers"` - // Method - The HTTP method used to send the event request message. - Method *string `json:"method,omitempty"` - // RequestURI - The URI used to send the event request message. - RequestURI *string `json:"requestUri,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventRequestMessage. -func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.Method != nil { - objectMap["method"] = erm.Method - } - if erm.RequestURI != nil { - objectMap["requestUri"] = erm.RequestURI - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// EventResponseMessage the event response message received from the service URI. -type EventResponseMessage struct { - // Content - The content of the event response message. - Content *string `json:"content,omitempty"` - // Headers - The headers of the event response message. - Headers map[string]*string `json:"headers"` - // ReasonPhrase - The reason phrase of the event response message. - ReasonPhrase *string `json:"reasonPhrase,omitempty"` - // StatusCode - The status code of the event response message. - StatusCode *string `json:"statusCode,omitempty"` - // Version - The HTTP message version. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventResponseMessage. -func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erm.Content != nil { - objectMap["content"] = erm.Content - } - if erm.Headers != nil { - objectMap["headers"] = erm.Headers - } - if erm.ReasonPhrase != nil { - objectMap["reasonPhrase"] = erm.ReasonPhrase - } - if erm.StatusCode != nil { - objectMap["statusCode"] = erm.StatusCode - } - if erm.Version != nil { - objectMap["version"] = erm.Version - } - return json.Marshal(objectMap) -} - -// ExportPolicy the export policy for a container registry. -type ExportPolicy struct { - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'ExportPolicyStatusEnabled', 'ExportPolicyStatusDisabled' - Status ExportPolicyStatus `json:"status,omitempty"` -} - -// FileTaskRunRequest the request parameters for a scheduling run against a task file. -type FileTaskRunRequest struct { - // TaskFilePath - The template/definition file path relative to the source. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The values/parameters file path relative to the source. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. - // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string `json:"sourceLocation,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) MarshalJSON() ([]byte, error) { - ftrr.Type = TypeFileTaskRunRequest - objectMap := make(map[string]interface{}) - if ftrr.TaskFilePath != nil { - objectMap["taskFilePath"] = ftrr.TaskFilePath - } - if ftrr.ValuesFilePath != nil { - objectMap["valuesFilePath"] = ftrr.ValuesFilePath - } - if ftrr.Values != nil { - objectMap["values"] = ftrr.Values - } - if ftrr.Timeout != nil { - objectMap["timeout"] = ftrr.Timeout - } - if ftrr.Platform != nil { - objectMap["platform"] = ftrr.Platform - } - if ftrr.AgentConfiguration != nil { - objectMap["agentConfiguration"] = ftrr.AgentConfiguration - } - if ftrr.SourceLocation != nil { - objectMap["sourceLocation"] = ftrr.SourceLocation - } - if ftrr.Credentials != nil { - objectMap["credentials"] = ftrr.Credentials - } - if ftrr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = ftrr.IsArchiveEnabled - } - if ftrr.AgentPoolName != nil { - objectMap["agentPoolName"] = ftrr.AgentPoolName - } - if ftrr.LogTemplate != nil { - objectMap["logTemplate"] = ftrr.LogTemplate - } - if ftrr.Type != "" { - objectMap["type"] = ftrr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return &ftrr, true -} - -// AsTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. -func (ftrr FileTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &ftrr, true -} - -// FileTaskStep the properties of a task step. -type FileTaskStep struct { - // TaskFilePath - The task template/definition file path relative to the source context. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The task values/parameters file path relative to the source context. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskStep. -func (fts FileTaskStep) MarshalJSON() ([]byte, error) { - fts.Type = TypeBasicTaskStepPropertiesTypeFileTask - objectMap := make(map[string]interface{}) - if fts.TaskFilePath != nil { - objectMap["taskFilePath"] = fts.TaskFilePath - } - if fts.ValuesFilePath != nil { - objectMap["valuesFilePath"] = fts.ValuesFilePath - } - if fts.Values != nil { - objectMap["values"] = fts.Values - } - if fts.ContextPath != nil { - objectMap["contextPath"] = fts.ContextPath - } - if fts.ContextAccessToken != nil { - objectMap["contextAccessToken"] = fts.ContextAccessToken - } - if fts.Type != "" { - objectMap["type"] = fts.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { - return &fts, true -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { - return nil, false -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. -func (fts FileTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &fts, true -} - -// FileTaskStepUpdateParameters the properties of updating a task step. -type FileTaskStepUpdateParameters struct { - // TaskFilePath - The task template/definition file path relative to the source context. - TaskFilePath *string `json:"taskFilePath,omitempty"` - // ValuesFilePath - The values/parameters file path relative to the source context. - ValuesFilePath *string `json:"valuesFilePath,omitempty"` - // Values - The collection of overridable values that can be passed when running a task. - Values *[]SetValue `json:"values,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - ftsup.Type = TypeBasicTaskStepUpdateParametersTypeFileTask - objectMap := make(map[string]interface{}) - if ftsup.TaskFilePath != nil { - objectMap["taskFilePath"] = ftsup.TaskFilePath - } - if ftsup.ValuesFilePath != nil { - objectMap["valuesFilePath"] = ftsup.ValuesFilePath - } - if ftsup.Values != nil { - objectMap["values"] = ftsup.Values - } - if ftsup.ContextPath != nil { - objectMap["contextPath"] = ftsup.ContextPath - } - if ftsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = ftsup.ContextAccessToken - } - if ftsup.Type != "" { - objectMap["type"] = ftsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return &ftsup, true -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return nil, false -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. -func (ftsup FileTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &ftsup, true -} - -// IdentityProperties managed identity for the resource. -type IdentityProperties struct { - // PrincipalID - The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the resource. The user identity - // dictionary key references will be ARM resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ - // providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for IdentityProperties. -func (IP IdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.PrincipalID != nil { - objectMap["principalId"] = IP.PrincipalID - } - if IP.TenantID != nil { - objectMap["tenantId"] = IP.TenantID - } - if IP.Type != "" { - objectMap["type"] = IP.Type - } - if IP.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = IP.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ImageDescriptor properties for a registry image. -type ImageDescriptor struct { - // Registry - The registry login server. - Registry *string `json:"registry,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Digest - The sha256-based digest of the image manifest. - Digest *string `json:"digest,omitempty"` -} - -// ImageUpdateTrigger the image update trigger that caused a build. -type ImageUpdateTrigger struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // Timestamp - The timestamp when the image update happened. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Images - The list of image updates that caused the build. - Images *[]ImageDescriptor `json:"images,omitempty"` -} - -// ImportImageParameters ... -type ImportImageParameters struct { - // Source - The source of the image. - Source *ImportSource `json:"source,omitempty"` - // TargetTags - List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). - TargetTags *[]string `json:"targetTags,omitempty"` - // UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created. - UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"` - // Mode - When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'ImportModeNoForce', 'ImportModeForce' - Mode ImportMode `json:"mode,omitempty"` -} - -// ImportSource ... -type ImportSource struct { - // ResourceID - The resource identifier of the source Azure Container Registry. - ResourceID *string `json:"resourceId,omitempty"` - // RegistryURI - The address of the source registry (e.g. 'mcr.microsoft.com'). - RegistryURI *string `json:"registryUri,omitempty"` - // Credentials - Credentials used when importing from a registry uri. - Credentials *ImportSourceCredentials `json:"credentials,omitempty"` - // SourceImage - Repository name of the source image. - // Specify an image by repository ('hello-world'). This will use the 'latest' tag. - // Specify an image by tag ('hello-world:latest'). - // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). - SourceImage *string `json:"sourceImage,omitempty"` -} - -// ImportSourceCredentials ... -type ImportSourceCredentials struct { - // Username - The username to authenticate with the source registry. - Username *string `json:"username,omitempty"` - // Password - The password used to authenticate with the source registry. - Password *string `json:"password,omitempty"` -} - -// InnerErrorDescription inner error. -type InnerErrorDescription struct { - // Code - error code. - Code *string `json:"code,omitempty"` - // Message - error message. - Message *string `json:"message,omitempty"` - // Target - target of the particular error. - Target *string `json:"target,omitempty"` -} - -// IPRule IP rule with specific IP or IP range in CIDR format. -type IPRule struct { - // Action - The action of IP ACL rule. Possible values include: 'ActionAllow' - Action Action `json:"action,omitempty"` - // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - IPAddressOrRange *string `json:"value,omitempty"` -} - -// KeyVaultProperties ... -type KeyVaultProperties struct { - // KeyIdentifier - Key vault uri to access the encryption key. - KeyIdentifier *string `json:"keyIdentifier,omitempty"` - // VersionedKeyIdentifier - READ-ONLY; The fully qualified key identifier that includes the version of the key that is actually used for encryption. - VersionedKeyIdentifier *string `json:"versionedKeyIdentifier,omitempty"` - // Identity - The client id of the identity which will be used to access key vault. - Identity *string `json:"identity,omitempty"` - // KeyRotationEnabled - READ-ONLY; Auto key rotation status for a CMK enabled registry. - KeyRotationEnabled *bool `json:"keyRotationEnabled,omitempty"` - // LastKeyRotationTimestamp - READ-ONLY; Timestamp of the last successful key rotation. - LastKeyRotationTimestamp *date.Time `json:"lastKeyRotationTimestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for KeyVaultProperties. -func (kvp KeyVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kvp.KeyIdentifier != nil { - objectMap["keyIdentifier"] = kvp.KeyIdentifier - } - if kvp.Identity != nil { - objectMap["identity"] = kvp.Identity - } - return json.Marshal(objectMap) -} - -// NetworkRuleSet the network rule set for a container registry. -type NetworkRuleSet struct { - // DefaultAction - The default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' - DefaultAction DefaultAction `json:"defaultAction,omitempty"` - // IPRules - The IP ACL rules. - IPRules *[]IPRule `json:"ipRules,omitempty"` -} - -// OperationDefinition the definition of a container registry operation. -type OperationDefinition struct { - // Origin - The origin information of the container registry operation. - Origin *string `json:"origin,omitempty"` - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The display information for the container registry operation. - Display *OperationDisplayDefinition `json:"display,omitempty"` - // OperationPropertiesDefinition - The properties information for the container registry operation. - *OperationPropertiesDefinition `json:"properties,omitempty"` - // IsDataAction - This property indicates if the operation is an action or a data action - // ref: https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations - IsDataAction *bool `json:"isDataAction,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDefinition. -func (od OperationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if od.Origin != nil { - objectMap["origin"] = od.Origin - } - if od.Name != nil { - objectMap["name"] = od.Name - } - if od.Display != nil { - objectMap["display"] = od.Display - } - if od.OperationPropertiesDefinition != nil { - objectMap["properties"] = od.OperationPropertiesDefinition - } - if od.IsDataAction != nil { - objectMap["isDataAction"] = od.IsDataAction - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationDefinition struct. -func (od *OperationDefinition) 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 "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - od.Origin = &origin - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - od.Name = &name - } - case "display": - if v != nil { - var display OperationDisplayDefinition - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - od.Display = &display - } - case "properties": - if v != nil { - var operationPropertiesDefinition OperationPropertiesDefinition - err = json.Unmarshal(*v, &operationPropertiesDefinition) - if err != nil { - return err - } - od.OperationPropertiesDefinition = &operationPropertiesDefinition - } - case "isDataAction": - if v != nil { - var isDataAction bool - err = json.Unmarshal(*v, &isDataAction) - if err != nil { - return err - } - od.IsDataAction = &isDataAction - } - } - } - - return nil -} - -// OperationDisplayDefinition the display information for a container registry operation. -type OperationDisplayDefinition struct { - // Provider - The resource provider name: Microsoft.ContainerRegistry. - Provider *string `json:"provider,omitempty"` - // Resource - The resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - The operation that users can perform. - Operation *string `json:"operation,omitempty"` - // Description - The description for the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult the result of a request to list container registry operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. - Value *[]OperationDefinition `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registry operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of OperationDefinition 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() OperationDefinition { - if !iter.page.NotDone() { - return OperationDefinition{} - } - 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 OperationDefinition 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() []OperationDefinition { - 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, - } -} - -// OperationLogSpecificationDefinition the definition of Azure Monitoring log. -type OperationLogSpecificationDefinition struct { - // Name - Log name. - Name *string `json:"name,omitempty"` - // DisplayName - Log display name. - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Log blob duration. - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// OperationMetricSpecificationDefinition the definition of Azure Monitoring metric. -type OperationMetricSpecificationDefinition struct { - // Name - Metric name. - Name *string `json:"name,omitempty"` - // DisplayName - Metric display name. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Metric description. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Metric unit. - Unit *string `json:"unit,omitempty"` - // AggregationType - Metric aggregation type. - AggregationType *string `json:"aggregationType,omitempty"` - // InternalMetricName - Internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` -} - -// OperationPropertiesDefinition the definition of Azure Monitoring properties. -type OperationPropertiesDefinition struct { - // ServiceSpecification - The definition of Azure Monitoring service. - ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` -} - -// OperationServiceSpecificationDefinition the definition of Azure Monitoring list. -type OperationServiceSpecificationDefinition struct { - // MetricSpecifications - A list of Azure Monitoring metrics definition. - MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` - // LogSpecifications - A list of Azure Monitoring log definitions. - LogSpecifications *[]OperationLogSpecificationDefinition `json:"logSpecifications,omitempty"` -} - -// OverrideTaskStepProperties ... -type OverrideTaskStepProperties struct { - // ContextPath - The source context against which run has to be queued. - ContextPath *string `json:"contextPath,omitempty"` - // File - The file against which run has to be queued. - File *string `json:"file,omitempty"` - // Arguments - Gets or sets the collection of override arguments to be used when - // executing a build step. - Arguments *[]Argument `json:"arguments,omitempty"` - // Target - The name of the target build stage for the docker build. - Target *string `json:"target,omitempty"` - // Values - The collection of overridable values that can be passed when running a Task. - Values *[]SetValue `json:"values,omitempty"` - // UpdateTriggerToken - Base64 encoded update trigger token that will be attached with the base image trigger webhook. - UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` -} - -// PackageType the properties of a package type. -type PackageType struct { - // Name - The name of the package type. - Name *string `json:"name,omitempty"` - // Endpoint - READ-ONLY; The endpoint of the package type. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for PackageType. -func (pt PackageType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pt.Name != nil { - objectMap["name"] = pt.Name - } - return json.Marshal(objectMap) -} - -// PlatformProperties the platform properties against which the run has to happen. -type PlatformProperties struct { - // Os - The operating system type required for the run. Possible values include: 'OSWindows', 'OSLinux' - Os OS `json:"os,omitempty"` - // Architecture - The OS architecture. Possible values include: 'ArchitectureAmd64', 'ArchitectureX86', 'ArchitectureThreeEightSix', 'ArchitectureArm', 'ArchitectureArm64' - Architecture Architecture `json:"architecture,omitempty"` - // Variant - Variant of the CPU. Possible values include: 'VariantV6', 'VariantV7', 'VariantV8' - Variant Variant `json:"variant,omitempty"` -} - -// PlatformUpdateParameters the properties for updating the platform configuration. -type PlatformUpdateParameters struct { - // Os - The operating system type required for the run. Possible values include: 'OSWindows', 'OSLinux' - Os OS `json:"os,omitempty"` - // Architecture - The OS architecture. Possible values include: 'ArchitectureAmd64', 'ArchitectureX86', 'ArchitectureThreeEightSix', 'ArchitectureArm', 'ArchitectureArm64' - Architecture Architecture `json:"architecture,omitempty"` - // Variant - Variant of the CPU. Possible values include: 'VariantV6', 'VariantV7', 'VariantV8' - Variant Variant `json:"variant,omitempty"` -} - -// Policies the policies for a container registry. -type Policies struct { - // QuarantinePolicy - The quarantine policy for a container registry. - QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"` - // TrustPolicy - The content trust policy for a container registry. - TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"` - // RetentionPolicy - The retention policy for a container registry. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` - // ExportPolicy - The export policy for a container registry. - ExportPolicy *ExportPolicy `json:"exportPolicy,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - This is private endpoint resource created with Microsoft.Network resource provider. - ID *string `json:"id,omitempty"` -} - -// PrivateEndpointConnection an object that represents a private endpoint connection for a container -// registry. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,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 "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pec.SystemData = &systemData - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult the result of a request to list private endpoint connections for a -// container registry. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of private endpoint connections. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) - if err != nil { - return err - } - page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties the properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private endpoint. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of private endpoint connection resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,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) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource a resource that supports private link capabilities. -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // Type - READ-ONLY; The resource type is private link resource. - Type *string `json:"type,omitempty"` - // ID - The resource ID. - ID *string `json:"id,omitempty"` - // Name - The name of the resource. - Name *string `json:"name,omitempty"` - // PrivateLinkResourceProperties - A resource that supports private link capabilities. - *PrivateLinkResourceProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.ID != nil { - objectMap["id"] = plr.ID - } - if plr.Name != nil { - objectMap["name"] = plr.Name - } - 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 "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - 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 "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - } - } - - return nil -} - -// PrivateLinkResourceListResult the result of a request to list private link resources for a container -// registry. -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of private link resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties the properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// PrivateLinkServiceConnectionState the state of a private link service connection. -type PrivateLinkServiceConnectionState struct { - // Status - The private link service connection status. Possible values include: 'ConnectionStatusApproved', 'ConnectionStatusPending', 'ConnectionStatusRejected', 'ConnectionStatusDisconnected' - Status ConnectionStatus `json:"status,omitempty"` - // Description - The description for connection status. For example if connection is rejected it can indicate reason for rejection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. Possible values include: 'ActionsRequiredNone', 'ActionsRequiredRecreate' - ActionsRequired ActionsRequired `json:"actionsRequired,omitempty"` -} - -// 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; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - 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) -} - -// QuarantinePolicy the quarantine policy for a container registry. -type QuarantinePolicy struct { - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// RegenerateCredentialParameters the parameters used to regenerate the login credential. -type RegenerateCredentialParameters struct { - // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'PasswordNamePassword', 'PasswordNamePassword2' - Name PasswordName `json:"name,omitempty"` -} - -// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesCreateFuture) 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 RegistriesCreateFuture.Result. -func (future *RegistriesCreateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture") - 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, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesDeleteFuture) 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 RegistriesDeleteFuture.Result. -func (future *RegistriesDeleteFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesImportImageFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesImportImageFuture) 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 RegistriesImportImageFuture.Result. -func (future *RegistriesImportImageFuture) result(client RegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesImportImageFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistriesScheduleRunFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesScheduleRunFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Run, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesScheduleRunFuture) 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 RegistriesScheduleRunFuture.Result. -func (future *RegistriesScheduleRunFuture) result(client RegistriesClient) (r Run, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesScheduleRunFuture") - 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.ScheduleRunResponder(r.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RegistriesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistriesClient) (Registry, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistriesUpdateFuture) 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 RegistriesUpdateFuture.Result. -func (future *RegistriesUpdateFuture) result(client RegistriesClient) (r Registry, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture") - 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, "containerregistry.RegistriesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// Registry an object that represents a container registry. -type Registry struct { - autorest.Response `json:"-"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // Identity - The identity of the container registry. - Identity *IdentityProperties `json:"identity,omitempty"` - // RegistryProperties - The properties of the container registry. - *RegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Registry. -func (r Registry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - if r.Identity != nil { - objectMap["identity"] = r.Identity - } - if r.RegistryProperties != nil { - objectMap["properties"] = r.RegistryProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Registry struct. -func (r *Registry) 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 - } - r.Sku = &sku - } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - r.Identity = &identity - } - case "properties": - if v != nil { - var registryProperties RegistryProperties - err = json.Unmarshal(*v, ®istryProperties) - if err != nil { - return err - } - r.RegistryProperties = ®istryProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - r.SystemData = &systemData - } - } - } - - return nil -} - -// RegistryListCredentialsResult the response from the ListCredentials operation. -type RegistryListCredentialsResult struct { - autorest.Response `json:"-"` - // Username - The username for a container registry. - Username *string `json:"username,omitempty"` - // Passwords - The list of passwords for a container registry. - Passwords *[]RegistryPassword `json:"passwords,omitempty"` -} - -// RegistryListResult the result of a request to list container registries. -type RegistryListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. - Value *[]Registry `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of container registries. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegistryListResultIterator provides access to a complete listing of Registry values. -type RegistryListResultIterator struct { - i int - page RegistryListResultPage -} - -// 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 *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.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 *RegistryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegistryListResultIterator) 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 RegistryListResultIterator) Response() RegistryListResult { - 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 RegistryListResultIterator) Value() Registry { - if !iter.page.NotDone() { - return Registry{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegistryListResultIterator type. -func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { - return RegistryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RegistryListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RegistryListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// registryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RegistryListResult) registryListResultPreparer(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))) -} - -// RegistryListResultPage contains a page of Registry values. -type RegistryListResultPage struct { - fn func(context.Context, RegistryListResult) (RegistryListResult, error) - rlr RegistryListResult -} - -// 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 *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.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 *RegistryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegistryListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegistryListResultPage) Response() RegistryListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegistryListResultPage) Values() []Registry { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RegistryListResultPage type. -func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { - return RegistryListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RegistryNameCheckRequest a request to check whether a container registry name is available. -type RegistryNameCheckRequest struct { - // Name - The name of the container registry. - Name *string `json:"name,omitempty"` - // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. - Type *string `json:"type,omitempty"` -} - -// RegistryNameStatus the result of a request to check the availability of a container registry name. -type RegistryNameStatus struct { - autorest.Response `json:"-"` - // NameAvailable - The value that indicates whether the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - If any, the reason that the name is not available. - Reason *string `json:"reason,omitempty"` - // Message - If any, the error message that provides more detail for the reason that the name is not available. - Message *string `json:"message,omitempty"` -} - -// RegistryPassword the login password for the container registry. -type RegistryPassword struct { - // Name - The password name. Possible values include: 'PasswordNamePassword', 'PasswordNamePassword2' - Name PasswordName `json:"name,omitempty"` - // Value - The password value. - Value *string `json:"value,omitempty"` -} - -// RegistryProperties the properties of a container registry. -type RegistryProperties struct { - // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. - LoginServer *string `json:"loginServer,omitempty"` - // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the container registry at the time the operation was called. - Status *Status `json:"status,omitempty"` - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` - // Policies - The policies for a container registry. - Policies *Policies `json:"policies,omitempty"` - // Encryption - The encryption settings of container registry. - Encryption *EncryptionProperty `json:"encryption,omitempty"` - // DataEndpointEnabled - Enable a single data endpoint per region for serving data. - DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` - // DataEndpointHostNames - READ-ONLY; List of host names that will serve data when dataEndpointEnabled is true. - DataEndpointHostNames *[]string `json:"dataEndpointHostNames,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections for a container registry. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' - NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` - // ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry. Possible values include: 'ZoneRedundancyEnabled', 'ZoneRedundancyDisabled' - ZoneRedundancy ZoneRedundancy `json:"zoneRedundancy,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryProperties. -func (rp RegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.AdminUserEnabled != nil { - objectMap["adminUserEnabled"] = rp.AdminUserEnabled - } - if rp.NetworkRuleSet != nil { - objectMap["networkRuleSet"] = rp.NetworkRuleSet - } - if rp.Policies != nil { - objectMap["policies"] = rp.Policies - } - if rp.Encryption != nil { - objectMap["encryption"] = rp.Encryption - } - if rp.DataEndpointEnabled != nil { - objectMap["dataEndpointEnabled"] = rp.DataEndpointEnabled - } - if rp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = rp.PublicNetworkAccess - } - if rp.NetworkRuleBypassOptions != "" { - objectMap["networkRuleBypassOptions"] = rp.NetworkRuleBypassOptions - } - if rp.ZoneRedundancy != "" { - objectMap["zoneRedundancy"] = rp.ZoneRedundancy - } - return json.Marshal(objectMap) -} - -// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. -type RegistryPropertiesUpdateParameters struct { - // AdminUserEnabled - The value that indicates whether the admin user is enabled. - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // NetworkRuleSet - The network rule set for a container registry. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` - // Policies - The policies for a container registry. - Policies *Policies `json:"policies,omitempty"` - // Encryption - The encryption settings of container registry. - Encryption *EncryptionProperty `json:"encryption,omitempty"` - // DataEndpointEnabled - Enable a single data endpoint per region for serving data. - DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' - NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` -} - -// RegistryUpdateParameters the parameters for updating a container registry. -type RegistryUpdateParameters struct { - // Identity - The identity of the container registry. - Identity *IdentityProperties `json:"identity,omitempty"` - // Tags - The tags for the container registry. - Tags map[string]*string `json:"tags"` - // Sku - The SKU of the container registry. - Sku *Sku `json:"sku,omitempty"` - // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. - *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistryUpdateParameters. -func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Identity != nil { - objectMap["identity"] = rup.Identity - } - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.Sku != nil { - objectMap["sku"] = rup.Sku - } - if rup.RegistryPropertiesUpdateParameters != nil { - objectMap["properties"] = rup.RegistryPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. -func (rup *RegistryUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rup.Identity = &identity - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rup.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - rup.Sku = &sku - } - case "properties": - if v != nil { - var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters - err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) - if err != nil { - return err - } - rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters - } - } - } - - return nil -} - -// RegistryUsage the quota usage for a container registry. -type RegistryUsage struct { - // Name - The name of the usage. - Name *string `json:"name,omitempty"` - // Limit - The limit of the usage. - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - The current value of the usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - // Unit - The unit of measurement. Possible values include: 'RegistryUsageUnitCount', 'RegistryUsageUnitBytes' - Unit RegistryUsageUnit `json:"unit,omitempty"` -} - -// RegistryUsageListResult the result of a request to get container registry quota usages. -type RegistryUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of container registry quota usages. - Value *[]RegistryUsage `json:"value,omitempty"` -} - -// Replication an object that represents a replication for a container registry. -type Replication struct { - autorest.Response `json:"-"` - // ReplicationProperties - The properties of the replication. - *ReplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Replication. -func (r Replication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.ReplicationProperties != nil { - objectMap["properties"] = r.ReplicationProperties - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Replication struct. -func (r *Replication) 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 replicationProperties ReplicationProperties - err = json.Unmarshal(*v, &replicationProperties) - if err != nil { - return err - } - r.ReplicationProperties = &replicationProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - r.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - r.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - r.SystemData = &systemData - } - } - } - - return nil -} - -// ReplicationListResult the result of a request to list replications for a container registry. -type ReplicationListResult struct { - autorest.Response `json:"-"` - // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. - Value *[]Replication `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of replications. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReplicationListResultIterator provides access to a complete listing of Replication values. -type ReplicationListResultIterator struct { - i int - page ReplicationListResultPage -} - -// 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 *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.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 *ReplicationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReplicationListResultIterator) 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 ReplicationListResultIterator) Response() ReplicationListResult { - 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 ReplicationListResultIterator) Value() Replication { - if !iter.page.NotDone() { - return Replication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReplicationListResultIterator type. -func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { - return ReplicationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr ReplicationListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr ReplicationListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// replicationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr ReplicationListResult) replicationListResultPreparer(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))) -} - -// ReplicationListResultPage contains a page of Replication values. -type ReplicationListResultPage struct { - fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) - rlr ReplicationListResult -} - -// 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 *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.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 *ReplicationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReplicationListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReplicationListResultPage) Response() ReplicationListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReplicationListResultPage) Values() []Replication { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the ReplicationListResultPage type. -func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { - return ReplicationListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// ReplicationProperties the properties of a replication. -type ReplicationProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; The status of the replication at the time the operation was called. - Status *Status `json:"status,omitempty"` - // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` - // ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry replication. Possible values include: 'ZoneRedundancyEnabled', 'ZoneRedundancyDisabled' - ZoneRedundancy ZoneRedundancy `json:"zoneRedundancy,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationProperties. -func (rp ReplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RegionEndpointEnabled != nil { - objectMap["regionEndpointEnabled"] = rp.RegionEndpointEnabled - } - if rp.ZoneRedundancy != "" { - objectMap["zoneRedundancy"] = rp.ZoneRedundancy - } - return json.Marshal(objectMap) -} - -// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsCreateFuture) 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 ReplicationsCreateFuture.Result. -func (future *ReplicationsCreateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture") - 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, "containerregistry.ReplicationsCreateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsDeleteFuture) 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 ReplicationsDeleteFuture.Result. -func (future *ReplicationsDeleteFuture) result(client ReplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationsClient) (Replication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationsUpdateFuture) 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 ReplicationsUpdateFuture.Result. -func (future *ReplicationsUpdateFuture) result(client ReplicationsClient) (r Replication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture") - 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, "containerregistry.ReplicationsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicationUpdateParameters the parameters for updating a replication. -type ReplicationUpdateParameters struct { - // Tags - The tags for the replication. - Tags map[string]*string `json:"tags"` - // ReplicationUpdateParametersProperties - The parameters for updating a replication's properties - *ReplicationUpdateParametersProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. -func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rup.Tags != nil { - objectMap["tags"] = rup.Tags - } - if rup.ReplicationUpdateParametersProperties != nil { - objectMap["properties"] = rup.ReplicationUpdateParametersProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ReplicationUpdateParameters struct. -func (rup *ReplicationUpdateParameters) 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 - } - rup.Tags = tags - } - case "properties": - if v != nil { - var replicationUpdateParametersProperties ReplicationUpdateParametersProperties - err = json.Unmarshal(*v, &replicationUpdateParametersProperties) - if err != nil { - return err - } - rup.ReplicationUpdateParametersProperties = &replicationUpdateParametersProperties - } - } - } - - return nil -} - -// ReplicationUpdateParametersProperties ... -type ReplicationUpdateParametersProperties struct { - // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. - RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` -} - -// Request the request that generated the event. -type Request struct { - // ID - The ID of the request that initiated the event. - ID *string `json:"id,omitempty"` - // Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. - Addr *string `json:"addr,omitempty"` - // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - Host *string `json:"host,omitempty"` - // Method - The request method that generated the event. - Method *string `json:"method,omitempty"` - // Useragent - The user agent header of the request. - Useragent *string `json:"useragent,omitempty"` -} - -// Resource an Azure resource. -type Resource struct { - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// RetentionPolicy the retention policy for a container registry. -type RetentionPolicy struct { - // Days - The number of days to retain an untagged manifest after which it gets purged. - Days *int32 `json:"days,omitempty"` - // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for RetentionPolicy. -func (rp RetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.Days != nil { - objectMap["days"] = rp.Days - } - if rp.Status != "" { - objectMap["status"] = rp.Status - } - return json.Marshal(objectMap) -} - -// Run run resource properties -type Run struct { - autorest.Response `json:"-"` - // RunProperties - The properties of a run. - *RunProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Run. -func (r Run) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RunProperties != nil { - objectMap["properties"] = r.RunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Run struct. -func (r *Run) 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 runProperties RunProperties - err = json.Unmarshal(*v, &runProperties) - if err != nil { - return err - } - r.RunProperties = &runProperties - } - 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 -} - -// RunFilter properties that are enabled for Odata querying on runs. -type RunFilter struct { - // RunID - The unique identifier for the run. - RunID *string `json:"runId,omitempty"` - // RunType - The type of run. Possible values include: 'RunTypeQuickBuild', 'RunTypeQuickRun', 'RunTypeAutoBuild', 'RunTypeAutoRun' - RunType RunType `json:"runType,omitempty"` - // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' - Status RunStatus `json:"status,omitempty"` - // CreateTime - The create time for a run. - CreateTime *date.Time `json:"createTime,omitempty"` - // FinishTime - The time the run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImageManifests - The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of - // build type. - OutputImageManifests *string `json:"outputImageManifests,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // TaskName - The name of the task that the run corresponds to. - TaskName *string `json:"taskName,omitempty"` - // AgentPoolName - The name of the agent pool that the run corresponds to. - AgentPoolName *string `json:"agentPoolName,omitempty"` -} - -// RunGetLogResult the result of get log link operation. -type RunGetLogResult struct { - autorest.Response `json:"-"` - // LogLink - The link to logs for a run on a azure container registry. - LogLink *string `json:"logLink,omitempty"` - // LogArtifactLink - The link to logs in registry for a run on a azure container registry. - LogArtifactLink *string `json:"logArtifactLink,omitempty"` -} - -// RunListResult collection of runs. -type RunListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Run `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RunListResultIterator provides access to a complete listing of Run values. -type RunListResultIterator struct { - i int - page RunListResultPage -} - -// 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 *RunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultIterator.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 *RunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RunListResultIterator) 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 RunListResultIterator) Response() RunListResult { - 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 RunListResultIterator) Value() Run { - if !iter.page.NotDone() { - return Run{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RunListResultIterator type. -func NewRunListResultIterator(page RunListResultPage) RunListResultIterator { - return RunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RunListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RunListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// runListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RunListResult) runListResultPreparer(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))) -} - -// RunListResultPage contains a page of Run values. -type RunListResultPage struct { - fn func(context.Context, RunListResult) (RunListResult, error) - rlr RunListResult -} - -// 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 *RunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultPage.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 *RunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RunListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RunListResultPage) Response() RunListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RunListResultPage) Values() []Run { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RunListResultPage type. -func NewRunListResultPage(cur RunListResult, getNextPage func(context.Context, RunListResult) (RunListResult, error)) RunListResultPage { - return RunListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RunProperties the properties for a run. -type RunProperties struct { - // RunID - The unique identifier for the run. - RunID *string `json:"runId,omitempty"` - // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' - Status RunStatus `json:"status,omitempty"` - // LastUpdatedTime - The last updated time for the run. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // RunType - The type of run. Possible values include: 'RunTypeQuickBuild', 'RunTypeQuickRun', 'RunTypeAutoBuild', 'RunTypeAutoRun' - RunType RunType `json:"runType,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // CreateTime - The time the run was scheduled. - CreateTime *date.Time `json:"createTime,omitempty"` - // StartTime - The time the run started. - StartTime *date.Time `json:"startTime,omitempty"` - // FinishTime - The time the run finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // OutputImages - The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. - OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` - // Task - The task against which run was scheduled. - Task *string `json:"task,omitempty"` - // ImageUpdateTrigger - The image update trigger that caused the run. This is applicable if the task has base image trigger configured. - ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` - // SourceTrigger - The source trigger that caused the run. - SourceTrigger *SourceTriggerDescriptor `json:"sourceTrigger,omitempty"` - // TimerTrigger - The timer trigger that caused the run. - TimerTrigger *TimerTriggerDescriptor `json:"timerTrigger,omitempty"` - // Platform - The platform properties against which the run will happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // SourceRegistryAuth - The scope of the credentials that were used to login to the source registry during this run. - SourceRegistryAuth *string `json:"sourceRegistryAuth,omitempty"` - // CustomRegistries - The list of custom registries that were logged in during this run. - CustomRegistries *[]string `json:"customRegistries,omitempty"` - // RunErrorMessage - READ-ONLY; The error message received from backend systems after the run is scheduled. - RunErrorMessage *string `json:"runErrorMessage,omitempty"` - // UpdateTriggerToken - The update trigger token passed for the Run. - UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` - // LogArtifact - READ-ONLY; The image description for the log artifact. - LogArtifact *ImageDescriptor `json:"logArtifact,omitempty"` - // ProvisioningState - The provisioning state of a run. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunProperties. -func (rp RunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RunID != nil { - objectMap["runId"] = rp.RunID - } - if rp.Status != "" { - objectMap["status"] = rp.Status - } - if rp.LastUpdatedTime != nil { - objectMap["lastUpdatedTime"] = rp.LastUpdatedTime - } - if rp.RunType != "" { - objectMap["runType"] = rp.RunType - } - if rp.AgentPoolName != nil { - objectMap["agentPoolName"] = rp.AgentPoolName - } - if rp.CreateTime != nil { - objectMap["createTime"] = rp.CreateTime - } - if rp.StartTime != nil { - objectMap["startTime"] = rp.StartTime - } - if rp.FinishTime != nil { - objectMap["finishTime"] = rp.FinishTime - } - if rp.OutputImages != nil { - objectMap["outputImages"] = rp.OutputImages - } - if rp.Task != nil { - objectMap["task"] = rp.Task - } - if rp.ImageUpdateTrigger != nil { - objectMap["imageUpdateTrigger"] = rp.ImageUpdateTrigger - } - if rp.SourceTrigger != nil { - objectMap["sourceTrigger"] = rp.SourceTrigger - } - if rp.TimerTrigger != nil { - objectMap["timerTrigger"] = rp.TimerTrigger - } - if rp.Platform != nil { - objectMap["platform"] = rp.Platform - } - if rp.AgentConfiguration != nil { - objectMap["agentConfiguration"] = rp.AgentConfiguration - } - if rp.SourceRegistryAuth != nil { - objectMap["sourceRegistryAuth"] = rp.SourceRegistryAuth - } - if rp.CustomRegistries != nil { - objectMap["customRegistries"] = rp.CustomRegistries - } - if rp.UpdateTriggerToken != nil { - objectMap["updateTriggerToken"] = rp.UpdateTriggerToken - } - if rp.ProvisioningState != "" { - objectMap["provisioningState"] = rp.ProvisioningState - } - if rp.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = rp.IsArchiveEnabled - } - return json.Marshal(objectMap) -} - -// BasicRunRequest the request parameters for scheduling a run. -type BasicRunRequest interface { - AsDockerBuildRequest() (*DockerBuildRequest, bool) - AsFileTaskRunRequest() (*FileTaskRunRequest, bool) - AsTaskRunRequest() (*TaskRunRequest, bool) - AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) - AsRunRequest() (*RunRequest, bool) -} - -// RunRequest the request parameters for scheduling a run. -type RunRequest struct { - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicRunRequest(body []byte) (BasicRunRequest, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeDockerBuildRequest): - var dbr DockerBuildRequest - err := json.Unmarshal(body, &dbr) - return dbr, err - case string(TypeFileTaskRunRequest): - var ftrr FileTaskRunRequest - err := json.Unmarshal(body, &ftrr) - return ftrr, err - case string(TypeTaskRunRequest): - var trr TaskRunRequest - err := json.Unmarshal(body, &trr) - return trr, err - case string(TypeEncodedTaskRunRequest): - var etrr EncodedTaskRunRequest - err := json.Unmarshal(body, &etrr) - return etrr, err - default: - var rr RunRequest - err := json.Unmarshal(body, &rr) - return rr, err - } -} -func unmarshalBasicRunRequestArray(body []byte) ([]BasicRunRequest, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rrArray := make([]BasicRunRequest, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rr, err := unmarshalBasicRunRequest(*rawMessage) - if err != nil { - return nil, err - } - rrArray[index] = rr - } - return rrArray, nil -} - -// MarshalJSON is the custom marshaler for RunRequest. -func (rr RunRequest) MarshalJSON() ([]byte, error) { - rr.Type = TypeRunRequest - objectMap := make(map[string]interface{}) - if rr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = rr.IsArchiveEnabled - } - if rr.AgentPoolName != nil { - objectMap["agentPoolName"] = rr.AgentPoolName - } - if rr.LogTemplate != nil { - objectMap["logTemplate"] = rr.LogTemplate - } - if rr.Type != "" { - objectMap["type"] = rr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return nil, false -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsRunRequest() (*RunRequest, bool) { - return &rr, true -} - -// AsBasicRunRequest is the BasicRunRequest implementation for RunRequest. -func (rr RunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &rr, true -} - -// RunsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type RunsCancelFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunsCancelFuture) 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 RunsCancelFuture.Result. -func (future *RunsCancelFuture) result(client RunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsCancelFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RunsCancelFuture") - return - } - ar.Response = future.Response() - return -} - -// RunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type RunsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RunsClient) (Run, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RunsUpdateFuture) 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 RunsUpdateFuture.Result. -func (future *RunsUpdateFuture) result(client RunsClient) (r Run, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.RunsUpdateFuture") - 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, "containerregistry.RunsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RunUpdateParameters the set of run properties that can be updated. -type RunUpdateParameters struct { - // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` -} - -// SecretObject describes the properties of a secret object value. -type SecretObject struct { - // Value - The value of the secret. The format of this value will be determined - // based on the type of the secret object. If the type is Opaque, the value will be - // used as is without any modification. - Value *string `json:"value,omitempty"` - // Type - The type of the secret object which determines how the value of the secret object has to be - // interpreted. Possible values include: 'SecretObjectTypeOpaque', 'SecretObjectTypeVaultsecret' - Type SecretObjectType `json:"type,omitempty"` -} - -// SetValue the properties of a overridable value that can be passed to a task template. -type SetValue struct { - // Name - The name of the overridable value. - Name *string `json:"name,omitempty"` - // Value - The overridable value. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the value represents a secret or not. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// Sku the SKU of a container registry. -type Sku struct { - // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'SkuNameClassic', 'SkuNameBasic', 'SkuNameStandard', 'SkuNamePremium' - Name SkuName `json:"name,omitempty"` - // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` -} - -// MarshalJSON is the custom marshaler for Sku. -func (s Sku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Name != "" { - objectMap["name"] = s.Name - } - return json.Marshal(objectMap) -} - -// Source the registry node that generated the event. Put differently, while the actor initiates the event, -// the source generates it. -type Source struct { - // Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. - Addr *string `json:"addr,omitempty"` - // InstanceID - The running instance of an application. Changes after each restart. - InstanceID *string `json:"instanceID,omitempty"` -} - -// SourceProperties the properties of the source code repository. -type SourceProperties struct { - // SourceControlType - The type of source control service. Possible values include: 'SourceControlTypeGithub', 'SourceControlTypeVisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceRegistryCredentials describes the credential parameters for accessing the source registry. -type SourceRegistryCredentials struct { - // LoginMode - The authentication mode which determines the source registry login scope. The credentials for the source registry - // will be generated using the given scope. These credentials will be used to login to - // the source registry during the run. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' - LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` -} - -// SourceTrigger the properties of a source based trigger. -type SourceTrigger struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceTriggerDescriptor the source trigger that caused a run. -type SourceTriggerDescriptor struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // EventType - The event type of the trigger. - EventType *string `json:"eventType,omitempty"` - // CommitID - The unique ID that identifies a commit. - CommitID *string `json:"commitId,omitempty"` - // PullRequestID - The unique ID that identifies pull request. - PullRequestID *string `json:"pullRequestId,omitempty"` - // RepositoryURL - The repository URL. - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // BranchName - The branch name in the repository. - BranchName *string `json:"branchName,omitempty"` - // ProviderType - The source control provider type. - ProviderType *string `json:"providerType,omitempty"` -} - -// SourceTriggerUpdateParameters the properties for updating a source based trigger. -type SourceTriggerUpdateParameters struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceUpdateParameters the properties for updating the source code repository. -type SourceUpdateParameters struct { - // SourceControlType - The type of source control service. Possible values include: 'SourceControlTypeGithub', 'SourceControlTypeVisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceUploadDefinition the properties of a response to source upload request. -type SourceUploadDefinition struct { - autorest.Response `json:"-"` - // UploadURL - The URL where the client can upload the source. - UploadURL *string `json:"uploadUrl,omitempty"` - // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. - RelativePath *string `json:"relativePath,omitempty"` -} - -// Status the status of an Azure resource at the time the operation was called. -type Status struct { - // DisplayStatus - READ-ONLY; The short label for the status. - DisplayStatus *string `json:"displayStatus,omitempty"` - // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. - Message *string `json:"message,omitempty"` - // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for Status. -func (s Status) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StorageAccountProperties the properties of a storage account for a container registry. Only applicable -// to Classic SKU. -type StorageAccountProperties struct { - // ID - The resource ID of the storage account. - ID *string `json:"id,omitempty"` -} - -// 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: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' - LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource modification (UTC). - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// Target the target of the event. -type Target struct { - // MediaType - The MIME type of the referenced object. - MediaType *string `json:"mediaType,omitempty"` - // Size - The number of bytes of the content. Same as Length field. - Size *int64 `json:"size,omitempty"` - // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. - Digest *string `json:"digest,omitempty"` - // Length - The number of bytes of the content. Same as Size field. - Length *int64 `json:"length,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // URL - The direct URL to the content. - URL *string `json:"url,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Name - The name of the artifact. - Name *string `json:"name,omitempty"` - // Version - The version of the artifact. - Version *string `json:"version,omitempty"` -} - -// Task the task that has the ARM resource and task properties. -// The task will have all information to schedule a run against it. -type Task struct { - autorest.Response `json:"-"` - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskProperties - The properties of a task. - *TaskProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Task. -func (t Task) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.Identity != nil { - objectMap["identity"] = t.Identity - } - if t.TaskProperties != nil { - objectMap["properties"] = t.TaskProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Task struct. -func (t *Task) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - t.Identity = &identity - } - case "properties": - if v != nil { - var taskProperties TaskProperties - err = json.Unmarshal(*v, &taskProperties) - if err != nil { - return err - } - t.TaskProperties = &taskProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - t.SystemData = &systemData - } - } - } - - return nil -} - -// TaskListResult the collection of tasks. -type TaskListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Task `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// TaskListResultIterator provides access to a complete listing of Task values. -type TaskListResultIterator struct { - i int - page TaskListResultPage -} - -// 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 *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.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 *TaskListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskListResultIterator) 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 TaskListResultIterator) Response() TaskListResult { - 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 TaskListResultIterator) Value() Task { - if !iter.page.NotDone() { - return Task{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TaskListResultIterator type. -func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { - return TaskListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TaskListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TaskListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// taskListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TaskListResult) taskListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TaskListResultPage contains a page of Task values. -type TaskListResultPage struct { - fn func(context.Context, TaskListResult) (TaskListResult, error) - tlr TaskListResult -} - -// 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 *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TaskListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TaskListResultPage) Response() TaskListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TaskListResultPage) Values() []Task { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TaskListResultPage type. -func NewTaskListResultPage(cur TaskListResult, getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { - return TaskListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TaskProperties the properties of a task. -type TaskProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CreationDate - READ-ONLY; The creation date of task. - CreationDate *date.Time `json:"creationDate,omitempty"` - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // AgentPoolName - The dedicated agent pool for the task. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties of a task step. - Step BasicTaskStepProperties `json:"step,omitempty"` - // Trigger - The properties that describe all triggers for the task. - Trigger *TriggerProperties `json:"trigger,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // IsSystemTask - The value of this property indicates whether the task resource is system task or not. - IsSystemTask *bool `json:"isSystemTask,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskProperties. -func (tp TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.Status != "" { - objectMap["status"] = tp.Status - } - if tp.Platform != nil { - objectMap["platform"] = tp.Platform - } - if tp.AgentConfiguration != nil { - objectMap["agentConfiguration"] = tp.AgentConfiguration - } - if tp.AgentPoolName != nil { - objectMap["agentPoolName"] = tp.AgentPoolName - } - if tp.Timeout != nil { - objectMap["timeout"] = tp.Timeout - } - objectMap["step"] = tp.Step - if tp.Trigger != nil { - objectMap["trigger"] = tp.Trigger - } - if tp.Credentials != nil { - objectMap["credentials"] = tp.Credentials - } - if tp.LogTemplate != nil { - objectMap["logTemplate"] = tp.LogTemplate - } - if tp.IsSystemTask != nil { - objectMap["isSystemTask"] = tp.IsSystemTask - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. -func (tp *TaskProperties) 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 "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "creationDate": - if v != nil { - var creationDate date.Time - err = json.Unmarshal(*v, &creationDate) - if err != nil { - return err - } - tp.CreationDate = &creationDate - } - case "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tp.Status = status - } - case "platform": - if v != nil { - var platform PlatformProperties - err = json.Unmarshal(*v, &platform) - if err != nil { - return err - } - tp.Platform = &platform - } - case "agentConfiguration": - if v != nil { - var agentConfiguration AgentProperties - err = json.Unmarshal(*v, &agentConfiguration) - if err != nil { - return err - } - tp.AgentConfiguration = &agentConfiguration - } - case "agentPoolName": - if v != nil { - var agentPoolName string - err = json.Unmarshal(*v, &agentPoolName) - if err != nil { - return err - } - tp.AgentPoolName = &agentPoolName - } - case "timeout": - if v != nil { - var timeout int32 - err = json.Unmarshal(*v, &timeout) - if err != nil { - return err - } - tp.Timeout = &timeout - } - case "step": - if v != nil { - step, err := unmarshalBasicTaskStepProperties(*v) - if err != nil { - return err - } - tp.Step = step - } - case "trigger": - if v != nil { - var trigger TriggerProperties - err = json.Unmarshal(*v, &trigger) - if err != nil { - return err - } - tp.Trigger = &trigger - } - case "credentials": - if v != nil { - var credentials Credentials - err = json.Unmarshal(*v, &credentials) - if err != nil { - return err - } - tp.Credentials = &credentials - } - case "logTemplate": - if v != nil { - var logTemplate string - err = json.Unmarshal(*v, &logTemplate) - if err != nil { - return err - } - tp.LogTemplate = &logTemplate - } - case "isSystemTask": - if v != nil { - var isSystemTask bool - err = json.Unmarshal(*v, &isSystemTask) - if err != nil { - return err - } - tp.IsSystemTask = &isSystemTask - } - } - } - - return nil -} - -// TaskPropertiesUpdateParameters the properties for updating a task. -type TaskPropertiesUpdateParameters struct { - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformUpdateParameters `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // AgentPoolName - The dedicated agent pool for the task. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties for updating a task step. - Step BasicTaskStepUpdateParameters `json:"step,omitempty"` - // Trigger - The properties for updating trigger properties. - Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` - // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. -func (tpup *TaskPropertiesUpdateParameters) 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 "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tpup.Status = status - } - case "platform": - if v != nil { - var platform PlatformUpdateParameters - err = json.Unmarshal(*v, &platform) - if err != nil { - return err - } - tpup.Platform = &platform - } - case "agentConfiguration": - if v != nil { - var agentConfiguration AgentProperties - err = json.Unmarshal(*v, &agentConfiguration) - if err != nil { - return err - } - tpup.AgentConfiguration = &agentConfiguration - } - case "agentPoolName": - if v != nil { - var agentPoolName string - err = json.Unmarshal(*v, &agentPoolName) - if err != nil { - return err - } - tpup.AgentPoolName = &agentPoolName - } - case "timeout": - if v != nil { - var timeout int32 - err = json.Unmarshal(*v, &timeout) - if err != nil { - return err - } - tpup.Timeout = &timeout - } - case "step": - if v != nil { - step, err := unmarshalBasicTaskStepUpdateParameters(*v) - if err != nil { - return err - } - tpup.Step = step - } - case "trigger": - if v != nil { - var trigger TriggerUpdateParameters - err = json.Unmarshal(*v, &trigger) - if err != nil { - return err - } - tpup.Trigger = &trigger - } - case "credentials": - if v != nil { - var credentials Credentials - err = json.Unmarshal(*v, &credentials) - if err != nil { - return err - } - tpup.Credentials = &credentials - } - case "logTemplate": - if v != nil { - var logTemplate string - err = json.Unmarshal(*v, &logTemplate) - if err != nil { - return err - } - tpup.LogTemplate = &logTemplate - } - } - } - - return nil -} - -// TaskRun the task run that has the ARM resource and properties. -// The task run will have the information of request and result of a run. -type TaskRun struct { - autorest.Response `json:"-"` - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunProperties - The properties associated with the task run, i.e., request and result of the run - *TaskRunProperties `json:"properties,omitempty"` - // Location - The location of the resource - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; The resource ID. - 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"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRun. -func (tr TaskRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Identity != nil { - objectMap["identity"] = tr.Identity - } - if tr.TaskRunProperties != nil { - objectMap["properties"] = tr.TaskRunProperties - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRun struct. -func (tr *TaskRun) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tr.Identity = &identity - } - case "properties": - if v != nil { - var taskRunProperties TaskRunProperties - err = json.Unmarshal(*v, &taskRunProperties) - if err != nil { - return err - } - tr.TaskRunProperties = &taskRunProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tr.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - tr.SystemData = &systemData - } - } - } - - return nil -} - -// TaskRunListResult the collection of task runs. -type TaskRunListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]TaskRun `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. - NextLink *string `json:"nextLink,omitempty"` -} - -// TaskRunListResultIterator provides access to a complete listing of TaskRun values. -type TaskRunListResultIterator struct { - i int - page TaskRunListResultPage -} - -// 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 *TaskRunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultIterator.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 *TaskRunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskRunListResultIterator) 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 TaskRunListResultIterator) Response() TaskRunListResult { - 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 TaskRunListResultIterator) Value() TaskRun { - if !iter.page.NotDone() { - return TaskRun{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TaskRunListResultIterator type. -func NewTaskRunListResultIterator(page TaskRunListResultPage) TaskRunListResultIterator { - return TaskRunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (trlr TaskRunListResult) IsEmpty() bool { - return trlr.Value == nil || len(*trlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (trlr TaskRunListResult) hasNextLink() bool { - return trlr.NextLink != nil && len(*trlr.NextLink) != 0 -} - -// taskRunListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (trlr TaskRunListResult) taskRunListResultPreparer(ctx context.Context) (*http.Request, error) { - if !trlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(trlr.NextLink))) -} - -// TaskRunListResultPage contains a page of TaskRun values. -type TaskRunListResultPage struct { - fn func(context.Context, TaskRunListResult) (TaskRunListResult, error) - trlr TaskRunListResult -} - -// 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 *TaskRunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultPage.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.trlr) - if err != nil { - return err - } - page.trlr = 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 *TaskRunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskRunListResultPage) NotDone() bool { - return !page.trlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TaskRunListResultPage) Response() TaskRunListResult { - return page.trlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TaskRunListResultPage) Values() []TaskRun { - if page.trlr.IsEmpty() { - return nil - } - return *page.trlr.Value -} - -// Creates a new instance of the TaskRunListResultPage type. -func NewTaskRunListResultPage(cur TaskRunListResult, getNextPage func(context.Context, TaskRunListResult) (TaskRunListResult, error)) TaskRunListResultPage { - return TaskRunListResultPage{ - fn: getNextPage, - trlr: cur, - } -} - -// TaskRunProperties the properties of task run. -type TaskRunProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of this task run. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // RunRequest - The request (parameters) for the run - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // RunResult - READ-ONLY; The result of this task run - RunResult *Run `json:"runResult,omitempty"` - // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRunProperties. -func (trp TaskRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["runRequest"] = trp.RunRequest - if trp.ForceUpdateTag != nil { - objectMap["forceUpdateTag"] = trp.ForceUpdateTag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunProperties struct. -func (trp *TaskRunProperties) 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 "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - trp.ProvisioningState = provisioningState - } - case "runRequest": - if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) - if err != nil { - return err - } - trp.RunRequest = runRequest - } - case "runResult": - if v != nil { - var runResult Run - err = json.Unmarshal(*v, &runResult) - if err != nil { - return err - } - trp.RunResult = &runResult - } - case "forceUpdateTag": - if v != nil { - var forceUpdateTag string - err = json.Unmarshal(*v, &forceUpdateTag) - if err != nil { - return err - } - trp.ForceUpdateTag = &forceUpdateTag - } - } - } - - return nil -} - -// TaskRunPropertiesUpdateParameters the properties of a task run update parameters. -type TaskRunPropertiesUpdateParameters struct { - // RunRequest - The request (parameters) for the new run - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunPropertiesUpdateParameters struct. -func (trpup *TaskRunPropertiesUpdateParameters) 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 "runRequest": - if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) - if err != nil { - return err - } - trpup.RunRequest = runRequest - } - case "forceUpdateTag": - if v != nil { - var forceUpdateTag string - err = json.Unmarshal(*v, &forceUpdateTag) - if err != nil { - return err - } - trpup.ForceUpdateTag = &forceUpdateTag - } - } - } - - return nil -} - -// TaskRunRequest the parameters for a task run request. -type TaskRunRequest struct { - // TaskID - The resource ID of task against which run has to be queued. - TaskID *string `json:"taskId,omitempty"` - // OverrideTaskStepProperties - Set of overridable parameters that can be passed when running a Task. - OverrideTaskStepProperties *OverrideTaskStepProperties `json:"overrideTaskStepProperties,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // AgentPoolName - The dedicated agent pool for the run. - AgentPoolName *string `json:"agentPoolName,omitempty"` - // LogTemplate - The template that describes the repository and tag information for run log artifact. - LogTemplate *string `json:"logTemplate,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TaskRunRequest. -func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { - trr.Type = TypeTaskRunRequest - objectMap := make(map[string]interface{}) - if trr.TaskID != nil { - objectMap["taskId"] = trr.TaskID - } - if trr.OverrideTaskStepProperties != nil { - objectMap["overrideTaskStepProperties"] = trr.OverrideTaskStepProperties - } - if trr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled - } - if trr.AgentPoolName != nil { - objectMap["agentPoolName"] = trr.AgentPoolName - } - if trr.LogTemplate != nil { - objectMap["logTemplate"] = trr.LogTemplate - } - if trr.Type != "" { - objectMap["type"] = trr.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { - return nil, false -} - -// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { - return nil, false -} - -// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return &trr, true -} - -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { - return nil, false -} - -// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { - return nil, false -} - -// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &trr, true -} - -// TaskRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (TaskRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsCreateFuture) 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 TaskRunsCreateFuture.Result. -func (future *TaskRunsCreateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.CreateResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsDeleteFuture) 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 TaskRunsDeleteFuture.Result. -func (future *TaskRunsDeleteFuture) result(client TaskRunsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TaskRunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TaskRunsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TaskRunsClient) (TaskRun, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TaskRunsUpdateFuture) 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 TaskRunsUpdateFuture.Result. -func (future *TaskRunsUpdateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.UpdateResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskRunUpdateParameters the parameters for updating a task run. -type TaskRunUpdateParameters struct { - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunPropertiesUpdateParameters - The properties for updating a task run. - *TaskRunPropertiesUpdateParameters `json:"properties,omitempty"` - // Location - The location of the resource - Location *string `json:"location,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TaskRunUpdateParameters. -func (trup TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if trup.Identity != nil { - objectMap["identity"] = trup.Identity - } - if trup.TaskRunPropertiesUpdateParameters != nil { - objectMap["properties"] = trup.TaskRunPropertiesUpdateParameters - } - if trup.Location != nil { - objectMap["location"] = trup.Location - } - if trup.Tags != nil { - objectMap["tags"] = trup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskRunUpdateParameters struct. -func (trup *TaskRunUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - trup.Identity = &identity - } - case "properties": - if v != nil { - var taskRunPropertiesUpdateParameters TaskRunPropertiesUpdateParameters - err = json.Unmarshal(*v, &taskRunPropertiesUpdateParameters) - if err != nil { - return err - } - trup.TaskRunPropertiesUpdateParameters = &taskRunPropertiesUpdateParameters - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - trup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - trup.Tags = tags - } - } - } - - return nil -} - -// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (Task, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksCreateFuture) 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 TasksCreateFuture.Result. -func (future *TasksCreateFuture) result(client TasksClient) (t Task, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksDeleteFuture) 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 TasksDeleteFuture.Result. -func (future *TasksDeleteFuture) result(client TasksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BasicTaskStepProperties base properties for any task step. -type BasicTaskStepProperties interface { - AsDockerBuildStep() (*DockerBuildStep, bool) - AsFileTaskStep() (*FileTaskStep, bool) - AsEncodedTaskStep() (*EncodedTaskStep, bool) - AsTaskStepProperties() (*TaskStepProperties, bool) -} - -// TaskStepProperties base properties for any task step. -type TaskStepProperties struct { - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` -} - -func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicTaskStepPropertiesTypeDocker): - var dbs DockerBuildStep - err := json.Unmarshal(body, &dbs) - return dbs, err - case string(TypeBasicTaskStepPropertiesTypeFileTask): - var fts FileTaskStep - err := json.Unmarshal(body, &fts) - return fts, err - case string(TypeBasicTaskStepPropertiesTypeEncodedTask): - var ets EncodedTaskStep - err := json.Unmarshal(body, &ets) - return ets, err - default: - var tsp TaskStepProperties - err := json.Unmarshal(body, &tsp) - return tsp, err - } -} -func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tspArray := make([]BasicTaskStepProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) - if err != nil { - return nil, err - } - tspArray[index] = tsp - } - return tspArray, nil -} - -// MarshalJSON is the custom marshaler for TaskStepProperties. -func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { - tsp.Type = TypeBasicTaskStepPropertiesTypeTaskStepProperties - objectMap := make(map[string]interface{}) - if tsp.ContextPath != nil { - objectMap["contextPath"] = tsp.ContextPath - } - if tsp.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsp.ContextAccessToken - } - if tsp.Type != "" { - objectMap["type"] = tsp.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false -} - -// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false -} - -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false -} - -// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { - return &tsp, true -} - -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &tsp, true -} - -// BasicTaskStepUpdateParameters base properties for updating any task step. -type BasicTaskStepUpdateParameters interface { - AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) - AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) - AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) - AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) -} - -// TaskStepUpdateParameters base properties for updating any task step. -type TaskStepUpdateParameters struct { - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` -} - -func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicTaskStepUpdateParametersTypeDocker): - var dbsup DockerBuildStepUpdateParameters - err := json.Unmarshal(body, &dbsup) - return dbsup, err - case string(TypeBasicTaskStepUpdateParametersTypeFileTask): - var ftsup FileTaskStepUpdateParameters - err := json.Unmarshal(body, &ftsup) - return ftsup, err - case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): - var etsup EncodedTaskStepUpdateParameters - err := json.Unmarshal(body, &etsup) - return etsup, err - default: - var tsup TaskStepUpdateParameters - err := json.Unmarshal(body, &tsup) - return tsup, err - } -} -func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) - if err != nil { - return nil, err - } - tsupArray[index] = tsup - } - return tsupArray, nil -} - -// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters - objectMap := make(map[string]interface{}) - if tsup.ContextPath != nil { - objectMap["contextPath"] = tsup.ContextPath - } - if tsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsup.ContextAccessToken - } - if tsup.Type != "" { - objectMap["type"] = tsup.Type - } - return json.Marshal(objectMap) -} - -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false -} - -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false -} - -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return &tsup, true -} - -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &tsup, true -} - -// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TasksClient) (Task, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TasksUpdateFuture) 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 TasksUpdateFuture.Result. -func (future *TasksUpdateFuture) result(client TasksClient) (t Task, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TaskUpdateParameters the parameters for updating a task. -type TaskUpdateParameters struct { - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskPropertiesUpdateParameters - The properties for updating a task. - *TaskPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TaskUpdateParameters. -func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Identity != nil { - objectMap["identity"] = tup.Identity - } - if tup.TaskPropertiesUpdateParameters != nil { - objectMap["properties"] = tup.TaskPropertiesUpdateParameters - } - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. -func (tup *TaskUpdateParameters) 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 "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tup.Identity = &identity - } - case "properties": - if v != nil { - var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters - err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) - if err != nil { - return err - } - tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tup.Tags = tags - } - } - } - - return nil -} - -// TimerTrigger the properties of a timer trigger. -type TimerTrigger struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// TimerTriggerDescriptor ... -type TimerTriggerDescriptor struct { - // TimerTriggerName - The timer trigger name that caused the run. - TimerTriggerName *string `json:"timerTriggerName,omitempty"` - // ScheduleOccurrence - The occurrence that triggered the run. - ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` -} - -// TimerTriggerUpdateParameters the properties for updating a timer trigger. -type TimerTriggerUpdateParameters struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// TriggerProperties the properties of a trigger. -type TriggerProperties struct { - // TimerTriggers - The collection of timer triggers. - TimerTriggers *[]TimerTrigger `json:"timerTriggers,omitempty"` - // SourceTriggers - The collection of triggers based on source code repository. - SourceTriggers *[]SourceTrigger `json:"sourceTriggers,omitempty"` - // BaseImageTrigger - The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTrigger `json:"baseImageTrigger,omitempty"` -} - -// TriggerUpdateParameters the properties for updating triggers. -type TriggerUpdateParameters struct { - // TimerTriggers - The collection of timer triggers. - TimerTriggers *[]TimerTriggerUpdateParameters `json:"timerTriggers,omitempty"` - // SourceTriggers - The collection of triggers based on source code repository. - SourceTriggers *[]SourceTriggerUpdateParameters `json:"sourceTriggers,omitempty"` - // BaseImageTrigger - The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTriggerUpdateParameters `json:"baseImageTrigger,omitempty"` -} - -// TrustPolicy the content trust policy for a container registry. -type TrustPolicy struct { - // Type - The type of trust policy. Possible values include: 'TrustPolicyTypeNotary' - Type TrustPolicyType `json:"type,omitempty"` - // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` -} - -// UserIdentityProperties ... -type UserIdentityProperties struct { - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// Webhook an object that represents a webhook for a container registry. -type Webhook struct { - autorest.Response `json:"-"` - // WebhookProperties - The properties of the webhook. - *WebhookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID. - 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 - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Webhook. -func (w Webhook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WebhookProperties != nil { - objectMap["properties"] = w.WebhookProperties - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Webhook struct. -func (w *Webhook) 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 webhookProperties WebhookProperties - err = json.Unmarshal(*v, &webhookProperties) - if err != nil { - return err - } - w.WebhookProperties = &webhookProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - w.SystemData = &systemData - } - } - } - - return nil -} - -// WebhookCreateParameters the parameters for creating a webhook. -type WebhookCreateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // Location - The location of the webhook. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. - *WebhookPropertiesCreateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookCreateParameters. -func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcp.Tags != nil { - objectMap["tags"] = wcp.Tags - } - if wcp.Location != nil { - objectMap["location"] = wcp.Location - } - if wcp.WebhookPropertiesCreateParameters != nil { - objectMap["properties"] = wcp.WebhookPropertiesCreateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. -func (wcp *WebhookCreateParameters) 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 - } - wcp.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wcp.Location = &location - } - case "properties": - if v != nil { - var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters - err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) - if err != nil { - return err - } - wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters - } - } - } - - return nil -} - -// WebhookListResult the result of a request to list webhooks for a container registry. -type WebhookListResult struct { - autorest.Response `json:"-"` - // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. - Value *[]Webhook `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next list of webhooks. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultIterator provides access to a complete listing of Webhook values. -type WebhookListResultIterator struct { - i int - page WebhookListResultPage -} - -// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { - 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 WebhookListResultIterator) Value() Webhook { - if !iter.page.NotDone() { - return Webhook{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebhookListResultIterator type. -func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { - return WebhookListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WebhookListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WebhookListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// webhookListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WebhookListResult) webhookListResultPreparer(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))) -} - -// WebhookListResultPage contains a page of Webhook values. -type WebhookListResultPage struct { - fn func(context.Context, WebhookListResult) (WebhookListResult, error) - wlr WebhookListResult -} - -// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebhookListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebhookListResultPage) Response() WebhookListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebhookListResultPage) Values() []Webhook { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WebhookListResultPage type. -func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { - return WebhookListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WebhookProperties the properties of a webhook. -type WebhookProperties struct { - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookProperties. -func (wp WebhookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Status != "" { - objectMap["status"] = wp.Status - } - if wp.Scope != nil { - objectMap["scope"] = wp.Scope - } - if wp.Actions != nil { - objectMap["actions"] = wp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. -type WebhookPropertiesCreateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. -func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpcp.ServiceURI != nil { - objectMap["serviceUri"] = wpcp.ServiceURI - } - if wpcp.CustomHeaders != nil { - objectMap["customHeaders"] = wpcp.CustomHeaders - } - if wpcp.Status != "" { - objectMap["status"] = wpcp.Status - } - if wpcp.Scope != nil { - objectMap["scope"] = wpcp.Scope - } - if wpcp.Actions != nil { - objectMap["actions"] = wpcp.Actions - } - return json.Marshal(objectMap) -} - -// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. -type WebhookPropertiesUpdateParameters struct { - // ServiceURI - The service URI for the webhook to post notifications. - ServiceURI *string `json:"serviceUri,omitempty"` - // CustomHeaders - Custom headers that will be added to the webhook notifications. - CustomHeaders map[string]*string `json:"customHeaders"` - // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' - Status WebhookStatus `json:"status,omitempty"` - // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. - Scope *string `json:"scope,omitempty"` - // Actions - The list of actions that trigger the webhook to post notifications. - Actions *[]WebhookAction `json:"actions,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. -func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpup.ServiceURI != nil { - objectMap["serviceUri"] = wpup.ServiceURI - } - if wpup.CustomHeaders != nil { - objectMap["customHeaders"] = wpup.CustomHeaders - } - if wpup.Status != "" { - objectMap["status"] = wpup.Status - } - if wpup.Scope != nil { - objectMap["scope"] = wpup.Scope - } - if wpup.Actions != nil { - objectMap["actions"] = wpup.Actions - } - return json.Marshal(objectMap) -} - -// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksCreateFuture) 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 WebhooksCreateFuture.Result. -func (future *WebhooksCreateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.CreateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksDeleteFuture) 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 WebhooksDeleteFuture.Result. -func (future *WebhooksDeleteFuture) result(client WebhooksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WebhooksUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebhooksClient) (Webhook, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebhooksUpdateFuture) 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 WebhooksUpdateFuture.Result. -func (future *WebhooksUpdateFuture) result(client WebhooksClient) (w Webhook, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.UpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WebhookUpdateParameters the parameters for updating a webhook. -type WebhookUpdateParameters struct { - // Tags - The tags for the webhook. - Tags map[string]*string `json:"tags"` - // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. - *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebhookUpdateParameters. -func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wup.Tags != nil { - objectMap["tags"] = wup.Tags - } - if wup.WebhookPropertiesUpdateParameters != nil { - objectMap["properties"] = wup.WebhookPropertiesUpdateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. -func (wup *WebhookUpdateParameters) 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 - } - wup.Tags = tags - } - case "properties": - if v != nil { - var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters - err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) - if err != nil { - return err - } - wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters - } - } - } - - return nil -} diff --git a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/operations.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/operations.go deleted file mode 100644 index cc68ddc33d9a..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 client for the Operations methods of the Containerregistry service. -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 Azure Container Registry 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, "containerregistry.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, "containerregistry.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerRegistry/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, "containerregistry.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, "containerregistry.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.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/containerregistry/mgmt/2021-09-01/containerregistry/privateendpointconnections.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/privateendpointconnections.go deleted file mode 100644 index 7f9ded2752f1..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/privateendpointconnections.go +++ /dev/null @@ -1,434 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the Containerregistry -// service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate update the state of specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -// privateEndpointConnection - the parameters for creating a private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName, privateEndpointConnection) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(privateEndpointConnection), - 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 get the specified private endpoint connection associated with the container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// List list all private endpoint connections in a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/privateEndpointConnections", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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 PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "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, "containerregistry.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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, registryName) - return -} diff --git a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/registries.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/registries.go deleted file mode 100644 index 1a1c622d18fa..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/registries.go +++ /dev/null @@ -1,1467 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RegistriesClient is the client for the Registries methods of the Containerregistry service. -type RegistriesClient struct { - BaseClient -} - -// NewRegistriesClient creates an instance of the RegistriesClient client. -func NewRegistriesClient(subscriptionID string) RegistriesClient { - return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient 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 NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { - return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only -// alphanumeric characters, be globally unique, and between 5 and 50 characters in length. -// Parameters: -// registryNameCheckRequest - the object containing information for the availability request. -func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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: registryNameCheckRequest, - Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}, - }}, - {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/checkNameAvailability", pathParameters), - autorest.WithJSON(registryNameCheckRequest), - 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 RegistriesClient) 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 RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, 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 container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registry - the parameters for creating a container registry. -func (client RegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result RegistriesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: registry, - Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, registry) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registry), - 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 RegistriesClient) CreateSender(req *http.Request) (future RegistriesCreateFuture, 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 RegistriesClient) CreateResponder(resp *http.Response) (result Registry, 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 a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result RegistriesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) DeleteSender(req *http.Request) (future RegistriesDeleteFuture, 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 RegistriesClient) 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 the properties of the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) 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 RegistriesClient) GetResponder(resp *http.Response) (result Registry, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBuildSourceUploadURL get the upload location for the user to be able to upload the source. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result SourceUploadDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GetBuildSourceUploadURL") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "GetBuildSourceUploadURL", err.Error()) - } - - req, err := client.GetBuildSourceUploadURLPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetBuildSourceUploadURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure sending request") - return - } - - result, err = client.GetBuildSourceUploadURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure responding to request") - return - } - - return -} - -// GetBuildSourceUploadURLPreparer prepares the GetBuildSourceUploadURL request. -func (client RegistriesClient) GetBuildSourceUploadURLPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBuildSourceUploadURLSender sends the GetBuildSourceUploadURL request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GetBuildSourceUploadURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetBuildSourceUploadURLResponder handles the response to the GetBuildSourceUploadURL request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GetBuildSourceUploadURLResponder(resp *http.Response) (result SourceUploadDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetPrivateLinkResource gets a private link resource by a specified group name for a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// groupName - the name of the private link resource. -func (client RegistriesClient) GetPrivateLinkResource(ctx context.Context, resourceGroupName string, registryName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GetPrivateLinkResource") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "GetPrivateLinkResource", err.Error()) - } - - req, err := client.GetPrivateLinkResourcePreparer(ctx, resourceGroupName, registryName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetPrivateLinkResource", nil, "Failure preparing request") - return - } - - resp, err := client.GetPrivateLinkResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetPrivateLinkResource", resp, "Failure sending request") - return - } - - result, err = client.GetPrivateLinkResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetPrivateLinkResource", resp, "Failure responding to request") - return - } - - return -} - -// GetPrivateLinkResourcePreparer prepares the GetPrivateLinkResource request. -func (client RegistriesClient) GetPrivateLinkResourcePreparer(ctx context.Context, resourceGroupName string, registryName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/privateLinkResources/{groupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetPrivateLinkResourceSender sends the GetPrivateLinkResource request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GetPrivateLinkResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetPrivateLinkResourceResponder handles the response to the GetPrivateLinkResource request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GetPrivateLinkResourceResponder(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 -} - -// ImportImage copies an image to this container registry from the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// parameters - the parameters specifying the image to copy and the source container registry. -func (client RegistriesClient) ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (result RegistriesImportImageFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ImportImage") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Source.Credentials.Password", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Source.SourceImage", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ImportImage", err.Error()) - } - - req, err := client.ImportImagePreparer(ctx, resourceGroupName, registryName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", nil, "Failure preparing request") - return - } - - result, err = client.ImportImageSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportImagePreparer prepares the ImportImage request. -func (client RegistriesClient) ImportImagePreparer(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/importImage", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportImageSender sends the ImportImage request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ImportImageSender(req *http.Request) (future RegistriesImportImageFuture, 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 -} - -// ImportImageResponder handles the response to the ImportImage request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ImportImageResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all the container registries under the specified subscription. -func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 the container registries under the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup") - 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.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RegistriesClient) 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-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.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.registryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 -} - -// ListCredentials lists the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListCredentials") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListCredentials", err.Error()) - } - - req, err := client.ListCredentialsPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListCredentialsPreparer prepares the ListCredentials request. -func (client RegistriesClient) ListCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCredentialsSender sends the ListCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCredentialsResponder handles the response to the ListCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPrivateLinkResources lists the private link resources for a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListPrivateLinkResources", err.Error()) - } - - result.fn = client.listPrivateLinkResourcesNextResults - req, err := client.ListPrivateLinkResourcesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", nil, "Failure preparing request") - return - } - - resp, err := client.ListPrivateLinkResourcesSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListPrivateLinkResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPrivateLinkResourcesPreparer prepares the ListPrivateLinkResources request. -func (client RegistriesClient) ListPrivateLinkResourcesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPrivateLinkResourcesSender sends the ListPrivateLinkResources request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListPrivateLinkResourcesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListPrivateLinkResourcesResponder handles the response to the ListPrivateLinkResources request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListPrivateLinkResourcesResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listPrivateLinkResourcesNextResults retrieves the next set of results, if any. -func (client RegistriesClient) listPrivateLinkResourcesNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListPrivateLinkResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListPrivateLinkResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListPrivateLinkResourcesComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistriesClient) ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") - 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.ListPrivateLinkResources(ctx, resourceGroupName, registryName) - return -} - -// ListUsages gets the quota usages for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result RegistryUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListUsages") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client RegistriesClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/listUsages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListUsagesResponder(resp *http.Response) (result RegistryUsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateCredential regenerates one of the login credentials for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// regenerateCredentialParameters - specifies name of the password which should be regenerated -- password or -// password2. -func (client RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.RegenerateCredential") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "RegenerateCredential", err.Error()) - } - - req, err := client.RegenerateCredentialPreparer(ctx, resourceGroupName, registryName, regenerateCredentialParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateCredentialSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request") - return - } - - result, err = client.RegenerateCredentialResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateCredentialPreparer prepares the RegenerateCredential request. -func (client RegistriesClient) RegenerateCredentialPreparer(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters), - autorest.WithJSON(regenerateCredentialParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always -// closes the http.Response Body. -func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ScheduleRun schedules a new run based on the request parameters and add it to the run queue. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runRequest - the parameters of a run that needs to scheduled. -func (client RegistriesClient) ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (result RegistriesScheduleRunFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ScheduleRun") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "ScheduleRun", err.Error()) - } - - req, err := client.ScheduleRunPreparer(ctx, resourceGroupName, registryName, runRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", nil, "Failure preparing request") - return - } - - result, err = client.ScheduleRunSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", result.Response(), "Failure sending request") - return - } - - return -} - -// ScheduleRunPreparer prepares the ScheduleRun request. -func (client RegistriesClient) ScheduleRunPreparer(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/scheduleRun", pathParameters), - autorest.WithJSON(runRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ScheduleRunSender sends the ScheduleRun request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ScheduleRunSender(req *http.Request) (future RegistriesScheduleRunFuture, 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 -} - -// ScheduleRunResponder handles the response to the ScheduleRun request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ScheduleRunResponder(resp *http.Response) (result Run, 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 a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// registryUpdateParameters - the parameters for updating a container registry. -func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result RegistriesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RegistriesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, registryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registryUpdateParameters), - 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 RegistriesClient) UpdateSender(req *http.Request) (future RegistriesUpdateFuture, 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 RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, 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/containerregistry/mgmt/2021-09-01/containerregistry/replications.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/replications.go deleted file mode 100644 index d244688f1de9..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/replications.go +++ /dev/null @@ -1,542 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReplicationsClient is the client for the Replications methods of the Containerregistry service. -type ReplicationsClient struct { - BaseClient -} - -// NewReplicationsClient creates an instance of the ReplicationsClient client. -func NewReplicationsClient(subscriptionID string) ReplicationsClient { - return NewReplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationsClientWithBaseURI creates an instance of the ReplicationsClient 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 NewReplicationsClientWithBaseURI(baseURI string, subscriptionID string) ReplicationsClient { - return ReplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replication - the parameters for creating a replication. -func (client ReplicationsClient) Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (result ReplicationsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, replicationName, replication) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ReplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replication), - 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 ReplicationsClient) CreateSender(req *http.Request) (future ReplicationsCreateFuture, 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 ReplicationsClient) CreateResponder(resp *http.Response) (result Replication, 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 a replication from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result ReplicationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ReplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) DeleteSender(req *http.Request) (future ReplicationsDeleteFuture, 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 ReplicationsClient) 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 the properties of the specified replication. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -func (client ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result Replication, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, replicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) 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 ReplicationsClient) GetResponder(resp *http.Response) (result Replication, 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 the replications for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client ReplicationsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.List") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ReplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/replications", 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 ReplicationsClient) 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 ReplicationsClient) ListResponder(resp *http.Response) (result ReplicationListResult, 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 ReplicationsClient) listNextResults(ctx context.Context, lastResults ReplicationListResult) (result ReplicationListResult, err error) { - req, err := lastResults.replicationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "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, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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, registryName) - return -} - -// Update updates a replication for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// replicationName - the name of the replication. -// replicationUpdateParameters - the parameters for updating a replication. -func (client ReplicationsClient) Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (result ReplicationsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: replicationName, - Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.ReplicationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ReplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "replicationName": autorest.Encode("path", replicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), - autorest.WithJSON(replicationUpdateParameters), - 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 ReplicationsClient) UpdateSender(req *http.Request) (future ReplicationsUpdateFuture, 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 ReplicationsClient) UpdateResponder(resp *http.Response) (result Replication, 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/containerregistry/mgmt/2021-09-01/containerregistry/runs.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/runs.go deleted file mode 100644 index 7035b1e3c4f3..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/runs.go +++ /dev/null @@ -1,529 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RunsClient is the client for the Runs methods of the Containerregistry service. -type RunsClient struct { - BaseClient -} - -// NewRunsClient creates an instance of the RunsClient client. -func NewRunsClient(subscriptionID string) RunsClient { - return NewRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunsClientWithBaseURI creates an instance of the RunsClient 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 NewRunsClientWithBaseURI(baseURI string, subscriptionID string) RunsClient { - return RunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancel an existing run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunsCancelFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.Cancel") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Cancel", err.Error()) - } - - req, err := client.CancelPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", nil, "Failure preparing request") - return - } - - result, err = client.CancelSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", result.Response(), "Failure sending request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client RunsClient) CancelPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client RunsClient) CancelSender(req *http.Request) (future RunsCancelFuture, 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 -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client RunsClient) CancelResponder(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 gets the detailed information for a given run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result Run, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}", 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 RunsClient) 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 RunsClient) GetResponder(resp *http.Response) (result Run, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLogSasURL gets a link to download the run logs. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -func (client RunsClient) GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunGetLogResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.GetLogSasURL") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "GetLogSasURL", err.Error()) - } - - req, err := client.GetLogSasURLPreparer(ctx, resourceGroupName, registryName, runID) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetLogSasURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure sending request") - return - } - - result, err = client.GetLogSasURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure responding to request") - return - } - - return -} - -// GetLogSasURLPreparer prepares the GetLogSasURL request. -func (client RunsClient) GetLogSasURLPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLogSasURLSender sends the GetLogSasURL request. The method will close the -// http.Response Body if it receives an error. -func (client RunsClient) GetLogSasURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLogSasURLResponder handles the response to the GetLogSasURL request. The method always -// closes the http.Response Body. -func (client RunsClient) GetLogSasURLResponder(resp *http.Response) (result RunGetLogResult, 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 the runs for a registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// filter - the runs filter to apply on the operation. Arithmetic operators are not supported. The allowed -// string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. -// top - $top is supported for get list of runs, which limits the maximum number of runs to return. -func (client RunsClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.List") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs", 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 RunsClient) 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 RunsClient) ListResponder(resp *http.Response) (result RunListResult, 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 RunsClient) listNextResults(ctx context.Context, lastResults RunListResult) (result RunListResult, err error) { - req, err := lastResults.runListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RunsClient", "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, "containerregistry.RunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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, registryName, filter, top) - return -} - -// Update patch the run properties. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -// runUpdateParameters - the run update properties. -func (client RunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (result RunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.RunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, runID, runUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/runs/{runId}", pathParameters), - autorest.WithJSON(runUpdateParameters), - 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 RunsClient) UpdateSender(req *http.Request) (future RunsUpdateFuture, 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 RunsClient) UpdateResponder(resp *http.Response) (result Run, 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/containerregistry/mgmt/2021-09-01/containerregistry/taskruns.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/taskruns.go deleted file mode 100644 index ee13d4b2d14f..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/taskruns.go +++ /dev/null @@ -1,634 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TaskRunsClient is the client for the TaskRuns methods of the Containerregistry service. -type TaskRunsClient struct { - BaseClient -} - -// NewTaskRunsClient creates an instance of the TaskRunsClient client. -func NewTaskRunsClient(subscriptionID string) TaskRunsClient { - return NewTaskRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTaskRunsClientWithBaseURI creates an instance of the TaskRunsClient 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 NewTaskRunsClientWithBaseURI(baseURI string, subscriptionID string) TaskRunsClient { - return TaskRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task run for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -// taskRun - the parameters of a run that needs to scheduled. -func (client TaskRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (result TaskRunsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskRunName, taskRun) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TaskRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(taskRun), - 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 TaskRunsClient) CreateSender(req *http.Request) (future TaskRunsCreateFuture, 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 TaskRunsClient) CreateResponder(resp *http.Response) (result TaskRun, 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 a specified task run resource. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRunsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TaskRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) DeleteSender(req *http.Request) (future TaskRunsDeleteFuture, 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 TaskRunsClient) 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 the detailed information for a given task run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TaskRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) 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 TaskRunsClient) GetResponder(resp *http.Response) (result TaskRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails gets the detailed information for a given task run that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.GetDetails") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TaskRunsClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TaskRunsClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) GetDetailsResponder(resp *http.Response) (result TaskRun, 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 the task runs for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TaskRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.List") - defer func() { - sc := -1 - if result.trlr.Response.Response != nil { - sc = result.trlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.trlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure sending request") - return - } - - result.trlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure responding to request") - return - } - if result.trlr.hasNextLink() && result.trlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TaskRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns", 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 TaskRunsClient) 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 TaskRunsClient) ListResponder(resp *http.Response) (result TaskRunListResult, 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 TaskRunsClient) listNextResults(ctx context.Context, lastResults TaskRunListResult) (result TaskRunListResult, err error) { - req, err := lastResults.taskRunListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "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, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TaskRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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, registryName) - return -} - -// Update updates a task run with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -// updateParameters - the parameters for updating a task run. -func (client TaskRunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (result TaskRunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskRunName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TaskRunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 TaskRunsClient) UpdateSender(req *http.Request) (future TaskRunsUpdateFuture, 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 TaskRunsClient) UpdateResponder(resp *http.Response) (result TaskRun, 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/containerregistry/mgmt/2021-09-01/containerregistry/tasks.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/tasks.go deleted file mode 100644 index 3af51765a125..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/tasks.go +++ /dev/null @@ -1,645 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TasksClient is the client for the Tasks methods of the Containerregistry service. -type TasksClient struct { - BaseClient -} - -// NewTasksClient creates an instance of the TasksClient client. -func NewTasksClient(subscriptionID string) TasksClient { - return NewTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTasksClientWithBaseURI creates an instance of the TasksClient 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 NewTasksClientWithBaseURI(baseURI string, subscriptionID string) TasksClient { - return TasksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -// taskCreateParameters - the parameters for creating a task. -func (client TasksClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (result TasksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, - {TargetValue: taskCreateParameters, - Constraints: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMaximum, Rule: int64(28800), Chain: nil}, - {Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMinimum, Rule: int64(300), Chain: nil}, - }}, - {Target: "taskCreateParameters.TaskProperties.Trigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskName, taskCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TasksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskCreateParameters), - 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 TasksClient) CreateSender(req *http.Request) (future TasksCreateFuture, 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 TasksClient) CreateResponder(resp *http.Response) (result Task, 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 a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result TasksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TasksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) DeleteSender(req *http.Request) (future TasksDeleteFuture, 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 TasksClient) 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 get the properties of a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TasksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) 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 TasksClient) GetResponder(resp *http.Response) (result Task, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails returns a task with extended information that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.GetDetails") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TasksClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TasksClient) GetDetailsResponder(resp *http.Response) (result Task, 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 the tasks for a specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client TasksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.List") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TasksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks", 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 TasksClient) 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 TasksClient) ListResponder(resp *http.Response) (result TaskListResult, 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 TasksClient) listNextResults(ctx context.Context, lastResults TaskListResult) (result TaskListResult, err error) { - req, err := lastResults.taskListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TasksClient", "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, "containerregistry.TasksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TasksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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, registryName) - return -} - -// Update updates a task with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -// taskUpdateParameters - the parameters for updating a task. -func (client TasksClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (result TasksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TasksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskUpdateParameters), - 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 TasksClient) UpdateSender(req *http.Request) (future TasksUpdateFuture, 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 TasksClient) UpdateResponder(resp *http.Response) (result Task, 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/containerregistry/mgmt/2021-09-01/containerregistry/version.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/version.go deleted file mode 100644 index 99b67c2027b6..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerregistry - -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() + " containerregistry/2021-09-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/webhooks.go b/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/webhooks.go deleted file mode 100644 index 53d1f9e259a3..000000000000 --- a/services/preview/containerregistry/mgmt/2021-09-01/containerregistry/webhooks.go +++ /dev/null @@ -1,866 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WebhooksClient is the client for the Webhooks methods of the Containerregistry service. -type WebhooksClient struct { - BaseClient -} - -// NewWebhooksClient creates an instance of the WebhooksClient client. -func NewWebhooksClient(subscriptionID string) WebhooksClient { - return NewWebhooksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhooksClientWithBaseURI creates an instance of the WebhooksClient 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 NewWebhooksClientWithBaseURI(baseURI string, subscriptionID string) WebhooksClient { - return WebhooksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a webhook for a container registry with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookCreateParameters - the parameters for creating a webhook. -func (client WebhooksClient) Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (result WebhooksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookCreateParameters, - Constraints: []validation.Constraint{{Target: "webhookCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.ServiceURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client WebhooksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookCreateParameters), - 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 WebhooksClient) CreateSender(req *http.Request) (future WebhooksCreateFuture, 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 WebhooksClient) CreateResponder(resp *http.Response) (result Webhook, 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 a webhook from a container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result WebhooksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) DeleteSender(req *http.Request) (future WebhooksDeleteFuture, 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 WebhooksClient) 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 the properties of the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhooksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) 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 WebhooksClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCallbackConfig gets the configuration of service URI and custom headers for the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result CallbackConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.GetCallbackConfig") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "GetCallbackConfig", err.Error()) - } - - req, err := client.GetCallbackConfigPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", nil, "Failure preparing request") - return - } - - resp, err := client.GetCallbackConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure sending request") - return - } - - result, err = client.GetCallbackConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure responding to request") - return - } - - return -} - -// GetCallbackConfigPreparer prepares the GetCallbackConfig request. -func (client WebhooksClient) GetCallbackConfigPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCallbackConfigSender sends the GetCallbackConfig request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) GetCallbackConfigSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCallbackConfigResponder handles the response to the GetCallbackConfig request. The method always -// closes the http.Response Body. -func (client WebhooksClient) GetCallbackConfigResponder(resp *http.Response) (result CallbackConfig, 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 the webhooks for the specified container registry. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -func (client WebhooksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.List") - 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: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WebhooksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/webhooks", 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 WebhooksClient) 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 WebhooksClient) ListResponder(resp *http.Response) (result WebhookListResult, 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 WebhooksClient) listNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "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, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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, registryName) - return -} - -// ListEvents lists recent events for the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "ListEvents", err.Error()) - } - - result.fn = client.listEventsNextResults - req, err := client.ListEventsPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventsSender(req) - if err != nil { - result.elr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure sending request") - return - } - - result.elr, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure responding to request") - return - } - if result.elr.hasNextLink() && result.elr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListEventsPreparer prepares the ListEvents request. -func (client WebhooksClient) ListEventsPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventsSender sends the ListEvents request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) ListEventsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventsResponder handles the response to the ListEvents request. The method always -// closes the http.Response Body. -func (client WebhooksClient) ListEventsResponder(resp *http.Response) (result EventListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listEventsNextResults retrieves the next set of results, if any. -func (client WebhooksClient) listEventsNextResults(ctx context.Context, lastResults EventListResult) (result EventListResult, err error) { - req, err := lastResults.eventListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListEventsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListEventsComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.ListEvents(ctx, resourceGroupName, registryName, webhookName) - return -} - -// Ping triggers a ping event to be sent to the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Ping") - 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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Ping", err.Error()) - } - - req, err := client.PingPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", nil, "Failure preparing request") - return - } - - resp, err := client.PingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure sending request") - return - } - - result, err = client.PingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure responding to request") - return - } - - return -} - -// PingPreparer prepares the Ping request. -func (client WebhooksClient) PingPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PingSender sends the Ping request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) PingSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PingResponder handles the response to the Ping request. The method always -// closes the http.Response Body. -func (client WebhooksClient) PingResponder(resp *http.Response) (result EventInfo, 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 webhook with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -// webhookUpdateParameters - the parameters for updating a webhook. -func (client WebhooksClient) Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (result WebhooksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2021-09-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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookUpdateParameters), - 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 WebhooksClient) UpdateSender(req *http.Request) (future WebhooksUpdateFuture, 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 WebhooksClient) UpdateResponder(resp *http.Response) (result Webhook, 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/containerregistry/runtime/2019-07/containerregistry/CHANGELOG.md b/services/preview/containerregistry/runtime/2019-07/containerregistry/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/containerregistry/runtime/2019-07/containerregistry/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/containerregistry/runtime/2019-07/containerregistry/client.go b/services/preview/containerregistry/runtime/2019-07/containerregistry/client.go deleted file mode 100644 index e60ba96ae43b..000000000000 --- a/services/preview/containerregistry/runtime/2019-07/containerregistry/client.go +++ /dev/null @@ -1,1567 +0,0 @@ -// Package containerregistry implements the Azure ARM Containerregistry service API version 2019-07-15-preview. -// -// Metadata API definition for the Azure Container Registry runtime -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BaseClient is the base client for Containerregistry. -type BaseClient struct { - autorest.Client - LoginURI string -} - -// New creates an instance of the BaseClient client. -func New(loginURI string) BaseClient { - return NewWithoutDefaults(loginURI) -} - -// NewWithoutDefaults creates an instance of the BaseClient client. -func NewWithoutDefaults(loginURI string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - LoginURI: loginURI, - } -} - -// CreateManifest put the manifest identified by `name` and `reference` where `reference` can be a tag or digest. -// Parameters: -// name - name of the image (including the namespace) -// reference - a tag or a digest, pointing to a specific image -// payload - manifest body, can take v1 or v2 values depending on accept header -func (client BaseClient) CreateManifest(ctx context.Context, name string, reference string, payload Manifest) (result SetObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateManifest") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateManifestPreparer(ctx, name, reference, payload) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "CreateManifest", nil, "Failure preparing request") - return - } - - resp, err := client.CreateManifestSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "CreateManifest", resp, "Failure sending request") - return - } - - result, err = client.CreateManifestResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "CreateManifest", resp, "Failure responding to request") - return - } - - return -} - -// CreateManifestPreparer prepares the CreateManifest request. -func (client BaseClient) CreateManifestPreparer(ctx context.Context, name string, reference string, payload Manifest) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "reference": autorest.Encode("path", reference), - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/vnd.docker.distribution.manifest.v2+json"), - autorest.AsPut(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/v2/{name}/manifests/{reference}", pathParameters), - autorest.WithJSON(payload)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateManifestSender sends the CreateManifest request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) CreateManifestSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateManifestResponder handles the response to the CreateManifest request. The method always -// closes the http.Response Body. -func (client BaseClient) CreateManifestResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAcrRepository delete the repository identified by `name` -// Parameters: -// name - name of the image (including the namespace) -func (client BaseClient) DeleteAcrRepository(ctx context.Context, name string) (result DeletedRepository, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteAcrRepository") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteAcrRepositoryPreparer(ctx, name) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "DeleteAcrRepository", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAcrRepositorySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "DeleteAcrRepository", resp, "Failure sending request") - return - } - - result, err = client.DeleteAcrRepositoryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "DeleteAcrRepository", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAcrRepositoryPreparer prepares the DeleteAcrRepository request. -func (client BaseClient) DeleteAcrRepositoryPreparer(ctx context.Context, name string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAcrRepositorySender sends the DeleteAcrRepository request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) DeleteAcrRepositorySender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteAcrRepositoryResponder handles the response to the DeleteAcrRepository request. The method always -// closes the http.Response Body. -func (client BaseClient) DeleteAcrRepositoryResponder(resp *http.Response) (result DeletedRepository, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAcrTag delete tag -// Parameters: -// name - name of the image (including the namespace) -// reference - tag or digest of the target manifest -func (client BaseClient) DeleteAcrTag(ctx context.Context, name string, reference string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteAcrTag") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteAcrTagPreparer(ctx, name, reference) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "DeleteAcrTag", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAcrTagSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "DeleteAcrTag", resp, "Failure sending request") - return - } - - result, err = client.DeleteAcrTagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "DeleteAcrTag", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAcrTagPreparer prepares the DeleteAcrTag request. -func (client BaseClient) DeleteAcrTagPreparer(ctx context.Context, name string, reference string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "reference": autorest.Encode("path", reference), - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}/_tags/{reference}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAcrTagSender sends the DeleteAcrTag request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) DeleteAcrTagSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteAcrTagResponder handles the response to the DeleteAcrTag request. The method always -// closes the http.Response Body. -func (client BaseClient) DeleteAcrTagResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteManifest delete the manifest identified by `name` and `reference`. Note that a manifest can _only_ be deleted -// by `digest`. -// Parameters: -// name - name of the image (including the namespace) -// reference - a tag or a digest, pointing to a specific image -func (client BaseClient) DeleteManifest(ctx context.Context, name string, reference string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteManifest") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteManifestPreparer(ctx, name, reference) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "DeleteManifest", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteManifestSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "DeleteManifest", resp, "Failure sending request") - return - } - - result, err = client.DeleteManifestResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "DeleteManifest", resp, "Failure responding to request") - return - } - - return -} - -// DeleteManifestPreparer prepares the DeleteManifest request. -func (client BaseClient) DeleteManifestPreparer(ctx context.Context, name string, reference string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "reference": autorest.Encode("path", reference), - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/v2/{name}/manifests/{reference}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteManifestSender sends the DeleteManifest request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) DeleteManifestSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteManifestResponder handles the response to the DeleteManifest request. The method always -// closes the http.Response Body. -func (client BaseClient) DeleteManifestResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetAcrAccessToken exchange ACR Refresh token for an ACR Access Token -// Parameters: -// service - indicates the name of your Azure container registry. -// scope - which is expected to be a valid scope, and can be specified more than once for multiple scope -// requests. You obtained this from the Www-Authenticate response header from the challenge. -// refreshToken - must be a valid ACR refresh token -func (client BaseClient) GetAcrAccessToken(ctx context.Context, service string, scope string, refreshToken string) (result AccessToken, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAcrAccessToken") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAcrAccessTokenPreparer(ctx, service, scope, refreshToken) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrAccessToken", nil, "Failure preparing request") - return - } - - resp, err := client.GetAcrAccessTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrAccessToken", resp, "Failure sending request") - return - } - - result, err = client.GetAcrAccessTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrAccessToken", resp, "Failure responding to request") - return - } - - return -} - -// GetAcrAccessTokenPreparer prepares the GetAcrAccessToken request. -func (client BaseClient) GetAcrAccessTokenPreparer(ctx context.Context, service string, scope string, refreshToken string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - formDataParameters := map[string]interface{}{ - "grant_type": "refresh_token", - "refresh_token": refreshToken, - "scope": scope, - "service": service, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPath("/oauth2/token"), - autorest.WithFormData(autorest.MapToValues(formDataParameters))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAcrAccessTokenSender sends the GetAcrAccessToken request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetAcrAccessTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAcrAccessTokenResponder handles the response to the GetAcrAccessToken request. The method always -// closes the http.Response Body. -func (client BaseClient) GetAcrAccessTokenResponder(resp *http.Response) (result AccessToken, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAcrAccessTokenFromLogin exchange Username, Password and Scope an ACR Access Token -// Parameters: -// service - indicates the name of your Azure container registry. -// scope - expected to be a valid scope, and can be specified more than once for multiple scope requests. You -// can obtain this from the Www-Authenticate response header from the challenge. -func (client BaseClient) GetAcrAccessTokenFromLogin(ctx context.Context, service string, scope string) (result AccessToken, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAcrAccessTokenFromLogin") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAcrAccessTokenFromLoginPreparer(ctx, service, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrAccessTokenFromLogin", nil, "Failure preparing request") - return - } - - resp, err := client.GetAcrAccessTokenFromLoginSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrAccessTokenFromLogin", resp, "Failure sending request") - return - } - - result, err = client.GetAcrAccessTokenFromLoginResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrAccessTokenFromLogin", resp, "Failure responding to request") - return - } - - return -} - -// GetAcrAccessTokenFromLoginPreparer prepares the GetAcrAccessTokenFromLogin request. -func (client BaseClient) GetAcrAccessTokenFromLoginPreparer(ctx context.Context, service string, scope string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - queryParameters := map[string]interface{}{ - "scope": autorest.Encode("query", scope), - "service": autorest.Encode("query", service), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPath("/oauth2/token"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAcrAccessTokenFromLoginSender sends the GetAcrAccessTokenFromLogin request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetAcrAccessTokenFromLoginSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAcrAccessTokenFromLoginResponder handles the response to the GetAcrAccessTokenFromLogin request. The method always -// closes the http.Response Body. -func (client BaseClient) GetAcrAccessTokenFromLoginResponder(resp *http.Response) (result AccessToken, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAcrManifestAttributes get manifest attributes -// Parameters: -// name - name of the image (including the namespace) -// reference - a tag or a digest, pointing to a specific image -func (client BaseClient) GetAcrManifestAttributes(ctx context.Context, name string, reference string) (result AcrManifestAttributes, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAcrManifestAttributes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAcrManifestAttributesPreparer(ctx, name, reference) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrManifestAttributes", nil, "Failure preparing request") - return - } - - resp, err := client.GetAcrManifestAttributesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrManifestAttributes", resp, "Failure sending request") - return - } - - result, err = client.GetAcrManifestAttributesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrManifestAttributes", resp, "Failure responding to request") - return - } - - return -} - -// GetAcrManifestAttributesPreparer prepares the GetAcrManifestAttributes request. -func (client BaseClient) GetAcrManifestAttributesPreparer(ctx context.Context, name string, reference string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "reference": autorest.Encode("path", reference), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}/_manifests/{reference}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAcrManifestAttributesSender sends the GetAcrManifestAttributes request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetAcrManifestAttributesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAcrManifestAttributesResponder handles the response to the GetAcrManifestAttributes request. The method always -// closes the http.Response Body. -func (client BaseClient) GetAcrManifestAttributesResponder(resp *http.Response) (result AcrManifestAttributes, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAcrManifests list manifests of a repository -// Parameters: -// name - name of the image (including the namespace) -// last - query parameter for the last item in previous query. Result set will include values lexically after -// last. -// n - query parameter for max number of items -// orderby - orderby query parameter -func (client BaseClient) GetAcrManifests(ctx context.Context, name string, last string, n *int32, orderby string) (result AcrManifests, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAcrManifests") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAcrManifestsPreparer(ctx, name, last, n, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrManifests", nil, "Failure preparing request") - return - } - - resp, err := client.GetAcrManifestsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrManifests", resp, "Failure sending request") - return - } - - result, err = client.GetAcrManifestsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrManifests", resp, "Failure responding to request") - return - } - - return -} - -// GetAcrManifestsPreparer prepares the GetAcrManifests request. -func (client BaseClient) GetAcrManifestsPreparer(ctx context.Context, name string, last string, n *int32, orderby string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - } - - queryParameters := map[string]interface{}{} - if len(last) > 0 { - queryParameters["last"] = autorest.Encode("query", last) - } - if n != nil { - queryParameters["n"] = autorest.Encode("query", *n) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}/_manifests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAcrManifestsSender sends the GetAcrManifests request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetAcrManifestsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAcrManifestsResponder handles the response to the GetAcrManifests request. The method always -// closes the http.Response Body. -func (client BaseClient) GetAcrManifestsResponder(resp *http.Response) (result AcrManifests, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAcrRefreshTokenFromExchange exchange AAD tokens for an ACR refresh Token -// Parameters: -// grantType - can take a value of access_token_refresh_token, or access_token, or refresh_token -// service - indicates the name of your Azure container registry. -// tenant - AAD tenant associated to the AAD credentials. -// refreshToken - AAD refresh token, mandatory when grant_type is access_token_refresh_token or refresh_token -// accessToken - AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. -func (client BaseClient) GetAcrRefreshTokenFromExchange(ctx context.Context, grantType string, service string, tenant string, refreshToken string, accessToken string) (result RefreshToken, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAcrRefreshTokenFromExchange") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAcrRefreshTokenFromExchangePreparer(ctx, grantType, service, tenant, refreshToken, accessToken) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrRefreshTokenFromExchange", nil, "Failure preparing request") - return - } - - resp, err := client.GetAcrRefreshTokenFromExchangeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrRefreshTokenFromExchange", resp, "Failure sending request") - return - } - - result, err = client.GetAcrRefreshTokenFromExchangeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrRefreshTokenFromExchange", resp, "Failure responding to request") - return - } - - return -} - -// GetAcrRefreshTokenFromExchangePreparer prepares the GetAcrRefreshTokenFromExchange request. -func (client BaseClient) GetAcrRefreshTokenFromExchangePreparer(ctx context.Context, grantType string, service string, tenant string, refreshToken string, accessToken string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - formDataParameters := map[string]interface{}{ - "grant_type": grantType, - "service": service, - } - if len(tenant) > 0 { - formDataParameters["tenant"] = tenant - } - if len(refreshToken) > 0 { - formDataParameters["refresh_token"] = refreshToken - } - if len(accessToken) > 0 { - formDataParameters["access_token"] = accessToken - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPath("/oauth2/exchange"), - autorest.WithFormData(autorest.MapToValues(formDataParameters))) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAcrRefreshTokenFromExchangeSender sends the GetAcrRefreshTokenFromExchange request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetAcrRefreshTokenFromExchangeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAcrRefreshTokenFromExchangeResponder handles the response to the GetAcrRefreshTokenFromExchange request. The method always -// closes the http.Response Body. -func (client BaseClient) GetAcrRefreshTokenFromExchangeResponder(resp *http.Response) (result RefreshToken, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAcrRepositories list repositories -// Parameters: -// last - query parameter for the last item in previous query. Result set will include values lexically after -// last. -// n - query parameter for max number of items -func (client BaseClient) GetAcrRepositories(ctx context.Context, last string, n *int32) (result Repositories, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAcrRepositories") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAcrRepositoriesPreparer(ctx, last, n) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrRepositories", nil, "Failure preparing request") - return - } - - resp, err := client.GetAcrRepositoriesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrRepositories", resp, "Failure sending request") - return - } - - result, err = client.GetAcrRepositoriesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrRepositories", resp, "Failure responding to request") - return - } - - return -} - -// GetAcrRepositoriesPreparer prepares the GetAcrRepositories request. -func (client BaseClient) GetAcrRepositoriesPreparer(ctx context.Context, last string, n *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - queryParameters := map[string]interface{}{} - if len(last) > 0 { - queryParameters["last"] = autorest.Encode("query", last) - } - if n != nil { - queryParameters["n"] = autorest.Encode("query", *n) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPath("/acr/v1/_catalog"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAcrRepositoriesSender sends the GetAcrRepositories request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetAcrRepositoriesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAcrRepositoriesResponder handles the response to the GetAcrRepositories request. The method always -// closes the http.Response Body. -func (client BaseClient) GetAcrRepositoriesResponder(resp *http.Response) (result Repositories, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAcrRepositoryAttributes get repository attributes -// Parameters: -// name - name of the image (including the namespace) -func (client BaseClient) GetAcrRepositoryAttributes(ctx context.Context, name string) (result RepositoryAttributes, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAcrRepositoryAttributes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAcrRepositoryAttributesPreparer(ctx, name) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrRepositoryAttributes", nil, "Failure preparing request") - return - } - - resp, err := client.GetAcrRepositoryAttributesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrRepositoryAttributes", resp, "Failure sending request") - return - } - - result, err = client.GetAcrRepositoryAttributesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrRepositoryAttributes", resp, "Failure responding to request") - return - } - - return -} - -// GetAcrRepositoryAttributesPreparer prepares the GetAcrRepositoryAttributes request. -func (client BaseClient) GetAcrRepositoryAttributesPreparer(ctx context.Context, name string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAcrRepositoryAttributesSender sends the GetAcrRepositoryAttributes request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetAcrRepositoryAttributesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAcrRepositoryAttributesResponder handles the response to the GetAcrRepositoryAttributes request. The method always -// closes the http.Response Body. -func (client BaseClient) GetAcrRepositoryAttributesResponder(resp *http.Response) (result RepositoryAttributes, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAcrTagAttributes get tag attributes by tag -// Parameters: -// name - name of the image (including the namespace) -// reference - tag or digest of the target manifest -func (client BaseClient) GetAcrTagAttributes(ctx context.Context, name string, reference string) (result AcrTagAttributes, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAcrTagAttributes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAcrTagAttributesPreparer(ctx, name, reference) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrTagAttributes", nil, "Failure preparing request") - return - } - - resp, err := client.GetAcrTagAttributesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrTagAttributes", resp, "Failure sending request") - return - } - - result, err = client.GetAcrTagAttributesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrTagAttributes", resp, "Failure responding to request") - return - } - - return -} - -// GetAcrTagAttributesPreparer prepares the GetAcrTagAttributes request. -func (client BaseClient) GetAcrTagAttributesPreparer(ctx context.Context, name string, reference string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "reference": autorest.Encode("path", reference), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}/_tags/{reference}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAcrTagAttributesSender sends the GetAcrTagAttributes request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetAcrTagAttributesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAcrTagAttributesResponder handles the response to the GetAcrTagAttributes request. The method always -// closes the http.Response Body. -func (client BaseClient) GetAcrTagAttributesResponder(resp *http.Response) (result AcrTagAttributes, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAcrTags list tags of a repository -// Parameters: -// name - name of the image (including the namespace) -// last - query parameter for the last item in previous query. Result set will include values lexically after -// last. -// n - query parameter for max number of items -// orderby - orderby query parameter -// digest - filter by digest -func (client BaseClient) GetAcrTags(ctx context.Context, name string, last string, n *int32, orderby string, digest string) (result AcrRepositoryTags, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAcrTags") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAcrTagsPreparer(ctx, name, last, n, orderby, digest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrTags", nil, "Failure preparing request") - return - } - - resp, err := client.GetAcrTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrTags", resp, "Failure sending request") - return - } - - result, err = client.GetAcrTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetAcrTags", resp, "Failure responding to request") - return - } - - return -} - -// GetAcrTagsPreparer prepares the GetAcrTags request. -func (client BaseClient) GetAcrTagsPreparer(ctx context.Context, name string, last string, n *int32, orderby string, digest string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - } - - queryParameters := map[string]interface{}{} - if len(last) > 0 { - queryParameters["last"] = autorest.Encode("query", last) - } - if n != nil { - queryParameters["n"] = autorest.Encode("query", *n) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(digest) > 0 { - queryParameters["digest"] = autorest.Encode("query", digest) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}/_tags", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAcrTagsSender sends the GetAcrTags request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetAcrTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAcrTagsResponder handles the response to the GetAcrTags request. The method always -// closes the http.Response Body. -func (client BaseClient) GetAcrTagsResponder(resp *http.Response) (result AcrRepositoryTags, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDockerRegistryV2Support tells whether this Docker Registry instance supports Docker Registry HTTP API v2 -func (client BaseClient) GetDockerRegistryV2Support(ctx context.Context) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDockerRegistryV2Support") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDockerRegistryV2SupportPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetDockerRegistryV2Support", nil, "Failure preparing request") - return - } - - resp, err := client.GetDockerRegistryV2SupportSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetDockerRegistryV2Support", resp, "Failure sending request") - return - } - - result, err = client.GetDockerRegistryV2SupportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetDockerRegistryV2Support", resp, "Failure responding to request") - return - } - - return -} - -// GetDockerRegistryV2SupportPreparer prepares the GetDockerRegistryV2Support request. -func (client BaseClient) GetDockerRegistryV2SupportPreparer(ctx context.Context) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPath("/v2/")) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDockerRegistryV2SupportSender sends the GetDockerRegistryV2Support request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetDockerRegistryV2SupportSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetDockerRegistryV2SupportResponder handles the response to the GetDockerRegistryV2Support request. The method always -// closes the http.Response Body. -func (client BaseClient) GetDockerRegistryV2SupportResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetManifest pulls the image manifest file associated with the specified name and reference. Reference may be a tag -// or a digest -// Parameters: -// name - name of the image (including the namespace) -// reference - a tag or a digest, pointing to a specific image -// accept - accept header string delimited by comma. For example, -// application/vnd.docker.distribution.manifest.v2+json -func (client BaseClient) GetManifest(ctx context.Context, name string, reference string, accept string) (result Manifest, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetManifest") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetManifestPreparer(ctx, name, reference, accept) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetManifest", nil, "Failure preparing request") - return - } - - resp, err := client.GetManifestSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetManifest", resp, "Failure sending request") - return - } - - result, err = client.GetManifestResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetManifest", resp, "Failure responding to request") - return - } - - return -} - -// GetManifestPreparer prepares the GetManifest request. -func (client BaseClient) GetManifestPreparer(ctx context.Context, name string, reference string, accept string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "reference": autorest.Encode("path", reference), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/v2/{name}/manifests/{reference}", pathParameters)) - if len(accept) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("accept", autorest.String(accept))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetManifestSender sends the GetManifest request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetManifestSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetManifestResponder handles the response to the GetManifest request. The method always -// closes the http.Response Body. -func (client BaseClient) GetManifestResponder(resp *http.Response) (result Manifest, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRepositories list repositories -// Parameters: -// last - query parameter for the last item in previous query. Result set will include values lexically after -// last. -// n - query parameter for max number of items -func (client BaseClient) GetRepositories(ctx context.Context, last string, n *int32) (result Repositories, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetRepositories") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetRepositoriesPreparer(ctx, last, n) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetRepositories", nil, "Failure preparing request") - return - } - - resp, err := client.GetRepositoriesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetRepositories", resp, "Failure sending request") - return - } - - result, err = client.GetRepositoriesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetRepositories", resp, "Failure responding to request") - return - } - - return -} - -// GetRepositoriesPreparer prepares the GetRepositories request. -func (client BaseClient) GetRepositoriesPreparer(ctx context.Context, last string, n *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - queryParameters := map[string]interface{}{} - if len(last) > 0 { - queryParameters["last"] = autorest.Encode("query", last) - } - if n != nil { - queryParameters["n"] = autorest.Encode("query", *n) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPath("/v2/_catalog"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetRepositoriesSender sends the GetRepositories request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetRepositoriesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetRepositoriesResponder handles the response to the GetRepositories request. The method always -// closes the http.Response Body. -func (client BaseClient) GetRepositoriesResponder(resp *http.Response) (result Repositories, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTagList fetch the tags under the repository identified by name -// Parameters: -// name - name of the image (including the namespace) -func (client BaseClient) GetTagList(ctx context.Context, name string) (result RepositoryTags, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetTagList") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetTagListPreparer(ctx, name) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetTagList", nil, "Failure preparing request") - return - } - - resp, err := client.GetTagListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetTagList", resp, "Failure sending request") - return - } - - result, err = client.GetTagListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "GetTagList", resp, "Failure responding to request") - return - } - - return -} - -// GetTagListPreparer prepares the GetTagList request. -func (client BaseClient) GetTagListPreparer(ctx context.Context, name string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/v2/{name}/tags/list", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTagListSender sends the GetTagList request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetTagListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetTagListResponder handles the response to the GetTagList request. The method always -// closes the http.Response Body. -func (client BaseClient) GetTagListResponder(resp *http.Response) (result RepositoryTags, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateAcrManifestAttributes update attributes of a manifest -// Parameters: -// name - name of the image (including the namespace) -// reference - a tag or a digest, pointing to a specific image -// value - repository attribute value -func (client BaseClient) UpdateAcrManifestAttributes(ctx context.Context, name string, reference string, value *ChangeableAttributes) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateAcrManifestAttributes") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateAcrManifestAttributesPreparer(ctx, name, reference, value) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "UpdateAcrManifestAttributes", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateAcrManifestAttributesSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "UpdateAcrManifestAttributes", resp, "Failure sending request") - return - } - - result, err = client.UpdateAcrManifestAttributesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "UpdateAcrManifestAttributes", resp, "Failure responding to request") - return - } - - return -} - -// UpdateAcrManifestAttributesPreparer prepares the UpdateAcrManifestAttributes request. -func (client BaseClient) UpdateAcrManifestAttributesPreparer(ctx context.Context, name string, reference string, value *ChangeableAttributes) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "reference": autorest.Encode("path", reference), - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}/_manifests/{reference}", pathParameters)) - if value != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(value)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateAcrManifestAttributesSender sends the UpdateAcrManifestAttributes request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) UpdateAcrManifestAttributesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateAcrManifestAttributesResponder handles the response to the UpdateAcrManifestAttributes request. The method always -// closes the http.Response Body. -func (client BaseClient) UpdateAcrManifestAttributesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdateAcrRepositoryAttributes update the attribute identified by `name` where `reference` is the name of the -// repository. -// Parameters: -// name - name of the image (including the namespace) -// value - repository attribute value -func (client BaseClient) UpdateAcrRepositoryAttributes(ctx context.Context, name string, value *ChangeableAttributes) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateAcrRepositoryAttributes") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateAcrRepositoryAttributesPreparer(ctx, name, value) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "UpdateAcrRepositoryAttributes", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateAcrRepositoryAttributesSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "UpdateAcrRepositoryAttributes", resp, "Failure sending request") - return - } - - result, err = client.UpdateAcrRepositoryAttributesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "UpdateAcrRepositoryAttributes", resp, "Failure responding to request") - return - } - - return -} - -// UpdateAcrRepositoryAttributesPreparer prepares the UpdateAcrRepositoryAttributes request. -func (client BaseClient) UpdateAcrRepositoryAttributesPreparer(ctx context.Context, name string, value *ChangeableAttributes) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}", pathParameters)) - if value != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(value)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateAcrRepositoryAttributesSender sends the UpdateAcrRepositoryAttributes request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) UpdateAcrRepositoryAttributesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateAcrRepositoryAttributesResponder handles the response to the UpdateAcrRepositoryAttributes request. The method always -// closes the http.Response Body. -func (client BaseClient) UpdateAcrRepositoryAttributesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdateAcrTagAttributes update tag attributes -// Parameters: -// name - name of the image (including the namespace) -// reference - tag or digest of the target manifest -// value - repository attribute value -func (client BaseClient) UpdateAcrTagAttributes(ctx context.Context, name string, reference string, value *ChangeableAttributes) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateAcrTagAttributes") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateAcrTagAttributesPreparer(ctx, name, reference, value) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "UpdateAcrTagAttributes", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateAcrTagAttributesSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "UpdateAcrTagAttributes", resp, "Failure sending request") - return - } - - result, err = client.UpdateAcrTagAttributesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.BaseClient", "UpdateAcrTagAttributes", resp, "Failure responding to request") - return - } - - return -} - -// UpdateAcrTagAttributesPreparer prepares the UpdateAcrTagAttributes request. -func (client BaseClient) UpdateAcrTagAttributesPreparer(ctx context.Context, name string, reference string, value *ChangeableAttributes) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "url": client.LoginURI, - } - - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "reference": autorest.Encode("path", reference), - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithCustomBaseURL("{url}", urlParameters), - autorest.WithPathParameters("/acr/v1/{name}/_tags/{reference}", pathParameters)) - if value != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(value)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateAcrTagAttributesSender sends the UpdateAcrTagAttributes request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) UpdateAcrTagAttributesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateAcrTagAttributesResponder handles the response to the UpdateAcrTagAttributes request. The method always -// closes the http.Response Body. -func (client BaseClient) UpdateAcrTagAttributesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/containerregistry/runtime/2019-07/containerregistry/containerregistryapi/interfaces.go b/services/preview/containerregistry/runtime/2019-07/containerregistry/containerregistryapi/interfaces.go deleted file mode 100644 index 0bfa841942b3..000000000000 --- a/services/preview/containerregistry/runtime/2019-07/containerregistry/containerregistryapi/interfaces.go +++ /dev/null @@ -1,39 +0,0 @@ -package containerregistryapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/containerregistry/runtime/2019-07/containerregistry" - "github.com/Azure/go-autorest/autorest" -) - -// BaseClientAPI contains the set of methods on the BaseClient type. -type BaseClientAPI interface { - CreateManifest(ctx context.Context, name string, reference string, payload containerregistry.Manifest) (result containerregistry.SetObject, err error) - DeleteAcrRepository(ctx context.Context, name string) (result containerregistry.DeletedRepository, err error) - DeleteAcrTag(ctx context.Context, name string, reference string) (result autorest.Response, err error) - DeleteManifest(ctx context.Context, name string, reference string) (result autorest.Response, err error) - GetAcrAccessToken(ctx context.Context, service string, scope string, refreshToken string) (result containerregistry.AccessToken, err error) - GetAcrAccessTokenFromLogin(ctx context.Context, service string, scope string) (result containerregistry.AccessToken, err error) - GetAcrManifestAttributes(ctx context.Context, name string, reference string) (result containerregistry.AcrManifestAttributes, err error) - GetAcrManifests(ctx context.Context, name string, last string, n *int32, orderby string) (result containerregistry.AcrManifests, err error) - GetAcrRefreshTokenFromExchange(ctx context.Context, grantType string, service string, tenant string, refreshToken string, accessToken string) (result containerregistry.RefreshToken, err error) - GetAcrRepositories(ctx context.Context, last string, n *int32) (result containerregistry.Repositories, err error) - GetAcrRepositoryAttributes(ctx context.Context, name string) (result containerregistry.RepositoryAttributes, err error) - GetAcrTagAttributes(ctx context.Context, name string, reference string) (result containerregistry.AcrTagAttributes, err error) - GetAcrTags(ctx context.Context, name string, last string, n *int32, orderby string, digest string) (result containerregistry.AcrRepositoryTags, err error) - GetDockerRegistryV2Support(ctx context.Context) (result autorest.Response, err error) - GetManifest(ctx context.Context, name string, reference string, accept string) (result containerregistry.Manifest, err error) - GetRepositories(ctx context.Context, last string, n *int32) (result containerregistry.Repositories, err error) - GetTagList(ctx context.Context, name string) (result containerregistry.RepositoryTags, err error) - UpdateAcrManifestAttributes(ctx context.Context, name string, reference string, value *containerregistry.ChangeableAttributes) (result autorest.Response, err error) - UpdateAcrRepositoryAttributes(ctx context.Context, name string, value *containerregistry.ChangeableAttributes) (result autorest.Response, err error) - UpdateAcrTagAttributes(ctx context.Context, name string, reference string, value *containerregistry.ChangeableAttributes) (result autorest.Response, err error) -} - -var _ BaseClientAPI = (*containerregistry.BaseClient)(nil) diff --git a/services/preview/containerregistry/runtime/2019-07/containerregistry/dataplane_meta.json b/services/preview/containerregistry/runtime/2019-07/containerregistry/dataplane_meta.json deleted file mode 100644 index 8273b300c53f..000000000000 --- a/services/preview/containerregistry/runtime/2019-07/containerregistry/dataplane_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/containerregistry/data-plane/readme.md", - "tag": "package-2019-07", - "use": "@microsoft.azure/autorest.go@2.1.183", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2019-07 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerregistry/data-plane/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/containerregistry/runtime/2019-07/containerregistry/models.go b/services/preview/containerregistry/runtime/2019-07/containerregistry/models.go deleted file mode 100644 index 8c1ab9d30b13..000000000000 --- a/services/preview/containerregistry/runtime/2019-07/containerregistry/models.go +++ /dev/null @@ -1,318 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/runtime/2019-07/containerregistry" - -// AccessToken ... -type AccessToken struct { - autorest.Response `json:"-"` - // AccessToken - The access token for performing authenticated requests - AccessToken *string `json:"access_token,omitempty"` -} - -// AcrErrorInfo error information -type AcrErrorInfo struct { - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message - Message *string `json:"message,omitempty"` - // Detail - Error details - Detail interface{} `json:"detail,omitempty"` -} - -// AcrErrors acr error response describing why the operation failed -type AcrErrors struct { - // Errors - Array of detailed error - Errors *[]AcrErrorInfo `json:"errors,omitempty"` -} - -// AcrManifestAttributes manifest attributes details -type AcrManifestAttributes struct { - autorest.Response `json:"-"` - // Registry - Registry name - Registry *string `json:"registry,omitempty"` - // ImageName - Image name - ImageName *string `json:"imageName,omitempty"` - // ManifestAttributes - Manifest attributes - ManifestAttributes *AcrManifestAttributesBase `json:"manifest,omitempty"` -} - -// AcrManifestAttributesBase manifest details -type AcrManifestAttributesBase struct { - // Digest - Manifest - Digest *string `json:"digest,omitempty"` - // ImageSize - Image size - ImageSize *int32 `json:"imageSize,omitempty"` - // CreatedTime - Created time - CreatedTime *string `json:"createdTime,omitempty"` - // LastUpdateTime - Last update time - LastUpdateTime *string `json:"lastUpdateTime,omitempty"` - // Architecture - CPU architecture - Architecture *string `json:"architecture,omitempty"` - // Os - Operating system - Os *string `json:"os,omitempty"` - // MediaType - Media type - MediaType *string `json:"mediaType,omitempty"` - // ConfigMediaType - Config blob media type - ConfigMediaType *string `json:"configMediaType,omitempty"` - // Tags - List of tags - Tags *[]string `json:"tags,omitempty"` - // ChangeableAttributes - Changeable attributes - ChangeableAttributes *ChangeableAttributes `json:"changeableAttributes,omitempty"` -} - -// AcrManifests manifest attributes -type AcrManifests struct { - autorest.Response `json:"-"` - // Registry - Registry name - Registry *string `json:"registry,omitempty"` - // ImageName - Image name - ImageName *string `json:"imageName,omitempty"` - // ManifestsAttributes - List of manifests - ManifestsAttributes *[]AcrManifestAttributesBase `json:"manifests,omitempty"` -} - -// AcrRepositoryTags list of tag details -type AcrRepositoryTags struct { - autorest.Response `json:"-"` - // Registry - Registry name - Registry *string `json:"registry,omitempty"` - // ImageName - Image name - ImageName *string `json:"imageName,omitempty"` - // TagsAttributes - List of tag attribute details - TagsAttributes *[]AcrTagAttributesBase `json:"tags,omitempty"` -} - -// AcrTagAttributes tag attributes -type AcrTagAttributes struct { - autorest.Response `json:"-"` - // Registry - Registry name - Registry *string `json:"registry,omitempty"` - // ImageName - Image name - ImageName *string `json:"imageName,omitempty"` - // TagAttributes - List of tag attribute details - TagAttributes *AcrTagAttributesBase `json:"tag,omitempty"` -} - -// AcrTagAttributesBase tag attribute details -type AcrTagAttributesBase struct { - // Name - Tag name - Name *string `json:"name,omitempty"` - // Digest - Tag digest - Digest *string `json:"digest,omitempty"` - // CreatedTime - Tag created time - CreatedTime *string `json:"createdTime,omitempty"` - // LastUpdateTime - Tag last update time - LastUpdateTime *string `json:"lastUpdateTime,omitempty"` - // Signed - Is signed - Signed *bool `json:"signed,omitempty"` - // ChangeableAttributes - Changeable attributes - ChangeableAttributes *ChangeableAttributes `json:"changeableAttributes,omitempty"` -} - -// ChangeableAttributes ... -type ChangeableAttributes struct { - // DeleteEnabled - Delete enabled - DeleteEnabled *bool `json:"deleteEnabled,omitempty"` - // WriteEnabled - Write enabled - WriteEnabled *bool `json:"writeEnabled,omitempty"` - // ListEnabled - List enabled - ListEnabled *bool `json:"listEnabled,omitempty"` - // ReadEnabled - Read enabled - ReadEnabled *bool `json:"readEnabled,omitempty"` -} - -// DeletedRepository deleted repository -type DeletedRepository struct { - autorest.Response `json:"-"` - // ManifestsDeleted - SHA of the deleted image - ManifestsDeleted *[]string `json:"manifestsDeleted,omitempty"` - // TagsDeleted - Tag of the deleted image - TagsDeleted *[]string `json:"tagsDeleted,omitempty"` -} - -// FsLayer image layer information -type FsLayer struct { - // BlobSum - SHA of an image layer - BlobSum *string `json:"blobSum,omitempty"` -} - -// History a list of unstructured historical data for v1 compatibility -type History struct { - // V1Compatibility - The raw v1 compatibility information - V1Compatibility *string `json:"v1Compatibility,omitempty"` -} - -// ImageSignature signature of a signed manifest -type ImageSignature struct { - // Header - A JSON web signature - Header *JWK `json:"header,omitempty"` - // Signature - A signature for the image manifest, signed by a libtrust private key - Signature *string `json:"signature,omitempty"` - // Protected - The signed protected header - Protected *string `json:"protected,omitempty"` -} - -// JWK a JSON web signature -type JWK struct { - Jwk *JWKHeader `json:"jwk,omitempty"` - // Alg - The algorithm used to sign or encrypt the JWT - Alg *string `json:"alg,omitempty"` -} - -// JWKHeader JSON web key parameter -type JWKHeader struct { - // Crv - crv value - Crv *string `json:"crv,omitempty"` - // Kid - kid value - Kid *string `json:"kid,omitempty"` - // Kty - kty value - Kty *string `json:"kty,omitempty"` - // X - x value - X *string `json:"x,omitempty"` - // Y - y value - Y *string `json:"y,omitempty"` -} - -// Manifest returns the requested manifest file -type Manifest struct { - autorest.Response `json:"-"` - // SchemaVersion - Schema version - SchemaVersion *int32 `json:"schemaVersion,omitempty"` - // MediaType - Media type usually application/vnd.docker.distribution.manifest.v2+json if this is in the accept header - MediaType *string `json:"mediaType,omitempty"` - // Config - V2 image config descriptor - Config *V2Descriptor `json:"config,omitempty"` - // Layers - List of V2 image layer information - Layers *[]V2Descriptor `json:"layers,omitempty"` - // Architecture - CPU architecture - Architecture *string `json:"architecture,omitempty"` - // Name - Image name - Name *string `json:"name,omitempty"` - // Tag - Image tag - Tag *string `json:"tag,omitempty"` - // FsLayers - List of layer information - FsLayers *[]FsLayer `json:"fsLayers,omitempty"` - // History - Image history - History *[]History `json:"history,omitempty"` - // Signatures - Image signature - Signatures *[]ImageSignature `json:"signatures,omitempty"` -} - -// ManifestAttributesManifest list of manifest attributes -type ManifestAttributesManifest struct { - // References - List of manifest attributes details - References *[]ManifestAttributesManifestReferences `json:"references,omitempty"` - // QuarantineTag - Quarantine tag name - QuarantineTag *string `json:"quarantineTag,omitempty"` -} - -// ManifestAttributesManifestReferences manifest attributes details -type ManifestAttributesManifestReferences struct { - // Digest - Manifest digest - Digest *string `json:"digest,omitempty"` - // Architecture - CPU architecture - Architecture *string `json:"architecture,omitempty"` - // Os - Operating system - Os *string `json:"os,omitempty"` -} - -// ManifestChangeableAttributes changeable attributes -type ManifestChangeableAttributes struct { - // DeleteEnabled - Delete enabled - DeleteEnabled *bool `json:"deleteEnabled,omitempty"` - // WriteEnabled - Write enabled - WriteEnabled *bool `json:"writeEnabled,omitempty"` - // ListEnabled - List enabled - ListEnabled *bool `json:"listEnabled,omitempty"` - // ReadEnabled - Read enabled - ReadEnabled *bool `json:"readEnabled,omitempty"` - // QuarantineState - Quarantine state - QuarantineState *string `json:"quarantineState,omitempty"` - // QuarantineDetails - Quarantine details - QuarantineDetails *string `json:"quarantineDetails,omitempty"` -} - -// RefreshToken ... -type RefreshToken struct { - autorest.Response `json:"-"` - // RefreshToken - The refresh token to be used for generating access tokens - RefreshToken *string `json:"refresh_token,omitempty"` -} - -// Repositories list of repositories -type Repositories struct { - autorest.Response `json:"-"` - // Names - Repository names - Names *[]string `json:"repositories,omitempty"` -} - -// RepositoryAttributes repository attributes -type RepositoryAttributes struct { - autorest.Response `json:"-"` - // Registry - Registry name - Registry *string `json:"registry,omitempty"` - // ImageName - Image name - ImageName *string `json:"imageName,omitempty"` - // CreatedTime - Image created time - CreatedTime *string `json:"createdTime,omitempty"` - // LastUpdateTime - Image last update time - LastUpdateTime *string `json:"lastUpdateTime,omitempty"` - // ManifestCount - Number of the manifests - ManifestCount *int32 `json:"manifestCount,omitempty"` - // TagCount - Number of the tags - TagCount *int32 `json:"tagCount,omitempty"` - // ChangeableAttributes - Changeable attributes - ChangeableAttributes *ChangeableAttributes `json:"changeableAttributes,omitempty"` -} - -// RepositoryTags result of the request to list tags of the image -type RepositoryTags struct { - autorest.Response `json:"-"` - // Name - Name of the image - Name *string `json:"name,omitempty"` - // Tags - List of tags - Tags *[]string `json:"tags,omitempty"` -} - -// SetObject ... -type SetObject struct { - autorest.Response `json:"-"` - Value interface{} `json:"value,omitempty"` -} - -// TagAttributes tag attributes -type TagAttributes struct { - // Registry - Registry name - Registry *string `json:"registry,omitempty"` - // ImageName - Image name - ImageName *string `json:"imageName,omitempty"` - // Tag - Tag attributes - Tag *TagAttributesTag `json:"tag,omitempty"` -} - -// TagAttributesTag tag -type TagAttributesTag struct { - // SignatureRecord - SignatureRecord value - SignatureRecord *string `json:"signatureRecord,omitempty"` -} - -// V2Descriptor docker V2 image layer descriptor including config and layers -type V2Descriptor struct { - // MediaType - Layer media type - MediaType *string `json:"mediaType,omitempty"` - // Size - Layer size - Size *int32 `json:"size,omitempty"` - // Digest - Layer digest - Digest *string `json:"digest,omitempty"` -} diff --git a/services/preview/containerregistry/runtime/2019-07/containerregistry/version.go b/services/preview/containerregistry/runtime/2019-07/containerregistry/version.go deleted file mode 100644 index fb4935206ed8..000000000000 --- a/services/preview/containerregistry/runtime/2019-07/containerregistry/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerregistry - -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() + " containerregistry/2019-07-15-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/CHANGELOG.md b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/_meta.json b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/_meta.json deleted file mode 100644 index 44f8b2aecd32..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "tag": "package-2019-08-preview", - "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-2019-08-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/cassandraresources.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/cassandraresources.go deleted file mode 100644 index d9a29639df0c..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/cassandraresources.go +++ /dev/null @@ -1,1200 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CassandraResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type CassandraResourcesClient struct { - BaseClient -} - -// NewCassandraResourcesClient creates an instance of the CassandraResourcesClient client. -func NewCassandraResourcesClient(subscriptionID string) CassandraResourcesClient { - return NewCassandraResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCassandraResourcesClientWithBaseURI creates an instance of the CassandraResourcesClient 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 NewCassandraResourcesClientWithBaseURI(baseURI string, subscriptionID string) CassandraResourcesClient { - return CassandraResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateCassandraKeyspace create or update an Azure Cosmos DB Cassandra keyspace -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// createUpdateCassandraKeyspaceParameters - the parameters to provide for the current Cassandra keyspace. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraKeyspaceParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", err.Error()) - } - - req, err := client.CreateUpdateCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraKeyspacePreparer prepares the CreateUpdateCassandraKeyspace request. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithJSON(createUpdateCassandraKeyspaceParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraKeyspaceSender sends the CreateUpdateCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraKeyspaceFuture, 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 -} - -// CreateUpdateCassandraKeyspaceResponder handles the response to the CreateUpdateCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateCassandraTable create or update an Azure Cosmos DB Cassandra Table -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// createUpdateCassandraTableParameters - the parameters to provide for the current Cassandra Table. -func (client CassandraResourcesClient) CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", err.Error()) - } - - req, err := client.CreateUpdateCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraTablePreparer prepares the CreateUpdateCassandraTable request. -func (client CassandraResourcesClient) CreateUpdateCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateCassandraTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraTableSender sends the CreateUpdateCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraTableSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraTableFuture, 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 -} - -// CreateUpdateCassandraTableResponder handles the response to the CreateUpdateCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCassandraKeyspace deletes an existing Azure Cosmos DB Cassandra keyspace. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesDeleteCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", err.Error()) - } - - req, err := client.DeleteCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraKeyspacePreparer prepares the DeleteCassandraKeyspace request. -func (client CassandraResourcesClient) DeleteCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraKeyspaceSender sends the DeleteCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesDeleteCassandraKeyspaceFuture, 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 -} - -// DeleteCassandraKeyspaceResponder handles the response to the DeleteCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceResponder(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 -} - -// DeleteCassandraTable deletes an existing Azure Cosmos DB Cassandra table. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesDeleteCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraTable", err.Error()) - } - - req, err := client.DeleteCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraTablePreparer prepares the DeleteCassandraTable request. -func (client CassandraResourcesClient) DeleteCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraTableSender sends the DeleteCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraTableSender(req *http.Request) (future CassandraResourcesDeleteCassandraTableFuture, 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 -} - -// DeleteCassandraTableResponder handles the response to the DeleteCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraTableResponder(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 -} - -// GetCassandraKeyspace gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraKeyspaceGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspace") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspace", err.Error()) - } - - req, err := client.GetCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspacePreparer prepares the GetCassandraKeyspace request. -func (client CassandraResourcesClient) GetCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceSender sends the GetCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceResponder handles the response to the GetCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraKeyspaceThroughput gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspaceThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.GetCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspaceThroughputPreparer prepares the GetCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceThroughputSender sends the GetCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceThroughputResponder handles the response to the GetCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTable gets the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraTableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTable", err.Error()) - } - - req, err := client.GetCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTablePreparer prepares the GetCassandraTable request. -func (client CassandraResourcesClient) GetCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableSender sends the GetCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableResponder handles the response to the GetCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTableThroughput gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", err.Error()) - } - - req, err := client.GetCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTableThroughputPreparer prepares the GetCassandraTableThroughput request. -func (client CassandraResourcesClient) GetCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableThroughputSender sends the GetCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableThroughputResponder handles the response to the GetCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraKeyspaces lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client CassandraResourcesClient) ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result CassandraKeyspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraKeyspaces") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", err.Error()) - } - - req, err := client.ListCassandraKeyspacesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraKeyspacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraKeyspacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraKeyspacesPreparer prepares the ListCassandraKeyspaces request. -func (client CassandraResourcesClient) ListCassandraKeyspacesPreparer(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 = "2019-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraKeyspacesSender sends the ListCassandraKeyspaces request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraKeyspacesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraKeyspacesResponder handles the response to the ListCassandraKeyspaces request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraKeyspacesResponder(resp *http.Response) (result CassandraKeyspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraTables lists the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraTableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraTables", err.Error()) - } - - req, err := client.ListCassandraTablesPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraTablesPreparer prepares the ListCassandraTables request. -func (client CassandraResourcesClient) ListCassandraTablesPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraTablesSender sends the ListCassandraTables request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraTablesResponder handles the response to the ListCassandraTables request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraTablesResponder(resp *http.Response) (result CassandraTableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraKeyspaceThroughput update RUs per second of an Azure Cosmos DB Cassandra Keyspace -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// Keyspace. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraKeyspaceThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.UpdateCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraKeyspaceThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraKeyspaceThroughputPreparer prepares the UpdateCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraKeyspaceThroughputSender sends the UpdateCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, 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 -} - -// UpdateCassandraKeyspaceThroughputResponder handles the response to the UpdateCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraTableThroughput update RUs per second of an Azure Cosmos DB Cassandra table -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// table. -func (client CassandraResourcesClient) UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", err.Error()) - } - - req, err := client.UpdateCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraTableThroughputPreparer prepares the UpdateCassandraTableThroughput request. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraTableThroughputSender sends the UpdateCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraTableThroughputFuture, 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 -} - -// UpdateCassandraTableThroughputResponder handles the response to the UpdateCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/client.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/client.go deleted file mode 100644 index 441fa83a45d3..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package documentdb implements the Azure ARM Documentdb service API version . -// -// Azure Cosmos DB Database Service Resource Provider REST API -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Documentdb - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Documentdb. -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/cosmos-db/mgmt/2019-08-01-preview/documentdb/collection.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collection.go deleted file mode 100644 index bb21cc70da56..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collection.go +++ /dev/null @@ -1,323 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionClient struct { - BaseClient -} - -// NewCollectionClient creates an instance of the CollectionClient client. -func NewCollectionClient(subscriptionID string) CollectionClient { - return NewCollectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionClientWithBaseURI creates an instance of the CollectionClient 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 NewCollectionClientWithBaseURI(baseURI string, subscriptionID string) CollectionClient { - return CollectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -func (client CollectionClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client CollectionClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionpartition.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionpartition.go deleted file mode 100644 index c201ae3399ac..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionpartition.go +++ /dev/null @@ -1,230 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionClient struct { - BaseClient -} - -// NewCollectionPartitionClient creates an instance of the CollectionPartitionClient client. -func NewCollectionPartitionClient(subscriptionID string) CollectionPartitionClient { - return NewCollectionPartitionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionClientWithBaseURI creates an instance of the CollectionPartitionClient 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 NewCollectionPartitionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionClient { - return CollectionPartitionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection, split by partition. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection, split by partition. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionPartitionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionUsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionPartitionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListUsagesResponder(resp *http.Response) (result PartitionUsagesResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionpartitionregion.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionpartitionregion.go deleted file mode 100644 index 1eaf4887be5f..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionpartitionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionRegionClient struct { - BaseClient -} - -// NewCollectionPartitionRegionClient creates an instance of the CollectionPartitionRegionClient client. -func NewCollectionPartitionRegionClient(subscriptionID string) CollectionPartitionRegionClient { - return NewCollectionPartitionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionRegionClientWithBaseURI creates an instance of the CollectionPartitionRegionClient 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 NewCollectionPartitionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionRegionClient { - return CollectionPartitionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection and region, split by -// partition. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionregion.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionregion.go deleted file mode 100644 index 96332d537d8c..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/collectionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionRegionClient struct { - BaseClient -} - -// NewCollectionRegionClient creates an instance of the CollectionRegionClient client. -func NewCollectionRegionClient(subscriptionID string) CollectionRegionClient { - return NewCollectionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionRegionClientWithBaseURI creates an instance of the CollectionRegionClient 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 NewCollectionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionRegionClient { - return CollectionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account, collection and -// region. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/database.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/database.go deleted file mode 100644 index 1f9b8372ff6e..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/database.go +++ /dev/null @@ -1,317 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseClient struct { - BaseClient -} - -// NewDatabaseClient creates an instance of the DatabaseClient client. -func NewDatabaseClient(subscriptionID string) DatabaseClient { - return NewDatabaseClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseClientWithBaseURI creates an instance of the DatabaseClient 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 NewDatabaseClientWithBaseURI(baseURI string, subscriptionID string) DatabaseClient { - return DatabaseClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -func (client DatabaseClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/databaseaccountregion.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/databaseaccountregion.go deleted file mode 100644 index 3fe1f8f9388d..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/databaseaccountregion.go +++ /dev/null @@ -1,129 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountRegionClient struct { - BaseClient -} - -// NewDatabaseAccountRegionClient creates an instance of the DatabaseAccountRegionClient client. -func NewDatabaseAccountRegionClient(subscriptionID string) DatabaseAccountRegionClient { - return NewDatabaseAccountRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountRegionClientWithBaseURI creates an instance of the DatabaseAccountRegionClient 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 NewDatabaseAccountRegionClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountRegionClient { - return DatabaseAccountRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and region. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/databaseaccounts.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/databaseaccounts.go deleted file mode 100644 index 7c2c1b3869b6..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/databaseaccounts.go +++ /dev/null @@ -1,1692 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountsClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountsClient struct { - BaseClient -} - -// NewDatabaseAccountsClient creates an instance of the DatabaseAccountsClient client. -func NewDatabaseAccountsClient(subscriptionID string) DatabaseAccountsClient { - return NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountsClientWithBaseURI creates an instance of the DatabaseAccountsClient 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 NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountsClient { - return DatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameExists checks that the Azure Cosmos DB account name already exists. A valid account name may contain only -// lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. -// Parameters: -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.CheckNameExists") - 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: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CheckNameExists", err.Error()) - } - - req, err := client.CheckNameExistsPreparer(ctx, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") - return - } - - result, err = client.CheckNameExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameExistsPreparer prepares the CheckNameExists request. -func (client DatabaseAccountsClient) CheckNameExistsPreparer(ctx context.Context, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameExistsSender sends the CheckNameExists request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) CheckNameExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CheckNameExistsResponder handles the response to the CheckNameExists request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when -// performing updates on an account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// createUpdateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (result DatabaseAccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateParameters, - Constraints: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMaximum, Rule: int64(2147483647), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: int64(86400), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: int64(5), Chain: nil}, - }}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.DatabaseAccountOfferType", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, createUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(createUpdateParameters), - 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 DatabaseAccountsClient) CreateOrUpdateSender(req *http.Request) (future DatabaseAccountsCreateOrUpdateFuture, 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 DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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 existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseAccountsClient) 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 = "2019-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) DeleteSender(req *http.Request) (future DatabaseAccountsDeleteFuture, 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 DatabaseAccountsClient) 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 -} - -// FailoverPriorityChange changes the failover priority for the Azure Cosmos DB database account. A failover priority -// of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover -// priority values must be unique for each of the regions in which the database account exists. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// failoverParameters - the new failover policies for the database account. -func (client DatabaseAccountsClient) FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (result DatabaseAccountsFailoverPriorityChangeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.FailoverPriorityChange") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: failoverParameters, - Constraints: []validation.Constraint{{Target: "failoverParameters.FailoverPolicies", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "FailoverPriorityChange", err.Error()) - } - - req, err := client.FailoverPriorityChangePreparer(ctx, resourceGroupName, accountName, failoverParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") - return - } - - result, err = client.FailoverPriorityChangeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPriorityChangePreparer prepares the FailoverPriorityChange request. -func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", pathParameters), - autorest.WithJSON(failoverParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverPriorityChangeSender sends the FailoverPriorityChange request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) FailoverPriorityChangeSender(req *http.Request) (future DatabaseAccountsFailoverPriorityChangeFuture, 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 -} - -// FailoverPriorityChangeResponder handles the response to the FailoverPriorityChange request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(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 retrieves the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseAccountsClient) 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 = "2019-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) 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 DatabaseAccountsClient) GetResponder(resp *http.Response) (result DatabaseAccountGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.GetReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", err.Error()) - } - - req, err := client.GetReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.GetReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// GetReadOnlyKeysPreparer prepares the GetReadOnlyKeys request. -func (client DatabaseAccountsClient) GetReadOnlyKeysPreparer(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 = "2019-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetReadOnlyKeysSender sends the GetReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) GetReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetReadOnlyKeysResponder handles the response to the GetReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) GetReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, 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 the Azure Cosmos DB database accounts available under the subscription. -func (client DatabaseAccountsClient) List(ctx context.Context) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DatabaseAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the Azure Cosmos DB database accounts available under the given resource group. -// Parameters: -// resourceGroupName - name of an Azure resource group. -func (client DatabaseAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DatabaseAccountsClient) 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 = "2019-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.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionStrings lists the connection strings for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListConnectionStrings") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListConnectionStrings", err.Error()) - } - - req, err := client.ListConnectionStringsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionStringsPreparer prepares the ListConnectionStrings request. -func (client DatabaseAccountsClient) ListConnectionStringsPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.Response) (result DatabaseAccountListConnectionStringsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DatabaseAccountsClient) ListKeysPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (result DatabaseAccountListKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions retrieves metric definitions for the given database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseAccountsClient) ListMetricDefinitionsPreparer(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 = "2019-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.DocumentDB/databaseAccounts/{accountName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountsClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", err.Error()) - } - - req, err := client.ListReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.ListReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListReadOnlyKeysPreparer prepares the ListReadOnlyKeys request. -func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListReadOnlyKeysSender sends the ListReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListReadOnlyKeysResponder handles the response to the ListReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseAccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseAccountsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// regionParameterForOffline - cosmos DB region to offline for the database account. -func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (result DatabaseAccountsOfflineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OfflineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOffline, - Constraints: []validation.Constraint{{Target: "regionParameterForOffline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OfflineRegion", err.Error()) - } - - req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOffline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OfflineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OfflineRegionPreparer prepares the OfflineRegion request. -func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/offlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOffline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OfflineRegionSender sends the OfflineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OfflineRegionSender(req *http.Request) (future DatabaseAccountsOfflineRegionFuture, 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 -} - -// OfflineRegionResponder handles the response to the OfflineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// OnlineRegion online the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// regionParameterForOnline - cosmos DB region to online for the database account. -func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (result DatabaseAccountsOnlineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OnlineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOnline, - Constraints: []validation.Constraint{{Target: "regionParameterForOnline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OnlineRegion", err.Error()) - } - - req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOnline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OnlineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OnlineRegionPreparer prepares the OnlineRegion request. -func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/onlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOnline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OnlineRegionSender sends the OnlineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OnlineRegionSender(req *http.Request) (future DatabaseAccountsOnlineRegionFuture, 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 -} - -// OnlineRegionResponder handles the response to the OnlineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OnlineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateKey regenerates an access key for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyToRegenerate - the name of the key to regenerate. -func (client DatabaseAccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (result DatabaseAccountsRegenerateKeyFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.RegenerateKey") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, keyToRegenerate) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateKeySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DatabaseAccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(keyToRegenerate), - 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 DatabaseAccountsClient) RegenerateKeySender(req *http.Request) (future DatabaseAccountsRegenerateKeyFuture, 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 -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) RegenerateKeyResponder(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 the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// updateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (result DatabaseAccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabaseAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 DatabaseAccountsClient) UpdateSender(req *http.Request) (future DatabaseAccountsUpdateFuture, 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 DatabaseAccountsClient) UpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/documentdbapi/interfaces.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/documentdbapi/interfaces.go deleted file mode 100644 index acb5a4f6ca02..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/documentdbapi/interfaces.go +++ /dev/null @@ -1,254 +0,0 @@ -package documentdbapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/cosmos-db/mgmt/2019-08-01-preview/documentdb" - "github.com/Azure/go-autorest/autorest" -) - -// DatabaseAccountsClientAPI contains the set of methods on the DatabaseAccountsClient type. -type DatabaseAccountsClientAPI interface { - CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters documentdb.DatabaseAccountCreateUpdateParameters) (result documentdb.DatabaseAccountsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountsDeleteFuture, err error) - FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters documentdb.FailoverPolicies) (result documentdb.DatabaseAccountsFailoverPriorityChangeFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountGetResults, err error) - GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - List(ctx context.Context) (result documentdb.DatabaseAccountsListResult, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result documentdb.DatabaseAccountsListResult, err error) - ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListConnectionStringsResult, err error) - ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListKeysResult, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.MetricListResult, err error) - ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.UsagesResult, err error) - OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOfflineRegionFuture, err error) - OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOnlineRegionFuture, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate documentdb.DatabaseAccountRegenerateKeyParameters) (result documentdb.DatabaseAccountsRegenerateKeyFuture, err error) - Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters documentdb.DatabaseAccountUpdateParameters) (result documentdb.DatabaseAccountsUpdateFuture, err error) -} - -var _ DatabaseAccountsClientAPI = (*documentdb.DatabaseAccountsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result documentdb.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result documentdb.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*documentdb.OperationsClient)(nil) - -// DatabaseClientAPI contains the set of methods on the DatabaseClient type. -type DatabaseClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ DatabaseClientAPI = (*documentdb.DatabaseClient)(nil) - -// CollectionClientAPI contains the set of methods on the CollectionClient type. -type CollectionClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ CollectionClientAPI = (*documentdb.CollectionClient)(nil) - -// CollectionRegionClientAPI contains the set of methods on the CollectionRegionClient type. -type CollectionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ CollectionRegionClientAPI = (*documentdb.CollectionRegionClient)(nil) - -// DatabaseAccountRegionClientAPI contains the set of methods on the DatabaseAccountRegionClient type. -type DatabaseAccountRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ DatabaseAccountRegionClientAPI = (*documentdb.DatabaseAccountRegionClient)(nil) - -// PercentileSourceTargetClientAPI contains the set of methods on the PercentileSourceTargetClient type. -type PercentileSourceTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileSourceTargetClientAPI = (*documentdb.PercentileSourceTargetClient)(nil) - -// PercentileTargetClientAPI contains the set of methods on the PercentileTargetClient type. -type PercentileTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileTargetClientAPI = (*documentdb.PercentileTargetClient)(nil) - -// PercentileClientAPI contains the set of methods on the PercentileClient type. -type PercentileClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileClientAPI = (*documentdb.PercentileClient)(nil) - -// CollectionPartitionRegionClientAPI contains the set of methods on the CollectionPartitionRegionClient type. -type CollectionPartitionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ CollectionPartitionRegionClientAPI = (*documentdb.CollectionPartitionRegionClient)(nil) - -// CollectionPartitionClientAPI contains the set of methods on the CollectionPartitionClient type. -type CollectionPartitionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionUsagesResult, err error) -} - -var _ CollectionPartitionClientAPI = (*documentdb.CollectionPartitionClient)(nil) - -// PartitionKeyRangeIDClientAPI contains the set of methods on the PartitionKeyRangeIDClient type. -type PartitionKeyRangeIDClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDClientAPI = (*documentdb.PartitionKeyRangeIDClient)(nil) - -// PartitionKeyRangeIDRegionClientAPI contains the set of methods on the PartitionKeyRangeIDRegionClient type. -type PartitionKeyRangeIDRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDRegionClientAPI = (*documentdb.PartitionKeyRangeIDRegionClient)(nil) - -// SQLResourcesClientAPI contains the set of methods on the SQLResourcesClient type. -type SQLResourcesClientAPI interface { - CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters documentdb.SQLContainerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLContainerFuture, err error) - CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters documentdb.SQLDatabaseCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture, err error) - CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters documentdb.SQLStoredProcedureCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) - CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters documentdb.SQLTriggerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLTriggerFuture, err error) - CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters documentdb.SQLUserDefinedFunctionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) - DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesDeleteSQLContainerFuture, err error) - DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesDeleteSQLDatabaseFuture, err error) - DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLResourcesDeleteSQLStoredProcedureFuture, err error) - DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLResourcesDeleteSQLTriggerFuture, err error) - DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) - GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLContainerGetResults, err error) - GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLDatabaseGetResults, err error) - GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLStoredProcedureGetResults, err error) - GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLTriggerGetResults, err error) - GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLUserDefinedFunctionGetResults, err error) - ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLContainerListResult, err error) - ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLDatabaseListResult, err error) - ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLStoredProcedureListResult, err error) - ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLTriggerListResult, err error) - ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLUserDefinedFunctionListResult, err error) - UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLContainerThroughputFuture, err error) - UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) -} - -var _ SQLResourcesClientAPI = (*documentdb.SQLResourcesClient)(nil) - -// MongoDBResourcesClientAPI contains the set of methods on the MongoDBResourcesClient type. -type MongoDBResourcesClientAPI interface { - CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters documentdb.MongoDBCollectionCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) - CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters documentdb.MongoDBDatabaseCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) - DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture, err error) - DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) - GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBCollectionGetResults, err error) - GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBDatabaseGetResults, err error) - GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBCollectionListResult, err error) - ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MongoDBDatabaseListResult, err error) - UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) - UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) -} - -var _ MongoDBResourcesClientAPI = (*documentdb.MongoDBResourcesClient)(nil) - -// TableResourcesClientAPI contains the set of methods on the TableResourcesClient type. -type TableResourcesClientAPI interface { - CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters documentdb.TableCreateUpdateParameters) (result documentdb.TableResourcesCreateUpdateTableFuture, err error) - DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesDeleteTableFuture, err error) - GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableGetResults, err error) - GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListTables(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.TableListResult, err error) - UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.TableResourcesUpdateTableThroughputFuture, err error) -} - -var _ TableResourcesClientAPI = (*documentdb.TableResourcesClient)(nil) - -// CassandraResourcesClientAPI contains the set of methods on the CassandraResourcesClient type. -type CassandraResourcesClientAPI interface { - CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters documentdb.CassandraKeyspaceCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) - CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters documentdb.CassandraTableCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraTableFuture, err error) - DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture, err error) - DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesDeleteCassandraTableFuture, err error) - GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraKeyspaceGetResults, err error) - GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraTableGetResults, err error) - GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.CassandraKeyspaceListResult, err error) - ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraTableListResult, err error) - UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) - UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture, err error) -} - -var _ CassandraResourcesClientAPI = (*documentdb.CassandraResourcesClient)(nil) - -// GremlinResourcesClientAPI contains the set of methods on the GremlinResourcesClient type. -type GremlinResourcesClientAPI interface { - CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters documentdb.GremlinDatabaseCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) - CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters documentdb.GremlinGraphCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture, err error) - DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesDeleteGremlinDatabaseFuture, err error) - DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesDeleteGremlinGraphFuture, err error) - GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinDatabaseGetResults, err error) - GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinGraphGetResults, err error) - GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.GremlinDatabaseListResult, err error) - ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinGraphListResult, err error) - UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) - UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) -} - -var _ GremlinResourcesClientAPI = (*documentdb.GremlinResourcesClient)(nil) - -// NotebookWorkspacesClientAPI contains the set of methods on the NotebookWorkspacesClient type. -type NotebookWorkspacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters documentdb.NotebookWorkspaceCreateUpdateParameters) (result documentdb.NotebookWorkspacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspace, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceListResult, err error) - ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceConnectionInfoResult, err error) - RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesRegenerateAuthTokenFuture, err error) - Start(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesStartFuture, err error) -} - -var _ NotebookWorkspacesClientAPI = (*documentdb.NotebookWorkspacesClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result documentdb.PrivateLinkResource, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateLinkResourceListResult, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*documentdb.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters documentdb.PrivateEndpointConnection) (result documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnection, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateEndpointConnectionListResult, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*documentdb.PrivateEndpointConnectionsClient)(nil) diff --git a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/enums.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/enums.go deleted file mode 100644 index 4cfd627a2915..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/enums.go +++ /dev/null @@ -1,295 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CompositePathSortOrder enumerates the values for composite path sort order. -type CompositePathSortOrder string - -const ( - // Ascending ... - Ascending CompositePathSortOrder = "Ascending" - // Descending ... - Descending CompositePathSortOrder = "Descending" -) - -// PossibleCompositePathSortOrderValues returns an array of possible values for the CompositePathSortOrder const type. -func PossibleCompositePathSortOrderValues() []CompositePathSortOrder { - return []CompositePathSortOrder{Ascending, Descending} -} - -// ConflictResolutionMode enumerates the values for conflict resolution mode. -type ConflictResolutionMode string - -const ( - // Custom ... - Custom ConflictResolutionMode = "Custom" - // LastWriterWins ... - LastWriterWins ConflictResolutionMode = "LastWriterWins" -) - -// PossibleConflictResolutionModeValues returns an array of possible values for the ConflictResolutionMode const type. -func PossibleConflictResolutionModeValues() []ConflictResolutionMode { - return []ConflictResolutionMode{Custom, LastWriterWins} -} - -// ConnectorOffer enumerates the values for connector offer. -type ConnectorOffer string - -const ( - // Small ... - Small ConnectorOffer = "Small" -) - -// PossibleConnectorOfferValues returns an array of possible values for the ConnectorOffer const type. -func PossibleConnectorOfferValues() []ConnectorOffer { - return []ConnectorOffer{Small} -} - -// DatabaseAccountKind enumerates the values for database account kind. -type DatabaseAccountKind string - -const ( - // GlobalDocumentDB ... - GlobalDocumentDB DatabaseAccountKind = "GlobalDocumentDB" - // MongoDB ... - MongoDB DatabaseAccountKind = "MongoDB" - // Parse ... - Parse DatabaseAccountKind = "Parse" -) - -// PossibleDatabaseAccountKindValues returns an array of possible values for the DatabaseAccountKind const type. -func PossibleDatabaseAccountKindValues() []DatabaseAccountKind { - return []DatabaseAccountKind{GlobalDocumentDB, MongoDB, Parse} -} - -// DatabaseAccountOfferType enumerates the values for database account offer type. -type DatabaseAccountOfferType string - -const ( - // Standard ... - Standard DatabaseAccountOfferType = "Standard" -) - -// PossibleDatabaseAccountOfferTypeValues returns an array of possible values for the DatabaseAccountOfferType const type. -func PossibleDatabaseAccountOfferTypeValues() []DatabaseAccountOfferType { - return []DatabaseAccountOfferType{Standard} -} - -// DataType enumerates the values for data type. -type DataType string - -const ( - // LineString ... - LineString DataType = "LineString" - // MultiPolygon ... - MultiPolygon DataType = "MultiPolygon" - // Number ... - Number DataType = "Number" - // Point ... - Point DataType = "Point" - // Polygon ... - Polygon DataType = "Polygon" - // String ... - String DataType = "String" -) - -// PossibleDataTypeValues returns an array of possible values for the DataType const type. -func PossibleDataTypeValues() []DataType { - return []DataType{LineString, MultiPolygon, Number, Point, Polygon, String} -} - -// DefaultConsistencyLevel enumerates the values for default consistency level. -type DefaultConsistencyLevel string - -const ( - // BoundedStaleness ... - BoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" - // ConsistentPrefix ... - ConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" - // Eventual ... - Eventual DefaultConsistencyLevel = "Eventual" - // Session ... - Session DefaultConsistencyLevel = "Session" - // Strong ... - Strong DefaultConsistencyLevel = "Strong" -) - -// PossibleDefaultConsistencyLevelValues returns an array of possible values for the DefaultConsistencyLevel const type. -func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { - return []DefaultConsistencyLevel{BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong} -} - -// IndexingMode enumerates the values for indexing mode. -type IndexingMode string - -const ( - // Consistent ... - Consistent IndexingMode = "Consistent" - // Lazy ... - Lazy IndexingMode = "Lazy" - // None ... - None IndexingMode = "None" -) - -// PossibleIndexingModeValues returns an array of possible values for the IndexingMode const type. -func PossibleIndexingModeValues() []IndexingMode { - return []IndexingMode{Consistent, Lazy, None} -} - -// IndexKind enumerates the values for index kind. -type IndexKind string - -const ( - // Hash ... - Hash IndexKind = "Hash" - // Range ... - Range IndexKind = "Range" - // Spatial ... - Spatial IndexKind = "Spatial" -) - -// PossibleIndexKindValues returns an array of possible values for the IndexKind const type. -func PossibleIndexKindValues() []IndexKind { - return []IndexKind{Hash, Range, Spatial} -} - -// KeyKind enumerates the values for key kind. -type KeyKind string - -const ( - // Primary ... - Primary KeyKind = "primary" - // PrimaryReadonly ... - PrimaryReadonly KeyKind = "primaryReadonly" - // Secondary ... - Secondary KeyKind = "secondary" - // SecondaryReadonly ... - SecondaryReadonly KeyKind = "secondaryReadonly" -) - -// PossibleKeyKindValues returns an array of possible values for the KeyKind const type. -func PossibleKeyKindValues() []KeyKind { - return []KeyKind{Primary, PrimaryReadonly, Secondary, SecondaryReadonly} -} - -// PartitionKind enumerates the values for partition kind. -type PartitionKind string - -const ( - // PartitionKindHash ... - PartitionKindHash PartitionKind = "Hash" - // PartitionKindRange ... - PartitionKindRange PartitionKind = "Range" -) - -// PossiblePartitionKindValues returns an array of possible values for the PartitionKind const type. -func PossiblePartitionKindValues() []PartitionKind { - return []PartitionKind{PartitionKindHash, PartitionKindRange} -} - -// PrimaryAggregationType enumerates the values for primary aggregation type. -type PrimaryAggregationType string - -const ( - // PrimaryAggregationTypeAverage ... - PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" - // PrimaryAggregationTypeLast ... - PrimaryAggregationTypeLast PrimaryAggregationType = "Last" - // PrimaryAggregationTypeMaximum ... - PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" - // PrimaryAggregationTypeMinimum ... - PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" - // PrimaryAggregationTypeNone ... - PrimaryAggregationTypeNone PrimaryAggregationType = "None" - // PrimaryAggregationTypeTotal ... - PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" -) - -// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeLast, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} -} - -// SpatialType enumerates the values for spatial type. -type SpatialType string - -const ( - // SpatialTypeLineString ... - SpatialTypeLineString SpatialType = "LineString" - // SpatialTypeMultiPolygon ... - SpatialTypeMultiPolygon SpatialType = "MultiPolygon" - // SpatialTypePoint ... - SpatialTypePoint SpatialType = "Point" - // SpatialTypePolygon ... - SpatialTypePolygon SpatialType = "Polygon" -) - -// PossibleSpatialTypeValues returns an array of possible values for the SpatialType const type. -func PossibleSpatialTypeValues() []SpatialType { - return []SpatialType{SpatialTypeLineString, SpatialTypeMultiPolygon, SpatialTypePoint, SpatialTypePolygon} -} - -// TriggerOperation enumerates the values for trigger operation. -type TriggerOperation string - -const ( - // All ... - All TriggerOperation = "All" - // Create ... - Create TriggerOperation = "Create" - // Delete ... - Delete TriggerOperation = "Delete" - // Replace ... - Replace TriggerOperation = "Replace" - // Update ... - Update TriggerOperation = "Update" -) - -// PossibleTriggerOperationValues returns an array of possible values for the TriggerOperation const type. -func PossibleTriggerOperationValues() []TriggerOperation { - return []TriggerOperation{All, Create, Delete, Replace, Update} -} - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // Post ... - Post TriggerType = "Post" - // Pre ... - Pre TriggerType = "Pre" -) - -// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. -func PossibleTriggerTypeValues() []TriggerType { - return []TriggerType{Post, Pre} -} - -// UnitType enumerates the values for unit type. -type UnitType string - -const ( - // Bytes ... - Bytes UnitType = "Bytes" - // BytesPerSecond ... - BytesPerSecond UnitType = "BytesPerSecond" - // Count ... - Count UnitType = "Count" - // CountPerSecond ... - CountPerSecond UnitType = "CountPerSecond" - // Milliseconds ... - Milliseconds UnitType = "Milliseconds" - // Percent ... - Percent UnitType = "Percent" - // Seconds ... - Seconds UnitType = "Seconds" -) - -// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{Bytes, BytesPerSecond, Count, CountPerSecond, Milliseconds, Percent, Seconds} -} diff --git a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/gremlinresources.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/gremlinresources.go deleted file mode 100644 index 5c484309d57d..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/gremlinresources.go +++ /dev/null @@ -1,1206 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GremlinResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type GremlinResourcesClient struct { - BaseClient -} - -// NewGremlinResourcesClient creates an instance of the GremlinResourcesClient client. -func NewGremlinResourcesClient(subscriptionID string) GremlinResourcesClient { - return NewGremlinResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGremlinResourcesClientWithBaseURI creates an instance of the GremlinResourcesClient 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 NewGremlinResourcesClientWithBaseURI(baseURI string, subscriptionID string) GremlinResourcesClient { - return GremlinResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateGremlinDatabase create or update an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateGremlinDatabaseParameters - the parameters to provide for the current Gremlin database. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", err.Error()) - } - - req, err := client.CreateUpdateGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinDatabasePreparer prepares the CreateUpdateGremlinDatabase request. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateGremlinDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinDatabaseSender sends the CreateUpdateGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinDatabaseFuture, 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 -} - -// CreateUpdateGremlinDatabaseResponder handles the response to the CreateUpdateGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateGremlinGraph create or update an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// createUpdateGremlinGraphParameters - the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinGraphParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", err.Error()) - } - - req, err := client.CreateUpdateGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinGraphPreparer prepares the CreateUpdateGremlinGraph request. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithJSON(createUpdateGremlinGraphParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinGraphSender sends the CreateUpdateGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinGraphFuture, 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 -} - -// CreateUpdateGremlinGraphResponder handles the response to the CreateUpdateGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteGremlinDatabase deletes an existing Azure Cosmos DB Gremlin database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesDeleteGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", err.Error()) - } - - req, err := client.DeleteGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinDatabasePreparer prepares the DeleteGremlinDatabase request. -func (client GremlinResourcesClient) DeleteGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinDatabaseSender sends the DeleteGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinDatabaseSender(req *http.Request) (future GremlinResourcesDeleteGremlinDatabaseFuture, 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 -} - -// DeleteGremlinDatabaseResponder handles the response to the DeleteGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinDatabaseResponder(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 -} - -// DeleteGremlinGraph deletes an existing Azure Cosmos DB Gremlin graph. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesDeleteGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinGraph", err.Error()) - } - - req, err := client.DeleteGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinGraphPreparer prepares the DeleteGremlinGraph request. -func (client GremlinResourcesClient) DeleteGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinGraphSender sends the DeleteGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinGraphSender(req *http.Request) (future GremlinResourcesDeleteGremlinGraphFuture, 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 -} - -// DeleteGremlinGraphResponder handles the response to the DeleteGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinGraphResponder(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 -} - -// GetGremlinDatabase gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabase", err.Error()) - } - - req, err := client.GetGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabasePreparer prepares the GetGremlinDatabase request. -func (client GremlinResourcesClient) GetGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseSender sends the GetGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseResponder handles the response to the GetGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinDatabaseThroughput gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.GetGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabaseThroughputPreparer prepares the GetGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseThroughputSender sends the GetGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseThroughputResponder handles the response to the GetGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraph gets the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinGraphGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraph") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraph", err.Error()) - } - - req, err := client.GetGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphPreparer prepares the GetGremlinGraph request. -func (client GremlinResourcesClient) GetGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphSender sends the GetGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphResponder handles the response to the GetGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraphThroughput gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with -// the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraphThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", err.Error()) - } - - req, err := client.GetGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphThroughputPreparer prepares the GetGremlinGraphThroughput request. -func (client GremlinResourcesClient) GetGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphThroughputSender sends the GetGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphThroughputResponder handles the response to the GetGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinDatabases lists the Gremlin databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client GremlinResourcesClient) ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result GremlinDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinDatabases", err.Error()) - } - - req, err := client.ListGremlinDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinDatabasesPreparer prepares the ListGremlinDatabases request. -func (client GremlinResourcesClient) ListGremlinDatabasesPreparer(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 = "2019-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinDatabasesSender sends the ListGremlinDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinDatabasesResponder handles the response to the ListGremlinDatabases request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinDatabasesResponder(resp *http.Response) (result GremlinDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinGraphs lists the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinGraphListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinGraphs") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinGraphs", err.Error()) - } - - req, err := client.ListGremlinGraphsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinGraphsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinGraphsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinGraphsPreparer prepares the ListGremlinGraphs request. -func (client GremlinResourcesClient) ListGremlinGraphsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinGraphsSender sends the ListGremlinGraphs request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinGraphsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinGraphsResponder handles the response to the ListGremlinGraphs request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinGraphsResponder(resp *http.Response) (result GremlinGraphListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinDatabaseThroughput update RUs per second of an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin -// database. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinDatabaseThroughputPreparer prepares the UpdateGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinDatabaseThroughputSender sends the UpdateGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinDatabaseThroughputFuture, 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 -} - -// UpdateGremlinDatabaseThroughputResponder handles the response to the UpdateGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinGraphThroughput update RUs per second of an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinGraphThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", err.Error()) - } - - req, err := client.UpdateGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinGraphThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinGraphThroughputPreparer prepares the UpdateGremlinGraphThroughput request. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinGraphThroughputSender sends the UpdateGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinGraphThroughputFuture, 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 -} - -// UpdateGremlinGraphThroughputResponder handles the response to the UpdateGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/models.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/models.go deleted file mode 100644 index 6d7147db6f47..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/models.go +++ /dev/null @@ -1,7178 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb" - -// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other -// than required location and tags -type ARMProxyResource struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ARMProxyResource. -func (apr ARMProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ARMResourceProperties the core properties of ARM resources. -type ARMResourceProperties struct { - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ARMResourceProperties. -func (arp ARMResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Location != nil { - objectMap["location"] = arp.Location - } - if arp.Tags != nil { - objectMap["tags"] = arp.Tags - } - return json.Marshal(objectMap) -} - -// 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) -} - -// Capability cosmos DB capability object -type Capability struct { - // Name - Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". - Name *string `json:"name,omitempty"` -} - -// CassandraKeyspaceCreateUpdateParameters parameters to create and update Cosmos DB Cassandra keyspace. -type CassandraKeyspaceCreateUpdateParameters struct { - // CassandraKeyspaceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra keyspace. - *CassandraKeyspaceCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceCreateUpdateParameters. -func (ckcup CassandraKeyspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckcup.CassandraKeyspaceCreateUpdateProperties != nil { - objectMap["properties"] = ckcup.CassandraKeyspaceCreateUpdateProperties - } - if ckcup.Location != nil { - objectMap["location"] = ckcup.Location - } - if ckcup.Tags != nil { - objectMap["tags"] = ckcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceCreateUpdateParameters struct. -func (ckcup *CassandraKeyspaceCreateUpdateParameters) 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 cassandraKeyspaceCreateUpdateProperties CassandraKeyspaceCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraKeyspaceCreateUpdateProperties) - if err != nil { - return err - } - ckcup.CassandraKeyspaceCreateUpdateProperties = &cassandraKeyspaceCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckcup.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra -// keyspace. -type CassandraKeyspaceCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra keyspace - Resource *CassandraKeyspaceResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceCreateUpdateProperties. -func (ckcup CassandraKeyspaceCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckcup.Resource != nil { - objectMap["resource"] = ckcup.Resource - } - if ckcup.Options != nil { - objectMap["options"] = ckcup.Options - } - return json.Marshal(objectMap) -} - -// CassandraKeyspaceGetProperties the properties of an Azure Cosmos DB Cassandra keyspace -type CassandraKeyspaceGetProperties struct { - Resource *CassandraKeyspaceGetPropertiesResource `json:"resource,omitempty"` -} - -// CassandraKeyspaceGetPropertiesResource ... -type CassandraKeyspaceGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetPropertiesResource. -func (ckgp CassandraKeyspaceGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgp.ID != nil { - objectMap["id"] = ckgp.ID - } - return json.Marshal(objectMap) -} - -// CassandraKeyspaceGetResults an Azure Cosmos DB Cassandra keyspace. -type CassandraKeyspaceGetResults struct { - autorest.Response `json:"-"` - // CassandraKeyspaceGetProperties - The properties of an Azure Cosmos DB Cassandra keyspace - *CassandraKeyspaceGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetResults. -func (ckgr CassandraKeyspaceGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgr.CassandraKeyspaceGetProperties != nil { - objectMap["properties"] = ckgr.CassandraKeyspaceGetProperties - } - if ckgr.Location != nil { - objectMap["location"] = ckgr.Location - } - if ckgr.Tags != nil { - objectMap["tags"] = ckgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceGetResults struct. -func (ckgr *CassandraKeyspaceGetResults) 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 cassandraKeyspaceGetProperties CassandraKeyspaceGetProperties - err = json.Unmarshal(*v, &cassandraKeyspaceGetProperties) - if err != nil { - return err - } - ckgr.CassandraKeyspaceGetProperties = &cassandraKeyspaceGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckgr.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceListResult the List operation response, that contains the Cassandra keyspaces and their -// properties. -type CassandraKeyspaceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra keyspaces and their properties. - Value *[]CassandraKeyspaceGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceListResult. -func (cklr CassandraKeyspaceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraKeyspaceResource cosmos DB Cassandra keyspace resource object -type CassandraKeyspaceResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` -} - -// CassandraPartitionKey cosmos DB Cassandra table partition key -type CassandraPartitionKey struct { - // Name - Name of the Cosmos DB Cassandra table partition key - Name *string `json:"name,omitempty"` -} - -// CassandraResourcesCreateUpdateCassandraKeyspaceFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraKeyspaceGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) 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 CassandraResourcesCreateUpdateCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ckgr CassandraKeyspaceGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ckgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ckgr.Response.Response, err = future.GetResult(sender); err == nil && ckgr.Response.Response.StatusCode != http.StatusNoContent { - ckgr, err = client.CreateUpdateCassandraKeyspaceResponder(ckgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", ckgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraTableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) 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 CassandraResourcesCreateUpdateCassandraTableFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) result(client CassandraResourcesClient) (ctgr CassandraTableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ctgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ctgr.Response.Response, err = future.GetResult(sender); err == nil && ctgr.Response.Response.StatusCode != http.StatusNoContent { - ctgr, err = client.CreateUpdateCassandraTableResponder(ctgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", ctgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type CassandraResourcesDeleteCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) 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 CassandraResourcesDeleteCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type CassandraResourcesDeleteCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraTableFuture) 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 CassandraResourcesDeleteCassandraTableFuture.Result. -func (future *CassandraResourcesDeleteCassandraTableFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraTableFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesUpdateCassandraKeyspaceThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) 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 CassandraResourcesUpdateCassandraKeyspaceThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraKeyspaceThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraTableThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesUpdateCassandraTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) 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 CassandraResourcesUpdateCassandraTableThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraSchema cosmos DB Cassandra table schema -type CassandraSchema struct { - // Columns - List of Cassandra table columns. - Columns *[]Column `json:"columns,omitempty"` - // PartitionKeys - List of partition key. - PartitionKeys *[]CassandraPartitionKey `json:"partitionKeys,omitempty"` - // ClusterKeys - List of cluster key. - ClusterKeys *[]ClusterKey `json:"clusterKeys,omitempty"` -} - -// CassandraTableCreateUpdateParameters parameters to create and update Cosmos DB Cassandra table. -type CassandraTableCreateUpdateParameters struct { - // CassandraTableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra table. - *CassandraTableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableCreateUpdateParameters. -func (ctcup CassandraTableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcup.CassandraTableCreateUpdateProperties != nil { - objectMap["properties"] = ctcup.CassandraTableCreateUpdateProperties - } - if ctcup.Location != nil { - objectMap["location"] = ctcup.Location - } - if ctcup.Tags != nil { - objectMap["tags"] = ctcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableCreateUpdateParameters struct. -func (ctcup *CassandraTableCreateUpdateParameters) 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 cassandraTableCreateUpdateProperties CassandraTableCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraTableCreateUpdateProperties) - if err != nil { - return err - } - ctcup.CassandraTableCreateUpdateProperties = &cassandraTableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctcup.Tags = tags - } - } - } - - return nil -} - -// CassandraTableCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra table. -type CassandraTableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra table - Resource *CassandraTableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for CassandraTableCreateUpdateProperties. -func (ctcup CassandraTableCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcup.Resource != nil { - objectMap["resource"] = ctcup.Resource - } - if ctcup.Options != nil { - objectMap["options"] = ctcup.Options - } - return json.Marshal(objectMap) -} - -// CassandraTableGetProperties the properties of an Azure Cosmos DB Cassandra table -type CassandraTableGetProperties struct { - Resource *CassandraTableGetPropertiesResource `json:"resource,omitempty"` -} - -// CassandraTableGetPropertiesResource ... -type CassandraTableGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetPropertiesResource. -func (ctgp CassandraTableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgp.ID != nil { - objectMap["id"] = ctgp.ID - } - if ctgp.DefaultTTL != nil { - objectMap["defaultTtl"] = ctgp.DefaultTTL - } - if ctgp.Schema != nil { - objectMap["schema"] = ctgp.Schema - } - return json.Marshal(objectMap) -} - -// CassandraTableGetResults an Azure Cosmos DB Cassandra table. -type CassandraTableGetResults struct { - autorest.Response `json:"-"` - // CassandraTableGetProperties - The properties of an Azure Cosmos DB Cassandra table - *CassandraTableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetResults. -func (ctgr CassandraTableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgr.CassandraTableGetProperties != nil { - objectMap["properties"] = ctgr.CassandraTableGetProperties - } - if ctgr.Location != nil { - objectMap["location"] = ctgr.Location - } - if ctgr.Tags != nil { - objectMap["tags"] = ctgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableGetResults struct. -func (ctgr *CassandraTableGetResults) 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 cassandraTableGetProperties CassandraTableGetProperties - err = json.Unmarshal(*v, &cassandraTableGetProperties) - if err != nil { - return err - } - ctgr.CassandraTableGetProperties = &cassandraTableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctgr.Tags = tags - } - } - } - - return nil -} - -// CassandraTableListResult the List operation response, that contains the Cassandra tables and their -// properties. -type CassandraTableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra tables and their properties. - Value *[]CassandraTableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableListResult. -func (ctlr CassandraTableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraTableResource cosmos DB Cassandra table resource object -type CassandraTableResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` -} - -// ClusterKey cosmos DB Cassandra table cluster key -type ClusterKey struct { - // Name - Name of the Cosmos DB Cassandra table cluster key - Name *string `json:"name,omitempty"` - // OrderBy - Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" - OrderBy *string `json:"orderBy,omitempty"` -} - -// Column cosmos DB Cassandra table column -type Column struct { - // Name - Name of the Cosmos DB Cassandra table column - Name *string `json:"name,omitempty"` - // Type - Type of the Cosmos DB Cassandra table column - Type *string `json:"type,omitempty"` -} - -// CompositePath ... -type CompositePath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Order - Sort order for composite paths. Possible values include: 'Ascending', 'Descending' - Order CompositePathSortOrder `json:"order,omitempty"` -} - -// ConflictResolutionPolicy the conflict resolution policy for the container. -type ConflictResolutionPolicy struct { - // Mode - Indicates the conflict resolution mode. Possible values include: 'LastWriterWins', 'Custom' - Mode ConflictResolutionMode `json:"mode,omitempty"` - // ConflictResolutionPath - The conflict resolution path in the case of LastWriterWins mode. - ConflictResolutionPath *string `json:"conflictResolutionPath,omitempty"` - // ConflictResolutionProcedure - The procedure to resolve conflicts in the case of custom mode. - ConflictResolutionProcedure *string `json:"conflictResolutionProcedure,omitempty"` -} - -// ConsistencyPolicy the consistency policy for the Cosmos DB database account. -type ConsistencyPolicy struct { - // DefaultConsistencyLevel - The default consistency level and configuration settings of the Cosmos DB account. Possible values include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix' - DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` - // MaxStalenessPrefix - When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` - // MaxIntervalInSeconds - When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` -} - -// ContainerPartitionKey the configuration of the partition key to be used for partitioning data into -// multiple partitions -type ContainerPartitionKey struct { - // Paths - List of paths using which data within the container can be partitioned - Paths *[]string `json:"paths,omitempty"` - // Kind - Indicates the kind of algorithm used for partitioning. Possible values include: 'PartitionKindHash', 'PartitionKindRange' - Kind PartitionKind `json:"kind,omitempty"` - // Version - Indicates the version of the partition key definition - Version *int32 `json:"version,omitempty"` -} - -// DatabaseAccountConnectionString connection string for the Cosmos DB account -type DatabaseAccountConnectionString struct { - // ConnectionString - READ-ONLY; Value of the connection string - ConnectionString *string `json:"connectionString,omitempty"` - // Description - READ-ONLY; Description of the connection string - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountConnectionString. -func (dacs DatabaseAccountConnectionString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountCreateUpdateParameters parameters to create and update Cosmos DB database accounts. -type DatabaseAccountCreateUpdateParameters struct { - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountCreateUpdateParameters. -func (dacup DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dacup.Kind != "" { - objectMap["kind"] = dacup.Kind - } - if dacup.DatabaseAccountCreateUpdateProperties != nil { - objectMap["properties"] = dacup.DatabaseAccountCreateUpdateProperties - } - if dacup.Location != nil { - objectMap["location"] = dacup.Location - } - if dacup.Tags != nil { - objectMap["tags"] = dacup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateParameters struct. -func (dacup *DatabaseAccountCreateUpdateParameters) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dacup.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountCreateUpdateProperties DatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &databaseAccountCreateUpdateProperties) - if err != nil { - return err - } - dacup.DatabaseAccountCreateUpdateProperties = &databaseAccountCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dacup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dacup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dacup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dacup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dacup.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountCreateUpdateProperties properties to create and update Azure Cosmos DB database accounts. -type DatabaseAccountCreateUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRangeFilter - Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` -} - -// DatabaseAccountGetProperties properties for the database account. -type DatabaseAccountGetProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the Cosmos DB database account. - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - // DatabaseAccountOfferType - READ-ONLY; The offer type for the Cosmos DB database account. Default value: Standard. Possible values include: 'Standard' - DatabaseAccountOfferType DatabaseAccountOfferType `json:"databaseAccountOfferType,omitempty"` - // IPRangeFilter - Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // ConsistencyPolicy - The consistency policy for the Cosmos DB database account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // WriteLocations - READ-ONLY; An array that contains the write location for the Cosmos DB account. - WriteLocations *[]Location `json:"writeLocations,omitempty"` - // ReadLocations - READ-ONLY; An array that contains of the read locations enabled for the Cosmos DB account. - ReadLocations *[]Location `json:"readLocations,omitempty"` - // Locations - READ-ONLY; An array that contains all of the locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // FailoverPolicies - READ-ONLY; An array that contains the regions ordered by their failover priorities. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetProperties. -func (dagp DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagp.ProvisioningState != nil { - objectMap["provisioningState"] = dagp.ProvisioningState - } - if dagp.IPRangeFilter != nil { - objectMap["ipRangeFilter"] = dagp.IPRangeFilter - } - if dagp.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = dagp.IsVirtualNetworkFilterEnabled - } - if dagp.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = dagp.EnableAutomaticFailover - } - if dagp.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = dagp.ConsistencyPolicy - } - if dagp.Capabilities != nil { - objectMap["capabilities"] = dagp.Capabilities - } - if dagp.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = dagp.VirtualNetworkRules - } - if dagp.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = dagp.EnableMultipleWriteLocations - } - if dagp.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = dagp.EnableCassandraConnector - } - if dagp.ConnectorOffer != "" { - objectMap["connectorOffer"] = dagp.ConnectorOffer - } - if dagp.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = dagp.DisableKeyBasedMetadataWriteAccess - } - return json.Marshal(objectMap) -} - -// DatabaseAccountGetResults an Azure Cosmos DB database account. -type DatabaseAccountGetResults struct { - autorest.Response `json:"-"` - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetResults. -func (dagr DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagr.Kind != "" { - objectMap["kind"] = dagr.Kind - } - if dagr.DatabaseAccountGetProperties != nil { - objectMap["properties"] = dagr.DatabaseAccountGetProperties - } - if dagr.Location != nil { - objectMap["location"] = dagr.Location - } - if dagr.Tags != nil { - objectMap["tags"] = dagr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetResults struct. -func (dagr *DatabaseAccountGetResults) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dagr.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountGetProperties DatabaseAccountGetProperties - err = json.Unmarshal(*v, &databaseAccountGetProperties) - if err != nil { - return err - } - dagr.DatabaseAccountGetProperties = &databaseAccountGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dagr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dagr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dagr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dagr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dagr.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountListConnectionStringsResult the connection strings for the given database account. -type DatabaseAccountListConnectionStringsResult struct { - autorest.Response `json:"-"` - // ConnectionStrings - An array that contains the connection strings for the Cosmos DB account. - ConnectionStrings *[]DatabaseAccountConnectionString `json:"connectionStrings,omitempty"` -} - -// DatabaseAccountListKeysResult the access keys for the given database account. -type DatabaseAccountListKeysResult struct { - autorest.Response `json:"-"` - // PrimaryMasterKey - READ-ONLY; Base 64 encoded value of the primary read-write key. - PrimaryMasterKey *string `json:"primaryMasterKey,omitempty"` - // SecondaryMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-write key. - SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListKeysResult. -func (dalkr DatabaseAccountListKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountListReadOnlyKeysResult the read-only access keys for the given database account. -type DatabaseAccountListReadOnlyKeysResult struct { - autorest.Response `json:"-"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListReadOnlyKeysResult. -func (dalrokr DatabaseAccountListReadOnlyKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountRegenerateKeyParameters parameters to regenerate the keys within the database account. -type DatabaseAccountRegenerateKeyParameters struct { - // KeyKind - The access key to regenerate. Possible values include: 'Primary', 'Secondary', 'PrimaryReadonly', 'SecondaryReadonly' - KeyKind KeyKind `json:"keyKind,omitempty"` -} - -// DatabaseAccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsCreateOrUpdateFuture) 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 DatabaseAccountsCreateOrUpdateFuture.Result. -func (future *DatabaseAccountsCreateOrUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.CreateOrUpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsDeleteFuture) 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 DatabaseAccountsDeleteFuture.Result. -func (future *DatabaseAccountsDeleteFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsFailoverPriorityChangeFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type DatabaseAccountsFailoverPriorityChangeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) 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 DatabaseAccountsFailoverPriorityChangeFuture.Result. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsFailoverPriorityChangeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsFailoverPriorityChangeFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsListResult the List operation response, that contains the database accounts and their -// properties. -type DatabaseAccountsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of database account and their properties. - Value *[]DatabaseAccountGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountsListResult. -func (dalr DatabaseAccountsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountsOfflineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOfflineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOfflineRegionFuture) 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 DatabaseAccountsOfflineRegionFuture.Result. -func (future *DatabaseAccountsOfflineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOfflineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsOnlineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOnlineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOnlineRegionFuture) 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 DatabaseAccountsOnlineRegionFuture.Result. -func (future *DatabaseAccountsOnlineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOnlineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsRegenerateKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsRegenerateKeyFuture) 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 DatabaseAccountsRegenerateKeyFuture.Result. -func (future *DatabaseAccountsRegenerateKeyFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsRegenerateKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsRegenerateKeyFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsUpdateFuture) 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 DatabaseAccountsUpdateFuture.Result. -func (future *DatabaseAccountsUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.UpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountUpdateParameters parameters for patching Azure Cosmos DB database account properties. -type DatabaseAccountUpdateParameters struct { - Tags map[string]*string `json:"tags"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - *DatabaseAccountUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountUpdateParameters. -func (daup DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if daup.Tags != nil { - objectMap["tags"] = daup.Tags - } - if daup.Location != nil { - objectMap["location"] = daup.Location - } - if daup.DatabaseAccountUpdateProperties != nil { - objectMap["properties"] = daup.DatabaseAccountUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateParameters struct. -func (daup *DatabaseAccountUpdateParameters) 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 - } - daup.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - daup.Location = &location - } - case "properties": - if v != nil { - var databaseAccountUpdateProperties DatabaseAccountUpdateProperties - err = json.Unmarshal(*v, &databaseAccountUpdateProperties) - if err != nil { - return err - } - daup.DatabaseAccountUpdateProperties = &databaseAccountUpdateProperties - } - } - } - - return nil -} - -// DatabaseAccountUpdateProperties properties to update Azure Cosmos DB database accounts. -type DatabaseAccountUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // IPRangeFilter - Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` -} - -// ErrorResponse 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"` -} - -// ExcludedPath ... -type ExcludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` -} - -// ExtendedResourceProperties the system generated resource properties associated with SQL databases, SQL -// containers, Gremlin databases and Gremlin graphs. -type ExtendedResourceProperties struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedResourceProperties. -func (erp ExtendedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverPolicies the list of new failover policies for the failover priority change. -type FailoverPolicies struct { - // FailoverPolicies - List of failover policies. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` -} - -// FailoverPolicy the failover policy for a given region of a database account. -type FailoverPolicy struct { - // ID - READ-ONLY; The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region in which the database account exists. - LocationName *string `json:"locationName,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverPolicy. -func (fp FailoverPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.LocationName != nil { - objectMap["locationName"] = fp.LocationName - } - if fp.FailoverPriority != nil { - objectMap["failoverPriority"] = fp.FailoverPriority - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseCreateUpdateParameters parameters to create and update Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateParameters struct { - // GremlinDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin database. - *GremlinDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseCreateUpdateParameters. -func (gdcup GremlinDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdcup.GremlinDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = gdcup.GremlinDatabaseCreateUpdateProperties - } - if gdcup.Location != nil { - objectMap["location"] = gdcup.Location - } - if gdcup.Tags != nil { - objectMap["tags"] = gdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseCreateUpdateParameters struct. -func (gdcup *GremlinDatabaseCreateUpdateParameters) 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 gremlinDatabaseCreateUpdateProperties GremlinDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinDatabaseCreateUpdateProperties) - if err != nil { - return err - } - gdcup.GremlinDatabaseCreateUpdateProperties = &gremlinDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdcup.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin database - Resource *GremlinDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseCreateUpdateProperties. -func (gdcup GremlinDatabaseCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdcup.Resource != nil { - objectMap["resource"] = gdcup.Resource - } - if gdcup.Options != nil { - objectMap["options"] = gdcup.Options - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type GremlinDatabaseGetProperties struct { - Resource *GremlinDatabaseGetPropertiesResource `json:"resource,omitempty"` -} - -// GremlinDatabaseGetPropertiesResource ... -type GremlinDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetPropertiesResource. -func (gdgp GremlinDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgp.ID != nil { - objectMap["id"] = gdgp.ID - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseGetResults an Azure Cosmos DB Gremlin database. -type GremlinDatabaseGetResults struct { - autorest.Response `json:"-"` - // GremlinDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *GremlinDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetResults. -func (gdgr GremlinDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgr.GremlinDatabaseGetProperties != nil { - objectMap["properties"] = gdgr.GremlinDatabaseGetProperties - } - if gdgr.Location != nil { - objectMap["location"] = gdgr.Location - } - if gdgr.Tags != nil { - objectMap["tags"] = gdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseGetResults struct. -func (gdgr *GremlinDatabaseGetResults) 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 gremlinDatabaseGetProperties GremlinDatabaseGetProperties - err = json.Unmarshal(*v, &gremlinDatabaseGetProperties) - if err != nil { - return err - } - gdgr.GremlinDatabaseGetProperties = &gremlinDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdgr.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseListResult the List operation response, that contains the Gremlin databases and their -// properties. -type GremlinDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Gremlin databases and their properties. - Value *[]GremlinDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseListResult. -func (gdlr GremlinDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinDatabaseResource cosmos DB Gremlin database resource object -type GremlinDatabaseResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` -} - -// GremlinGraphCreateUpdateParameters parameters to create and update Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateParameters struct { - // GremlinGraphCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin graph. - *GremlinGraphCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphCreateUpdateParameters. -func (ggcup GremlinGraphCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ggcup.GremlinGraphCreateUpdateProperties != nil { - objectMap["properties"] = ggcup.GremlinGraphCreateUpdateProperties - } - if ggcup.Location != nil { - objectMap["location"] = ggcup.Location - } - if ggcup.Tags != nil { - objectMap["tags"] = ggcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphCreateUpdateParameters struct. -func (ggcup *GremlinGraphCreateUpdateParameters) 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 gremlinGraphCreateUpdateProperties GremlinGraphCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinGraphCreateUpdateProperties) - if err != nil { - return err - } - ggcup.GremlinGraphCreateUpdateProperties = &gremlinGraphCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ggcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ggcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ggcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ggcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ggcup.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin graph - Resource *GremlinGraphResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphCreateUpdateProperties. -func (ggcup GremlinGraphCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ggcup.Resource != nil { - objectMap["resource"] = ggcup.Resource - } - if ggcup.Options != nil { - objectMap["options"] = ggcup.Options - } - return json.Marshal(objectMap) -} - -// GremlinGraphGetProperties the properties of an Azure Cosmos DB Gremlin graph -type GremlinGraphGetProperties struct { - Resource *GremlinGraphGetPropertiesResource `json:"resource,omitempty"` -} - -// GremlinGraphGetPropertiesResource ... -type GremlinGraphGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetPropertiesResource. -func (gggp GremlinGraphGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggp.ID != nil { - objectMap["id"] = gggp.ID - } - if gggp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = gggp.IndexingPolicy - } - if gggp.PartitionKey != nil { - objectMap["partitionKey"] = gggp.PartitionKey - } - if gggp.DefaultTTL != nil { - objectMap["defaultTtl"] = gggp.DefaultTTL - } - if gggp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = gggp.UniqueKeyPolicy - } - if gggp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = gggp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// GremlinGraphGetResults an Azure Cosmos DB Gremlin graph. -type GremlinGraphGetResults struct { - autorest.Response `json:"-"` - // GremlinGraphGetProperties - The properties of an Azure Cosmos DB Gremlin graph - *GremlinGraphGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetResults. -func (gggr GremlinGraphGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggr.GremlinGraphGetProperties != nil { - objectMap["properties"] = gggr.GremlinGraphGetProperties - } - if gggr.Location != nil { - objectMap["location"] = gggr.Location - } - if gggr.Tags != nil { - objectMap["tags"] = gggr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphGetResults struct. -func (gggr *GremlinGraphGetResults) 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 gremlinGraphGetProperties GremlinGraphGetProperties - err = json.Unmarshal(*v, &gremlinGraphGetProperties) - if err != nil { - return err - } - gggr.GremlinGraphGetProperties = &gremlinGraphGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gggr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gggr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gggr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gggr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gggr.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphListResult the List operation response, that contains the graphs and their properties. -type GremlinGraphListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of graphs and their properties. - Value *[]GremlinGraphGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphListResult. -func (gglr GremlinGraphListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinGraphResource cosmos DB Gremlin graph resource object -type GremlinGraphResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// GremlinResourcesCreateUpdateGremlinDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesCreateUpdateGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) 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 GremlinResourcesCreateUpdateGremlinDatabaseFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) result(client GremlinResourcesClient) (gdgr GremlinDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gdgr.Response.Response, err = future.GetResult(sender); err == nil && gdgr.Response.Response.StatusCode != http.StatusNoContent { - gdgr, err = client.CreateUpdateGremlinDatabaseResponder(gdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", gdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesCreateUpdateGremlinGraphFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type GremlinResourcesCreateUpdateGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinGraphGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) 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 GremlinResourcesCreateUpdateGremlinGraphFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) result(client GremlinResourcesClient) (gggr GremlinGraphGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gggr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gggr.Response.Response, err = future.GetResult(sender); err == nil && gggr.Response.Response.StatusCode != http.StatusNoContent { - gggr, err = client.CreateUpdateGremlinGraphResponder(gggr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", gggr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesDeleteGremlinDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type GremlinResourcesDeleteGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) 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 GremlinResourcesDeleteGremlinDatabaseFuture.Result. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesDeleteGremlinGraphFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GremlinResourcesDeleteGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinGraphFuture) 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 GremlinResourcesDeleteGremlinGraphFuture.Result. -func (future *GremlinResourcesDeleteGremlinGraphFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinGraphFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesUpdateGremlinDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) 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 GremlinResourcesUpdateGremlinDatabaseThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinGraphThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinGraphThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) 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 GremlinResourcesUpdateGremlinGraphThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinGraphThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// IncludedPath the paths that are included in indexing -type IncludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Indexes - List of indexes for this path - Indexes *[]Indexes `json:"indexes,omitempty"` -} - -// Indexes the indexes for the path. -type Indexes struct { - // DataType - The datatype for which the indexing behavior is applied to. Possible values include: 'String', 'Number', 'Point', 'Polygon', 'LineString', 'MultiPolygon' - DataType DataType `json:"dataType,omitempty"` - // Precision - The precision of the index. -1 is maximum precision. - Precision *int32 `json:"precision,omitempty"` - // Kind - Indicates the type of index. Possible values include: 'Hash', 'Range', 'Spatial' - Kind IndexKind `json:"kind,omitempty"` -} - -// IndexingPolicy cosmos DB indexing policy -type IndexingPolicy struct { - // Automatic - Indicates if the indexing policy is automatic - Automatic *bool `json:"automatic,omitempty"` - // IndexingMode - Indicates the indexing mode. Possible values include: 'Consistent', 'Lazy', 'None' - IndexingMode IndexingMode `json:"indexingMode,omitempty"` - // IncludedPaths - List of paths to include in the indexing - IncludedPaths *[]IncludedPath `json:"includedPaths,omitempty"` - // ExcludedPaths - List of paths to exclude from indexing - ExcludedPaths *[]ExcludedPath `json:"excludedPaths,omitempty"` - // CompositeIndexes - List of composite path list - CompositeIndexes *[][]CompositePath `json:"compositeIndexes,omitempty"` - // SpatialIndexes - List of spatial specifics - SpatialIndexes *[]SpatialSpec `json:"spatialIndexes,omitempty"` -} - -// Location a region in which the Azure Cosmos DB database account is deployed. -type Location struct { - // ID - READ-ONLY; The unique identifier of the region within the database account. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region. - LocationName *string `json:"locationName,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` - // IsZoneRedundant - Flag to indicate whether or not this region is an AvailabilityZone region - IsZoneRedundant *bool `json:"isZoneRedundant,omitempty"` -} - -// MarshalJSON is the custom marshaler for Location. -func (l Location) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if l.LocationName != nil { - objectMap["locationName"] = l.LocationName - } - if l.ProvisioningState != nil { - objectMap["provisioningState"] = l.ProvisioningState - } - if l.FailoverPriority != nil { - objectMap["failoverPriority"] = l.FailoverPriority - } - if l.IsZoneRedundant != nil { - objectMap["isZoneRedundant"] = l.IsZoneRedundant - } - return json.Marshal(objectMap) -} - -// Metric metric data -type Metric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for Metric. -func (mVar Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.Unit != "" { - objectMap["unit"] = mVar.Unit - } - return json.Marshal(objectMap) -} - -// MetricAvailability the availability of the metric. -type MetricAvailability struct { - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - READ-ONLY; The retention for the metric values. - Retention *string `json:"retention,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAvailability. -func (ma MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinition the definition of a metric. -type MetricDefinition struct { - // MetricAvailabilities - READ-ONLY; The list of metric availabilities for the account. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type of the metric. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeTotal', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeLast' - PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // ResourceURI - READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinition. -func (md MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if md.Unit != "" { - objectMap["unit"] = md.Unit - } - return json.Marshal(objectMap) -} - -// MetricDefinitionsListResult the response to a list metric definitions request. -type MetricDefinitionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metric definitions for the account. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinitionsListResult. -func (mdlr MetricDefinitionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricListResult the response to a list metrics request. -type MetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metrics for the account. - Value *[]Metric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricListResult. -func (mlr MetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricName a metric name. -type MetricName struct { - // Value - READ-ONLY; The name of the metric. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The friendly name of the metric. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricName. -func (mn MetricName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricValue represents metrics values. -type MetricValue struct { - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricValue. -func (mv MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionCreateUpdateParameters parameters to create and update Cosmos DB MongoDB collection. -type MongoDBCollectionCreateUpdateParameters struct { - // MongoDBCollectionCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB collection. - *MongoDBCollectionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionCreateUpdateParameters. -func (mdccup MongoDBCollectionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdccup.MongoDBCollectionCreateUpdateProperties != nil { - objectMap["properties"] = mdccup.MongoDBCollectionCreateUpdateProperties - } - if mdccup.Location != nil { - objectMap["location"] = mdccup.Location - } - if mdccup.Tags != nil { - objectMap["tags"] = mdccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionCreateUpdateParameters struct. -func (mdccup *MongoDBCollectionCreateUpdateParameters) 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 mongoDBCollectionCreateUpdateProperties MongoDBCollectionCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBCollectionCreateUpdateProperties) - if err != nil { - return err - } - mdccup.MongoDBCollectionCreateUpdateProperties = &mongoDBCollectionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdccup.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB -// collection. -type MongoDBCollectionCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB collection - Resource *MongoDBCollectionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionCreateUpdateProperties. -func (mdccup MongoDBCollectionCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdccup.Resource != nil { - objectMap["resource"] = mdccup.Resource - } - if mdccup.Options != nil { - objectMap["options"] = mdccup.Options - } - return json.Marshal(objectMap) -} - -// MongoDBCollectionGetProperties the properties of an Azure Cosmos DB MongoDB collection -type MongoDBCollectionGetProperties struct { - Resource *MongoDBCollectionGetPropertiesResource `json:"resource,omitempty"` -} - -// MongoDBCollectionGetPropertiesResource ... -type MongoDBCollectionGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetPropertiesResource. -func (mdcgp MongoDBCollectionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgp.ID != nil { - objectMap["id"] = mdcgp.ID - } - if mdcgp.ShardKey != nil { - objectMap["shardKey"] = mdcgp.ShardKey - } - if mdcgp.Indexes != nil { - objectMap["indexes"] = mdcgp.Indexes - } - return json.Marshal(objectMap) -} - -// MongoDBCollectionGetResults an Azure Cosmos DB MongoDB collection. -type MongoDBCollectionGetResults struct { - autorest.Response `json:"-"` - // MongoDBCollectionGetProperties - The properties of an Azure Cosmos DB MongoDB collection - *MongoDBCollectionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetResults. -func (mdcgr MongoDBCollectionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgr.MongoDBCollectionGetProperties != nil { - objectMap["properties"] = mdcgr.MongoDBCollectionGetProperties - } - if mdcgr.Location != nil { - objectMap["location"] = mdcgr.Location - } - if mdcgr.Tags != nil { - objectMap["tags"] = mdcgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionGetResults struct. -func (mdcgr *MongoDBCollectionGetResults) 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 mongoDBCollectionGetProperties MongoDBCollectionGetProperties - err = json.Unmarshal(*v, &mongoDBCollectionGetProperties) - if err != nil { - return err - } - mdcgr.MongoDBCollectionGetProperties = &mongoDBCollectionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdcgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdcgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdcgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdcgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdcgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionListResult the List operation response, that contains the MongoDB collections and their -// properties. -type MongoDBCollectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB collections and their properties. - Value *[]MongoDBCollectionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionListResult. -func (mdclr MongoDBCollectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionResource cosmos DB MongoDB collection resource object -type MongoDBCollectionResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionResource. -func (mdcr MongoDBCollectionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcr.ID != nil { - objectMap["id"] = mdcr.ID - } - if mdcr.ShardKey != nil { - objectMap["shardKey"] = mdcr.ShardKey - } - if mdcr.Indexes != nil { - objectMap["indexes"] = mdcr.Indexes - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseCreateUpdateParameters parameters to create and update Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateParameters struct { - // MongoDBDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB database. - *MongoDBDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseCreateUpdateParameters. -func (mddcup MongoDBDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddcup.MongoDBDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = mddcup.MongoDBDatabaseCreateUpdateProperties - } - if mddcup.Location != nil { - objectMap["location"] = mddcup.Location - } - if mddcup.Tags != nil { - objectMap["tags"] = mddcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseCreateUpdateParameters struct. -func (mddcup *MongoDBDatabaseCreateUpdateParameters) 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 mongoDBDatabaseCreateUpdateProperties MongoDBDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBDatabaseCreateUpdateProperties) - if err != nil { - return err - } - mddcup.MongoDBDatabaseCreateUpdateProperties = &mongoDBDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddcup.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB database - Resource *MongoDBDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseCreateUpdateProperties. -func (mddcup MongoDBDatabaseCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddcup.Resource != nil { - objectMap["resource"] = mddcup.Resource - } - if mddcup.Options != nil { - objectMap["options"] = mddcup.Options - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseGetProperties the properties of an Azure Cosmos DB MongoDB database -type MongoDBDatabaseGetProperties struct { - Resource *MongoDBDatabaseGetPropertiesResource `json:"resource,omitempty"` -} - -// MongoDBDatabaseGetPropertiesResource ... -type MongoDBDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetPropertiesResource. -func (mddgp MongoDBDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgp.ID != nil { - objectMap["id"] = mddgp.ID - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseGetResults an Azure Cosmos DB MongoDB database. -type MongoDBDatabaseGetResults struct { - autorest.Response `json:"-"` - // MongoDBDatabaseGetProperties - The properties of an Azure Cosmos DB MongoDB database - *MongoDBDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetResults. -func (mddgr MongoDBDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgr.MongoDBDatabaseGetProperties != nil { - objectMap["properties"] = mddgr.MongoDBDatabaseGetProperties - } - if mddgr.Location != nil { - objectMap["location"] = mddgr.Location - } - if mddgr.Tags != nil { - objectMap["tags"] = mddgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseGetResults struct. -func (mddgr *MongoDBDatabaseGetResults) 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 mongoDBDatabaseGetProperties MongoDBDatabaseGetProperties - err = json.Unmarshal(*v, &mongoDBDatabaseGetProperties) - if err != nil { - return err - } - mddgr.MongoDBDatabaseGetProperties = &mongoDBDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseListResult the List operation response, that contains the MongoDB databases and their -// properties. -type MongoDBDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB databases and their properties. - Value *[]MongoDBDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseListResult. -func (mddlr MongoDBDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBDatabaseResource cosmos DB MongoDB database resource object -type MongoDBDatabaseResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` -} - -// MongoDBResourcesCreateUpdateMongoDBCollectionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBCollectionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) 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 MongoDBResourcesCreateUpdateMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) result(client MongoDBResourcesClient) (mdcgr MongoDBCollectionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mdcgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mdcgr.Response.Response, err = future.GetResult(sender); err == nil && mdcgr.Response.Response.StatusCode != http.StatusNoContent { - mdcgr, err = client.CreateUpdateMongoDBCollectionResponder(mdcgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", mdcgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesCreateUpdateMongoDBDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) 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 MongoDBResourcesCreateUpdateMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (mddgr MongoDBDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mddgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mddgr.Response.Response, err = future.GetResult(sender); err == nil && mddgr.Response.Response.StatusCode != http.StatusNoContent { - mddgr, err = client.CreateUpdateMongoDBDatabaseResponder(mddgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", mddgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesDeleteMongoDBCollectionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type MongoDBResourcesDeleteMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) 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 MongoDBResourcesDeleteMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesDeleteMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type MongoDBResourcesDeleteMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) 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 MongoDBResourcesDeleteMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesUpdateMongoDBCollectionThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBCollectionThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) 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 MongoDBResourcesUpdateMongoDBCollectionThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBCollectionThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) 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 MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoIndex cosmos DB MongoDB collection index key -type MongoIndex struct { - // Key - Cosmos DB MongoDB collection index keys - Key *MongoIndexKeys `json:"key,omitempty"` - // Options - Cosmos DB MongoDB collection index key options - Options *MongoIndexOptions `json:"options,omitempty"` -} - -// MongoIndexKeys cosmos DB MongoDB collection resource object -type MongoIndexKeys struct { - // Keys - List of keys for each MongoDB collection in the Azure Cosmos DB service - Keys *[]string `json:"keys,omitempty"` -} - -// MongoIndexOptions cosmos DB MongoDB collection index options -type MongoIndexOptions struct { - // ExpireAfterSeconds - Expire after seconds - ExpireAfterSeconds *int32 `json:"expireAfterSeconds,omitempty"` - // Unique - Is unique or not - Unique *bool `json:"unique,omitempty"` -} - -// NotebookWorkspace a notebook workspace resource -type NotebookWorkspace struct { - autorest.Response `json:"-"` - // NotebookWorkspaceProperties - Resource properties. - *NotebookWorkspaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspace. -func (nw NotebookWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nw.NotebookWorkspaceProperties != nil { - objectMap["properties"] = nw.NotebookWorkspaceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotebookWorkspace struct. -func (nw *NotebookWorkspace) 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 notebookWorkspaceProperties NotebookWorkspaceProperties - err = json.Unmarshal(*v, ¬ebookWorkspaceProperties) - if err != nil { - return err - } - nw.NotebookWorkspaceProperties = ¬ebookWorkspaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nw.Type = &typeVar - } - } - } - - return nil -} - -// NotebookWorkspaceConnectionInfoResult the connection info for the given notebook workspace -type NotebookWorkspaceConnectionInfoResult struct { - autorest.Response `json:"-"` - // AuthToken - READ-ONLY; Specifies auth token used for connecting to Notebook server (uses token-based auth). - AuthToken *string `json:"authToken,omitempty"` - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceConnectionInfoResult. -func (nwcir NotebookWorkspaceConnectionInfoResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceCreateUpdateParameters parameters to create a notebook workspace resource -type NotebookWorkspaceCreateUpdateParameters struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceCreateUpdateParameters. -func (nwcup NotebookWorkspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceListResult a list of notebook workspace resources -type NotebookWorkspaceListResult struct { - autorest.Response `json:"-"` - // Value - Array of notebook workspace resources - Value *[]NotebookWorkspace `json:"value,omitempty"` -} - -// NotebookWorkspaceProperties properties of a notebook workspace resource. -type NotebookWorkspaceProperties struct { - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` - // Status - READ-ONLY; Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceProperties. -func (nwp NotebookWorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (NotebookWorkspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesCreateOrUpdateFuture) 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 NotebookWorkspacesCreateOrUpdateFuture.Result. -func (future *NotebookWorkspacesCreateOrUpdateFuture) result(client NotebookWorkspacesClient) (nw NotebookWorkspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nw.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nw.Response.Response, err = future.GetResult(sender); err == nil && nw.Response.Response.StatusCode != http.StatusNoContent { - nw, err = client.CreateOrUpdateResponder(nw.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", nw.Response.Response, "Failure responding to request") - } - } - return -} - -// NotebookWorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesDeleteFuture) 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 NotebookWorkspacesDeleteFuture.Result. -func (future *NotebookWorkspacesDeleteFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesRegenerateAuthTokenFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type NotebookWorkspacesRegenerateAuthTokenFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) 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 NotebookWorkspacesRegenerateAuthTokenFuture.Result. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesRegenerateAuthTokenFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesRegenerateAuthTokenFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NotebookWorkspacesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesStartFuture) 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 NotebookWorkspacesStartFuture.Result. -func (future *NotebookWorkspacesStartFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// Operation 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.ResourceProvider - 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"` - // Description - Description of operation - Description *string `json:"Description,omitempty"` -} - -// OperationListResult 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 OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the 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, - } -} - -// PartitionMetric the metric values for a single partition. -type PartitionMetric struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the metric values. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the metric values. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetric. -func (pm PartitionMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PartitionMetricListResult the response to a list partition metrics request. -type PartitionMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level metrics for the account. - Value *[]PartitionMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetricListResult. -func (pmlr PartitionMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PartitionUsage the partition level usage data for a usage request. -type PartitionUsage struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the usages. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the usages. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsage. -func (pu PartitionUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pu.Unit != "" { - objectMap["unit"] = pu.Unit - } - return json.Marshal(objectMap) -} - -// PartitionUsagesResult the response to a list partition level usage request. -type PartitionUsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level usages for the database. A usage is a point in time metric - Value *[]PartitionUsage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsagesResult. -func (pur PartitionUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetric percentile Metric data -type PercentileMetric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The percentile metric values for the specified time window and timestep. - MetricValues *[]PercentileMetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetric. -func (pm PercentileMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PercentileMetricListResult the response to a list percentile metrics request. -type PercentileMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of percentile metrics for the account. - Value *[]PercentileMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricListResult. -func (pmlr PercentileMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetricValue represents percentile metrics values. -type PercentileMetricValue struct { - // P10 - READ-ONLY; The 10th percentile value for the metric. - P10 *float64 `json:"P10,omitempty"` - // P25 - READ-ONLY; The 25th percentile value for the metric. - P25 *float64 `json:"P25,omitempty"` - // P50 - READ-ONLY; The 50th percentile value for the metric. - P50 *float64 `json:"P50,omitempty"` - // P75 - READ-ONLY; The 75th percentile value for the metric. - P75 *float64 `json:"P75,omitempty"` - // P90 - READ-ONLY; The 90th percentile value for the metric. - P90 *float64 `json:"P90,omitempty"` - // P95 - READ-ONLY; The 95th percentile value for the metric. - P95 *float64 `json:"P95,omitempty"` - // P99 - READ-ONLY; The 99th percentile value for the metric. - P99 *float64 `json:"P99,omitempty"` - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricValue. -func (pmv PercentileMetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // GroupID - Group id of the private endpoint. - GroupID *string `json:"groupId,omitempty"` - // ProvisioningState - Provisioning state of the private endpoint. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource required zone names. - 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) -} - -// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// 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) -} - -// RegionForOnlineOffline cosmos DB region to online or offline. -type RegionForOnlineOffline struct { - // Region - Cosmos DB region, with spaces between words and each word capitalized. - Region *string `json:"region,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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SpatialSpec ... -type SpatialSpec struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Types - List of path's spatial type - Types *[]SpatialType `json:"types,omitempty"` -} - -// SQLContainerCreateUpdateParameters parameters to create and update Cosmos DB container. -type SQLContainerCreateUpdateParameters struct { - // SQLContainerCreateUpdateProperties - Properties to create and update Azure Cosmos DB container. - *SQLContainerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerCreateUpdateParameters. -func (sccup SQLContainerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccup.SQLContainerCreateUpdateProperties != nil { - objectMap["properties"] = sccup.SQLContainerCreateUpdateProperties - } - if sccup.Location != nil { - objectMap["location"] = sccup.Location - } - if sccup.Tags != nil { - objectMap["tags"] = sccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerCreateUpdateParameters struct. -func (sccup *SQLContainerCreateUpdateParameters) 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 SQLContainerCreateUpdateProperties SQLContainerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLContainerCreateUpdateProperties) - if err != nil { - return err - } - sccup.SQLContainerCreateUpdateProperties = &SQLContainerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sccup.Tags = tags - } - } - } - - return nil -} - -// SQLContainerCreateUpdateProperties properties to create and update Azure Cosmos DB container. -type SQLContainerCreateUpdateProperties struct { - // Resource - The standard JSON format of a container - Resource *SQLContainerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for SQLContainerCreateUpdateProperties. -func (sccup SQLContainerCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccup.Resource != nil { - objectMap["resource"] = sccup.Resource - } - if sccup.Options != nil { - objectMap["options"] = sccup.Options - } - return json.Marshal(objectMap) -} - -// SQLContainerGetProperties the properties of an Azure Cosmos DB container -type SQLContainerGetProperties struct { - Resource *SQLContainerGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLContainerGetPropertiesResource ... -type SQLContainerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetPropertiesResource. -func (scgp SQLContainerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgp.ID != nil { - objectMap["id"] = scgp.ID - } - if scgp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = scgp.IndexingPolicy - } - if scgp.PartitionKey != nil { - objectMap["partitionKey"] = scgp.PartitionKey - } - if scgp.DefaultTTL != nil { - objectMap["defaultTtl"] = scgp.DefaultTTL - } - if scgp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = scgp.UniqueKeyPolicy - } - if scgp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = scgp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// SQLContainerGetResults an Azure Cosmos DB container. -type SQLContainerGetResults struct { - autorest.Response `json:"-"` - // SQLContainerGetProperties - The properties of an Azure Cosmos DB container - *SQLContainerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetResults. -func (scgr SQLContainerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgr.SQLContainerGetProperties != nil { - objectMap["properties"] = scgr.SQLContainerGetProperties - } - if scgr.Location != nil { - objectMap["location"] = scgr.Location - } - if scgr.Tags != nil { - objectMap["tags"] = scgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerGetResults struct. -func (scgr *SQLContainerGetResults) 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 SQLContainerGetProperties SQLContainerGetProperties - err = json.Unmarshal(*v, &SQLContainerGetProperties) - if err != nil { - return err - } - scgr.SQLContainerGetProperties = &SQLContainerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - scgr.Tags = tags - } - } - } - - return nil -} - -// SQLContainerListResult the List operation response, that contains the containers and their properties. -type SQLContainerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of containers and their properties. - Value *[]SQLContainerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerListResult. -func (sclr SQLContainerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLContainerResource cosmos DB SQL container resource object -type SQLContainerResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// SQLDatabaseCreateUpdateParameters parameters to create and update Cosmos DB SQL database. -type SQLDatabaseCreateUpdateParameters struct { - // SQLDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB SQL database. - *SQLDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseCreateUpdateParameters. -func (sdcup SQLDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdcup.SQLDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = sdcup.SQLDatabaseCreateUpdateProperties - } - if sdcup.Location != nil { - objectMap["location"] = sdcup.Location - } - if sdcup.Tags != nil { - objectMap["tags"] = sdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseCreateUpdateParameters struct. -func (sdcup *SQLDatabaseCreateUpdateParameters) 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 SQLDatabaseCreateUpdateProperties SQLDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &SQLDatabaseCreateUpdateProperties) - if err != nil { - return err - } - sdcup.SQLDatabaseCreateUpdateProperties = &SQLDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdcup.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB SQL database. -type SQLDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a SQL database - Resource *SQLDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseCreateUpdateProperties. -func (sdcup SQLDatabaseCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdcup.Resource != nil { - objectMap["resource"] = sdcup.Resource - } - if sdcup.Options != nil { - objectMap["options"] = sdcup.Options - } - return json.Marshal(objectMap) -} - -// SQLDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type SQLDatabaseGetProperties struct { - Resource *SQLDatabaseGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLDatabaseGetPropertiesResource ... -type SQLDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Colls - A system generated property that specified the addressable path of the collections resource. - Colls *string `json:"_colls,omitempty"` - // Users - A system generated property that specifies the addressable path of the users resource. - Users *string `json:"_users,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetPropertiesResource. -func (sdgp SQLDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgp.ID != nil { - objectMap["id"] = sdgp.ID - } - if sdgp.Colls != nil { - objectMap["_colls"] = sdgp.Colls - } - if sdgp.Users != nil { - objectMap["_users"] = sdgp.Users - } - return json.Marshal(objectMap) -} - -// SQLDatabaseGetResults an Azure Cosmos DB SQL database. -type SQLDatabaseGetResults struct { - autorest.Response `json:"-"` - // SQLDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *SQLDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetResults. -func (sdgr SQLDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgr.SQLDatabaseGetProperties != nil { - objectMap["properties"] = sdgr.SQLDatabaseGetProperties - } - if sdgr.Location != nil { - objectMap["location"] = sdgr.Location - } - if sdgr.Tags != nil { - objectMap["tags"] = sdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseGetResults struct. -func (sdgr *SQLDatabaseGetResults) 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 SQLDatabaseGetProperties SQLDatabaseGetProperties - err = json.Unmarshal(*v, &SQLDatabaseGetProperties) - if err != nil { - return err - } - sdgr.SQLDatabaseGetProperties = &SQLDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdgr.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseListResult the List operation response, that contains the SQL databases and their properties. -type SQLDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of SQL databases and their properties. - Value *[]SQLDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseListResult. -func (sdlr SQLDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLDatabaseResource cosmos DB SQL database resource object -type SQLDatabaseResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` -} - -// SQLResourcesCreateUpdateSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLContainerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) 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 SQLResourcesCreateUpdateSQLContainerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) result(client SQLResourcesClient) (scgr SQLContainerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - scgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLContainerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if scgr.Response.Response, err = future.GetResult(sender); err == nil && scgr.Response.Response.StatusCode != http.StatusNoContent { - scgr, err = client.CreateUpdateSQLContainerResponder(scgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", scgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) 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 SQLResourcesCreateUpdateSQLDatabaseFuture.Result. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) result(client SQLResourcesClient) (sdgr SQLDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sdgr.Response.Response, err = future.GetResult(sender); err == nil && sdgr.Response.Response.StatusCode != http.StatusNoContent { - sdgr, err = client.CreateUpdateSQLDatabaseResponder(sdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", sdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLStoredProcedureFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLStoredProcedureGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) 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 SQLResourcesCreateUpdateSQLStoredProcedureFuture.Result. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) result(client SQLResourcesClient) (sspgr SQLStoredProcedureGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sspgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sspgr.Response.Response, err = future.GetResult(sender); err == nil && sspgr.Response.Response.StatusCode != http.StatusNoContent { - sspgr, err = client.CreateUpdateSQLStoredProcedureResponder(sspgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", sspgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLTriggerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) 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 SQLResourcesCreateUpdateSQLTriggerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) result(client SQLResourcesClient) (stgr SQLTriggerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - stgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLTriggerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if stgr.Response.Response, err = future.GetResult(sender); err == nil && stgr.Response.Response.StatusCode != http.StatusNoContent { - stgr, err = client.CreateUpdateSQLTriggerResponder(stgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", stgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLUserDefinedFunctionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) 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 SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (sudfgr SQLUserDefinedFunctionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sudfgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sudfgr.Response.Response, err = future.GetResult(sender); err == nil && sudfgr.Response.Response.StatusCode != http.StatusNoContent { - sudfgr, err = client.CreateUpdateSQLUserDefinedFunctionResponder(sudfgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", sudfgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesDeleteSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLContainerFuture) 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 SQLResourcesDeleteSQLContainerFuture.Result. -func (future *SQLResourcesDeleteSQLContainerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLContainerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLDatabaseFuture) 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 SQLResourcesDeleteSQLDatabaseFuture.Result. -func (future *SQLResourcesDeleteSQLDatabaseFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLStoredProcedureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) 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 SQLResourcesDeleteSQLStoredProcedureFuture.Result. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLStoredProcedureFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLTriggerFuture) 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 SQLResourcesDeleteSQLTriggerFuture.Result. -func (future *SQLResourcesDeleteSQLTriggerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLTriggerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesDeleteSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) 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 SQLResourcesDeleteSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesUpdateSQLContainerThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLContainerThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) 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 SQLResourcesUpdateSQLContainerThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLContainerThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLContainerThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLDatabaseThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) 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 SQLResourcesUpdateSQLDatabaseThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLStoredProcedureCreateUpdateParameters parameters to create and update Cosmos DB storedProcedure. -type SQLStoredProcedureCreateUpdateParameters struct { - // SQLStoredProcedureCreateUpdateProperties - Properties to create and update Azure Cosmos DB storedProcedure. - *SQLStoredProcedureCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureCreateUpdateParameters. -func (sspcup SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspcup.SQLStoredProcedureCreateUpdateProperties != nil { - objectMap["properties"] = sspcup.SQLStoredProcedureCreateUpdateProperties - } - if sspcup.Location != nil { - objectMap["location"] = sspcup.Location - } - if sspcup.Tags != nil { - objectMap["tags"] = sspcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureCreateUpdateParameters struct. -func (sspcup *SQLStoredProcedureCreateUpdateParameters) 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 SQLStoredProcedureCreateUpdateProperties SQLStoredProcedureCreateUpdateProperties - err = json.Unmarshal(*v, &SQLStoredProcedureCreateUpdateProperties) - if err != nil { - return err - } - sspcup.SQLStoredProcedureCreateUpdateProperties = &SQLStoredProcedureCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspcup.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureCreateUpdateProperties properties to create and update Azure Cosmos DB -// storedProcedure. -type SQLStoredProcedureCreateUpdateProperties struct { - // Resource - The standard JSON format of a storedProcedure - Resource *SQLStoredProcedureResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureCreateUpdateProperties. -func (sspcup SQLStoredProcedureCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspcup.Resource != nil { - objectMap["resource"] = sspcup.Resource - } - if sspcup.Options != nil { - objectMap["options"] = sspcup.Options - } - return json.Marshal(objectMap) -} - -// SQLStoredProcedureGetProperties the properties of an Azure Cosmos DB StoredProcedure -type SQLStoredProcedureGetProperties struct { - Resource *SQLStoredProcedureGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLStoredProcedureGetPropertiesResource ... -type SQLStoredProcedureGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetPropertiesResource. -func (sspgp SQLStoredProcedureGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgp.ID != nil { - objectMap["id"] = sspgp.ID - } - if sspgp.Body != nil { - objectMap["body"] = sspgp.Body - } - return json.Marshal(objectMap) -} - -// SQLStoredProcedureGetResults an Azure Cosmos DB storedProcedure. -type SQLStoredProcedureGetResults struct { - autorest.Response `json:"-"` - // SQLStoredProcedureGetProperties - The properties of an Azure Cosmos DB storedProcedure - *SQLStoredProcedureGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetResults. -func (sspgr SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgr.SQLStoredProcedureGetProperties != nil { - objectMap["properties"] = sspgr.SQLStoredProcedureGetProperties - } - if sspgr.Location != nil { - objectMap["location"] = sspgr.Location - } - if sspgr.Tags != nil { - objectMap["tags"] = sspgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureGetResults struct. -func (sspgr *SQLStoredProcedureGetResults) 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 SQLStoredProcedureGetProperties SQLStoredProcedureGetProperties - err = json.Unmarshal(*v, &SQLStoredProcedureGetProperties) - if err != nil { - return err - } - sspgr.SQLStoredProcedureGetProperties = &SQLStoredProcedureGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspgr.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureListResult the List operation response, that contains the storedProcedures and their -// properties. -type SQLStoredProcedureListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of storedProcedures and their properties. - Value *[]SQLStoredProcedureGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureListResult. -func (ssplr SQLStoredProcedureListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLStoredProcedureResource cosmos DB SQL storedProcedure resource object -type SQLStoredProcedureResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` -} - -// SQLTriggerCreateUpdateParameters parameters to create and update Cosmos DB trigger. -type SQLTriggerCreateUpdateParameters struct { - // SQLTriggerCreateUpdateProperties - Properties to create and update Azure Cosmos DB trigger. - *SQLTriggerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerCreateUpdateParameters. -func (stcup SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stcup.SQLTriggerCreateUpdateProperties != nil { - objectMap["properties"] = stcup.SQLTriggerCreateUpdateProperties - } - if stcup.Location != nil { - objectMap["location"] = stcup.Location - } - if stcup.Tags != nil { - objectMap["tags"] = stcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerCreateUpdateParameters struct. -func (stcup *SQLTriggerCreateUpdateParameters) 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 SQLTriggerCreateUpdateProperties SQLTriggerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLTriggerCreateUpdateProperties) - if err != nil { - return err - } - stcup.SQLTriggerCreateUpdateProperties = &SQLTriggerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stcup.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerCreateUpdateProperties properties to create and update Azure Cosmos DB trigger. -type SQLTriggerCreateUpdateProperties struct { - // Resource - The standard JSON format of a trigger - Resource *SQLTriggerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerCreateUpdateProperties. -func (stcup SQLTriggerCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stcup.Resource != nil { - objectMap["resource"] = stcup.Resource - } - if stcup.Options != nil { - objectMap["options"] = stcup.Options - } - return json.Marshal(objectMap) -} - -// SQLTriggerGetProperties the properties of an Azure Cosmos DB trigger -type SQLTriggerGetProperties struct { - Resource *SQLTriggerGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLTriggerGetPropertiesResource ... -type SQLTriggerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetPropertiesResource. -func (stgp SQLTriggerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgp.ID != nil { - objectMap["id"] = stgp.ID - } - if stgp.Body != nil { - objectMap["body"] = stgp.Body - } - if stgp.TriggerType != "" { - objectMap["triggerType"] = stgp.TriggerType - } - if stgp.TriggerOperation != "" { - objectMap["triggerOperation"] = stgp.TriggerOperation - } - return json.Marshal(objectMap) -} - -// SQLTriggerGetResults an Azure Cosmos DB trigger. -type SQLTriggerGetResults struct { - autorest.Response `json:"-"` - // SQLTriggerGetProperties - The properties of an Azure Cosmos DB trigger - *SQLTriggerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetResults. -func (stgr SQLTriggerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgr.SQLTriggerGetProperties != nil { - objectMap["properties"] = stgr.SQLTriggerGetProperties - } - if stgr.Location != nil { - objectMap["location"] = stgr.Location - } - if stgr.Tags != nil { - objectMap["tags"] = stgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerGetResults struct. -func (stgr *SQLTriggerGetResults) 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 SQLTriggerGetProperties SQLTriggerGetProperties - err = json.Unmarshal(*v, &SQLTriggerGetProperties) - if err != nil { - return err - } - stgr.SQLTriggerGetProperties = &SQLTriggerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stgr.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerListResult the List operation response, that contains the triggers and their properties. -type SQLTriggerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of triggers and their properties. - Value *[]SQLTriggerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerListResult. -func (stlr SQLTriggerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLTriggerResource cosmos DB SQL trigger resource object -type SQLTriggerResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` -} - -// SQLUserDefinedFunctionCreateUpdateParameters parameters to create and update Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateParameters struct { - // SQLUserDefinedFunctionCreateUpdateProperties - Properties to create and update Azure Cosmos DB userDefinedFunction. - *SQLUserDefinedFunctionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionCreateUpdateParameters. -func (sudfcup SQLUserDefinedFunctionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfcup.SQLUserDefinedFunctionCreateUpdateProperties != nil { - objectMap["properties"] = sudfcup.SQLUserDefinedFunctionCreateUpdateProperties - } - if sudfcup.Location != nil { - objectMap["location"] = sudfcup.Location - } - if sudfcup.Tags != nil { - objectMap["tags"] = sudfcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionCreateUpdateParameters struct. -func (sudfcup *SQLUserDefinedFunctionCreateUpdateParameters) 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 SQLUserDefinedFunctionCreateUpdateProperties SQLUserDefinedFunctionCreateUpdateProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionCreateUpdateProperties) - if err != nil { - return err - } - sudfcup.SQLUserDefinedFunctionCreateUpdateProperties = &SQLUserDefinedFunctionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfcup.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionCreateUpdateProperties properties to create and update Azure Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateProperties struct { - // Resource - The standard JSON format of a userDefinedFunction - Resource *SQLUserDefinedFunctionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionCreateUpdateProperties. -func (sudfcup SQLUserDefinedFunctionCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfcup.Resource != nil { - objectMap["resource"] = sudfcup.Resource - } - if sudfcup.Options != nil { - objectMap["options"] = sudfcup.Options - } - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionGetProperties the properties of an Azure Cosmos DB userDefinedFunction -type SQLUserDefinedFunctionGetProperties struct { - Resource *SQLUserDefinedFunctionGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLUserDefinedFunctionGetPropertiesResource ... -type SQLUserDefinedFunctionGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetPropertiesResource. -func (sudfgp SQLUserDefinedFunctionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgp.ID != nil { - objectMap["id"] = sudfgp.ID - } - if sudfgp.Body != nil { - objectMap["body"] = sudfgp.Body - } - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionGetResults an Azure Cosmos DB userDefinedFunction. -type SQLUserDefinedFunctionGetResults struct { - autorest.Response `json:"-"` - // SQLUserDefinedFunctionGetProperties - The properties of an Azure Cosmos DB userDefinedFunction - *SQLUserDefinedFunctionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetResults. -func (sudfgr SQLUserDefinedFunctionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgr.SQLUserDefinedFunctionGetProperties != nil { - objectMap["properties"] = sudfgr.SQLUserDefinedFunctionGetProperties - } - if sudfgr.Location != nil { - objectMap["location"] = sudfgr.Location - } - if sudfgr.Tags != nil { - objectMap["tags"] = sudfgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionGetResults struct. -func (sudfgr *SQLUserDefinedFunctionGetResults) 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 SQLUserDefinedFunctionGetProperties SQLUserDefinedFunctionGetProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionGetProperties) - if err != nil { - return err - } - sudfgr.SQLUserDefinedFunctionGetProperties = &SQLUserDefinedFunctionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfgr.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionListResult the List operation response, that contains the userDefinedFunctions and -// their properties. -type SQLUserDefinedFunctionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of userDefinedFunctions and their properties. - Value *[]SQLUserDefinedFunctionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionListResult. -func (sudflr SQLUserDefinedFunctionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionResource cosmos DB SQL userDefinedFunction resource object -type SQLUserDefinedFunctionResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` -} - -// TableCreateUpdateParameters parameters to create and update Cosmos DB Table. -type TableCreateUpdateParameters struct { - // TableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Table. - *TableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableCreateUpdateParameters. -func (tcup TableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TableCreateUpdateProperties != nil { - objectMap["properties"] = tcup.TableCreateUpdateProperties - } - if tcup.Location != nil { - objectMap["location"] = tcup.Location - } - if tcup.Tags != nil { - objectMap["tags"] = tcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableCreateUpdateParameters struct. -func (tcup *TableCreateUpdateParameters) 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 tableCreateUpdateProperties TableCreateUpdateProperties - err = json.Unmarshal(*v, &tableCreateUpdateProperties) - if err != nil { - return err - } - tcup.TableCreateUpdateProperties = &tableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tcup.Tags = tags - } - } - } - - return nil -} - -// TableCreateUpdateProperties properties to create and update Azure Cosmos DB Table. -type TableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Table - Resource *TableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options map[string]*string `json:"options"` -} - -// MarshalJSON is the custom marshaler for TableCreateUpdateProperties. -func (tcup TableCreateUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.Resource != nil { - objectMap["resource"] = tcup.Resource - } - if tcup.Options != nil { - objectMap["options"] = tcup.Options - } - return json.Marshal(objectMap) -} - -// TableGetProperties the properties of an Azure Cosmos Table -type TableGetProperties struct { - Resource *TableGetPropertiesResource `json:"resource,omitempty"` -} - -// TableGetPropertiesResource ... -type TableGetPropertiesResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableGetPropertiesResource. -func (tgp TableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgp.ID != nil { - objectMap["id"] = tgp.ID - } - return json.Marshal(objectMap) -} - -// TableGetResults an Azure Cosmos DB Table. -type TableGetResults struct { - autorest.Response `json:"-"` - // TableGetProperties - The properties of an Azure Cosmos DB Table - *TableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableGetResults. -func (tgr TableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgr.TableGetProperties != nil { - objectMap["properties"] = tgr.TableGetProperties - } - if tgr.Location != nil { - objectMap["location"] = tgr.Location - } - if tgr.Tags != nil { - objectMap["tags"] = tgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableGetResults struct. -func (tgr *TableGetResults) 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 tableGetProperties TableGetProperties - err = json.Unmarshal(*v, &tableGetProperties) - if err != nil { - return err - } - tgr.TableGetProperties = &tableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tgr.Tags = tags - } - } - } - - return nil -} - -// TableListResult the List operation response, that contains the Table and their properties. -type TableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Table and their properties. - Value *[]TableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableListResult. -func (tlr TableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TableResource cosmos DB table resource object -type TableResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` -} - -// TableResourcesCreateUpdateTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesCreateUpdateTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (TableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesCreateUpdateTableFuture) 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 TableResourcesCreateUpdateTableFuture.Result. -func (future *TableResourcesCreateUpdateTableFuture) result(client TableResourcesClient) (tgr TableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesCreateUpdateTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tgr.Response.Response, err = future.GetResult(sender); err == nil && tgr.Response.Response.StatusCode != http.StatusNoContent { - tgr, err = client.CreateUpdateTableResponder(tgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", tgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesDeleteTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesDeleteTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesDeleteTableFuture) 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 TableResourcesDeleteTableFuture.Result. -func (future *TableResourcesDeleteTableFuture) result(client TableResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesDeleteTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesDeleteTableFuture") - return - } - ar.Response = future.Response() - return -} - -// TableResourcesUpdateTableThroughputFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesUpdateTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesUpdateTableThroughputFuture) 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 TableResourcesUpdateTableThroughputFuture.Result. -func (future *TableResourcesUpdateTableThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesUpdateTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// ThroughputSettingsGetProperties the properties of an Azure Cosmos DB resource throughput -type ThroughputSettingsGetProperties struct { - Resource *ThroughputSettingsGetPropertiesResource `json:"resource,omitempty"` -} - -// ThroughputSettingsGetPropertiesResource ... -type ThroughputSettingsGetPropertiesResource struct { - // Throughput - Value of the Cosmos DB resource throughput - Throughput *int32 `json:"throughput,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetPropertiesResource. -func (tsgp ThroughputSettingsGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgp.Throughput != nil { - objectMap["throughput"] = tsgp.Throughput - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsGetResults an Azure Cosmos DB resource throughput. -type ThroughputSettingsGetResults struct { - autorest.Response `json:"-"` - // ThroughputSettingsGetProperties - The properties of an Azure Cosmos DB resource throughput - *ThroughputSettingsGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetResults. -func (tsgr ThroughputSettingsGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgr.ThroughputSettingsGetProperties != nil { - objectMap["properties"] = tsgr.ThroughputSettingsGetProperties - } - if tsgr.Location != nil { - objectMap["location"] = tsgr.Location - } - if tsgr.Tags != nil { - objectMap["tags"] = tsgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsGetResults struct. -func (tsgr *ThroughputSettingsGetResults) 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 throughputSettingsGetProperties ThroughputSettingsGetProperties - err = json.Unmarshal(*v, &throughputSettingsGetProperties) - if err != nil { - return err - } - tsgr.ThroughputSettingsGetProperties = &throughputSettingsGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsgr.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsResource cosmos DB resource throughput object -type ThroughputSettingsResource struct { - // Throughput - Value of the Cosmos DB resource throughput - Throughput *int32 `json:"throughput,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsResource. -func (tsr ThroughputSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsr.Throughput != nil { - objectMap["throughput"] = tsr.Throughput - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsUpdateParameters parameters to update Cosmos DB resource throughput. -type ThroughputSettingsUpdateParameters struct { - // ThroughputSettingsUpdateProperties - Properties to update Azure Cosmos DB resource throughput. - *ThroughputSettingsUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsUpdateParameters. -func (tsup ThroughputSettingsUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsup.ThroughputSettingsUpdateProperties != nil { - objectMap["properties"] = tsup.ThroughputSettingsUpdateProperties - } - if tsup.Location != nil { - objectMap["location"] = tsup.Location - } - if tsup.Tags != nil { - objectMap["tags"] = tsup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsUpdateParameters struct. -func (tsup *ThroughputSettingsUpdateParameters) 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 throughputSettingsUpdateProperties ThroughputSettingsUpdateProperties - err = json.Unmarshal(*v, &throughputSettingsUpdateProperties) - if err != nil { - return err - } - tsup.ThroughputSettingsUpdateProperties = &throughputSettingsUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsup.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsUpdateProperties properties to update Azure Cosmos DB resource throughput. -type ThroughputSettingsUpdateProperties struct { - // Resource - The standard JSON format of a resource throughput - Resource *ThroughputSettingsResource `json:"resource,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"` -} - -// 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) -} - -// UniqueKey the unique key on that enforces uniqueness constraint on documents in the collection in the -// Azure Cosmos DB service. -type UniqueKey struct { - // Paths - List of paths must be unique for each document in the Azure Cosmos DB service - Paths *[]string `json:"paths,omitempty"` -} - -// UniqueKeyPolicy the unique key policy configuration for specifying uniqueness constraints on documents -// in the collection in the Azure Cosmos DB service. -type UniqueKeyPolicy struct { - // UniqueKeys - List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - UniqueKeys *[]UniqueKey `json:"uniqueKeys,omitempty"` -} - -// Usage the usage data for a usage request. -type Usage struct { - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.Unit != "" { - objectMap["unit"] = u.Unit - } - return json.Marshal(objectMap) -} - -// UsagesResult the response to a list usage request. -type UsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of usages for the database. A usage is a point in time metric - Value *[]Usage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsagesResult. -func (ur UsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRule virtual Network ACL Rule object -type VirtualNetworkRule struct { - // ID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. - ID *string `json:"id,omitempty"` - // IgnoreMissingVNetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVNetServiceEndpoint *bool `json:"ignoreMissingVNetServiceEndpoint,omitempty"` -} diff --git a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/mongodbresources.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/mongodbresources.go deleted file mode 100644 index c96b6335c602..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/mongodbresources.go +++ /dev/null @@ -1,1200 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// MongoDBResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type MongoDBResourcesClient struct { - BaseClient -} - -// NewMongoDBResourcesClient creates an instance of the MongoDBResourcesClient client. -func NewMongoDBResourcesClient(subscriptionID string) MongoDBResourcesClient { - return NewMongoDBResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMongoDBResourcesClientWithBaseURI creates an instance of the MongoDBResourcesClient 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 NewMongoDBResourcesClientWithBaseURI(baseURI string, subscriptionID string) MongoDBResourcesClient { - return MongoDBResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateMongoDBCollection create or update an Azure Cosmos DB MongoDB Collection -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// createUpdateMongoDBCollectionParameters - the parameters to provide for the current MongoDB Collection. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBCollectionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", err.Error()) - } - - req, err := client.CreateUpdateMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBCollectionPreparer prepares the CreateUpdateMongoDBCollection request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBCollectionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBCollectionSender sends the CreateUpdateMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBCollectionFuture, 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 -} - -// CreateUpdateMongoDBCollectionResponder handles the response to the CreateUpdateMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateMongoDBDatabase create or updates Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateMongoDBDatabaseParameters - the parameters to provide for the current MongoDB database. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", err.Error()) - } - - req, err := client.CreateUpdateMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBDatabasePreparer prepares the CreateUpdateMongoDBDatabase request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBDatabaseSender sends the CreateUpdateMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, 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 -} - -// CreateUpdateMongoDBDatabaseResponder handles the response to the CreateUpdateMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteMongoDBCollection deletes an existing Azure Cosmos DB MongoDB Collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesDeleteMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", err.Error()) - } - - req, err := client.DeleteMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBCollectionPreparer prepares the DeleteMongoDBCollection request. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBCollectionSender sends the DeleteMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBCollectionFuture, 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 -} - -// DeleteMongoDBCollectionResponder handles the response to the DeleteMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionResponder(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 -} - -// DeleteMongoDBDatabase deletes an existing Azure Cosmos DB MongoDB database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", err.Error()) - } - - req, err := client.DeleteMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBDatabasePreparer prepares the DeleteMongoDBDatabase request. -func (client MongoDBResourcesClient) DeleteMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBDatabaseSender sends the DeleteMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBDatabaseFuture, 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 -} - -// DeleteMongoDBDatabaseResponder handles the response to the DeleteMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseResponder(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 -} - -// GetMongoDBCollection gets the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBCollectionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollection") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollection", err.Error()) - } - - req, err := client.GetMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionPreparer prepares the GetMongoDBCollection request. -func (client MongoDBResourcesClient) GetMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionSender sends the GetMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionResponder handles the response to the GetMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBCollectionThroughput gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollectionThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.GetMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionThroughputPreparer prepares the GetMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionThroughputSender sends the GetMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionThroughputResponder handles the response to the GetMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabase gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", err.Error()) - } - - req, err := client.GetMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabasePreparer prepares the GetMongoDBDatabase request. -func (client MongoDBResourcesClient) GetMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseSender sends the GetMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseResponder handles the response to the GetMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabaseThroughput gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.GetMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabaseThroughputPreparer prepares the GetMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseThroughputSender sends the GetMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseThroughputResponder handles the response to the GetMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBCollections lists the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBCollectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBCollections") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBCollections", err.Error()) - } - - req, err := client.ListMongoDBCollectionsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBCollectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBCollectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBCollectionsPreparer prepares the ListMongoDBCollections request. -func (client MongoDBResourcesClient) ListMongoDBCollectionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBCollectionsSender sends the ListMongoDBCollections request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBCollectionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBCollectionsResponder handles the response to the ListMongoDBCollections request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBCollectionsResponder(resp *http.Response) (result MongoDBCollectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBDatabases lists the MongoDB databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client MongoDBResourcesClient) ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result MongoDBDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", err.Error()) - } - - req, err := client.ListMongoDBDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBDatabasesPreparer prepares the ListMongoDBDatabases request. -func (client MongoDBResourcesClient) ListMongoDBDatabasesPreparer(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 = "2019-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBDatabasesSender sends the ListMongoDBDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBDatabasesResponder handles the response to the ListMongoDBDatabases request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBDatabasesResponder(resp *http.Response) (result MongoDBDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBCollectionThroughput update the RUs per second of an Azure Cosmos DB MongoDB collection -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// collection. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBCollectionThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBCollectionThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBCollectionThroughputPreparer prepares the UpdateMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBCollectionThroughputSender sends the UpdateMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, 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 -} - -// UpdateMongoDBCollectionThroughputResponder handles the response to the UpdateMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBDatabaseThroughput update RUs per second of the an Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// database. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBDatabaseThroughputPreparer prepares the UpdateMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBDatabaseThroughputSender sends the UpdateMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, 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 -} - -// UpdateMongoDBDatabaseThroughputResponder handles the response to the UpdateMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/notebookworkspaces.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/notebookworkspaces.go deleted file mode 100644 index 5e26f0f3138a..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/notebookworkspaces.go +++ /dev/null @@ -1,681 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotebookWorkspacesClient is the azure Cosmos DB Database Service Resource Provider REST API -type NotebookWorkspacesClient struct { - BaseClient -} - -// NewNotebookWorkspacesClient creates an instance of the NotebookWorkspacesClient client. -func NewNotebookWorkspacesClient(subscriptionID string) NotebookWorkspacesClient { - return NewNotebookWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotebookWorkspacesClientWithBaseURI creates an instance of the NotebookWorkspacesClient 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 NewNotebookWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) NotebookWorkspacesClient { - return NotebookWorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// notebookCreateUpdateParameters - the notebook workspace to create for the current database account. -func (client NotebookWorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (result NotebookWorkspacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, notebookCreateUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotebookWorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", pathParameters), - autorest.WithJSON(notebookCreateUpdateParameters), - 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 NotebookWorkspacesClient) CreateOrUpdateSender(req *http.Request) (future NotebookWorkspacesCreateOrUpdateFuture, 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 NotebookWorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result NotebookWorkspace, 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 notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotebookWorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) DeleteSender(req *http.Request) (future NotebookWorkspacesDeleteFuture, 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 NotebookWorkspacesClient) 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 the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotebookWorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) 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 NotebookWorkspacesClient) GetResponder(resp *http.Response) (result NotebookWorkspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabaseAccount gets the notebook workspace resources of an existing Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client NotebookWorkspacesClient) ListByDatabaseAccountPreparer(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 = "2019-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListByDatabaseAccountResponder(resp *http.Response) (result NotebookWorkspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionInfo retrieves the connection info for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceConnectionInfoResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListConnectionInfo") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListConnectionInfo", err.Error()) - } - - req, err := client.ListConnectionInfoPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionInfoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionInfoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionInfoPreparer prepares the ListConnectionInfo request. -func (client NotebookWorkspacesClient) ListConnectionInfoPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionInfoSender sends the ListConnectionInfo request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListConnectionInfoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionInfoResponder handles the response to the ListConnectionInfo request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListConnectionInfoResponder(resp *http.Response) (result NotebookWorkspaceConnectionInfoResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateAuthToken regenerates the auth token for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesRegenerateAuthTokenFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.RegenerateAuthToken") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", err.Error()) - } - - req, err := client.RegenerateAuthTokenPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateAuthTokenSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateAuthTokenPreparer prepares the RegenerateAuthToken request. -func (client NotebookWorkspacesClient) RegenerateAuthTokenPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateAuthTokenSender sends the RegenerateAuthToken request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) RegenerateAuthTokenSender(req *http.Request) (future NotebookWorkspacesRegenerateAuthTokenFuture, 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 -} - -// RegenerateAuthTokenResponder handles the response to the RegenerateAuthToken request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) RegenerateAuthTokenResponder(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 the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Start(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client NotebookWorkspacesClient) StartPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/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 NotebookWorkspacesClient) StartSender(req *http.Request) (future NotebookWorkspacesStartFuture, 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 NotebookWorkspacesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/operations.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/operations.go deleted file mode 100644 index cc810d625e83..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure Cosmos DB Database Service Resource Provider REST API -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 Cosmos DB Resource Provider 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, "documentdb.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, "documentdb.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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 = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DocumentDB/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, "documentdb.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, "documentdb.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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/cosmos-db/mgmt/2019-08-01-preview/documentdb/partitionkeyrangeid.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/partitionkeyrangeid.go deleted file mode 100644 index 792b435ed634..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/partitionkeyrangeid.go +++ /dev/null @@ -1,133 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDClient creates an instance of the PartitionKeyRangeIDClient client. -func NewPartitionKeyRangeIDClient(subscriptionID string) PartitionKeyRangeIDClient { - return NewPartitionKeyRangeIDClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDClientWithBaseURI creates an instance of the PartitionKeyRangeIDClient 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 NewPartitionKeyRangeIDClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDClient { - return PartitionKeyRangeIDClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/partitionkeyrangeidregion.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/partitionkeyrangeidregion.go deleted file mode 100644 index 7e5c0ca624f8..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/partitionkeyrangeidregion.go +++ /dev/null @@ -1,135 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDRegionClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDRegionClient creates an instance of the PartitionKeyRangeIDRegionClient client. -func NewPartitionKeyRangeIDRegionClient(subscriptionID string) PartitionKeyRangeIDRegionClient { - return NewPartitionKeyRangeIDRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDRegionClientWithBaseURI creates an instance of the PartitionKeyRangeIDRegionClient 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 NewPartitionKeyRangeIDRegionClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDRegionClient { - return PartitionKeyRangeIDRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id and region. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentile.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentile.go deleted file mode 100644 index 5005ca8ad037..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentile.go +++ /dev/null @@ -1,127 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileClient struct { - BaseClient -} - -// NewPercentileClient creates an instance of the PercentileClient client. -func NewPercentileClient(subscriptionID string) PercentileClient { - return NewPercentileClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileClientWithBaseURI creates an instance of the PercentileClient 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 NewPercentileClientWithBaseURI(baseURI string, subscriptionID string) PercentileClient { - return PercentileClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. This url is only -// for PBS and Replication Latency data -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentilesourcetarget.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentilesourcetarget.go deleted file mode 100644 index 34b9ab24b7f6..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentilesourcetarget.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileSourceTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileSourceTargetClient struct { - BaseClient -} - -// NewPercentileSourceTargetClient creates an instance of the PercentileSourceTargetClient client. -func NewPercentileSourceTargetClient(subscriptionID string) PercentileSourceTargetClient { - return NewPercentileSourceTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileSourceTargetClientWithBaseURI creates an instance of the PercentileSourceTargetClient 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 NewPercentileSourceTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileSourceTargetClient { - return PercentileSourceTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account, source and target region. -// This url is only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// sourceRegion - source region from which data is written. Cosmos DB region, with spaces between words and -// each word capitalized. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileSourceTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileSourceTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileSourceTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, sourceRegion, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileSourceTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceRegion": autorest.Encode("path", sourceRegion), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileSourceTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileSourceTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentiletarget.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentiletarget.go deleted file mode 100644 index 8b52720e7aee..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/percentiletarget.go +++ /dev/null @@ -1,131 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileTargetClient struct { - BaseClient -} - -// NewPercentileTargetClient creates an instance of the PercentileTargetClient client. -func NewPercentileTargetClient(subscriptionID string) PercentileTargetClient { - return NewPercentileTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileTargetClientWithBaseURI creates an instance of the PercentileTargetClient 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 NewPercentileTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileTargetClient { - return PercentileTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account target region. This url is -// only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, targetRegion 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), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/privateendpointconnections.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/privateendpointconnections.go deleted file mode 100644 index a084a08ec5ab..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/privateendpointconnections.go +++ /dev/null @@ -1,406 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) 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 = "2019-08-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.DocumentDB/databaseAccounts/{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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByDatabaseAccount list all private endpoint connections on a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/privatelinkresources.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/privatelinkresources.go deleted file mode 100644 index 42aee63e6a66..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/privatelinkresources.go +++ /dev/null @@ -1,215 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByDatabaseAccount gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateLinkResourcesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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/cosmos-db/mgmt/2019-08-01-preview/documentdb/sqlresources.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/sqlresources.go deleted file mode 100644 index 2272a1dec7a3..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/sqlresources.go +++ /dev/null @@ -1,2392 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type SQLResourcesClient struct { - BaseClient -} - -// NewSQLResourcesClient creates an instance of the SQLResourcesClient client. -func NewSQLResourcesClient(subscriptionID string) SQLResourcesClient { - return NewSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLResourcesClientWithBaseURI creates an instance of the SQLResourcesClient 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 NewSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string) SQLResourcesClient { - return SQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateSQLContainer create or update an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// createUpdateSQLContainerParameters - the parameters to provide for the current SQL container. -func (client SQLResourcesClient) CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLContainerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", err.Error()) - } - - req, err := client.CreateUpdateSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, createUpdateSQLContainerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLContainerPreparer prepares the CreateUpdateSQLContainer request. -func (client SQLResourcesClient) CreateUpdateSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithJSON(createUpdateSQLContainerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLContainerSender sends the CreateUpdateSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLContainerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLContainerFuture, 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 -} - -// CreateUpdateSQLContainerResponder handles the response to the CreateUpdateSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLDatabase create or update an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateSQLDatabaseParameters - the parameters to provide for the current SQL database. -func (client SQLResourcesClient) CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", err.Error()) - } - - req, err := client.CreateUpdateSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateSQLDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLDatabasePreparer prepares the CreateUpdateSQLDatabase request. -func (client SQLResourcesClient) CreateUpdateSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateSQLDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLDatabaseSender sends the CreateUpdateSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseSender(req *http.Request) (future SQLResourcesCreateUpdateSQLDatabaseFuture, 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 -} - -// CreateUpdateSQLDatabaseResponder handles the response to the CreateUpdateSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLStoredProcedure create or update an Azure Cosmos DB SQL storedProcedure -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -// createUpdateSQLStoredProcedureParameters - the parameters to provide for the current SQL storedProcedure. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLStoredProcedureParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", err.Error()) - } - - req, err := client.CreateUpdateSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSQLStoredProcedureParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLStoredProcedurePreparer prepares the CreateUpdateSQLStoredProcedure request. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithJSON(createUpdateSQLStoredProcedureParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLStoredProcedureSender sends the CreateUpdateSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureSender(req *http.Request) (future SQLResourcesCreateUpdateSQLStoredProcedureFuture, 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 -} - -// CreateUpdateSQLStoredProcedureResponder handles the response to the CreateUpdateSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLTrigger create or update an Azure Cosmos DB SQL trigger -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -// createUpdateSQLTriggerParameters - the parameters to provide for the current SQL trigger. -func (client SQLResourcesClient) CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLTriggerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", err.Error()) - } - - req, err := client.CreateUpdateSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSQLTriggerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLTriggerPreparer prepares the CreateUpdateSQLTrigger request. -func (client SQLResourcesClient) CreateUpdateSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithJSON(createUpdateSQLTriggerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLTriggerSender sends the CreateUpdateSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLTriggerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLTriggerFuture, 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 -} - -// CreateUpdateSQLTriggerResponder handles the response to the CreateUpdateSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLUserDefinedFunction create or update an Azure Cosmos DB SQL userDefinedFunction -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -// createUpdateSQLUserDefinedFunctionParameters - the parameters to provide for the current SQL -// userDefinedFunction. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLUserDefinedFunctionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", err.Error()) - } - - req, err := client.CreateUpdateSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSQLUserDefinedFunctionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLUserDefinedFunctionPreparer prepares the CreateUpdateSQLUserDefinedFunction request. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithJSON(createUpdateSQLUserDefinedFunctionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLUserDefinedFunctionSender sends the CreateUpdateSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, 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 -} - -// CreateUpdateSQLUserDefinedFunctionResponder handles the response to the CreateUpdateSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSQLContainer deletes an existing Azure Cosmos DB SQL container. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesDeleteSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLContainer", err.Error()) - } - - req, err := client.DeleteSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLContainerPreparer prepares the DeleteSQLContainer request. -func (client SQLResourcesClient) DeleteSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLContainerSender sends the DeleteSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLContainerSender(req *http.Request) (future SQLResourcesDeleteSQLContainerFuture, 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 -} - -// DeleteSQLContainerResponder handles the response to the DeleteSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLContainerResponder(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 -} - -// DeleteSQLDatabase deletes an existing Azure Cosmos DB SQL database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesDeleteSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLDatabase", err.Error()) - } - - req, err := client.DeleteSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLDatabasePreparer prepares the DeleteSQLDatabase request. -func (client SQLResourcesClient) DeleteSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLDatabaseSender sends the DeleteSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLDatabaseSender(req *http.Request) (future SQLResourcesDeleteSQLDatabaseFuture, 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 -} - -// DeleteSQLDatabaseResponder handles the response to the DeleteSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLDatabaseResponder(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 -} - -// DeleteSQLStoredProcedure deletes an existing Azure Cosmos DB SQL storedProcedure. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLResourcesDeleteSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", err.Error()) - } - - req, err := client.DeleteSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLStoredProcedurePreparer prepares the DeleteSQLStoredProcedure request. -func (client SQLResourcesClient) DeleteSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLStoredProcedureSender sends the DeleteSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLStoredProcedureSender(req *http.Request) (future SQLResourcesDeleteSQLStoredProcedureFuture, 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 -} - -// DeleteSQLStoredProcedureResponder handles the response to the DeleteSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLStoredProcedureResponder(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 -} - -// DeleteSQLTrigger deletes an existing Azure Cosmos DB SQL trigger. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLResourcesDeleteSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLTrigger", err.Error()) - } - - req, err := client.DeleteSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLTriggerPreparer prepares the DeleteSQLTrigger request. -func (client SQLResourcesClient) DeleteSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLTriggerSender sends the DeleteSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLTriggerSender(req *http.Request) (future SQLResourcesDeleteSQLTriggerFuture, 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 -} - -// DeleteSQLTriggerResponder handles the response to the DeleteSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLTriggerResponder(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 -} - -// DeleteSQLUserDefinedFunction deletes an existing Azure Cosmos DB SQL userDefinedFunction. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", err.Error()) - } - - req, err := client.DeleteSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLUserDefinedFunctionPreparer prepares the DeleteSQLUserDefinedFunction request. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLUserDefinedFunctionSender sends the DeleteSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesDeleteSQLUserDefinedFunctionFuture, 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 -} - -// DeleteSQLUserDefinedFunctionResponder handles the response to the DeleteSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionResponder(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 -} - -// GetSQLContainer gets the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error()) - } - - req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerPreparer prepares the GetSQLContainer request. -func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerSender sends the GetSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database -// account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error()) - } - - req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request. -func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error()) - } - - req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabasePreparer prepares the GetSQLDatabase request. -func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database -// account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error()) - } - - req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request. -func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLStoredProcedure gets the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLStoredProcedureGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLStoredProcedure") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLStoredProcedure", err.Error()) - } - - req, err := client.GetSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLStoredProcedureSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure sending request") - return - } - - result, err = client.GetSQLStoredProcedureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLStoredProcedurePreparer prepares the GetSQLStoredProcedure request. -func (client SQLResourcesClient) GetSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLStoredProcedureSender sends the GetSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLStoredProcedureSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLStoredProcedureResponder handles the response to the GetSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLTrigger gets the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLTriggerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLTrigger") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLTrigger", err.Error()) - } - - req, err := client.GetSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLTriggerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure sending request") - return - } - - result, err = client.GetSQLTriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLTriggerPreparer prepares the GetSQLTrigger request. -func (client SQLResourcesClient) GetSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLTriggerSender sends the GetSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLTriggerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLTriggerResponder handles the response to the GetSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLUserDefinedFunction gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLUserDefinedFunctionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLUserDefinedFunction") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", err.Error()) - } - - req, err := client.GetSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLUserDefinedFunctionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure sending request") - return - } - - result, err = client.GetSQLUserDefinedFunctionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLUserDefinedFunctionPreparer prepares the GetSQLUserDefinedFunction request. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLUserDefinedFunctionSender sends the GetSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLUserDefinedFunctionResponder handles the response to the GetSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLContainers lists the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLContainerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLContainers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLContainers", err.Error()) - } - - req, err := client.ListSQLContainersPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLContainersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLContainersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLContainersPreparer prepares the ListSQLContainers request. -func (client SQLResourcesClient) ListSQLContainersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLContainersSender sends the ListSQLContainers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLContainersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLContainersResponder handles the response to the ListSQLContainers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLContainersResponder(resp *http.Response) (result SQLContainerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLDatabases lists the SQL databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result SQLDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLDatabases", err.Error()) - } - - req, err := client.ListSQLDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListSQLDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLDatabasesPreparer prepares the ListSQLDatabases request. -func (client SQLResourcesClient) ListSQLDatabasesPreparer(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 = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLDatabasesSender sends the ListSQLDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLDatabasesResponder handles the response to the ListSQLDatabases request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLDatabasesResponder(resp *http.Response) (result SQLDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLStoredProcedures lists the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLStoredProcedureListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLStoredProcedures") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLStoredProcedures", err.Error()) - } - - req, err := client.ListSQLStoredProceduresPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLStoredProceduresSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure sending request") - return - } - - result, err = client.ListSQLStoredProceduresResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLStoredProceduresPreparer prepares the ListSQLStoredProcedures request. -func (client SQLResourcesClient) ListSQLStoredProceduresPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLStoredProceduresSender sends the ListSQLStoredProcedures request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLStoredProceduresSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLStoredProceduresResponder handles the response to the ListSQLStoredProcedures request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLStoredProceduresResponder(resp *http.Response) (result SQLStoredProcedureListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLTriggers lists the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLTriggerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLTriggers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLTriggers", err.Error()) - } - - req, err := client.ListSQLTriggersPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLTriggersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLTriggersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLTriggersPreparer prepares the ListSQLTriggers request. -func (client SQLResourcesClient) ListSQLTriggersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLTriggersSender sends the ListSQLTriggers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLTriggersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLTriggersResponder handles the response to the ListSQLTriggers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLTriggersResponder(resp *http.Response) (result SQLTriggerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLUserDefinedFunctions lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLUserDefinedFunctionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLUserDefinedFunctions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", err.Error()) - } - - req, err := client.ListSQLUserDefinedFunctionsPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLUserDefinedFunctionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure sending request") - return - } - - result, err = client.ListSQLUserDefinedFunctionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLUserDefinedFunctionsPreparer prepares the ListSQLUserDefinedFunctions request. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLUserDefinedFunctionsSender sends the ListSQLUserDefinedFunctions request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLUserDefinedFunctionsResponder handles the response to the ListSQLUserDefinedFunctions request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsResponder(resp *http.Response) (result SQLUserDefinedFunctionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLContainerThroughput update RUs per second of an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL container. -func (client SQLResourcesClient) UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLContainerThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLContainerThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", err.Error()) - } - - req, err := client.UpdateSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLContainerThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLContainerThroughputPreparer prepares the UpdateSQLContainerThroughput request. -func (client SQLResourcesClient) UpdateSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLContainerThroughputSender sends the UpdateSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLContainerThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLContainerThroughputFuture, 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 -} - -// UpdateSQLContainerThroughputResponder handles the response to the UpdateSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLDatabaseThroughput update RUs per second of an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL database. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLDatabaseThroughputPreparer prepares the UpdateSQLDatabaseThroughput request. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLDatabaseThroughputSender sends the UpdateSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLDatabaseThroughputFuture, 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 -} - -// UpdateSQLDatabaseThroughputResponder handles the response to the UpdateSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/tableresources.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/tableresources.go deleted file mode 100644 index a336a27084a0..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/tableresources.go +++ /dev/null @@ -1,608 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TableResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type TableResourcesClient struct { - BaseClient -} - -// NewTableResourcesClient creates an instance of the TableResourcesClient client. -func NewTableResourcesClient(subscriptionID string) TableResourcesClient { - return NewTableResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTableResourcesClientWithBaseURI creates an instance of the TableResourcesClient 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 NewTableResourcesClientWithBaseURI(baseURI string, subscriptionID string) TableResourcesClient { - return TableResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateTable create or update an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// createUpdateTableParameters - the parameters to provide for the current Table. -func (client TableResourcesClient) CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (result TableResourcesCreateUpdateTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.CreateUpdateTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateTableParameters.TableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "CreateUpdateTable", err.Error()) - } - - req, err := client.CreateUpdateTablePreparer(ctx, resourceGroupName, accountName, tableName, createUpdateTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateTablePreparer prepares the CreateUpdateTable request. -func (client TableResourcesClient) CreateUpdateTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateTableSender sends the CreateUpdateTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) CreateUpdateTableSender(req *http.Request) (future TableResourcesCreateUpdateTableFuture, 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 -} - -// CreateUpdateTableResponder handles the response to the CreateUpdateTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) CreateUpdateTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteTable deletes an existing Azure Cosmos DB Table. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesDeleteTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.DeleteTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "DeleteTable", err.Error()) - } - - req, err := client.DeleteTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteTablePreparer prepares the DeleteTable request. -func (client TableResourcesClient) DeleteTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteTableSender sends the DeleteTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) DeleteTableSender(req *http.Request) (future TableResourcesDeleteTableFuture, 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 -} - -// DeleteTableResponder handles the response to the DeleteTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) DeleteTableResponder(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 -} - -// GetTable gets the Tables under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTable", err.Error()) - } - - req, err := client.GetTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure sending request") - return - } - - result, err = client.GetTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure responding to request") - return - } - - return -} - -// GetTablePreparer prepares the GetTable request. -func (client TableResourcesClient) GetTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableSender sends the GetTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableResponder handles the response to the GetTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTableThroughput gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTableThroughput", err.Error()) - } - - req, err := client.GetTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetTableThroughputPreparer prepares the GetTableThroughput request. -func (client TableResourcesClient) GetTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableThroughputSender sends the GetTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableThroughputResponder handles the response to the GetTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListTables lists the Tables under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client TableResourcesClient) ListTables(ctx context.Context, resourceGroupName string, accountName string) (result TableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.ListTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "ListTables", err.Error()) - } - - req, err := client.ListTablesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure sending request") - return - } - - result, err = client.ListTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure responding to request") - return - } - - return -} - -// ListTablesPreparer prepares the ListTables request. -func (client TableResourcesClient) ListTablesPreparer(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 = "2019-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.DocumentDB/databaseAccounts/{accountName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListTablesSender sends the ListTables request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) ListTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListTablesResponder handles the response to the ListTables request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) ListTablesResponder(resp *http.Response) (result TableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateTableThroughput update RUs per second of an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current Table. -func (client TableResourcesClient) UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result TableResourcesUpdateTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.UpdateTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "UpdateTableThroughput", err.Error()) - } - - req, err := client.UpdateTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTableThroughputPreparer prepares the UpdateTableThroughput request. -func (client TableResourcesClient) UpdateTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTableThroughputSender sends the UpdateTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) UpdateTableThroughputSender(req *http.Request) (future TableResourcesUpdateTableThroughputFuture, 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 -} - -// UpdateTableThroughputResponder handles the response to the UpdateTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) UpdateTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/version.go b/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/version.go deleted file mode 100644 index a35c0a5c0a95..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-08-01-preview/documentdb/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package documentdb - -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() + " documentdb/2019-08-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/cosmos-db/mgmt/2019-12-12-preview/documentdb/CHANGELOG.md b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/_meta.json b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/_meta.json deleted file mode 100644 index a4094fe5e436..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "tag": "package-2019-12", - "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-2019-12 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/cassandraresources.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/cassandraresources.go deleted file mode 100644 index fc0780d5fd8b..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/cassandraresources.go +++ /dev/null @@ -1,1180 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CassandraResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type CassandraResourcesClient struct { - BaseClient -} - -// NewCassandraResourcesClient creates an instance of the CassandraResourcesClient client. -func NewCassandraResourcesClient(subscriptionID string, subscriptionID1 string) CassandraResourcesClient { - return NewCassandraResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewCassandraResourcesClientWithBaseURI creates an instance of the CassandraResourcesClient 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 NewCassandraResourcesClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) CassandraResourcesClient { - return CassandraResourcesClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// CreateUpdateCassandraKeyspace create or update an Azure Cosmos DB Cassandra keyspace -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// createUpdateCassandraKeyspaceParameters - the parameters to provide for the current Cassandra keyspace. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraKeyspace") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraKeyspaceParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", err.Error()) - } - - req, err := client.CreateUpdateCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraKeyspacePreparer prepares the CreateUpdateCassandraKeyspace request. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithJSON(createUpdateCassandraKeyspaceParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraKeyspaceSender sends the CreateUpdateCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraKeyspaceFuture, 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 -} - -// CreateUpdateCassandraKeyspaceResponder handles the response to the CreateUpdateCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateCassandraTable create or update an Azure Cosmos DB Cassandra Table -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// createUpdateCassandraTableParameters - the parameters to provide for the current Cassandra Table. -func (client CassandraResourcesClient) CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraTable") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", err.Error()) - } - - req, err := client.CreateUpdateCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraTablePreparer prepares the CreateUpdateCassandraTable request. -func (client CassandraResourcesClient) CreateUpdateCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateCassandraTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraTableSender sends the CreateUpdateCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraTableSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraTableFuture, 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 -} - -// CreateUpdateCassandraTableResponder handles the response to the CreateUpdateCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCassandraKeyspace deletes an existing Azure Cosmos DB Cassandra keyspace. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesDeleteCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraKeyspace") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", err.Error()) - } - - req, err := client.DeleteCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraKeyspacePreparer prepares the DeleteCassandraKeyspace request. -func (client CassandraResourcesClient) DeleteCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraKeyspaceSender sends the DeleteCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesDeleteCassandraKeyspaceFuture, 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 -} - -// DeleteCassandraKeyspaceResponder handles the response to the DeleteCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceResponder(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 -} - -// DeleteCassandraTable deletes an existing Azure Cosmos DB Cassandra table. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesDeleteCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraTable") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraTable", err.Error()) - } - - req, err := client.DeleteCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraTablePreparer prepares the DeleteCassandraTable request. -func (client CassandraResourcesClient) DeleteCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraTableSender sends the DeleteCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraTableSender(req *http.Request) (future CassandraResourcesDeleteCassandraTableFuture, 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 -} - -// DeleteCassandraTableResponder handles the response to the DeleteCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraTableResponder(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 -} - -// GetCassandraKeyspace gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraKeyspaceGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspace") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspace", err.Error()) - } - - req, err := client.GetCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspacePreparer prepares the GetCassandraKeyspace request. -func (client CassandraResourcesClient) GetCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceSender sends the GetCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceResponder handles the response to the GetCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraKeyspaceThroughput gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspaceThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.GetCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspaceThroughputPreparer prepares the GetCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceThroughputSender sends the GetCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceThroughputResponder handles the response to the GetCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTable gets the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraTableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTable") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTable", err.Error()) - } - - req, err := client.GetCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTablePreparer prepares the GetCassandraTable request. -func (client CassandraResourcesClient) GetCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableSender sends the GetCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableResponder handles the response to the GetCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTableThroughput gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTableThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", err.Error()) - } - - req, err := client.GetCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTableThroughputPreparer prepares the GetCassandraTableThroughput request. -func (client CassandraResourcesClient) GetCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableThroughputSender sends the GetCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableThroughputResponder handles the response to the GetCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraKeyspaces lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client CassandraResourcesClient) ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result CassandraKeyspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraKeyspaces") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", err.Error()) - } - - req, err := client.ListCassandraKeyspacesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraKeyspacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraKeyspacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraKeyspacesPreparer prepares the ListCassandraKeyspaces request. -func (client CassandraResourcesClient) ListCassandraKeyspacesPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraKeyspacesSender sends the ListCassandraKeyspaces request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraKeyspacesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraKeyspacesResponder handles the response to the ListCassandraKeyspaces request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraKeyspacesResponder(resp *http.Response) (result CassandraKeyspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraTables lists the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraTableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraTables") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraTables", err.Error()) - } - - req, err := client.ListCassandraTablesPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraTablesPreparer prepares the ListCassandraTables request. -func (client CassandraResourcesClient) ListCassandraTablesPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraTablesSender sends the ListCassandraTables request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraTablesResponder handles the response to the ListCassandraTables request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraTablesResponder(resp *http.Response) (result CassandraTableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraKeyspaceThroughput update RUs per second of an Azure Cosmos DB Cassandra Keyspace -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// Keyspace. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraKeyspaceThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.UpdateCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraKeyspaceThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraKeyspaceThroughputPreparer prepares the UpdateCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraKeyspaceThroughputSender sends the UpdateCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, 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 -} - -// UpdateCassandraKeyspaceThroughputResponder handles the response to the UpdateCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraTableThroughput update RUs per second of an Azure Cosmos DB Cassandra table -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// table. -func (client CassandraResourcesClient) UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraTableThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", err.Error()) - } - - req, err := client.UpdateCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraTableThroughputPreparer prepares the UpdateCassandraTableThroughput request. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraTableThroughputSender sends the UpdateCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraTableThroughputFuture, 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 -} - -// UpdateCassandraTableThroughputResponder handles the response to the UpdateCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/client.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/client.go deleted file mode 100644 index d161e6593add..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Package documentdb implements the Azure ARM Documentdb service API version . -// -// Azure Cosmos DB Database Service Resource Provider REST API -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Documentdb - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Documentdb. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string - SubscriptionID1 string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string, subscriptionID1 string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// 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, subscriptionID1 string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - SubscriptionID1: subscriptionID1, - } -} diff --git a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collection.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collection.go deleted file mode 100644 index 0d82325cdd10..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collection.go +++ /dev/null @@ -1,317 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionClient struct { - BaseClient -} - -// NewCollectionClient creates an instance of the CollectionClient client. -func NewCollectionClient(subscriptionID string, subscriptionID1 string) CollectionClient { - return NewCollectionClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewCollectionClientWithBaseURI creates an instance of the CollectionClient 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 NewCollectionClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) CollectionClient { - return CollectionClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetricDefinitions retrieves metric definitions for the given collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -func (client CollectionClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetricDefinitions") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client CollectionClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListUsages") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionpartition.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionpartition.go deleted file mode 100644 index 5b5c04daf115..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionpartition.go +++ /dev/null @@ -1,226 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionClient struct { - BaseClient -} - -// NewCollectionPartitionClient creates an instance of the CollectionPartitionClient client. -func NewCollectionPartitionClient(subscriptionID string, subscriptionID1 string) CollectionPartitionClient { - return NewCollectionPartitionClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewCollectionPartitionClientWithBaseURI creates an instance of the CollectionPartitionClient 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 NewCollectionPartitionClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) CollectionPartitionClient { - return CollectionPartitionClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection, split by partition. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection, split by partition. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionPartitionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionUsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListUsages") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionPartitionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListUsagesResponder(resp *http.Response) (result PartitionUsagesResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionpartitionregion.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionpartitionregion.go deleted file mode 100644 index adaef83a8f36..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionpartitionregion.go +++ /dev/null @@ -1,132 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionRegionClient struct { - BaseClient -} - -// NewCollectionPartitionRegionClient creates an instance of the CollectionPartitionRegionClient client. -func NewCollectionPartitionRegionClient(subscriptionID string, subscriptionID1 string) CollectionPartitionRegionClient { - return NewCollectionPartitionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewCollectionPartitionRegionClientWithBaseURI creates an instance of the CollectionPartitionRegionClient 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 NewCollectionPartitionRegionClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) CollectionPartitionRegionClient { - return CollectionPartitionRegionClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection and region, split by -// partition. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionRegionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionregion.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionregion.go deleted file mode 100644 index b581dd6bb1d7..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/collectionregion.go +++ /dev/null @@ -1,132 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionRegionClient struct { - BaseClient -} - -// NewCollectionRegionClient creates an instance of the CollectionRegionClient client. -func NewCollectionRegionClient(subscriptionID string, subscriptionID1 string) CollectionRegionClient { - return NewCollectionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewCollectionRegionClientWithBaseURI creates an instance of the CollectionRegionClient 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 NewCollectionRegionClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) CollectionRegionClient { - return CollectionRegionClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account, collection and -// region. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionRegionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/database.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/database.go deleted file mode 100644 index 89eb636b6b25..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/database.go +++ /dev/null @@ -1,311 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseClient struct { - BaseClient -} - -// NewDatabaseClient creates an instance of the DatabaseClient client. -func NewDatabaseClient(subscriptionID string, subscriptionID1 string) DatabaseClient { - return NewDatabaseClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewDatabaseClientWithBaseURI creates an instance of the DatabaseClient 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 NewDatabaseClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) DatabaseClient { - return DatabaseClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetricDefinitions retrieves metric definitions for the given database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -func (client DatabaseClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetricDefinitions") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListUsages") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/databaseaccountregion.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/databaseaccountregion.go deleted file mode 100644 index 4ba0f2f8f51c..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/databaseaccountregion.go +++ /dev/null @@ -1,127 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountRegionClient struct { - BaseClient -} - -// NewDatabaseAccountRegionClient creates an instance of the DatabaseAccountRegionClient client. -func NewDatabaseAccountRegionClient(subscriptionID string, subscriptionID1 string) DatabaseAccountRegionClient { - return NewDatabaseAccountRegionClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewDatabaseAccountRegionClientWithBaseURI creates an instance of the DatabaseAccountRegionClient 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 NewDatabaseAccountRegionClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) DatabaseAccountRegionClient { - return DatabaseAccountRegionClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and region. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountRegionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/databaseaccounts.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/databaseaccounts.go deleted file mode 100644 index f3898fff3417..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/databaseaccounts.go +++ /dev/null @@ -1,1654 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountsClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountsClient struct { - BaseClient -} - -// NewDatabaseAccountsClient creates an instance of the DatabaseAccountsClient client. -func NewDatabaseAccountsClient(subscriptionID string, subscriptionID1 string) DatabaseAccountsClient { - return NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewDatabaseAccountsClientWithBaseURI creates an instance of the DatabaseAccountsClient 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 NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) DatabaseAccountsClient { - return DatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// CheckNameExists checks that the Azure Cosmos DB account name already exists. A valid account name may contain only -// lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. -// Parameters: -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.CheckNameExists") - 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: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CheckNameExists", err.Error()) - } - - req, err := client.CheckNameExistsPreparer(ctx, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") - return - } - - result, err = client.CheckNameExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameExistsPreparer prepares the CheckNameExists request. -func (client DatabaseAccountsClient) CheckNameExistsPreparer(ctx context.Context, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameExistsSender sends the CheckNameExists request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) CheckNameExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CheckNameExistsResponder handles the response to the CheckNameExists request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when -// performing updates on an account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// createUpdateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (result DatabaseAccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateParameters, - Constraints: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMaximum, Rule: int64(2147483647), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: int64(86400), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: int64(5), Chain: nil}, - }}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.DatabaseAccountOfferType", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, createUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (*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 = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(createUpdateParameters), - 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 DatabaseAccountsClient) CreateOrUpdateSender(req *http.Request) (future DatabaseAccountsCreateOrUpdateFuture, 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 DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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 existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseAccountsClient) 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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) DeleteSender(req *http.Request) (future DatabaseAccountsDeleteFuture, 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 DatabaseAccountsClient) 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 -} - -// FailoverPriorityChange changes the failover priority for the Azure Cosmos DB database account. A failover priority -// of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover -// priority values must be unique for each of the regions in which the database account exists. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// failoverParameters - the new failover policies for the database account. -func (client DatabaseAccountsClient) FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (result DatabaseAccountsFailoverPriorityChangeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.FailoverPriorityChange") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: failoverParameters, - Constraints: []validation.Constraint{{Target: "failoverParameters.FailoverPolicies", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "FailoverPriorityChange", err.Error()) - } - - req, err := client.FailoverPriorityChangePreparer(ctx, resourceGroupName, accountName, failoverParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") - return - } - - result, err = client.FailoverPriorityChangeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPriorityChangePreparer prepares the FailoverPriorityChange request. -func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (*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 = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", pathParameters), - autorest.WithJSON(failoverParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverPriorityChangeSender sends the FailoverPriorityChange request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) FailoverPriorityChangeSender(req *http.Request) (future DatabaseAccountsFailoverPriorityChangeFuture, 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 -} - -// FailoverPriorityChangeResponder handles the response to the FailoverPriorityChange request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(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 retrieves the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseAccountsClient) 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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) 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 DatabaseAccountsClient) GetResponder(resp *http.Response) (result DatabaseAccountGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.GetReadOnlyKeys") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", err.Error()) - } - - req, err := client.GetReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.GetReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// GetReadOnlyKeysPreparer prepares the GetReadOnlyKeys request. -func (client DatabaseAccountsClient) GetReadOnlyKeysPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetReadOnlyKeysSender sends the GetReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) GetReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetReadOnlyKeysResponder handles the response to the GetReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) GetReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, 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 the Azure Cosmos DB database accounts available under the subscription. -func (client DatabaseAccountsClient) List(ctx context.Context) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DatabaseAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the Azure Cosmos DB database accounts available under the given resource group. -// Parameters: -// resourceGroupName - name of an Azure resource group. -func (client DatabaseAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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("documentdb.DatabaseAccountsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DatabaseAccountsClient) 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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionStrings lists the connection strings for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListConnectionStrings") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListConnectionStrings", err.Error()) - } - - req, err := client.ListConnectionStringsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionStringsPreparer prepares the ListConnectionStrings request. -func (client DatabaseAccountsClient) ListConnectionStringsPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.Response) (result DatabaseAccountListConnectionStringsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListKeys") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DatabaseAccountsClient) ListKeysPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (result DatabaseAccountListKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions retrieves metric definitions for the given database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetricDefinitions") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseAccountsClient) ListMetricDefinitionsPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountsClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListReadOnlyKeys") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", err.Error()) - } - - req, err := client.ListReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.ListReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListReadOnlyKeysPreparer prepares the ListReadOnlyKeys request. -func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListReadOnlyKeysSender sends the ListReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListReadOnlyKeysResponder handles the response to the ListReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseAccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListUsages") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseAccountsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// regionParameterForOffline - cosmos DB region to offline for the database account. -func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (result DatabaseAccountsOfflineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OfflineRegion") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOffline, - Constraints: []validation.Constraint{{Target: "regionParameterForOffline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OfflineRegion", err.Error()) - } - - req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOffline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OfflineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OfflineRegionPreparer prepares the OfflineRegion request. -func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (*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 = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/offlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOffline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OfflineRegionSender sends the OfflineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OfflineRegionSender(req *http.Request) (future DatabaseAccountsOfflineRegionFuture, 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 -} - -// OfflineRegionResponder handles the response to the OfflineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// OnlineRegion online the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// regionParameterForOnline - cosmos DB region to online for the database account. -func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (result DatabaseAccountsOnlineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OnlineRegion") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOnline, - Constraints: []validation.Constraint{{Target: "regionParameterForOnline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OnlineRegion", err.Error()) - } - - req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOnline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OnlineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OnlineRegionPreparer prepares the OnlineRegion request. -func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (*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 = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/onlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOnline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OnlineRegionSender sends the OnlineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OnlineRegionSender(req *http.Request) (future DatabaseAccountsOnlineRegionFuture, 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 -} - -// OnlineRegionResponder handles the response to the OnlineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OnlineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateKey regenerates an access key for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyToRegenerate - the name of the key to regenerate. -func (client DatabaseAccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (result DatabaseAccountsRegenerateKeyFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.RegenerateKey") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, keyToRegenerate) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateKeySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DatabaseAccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (*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 = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(keyToRegenerate), - 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 DatabaseAccountsClient) RegenerateKeySender(req *http.Request) (future DatabaseAccountsRegenerateKeyFuture, 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 -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) RegenerateKeyResponder(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 the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// updateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (result DatabaseAccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabaseAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (*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 = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 DatabaseAccountsClient) UpdateSender(req *http.Request) (future DatabaseAccountsUpdateFuture, 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 DatabaseAccountsClient) UpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/documentdbapi/interfaces.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/documentdbapi/interfaces.go deleted file mode 100644 index b7c89cdc304e..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/documentdbapi/interfaces.go +++ /dev/null @@ -1,254 +0,0 @@ -package documentdbapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/cosmos-db/mgmt/2019-12-12-preview/documentdb" - "github.com/Azure/go-autorest/autorest" -) - -// DatabaseAccountsClientAPI contains the set of methods on the DatabaseAccountsClient type. -type DatabaseAccountsClientAPI interface { - CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters documentdb.DatabaseAccountCreateUpdateParameters) (result documentdb.DatabaseAccountsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountsDeleteFuture, err error) - FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters documentdb.FailoverPolicies) (result documentdb.DatabaseAccountsFailoverPriorityChangeFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountGetResults, err error) - GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - List(ctx context.Context) (result documentdb.DatabaseAccountsListResult, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result documentdb.DatabaseAccountsListResult, err error) - ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListConnectionStringsResult, err error) - ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListKeysResult, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.MetricListResult, err error) - ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.UsagesResult, err error) - OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOfflineRegionFuture, err error) - OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOnlineRegionFuture, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate documentdb.DatabaseAccountRegenerateKeyParameters) (result documentdb.DatabaseAccountsRegenerateKeyFuture, err error) - Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters documentdb.DatabaseAccountUpdateParameters) (result documentdb.DatabaseAccountsUpdateFuture, err error) -} - -var _ DatabaseAccountsClientAPI = (*documentdb.DatabaseAccountsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result documentdb.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result documentdb.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*documentdb.OperationsClient)(nil) - -// DatabaseClientAPI contains the set of methods on the DatabaseClient type. -type DatabaseClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ DatabaseClientAPI = (*documentdb.DatabaseClient)(nil) - -// CollectionClientAPI contains the set of methods on the CollectionClient type. -type CollectionClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ CollectionClientAPI = (*documentdb.CollectionClient)(nil) - -// CollectionRegionClientAPI contains the set of methods on the CollectionRegionClient type. -type CollectionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ CollectionRegionClientAPI = (*documentdb.CollectionRegionClient)(nil) - -// DatabaseAccountRegionClientAPI contains the set of methods on the DatabaseAccountRegionClient type. -type DatabaseAccountRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ DatabaseAccountRegionClientAPI = (*documentdb.DatabaseAccountRegionClient)(nil) - -// PercentileSourceTargetClientAPI contains the set of methods on the PercentileSourceTargetClient type. -type PercentileSourceTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileSourceTargetClientAPI = (*documentdb.PercentileSourceTargetClient)(nil) - -// PercentileTargetClientAPI contains the set of methods on the PercentileTargetClient type. -type PercentileTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileTargetClientAPI = (*documentdb.PercentileTargetClient)(nil) - -// PercentileClientAPI contains the set of methods on the PercentileClient type. -type PercentileClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileClientAPI = (*documentdb.PercentileClient)(nil) - -// CollectionPartitionRegionClientAPI contains the set of methods on the CollectionPartitionRegionClient type. -type CollectionPartitionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ CollectionPartitionRegionClientAPI = (*documentdb.CollectionPartitionRegionClient)(nil) - -// CollectionPartitionClientAPI contains the set of methods on the CollectionPartitionClient type. -type CollectionPartitionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionUsagesResult, err error) -} - -var _ CollectionPartitionClientAPI = (*documentdb.CollectionPartitionClient)(nil) - -// PartitionKeyRangeIDClientAPI contains the set of methods on the PartitionKeyRangeIDClient type. -type PartitionKeyRangeIDClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDClientAPI = (*documentdb.PartitionKeyRangeIDClient)(nil) - -// PartitionKeyRangeIDRegionClientAPI contains the set of methods on the PartitionKeyRangeIDRegionClient type. -type PartitionKeyRangeIDRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDRegionClientAPI = (*documentdb.PartitionKeyRangeIDRegionClient)(nil) - -// SQLResourcesClientAPI contains the set of methods on the SQLResourcesClient type. -type SQLResourcesClientAPI interface { - CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters documentdb.SQLContainerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLContainerFuture, err error) - CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters documentdb.SQLDatabaseCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture, err error) - CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters documentdb.SQLStoredProcedureCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) - CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters documentdb.SQLTriggerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLTriggerFuture, err error) - CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters documentdb.SQLUserDefinedFunctionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) - DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesDeleteSQLContainerFuture, err error) - DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesDeleteSQLDatabaseFuture, err error) - DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLResourcesDeleteSQLStoredProcedureFuture, err error) - DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLResourcesDeleteSQLTriggerFuture, err error) - DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) - GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLContainerGetResults, err error) - GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLDatabaseGetResults, err error) - GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLStoredProcedureGetResults, err error) - GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLTriggerGetResults, err error) - GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLUserDefinedFunctionGetResults, err error) - ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLContainerListResult, err error) - ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLDatabaseListResult, err error) - ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLStoredProcedureListResult, err error) - ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLTriggerListResult, err error) - ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLUserDefinedFunctionListResult, err error) - UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLContainerThroughputFuture, err error) - UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) -} - -var _ SQLResourcesClientAPI = (*documentdb.SQLResourcesClient)(nil) - -// MongoDBResourcesClientAPI contains the set of methods on the MongoDBResourcesClient type. -type MongoDBResourcesClientAPI interface { - CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters documentdb.MongoDBCollectionCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) - CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters documentdb.MongoDBDatabaseCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) - DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture, err error) - DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) - GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBCollectionGetResults, err error) - GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBDatabaseGetResults, err error) - GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBCollectionListResult, err error) - ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MongoDBDatabaseListResult, err error) - UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) - UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) -} - -var _ MongoDBResourcesClientAPI = (*documentdb.MongoDBResourcesClient)(nil) - -// TableResourcesClientAPI contains the set of methods on the TableResourcesClient type. -type TableResourcesClientAPI interface { - CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters documentdb.TableCreateUpdateParameters) (result documentdb.TableResourcesCreateUpdateTableFuture, err error) - DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesDeleteTableFuture, err error) - GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableGetResults, err error) - GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListTables(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.TableListResult, err error) - UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.TableResourcesUpdateTableThroughputFuture, err error) -} - -var _ TableResourcesClientAPI = (*documentdb.TableResourcesClient)(nil) - -// CassandraResourcesClientAPI contains the set of methods on the CassandraResourcesClient type. -type CassandraResourcesClientAPI interface { - CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters documentdb.CassandraKeyspaceCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) - CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters documentdb.CassandraTableCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraTableFuture, err error) - DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture, err error) - DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesDeleteCassandraTableFuture, err error) - GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraKeyspaceGetResults, err error) - GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraTableGetResults, err error) - GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.CassandraKeyspaceListResult, err error) - ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraTableListResult, err error) - UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) - UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture, err error) -} - -var _ CassandraResourcesClientAPI = (*documentdb.CassandraResourcesClient)(nil) - -// GremlinResourcesClientAPI contains the set of methods on the GremlinResourcesClient type. -type GremlinResourcesClientAPI interface { - CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters documentdb.GremlinDatabaseCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) - CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters documentdb.GremlinGraphCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture, err error) - DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesDeleteGremlinDatabaseFuture, err error) - DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesDeleteGremlinGraphFuture, err error) - GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinDatabaseGetResults, err error) - GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinGraphGetResults, err error) - GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.GremlinDatabaseListResult, err error) - ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinGraphListResult, err error) - UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) - UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) -} - -var _ GremlinResourcesClientAPI = (*documentdb.GremlinResourcesClient)(nil) - -// NotebookWorkspacesClientAPI contains the set of methods on the NotebookWorkspacesClient type. -type NotebookWorkspacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters documentdb.NotebookWorkspaceCreateUpdateParameters) (result documentdb.NotebookWorkspacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspace, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceListResult, err error) - ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceConnectionInfoResult, err error) - RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesRegenerateAuthTokenFuture, err error) - Start(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesStartFuture, err error) -} - -var _ NotebookWorkspacesClientAPI = (*documentdb.NotebookWorkspacesClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result documentdb.PrivateLinkResource, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateLinkResourceListResult, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*documentdb.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters documentdb.PrivateEndpointConnection) (result documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnection, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateEndpointConnectionListResult, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*documentdb.PrivateEndpointConnectionsClient)(nil) diff --git a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/enums.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/enums.go deleted file mode 100644 index 4cfd627a2915..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/enums.go +++ /dev/null @@ -1,295 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CompositePathSortOrder enumerates the values for composite path sort order. -type CompositePathSortOrder string - -const ( - // Ascending ... - Ascending CompositePathSortOrder = "Ascending" - // Descending ... - Descending CompositePathSortOrder = "Descending" -) - -// PossibleCompositePathSortOrderValues returns an array of possible values for the CompositePathSortOrder const type. -func PossibleCompositePathSortOrderValues() []CompositePathSortOrder { - return []CompositePathSortOrder{Ascending, Descending} -} - -// ConflictResolutionMode enumerates the values for conflict resolution mode. -type ConflictResolutionMode string - -const ( - // Custom ... - Custom ConflictResolutionMode = "Custom" - // LastWriterWins ... - LastWriterWins ConflictResolutionMode = "LastWriterWins" -) - -// PossibleConflictResolutionModeValues returns an array of possible values for the ConflictResolutionMode const type. -func PossibleConflictResolutionModeValues() []ConflictResolutionMode { - return []ConflictResolutionMode{Custom, LastWriterWins} -} - -// ConnectorOffer enumerates the values for connector offer. -type ConnectorOffer string - -const ( - // Small ... - Small ConnectorOffer = "Small" -) - -// PossibleConnectorOfferValues returns an array of possible values for the ConnectorOffer const type. -func PossibleConnectorOfferValues() []ConnectorOffer { - return []ConnectorOffer{Small} -} - -// DatabaseAccountKind enumerates the values for database account kind. -type DatabaseAccountKind string - -const ( - // GlobalDocumentDB ... - GlobalDocumentDB DatabaseAccountKind = "GlobalDocumentDB" - // MongoDB ... - MongoDB DatabaseAccountKind = "MongoDB" - // Parse ... - Parse DatabaseAccountKind = "Parse" -) - -// PossibleDatabaseAccountKindValues returns an array of possible values for the DatabaseAccountKind const type. -func PossibleDatabaseAccountKindValues() []DatabaseAccountKind { - return []DatabaseAccountKind{GlobalDocumentDB, MongoDB, Parse} -} - -// DatabaseAccountOfferType enumerates the values for database account offer type. -type DatabaseAccountOfferType string - -const ( - // Standard ... - Standard DatabaseAccountOfferType = "Standard" -) - -// PossibleDatabaseAccountOfferTypeValues returns an array of possible values for the DatabaseAccountOfferType const type. -func PossibleDatabaseAccountOfferTypeValues() []DatabaseAccountOfferType { - return []DatabaseAccountOfferType{Standard} -} - -// DataType enumerates the values for data type. -type DataType string - -const ( - // LineString ... - LineString DataType = "LineString" - // MultiPolygon ... - MultiPolygon DataType = "MultiPolygon" - // Number ... - Number DataType = "Number" - // Point ... - Point DataType = "Point" - // Polygon ... - Polygon DataType = "Polygon" - // String ... - String DataType = "String" -) - -// PossibleDataTypeValues returns an array of possible values for the DataType const type. -func PossibleDataTypeValues() []DataType { - return []DataType{LineString, MultiPolygon, Number, Point, Polygon, String} -} - -// DefaultConsistencyLevel enumerates the values for default consistency level. -type DefaultConsistencyLevel string - -const ( - // BoundedStaleness ... - BoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" - // ConsistentPrefix ... - ConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" - // Eventual ... - Eventual DefaultConsistencyLevel = "Eventual" - // Session ... - Session DefaultConsistencyLevel = "Session" - // Strong ... - Strong DefaultConsistencyLevel = "Strong" -) - -// PossibleDefaultConsistencyLevelValues returns an array of possible values for the DefaultConsistencyLevel const type. -func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { - return []DefaultConsistencyLevel{BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong} -} - -// IndexingMode enumerates the values for indexing mode. -type IndexingMode string - -const ( - // Consistent ... - Consistent IndexingMode = "Consistent" - // Lazy ... - Lazy IndexingMode = "Lazy" - // None ... - None IndexingMode = "None" -) - -// PossibleIndexingModeValues returns an array of possible values for the IndexingMode const type. -func PossibleIndexingModeValues() []IndexingMode { - return []IndexingMode{Consistent, Lazy, None} -} - -// IndexKind enumerates the values for index kind. -type IndexKind string - -const ( - // Hash ... - Hash IndexKind = "Hash" - // Range ... - Range IndexKind = "Range" - // Spatial ... - Spatial IndexKind = "Spatial" -) - -// PossibleIndexKindValues returns an array of possible values for the IndexKind const type. -func PossibleIndexKindValues() []IndexKind { - return []IndexKind{Hash, Range, Spatial} -} - -// KeyKind enumerates the values for key kind. -type KeyKind string - -const ( - // Primary ... - Primary KeyKind = "primary" - // PrimaryReadonly ... - PrimaryReadonly KeyKind = "primaryReadonly" - // Secondary ... - Secondary KeyKind = "secondary" - // SecondaryReadonly ... - SecondaryReadonly KeyKind = "secondaryReadonly" -) - -// PossibleKeyKindValues returns an array of possible values for the KeyKind const type. -func PossibleKeyKindValues() []KeyKind { - return []KeyKind{Primary, PrimaryReadonly, Secondary, SecondaryReadonly} -} - -// PartitionKind enumerates the values for partition kind. -type PartitionKind string - -const ( - // PartitionKindHash ... - PartitionKindHash PartitionKind = "Hash" - // PartitionKindRange ... - PartitionKindRange PartitionKind = "Range" -) - -// PossiblePartitionKindValues returns an array of possible values for the PartitionKind const type. -func PossiblePartitionKindValues() []PartitionKind { - return []PartitionKind{PartitionKindHash, PartitionKindRange} -} - -// PrimaryAggregationType enumerates the values for primary aggregation type. -type PrimaryAggregationType string - -const ( - // PrimaryAggregationTypeAverage ... - PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" - // PrimaryAggregationTypeLast ... - PrimaryAggregationTypeLast PrimaryAggregationType = "Last" - // PrimaryAggregationTypeMaximum ... - PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" - // PrimaryAggregationTypeMinimum ... - PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" - // PrimaryAggregationTypeNone ... - PrimaryAggregationTypeNone PrimaryAggregationType = "None" - // PrimaryAggregationTypeTotal ... - PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" -) - -// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeLast, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} -} - -// SpatialType enumerates the values for spatial type. -type SpatialType string - -const ( - // SpatialTypeLineString ... - SpatialTypeLineString SpatialType = "LineString" - // SpatialTypeMultiPolygon ... - SpatialTypeMultiPolygon SpatialType = "MultiPolygon" - // SpatialTypePoint ... - SpatialTypePoint SpatialType = "Point" - // SpatialTypePolygon ... - SpatialTypePolygon SpatialType = "Polygon" -) - -// PossibleSpatialTypeValues returns an array of possible values for the SpatialType const type. -func PossibleSpatialTypeValues() []SpatialType { - return []SpatialType{SpatialTypeLineString, SpatialTypeMultiPolygon, SpatialTypePoint, SpatialTypePolygon} -} - -// TriggerOperation enumerates the values for trigger operation. -type TriggerOperation string - -const ( - // All ... - All TriggerOperation = "All" - // Create ... - Create TriggerOperation = "Create" - // Delete ... - Delete TriggerOperation = "Delete" - // Replace ... - Replace TriggerOperation = "Replace" - // Update ... - Update TriggerOperation = "Update" -) - -// PossibleTriggerOperationValues returns an array of possible values for the TriggerOperation const type. -func PossibleTriggerOperationValues() []TriggerOperation { - return []TriggerOperation{All, Create, Delete, Replace, Update} -} - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // Post ... - Post TriggerType = "Post" - // Pre ... - Pre TriggerType = "Pre" -) - -// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. -func PossibleTriggerTypeValues() []TriggerType { - return []TriggerType{Post, Pre} -} - -// UnitType enumerates the values for unit type. -type UnitType string - -const ( - // Bytes ... - Bytes UnitType = "Bytes" - // BytesPerSecond ... - BytesPerSecond UnitType = "BytesPerSecond" - // Count ... - Count UnitType = "Count" - // CountPerSecond ... - CountPerSecond UnitType = "CountPerSecond" - // Milliseconds ... - Milliseconds UnitType = "Milliseconds" - // Percent ... - Percent UnitType = "Percent" - // Seconds ... - Seconds UnitType = "Seconds" -) - -// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{Bytes, BytesPerSecond, Count, CountPerSecond, Milliseconds, Percent, Seconds} -} diff --git a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/gremlinresources.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/gremlinresources.go deleted file mode 100644 index 282ecfc03bcc..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/gremlinresources.go +++ /dev/null @@ -1,1186 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GremlinResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type GremlinResourcesClient struct { - BaseClient -} - -// NewGremlinResourcesClient creates an instance of the GremlinResourcesClient client. -func NewGremlinResourcesClient(subscriptionID string, subscriptionID1 string) GremlinResourcesClient { - return NewGremlinResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewGremlinResourcesClientWithBaseURI creates an instance of the GremlinResourcesClient 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 NewGremlinResourcesClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) GremlinResourcesClient { - return GremlinResourcesClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// CreateUpdateGremlinDatabase create or update an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateGremlinDatabaseParameters - the parameters to provide for the current Gremlin database. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", err.Error()) - } - - req, err := client.CreateUpdateGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinDatabasePreparer prepares the CreateUpdateGremlinDatabase request. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateGremlinDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinDatabaseSender sends the CreateUpdateGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinDatabaseFuture, 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 -} - -// CreateUpdateGremlinDatabaseResponder handles the response to the CreateUpdateGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateGremlinGraph create or update an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// createUpdateGremlinGraphParameters - the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinGraph") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinGraphParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", err.Error()) - } - - req, err := client.CreateUpdateGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinGraphPreparer prepares the CreateUpdateGremlinGraph request. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithJSON(createUpdateGremlinGraphParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinGraphSender sends the CreateUpdateGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinGraphFuture, 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 -} - -// CreateUpdateGremlinGraphResponder handles the response to the CreateUpdateGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteGremlinDatabase deletes an existing Azure Cosmos DB Gremlin database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesDeleteGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", err.Error()) - } - - req, err := client.DeleteGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinDatabasePreparer prepares the DeleteGremlinDatabase request. -func (client GremlinResourcesClient) DeleteGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinDatabaseSender sends the DeleteGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinDatabaseSender(req *http.Request) (future GremlinResourcesDeleteGremlinDatabaseFuture, 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 -} - -// DeleteGremlinDatabaseResponder handles the response to the DeleteGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinDatabaseResponder(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 -} - -// DeleteGremlinGraph deletes an existing Azure Cosmos DB Gremlin graph. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesDeleteGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinGraph") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinGraph", err.Error()) - } - - req, err := client.DeleteGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinGraphPreparer prepares the DeleteGremlinGraph request. -func (client GremlinResourcesClient) DeleteGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinGraphSender sends the DeleteGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinGraphSender(req *http.Request) (future GremlinResourcesDeleteGremlinGraphFuture, 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 -} - -// DeleteGremlinGraphResponder handles the response to the DeleteGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinGraphResponder(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 -} - -// GetGremlinDatabase gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabase", err.Error()) - } - - req, err := client.GetGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabasePreparer prepares the GetGremlinDatabase request. -func (client GremlinResourcesClient) GetGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseSender sends the GetGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseResponder handles the response to the GetGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinDatabaseThroughput gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabaseThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.GetGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabaseThroughputPreparer prepares the GetGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseThroughputSender sends the GetGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseThroughputResponder handles the response to the GetGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraph gets the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinGraphGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraph") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraph", err.Error()) - } - - req, err := client.GetGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphPreparer prepares the GetGremlinGraph request. -func (client GremlinResourcesClient) GetGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphSender sends the GetGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphResponder handles the response to the GetGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraphThroughput gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with -// the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraphThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", err.Error()) - } - - req, err := client.GetGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphThroughputPreparer prepares the GetGremlinGraphThroughput request. -func (client GremlinResourcesClient) GetGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphThroughputSender sends the GetGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphThroughputResponder handles the response to the GetGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinDatabases lists the Gremlin databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client GremlinResourcesClient) ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result GremlinDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinDatabases") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinDatabases", err.Error()) - } - - req, err := client.ListGremlinDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinDatabasesPreparer prepares the ListGremlinDatabases request. -func (client GremlinResourcesClient) ListGremlinDatabasesPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinDatabasesSender sends the ListGremlinDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinDatabasesResponder handles the response to the ListGremlinDatabases request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinDatabasesResponder(resp *http.Response) (result GremlinDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinGraphs lists the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinGraphListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinGraphs") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinGraphs", err.Error()) - } - - req, err := client.ListGremlinGraphsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinGraphsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinGraphsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinGraphsPreparer prepares the ListGremlinGraphs request. -func (client GremlinResourcesClient) ListGremlinGraphsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinGraphsSender sends the ListGremlinGraphs request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinGraphsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinGraphsResponder handles the response to the ListGremlinGraphs request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinGraphsResponder(resp *http.Response) (result GremlinGraphListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinDatabaseThroughput update RUs per second of an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin -// database. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinDatabaseThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinDatabaseThroughputPreparer prepares the UpdateGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinDatabaseThroughputSender sends the UpdateGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinDatabaseThroughputFuture, 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 -} - -// UpdateGremlinDatabaseThroughputResponder handles the response to the UpdateGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinGraphThroughput update RUs per second of an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinGraphThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", err.Error()) - } - - req, err := client.UpdateGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinGraphThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinGraphThroughputPreparer prepares the UpdateGremlinGraphThroughput request. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinGraphThroughputSender sends the UpdateGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinGraphThroughputFuture, 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 -} - -// UpdateGremlinGraphThroughputResponder handles the response to the UpdateGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/models.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/models.go deleted file mode 100644 index c1c397f09fe3..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/models.go +++ /dev/null @@ -1,7147 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb" - -// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other -// than required location and tags -type ARMProxyResource struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ARMProxyResource. -func (apr ARMProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ARMResourceProperties the core properties of ARM resources. -type ARMResourceProperties struct { - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ARMResourceProperties. -func (arp ARMResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Location != nil { - objectMap["location"] = arp.Location - } - if arp.Tags != nil { - objectMap["tags"] = arp.Tags - } - return json.Marshal(objectMap) -} - -// AutoUpgradePolicyResource cosmos DB resource auto-upgrade policy -type AutoUpgradePolicyResource struct { - // ThroughputPolicy - Represents throughput policy which service must adhere to for auto-upgrade - ThroughputPolicy *ThroughputPolicyResource `json:"throughputPolicy,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) -} - -// Capability cosmos DB capability object -type Capability struct { - // Name - Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". - Name *string `json:"name,omitempty"` -} - -// CassandraKeyspaceCreateUpdateParameters parameters to create and update Cosmos DB Cassandra keyspace. -type CassandraKeyspaceCreateUpdateParameters struct { - // CassandraKeyspaceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra keyspace. - *CassandraKeyspaceCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceCreateUpdateParameters. -func (ckcup CassandraKeyspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckcup.CassandraKeyspaceCreateUpdateProperties != nil { - objectMap["properties"] = ckcup.CassandraKeyspaceCreateUpdateProperties - } - if ckcup.Location != nil { - objectMap["location"] = ckcup.Location - } - if ckcup.Tags != nil { - objectMap["tags"] = ckcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceCreateUpdateParameters struct. -func (ckcup *CassandraKeyspaceCreateUpdateParameters) 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 cassandraKeyspaceCreateUpdateProperties CassandraKeyspaceCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraKeyspaceCreateUpdateProperties) - if err != nil { - return err - } - ckcup.CassandraKeyspaceCreateUpdateProperties = &cassandraKeyspaceCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckcup.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra -// keyspace. -type CassandraKeyspaceCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra keyspace - Resource *CassandraKeyspaceResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetProperties the properties of an Azure Cosmos DB Cassandra keyspace -type CassandraKeyspaceGetProperties struct { - Resource *CassandraKeyspaceGetPropertiesResource `json:"resource,omitempty"` -} - -// CassandraKeyspaceGetPropertiesResource ... -type CassandraKeyspaceGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetPropertiesResource. -func (ckgp CassandraKeyspaceGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgp.ID != nil { - objectMap["id"] = ckgp.ID - } - return json.Marshal(objectMap) -} - -// CassandraKeyspaceGetResults an Azure Cosmos DB Cassandra keyspace. -type CassandraKeyspaceGetResults struct { - autorest.Response `json:"-"` - // CassandraKeyspaceGetProperties - The properties of an Azure Cosmos DB Cassandra keyspace - *CassandraKeyspaceGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetResults. -func (ckgr CassandraKeyspaceGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgr.CassandraKeyspaceGetProperties != nil { - objectMap["properties"] = ckgr.CassandraKeyspaceGetProperties - } - if ckgr.Location != nil { - objectMap["location"] = ckgr.Location - } - if ckgr.Tags != nil { - objectMap["tags"] = ckgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceGetResults struct. -func (ckgr *CassandraKeyspaceGetResults) 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 cassandraKeyspaceGetProperties CassandraKeyspaceGetProperties - err = json.Unmarshal(*v, &cassandraKeyspaceGetProperties) - if err != nil { - return err - } - ckgr.CassandraKeyspaceGetProperties = &cassandraKeyspaceGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckgr.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceListResult the List operation response, that contains the Cassandra keyspaces and their -// properties. -type CassandraKeyspaceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra keyspaces and their properties. - Value *[]CassandraKeyspaceGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceListResult. -func (cklr CassandraKeyspaceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraKeyspaceResource cosmos DB Cassandra keyspace resource object -type CassandraKeyspaceResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` -} - -// CassandraPartitionKey cosmos DB Cassandra table partition key -type CassandraPartitionKey struct { - // Name - Name of the Cosmos DB Cassandra table partition key - Name *string `json:"name,omitempty"` -} - -// CassandraResourcesCreateUpdateCassandraKeyspaceFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraKeyspaceGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) 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 CassandraResourcesCreateUpdateCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ckgr CassandraKeyspaceGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ckgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ckgr.Response.Response, err = future.GetResult(sender); err == nil && ckgr.Response.Response.StatusCode != http.StatusNoContent { - ckgr, err = client.CreateUpdateCassandraKeyspaceResponder(ckgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", ckgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraTableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) 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 CassandraResourcesCreateUpdateCassandraTableFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) result(client CassandraResourcesClient) (ctgr CassandraTableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ctgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ctgr.Response.Response, err = future.GetResult(sender); err == nil && ctgr.Response.Response.StatusCode != http.StatusNoContent { - ctgr, err = client.CreateUpdateCassandraTableResponder(ctgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", ctgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type CassandraResourcesDeleteCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) 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 CassandraResourcesDeleteCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type CassandraResourcesDeleteCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraTableFuture) 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 CassandraResourcesDeleteCassandraTableFuture.Result. -func (future *CassandraResourcesDeleteCassandraTableFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraTableFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesUpdateCassandraKeyspaceThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) 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 CassandraResourcesUpdateCassandraKeyspaceThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraKeyspaceThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraTableThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesUpdateCassandraTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) 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 CassandraResourcesUpdateCassandraTableThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraSchema cosmos DB Cassandra table schema -type CassandraSchema struct { - // Columns - List of Cassandra table columns. - Columns *[]Column `json:"columns,omitempty"` - // PartitionKeys - List of partition key. - PartitionKeys *[]CassandraPartitionKey `json:"partitionKeys,omitempty"` - // ClusterKeys - List of cluster key. - ClusterKeys *[]ClusterKey `json:"clusterKeys,omitempty"` -} - -// CassandraTableCreateUpdateParameters parameters to create and update Cosmos DB Cassandra table. -type CassandraTableCreateUpdateParameters struct { - // CassandraTableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra table. - *CassandraTableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableCreateUpdateParameters. -func (ctcup CassandraTableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcup.CassandraTableCreateUpdateProperties != nil { - objectMap["properties"] = ctcup.CassandraTableCreateUpdateProperties - } - if ctcup.Location != nil { - objectMap["location"] = ctcup.Location - } - if ctcup.Tags != nil { - objectMap["tags"] = ctcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableCreateUpdateParameters struct. -func (ctcup *CassandraTableCreateUpdateParameters) 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 cassandraTableCreateUpdateProperties CassandraTableCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraTableCreateUpdateProperties) - if err != nil { - return err - } - ctcup.CassandraTableCreateUpdateProperties = &cassandraTableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctcup.Tags = tags - } - } - } - - return nil -} - -// CassandraTableCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra table. -type CassandraTableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra table - Resource *CassandraTableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraTableGetProperties the properties of an Azure Cosmos DB Cassandra table -type CassandraTableGetProperties struct { - Resource *CassandraTableGetPropertiesResource `json:"resource,omitempty"` -} - -// CassandraTableGetPropertiesResource ... -type CassandraTableGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetPropertiesResource. -func (ctgp CassandraTableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgp.ID != nil { - objectMap["id"] = ctgp.ID - } - if ctgp.DefaultTTL != nil { - objectMap["defaultTtl"] = ctgp.DefaultTTL - } - if ctgp.Schema != nil { - objectMap["schema"] = ctgp.Schema - } - return json.Marshal(objectMap) -} - -// CassandraTableGetResults an Azure Cosmos DB Cassandra table. -type CassandraTableGetResults struct { - autorest.Response `json:"-"` - // CassandraTableGetProperties - The properties of an Azure Cosmos DB Cassandra table - *CassandraTableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetResults. -func (ctgr CassandraTableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgr.CassandraTableGetProperties != nil { - objectMap["properties"] = ctgr.CassandraTableGetProperties - } - if ctgr.Location != nil { - objectMap["location"] = ctgr.Location - } - if ctgr.Tags != nil { - objectMap["tags"] = ctgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableGetResults struct. -func (ctgr *CassandraTableGetResults) 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 cassandraTableGetProperties CassandraTableGetProperties - err = json.Unmarshal(*v, &cassandraTableGetProperties) - if err != nil { - return err - } - ctgr.CassandraTableGetProperties = &cassandraTableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctgr.Tags = tags - } - } - } - - return nil -} - -// CassandraTableListResult the List operation response, that contains the Cassandra tables and their -// properties. -type CassandraTableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra tables and their properties. - Value *[]CassandraTableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableListResult. -func (ctlr CassandraTableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraTableResource cosmos DB Cassandra table resource object -type CassandraTableResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` -} - -// ClusterKey cosmos DB Cassandra table cluster key -type ClusterKey struct { - // Name - Name of the Cosmos DB Cassandra table cluster key - Name *string `json:"name,omitempty"` - // OrderBy - Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" - OrderBy *string `json:"orderBy,omitempty"` -} - -// Column cosmos DB Cassandra table column -type Column struct { - // Name - Name of the Cosmos DB Cassandra table column - Name *string `json:"name,omitempty"` - // Type - Type of the Cosmos DB Cassandra table column - Type *string `json:"type,omitempty"` -} - -// CompositePath ... -type CompositePath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Order - Sort order for composite paths. Possible values include: 'Ascending', 'Descending' - Order CompositePathSortOrder `json:"order,omitempty"` -} - -// ConflictResolutionPolicy the conflict resolution policy for the container. -type ConflictResolutionPolicy struct { - // Mode - Indicates the conflict resolution mode. Possible values include: 'LastWriterWins', 'Custom' - Mode ConflictResolutionMode `json:"mode,omitempty"` - // ConflictResolutionPath - The conflict resolution path in the case of LastWriterWins mode. - ConflictResolutionPath *string `json:"conflictResolutionPath,omitempty"` - // ConflictResolutionProcedure - The procedure to resolve conflicts in the case of custom mode. - ConflictResolutionProcedure *string `json:"conflictResolutionProcedure,omitempty"` -} - -// ConsistencyPolicy the consistency policy for the Cosmos DB database account. -type ConsistencyPolicy struct { - // DefaultConsistencyLevel - The default consistency level and configuration settings of the Cosmos DB account. Possible values include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix' - DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` - // MaxStalenessPrefix - When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` - // MaxIntervalInSeconds - When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` -} - -// ContainerPartitionKey the configuration of the partition key to be used for partitioning data into -// multiple partitions -type ContainerPartitionKey struct { - // Paths - List of paths using which data within the container can be partitioned - Paths *[]string `json:"paths,omitempty"` - // Kind - Indicates the kind of algorithm used for partitioning. Possible values include: 'PartitionKindHash', 'PartitionKindRange' - Kind PartitionKind `json:"kind,omitempty"` - // Version - Indicates the version of the partition key definition - Version *int32 `json:"version,omitempty"` -} - -// CreateUpdateOptions createUpdateOptions are a list of key-value pairs that describe the resource. -// Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" -type CreateUpdateOptions struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]*string `json:""` - // Throughput - Request Units per second. For example, "throughput": "10000". - Throughput *string `json:"throughput,omitempty"` -} - -// MarshalJSON is the custom marshaler for CreateUpdateOptions. -func (cuo CreateUpdateOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cuo.Throughput != nil { - objectMap["throughput"] = cuo.Throughput - } - for k, v := range cuo.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CreateUpdateOptions struct. -func (cuo *CreateUpdateOptions) 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 { - default: - if v != nil { - var additionalProperties string - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if cuo.AdditionalProperties == nil { - cuo.AdditionalProperties = make(map[string]*string) - } - cuo.AdditionalProperties[k] = &additionalProperties - } - case "throughput": - if v != nil { - var throughput string - err = json.Unmarshal(*v, &throughput) - if err != nil { - return err - } - cuo.Throughput = &throughput - } - } - } - - return nil -} - -// DatabaseAccountConnectionString connection string for the Cosmos DB account -type DatabaseAccountConnectionString struct { - // ConnectionString - READ-ONLY; Value of the connection string - ConnectionString *string `json:"connectionString,omitempty"` - // Description - READ-ONLY; Description of the connection string - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountConnectionString. -func (dacs DatabaseAccountConnectionString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountCreateUpdateParameters parameters to create and update Cosmos DB database accounts. -type DatabaseAccountCreateUpdateParameters struct { - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountCreateUpdateParameters. -func (dacup DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dacup.Kind != "" { - objectMap["kind"] = dacup.Kind - } - if dacup.DatabaseAccountCreateUpdateProperties != nil { - objectMap["properties"] = dacup.DatabaseAccountCreateUpdateProperties - } - if dacup.Location != nil { - objectMap["location"] = dacup.Location - } - if dacup.Tags != nil { - objectMap["tags"] = dacup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateParameters struct. -func (dacup *DatabaseAccountCreateUpdateParameters) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dacup.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountCreateUpdateProperties DatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &databaseAccountCreateUpdateProperties) - if err != nil { - return err - } - dacup.DatabaseAccountCreateUpdateProperties = &databaseAccountCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dacup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dacup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dacup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dacup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dacup.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountCreateUpdateProperties properties to create and update Azure Cosmos DB database accounts. -type DatabaseAccountCreateUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRangeFilter - Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` -} - -// DatabaseAccountGetProperties properties for the database account. -type DatabaseAccountGetProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the Cosmos DB database account. - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - // DatabaseAccountOfferType - READ-ONLY; The offer type for the Cosmos DB database account. Default value: Standard. Possible values include: 'Standard' - DatabaseAccountOfferType DatabaseAccountOfferType `json:"databaseAccountOfferType,omitempty"` - // IPRangeFilter - Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // ConsistencyPolicy - The consistency policy for the Cosmos DB database account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // WriteLocations - READ-ONLY; An array that contains the write location for the Cosmos DB account. - WriteLocations *[]Location `json:"writeLocations,omitempty"` - // ReadLocations - READ-ONLY; An array that contains of the read locations enabled for the Cosmos DB account. - ReadLocations *[]Location `json:"readLocations,omitempty"` - // Locations - READ-ONLY; An array that contains all of the locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // FailoverPolicies - READ-ONLY; An array that contains the regions ordered by their failover priorities. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetProperties. -func (dagp DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagp.ProvisioningState != nil { - objectMap["provisioningState"] = dagp.ProvisioningState - } - if dagp.IPRangeFilter != nil { - objectMap["ipRangeFilter"] = dagp.IPRangeFilter - } - if dagp.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = dagp.IsVirtualNetworkFilterEnabled - } - if dagp.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = dagp.EnableAutomaticFailover - } - if dagp.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = dagp.ConsistencyPolicy - } - if dagp.Capabilities != nil { - objectMap["capabilities"] = dagp.Capabilities - } - if dagp.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = dagp.VirtualNetworkRules - } - if dagp.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = dagp.EnableMultipleWriteLocations - } - if dagp.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = dagp.EnableCassandraConnector - } - if dagp.ConnectorOffer != "" { - objectMap["connectorOffer"] = dagp.ConnectorOffer - } - if dagp.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = dagp.DisableKeyBasedMetadataWriteAccess - } - if dagp.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = dagp.KeyVaultKeyURI - } - return json.Marshal(objectMap) -} - -// DatabaseAccountGetResults an Azure Cosmos DB database account. -type DatabaseAccountGetResults struct { - autorest.Response `json:"-"` - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetResults. -func (dagr DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagr.Kind != "" { - objectMap["kind"] = dagr.Kind - } - if dagr.DatabaseAccountGetProperties != nil { - objectMap["properties"] = dagr.DatabaseAccountGetProperties - } - if dagr.Location != nil { - objectMap["location"] = dagr.Location - } - if dagr.Tags != nil { - objectMap["tags"] = dagr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetResults struct. -func (dagr *DatabaseAccountGetResults) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dagr.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountGetProperties DatabaseAccountGetProperties - err = json.Unmarshal(*v, &databaseAccountGetProperties) - if err != nil { - return err - } - dagr.DatabaseAccountGetProperties = &databaseAccountGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dagr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dagr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dagr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dagr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dagr.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountListConnectionStringsResult the connection strings for the given database account. -type DatabaseAccountListConnectionStringsResult struct { - autorest.Response `json:"-"` - // ConnectionStrings - An array that contains the connection strings for the Cosmos DB account. - ConnectionStrings *[]DatabaseAccountConnectionString `json:"connectionStrings,omitempty"` -} - -// DatabaseAccountListKeysResult the access keys for the given database account. -type DatabaseAccountListKeysResult struct { - autorest.Response `json:"-"` - // PrimaryMasterKey - READ-ONLY; Base 64 encoded value of the primary read-write key. - PrimaryMasterKey *string `json:"primaryMasterKey,omitempty"` - // SecondaryMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-write key. - SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListKeysResult. -func (dalkr DatabaseAccountListKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountListReadOnlyKeysResult the read-only access keys for the given database account. -type DatabaseAccountListReadOnlyKeysResult struct { - autorest.Response `json:"-"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListReadOnlyKeysResult. -func (dalrokr DatabaseAccountListReadOnlyKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountRegenerateKeyParameters parameters to regenerate the keys within the database account. -type DatabaseAccountRegenerateKeyParameters struct { - // KeyKind - The access key to regenerate. Possible values include: 'Primary', 'Secondary', 'PrimaryReadonly', 'SecondaryReadonly' - KeyKind KeyKind `json:"keyKind,omitempty"` -} - -// DatabaseAccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsCreateOrUpdateFuture) 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 DatabaseAccountsCreateOrUpdateFuture.Result. -func (future *DatabaseAccountsCreateOrUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.CreateOrUpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsDeleteFuture) 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 DatabaseAccountsDeleteFuture.Result. -func (future *DatabaseAccountsDeleteFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsFailoverPriorityChangeFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type DatabaseAccountsFailoverPriorityChangeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) 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 DatabaseAccountsFailoverPriorityChangeFuture.Result. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsFailoverPriorityChangeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsFailoverPriorityChangeFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsListResult the List operation response, that contains the database accounts and their -// properties. -type DatabaseAccountsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of database account and their properties. - Value *[]DatabaseAccountGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountsListResult. -func (dalr DatabaseAccountsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountsOfflineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOfflineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOfflineRegionFuture) 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 DatabaseAccountsOfflineRegionFuture.Result. -func (future *DatabaseAccountsOfflineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOfflineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsOnlineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOnlineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOnlineRegionFuture) 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 DatabaseAccountsOnlineRegionFuture.Result. -func (future *DatabaseAccountsOnlineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOnlineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsRegenerateKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsRegenerateKeyFuture) 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 DatabaseAccountsRegenerateKeyFuture.Result. -func (future *DatabaseAccountsRegenerateKeyFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsRegenerateKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsRegenerateKeyFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsUpdateFuture) 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 DatabaseAccountsUpdateFuture.Result. -func (future *DatabaseAccountsUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.UpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountUpdateParameters parameters for patching Azure Cosmos DB database account properties. -type DatabaseAccountUpdateParameters struct { - Tags map[string]*string `json:"tags"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - *DatabaseAccountUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountUpdateParameters. -func (daup DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if daup.Tags != nil { - objectMap["tags"] = daup.Tags - } - if daup.Location != nil { - objectMap["location"] = daup.Location - } - if daup.DatabaseAccountUpdateProperties != nil { - objectMap["properties"] = daup.DatabaseAccountUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateParameters struct. -func (daup *DatabaseAccountUpdateParameters) 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 - } - daup.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - daup.Location = &location - } - case "properties": - if v != nil { - var databaseAccountUpdateProperties DatabaseAccountUpdateProperties - err = json.Unmarshal(*v, &databaseAccountUpdateProperties) - if err != nil { - return err - } - daup.DatabaseAccountUpdateProperties = &databaseAccountUpdateProperties - } - } - } - - return nil -} - -// DatabaseAccountUpdateProperties properties to update Azure Cosmos DB database accounts. -type DatabaseAccountUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // IPRangeFilter - Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` -} - -// ErrorResponse 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"` -} - -// ExcludedPath ... -type ExcludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` -} - -// ExtendedResourceProperties the system generated resource properties associated with SQL databases, SQL -// containers, Gremlin databases and Gremlin graphs. -type ExtendedResourceProperties struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedResourceProperties. -func (erp ExtendedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverPolicies the list of new failover policies for the failover priority change. -type FailoverPolicies struct { - // FailoverPolicies - List of failover policies. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` -} - -// FailoverPolicy the failover policy for a given region of a database account. -type FailoverPolicy struct { - // ID - READ-ONLY; The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region in which the database account exists. - LocationName *string `json:"locationName,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverPolicy. -func (fp FailoverPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.LocationName != nil { - objectMap["locationName"] = fp.LocationName - } - if fp.FailoverPriority != nil { - objectMap["failoverPriority"] = fp.FailoverPriority - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseCreateUpdateParameters parameters to create and update Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateParameters struct { - // GremlinDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin database. - *GremlinDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseCreateUpdateParameters. -func (gdcup GremlinDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdcup.GremlinDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = gdcup.GremlinDatabaseCreateUpdateProperties - } - if gdcup.Location != nil { - objectMap["location"] = gdcup.Location - } - if gdcup.Tags != nil { - objectMap["tags"] = gdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseCreateUpdateParameters struct. -func (gdcup *GremlinDatabaseCreateUpdateParameters) 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 gremlinDatabaseCreateUpdateProperties GremlinDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinDatabaseCreateUpdateProperties) - if err != nil { - return err - } - gdcup.GremlinDatabaseCreateUpdateProperties = &gremlinDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdcup.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin database - Resource *GremlinDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type GremlinDatabaseGetProperties struct { - Resource *GremlinDatabaseGetPropertiesResource `json:"resource,omitempty"` -} - -// GremlinDatabaseGetPropertiesResource ... -type GremlinDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetPropertiesResource. -func (gdgp GremlinDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgp.ID != nil { - objectMap["id"] = gdgp.ID - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseGetResults an Azure Cosmos DB Gremlin database. -type GremlinDatabaseGetResults struct { - autorest.Response `json:"-"` - // GremlinDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *GremlinDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetResults. -func (gdgr GremlinDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgr.GremlinDatabaseGetProperties != nil { - objectMap["properties"] = gdgr.GremlinDatabaseGetProperties - } - if gdgr.Location != nil { - objectMap["location"] = gdgr.Location - } - if gdgr.Tags != nil { - objectMap["tags"] = gdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseGetResults struct. -func (gdgr *GremlinDatabaseGetResults) 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 gremlinDatabaseGetProperties GremlinDatabaseGetProperties - err = json.Unmarshal(*v, &gremlinDatabaseGetProperties) - if err != nil { - return err - } - gdgr.GremlinDatabaseGetProperties = &gremlinDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdgr.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseListResult the List operation response, that contains the Gremlin databases and their -// properties. -type GremlinDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Gremlin databases and their properties. - Value *[]GremlinDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseListResult. -func (gdlr GremlinDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinDatabaseResource cosmos DB Gremlin database resource object -type GremlinDatabaseResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` -} - -// GremlinGraphCreateUpdateParameters parameters to create and update Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateParameters struct { - // GremlinGraphCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin graph. - *GremlinGraphCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphCreateUpdateParameters. -func (ggcup GremlinGraphCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ggcup.GremlinGraphCreateUpdateProperties != nil { - objectMap["properties"] = ggcup.GremlinGraphCreateUpdateProperties - } - if ggcup.Location != nil { - objectMap["location"] = ggcup.Location - } - if ggcup.Tags != nil { - objectMap["tags"] = ggcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphCreateUpdateParameters struct. -func (ggcup *GremlinGraphCreateUpdateParameters) 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 gremlinGraphCreateUpdateProperties GremlinGraphCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinGraphCreateUpdateProperties) - if err != nil { - return err - } - ggcup.GremlinGraphCreateUpdateProperties = &gremlinGraphCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ggcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ggcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ggcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ggcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ggcup.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin graph - Resource *GremlinGraphResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinGraphGetProperties the properties of an Azure Cosmos DB Gremlin graph -type GremlinGraphGetProperties struct { - Resource *GremlinGraphGetPropertiesResource `json:"resource,omitempty"` -} - -// GremlinGraphGetPropertiesResource ... -type GremlinGraphGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetPropertiesResource. -func (gggp GremlinGraphGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggp.ID != nil { - objectMap["id"] = gggp.ID - } - if gggp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = gggp.IndexingPolicy - } - if gggp.PartitionKey != nil { - objectMap["partitionKey"] = gggp.PartitionKey - } - if gggp.DefaultTTL != nil { - objectMap["defaultTtl"] = gggp.DefaultTTL - } - if gggp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = gggp.UniqueKeyPolicy - } - if gggp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = gggp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// GremlinGraphGetResults an Azure Cosmos DB Gremlin graph. -type GremlinGraphGetResults struct { - autorest.Response `json:"-"` - // GremlinGraphGetProperties - The properties of an Azure Cosmos DB Gremlin graph - *GremlinGraphGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetResults. -func (gggr GremlinGraphGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggr.GremlinGraphGetProperties != nil { - objectMap["properties"] = gggr.GremlinGraphGetProperties - } - if gggr.Location != nil { - objectMap["location"] = gggr.Location - } - if gggr.Tags != nil { - objectMap["tags"] = gggr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphGetResults struct. -func (gggr *GremlinGraphGetResults) 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 gremlinGraphGetProperties GremlinGraphGetProperties - err = json.Unmarshal(*v, &gremlinGraphGetProperties) - if err != nil { - return err - } - gggr.GremlinGraphGetProperties = &gremlinGraphGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gggr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gggr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gggr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gggr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gggr.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphListResult the List operation response, that contains the graphs and their properties. -type GremlinGraphListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of graphs and their properties. - Value *[]GremlinGraphGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphListResult. -func (gglr GremlinGraphListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinGraphResource cosmos DB Gremlin graph resource object -type GremlinGraphResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// GremlinResourcesCreateUpdateGremlinDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesCreateUpdateGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) 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 GremlinResourcesCreateUpdateGremlinDatabaseFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) result(client GremlinResourcesClient) (gdgr GremlinDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gdgr.Response.Response, err = future.GetResult(sender); err == nil && gdgr.Response.Response.StatusCode != http.StatusNoContent { - gdgr, err = client.CreateUpdateGremlinDatabaseResponder(gdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", gdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesCreateUpdateGremlinGraphFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type GremlinResourcesCreateUpdateGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinGraphGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) 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 GremlinResourcesCreateUpdateGremlinGraphFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) result(client GremlinResourcesClient) (gggr GremlinGraphGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gggr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gggr.Response.Response, err = future.GetResult(sender); err == nil && gggr.Response.Response.StatusCode != http.StatusNoContent { - gggr, err = client.CreateUpdateGremlinGraphResponder(gggr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", gggr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesDeleteGremlinDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type GremlinResourcesDeleteGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) 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 GremlinResourcesDeleteGremlinDatabaseFuture.Result. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesDeleteGremlinGraphFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GremlinResourcesDeleteGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinGraphFuture) 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 GremlinResourcesDeleteGremlinGraphFuture.Result. -func (future *GremlinResourcesDeleteGremlinGraphFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinGraphFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesUpdateGremlinDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) 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 GremlinResourcesUpdateGremlinDatabaseThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinGraphThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinGraphThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) 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 GremlinResourcesUpdateGremlinGraphThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinGraphThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// IncludedPath the paths that are included in indexing -type IncludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Indexes - List of indexes for this path - Indexes *[]Indexes `json:"indexes,omitempty"` -} - -// Indexes the indexes for the path. -type Indexes struct { - // DataType - The datatype for which the indexing behavior is applied to. Possible values include: 'String', 'Number', 'Point', 'Polygon', 'LineString', 'MultiPolygon' - DataType DataType `json:"dataType,omitempty"` - // Precision - The precision of the index. -1 is maximum precision. - Precision *int32 `json:"precision,omitempty"` - // Kind - Indicates the type of index. Possible values include: 'Hash', 'Range', 'Spatial' - Kind IndexKind `json:"kind,omitempty"` -} - -// IndexingPolicy cosmos DB indexing policy -type IndexingPolicy struct { - // Automatic - Indicates if the indexing policy is automatic - Automatic *bool `json:"automatic,omitempty"` - // IndexingMode - Indicates the indexing mode. Possible values include: 'Consistent', 'Lazy', 'None' - IndexingMode IndexingMode `json:"indexingMode,omitempty"` - // IncludedPaths - List of paths to include in the indexing - IncludedPaths *[]IncludedPath `json:"includedPaths,omitempty"` - // ExcludedPaths - List of paths to exclude from indexing - ExcludedPaths *[]ExcludedPath `json:"excludedPaths,omitempty"` - // CompositeIndexes - List of composite path list - CompositeIndexes *[][]CompositePath `json:"compositeIndexes,omitempty"` - // SpatialIndexes - List of spatial specifics - SpatialIndexes *[]SpatialSpec `json:"spatialIndexes,omitempty"` -} - -// Location a region in which the Azure Cosmos DB database account is deployed. -type Location struct { - // ID - READ-ONLY; The unique identifier of the region within the database account. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region. - LocationName *string `json:"locationName,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` - // IsZoneRedundant - Flag to indicate whether or not this region is an AvailabilityZone region - IsZoneRedundant *bool `json:"isZoneRedundant,omitempty"` -} - -// MarshalJSON is the custom marshaler for Location. -func (l Location) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if l.LocationName != nil { - objectMap["locationName"] = l.LocationName - } - if l.ProvisioningState != nil { - objectMap["provisioningState"] = l.ProvisioningState - } - if l.FailoverPriority != nil { - objectMap["failoverPriority"] = l.FailoverPriority - } - if l.IsZoneRedundant != nil { - objectMap["isZoneRedundant"] = l.IsZoneRedundant - } - return json.Marshal(objectMap) -} - -// Metric metric data -type Metric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for Metric. -func (mVar Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.Unit != "" { - objectMap["unit"] = mVar.Unit - } - return json.Marshal(objectMap) -} - -// MetricAvailability the availability of the metric. -type MetricAvailability struct { - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - READ-ONLY; The retention for the metric values. - Retention *string `json:"retention,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAvailability. -func (ma MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinition the definition of a metric. -type MetricDefinition struct { - // MetricAvailabilities - READ-ONLY; The list of metric availabilities for the account. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type of the metric. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeTotal', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeLast' - PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // ResourceURI - READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinition. -func (md MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if md.Unit != "" { - objectMap["unit"] = md.Unit - } - return json.Marshal(objectMap) -} - -// MetricDefinitionsListResult the response to a list metric definitions request. -type MetricDefinitionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metric definitions for the account. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinitionsListResult. -func (mdlr MetricDefinitionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricListResult the response to a list metrics request. -type MetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metrics for the account. - Value *[]Metric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricListResult. -func (mlr MetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricName a metric name. -type MetricName struct { - // Value - READ-ONLY; The name of the metric. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The friendly name of the metric. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricName. -func (mn MetricName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricValue represents metrics values. -type MetricValue struct { - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricValue. -func (mv MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionCreateUpdateParameters parameters to create and update Cosmos DB MongoDB collection. -type MongoDBCollectionCreateUpdateParameters struct { - // MongoDBCollectionCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB collection. - *MongoDBCollectionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionCreateUpdateParameters. -func (mdccup MongoDBCollectionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdccup.MongoDBCollectionCreateUpdateProperties != nil { - objectMap["properties"] = mdccup.MongoDBCollectionCreateUpdateProperties - } - if mdccup.Location != nil { - objectMap["location"] = mdccup.Location - } - if mdccup.Tags != nil { - objectMap["tags"] = mdccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionCreateUpdateParameters struct. -func (mdccup *MongoDBCollectionCreateUpdateParameters) 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 mongoDBCollectionCreateUpdateProperties MongoDBCollectionCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBCollectionCreateUpdateProperties) - if err != nil { - return err - } - mdccup.MongoDBCollectionCreateUpdateProperties = &mongoDBCollectionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdccup.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB -// collection. -type MongoDBCollectionCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB collection - Resource *MongoDBCollectionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetProperties the properties of an Azure Cosmos DB MongoDB collection -type MongoDBCollectionGetProperties struct { - Resource *MongoDBCollectionGetPropertiesResource `json:"resource,omitempty"` -} - -// MongoDBCollectionGetPropertiesResource ... -type MongoDBCollectionGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetPropertiesResource. -func (mdcgp MongoDBCollectionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgp.ID != nil { - objectMap["id"] = mdcgp.ID - } - if mdcgp.ShardKey != nil { - objectMap["shardKey"] = mdcgp.ShardKey - } - if mdcgp.Indexes != nil { - objectMap["indexes"] = mdcgp.Indexes - } - return json.Marshal(objectMap) -} - -// MongoDBCollectionGetResults an Azure Cosmos DB MongoDB collection. -type MongoDBCollectionGetResults struct { - autorest.Response `json:"-"` - // MongoDBCollectionGetProperties - The properties of an Azure Cosmos DB MongoDB collection - *MongoDBCollectionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetResults. -func (mdcgr MongoDBCollectionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgr.MongoDBCollectionGetProperties != nil { - objectMap["properties"] = mdcgr.MongoDBCollectionGetProperties - } - if mdcgr.Location != nil { - objectMap["location"] = mdcgr.Location - } - if mdcgr.Tags != nil { - objectMap["tags"] = mdcgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionGetResults struct. -func (mdcgr *MongoDBCollectionGetResults) 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 mongoDBCollectionGetProperties MongoDBCollectionGetProperties - err = json.Unmarshal(*v, &mongoDBCollectionGetProperties) - if err != nil { - return err - } - mdcgr.MongoDBCollectionGetProperties = &mongoDBCollectionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdcgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdcgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdcgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdcgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdcgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionListResult the List operation response, that contains the MongoDB collections and their -// properties. -type MongoDBCollectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB collections and their properties. - Value *[]MongoDBCollectionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionListResult. -func (mdclr MongoDBCollectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionResource cosmos DB MongoDB collection resource object -type MongoDBCollectionResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionResource. -func (mdcr MongoDBCollectionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcr.ID != nil { - objectMap["id"] = mdcr.ID - } - if mdcr.ShardKey != nil { - objectMap["shardKey"] = mdcr.ShardKey - } - if mdcr.Indexes != nil { - objectMap["indexes"] = mdcr.Indexes - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseCreateUpdateParameters parameters to create and update Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateParameters struct { - // MongoDBDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB database. - *MongoDBDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseCreateUpdateParameters. -func (mddcup MongoDBDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddcup.MongoDBDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = mddcup.MongoDBDatabaseCreateUpdateProperties - } - if mddcup.Location != nil { - objectMap["location"] = mddcup.Location - } - if mddcup.Tags != nil { - objectMap["tags"] = mddcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseCreateUpdateParameters struct. -func (mddcup *MongoDBDatabaseCreateUpdateParameters) 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 mongoDBDatabaseCreateUpdateProperties MongoDBDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBDatabaseCreateUpdateProperties) - if err != nil { - return err - } - mddcup.MongoDBDatabaseCreateUpdateProperties = &mongoDBDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddcup.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB database - Resource *MongoDBDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetProperties the properties of an Azure Cosmos DB MongoDB database -type MongoDBDatabaseGetProperties struct { - Resource *MongoDBDatabaseGetPropertiesResource `json:"resource,omitempty"` -} - -// MongoDBDatabaseGetPropertiesResource ... -type MongoDBDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetPropertiesResource. -func (mddgp MongoDBDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgp.ID != nil { - objectMap["id"] = mddgp.ID - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseGetResults an Azure Cosmos DB MongoDB database. -type MongoDBDatabaseGetResults struct { - autorest.Response `json:"-"` - // MongoDBDatabaseGetProperties - The properties of an Azure Cosmos DB MongoDB database - *MongoDBDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetResults. -func (mddgr MongoDBDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgr.MongoDBDatabaseGetProperties != nil { - objectMap["properties"] = mddgr.MongoDBDatabaseGetProperties - } - if mddgr.Location != nil { - objectMap["location"] = mddgr.Location - } - if mddgr.Tags != nil { - objectMap["tags"] = mddgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseGetResults struct. -func (mddgr *MongoDBDatabaseGetResults) 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 mongoDBDatabaseGetProperties MongoDBDatabaseGetProperties - err = json.Unmarshal(*v, &mongoDBDatabaseGetProperties) - if err != nil { - return err - } - mddgr.MongoDBDatabaseGetProperties = &mongoDBDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseListResult the List operation response, that contains the MongoDB databases and their -// properties. -type MongoDBDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB databases and their properties. - Value *[]MongoDBDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseListResult. -func (mddlr MongoDBDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBDatabaseResource cosmos DB MongoDB database resource object -type MongoDBDatabaseResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` -} - -// MongoDBResourcesCreateUpdateMongoDBCollectionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBCollectionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) 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 MongoDBResourcesCreateUpdateMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) result(client MongoDBResourcesClient) (mdcgr MongoDBCollectionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mdcgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mdcgr.Response.Response, err = future.GetResult(sender); err == nil && mdcgr.Response.Response.StatusCode != http.StatusNoContent { - mdcgr, err = client.CreateUpdateMongoDBCollectionResponder(mdcgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", mdcgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesCreateUpdateMongoDBDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) 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 MongoDBResourcesCreateUpdateMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (mddgr MongoDBDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mddgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mddgr.Response.Response, err = future.GetResult(sender); err == nil && mddgr.Response.Response.StatusCode != http.StatusNoContent { - mddgr, err = client.CreateUpdateMongoDBDatabaseResponder(mddgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", mddgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesDeleteMongoDBCollectionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type MongoDBResourcesDeleteMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) 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 MongoDBResourcesDeleteMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesDeleteMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type MongoDBResourcesDeleteMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) 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 MongoDBResourcesDeleteMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesUpdateMongoDBCollectionThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBCollectionThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) 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 MongoDBResourcesUpdateMongoDBCollectionThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBCollectionThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) 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 MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoIndex cosmos DB MongoDB collection index key -type MongoIndex struct { - // Key - Cosmos DB MongoDB collection index keys - Key *MongoIndexKeys `json:"key,omitempty"` - // Options - Cosmos DB MongoDB collection index key options - Options *MongoIndexOptions `json:"options,omitempty"` -} - -// MongoIndexKeys cosmos DB MongoDB collection resource object -type MongoIndexKeys struct { - // Keys - List of keys for each MongoDB collection in the Azure Cosmos DB service - Keys *[]string `json:"keys,omitempty"` -} - -// MongoIndexOptions cosmos DB MongoDB collection index options -type MongoIndexOptions struct { - // ExpireAfterSeconds - Expire after seconds - ExpireAfterSeconds *int32 `json:"expireAfterSeconds,omitempty"` - // Unique - Is unique or not - Unique *bool `json:"unique,omitempty"` -} - -// NotebookWorkspace a notebook workspace resource -type NotebookWorkspace struct { - autorest.Response `json:"-"` - // NotebookWorkspaceProperties - Resource properties. - *NotebookWorkspaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspace. -func (nw NotebookWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nw.NotebookWorkspaceProperties != nil { - objectMap["properties"] = nw.NotebookWorkspaceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotebookWorkspace struct. -func (nw *NotebookWorkspace) 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 notebookWorkspaceProperties NotebookWorkspaceProperties - err = json.Unmarshal(*v, ¬ebookWorkspaceProperties) - if err != nil { - return err - } - nw.NotebookWorkspaceProperties = ¬ebookWorkspaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nw.Type = &typeVar - } - } - } - - return nil -} - -// NotebookWorkspaceConnectionInfoResult the connection info for the given notebook workspace -type NotebookWorkspaceConnectionInfoResult struct { - autorest.Response `json:"-"` - // AuthToken - READ-ONLY; Specifies auth token used for connecting to Notebook server (uses token-based auth). - AuthToken *string `json:"authToken,omitempty"` - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceConnectionInfoResult. -func (nwcir NotebookWorkspaceConnectionInfoResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceCreateUpdateParameters parameters to create a notebook workspace resource -type NotebookWorkspaceCreateUpdateParameters struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceCreateUpdateParameters. -func (nwcup NotebookWorkspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceListResult a list of notebook workspace resources -type NotebookWorkspaceListResult struct { - autorest.Response `json:"-"` - // Value - Array of notebook workspace resources - Value *[]NotebookWorkspace `json:"value,omitempty"` -} - -// NotebookWorkspaceProperties properties of a notebook workspace resource. -type NotebookWorkspaceProperties struct { - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` - // Status - READ-ONLY; Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceProperties. -func (nwp NotebookWorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (NotebookWorkspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesCreateOrUpdateFuture) 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 NotebookWorkspacesCreateOrUpdateFuture.Result. -func (future *NotebookWorkspacesCreateOrUpdateFuture) result(client NotebookWorkspacesClient) (nw NotebookWorkspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nw.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nw.Response.Response, err = future.GetResult(sender); err == nil && nw.Response.Response.StatusCode != http.StatusNoContent { - nw, err = client.CreateOrUpdateResponder(nw.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", nw.Response.Response, "Failure responding to request") - } - } - return -} - -// NotebookWorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesDeleteFuture) 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 NotebookWorkspacesDeleteFuture.Result. -func (future *NotebookWorkspacesDeleteFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesRegenerateAuthTokenFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type NotebookWorkspacesRegenerateAuthTokenFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) 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 NotebookWorkspacesRegenerateAuthTokenFuture.Result. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesRegenerateAuthTokenFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesRegenerateAuthTokenFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NotebookWorkspacesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesStartFuture) 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 NotebookWorkspacesStartFuture.Result. -func (future *NotebookWorkspacesStartFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// Operation 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.ResourceProvider - 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"` - // Description - Description of operation - Description *string `json:"Description,omitempty"` -} - -// OperationListResult 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 OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the 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, - } -} - -// PartitionMetric the metric values for a single partition. -type PartitionMetric struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the metric values. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the metric values. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetric. -func (pm PartitionMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PartitionMetricListResult the response to a list partition metrics request. -type PartitionMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level metrics for the account. - Value *[]PartitionMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetricListResult. -func (pmlr PartitionMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PartitionUsage the partition level usage data for a usage request. -type PartitionUsage struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the usages. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the usages. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsage. -func (pu PartitionUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pu.Unit != "" { - objectMap["unit"] = pu.Unit - } - return json.Marshal(objectMap) -} - -// PartitionUsagesResult the response to a list partition level usage request. -type PartitionUsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level usages for the database. A usage is a point in time metric - Value *[]PartitionUsage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsagesResult. -func (pur PartitionUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetric percentile Metric data -type PercentileMetric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The percentile metric values for the specified time window and timestep. - MetricValues *[]PercentileMetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetric. -func (pm PercentileMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PercentileMetricListResult the response to a list percentile metrics request. -type PercentileMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of percentile metrics for the account. - Value *[]PercentileMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricListResult. -func (pmlr PercentileMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetricValue represents percentile metrics values. -type PercentileMetricValue struct { - // P10 - READ-ONLY; The 10th percentile value for the metric. - P10 *float64 `json:"P10,omitempty"` - // P25 - READ-ONLY; The 25th percentile value for the metric. - P25 *float64 `json:"P25,omitempty"` - // P50 - READ-ONLY; The 50th percentile value for the metric. - P50 *float64 `json:"P50,omitempty"` - // P75 - READ-ONLY; The 75th percentile value for the metric. - P75 *float64 `json:"P75,omitempty"` - // P90 - READ-ONLY; The 90th percentile value for the metric. - P90 *float64 `json:"P90,omitempty"` - // P95 - READ-ONLY; The 95th percentile value for the metric. - P95 *float64 `json:"P95,omitempty"` - // P99 - READ-ONLY; The 99th percentile value for the metric. - P99 *float64 `json:"P99,omitempty"` - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricValue. -func (pmv PercentileMetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // GroupID - Group id of the private endpoint. - GroupID *string `json:"groupId,omitempty"` - // ProvisioningState - Provisioning state of the private endpoint. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource required zone names. - 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) -} - -// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProvisionedThroughputSettingsResource cosmos DB provisioned throughput settings object -type ProvisionedThroughputSettingsResource struct { - // MaxThroughput - Represents maximum throughput container can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` - // AutoUpgradePolicy - Cosmos DB resource auto-upgrade policy - AutoUpgradePolicy *AutoUpgradePolicyResource `json:"autoUpgradePolicy,omitempty"` - // TargetMaxThroughput - READ-ONLY; Represents target maximum throughput container can scale up to once offer is no longer in pending state. - TargetMaxThroughput *int32 `json:"targetMaxThroughput,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProvisionedThroughputSettingsResource. -func (ptsr ProvisionedThroughputSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptsr.MaxThroughput != nil { - objectMap["maxThroughput"] = ptsr.MaxThroughput - } - if ptsr.AutoUpgradePolicy != nil { - objectMap["autoUpgradePolicy"] = ptsr.AutoUpgradePolicy - } - return json.Marshal(objectMap) -} - -// 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) -} - -// RegionForOnlineOffline cosmos DB region to online or offline. -type RegionForOnlineOffline struct { - // Region - Cosmos DB region, with spaces between words and each word capitalized. - Region *string `json:"region,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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SpatialSpec ... -type SpatialSpec struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Types - List of path's spatial type - Types *[]SpatialType `json:"types,omitempty"` -} - -// SQLContainerCreateUpdateParameters parameters to create and update Cosmos DB container. -type SQLContainerCreateUpdateParameters struct { - // SQLContainerCreateUpdateProperties - Properties to create and update Azure Cosmos DB container. - *SQLContainerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerCreateUpdateParameters. -func (sccup SQLContainerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccup.SQLContainerCreateUpdateProperties != nil { - objectMap["properties"] = sccup.SQLContainerCreateUpdateProperties - } - if sccup.Location != nil { - objectMap["location"] = sccup.Location - } - if sccup.Tags != nil { - objectMap["tags"] = sccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerCreateUpdateParameters struct. -func (sccup *SQLContainerCreateUpdateParameters) 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 SQLContainerCreateUpdateProperties SQLContainerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLContainerCreateUpdateProperties) - if err != nil { - return err - } - sccup.SQLContainerCreateUpdateProperties = &SQLContainerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sccup.Tags = tags - } - } - } - - return nil -} - -// SQLContainerCreateUpdateProperties properties to create and update Azure Cosmos DB container. -type SQLContainerCreateUpdateProperties struct { - // Resource - The standard JSON format of a container - Resource *SQLContainerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLContainerGetProperties the properties of an Azure Cosmos DB container -type SQLContainerGetProperties struct { - Resource *SQLContainerGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLContainerGetPropertiesResource ... -type SQLContainerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetPropertiesResource. -func (scgp SQLContainerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgp.ID != nil { - objectMap["id"] = scgp.ID - } - if scgp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = scgp.IndexingPolicy - } - if scgp.PartitionKey != nil { - objectMap["partitionKey"] = scgp.PartitionKey - } - if scgp.DefaultTTL != nil { - objectMap["defaultTtl"] = scgp.DefaultTTL - } - if scgp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = scgp.UniqueKeyPolicy - } - if scgp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = scgp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// SQLContainerGetResults an Azure Cosmos DB container. -type SQLContainerGetResults struct { - autorest.Response `json:"-"` - // SQLContainerGetProperties - The properties of an Azure Cosmos DB container - *SQLContainerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetResults. -func (scgr SQLContainerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgr.SQLContainerGetProperties != nil { - objectMap["properties"] = scgr.SQLContainerGetProperties - } - if scgr.Location != nil { - objectMap["location"] = scgr.Location - } - if scgr.Tags != nil { - objectMap["tags"] = scgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerGetResults struct. -func (scgr *SQLContainerGetResults) 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 SQLContainerGetProperties SQLContainerGetProperties - err = json.Unmarshal(*v, &SQLContainerGetProperties) - if err != nil { - return err - } - scgr.SQLContainerGetProperties = &SQLContainerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - scgr.Tags = tags - } - } - } - - return nil -} - -// SQLContainerListResult the List operation response, that contains the containers and their properties. -type SQLContainerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of containers and their properties. - Value *[]SQLContainerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerListResult. -func (sclr SQLContainerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLContainerResource cosmos DB SQL container resource object -type SQLContainerResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// SQLDatabaseCreateUpdateParameters parameters to create and update Cosmos DB SQL database. -type SQLDatabaseCreateUpdateParameters struct { - // SQLDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB SQL database. - *SQLDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseCreateUpdateParameters. -func (sdcup SQLDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdcup.SQLDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = sdcup.SQLDatabaseCreateUpdateProperties - } - if sdcup.Location != nil { - objectMap["location"] = sdcup.Location - } - if sdcup.Tags != nil { - objectMap["tags"] = sdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseCreateUpdateParameters struct. -func (sdcup *SQLDatabaseCreateUpdateParameters) 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 SQLDatabaseCreateUpdateProperties SQLDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &SQLDatabaseCreateUpdateProperties) - if err != nil { - return err - } - sdcup.SQLDatabaseCreateUpdateProperties = &SQLDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdcup.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB SQL database. -type SQLDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a SQL database - Resource *SQLDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type SQLDatabaseGetProperties struct { - Resource *SQLDatabaseGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLDatabaseGetPropertiesResource ... -type SQLDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Colls - A system generated property that specified the addressable path of the collections resource. - Colls *string `json:"_colls,omitempty"` - // Users - A system generated property that specifies the addressable path of the users resource. - Users *string `json:"_users,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetPropertiesResource. -func (sdgp SQLDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgp.ID != nil { - objectMap["id"] = sdgp.ID - } - if sdgp.Colls != nil { - objectMap["_colls"] = sdgp.Colls - } - if sdgp.Users != nil { - objectMap["_users"] = sdgp.Users - } - return json.Marshal(objectMap) -} - -// SQLDatabaseGetResults an Azure Cosmos DB SQL database. -type SQLDatabaseGetResults struct { - autorest.Response `json:"-"` - // SQLDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *SQLDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetResults. -func (sdgr SQLDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgr.SQLDatabaseGetProperties != nil { - objectMap["properties"] = sdgr.SQLDatabaseGetProperties - } - if sdgr.Location != nil { - objectMap["location"] = sdgr.Location - } - if sdgr.Tags != nil { - objectMap["tags"] = sdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseGetResults struct. -func (sdgr *SQLDatabaseGetResults) 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 SQLDatabaseGetProperties SQLDatabaseGetProperties - err = json.Unmarshal(*v, &SQLDatabaseGetProperties) - if err != nil { - return err - } - sdgr.SQLDatabaseGetProperties = &SQLDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdgr.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseListResult the List operation response, that contains the SQL databases and their properties. -type SQLDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of SQL databases and their properties. - Value *[]SQLDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseListResult. -func (sdlr SQLDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLDatabaseResource cosmos DB SQL database resource object -type SQLDatabaseResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` -} - -// SQLResourcesCreateUpdateSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLContainerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) 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 SQLResourcesCreateUpdateSQLContainerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) result(client SQLResourcesClient) (scgr SQLContainerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - scgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLContainerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if scgr.Response.Response, err = future.GetResult(sender); err == nil && scgr.Response.Response.StatusCode != http.StatusNoContent { - scgr, err = client.CreateUpdateSQLContainerResponder(scgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", scgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) 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 SQLResourcesCreateUpdateSQLDatabaseFuture.Result. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) result(client SQLResourcesClient) (sdgr SQLDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sdgr.Response.Response, err = future.GetResult(sender); err == nil && sdgr.Response.Response.StatusCode != http.StatusNoContent { - sdgr, err = client.CreateUpdateSQLDatabaseResponder(sdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", sdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLStoredProcedureFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLStoredProcedureGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) 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 SQLResourcesCreateUpdateSQLStoredProcedureFuture.Result. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) result(client SQLResourcesClient) (sspgr SQLStoredProcedureGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sspgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sspgr.Response.Response, err = future.GetResult(sender); err == nil && sspgr.Response.Response.StatusCode != http.StatusNoContent { - sspgr, err = client.CreateUpdateSQLStoredProcedureResponder(sspgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", sspgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLTriggerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) 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 SQLResourcesCreateUpdateSQLTriggerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) result(client SQLResourcesClient) (stgr SQLTriggerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - stgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLTriggerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if stgr.Response.Response, err = future.GetResult(sender); err == nil && stgr.Response.Response.StatusCode != http.StatusNoContent { - stgr, err = client.CreateUpdateSQLTriggerResponder(stgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", stgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLUserDefinedFunctionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) 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 SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (sudfgr SQLUserDefinedFunctionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sudfgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sudfgr.Response.Response, err = future.GetResult(sender); err == nil && sudfgr.Response.Response.StatusCode != http.StatusNoContent { - sudfgr, err = client.CreateUpdateSQLUserDefinedFunctionResponder(sudfgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", sudfgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesDeleteSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLContainerFuture) 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 SQLResourcesDeleteSQLContainerFuture.Result. -func (future *SQLResourcesDeleteSQLContainerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLContainerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLDatabaseFuture) 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 SQLResourcesDeleteSQLDatabaseFuture.Result. -func (future *SQLResourcesDeleteSQLDatabaseFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLStoredProcedureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) 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 SQLResourcesDeleteSQLStoredProcedureFuture.Result. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLStoredProcedureFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLTriggerFuture) 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 SQLResourcesDeleteSQLTriggerFuture.Result. -func (future *SQLResourcesDeleteSQLTriggerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLTriggerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesDeleteSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) 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 SQLResourcesDeleteSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesUpdateSQLContainerThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLContainerThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) 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 SQLResourcesUpdateSQLContainerThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLContainerThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLContainerThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLDatabaseThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) 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 SQLResourcesUpdateSQLDatabaseThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLStoredProcedureCreateUpdateParameters parameters to create and update Cosmos DB storedProcedure. -type SQLStoredProcedureCreateUpdateParameters struct { - // SQLStoredProcedureCreateUpdateProperties - Properties to create and update Azure Cosmos DB storedProcedure. - *SQLStoredProcedureCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureCreateUpdateParameters. -func (sspcup SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspcup.SQLStoredProcedureCreateUpdateProperties != nil { - objectMap["properties"] = sspcup.SQLStoredProcedureCreateUpdateProperties - } - if sspcup.Location != nil { - objectMap["location"] = sspcup.Location - } - if sspcup.Tags != nil { - objectMap["tags"] = sspcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureCreateUpdateParameters struct. -func (sspcup *SQLStoredProcedureCreateUpdateParameters) 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 SQLStoredProcedureCreateUpdateProperties SQLStoredProcedureCreateUpdateProperties - err = json.Unmarshal(*v, &SQLStoredProcedureCreateUpdateProperties) - if err != nil { - return err - } - sspcup.SQLStoredProcedureCreateUpdateProperties = &SQLStoredProcedureCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspcup.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureCreateUpdateProperties properties to create and update Azure Cosmos DB -// storedProcedure. -type SQLStoredProcedureCreateUpdateProperties struct { - // Resource - The standard JSON format of a storedProcedure - Resource *SQLStoredProcedureResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLStoredProcedureGetProperties the properties of an Azure Cosmos DB StoredProcedure -type SQLStoredProcedureGetProperties struct { - Resource *SQLStoredProcedureGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLStoredProcedureGetPropertiesResource ... -type SQLStoredProcedureGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetPropertiesResource. -func (sspgp SQLStoredProcedureGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgp.ID != nil { - objectMap["id"] = sspgp.ID - } - if sspgp.Body != nil { - objectMap["body"] = sspgp.Body - } - return json.Marshal(objectMap) -} - -// SQLStoredProcedureGetResults an Azure Cosmos DB storedProcedure. -type SQLStoredProcedureGetResults struct { - autorest.Response `json:"-"` - // SQLStoredProcedureGetProperties - The properties of an Azure Cosmos DB storedProcedure - *SQLStoredProcedureGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetResults. -func (sspgr SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgr.SQLStoredProcedureGetProperties != nil { - objectMap["properties"] = sspgr.SQLStoredProcedureGetProperties - } - if sspgr.Location != nil { - objectMap["location"] = sspgr.Location - } - if sspgr.Tags != nil { - objectMap["tags"] = sspgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureGetResults struct. -func (sspgr *SQLStoredProcedureGetResults) 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 SQLStoredProcedureGetProperties SQLStoredProcedureGetProperties - err = json.Unmarshal(*v, &SQLStoredProcedureGetProperties) - if err != nil { - return err - } - sspgr.SQLStoredProcedureGetProperties = &SQLStoredProcedureGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspgr.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureListResult the List operation response, that contains the storedProcedures and their -// properties. -type SQLStoredProcedureListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of storedProcedures and their properties. - Value *[]SQLStoredProcedureGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureListResult. -func (ssplr SQLStoredProcedureListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLStoredProcedureResource cosmos DB SQL storedProcedure resource object -type SQLStoredProcedureResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` -} - -// SQLTriggerCreateUpdateParameters parameters to create and update Cosmos DB trigger. -type SQLTriggerCreateUpdateParameters struct { - // SQLTriggerCreateUpdateProperties - Properties to create and update Azure Cosmos DB trigger. - *SQLTriggerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerCreateUpdateParameters. -func (stcup SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stcup.SQLTriggerCreateUpdateProperties != nil { - objectMap["properties"] = stcup.SQLTriggerCreateUpdateProperties - } - if stcup.Location != nil { - objectMap["location"] = stcup.Location - } - if stcup.Tags != nil { - objectMap["tags"] = stcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerCreateUpdateParameters struct. -func (stcup *SQLTriggerCreateUpdateParameters) 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 SQLTriggerCreateUpdateProperties SQLTriggerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLTriggerCreateUpdateProperties) - if err != nil { - return err - } - stcup.SQLTriggerCreateUpdateProperties = &SQLTriggerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stcup.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerCreateUpdateProperties properties to create and update Azure Cosmos DB trigger. -type SQLTriggerCreateUpdateProperties struct { - // Resource - The standard JSON format of a trigger - Resource *SQLTriggerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLTriggerGetProperties the properties of an Azure Cosmos DB trigger -type SQLTriggerGetProperties struct { - Resource *SQLTriggerGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLTriggerGetPropertiesResource ... -type SQLTriggerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetPropertiesResource. -func (stgp SQLTriggerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgp.ID != nil { - objectMap["id"] = stgp.ID - } - if stgp.Body != nil { - objectMap["body"] = stgp.Body - } - if stgp.TriggerType != "" { - objectMap["triggerType"] = stgp.TriggerType - } - if stgp.TriggerOperation != "" { - objectMap["triggerOperation"] = stgp.TriggerOperation - } - return json.Marshal(objectMap) -} - -// SQLTriggerGetResults an Azure Cosmos DB trigger. -type SQLTriggerGetResults struct { - autorest.Response `json:"-"` - // SQLTriggerGetProperties - The properties of an Azure Cosmos DB trigger - *SQLTriggerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetResults. -func (stgr SQLTriggerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgr.SQLTriggerGetProperties != nil { - objectMap["properties"] = stgr.SQLTriggerGetProperties - } - if stgr.Location != nil { - objectMap["location"] = stgr.Location - } - if stgr.Tags != nil { - objectMap["tags"] = stgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerGetResults struct. -func (stgr *SQLTriggerGetResults) 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 SQLTriggerGetProperties SQLTriggerGetProperties - err = json.Unmarshal(*v, &SQLTriggerGetProperties) - if err != nil { - return err - } - stgr.SQLTriggerGetProperties = &SQLTriggerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stgr.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerListResult the List operation response, that contains the triggers and their properties. -type SQLTriggerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of triggers and their properties. - Value *[]SQLTriggerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerListResult. -func (stlr SQLTriggerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLTriggerResource cosmos DB SQL trigger resource object -type SQLTriggerResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` -} - -// SQLUserDefinedFunctionCreateUpdateParameters parameters to create and update Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateParameters struct { - // SQLUserDefinedFunctionCreateUpdateProperties - Properties to create and update Azure Cosmos DB userDefinedFunction. - *SQLUserDefinedFunctionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionCreateUpdateParameters. -func (sudfcup SQLUserDefinedFunctionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfcup.SQLUserDefinedFunctionCreateUpdateProperties != nil { - objectMap["properties"] = sudfcup.SQLUserDefinedFunctionCreateUpdateProperties - } - if sudfcup.Location != nil { - objectMap["location"] = sudfcup.Location - } - if sudfcup.Tags != nil { - objectMap["tags"] = sudfcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionCreateUpdateParameters struct. -func (sudfcup *SQLUserDefinedFunctionCreateUpdateParameters) 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 SQLUserDefinedFunctionCreateUpdateProperties SQLUserDefinedFunctionCreateUpdateProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionCreateUpdateProperties) - if err != nil { - return err - } - sudfcup.SQLUserDefinedFunctionCreateUpdateProperties = &SQLUserDefinedFunctionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfcup.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionCreateUpdateProperties properties to create and update Azure Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateProperties struct { - // Resource - The standard JSON format of a userDefinedFunction - Resource *SQLUserDefinedFunctionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLUserDefinedFunctionGetProperties the properties of an Azure Cosmos DB userDefinedFunction -type SQLUserDefinedFunctionGetProperties struct { - Resource *SQLUserDefinedFunctionGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLUserDefinedFunctionGetPropertiesResource ... -type SQLUserDefinedFunctionGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetPropertiesResource. -func (sudfgp SQLUserDefinedFunctionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgp.ID != nil { - objectMap["id"] = sudfgp.ID - } - if sudfgp.Body != nil { - objectMap["body"] = sudfgp.Body - } - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionGetResults an Azure Cosmos DB userDefinedFunction. -type SQLUserDefinedFunctionGetResults struct { - autorest.Response `json:"-"` - // SQLUserDefinedFunctionGetProperties - The properties of an Azure Cosmos DB userDefinedFunction - *SQLUserDefinedFunctionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetResults. -func (sudfgr SQLUserDefinedFunctionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgr.SQLUserDefinedFunctionGetProperties != nil { - objectMap["properties"] = sudfgr.SQLUserDefinedFunctionGetProperties - } - if sudfgr.Location != nil { - objectMap["location"] = sudfgr.Location - } - if sudfgr.Tags != nil { - objectMap["tags"] = sudfgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionGetResults struct. -func (sudfgr *SQLUserDefinedFunctionGetResults) 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 SQLUserDefinedFunctionGetProperties SQLUserDefinedFunctionGetProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionGetProperties) - if err != nil { - return err - } - sudfgr.SQLUserDefinedFunctionGetProperties = &SQLUserDefinedFunctionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfgr.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionListResult the List operation response, that contains the userDefinedFunctions and -// their properties. -type SQLUserDefinedFunctionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of userDefinedFunctions and their properties. - Value *[]SQLUserDefinedFunctionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionListResult. -func (sudflr SQLUserDefinedFunctionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionResource cosmos DB SQL userDefinedFunction resource object -type SQLUserDefinedFunctionResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` -} - -// TableCreateUpdateParameters parameters to create and update Cosmos DB Table. -type TableCreateUpdateParameters struct { - // TableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Table. - *TableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableCreateUpdateParameters. -func (tcup TableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TableCreateUpdateProperties != nil { - objectMap["properties"] = tcup.TableCreateUpdateProperties - } - if tcup.Location != nil { - objectMap["location"] = tcup.Location - } - if tcup.Tags != nil { - objectMap["tags"] = tcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableCreateUpdateParameters struct. -func (tcup *TableCreateUpdateParameters) 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 tableCreateUpdateProperties TableCreateUpdateProperties - err = json.Unmarshal(*v, &tableCreateUpdateProperties) - if err != nil { - return err - } - tcup.TableCreateUpdateProperties = &tableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tcup.Tags = tags - } - } - } - - return nil -} - -// TableCreateUpdateProperties properties to create and update Azure Cosmos DB Table. -type TableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Table - Resource *TableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// TableGetProperties the properties of an Azure Cosmos Table -type TableGetProperties struct { - Resource *TableGetPropertiesResource `json:"resource,omitempty"` -} - -// TableGetPropertiesResource ... -type TableGetPropertiesResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableGetPropertiesResource. -func (tgp TableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgp.ID != nil { - objectMap["id"] = tgp.ID - } - return json.Marshal(objectMap) -} - -// TableGetResults an Azure Cosmos DB Table. -type TableGetResults struct { - autorest.Response `json:"-"` - // TableGetProperties - The properties of an Azure Cosmos DB Table - *TableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableGetResults. -func (tgr TableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgr.TableGetProperties != nil { - objectMap["properties"] = tgr.TableGetProperties - } - if tgr.Location != nil { - objectMap["location"] = tgr.Location - } - if tgr.Tags != nil { - objectMap["tags"] = tgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableGetResults struct. -func (tgr *TableGetResults) 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 tableGetProperties TableGetProperties - err = json.Unmarshal(*v, &tableGetProperties) - if err != nil { - return err - } - tgr.TableGetProperties = &tableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tgr.Tags = tags - } - } - } - - return nil -} - -// TableListResult the List operation response, that contains the Table and their properties. -type TableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Table and their properties. - Value *[]TableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableListResult. -func (tlr TableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TableResource cosmos DB table resource object -type TableResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` -} - -// TableResourcesCreateUpdateTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesCreateUpdateTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (TableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesCreateUpdateTableFuture) 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 TableResourcesCreateUpdateTableFuture.Result. -func (future *TableResourcesCreateUpdateTableFuture) result(client TableResourcesClient) (tgr TableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesCreateUpdateTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tgr.Response.Response, err = future.GetResult(sender); err == nil && tgr.Response.Response.StatusCode != http.StatusNoContent { - tgr, err = client.CreateUpdateTableResponder(tgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", tgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesDeleteTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesDeleteTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesDeleteTableFuture) 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 TableResourcesDeleteTableFuture.Result. -func (future *TableResourcesDeleteTableFuture) result(client TableResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesDeleteTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesDeleteTableFuture") - return - } - ar.Response = future.Response() - return -} - -// TableResourcesUpdateTableThroughputFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesUpdateTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesUpdateTableThroughputFuture) 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 TableResourcesUpdateTableThroughputFuture.Result. -func (future *TableResourcesUpdateTableThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesUpdateTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// ThroughputPolicyResource cosmos DB resource throughput policy -type ThroughputPolicyResource struct { - // IsEnabled - Determines whether the ThroughputPolicy is active or not - IsEnabled *bool `json:"isEnabled,omitempty"` - // IncrementPercent - Represents the percentage by which throughput can increase every time throughput policy kicks in. - IncrementPercent *int32 `json:"incrementPercent,omitempty"` -} - -// ThroughputSettingsGetProperties the properties of an Azure Cosmos DB resource throughput -type ThroughputSettingsGetProperties struct { - Resource *ThroughputSettingsGetPropertiesResource `json:"resource,omitempty"` -} - -// ThroughputSettingsGetPropertiesResource ... -type ThroughputSettingsGetPropertiesResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or provisionedThroughputSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // ProvisionedThroughputSettings - Cosmos DB resource for provisioned throughput settings. Either throughput is required or provisionedThroughputSettings is required, but not both. - ProvisionedThroughputSettings *ProvisionedThroughputSettingsResource `json:"provisionedThroughputSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetPropertiesResource. -func (tsgp ThroughputSettingsGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgp.Throughput != nil { - objectMap["throughput"] = tsgp.Throughput - } - if tsgp.ProvisionedThroughputSettings != nil { - objectMap["provisionedThroughputSettings"] = tsgp.ProvisionedThroughputSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsGetResults an Azure Cosmos DB resource throughput. -type ThroughputSettingsGetResults struct { - autorest.Response `json:"-"` - // ThroughputSettingsGetProperties - The properties of an Azure Cosmos DB resource throughput - *ThroughputSettingsGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetResults. -func (tsgr ThroughputSettingsGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgr.ThroughputSettingsGetProperties != nil { - objectMap["properties"] = tsgr.ThroughputSettingsGetProperties - } - if tsgr.Location != nil { - objectMap["location"] = tsgr.Location - } - if tsgr.Tags != nil { - objectMap["tags"] = tsgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsGetResults struct. -func (tsgr *ThroughputSettingsGetResults) 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 throughputSettingsGetProperties ThroughputSettingsGetProperties - err = json.Unmarshal(*v, &throughputSettingsGetProperties) - if err != nil { - return err - } - tsgr.ThroughputSettingsGetProperties = &throughputSettingsGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsgr.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsResource cosmos DB resource throughput object. Either throughput is required or -// provisionedThroughputSettings is required, but not both. -type ThroughputSettingsResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or provisionedThroughputSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // ProvisionedThroughputSettings - Cosmos DB resource for provisioned throughput settings. Either throughput is required or provisionedThroughputSettings is required, but not both. - ProvisionedThroughputSettings *ProvisionedThroughputSettingsResource `json:"provisionedThroughputSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsResource. -func (tsr ThroughputSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsr.Throughput != nil { - objectMap["throughput"] = tsr.Throughput - } - if tsr.ProvisionedThroughputSettings != nil { - objectMap["provisionedThroughputSettings"] = tsr.ProvisionedThroughputSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsUpdateParameters parameters to update Cosmos DB resource throughput. -type ThroughputSettingsUpdateParameters struct { - // ThroughputSettingsUpdateProperties - Properties to update Azure Cosmos DB resource throughput. - *ThroughputSettingsUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsUpdateParameters. -func (tsup ThroughputSettingsUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsup.ThroughputSettingsUpdateProperties != nil { - objectMap["properties"] = tsup.ThroughputSettingsUpdateProperties - } - if tsup.Location != nil { - objectMap["location"] = tsup.Location - } - if tsup.Tags != nil { - objectMap["tags"] = tsup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsUpdateParameters struct. -func (tsup *ThroughputSettingsUpdateParameters) 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 throughputSettingsUpdateProperties ThroughputSettingsUpdateProperties - err = json.Unmarshal(*v, &throughputSettingsUpdateProperties) - if err != nil { - return err - } - tsup.ThroughputSettingsUpdateProperties = &throughputSettingsUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsup.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsUpdateProperties properties to update Azure Cosmos DB resource throughput. -type ThroughputSettingsUpdateProperties struct { - // Resource - The standard JSON format of a resource throughput - Resource *ThroughputSettingsResource `json:"resource,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"` -} - -// 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) -} - -// UniqueKey the unique key on that enforces uniqueness constraint on documents in the collection in the -// Azure Cosmos DB service. -type UniqueKey struct { - // Paths - List of paths must be unique for each document in the Azure Cosmos DB service - Paths *[]string `json:"paths,omitempty"` -} - -// UniqueKeyPolicy the unique key policy configuration for specifying uniqueness constraints on documents -// in the collection in the Azure Cosmos DB service. -type UniqueKeyPolicy struct { - // UniqueKeys - List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - UniqueKeys *[]UniqueKey `json:"uniqueKeys,omitempty"` -} - -// Usage the usage data for a usage request. -type Usage struct { - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.Unit != "" { - objectMap["unit"] = u.Unit - } - return json.Marshal(objectMap) -} - -// UsagesResult the response to a list usage request. -type UsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of usages for the database. A usage is a point in time metric - Value *[]Usage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsagesResult. -func (ur UsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRule virtual Network ACL Rule object -type VirtualNetworkRule struct { - // ID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. - ID *string `json:"id,omitempty"` - // IgnoreMissingVNetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVNetServiceEndpoint *bool `json:"ignoreMissingVNetServiceEndpoint,omitempty"` -} diff --git a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/mongodbresources.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/mongodbresources.go deleted file mode 100644 index 408df1924f0b..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/mongodbresources.go +++ /dev/null @@ -1,1180 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// MongoDBResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type MongoDBResourcesClient struct { - BaseClient -} - -// NewMongoDBResourcesClient creates an instance of the MongoDBResourcesClient client. -func NewMongoDBResourcesClient(subscriptionID string, subscriptionID1 string) MongoDBResourcesClient { - return NewMongoDBResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewMongoDBResourcesClientWithBaseURI creates an instance of the MongoDBResourcesClient 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 NewMongoDBResourcesClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) MongoDBResourcesClient { - return MongoDBResourcesClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// CreateUpdateMongoDBCollection create or update an Azure Cosmos DB MongoDB Collection -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// createUpdateMongoDBCollectionParameters - the parameters to provide for the current MongoDB Collection. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBCollection") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBCollectionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", err.Error()) - } - - req, err := client.CreateUpdateMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBCollectionPreparer prepares the CreateUpdateMongoDBCollection request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBCollectionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBCollectionSender sends the CreateUpdateMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBCollectionFuture, 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 -} - -// CreateUpdateMongoDBCollectionResponder handles the response to the CreateUpdateMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateMongoDBDatabase create or updates Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateMongoDBDatabaseParameters - the parameters to provide for the current MongoDB database. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", err.Error()) - } - - req, err := client.CreateUpdateMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBDatabasePreparer prepares the CreateUpdateMongoDBDatabase request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBDatabaseSender sends the CreateUpdateMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, 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 -} - -// CreateUpdateMongoDBDatabaseResponder handles the response to the CreateUpdateMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteMongoDBCollection deletes an existing Azure Cosmos DB MongoDB Collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesDeleteMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBCollection") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", err.Error()) - } - - req, err := client.DeleteMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBCollectionPreparer prepares the DeleteMongoDBCollection request. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBCollectionSender sends the DeleteMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBCollectionFuture, 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 -} - -// DeleteMongoDBCollectionResponder handles the response to the DeleteMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionResponder(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 -} - -// DeleteMongoDBDatabase deletes an existing Azure Cosmos DB MongoDB database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", err.Error()) - } - - req, err := client.DeleteMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBDatabasePreparer prepares the DeleteMongoDBDatabase request. -func (client MongoDBResourcesClient) DeleteMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBDatabaseSender sends the DeleteMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBDatabaseFuture, 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 -} - -// DeleteMongoDBDatabaseResponder handles the response to the DeleteMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseResponder(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 -} - -// GetMongoDBCollection gets the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBCollectionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollection") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollection", err.Error()) - } - - req, err := client.GetMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionPreparer prepares the GetMongoDBCollection request. -func (client MongoDBResourcesClient) GetMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionSender sends the GetMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionResponder handles the response to the GetMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBCollectionThroughput gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollectionThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.GetMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionThroughputPreparer prepares the GetMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionThroughputSender sends the GetMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionThroughputResponder handles the response to the GetMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabase gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", err.Error()) - } - - req, err := client.GetMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabasePreparer prepares the GetMongoDBDatabase request. -func (client MongoDBResourcesClient) GetMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseSender sends the GetMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseResponder handles the response to the GetMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabaseThroughput gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabaseThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.GetMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabaseThroughputPreparer prepares the GetMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseThroughputSender sends the GetMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseThroughputResponder handles the response to the GetMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBCollections lists the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBCollectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBCollections") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBCollections", err.Error()) - } - - req, err := client.ListMongoDBCollectionsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBCollectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBCollectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBCollectionsPreparer prepares the ListMongoDBCollections request. -func (client MongoDBResourcesClient) ListMongoDBCollectionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBCollectionsSender sends the ListMongoDBCollections request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBCollectionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBCollectionsResponder handles the response to the ListMongoDBCollections request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBCollectionsResponder(resp *http.Response) (result MongoDBCollectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBDatabases lists the MongoDB databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client MongoDBResourcesClient) ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result MongoDBDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBDatabases") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", err.Error()) - } - - req, err := client.ListMongoDBDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBDatabasesPreparer prepares the ListMongoDBDatabases request. -func (client MongoDBResourcesClient) ListMongoDBDatabasesPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBDatabasesSender sends the ListMongoDBDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBDatabasesResponder handles the response to the ListMongoDBDatabases request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBDatabasesResponder(resp *http.Response) (result MongoDBDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBCollectionThroughput update the RUs per second of an Azure Cosmos DB MongoDB collection -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// collection. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBCollectionThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBCollectionThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBCollectionThroughputPreparer prepares the UpdateMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBCollectionThroughputSender sends the UpdateMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, 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 -} - -// UpdateMongoDBCollectionThroughputResponder handles the response to the UpdateMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBDatabaseThroughput update RUs per second of the an Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// database. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBDatabaseThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBDatabaseThroughputPreparer prepares the UpdateMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBDatabaseThroughputSender sends the UpdateMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, 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 -} - -// UpdateMongoDBDatabaseThroughputResponder handles the response to the UpdateMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/notebookworkspaces.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/notebookworkspaces.go deleted file mode 100644 index 8acd988ec0c4..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/notebookworkspaces.go +++ /dev/null @@ -1,681 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotebookWorkspacesClient is the azure Cosmos DB Database Service Resource Provider REST API -type NotebookWorkspacesClient struct { - BaseClient -} - -// NewNotebookWorkspacesClient creates an instance of the NotebookWorkspacesClient client. -func NewNotebookWorkspacesClient(subscriptionID string, subscriptionID1 string) NotebookWorkspacesClient { - return NewNotebookWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewNotebookWorkspacesClientWithBaseURI creates an instance of the NotebookWorkspacesClient 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 NewNotebookWorkspacesClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) NotebookWorkspacesClient { - return NotebookWorkspacesClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// CreateOrUpdate creates the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// notebookCreateUpdateParameters - the notebook workspace to create for the current database account. -func (client NotebookWorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (result NotebookWorkspacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, notebookCreateUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotebookWorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", pathParameters), - autorest.WithJSON(notebookCreateUpdateParameters), - 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 NotebookWorkspacesClient) CreateOrUpdateSender(req *http.Request) (future NotebookWorkspacesCreateOrUpdateFuture, 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 NotebookWorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result NotebookWorkspace, 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 notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotebookWorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) DeleteSender(req *http.Request) (future NotebookWorkspacesDeleteFuture, 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 NotebookWorkspacesClient) 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 the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotebookWorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) 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 NotebookWorkspacesClient) GetResponder(resp *http.Response) (result NotebookWorkspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabaseAccount gets the notebook workspace resources of an existing Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client NotebookWorkspacesClient) ListByDatabaseAccountPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListByDatabaseAccountResponder(resp *http.Response) (result NotebookWorkspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionInfo retrieves the connection info for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceConnectionInfoResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListConnectionInfo") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListConnectionInfo", err.Error()) - } - - req, err := client.ListConnectionInfoPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionInfoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionInfoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionInfoPreparer prepares the ListConnectionInfo request. -func (client NotebookWorkspacesClient) ListConnectionInfoPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionInfoSender sends the ListConnectionInfo request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListConnectionInfoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionInfoResponder handles the response to the ListConnectionInfo request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListConnectionInfoResponder(resp *http.Response) (result NotebookWorkspaceConnectionInfoResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateAuthToken regenerates the auth token for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesRegenerateAuthTokenFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.RegenerateAuthToken") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", err.Error()) - } - - req, err := client.RegenerateAuthTokenPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateAuthTokenSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateAuthTokenPreparer prepares the RegenerateAuthToken request. -func (client NotebookWorkspacesClient) RegenerateAuthTokenPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateAuthTokenSender sends the RegenerateAuthToken request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) RegenerateAuthTokenSender(req *http.Request) (future NotebookWorkspacesRegenerateAuthTokenFuture, 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 -} - -// RegenerateAuthTokenResponder handles the response to the RegenerateAuthToken request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) RegenerateAuthTokenResponder(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 the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Start(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client NotebookWorkspacesClient) StartPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/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 NotebookWorkspacesClient) StartSender(req *http.Request) (future NotebookWorkspacesStartFuture, 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 NotebookWorkspacesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/operations.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/operations.go deleted file mode 100644 index cf03c9d1e707..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure Cosmos DB Database Service Resource Provider REST API -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string, subscriptionID1 string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// 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, subscriptionID1 string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// List lists all of the available Cosmos DB Resource Provider 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, "documentdb.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, "documentdb.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DocumentDB/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, "documentdb.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, "documentdb.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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/cosmos-db/mgmt/2019-12-12-preview/documentdb/partitionkeyrangeid.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/partitionkeyrangeid.go deleted file mode 100644 index a44febb76901..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/partitionkeyrangeid.go +++ /dev/null @@ -1,131 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDClient creates an instance of the PartitionKeyRangeIDClient client. -func NewPartitionKeyRangeIDClient(subscriptionID string, subscriptionID1 string) PartitionKeyRangeIDClient { - return NewPartitionKeyRangeIDClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewPartitionKeyRangeIDClientWithBaseURI creates an instance of the PartitionKeyRangeIDClient 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 NewPartitionKeyRangeIDClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) PartitionKeyRangeIDClient { - return PartitionKeyRangeIDClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/partitionkeyrangeidregion.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/partitionkeyrangeidregion.go deleted file mode 100644 index 6aedb8396667..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/partitionkeyrangeidregion.go +++ /dev/null @@ -1,133 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDRegionClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDRegionClient creates an instance of the PartitionKeyRangeIDRegionClient client. -func NewPartitionKeyRangeIDRegionClient(subscriptionID string, subscriptionID1 string) PartitionKeyRangeIDRegionClient { - return NewPartitionKeyRangeIDRegionClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewPartitionKeyRangeIDRegionClientWithBaseURI creates an instance of the PartitionKeyRangeIDRegionClient 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 NewPartitionKeyRangeIDRegionClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) PartitionKeyRangeIDRegionClient { - return PartitionKeyRangeIDRegionClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id and region. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDRegionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentile.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentile.go deleted file mode 100644 index 3d121f00d2a5..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentile.go +++ /dev/null @@ -1,125 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileClient struct { - BaseClient -} - -// NewPercentileClient creates an instance of the PercentileClient client. -func NewPercentileClient(subscriptionID string, subscriptionID1 string) PercentileClient { - return NewPercentileClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewPercentileClientWithBaseURI creates an instance of the PercentileClient 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 NewPercentileClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) PercentileClient { - return PercentileClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. This url is only -// for PBS and Replication Latency data -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentilesourcetarget.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentilesourcetarget.go deleted file mode 100644 index 85c1ebdcae16..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentilesourcetarget.go +++ /dev/null @@ -1,132 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileSourceTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileSourceTargetClient struct { - BaseClient -} - -// NewPercentileSourceTargetClient creates an instance of the PercentileSourceTargetClient client. -func NewPercentileSourceTargetClient(subscriptionID string, subscriptionID1 string) PercentileSourceTargetClient { - return NewPercentileSourceTargetClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewPercentileSourceTargetClientWithBaseURI creates an instance of the PercentileSourceTargetClient 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 NewPercentileSourceTargetClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) PercentileSourceTargetClient { - return PercentileSourceTargetClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account, source and target region. -// This url is only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// sourceRegion - source region from which data is written. Cosmos DB region, with spaces between words and -// each word capitalized. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileSourceTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileSourceTargetClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileSourceTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, sourceRegion, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileSourceTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceRegion": autorest.Encode("path", sourceRegion), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileSourceTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileSourceTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentiletarget.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentiletarget.go deleted file mode 100644 index e804fdf632cf..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/percentiletarget.go +++ /dev/null @@ -1,129 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileTargetClient struct { - BaseClient -} - -// NewPercentileTargetClient creates an instance of the PercentileTargetClient client. -func NewPercentileTargetClient(subscriptionID string, subscriptionID1 string) PercentileTargetClient { - return NewPercentileTargetClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewPercentileTargetClientWithBaseURI creates an instance of the PercentileTargetClient 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 NewPercentileTargetClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) PercentileTargetClient { - return PercentileTargetClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account target region. This url is -// only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileTargetClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, targetRegion 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), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/privateendpointconnections.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/privateendpointconnections.go deleted file mode 100644 index bea6fd6e761c..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/privateendpointconnections.go +++ /dev/null @@ -1,406 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string, subscriptionID1 string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) 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 = "2019-08-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.DocumentDB/databaseAccounts/{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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByDatabaseAccount list all private endpoint connections on a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/privatelinkresources.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/privatelinkresources.go deleted file mode 100644 index 1e0f9b660a2a..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/privatelinkresources.go +++ /dev/null @@ -1,215 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string, subscriptionID1 string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// Get gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByDatabaseAccount gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateLinkResourcesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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/cosmos-db/mgmt/2019-12-12-preview/documentdb/sqlresources.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/sqlresources.go deleted file mode 100644 index de5b4b6c7ff4..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/sqlresources.go +++ /dev/null @@ -1,2348 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type SQLResourcesClient struct { - BaseClient -} - -// NewSQLResourcesClient creates an instance of the SQLResourcesClient client. -func NewSQLResourcesClient(subscriptionID string, subscriptionID1 string) SQLResourcesClient { - return NewSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewSQLResourcesClientWithBaseURI creates an instance of the SQLResourcesClient 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 NewSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) SQLResourcesClient { - return SQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// CreateUpdateSQLContainer create or update an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// createUpdateSQLContainerParameters - the parameters to provide for the current SQL container. -func (client SQLResourcesClient) CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLContainer") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLContainerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", err.Error()) - } - - req, err := client.CreateUpdateSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, createUpdateSQLContainerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLContainerPreparer prepares the CreateUpdateSQLContainer request. -func (client SQLResourcesClient) CreateUpdateSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithJSON(createUpdateSQLContainerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLContainerSender sends the CreateUpdateSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLContainerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLContainerFuture, 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 -} - -// CreateUpdateSQLContainerResponder handles the response to the CreateUpdateSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLDatabase create or update an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateSQLDatabaseParameters - the parameters to provide for the current SQL database. -func (client SQLResourcesClient) CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", err.Error()) - } - - req, err := client.CreateUpdateSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateSQLDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLDatabasePreparer prepares the CreateUpdateSQLDatabase request. -func (client SQLResourcesClient) CreateUpdateSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateSQLDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLDatabaseSender sends the CreateUpdateSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseSender(req *http.Request) (future SQLResourcesCreateUpdateSQLDatabaseFuture, 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 -} - -// CreateUpdateSQLDatabaseResponder handles the response to the CreateUpdateSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLStoredProcedure create or update an Azure Cosmos DB SQL storedProcedure -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -// createUpdateSQLStoredProcedureParameters - the parameters to provide for the current SQL storedProcedure. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLStoredProcedure") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLStoredProcedureParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", err.Error()) - } - - req, err := client.CreateUpdateSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSQLStoredProcedureParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLStoredProcedurePreparer prepares the CreateUpdateSQLStoredProcedure request. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithJSON(createUpdateSQLStoredProcedureParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLStoredProcedureSender sends the CreateUpdateSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureSender(req *http.Request) (future SQLResourcesCreateUpdateSQLStoredProcedureFuture, 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 -} - -// CreateUpdateSQLStoredProcedureResponder handles the response to the CreateUpdateSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLTrigger create or update an Azure Cosmos DB SQL trigger -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -// createUpdateSQLTriggerParameters - the parameters to provide for the current SQL trigger. -func (client SQLResourcesClient) CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLTrigger") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLTriggerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", err.Error()) - } - - req, err := client.CreateUpdateSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSQLTriggerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLTriggerPreparer prepares the CreateUpdateSQLTrigger request. -func (client SQLResourcesClient) CreateUpdateSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithJSON(createUpdateSQLTriggerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLTriggerSender sends the CreateUpdateSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLTriggerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLTriggerFuture, 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 -} - -// CreateUpdateSQLTriggerResponder handles the response to the CreateUpdateSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLUserDefinedFunction create or update an Azure Cosmos DB SQL userDefinedFunction -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -// createUpdateSQLUserDefinedFunctionParameters - the parameters to provide for the current SQL -// userDefinedFunction. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLUserDefinedFunction") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLUserDefinedFunctionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", err.Error()) - } - - req, err := client.CreateUpdateSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSQLUserDefinedFunctionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLUserDefinedFunctionPreparer prepares the CreateUpdateSQLUserDefinedFunction request. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithJSON(createUpdateSQLUserDefinedFunctionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLUserDefinedFunctionSender sends the CreateUpdateSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, 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 -} - -// CreateUpdateSQLUserDefinedFunctionResponder handles the response to the CreateUpdateSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSQLContainer deletes an existing Azure Cosmos DB SQL container. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesDeleteSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLContainer") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLContainer", err.Error()) - } - - req, err := client.DeleteSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLContainerPreparer prepares the DeleteSQLContainer request. -func (client SQLResourcesClient) DeleteSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLContainerSender sends the DeleteSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLContainerSender(req *http.Request) (future SQLResourcesDeleteSQLContainerFuture, 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 -} - -// DeleteSQLContainerResponder handles the response to the DeleteSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLContainerResponder(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 -} - -// DeleteSQLDatabase deletes an existing Azure Cosmos DB SQL database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesDeleteSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLDatabase", err.Error()) - } - - req, err := client.DeleteSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLDatabasePreparer prepares the DeleteSQLDatabase request. -func (client SQLResourcesClient) DeleteSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLDatabaseSender sends the DeleteSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLDatabaseSender(req *http.Request) (future SQLResourcesDeleteSQLDatabaseFuture, 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 -} - -// DeleteSQLDatabaseResponder handles the response to the DeleteSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLDatabaseResponder(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 -} - -// DeleteSQLStoredProcedure deletes an existing Azure Cosmos DB SQL storedProcedure. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLResourcesDeleteSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLStoredProcedure") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", err.Error()) - } - - req, err := client.DeleteSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLStoredProcedurePreparer prepares the DeleteSQLStoredProcedure request. -func (client SQLResourcesClient) DeleteSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLStoredProcedureSender sends the DeleteSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLStoredProcedureSender(req *http.Request) (future SQLResourcesDeleteSQLStoredProcedureFuture, 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 -} - -// DeleteSQLStoredProcedureResponder handles the response to the DeleteSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLStoredProcedureResponder(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 -} - -// DeleteSQLTrigger deletes an existing Azure Cosmos DB SQL trigger. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLResourcesDeleteSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLTrigger") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLTrigger", err.Error()) - } - - req, err := client.DeleteSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLTriggerPreparer prepares the DeleteSQLTrigger request. -func (client SQLResourcesClient) DeleteSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLTriggerSender sends the DeleteSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLTriggerSender(req *http.Request) (future SQLResourcesDeleteSQLTriggerFuture, 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 -} - -// DeleteSQLTriggerResponder handles the response to the DeleteSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLTriggerResponder(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 -} - -// DeleteSQLUserDefinedFunction deletes an existing Azure Cosmos DB SQL userDefinedFunction. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLUserDefinedFunction") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", err.Error()) - } - - req, err := client.DeleteSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLUserDefinedFunctionPreparer prepares the DeleteSQLUserDefinedFunction request. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLUserDefinedFunctionSender sends the DeleteSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesDeleteSQLUserDefinedFunctionFuture, 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 -} - -// DeleteSQLUserDefinedFunctionResponder handles the response to the DeleteSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionResponder(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 -} - -// GetSQLContainer gets the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error()) - } - - req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerPreparer prepares the GetSQLContainer request. -func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerSender sends the GetSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database -// account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error()) - } - - req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request. -func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error()) - } - - req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabasePreparer prepares the GetSQLDatabase request. -func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database -// account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error()) - } - - req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request. -func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLStoredProcedure gets the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLStoredProcedureGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLStoredProcedure") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLStoredProcedure", err.Error()) - } - - req, err := client.GetSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLStoredProcedureSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure sending request") - return - } - - result, err = client.GetSQLStoredProcedureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLStoredProcedurePreparer prepares the GetSQLStoredProcedure request. -func (client SQLResourcesClient) GetSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLStoredProcedureSender sends the GetSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLStoredProcedureSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLStoredProcedureResponder handles the response to the GetSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLTrigger gets the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLTriggerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLTrigger") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLTrigger", err.Error()) - } - - req, err := client.GetSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLTriggerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure sending request") - return - } - - result, err = client.GetSQLTriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLTriggerPreparer prepares the GetSQLTrigger request. -func (client SQLResourcesClient) GetSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLTriggerSender sends the GetSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLTriggerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLTriggerResponder handles the response to the GetSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLUserDefinedFunction gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLUserDefinedFunctionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLUserDefinedFunction") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", err.Error()) - } - - req, err := client.GetSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLUserDefinedFunctionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure sending request") - return - } - - result, err = client.GetSQLUserDefinedFunctionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLUserDefinedFunctionPreparer prepares the GetSQLUserDefinedFunction request. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLUserDefinedFunctionSender sends the GetSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLUserDefinedFunctionResponder handles the response to the GetSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLContainers lists the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLContainerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLContainers") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLContainers", err.Error()) - } - - req, err := client.ListSQLContainersPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLContainersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLContainersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLContainersPreparer prepares the ListSQLContainers request. -func (client SQLResourcesClient) ListSQLContainersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLContainersSender sends the ListSQLContainers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLContainersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLContainersResponder handles the response to the ListSQLContainers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLContainersResponder(resp *http.Response) (result SQLContainerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLDatabases lists the SQL databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result SQLDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLDatabases") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLDatabases", err.Error()) - } - - req, err := client.ListSQLDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListSQLDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLDatabasesPreparer prepares the ListSQLDatabases request. -func (client SQLResourcesClient) ListSQLDatabasesPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLDatabasesSender sends the ListSQLDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLDatabasesResponder handles the response to the ListSQLDatabases request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLDatabasesResponder(resp *http.Response) (result SQLDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLStoredProcedures lists the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLStoredProcedureListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLStoredProcedures") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLStoredProcedures", err.Error()) - } - - req, err := client.ListSQLStoredProceduresPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLStoredProceduresSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure sending request") - return - } - - result, err = client.ListSQLStoredProceduresResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLStoredProceduresPreparer prepares the ListSQLStoredProcedures request. -func (client SQLResourcesClient) ListSQLStoredProceduresPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLStoredProceduresSender sends the ListSQLStoredProcedures request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLStoredProceduresSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLStoredProceduresResponder handles the response to the ListSQLStoredProcedures request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLStoredProceduresResponder(resp *http.Response) (result SQLStoredProcedureListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLTriggers lists the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLTriggerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLTriggers") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLTriggers", err.Error()) - } - - req, err := client.ListSQLTriggersPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLTriggersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLTriggersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLTriggersPreparer prepares the ListSQLTriggers request. -func (client SQLResourcesClient) ListSQLTriggersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLTriggersSender sends the ListSQLTriggers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLTriggersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLTriggersResponder handles the response to the ListSQLTriggers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLTriggersResponder(resp *http.Response) (result SQLTriggerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLUserDefinedFunctions lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLUserDefinedFunctionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLUserDefinedFunctions") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", err.Error()) - } - - req, err := client.ListSQLUserDefinedFunctionsPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLUserDefinedFunctionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure sending request") - return - } - - result, err = client.ListSQLUserDefinedFunctionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLUserDefinedFunctionsPreparer prepares the ListSQLUserDefinedFunctions request. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLUserDefinedFunctionsSender sends the ListSQLUserDefinedFunctions request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLUserDefinedFunctionsResponder handles the response to the ListSQLUserDefinedFunctions request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsResponder(resp *http.Response) (result SQLUserDefinedFunctionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLContainerThroughput update RUs per second of an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL container. -func (client SQLResourcesClient) UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLContainerThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLContainerThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", err.Error()) - } - - req, err := client.UpdateSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLContainerThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLContainerThroughputPreparer prepares the UpdateSQLContainerThroughput request. -func (client SQLResourcesClient) UpdateSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLContainerThroughputSender sends the UpdateSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLContainerThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLContainerThroughputFuture, 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 -} - -// UpdateSQLContainerThroughputResponder handles the response to the UpdateSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLDatabaseThroughput update RUs per second of an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL database. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLDatabaseThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLDatabaseThroughputPreparer prepares the UpdateSQLDatabaseThroughput request. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLDatabaseThroughputSender sends the UpdateSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLDatabaseThroughputFuture, 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 -} - -// UpdateSQLDatabaseThroughputResponder handles the response to the UpdateSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/tableresources.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/tableresources.go deleted file mode 100644 index fb543becabf3..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/tableresources.go +++ /dev/null @@ -1,598 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TableResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type TableResourcesClient struct { - BaseClient -} - -// NewTableResourcesClient creates an instance of the TableResourcesClient client. -func NewTableResourcesClient(subscriptionID string, subscriptionID1 string) TableResourcesClient { - return NewTableResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID, subscriptionID1) -} - -// NewTableResourcesClientWithBaseURI creates an instance of the TableResourcesClient 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 NewTableResourcesClientWithBaseURI(baseURI string, subscriptionID string, subscriptionID1 string) TableResourcesClient { - return TableResourcesClient{NewWithBaseURI(baseURI, subscriptionID, subscriptionID1)} -} - -// CreateUpdateTable create or update an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// createUpdateTableParameters - the parameters to provide for the current Table. -func (client TableResourcesClient) CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (result TableResourcesCreateUpdateTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.CreateUpdateTable") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateTableParameters.TableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "CreateUpdateTable", err.Error()) - } - - req, err := client.CreateUpdateTablePreparer(ctx, resourceGroupName, accountName, tableName, createUpdateTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateTablePreparer prepares the CreateUpdateTable request. -func (client TableResourcesClient) CreateUpdateTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateTableSender sends the CreateUpdateTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) CreateUpdateTableSender(req *http.Request) (future TableResourcesCreateUpdateTableFuture, 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 -} - -// CreateUpdateTableResponder handles the response to the CreateUpdateTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) CreateUpdateTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteTable deletes an existing Azure Cosmos DB Table. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesDeleteTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.DeleteTable") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "DeleteTable", err.Error()) - } - - req, err := client.DeleteTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteTablePreparer prepares the DeleteTable request. -func (client TableResourcesClient) DeleteTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteTableSender sends the DeleteTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) DeleteTableSender(req *http.Request) (future TableResourcesDeleteTableFuture, 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 -} - -// DeleteTableResponder handles the response to the DeleteTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) DeleteTableResponder(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 -} - -// GetTable gets the Tables under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTable") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTable", err.Error()) - } - - req, err := client.GetTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure sending request") - return - } - - result, err = client.GetTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure responding to request") - return - } - - return -} - -// GetTablePreparer prepares the GetTable request. -func (client TableResourcesClient) GetTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableSender sends the GetTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableResponder handles the response to the GetTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTableThroughput gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTableThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTableThroughput", err.Error()) - } - - req, err := client.GetTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetTableThroughputPreparer prepares the GetTableThroughput request. -func (client TableResourcesClient) GetTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableThroughputSender sends the GetTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableThroughputResponder handles the response to the GetTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListTables lists the Tables under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -func (client TableResourcesClient) ListTables(ctx context.Context, resourceGroupName string, accountName string) (result TableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.ListTables") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "ListTables", err.Error()) - } - - req, err := client.ListTablesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure sending request") - return - } - - result, err = client.ListTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure responding to request") - return - } - - return -} - -// ListTablesPreparer prepares the ListTables request. -func (client TableResourcesClient) ListTablesPreparer(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 = "2019-12-12" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListTablesSender sends the ListTables request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) ListTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListTablesResponder handles the response to the ListTables request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) ListTablesResponder(resp *http.Response) (result TableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateTableThroughput update RUs per second of an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current Table. -func (client TableResourcesClient) UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result TableResourcesUpdateTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.UpdateTableThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "UpdateTableThroughput", err.Error()) - } - - req, err := client.UpdateTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTableThroughputPreparer prepares the UpdateTableThroughput request. -func (client TableResourcesClient) UpdateTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2019-12-12" - 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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTableThroughputSender sends the UpdateTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) UpdateTableThroughputSender(req *http.Request) (future TableResourcesUpdateTableThroughputFuture, 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 -} - -// UpdateTableThroughputResponder handles the response to the UpdateTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) UpdateTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/version.go b/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/version.go deleted file mode 100644 index 25c4804e31b9..000000000000 --- a/services/preview/cosmos-db/mgmt/2019-12-12-preview/documentdb/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package documentdb - -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() + " documentdb/2019-12-12-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/CHANGELOG.md b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/_meta.json b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/_meta.json deleted file mode 100644 index 7743a55f27ae..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "tag": "package-2020-03", - "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-2020-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/cassandraresources.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/cassandraresources.go deleted file mode 100644 index ca01d7a13344..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/cassandraresources.go +++ /dev/null @@ -1,1591 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CassandraResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type CassandraResourcesClient struct { - BaseClient -} - -// NewCassandraResourcesClient creates an instance of the CassandraResourcesClient client. -func NewCassandraResourcesClient(subscriptionID string) CassandraResourcesClient { - return NewCassandraResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCassandraResourcesClientWithBaseURI creates an instance of the CassandraResourcesClient 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 NewCassandraResourcesClientWithBaseURI(baseURI string, subscriptionID string) CassandraResourcesClient { - return CassandraResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateCassandraKeyspace create or update an Azure Cosmos DB Cassandra keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// createUpdateCassandraKeyspaceParameters - the parameters to provide for the current Cassandra keyspace. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraKeyspaceParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", err.Error()) - } - - req, err := client.CreateUpdateCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraKeyspacePreparer prepares the CreateUpdateCassandraKeyspace request. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithJSON(createUpdateCassandraKeyspaceParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraKeyspaceSender sends the CreateUpdateCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraKeyspaceFuture, 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 -} - -// CreateUpdateCassandraKeyspaceResponder handles the response to the CreateUpdateCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateCassandraTable create or update an Azure Cosmos DB Cassandra Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// createUpdateCassandraTableParameters - the parameters to provide for the current Cassandra Table. -func (client CassandraResourcesClient) CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", err.Error()) - } - - req, err := client.CreateUpdateCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraTablePreparer prepares the CreateUpdateCassandraTable request. -func (client CassandraResourcesClient) CreateUpdateCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateCassandraTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraTableSender sends the CreateUpdateCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraTableSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraTableFuture, 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 -} - -// CreateUpdateCassandraTableResponder handles the response to the CreateUpdateCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCassandraKeyspace deletes an existing Azure Cosmos DB Cassandra keyspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesDeleteCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", err.Error()) - } - - req, err := client.DeleteCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraKeyspacePreparer prepares the DeleteCassandraKeyspace request. -func (client CassandraResourcesClient) DeleteCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraKeyspaceSender sends the DeleteCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesDeleteCassandraKeyspaceFuture, 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 -} - -// DeleteCassandraKeyspaceResponder handles the response to the DeleteCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceResponder(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 -} - -// DeleteCassandraTable deletes an existing Azure Cosmos DB Cassandra table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesDeleteCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraTable", err.Error()) - } - - req, err := client.DeleteCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraTablePreparer prepares the DeleteCassandraTable request. -func (client CassandraResourcesClient) DeleteCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraTableSender sends the DeleteCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraTableSender(req *http.Request) (future CassandraResourcesDeleteCassandraTableFuture, 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 -} - -// DeleteCassandraTableResponder handles the response to the DeleteCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraTableResponder(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 -} - -// GetCassandraKeyspace gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraKeyspaceGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspace") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspace", err.Error()) - } - - req, err := client.GetCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspacePreparer prepares the GetCassandraKeyspace request. -func (client CassandraResourcesClient) GetCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceSender sends the GetCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceResponder handles the response to the GetCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraKeyspaceThroughput gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspaceThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.GetCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspaceThroughputPreparer prepares the GetCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceThroughputSender sends the GetCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceThroughputResponder handles the response to the GetCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTable gets the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraTableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTable", err.Error()) - } - - req, err := client.GetCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTablePreparer prepares the GetCassandraTable request. -func (client CassandraResourcesClient) GetCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableSender sends the GetCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableResponder handles the response to the GetCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTableThroughput gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", err.Error()) - } - - req, err := client.GetCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTableThroughputPreparer prepares the GetCassandraTableThroughput request. -func (client CassandraResourcesClient) GetCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableThroughputSender sends the GetCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableThroughputResponder handles the response to the GetCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraKeyspaces lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client CassandraResourcesClient) ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result CassandraKeyspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraKeyspaces") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", err.Error()) - } - - req, err := client.ListCassandraKeyspacesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraKeyspacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraKeyspacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraKeyspacesPreparer prepares the ListCassandraKeyspaces request. -func (client CassandraResourcesClient) ListCassandraKeyspacesPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraKeyspacesSender sends the ListCassandraKeyspaces request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraKeyspacesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraKeyspacesResponder handles the response to the ListCassandraKeyspaces request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraKeyspacesResponder(resp *http.Response) (result CassandraKeyspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraTables lists the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraTableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraTables", err.Error()) - } - - req, err := client.ListCassandraTablesPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraTablesPreparer prepares the ListCassandraTables request. -func (client CassandraResourcesClient) ListCassandraTablesPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraTablesSender sends the ListCassandraTables request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraTablesResponder handles the response to the ListCassandraTables request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraTablesResponder(resp *http.Response) (result CassandraTableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraKeyspaceToAutoscale migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to -// autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", err.Error()) - } - - req, err := client.MigrateCassandraKeyspaceToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraKeyspaceToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraKeyspaceToAutoscalePreparer prepares the MigrateCassandraKeyspaceToAutoscale request. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraKeyspaceToAutoscaleSender sends the MigrateCassandraKeyspaceToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, 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 -} - -// MigrateCassandraKeyspaceToAutoscaleResponder handles the response to the MigrateCassandraKeyspaceToAutoscale request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraKeyspaceToManualThroughput migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", err.Error()) - } - - req, err := client.MigrateCassandraKeyspaceToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraKeyspaceToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraKeyspaceToManualThroughputPreparer prepares the MigrateCassandraKeyspaceToManualThroughput request. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraKeyspaceToManualThroughputSender sends the MigrateCassandraKeyspaceToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, 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 -} - -// MigrateCassandraKeyspaceToManualThroughputResponder handles the response to the MigrateCassandraKeyspaceToManualThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraTableToAutoscale migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", err.Error()) - } - - req, err := client.MigrateCassandraTableToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraTableToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraTableToAutoscalePreparer prepares the MigrateCassandraTableToAutoscale request. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraTableToAutoscaleSender sends the MigrateCassandraTableToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToAutoscaleFuture, 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 -} - -// MigrateCassandraTableToAutoscaleResponder handles the response to the MigrateCassandraTableToAutoscale request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraTableToManualThroughput migrate an Azure Cosmos DB Cassandra table from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", err.Error()) - } - - req, err := client.MigrateCassandraTableToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraTableToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraTableToManualThroughputPreparer prepares the MigrateCassandraTableToManualThroughput request. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraTableToManualThroughputSender sends the MigrateCassandraTableToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToManualThroughputFuture, 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 -} - -// MigrateCassandraTableToManualThroughputResponder handles the response to the MigrateCassandraTableToManualThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraKeyspaceThroughput update RUs per second of an Azure Cosmos DB Cassandra Keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// Keyspace. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraKeyspaceThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.UpdateCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraKeyspaceThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraKeyspaceThroughputPreparer prepares the UpdateCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraKeyspaceThroughputSender sends the UpdateCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, 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 -} - -// UpdateCassandraKeyspaceThroughputResponder handles the response to the UpdateCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraTableThroughput update RUs per second of an Azure Cosmos DB Cassandra table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// table. -func (client CassandraResourcesClient) UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", err.Error()) - } - - req, err := client.UpdateCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraTableThroughputPreparer prepares the UpdateCassandraTableThroughput request. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraTableThroughputSender sends the UpdateCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraTableThroughputFuture, 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 -} - -// UpdateCassandraTableThroughputResponder handles the response to the UpdateCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/client.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/client.go deleted file mode 100644 index 441fa83a45d3..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package documentdb implements the Azure ARM Documentdb service API version . -// -// Azure Cosmos DB Database Service Resource Provider REST API -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Documentdb - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Documentdb. -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/cosmos-db/mgmt/2020-03-01-preview/documentdb/collection.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collection.go deleted file mode 100644 index dd64f9ebb475..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collection.go +++ /dev/null @@ -1,323 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionClient struct { - BaseClient -} - -// NewCollectionClient creates an instance of the CollectionClient client. -func NewCollectionClient(subscriptionID string) CollectionClient { - return NewCollectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionClientWithBaseURI creates an instance of the CollectionClient 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 NewCollectionClientWithBaseURI(baseURI string, subscriptionID string) CollectionClient { - return CollectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -func (client CollectionClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client CollectionClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionpartition.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionpartition.go deleted file mode 100644 index 9fca5560643c..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionpartition.go +++ /dev/null @@ -1,230 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionClient struct { - BaseClient -} - -// NewCollectionPartitionClient creates an instance of the CollectionPartitionClient client. -func NewCollectionPartitionClient(subscriptionID string) CollectionPartitionClient { - return NewCollectionPartitionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionClientWithBaseURI creates an instance of the CollectionPartitionClient 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 NewCollectionPartitionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionClient { - return CollectionPartitionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionPartitionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionUsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionPartitionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListUsagesResponder(resp *http.Response) (result PartitionUsagesResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionpartitionregion.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionpartitionregion.go deleted file mode 100644 index 8381cb8cde0a..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionpartitionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionRegionClient struct { - BaseClient -} - -// NewCollectionPartitionRegionClient creates an instance of the CollectionPartitionRegionClient client. -func NewCollectionPartitionRegionClient(subscriptionID string) CollectionPartitionRegionClient { - return NewCollectionPartitionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionRegionClientWithBaseURI creates an instance of the CollectionPartitionRegionClient 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 NewCollectionPartitionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionRegionClient { - return CollectionPartitionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection and region, split by -// partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionregion.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionregion.go deleted file mode 100644 index f3acff1933ba..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/collectionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionRegionClient struct { - BaseClient -} - -// NewCollectionRegionClient creates an instance of the CollectionRegionClient client. -func NewCollectionRegionClient(subscriptionID string) CollectionRegionClient { - return NewCollectionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionRegionClientWithBaseURI creates an instance of the CollectionRegionClient 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 NewCollectionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionRegionClient { - return CollectionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account, collection and -// region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/database.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/database.go deleted file mode 100644 index 282ce4dd4339..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/database.go +++ /dev/null @@ -1,317 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseClient struct { - BaseClient -} - -// NewDatabaseClient creates an instance of the DatabaseClient client. -func NewDatabaseClient(subscriptionID string) DatabaseClient { - return NewDatabaseClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseClientWithBaseURI creates an instance of the DatabaseClient 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 NewDatabaseClientWithBaseURI(baseURI string, subscriptionID string) DatabaseClient { - return DatabaseClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -func (client DatabaseClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/databaseaccountregion.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/databaseaccountregion.go deleted file mode 100644 index ba406e6ee580..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/databaseaccountregion.go +++ /dev/null @@ -1,129 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountRegionClient struct { - BaseClient -} - -// NewDatabaseAccountRegionClient creates an instance of the DatabaseAccountRegionClient client. -func NewDatabaseAccountRegionClient(subscriptionID string) DatabaseAccountRegionClient { - return NewDatabaseAccountRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountRegionClientWithBaseURI creates an instance of the DatabaseAccountRegionClient 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 NewDatabaseAccountRegionClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountRegionClient { - return DatabaseAccountRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/databaseaccounts.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/databaseaccounts.go deleted file mode 100644 index 0c81f801f920..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/databaseaccounts.go +++ /dev/null @@ -1,1692 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountsClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountsClient struct { - BaseClient -} - -// NewDatabaseAccountsClient creates an instance of the DatabaseAccountsClient client. -func NewDatabaseAccountsClient(subscriptionID string) DatabaseAccountsClient { - return NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountsClientWithBaseURI creates an instance of the DatabaseAccountsClient 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 NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountsClient { - return DatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameExists checks that the Azure Cosmos DB account name already exists. A valid account name may contain only -// lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. -// Parameters: -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.CheckNameExists") - 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: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CheckNameExists", err.Error()) - } - - req, err := client.CheckNameExistsPreparer(ctx, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") - return - } - - result, err = client.CheckNameExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameExistsPreparer prepares the CheckNameExists request. -func (client DatabaseAccountsClient) CheckNameExistsPreparer(ctx context.Context, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameExistsSender sends the CheckNameExists request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) CheckNameExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CheckNameExistsResponder handles the response to the CheckNameExists request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when -// performing updates on an account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// createUpdateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (result DatabaseAccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateParameters, - Constraints: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMaximum, Rule: int64(2147483647), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: int64(86400), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: int64(5), Chain: nil}, - }}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.DatabaseAccountOfferType", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, createUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (*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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(createUpdateParameters), - 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 DatabaseAccountsClient) CreateOrUpdateSender(req *http.Request) (future DatabaseAccountsCreateOrUpdateFuture, 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 DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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 existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseAccountsClient) 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 = "2020-03-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) DeleteSender(req *http.Request) (future DatabaseAccountsDeleteFuture, 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 DatabaseAccountsClient) 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 -} - -// FailoverPriorityChange changes the failover priority for the Azure Cosmos DB database account. A failover priority -// of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover -// priority values must be unique for each of the regions in which the database account exists. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// failoverParameters - the new failover policies for the database account. -func (client DatabaseAccountsClient) FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (result DatabaseAccountsFailoverPriorityChangeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.FailoverPriorityChange") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: failoverParameters, - Constraints: []validation.Constraint{{Target: "failoverParameters.FailoverPolicies", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "FailoverPriorityChange", err.Error()) - } - - req, err := client.FailoverPriorityChangePreparer(ctx, resourceGroupName, accountName, failoverParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") - return - } - - result, err = client.FailoverPriorityChangeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPriorityChangePreparer prepares the FailoverPriorityChange request. -func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (*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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", pathParameters), - autorest.WithJSON(failoverParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverPriorityChangeSender sends the FailoverPriorityChange request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) FailoverPriorityChangeSender(req *http.Request) (future DatabaseAccountsFailoverPriorityChangeFuture, 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 -} - -// FailoverPriorityChangeResponder handles the response to the FailoverPriorityChange request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(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 retrieves the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseAccountsClient) 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 = "2020-03-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) 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 DatabaseAccountsClient) GetResponder(resp *http.Response) (result DatabaseAccountGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.GetReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", err.Error()) - } - - req, err := client.GetReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.GetReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// GetReadOnlyKeysPreparer prepares the GetReadOnlyKeys request. -func (client DatabaseAccountsClient) GetReadOnlyKeysPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetReadOnlyKeysSender sends the GetReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) GetReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetReadOnlyKeysResponder handles the response to the GetReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) GetReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, 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 the Azure Cosmos DB database accounts available under the subscription. -func (client DatabaseAccountsClient) List(ctx context.Context) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DatabaseAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the Azure Cosmos DB database accounts available under the given resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client DatabaseAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DatabaseAccountsClient) 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-03-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.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionStrings lists the connection strings for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListConnectionStrings") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListConnectionStrings", err.Error()) - } - - req, err := client.ListConnectionStringsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionStringsPreparer prepares the ListConnectionStrings request. -func (client DatabaseAccountsClient) ListConnectionStringsPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.Response) (result DatabaseAccountListConnectionStringsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DatabaseAccountsClient) ListKeysPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (result DatabaseAccountListKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions retrieves metric definitions for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseAccountsClient) ListMetricDefinitionsPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountsClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", err.Error()) - } - - req, err := client.ListReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.ListReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListReadOnlyKeysPreparer prepares the ListReadOnlyKeys request. -func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListReadOnlyKeysSender sends the ListReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListReadOnlyKeysResponder handles the response to the ListReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseAccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseAccountsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOffline - cosmos DB region to offline for the database account. -func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (result DatabaseAccountsOfflineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OfflineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOffline, - Constraints: []validation.Constraint{{Target: "regionParameterForOffline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OfflineRegion", err.Error()) - } - - req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOffline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OfflineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OfflineRegionPreparer prepares the OfflineRegion request. -func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (*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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/offlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOffline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OfflineRegionSender sends the OfflineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OfflineRegionSender(req *http.Request) (future DatabaseAccountsOfflineRegionFuture, 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 -} - -// OfflineRegionResponder handles the response to the OfflineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// OnlineRegion online the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOnline - cosmos DB region to online for the database account. -func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (result DatabaseAccountsOnlineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OnlineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOnline, - Constraints: []validation.Constraint{{Target: "regionParameterForOnline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OnlineRegion", err.Error()) - } - - req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOnline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OnlineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OnlineRegionPreparer prepares the OnlineRegion request. -func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (*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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/onlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOnline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OnlineRegionSender sends the OnlineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OnlineRegionSender(req *http.Request) (future DatabaseAccountsOnlineRegionFuture, 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 -} - -// OnlineRegionResponder handles the response to the OnlineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OnlineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateKey regenerates an access key for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyToRegenerate - the name of the key to regenerate. -func (client DatabaseAccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (result DatabaseAccountsRegenerateKeyFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.RegenerateKey") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, keyToRegenerate) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateKeySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DatabaseAccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (*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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(keyToRegenerate), - 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 DatabaseAccountsClient) RegenerateKeySender(req *http.Request) (future DatabaseAccountsRegenerateKeyFuture, 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 -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) RegenerateKeyResponder(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 the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// updateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (result DatabaseAccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabaseAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (*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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 DatabaseAccountsClient) UpdateSender(req *http.Request) (future DatabaseAccountsUpdateFuture, 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 DatabaseAccountsClient) UpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/documentdbapi/interfaces.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/documentdbapi/interfaces.go deleted file mode 100644 index e3feb9c25332..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/documentdbapi/interfaces.go +++ /dev/null @@ -1,272 +0,0 @@ -package documentdbapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/cosmos-db/mgmt/2020-03-01-preview/documentdb" - "github.com/Azure/go-autorest/autorest" -) - -// DatabaseAccountsClientAPI contains the set of methods on the DatabaseAccountsClient type. -type DatabaseAccountsClientAPI interface { - CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters documentdb.DatabaseAccountCreateUpdateParameters) (result documentdb.DatabaseAccountsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountsDeleteFuture, err error) - FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters documentdb.FailoverPolicies) (result documentdb.DatabaseAccountsFailoverPriorityChangeFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountGetResults, err error) - GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - List(ctx context.Context) (result documentdb.DatabaseAccountsListResult, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result documentdb.DatabaseAccountsListResult, err error) - ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListConnectionStringsResult, err error) - ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListKeysResult, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.MetricListResult, err error) - ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.UsagesResult, err error) - OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOfflineRegionFuture, err error) - OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOnlineRegionFuture, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate documentdb.DatabaseAccountRegenerateKeyParameters) (result documentdb.DatabaseAccountsRegenerateKeyFuture, err error) - Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters documentdb.DatabaseAccountUpdateParameters) (result documentdb.DatabaseAccountsUpdateFuture, err error) -} - -var _ DatabaseAccountsClientAPI = (*documentdb.DatabaseAccountsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result documentdb.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result documentdb.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*documentdb.OperationsClient)(nil) - -// DatabaseClientAPI contains the set of methods on the DatabaseClient type. -type DatabaseClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ DatabaseClientAPI = (*documentdb.DatabaseClient)(nil) - -// CollectionClientAPI contains the set of methods on the CollectionClient type. -type CollectionClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ CollectionClientAPI = (*documentdb.CollectionClient)(nil) - -// CollectionRegionClientAPI contains the set of methods on the CollectionRegionClient type. -type CollectionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ CollectionRegionClientAPI = (*documentdb.CollectionRegionClient)(nil) - -// DatabaseAccountRegionClientAPI contains the set of methods on the DatabaseAccountRegionClient type. -type DatabaseAccountRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ DatabaseAccountRegionClientAPI = (*documentdb.DatabaseAccountRegionClient)(nil) - -// PercentileSourceTargetClientAPI contains the set of methods on the PercentileSourceTargetClient type. -type PercentileSourceTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileSourceTargetClientAPI = (*documentdb.PercentileSourceTargetClient)(nil) - -// PercentileTargetClientAPI contains the set of methods on the PercentileTargetClient type. -type PercentileTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileTargetClientAPI = (*documentdb.PercentileTargetClient)(nil) - -// PercentileClientAPI contains the set of methods on the PercentileClient type. -type PercentileClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileClientAPI = (*documentdb.PercentileClient)(nil) - -// CollectionPartitionRegionClientAPI contains the set of methods on the CollectionPartitionRegionClient type. -type CollectionPartitionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ CollectionPartitionRegionClientAPI = (*documentdb.CollectionPartitionRegionClient)(nil) - -// CollectionPartitionClientAPI contains the set of methods on the CollectionPartitionClient type. -type CollectionPartitionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionUsagesResult, err error) -} - -var _ CollectionPartitionClientAPI = (*documentdb.CollectionPartitionClient)(nil) - -// PartitionKeyRangeIDClientAPI contains the set of methods on the PartitionKeyRangeIDClient type. -type PartitionKeyRangeIDClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDClientAPI = (*documentdb.PartitionKeyRangeIDClient)(nil) - -// PartitionKeyRangeIDRegionClientAPI contains the set of methods on the PartitionKeyRangeIDRegionClient type. -type PartitionKeyRangeIDRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDRegionClientAPI = (*documentdb.PartitionKeyRangeIDRegionClient)(nil) - -// SQLResourcesClientAPI contains the set of methods on the SQLResourcesClient type. -type SQLResourcesClientAPI interface { - CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters documentdb.SQLContainerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLContainerFuture, err error) - CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters documentdb.SQLDatabaseCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture, err error) - CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters documentdb.SQLStoredProcedureCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) - CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters documentdb.SQLTriggerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLTriggerFuture, err error) - CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters documentdb.SQLUserDefinedFunctionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) - DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesDeleteSQLContainerFuture, err error) - DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesDeleteSQLDatabaseFuture, err error) - DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLResourcesDeleteSQLStoredProcedureFuture, err error) - DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLResourcesDeleteSQLTriggerFuture, err error) - DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) - GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLContainerGetResults, err error) - GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLDatabaseGetResults, err error) - GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLStoredProcedureGetResults, err error) - GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLTriggerGetResults, err error) - GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLUserDefinedFunctionGetResults, err error) - ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLContainerListResult, err error) - ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLDatabaseListResult, err error) - ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLStoredProcedureListResult, err error) - ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLTriggerListResult, err error) - ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLUserDefinedFunctionListResult, err error) - MigrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) - MigrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) - MigrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) - MigrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) - UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLContainerThroughputFuture, err error) - UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) -} - -var _ SQLResourcesClientAPI = (*documentdb.SQLResourcesClient)(nil) - -// MongoDBResourcesClientAPI contains the set of methods on the MongoDBResourcesClient type. -type MongoDBResourcesClientAPI interface { - CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters documentdb.MongoDBCollectionCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) - CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters documentdb.MongoDBDatabaseCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) - DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture, err error) - DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) - GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBCollectionGetResults, err error) - GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBDatabaseGetResults, err error) - GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBCollectionListResult, err error) - ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MongoDBDatabaseListResult, err error) - MigrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) - MigrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) - MigrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) - MigrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) - UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) - UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) -} - -var _ MongoDBResourcesClientAPI = (*documentdb.MongoDBResourcesClient)(nil) - -// TableResourcesClientAPI contains the set of methods on the TableResourcesClient type. -type TableResourcesClientAPI interface { - CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters documentdb.TableCreateUpdateParameters) (result documentdb.TableResourcesCreateUpdateTableFuture, err error) - DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesDeleteTableFuture, err error) - GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableGetResults, err error) - GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListTables(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.TableListResult, err error) - MigrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesMigrateTableToAutoscaleFuture, err error) - MigrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesMigrateTableToManualThroughputFuture, err error) - UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.TableResourcesUpdateTableThroughputFuture, err error) -} - -var _ TableResourcesClientAPI = (*documentdb.TableResourcesClient)(nil) - -// CassandraResourcesClientAPI contains the set of methods on the CassandraResourcesClient type. -type CassandraResourcesClientAPI interface { - CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters documentdb.CassandraKeyspaceCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) - CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters documentdb.CassandraTableCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraTableFuture, err error) - DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture, err error) - DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesDeleteCassandraTableFuture, err error) - GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraKeyspaceGetResults, err error) - GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraTableGetResults, err error) - GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.CassandraKeyspaceListResult, err error) - ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraTableListResult, err error) - MigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) - MigrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) - MigrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) - MigrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) - UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) - UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture, err error) -} - -var _ CassandraResourcesClientAPI = (*documentdb.CassandraResourcesClient)(nil) - -// GremlinResourcesClientAPI contains the set of methods on the GremlinResourcesClient type. -type GremlinResourcesClientAPI interface { - CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters documentdb.GremlinDatabaseCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) - CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters documentdb.GremlinGraphCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture, err error) - DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesDeleteGremlinDatabaseFuture, err error) - DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesDeleteGremlinGraphFuture, err error) - GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinDatabaseGetResults, err error) - GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinGraphGetResults, err error) - GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.GremlinDatabaseListResult, err error) - ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinGraphListResult, err error) - MigrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) - MigrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) - MigrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) - MigrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) - UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) - UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) -} - -var _ GremlinResourcesClientAPI = (*documentdb.GremlinResourcesClient)(nil) - -// NotebookWorkspacesClientAPI contains the set of methods on the NotebookWorkspacesClient type. -type NotebookWorkspacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters documentdb.NotebookWorkspaceCreateUpdateParameters) (result documentdb.NotebookWorkspacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspace, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceListResult, err error) - ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceConnectionInfoResult, err error) - RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesRegenerateAuthTokenFuture, err error) - Start(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesStartFuture, err error) -} - -var _ NotebookWorkspacesClientAPI = (*documentdb.NotebookWorkspacesClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result documentdb.PrivateLinkResource, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateLinkResourceListResult, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*documentdb.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters documentdb.PrivateEndpointConnection) (result documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnection, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateEndpointConnectionListResult, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*documentdb.PrivateEndpointConnectionsClient)(nil) diff --git a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/enums.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/enums.go deleted file mode 100644 index a2c92786dd60..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/enums.go +++ /dev/null @@ -1,310 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CompositePathSortOrder enumerates the values for composite path sort order. -type CompositePathSortOrder string - -const ( - // Ascending ... - Ascending CompositePathSortOrder = "Ascending" - // Descending ... - Descending CompositePathSortOrder = "Descending" -) - -// PossibleCompositePathSortOrderValues returns an array of possible values for the CompositePathSortOrder const type. -func PossibleCompositePathSortOrderValues() []CompositePathSortOrder { - return []CompositePathSortOrder{Ascending, Descending} -} - -// ConflictResolutionMode enumerates the values for conflict resolution mode. -type ConflictResolutionMode string - -const ( - // Custom ... - Custom ConflictResolutionMode = "Custom" - // LastWriterWins ... - LastWriterWins ConflictResolutionMode = "LastWriterWins" -) - -// PossibleConflictResolutionModeValues returns an array of possible values for the ConflictResolutionMode const type. -func PossibleConflictResolutionModeValues() []ConflictResolutionMode { - return []ConflictResolutionMode{Custom, LastWriterWins} -} - -// ConnectorOffer enumerates the values for connector offer. -type ConnectorOffer string - -const ( - // Small ... - Small ConnectorOffer = "Small" -) - -// PossibleConnectorOfferValues returns an array of possible values for the ConnectorOffer const type. -func PossibleConnectorOfferValues() []ConnectorOffer { - return []ConnectorOffer{Small} -} - -// DatabaseAccountKind enumerates the values for database account kind. -type DatabaseAccountKind string - -const ( - // GlobalDocumentDB ... - GlobalDocumentDB DatabaseAccountKind = "GlobalDocumentDB" - // MongoDB ... - MongoDB DatabaseAccountKind = "MongoDB" - // Parse ... - Parse DatabaseAccountKind = "Parse" -) - -// PossibleDatabaseAccountKindValues returns an array of possible values for the DatabaseAccountKind const type. -func PossibleDatabaseAccountKindValues() []DatabaseAccountKind { - return []DatabaseAccountKind{GlobalDocumentDB, MongoDB, Parse} -} - -// DatabaseAccountOfferType enumerates the values for database account offer type. -type DatabaseAccountOfferType string - -const ( - // Standard ... - Standard DatabaseAccountOfferType = "Standard" -) - -// PossibleDatabaseAccountOfferTypeValues returns an array of possible values for the DatabaseAccountOfferType const type. -func PossibleDatabaseAccountOfferTypeValues() []DatabaseAccountOfferType { - return []DatabaseAccountOfferType{Standard} -} - -// DataType enumerates the values for data type. -type DataType string - -const ( - // LineString ... - LineString DataType = "LineString" - // MultiPolygon ... - MultiPolygon DataType = "MultiPolygon" - // Number ... - Number DataType = "Number" - // Point ... - Point DataType = "Point" - // Polygon ... - Polygon DataType = "Polygon" - // String ... - String DataType = "String" -) - -// PossibleDataTypeValues returns an array of possible values for the DataType const type. -func PossibleDataTypeValues() []DataType { - return []DataType{LineString, MultiPolygon, Number, Point, Polygon, String} -} - -// DefaultConsistencyLevel enumerates the values for default consistency level. -type DefaultConsistencyLevel string - -const ( - // BoundedStaleness ... - BoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" - // ConsistentPrefix ... - ConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" - // Eventual ... - Eventual DefaultConsistencyLevel = "Eventual" - // Session ... - Session DefaultConsistencyLevel = "Session" - // Strong ... - Strong DefaultConsistencyLevel = "Strong" -) - -// PossibleDefaultConsistencyLevelValues returns an array of possible values for the DefaultConsistencyLevel const type. -func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { - return []DefaultConsistencyLevel{BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong} -} - -// IndexingMode enumerates the values for indexing mode. -type IndexingMode string - -const ( - // Consistent ... - Consistent IndexingMode = "Consistent" - // Lazy ... - Lazy IndexingMode = "Lazy" - // None ... - None IndexingMode = "None" -) - -// PossibleIndexingModeValues returns an array of possible values for the IndexingMode const type. -func PossibleIndexingModeValues() []IndexingMode { - return []IndexingMode{Consistent, Lazy, None} -} - -// IndexKind enumerates the values for index kind. -type IndexKind string - -const ( - // Hash ... - Hash IndexKind = "Hash" - // Range ... - Range IndexKind = "Range" - // Spatial ... - Spatial IndexKind = "Spatial" -) - -// PossibleIndexKindValues returns an array of possible values for the IndexKind const type. -func PossibleIndexKindValues() []IndexKind { - return []IndexKind{Hash, Range, Spatial} -} - -// KeyKind enumerates the values for key kind. -type KeyKind string - -const ( - // Primary ... - Primary KeyKind = "primary" - // PrimaryReadonly ... - PrimaryReadonly KeyKind = "primaryReadonly" - // Secondary ... - Secondary KeyKind = "secondary" - // SecondaryReadonly ... - SecondaryReadonly KeyKind = "secondaryReadonly" -) - -// PossibleKeyKindValues returns an array of possible values for the KeyKind const type. -func PossibleKeyKindValues() []KeyKind { - return []KeyKind{Primary, PrimaryReadonly, Secondary, SecondaryReadonly} -} - -// PartitionKind enumerates the values for partition kind. -type PartitionKind string - -const ( - // PartitionKindHash ... - PartitionKindHash PartitionKind = "Hash" - // PartitionKindRange ... - PartitionKindRange PartitionKind = "Range" -) - -// PossiblePartitionKindValues returns an array of possible values for the PartitionKind const type. -func PossiblePartitionKindValues() []PartitionKind { - return []PartitionKind{PartitionKindHash, PartitionKindRange} -} - -// PrimaryAggregationType enumerates the values for primary aggregation type. -type PrimaryAggregationType string - -const ( - // PrimaryAggregationTypeAverage ... - PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" - // PrimaryAggregationTypeLast ... - PrimaryAggregationTypeLast PrimaryAggregationType = "Last" - // PrimaryAggregationTypeMaximum ... - PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" - // PrimaryAggregationTypeMinimum ... - PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" - // PrimaryAggregationTypeNone ... - PrimaryAggregationTypeNone PrimaryAggregationType = "None" - // PrimaryAggregationTypeTotal ... - PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" -) - -// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeLast, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // Disabled ... - Disabled PublicNetworkAccess = "Disabled" - // Enabled ... - Enabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{Disabled, Enabled} -} - -// SpatialType enumerates the values for spatial type. -type SpatialType string - -const ( - // SpatialTypeLineString ... - SpatialTypeLineString SpatialType = "LineString" - // SpatialTypeMultiPolygon ... - SpatialTypeMultiPolygon SpatialType = "MultiPolygon" - // SpatialTypePoint ... - SpatialTypePoint SpatialType = "Point" - // SpatialTypePolygon ... - SpatialTypePolygon SpatialType = "Polygon" -) - -// PossibleSpatialTypeValues returns an array of possible values for the SpatialType const type. -func PossibleSpatialTypeValues() []SpatialType { - return []SpatialType{SpatialTypeLineString, SpatialTypeMultiPolygon, SpatialTypePoint, SpatialTypePolygon} -} - -// TriggerOperation enumerates the values for trigger operation. -type TriggerOperation string - -const ( - // All ... - All TriggerOperation = "All" - // Create ... - Create TriggerOperation = "Create" - // Delete ... - Delete TriggerOperation = "Delete" - // Replace ... - Replace TriggerOperation = "Replace" - // Update ... - Update TriggerOperation = "Update" -) - -// PossibleTriggerOperationValues returns an array of possible values for the TriggerOperation const type. -func PossibleTriggerOperationValues() []TriggerOperation { - return []TriggerOperation{All, Create, Delete, Replace, Update} -} - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // Post ... - Post TriggerType = "Post" - // Pre ... - Pre TriggerType = "Pre" -) - -// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. -func PossibleTriggerTypeValues() []TriggerType { - return []TriggerType{Post, Pre} -} - -// UnitType enumerates the values for unit type. -type UnitType string - -const ( - // Bytes ... - Bytes UnitType = "Bytes" - // BytesPerSecond ... - BytesPerSecond UnitType = "BytesPerSecond" - // Count ... - Count UnitType = "Count" - // CountPerSecond ... - CountPerSecond UnitType = "CountPerSecond" - // Milliseconds ... - Milliseconds UnitType = "Milliseconds" - // Percent ... - Percent UnitType = "Percent" - // Seconds ... - Seconds UnitType = "Seconds" -) - -// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{Bytes, BytesPerSecond, Count, CountPerSecond, Milliseconds, Percent, Seconds} -} diff --git a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/gremlinresources.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/gremlinresources.go deleted file mode 100644 index fa52b8da5186..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/gremlinresources.go +++ /dev/null @@ -1,1595 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GremlinResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type GremlinResourcesClient struct { - BaseClient -} - -// NewGremlinResourcesClient creates an instance of the GremlinResourcesClient client. -func NewGremlinResourcesClient(subscriptionID string) GremlinResourcesClient { - return NewGremlinResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGremlinResourcesClientWithBaseURI creates an instance of the GremlinResourcesClient 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 NewGremlinResourcesClientWithBaseURI(baseURI string, subscriptionID string) GremlinResourcesClient { - return GremlinResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateGremlinDatabase create or update an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateGremlinDatabaseParameters - the parameters to provide for the current Gremlin database. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", err.Error()) - } - - req, err := client.CreateUpdateGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinDatabasePreparer prepares the CreateUpdateGremlinDatabase request. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateGremlinDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinDatabaseSender sends the CreateUpdateGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinDatabaseFuture, 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 -} - -// CreateUpdateGremlinDatabaseResponder handles the response to the CreateUpdateGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateGremlinGraph create or update an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// createUpdateGremlinGraphParameters - the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinGraphParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", err.Error()) - } - - req, err := client.CreateUpdateGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinGraphPreparer prepares the CreateUpdateGremlinGraph request. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithJSON(createUpdateGremlinGraphParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinGraphSender sends the CreateUpdateGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinGraphFuture, 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 -} - -// CreateUpdateGremlinGraphResponder handles the response to the CreateUpdateGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteGremlinDatabase deletes an existing Azure Cosmos DB Gremlin database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesDeleteGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", err.Error()) - } - - req, err := client.DeleteGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinDatabasePreparer prepares the DeleteGremlinDatabase request. -func (client GremlinResourcesClient) DeleteGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinDatabaseSender sends the DeleteGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinDatabaseSender(req *http.Request) (future GremlinResourcesDeleteGremlinDatabaseFuture, 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 -} - -// DeleteGremlinDatabaseResponder handles the response to the DeleteGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinDatabaseResponder(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 -} - -// DeleteGremlinGraph deletes an existing Azure Cosmos DB Gremlin graph. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesDeleteGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinGraph", err.Error()) - } - - req, err := client.DeleteGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinGraphPreparer prepares the DeleteGremlinGraph request. -func (client GremlinResourcesClient) DeleteGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinGraphSender sends the DeleteGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinGraphSender(req *http.Request) (future GremlinResourcesDeleteGremlinGraphFuture, 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 -} - -// DeleteGremlinGraphResponder handles the response to the DeleteGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinGraphResponder(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 -} - -// GetGremlinDatabase gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabase", err.Error()) - } - - req, err := client.GetGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabasePreparer prepares the GetGremlinDatabase request. -func (client GremlinResourcesClient) GetGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseSender sends the GetGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseResponder handles the response to the GetGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinDatabaseThroughput gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.GetGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabaseThroughputPreparer prepares the GetGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseThroughputSender sends the GetGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseThroughputResponder handles the response to the GetGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraph gets the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinGraphGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraph") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraph", err.Error()) - } - - req, err := client.GetGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphPreparer prepares the GetGremlinGraph request. -func (client GremlinResourcesClient) GetGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphSender sends the GetGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphResponder handles the response to the GetGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraphThroughput gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with -// the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraphThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", err.Error()) - } - - req, err := client.GetGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphThroughputPreparer prepares the GetGremlinGraphThroughput request. -func (client GremlinResourcesClient) GetGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphThroughputSender sends the GetGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphThroughputResponder handles the response to the GetGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinDatabases lists the Gremlin databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client GremlinResourcesClient) ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result GremlinDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinDatabases", err.Error()) - } - - req, err := client.ListGremlinDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinDatabasesPreparer prepares the ListGremlinDatabases request. -func (client GremlinResourcesClient) ListGremlinDatabasesPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinDatabasesSender sends the ListGremlinDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinDatabasesResponder handles the response to the ListGremlinDatabases request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinDatabasesResponder(resp *http.Response) (result GremlinDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinGraphs lists the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinGraphListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinGraphs") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinGraphs", err.Error()) - } - - req, err := client.ListGremlinGraphsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinGraphsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinGraphsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinGraphsPreparer prepares the ListGremlinGraphs request. -func (client GremlinResourcesClient) ListGremlinGraphsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinGraphsSender sends the ListGremlinGraphs request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinGraphsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinGraphsResponder handles the response to the ListGremlinGraphs request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinGraphsResponder(resp *http.Response) (result GremlinGraphListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinDatabaseToAutoscale migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateGremlinDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinDatabaseToAutoscalePreparer prepares the MigrateGremlinDatabaseToAutoscale request. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinDatabaseToAutoscaleSender sends the MigrateGremlinDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, 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 -} - -// MigrateGremlinDatabaseToAutoscaleResponder handles the response to the MigrateGremlinDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinDatabaseToManualThroughput migrate an Azure Cosmos DB Gremlin database from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateGremlinDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinDatabaseToManualThroughputPreparer prepares the MigrateGremlinDatabaseToManualThroughput request. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinDatabaseToManualThroughputSender sends the MigrateGremlinDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, 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 -} - -// MigrateGremlinDatabaseToManualThroughputResponder handles the response to the MigrateGremlinDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinGraphToAutoscale migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", err.Error()) - } - - req, err := client.MigrateGremlinGraphToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinGraphToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinGraphToAutoscalePreparer prepares the MigrateGremlinGraphToAutoscale request. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinGraphToAutoscaleSender sends the MigrateGremlinGraphToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, 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 -} - -// MigrateGremlinGraphToAutoscaleResponder handles the response to the MigrateGremlinGraphToAutoscale request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinGraphToManualThroughput migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", err.Error()) - } - - req, err := client.MigrateGremlinGraphToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinGraphToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinGraphToManualThroughputPreparer prepares the MigrateGremlinGraphToManualThroughput request. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinGraphToManualThroughputSender sends the MigrateGremlinGraphToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, 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 -} - -// MigrateGremlinGraphToManualThroughputResponder handles the response to the MigrateGremlinGraphToManualThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinDatabaseThroughput update RUs per second of an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin -// database. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinDatabaseThroughputPreparer prepares the UpdateGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinDatabaseThroughputSender sends the UpdateGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinDatabaseThroughputFuture, 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 -} - -// UpdateGremlinDatabaseThroughputResponder handles the response to the UpdateGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinGraphThroughput update RUs per second of an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinGraphThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", err.Error()) - } - - req, err := client.UpdateGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinGraphThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinGraphThroughputPreparer prepares the UpdateGremlinGraphThroughput request. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinGraphThroughputSender sends the UpdateGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinGraphThroughputFuture, 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 -} - -// UpdateGremlinGraphThroughputResponder handles the response to the UpdateGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/models.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/models.go deleted file mode 100644 index 003f9a7cd49a..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/models.go +++ /dev/null @@ -1,8001 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb" - -// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other -// than required location and tags -type ARMProxyResource struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ARMProxyResource. -func (apr ARMProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ARMResourceProperties the core properties of ARM resources. -type ARMResourceProperties struct { - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ARMResourceProperties. -func (arp ARMResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Location != nil { - objectMap["location"] = arp.Location - } - if arp.Tags != nil { - objectMap["tags"] = arp.Tags - } - return json.Marshal(objectMap) -} - -// AutoUpgradePolicyResource cosmos DB resource auto-upgrade policy -type AutoUpgradePolicyResource struct { - // ThroughputPolicy - Represents throughput policy which service must adhere to for auto-upgrade - ThroughputPolicy *ThroughputPolicyResource `json:"throughputPolicy,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) -} - -// Capability cosmos DB capability object -type Capability struct { - // Name - Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". - Name *string `json:"name,omitempty"` -} - -// CassandraKeyspaceCreateUpdateParameters parameters to create and update Cosmos DB Cassandra keyspace. -type CassandraKeyspaceCreateUpdateParameters struct { - // CassandraKeyspaceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra keyspace. - *CassandraKeyspaceCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceCreateUpdateParameters. -func (ckcup CassandraKeyspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckcup.CassandraKeyspaceCreateUpdateProperties != nil { - objectMap["properties"] = ckcup.CassandraKeyspaceCreateUpdateProperties - } - if ckcup.Location != nil { - objectMap["location"] = ckcup.Location - } - if ckcup.Tags != nil { - objectMap["tags"] = ckcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceCreateUpdateParameters struct. -func (ckcup *CassandraKeyspaceCreateUpdateParameters) 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 cassandraKeyspaceCreateUpdateProperties CassandraKeyspaceCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraKeyspaceCreateUpdateProperties) - if err != nil { - return err - } - ckcup.CassandraKeyspaceCreateUpdateProperties = &cassandraKeyspaceCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckcup.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra -// keyspace. -type CassandraKeyspaceCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra keyspace - Resource *CassandraKeyspaceResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetProperties the properties of an Azure Cosmos DB Cassandra keyspace -type CassandraKeyspaceGetProperties struct { - Resource *CassandraKeyspaceGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraKeyspaceGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetPropertiesOptions ... -type CassandraKeyspaceGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// CassandraKeyspaceGetPropertiesResource ... -type CassandraKeyspaceGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetPropertiesResource. -func (ckgp CassandraKeyspaceGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgp.ID != nil { - objectMap["id"] = ckgp.ID - } - return json.Marshal(objectMap) -} - -// CassandraKeyspaceGetResults an Azure Cosmos DB Cassandra keyspace. -type CassandraKeyspaceGetResults struct { - autorest.Response `json:"-"` - // CassandraKeyspaceGetProperties - The properties of an Azure Cosmos DB Cassandra keyspace - *CassandraKeyspaceGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetResults. -func (ckgr CassandraKeyspaceGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgr.CassandraKeyspaceGetProperties != nil { - objectMap["properties"] = ckgr.CassandraKeyspaceGetProperties - } - if ckgr.Location != nil { - objectMap["location"] = ckgr.Location - } - if ckgr.Tags != nil { - objectMap["tags"] = ckgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceGetResults struct. -func (ckgr *CassandraKeyspaceGetResults) 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 cassandraKeyspaceGetProperties CassandraKeyspaceGetProperties - err = json.Unmarshal(*v, &cassandraKeyspaceGetProperties) - if err != nil { - return err - } - ckgr.CassandraKeyspaceGetProperties = &cassandraKeyspaceGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckgr.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceListResult the List operation response, that contains the Cassandra keyspaces and their -// properties. -type CassandraKeyspaceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra keyspaces and their properties. - Value *[]CassandraKeyspaceGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceListResult. -func (cklr CassandraKeyspaceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraKeyspaceResource cosmos DB Cassandra keyspace resource object -type CassandraKeyspaceResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` -} - -// CassandraPartitionKey cosmos DB Cassandra table partition key -type CassandraPartitionKey struct { - // Name - Name of the Cosmos DB Cassandra table partition key - Name *string `json:"name,omitempty"` -} - -// CassandraResourcesCreateUpdateCassandraKeyspaceFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraKeyspaceGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) 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 CassandraResourcesCreateUpdateCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ckgr CassandraKeyspaceGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ckgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ckgr.Response.Response, err = future.GetResult(sender); err == nil && ckgr.Response.Response.StatusCode != http.StatusNoContent { - ckgr, err = client.CreateUpdateCassandraKeyspaceResponder(ckgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", ckgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraTableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) 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 CassandraResourcesCreateUpdateCassandraTableFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) result(client CassandraResourcesClient) (ctgr CassandraTableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ctgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ctgr.Response.Response, err = future.GetResult(sender); err == nil && ctgr.Response.Response.StatusCode != http.StatusNoContent { - ctgr, err = client.CreateUpdateCassandraTableResponder(ctgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", ctgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type CassandraResourcesDeleteCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) 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 CassandraResourcesDeleteCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type CassandraResourcesDeleteCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraTableFuture) 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 CassandraResourcesDeleteCassandraTableFuture.Result. -func (future *CassandraResourcesDeleteCassandraTableFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraTableFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture) 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 CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture.Result. -func (future *CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraKeyspaceToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture) 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 CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture.Result. -func (future *CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraKeyspaceToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraTableToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesMigrateCassandraTableToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraTableToAutoscaleFuture) 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 CassandraResourcesMigrateCassandraTableToAutoscaleFuture.Result. -func (future *CassandraResourcesMigrateCassandraTableToAutoscaleFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraTableToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraTableToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type CassandraResourcesMigrateCassandraTableToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraTableToManualThroughputFuture) 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 CassandraResourcesMigrateCassandraTableToManualThroughputFuture.Result. -func (future *CassandraResourcesMigrateCassandraTableToManualThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraTableToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesUpdateCassandraKeyspaceThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) 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 CassandraResourcesUpdateCassandraKeyspaceThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraKeyspaceThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraTableThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesUpdateCassandraTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) 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 CassandraResourcesUpdateCassandraTableThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraSchema cosmos DB Cassandra table schema -type CassandraSchema struct { - // Columns - List of Cassandra table columns. - Columns *[]Column `json:"columns,omitempty"` - // PartitionKeys - List of partition key. - PartitionKeys *[]CassandraPartitionKey `json:"partitionKeys,omitempty"` - // ClusterKeys - List of cluster key. - ClusterKeys *[]ClusterKey `json:"clusterKeys,omitempty"` -} - -// CassandraTableCreateUpdateParameters parameters to create and update Cosmos DB Cassandra table. -type CassandraTableCreateUpdateParameters struct { - // CassandraTableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra table. - *CassandraTableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableCreateUpdateParameters. -func (ctcup CassandraTableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcup.CassandraTableCreateUpdateProperties != nil { - objectMap["properties"] = ctcup.CassandraTableCreateUpdateProperties - } - if ctcup.Location != nil { - objectMap["location"] = ctcup.Location - } - if ctcup.Tags != nil { - objectMap["tags"] = ctcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableCreateUpdateParameters struct. -func (ctcup *CassandraTableCreateUpdateParameters) 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 cassandraTableCreateUpdateProperties CassandraTableCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraTableCreateUpdateProperties) - if err != nil { - return err - } - ctcup.CassandraTableCreateUpdateProperties = &cassandraTableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctcup.Tags = tags - } - } - } - - return nil -} - -// CassandraTableCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra table. -type CassandraTableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra table - Resource *CassandraTableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraTableGetProperties the properties of an Azure Cosmos DB Cassandra table -type CassandraTableGetProperties struct { - Resource *CassandraTableGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraTableGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraTableGetPropertiesOptions ... -type CassandraTableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// CassandraTableGetPropertiesResource ... -type CassandraTableGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetPropertiesResource. -func (ctgp CassandraTableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgp.ID != nil { - objectMap["id"] = ctgp.ID - } - if ctgp.DefaultTTL != nil { - objectMap["defaultTtl"] = ctgp.DefaultTTL - } - if ctgp.Schema != nil { - objectMap["schema"] = ctgp.Schema - } - return json.Marshal(objectMap) -} - -// CassandraTableGetResults an Azure Cosmos DB Cassandra table. -type CassandraTableGetResults struct { - autorest.Response `json:"-"` - // CassandraTableGetProperties - The properties of an Azure Cosmos DB Cassandra table - *CassandraTableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetResults. -func (ctgr CassandraTableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgr.CassandraTableGetProperties != nil { - objectMap["properties"] = ctgr.CassandraTableGetProperties - } - if ctgr.Location != nil { - objectMap["location"] = ctgr.Location - } - if ctgr.Tags != nil { - objectMap["tags"] = ctgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableGetResults struct. -func (ctgr *CassandraTableGetResults) 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 cassandraTableGetProperties CassandraTableGetProperties - err = json.Unmarshal(*v, &cassandraTableGetProperties) - if err != nil { - return err - } - ctgr.CassandraTableGetProperties = &cassandraTableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctgr.Tags = tags - } - } - } - - return nil -} - -// CassandraTableListResult the List operation response, that contains the Cassandra tables and their -// properties. -type CassandraTableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra tables and their properties. - Value *[]CassandraTableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableListResult. -func (ctlr CassandraTableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraTableResource cosmos DB Cassandra table resource object -type CassandraTableResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` -} - -// ClusterKey cosmos DB Cassandra table cluster key -type ClusterKey struct { - // Name - Name of the Cosmos DB Cassandra table cluster key - Name *string `json:"name,omitempty"` - // OrderBy - Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" - OrderBy *string `json:"orderBy,omitempty"` -} - -// Column cosmos DB Cassandra table column -type Column struct { - // Name - Name of the Cosmos DB Cassandra table column - Name *string `json:"name,omitempty"` - // Type - Type of the Cosmos DB Cassandra table column - Type *string `json:"type,omitempty"` -} - -// CompositePath ... -type CompositePath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Order - Sort order for composite paths. Possible values include: 'Ascending', 'Descending' - Order CompositePathSortOrder `json:"order,omitempty"` -} - -// ConflictResolutionPolicy the conflict resolution policy for the container. -type ConflictResolutionPolicy struct { - // Mode - Indicates the conflict resolution mode. Possible values include: 'LastWriterWins', 'Custom' - Mode ConflictResolutionMode `json:"mode,omitempty"` - // ConflictResolutionPath - The conflict resolution path in the case of LastWriterWins mode. - ConflictResolutionPath *string `json:"conflictResolutionPath,omitempty"` - // ConflictResolutionProcedure - The procedure to resolve conflicts in the case of custom mode. - ConflictResolutionProcedure *string `json:"conflictResolutionProcedure,omitempty"` -} - -// ConsistencyPolicy the consistency policy for the Cosmos DB database account. -type ConsistencyPolicy struct { - // DefaultConsistencyLevel - The default consistency level and configuration settings of the Cosmos DB account. Possible values include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix' - DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` - // MaxStalenessPrefix - When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` - // MaxIntervalInSeconds - When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` -} - -// ContainerPartitionKey the configuration of the partition key to be used for partitioning data into -// multiple partitions -type ContainerPartitionKey struct { - // Paths - List of paths using which data within the container can be partitioned - Paths *[]string `json:"paths,omitempty"` - // Kind - Indicates the kind of algorithm used for partitioning. Possible values include: 'PartitionKindHash', 'PartitionKindRange' - Kind PartitionKind `json:"kind,omitempty"` - // Version - Indicates the version of the partition key definition - Version *int32 `json:"version,omitempty"` -} - -// CreateUpdateOptions createUpdateOptions are a list of key-value pairs that describe the resource. -// Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" -type CreateUpdateOptions struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]*string `json:""` - // Throughput - Request Units per second. For example, "throughput": "10000". - Throughput *string `json:"throughput,omitempty"` -} - -// MarshalJSON is the custom marshaler for CreateUpdateOptions. -func (cuo CreateUpdateOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cuo.Throughput != nil { - objectMap["throughput"] = cuo.Throughput - } - for k, v := range cuo.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CreateUpdateOptions struct. -func (cuo *CreateUpdateOptions) 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 { - default: - if v != nil { - var additionalProperties string - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if cuo.AdditionalProperties == nil { - cuo.AdditionalProperties = make(map[string]*string) - } - cuo.AdditionalProperties[k] = &additionalProperties - } - case "throughput": - if v != nil { - var throughput string - err = json.Unmarshal(*v, &throughput) - if err != nil { - return err - } - cuo.Throughput = &throughput - } - } - } - - return nil -} - -// DatabaseAccountConnectionString connection string for the Cosmos DB account -type DatabaseAccountConnectionString struct { - // ConnectionString - READ-ONLY; Value of the connection string - ConnectionString *string `json:"connectionString,omitempty"` - // Description - READ-ONLY; Description of the connection string - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountConnectionString. -func (dacs DatabaseAccountConnectionString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountCreateUpdateParameters parameters to create and update Cosmos DB database accounts. -type DatabaseAccountCreateUpdateParameters struct { - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountCreateUpdateParameters. -func (dacup DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dacup.Kind != "" { - objectMap["kind"] = dacup.Kind - } - if dacup.DatabaseAccountCreateUpdateProperties != nil { - objectMap["properties"] = dacup.DatabaseAccountCreateUpdateProperties - } - if dacup.Location != nil { - objectMap["location"] = dacup.Location - } - if dacup.Tags != nil { - objectMap["tags"] = dacup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateParameters struct. -func (dacup *DatabaseAccountCreateUpdateParameters) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dacup.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountCreateUpdateProperties DatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &databaseAccountCreateUpdateProperties) - if err != nil { - return err - } - dacup.DatabaseAccountCreateUpdateProperties = &databaseAccountCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dacup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dacup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dacup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dacup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dacup.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountCreateUpdateProperties properties to create and update Azure Cosmos DB database accounts. -type DatabaseAccountCreateUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRangeFilter - Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// DatabaseAccountGetProperties properties for the database account. -type DatabaseAccountGetProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the Cosmos DB database account. - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - // DatabaseAccountOfferType - READ-ONLY; The offer type for the Cosmos DB database account. Default value: Standard. Possible values include: 'Standard' - DatabaseAccountOfferType DatabaseAccountOfferType `json:"databaseAccountOfferType,omitempty"` - // IPRangeFilter - Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // ConsistencyPolicy - The consistency policy for the Cosmos DB database account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // WriteLocations - READ-ONLY; An array that contains the write location for the Cosmos DB account. - WriteLocations *[]Location `json:"writeLocations,omitempty"` - // ReadLocations - READ-ONLY; An array that contains of the read locations enabled for the Cosmos DB account. - ReadLocations *[]Location `json:"readLocations,omitempty"` - // Locations - READ-ONLY; An array that contains all of the locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // FailoverPolicies - READ-ONLY; An array that contains the regions ordered by their failover priorities. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of Private Endpoint Connections configured for the Cosmos DB account. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetProperties. -func (dagp DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagp.ProvisioningState != nil { - objectMap["provisioningState"] = dagp.ProvisioningState - } - if dagp.IPRangeFilter != nil { - objectMap["ipRangeFilter"] = dagp.IPRangeFilter - } - if dagp.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = dagp.IsVirtualNetworkFilterEnabled - } - if dagp.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = dagp.EnableAutomaticFailover - } - if dagp.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = dagp.ConsistencyPolicy - } - if dagp.Capabilities != nil { - objectMap["capabilities"] = dagp.Capabilities - } - if dagp.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = dagp.VirtualNetworkRules - } - if dagp.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = dagp.EnableMultipleWriteLocations - } - if dagp.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = dagp.EnableCassandraConnector - } - if dagp.ConnectorOffer != "" { - objectMap["connectorOffer"] = dagp.ConnectorOffer - } - if dagp.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = dagp.DisableKeyBasedMetadataWriteAccess - } - if dagp.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = dagp.KeyVaultKeyURI - } - if dagp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = dagp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// DatabaseAccountGetResults an Azure Cosmos DB database account. -type DatabaseAccountGetResults struct { - autorest.Response `json:"-"` - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetResults. -func (dagr DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagr.Kind != "" { - objectMap["kind"] = dagr.Kind - } - if dagr.DatabaseAccountGetProperties != nil { - objectMap["properties"] = dagr.DatabaseAccountGetProperties - } - if dagr.Location != nil { - objectMap["location"] = dagr.Location - } - if dagr.Tags != nil { - objectMap["tags"] = dagr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetResults struct. -func (dagr *DatabaseAccountGetResults) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dagr.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountGetProperties DatabaseAccountGetProperties - err = json.Unmarshal(*v, &databaseAccountGetProperties) - if err != nil { - return err - } - dagr.DatabaseAccountGetProperties = &databaseAccountGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dagr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dagr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dagr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dagr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dagr.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountListConnectionStringsResult the connection strings for the given database account. -type DatabaseAccountListConnectionStringsResult struct { - autorest.Response `json:"-"` - // ConnectionStrings - An array that contains the connection strings for the Cosmos DB account. - ConnectionStrings *[]DatabaseAccountConnectionString `json:"connectionStrings,omitempty"` -} - -// DatabaseAccountListKeysResult the access keys for the given database account. -type DatabaseAccountListKeysResult struct { - autorest.Response `json:"-"` - // PrimaryMasterKey - READ-ONLY; Base 64 encoded value of the primary read-write key. - PrimaryMasterKey *string `json:"primaryMasterKey,omitempty"` - // SecondaryMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-write key. - SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListKeysResult. -func (dalkr DatabaseAccountListKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountListReadOnlyKeysResult the read-only access keys for the given database account. -type DatabaseAccountListReadOnlyKeysResult struct { - autorest.Response `json:"-"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListReadOnlyKeysResult. -func (dalrokr DatabaseAccountListReadOnlyKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountRegenerateKeyParameters parameters to regenerate the keys within the database account. -type DatabaseAccountRegenerateKeyParameters struct { - // KeyKind - The access key to regenerate. Possible values include: 'Primary', 'Secondary', 'PrimaryReadonly', 'SecondaryReadonly' - KeyKind KeyKind `json:"keyKind,omitempty"` -} - -// DatabaseAccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsCreateOrUpdateFuture) 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 DatabaseAccountsCreateOrUpdateFuture.Result. -func (future *DatabaseAccountsCreateOrUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.CreateOrUpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsDeleteFuture) 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 DatabaseAccountsDeleteFuture.Result. -func (future *DatabaseAccountsDeleteFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsFailoverPriorityChangeFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type DatabaseAccountsFailoverPriorityChangeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) 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 DatabaseAccountsFailoverPriorityChangeFuture.Result. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsFailoverPriorityChangeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsFailoverPriorityChangeFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsListResult the List operation response, that contains the database accounts and their -// properties. -type DatabaseAccountsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of database account and their properties. - Value *[]DatabaseAccountGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountsListResult. -func (dalr DatabaseAccountsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountsOfflineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOfflineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOfflineRegionFuture) 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 DatabaseAccountsOfflineRegionFuture.Result. -func (future *DatabaseAccountsOfflineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOfflineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsOnlineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOnlineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOnlineRegionFuture) 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 DatabaseAccountsOnlineRegionFuture.Result. -func (future *DatabaseAccountsOnlineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOnlineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsRegenerateKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsRegenerateKeyFuture) 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 DatabaseAccountsRegenerateKeyFuture.Result. -func (future *DatabaseAccountsRegenerateKeyFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsRegenerateKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsRegenerateKeyFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsUpdateFuture) 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 DatabaseAccountsUpdateFuture.Result. -func (future *DatabaseAccountsUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.UpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountUpdateParameters parameters for patching Azure Cosmos DB database account properties. -type DatabaseAccountUpdateParameters struct { - Tags map[string]*string `json:"tags"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - *DatabaseAccountUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountUpdateParameters. -func (daup DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if daup.Tags != nil { - objectMap["tags"] = daup.Tags - } - if daup.Location != nil { - objectMap["location"] = daup.Location - } - if daup.DatabaseAccountUpdateProperties != nil { - objectMap["properties"] = daup.DatabaseAccountUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateParameters struct. -func (daup *DatabaseAccountUpdateParameters) 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 - } - daup.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - daup.Location = &location - } - case "properties": - if v != nil { - var databaseAccountUpdateProperties DatabaseAccountUpdateProperties - err = json.Unmarshal(*v, &databaseAccountUpdateProperties) - if err != nil { - return err - } - daup.DatabaseAccountUpdateProperties = &databaseAccountUpdateProperties - } - } - } - - return nil -} - -// DatabaseAccountUpdateProperties properties to update Azure Cosmos DB database accounts. -type DatabaseAccountUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // IPRangeFilter - Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// ErrorResponse 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"` -} - -// ExcludedPath ... -type ExcludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` -} - -// ExtendedResourceProperties the system generated resource properties associated with SQL databases, SQL -// containers, Gremlin databases and Gremlin graphs. -type ExtendedResourceProperties struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedResourceProperties. -func (erp ExtendedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverPolicies the list of new failover policies for the failover priority change. -type FailoverPolicies struct { - // FailoverPolicies - List of failover policies. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` -} - -// FailoverPolicy the failover policy for a given region of a database account. -type FailoverPolicy struct { - // ID - READ-ONLY; The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region in which the database account exists. - LocationName *string `json:"locationName,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverPolicy. -func (fp FailoverPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.LocationName != nil { - objectMap["locationName"] = fp.LocationName - } - if fp.FailoverPriority != nil { - objectMap["failoverPriority"] = fp.FailoverPriority - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseCreateUpdateParameters parameters to create and update Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateParameters struct { - // GremlinDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin database. - *GremlinDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseCreateUpdateParameters. -func (gdcup GremlinDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdcup.GremlinDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = gdcup.GremlinDatabaseCreateUpdateProperties - } - if gdcup.Location != nil { - objectMap["location"] = gdcup.Location - } - if gdcup.Tags != nil { - objectMap["tags"] = gdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseCreateUpdateParameters struct. -func (gdcup *GremlinDatabaseCreateUpdateParameters) 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 gremlinDatabaseCreateUpdateProperties GremlinDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinDatabaseCreateUpdateProperties) - if err != nil { - return err - } - gdcup.GremlinDatabaseCreateUpdateProperties = &gremlinDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdcup.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin database - Resource *GremlinDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type GremlinDatabaseGetProperties struct { - Resource *GremlinDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetPropertiesOptions ... -type GremlinDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// GremlinDatabaseGetPropertiesResource ... -type GremlinDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetPropertiesResource. -func (gdgp GremlinDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgp.ID != nil { - objectMap["id"] = gdgp.ID - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseGetResults an Azure Cosmos DB Gremlin database. -type GremlinDatabaseGetResults struct { - autorest.Response `json:"-"` - // GremlinDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *GremlinDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetResults. -func (gdgr GremlinDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgr.GremlinDatabaseGetProperties != nil { - objectMap["properties"] = gdgr.GremlinDatabaseGetProperties - } - if gdgr.Location != nil { - objectMap["location"] = gdgr.Location - } - if gdgr.Tags != nil { - objectMap["tags"] = gdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseGetResults struct. -func (gdgr *GremlinDatabaseGetResults) 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 gremlinDatabaseGetProperties GremlinDatabaseGetProperties - err = json.Unmarshal(*v, &gremlinDatabaseGetProperties) - if err != nil { - return err - } - gdgr.GremlinDatabaseGetProperties = &gremlinDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdgr.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseListResult the List operation response, that contains the Gremlin databases and their -// properties. -type GremlinDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Gremlin databases and their properties. - Value *[]GremlinDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseListResult. -func (gdlr GremlinDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinDatabaseResource cosmos DB Gremlin database resource object -type GremlinDatabaseResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` -} - -// GremlinGraphCreateUpdateParameters parameters to create and update Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateParameters struct { - // GremlinGraphCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin graph. - *GremlinGraphCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphCreateUpdateParameters. -func (ggcup GremlinGraphCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ggcup.GremlinGraphCreateUpdateProperties != nil { - objectMap["properties"] = ggcup.GremlinGraphCreateUpdateProperties - } - if ggcup.Location != nil { - objectMap["location"] = ggcup.Location - } - if ggcup.Tags != nil { - objectMap["tags"] = ggcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphCreateUpdateParameters struct. -func (ggcup *GremlinGraphCreateUpdateParameters) 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 gremlinGraphCreateUpdateProperties GremlinGraphCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinGraphCreateUpdateProperties) - if err != nil { - return err - } - ggcup.GremlinGraphCreateUpdateProperties = &gremlinGraphCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ggcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ggcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ggcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ggcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ggcup.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin graph - Resource *GremlinGraphResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinGraphGetProperties the properties of an Azure Cosmos DB Gremlin graph -type GremlinGraphGetProperties struct { - Resource *GremlinGraphGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinGraphGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinGraphGetPropertiesOptions ... -type GremlinGraphGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// GremlinGraphGetPropertiesResource ... -type GremlinGraphGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetPropertiesResource. -func (gggp GremlinGraphGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggp.ID != nil { - objectMap["id"] = gggp.ID - } - if gggp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = gggp.IndexingPolicy - } - if gggp.PartitionKey != nil { - objectMap["partitionKey"] = gggp.PartitionKey - } - if gggp.DefaultTTL != nil { - objectMap["defaultTtl"] = gggp.DefaultTTL - } - if gggp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = gggp.UniqueKeyPolicy - } - if gggp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = gggp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// GremlinGraphGetResults an Azure Cosmos DB Gremlin graph. -type GremlinGraphGetResults struct { - autorest.Response `json:"-"` - // GremlinGraphGetProperties - The properties of an Azure Cosmos DB Gremlin graph - *GremlinGraphGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetResults. -func (gggr GremlinGraphGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggr.GremlinGraphGetProperties != nil { - objectMap["properties"] = gggr.GremlinGraphGetProperties - } - if gggr.Location != nil { - objectMap["location"] = gggr.Location - } - if gggr.Tags != nil { - objectMap["tags"] = gggr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphGetResults struct. -func (gggr *GremlinGraphGetResults) 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 gremlinGraphGetProperties GremlinGraphGetProperties - err = json.Unmarshal(*v, &gremlinGraphGetProperties) - if err != nil { - return err - } - gggr.GremlinGraphGetProperties = &gremlinGraphGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gggr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gggr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gggr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gggr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gggr.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphListResult the List operation response, that contains the graphs and their properties. -type GremlinGraphListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of graphs and their properties. - Value *[]GremlinGraphGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphListResult. -func (gglr GremlinGraphListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinGraphResource cosmos DB Gremlin graph resource object -type GremlinGraphResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// GremlinResourcesCreateUpdateGremlinDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesCreateUpdateGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) 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 GremlinResourcesCreateUpdateGremlinDatabaseFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) result(client GremlinResourcesClient) (gdgr GremlinDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gdgr.Response.Response, err = future.GetResult(sender); err == nil && gdgr.Response.Response.StatusCode != http.StatusNoContent { - gdgr, err = client.CreateUpdateGremlinDatabaseResponder(gdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", gdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesCreateUpdateGremlinGraphFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type GremlinResourcesCreateUpdateGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinGraphGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) 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 GremlinResourcesCreateUpdateGremlinGraphFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) result(client GremlinResourcesClient) (gggr GremlinGraphGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gggr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gggr.Response.Response, err = future.GetResult(sender); err == nil && gggr.Response.Response.StatusCode != http.StatusNoContent { - gggr, err = client.CreateUpdateGremlinGraphResponder(gggr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", gggr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesDeleteGremlinDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type GremlinResourcesDeleteGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) 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 GremlinResourcesDeleteGremlinDatabaseFuture.Result. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesDeleteGremlinGraphFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GremlinResourcesDeleteGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinGraphFuture) 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 GremlinResourcesDeleteGremlinGraphFuture.Result. -func (future *GremlinResourcesDeleteGremlinGraphFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinGraphFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture) 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 GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture.Result. -func (future *GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture) 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 GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture.Result. -func (future *GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinGraphToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesMigrateGremlinGraphToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinGraphToAutoscaleFuture) 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 GremlinResourcesMigrateGremlinGraphToAutoscaleFuture.Result. -func (future *GremlinResourcesMigrateGremlinGraphToAutoscaleFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinGraphToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinGraphToManualThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type GremlinResourcesMigrateGremlinGraphToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinGraphToManualThroughputFuture) 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 GremlinResourcesMigrateGremlinGraphToManualThroughputFuture.Result. -func (future *GremlinResourcesMigrateGremlinGraphToManualThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinGraphToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) 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 GremlinResourcesUpdateGremlinDatabaseThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinGraphThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinGraphThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) 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 GremlinResourcesUpdateGremlinGraphThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinGraphThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// IncludedPath the paths that are included in indexing -type IncludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Indexes - List of indexes for this path - Indexes *[]Indexes `json:"indexes,omitempty"` -} - -// Indexes the indexes for the path. -type Indexes struct { - // DataType - The datatype for which the indexing behavior is applied to. Possible values include: 'String', 'Number', 'Point', 'Polygon', 'LineString', 'MultiPolygon' - DataType DataType `json:"dataType,omitempty"` - // Precision - The precision of the index. -1 is maximum precision. - Precision *int32 `json:"precision,omitempty"` - // Kind - Indicates the type of index. Possible values include: 'Hash', 'Range', 'Spatial' - Kind IndexKind `json:"kind,omitempty"` -} - -// IndexingPolicy cosmos DB indexing policy -type IndexingPolicy struct { - // Automatic - Indicates if the indexing policy is automatic - Automatic *bool `json:"automatic,omitempty"` - // IndexingMode - Indicates the indexing mode. Possible values include: 'Consistent', 'Lazy', 'None' - IndexingMode IndexingMode `json:"indexingMode,omitempty"` - // IncludedPaths - List of paths to include in the indexing - IncludedPaths *[]IncludedPath `json:"includedPaths,omitempty"` - // ExcludedPaths - List of paths to exclude from indexing - ExcludedPaths *[]ExcludedPath `json:"excludedPaths,omitempty"` - // CompositeIndexes - List of composite path list - CompositeIndexes *[][]CompositePath `json:"compositeIndexes,omitempty"` - // SpatialIndexes - List of spatial specifics - SpatialIndexes *[]SpatialSpec `json:"spatialIndexes,omitempty"` -} - -// Location a region in which the Azure Cosmos DB database account is deployed. -type Location struct { - // ID - READ-ONLY; The unique identifier of the region within the database account. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region. - LocationName *string `json:"locationName,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` - // IsZoneRedundant - Flag to indicate whether or not this region is an AvailabilityZone region - IsZoneRedundant *bool `json:"isZoneRedundant,omitempty"` -} - -// MarshalJSON is the custom marshaler for Location. -func (l Location) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if l.LocationName != nil { - objectMap["locationName"] = l.LocationName - } - if l.ProvisioningState != nil { - objectMap["provisioningState"] = l.ProvisioningState - } - if l.FailoverPriority != nil { - objectMap["failoverPriority"] = l.FailoverPriority - } - if l.IsZoneRedundant != nil { - objectMap["isZoneRedundant"] = l.IsZoneRedundant - } - return json.Marshal(objectMap) -} - -// Metric metric data -type Metric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for Metric. -func (mVar Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.Unit != "" { - objectMap["unit"] = mVar.Unit - } - return json.Marshal(objectMap) -} - -// MetricAvailability the availability of the metric. -type MetricAvailability struct { - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - READ-ONLY; The retention for the metric values. - Retention *string `json:"retention,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAvailability. -func (ma MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinition the definition of a metric. -type MetricDefinition struct { - // MetricAvailabilities - READ-ONLY; The list of metric availabilities for the account. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type of the metric. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeTotal', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeLast' - PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // ResourceURI - READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinition. -func (md MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if md.Unit != "" { - objectMap["unit"] = md.Unit - } - return json.Marshal(objectMap) -} - -// MetricDefinitionsListResult the response to a list metric definitions request. -type MetricDefinitionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metric definitions for the account. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinitionsListResult. -func (mdlr MetricDefinitionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricListResult the response to a list metrics request. -type MetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metrics for the account. - Value *[]Metric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricListResult. -func (mlr MetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricName a metric name. -type MetricName struct { - // Value - READ-ONLY; The name of the metric. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The friendly name of the metric. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricName. -func (mn MetricName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricValue represents metrics values. -type MetricValue struct { - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricValue. -func (mv MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionCreateUpdateParameters parameters to create and update Cosmos DB MongoDB collection. -type MongoDBCollectionCreateUpdateParameters struct { - // MongoDBCollectionCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB collection. - *MongoDBCollectionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionCreateUpdateParameters. -func (mdccup MongoDBCollectionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdccup.MongoDBCollectionCreateUpdateProperties != nil { - objectMap["properties"] = mdccup.MongoDBCollectionCreateUpdateProperties - } - if mdccup.Location != nil { - objectMap["location"] = mdccup.Location - } - if mdccup.Tags != nil { - objectMap["tags"] = mdccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionCreateUpdateParameters struct. -func (mdccup *MongoDBCollectionCreateUpdateParameters) 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 mongoDBCollectionCreateUpdateProperties MongoDBCollectionCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBCollectionCreateUpdateProperties) - if err != nil { - return err - } - mdccup.MongoDBCollectionCreateUpdateProperties = &mongoDBCollectionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdccup.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB -// collection. -type MongoDBCollectionCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB collection - Resource *MongoDBCollectionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetProperties the properties of an Azure Cosmos DB MongoDB collection -type MongoDBCollectionGetProperties struct { - Resource *MongoDBCollectionGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBCollectionGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetPropertiesOptions ... -type MongoDBCollectionGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// MongoDBCollectionGetPropertiesResource ... -type MongoDBCollectionGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetPropertiesResource. -func (mdcgp MongoDBCollectionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgp.ID != nil { - objectMap["id"] = mdcgp.ID - } - if mdcgp.ShardKey != nil { - objectMap["shardKey"] = mdcgp.ShardKey - } - if mdcgp.Indexes != nil { - objectMap["indexes"] = mdcgp.Indexes - } - return json.Marshal(objectMap) -} - -// MongoDBCollectionGetResults an Azure Cosmos DB MongoDB collection. -type MongoDBCollectionGetResults struct { - autorest.Response `json:"-"` - // MongoDBCollectionGetProperties - The properties of an Azure Cosmos DB MongoDB collection - *MongoDBCollectionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetResults. -func (mdcgr MongoDBCollectionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgr.MongoDBCollectionGetProperties != nil { - objectMap["properties"] = mdcgr.MongoDBCollectionGetProperties - } - if mdcgr.Location != nil { - objectMap["location"] = mdcgr.Location - } - if mdcgr.Tags != nil { - objectMap["tags"] = mdcgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionGetResults struct. -func (mdcgr *MongoDBCollectionGetResults) 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 mongoDBCollectionGetProperties MongoDBCollectionGetProperties - err = json.Unmarshal(*v, &mongoDBCollectionGetProperties) - if err != nil { - return err - } - mdcgr.MongoDBCollectionGetProperties = &mongoDBCollectionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdcgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdcgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdcgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdcgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdcgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionListResult the List operation response, that contains the MongoDB collections and their -// properties. -type MongoDBCollectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB collections and their properties. - Value *[]MongoDBCollectionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionListResult. -func (mdclr MongoDBCollectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionResource cosmos DB MongoDB collection resource object -type MongoDBCollectionResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionResource. -func (mdcr MongoDBCollectionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcr.ID != nil { - objectMap["id"] = mdcr.ID - } - if mdcr.ShardKey != nil { - objectMap["shardKey"] = mdcr.ShardKey - } - if mdcr.Indexes != nil { - objectMap["indexes"] = mdcr.Indexes - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseCreateUpdateParameters parameters to create and update Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateParameters struct { - // MongoDBDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB database. - *MongoDBDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseCreateUpdateParameters. -func (mddcup MongoDBDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddcup.MongoDBDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = mddcup.MongoDBDatabaseCreateUpdateProperties - } - if mddcup.Location != nil { - objectMap["location"] = mddcup.Location - } - if mddcup.Tags != nil { - objectMap["tags"] = mddcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseCreateUpdateParameters struct. -func (mddcup *MongoDBDatabaseCreateUpdateParameters) 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 mongoDBDatabaseCreateUpdateProperties MongoDBDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBDatabaseCreateUpdateProperties) - if err != nil { - return err - } - mddcup.MongoDBDatabaseCreateUpdateProperties = &mongoDBDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddcup.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB database - Resource *MongoDBDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetProperties the properties of an Azure Cosmos DB MongoDB database -type MongoDBDatabaseGetProperties struct { - Resource *MongoDBDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetPropertiesOptions ... -type MongoDBDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// MongoDBDatabaseGetPropertiesResource ... -type MongoDBDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetPropertiesResource. -func (mddgp MongoDBDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgp.ID != nil { - objectMap["id"] = mddgp.ID - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseGetResults an Azure Cosmos DB MongoDB database. -type MongoDBDatabaseGetResults struct { - autorest.Response `json:"-"` - // MongoDBDatabaseGetProperties - The properties of an Azure Cosmos DB MongoDB database - *MongoDBDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetResults. -func (mddgr MongoDBDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgr.MongoDBDatabaseGetProperties != nil { - objectMap["properties"] = mddgr.MongoDBDatabaseGetProperties - } - if mddgr.Location != nil { - objectMap["location"] = mddgr.Location - } - if mddgr.Tags != nil { - objectMap["tags"] = mddgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseGetResults struct. -func (mddgr *MongoDBDatabaseGetResults) 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 mongoDBDatabaseGetProperties MongoDBDatabaseGetProperties - err = json.Unmarshal(*v, &mongoDBDatabaseGetProperties) - if err != nil { - return err - } - mddgr.MongoDBDatabaseGetProperties = &mongoDBDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseListResult the List operation response, that contains the MongoDB databases and their -// properties. -type MongoDBDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB databases and their properties. - Value *[]MongoDBDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseListResult. -func (mddlr MongoDBDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBDatabaseResource cosmos DB MongoDB database resource object -type MongoDBDatabaseResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` -} - -// MongoDBResourcesCreateUpdateMongoDBCollectionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBCollectionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) 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 MongoDBResourcesCreateUpdateMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) result(client MongoDBResourcesClient) (mdcgr MongoDBCollectionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mdcgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mdcgr.Response.Response, err = future.GetResult(sender); err == nil && mdcgr.Response.Response.StatusCode != http.StatusNoContent { - mdcgr, err = client.CreateUpdateMongoDBCollectionResponder(mdcgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", mdcgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesCreateUpdateMongoDBDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) 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 MongoDBResourcesCreateUpdateMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (mddgr MongoDBDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mddgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mddgr.Response.Response, err = future.GetResult(sender); err == nil && mddgr.Response.Response.StatusCode != http.StatusNoContent { - mddgr, err = client.CreateUpdateMongoDBDatabaseResponder(mddgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", mddgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesDeleteMongoDBCollectionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type MongoDBResourcesDeleteMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) 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 MongoDBResourcesDeleteMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesDeleteMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type MongoDBResourcesDeleteMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) 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 MongoDBResourcesDeleteMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture) 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 MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBCollectionToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture) 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 MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBCollectionToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture) 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 MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture) 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 MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBCollectionThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBCollectionThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) 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 MongoDBResourcesUpdateMongoDBCollectionThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBCollectionThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) 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 MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoIndex cosmos DB MongoDB collection index key -type MongoIndex struct { - // Key - Cosmos DB MongoDB collection index keys - Key *MongoIndexKeys `json:"key,omitempty"` - // Options - Cosmos DB MongoDB collection index key options - Options *MongoIndexOptions `json:"options,omitempty"` -} - -// MongoIndexKeys cosmos DB MongoDB collection resource object -type MongoIndexKeys struct { - // Keys - List of keys for each MongoDB collection in the Azure Cosmos DB service - Keys *[]string `json:"keys,omitempty"` -} - -// MongoIndexOptions cosmos DB MongoDB collection index options -type MongoIndexOptions struct { - // ExpireAfterSeconds - Expire after seconds - ExpireAfterSeconds *int32 `json:"expireAfterSeconds,omitempty"` - // Unique - Is unique or not - Unique *bool `json:"unique,omitempty"` -} - -// NotebookWorkspace a notebook workspace resource -type NotebookWorkspace struct { - autorest.Response `json:"-"` - // NotebookWorkspaceProperties - Resource properties. - *NotebookWorkspaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspace. -func (nw NotebookWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nw.NotebookWorkspaceProperties != nil { - objectMap["properties"] = nw.NotebookWorkspaceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotebookWorkspace struct. -func (nw *NotebookWorkspace) 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 notebookWorkspaceProperties NotebookWorkspaceProperties - err = json.Unmarshal(*v, ¬ebookWorkspaceProperties) - if err != nil { - return err - } - nw.NotebookWorkspaceProperties = ¬ebookWorkspaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nw.Type = &typeVar - } - } - } - - return nil -} - -// NotebookWorkspaceConnectionInfoResult the connection info for the given notebook workspace -type NotebookWorkspaceConnectionInfoResult struct { - autorest.Response `json:"-"` - // AuthToken - READ-ONLY; Specifies auth token used for connecting to Notebook server (uses token-based auth). - AuthToken *string `json:"authToken,omitempty"` - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceConnectionInfoResult. -func (nwcir NotebookWorkspaceConnectionInfoResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceCreateUpdateParameters parameters to create a notebook workspace resource -type NotebookWorkspaceCreateUpdateParameters struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceCreateUpdateParameters. -func (nwcup NotebookWorkspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceListResult a list of notebook workspace resources -type NotebookWorkspaceListResult struct { - autorest.Response `json:"-"` - // Value - Array of notebook workspace resources - Value *[]NotebookWorkspace `json:"value,omitempty"` -} - -// NotebookWorkspaceProperties properties of a notebook workspace resource. -type NotebookWorkspaceProperties struct { - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` - // Status - READ-ONLY; Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceProperties. -func (nwp NotebookWorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (NotebookWorkspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesCreateOrUpdateFuture) 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 NotebookWorkspacesCreateOrUpdateFuture.Result. -func (future *NotebookWorkspacesCreateOrUpdateFuture) result(client NotebookWorkspacesClient) (nw NotebookWorkspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nw.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nw.Response.Response, err = future.GetResult(sender); err == nil && nw.Response.Response.StatusCode != http.StatusNoContent { - nw, err = client.CreateOrUpdateResponder(nw.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", nw.Response.Response, "Failure responding to request") - } - } - return -} - -// NotebookWorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesDeleteFuture) 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 NotebookWorkspacesDeleteFuture.Result. -func (future *NotebookWorkspacesDeleteFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesRegenerateAuthTokenFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type NotebookWorkspacesRegenerateAuthTokenFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) 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 NotebookWorkspacesRegenerateAuthTokenFuture.Result. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesRegenerateAuthTokenFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesRegenerateAuthTokenFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NotebookWorkspacesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesStartFuture) 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 NotebookWorkspacesStartFuture.Result. -func (future *NotebookWorkspacesStartFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// Operation 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.ResourceProvider - 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"` - // Description - Description of operation - Description *string `json:"Description,omitempty"` -} - -// OperationListResult 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 OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the 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, - } -} - -// OptionsResource cosmos DB options resource object -type OptionsResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// PartitionMetric the metric values for a single partition. -type PartitionMetric struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the metric values. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the metric values. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetric. -func (pm PartitionMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PartitionMetricListResult the response to a list partition metrics request. -type PartitionMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level metrics for the account. - Value *[]PartitionMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetricListResult. -func (pmlr PartitionMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PartitionUsage the partition level usage data for a usage request. -type PartitionUsage struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the usages. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the usages. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsage. -func (pu PartitionUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pu.Unit != "" { - objectMap["unit"] = pu.Unit - } - return json.Marshal(objectMap) -} - -// PartitionUsagesResult the response to a list partition level usage request. -type PartitionUsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level usages for the database. A usage is a point in time metric - Value *[]PartitionUsage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsagesResult. -func (pur PartitionUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetric percentile Metric data -type PercentileMetric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The percentile metric values for the specified time window and timestep. - MetricValues *[]PercentileMetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetric. -func (pm PercentileMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PercentileMetricListResult the response to a list percentile metrics request. -type PercentileMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of percentile metrics for the account. - Value *[]PercentileMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricListResult. -func (pmlr PercentileMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetricValue represents percentile metrics values. -type PercentileMetricValue struct { - // P10 - READ-ONLY; The 10th percentile value for the metric. - P10 *float64 `json:"P10,omitempty"` - // P25 - READ-ONLY; The 25th percentile value for the metric. - P25 *float64 `json:"P25,omitempty"` - // P50 - READ-ONLY; The 50th percentile value for the metric. - P50 *float64 `json:"P50,omitempty"` - // P75 - READ-ONLY; The 75th percentile value for the metric. - P75 *float64 `json:"P75,omitempty"` - // P90 - READ-ONLY; The 90th percentile value for the metric. - P90 *float64 `json:"P90,omitempty"` - // P95 - READ-ONLY; The 95th percentile value for the metric. - P95 *float64 `json:"P95,omitempty"` - // P99 - READ-ONLY; The 99th percentile value for the metric. - P99 *float64 `json:"P99,omitempty"` - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricValue. -func (pmv PercentileMetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // GroupID - Group id of the private endpoint. - GroupID *string `json:"groupId,omitempty"` - // ProvisioningState - Provisioning state of the private endpoint. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource required zone names. - 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) -} - -// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) - ActionsRequired *string `json:"actionsRequired,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProvisionedThroughputSettingsResource cosmos DB provisioned throughput settings object -type ProvisionedThroughputSettingsResource struct { - // MaxThroughput - Represents maximum throughput container can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` - // AutoUpgradePolicy - Cosmos DB resource auto-upgrade policy - AutoUpgradePolicy *AutoUpgradePolicyResource `json:"autoUpgradePolicy,omitempty"` - // TargetMaxThroughput - READ-ONLY; Represents target maximum throughput container can scale up to once offer is no longer in pending state. - TargetMaxThroughput *int32 `json:"targetMaxThroughput,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProvisionedThroughputSettingsResource. -func (ptsr ProvisionedThroughputSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptsr.MaxThroughput != nil { - objectMap["maxThroughput"] = ptsr.MaxThroughput - } - if ptsr.AutoUpgradePolicy != nil { - objectMap["autoUpgradePolicy"] = ptsr.AutoUpgradePolicy - } - return json.Marshal(objectMap) -} - -// 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) -} - -// RegionForOnlineOffline cosmos DB region to online or offline. -type RegionForOnlineOffline struct { - // Region - Cosmos DB region, with spaces between words and each word capitalized. - Region *string `json:"region,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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SpatialSpec ... -type SpatialSpec struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Types - List of path's spatial type - Types *[]SpatialType `json:"types,omitempty"` -} - -// SQLContainerCreateUpdateParameters parameters to create and update Cosmos DB container. -type SQLContainerCreateUpdateParameters struct { - // SQLContainerCreateUpdateProperties - Properties to create and update Azure Cosmos DB container. - *SQLContainerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerCreateUpdateParameters. -func (sccup SQLContainerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccup.SQLContainerCreateUpdateProperties != nil { - objectMap["properties"] = sccup.SQLContainerCreateUpdateProperties - } - if sccup.Location != nil { - objectMap["location"] = sccup.Location - } - if sccup.Tags != nil { - objectMap["tags"] = sccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerCreateUpdateParameters struct. -func (sccup *SQLContainerCreateUpdateParameters) 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 SQLContainerCreateUpdateProperties SQLContainerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLContainerCreateUpdateProperties) - if err != nil { - return err - } - sccup.SQLContainerCreateUpdateProperties = &SQLContainerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sccup.Tags = tags - } - } - } - - return nil -} - -// SQLContainerCreateUpdateProperties properties to create and update Azure Cosmos DB container. -type SQLContainerCreateUpdateProperties struct { - // Resource - The standard JSON format of a container - Resource *SQLContainerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLContainerGetProperties the properties of an Azure Cosmos DB container -type SQLContainerGetProperties struct { - Resource *SQLContainerGetPropertiesResource `json:"resource,omitempty"` - Options *SQLContainerGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLContainerGetPropertiesOptions ... -type SQLContainerGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// SQLContainerGetPropertiesResource ... -type SQLContainerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetPropertiesResource. -func (scgp SQLContainerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgp.ID != nil { - objectMap["id"] = scgp.ID - } - if scgp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = scgp.IndexingPolicy - } - if scgp.PartitionKey != nil { - objectMap["partitionKey"] = scgp.PartitionKey - } - if scgp.DefaultTTL != nil { - objectMap["defaultTtl"] = scgp.DefaultTTL - } - if scgp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = scgp.UniqueKeyPolicy - } - if scgp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = scgp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// SQLContainerGetResults an Azure Cosmos DB container. -type SQLContainerGetResults struct { - autorest.Response `json:"-"` - // SQLContainerGetProperties - The properties of an Azure Cosmos DB container - *SQLContainerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetResults. -func (scgr SQLContainerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgr.SQLContainerGetProperties != nil { - objectMap["properties"] = scgr.SQLContainerGetProperties - } - if scgr.Location != nil { - objectMap["location"] = scgr.Location - } - if scgr.Tags != nil { - objectMap["tags"] = scgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerGetResults struct. -func (scgr *SQLContainerGetResults) 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 SQLContainerGetProperties SQLContainerGetProperties - err = json.Unmarshal(*v, &SQLContainerGetProperties) - if err != nil { - return err - } - scgr.SQLContainerGetProperties = &SQLContainerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - scgr.Tags = tags - } - } - } - - return nil -} - -// SQLContainerListResult the List operation response, that contains the containers and their properties. -type SQLContainerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of containers and their properties. - Value *[]SQLContainerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerListResult. -func (sclr SQLContainerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLContainerResource cosmos DB SQL container resource object -type SQLContainerResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// SQLDatabaseCreateUpdateParameters parameters to create and update Cosmos DB SQL database. -type SQLDatabaseCreateUpdateParameters struct { - // SQLDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB SQL database. - *SQLDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseCreateUpdateParameters. -func (sdcup SQLDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdcup.SQLDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = sdcup.SQLDatabaseCreateUpdateProperties - } - if sdcup.Location != nil { - objectMap["location"] = sdcup.Location - } - if sdcup.Tags != nil { - objectMap["tags"] = sdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseCreateUpdateParameters struct. -func (sdcup *SQLDatabaseCreateUpdateParameters) 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 SQLDatabaseCreateUpdateProperties SQLDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &SQLDatabaseCreateUpdateProperties) - if err != nil { - return err - } - sdcup.SQLDatabaseCreateUpdateProperties = &SQLDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdcup.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB SQL database. -type SQLDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a SQL database - Resource *SQLDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type SQLDatabaseGetProperties struct { - Resource *SQLDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *SQLDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetPropertiesOptions ... -type SQLDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// SQLDatabaseGetPropertiesResource ... -type SQLDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Colls - A system generated property that specified the addressable path of the collections resource. - Colls *string `json:"_colls,omitempty"` - // Users - A system generated property that specifies the addressable path of the users resource. - Users *string `json:"_users,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetPropertiesResource. -func (sdgp SQLDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgp.ID != nil { - objectMap["id"] = sdgp.ID - } - if sdgp.Colls != nil { - objectMap["_colls"] = sdgp.Colls - } - if sdgp.Users != nil { - objectMap["_users"] = sdgp.Users - } - return json.Marshal(objectMap) -} - -// SQLDatabaseGetResults an Azure Cosmos DB SQL database. -type SQLDatabaseGetResults struct { - autorest.Response `json:"-"` - // SQLDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *SQLDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetResults. -func (sdgr SQLDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgr.SQLDatabaseGetProperties != nil { - objectMap["properties"] = sdgr.SQLDatabaseGetProperties - } - if sdgr.Location != nil { - objectMap["location"] = sdgr.Location - } - if sdgr.Tags != nil { - objectMap["tags"] = sdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseGetResults struct. -func (sdgr *SQLDatabaseGetResults) 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 SQLDatabaseGetProperties SQLDatabaseGetProperties - err = json.Unmarshal(*v, &SQLDatabaseGetProperties) - if err != nil { - return err - } - sdgr.SQLDatabaseGetProperties = &SQLDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdgr.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseListResult the List operation response, that contains the SQL databases and their properties. -type SQLDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of SQL databases and their properties. - Value *[]SQLDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseListResult. -func (sdlr SQLDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLDatabaseResource cosmos DB SQL database resource object -type SQLDatabaseResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` -} - -// SQLResourcesCreateUpdateSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLContainerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) 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 SQLResourcesCreateUpdateSQLContainerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) result(client SQLResourcesClient) (scgr SQLContainerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - scgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLContainerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if scgr.Response.Response, err = future.GetResult(sender); err == nil && scgr.Response.Response.StatusCode != http.StatusNoContent { - scgr, err = client.CreateUpdateSQLContainerResponder(scgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", scgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) 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 SQLResourcesCreateUpdateSQLDatabaseFuture.Result. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) result(client SQLResourcesClient) (sdgr SQLDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sdgr.Response.Response, err = future.GetResult(sender); err == nil && sdgr.Response.Response.StatusCode != http.StatusNoContent { - sdgr, err = client.CreateUpdateSQLDatabaseResponder(sdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", sdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLStoredProcedureFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLStoredProcedureGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) 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 SQLResourcesCreateUpdateSQLStoredProcedureFuture.Result. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) result(client SQLResourcesClient) (sspgr SQLStoredProcedureGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sspgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sspgr.Response.Response, err = future.GetResult(sender); err == nil && sspgr.Response.Response.StatusCode != http.StatusNoContent { - sspgr, err = client.CreateUpdateSQLStoredProcedureResponder(sspgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", sspgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLTriggerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) 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 SQLResourcesCreateUpdateSQLTriggerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) result(client SQLResourcesClient) (stgr SQLTriggerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - stgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLTriggerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if stgr.Response.Response, err = future.GetResult(sender); err == nil && stgr.Response.Response.StatusCode != http.StatusNoContent { - stgr, err = client.CreateUpdateSQLTriggerResponder(stgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", stgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLUserDefinedFunctionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) 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 SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (sudfgr SQLUserDefinedFunctionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sudfgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sudfgr.Response.Response, err = future.GetResult(sender); err == nil && sudfgr.Response.Response.StatusCode != http.StatusNoContent { - sudfgr, err = client.CreateUpdateSQLUserDefinedFunctionResponder(sudfgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", sudfgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesDeleteSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLContainerFuture) 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 SQLResourcesDeleteSQLContainerFuture.Result. -func (future *SQLResourcesDeleteSQLContainerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLContainerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLDatabaseFuture) 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 SQLResourcesDeleteSQLDatabaseFuture.Result. -func (future *SQLResourcesDeleteSQLDatabaseFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLStoredProcedureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) 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 SQLResourcesDeleteSQLStoredProcedureFuture.Result. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLStoredProcedureFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLTriggerFuture) 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 SQLResourcesDeleteSQLTriggerFuture.Result. -func (future *SQLResourcesDeleteSQLTriggerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLTriggerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesDeleteSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) 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 SQLResourcesDeleteSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesMigrateSQLContainerToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLContainerToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLContainerToAutoscaleFuture) 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 SQLResourcesMigrateSQLContainerToAutoscaleFuture.Result. -func (future *SQLResourcesMigrateSQLContainerToAutoscaleFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLContainerToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLContainerToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLContainerToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLContainerToManualThroughputFuture) 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 SQLResourcesMigrateSQLContainerToManualThroughputFuture.Result. -func (future *SQLResourcesMigrateSQLContainerToManualThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLContainerToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesMigrateSQLDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLDatabaseToAutoscaleFuture) 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 SQLResourcesMigrateSQLDatabaseToAutoscaleFuture.Result. -func (future *SQLResourcesMigrateSQLDatabaseToAutoscaleFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLDatabaseToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLDatabaseToManualThroughputFuture) 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 SQLResourcesMigrateSQLDatabaseToManualThroughputFuture.Result. -func (future *SQLResourcesMigrateSQLDatabaseToManualThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLContainerThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLContainerThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) 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 SQLResourcesUpdateSQLContainerThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLContainerThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLContainerThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLDatabaseThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) 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 SQLResourcesUpdateSQLDatabaseThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLStoredProcedureCreateUpdateParameters parameters to create and update Cosmos DB storedProcedure. -type SQLStoredProcedureCreateUpdateParameters struct { - // SQLStoredProcedureCreateUpdateProperties - Properties to create and update Azure Cosmos DB storedProcedure. - *SQLStoredProcedureCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureCreateUpdateParameters. -func (sspcup SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspcup.SQLStoredProcedureCreateUpdateProperties != nil { - objectMap["properties"] = sspcup.SQLStoredProcedureCreateUpdateProperties - } - if sspcup.Location != nil { - objectMap["location"] = sspcup.Location - } - if sspcup.Tags != nil { - objectMap["tags"] = sspcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureCreateUpdateParameters struct. -func (sspcup *SQLStoredProcedureCreateUpdateParameters) 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 SQLStoredProcedureCreateUpdateProperties SQLStoredProcedureCreateUpdateProperties - err = json.Unmarshal(*v, &SQLStoredProcedureCreateUpdateProperties) - if err != nil { - return err - } - sspcup.SQLStoredProcedureCreateUpdateProperties = &SQLStoredProcedureCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspcup.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureCreateUpdateProperties properties to create and update Azure Cosmos DB -// storedProcedure. -type SQLStoredProcedureCreateUpdateProperties struct { - // Resource - The standard JSON format of a storedProcedure - Resource *SQLStoredProcedureResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLStoredProcedureGetProperties the properties of an Azure Cosmos DB StoredProcedure -type SQLStoredProcedureGetProperties struct { - Resource *SQLStoredProcedureGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLStoredProcedureGetPropertiesResource ... -type SQLStoredProcedureGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetPropertiesResource. -func (sspgp SQLStoredProcedureGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgp.ID != nil { - objectMap["id"] = sspgp.ID - } - if sspgp.Body != nil { - objectMap["body"] = sspgp.Body - } - return json.Marshal(objectMap) -} - -// SQLStoredProcedureGetResults an Azure Cosmos DB storedProcedure. -type SQLStoredProcedureGetResults struct { - autorest.Response `json:"-"` - // SQLStoredProcedureGetProperties - The properties of an Azure Cosmos DB storedProcedure - *SQLStoredProcedureGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetResults. -func (sspgr SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgr.SQLStoredProcedureGetProperties != nil { - objectMap["properties"] = sspgr.SQLStoredProcedureGetProperties - } - if sspgr.Location != nil { - objectMap["location"] = sspgr.Location - } - if sspgr.Tags != nil { - objectMap["tags"] = sspgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureGetResults struct. -func (sspgr *SQLStoredProcedureGetResults) 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 SQLStoredProcedureGetProperties SQLStoredProcedureGetProperties - err = json.Unmarshal(*v, &SQLStoredProcedureGetProperties) - if err != nil { - return err - } - sspgr.SQLStoredProcedureGetProperties = &SQLStoredProcedureGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspgr.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureListResult the List operation response, that contains the storedProcedures and their -// properties. -type SQLStoredProcedureListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of storedProcedures and their properties. - Value *[]SQLStoredProcedureGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureListResult. -func (ssplr SQLStoredProcedureListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLStoredProcedureResource cosmos DB SQL storedProcedure resource object -type SQLStoredProcedureResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` -} - -// SQLTriggerCreateUpdateParameters parameters to create and update Cosmos DB trigger. -type SQLTriggerCreateUpdateParameters struct { - // SQLTriggerCreateUpdateProperties - Properties to create and update Azure Cosmos DB trigger. - *SQLTriggerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerCreateUpdateParameters. -func (stcup SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stcup.SQLTriggerCreateUpdateProperties != nil { - objectMap["properties"] = stcup.SQLTriggerCreateUpdateProperties - } - if stcup.Location != nil { - objectMap["location"] = stcup.Location - } - if stcup.Tags != nil { - objectMap["tags"] = stcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerCreateUpdateParameters struct. -func (stcup *SQLTriggerCreateUpdateParameters) 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 SQLTriggerCreateUpdateProperties SQLTriggerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLTriggerCreateUpdateProperties) - if err != nil { - return err - } - stcup.SQLTriggerCreateUpdateProperties = &SQLTriggerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stcup.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerCreateUpdateProperties properties to create and update Azure Cosmos DB trigger. -type SQLTriggerCreateUpdateProperties struct { - // Resource - The standard JSON format of a trigger - Resource *SQLTriggerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLTriggerGetProperties the properties of an Azure Cosmos DB trigger -type SQLTriggerGetProperties struct { - Resource *SQLTriggerGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLTriggerGetPropertiesResource ... -type SQLTriggerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetPropertiesResource. -func (stgp SQLTriggerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgp.ID != nil { - objectMap["id"] = stgp.ID - } - if stgp.Body != nil { - objectMap["body"] = stgp.Body - } - if stgp.TriggerType != "" { - objectMap["triggerType"] = stgp.TriggerType - } - if stgp.TriggerOperation != "" { - objectMap["triggerOperation"] = stgp.TriggerOperation - } - return json.Marshal(objectMap) -} - -// SQLTriggerGetResults an Azure Cosmos DB trigger. -type SQLTriggerGetResults struct { - autorest.Response `json:"-"` - // SQLTriggerGetProperties - The properties of an Azure Cosmos DB trigger - *SQLTriggerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetResults. -func (stgr SQLTriggerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgr.SQLTriggerGetProperties != nil { - objectMap["properties"] = stgr.SQLTriggerGetProperties - } - if stgr.Location != nil { - objectMap["location"] = stgr.Location - } - if stgr.Tags != nil { - objectMap["tags"] = stgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerGetResults struct. -func (stgr *SQLTriggerGetResults) 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 SQLTriggerGetProperties SQLTriggerGetProperties - err = json.Unmarshal(*v, &SQLTriggerGetProperties) - if err != nil { - return err - } - stgr.SQLTriggerGetProperties = &SQLTriggerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stgr.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerListResult the List operation response, that contains the triggers and their properties. -type SQLTriggerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of triggers and their properties. - Value *[]SQLTriggerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerListResult. -func (stlr SQLTriggerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLTriggerResource cosmos DB SQL trigger resource object -type SQLTriggerResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` -} - -// SQLUserDefinedFunctionCreateUpdateParameters parameters to create and update Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateParameters struct { - // SQLUserDefinedFunctionCreateUpdateProperties - Properties to create and update Azure Cosmos DB userDefinedFunction. - *SQLUserDefinedFunctionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionCreateUpdateParameters. -func (sudfcup SQLUserDefinedFunctionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfcup.SQLUserDefinedFunctionCreateUpdateProperties != nil { - objectMap["properties"] = sudfcup.SQLUserDefinedFunctionCreateUpdateProperties - } - if sudfcup.Location != nil { - objectMap["location"] = sudfcup.Location - } - if sudfcup.Tags != nil { - objectMap["tags"] = sudfcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionCreateUpdateParameters struct. -func (sudfcup *SQLUserDefinedFunctionCreateUpdateParameters) 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 SQLUserDefinedFunctionCreateUpdateProperties SQLUserDefinedFunctionCreateUpdateProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionCreateUpdateProperties) - if err != nil { - return err - } - sudfcup.SQLUserDefinedFunctionCreateUpdateProperties = &SQLUserDefinedFunctionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfcup.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionCreateUpdateProperties properties to create and update Azure Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateProperties struct { - // Resource - The standard JSON format of a userDefinedFunction - Resource *SQLUserDefinedFunctionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLUserDefinedFunctionGetProperties the properties of an Azure Cosmos DB userDefinedFunction -type SQLUserDefinedFunctionGetProperties struct { - Resource *SQLUserDefinedFunctionGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLUserDefinedFunctionGetPropertiesResource ... -type SQLUserDefinedFunctionGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetPropertiesResource. -func (sudfgp SQLUserDefinedFunctionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgp.ID != nil { - objectMap["id"] = sudfgp.ID - } - if sudfgp.Body != nil { - objectMap["body"] = sudfgp.Body - } - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionGetResults an Azure Cosmos DB userDefinedFunction. -type SQLUserDefinedFunctionGetResults struct { - autorest.Response `json:"-"` - // SQLUserDefinedFunctionGetProperties - The properties of an Azure Cosmos DB userDefinedFunction - *SQLUserDefinedFunctionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetResults. -func (sudfgr SQLUserDefinedFunctionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgr.SQLUserDefinedFunctionGetProperties != nil { - objectMap["properties"] = sudfgr.SQLUserDefinedFunctionGetProperties - } - if sudfgr.Location != nil { - objectMap["location"] = sudfgr.Location - } - if sudfgr.Tags != nil { - objectMap["tags"] = sudfgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionGetResults struct. -func (sudfgr *SQLUserDefinedFunctionGetResults) 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 SQLUserDefinedFunctionGetProperties SQLUserDefinedFunctionGetProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionGetProperties) - if err != nil { - return err - } - sudfgr.SQLUserDefinedFunctionGetProperties = &SQLUserDefinedFunctionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfgr.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionListResult the List operation response, that contains the userDefinedFunctions and -// their properties. -type SQLUserDefinedFunctionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of userDefinedFunctions and their properties. - Value *[]SQLUserDefinedFunctionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionListResult. -func (sudflr SQLUserDefinedFunctionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionResource cosmos DB SQL userDefinedFunction resource object -type SQLUserDefinedFunctionResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` -} - -// TableCreateUpdateParameters parameters to create and update Cosmos DB Table. -type TableCreateUpdateParameters struct { - // TableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Table. - *TableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableCreateUpdateParameters. -func (tcup TableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TableCreateUpdateProperties != nil { - objectMap["properties"] = tcup.TableCreateUpdateProperties - } - if tcup.Location != nil { - objectMap["location"] = tcup.Location - } - if tcup.Tags != nil { - objectMap["tags"] = tcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableCreateUpdateParameters struct. -func (tcup *TableCreateUpdateParameters) 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 tableCreateUpdateProperties TableCreateUpdateProperties - err = json.Unmarshal(*v, &tableCreateUpdateProperties) - if err != nil { - return err - } - tcup.TableCreateUpdateProperties = &tableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tcup.Tags = tags - } - } - } - - return nil -} - -// TableCreateUpdateProperties properties to create and update Azure Cosmos DB Table. -type TableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Table - Resource *TableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// TableGetProperties the properties of an Azure Cosmos Table -type TableGetProperties struct { - Resource *TableGetPropertiesResource `json:"resource,omitempty"` - Options *TableGetPropertiesOptions `json:"options,omitempty"` -} - -// TableGetPropertiesOptions ... -type TableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` -} - -// TableGetPropertiesResource ... -type TableGetPropertiesResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableGetPropertiesResource. -func (tgp TableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgp.ID != nil { - objectMap["id"] = tgp.ID - } - return json.Marshal(objectMap) -} - -// TableGetResults an Azure Cosmos DB Table. -type TableGetResults struct { - autorest.Response `json:"-"` - // TableGetProperties - The properties of an Azure Cosmos DB Table - *TableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableGetResults. -func (tgr TableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgr.TableGetProperties != nil { - objectMap["properties"] = tgr.TableGetProperties - } - if tgr.Location != nil { - objectMap["location"] = tgr.Location - } - if tgr.Tags != nil { - objectMap["tags"] = tgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableGetResults struct. -func (tgr *TableGetResults) 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 tableGetProperties TableGetProperties - err = json.Unmarshal(*v, &tableGetProperties) - if err != nil { - return err - } - tgr.TableGetProperties = &tableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tgr.Tags = tags - } - } - } - - return nil -} - -// TableListResult the List operation response, that contains the Table and their properties. -type TableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Table and their properties. - Value *[]TableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableListResult. -func (tlr TableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TableResource cosmos DB table resource object -type TableResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` -} - -// TableResourcesCreateUpdateTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesCreateUpdateTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (TableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesCreateUpdateTableFuture) 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 TableResourcesCreateUpdateTableFuture.Result. -func (future *TableResourcesCreateUpdateTableFuture) result(client TableResourcesClient) (tgr TableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesCreateUpdateTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tgr.Response.Response, err = future.GetResult(sender); err == nil && tgr.Response.Response.StatusCode != http.StatusNoContent { - tgr, err = client.CreateUpdateTableResponder(tgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", tgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesDeleteTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesDeleteTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesDeleteTableFuture) 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 TableResourcesDeleteTableFuture.Result. -func (future *TableResourcesDeleteTableFuture) result(client TableResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesDeleteTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesDeleteTableFuture") - return - } - ar.Response = future.Response() - return -} - -// TableResourcesMigrateTableToAutoscaleFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type TableResourcesMigrateTableToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesMigrateTableToAutoscaleFuture) 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 TableResourcesMigrateTableToAutoscaleFuture.Result. -func (future *TableResourcesMigrateTableToAutoscaleFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesMigrateTableToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateTableToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesMigrateTableToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type TableResourcesMigrateTableToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesMigrateTableToManualThroughputFuture) 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 TableResourcesMigrateTableToManualThroughputFuture.Result. -func (future *TableResourcesMigrateTableToManualThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesMigrateTableToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateTableToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesUpdateTableThroughputFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesUpdateTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesUpdateTableThroughputFuture) 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 TableResourcesUpdateTableThroughputFuture.Result. -func (future *TableResourcesUpdateTableThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesUpdateTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// ThroughputPolicyResource cosmos DB resource throughput policy -type ThroughputPolicyResource struct { - // IsEnabled - Determines whether the ThroughputPolicy is active or not - IsEnabled *bool `json:"isEnabled,omitempty"` - // IncrementPercent - Represents the percentage by which throughput can increase every time throughput policy kicks in. - IncrementPercent *int32 `json:"incrementPercent,omitempty"` -} - -// ThroughputSettingsGetProperties the properties of an Azure Cosmos DB resource throughput -type ThroughputSettingsGetProperties struct { - Resource *ThroughputSettingsGetPropertiesResource `json:"resource,omitempty"` -} - -// ThroughputSettingsGetPropertiesResource ... -type ThroughputSettingsGetPropertiesResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or provisionedThroughputSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // ProvisionedThroughputSettings - Cosmos DB resource for provisioned throughput settings. Either throughput is required or provisionedThroughputSettings is required, but not both. - ProvisionedThroughputSettings *ProvisionedThroughputSettingsResource `json:"provisionedThroughputSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetPropertiesResource. -func (tsgp ThroughputSettingsGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgp.Throughput != nil { - objectMap["throughput"] = tsgp.Throughput - } - if tsgp.ProvisionedThroughputSettings != nil { - objectMap["provisionedThroughputSettings"] = tsgp.ProvisionedThroughputSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsGetResults an Azure Cosmos DB resource throughput. -type ThroughputSettingsGetResults struct { - autorest.Response `json:"-"` - // ThroughputSettingsGetProperties - The properties of an Azure Cosmos DB resource throughput - *ThroughputSettingsGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetResults. -func (tsgr ThroughputSettingsGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgr.ThroughputSettingsGetProperties != nil { - objectMap["properties"] = tsgr.ThroughputSettingsGetProperties - } - if tsgr.Location != nil { - objectMap["location"] = tsgr.Location - } - if tsgr.Tags != nil { - objectMap["tags"] = tsgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsGetResults struct. -func (tsgr *ThroughputSettingsGetResults) 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 throughputSettingsGetProperties ThroughputSettingsGetProperties - err = json.Unmarshal(*v, &throughputSettingsGetProperties) - if err != nil { - return err - } - tsgr.ThroughputSettingsGetProperties = &throughputSettingsGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsgr.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsResource cosmos DB resource throughput object. Either throughput is required or -// provisionedThroughputSettings is required, but not both. -type ThroughputSettingsResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or provisionedThroughputSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // ProvisionedThroughputSettings - Cosmos DB resource for provisioned throughput settings. Either throughput is required or provisionedThroughputSettings is required, but not both. - ProvisionedThroughputSettings *ProvisionedThroughputSettingsResource `json:"provisionedThroughputSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsResource. -func (tsr ThroughputSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsr.Throughput != nil { - objectMap["throughput"] = tsr.Throughput - } - if tsr.ProvisionedThroughputSettings != nil { - objectMap["provisionedThroughputSettings"] = tsr.ProvisionedThroughputSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsUpdateParameters parameters to update Cosmos DB resource throughput. -type ThroughputSettingsUpdateParameters struct { - // ThroughputSettingsUpdateProperties - Properties to update Azure Cosmos DB resource throughput. - *ThroughputSettingsUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsUpdateParameters. -func (tsup ThroughputSettingsUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsup.ThroughputSettingsUpdateProperties != nil { - objectMap["properties"] = tsup.ThroughputSettingsUpdateProperties - } - if tsup.Location != nil { - objectMap["location"] = tsup.Location - } - if tsup.Tags != nil { - objectMap["tags"] = tsup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsUpdateParameters struct. -func (tsup *ThroughputSettingsUpdateParameters) 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 throughputSettingsUpdateProperties ThroughputSettingsUpdateProperties - err = json.Unmarshal(*v, &throughputSettingsUpdateProperties) - if err != nil { - return err - } - tsup.ThroughputSettingsUpdateProperties = &throughputSettingsUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsup.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsUpdateProperties properties to update Azure Cosmos DB resource throughput. -type ThroughputSettingsUpdateProperties struct { - // Resource - The standard JSON format of a resource throughput - Resource *ThroughputSettingsResource `json:"resource,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"` -} - -// 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) -} - -// UniqueKey the unique key on that enforces uniqueness constraint on documents in the collection in the -// Azure Cosmos DB service. -type UniqueKey struct { - // Paths - List of paths must be unique for each document in the Azure Cosmos DB service - Paths *[]string `json:"paths,omitempty"` -} - -// UniqueKeyPolicy the unique key policy configuration for specifying uniqueness constraints on documents -// in the collection in the Azure Cosmos DB service. -type UniqueKeyPolicy struct { - // UniqueKeys - List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - UniqueKeys *[]UniqueKey `json:"uniqueKeys,omitempty"` -} - -// Usage the usage data for a usage request. -type Usage struct { - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.Unit != "" { - objectMap["unit"] = u.Unit - } - return json.Marshal(objectMap) -} - -// UsagesResult the response to a list usage request. -type UsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of usages for the database. A usage is a point in time metric - Value *[]Usage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsagesResult. -func (ur UsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRule virtual Network ACL Rule object -type VirtualNetworkRule struct { - // ID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. - ID *string `json:"id,omitempty"` - // IgnoreMissingVNetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVNetServiceEndpoint *bool `json:"ignoreMissingVNetServiceEndpoint,omitempty"` -} diff --git a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/mongodbresources.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/mongodbresources.go deleted file mode 100644 index 3244047bedea..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/mongodbresources.go +++ /dev/null @@ -1,1591 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// MongoDBResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type MongoDBResourcesClient struct { - BaseClient -} - -// NewMongoDBResourcesClient creates an instance of the MongoDBResourcesClient client. -func NewMongoDBResourcesClient(subscriptionID string) MongoDBResourcesClient { - return NewMongoDBResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMongoDBResourcesClientWithBaseURI creates an instance of the MongoDBResourcesClient 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 NewMongoDBResourcesClientWithBaseURI(baseURI string, subscriptionID string) MongoDBResourcesClient { - return MongoDBResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateMongoDBCollection create or update an Azure Cosmos DB MongoDB Collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// createUpdateMongoDBCollectionParameters - the parameters to provide for the current MongoDB Collection. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBCollectionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", err.Error()) - } - - req, err := client.CreateUpdateMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBCollectionPreparer prepares the CreateUpdateMongoDBCollection request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBCollectionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBCollectionSender sends the CreateUpdateMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBCollectionFuture, 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 -} - -// CreateUpdateMongoDBCollectionResponder handles the response to the CreateUpdateMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateMongoDBDatabase create or updates Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateMongoDBDatabaseParameters - the parameters to provide for the current MongoDB database. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", err.Error()) - } - - req, err := client.CreateUpdateMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBDatabasePreparer prepares the CreateUpdateMongoDBDatabase request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBDatabaseSender sends the CreateUpdateMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, 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 -} - -// CreateUpdateMongoDBDatabaseResponder handles the response to the CreateUpdateMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteMongoDBCollection deletes an existing Azure Cosmos DB MongoDB Collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesDeleteMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", err.Error()) - } - - req, err := client.DeleteMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBCollectionPreparer prepares the DeleteMongoDBCollection request. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBCollectionSender sends the DeleteMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBCollectionFuture, 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 -} - -// DeleteMongoDBCollectionResponder handles the response to the DeleteMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionResponder(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 -} - -// DeleteMongoDBDatabase deletes an existing Azure Cosmos DB MongoDB database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", err.Error()) - } - - req, err := client.DeleteMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBDatabasePreparer prepares the DeleteMongoDBDatabase request. -func (client MongoDBResourcesClient) DeleteMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBDatabaseSender sends the DeleteMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBDatabaseFuture, 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 -} - -// DeleteMongoDBDatabaseResponder handles the response to the DeleteMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseResponder(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 -} - -// GetMongoDBCollection gets the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBCollectionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollection") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollection", err.Error()) - } - - req, err := client.GetMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionPreparer prepares the GetMongoDBCollection request. -func (client MongoDBResourcesClient) GetMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionSender sends the GetMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionResponder handles the response to the GetMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBCollectionThroughput gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollectionThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.GetMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionThroughputPreparer prepares the GetMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionThroughputSender sends the GetMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionThroughputResponder handles the response to the GetMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabase gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", err.Error()) - } - - req, err := client.GetMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabasePreparer prepares the GetMongoDBDatabase request. -func (client MongoDBResourcesClient) GetMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseSender sends the GetMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseResponder handles the response to the GetMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabaseThroughput gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.GetMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabaseThroughputPreparer prepares the GetMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseThroughputSender sends the GetMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseThroughputResponder handles the response to the GetMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBCollections lists the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBCollectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBCollections") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBCollections", err.Error()) - } - - req, err := client.ListMongoDBCollectionsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBCollectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBCollectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBCollectionsPreparer prepares the ListMongoDBCollections request. -func (client MongoDBResourcesClient) ListMongoDBCollectionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBCollectionsSender sends the ListMongoDBCollections request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBCollectionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBCollectionsResponder handles the response to the ListMongoDBCollections request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBCollectionsResponder(resp *http.Response) (result MongoDBCollectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBDatabases lists the MongoDB databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client MongoDBResourcesClient) ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result MongoDBDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", err.Error()) - } - - req, err := client.ListMongoDBDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBDatabasesPreparer prepares the ListMongoDBDatabases request. -func (client MongoDBResourcesClient) ListMongoDBDatabasesPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBDatabasesSender sends the ListMongoDBDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBDatabasesResponder handles the response to the ListMongoDBDatabases request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBDatabasesResponder(resp *http.Response) (result MongoDBDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBCollectionToAutoscale migrate an Azure Cosmos DB MongoDB collection from manual throughput to -// autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", err.Error()) - } - - req, err := client.MigrateMongoDBCollectionToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBCollectionToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBCollectionToAutoscalePreparer prepares the MigrateMongoDBCollectionToAutoscale request. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBCollectionToAutoscaleSender sends the MigrateMongoDBCollectionToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, 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 -} - -// MigrateMongoDBCollectionToAutoscaleResponder handles the response to the MigrateMongoDBCollectionToAutoscale request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBCollectionToManualThroughput migrate an Azure Cosmos DB MongoDB collection from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", err.Error()) - } - - req, err := client.MigrateMongoDBCollectionToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBCollectionToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBCollectionToManualThroughputPreparer prepares the MigrateMongoDBCollectionToManualThroughput request. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBCollectionToManualThroughputSender sends the MigrateMongoDBCollectionToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, 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 -} - -// MigrateMongoDBCollectionToManualThroughputResponder handles the response to the MigrateMongoDBCollectionToManualThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBDatabaseToAutoscale migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateMongoDBDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBDatabaseToAutoscalePreparer prepares the MigrateMongoDBDatabaseToAutoscale request. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBDatabaseToAutoscaleSender sends the MigrateMongoDBDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, 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 -} - -// MigrateMongoDBDatabaseToAutoscaleResponder handles the response to the MigrateMongoDBDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBDatabaseToManualThroughput migrate an Azure Cosmos DB MongoDB database from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateMongoDBDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBDatabaseToManualThroughputPreparer prepares the MigrateMongoDBDatabaseToManualThroughput request. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBDatabaseToManualThroughputSender sends the MigrateMongoDBDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, 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 -} - -// MigrateMongoDBDatabaseToManualThroughputResponder handles the response to the MigrateMongoDBDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBCollectionThroughput update the RUs per second of an Azure Cosmos DB MongoDB collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// collection. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBCollectionThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBCollectionThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBCollectionThroughputPreparer prepares the UpdateMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBCollectionThroughputSender sends the UpdateMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, 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 -} - -// UpdateMongoDBCollectionThroughputResponder handles the response to the UpdateMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBDatabaseThroughput update RUs per second of the an Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// database. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBDatabaseThroughputPreparer prepares the UpdateMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBDatabaseThroughputSender sends the UpdateMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, 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 -} - -// UpdateMongoDBDatabaseThroughputResponder handles the response to the UpdateMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/notebookworkspaces.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/notebookworkspaces.go deleted file mode 100644 index 8b2411967a5b..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/notebookworkspaces.go +++ /dev/null @@ -1,681 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotebookWorkspacesClient is the azure Cosmos DB Database Service Resource Provider REST API -type NotebookWorkspacesClient struct { - BaseClient -} - -// NewNotebookWorkspacesClient creates an instance of the NotebookWorkspacesClient client. -func NewNotebookWorkspacesClient(subscriptionID string) NotebookWorkspacesClient { - return NewNotebookWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotebookWorkspacesClientWithBaseURI creates an instance of the NotebookWorkspacesClient 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 NewNotebookWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) NotebookWorkspacesClient { - return NotebookWorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// notebookCreateUpdateParameters - the notebook workspace to create for the current database account. -func (client NotebookWorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (result NotebookWorkspacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, notebookCreateUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotebookWorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", pathParameters), - autorest.WithJSON(notebookCreateUpdateParameters), - 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 NotebookWorkspacesClient) CreateOrUpdateSender(req *http.Request) (future NotebookWorkspacesCreateOrUpdateFuture, 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 NotebookWorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result NotebookWorkspace, 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 notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotebookWorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) DeleteSender(req *http.Request) (future NotebookWorkspacesDeleteFuture, 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 NotebookWorkspacesClient) 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 the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotebookWorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) 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 NotebookWorkspacesClient) GetResponder(resp *http.Response) (result NotebookWorkspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabaseAccount gets the notebook workspace resources of an existing Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client NotebookWorkspacesClient) ListByDatabaseAccountPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListByDatabaseAccountResponder(resp *http.Response) (result NotebookWorkspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionInfo retrieves the connection info for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceConnectionInfoResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListConnectionInfo") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListConnectionInfo", err.Error()) - } - - req, err := client.ListConnectionInfoPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionInfoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionInfoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionInfoPreparer prepares the ListConnectionInfo request. -func (client NotebookWorkspacesClient) ListConnectionInfoPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionInfoSender sends the ListConnectionInfo request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListConnectionInfoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionInfoResponder handles the response to the ListConnectionInfo request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListConnectionInfoResponder(resp *http.Response) (result NotebookWorkspaceConnectionInfoResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateAuthToken regenerates the auth token for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesRegenerateAuthTokenFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.RegenerateAuthToken") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", err.Error()) - } - - req, err := client.RegenerateAuthTokenPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateAuthTokenSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateAuthTokenPreparer prepares the RegenerateAuthToken request. -func (client NotebookWorkspacesClient) RegenerateAuthTokenPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateAuthTokenSender sends the RegenerateAuthToken request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) RegenerateAuthTokenSender(req *http.Request) (future NotebookWorkspacesRegenerateAuthTokenFuture, 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 -} - -// RegenerateAuthTokenResponder handles the response to the RegenerateAuthToken request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) RegenerateAuthTokenResponder(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 the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Start(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client NotebookWorkspacesClient) StartPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/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 NotebookWorkspacesClient) StartSender(req *http.Request) (future NotebookWorkspacesStartFuture, 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 NotebookWorkspacesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/operations.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/operations.go deleted file mode 100644 index e3eb521cd412..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure Cosmos DB Database Service Resource Provider REST API -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 Cosmos DB Resource Provider 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, "documentdb.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, "documentdb.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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 = "2020-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DocumentDB/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, "documentdb.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, "documentdb.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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/cosmos-db/mgmt/2020-03-01-preview/documentdb/partitionkeyrangeid.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/partitionkeyrangeid.go deleted file mode 100644 index 91c70bf809ff..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/partitionkeyrangeid.go +++ /dev/null @@ -1,133 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDClient creates an instance of the PartitionKeyRangeIDClient client. -func NewPartitionKeyRangeIDClient(subscriptionID string) PartitionKeyRangeIDClient { - return NewPartitionKeyRangeIDClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDClientWithBaseURI creates an instance of the PartitionKeyRangeIDClient 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 NewPartitionKeyRangeIDClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDClient { - return PartitionKeyRangeIDClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/partitionkeyrangeidregion.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/partitionkeyrangeidregion.go deleted file mode 100644 index 9ae3728e3071..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/partitionkeyrangeidregion.go +++ /dev/null @@ -1,135 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDRegionClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDRegionClient creates an instance of the PartitionKeyRangeIDRegionClient client. -func NewPartitionKeyRangeIDRegionClient(subscriptionID string) PartitionKeyRangeIDRegionClient { - return NewPartitionKeyRangeIDRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDRegionClientWithBaseURI creates an instance of the PartitionKeyRangeIDRegionClient 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 NewPartitionKeyRangeIDRegionClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDRegionClient { - return PartitionKeyRangeIDRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentile.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentile.go deleted file mode 100644 index 44e839c7e25d..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentile.go +++ /dev/null @@ -1,127 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileClient struct { - BaseClient -} - -// NewPercentileClient creates an instance of the PercentileClient client. -func NewPercentileClient(subscriptionID string) PercentileClient { - return NewPercentileClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileClientWithBaseURI creates an instance of the PercentileClient 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 NewPercentileClientWithBaseURI(baseURI string, subscriptionID string) PercentileClient { - return PercentileClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. This url is only -// for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentilesourcetarget.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentilesourcetarget.go deleted file mode 100644 index 18dbc37bc3be..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentilesourcetarget.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileSourceTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileSourceTargetClient struct { - BaseClient -} - -// NewPercentileSourceTargetClient creates an instance of the PercentileSourceTargetClient client. -func NewPercentileSourceTargetClient(subscriptionID string) PercentileSourceTargetClient { - return NewPercentileSourceTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileSourceTargetClientWithBaseURI creates an instance of the PercentileSourceTargetClient 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 NewPercentileSourceTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileSourceTargetClient { - return PercentileSourceTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account, source and target region. -// This url is only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// sourceRegion - source region from which data is written. Cosmos DB region, with spaces between words and -// each word capitalized. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileSourceTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileSourceTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileSourceTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, sourceRegion, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileSourceTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceRegion": autorest.Encode("path", sourceRegion), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileSourceTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileSourceTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentiletarget.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentiletarget.go deleted file mode 100644 index 8d2bd5b1ac65..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/percentiletarget.go +++ /dev/null @@ -1,131 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileTargetClient struct { - BaseClient -} - -// NewPercentileTargetClient creates an instance of the PercentileTargetClient client. -func NewPercentileTargetClient(subscriptionID string) PercentileTargetClient { - return NewPercentileTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileTargetClientWithBaseURI creates an instance of the PercentileTargetClient 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 NewPercentileTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileTargetClient { - return PercentileTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account target region. This url is -// only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, targetRegion 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), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2020-03-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/privateendpointconnections.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/privateendpointconnections.go deleted file mode 100644 index a084a08ec5ab..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/privateendpointconnections.go +++ /dev/null @@ -1,406 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) 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 = "2019-08-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.DocumentDB/databaseAccounts/{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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByDatabaseAccount list all private endpoint connections on a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/privatelinkresources.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/privatelinkresources.go deleted file mode 100644 index 42aee63e6a66..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/privatelinkresources.go +++ /dev/null @@ -1,215 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByDatabaseAccount gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateLinkResourcesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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/cosmos-db/mgmt/2020-03-01-preview/documentdb/sqlresources.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/sqlresources.go deleted file mode 100644 index 190392816f4d..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/sqlresources.go +++ /dev/null @@ -1,2780 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type SQLResourcesClient struct { - BaseClient -} - -// NewSQLResourcesClient creates an instance of the SQLResourcesClient client. -func NewSQLResourcesClient(subscriptionID string) SQLResourcesClient { - return NewSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLResourcesClientWithBaseURI creates an instance of the SQLResourcesClient 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 NewSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string) SQLResourcesClient { - return SQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateSQLContainer create or update an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// createUpdateSQLContainerParameters - the parameters to provide for the current SQL container. -func (client SQLResourcesClient) CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLContainerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", err.Error()) - } - - req, err := client.CreateUpdateSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, createUpdateSQLContainerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLContainerPreparer prepares the CreateUpdateSQLContainer request. -func (client SQLResourcesClient) CreateUpdateSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithJSON(createUpdateSQLContainerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLContainerSender sends the CreateUpdateSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLContainerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLContainerFuture, 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 -} - -// CreateUpdateSQLContainerResponder handles the response to the CreateUpdateSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLDatabase create or update an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateSQLDatabaseParameters - the parameters to provide for the current SQL database. -func (client SQLResourcesClient) CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", err.Error()) - } - - req, err := client.CreateUpdateSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateSQLDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLDatabasePreparer prepares the CreateUpdateSQLDatabase request. -func (client SQLResourcesClient) CreateUpdateSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateSQLDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLDatabaseSender sends the CreateUpdateSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseSender(req *http.Request) (future SQLResourcesCreateUpdateSQLDatabaseFuture, 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 -} - -// CreateUpdateSQLDatabaseResponder handles the response to the CreateUpdateSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLStoredProcedure create or update an Azure Cosmos DB SQL storedProcedure -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -// createUpdateSQLStoredProcedureParameters - the parameters to provide for the current SQL storedProcedure. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLStoredProcedureParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", err.Error()) - } - - req, err := client.CreateUpdateSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSQLStoredProcedureParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLStoredProcedurePreparer prepares the CreateUpdateSQLStoredProcedure request. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithJSON(createUpdateSQLStoredProcedureParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLStoredProcedureSender sends the CreateUpdateSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureSender(req *http.Request) (future SQLResourcesCreateUpdateSQLStoredProcedureFuture, 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 -} - -// CreateUpdateSQLStoredProcedureResponder handles the response to the CreateUpdateSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLTrigger create or update an Azure Cosmos DB SQL trigger -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -// createUpdateSQLTriggerParameters - the parameters to provide for the current SQL trigger. -func (client SQLResourcesClient) CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLTriggerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", err.Error()) - } - - req, err := client.CreateUpdateSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSQLTriggerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLTriggerPreparer prepares the CreateUpdateSQLTrigger request. -func (client SQLResourcesClient) CreateUpdateSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithJSON(createUpdateSQLTriggerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLTriggerSender sends the CreateUpdateSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLTriggerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLTriggerFuture, 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 -} - -// CreateUpdateSQLTriggerResponder handles the response to the CreateUpdateSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLUserDefinedFunction create or update an Azure Cosmos DB SQL userDefinedFunction -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -// createUpdateSQLUserDefinedFunctionParameters - the parameters to provide for the current SQL -// userDefinedFunction. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLUserDefinedFunctionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", err.Error()) - } - - req, err := client.CreateUpdateSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSQLUserDefinedFunctionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLUserDefinedFunctionPreparer prepares the CreateUpdateSQLUserDefinedFunction request. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithJSON(createUpdateSQLUserDefinedFunctionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLUserDefinedFunctionSender sends the CreateUpdateSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, 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 -} - -// CreateUpdateSQLUserDefinedFunctionResponder handles the response to the CreateUpdateSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSQLContainer deletes an existing Azure Cosmos DB SQL container. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesDeleteSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLContainer", err.Error()) - } - - req, err := client.DeleteSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLContainerPreparer prepares the DeleteSQLContainer request. -func (client SQLResourcesClient) DeleteSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLContainerSender sends the DeleteSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLContainerSender(req *http.Request) (future SQLResourcesDeleteSQLContainerFuture, 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 -} - -// DeleteSQLContainerResponder handles the response to the DeleteSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLContainerResponder(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 -} - -// DeleteSQLDatabase deletes an existing Azure Cosmos DB SQL database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesDeleteSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLDatabase", err.Error()) - } - - req, err := client.DeleteSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLDatabasePreparer prepares the DeleteSQLDatabase request. -func (client SQLResourcesClient) DeleteSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLDatabaseSender sends the DeleteSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLDatabaseSender(req *http.Request) (future SQLResourcesDeleteSQLDatabaseFuture, 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 -} - -// DeleteSQLDatabaseResponder handles the response to the DeleteSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLDatabaseResponder(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 -} - -// DeleteSQLStoredProcedure deletes an existing Azure Cosmos DB SQL storedProcedure. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLResourcesDeleteSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", err.Error()) - } - - req, err := client.DeleteSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLStoredProcedurePreparer prepares the DeleteSQLStoredProcedure request. -func (client SQLResourcesClient) DeleteSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLStoredProcedureSender sends the DeleteSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLStoredProcedureSender(req *http.Request) (future SQLResourcesDeleteSQLStoredProcedureFuture, 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 -} - -// DeleteSQLStoredProcedureResponder handles the response to the DeleteSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLStoredProcedureResponder(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 -} - -// DeleteSQLTrigger deletes an existing Azure Cosmos DB SQL trigger. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLResourcesDeleteSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLTrigger", err.Error()) - } - - req, err := client.DeleteSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLTriggerPreparer prepares the DeleteSQLTrigger request. -func (client SQLResourcesClient) DeleteSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLTriggerSender sends the DeleteSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLTriggerSender(req *http.Request) (future SQLResourcesDeleteSQLTriggerFuture, 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 -} - -// DeleteSQLTriggerResponder handles the response to the DeleteSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLTriggerResponder(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 -} - -// DeleteSQLUserDefinedFunction deletes an existing Azure Cosmos DB SQL userDefinedFunction. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", err.Error()) - } - - req, err := client.DeleteSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLUserDefinedFunctionPreparer prepares the DeleteSQLUserDefinedFunction request. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLUserDefinedFunctionSender sends the DeleteSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesDeleteSQLUserDefinedFunctionFuture, 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 -} - -// DeleteSQLUserDefinedFunctionResponder handles the response to the DeleteSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionResponder(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 -} - -// GetSQLContainer gets the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error()) - } - - req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerPreparer prepares the GetSQLContainer request. -func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerSender sends the GetSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database -// account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error()) - } - - req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request. -func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error()) - } - - req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabasePreparer prepares the GetSQLDatabase request. -func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database -// account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error()) - } - - req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request. -func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLStoredProcedure gets the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLStoredProcedureGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLStoredProcedure") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLStoredProcedure", err.Error()) - } - - req, err := client.GetSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLStoredProcedureSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure sending request") - return - } - - result, err = client.GetSQLStoredProcedureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLStoredProcedurePreparer prepares the GetSQLStoredProcedure request. -func (client SQLResourcesClient) GetSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLStoredProcedureSender sends the GetSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLStoredProcedureSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLStoredProcedureResponder handles the response to the GetSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLTrigger gets the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLTriggerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLTrigger") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLTrigger", err.Error()) - } - - req, err := client.GetSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLTriggerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure sending request") - return - } - - result, err = client.GetSQLTriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLTriggerPreparer prepares the GetSQLTrigger request. -func (client SQLResourcesClient) GetSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLTriggerSender sends the GetSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLTriggerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLTriggerResponder handles the response to the GetSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLUserDefinedFunction gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLUserDefinedFunctionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLUserDefinedFunction") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", err.Error()) - } - - req, err := client.GetSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLUserDefinedFunctionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure sending request") - return - } - - result, err = client.GetSQLUserDefinedFunctionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLUserDefinedFunctionPreparer prepares the GetSQLUserDefinedFunction request. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLUserDefinedFunctionSender sends the GetSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLUserDefinedFunctionResponder handles the response to the GetSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLContainers lists the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLContainerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLContainers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLContainers", err.Error()) - } - - req, err := client.ListSQLContainersPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLContainersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLContainersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLContainersPreparer prepares the ListSQLContainers request. -func (client SQLResourcesClient) ListSQLContainersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLContainersSender sends the ListSQLContainers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLContainersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLContainersResponder handles the response to the ListSQLContainers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLContainersResponder(resp *http.Response) (result SQLContainerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLDatabases lists the SQL databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result SQLDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLDatabases", err.Error()) - } - - req, err := client.ListSQLDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListSQLDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLDatabasesPreparer prepares the ListSQLDatabases request. -func (client SQLResourcesClient) ListSQLDatabasesPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLDatabasesSender sends the ListSQLDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLDatabasesResponder handles the response to the ListSQLDatabases request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLDatabasesResponder(resp *http.Response) (result SQLDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLStoredProcedures lists the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLStoredProcedureListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLStoredProcedures") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLStoredProcedures", err.Error()) - } - - req, err := client.ListSQLStoredProceduresPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLStoredProceduresSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure sending request") - return - } - - result, err = client.ListSQLStoredProceduresResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLStoredProceduresPreparer prepares the ListSQLStoredProcedures request. -func (client SQLResourcesClient) ListSQLStoredProceduresPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLStoredProceduresSender sends the ListSQLStoredProcedures request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLStoredProceduresSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLStoredProceduresResponder handles the response to the ListSQLStoredProcedures request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLStoredProceduresResponder(resp *http.Response) (result SQLStoredProcedureListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLTriggers lists the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLTriggerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLTriggers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLTriggers", err.Error()) - } - - req, err := client.ListSQLTriggersPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLTriggersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLTriggersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLTriggersPreparer prepares the ListSQLTriggers request. -func (client SQLResourcesClient) ListSQLTriggersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLTriggersSender sends the ListSQLTriggers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLTriggersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLTriggersResponder handles the response to the ListSQLTriggers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLTriggersResponder(resp *http.Response) (result SQLTriggerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLUserDefinedFunctions lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLUserDefinedFunctionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLUserDefinedFunctions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", err.Error()) - } - - req, err := client.ListSQLUserDefinedFunctionsPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLUserDefinedFunctionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure sending request") - return - } - - result, err = client.ListSQLUserDefinedFunctionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLUserDefinedFunctionsPreparer prepares the ListSQLUserDefinedFunctions request. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLUserDefinedFunctionsSender sends the ListSQLUserDefinedFunctions request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLUserDefinedFunctionsResponder handles the response to the ListSQLUserDefinedFunctions request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsResponder(resp *http.Response) (result SQLUserDefinedFunctionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLContainerToAutoscale migrate an Azure Cosmos DB SQL container from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", err.Error()) - } - - req, err := client.MigrateSQLContainerToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLContainerToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLContainerToAutoscalePreparer prepares the MigrateSQLContainerToAutoscale request. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLContainerToAutoscaleSender sends the MigrateSQLContainerToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToAutoscaleFuture, 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 -} - -// MigrateSQLContainerToAutoscaleResponder handles the response to the MigrateSQLContainerToAutoscale request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLContainerToManualThroughput migrate an Azure Cosmos DB SQL container from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", err.Error()) - } - - req, err := client.MigrateSQLContainerToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLContainerToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLContainerToManualThroughputPreparer prepares the MigrateSQLContainerToManualThroughput request. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLContainerToManualThroughputSender sends the MigrateSQLContainerToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToManualThroughputFuture, 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 -} - -// MigrateSQLContainerToManualThroughputResponder handles the response to the MigrateSQLContainerToManualThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLDatabaseToAutoscale migrate an Azure Cosmos DB SQL database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateSQLDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLDatabaseToAutoscalePreparer prepares the MigrateSQLDatabaseToAutoscale request. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLDatabaseToAutoscaleSender sends the MigrateSQLDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, 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 -} - -// MigrateSQLDatabaseToAutoscaleResponder handles the response to the MigrateSQLDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLDatabaseToManualThroughput migrate an Azure Cosmos DB SQL database from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateSQLDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLDatabaseToManualThroughputPreparer prepares the MigrateSQLDatabaseToManualThroughput request. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLDatabaseToManualThroughputSender sends the MigrateSQLDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, 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 -} - -// MigrateSQLDatabaseToManualThroughputResponder handles the response to the MigrateSQLDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLContainerThroughput update RUs per second of an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL container. -func (client SQLResourcesClient) UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLContainerThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLContainerThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", err.Error()) - } - - req, err := client.UpdateSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLContainerThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLContainerThroughputPreparer prepares the UpdateSQLContainerThroughput request. -func (client SQLResourcesClient) UpdateSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLContainerThroughputSender sends the UpdateSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLContainerThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLContainerThroughputFuture, 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 -} - -// UpdateSQLContainerThroughputResponder handles the response to the UpdateSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLDatabaseThroughput update RUs per second of an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL database. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLDatabaseThroughputPreparer prepares the UpdateSQLDatabaseThroughput request. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLDatabaseThroughputSender sends the UpdateSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLDatabaseThroughputFuture, 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 -} - -// UpdateSQLDatabaseThroughputResponder handles the response to the UpdateSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/tableresources.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/tableresources.go deleted file mode 100644 index 6202cb007db3..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/tableresources.go +++ /dev/null @@ -1,800 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TableResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type TableResourcesClient struct { - BaseClient -} - -// NewTableResourcesClient creates an instance of the TableResourcesClient client. -func NewTableResourcesClient(subscriptionID string) TableResourcesClient { - return NewTableResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTableResourcesClientWithBaseURI creates an instance of the TableResourcesClient 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 NewTableResourcesClientWithBaseURI(baseURI string, subscriptionID string) TableResourcesClient { - return TableResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateTable create or update an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// createUpdateTableParameters - the parameters to provide for the current Table. -func (client TableResourcesClient) CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (result TableResourcesCreateUpdateTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.CreateUpdateTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateTableParameters.TableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "CreateUpdateTable", err.Error()) - } - - req, err := client.CreateUpdateTablePreparer(ctx, resourceGroupName, accountName, tableName, createUpdateTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateTablePreparer prepares the CreateUpdateTable request. -func (client TableResourcesClient) CreateUpdateTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateTableSender sends the CreateUpdateTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) CreateUpdateTableSender(req *http.Request) (future TableResourcesCreateUpdateTableFuture, 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 -} - -// CreateUpdateTableResponder handles the response to the CreateUpdateTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) CreateUpdateTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteTable deletes an existing Azure Cosmos DB Table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesDeleteTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.DeleteTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "DeleteTable", err.Error()) - } - - req, err := client.DeleteTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteTablePreparer prepares the DeleteTable request. -func (client TableResourcesClient) DeleteTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteTableSender sends the DeleteTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) DeleteTableSender(req *http.Request) (future TableResourcesDeleteTableFuture, 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 -} - -// DeleteTableResponder handles the response to the DeleteTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) DeleteTableResponder(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 -} - -// GetTable gets the Tables under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTable", err.Error()) - } - - req, err := client.GetTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure sending request") - return - } - - result, err = client.GetTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure responding to request") - return - } - - return -} - -// GetTablePreparer prepares the GetTable request. -func (client TableResourcesClient) GetTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableSender sends the GetTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableResponder handles the response to the GetTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTableThroughput gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTableThroughput", err.Error()) - } - - req, err := client.GetTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetTableThroughputPreparer prepares the GetTableThroughput request. -func (client TableResourcesClient) GetTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableThroughputSender sends the GetTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableThroughputResponder handles the response to the GetTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListTables lists the Tables under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client TableResourcesClient) ListTables(ctx context.Context, resourceGroupName string, accountName string) (result TableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.ListTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "ListTables", err.Error()) - } - - req, err := client.ListTablesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure sending request") - return - } - - result, err = client.ListTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure responding to request") - return - } - - return -} - -// ListTablesPreparer prepares the ListTables request. -func (client TableResourcesClient) ListTablesPreparer(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 = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListTablesSender sends the ListTables request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) ListTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListTablesResponder handles the response to the ListTables request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) ListTablesResponder(resp *http.Response) (result TableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateTableToAutoscale migrate an Azure Cosmos DB Table from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) MigrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesMigrateTableToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.MigrateTableToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "MigrateTableToAutoscale", err.Error()) - } - - req, err := client.MigrateTableToAutoscalePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateTableToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateTableToAutoscalePreparer prepares the MigrateTableToAutoscale request. -func (client TableResourcesClient) MigrateTableToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateTableToAutoscaleSender sends the MigrateTableToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) MigrateTableToAutoscaleSender(req *http.Request) (future TableResourcesMigrateTableToAutoscaleFuture, 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 -} - -// MigrateTableToAutoscaleResponder handles the response to the MigrateTableToAutoscale request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) MigrateTableToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateTableToManualThroughput migrate an Azure Cosmos DB Table from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) MigrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesMigrateTableToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.MigrateTableToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "MigrateTableToManualThroughput", err.Error()) - } - - req, err := client.MigrateTableToManualThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateTableToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateTableToManualThroughputPreparer prepares the MigrateTableToManualThroughput request. -func (client TableResourcesClient) MigrateTableToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateTableToManualThroughputSender sends the MigrateTableToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) MigrateTableToManualThroughputSender(req *http.Request) (future TableResourcesMigrateTableToManualThroughputFuture, 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 -} - -// MigrateTableToManualThroughputResponder handles the response to the MigrateTableToManualThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) MigrateTableToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateTableThroughput update RUs per second of an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current Table. -func (client TableResourcesClient) UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result TableResourcesUpdateTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.UpdateTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.ProvisionedThroughputSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "UpdateTableThroughput", err.Error()) - } - - req, err := client.UpdateTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTableThroughputPreparer prepares the UpdateTableThroughput request. -func (client TableResourcesClient) UpdateTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-03-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTableThroughputSender sends the UpdateTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) UpdateTableThroughputSender(req *http.Request) (future TableResourcesUpdateTableThroughputFuture, 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 -} - -// UpdateTableThroughputResponder handles the response to the UpdateTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) UpdateTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/version.go b/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/version.go deleted file mode 100644 index 20e0be03870e..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-03-01-preview/documentdb/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package documentdb - -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() + " documentdb/2020-03-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/cosmos-db/mgmt/2020-04-01-preview/documentdb/CHANGELOG.md b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/_meta.json b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/_meta.json deleted file mode 100644 index f2b8a43687fd..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "tag": "package-2020-04", - "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-2020-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/cassandraresources.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/cassandraresources.go deleted file mode 100644 index 2b13b57d98e5..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/cassandraresources.go +++ /dev/null @@ -1,1591 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CassandraResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type CassandraResourcesClient struct { - BaseClient -} - -// NewCassandraResourcesClient creates an instance of the CassandraResourcesClient client. -func NewCassandraResourcesClient(subscriptionID string) CassandraResourcesClient { - return NewCassandraResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCassandraResourcesClientWithBaseURI creates an instance of the CassandraResourcesClient 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 NewCassandraResourcesClientWithBaseURI(baseURI string, subscriptionID string) CassandraResourcesClient { - return CassandraResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateCassandraKeyspace create or update an Azure Cosmos DB Cassandra keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// createUpdateCassandraKeyspaceParameters - the parameters to provide for the current Cassandra keyspace. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraKeyspaceParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", err.Error()) - } - - req, err := client.CreateUpdateCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraKeyspacePreparer prepares the CreateUpdateCassandraKeyspace request. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithJSON(createUpdateCassandraKeyspaceParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraKeyspaceSender sends the CreateUpdateCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraKeyspaceFuture, 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 -} - -// CreateUpdateCassandraKeyspaceResponder handles the response to the CreateUpdateCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateCassandraTable create or update an Azure Cosmos DB Cassandra Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// createUpdateCassandraTableParameters - the parameters to provide for the current Cassandra Table. -func (client CassandraResourcesClient) CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", err.Error()) - } - - req, err := client.CreateUpdateCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraTablePreparer prepares the CreateUpdateCassandraTable request. -func (client CassandraResourcesClient) CreateUpdateCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateCassandraTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraTableSender sends the CreateUpdateCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraTableSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraTableFuture, 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 -} - -// CreateUpdateCassandraTableResponder handles the response to the CreateUpdateCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCassandraKeyspace deletes an existing Azure Cosmos DB Cassandra keyspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesDeleteCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", err.Error()) - } - - req, err := client.DeleteCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraKeyspacePreparer prepares the DeleteCassandraKeyspace request. -func (client CassandraResourcesClient) DeleteCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraKeyspaceSender sends the DeleteCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesDeleteCassandraKeyspaceFuture, 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 -} - -// DeleteCassandraKeyspaceResponder handles the response to the DeleteCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceResponder(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 -} - -// DeleteCassandraTable deletes an existing Azure Cosmos DB Cassandra table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesDeleteCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraTable", err.Error()) - } - - req, err := client.DeleteCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraTablePreparer prepares the DeleteCassandraTable request. -func (client CassandraResourcesClient) DeleteCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraTableSender sends the DeleteCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraTableSender(req *http.Request) (future CassandraResourcesDeleteCassandraTableFuture, 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 -} - -// DeleteCassandraTableResponder handles the response to the DeleteCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraTableResponder(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 -} - -// GetCassandraKeyspace gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraKeyspaceGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspace") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspace", err.Error()) - } - - req, err := client.GetCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspacePreparer prepares the GetCassandraKeyspace request. -func (client CassandraResourcesClient) GetCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceSender sends the GetCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceResponder handles the response to the GetCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraKeyspaceThroughput gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspaceThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.GetCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspaceThroughputPreparer prepares the GetCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceThroughputSender sends the GetCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceThroughputResponder handles the response to the GetCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTable gets the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraTableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTable", err.Error()) - } - - req, err := client.GetCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTablePreparer prepares the GetCassandraTable request. -func (client CassandraResourcesClient) GetCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableSender sends the GetCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableResponder handles the response to the GetCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTableThroughput gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", err.Error()) - } - - req, err := client.GetCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTableThroughputPreparer prepares the GetCassandraTableThroughput request. -func (client CassandraResourcesClient) GetCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableThroughputSender sends the GetCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableThroughputResponder handles the response to the GetCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraKeyspaces lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client CassandraResourcesClient) ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result CassandraKeyspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraKeyspaces") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", err.Error()) - } - - req, err := client.ListCassandraKeyspacesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraKeyspacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraKeyspacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraKeyspacesPreparer prepares the ListCassandraKeyspaces request. -func (client CassandraResourcesClient) ListCassandraKeyspacesPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraKeyspacesSender sends the ListCassandraKeyspaces request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraKeyspacesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraKeyspacesResponder handles the response to the ListCassandraKeyspaces request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraKeyspacesResponder(resp *http.Response) (result CassandraKeyspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraTables lists the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraTableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraTables", err.Error()) - } - - req, err := client.ListCassandraTablesPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraTablesPreparer prepares the ListCassandraTables request. -func (client CassandraResourcesClient) ListCassandraTablesPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraTablesSender sends the ListCassandraTables request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraTablesResponder handles the response to the ListCassandraTables request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraTablesResponder(resp *http.Response) (result CassandraTableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraKeyspaceToAutoscale migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to -// autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", err.Error()) - } - - req, err := client.MigrateCassandraKeyspaceToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraKeyspaceToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraKeyspaceToAutoscalePreparer prepares the MigrateCassandraKeyspaceToAutoscale request. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraKeyspaceToAutoscaleSender sends the MigrateCassandraKeyspaceToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, 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 -} - -// MigrateCassandraKeyspaceToAutoscaleResponder handles the response to the MigrateCassandraKeyspaceToAutoscale request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraKeyspaceToManualThroughput migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", err.Error()) - } - - req, err := client.MigrateCassandraKeyspaceToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraKeyspaceToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraKeyspaceToManualThroughputPreparer prepares the MigrateCassandraKeyspaceToManualThroughput request. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraKeyspaceToManualThroughputSender sends the MigrateCassandraKeyspaceToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, 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 -} - -// MigrateCassandraKeyspaceToManualThroughputResponder handles the response to the MigrateCassandraKeyspaceToManualThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraTableToAutoscale migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", err.Error()) - } - - req, err := client.MigrateCassandraTableToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraTableToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraTableToAutoscalePreparer prepares the MigrateCassandraTableToAutoscale request. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraTableToAutoscaleSender sends the MigrateCassandraTableToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToAutoscaleFuture, 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 -} - -// MigrateCassandraTableToAutoscaleResponder handles the response to the MigrateCassandraTableToAutoscale request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraTableToManualThroughput migrate an Azure Cosmos DB Cassandra table from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", err.Error()) - } - - req, err := client.MigrateCassandraTableToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraTableToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraTableToManualThroughputPreparer prepares the MigrateCassandraTableToManualThroughput request. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraTableToManualThroughputSender sends the MigrateCassandraTableToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToManualThroughputFuture, 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 -} - -// MigrateCassandraTableToManualThroughputResponder handles the response to the MigrateCassandraTableToManualThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraKeyspaceThroughput update RUs per second of an Azure Cosmos DB Cassandra Keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// Keyspace. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraKeyspaceThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.UpdateCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraKeyspaceThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraKeyspaceThroughputPreparer prepares the UpdateCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraKeyspaceThroughputSender sends the UpdateCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, 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 -} - -// UpdateCassandraKeyspaceThroughputResponder handles the response to the UpdateCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraTableThroughput update RUs per second of an Azure Cosmos DB Cassandra table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// table. -func (client CassandraResourcesClient) UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", err.Error()) - } - - req, err := client.UpdateCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraTableThroughputPreparer prepares the UpdateCassandraTableThroughput request. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraTableThroughputSender sends the UpdateCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraTableThroughputFuture, 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 -} - -// UpdateCassandraTableThroughputResponder handles the response to the UpdateCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/client.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/client.go deleted file mode 100644 index 441fa83a45d3..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package documentdb implements the Azure ARM Documentdb service API version . -// -// Azure Cosmos DB Database Service Resource Provider REST API -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Documentdb - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Documentdb. -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/cosmos-db/mgmt/2020-04-01-preview/documentdb/collection.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collection.go deleted file mode 100644 index 01c17338d975..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collection.go +++ /dev/null @@ -1,323 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionClient struct { - BaseClient -} - -// NewCollectionClient creates an instance of the CollectionClient client. -func NewCollectionClient(subscriptionID string) CollectionClient { - return NewCollectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionClientWithBaseURI creates an instance of the CollectionClient 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 NewCollectionClientWithBaseURI(baseURI string, subscriptionID string) CollectionClient { - return CollectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -func (client CollectionClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client CollectionClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionpartition.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionpartition.go deleted file mode 100644 index f06c02d6bedb..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionpartition.go +++ /dev/null @@ -1,230 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionClient struct { - BaseClient -} - -// NewCollectionPartitionClient creates an instance of the CollectionPartitionClient client. -func NewCollectionPartitionClient(subscriptionID string) CollectionPartitionClient { - return NewCollectionPartitionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionClientWithBaseURI creates an instance of the CollectionPartitionClient 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 NewCollectionPartitionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionClient { - return CollectionPartitionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionPartitionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionUsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionPartitionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListUsagesResponder(resp *http.Response) (result PartitionUsagesResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionpartitionregion.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionpartitionregion.go deleted file mode 100644 index 77834820062a..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionpartitionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionRegionClient struct { - BaseClient -} - -// NewCollectionPartitionRegionClient creates an instance of the CollectionPartitionRegionClient client. -func NewCollectionPartitionRegionClient(subscriptionID string) CollectionPartitionRegionClient { - return NewCollectionPartitionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionRegionClientWithBaseURI creates an instance of the CollectionPartitionRegionClient 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 NewCollectionPartitionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionRegionClient { - return CollectionPartitionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection and region, split by -// partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionregion.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionregion.go deleted file mode 100644 index ab5bcee0f829..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/collectionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionRegionClient struct { - BaseClient -} - -// NewCollectionRegionClient creates an instance of the CollectionRegionClient client. -func NewCollectionRegionClient(subscriptionID string) CollectionRegionClient { - return NewCollectionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionRegionClientWithBaseURI creates an instance of the CollectionRegionClient 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 NewCollectionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionRegionClient { - return CollectionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account, collection and -// region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/database.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/database.go deleted file mode 100644 index f5fe2dd03b1a..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/database.go +++ /dev/null @@ -1,317 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseClient struct { - BaseClient -} - -// NewDatabaseClient creates an instance of the DatabaseClient client. -func NewDatabaseClient(subscriptionID string) DatabaseClient { - return NewDatabaseClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseClientWithBaseURI creates an instance of the DatabaseClient 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 NewDatabaseClientWithBaseURI(baseURI string, subscriptionID string) DatabaseClient { - return DatabaseClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -func (client DatabaseClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/databaseaccountregion.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/databaseaccountregion.go deleted file mode 100644 index 0daa8eda77e0..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/databaseaccountregion.go +++ /dev/null @@ -1,129 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountRegionClient struct { - BaseClient -} - -// NewDatabaseAccountRegionClient creates an instance of the DatabaseAccountRegionClient client. -func NewDatabaseAccountRegionClient(subscriptionID string) DatabaseAccountRegionClient { - return NewDatabaseAccountRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountRegionClientWithBaseURI creates an instance of the DatabaseAccountRegionClient 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 NewDatabaseAccountRegionClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountRegionClient { - return DatabaseAccountRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/databaseaccounts.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/databaseaccounts.go deleted file mode 100644 index 4fe81e8dac36..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/databaseaccounts.go +++ /dev/null @@ -1,1692 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountsClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountsClient struct { - BaseClient -} - -// NewDatabaseAccountsClient creates an instance of the DatabaseAccountsClient client. -func NewDatabaseAccountsClient(subscriptionID string) DatabaseAccountsClient { - return NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountsClientWithBaseURI creates an instance of the DatabaseAccountsClient 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 NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountsClient { - return DatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameExists checks that the Azure Cosmos DB account name already exists. A valid account name may contain only -// lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. -// Parameters: -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.CheckNameExists") - 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: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CheckNameExists", err.Error()) - } - - req, err := client.CheckNameExistsPreparer(ctx, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") - return - } - - result, err = client.CheckNameExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameExistsPreparer prepares the CheckNameExists request. -func (client DatabaseAccountsClient) CheckNameExistsPreparer(ctx context.Context, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameExistsSender sends the CheckNameExists request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) CheckNameExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CheckNameExistsResponder handles the response to the CheckNameExists request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when -// performing updates on an account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// createUpdateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (result DatabaseAccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateParameters, - Constraints: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMaximum, Rule: int64(2147483647), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: int64(86400), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: int64(5), Chain: nil}, - }}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.DatabaseAccountOfferType", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, createUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (*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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(createUpdateParameters), - 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 DatabaseAccountsClient) CreateOrUpdateSender(req *http.Request) (future DatabaseAccountsCreateOrUpdateFuture, 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 DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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 existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseAccountsClient) 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 = "2020-04-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) DeleteSender(req *http.Request) (future DatabaseAccountsDeleteFuture, 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 DatabaseAccountsClient) 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 -} - -// FailoverPriorityChange changes the failover priority for the Azure Cosmos DB database account. A failover priority -// of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover -// priority values must be unique for each of the regions in which the database account exists. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// failoverParameters - the new failover policies for the database account. -func (client DatabaseAccountsClient) FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (result DatabaseAccountsFailoverPriorityChangeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.FailoverPriorityChange") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: failoverParameters, - Constraints: []validation.Constraint{{Target: "failoverParameters.FailoverPolicies", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "FailoverPriorityChange", err.Error()) - } - - req, err := client.FailoverPriorityChangePreparer(ctx, resourceGroupName, accountName, failoverParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") - return - } - - result, err = client.FailoverPriorityChangeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPriorityChangePreparer prepares the FailoverPriorityChange request. -func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (*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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", pathParameters), - autorest.WithJSON(failoverParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverPriorityChangeSender sends the FailoverPriorityChange request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) FailoverPriorityChangeSender(req *http.Request) (future DatabaseAccountsFailoverPriorityChangeFuture, 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 -} - -// FailoverPriorityChangeResponder handles the response to the FailoverPriorityChange request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(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 retrieves the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseAccountsClient) 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 = "2020-04-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) 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 DatabaseAccountsClient) GetResponder(resp *http.Response) (result DatabaseAccountGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.GetReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", err.Error()) - } - - req, err := client.GetReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.GetReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// GetReadOnlyKeysPreparer prepares the GetReadOnlyKeys request. -func (client DatabaseAccountsClient) GetReadOnlyKeysPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetReadOnlyKeysSender sends the GetReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) GetReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetReadOnlyKeysResponder handles the response to the GetReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) GetReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, 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 the Azure Cosmos DB database accounts available under the subscription. -func (client DatabaseAccountsClient) List(ctx context.Context) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DatabaseAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the Azure Cosmos DB database accounts available under the given resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client DatabaseAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DatabaseAccountsClient) 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-04-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.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionStrings lists the connection strings for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListConnectionStrings") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListConnectionStrings", err.Error()) - } - - req, err := client.ListConnectionStringsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionStringsPreparer prepares the ListConnectionStrings request. -func (client DatabaseAccountsClient) ListConnectionStringsPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.Response) (result DatabaseAccountListConnectionStringsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DatabaseAccountsClient) ListKeysPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (result DatabaseAccountListKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions retrieves metric definitions for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseAccountsClient) ListMetricDefinitionsPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountsClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", err.Error()) - } - - req, err := client.ListReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.ListReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListReadOnlyKeysPreparer prepares the ListReadOnlyKeys request. -func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListReadOnlyKeysSender sends the ListReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListReadOnlyKeysResponder handles the response to the ListReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseAccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseAccountsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOffline - cosmos DB region to offline for the database account. -func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (result DatabaseAccountsOfflineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OfflineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOffline, - Constraints: []validation.Constraint{{Target: "regionParameterForOffline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OfflineRegion", err.Error()) - } - - req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOffline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OfflineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OfflineRegionPreparer prepares the OfflineRegion request. -func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (*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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/offlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOffline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OfflineRegionSender sends the OfflineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OfflineRegionSender(req *http.Request) (future DatabaseAccountsOfflineRegionFuture, 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 -} - -// OfflineRegionResponder handles the response to the OfflineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// OnlineRegion online the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOnline - cosmos DB region to online for the database account. -func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (result DatabaseAccountsOnlineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OnlineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOnline, - Constraints: []validation.Constraint{{Target: "regionParameterForOnline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OnlineRegion", err.Error()) - } - - req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOnline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OnlineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OnlineRegionPreparer prepares the OnlineRegion request. -func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (*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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/onlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOnline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OnlineRegionSender sends the OnlineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OnlineRegionSender(req *http.Request) (future DatabaseAccountsOnlineRegionFuture, 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 -} - -// OnlineRegionResponder handles the response to the OnlineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OnlineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateKey regenerates an access key for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyToRegenerate - the name of the key to regenerate. -func (client DatabaseAccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (result DatabaseAccountsRegenerateKeyFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.RegenerateKey") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, keyToRegenerate) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateKeySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DatabaseAccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (*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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(keyToRegenerate), - 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 DatabaseAccountsClient) RegenerateKeySender(req *http.Request) (future DatabaseAccountsRegenerateKeyFuture, 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 -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) RegenerateKeyResponder(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 the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// updateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (result DatabaseAccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabaseAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (*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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 DatabaseAccountsClient) UpdateSender(req *http.Request) (future DatabaseAccountsUpdateFuture, 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 DatabaseAccountsClient) UpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/documentdbapi/interfaces.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/documentdbapi/interfaces.go deleted file mode 100644 index 5369569f32c1..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/documentdbapi/interfaces.go +++ /dev/null @@ -1,272 +0,0 @@ -package documentdbapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/cosmos-db/mgmt/2020-04-01-preview/documentdb" - "github.com/Azure/go-autorest/autorest" -) - -// DatabaseAccountsClientAPI contains the set of methods on the DatabaseAccountsClient type. -type DatabaseAccountsClientAPI interface { - CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters documentdb.DatabaseAccountCreateUpdateParameters) (result documentdb.DatabaseAccountsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountsDeleteFuture, err error) - FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters documentdb.FailoverPolicies) (result documentdb.DatabaseAccountsFailoverPriorityChangeFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountGetResults, err error) - GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - List(ctx context.Context) (result documentdb.DatabaseAccountsListResult, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result documentdb.DatabaseAccountsListResult, err error) - ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListConnectionStringsResult, err error) - ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListKeysResult, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.MetricListResult, err error) - ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.UsagesResult, err error) - OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOfflineRegionFuture, err error) - OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOnlineRegionFuture, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate documentdb.DatabaseAccountRegenerateKeyParameters) (result documentdb.DatabaseAccountsRegenerateKeyFuture, err error) - Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters documentdb.DatabaseAccountUpdateParameters) (result documentdb.DatabaseAccountsUpdateFuture, err error) -} - -var _ DatabaseAccountsClientAPI = (*documentdb.DatabaseAccountsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result documentdb.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result documentdb.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*documentdb.OperationsClient)(nil) - -// DatabaseClientAPI contains the set of methods on the DatabaseClient type. -type DatabaseClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ DatabaseClientAPI = (*documentdb.DatabaseClient)(nil) - -// CollectionClientAPI contains the set of methods on the CollectionClient type. -type CollectionClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ CollectionClientAPI = (*documentdb.CollectionClient)(nil) - -// CollectionRegionClientAPI contains the set of methods on the CollectionRegionClient type. -type CollectionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ CollectionRegionClientAPI = (*documentdb.CollectionRegionClient)(nil) - -// DatabaseAccountRegionClientAPI contains the set of methods on the DatabaseAccountRegionClient type. -type DatabaseAccountRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ DatabaseAccountRegionClientAPI = (*documentdb.DatabaseAccountRegionClient)(nil) - -// PercentileSourceTargetClientAPI contains the set of methods on the PercentileSourceTargetClient type. -type PercentileSourceTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileSourceTargetClientAPI = (*documentdb.PercentileSourceTargetClient)(nil) - -// PercentileTargetClientAPI contains the set of methods on the PercentileTargetClient type. -type PercentileTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileTargetClientAPI = (*documentdb.PercentileTargetClient)(nil) - -// PercentileClientAPI contains the set of methods on the PercentileClient type. -type PercentileClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileClientAPI = (*documentdb.PercentileClient)(nil) - -// CollectionPartitionRegionClientAPI contains the set of methods on the CollectionPartitionRegionClient type. -type CollectionPartitionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ CollectionPartitionRegionClientAPI = (*documentdb.CollectionPartitionRegionClient)(nil) - -// CollectionPartitionClientAPI contains the set of methods on the CollectionPartitionClient type. -type CollectionPartitionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionUsagesResult, err error) -} - -var _ CollectionPartitionClientAPI = (*documentdb.CollectionPartitionClient)(nil) - -// PartitionKeyRangeIDClientAPI contains the set of methods on the PartitionKeyRangeIDClient type. -type PartitionKeyRangeIDClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDClientAPI = (*documentdb.PartitionKeyRangeIDClient)(nil) - -// PartitionKeyRangeIDRegionClientAPI contains the set of methods on the PartitionKeyRangeIDRegionClient type. -type PartitionKeyRangeIDRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDRegionClientAPI = (*documentdb.PartitionKeyRangeIDRegionClient)(nil) - -// SQLResourcesClientAPI contains the set of methods on the SQLResourcesClient type. -type SQLResourcesClientAPI interface { - CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters documentdb.SQLContainerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLContainerFuture, err error) - CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters documentdb.SQLDatabaseCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture, err error) - CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters documentdb.SQLStoredProcedureCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) - CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters documentdb.SQLTriggerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLTriggerFuture, err error) - CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters documentdb.SQLUserDefinedFunctionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) - DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesDeleteSQLContainerFuture, err error) - DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesDeleteSQLDatabaseFuture, err error) - DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLResourcesDeleteSQLStoredProcedureFuture, err error) - DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLResourcesDeleteSQLTriggerFuture, err error) - DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) - GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLContainerGetResults, err error) - GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLDatabaseGetResults, err error) - GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLStoredProcedureGetResults, err error) - GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLTriggerGetResults, err error) - GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLUserDefinedFunctionGetResults, err error) - ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLContainerListResult, err error) - ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLDatabaseListResult, err error) - ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLStoredProcedureListResult, err error) - ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLTriggerListResult, err error) - ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLUserDefinedFunctionListResult, err error) - MigrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) - MigrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) - MigrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) - MigrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) - UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLContainerThroughputFuture, err error) - UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) -} - -var _ SQLResourcesClientAPI = (*documentdb.SQLResourcesClient)(nil) - -// MongoDBResourcesClientAPI contains the set of methods on the MongoDBResourcesClient type. -type MongoDBResourcesClientAPI interface { - CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters documentdb.MongoDBCollectionCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) - CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters documentdb.MongoDBDatabaseCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) - DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture, err error) - DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) - GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBCollectionGetResults, err error) - GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBDatabaseGetResults, err error) - GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBCollectionListResult, err error) - ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MongoDBDatabaseListResult, err error) - MigrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) - MigrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) - MigrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) - MigrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) - UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) - UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) -} - -var _ MongoDBResourcesClientAPI = (*documentdb.MongoDBResourcesClient)(nil) - -// TableResourcesClientAPI contains the set of methods on the TableResourcesClient type. -type TableResourcesClientAPI interface { - CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters documentdb.TableCreateUpdateParameters) (result documentdb.TableResourcesCreateUpdateTableFuture, err error) - DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesDeleteTableFuture, err error) - GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableGetResults, err error) - GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListTables(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.TableListResult, err error) - MigrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesMigrateTableToAutoscaleFuture, err error) - MigrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesMigrateTableToManualThroughputFuture, err error) - UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.TableResourcesUpdateTableThroughputFuture, err error) -} - -var _ TableResourcesClientAPI = (*documentdb.TableResourcesClient)(nil) - -// CassandraResourcesClientAPI contains the set of methods on the CassandraResourcesClient type. -type CassandraResourcesClientAPI interface { - CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters documentdb.CassandraKeyspaceCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) - CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters documentdb.CassandraTableCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraTableFuture, err error) - DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture, err error) - DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesDeleteCassandraTableFuture, err error) - GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraKeyspaceGetResults, err error) - GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraTableGetResults, err error) - GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.CassandraKeyspaceListResult, err error) - ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraTableListResult, err error) - MigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) - MigrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) - MigrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) - MigrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) - UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) - UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture, err error) -} - -var _ CassandraResourcesClientAPI = (*documentdb.CassandraResourcesClient)(nil) - -// GremlinResourcesClientAPI contains the set of methods on the GremlinResourcesClient type. -type GremlinResourcesClientAPI interface { - CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters documentdb.GremlinDatabaseCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) - CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters documentdb.GremlinGraphCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture, err error) - DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesDeleteGremlinDatabaseFuture, err error) - DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesDeleteGremlinGraphFuture, err error) - GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinDatabaseGetResults, err error) - GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinGraphGetResults, err error) - GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.GremlinDatabaseListResult, err error) - ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinGraphListResult, err error) - MigrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) - MigrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) - MigrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) - MigrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) - UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) - UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) -} - -var _ GremlinResourcesClientAPI = (*documentdb.GremlinResourcesClient)(nil) - -// NotebookWorkspacesClientAPI contains the set of methods on the NotebookWorkspacesClient type. -type NotebookWorkspacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters documentdb.NotebookWorkspaceCreateUpdateParameters) (result documentdb.NotebookWorkspacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspace, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceListResult, err error) - ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceConnectionInfoResult, err error) - RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesRegenerateAuthTokenFuture, err error) - Start(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesStartFuture, err error) -} - -var _ NotebookWorkspacesClientAPI = (*documentdb.NotebookWorkspacesClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result documentdb.PrivateLinkResource, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateLinkResourceListResult, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*documentdb.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters documentdb.PrivateEndpointConnection) (result documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnection, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateEndpointConnectionListResult, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*documentdb.PrivateEndpointConnectionsClient)(nil) diff --git a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/enums.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/enums.go deleted file mode 100644 index f406142864ba..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/enums.go +++ /dev/null @@ -1,325 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CompositePathSortOrder enumerates the values for composite path sort order. -type CompositePathSortOrder string - -const ( - // Ascending ... - Ascending CompositePathSortOrder = "Ascending" - // Descending ... - Descending CompositePathSortOrder = "Descending" -) - -// PossibleCompositePathSortOrderValues returns an array of possible values for the CompositePathSortOrder const type. -func PossibleCompositePathSortOrderValues() []CompositePathSortOrder { - return []CompositePathSortOrder{Ascending, Descending} -} - -// ConflictResolutionMode enumerates the values for conflict resolution mode. -type ConflictResolutionMode string - -const ( - // Custom ... - Custom ConflictResolutionMode = "Custom" - // LastWriterWins ... - LastWriterWins ConflictResolutionMode = "LastWriterWins" -) - -// PossibleConflictResolutionModeValues returns an array of possible values for the ConflictResolutionMode const type. -func PossibleConflictResolutionModeValues() []ConflictResolutionMode { - return []ConflictResolutionMode{Custom, LastWriterWins} -} - -// ConnectorOffer enumerates the values for connector offer. -type ConnectorOffer string - -const ( - // Small ... - Small ConnectorOffer = "Small" -) - -// PossibleConnectorOfferValues returns an array of possible values for the ConnectorOffer const type. -func PossibleConnectorOfferValues() []ConnectorOffer { - return []ConnectorOffer{Small} -} - -// DatabaseAccountKind enumerates the values for database account kind. -type DatabaseAccountKind string - -const ( - // GlobalDocumentDB ... - GlobalDocumentDB DatabaseAccountKind = "GlobalDocumentDB" - // MongoDB ... - MongoDB DatabaseAccountKind = "MongoDB" - // Parse ... - Parse DatabaseAccountKind = "Parse" -) - -// PossibleDatabaseAccountKindValues returns an array of possible values for the DatabaseAccountKind const type. -func PossibleDatabaseAccountKindValues() []DatabaseAccountKind { - return []DatabaseAccountKind{GlobalDocumentDB, MongoDB, Parse} -} - -// DatabaseAccountOfferType enumerates the values for database account offer type. -type DatabaseAccountOfferType string - -const ( - // Standard ... - Standard DatabaseAccountOfferType = "Standard" -) - -// PossibleDatabaseAccountOfferTypeValues returns an array of possible values for the DatabaseAccountOfferType const type. -func PossibleDatabaseAccountOfferTypeValues() []DatabaseAccountOfferType { - return []DatabaseAccountOfferType{Standard} -} - -// DataType enumerates the values for data type. -type DataType string - -const ( - // LineString ... - LineString DataType = "LineString" - // MultiPolygon ... - MultiPolygon DataType = "MultiPolygon" - // Number ... - Number DataType = "Number" - // Point ... - Point DataType = "Point" - // Polygon ... - Polygon DataType = "Polygon" - // String ... - String DataType = "String" -) - -// PossibleDataTypeValues returns an array of possible values for the DataType const type. -func PossibleDataTypeValues() []DataType { - return []DataType{LineString, MultiPolygon, Number, Point, Polygon, String} -} - -// DefaultConsistencyLevel enumerates the values for default consistency level. -type DefaultConsistencyLevel string - -const ( - // BoundedStaleness ... - BoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" - // ConsistentPrefix ... - ConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" - // Eventual ... - Eventual DefaultConsistencyLevel = "Eventual" - // Session ... - Session DefaultConsistencyLevel = "Session" - // Strong ... - Strong DefaultConsistencyLevel = "Strong" -) - -// PossibleDefaultConsistencyLevelValues returns an array of possible values for the DefaultConsistencyLevel const type. -func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { - return []DefaultConsistencyLevel{BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong} -} - -// IndexingMode enumerates the values for indexing mode. -type IndexingMode string - -const ( - // Consistent ... - Consistent IndexingMode = "Consistent" - // Lazy ... - Lazy IndexingMode = "Lazy" - // None ... - None IndexingMode = "None" -) - -// PossibleIndexingModeValues returns an array of possible values for the IndexingMode const type. -func PossibleIndexingModeValues() []IndexingMode { - return []IndexingMode{Consistent, Lazy, None} -} - -// IndexKind enumerates the values for index kind. -type IndexKind string - -const ( - // Hash ... - Hash IndexKind = "Hash" - // Range ... - Range IndexKind = "Range" - // Spatial ... - Spatial IndexKind = "Spatial" -) - -// PossibleIndexKindValues returns an array of possible values for the IndexKind const type. -func PossibleIndexKindValues() []IndexKind { - return []IndexKind{Hash, Range, Spatial} -} - -// KeyKind enumerates the values for key kind. -type KeyKind string - -const ( - // Primary ... - Primary KeyKind = "primary" - // PrimaryReadonly ... - PrimaryReadonly KeyKind = "primaryReadonly" - // Secondary ... - Secondary KeyKind = "secondary" - // SecondaryReadonly ... - SecondaryReadonly KeyKind = "secondaryReadonly" -) - -// PossibleKeyKindValues returns an array of possible values for the KeyKind const type. -func PossibleKeyKindValues() []KeyKind { - return []KeyKind{Primary, PrimaryReadonly, Secondary, SecondaryReadonly} -} - -// PartitionKind enumerates the values for partition kind. -type PartitionKind string - -const ( - // PartitionKindHash ... - PartitionKindHash PartitionKind = "Hash" - // PartitionKindRange ... - PartitionKindRange PartitionKind = "Range" -) - -// PossiblePartitionKindValues returns an array of possible values for the PartitionKind const type. -func PossiblePartitionKindValues() []PartitionKind { - return []PartitionKind{PartitionKindHash, PartitionKindRange} -} - -// PrimaryAggregationType enumerates the values for primary aggregation type. -type PrimaryAggregationType string - -const ( - // PrimaryAggregationTypeAverage ... - PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" - // PrimaryAggregationTypeLast ... - PrimaryAggregationTypeLast PrimaryAggregationType = "Last" - // PrimaryAggregationTypeMaximum ... - PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" - // PrimaryAggregationTypeMinimum ... - PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" - // PrimaryAggregationTypeNone ... - PrimaryAggregationTypeNone PrimaryAggregationType = "None" - // PrimaryAggregationTypeTotal ... - PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" -) - -// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeLast, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // Disabled ... - Disabled PublicNetworkAccess = "Disabled" - // Enabled ... - Enabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{Disabled, Enabled} -} - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // ThreeFullStopSix ... - ThreeFullStopSix ServerVersion = "3.6" - // ThreeFullStopTwo ... - ThreeFullStopTwo ServerVersion = "3.2" -) - -// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. -func PossibleServerVersionValues() []ServerVersion { - return []ServerVersion{ThreeFullStopSix, ThreeFullStopTwo} -} - -// SpatialType enumerates the values for spatial type. -type SpatialType string - -const ( - // SpatialTypeLineString ... - SpatialTypeLineString SpatialType = "LineString" - // SpatialTypeMultiPolygon ... - SpatialTypeMultiPolygon SpatialType = "MultiPolygon" - // SpatialTypePoint ... - SpatialTypePoint SpatialType = "Point" - // SpatialTypePolygon ... - SpatialTypePolygon SpatialType = "Polygon" -) - -// PossibleSpatialTypeValues returns an array of possible values for the SpatialType const type. -func PossibleSpatialTypeValues() []SpatialType { - return []SpatialType{SpatialTypeLineString, SpatialTypeMultiPolygon, SpatialTypePoint, SpatialTypePolygon} -} - -// TriggerOperation enumerates the values for trigger operation. -type TriggerOperation string - -const ( - // All ... - All TriggerOperation = "All" - // Create ... - Create TriggerOperation = "Create" - // Delete ... - Delete TriggerOperation = "Delete" - // Replace ... - Replace TriggerOperation = "Replace" - // Update ... - Update TriggerOperation = "Update" -) - -// PossibleTriggerOperationValues returns an array of possible values for the TriggerOperation const type. -func PossibleTriggerOperationValues() []TriggerOperation { - return []TriggerOperation{All, Create, Delete, Replace, Update} -} - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // Post ... - Post TriggerType = "Post" - // Pre ... - Pre TriggerType = "Pre" -) - -// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. -func PossibleTriggerTypeValues() []TriggerType { - return []TriggerType{Post, Pre} -} - -// UnitType enumerates the values for unit type. -type UnitType string - -const ( - // Bytes ... - Bytes UnitType = "Bytes" - // BytesPerSecond ... - BytesPerSecond UnitType = "BytesPerSecond" - // Count ... - Count UnitType = "Count" - // CountPerSecond ... - CountPerSecond UnitType = "CountPerSecond" - // Milliseconds ... - Milliseconds UnitType = "Milliseconds" - // Percent ... - Percent UnitType = "Percent" - // Seconds ... - Seconds UnitType = "Seconds" -) - -// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{Bytes, BytesPerSecond, Count, CountPerSecond, Milliseconds, Percent, Seconds} -} diff --git a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/gremlinresources.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/gremlinresources.go deleted file mode 100644 index 939d420b7457..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/gremlinresources.go +++ /dev/null @@ -1,1595 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GremlinResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type GremlinResourcesClient struct { - BaseClient -} - -// NewGremlinResourcesClient creates an instance of the GremlinResourcesClient client. -func NewGremlinResourcesClient(subscriptionID string) GremlinResourcesClient { - return NewGremlinResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGremlinResourcesClientWithBaseURI creates an instance of the GremlinResourcesClient 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 NewGremlinResourcesClientWithBaseURI(baseURI string, subscriptionID string) GremlinResourcesClient { - return GremlinResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateGremlinDatabase create or update an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateGremlinDatabaseParameters - the parameters to provide for the current Gremlin database. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", err.Error()) - } - - req, err := client.CreateUpdateGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinDatabasePreparer prepares the CreateUpdateGremlinDatabase request. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateGremlinDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinDatabaseSender sends the CreateUpdateGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinDatabaseFuture, 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 -} - -// CreateUpdateGremlinDatabaseResponder handles the response to the CreateUpdateGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateGremlinGraph create or update an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// createUpdateGremlinGraphParameters - the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinGraphParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", err.Error()) - } - - req, err := client.CreateUpdateGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinGraphPreparer prepares the CreateUpdateGremlinGraph request. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithJSON(createUpdateGremlinGraphParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinGraphSender sends the CreateUpdateGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinGraphFuture, 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 -} - -// CreateUpdateGremlinGraphResponder handles the response to the CreateUpdateGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteGremlinDatabase deletes an existing Azure Cosmos DB Gremlin database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesDeleteGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", err.Error()) - } - - req, err := client.DeleteGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinDatabasePreparer prepares the DeleteGremlinDatabase request. -func (client GremlinResourcesClient) DeleteGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinDatabaseSender sends the DeleteGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinDatabaseSender(req *http.Request) (future GremlinResourcesDeleteGremlinDatabaseFuture, 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 -} - -// DeleteGremlinDatabaseResponder handles the response to the DeleteGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinDatabaseResponder(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 -} - -// DeleteGremlinGraph deletes an existing Azure Cosmos DB Gremlin graph. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesDeleteGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinGraph", err.Error()) - } - - req, err := client.DeleteGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinGraphPreparer prepares the DeleteGremlinGraph request. -func (client GremlinResourcesClient) DeleteGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinGraphSender sends the DeleteGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinGraphSender(req *http.Request) (future GremlinResourcesDeleteGremlinGraphFuture, 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 -} - -// DeleteGremlinGraphResponder handles the response to the DeleteGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinGraphResponder(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 -} - -// GetGremlinDatabase gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabase", err.Error()) - } - - req, err := client.GetGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabasePreparer prepares the GetGremlinDatabase request. -func (client GremlinResourcesClient) GetGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseSender sends the GetGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseResponder handles the response to the GetGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinDatabaseThroughput gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.GetGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabaseThroughputPreparer prepares the GetGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseThroughputSender sends the GetGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseThroughputResponder handles the response to the GetGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraph gets the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinGraphGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraph") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraph", err.Error()) - } - - req, err := client.GetGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphPreparer prepares the GetGremlinGraph request. -func (client GremlinResourcesClient) GetGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphSender sends the GetGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphResponder handles the response to the GetGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraphThroughput gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with -// the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraphThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", err.Error()) - } - - req, err := client.GetGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphThroughputPreparer prepares the GetGremlinGraphThroughput request. -func (client GremlinResourcesClient) GetGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphThroughputSender sends the GetGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphThroughputResponder handles the response to the GetGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinDatabases lists the Gremlin databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client GremlinResourcesClient) ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result GremlinDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinDatabases", err.Error()) - } - - req, err := client.ListGremlinDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinDatabasesPreparer prepares the ListGremlinDatabases request. -func (client GremlinResourcesClient) ListGremlinDatabasesPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinDatabasesSender sends the ListGremlinDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinDatabasesResponder handles the response to the ListGremlinDatabases request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinDatabasesResponder(resp *http.Response) (result GremlinDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinGraphs lists the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinGraphListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinGraphs") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinGraphs", err.Error()) - } - - req, err := client.ListGremlinGraphsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinGraphsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinGraphsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinGraphsPreparer prepares the ListGremlinGraphs request. -func (client GremlinResourcesClient) ListGremlinGraphsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinGraphsSender sends the ListGremlinGraphs request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinGraphsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinGraphsResponder handles the response to the ListGremlinGraphs request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinGraphsResponder(resp *http.Response) (result GremlinGraphListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinDatabaseToAutoscale migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateGremlinDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinDatabaseToAutoscalePreparer prepares the MigrateGremlinDatabaseToAutoscale request. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinDatabaseToAutoscaleSender sends the MigrateGremlinDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, 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 -} - -// MigrateGremlinDatabaseToAutoscaleResponder handles the response to the MigrateGremlinDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinDatabaseToManualThroughput migrate an Azure Cosmos DB Gremlin database from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateGremlinDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinDatabaseToManualThroughputPreparer prepares the MigrateGremlinDatabaseToManualThroughput request. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinDatabaseToManualThroughputSender sends the MigrateGremlinDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, 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 -} - -// MigrateGremlinDatabaseToManualThroughputResponder handles the response to the MigrateGremlinDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinGraphToAutoscale migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", err.Error()) - } - - req, err := client.MigrateGremlinGraphToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinGraphToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinGraphToAutoscalePreparer prepares the MigrateGremlinGraphToAutoscale request. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinGraphToAutoscaleSender sends the MigrateGremlinGraphToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, 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 -} - -// MigrateGremlinGraphToAutoscaleResponder handles the response to the MigrateGremlinGraphToAutoscale request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinGraphToManualThroughput migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", err.Error()) - } - - req, err := client.MigrateGremlinGraphToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinGraphToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinGraphToManualThroughputPreparer prepares the MigrateGremlinGraphToManualThroughput request. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinGraphToManualThroughputSender sends the MigrateGremlinGraphToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, 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 -} - -// MigrateGremlinGraphToManualThroughputResponder handles the response to the MigrateGremlinGraphToManualThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinDatabaseThroughput update RUs per second of an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin -// database. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinDatabaseThroughputPreparer prepares the UpdateGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinDatabaseThroughputSender sends the UpdateGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinDatabaseThroughputFuture, 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 -} - -// UpdateGremlinDatabaseThroughputResponder handles the response to the UpdateGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinGraphThroughput update RUs per second of an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinGraphThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", err.Error()) - } - - req, err := client.UpdateGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinGraphThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinGraphThroughputPreparer prepares the UpdateGremlinGraphThroughput request. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinGraphThroughputSender sends the UpdateGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinGraphThroughputFuture, 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 -} - -// UpdateGremlinGraphThroughputResponder handles the response to the UpdateGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/models.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/models.go deleted file mode 100644 index 6983edc38f76..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/models.go +++ /dev/null @@ -1,8065 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb" - -// APIProperties ... -type APIProperties struct { - // ServerVersion - Describes the ServerVersion of an a MongoDB account. Possible values include: 'ThreeFullStopTwo', 'ThreeFullStopSix' - ServerVersion ServerVersion `json:"serverVersion,omitempty"` -} - -// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other -// than required location and tags -type ARMProxyResource struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ARMProxyResource. -func (apr ARMProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ARMResourceProperties the core properties of ARM resources. -type ARMResourceProperties struct { - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ARMResourceProperties. -func (arp ARMResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Location != nil { - objectMap["location"] = arp.Location - } - if arp.Tags != nil { - objectMap["tags"] = arp.Tags - } - return json.Marshal(objectMap) -} - -// AutoscaleSettings ... -type AutoscaleSettings struct { - // MaxThroughput - Represents maximum throughput, the resource can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` -} - -// AutoscaleSettingsResource cosmos DB provisioned throughput settings object -type AutoscaleSettingsResource struct { - // MaxThroughput - Represents maximum throughput container can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` - // AutoUpgradePolicy - Cosmos DB resource auto-upgrade policy - AutoUpgradePolicy *AutoUpgradePolicyResource `json:"autoUpgradePolicy,omitempty"` - // TargetMaxThroughput - READ-ONLY; Represents target maximum throughput container can scale up to once offer is no longer in pending state. - TargetMaxThroughput *int32 `json:"targetMaxThroughput,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingsResource. -func (asr AutoscaleSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.MaxThroughput != nil { - objectMap["maxThroughput"] = asr.MaxThroughput - } - if asr.AutoUpgradePolicy != nil { - objectMap["autoUpgradePolicy"] = asr.AutoUpgradePolicy - } - return json.Marshal(objectMap) -} - -// AutoUpgradePolicyResource cosmos DB resource auto-upgrade policy -type AutoUpgradePolicyResource struct { - // ThroughputPolicy - Represents throughput policy which service must adhere to for auto-upgrade - ThroughputPolicy *ThroughputPolicyResource `json:"throughputPolicy,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) -} - -// Capability cosmos DB capability object -type Capability struct { - // Name - Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". - Name *string `json:"name,omitempty"` -} - -// CassandraKeyspaceCreateUpdateParameters parameters to create and update Cosmos DB Cassandra keyspace. -type CassandraKeyspaceCreateUpdateParameters struct { - // CassandraKeyspaceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra keyspace. - *CassandraKeyspaceCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceCreateUpdateParameters. -func (ckcup CassandraKeyspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckcup.CassandraKeyspaceCreateUpdateProperties != nil { - objectMap["properties"] = ckcup.CassandraKeyspaceCreateUpdateProperties - } - if ckcup.Location != nil { - objectMap["location"] = ckcup.Location - } - if ckcup.Tags != nil { - objectMap["tags"] = ckcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceCreateUpdateParameters struct. -func (ckcup *CassandraKeyspaceCreateUpdateParameters) 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 cassandraKeyspaceCreateUpdateProperties CassandraKeyspaceCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraKeyspaceCreateUpdateProperties) - if err != nil { - return err - } - ckcup.CassandraKeyspaceCreateUpdateProperties = &cassandraKeyspaceCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckcup.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra -// keyspace. -type CassandraKeyspaceCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra keyspace - Resource *CassandraKeyspaceResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetProperties the properties of an Azure Cosmos DB Cassandra keyspace -type CassandraKeyspaceGetProperties struct { - Resource *CassandraKeyspaceGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraKeyspaceGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetPropertiesOptions ... -type CassandraKeyspaceGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// CassandraKeyspaceGetPropertiesResource ... -type CassandraKeyspaceGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetPropertiesResource. -func (ckgp CassandraKeyspaceGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgp.ID != nil { - objectMap["id"] = ckgp.ID - } - return json.Marshal(objectMap) -} - -// CassandraKeyspaceGetResults an Azure Cosmos DB Cassandra keyspace. -type CassandraKeyspaceGetResults struct { - autorest.Response `json:"-"` - // CassandraKeyspaceGetProperties - The properties of an Azure Cosmos DB Cassandra keyspace - *CassandraKeyspaceGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetResults. -func (ckgr CassandraKeyspaceGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgr.CassandraKeyspaceGetProperties != nil { - objectMap["properties"] = ckgr.CassandraKeyspaceGetProperties - } - if ckgr.Location != nil { - objectMap["location"] = ckgr.Location - } - if ckgr.Tags != nil { - objectMap["tags"] = ckgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceGetResults struct. -func (ckgr *CassandraKeyspaceGetResults) 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 cassandraKeyspaceGetProperties CassandraKeyspaceGetProperties - err = json.Unmarshal(*v, &cassandraKeyspaceGetProperties) - if err != nil { - return err - } - ckgr.CassandraKeyspaceGetProperties = &cassandraKeyspaceGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckgr.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceListResult the List operation response, that contains the Cassandra keyspaces and their -// properties. -type CassandraKeyspaceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra keyspaces and their properties. - Value *[]CassandraKeyspaceGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceListResult. -func (cklr CassandraKeyspaceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraKeyspaceResource cosmos DB Cassandra keyspace resource object -type CassandraKeyspaceResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` -} - -// CassandraPartitionKey cosmos DB Cassandra table partition key -type CassandraPartitionKey struct { - // Name - Name of the Cosmos DB Cassandra table partition key - Name *string `json:"name,omitempty"` -} - -// CassandraResourcesCreateUpdateCassandraKeyspaceFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraKeyspaceGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) 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 CassandraResourcesCreateUpdateCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ckgr CassandraKeyspaceGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ckgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ckgr.Response.Response, err = future.GetResult(sender); err == nil && ckgr.Response.Response.StatusCode != http.StatusNoContent { - ckgr, err = client.CreateUpdateCassandraKeyspaceResponder(ckgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", ckgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraTableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) 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 CassandraResourcesCreateUpdateCassandraTableFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) result(client CassandraResourcesClient) (ctgr CassandraTableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ctgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ctgr.Response.Response, err = future.GetResult(sender); err == nil && ctgr.Response.Response.StatusCode != http.StatusNoContent { - ctgr, err = client.CreateUpdateCassandraTableResponder(ctgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", ctgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type CassandraResourcesDeleteCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) 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 CassandraResourcesDeleteCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type CassandraResourcesDeleteCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraTableFuture) 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 CassandraResourcesDeleteCassandraTableFuture.Result. -func (future *CassandraResourcesDeleteCassandraTableFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraTableFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture) 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 CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture.Result. -func (future *CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraKeyspaceToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture) 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 CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture.Result. -func (future *CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraKeyspaceToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraTableToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesMigrateCassandraTableToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraTableToAutoscaleFuture) 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 CassandraResourcesMigrateCassandraTableToAutoscaleFuture.Result. -func (future *CassandraResourcesMigrateCassandraTableToAutoscaleFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraTableToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraTableToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type CassandraResourcesMigrateCassandraTableToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraTableToManualThroughputFuture) 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 CassandraResourcesMigrateCassandraTableToManualThroughputFuture.Result. -func (future *CassandraResourcesMigrateCassandraTableToManualThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraTableToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesUpdateCassandraKeyspaceThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) 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 CassandraResourcesUpdateCassandraKeyspaceThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraKeyspaceThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraTableThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesUpdateCassandraTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) 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 CassandraResourcesUpdateCassandraTableThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraSchema cosmos DB Cassandra table schema -type CassandraSchema struct { - // Columns - List of Cassandra table columns. - Columns *[]Column `json:"columns,omitempty"` - // PartitionKeys - List of partition key. - PartitionKeys *[]CassandraPartitionKey `json:"partitionKeys,omitempty"` - // ClusterKeys - List of cluster key. - ClusterKeys *[]ClusterKey `json:"clusterKeys,omitempty"` -} - -// CassandraTableCreateUpdateParameters parameters to create and update Cosmos DB Cassandra table. -type CassandraTableCreateUpdateParameters struct { - // CassandraTableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra table. - *CassandraTableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableCreateUpdateParameters. -func (ctcup CassandraTableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcup.CassandraTableCreateUpdateProperties != nil { - objectMap["properties"] = ctcup.CassandraTableCreateUpdateProperties - } - if ctcup.Location != nil { - objectMap["location"] = ctcup.Location - } - if ctcup.Tags != nil { - objectMap["tags"] = ctcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableCreateUpdateParameters struct. -func (ctcup *CassandraTableCreateUpdateParameters) 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 cassandraTableCreateUpdateProperties CassandraTableCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraTableCreateUpdateProperties) - if err != nil { - return err - } - ctcup.CassandraTableCreateUpdateProperties = &cassandraTableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctcup.Tags = tags - } - } - } - - return nil -} - -// CassandraTableCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra table. -type CassandraTableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra table - Resource *CassandraTableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraTableGetProperties the properties of an Azure Cosmos DB Cassandra table -type CassandraTableGetProperties struct { - Resource *CassandraTableGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraTableGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraTableGetPropertiesOptions ... -type CassandraTableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// CassandraTableGetPropertiesResource ... -type CassandraTableGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetPropertiesResource. -func (ctgp CassandraTableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgp.ID != nil { - objectMap["id"] = ctgp.ID - } - if ctgp.DefaultTTL != nil { - objectMap["defaultTtl"] = ctgp.DefaultTTL - } - if ctgp.Schema != nil { - objectMap["schema"] = ctgp.Schema - } - if ctgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = ctgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// CassandraTableGetResults an Azure Cosmos DB Cassandra table. -type CassandraTableGetResults struct { - autorest.Response `json:"-"` - // CassandraTableGetProperties - The properties of an Azure Cosmos DB Cassandra table - *CassandraTableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetResults. -func (ctgr CassandraTableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgr.CassandraTableGetProperties != nil { - objectMap["properties"] = ctgr.CassandraTableGetProperties - } - if ctgr.Location != nil { - objectMap["location"] = ctgr.Location - } - if ctgr.Tags != nil { - objectMap["tags"] = ctgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableGetResults struct. -func (ctgr *CassandraTableGetResults) 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 cassandraTableGetProperties CassandraTableGetProperties - err = json.Unmarshal(*v, &cassandraTableGetProperties) - if err != nil { - return err - } - ctgr.CassandraTableGetProperties = &cassandraTableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctgr.Tags = tags - } - } - } - - return nil -} - -// CassandraTableListResult the List operation response, that contains the Cassandra tables and their -// properties. -type CassandraTableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra tables and their properties. - Value *[]CassandraTableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableListResult. -func (ctlr CassandraTableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraTableResource cosmos DB Cassandra table resource object -type CassandraTableResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` -} - -// ClusterKey cosmos DB Cassandra table cluster key -type ClusterKey struct { - // Name - Name of the Cosmos DB Cassandra table cluster key - Name *string `json:"name,omitempty"` - // OrderBy - Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" - OrderBy *string `json:"orderBy,omitempty"` -} - -// Column cosmos DB Cassandra table column -type Column struct { - // Name - Name of the Cosmos DB Cassandra table column - Name *string `json:"name,omitempty"` - // Type - Type of the Cosmos DB Cassandra table column - Type *string `json:"type,omitempty"` -} - -// CompositePath ... -type CompositePath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Order - Sort order for composite paths. Possible values include: 'Ascending', 'Descending' - Order CompositePathSortOrder `json:"order,omitempty"` -} - -// ConflictResolutionPolicy the conflict resolution policy for the container. -type ConflictResolutionPolicy struct { - // Mode - Indicates the conflict resolution mode. Possible values include: 'LastWriterWins', 'Custom' - Mode ConflictResolutionMode `json:"mode,omitempty"` - // ConflictResolutionPath - The conflict resolution path in the case of LastWriterWins mode. - ConflictResolutionPath *string `json:"conflictResolutionPath,omitempty"` - // ConflictResolutionProcedure - The procedure to resolve conflicts in the case of custom mode. - ConflictResolutionProcedure *string `json:"conflictResolutionProcedure,omitempty"` -} - -// ConsistencyPolicy the consistency policy for the Cosmos DB database account. -type ConsistencyPolicy struct { - // DefaultConsistencyLevel - The default consistency level and configuration settings of the Cosmos DB account. Possible values include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix' - DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` - // MaxStalenessPrefix - When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` - // MaxIntervalInSeconds - When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` -} - -// ContainerPartitionKey the configuration of the partition key to be used for partitioning data into -// multiple partitions -type ContainerPartitionKey struct { - // Paths - List of paths using which data within the container can be partitioned - Paths *[]string `json:"paths,omitempty"` - // Kind - Indicates the kind of algorithm used for partitioning. Possible values include: 'PartitionKindHash', 'PartitionKindRange' - Kind PartitionKind `json:"kind,omitempty"` - // Version - Indicates the version of the partition key definition - Version *int32 `json:"version,omitempty"` -} - -// CorsPolicy the CORS policy for the Cosmos DB database account. -type CorsPolicy struct { - // AllowedOrigins - The origin domains that are permitted to make a request against the service via CORS. - AllowedOrigins *string `json:"allowedOrigins,omitempty"` - // AllowedMethods - The methods (HTTP request verbs) that the origin domain may use for a CORS request. - AllowedMethods *string `json:"allowedMethods,omitempty"` - // AllowedHeaders - The request headers that the origin domain may specify on the CORS request. - AllowedHeaders *string `json:"allowedHeaders,omitempty"` - // ExposedHeaders - The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - ExposedHeaders *string `json:"exposedHeaders,omitempty"` - // MaxAgeInSeconds - The maximum amount time that a browser should cache the preflight OPTIONS request. - MaxAgeInSeconds *int64 `json:"maxAgeInSeconds,omitempty"` -} - -// CreateUpdateOptions createUpdateOptions are a list of key-value pairs that describe the resource. -// Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" -type CreateUpdateOptions struct { - // Throughput - Request Units per second. For example, "throughput": 10000. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// DatabaseAccountConnectionString connection string for the Cosmos DB account -type DatabaseAccountConnectionString struct { - // ConnectionString - READ-ONLY; Value of the connection string - ConnectionString *string `json:"connectionString,omitempty"` - // Description - READ-ONLY; Description of the connection string - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountConnectionString. -func (dacs DatabaseAccountConnectionString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountCreateUpdateParameters parameters to create and update Cosmos DB database accounts. -type DatabaseAccountCreateUpdateParameters struct { - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountCreateUpdateParameters. -func (dacup DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dacup.Kind != "" { - objectMap["kind"] = dacup.Kind - } - if dacup.DatabaseAccountCreateUpdateProperties != nil { - objectMap["properties"] = dacup.DatabaseAccountCreateUpdateProperties - } - if dacup.Location != nil { - objectMap["location"] = dacup.Location - } - if dacup.Tags != nil { - objectMap["tags"] = dacup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateParameters struct. -func (dacup *DatabaseAccountCreateUpdateParameters) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dacup.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountCreateUpdateProperties DatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &databaseAccountCreateUpdateProperties) - if err != nil { - return err - } - dacup.DatabaseAccountCreateUpdateProperties = &databaseAccountCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dacup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dacup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dacup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dacup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dacup.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountCreateUpdateProperties properties to create and update Azure Cosmos DB database accounts. -type DatabaseAccountCreateUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` -} - -// DatabaseAccountGetProperties properties for the database account. -type DatabaseAccountGetProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the Cosmos DB database account. - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - // DatabaseAccountOfferType - READ-ONLY; The offer type for the Cosmos DB database account. Default value: Standard. Possible values include: 'Standard' - DatabaseAccountOfferType DatabaseAccountOfferType `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // ConsistencyPolicy - The consistency policy for the Cosmos DB database account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // WriteLocations - READ-ONLY; An array that contains the write location for the Cosmos DB account. - WriteLocations *[]Location `json:"writeLocations,omitempty"` - // ReadLocations - READ-ONLY; An array that contains of the read locations enabled for the Cosmos DB account. - ReadLocations *[]Location `json:"readLocations,omitempty"` - // Locations - READ-ONLY; An array that contains all of the locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // FailoverPolicies - READ-ONLY; An array that contains the regions ordered by their failover priorities. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of Private Endpoint Connections configured for the Cosmos DB account. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetProperties. -func (dagp DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagp.ProvisioningState != nil { - objectMap["provisioningState"] = dagp.ProvisioningState - } - if dagp.IPRules != nil { - objectMap["ipRules"] = dagp.IPRules - } - if dagp.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = dagp.IsVirtualNetworkFilterEnabled - } - if dagp.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = dagp.EnableAutomaticFailover - } - if dagp.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = dagp.ConsistencyPolicy - } - if dagp.Capabilities != nil { - objectMap["capabilities"] = dagp.Capabilities - } - if dagp.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = dagp.VirtualNetworkRules - } - if dagp.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = dagp.EnableMultipleWriteLocations - } - if dagp.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = dagp.EnableCassandraConnector - } - if dagp.ConnectorOffer != "" { - objectMap["connectorOffer"] = dagp.ConnectorOffer - } - if dagp.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = dagp.DisableKeyBasedMetadataWriteAccess - } - if dagp.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = dagp.KeyVaultKeyURI - } - if dagp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = dagp.PublicNetworkAccess - } - if dagp.EnableFreeTier != nil { - objectMap["enableFreeTier"] = dagp.EnableFreeTier - } - if dagp.APIProperties != nil { - objectMap["apiProperties"] = dagp.APIProperties - } - if dagp.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = dagp.EnableAnalyticalStorage - } - if dagp.Cors != nil { - objectMap["cors"] = dagp.Cors - } - return json.Marshal(objectMap) -} - -// DatabaseAccountGetResults an Azure Cosmos DB database account. -type DatabaseAccountGetResults struct { - autorest.Response `json:"-"` - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetResults. -func (dagr DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagr.Kind != "" { - objectMap["kind"] = dagr.Kind - } - if dagr.DatabaseAccountGetProperties != nil { - objectMap["properties"] = dagr.DatabaseAccountGetProperties - } - if dagr.Location != nil { - objectMap["location"] = dagr.Location - } - if dagr.Tags != nil { - objectMap["tags"] = dagr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetResults struct. -func (dagr *DatabaseAccountGetResults) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dagr.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountGetProperties DatabaseAccountGetProperties - err = json.Unmarshal(*v, &databaseAccountGetProperties) - if err != nil { - return err - } - dagr.DatabaseAccountGetProperties = &databaseAccountGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dagr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dagr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dagr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dagr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dagr.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountListConnectionStringsResult the connection strings for the given database account. -type DatabaseAccountListConnectionStringsResult struct { - autorest.Response `json:"-"` - // ConnectionStrings - An array that contains the connection strings for the Cosmos DB account. - ConnectionStrings *[]DatabaseAccountConnectionString `json:"connectionStrings,omitempty"` -} - -// DatabaseAccountListKeysResult the access keys for the given database account. -type DatabaseAccountListKeysResult struct { - autorest.Response `json:"-"` - // PrimaryMasterKey - READ-ONLY; Base 64 encoded value of the primary read-write key. - PrimaryMasterKey *string `json:"primaryMasterKey,omitempty"` - // SecondaryMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-write key. - SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListKeysResult. -func (dalkr DatabaseAccountListKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountListReadOnlyKeysResult the read-only access keys for the given database account. -type DatabaseAccountListReadOnlyKeysResult struct { - autorest.Response `json:"-"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListReadOnlyKeysResult. -func (dalrokr DatabaseAccountListReadOnlyKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountRegenerateKeyParameters parameters to regenerate the keys within the database account. -type DatabaseAccountRegenerateKeyParameters struct { - // KeyKind - The access key to regenerate. Possible values include: 'Primary', 'Secondary', 'PrimaryReadonly', 'SecondaryReadonly' - KeyKind KeyKind `json:"keyKind,omitempty"` -} - -// DatabaseAccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsCreateOrUpdateFuture) 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 DatabaseAccountsCreateOrUpdateFuture.Result. -func (future *DatabaseAccountsCreateOrUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.CreateOrUpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsDeleteFuture) 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 DatabaseAccountsDeleteFuture.Result. -func (future *DatabaseAccountsDeleteFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsFailoverPriorityChangeFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type DatabaseAccountsFailoverPriorityChangeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) 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 DatabaseAccountsFailoverPriorityChangeFuture.Result. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsFailoverPriorityChangeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsFailoverPriorityChangeFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsListResult the List operation response, that contains the database accounts and their -// properties. -type DatabaseAccountsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of database account and their properties. - Value *[]DatabaseAccountGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountsListResult. -func (dalr DatabaseAccountsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountsOfflineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOfflineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOfflineRegionFuture) 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 DatabaseAccountsOfflineRegionFuture.Result. -func (future *DatabaseAccountsOfflineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOfflineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsOnlineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOnlineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOnlineRegionFuture) 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 DatabaseAccountsOnlineRegionFuture.Result. -func (future *DatabaseAccountsOnlineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOnlineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsRegenerateKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsRegenerateKeyFuture) 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 DatabaseAccountsRegenerateKeyFuture.Result. -func (future *DatabaseAccountsRegenerateKeyFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsRegenerateKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsRegenerateKeyFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsUpdateFuture) 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 DatabaseAccountsUpdateFuture.Result. -func (future *DatabaseAccountsUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.UpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountUpdateParameters parameters for patching Azure Cosmos DB database account properties. -type DatabaseAccountUpdateParameters struct { - Tags map[string]*string `json:"tags"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - *DatabaseAccountUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountUpdateParameters. -func (daup DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if daup.Tags != nil { - objectMap["tags"] = daup.Tags - } - if daup.Location != nil { - objectMap["location"] = daup.Location - } - if daup.DatabaseAccountUpdateProperties != nil { - objectMap["properties"] = daup.DatabaseAccountUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateParameters struct. -func (daup *DatabaseAccountUpdateParameters) 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 - } - daup.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - daup.Location = &location - } - case "properties": - if v != nil { - var databaseAccountUpdateProperties DatabaseAccountUpdateProperties - err = json.Unmarshal(*v, &databaseAccountUpdateProperties) - if err != nil { - return err - } - daup.DatabaseAccountUpdateProperties = &databaseAccountUpdateProperties - } - } - } - - return nil -} - -// DatabaseAccountUpdateProperties properties to update Azure Cosmos DB database accounts. -type DatabaseAccountUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` -} - -// ErrorResponse 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"` -} - -// ExcludedPath ... -type ExcludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` -} - -// ExtendedResourceProperties the system generated resource properties associated with SQL databases, SQL -// containers, Gremlin databases and Gremlin graphs. -type ExtendedResourceProperties struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedResourceProperties. -func (erp ExtendedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverPolicies the list of new failover policies for the failover priority change. -type FailoverPolicies struct { - // FailoverPolicies - List of failover policies. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` -} - -// FailoverPolicy the failover policy for a given region of a database account. -type FailoverPolicy struct { - // ID - READ-ONLY; The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region in which the database account exists. - LocationName *string `json:"locationName,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverPolicy. -func (fp FailoverPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.LocationName != nil { - objectMap["locationName"] = fp.LocationName - } - if fp.FailoverPriority != nil { - objectMap["failoverPriority"] = fp.FailoverPriority - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseCreateUpdateParameters parameters to create and update Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateParameters struct { - // GremlinDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin database. - *GremlinDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseCreateUpdateParameters. -func (gdcup GremlinDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdcup.GremlinDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = gdcup.GremlinDatabaseCreateUpdateProperties - } - if gdcup.Location != nil { - objectMap["location"] = gdcup.Location - } - if gdcup.Tags != nil { - objectMap["tags"] = gdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseCreateUpdateParameters struct. -func (gdcup *GremlinDatabaseCreateUpdateParameters) 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 gremlinDatabaseCreateUpdateProperties GremlinDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinDatabaseCreateUpdateProperties) - if err != nil { - return err - } - gdcup.GremlinDatabaseCreateUpdateProperties = &gremlinDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdcup.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin database - Resource *GremlinDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type GremlinDatabaseGetProperties struct { - Resource *GremlinDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetPropertiesOptions ... -type GremlinDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// GremlinDatabaseGetPropertiesResource ... -type GremlinDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetPropertiesResource. -func (gdgp GremlinDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgp.ID != nil { - objectMap["id"] = gdgp.ID - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseGetResults an Azure Cosmos DB Gremlin database. -type GremlinDatabaseGetResults struct { - autorest.Response `json:"-"` - // GremlinDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *GremlinDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetResults. -func (gdgr GremlinDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgr.GremlinDatabaseGetProperties != nil { - objectMap["properties"] = gdgr.GremlinDatabaseGetProperties - } - if gdgr.Location != nil { - objectMap["location"] = gdgr.Location - } - if gdgr.Tags != nil { - objectMap["tags"] = gdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseGetResults struct. -func (gdgr *GremlinDatabaseGetResults) 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 gremlinDatabaseGetProperties GremlinDatabaseGetProperties - err = json.Unmarshal(*v, &gremlinDatabaseGetProperties) - if err != nil { - return err - } - gdgr.GremlinDatabaseGetProperties = &gremlinDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdgr.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseListResult the List operation response, that contains the Gremlin databases and their -// properties. -type GremlinDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Gremlin databases and their properties. - Value *[]GremlinDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseListResult. -func (gdlr GremlinDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinDatabaseResource cosmos DB Gremlin database resource object -type GremlinDatabaseResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` -} - -// GremlinGraphCreateUpdateParameters parameters to create and update Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateParameters struct { - // GremlinGraphCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin graph. - *GremlinGraphCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphCreateUpdateParameters. -func (ggcup GremlinGraphCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ggcup.GremlinGraphCreateUpdateProperties != nil { - objectMap["properties"] = ggcup.GremlinGraphCreateUpdateProperties - } - if ggcup.Location != nil { - objectMap["location"] = ggcup.Location - } - if ggcup.Tags != nil { - objectMap["tags"] = ggcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphCreateUpdateParameters struct. -func (ggcup *GremlinGraphCreateUpdateParameters) 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 gremlinGraphCreateUpdateProperties GremlinGraphCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinGraphCreateUpdateProperties) - if err != nil { - return err - } - ggcup.GremlinGraphCreateUpdateProperties = &gremlinGraphCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ggcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ggcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ggcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ggcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ggcup.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin graph - Resource *GremlinGraphResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinGraphGetProperties the properties of an Azure Cosmos DB Gremlin graph -type GremlinGraphGetProperties struct { - Resource *GremlinGraphGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinGraphGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinGraphGetPropertiesOptions ... -type GremlinGraphGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// GremlinGraphGetPropertiesResource ... -type GremlinGraphGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetPropertiesResource. -func (gggp GremlinGraphGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggp.ID != nil { - objectMap["id"] = gggp.ID - } - if gggp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = gggp.IndexingPolicy - } - if gggp.PartitionKey != nil { - objectMap["partitionKey"] = gggp.PartitionKey - } - if gggp.DefaultTTL != nil { - objectMap["defaultTtl"] = gggp.DefaultTTL - } - if gggp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = gggp.UniqueKeyPolicy - } - if gggp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = gggp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// GremlinGraphGetResults an Azure Cosmos DB Gremlin graph. -type GremlinGraphGetResults struct { - autorest.Response `json:"-"` - // GremlinGraphGetProperties - The properties of an Azure Cosmos DB Gremlin graph - *GremlinGraphGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetResults. -func (gggr GremlinGraphGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggr.GremlinGraphGetProperties != nil { - objectMap["properties"] = gggr.GremlinGraphGetProperties - } - if gggr.Location != nil { - objectMap["location"] = gggr.Location - } - if gggr.Tags != nil { - objectMap["tags"] = gggr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphGetResults struct. -func (gggr *GremlinGraphGetResults) 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 gremlinGraphGetProperties GremlinGraphGetProperties - err = json.Unmarshal(*v, &gremlinGraphGetProperties) - if err != nil { - return err - } - gggr.GremlinGraphGetProperties = &gremlinGraphGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gggr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gggr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gggr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gggr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gggr.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphListResult the List operation response, that contains the graphs and their properties. -type GremlinGraphListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of graphs and their properties. - Value *[]GremlinGraphGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphListResult. -func (gglr GremlinGraphListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinGraphResource cosmos DB Gremlin graph resource object -type GremlinGraphResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// GremlinResourcesCreateUpdateGremlinDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesCreateUpdateGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) 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 GremlinResourcesCreateUpdateGremlinDatabaseFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) result(client GremlinResourcesClient) (gdgr GremlinDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gdgr.Response.Response, err = future.GetResult(sender); err == nil && gdgr.Response.Response.StatusCode != http.StatusNoContent { - gdgr, err = client.CreateUpdateGremlinDatabaseResponder(gdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", gdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesCreateUpdateGremlinGraphFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type GremlinResourcesCreateUpdateGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinGraphGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) 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 GremlinResourcesCreateUpdateGremlinGraphFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) result(client GremlinResourcesClient) (gggr GremlinGraphGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gggr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gggr.Response.Response, err = future.GetResult(sender); err == nil && gggr.Response.Response.StatusCode != http.StatusNoContent { - gggr, err = client.CreateUpdateGremlinGraphResponder(gggr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", gggr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesDeleteGremlinDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type GremlinResourcesDeleteGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) 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 GremlinResourcesDeleteGremlinDatabaseFuture.Result. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesDeleteGremlinGraphFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GremlinResourcesDeleteGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinGraphFuture) 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 GremlinResourcesDeleteGremlinGraphFuture.Result. -func (future *GremlinResourcesDeleteGremlinGraphFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinGraphFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture) 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 GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture.Result. -func (future *GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture) 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 GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture.Result. -func (future *GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinGraphToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesMigrateGremlinGraphToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinGraphToAutoscaleFuture) 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 GremlinResourcesMigrateGremlinGraphToAutoscaleFuture.Result. -func (future *GremlinResourcesMigrateGremlinGraphToAutoscaleFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinGraphToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinGraphToManualThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type GremlinResourcesMigrateGremlinGraphToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinGraphToManualThroughputFuture) 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 GremlinResourcesMigrateGremlinGraphToManualThroughputFuture.Result. -func (future *GremlinResourcesMigrateGremlinGraphToManualThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinGraphToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) 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 GremlinResourcesUpdateGremlinDatabaseThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinGraphThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinGraphThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) 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 GremlinResourcesUpdateGremlinGraphThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinGraphThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// IncludedPath the paths that are included in indexing -type IncludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Indexes - List of indexes for this path - Indexes *[]Indexes `json:"indexes,omitempty"` -} - -// Indexes the indexes for the path. -type Indexes struct { - // DataType - The datatype for which the indexing behavior is applied to. Possible values include: 'String', 'Number', 'Point', 'Polygon', 'LineString', 'MultiPolygon' - DataType DataType `json:"dataType,omitempty"` - // Precision - The precision of the index. -1 is maximum precision. - Precision *int32 `json:"precision,omitempty"` - // Kind - Indicates the type of index. Possible values include: 'Hash', 'Range', 'Spatial' - Kind IndexKind `json:"kind,omitempty"` -} - -// IndexingPolicy cosmos DB indexing policy -type IndexingPolicy struct { - // Automatic - Indicates if the indexing policy is automatic - Automatic *bool `json:"automatic,omitempty"` - // IndexingMode - Indicates the indexing mode. Possible values include: 'Consistent', 'Lazy', 'None' - IndexingMode IndexingMode `json:"indexingMode,omitempty"` - // IncludedPaths - List of paths to include in the indexing - IncludedPaths *[]IncludedPath `json:"includedPaths,omitempty"` - // ExcludedPaths - List of paths to exclude from indexing - ExcludedPaths *[]ExcludedPath `json:"excludedPaths,omitempty"` - // CompositeIndexes - List of composite path list - CompositeIndexes *[][]CompositePath `json:"compositeIndexes,omitempty"` - // SpatialIndexes - List of spatial specifics - SpatialIndexes *[]SpatialSpec `json:"spatialIndexes,omitempty"` -} - -// IPAddressOrRange ipAddressOrRange object -type IPAddressOrRange struct { - // IPAddressOrRange - A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. - IPAddressOrRange *string `json:"ipAddressOrRange,omitempty"` -} - -// Location a region in which the Azure Cosmos DB database account is deployed. -type Location struct { - // ID - READ-ONLY; The unique identifier of the region within the database account. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region. - LocationName *string `json:"locationName,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` - // IsZoneRedundant - Flag to indicate whether or not this region is an AvailabilityZone region - IsZoneRedundant *bool `json:"isZoneRedundant,omitempty"` -} - -// MarshalJSON is the custom marshaler for Location. -func (l Location) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if l.LocationName != nil { - objectMap["locationName"] = l.LocationName - } - if l.ProvisioningState != nil { - objectMap["provisioningState"] = l.ProvisioningState - } - if l.FailoverPriority != nil { - objectMap["failoverPriority"] = l.FailoverPriority - } - if l.IsZoneRedundant != nil { - objectMap["isZoneRedundant"] = l.IsZoneRedundant - } - return json.Marshal(objectMap) -} - -// Metric metric data -type Metric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for Metric. -func (mVar Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.Unit != "" { - objectMap["unit"] = mVar.Unit - } - return json.Marshal(objectMap) -} - -// MetricAvailability the availability of the metric. -type MetricAvailability struct { - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - READ-ONLY; The retention for the metric values. - Retention *string `json:"retention,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAvailability. -func (ma MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinition the definition of a metric. -type MetricDefinition struct { - // MetricAvailabilities - READ-ONLY; The list of metric availabilities for the account. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type of the metric. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeTotal', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeLast' - PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // ResourceURI - READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinition. -func (md MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if md.Unit != "" { - objectMap["unit"] = md.Unit - } - return json.Marshal(objectMap) -} - -// MetricDefinitionsListResult the response to a list metric definitions request. -type MetricDefinitionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metric definitions for the account. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinitionsListResult. -func (mdlr MetricDefinitionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricListResult the response to a list metrics request. -type MetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metrics for the account. - Value *[]Metric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricListResult. -func (mlr MetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricName a metric name. -type MetricName struct { - // Value - READ-ONLY; The name of the metric. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The friendly name of the metric. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricName. -func (mn MetricName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricValue represents metrics values. -type MetricValue struct { - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricValue. -func (mv MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionCreateUpdateParameters parameters to create and update Cosmos DB MongoDB collection. -type MongoDBCollectionCreateUpdateParameters struct { - // MongoDBCollectionCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB collection. - *MongoDBCollectionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionCreateUpdateParameters. -func (mdccup MongoDBCollectionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdccup.MongoDBCollectionCreateUpdateProperties != nil { - objectMap["properties"] = mdccup.MongoDBCollectionCreateUpdateProperties - } - if mdccup.Location != nil { - objectMap["location"] = mdccup.Location - } - if mdccup.Tags != nil { - objectMap["tags"] = mdccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionCreateUpdateParameters struct. -func (mdccup *MongoDBCollectionCreateUpdateParameters) 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 mongoDBCollectionCreateUpdateProperties MongoDBCollectionCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBCollectionCreateUpdateProperties) - if err != nil { - return err - } - mdccup.MongoDBCollectionCreateUpdateProperties = &mongoDBCollectionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdccup.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB -// collection. -type MongoDBCollectionCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB collection - Resource *MongoDBCollectionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetProperties the properties of an Azure Cosmos DB MongoDB collection -type MongoDBCollectionGetProperties struct { - Resource *MongoDBCollectionGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBCollectionGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetPropertiesOptions ... -type MongoDBCollectionGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// MongoDBCollectionGetPropertiesResource ... -type MongoDBCollectionGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetPropertiesResource. -func (mdcgp MongoDBCollectionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgp.ID != nil { - objectMap["id"] = mdcgp.ID - } - if mdcgp.ShardKey != nil { - objectMap["shardKey"] = mdcgp.ShardKey - } - if mdcgp.Indexes != nil { - objectMap["indexes"] = mdcgp.Indexes - } - if mdcgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = mdcgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// MongoDBCollectionGetResults an Azure Cosmos DB MongoDB collection. -type MongoDBCollectionGetResults struct { - autorest.Response `json:"-"` - // MongoDBCollectionGetProperties - The properties of an Azure Cosmos DB MongoDB collection - *MongoDBCollectionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetResults. -func (mdcgr MongoDBCollectionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgr.MongoDBCollectionGetProperties != nil { - objectMap["properties"] = mdcgr.MongoDBCollectionGetProperties - } - if mdcgr.Location != nil { - objectMap["location"] = mdcgr.Location - } - if mdcgr.Tags != nil { - objectMap["tags"] = mdcgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionGetResults struct. -func (mdcgr *MongoDBCollectionGetResults) 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 mongoDBCollectionGetProperties MongoDBCollectionGetProperties - err = json.Unmarshal(*v, &mongoDBCollectionGetProperties) - if err != nil { - return err - } - mdcgr.MongoDBCollectionGetProperties = &mongoDBCollectionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdcgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdcgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdcgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdcgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdcgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionListResult the List operation response, that contains the MongoDB collections and their -// properties. -type MongoDBCollectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB collections and their properties. - Value *[]MongoDBCollectionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionListResult. -func (mdclr MongoDBCollectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionResource cosmos DB MongoDB collection resource object -type MongoDBCollectionResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionResource. -func (mdcr MongoDBCollectionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcr.ID != nil { - objectMap["id"] = mdcr.ID - } - if mdcr.ShardKey != nil { - objectMap["shardKey"] = mdcr.ShardKey - } - if mdcr.Indexes != nil { - objectMap["indexes"] = mdcr.Indexes - } - if mdcr.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = mdcr.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseCreateUpdateParameters parameters to create and update Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateParameters struct { - // MongoDBDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB database. - *MongoDBDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseCreateUpdateParameters. -func (mddcup MongoDBDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddcup.MongoDBDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = mddcup.MongoDBDatabaseCreateUpdateProperties - } - if mddcup.Location != nil { - objectMap["location"] = mddcup.Location - } - if mddcup.Tags != nil { - objectMap["tags"] = mddcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseCreateUpdateParameters struct. -func (mddcup *MongoDBDatabaseCreateUpdateParameters) 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 mongoDBDatabaseCreateUpdateProperties MongoDBDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBDatabaseCreateUpdateProperties) - if err != nil { - return err - } - mddcup.MongoDBDatabaseCreateUpdateProperties = &mongoDBDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddcup.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB database - Resource *MongoDBDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetProperties the properties of an Azure Cosmos DB MongoDB database -type MongoDBDatabaseGetProperties struct { - Resource *MongoDBDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetPropertiesOptions ... -type MongoDBDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// MongoDBDatabaseGetPropertiesResource ... -type MongoDBDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetPropertiesResource. -func (mddgp MongoDBDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgp.ID != nil { - objectMap["id"] = mddgp.ID - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseGetResults an Azure Cosmos DB MongoDB database. -type MongoDBDatabaseGetResults struct { - autorest.Response `json:"-"` - // MongoDBDatabaseGetProperties - The properties of an Azure Cosmos DB MongoDB database - *MongoDBDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetResults. -func (mddgr MongoDBDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgr.MongoDBDatabaseGetProperties != nil { - objectMap["properties"] = mddgr.MongoDBDatabaseGetProperties - } - if mddgr.Location != nil { - objectMap["location"] = mddgr.Location - } - if mddgr.Tags != nil { - objectMap["tags"] = mddgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseGetResults struct. -func (mddgr *MongoDBDatabaseGetResults) 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 mongoDBDatabaseGetProperties MongoDBDatabaseGetProperties - err = json.Unmarshal(*v, &mongoDBDatabaseGetProperties) - if err != nil { - return err - } - mddgr.MongoDBDatabaseGetProperties = &mongoDBDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseListResult the List operation response, that contains the MongoDB databases and their -// properties. -type MongoDBDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB databases and their properties. - Value *[]MongoDBDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseListResult. -func (mddlr MongoDBDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBDatabaseResource cosmos DB MongoDB database resource object -type MongoDBDatabaseResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` -} - -// MongoDBResourcesCreateUpdateMongoDBCollectionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBCollectionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) 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 MongoDBResourcesCreateUpdateMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) result(client MongoDBResourcesClient) (mdcgr MongoDBCollectionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mdcgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mdcgr.Response.Response, err = future.GetResult(sender); err == nil && mdcgr.Response.Response.StatusCode != http.StatusNoContent { - mdcgr, err = client.CreateUpdateMongoDBCollectionResponder(mdcgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", mdcgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesCreateUpdateMongoDBDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) 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 MongoDBResourcesCreateUpdateMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (mddgr MongoDBDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mddgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mddgr.Response.Response, err = future.GetResult(sender); err == nil && mddgr.Response.Response.StatusCode != http.StatusNoContent { - mddgr, err = client.CreateUpdateMongoDBDatabaseResponder(mddgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", mddgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesDeleteMongoDBCollectionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type MongoDBResourcesDeleteMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) 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 MongoDBResourcesDeleteMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesDeleteMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type MongoDBResourcesDeleteMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) 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 MongoDBResourcesDeleteMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture) 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 MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBCollectionToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture) 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 MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBCollectionToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture) 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 MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture) 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 MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBCollectionThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBCollectionThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) 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 MongoDBResourcesUpdateMongoDBCollectionThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBCollectionThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) 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 MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoIndex cosmos DB MongoDB collection index key -type MongoIndex struct { - // Key - Cosmos DB MongoDB collection index keys - Key *MongoIndexKeys `json:"key,omitempty"` - // Options - Cosmos DB MongoDB collection index key options - Options *MongoIndexOptions `json:"options,omitempty"` -} - -// MongoIndexKeys cosmos DB MongoDB collection resource object -type MongoIndexKeys struct { - // Keys - List of keys for each MongoDB collection in the Azure Cosmos DB service - Keys *[]string `json:"keys,omitempty"` -} - -// MongoIndexOptions cosmos DB MongoDB collection index options -type MongoIndexOptions struct { - // ExpireAfterSeconds - Expire after seconds - ExpireAfterSeconds *int32 `json:"expireAfterSeconds,omitempty"` - // Unique - Is unique or not - Unique *bool `json:"unique,omitempty"` -} - -// NotebookWorkspace a notebook workspace resource -type NotebookWorkspace struct { - autorest.Response `json:"-"` - // NotebookWorkspaceProperties - Resource properties. - *NotebookWorkspaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspace. -func (nw NotebookWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nw.NotebookWorkspaceProperties != nil { - objectMap["properties"] = nw.NotebookWorkspaceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotebookWorkspace struct. -func (nw *NotebookWorkspace) 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 notebookWorkspaceProperties NotebookWorkspaceProperties - err = json.Unmarshal(*v, ¬ebookWorkspaceProperties) - if err != nil { - return err - } - nw.NotebookWorkspaceProperties = ¬ebookWorkspaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nw.Type = &typeVar - } - } - } - - return nil -} - -// NotebookWorkspaceConnectionInfoResult the connection info for the given notebook workspace -type NotebookWorkspaceConnectionInfoResult struct { - autorest.Response `json:"-"` - // AuthToken - READ-ONLY; Specifies auth token used for connecting to Notebook server (uses token-based auth). - AuthToken *string `json:"authToken,omitempty"` - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceConnectionInfoResult. -func (nwcir NotebookWorkspaceConnectionInfoResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceCreateUpdateParameters parameters to create a notebook workspace resource -type NotebookWorkspaceCreateUpdateParameters struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceCreateUpdateParameters. -func (nwcup NotebookWorkspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceListResult a list of notebook workspace resources -type NotebookWorkspaceListResult struct { - autorest.Response `json:"-"` - // Value - Array of notebook workspace resources - Value *[]NotebookWorkspace `json:"value,omitempty"` -} - -// NotebookWorkspaceProperties properties of a notebook workspace resource. -type NotebookWorkspaceProperties struct { - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` - // Status - READ-ONLY; Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceProperties. -func (nwp NotebookWorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (NotebookWorkspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesCreateOrUpdateFuture) 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 NotebookWorkspacesCreateOrUpdateFuture.Result. -func (future *NotebookWorkspacesCreateOrUpdateFuture) result(client NotebookWorkspacesClient) (nw NotebookWorkspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nw.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nw.Response.Response, err = future.GetResult(sender); err == nil && nw.Response.Response.StatusCode != http.StatusNoContent { - nw, err = client.CreateOrUpdateResponder(nw.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", nw.Response.Response, "Failure responding to request") - } - } - return -} - -// NotebookWorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesDeleteFuture) 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 NotebookWorkspacesDeleteFuture.Result. -func (future *NotebookWorkspacesDeleteFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesRegenerateAuthTokenFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type NotebookWorkspacesRegenerateAuthTokenFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) 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 NotebookWorkspacesRegenerateAuthTokenFuture.Result. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesRegenerateAuthTokenFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesRegenerateAuthTokenFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NotebookWorkspacesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesStartFuture) 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 NotebookWorkspacesStartFuture.Result. -func (future *NotebookWorkspacesStartFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// Operation 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.ResourceProvider - 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"` - // Description - Description of operation - Description *string `json:"Description,omitempty"` -} - -// OperationListResult 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 OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the 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, - } -} - -// OptionsResource cosmos DB options resource object -type OptionsResource struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// PartitionMetric the metric values for a single partition. -type PartitionMetric struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the metric values. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the metric values. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetric. -func (pm PartitionMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PartitionMetricListResult the response to a list partition metrics request. -type PartitionMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level metrics for the account. - Value *[]PartitionMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetricListResult. -func (pmlr PartitionMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PartitionUsage the partition level usage data for a usage request. -type PartitionUsage struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the usages. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the usages. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsage. -func (pu PartitionUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pu.Unit != "" { - objectMap["unit"] = pu.Unit - } - return json.Marshal(objectMap) -} - -// PartitionUsagesResult the response to a list partition level usage request. -type PartitionUsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level usages for the database. A usage is a point in time metric - Value *[]PartitionUsage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsagesResult. -func (pur PartitionUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetric percentile Metric data -type PercentileMetric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The percentile metric values for the specified time window and timestep. - MetricValues *[]PercentileMetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetric. -func (pm PercentileMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PercentileMetricListResult the response to a list percentile metrics request. -type PercentileMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of percentile metrics for the account. - Value *[]PercentileMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricListResult. -func (pmlr PercentileMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetricValue represents percentile metrics values. -type PercentileMetricValue struct { - // P10 - READ-ONLY; The 10th percentile value for the metric. - P10 *float64 `json:"P10,omitempty"` - // P25 - READ-ONLY; The 25th percentile value for the metric. - P25 *float64 `json:"P25,omitempty"` - // P50 - READ-ONLY; The 50th percentile value for the metric. - P50 *float64 `json:"P50,omitempty"` - // P75 - READ-ONLY; The 75th percentile value for the metric. - P75 *float64 `json:"P75,omitempty"` - // P90 - READ-ONLY; The 90th percentile value for the metric. - P90 *float64 `json:"P90,omitempty"` - // P95 - READ-ONLY; The 95th percentile value for the metric. - P95 *float64 `json:"P95,omitempty"` - // P99 - READ-ONLY; The 99th percentile value for the metric. - P99 *float64 `json:"P99,omitempty"` - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricValue. -func (pmv PercentileMetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // GroupID - Group id of the private endpoint. - GroupID *string `json:"groupId,omitempty"` - // ProvisioningState - Provisioning state of the private endpoint. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource required zone names. - 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) -} - -// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) - ActionsRequired *string `json:"actionsRequired,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// 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) -} - -// RegionForOnlineOffline cosmos DB region to online or offline. -type RegionForOnlineOffline struct { - // Region - Cosmos DB region, with spaces between words and each word capitalized. - Region *string `json:"region,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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SpatialSpec ... -type SpatialSpec struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Types - List of path's spatial type - Types *[]SpatialType `json:"types,omitempty"` -} - -// SQLContainerCreateUpdateParameters parameters to create and update Cosmos DB container. -type SQLContainerCreateUpdateParameters struct { - // SQLContainerCreateUpdateProperties - Properties to create and update Azure Cosmos DB container. - *SQLContainerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerCreateUpdateParameters. -func (sccup SQLContainerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccup.SQLContainerCreateUpdateProperties != nil { - objectMap["properties"] = sccup.SQLContainerCreateUpdateProperties - } - if sccup.Location != nil { - objectMap["location"] = sccup.Location - } - if sccup.Tags != nil { - objectMap["tags"] = sccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerCreateUpdateParameters struct. -func (sccup *SQLContainerCreateUpdateParameters) 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 SQLContainerCreateUpdateProperties SQLContainerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLContainerCreateUpdateProperties) - if err != nil { - return err - } - sccup.SQLContainerCreateUpdateProperties = &SQLContainerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sccup.Tags = tags - } - } - } - - return nil -} - -// SQLContainerCreateUpdateProperties properties to create and update Azure Cosmos DB container. -type SQLContainerCreateUpdateProperties struct { - // Resource - The standard JSON format of a container - Resource *SQLContainerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLContainerGetProperties the properties of an Azure Cosmos DB container -type SQLContainerGetProperties struct { - Resource *SQLContainerGetPropertiesResource `json:"resource,omitempty"` - Options *SQLContainerGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLContainerGetPropertiesOptions ... -type SQLContainerGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// SQLContainerGetPropertiesResource ... -type SQLContainerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int64 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetPropertiesResource. -func (scgp SQLContainerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgp.ID != nil { - objectMap["id"] = scgp.ID - } - if scgp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = scgp.IndexingPolicy - } - if scgp.PartitionKey != nil { - objectMap["partitionKey"] = scgp.PartitionKey - } - if scgp.DefaultTTL != nil { - objectMap["defaultTtl"] = scgp.DefaultTTL - } - if scgp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = scgp.UniqueKeyPolicy - } - if scgp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = scgp.ConflictResolutionPolicy - } - if scgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = scgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// SQLContainerGetResults an Azure Cosmos DB container. -type SQLContainerGetResults struct { - autorest.Response `json:"-"` - // SQLContainerGetProperties - The properties of an Azure Cosmos DB container - *SQLContainerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetResults. -func (scgr SQLContainerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgr.SQLContainerGetProperties != nil { - objectMap["properties"] = scgr.SQLContainerGetProperties - } - if scgr.Location != nil { - objectMap["location"] = scgr.Location - } - if scgr.Tags != nil { - objectMap["tags"] = scgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerGetResults struct. -func (scgr *SQLContainerGetResults) 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 SQLContainerGetProperties SQLContainerGetProperties - err = json.Unmarshal(*v, &SQLContainerGetProperties) - if err != nil { - return err - } - scgr.SQLContainerGetProperties = &SQLContainerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - scgr.Tags = tags - } - } - } - - return nil -} - -// SQLContainerListResult the List operation response, that contains the containers and their properties. -type SQLContainerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of containers and their properties. - Value *[]SQLContainerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerListResult. -func (sclr SQLContainerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLContainerResource cosmos DB SQL container resource object -type SQLContainerResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int64 `json:"analyticalStorageTtl,omitempty"` -} - -// SQLDatabaseCreateUpdateParameters parameters to create and update Cosmos DB SQL database. -type SQLDatabaseCreateUpdateParameters struct { - // SQLDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB SQL database. - *SQLDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseCreateUpdateParameters. -func (sdcup SQLDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdcup.SQLDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = sdcup.SQLDatabaseCreateUpdateProperties - } - if sdcup.Location != nil { - objectMap["location"] = sdcup.Location - } - if sdcup.Tags != nil { - objectMap["tags"] = sdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseCreateUpdateParameters struct. -func (sdcup *SQLDatabaseCreateUpdateParameters) 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 SQLDatabaseCreateUpdateProperties SQLDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &SQLDatabaseCreateUpdateProperties) - if err != nil { - return err - } - sdcup.SQLDatabaseCreateUpdateProperties = &SQLDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdcup.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB SQL database. -type SQLDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a SQL database - Resource *SQLDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type SQLDatabaseGetProperties struct { - Resource *SQLDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *SQLDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetPropertiesOptions ... -type SQLDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// SQLDatabaseGetPropertiesResource ... -type SQLDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Colls - A system generated property that specified the addressable path of the collections resource. - Colls *string `json:"_colls,omitempty"` - // Users - A system generated property that specifies the addressable path of the users resource. - Users *string `json:"_users,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetPropertiesResource. -func (sdgp SQLDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgp.ID != nil { - objectMap["id"] = sdgp.ID - } - if sdgp.Colls != nil { - objectMap["_colls"] = sdgp.Colls - } - if sdgp.Users != nil { - objectMap["_users"] = sdgp.Users - } - return json.Marshal(objectMap) -} - -// SQLDatabaseGetResults an Azure Cosmos DB SQL database. -type SQLDatabaseGetResults struct { - autorest.Response `json:"-"` - // SQLDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *SQLDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetResults. -func (sdgr SQLDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgr.SQLDatabaseGetProperties != nil { - objectMap["properties"] = sdgr.SQLDatabaseGetProperties - } - if sdgr.Location != nil { - objectMap["location"] = sdgr.Location - } - if sdgr.Tags != nil { - objectMap["tags"] = sdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseGetResults struct. -func (sdgr *SQLDatabaseGetResults) 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 SQLDatabaseGetProperties SQLDatabaseGetProperties - err = json.Unmarshal(*v, &SQLDatabaseGetProperties) - if err != nil { - return err - } - sdgr.SQLDatabaseGetProperties = &SQLDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdgr.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseListResult the List operation response, that contains the SQL databases and their properties. -type SQLDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of SQL databases and their properties. - Value *[]SQLDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseListResult. -func (sdlr SQLDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLDatabaseResource cosmos DB SQL database resource object -type SQLDatabaseResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` -} - -// SQLResourcesCreateUpdateSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLContainerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) 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 SQLResourcesCreateUpdateSQLContainerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) result(client SQLResourcesClient) (scgr SQLContainerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - scgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLContainerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if scgr.Response.Response, err = future.GetResult(sender); err == nil && scgr.Response.Response.StatusCode != http.StatusNoContent { - scgr, err = client.CreateUpdateSQLContainerResponder(scgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", scgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) 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 SQLResourcesCreateUpdateSQLDatabaseFuture.Result. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) result(client SQLResourcesClient) (sdgr SQLDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sdgr.Response.Response, err = future.GetResult(sender); err == nil && sdgr.Response.Response.StatusCode != http.StatusNoContent { - sdgr, err = client.CreateUpdateSQLDatabaseResponder(sdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", sdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLStoredProcedureFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLStoredProcedureGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) 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 SQLResourcesCreateUpdateSQLStoredProcedureFuture.Result. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) result(client SQLResourcesClient) (sspgr SQLStoredProcedureGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sspgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sspgr.Response.Response, err = future.GetResult(sender); err == nil && sspgr.Response.Response.StatusCode != http.StatusNoContent { - sspgr, err = client.CreateUpdateSQLStoredProcedureResponder(sspgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", sspgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLTriggerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) 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 SQLResourcesCreateUpdateSQLTriggerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) result(client SQLResourcesClient) (stgr SQLTriggerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - stgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLTriggerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if stgr.Response.Response, err = future.GetResult(sender); err == nil && stgr.Response.Response.StatusCode != http.StatusNoContent { - stgr, err = client.CreateUpdateSQLTriggerResponder(stgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", stgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLUserDefinedFunctionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) 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 SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (sudfgr SQLUserDefinedFunctionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sudfgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sudfgr.Response.Response, err = future.GetResult(sender); err == nil && sudfgr.Response.Response.StatusCode != http.StatusNoContent { - sudfgr, err = client.CreateUpdateSQLUserDefinedFunctionResponder(sudfgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", sudfgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesDeleteSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLContainerFuture) 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 SQLResourcesDeleteSQLContainerFuture.Result. -func (future *SQLResourcesDeleteSQLContainerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLContainerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLDatabaseFuture) 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 SQLResourcesDeleteSQLDatabaseFuture.Result. -func (future *SQLResourcesDeleteSQLDatabaseFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLStoredProcedureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) 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 SQLResourcesDeleteSQLStoredProcedureFuture.Result. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLStoredProcedureFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLTriggerFuture) 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 SQLResourcesDeleteSQLTriggerFuture.Result. -func (future *SQLResourcesDeleteSQLTriggerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLTriggerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesDeleteSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) 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 SQLResourcesDeleteSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesMigrateSQLContainerToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLContainerToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLContainerToAutoscaleFuture) 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 SQLResourcesMigrateSQLContainerToAutoscaleFuture.Result. -func (future *SQLResourcesMigrateSQLContainerToAutoscaleFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLContainerToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLContainerToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLContainerToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLContainerToManualThroughputFuture) 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 SQLResourcesMigrateSQLContainerToManualThroughputFuture.Result. -func (future *SQLResourcesMigrateSQLContainerToManualThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLContainerToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesMigrateSQLDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLDatabaseToAutoscaleFuture) 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 SQLResourcesMigrateSQLDatabaseToAutoscaleFuture.Result. -func (future *SQLResourcesMigrateSQLDatabaseToAutoscaleFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLDatabaseToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLDatabaseToManualThroughputFuture) 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 SQLResourcesMigrateSQLDatabaseToManualThroughputFuture.Result. -func (future *SQLResourcesMigrateSQLDatabaseToManualThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLContainerThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLContainerThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) 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 SQLResourcesUpdateSQLContainerThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLContainerThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLContainerThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLDatabaseThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) 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 SQLResourcesUpdateSQLDatabaseThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLStoredProcedureCreateUpdateParameters parameters to create and update Cosmos DB storedProcedure. -type SQLStoredProcedureCreateUpdateParameters struct { - // SQLStoredProcedureCreateUpdateProperties - Properties to create and update Azure Cosmos DB storedProcedure. - *SQLStoredProcedureCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureCreateUpdateParameters. -func (sspcup SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspcup.SQLStoredProcedureCreateUpdateProperties != nil { - objectMap["properties"] = sspcup.SQLStoredProcedureCreateUpdateProperties - } - if sspcup.Location != nil { - objectMap["location"] = sspcup.Location - } - if sspcup.Tags != nil { - objectMap["tags"] = sspcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureCreateUpdateParameters struct. -func (sspcup *SQLStoredProcedureCreateUpdateParameters) 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 SQLStoredProcedureCreateUpdateProperties SQLStoredProcedureCreateUpdateProperties - err = json.Unmarshal(*v, &SQLStoredProcedureCreateUpdateProperties) - if err != nil { - return err - } - sspcup.SQLStoredProcedureCreateUpdateProperties = &SQLStoredProcedureCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspcup.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureCreateUpdateProperties properties to create and update Azure Cosmos DB -// storedProcedure. -type SQLStoredProcedureCreateUpdateProperties struct { - // Resource - The standard JSON format of a storedProcedure - Resource *SQLStoredProcedureResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLStoredProcedureGetProperties the properties of an Azure Cosmos DB StoredProcedure -type SQLStoredProcedureGetProperties struct { - Resource *SQLStoredProcedureGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLStoredProcedureGetPropertiesResource ... -type SQLStoredProcedureGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetPropertiesResource. -func (sspgp SQLStoredProcedureGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgp.ID != nil { - objectMap["id"] = sspgp.ID - } - if sspgp.Body != nil { - objectMap["body"] = sspgp.Body - } - return json.Marshal(objectMap) -} - -// SQLStoredProcedureGetResults an Azure Cosmos DB storedProcedure. -type SQLStoredProcedureGetResults struct { - autorest.Response `json:"-"` - // SQLStoredProcedureGetProperties - The properties of an Azure Cosmos DB storedProcedure - *SQLStoredProcedureGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetResults. -func (sspgr SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgr.SQLStoredProcedureGetProperties != nil { - objectMap["properties"] = sspgr.SQLStoredProcedureGetProperties - } - if sspgr.Location != nil { - objectMap["location"] = sspgr.Location - } - if sspgr.Tags != nil { - objectMap["tags"] = sspgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureGetResults struct. -func (sspgr *SQLStoredProcedureGetResults) 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 SQLStoredProcedureGetProperties SQLStoredProcedureGetProperties - err = json.Unmarshal(*v, &SQLStoredProcedureGetProperties) - if err != nil { - return err - } - sspgr.SQLStoredProcedureGetProperties = &SQLStoredProcedureGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspgr.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureListResult the List operation response, that contains the storedProcedures and their -// properties. -type SQLStoredProcedureListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of storedProcedures and their properties. - Value *[]SQLStoredProcedureGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureListResult. -func (ssplr SQLStoredProcedureListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLStoredProcedureResource cosmos DB SQL storedProcedure resource object -type SQLStoredProcedureResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` -} - -// SQLTriggerCreateUpdateParameters parameters to create and update Cosmos DB trigger. -type SQLTriggerCreateUpdateParameters struct { - // SQLTriggerCreateUpdateProperties - Properties to create and update Azure Cosmos DB trigger. - *SQLTriggerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerCreateUpdateParameters. -func (stcup SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stcup.SQLTriggerCreateUpdateProperties != nil { - objectMap["properties"] = stcup.SQLTriggerCreateUpdateProperties - } - if stcup.Location != nil { - objectMap["location"] = stcup.Location - } - if stcup.Tags != nil { - objectMap["tags"] = stcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerCreateUpdateParameters struct. -func (stcup *SQLTriggerCreateUpdateParameters) 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 SQLTriggerCreateUpdateProperties SQLTriggerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLTriggerCreateUpdateProperties) - if err != nil { - return err - } - stcup.SQLTriggerCreateUpdateProperties = &SQLTriggerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stcup.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerCreateUpdateProperties properties to create and update Azure Cosmos DB trigger. -type SQLTriggerCreateUpdateProperties struct { - // Resource - The standard JSON format of a trigger - Resource *SQLTriggerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLTriggerGetProperties the properties of an Azure Cosmos DB trigger -type SQLTriggerGetProperties struct { - Resource *SQLTriggerGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLTriggerGetPropertiesResource ... -type SQLTriggerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetPropertiesResource. -func (stgp SQLTriggerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgp.ID != nil { - objectMap["id"] = stgp.ID - } - if stgp.Body != nil { - objectMap["body"] = stgp.Body - } - if stgp.TriggerType != "" { - objectMap["triggerType"] = stgp.TriggerType - } - if stgp.TriggerOperation != "" { - objectMap["triggerOperation"] = stgp.TriggerOperation - } - return json.Marshal(objectMap) -} - -// SQLTriggerGetResults an Azure Cosmos DB trigger. -type SQLTriggerGetResults struct { - autorest.Response `json:"-"` - // SQLTriggerGetProperties - The properties of an Azure Cosmos DB trigger - *SQLTriggerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetResults. -func (stgr SQLTriggerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgr.SQLTriggerGetProperties != nil { - objectMap["properties"] = stgr.SQLTriggerGetProperties - } - if stgr.Location != nil { - objectMap["location"] = stgr.Location - } - if stgr.Tags != nil { - objectMap["tags"] = stgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerGetResults struct. -func (stgr *SQLTriggerGetResults) 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 SQLTriggerGetProperties SQLTriggerGetProperties - err = json.Unmarshal(*v, &SQLTriggerGetProperties) - if err != nil { - return err - } - stgr.SQLTriggerGetProperties = &SQLTriggerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stgr.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerListResult the List operation response, that contains the triggers and their properties. -type SQLTriggerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of triggers and their properties. - Value *[]SQLTriggerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerListResult. -func (stlr SQLTriggerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLTriggerResource cosmos DB SQL trigger resource object -type SQLTriggerResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` -} - -// SQLUserDefinedFunctionCreateUpdateParameters parameters to create and update Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateParameters struct { - // SQLUserDefinedFunctionCreateUpdateProperties - Properties to create and update Azure Cosmos DB userDefinedFunction. - *SQLUserDefinedFunctionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionCreateUpdateParameters. -func (sudfcup SQLUserDefinedFunctionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfcup.SQLUserDefinedFunctionCreateUpdateProperties != nil { - objectMap["properties"] = sudfcup.SQLUserDefinedFunctionCreateUpdateProperties - } - if sudfcup.Location != nil { - objectMap["location"] = sudfcup.Location - } - if sudfcup.Tags != nil { - objectMap["tags"] = sudfcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionCreateUpdateParameters struct. -func (sudfcup *SQLUserDefinedFunctionCreateUpdateParameters) 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 SQLUserDefinedFunctionCreateUpdateProperties SQLUserDefinedFunctionCreateUpdateProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionCreateUpdateProperties) - if err != nil { - return err - } - sudfcup.SQLUserDefinedFunctionCreateUpdateProperties = &SQLUserDefinedFunctionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfcup.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionCreateUpdateProperties properties to create and update Azure Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateProperties struct { - // Resource - The standard JSON format of a userDefinedFunction - Resource *SQLUserDefinedFunctionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLUserDefinedFunctionGetProperties the properties of an Azure Cosmos DB userDefinedFunction -type SQLUserDefinedFunctionGetProperties struct { - Resource *SQLUserDefinedFunctionGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLUserDefinedFunctionGetPropertiesResource ... -type SQLUserDefinedFunctionGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetPropertiesResource. -func (sudfgp SQLUserDefinedFunctionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgp.ID != nil { - objectMap["id"] = sudfgp.ID - } - if sudfgp.Body != nil { - objectMap["body"] = sudfgp.Body - } - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionGetResults an Azure Cosmos DB userDefinedFunction. -type SQLUserDefinedFunctionGetResults struct { - autorest.Response `json:"-"` - // SQLUserDefinedFunctionGetProperties - The properties of an Azure Cosmos DB userDefinedFunction - *SQLUserDefinedFunctionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetResults. -func (sudfgr SQLUserDefinedFunctionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgr.SQLUserDefinedFunctionGetProperties != nil { - objectMap["properties"] = sudfgr.SQLUserDefinedFunctionGetProperties - } - if sudfgr.Location != nil { - objectMap["location"] = sudfgr.Location - } - if sudfgr.Tags != nil { - objectMap["tags"] = sudfgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionGetResults struct. -func (sudfgr *SQLUserDefinedFunctionGetResults) 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 SQLUserDefinedFunctionGetProperties SQLUserDefinedFunctionGetProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionGetProperties) - if err != nil { - return err - } - sudfgr.SQLUserDefinedFunctionGetProperties = &SQLUserDefinedFunctionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfgr.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionListResult the List operation response, that contains the userDefinedFunctions and -// their properties. -type SQLUserDefinedFunctionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of userDefinedFunctions and their properties. - Value *[]SQLUserDefinedFunctionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionListResult. -func (sudflr SQLUserDefinedFunctionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionResource cosmos DB SQL userDefinedFunction resource object -type SQLUserDefinedFunctionResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` -} - -// TableCreateUpdateParameters parameters to create and update Cosmos DB Table. -type TableCreateUpdateParameters struct { - // TableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Table. - *TableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableCreateUpdateParameters. -func (tcup TableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TableCreateUpdateProperties != nil { - objectMap["properties"] = tcup.TableCreateUpdateProperties - } - if tcup.Location != nil { - objectMap["location"] = tcup.Location - } - if tcup.Tags != nil { - objectMap["tags"] = tcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableCreateUpdateParameters struct. -func (tcup *TableCreateUpdateParameters) 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 tableCreateUpdateProperties TableCreateUpdateProperties - err = json.Unmarshal(*v, &tableCreateUpdateProperties) - if err != nil { - return err - } - tcup.TableCreateUpdateProperties = &tableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tcup.Tags = tags - } - } - } - - return nil -} - -// TableCreateUpdateProperties properties to create and update Azure Cosmos DB Table. -type TableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Table - Resource *TableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// TableGetProperties the properties of an Azure Cosmos Table -type TableGetProperties struct { - Resource *TableGetPropertiesResource `json:"resource,omitempty"` - Options *TableGetPropertiesOptions `json:"options,omitempty"` -} - -// TableGetPropertiesOptions ... -type TableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// TableGetPropertiesResource ... -type TableGetPropertiesResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableGetPropertiesResource. -func (tgp TableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgp.ID != nil { - objectMap["id"] = tgp.ID - } - return json.Marshal(objectMap) -} - -// TableGetResults an Azure Cosmos DB Table. -type TableGetResults struct { - autorest.Response `json:"-"` - // TableGetProperties - The properties of an Azure Cosmos DB Table - *TableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableGetResults. -func (tgr TableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgr.TableGetProperties != nil { - objectMap["properties"] = tgr.TableGetProperties - } - if tgr.Location != nil { - objectMap["location"] = tgr.Location - } - if tgr.Tags != nil { - objectMap["tags"] = tgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableGetResults struct. -func (tgr *TableGetResults) 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 tableGetProperties TableGetProperties - err = json.Unmarshal(*v, &tableGetProperties) - if err != nil { - return err - } - tgr.TableGetProperties = &tableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tgr.Tags = tags - } - } - } - - return nil -} - -// TableListResult the List operation response, that contains the Table and their properties. -type TableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Table and their properties. - Value *[]TableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableListResult. -func (tlr TableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TableResource cosmos DB table resource object -type TableResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` -} - -// TableResourcesCreateUpdateTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesCreateUpdateTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (TableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesCreateUpdateTableFuture) 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 TableResourcesCreateUpdateTableFuture.Result. -func (future *TableResourcesCreateUpdateTableFuture) result(client TableResourcesClient) (tgr TableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesCreateUpdateTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tgr.Response.Response, err = future.GetResult(sender); err == nil && tgr.Response.Response.StatusCode != http.StatusNoContent { - tgr, err = client.CreateUpdateTableResponder(tgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", tgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesDeleteTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesDeleteTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesDeleteTableFuture) 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 TableResourcesDeleteTableFuture.Result. -func (future *TableResourcesDeleteTableFuture) result(client TableResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesDeleteTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesDeleteTableFuture") - return - } - ar.Response = future.Response() - return -} - -// TableResourcesMigrateTableToAutoscaleFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type TableResourcesMigrateTableToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesMigrateTableToAutoscaleFuture) 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 TableResourcesMigrateTableToAutoscaleFuture.Result. -func (future *TableResourcesMigrateTableToAutoscaleFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesMigrateTableToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateTableToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesMigrateTableToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type TableResourcesMigrateTableToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesMigrateTableToManualThroughputFuture) 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 TableResourcesMigrateTableToManualThroughputFuture.Result. -func (future *TableResourcesMigrateTableToManualThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesMigrateTableToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateTableToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesUpdateTableThroughputFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesUpdateTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesUpdateTableThroughputFuture) 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 TableResourcesUpdateTableThroughputFuture.Result. -func (future *TableResourcesUpdateTableThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesUpdateTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// ThroughputPolicyResource cosmos DB resource throughput policy -type ThroughputPolicyResource struct { - // IsEnabled - Determines whether the ThroughputPolicy is active or not - IsEnabled *bool `json:"isEnabled,omitempty"` - // IncrementPercent - Represents the percentage by which throughput can increase every time throughput policy kicks in. - IncrementPercent *int32 `json:"incrementPercent,omitempty"` -} - -// ThroughputSettingsGetProperties the properties of an Azure Cosmos DB resource throughput -type ThroughputSettingsGetProperties struct { - Resource *ThroughputSettingsGetPropertiesResource `json:"resource,omitempty"` -} - -// ThroughputSettingsGetPropertiesResource ... -type ThroughputSettingsGetPropertiesResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. - AutoscaleSettings *AutoscaleSettingsResource `json:"autoscaleSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetPropertiesResource. -func (tsgp ThroughputSettingsGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgp.Throughput != nil { - objectMap["throughput"] = tsgp.Throughput - } - if tsgp.AutoscaleSettings != nil { - objectMap["autoscaleSettings"] = tsgp.AutoscaleSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsGetResults an Azure Cosmos DB resource throughput. -type ThroughputSettingsGetResults struct { - autorest.Response `json:"-"` - // ThroughputSettingsGetProperties - The properties of an Azure Cosmos DB resource throughput - *ThroughputSettingsGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetResults. -func (tsgr ThroughputSettingsGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgr.ThroughputSettingsGetProperties != nil { - objectMap["properties"] = tsgr.ThroughputSettingsGetProperties - } - if tsgr.Location != nil { - objectMap["location"] = tsgr.Location - } - if tsgr.Tags != nil { - objectMap["tags"] = tsgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsGetResults struct. -func (tsgr *ThroughputSettingsGetResults) 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 throughputSettingsGetProperties ThroughputSettingsGetProperties - err = json.Unmarshal(*v, &throughputSettingsGetProperties) - if err != nil { - return err - } - tsgr.ThroughputSettingsGetProperties = &throughputSettingsGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsgr.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsResource cosmos DB resource throughput object. Either throughput is required or -// autoscaleSettings is required, but not both. -type ThroughputSettingsResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. - AutoscaleSettings *AutoscaleSettingsResource `json:"autoscaleSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsResource. -func (tsr ThroughputSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsr.Throughput != nil { - objectMap["throughput"] = tsr.Throughput - } - if tsr.AutoscaleSettings != nil { - objectMap["autoscaleSettings"] = tsr.AutoscaleSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsUpdateParameters parameters to update Cosmos DB resource throughput. -type ThroughputSettingsUpdateParameters struct { - // ThroughputSettingsUpdateProperties - Properties to update Azure Cosmos DB resource throughput. - *ThroughputSettingsUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsUpdateParameters. -func (tsup ThroughputSettingsUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsup.ThroughputSettingsUpdateProperties != nil { - objectMap["properties"] = tsup.ThroughputSettingsUpdateProperties - } - if tsup.Location != nil { - objectMap["location"] = tsup.Location - } - if tsup.Tags != nil { - objectMap["tags"] = tsup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsUpdateParameters struct. -func (tsup *ThroughputSettingsUpdateParameters) 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 throughputSettingsUpdateProperties ThroughputSettingsUpdateProperties - err = json.Unmarshal(*v, &throughputSettingsUpdateProperties) - if err != nil { - return err - } - tsup.ThroughputSettingsUpdateProperties = &throughputSettingsUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsup.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsUpdateProperties properties to update Azure Cosmos DB resource throughput. -type ThroughputSettingsUpdateProperties struct { - // Resource - The standard JSON format of a resource throughput - Resource *ThroughputSettingsResource `json:"resource,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"` -} - -// 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) -} - -// UniqueKey the unique key on that enforces uniqueness constraint on documents in the collection in the -// Azure Cosmos DB service. -type UniqueKey struct { - // Paths - List of paths must be unique for each document in the Azure Cosmos DB service - Paths *[]string `json:"paths,omitempty"` -} - -// UniqueKeyPolicy the unique key policy configuration for specifying uniqueness constraints on documents -// in the collection in the Azure Cosmos DB service. -type UniqueKeyPolicy struct { - // UniqueKeys - List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - UniqueKeys *[]UniqueKey `json:"uniqueKeys,omitempty"` -} - -// Usage the usage data for a usage request. -type Usage struct { - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.Unit != "" { - objectMap["unit"] = u.Unit - } - return json.Marshal(objectMap) -} - -// UsagesResult the response to a list usage request. -type UsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of usages for the database. A usage is a point in time metric - Value *[]Usage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsagesResult. -func (ur UsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRule virtual Network ACL Rule object -type VirtualNetworkRule struct { - // ID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. - ID *string `json:"id,omitempty"` - // IgnoreMissingVNetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVNetServiceEndpoint *bool `json:"ignoreMissingVNetServiceEndpoint,omitempty"` -} diff --git a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/mongodbresources.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/mongodbresources.go deleted file mode 100644 index 352ef4445ffa..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/mongodbresources.go +++ /dev/null @@ -1,1591 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// MongoDBResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type MongoDBResourcesClient struct { - BaseClient -} - -// NewMongoDBResourcesClient creates an instance of the MongoDBResourcesClient client. -func NewMongoDBResourcesClient(subscriptionID string) MongoDBResourcesClient { - return NewMongoDBResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMongoDBResourcesClientWithBaseURI creates an instance of the MongoDBResourcesClient 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 NewMongoDBResourcesClientWithBaseURI(baseURI string, subscriptionID string) MongoDBResourcesClient { - return MongoDBResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateMongoDBCollection create or update an Azure Cosmos DB MongoDB Collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// createUpdateMongoDBCollectionParameters - the parameters to provide for the current MongoDB Collection. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBCollectionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", err.Error()) - } - - req, err := client.CreateUpdateMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBCollectionPreparer prepares the CreateUpdateMongoDBCollection request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBCollectionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBCollectionSender sends the CreateUpdateMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBCollectionFuture, 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 -} - -// CreateUpdateMongoDBCollectionResponder handles the response to the CreateUpdateMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateMongoDBDatabase create or updates Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateMongoDBDatabaseParameters - the parameters to provide for the current MongoDB database. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", err.Error()) - } - - req, err := client.CreateUpdateMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBDatabasePreparer prepares the CreateUpdateMongoDBDatabase request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBDatabaseSender sends the CreateUpdateMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, 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 -} - -// CreateUpdateMongoDBDatabaseResponder handles the response to the CreateUpdateMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteMongoDBCollection deletes an existing Azure Cosmos DB MongoDB Collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesDeleteMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", err.Error()) - } - - req, err := client.DeleteMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBCollectionPreparer prepares the DeleteMongoDBCollection request. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBCollectionSender sends the DeleteMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBCollectionFuture, 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 -} - -// DeleteMongoDBCollectionResponder handles the response to the DeleteMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionResponder(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 -} - -// DeleteMongoDBDatabase deletes an existing Azure Cosmos DB MongoDB database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", err.Error()) - } - - req, err := client.DeleteMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBDatabasePreparer prepares the DeleteMongoDBDatabase request. -func (client MongoDBResourcesClient) DeleteMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBDatabaseSender sends the DeleteMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBDatabaseFuture, 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 -} - -// DeleteMongoDBDatabaseResponder handles the response to the DeleteMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseResponder(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 -} - -// GetMongoDBCollection gets the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBCollectionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollection") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollection", err.Error()) - } - - req, err := client.GetMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionPreparer prepares the GetMongoDBCollection request. -func (client MongoDBResourcesClient) GetMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionSender sends the GetMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionResponder handles the response to the GetMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBCollectionThroughput gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollectionThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.GetMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionThroughputPreparer prepares the GetMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionThroughputSender sends the GetMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionThroughputResponder handles the response to the GetMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabase gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", err.Error()) - } - - req, err := client.GetMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabasePreparer prepares the GetMongoDBDatabase request. -func (client MongoDBResourcesClient) GetMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseSender sends the GetMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseResponder handles the response to the GetMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabaseThroughput gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.GetMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabaseThroughputPreparer prepares the GetMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseThroughputSender sends the GetMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseThroughputResponder handles the response to the GetMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBCollections lists the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBCollectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBCollections") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBCollections", err.Error()) - } - - req, err := client.ListMongoDBCollectionsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBCollectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBCollectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBCollectionsPreparer prepares the ListMongoDBCollections request. -func (client MongoDBResourcesClient) ListMongoDBCollectionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBCollectionsSender sends the ListMongoDBCollections request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBCollectionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBCollectionsResponder handles the response to the ListMongoDBCollections request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBCollectionsResponder(resp *http.Response) (result MongoDBCollectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBDatabases lists the MongoDB databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client MongoDBResourcesClient) ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result MongoDBDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", err.Error()) - } - - req, err := client.ListMongoDBDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBDatabasesPreparer prepares the ListMongoDBDatabases request. -func (client MongoDBResourcesClient) ListMongoDBDatabasesPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBDatabasesSender sends the ListMongoDBDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBDatabasesResponder handles the response to the ListMongoDBDatabases request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBDatabasesResponder(resp *http.Response) (result MongoDBDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBCollectionToAutoscale migrate an Azure Cosmos DB MongoDB collection from manual throughput to -// autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", err.Error()) - } - - req, err := client.MigrateMongoDBCollectionToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBCollectionToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBCollectionToAutoscalePreparer prepares the MigrateMongoDBCollectionToAutoscale request. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBCollectionToAutoscaleSender sends the MigrateMongoDBCollectionToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, 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 -} - -// MigrateMongoDBCollectionToAutoscaleResponder handles the response to the MigrateMongoDBCollectionToAutoscale request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBCollectionToManualThroughput migrate an Azure Cosmos DB MongoDB collection from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", err.Error()) - } - - req, err := client.MigrateMongoDBCollectionToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBCollectionToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBCollectionToManualThroughputPreparer prepares the MigrateMongoDBCollectionToManualThroughput request. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBCollectionToManualThroughputSender sends the MigrateMongoDBCollectionToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, 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 -} - -// MigrateMongoDBCollectionToManualThroughputResponder handles the response to the MigrateMongoDBCollectionToManualThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBDatabaseToAutoscale migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateMongoDBDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBDatabaseToAutoscalePreparer prepares the MigrateMongoDBDatabaseToAutoscale request. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBDatabaseToAutoscaleSender sends the MigrateMongoDBDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, 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 -} - -// MigrateMongoDBDatabaseToAutoscaleResponder handles the response to the MigrateMongoDBDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBDatabaseToManualThroughput migrate an Azure Cosmos DB MongoDB database from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateMongoDBDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBDatabaseToManualThroughputPreparer prepares the MigrateMongoDBDatabaseToManualThroughput request. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBDatabaseToManualThroughputSender sends the MigrateMongoDBDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, 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 -} - -// MigrateMongoDBDatabaseToManualThroughputResponder handles the response to the MigrateMongoDBDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBCollectionThroughput update the RUs per second of an Azure Cosmos DB MongoDB collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// collection. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBCollectionThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBCollectionThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBCollectionThroughputPreparer prepares the UpdateMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBCollectionThroughputSender sends the UpdateMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, 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 -} - -// UpdateMongoDBCollectionThroughputResponder handles the response to the UpdateMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBDatabaseThroughput update RUs per second of the an Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// database. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBDatabaseThroughputPreparer prepares the UpdateMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBDatabaseThroughputSender sends the UpdateMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, 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 -} - -// UpdateMongoDBDatabaseThroughputResponder handles the response to the UpdateMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/notebookworkspaces.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/notebookworkspaces.go deleted file mode 100644 index 8884a6088998..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/notebookworkspaces.go +++ /dev/null @@ -1,681 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotebookWorkspacesClient is the azure Cosmos DB Database Service Resource Provider REST API -type NotebookWorkspacesClient struct { - BaseClient -} - -// NewNotebookWorkspacesClient creates an instance of the NotebookWorkspacesClient client. -func NewNotebookWorkspacesClient(subscriptionID string) NotebookWorkspacesClient { - return NewNotebookWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotebookWorkspacesClientWithBaseURI creates an instance of the NotebookWorkspacesClient 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 NewNotebookWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) NotebookWorkspacesClient { - return NotebookWorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// notebookCreateUpdateParameters - the notebook workspace to create for the current database account. -func (client NotebookWorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (result NotebookWorkspacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, notebookCreateUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotebookWorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", pathParameters), - autorest.WithJSON(notebookCreateUpdateParameters), - 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 NotebookWorkspacesClient) CreateOrUpdateSender(req *http.Request) (future NotebookWorkspacesCreateOrUpdateFuture, 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 NotebookWorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result NotebookWorkspace, 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 notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotebookWorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) DeleteSender(req *http.Request) (future NotebookWorkspacesDeleteFuture, 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 NotebookWorkspacesClient) 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 the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotebookWorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) 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 NotebookWorkspacesClient) GetResponder(resp *http.Response) (result NotebookWorkspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabaseAccount gets the notebook workspace resources of an existing Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client NotebookWorkspacesClient) ListByDatabaseAccountPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListByDatabaseAccountResponder(resp *http.Response) (result NotebookWorkspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionInfo retrieves the connection info for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceConnectionInfoResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListConnectionInfo") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListConnectionInfo", err.Error()) - } - - req, err := client.ListConnectionInfoPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionInfoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionInfoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionInfoPreparer prepares the ListConnectionInfo request. -func (client NotebookWorkspacesClient) ListConnectionInfoPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionInfoSender sends the ListConnectionInfo request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListConnectionInfoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionInfoResponder handles the response to the ListConnectionInfo request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListConnectionInfoResponder(resp *http.Response) (result NotebookWorkspaceConnectionInfoResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateAuthToken regenerates the auth token for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesRegenerateAuthTokenFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.RegenerateAuthToken") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", err.Error()) - } - - req, err := client.RegenerateAuthTokenPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateAuthTokenSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateAuthTokenPreparer prepares the RegenerateAuthToken request. -func (client NotebookWorkspacesClient) RegenerateAuthTokenPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateAuthTokenSender sends the RegenerateAuthToken request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) RegenerateAuthTokenSender(req *http.Request) (future NotebookWorkspacesRegenerateAuthTokenFuture, 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 -} - -// RegenerateAuthTokenResponder handles the response to the RegenerateAuthToken request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) RegenerateAuthTokenResponder(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 the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Start(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client NotebookWorkspacesClient) StartPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/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 NotebookWorkspacesClient) StartSender(req *http.Request) (future NotebookWorkspacesStartFuture, 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 NotebookWorkspacesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/operations.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/operations.go deleted file mode 100644 index d11d1a244461..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure Cosmos DB Database Service Resource Provider REST API -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 Cosmos DB Resource Provider 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, "documentdb.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, "documentdb.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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 = "2020-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DocumentDB/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, "documentdb.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, "documentdb.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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/cosmos-db/mgmt/2020-04-01-preview/documentdb/partitionkeyrangeid.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/partitionkeyrangeid.go deleted file mode 100644 index d69e30957919..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/partitionkeyrangeid.go +++ /dev/null @@ -1,133 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDClient creates an instance of the PartitionKeyRangeIDClient client. -func NewPartitionKeyRangeIDClient(subscriptionID string) PartitionKeyRangeIDClient { - return NewPartitionKeyRangeIDClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDClientWithBaseURI creates an instance of the PartitionKeyRangeIDClient 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 NewPartitionKeyRangeIDClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDClient { - return PartitionKeyRangeIDClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/partitionkeyrangeidregion.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/partitionkeyrangeidregion.go deleted file mode 100644 index 024d58c14d99..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/partitionkeyrangeidregion.go +++ /dev/null @@ -1,135 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDRegionClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDRegionClient creates an instance of the PartitionKeyRangeIDRegionClient client. -func NewPartitionKeyRangeIDRegionClient(subscriptionID string) PartitionKeyRangeIDRegionClient { - return NewPartitionKeyRangeIDRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDRegionClientWithBaseURI creates an instance of the PartitionKeyRangeIDRegionClient 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 NewPartitionKeyRangeIDRegionClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDRegionClient { - return PartitionKeyRangeIDRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentile.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentile.go deleted file mode 100644 index c56f691496ed..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentile.go +++ /dev/null @@ -1,127 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileClient struct { - BaseClient -} - -// NewPercentileClient creates an instance of the PercentileClient client. -func NewPercentileClient(subscriptionID string) PercentileClient { - return NewPercentileClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileClientWithBaseURI creates an instance of the PercentileClient 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 NewPercentileClientWithBaseURI(baseURI string, subscriptionID string) PercentileClient { - return PercentileClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. This url is only -// for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentilesourcetarget.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentilesourcetarget.go deleted file mode 100644 index 6315f13696f2..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentilesourcetarget.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileSourceTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileSourceTargetClient struct { - BaseClient -} - -// NewPercentileSourceTargetClient creates an instance of the PercentileSourceTargetClient client. -func NewPercentileSourceTargetClient(subscriptionID string) PercentileSourceTargetClient { - return NewPercentileSourceTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileSourceTargetClientWithBaseURI creates an instance of the PercentileSourceTargetClient 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 NewPercentileSourceTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileSourceTargetClient { - return PercentileSourceTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account, source and target region. -// This url is only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// sourceRegion - source region from which data is written. Cosmos DB region, with spaces between words and -// each word capitalized. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileSourceTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileSourceTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileSourceTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, sourceRegion, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileSourceTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceRegion": autorest.Encode("path", sourceRegion), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileSourceTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileSourceTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentiletarget.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentiletarget.go deleted file mode 100644 index d0a139aa785a..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/percentiletarget.go +++ /dev/null @@ -1,131 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileTargetClient struct { - BaseClient -} - -// NewPercentileTargetClient creates an instance of the PercentileTargetClient client. -func NewPercentileTargetClient(subscriptionID string) PercentileTargetClient { - return NewPercentileTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileTargetClientWithBaseURI creates an instance of the PercentileTargetClient 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 NewPercentileTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileTargetClient { - return PercentileTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account target region. This url is -// only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, targetRegion 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), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2020-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/privateendpointconnections.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/privateendpointconnections.go deleted file mode 100644 index a084a08ec5ab..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/privateendpointconnections.go +++ /dev/null @@ -1,406 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) 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 = "2019-08-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.DocumentDB/databaseAccounts/{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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByDatabaseAccount list all private endpoint connections on a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/privatelinkresources.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/privatelinkresources.go deleted file mode 100644 index 42aee63e6a66..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/privatelinkresources.go +++ /dev/null @@ -1,215 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByDatabaseAccount gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateLinkResourcesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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/cosmos-db/mgmt/2020-04-01-preview/documentdb/sqlresources.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/sqlresources.go deleted file mode 100644 index 81de3f75ca05..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/sqlresources.go +++ /dev/null @@ -1,2780 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type SQLResourcesClient struct { - BaseClient -} - -// NewSQLResourcesClient creates an instance of the SQLResourcesClient client. -func NewSQLResourcesClient(subscriptionID string) SQLResourcesClient { - return NewSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLResourcesClientWithBaseURI creates an instance of the SQLResourcesClient 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 NewSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string) SQLResourcesClient { - return SQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateSQLContainer create or update an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// createUpdateSQLContainerParameters - the parameters to provide for the current SQL container. -func (client SQLResourcesClient) CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLContainerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", err.Error()) - } - - req, err := client.CreateUpdateSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, createUpdateSQLContainerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLContainerPreparer prepares the CreateUpdateSQLContainer request. -func (client SQLResourcesClient) CreateUpdateSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithJSON(createUpdateSQLContainerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLContainerSender sends the CreateUpdateSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLContainerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLContainerFuture, 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 -} - -// CreateUpdateSQLContainerResponder handles the response to the CreateUpdateSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLDatabase create or update an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateSQLDatabaseParameters - the parameters to provide for the current SQL database. -func (client SQLResourcesClient) CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", err.Error()) - } - - req, err := client.CreateUpdateSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateSQLDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLDatabasePreparer prepares the CreateUpdateSQLDatabase request. -func (client SQLResourcesClient) CreateUpdateSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateSQLDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLDatabaseSender sends the CreateUpdateSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseSender(req *http.Request) (future SQLResourcesCreateUpdateSQLDatabaseFuture, 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 -} - -// CreateUpdateSQLDatabaseResponder handles the response to the CreateUpdateSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLStoredProcedure create or update an Azure Cosmos DB SQL storedProcedure -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -// createUpdateSQLStoredProcedureParameters - the parameters to provide for the current SQL storedProcedure. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLStoredProcedureParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", err.Error()) - } - - req, err := client.CreateUpdateSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSQLStoredProcedureParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLStoredProcedurePreparer prepares the CreateUpdateSQLStoredProcedure request. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithJSON(createUpdateSQLStoredProcedureParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLStoredProcedureSender sends the CreateUpdateSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureSender(req *http.Request) (future SQLResourcesCreateUpdateSQLStoredProcedureFuture, 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 -} - -// CreateUpdateSQLStoredProcedureResponder handles the response to the CreateUpdateSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLTrigger create or update an Azure Cosmos DB SQL trigger -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -// createUpdateSQLTriggerParameters - the parameters to provide for the current SQL trigger. -func (client SQLResourcesClient) CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLTriggerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", err.Error()) - } - - req, err := client.CreateUpdateSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSQLTriggerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLTriggerPreparer prepares the CreateUpdateSQLTrigger request. -func (client SQLResourcesClient) CreateUpdateSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithJSON(createUpdateSQLTriggerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLTriggerSender sends the CreateUpdateSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLTriggerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLTriggerFuture, 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 -} - -// CreateUpdateSQLTriggerResponder handles the response to the CreateUpdateSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLUserDefinedFunction create or update an Azure Cosmos DB SQL userDefinedFunction -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -// createUpdateSQLUserDefinedFunctionParameters - the parameters to provide for the current SQL -// userDefinedFunction. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLUserDefinedFunctionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", err.Error()) - } - - req, err := client.CreateUpdateSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSQLUserDefinedFunctionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLUserDefinedFunctionPreparer prepares the CreateUpdateSQLUserDefinedFunction request. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithJSON(createUpdateSQLUserDefinedFunctionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLUserDefinedFunctionSender sends the CreateUpdateSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, 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 -} - -// CreateUpdateSQLUserDefinedFunctionResponder handles the response to the CreateUpdateSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSQLContainer deletes an existing Azure Cosmos DB SQL container. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesDeleteSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLContainer", err.Error()) - } - - req, err := client.DeleteSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLContainerPreparer prepares the DeleteSQLContainer request. -func (client SQLResourcesClient) DeleteSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLContainerSender sends the DeleteSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLContainerSender(req *http.Request) (future SQLResourcesDeleteSQLContainerFuture, 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 -} - -// DeleteSQLContainerResponder handles the response to the DeleteSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLContainerResponder(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 -} - -// DeleteSQLDatabase deletes an existing Azure Cosmos DB SQL database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesDeleteSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLDatabase", err.Error()) - } - - req, err := client.DeleteSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLDatabasePreparer prepares the DeleteSQLDatabase request. -func (client SQLResourcesClient) DeleteSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLDatabaseSender sends the DeleteSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLDatabaseSender(req *http.Request) (future SQLResourcesDeleteSQLDatabaseFuture, 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 -} - -// DeleteSQLDatabaseResponder handles the response to the DeleteSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLDatabaseResponder(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 -} - -// DeleteSQLStoredProcedure deletes an existing Azure Cosmos DB SQL storedProcedure. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLResourcesDeleteSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", err.Error()) - } - - req, err := client.DeleteSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLStoredProcedurePreparer prepares the DeleteSQLStoredProcedure request. -func (client SQLResourcesClient) DeleteSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLStoredProcedureSender sends the DeleteSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLStoredProcedureSender(req *http.Request) (future SQLResourcesDeleteSQLStoredProcedureFuture, 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 -} - -// DeleteSQLStoredProcedureResponder handles the response to the DeleteSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLStoredProcedureResponder(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 -} - -// DeleteSQLTrigger deletes an existing Azure Cosmos DB SQL trigger. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLResourcesDeleteSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLTrigger", err.Error()) - } - - req, err := client.DeleteSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLTriggerPreparer prepares the DeleteSQLTrigger request. -func (client SQLResourcesClient) DeleteSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLTriggerSender sends the DeleteSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLTriggerSender(req *http.Request) (future SQLResourcesDeleteSQLTriggerFuture, 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 -} - -// DeleteSQLTriggerResponder handles the response to the DeleteSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLTriggerResponder(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 -} - -// DeleteSQLUserDefinedFunction deletes an existing Azure Cosmos DB SQL userDefinedFunction. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", err.Error()) - } - - req, err := client.DeleteSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLUserDefinedFunctionPreparer prepares the DeleteSQLUserDefinedFunction request. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLUserDefinedFunctionSender sends the DeleteSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesDeleteSQLUserDefinedFunctionFuture, 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 -} - -// DeleteSQLUserDefinedFunctionResponder handles the response to the DeleteSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionResponder(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 -} - -// GetSQLContainer gets the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error()) - } - - req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerPreparer prepares the GetSQLContainer request. -func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerSender sends the GetSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database -// account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error()) - } - - req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request. -func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error()) - } - - req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabasePreparer prepares the GetSQLDatabase request. -func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database -// account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error()) - } - - req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request. -func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLStoredProcedure gets the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLStoredProcedureGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLStoredProcedure") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLStoredProcedure", err.Error()) - } - - req, err := client.GetSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLStoredProcedureSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure sending request") - return - } - - result, err = client.GetSQLStoredProcedureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLStoredProcedurePreparer prepares the GetSQLStoredProcedure request. -func (client SQLResourcesClient) GetSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLStoredProcedureSender sends the GetSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLStoredProcedureSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLStoredProcedureResponder handles the response to the GetSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLTrigger gets the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLTriggerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLTrigger") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLTrigger", err.Error()) - } - - req, err := client.GetSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLTriggerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure sending request") - return - } - - result, err = client.GetSQLTriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLTriggerPreparer prepares the GetSQLTrigger request. -func (client SQLResourcesClient) GetSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLTriggerSender sends the GetSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLTriggerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLTriggerResponder handles the response to the GetSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLUserDefinedFunction gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLUserDefinedFunctionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLUserDefinedFunction") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", err.Error()) - } - - req, err := client.GetSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLUserDefinedFunctionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure sending request") - return - } - - result, err = client.GetSQLUserDefinedFunctionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLUserDefinedFunctionPreparer prepares the GetSQLUserDefinedFunction request. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLUserDefinedFunctionSender sends the GetSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLUserDefinedFunctionResponder handles the response to the GetSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLContainers lists the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLContainerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLContainers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLContainers", err.Error()) - } - - req, err := client.ListSQLContainersPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLContainersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLContainersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLContainersPreparer prepares the ListSQLContainers request. -func (client SQLResourcesClient) ListSQLContainersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLContainersSender sends the ListSQLContainers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLContainersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLContainersResponder handles the response to the ListSQLContainers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLContainersResponder(resp *http.Response) (result SQLContainerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLDatabases lists the SQL databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result SQLDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLDatabases", err.Error()) - } - - req, err := client.ListSQLDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListSQLDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLDatabasesPreparer prepares the ListSQLDatabases request. -func (client SQLResourcesClient) ListSQLDatabasesPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLDatabasesSender sends the ListSQLDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLDatabasesResponder handles the response to the ListSQLDatabases request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLDatabasesResponder(resp *http.Response) (result SQLDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLStoredProcedures lists the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLStoredProcedureListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLStoredProcedures") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLStoredProcedures", err.Error()) - } - - req, err := client.ListSQLStoredProceduresPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLStoredProceduresSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure sending request") - return - } - - result, err = client.ListSQLStoredProceduresResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLStoredProceduresPreparer prepares the ListSQLStoredProcedures request. -func (client SQLResourcesClient) ListSQLStoredProceduresPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLStoredProceduresSender sends the ListSQLStoredProcedures request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLStoredProceduresSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLStoredProceduresResponder handles the response to the ListSQLStoredProcedures request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLStoredProceduresResponder(resp *http.Response) (result SQLStoredProcedureListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLTriggers lists the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLTriggerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLTriggers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLTriggers", err.Error()) - } - - req, err := client.ListSQLTriggersPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLTriggersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLTriggersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLTriggersPreparer prepares the ListSQLTriggers request. -func (client SQLResourcesClient) ListSQLTriggersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLTriggersSender sends the ListSQLTriggers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLTriggersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLTriggersResponder handles the response to the ListSQLTriggers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLTriggersResponder(resp *http.Response) (result SQLTriggerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLUserDefinedFunctions lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLUserDefinedFunctionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLUserDefinedFunctions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", err.Error()) - } - - req, err := client.ListSQLUserDefinedFunctionsPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLUserDefinedFunctionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure sending request") - return - } - - result, err = client.ListSQLUserDefinedFunctionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLUserDefinedFunctionsPreparer prepares the ListSQLUserDefinedFunctions request. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLUserDefinedFunctionsSender sends the ListSQLUserDefinedFunctions request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLUserDefinedFunctionsResponder handles the response to the ListSQLUserDefinedFunctions request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsResponder(resp *http.Response) (result SQLUserDefinedFunctionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLContainerToAutoscale migrate an Azure Cosmos DB SQL container from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", err.Error()) - } - - req, err := client.MigrateSQLContainerToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLContainerToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLContainerToAutoscalePreparer prepares the MigrateSQLContainerToAutoscale request. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLContainerToAutoscaleSender sends the MigrateSQLContainerToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToAutoscaleFuture, 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 -} - -// MigrateSQLContainerToAutoscaleResponder handles the response to the MigrateSQLContainerToAutoscale request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLContainerToManualThroughput migrate an Azure Cosmos DB SQL container from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", err.Error()) - } - - req, err := client.MigrateSQLContainerToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLContainerToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLContainerToManualThroughputPreparer prepares the MigrateSQLContainerToManualThroughput request. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLContainerToManualThroughputSender sends the MigrateSQLContainerToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToManualThroughputFuture, 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 -} - -// MigrateSQLContainerToManualThroughputResponder handles the response to the MigrateSQLContainerToManualThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLDatabaseToAutoscale migrate an Azure Cosmos DB SQL database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateSQLDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLDatabaseToAutoscalePreparer prepares the MigrateSQLDatabaseToAutoscale request. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLDatabaseToAutoscaleSender sends the MigrateSQLDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, 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 -} - -// MigrateSQLDatabaseToAutoscaleResponder handles the response to the MigrateSQLDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLDatabaseToManualThroughput migrate an Azure Cosmos DB SQL database from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateSQLDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLDatabaseToManualThroughputPreparer prepares the MigrateSQLDatabaseToManualThroughput request. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLDatabaseToManualThroughputSender sends the MigrateSQLDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, 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 -} - -// MigrateSQLDatabaseToManualThroughputResponder handles the response to the MigrateSQLDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLContainerThroughput update RUs per second of an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL container. -func (client SQLResourcesClient) UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLContainerThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLContainerThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", err.Error()) - } - - req, err := client.UpdateSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLContainerThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLContainerThroughputPreparer prepares the UpdateSQLContainerThroughput request. -func (client SQLResourcesClient) UpdateSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLContainerThroughputSender sends the UpdateSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLContainerThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLContainerThroughputFuture, 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 -} - -// UpdateSQLContainerThroughputResponder handles the response to the UpdateSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLDatabaseThroughput update RUs per second of an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL database. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLDatabaseThroughputPreparer prepares the UpdateSQLDatabaseThroughput request. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLDatabaseThroughputSender sends the UpdateSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLDatabaseThroughputFuture, 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 -} - -// UpdateSQLDatabaseThroughputResponder handles the response to the UpdateSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/tableresources.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/tableresources.go deleted file mode 100644 index 216a9928ceaf..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/tableresources.go +++ /dev/null @@ -1,800 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TableResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type TableResourcesClient struct { - BaseClient -} - -// NewTableResourcesClient creates an instance of the TableResourcesClient client. -func NewTableResourcesClient(subscriptionID string) TableResourcesClient { - return NewTableResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTableResourcesClientWithBaseURI creates an instance of the TableResourcesClient 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 NewTableResourcesClientWithBaseURI(baseURI string, subscriptionID string) TableResourcesClient { - return TableResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateTable create or update an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// createUpdateTableParameters - the parameters to provide for the current Table. -func (client TableResourcesClient) CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (result TableResourcesCreateUpdateTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.CreateUpdateTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateTableParameters.TableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "CreateUpdateTable", err.Error()) - } - - req, err := client.CreateUpdateTablePreparer(ctx, resourceGroupName, accountName, tableName, createUpdateTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateTablePreparer prepares the CreateUpdateTable request. -func (client TableResourcesClient) CreateUpdateTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateTableSender sends the CreateUpdateTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) CreateUpdateTableSender(req *http.Request) (future TableResourcesCreateUpdateTableFuture, 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 -} - -// CreateUpdateTableResponder handles the response to the CreateUpdateTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) CreateUpdateTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteTable deletes an existing Azure Cosmos DB Table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesDeleteTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.DeleteTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "DeleteTable", err.Error()) - } - - req, err := client.DeleteTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteTablePreparer prepares the DeleteTable request. -func (client TableResourcesClient) DeleteTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteTableSender sends the DeleteTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) DeleteTableSender(req *http.Request) (future TableResourcesDeleteTableFuture, 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 -} - -// DeleteTableResponder handles the response to the DeleteTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) DeleteTableResponder(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 -} - -// GetTable gets the Tables under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTable", err.Error()) - } - - req, err := client.GetTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure sending request") - return - } - - result, err = client.GetTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure responding to request") - return - } - - return -} - -// GetTablePreparer prepares the GetTable request. -func (client TableResourcesClient) GetTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableSender sends the GetTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableResponder handles the response to the GetTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTableThroughput gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTableThroughput", err.Error()) - } - - req, err := client.GetTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetTableThroughputPreparer prepares the GetTableThroughput request. -func (client TableResourcesClient) GetTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableThroughputSender sends the GetTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableThroughputResponder handles the response to the GetTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListTables lists the Tables under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client TableResourcesClient) ListTables(ctx context.Context, resourceGroupName string, accountName string) (result TableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.ListTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "ListTables", err.Error()) - } - - req, err := client.ListTablesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure sending request") - return - } - - result, err = client.ListTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure responding to request") - return - } - - return -} - -// ListTablesPreparer prepares the ListTables request. -func (client TableResourcesClient) ListTablesPreparer(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 = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListTablesSender sends the ListTables request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) ListTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListTablesResponder handles the response to the ListTables request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) ListTablesResponder(resp *http.Response) (result TableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateTableToAutoscale migrate an Azure Cosmos DB Table from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) MigrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesMigrateTableToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.MigrateTableToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "MigrateTableToAutoscale", err.Error()) - } - - req, err := client.MigrateTableToAutoscalePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateTableToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateTableToAutoscalePreparer prepares the MigrateTableToAutoscale request. -func (client TableResourcesClient) MigrateTableToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateTableToAutoscaleSender sends the MigrateTableToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) MigrateTableToAutoscaleSender(req *http.Request) (future TableResourcesMigrateTableToAutoscaleFuture, 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 -} - -// MigrateTableToAutoscaleResponder handles the response to the MigrateTableToAutoscale request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) MigrateTableToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateTableToManualThroughput migrate an Azure Cosmos DB Table from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) MigrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesMigrateTableToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.MigrateTableToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "MigrateTableToManualThroughput", err.Error()) - } - - req, err := client.MigrateTableToManualThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateTableToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateTableToManualThroughputPreparer prepares the MigrateTableToManualThroughput request. -func (client TableResourcesClient) MigrateTableToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateTableToManualThroughputSender sends the MigrateTableToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) MigrateTableToManualThroughputSender(req *http.Request) (future TableResourcesMigrateTableToManualThroughputFuture, 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 -} - -// MigrateTableToManualThroughputResponder handles the response to the MigrateTableToManualThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) MigrateTableToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateTableThroughput update RUs per second of an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current Table. -func (client TableResourcesClient) UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result TableResourcesUpdateTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.UpdateTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "UpdateTableThroughput", err.Error()) - } - - req, err := client.UpdateTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTableThroughputPreparer prepares the UpdateTableThroughput request. -func (client TableResourcesClient) UpdateTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-04-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTableThroughputSender sends the UpdateTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) UpdateTableThroughputSender(req *http.Request) (future TableResourcesUpdateTableThroughputFuture, 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 -} - -// UpdateTableThroughputResponder handles the response to the UpdateTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) UpdateTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/version.go b/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/version.go deleted file mode 100644 index 4ebc06dbc271..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package documentdb - -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() + " documentdb/2020-04-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/cosmos-db/mgmt/2020-06-01-preview/documentdb/CHANGELOG.md b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/_meta.json b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/_meta.json deleted file mode 100644 index 598dbd717f96..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "d4bad535d456ee82c7fd17d1ec2b8802a0b83205", - "readme": "/_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "tag": "package-2020-06-preview", - "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-2020-06-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/cassandraresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/cassandraresources.go deleted file mode 100644 index 1f83a298ae66..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/cassandraresources.go +++ /dev/null @@ -1,1204 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CassandraResourcesClient is the client for the CassandraResources methods of the Documentdb service. -type CassandraResourcesClient struct { - BaseClient -} - -// NewCassandraResourcesClient creates an instance of the CassandraResourcesClient client. -func NewCassandraResourcesClient(subscriptionID string) CassandraResourcesClient { - return NewCassandraResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCassandraResourcesClientWithBaseURI creates an instance of the CassandraResourcesClient 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 NewCassandraResourcesClientWithBaseURI(baseURI string, subscriptionID string) CassandraResourcesClient { - return CassandraResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateCassandraKeyspace create or update an Azure Cosmos DB Cassandra keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// createUpdateCassandraKeyspaceParameters - the parameters to provide for the current Cassandra keyspace. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraKeyspaceParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", err.Error()) - } - - req, err := client.CreateUpdateCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraKeyspacePreparer prepares the CreateUpdateCassandraKeyspace request. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithJSON(createUpdateCassandraKeyspaceParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraKeyspaceSender sends the CreateUpdateCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraKeyspaceFuture, 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 -} - -// CreateUpdateCassandraKeyspaceResponder handles the response to the CreateUpdateCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateCassandraTable create or update an Azure Cosmos DB Cassandra Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// createUpdateCassandraTableParameters - the parameters to provide for the current Cassandra Table. -func (client CassandraResourcesClient) CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", err.Error()) - } - - req, err := client.CreateUpdateCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraTablePreparer prepares the CreateUpdateCassandraTable request. -func (client CassandraResourcesClient) CreateUpdateCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateCassandraTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraTableSender sends the CreateUpdateCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraTableSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraTableFuture, 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 -} - -// CreateUpdateCassandraTableResponder handles the response to the CreateUpdateCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCassandraKeyspace deletes an existing Azure Cosmos DB Cassandra keyspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesDeleteCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", err.Error()) - } - - req, err := client.DeleteCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraKeyspacePreparer prepares the DeleteCassandraKeyspace request. -func (client CassandraResourcesClient) DeleteCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraKeyspaceSender sends the DeleteCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesDeleteCassandraKeyspaceFuture, 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 -} - -// DeleteCassandraKeyspaceResponder handles the response to the DeleteCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceResponder(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 -} - -// DeleteCassandraTable deletes an existing Azure Cosmos DB Cassandra table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesDeleteCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraTable", err.Error()) - } - - req, err := client.DeleteCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraTablePreparer prepares the DeleteCassandraTable request. -func (client CassandraResourcesClient) DeleteCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraTableSender sends the DeleteCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraTableSender(req *http.Request) (future CassandraResourcesDeleteCassandraTableFuture, 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 -} - -// DeleteCassandraTableResponder handles the response to the DeleteCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraTableResponder(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 -} - -// GetCassandraKeyspace gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraKeyspaceGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspace") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspace", err.Error()) - } - - req, err := client.GetCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspacePreparer prepares the GetCassandraKeyspace request. -func (client CassandraResourcesClient) GetCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceSender sends the GetCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceResponder handles the response to the GetCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraKeyspaceThroughput gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspaceThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.GetCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspaceThroughputPreparer prepares the GetCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceThroughputSender sends the GetCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceThroughputResponder handles the response to the GetCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTable gets the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraTableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTable", err.Error()) - } - - req, err := client.GetCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTablePreparer prepares the GetCassandraTable request. -func (client CassandraResourcesClient) GetCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableSender sends the GetCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableResponder handles the response to the GetCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTableThroughput gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", err.Error()) - } - - req, err := client.GetCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTableThroughputPreparer prepares the GetCassandraTableThroughput request. -func (client CassandraResourcesClient) GetCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableThroughputSender sends the GetCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableThroughputResponder handles the response to the GetCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraKeyspaces lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client CassandraResourcesClient) ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result CassandraKeyspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraKeyspaces") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", err.Error()) - } - - req, err := client.ListCassandraKeyspacesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraKeyspacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraKeyspacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraKeyspacesPreparer prepares the ListCassandraKeyspaces request. -func (client CassandraResourcesClient) ListCassandraKeyspacesPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraKeyspacesSender sends the ListCassandraKeyspaces request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraKeyspacesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraKeyspacesResponder handles the response to the ListCassandraKeyspaces request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraKeyspacesResponder(resp *http.Response) (result CassandraKeyspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraTables lists the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraTableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraTables", err.Error()) - } - - req, err := client.ListCassandraTablesPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraTablesPreparer prepares the ListCassandraTables request. -func (client CassandraResourcesClient) ListCassandraTablesPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraTablesSender sends the ListCassandraTables request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraTablesResponder handles the response to the ListCassandraTables request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraTablesResponder(resp *http.Response) (result CassandraTableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraKeyspaceThroughput update RUs per second of an Azure Cosmos DB Cassandra Keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// Keyspace. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraKeyspaceThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.UpdateCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraKeyspaceThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraKeyspaceThroughputPreparer prepares the UpdateCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraKeyspaceThroughputSender sends the UpdateCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, 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 -} - -// UpdateCassandraKeyspaceThroughputResponder handles the response to the UpdateCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraTableThroughput update RUs per second of an Azure Cosmos DB Cassandra table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// table. -func (client CassandraResourcesClient) UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", err.Error()) - } - - req, err := client.UpdateCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraTableThroughputPreparer prepares the UpdateCassandraTableThroughput request. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraTableThroughputSender sends the UpdateCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraTableThroughputFuture, 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 -} - -// UpdateCassandraTableThroughputResponder handles the response to the UpdateCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/client.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/client.go deleted file mode 100644 index 847fa9ad4ab1..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package documentdb implements the Azure ARM Documentdb service API version . -// -// -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Documentdb - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Documentdb. -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/cosmos-db/mgmt/2020-06-01-preview/documentdb/collection.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collection.go deleted file mode 100644 index d2f9416480a1..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collection.go +++ /dev/null @@ -1,323 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionClient is the client for the Collection methods of the Documentdb service. -type CollectionClient struct { - BaseClient -} - -// NewCollectionClient creates an instance of the CollectionClient client. -func NewCollectionClient(subscriptionID string) CollectionClient { - return NewCollectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionClientWithBaseURI creates an instance of the CollectionClient 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 NewCollectionClientWithBaseURI(baseURI string, subscriptionID string) CollectionClient { - return CollectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -func (client CollectionClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client CollectionClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartition.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartition.go deleted file mode 100644 index 3beccefb33ce..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartition.go +++ /dev/null @@ -1,230 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionClient is the client for the CollectionPartition methods of the Documentdb service. -type CollectionPartitionClient struct { - BaseClient -} - -// NewCollectionPartitionClient creates an instance of the CollectionPartitionClient client. -func NewCollectionPartitionClient(subscriptionID string) CollectionPartitionClient { - return NewCollectionPartitionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionClientWithBaseURI creates an instance of the CollectionPartitionClient 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 NewCollectionPartitionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionClient { - return CollectionPartitionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionPartitionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionUsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionPartitionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListUsagesResponder(resp *http.Response) (result PartitionUsagesResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartitionregion.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartitionregion.go deleted file mode 100644 index 0f5d149e7d1e..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartitionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionRegionClient is the client for the CollectionPartitionRegion methods of the Documentdb service. -type CollectionPartitionRegionClient struct { - BaseClient -} - -// NewCollectionPartitionRegionClient creates an instance of the CollectionPartitionRegionClient client. -func NewCollectionPartitionRegionClient(subscriptionID string) CollectionPartitionRegionClient { - return NewCollectionPartitionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionRegionClientWithBaseURI creates an instance of the CollectionPartitionRegionClient 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 NewCollectionPartitionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionRegionClient { - return CollectionPartitionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection and region, split by -// partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionregion.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionregion.go deleted file mode 100644 index 73d50d888c7c..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionRegionClient is the client for the CollectionRegion methods of the Documentdb service. -type CollectionRegionClient struct { - BaseClient -} - -// NewCollectionRegionClient creates an instance of the CollectionRegionClient client. -func NewCollectionRegionClient(subscriptionID string) CollectionRegionClient { - return NewCollectionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionRegionClientWithBaseURI creates an instance of the CollectionRegionClient 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 NewCollectionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionRegionClient { - return CollectionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account, collection and -// region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/database.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/database.go deleted file mode 100644 index 3b36684946d3..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/database.go +++ /dev/null @@ -1,317 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseClient is the client for the Database methods of the Documentdb service. -type DatabaseClient struct { - BaseClient -} - -// NewDatabaseClient creates an instance of the DatabaseClient client. -func NewDatabaseClient(subscriptionID string) DatabaseClient { - return NewDatabaseClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseClientWithBaseURI creates an instance of the DatabaseClient 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 NewDatabaseClientWithBaseURI(baseURI string, subscriptionID string) DatabaseClient { - return DatabaseClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -func (client DatabaseClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccountregion.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccountregion.go deleted file mode 100644 index 5a12faf42c68..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccountregion.go +++ /dev/null @@ -1,129 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountRegionClient is the client for the DatabaseAccountRegion methods of the Documentdb service. -type DatabaseAccountRegionClient struct { - BaseClient -} - -// NewDatabaseAccountRegionClient creates an instance of the DatabaseAccountRegionClient client. -func NewDatabaseAccountRegionClient(subscriptionID string) DatabaseAccountRegionClient { - return NewDatabaseAccountRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountRegionClientWithBaseURI creates an instance of the DatabaseAccountRegionClient 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 NewDatabaseAccountRegionClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountRegionClient { - return DatabaseAccountRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccounts.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccounts.go deleted file mode 100644 index 06efea8783f1..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccounts.go +++ /dev/null @@ -1,1677 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountsClient is the client for the DatabaseAccounts methods of the Documentdb service. -type DatabaseAccountsClient struct { - BaseClient -} - -// NewDatabaseAccountsClient creates an instance of the DatabaseAccountsClient client. -func NewDatabaseAccountsClient(subscriptionID string) DatabaseAccountsClient { - return NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountsClientWithBaseURI creates an instance of the DatabaseAccountsClient 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 NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountsClient { - return DatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameExists checks that the Azure Cosmos DB account name already exists. A valid account name may contain only -// lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. -// Parameters: -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.CheckNameExists") - 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: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CheckNameExists", err.Error()) - } - - req, err := client.CheckNameExistsPreparer(ctx, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") - return - } - - result, err = client.CheckNameExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameExistsPreparer prepares the CheckNameExists request. -func (client DatabaseAccountsClient) CheckNameExistsPreparer(ctx context.Context, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameExistsSender sends the CheckNameExists request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) CheckNameExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CheckNameExistsResponder handles the response to the CheckNameExists request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when -// performing updates on an account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// createUpdateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (result DatabaseAccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, createUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (*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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(createUpdateParameters), - 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 DatabaseAccountsClient) CreateOrUpdateSender(req *http.Request) (future DatabaseAccountsCreateOrUpdateFuture, 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 DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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 existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseAccountsClient) 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 = "2020-06-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) DeleteSender(req *http.Request) (future DatabaseAccountsDeleteFuture, 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 DatabaseAccountsClient) 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 -} - -// FailoverPriorityChange changes the failover priority for the Azure Cosmos DB database account. A failover priority -// of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover -// priority values must be unique for each of the regions in which the database account exists. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// failoverParameters - the new failover policies for the database account. -func (client DatabaseAccountsClient) FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (result DatabaseAccountsFailoverPriorityChangeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.FailoverPriorityChange") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: failoverParameters, - Constraints: []validation.Constraint{{Target: "failoverParameters.FailoverPolicies", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "FailoverPriorityChange", err.Error()) - } - - req, err := client.FailoverPriorityChangePreparer(ctx, resourceGroupName, accountName, failoverParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") - return - } - - result, err = client.FailoverPriorityChangeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPriorityChangePreparer prepares the FailoverPriorityChange request. -func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (*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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", pathParameters), - autorest.WithJSON(failoverParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverPriorityChangeSender sends the FailoverPriorityChange request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) FailoverPriorityChangeSender(req *http.Request) (future DatabaseAccountsFailoverPriorityChangeFuture, 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 -} - -// FailoverPriorityChangeResponder handles the response to the FailoverPriorityChange request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(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 retrieves the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseAccountsClient) 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 = "2020-06-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) 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 DatabaseAccountsClient) GetResponder(resp *http.Response) (result DatabaseAccountGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.GetReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", err.Error()) - } - - req, err := client.GetReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.GetReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// GetReadOnlyKeysPreparer prepares the GetReadOnlyKeys request. -func (client DatabaseAccountsClient) GetReadOnlyKeysPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetReadOnlyKeysSender sends the GetReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) GetReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetReadOnlyKeysResponder handles the response to the GetReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) GetReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, 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 the Azure Cosmos DB database accounts available under the subscription. -func (client DatabaseAccountsClient) List(ctx context.Context) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DatabaseAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the Azure Cosmos DB database accounts available under the given resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client DatabaseAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DatabaseAccountsClient) 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-06-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.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionStrings lists the connection strings for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListConnectionStrings") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListConnectionStrings", err.Error()) - } - - req, err := client.ListConnectionStringsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionStringsPreparer prepares the ListConnectionStrings request. -func (client DatabaseAccountsClient) ListConnectionStringsPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.Response) (result DatabaseAccountListConnectionStringsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DatabaseAccountsClient) ListKeysPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (result DatabaseAccountListKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions retrieves metric definitions for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseAccountsClient) ListMetricDefinitionsPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountsClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", err.Error()) - } - - req, err := client.ListReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.ListReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListReadOnlyKeysPreparer prepares the ListReadOnlyKeys request. -func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListReadOnlyKeysSender sends the ListReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListReadOnlyKeysResponder handles the response to the ListReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseAccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseAccountsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOffline - cosmos DB region to offline for the database account. -func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (result DatabaseAccountsOfflineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OfflineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOffline, - Constraints: []validation.Constraint{{Target: "regionParameterForOffline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OfflineRegion", err.Error()) - } - - req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOffline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OfflineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OfflineRegionPreparer prepares the OfflineRegion request. -func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (*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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/offlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOffline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OfflineRegionSender sends the OfflineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OfflineRegionSender(req *http.Request) (future DatabaseAccountsOfflineRegionFuture, 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 -} - -// OfflineRegionResponder handles the response to the OfflineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// OnlineRegion online the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOnline - cosmos DB region to online for the database account. -func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (result DatabaseAccountsOnlineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OnlineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOnline, - Constraints: []validation.Constraint{{Target: "regionParameterForOnline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OnlineRegion", err.Error()) - } - - req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOnline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OnlineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OnlineRegionPreparer prepares the OnlineRegion request. -func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (*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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/onlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOnline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OnlineRegionSender sends the OnlineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OnlineRegionSender(req *http.Request) (future DatabaseAccountsOnlineRegionFuture, 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 -} - -// OnlineRegionResponder handles the response to the OnlineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OnlineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateKey regenerates an access key for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyToRegenerate - the name of the key to regenerate. -func (client DatabaseAccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (result DatabaseAccountsRegenerateKeyFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.RegenerateKey") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, keyToRegenerate) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateKeySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DatabaseAccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (*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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(keyToRegenerate), - 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 DatabaseAccountsClient) RegenerateKeySender(req *http.Request) (future DatabaseAccountsRegenerateKeyFuture, 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 -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) RegenerateKeyResponder(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 the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// updateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (result DatabaseAccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabaseAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (*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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 DatabaseAccountsClient) UpdateSender(req *http.Request) (future DatabaseAccountsUpdateFuture, 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 DatabaseAccountsClient) UpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/documentdbapi/interfaces.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/documentdbapi/interfaces.go deleted file mode 100644 index f793f9add69f..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/documentdbapi/interfaces.go +++ /dev/null @@ -1,313 +0,0 @@ -package documentdbapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/cosmos-db/mgmt/2020-06-01-preview/documentdb" - "github.com/Azure/go-autorest/autorest" -) - -// DatabaseAccountsClientAPI contains the set of methods on the DatabaseAccountsClient type. -type DatabaseAccountsClientAPI interface { - CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters documentdb.DatabaseAccountCreateUpdateParameters) (result documentdb.DatabaseAccountsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountsDeleteFuture, err error) - FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters documentdb.FailoverPolicies) (result documentdb.DatabaseAccountsFailoverPriorityChangeFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountGetResults, err error) - GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - List(ctx context.Context) (result documentdb.DatabaseAccountsListResult, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result documentdb.DatabaseAccountsListResult, err error) - ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListConnectionStringsResult, err error) - ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListKeysResult, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.MetricListResult, err error) - ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.UsagesResult, err error) - OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOfflineRegionFuture, err error) - OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOnlineRegionFuture, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate documentdb.DatabaseAccountRegenerateKeyParameters) (result documentdb.DatabaseAccountsRegenerateKeyFuture, err error) - Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters documentdb.DatabaseAccountUpdateParameters) (result documentdb.DatabaseAccountsUpdateFuture, err error) -} - -var _ DatabaseAccountsClientAPI = (*documentdb.DatabaseAccountsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result documentdb.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result documentdb.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*documentdb.OperationsClient)(nil) - -// DatabaseClientAPI contains the set of methods on the DatabaseClient type. -type DatabaseClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ DatabaseClientAPI = (*documentdb.DatabaseClient)(nil) - -// CollectionClientAPI contains the set of methods on the CollectionClient type. -type CollectionClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ CollectionClientAPI = (*documentdb.CollectionClient)(nil) - -// CollectionRegionClientAPI contains the set of methods on the CollectionRegionClient type. -type CollectionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ CollectionRegionClientAPI = (*documentdb.CollectionRegionClient)(nil) - -// DatabaseAccountRegionClientAPI contains the set of methods on the DatabaseAccountRegionClient type. -type DatabaseAccountRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ DatabaseAccountRegionClientAPI = (*documentdb.DatabaseAccountRegionClient)(nil) - -// PercentileSourceTargetClientAPI contains the set of methods on the PercentileSourceTargetClient type. -type PercentileSourceTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileSourceTargetClientAPI = (*documentdb.PercentileSourceTargetClient)(nil) - -// PercentileTargetClientAPI contains the set of methods on the PercentileTargetClient type. -type PercentileTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileTargetClientAPI = (*documentdb.PercentileTargetClient)(nil) - -// PercentileClientAPI contains the set of methods on the PercentileClient type. -type PercentileClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileClientAPI = (*documentdb.PercentileClient)(nil) - -// CollectionPartitionRegionClientAPI contains the set of methods on the CollectionPartitionRegionClient type. -type CollectionPartitionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ CollectionPartitionRegionClientAPI = (*documentdb.CollectionPartitionRegionClient)(nil) - -// CollectionPartitionClientAPI contains the set of methods on the CollectionPartitionClient type. -type CollectionPartitionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionUsagesResult, err error) -} - -var _ CollectionPartitionClientAPI = (*documentdb.CollectionPartitionClient)(nil) - -// PartitionKeyRangeIDClientAPI contains the set of methods on the PartitionKeyRangeIDClient type. -type PartitionKeyRangeIDClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDClientAPI = (*documentdb.PartitionKeyRangeIDClient)(nil) - -// PartitionKeyRangeIDRegionClientAPI contains the set of methods on the PartitionKeyRangeIDRegionClient type. -type PartitionKeyRangeIDRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDRegionClientAPI = (*documentdb.PartitionKeyRangeIDRegionClient)(nil) - -// SQLResourcesClientAPI contains the set of methods on the SQLResourcesClient type. -type SQLResourcesClientAPI interface { - CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters documentdb.SQLContainerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLContainerFuture, err error) - CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters documentdb.SQLDatabaseCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture, err error) - CreateUpdateSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters documentdb.SQLRoleAssignmentCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture, err error) - CreateUpdateSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters documentdb.SQLRoleDefinitionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture, err error) - CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters documentdb.SQLStoredProcedureCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) - CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters documentdb.SQLTriggerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLTriggerFuture, err error) - CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters documentdb.SQLUserDefinedFunctionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) - DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesDeleteSQLContainerFuture, err error) - DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesDeleteSQLDatabaseFuture, err error) - DeleteSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result documentdb.SQLResourcesDeleteSQLRoleAssignmentFuture, err error) - DeleteSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result documentdb.SQLResourcesDeleteSQLRoleDefinitionFuture, err error) - DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLResourcesDeleteSQLStoredProcedureFuture, err error) - DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLResourcesDeleteSQLTriggerFuture, err error) - DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) - GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLContainerGetResults, err error) - GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLDatabaseGetResults, err error) - GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result documentdb.SQLRoleAssignmentGetResults, err error) - GetSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result documentdb.SQLRoleDefinitionGetResults, err error) - GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLStoredProcedureGetResults, err error) - GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLTriggerGetResults, err error) - GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLUserDefinedFunctionGetResults, err error) - ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLContainerListResult, err error) - ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLDatabaseListResult, err error) - ListSQLRoleAssignments(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLRoleAssignmentListResult, err error) - ListSQLRoleDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLRoleDefinitionListResult, err error) - ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLStoredProcedureListResult, err error) - ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLTriggerListResult, err error) - ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLUserDefinedFunctionListResult, err error) - UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLContainerThroughputFuture, err error) - UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) -} - -var _ SQLResourcesClientAPI = (*documentdb.SQLResourcesClient)(nil) - -// MongoDBResourcesClientAPI contains the set of methods on the MongoDBResourcesClient type. -type MongoDBResourcesClientAPI interface { - CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters documentdb.MongoDBCollectionCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) - CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters documentdb.MongoDBDatabaseCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) - DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture, err error) - DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) - GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBCollectionGetResults, err error) - GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBDatabaseGetResults, err error) - GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBCollectionListResult, err error) - ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MongoDBDatabaseListResult, err error) - UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) - UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) -} - -var _ MongoDBResourcesClientAPI = (*documentdb.MongoDBResourcesClient)(nil) - -// TableResourcesClientAPI contains the set of methods on the TableResourcesClient type. -type TableResourcesClientAPI interface { - CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters documentdb.TableCreateUpdateParameters) (result documentdb.TableResourcesCreateUpdateTableFuture, err error) - DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesDeleteTableFuture, err error) - GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableGetResults, err error) - GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListTables(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.TableListResult, err error) - UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.TableResourcesUpdateTableThroughputFuture, err error) -} - -var _ TableResourcesClientAPI = (*documentdb.TableResourcesClient)(nil) - -// CassandraResourcesClientAPI contains the set of methods on the CassandraResourcesClient type. -type CassandraResourcesClientAPI interface { - CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters documentdb.CassandraKeyspaceCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) - CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters documentdb.CassandraTableCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraTableFuture, err error) - DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture, err error) - DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesDeleteCassandraTableFuture, err error) - GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraKeyspaceGetResults, err error) - GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraTableGetResults, err error) - GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.CassandraKeyspaceListResult, err error) - ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraTableListResult, err error) - UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) - UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture, err error) -} - -var _ CassandraResourcesClientAPI = (*documentdb.CassandraResourcesClient)(nil) - -// GremlinResourcesClientAPI contains the set of methods on the GremlinResourcesClient type. -type GremlinResourcesClientAPI interface { - CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters documentdb.GremlinDatabaseCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) - CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters documentdb.GremlinGraphCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture, err error) - DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesDeleteGremlinDatabaseFuture, err error) - DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesDeleteGremlinGraphFuture, err error) - GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinDatabaseGetResults, err error) - GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinGraphGetResults, err error) - GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.GremlinDatabaseListResult, err error) - ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinGraphListResult, err error) - UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) - UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) -} - -var _ GremlinResourcesClientAPI = (*documentdb.GremlinResourcesClient)(nil) - -// RestorableDatabaseAccountsClientAPI contains the set of methods on the RestorableDatabaseAccountsClient type. -type RestorableDatabaseAccountsClientAPI interface { - GetByLocation(ctx context.Context, location string, instanceID string) (result documentdb.RestorableDatabaseAccountGetResult, err error) - List(ctx context.Context) (result documentdb.RestorableDatabaseAccountsListResult, err error) - ListByLocation(ctx context.Context, location string) (result documentdb.RestorableDatabaseAccountsListResult, err error) -} - -var _ RestorableDatabaseAccountsClientAPI = (*documentdb.RestorableDatabaseAccountsClient)(nil) - -// NotebookWorkspacesClientAPI contains the set of methods on the NotebookWorkspacesClient type. -type NotebookWorkspacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters documentdb.NotebookWorkspaceCreateUpdateParameters) (result documentdb.NotebookWorkspacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspace, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceListResult, err error) - ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceConnectionInfoResult, err error) - RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesRegenerateAuthTokenFuture, err error) - Start(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesStartFuture, err error) -} - -var _ NotebookWorkspacesClientAPI = (*documentdb.NotebookWorkspacesClient)(nil) - -// RestorableSQLDatabasesClientAPI contains the set of methods on the RestorableSQLDatabasesClient type. -type RestorableSQLDatabasesClientAPI interface { - List(ctx context.Context, location string, instanceID string) (result documentdb.RestorableSQLDatabasesListResult, err error) -} - -var _ RestorableSQLDatabasesClientAPI = (*documentdb.RestorableSQLDatabasesClient)(nil) - -// RestorableSQLContainersClientAPI contains the set of methods on the RestorableSQLContainersClient type. -type RestorableSQLContainersClientAPI interface { - List(ctx context.Context, location string, instanceID string, restorableSQLDatabaseRid string) (result documentdb.RestorableSQLContainersListResult, err error) -} - -var _ RestorableSQLContainersClientAPI = (*documentdb.RestorableSQLContainersClient)(nil) - -// RestorableSQLResourcesClientAPI contains the set of methods on the RestorableSQLResourcesClient type. -type RestorableSQLResourcesClientAPI interface { - List(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (result documentdb.RestorableSQLResourcesListResult, err error) -} - -var _ RestorableSQLResourcesClientAPI = (*documentdb.RestorableSQLResourcesClient)(nil) - -// RestorableMongodbDatabasesClientAPI contains the set of methods on the RestorableMongodbDatabasesClient type. -type RestorableMongodbDatabasesClientAPI interface { - List(ctx context.Context, location string, instanceID string) (result documentdb.RestorableMongodbDatabasesListResult, err error) -} - -var _ RestorableMongodbDatabasesClientAPI = (*documentdb.RestorableMongodbDatabasesClient)(nil) - -// RestorableMongodbCollectionsClientAPI contains the set of methods on the RestorableMongodbCollectionsClient type. -type RestorableMongodbCollectionsClientAPI interface { - List(ctx context.Context, location string, instanceID string, restorableMongodbDatabaseRid string) (result documentdb.RestorableMongodbCollectionsListResult, err error) -} - -var _ RestorableMongodbCollectionsClientAPI = (*documentdb.RestorableMongodbCollectionsClient)(nil) - -// RestorableMongodbResourcesClientAPI contains the set of methods on the RestorableMongodbResourcesClient type. -type RestorableMongodbResourcesClientAPI interface { - List(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (result documentdb.RestorableMongodbResourcesListResult, err error) -} - -var _ RestorableMongodbResourcesClientAPI = (*documentdb.RestorableMongodbResourcesClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result documentdb.PrivateLinkResource, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateLinkResourceListResult, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*documentdb.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters documentdb.PrivateEndpointConnection) (result documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnection, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateEndpointConnectionListResult, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*documentdb.PrivateEndpointConnectionsClient)(nil) diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/enums.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/enums.go deleted file mode 100644 index 7c7c76f03368..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/enums.go +++ /dev/null @@ -1,483 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// APIType enumerates the values for api type. -type APIType string - -const ( - // Cassandra ... - Cassandra APIType = "Cassandra" - // Gremlin ... - Gremlin APIType = "Gremlin" - // GremlinV2 ... - GremlinV2 APIType = "GremlinV2" - // MongoDB ... - MongoDB APIType = "MongoDB" - // SQL ... - SQL APIType = "Sql" - // Table ... - Table APIType = "Table" -) - -// PossibleAPITypeValues returns an array of possible values for the APIType const type. -func PossibleAPITypeValues() []APIType { - return []APIType{Cassandra, Gremlin, GremlinV2, MongoDB, SQL, Table} -} - -// CompositePathSortOrder enumerates the values for composite path sort order. -type CompositePathSortOrder string - -const ( - // Ascending ... - Ascending CompositePathSortOrder = "Ascending" - // Descending ... - Descending CompositePathSortOrder = "Descending" -) - -// PossibleCompositePathSortOrderValues returns an array of possible values for the CompositePathSortOrder const type. -func PossibleCompositePathSortOrderValues() []CompositePathSortOrder { - return []CompositePathSortOrder{Ascending, Descending} -} - -// ConflictResolutionMode enumerates the values for conflict resolution mode. -type ConflictResolutionMode string - -const ( - // Custom ... - Custom ConflictResolutionMode = "Custom" - // LastWriterWins ... - LastWriterWins ConflictResolutionMode = "LastWriterWins" -) - -// PossibleConflictResolutionModeValues returns an array of possible values for the ConflictResolutionMode const type. -func PossibleConflictResolutionModeValues() []ConflictResolutionMode { - return []ConflictResolutionMode{Custom, LastWriterWins} -} - -// ConnectorOffer enumerates the values for connector offer. -type ConnectorOffer string - -const ( - // Small ... - Small ConnectorOffer = "Small" -) - -// PossibleConnectorOfferValues returns an array of possible values for the ConnectorOffer const type. -func PossibleConnectorOfferValues() []ConnectorOffer { - return []ConnectorOffer{Small} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // Application ... - Application CreatedByType = "Application" - // Key ... - Key CreatedByType = "Key" - // ManagedIdentity ... - ManagedIdentity CreatedByType = "ManagedIdentity" - // User ... - User CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{Application, Key, ManagedIdentity, User} -} - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // Default ... - Default CreateMode = "Default" - // Restore ... - Restore CreateMode = "Restore" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{Default, Restore} -} - -// CreateModeBasicDatabaseAccountCreateUpdateProperties enumerates the values for create mode basic database -// account create update properties. -type CreateModeBasicDatabaseAccountCreateUpdateProperties string - -const ( - // CreateModeDatabaseAccountCreateUpdateProperties ... - CreateModeDatabaseAccountCreateUpdateProperties CreateModeBasicDatabaseAccountCreateUpdateProperties = "DatabaseAccountCreateUpdateProperties" - // CreateModeDefault ... - CreateModeDefault CreateModeBasicDatabaseAccountCreateUpdateProperties = "Default" - // CreateModeRestore ... - CreateModeRestore CreateModeBasicDatabaseAccountCreateUpdateProperties = "Restore" -) - -// PossibleCreateModeBasicDatabaseAccountCreateUpdatePropertiesValues returns an array of possible values for the CreateModeBasicDatabaseAccountCreateUpdateProperties const type. -func PossibleCreateModeBasicDatabaseAccountCreateUpdatePropertiesValues() []CreateModeBasicDatabaseAccountCreateUpdateProperties { - return []CreateModeBasicDatabaseAccountCreateUpdateProperties{CreateModeDatabaseAccountCreateUpdateProperties, CreateModeDefault, CreateModeRestore} -} - -// DatabaseAccountKind enumerates the values for database account kind. -type DatabaseAccountKind string - -const ( - // DatabaseAccountKindGlobalDocumentDB ... - DatabaseAccountKindGlobalDocumentDB DatabaseAccountKind = "GlobalDocumentDB" - // DatabaseAccountKindMongoDB ... - DatabaseAccountKindMongoDB DatabaseAccountKind = "MongoDB" - // DatabaseAccountKindParse ... - DatabaseAccountKindParse DatabaseAccountKind = "Parse" -) - -// PossibleDatabaseAccountKindValues returns an array of possible values for the DatabaseAccountKind const type. -func PossibleDatabaseAccountKindValues() []DatabaseAccountKind { - return []DatabaseAccountKind{DatabaseAccountKindGlobalDocumentDB, DatabaseAccountKindMongoDB, DatabaseAccountKindParse} -} - -// DatabaseAccountOfferType enumerates the values for database account offer type. -type DatabaseAccountOfferType string - -const ( - // Standard ... - Standard DatabaseAccountOfferType = "Standard" -) - -// PossibleDatabaseAccountOfferTypeValues returns an array of possible values for the DatabaseAccountOfferType const type. -func PossibleDatabaseAccountOfferTypeValues() []DatabaseAccountOfferType { - return []DatabaseAccountOfferType{Standard} -} - -// DataType enumerates the values for data type. -type DataType string - -const ( - // LineString ... - LineString DataType = "LineString" - // MultiPolygon ... - MultiPolygon DataType = "MultiPolygon" - // Number ... - Number DataType = "Number" - // Point ... - Point DataType = "Point" - // Polygon ... - Polygon DataType = "Polygon" - // String ... - String DataType = "String" -) - -// PossibleDataTypeValues returns an array of possible values for the DataType const type. -func PossibleDataTypeValues() []DataType { - return []DataType{LineString, MultiPolygon, Number, Point, Polygon, String} -} - -// DefaultConsistencyLevel enumerates the values for default consistency level. -type DefaultConsistencyLevel string - -const ( - // BoundedStaleness ... - BoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" - // ConsistentPrefix ... - ConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" - // Eventual ... - Eventual DefaultConsistencyLevel = "Eventual" - // Session ... - Session DefaultConsistencyLevel = "Session" - // Strong ... - Strong DefaultConsistencyLevel = "Strong" -) - -// PossibleDefaultConsistencyLevelValues returns an array of possible values for the DefaultConsistencyLevel const type. -func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { - return []DefaultConsistencyLevel{BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong} -} - -// IndexingMode enumerates the values for indexing mode. -type IndexingMode string - -const ( - // Consistent ... - Consistent IndexingMode = "Consistent" - // Lazy ... - Lazy IndexingMode = "Lazy" - // None ... - None IndexingMode = "None" -) - -// PossibleIndexingModeValues returns an array of possible values for the IndexingMode const type. -func PossibleIndexingModeValues() []IndexingMode { - return []IndexingMode{Consistent, Lazy, None} -} - -// IndexKind enumerates the values for index kind. -type IndexKind string - -const ( - // Hash ... - Hash IndexKind = "Hash" - // Range ... - Range IndexKind = "Range" - // Spatial ... - Spatial IndexKind = "Spatial" -) - -// PossibleIndexKindValues returns an array of possible values for the IndexKind const type. -func PossibleIndexKindValues() []IndexKind { - return []IndexKind{Hash, Range, Spatial} -} - -// KeyKind enumerates the values for key kind. -type KeyKind string - -const ( - // Primary ... - Primary KeyKind = "primary" - // PrimaryReadonly ... - PrimaryReadonly KeyKind = "primaryReadonly" - // Secondary ... - Secondary KeyKind = "secondary" - // SecondaryReadonly ... - SecondaryReadonly KeyKind = "secondaryReadonly" -) - -// PossibleKeyKindValues returns an array of possible values for the KeyKind const type. -func PossibleKeyKindValues() []KeyKind { - return []KeyKind{Primary, PrimaryReadonly, Secondary, SecondaryReadonly} -} - -// OperationType enumerates the values for operation type. -type OperationType string - -const ( - // Create ... - Create OperationType = "Create" - // Delete ... - Delete OperationType = "Delete" - // Replace ... - Replace OperationType = "Replace" - // SystemOperation ... - SystemOperation OperationType = "SystemOperation" -) - -// PossibleOperationTypeValues returns an array of possible values for the OperationType const type. -func PossibleOperationTypeValues() []OperationType { - return []OperationType{Create, Delete, Replace, SystemOperation} -} - -// PartitionKind enumerates the values for partition kind. -type PartitionKind string - -const ( - // PartitionKindHash ... - PartitionKindHash PartitionKind = "Hash" - // PartitionKindRange ... - PartitionKindRange PartitionKind = "Range" -) - -// PossiblePartitionKindValues returns an array of possible values for the PartitionKind const type. -func PossiblePartitionKindValues() []PartitionKind { - return []PartitionKind{PartitionKindHash, PartitionKindRange} -} - -// PrimaryAggregationType enumerates the values for primary aggregation type. -type PrimaryAggregationType string - -const ( - // PrimaryAggregationTypeAverage ... - PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" - // PrimaryAggregationTypeLast ... - PrimaryAggregationTypeLast PrimaryAggregationType = "Last" - // PrimaryAggregationTypeMaximum ... - PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" - // PrimaryAggregationTypeMinimum ... - PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" - // PrimaryAggregationTypeNone ... - PrimaryAggregationTypeNone PrimaryAggregationType = "None" - // PrimaryAggregationTypeTotal ... - PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" -) - -// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeLast, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // Disabled ... - Disabled PublicNetworkAccess = "Disabled" - // Enabled ... - Enabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{Disabled, Enabled} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned,UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// RestoreMode enumerates the values for restore mode. -type RestoreMode string - -const ( - // PointInTime ... - PointInTime RestoreMode = "PointInTime" -) - -// PossibleRestoreModeValues returns an array of possible values for the RestoreMode const type. -func PossibleRestoreModeValues() []RestoreMode { - return []RestoreMode{PointInTime} -} - -// RoleDefinitionType enumerates the values for role definition type. -type RoleDefinitionType string - -const ( - // BuiltInRole ... - BuiltInRole RoleDefinitionType = "BuiltInRole" - // CustomRole ... - CustomRole RoleDefinitionType = "CustomRole" -) - -// PossibleRoleDefinitionTypeValues returns an array of possible values for the RoleDefinitionType const type. -func PossibleRoleDefinitionTypeValues() []RoleDefinitionType { - return []RoleDefinitionType{BuiltInRole, CustomRole} -} - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // ThreeFullStopSix ... - ThreeFullStopSix ServerVersion = "3.6" - // ThreeFullStopTwo ... - ThreeFullStopTwo ServerVersion = "3.2" -) - -// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. -func PossibleServerVersionValues() []ServerVersion { - return []ServerVersion{ThreeFullStopSix, ThreeFullStopTwo} -} - -// SpatialType enumerates the values for spatial type. -type SpatialType string - -const ( - // SpatialTypeLineString ... - SpatialTypeLineString SpatialType = "LineString" - // SpatialTypeMultiPolygon ... - SpatialTypeMultiPolygon SpatialType = "MultiPolygon" - // SpatialTypePoint ... - SpatialTypePoint SpatialType = "Point" - // SpatialTypePolygon ... - SpatialTypePolygon SpatialType = "Polygon" -) - -// PossibleSpatialTypeValues returns an array of possible values for the SpatialType const type. -func PossibleSpatialTypeValues() []SpatialType { - return []SpatialType{SpatialTypeLineString, SpatialTypeMultiPolygon, SpatialTypePoint, SpatialTypePolygon} -} - -// TriggerOperation enumerates the values for trigger operation. -type TriggerOperation string - -const ( - // TriggerOperationAll ... - TriggerOperationAll TriggerOperation = "All" - // TriggerOperationCreate ... - TriggerOperationCreate TriggerOperation = "Create" - // TriggerOperationDelete ... - TriggerOperationDelete TriggerOperation = "Delete" - // TriggerOperationReplace ... - TriggerOperationReplace TriggerOperation = "Replace" - // TriggerOperationUpdate ... - TriggerOperationUpdate TriggerOperation = "Update" -) - -// PossibleTriggerOperationValues returns an array of possible values for the TriggerOperation const type. -func PossibleTriggerOperationValues() []TriggerOperation { - return []TriggerOperation{TriggerOperationAll, TriggerOperationCreate, TriggerOperationDelete, TriggerOperationReplace, TriggerOperationUpdate} -} - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // Post ... - Post TriggerType = "Post" - // Pre ... - Pre TriggerType = "Pre" -) - -// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. -func PossibleTriggerTypeValues() []TriggerType { - return []TriggerType{Post, Pre} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeBackupPolicy ... - TypeBackupPolicy Type = "BackupPolicy" - // TypeContinuous ... - TypeContinuous Type = "Continuous" - // TypePeriodic ... - TypePeriodic Type = "Periodic" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeBackupPolicy, TypeContinuous, TypePeriodic} -} - -// UnitType enumerates the values for unit type. -type UnitType string - -const ( - // Bytes ... - Bytes UnitType = "Bytes" - // BytesPerSecond ... - BytesPerSecond UnitType = "BytesPerSecond" - // Count ... - Count UnitType = "Count" - // CountPerSecond ... - CountPerSecond UnitType = "CountPerSecond" - // Milliseconds ... - Milliseconds UnitType = "Milliseconds" - // Percent ... - Percent UnitType = "Percent" - // Seconds ... - Seconds UnitType = "Seconds" -) - -// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{Bytes, BytesPerSecond, Count, CountPerSecond, Milliseconds, Percent, Seconds} -} diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/gremlinresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/gremlinresources.go deleted file mode 100644 index bf11fa669847..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/gremlinresources.go +++ /dev/null @@ -1,1210 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GremlinResourcesClient is the client for the GremlinResources methods of the Documentdb service. -type GremlinResourcesClient struct { - BaseClient -} - -// NewGremlinResourcesClient creates an instance of the GremlinResourcesClient client. -func NewGremlinResourcesClient(subscriptionID string) GremlinResourcesClient { - return NewGremlinResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGremlinResourcesClientWithBaseURI creates an instance of the GremlinResourcesClient 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 NewGremlinResourcesClientWithBaseURI(baseURI string, subscriptionID string) GremlinResourcesClient { - return GremlinResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateGremlinDatabase create or update an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateGremlinDatabaseParameters - the parameters to provide for the current Gremlin database. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", err.Error()) - } - - req, err := client.CreateUpdateGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinDatabasePreparer prepares the CreateUpdateGremlinDatabase request. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateGremlinDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinDatabaseSender sends the CreateUpdateGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinDatabaseFuture, 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 -} - -// CreateUpdateGremlinDatabaseResponder handles the response to the CreateUpdateGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateGremlinGraph create or update an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// createUpdateGremlinGraphParameters - the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinGraphParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", err.Error()) - } - - req, err := client.CreateUpdateGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinGraphPreparer prepares the CreateUpdateGremlinGraph request. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithJSON(createUpdateGremlinGraphParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinGraphSender sends the CreateUpdateGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinGraphFuture, 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 -} - -// CreateUpdateGremlinGraphResponder handles the response to the CreateUpdateGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteGremlinDatabase deletes an existing Azure Cosmos DB Gremlin database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesDeleteGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", err.Error()) - } - - req, err := client.DeleteGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinDatabasePreparer prepares the DeleteGremlinDatabase request. -func (client GremlinResourcesClient) DeleteGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinDatabaseSender sends the DeleteGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinDatabaseSender(req *http.Request) (future GremlinResourcesDeleteGremlinDatabaseFuture, 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 -} - -// DeleteGremlinDatabaseResponder handles the response to the DeleteGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinDatabaseResponder(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 -} - -// DeleteGremlinGraph deletes an existing Azure Cosmos DB Gremlin graph. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesDeleteGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinGraph", err.Error()) - } - - req, err := client.DeleteGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinGraphPreparer prepares the DeleteGremlinGraph request. -func (client GremlinResourcesClient) DeleteGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinGraphSender sends the DeleteGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinGraphSender(req *http.Request) (future GremlinResourcesDeleteGremlinGraphFuture, 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 -} - -// DeleteGremlinGraphResponder handles the response to the DeleteGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinGraphResponder(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 -} - -// GetGremlinDatabase gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabase", err.Error()) - } - - req, err := client.GetGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabasePreparer prepares the GetGremlinDatabase request. -func (client GremlinResourcesClient) GetGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseSender sends the GetGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseResponder handles the response to the GetGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinDatabaseThroughput gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.GetGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabaseThroughputPreparer prepares the GetGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseThroughputSender sends the GetGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseThroughputResponder handles the response to the GetGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraph gets the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinGraphGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraph") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraph", err.Error()) - } - - req, err := client.GetGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphPreparer prepares the GetGremlinGraph request. -func (client GremlinResourcesClient) GetGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphSender sends the GetGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphResponder handles the response to the GetGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraphThroughput gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with -// the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraphThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", err.Error()) - } - - req, err := client.GetGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphThroughputPreparer prepares the GetGremlinGraphThroughput request. -func (client GremlinResourcesClient) GetGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphThroughputSender sends the GetGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphThroughputResponder handles the response to the GetGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinDatabases lists the Gremlin databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client GremlinResourcesClient) ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result GremlinDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinDatabases", err.Error()) - } - - req, err := client.ListGremlinDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinDatabasesPreparer prepares the ListGremlinDatabases request. -func (client GremlinResourcesClient) ListGremlinDatabasesPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinDatabasesSender sends the ListGremlinDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinDatabasesResponder handles the response to the ListGremlinDatabases request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinDatabasesResponder(resp *http.Response) (result GremlinDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinGraphs lists the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinGraphListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinGraphs") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinGraphs", err.Error()) - } - - req, err := client.ListGremlinGraphsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinGraphsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinGraphsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinGraphsPreparer prepares the ListGremlinGraphs request. -func (client GremlinResourcesClient) ListGremlinGraphsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinGraphsSender sends the ListGremlinGraphs request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinGraphsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinGraphsResponder handles the response to the ListGremlinGraphs request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinGraphsResponder(resp *http.Response) (result GremlinGraphListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinDatabaseThroughput update RUs per second of an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin -// database. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinDatabaseThroughputPreparer prepares the UpdateGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinDatabaseThroughputSender sends the UpdateGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinDatabaseThroughputFuture, 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 -} - -// UpdateGremlinDatabaseThroughputResponder handles the response to the UpdateGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinGraphThroughput update RUs per second of an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinGraphThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", err.Error()) - } - - req, err := client.UpdateGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinGraphThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinGraphThroughputPreparer prepares the UpdateGremlinGraphThroughput request. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinGraphThroughputSender sends the UpdateGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinGraphThroughputFuture, 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 -} - -// UpdateGremlinGraphThroughputResponder handles the response to the UpdateGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/models.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/models.go deleted file mode 100644 index 1bd116467bd4..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/models.go +++ /dev/null @@ -1,10704 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb" - -// APIProperties ... -type APIProperties struct { - // ServerVersion - Describes the ServerVersion of an a MongoDB account. Possible values include: 'ThreeFullStopTwo', 'ThreeFullStopSix' - ServerVersion ServerVersion `json:"serverVersion,omitempty"` -} - -// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other -// than required location and tags -type ARMProxyResource struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ARMProxyResource. -func (apr ARMProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ARMResourceProperties the core properties of ARM resources. -type ARMResourceProperties struct { - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ARMResourceProperties. -func (arp ARMResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Location != nil { - objectMap["location"] = arp.Location - } - if arp.Tags != nil { - objectMap["tags"] = arp.Tags - } - if arp.Identity != nil { - objectMap["identity"] = arp.Identity - } - return json.Marshal(objectMap) -} - -// AutoscaleSettings ... -type AutoscaleSettings struct { - // MaxThroughput - Represents maximum throughput, the resource can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` -} - -// AutoscaleSettingsResource cosmos DB provisioned throughput settings object -type AutoscaleSettingsResource struct { - // MaxThroughput - Represents maximum throughput container can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` - // AutoUpgradePolicy - Cosmos DB resource auto-upgrade policy - AutoUpgradePolicy *AutoUpgradePolicyResource `json:"autoUpgradePolicy,omitempty"` - // TargetMaxThroughput - READ-ONLY; Represents target maximum throughput container can scale up to once offer is no longer in pending state. - TargetMaxThroughput *int32 `json:"targetMaxThroughput,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingsResource. -func (asr AutoscaleSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.MaxThroughput != nil { - objectMap["maxThroughput"] = asr.MaxThroughput - } - if asr.AutoUpgradePolicy != nil { - objectMap["autoUpgradePolicy"] = asr.AutoUpgradePolicy - } - return json.Marshal(objectMap) -} - -// AutoUpgradePolicyResource cosmos DB resource auto-upgrade policy -type AutoUpgradePolicyResource struct { - // ThroughputPolicy - Represents throughput policy which service must adhere to for auto-upgrade - ThroughputPolicy *ThroughputPolicyResource `json:"throughputPolicy,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) -} - -// BasicBackupPolicy the object representing the policy for taking backups on an account. -type BasicBackupPolicy interface { - AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) - AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) - AsBackupPolicy() (*BackupPolicy, bool) -} - -// BackupPolicy the object representing the policy for taking backups on an account. -type BackupPolicy struct { - // Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicBackupPolicy(body []byte) (BasicBackupPolicy, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypePeriodic): - var pmbp PeriodicModeBackupPolicy - err := json.Unmarshal(body, &pmbp) - return pmbp, err - case string(TypeContinuous): - var cmbp ContinuousModeBackupPolicy - err := json.Unmarshal(body, &cmbp) - return cmbp, err - default: - var bp BackupPolicy - err := json.Unmarshal(body, &bp) - return bp, err - } -} -func unmarshalBasicBackupPolicyArray(body []byte) ([]BasicBackupPolicy, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - bpArray := make([]BasicBackupPolicy, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bp, err := unmarshalBasicBackupPolicy(*rawMessage) - if err != nil { - return nil, err - } - bpArray[index] = bp - } - return bpArray, nil -} - -// MarshalJSON is the custom marshaler for BackupPolicy. -func (bp BackupPolicy) MarshalJSON() ([]byte, error) { - bp.Type = TypeBackupPolicy - objectMap := make(map[string]interface{}) - if bp.Type != "" { - objectMap["type"] = bp.Type - } - return json.Marshal(objectMap) -} - -// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) { - return nil, false -} - -// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) { - return nil, false -} - -// AsBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return &bp, true -} - -// AsBasicBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) { - return &bp, true -} - -// Capability cosmos DB capability object -type Capability struct { - // Name - Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". - Name *string `json:"name,omitempty"` -} - -// CassandraKeyspaceCreateUpdateParameters parameters to create and update Cosmos DB Cassandra keyspace. -type CassandraKeyspaceCreateUpdateParameters struct { - // CassandraKeyspaceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra keyspace. - *CassandraKeyspaceCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceCreateUpdateParameters. -func (ckcup CassandraKeyspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckcup.CassandraKeyspaceCreateUpdateProperties != nil { - objectMap["properties"] = ckcup.CassandraKeyspaceCreateUpdateProperties - } - if ckcup.Location != nil { - objectMap["location"] = ckcup.Location - } - if ckcup.Tags != nil { - objectMap["tags"] = ckcup.Tags - } - if ckcup.Identity != nil { - objectMap["identity"] = ckcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceCreateUpdateParameters struct. -func (ckcup *CassandraKeyspaceCreateUpdateParameters) 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 cassandraKeyspaceCreateUpdateProperties CassandraKeyspaceCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraKeyspaceCreateUpdateProperties) - if err != nil { - return err - } - ckcup.CassandraKeyspaceCreateUpdateProperties = &cassandraKeyspaceCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ckcup.Identity = &identity - } - } - } - - return nil -} - -// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra -// keyspace. -type CassandraKeyspaceCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra keyspace - Resource *CassandraKeyspaceResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetProperties the properties of an Azure Cosmos DB Cassandra keyspace -type CassandraKeyspaceGetProperties struct { - Resource *CassandraKeyspaceGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraKeyspaceGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetPropertiesOptions ... -type CassandraKeyspaceGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// CassandraKeyspaceGetPropertiesResource ... -type CassandraKeyspaceGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetPropertiesResource. -func (ckgp CassandraKeyspaceGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgp.ID != nil { - objectMap["id"] = ckgp.ID - } - return json.Marshal(objectMap) -} - -// CassandraKeyspaceGetResults an Azure Cosmos DB Cassandra keyspace. -type CassandraKeyspaceGetResults struct { - autorest.Response `json:"-"` - // CassandraKeyspaceGetProperties - The properties of an Azure Cosmos DB Cassandra keyspace - *CassandraKeyspaceGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetResults. -func (ckgr CassandraKeyspaceGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgr.CassandraKeyspaceGetProperties != nil { - objectMap["properties"] = ckgr.CassandraKeyspaceGetProperties - } - if ckgr.Location != nil { - objectMap["location"] = ckgr.Location - } - if ckgr.Tags != nil { - objectMap["tags"] = ckgr.Tags - } - if ckgr.Identity != nil { - objectMap["identity"] = ckgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceGetResults struct. -func (ckgr *CassandraKeyspaceGetResults) 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 cassandraKeyspaceGetProperties CassandraKeyspaceGetProperties - err = json.Unmarshal(*v, &cassandraKeyspaceGetProperties) - if err != nil { - return err - } - ckgr.CassandraKeyspaceGetProperties = &cassandraKeyspaceGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ckgr.Identity = &identity - } - } - } - - return nil -} - -// CassandraKeyspaceListResult the List operation response, that contains the Cassandra keyspaces and their -// properties. -type CassandraKeyspaceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra keyspaces and their properties. - Value *[]CassandraKeyspaceGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceListResult. -func (cklr CassandraKeyspaceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraKeyspaceResource cosmos DB Cassandra keyspace resource object -type CassandraKeyspaceResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` -} - -// CassandraPartitionKey cosmos DB Cassandra table partition key -type CassandraPartitionKey struct { - // Name - Name of the Cosmos DB Cassandra table partition key - Name *string `json:"name,omitempty"` -} - -// CassandraResourcesCreateUpdateCassandraKeyspaceFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraKeyspaceGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) 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 CassandraResourcesCreateUpdateCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ckgr CassandraKeyspaceGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ckgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ckgr.Response.Response, err = future.GetResult(sender); err == nil && ckgr.Response.Response.StatusCode != http.StatusNoContent { - ckgr, err = client.CreateUpdateCassandraKeyspaceResponder(ckgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", ckgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraTableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) 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 CassandraResourcesCreateUpdateCassandraTableFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) result(client CassandraResourcesClient) (ctgr CassandraTableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ctgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ctgr.Response.Response, err = future.GetResult(sender); err == nil && ctgr.Response.Response.StatusCode != http.StatusNoContent { - ctgr, err = client.CreateUpdateCassandraTableResponder(ctgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", ctgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type CassandraResourcesDeleteCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) 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 CassandraResourcesDeleteCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type CassandraResourcesDeleteCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraTableFuture) 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 CassandraResourcesDeleteCassandraTableFuture.Result. -func (future *CassandraResourcesDeleteCassandraTableFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraTableFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesUpdateCassandraKeyspaceThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) 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 CassandraResourcesUpdateCassandraKeyspaceThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraKeyspaceThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraTableThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesUpdateCassandraTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) 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 CassandraResourcesUpdateCassandraTableThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraSchema cosmos DB Cassandra table schema -type CassandraSchema struct { - // Columns - List of Cassandra table columns. - Columns *[]Column `json:"columns,omitempty"` - // PartitionKeys - List of partition key. - PartitionKeys *[]CassandraPartitionKey `json:"partitionKeys,omitempty"` - // ClusterKeys - List of cluster key. - ClusterKeys *[]ClusterKey `json:"clusterKeys,omitempty"` -} - -// CassandraTableCreateUpdateParameters parameters to create and update Cosmos DB Cassandra table. -type CassandraTableCreateUpdateParameters struct { - // CassandraTableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra table. - *CassandraTableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableCreateUpdateParameters. -func (ctcup CassandraTableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcup.CassandraTableCreateUpdateProperties != nil { - objectMap["properties"] = ctcup.CassandraTableCreateUpdateProperties - } - if ctcup.Location != nil { - objectMap["location"] = ctcup.Location - } - if ctcup.Tags != nil { - objectMap["tags"] = ctcup.Tags - } - if ctcup.Identity != nil { - objectMap["identity"] = ctcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableCreateUpdateParameters struct. -func (ctcup *CassandraTableCreateUpdateParameters) 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 cassandraTableCreateUpdateProperties CassandraTableCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraTableCreateUpdateProperties) - if err != nil { - return err - } - ctcup.CassandraTableCreateUpdateProperties = &cassandraTableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ctcup.Identity = &identity - } - } - } - - return nil -} - -// CassandraTableCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra table. -type CassandraTableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra table - Resource *CassandraTableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraTableGetProperties the properties of an Azure Cosmos DB Cassandra table -type CassandraTableGetProperties struct { - Resource *CassandraTableGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraTableGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraTableGetPropertiesOptions ... -type CassandraTableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// CassandraTableGetPropertiesResource ... -type CassandraTableGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetPropertiesResource. -func (ctgp CassandraTableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgp.ID != nil { - objectMap["id"] = ctgp.ID - } - if ctgp.DefaultTTL != nil { - objectMap["defaultTtl"] = ctgp.DefaultTTL - } - if ctgp.Schema != nil { - objectMap["schema"] = ctgp.Schema - } - if ctgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = ctgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// CassandraTableGetResults an Azure Cosmos DB Cassandra table. -type CassandraTableGetResults struct { - autorest.Response `json:"-"` - // CassandraTableGetProperties - The properties of an Azure Cosmos DB Cassandra table - *CassandraTableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetResults. -func (ctgr CassandraTableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgr.CassandraTableGetProperties != nil { - objectMap["properties"] = ctgr.CassandraTableGetProperties - } - if ctgr.Location != nil { - objectMap["location"] = ctgr.Location - } - if ctgr.Tags != nil { - objectMap["tags"] = ctgr.Tags - } - if ctgr.Identity != nil { - objectMap["identity"] = ctgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableGetResults struct. -func (ctgr *CassandraTableGetResults) 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 cassandraTableGetProperties CassandraTableGetProperties - err = json.Unmarshal(*v, &cassandraTableGetProperties) - if err != nil { - return err - } - ctgr.CassandraTableGetProperties = &cassandraTableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ctgr.Identity = &identity - } - } - } - - return nil -} - -// CassandraTableListResult the List operation response, that contains the Cassandra tables and their -// properties. -type CassandraTableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra tables and their properties. - Value *[]CassandraTableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableListResult. -func (ctlr CassandraTableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraTableResource cosmos DB Cassandra table resource object -type CassandraTableResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` -} - -// ClusterKey cosmos DB Cassandra table cluster key -type ClusterKey struct { - // Name - Name of the Cosmos DB Cassandra table cluster key - Name *string `json:"name,omitempty"` - // OrderBy - Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" - OrderBy *string `json:"orderBy,omitempty"` -} - -// Column cosmos DB Cassandra table column -type Column struct { - // Name - Name of the Cosmos DB Cassandra table column - Name *string `json:"name,omitempty"` - // Type - Type of the Cosmos DB Cassandra table column - Type *string `json:"type,omitempty"` -} - -// CompositePath ... -type CompositePath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Order - Sort order for composite paths. Possible values include: 'Ascending', 'Descending' - Order CompositePathSortOrder `json:"order,omitempty"` -} - -// ConflictResolutionPolicy the conflict resolution policy for the container. -type ConflictResolutionPolicy struct { - // Mode - Indicates the conflict resolution mode. Possible values include: 'LastWriterWins', 'Custom' - Mode ConflictResolutionMode `json:"mode,omitempty"` - // ConflictResolutionPath - The conflict resolution path in the case of LastWriterWins mode. - ConflictResolutionPath *string `json:"conflictResolutionPath,omitempty"` - // ConflictResolutionProcedure - The procedure to resolve conflicts in the case of custom mode. - ConflictResolutionProcedure *string `json:"conflictResolutionProcedure,omitempty"` -} - -// ConsistencyPolicy the consistency policy for the Cosmos DB database account. -type ConsistencyPolicy struct { - // DefaultConsistencyLevel - The default consistency level and configuration settings of the Cosmos DB account. Possible values include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix' - DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` - // MaxStalenessPrefix - When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` - // MaxIntervalInSeconds - When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` -} - -// ContainerPartitionKey the configuration of the partition key to be used for partitioning data into -// multiple partitions -type ContainerPartitionKey struct { - // Paths - List of paths using which data within the container can be partitioned - Paths *[]string `json:"paths,omitempty"` - // Kind - Indicates the kind of algorithm used for partitioning. Possible values include: 'PartitionKindHash', 'PartitionKindRange' - Kind PartitionKind `json:"kind,omitempty"` - // Version - Indicates the version of the partition key definition - Version *int32 `json:"version,omitempty"` -} - -// ContinuousModeBackupPolicy the object representing continuous mode backup policy. -type ContinuousModeBackupPolicy struct { - // Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) MarshalJSON() ([]byte, error) { - cmbp.Type = TypeContinuous - objectMap := make(map[string]interface{}) - if cmbp.Type != "" { - objectMap["type"] = cmbp.Type - } - return json.Marshal(objectMap) -} - -// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) { - return nil, false -} - -// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) { - return &cmbp, true -} - -// AsBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return nil, false -} - -// AsBasicBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) { - return &cmbp, true -} - -// CorsPolicy the CORS policy for the Cosmos DB database account. -type CorsPolicy struct { - // AllowedOrigins - The origin domains that are permitted to make a request against the service via CORS. - AllowedOrigins *string `json:"allowedOrigins,omitempty"` - // AllowedMethods - The methods (HTTP request verbs) that the origin domain may use for a CORS request. - AllowedMethods *string `json:"allowedMethods,omitempty"` - // AllowedHeaders - The request headers that the origin domain may specify on the CORS request. - AllowedHeaders *string `json:"allowedHeaders,omitempty"` - // ExposedHeaders - The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - ExposedHeaders *string `json:"exposedHeaders,omitempty"` - // MaxAgeInSeconds - The maximum amount time that a browser should cache the preflight OPTIONS request. - MaxAgeInSeconds *int64 `json:"maxAgeInSeconds,omitempty"` -} - -// CreateUpdateOptions createUpdateOptions are a list of key-value pairs that describe the resource. -// Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" -type CreateUpdateOptions struct { - // Throughput - Request Units per second. For example, "throughput": 10000. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// DatabaseAccountConnectionString connection string for the Cosmos DB account -type DatabaseAccountConnectionString struct { - // ConnectionString - READ-ONLY; Value of the connection string - ConnectionString *string `json:"connectionString,omitempty"` - // Description - READ-ONLY; Description of the connection string - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountConnectionString. -func (dacs DatabaseAccountConnectionString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountCreateUpdateParameters parameters to create and update Cosmos DB database accounts. -type DatabaseAccountCreateUpdateParameters struct { - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'DatabaseAccountKindGlobalDocumentDB', 'DatabaseAccountKindMongoDB', 'DatabaseAccountKindParse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - Properties BasicDatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountCreateUpdateParameters. -func (dacup DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dacup.Kind != "" { - objectMap["kind"] = dacup.Kind - } - objectMap["properties"] = dacup.Properties - if dacup.Location != nil { - objectMap["location"] = dacup.Location - } - if dacup.Tags != nil { - objectMap["tags"] = dacup.Tags - } - if dacup.Identity != nil { - objectMap["identity"] = dacup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateParameters struct. -func (dacup *DatabaseAccountCreateUpdateParameters) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dacup.Kind = kind - } - case "properties": - if v != nil { - properties, err := unmarshalBasicDatabaseAccountCreateUpdateProperties(*v) - if err != nil { - return err - } - dacup.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dacup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dacup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dacup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dacup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dacup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dacup.Identity = &identity - } - } - } - - return nil -} - -// BasicDatabaseAccountCreateUpdateProperties properties to create and update Azure Cosmos DB database accounts. -type BasicDatabaseAccountCreateUpdateProperties interface { - AsDefaultRequestDatabaseAccountCreateUpdateProperties() (*DefaultRequestDatabaseAccountCreateUpdateProperties, bool) - AsRestoreReqeustDatabaseAccountCreateUpdateProperties() (*RestoreReqeustDatabaseAccountCreateUpdateProperties, bool) - AsDatabaseAccountCreateUpdateProperties() (*DatabaseAccountCreateUpdateProperties, bool) -} - -// DatabaseAccountCreateUpdateProperties properties to create and update Azure Cosmos DB database accounts. -type DatabaseAccountCreateUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` - // CreateMode - Possible values include: 'CreateModeDatabaseAccountCreateUpdateProperties', 'CreateModeDefault', 'CreateModeRestore' - CreateMode CreateModeBasicDatabaseAccountCreateUpdateProperties `json:"createMode,omitempty"` -} - -func unmarshalBasicDatabaseAccountCreateUpdateProperties(body []byte) (BasicDatabaseAccountCreateUpdateProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["createMode"] { - case string(CreateModeDefault): - var drdacup DefaultRequestDatabaseAccountCreateUpdateProperties - err := json.Unmarshal(body, &drdacup) - return drdacup, err - case string(CreateModeRestore): - var rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties - err := json.Unmarshal(body, &rrdacup) - return rrdacup, err - default: - var dacup DatabaseAccountCreateUpdateProperties - err := json.Unmarshal(body, &dacup) - return dacup, err - } -} -func unmarshalBasicDatabaseAccountCreateUpdatePropertiesArray(body []byte) ([]BasicDatabaseAccountCreateUpdateProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dacupArray := make([]BasicDatabaseAccountCreateUpdateProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dacup, err := unmarshalBasicDatabaseAccountCreateUpdateProperties(*rawMessage) - if err != nil { - return nil, err - } - dacupArray[index] = dacup - } - return dacupArray, nil -} - -// MarshalJSON is the custom marshaler for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { - dacup.CreateMode = CreateModeDatabaseAccountCreateUpdateProperties - objectMap := make(map[string]interface{}) - if dacup.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = dacup.ConsistencyPolicy - } - if dacup.Locations != nil { - objectMap["locations"] = dacup.Locations - } - if dacup.DatabaseAccountOfferType != nil { - objectMap["databaseAccountOfferType"] = dacup.DatabaseAccountOfferType - } - if dacup.IPRules != nil { - objectMap["ipRules"] = dacup.IPRules - } - if dacup.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = dacup.IsVirtualNetworkFilterEnabled - } - if dacup.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = dacup.EnableAutomaticFailover - } - if dacup.Capabilities != nil { - objectMap["capabilities"] = dacup.Capabilities - } - if dacup.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = dacup.VirtualNetworkRules - } - if dacup.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = dacup.EnableMultipleWriteLocations - } - if dacup.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = dacup.EnableCassandraConnector - } - if dacup.ConnectorOffer != "" { - objectMap["connectorOffer"] = dacup.ConnectorOffer - } - if dacup.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = dacup.DisableKeyBasedMetadataWriteAccess - } - if dacup.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = dacup.KeyVaultKeyURI - } - if dacup.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = dacup.PublicNetworkAccess - } - if dacup.EnableFreeTier != nil { - objectMap["enableFreeTier"] = dacup.EnableFreeTier - } - if dacup.APIProperties != nil { - objectMap["apiProperties"] = dacup.APIProperties - } - if dacup.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = dacup.EnableAnalyticalStorage - } - objectMap["backupPolicy"] = dacup.BackupPolicy - if dacup.Cors != nil { - objectMap["cors"] = dacup.Cors - } - if dacup.CreateMode != "" { - objectMap["createMode"] = dacup.CreateMode - } - return json.Marshal(objectMap) -} - -// AsDefaultRequestDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) AsDefaultRequestDatabaseAccountCreateUpdateProperties() (*DefaultRequestDatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsRestoreReqeustDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) AsRestoreReqeustDatabaseAccountCreateUpdateProperties() (*RestoreReqeustDatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) AsDatabaseAccountCreateUpdateProperties() (*DatabaseAccountCreateUpdateProperties, bool) { - return &dacup, true -} - -// AsBasicDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) AsBasicDatabaseAccountCreateUpdateProperties() (BasicDatabaseAccountCreateUpdateProperties, bool) { - return &dacup, true -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateProperties struct. -func (dacup *DatabaseAccountCreateUpdateProperties) 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 "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - dacup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - dacup.Locations = &locations - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType string - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - dacup.DatabaseAccountOfferType = &databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - dacup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - dacup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - dacup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - dacup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - dacup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - dacup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - dacup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - dacup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - dacup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - dacup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - dacup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - dacup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - dacup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - dacup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - dacup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - dacup.Cors = &cors - } - case "createMode": - if v != nil { - var createMode CreateModeBasicDatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &createMode) - if err != nil { - return err - } - dacup.CreateMode = createMode - } - } - } - - return nil -} - -// DatabaseAccountGetProperties properties for the database account. -type DatabaseAccountGetProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the Cosmos DB database account. - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - // DatabaseAccountOfferType - READ-ONLY; The offer type for the Cosmos DB database account. Default value: Standard. Possible values include: 'Standard' - DatabaseAccountOfferType DatabaseAccountOfferType `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // ConsistencyPolicy - The consistency policy for the Cosmos DB database account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // WriteLocations - READ-ONLY; An array that contains the write location for the Cosmos DB account. - WriteLocations *[]Location `json:"writeLocations,omitempty"` - // ReadLocations - READ-ONLY; An array that contains of the read locations enabled for the Cosmos DB account. - ReadLocations *[]Location `json:"readLocations,omitempty"` - // Locations - READ-ONLY; An array that contains all of the locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // FailoverPolicies - READ-ONLY; An array that contains the regions ordered by their failover priorities. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of Private Endpoint Connections configured for the Cosmos DB account. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // InstanceID - READ-ONLY; A unique identifier assigned to the database account - InstanceID *string `json:"instanceId,omitempty"` - // CreateMode - Enum to indicate the mode of account creation. Possible values include: 'Default', 'Restore' - CreateMode CreateMode `json:"createMode,omitempty"` - // RestoreParameters - Parameters to indicate the information about the restore. - RestoreParameters *RestoreParameters `json:"restoreParameters,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetProperties. -func (dagp DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagp.ProvisioningState != nil { - objectMap["provisioningState"] = dagp.ProvisioningState - } - if dagp.IPRules != nil { - objectMap["ipRules"] = dagp.IPRules - } - if dagp.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = dagp.IsVirtualNetworkFilterEnabled - } - if dagp.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = dagp.EnableAutomaticFailover - } - if dagp.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = dagp.ConsistencyPolicy - } - if dagp.Capabilities != nil { - objectMap["capabilities"] = dagp.Capabilities - } - if dagp.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = dagp.VirtualNetworkRules - } - if dagp.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = dagp.EnableMultipleWriteLocations - } - if dagp.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = dagp.EnableCassandraConnector - } - if dagp.ConnectorOffer != "" { - objectMap["connectorOffer"] = dagp.ConnectorOffer - } - if dagp.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = dagp.DisableKeyBasedMetadataWriteAccess - } - if dagp.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = dagp.KeyVaultKeyURI - } - if dagp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = dagp.PublicNetworkAccess - } - if dagp.EnableFreeTier != nil { - objectMap["enableFreeTier"] = dagp.EnableFreeTier - } - if dagp.APIProperties != nil { - objectMap["apiProperties"] = dagp.APIProperties - } - if dagp.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = dagp.EnableAnalyticalStorage - } - if dagp.CreateMode != "" { - objectMap["createMode"] = dagp.CreateMode - } - if dagp.RestoreParameters != nil { - objectMap["restoreParameters"] = dagp.RestoreParameters - } - objectMap["backupPolicy"] = dagp.BackupPolicy - if dagp.Cors != nil { - objectMap["cors"] = dagp.Cors - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetProperties struct. -func (dagp *DatabaseAccountGetProperties) 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 "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - dagp.ProvisioningState = &provisioningState - } - case "documentEndpoint": - if v != nil { - var documentEndpoint string - err = json.Unmarshal(*v, &documentEndpoint) - if err != nil { - return err - } - dagp.DocumentEndpoint = &documentEndpoint - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType DatabaseAccountOfferType - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - dagp.DatabaseAccountOfferType = databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - dagp.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - dagp.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - dagp.EnableAutomaticFailover = &enableAutomaticFailover - } - case "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - dagp.ConsistencyPolicy = &consistencyPolicy - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - dagp.Capabilities = &capabilities - } - case "writeLocations": - if v != nil { - var writeLocations []Location - err = json.Unmarshal(*v, &writeLocations) - if err != nil { - return err - } - dagp.WriteLocations = &writeLocations - } - case "readLocations": - if v != nil { - var readLocations []Location - err = json.Unmarshal(*v, &readLocations) - if err != nil { - return err - } - dagp.ReadLocations = &readLocations - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - dagp.Locations = &locations - } - case "failoverPolicies": - if v != nil { - var failoverPolicies []FailoverPolicy - err = json.Unmarshal(*v, &failoverPolicies) - if err != nil { - return err - } - dagp.FailoverPolicies = &failoverPolicies - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - dagp.VirtualNetworkRules = &virtualNetworkRules - } - case "privateEndpointConnections": - if v != nil { - var privateEndpointConnections []PrivateEndpointConnection - err = json.Unmarshal(*v, &privateEndpointConnections) - if err != nil { - return err - } - dagp.PrivateEndpointConnections = &privateEndpointConnections - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - dagp.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - dagp.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - dagp.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - dagp.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - dagp.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - dagp.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - dagp.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - dagp.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - dagp.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "instanceId": - if v != nil { - var instanceID string - err = json.Unmarshal(*v, &instanceID) - if err != nil { - return err - } - dagp.InstanceID = &instanceID - } - case "createMode": - if v != nil { - var createMode CreateMode - err = json.Unmarshal(*v, &createMode) - if err != nil { - return err - } - dagp.CreateMode = createMode - } - case "restoreParameters": - if v != nil { - var restoreParameters RestoreParameters - err = json.Unmarshal(*v, &restoreParameters) - if err != nil { - return err - } - dagp.RestoreParameters = &restoreParameters - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - dagp.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - dagp.Cors = &cors - } - } - } - - return nil -} - -// DatabaseAccountGetResults an Azure Cosmos DB database account. -type DatabaseAccountGetResults struct { - autorest.Response `json:"-"` - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'DatabaseAccountKindGlobalDocumentDB', 'DatabaseAccountKindMongoDB', 'DatabaseAccountKindParse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountGetProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetResults. -func (dagr DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagr.Kind != "" { - objectMap["kind"] = dagr.Kind - } - if dagr.DatabaseAccountGetProperties != nil { - objectMap["properties"] = dagr.DatabaseAccountGetProperties - } - if dagr.Location != nil { - objectMap["location"] = dagr.Location - } - if dagr.Tags != nil { - objectMap["tags"] = dagr.Tags - } - if dagr.Identity != nil { - objectMap["identity"] = dagr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetResults struct. -func (dagr *DatabaseAccountGetResults) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dagr.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountGetProperties DatabaseAccountGetProperties - err = json.Unmarshal(*v, &databaseAccountGetProperties) - if err != nil { - return err - } - dagr.DatabaseAccountGetProperties = &databaseAccountGetProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - dagr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dagr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dagr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dagr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dagr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dagr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dagr.Identity = &identity - } - } - } - - return nil -} - -// DatabaseAccountListConnectionStringsResult the connection strings for the given database account. -type DatabaseAccountListConnectionStringsResult struct { - autorest.Response `json:"-"` - // ConnectionStrings - An array that contains the connection strings for the Cosmos DB account. - ConnectionStrings *[]DatabaseAccountConnectionString `json:"connectionStrings,omitempty"` -} - -// DatabaseAccountListKeysResult the access keys for the given database account. -type DatabaseAccountListKeysResult struct { - autorest.Response `json:"-"` - // PrimaryMasterKey - READ-ONLY; Base 64 encoded value of the primary read-write key. - PrimaryMasterKey *string `json:"primaryMasterKey,omitempty"` - // SecondaryMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-write key. - SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListKeysResult. -func (dalkr DatabaseAccountListKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountListReadOnlyKeysResult the read-only access keys for the given database account. -type DatabaseAccountListReadOnlyKeysResult struct { - autorest.Response `json:"-"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListReadOnlyKeysResult. -func (dalrokr DatabaseAccountListReadOnlyKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountRegenerateKeyParameters parameters to regenerate the keys within the database account. -type DatabaseAccountRegenerateKeyParameters struct { - // KeyKind - The access key to regenerate. Possible values include: 'Primary', 'Secondary', 'PrimaryReadonly', 'SecondaryReadonly' - KeyKind KeyKind `json:"keyKind,omitempty"` -} - -// DatabaseAccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsCreateOrUpdateFuture) 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 DatabaseAccountsCreateOrUpdateFuture.Result. -func (future *DatabaseAccountsCreateOrUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.CreateOrUpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsDeleteFuture) 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 DatabaseAccountsDeleteFuture.Result. -func (future *DatabaseAccountsDeleteFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsFailoverPriorityChangeFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type DatabaseAccountsFailoverPriorityChangeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) 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 DatabaseAccountsFailoverPriorityChangeFuture.Result. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsFailoverPriorityChangeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsFailoverPriorityChangeFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsListResult the List operation response, that contains the database accounts and their -// properties. -type DatabaseAccountsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of database account and their properties. - Value *[]DatabaseAccountGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountsListResult. -func (dalr DatabaseAccountsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountsOfflineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOfflineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOfflineRegionFuture) 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 DatabaseAccountsOfflineRegionFuture.Result. -func (future *DatabaseAccountsOfflineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOfflineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsOnlineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOnlineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOnlineRegionFuture) 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 DatabaseAccountsOnlineRegionFuture.Result. -func (future *DatabaseAccountsOnlineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOnlineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsRegenerateKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsRegenerateKeyFuture) 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 DatabaseAccountsRegenerateKeyFuture.Result. -func (future *DatabaseAccountsRegenerateKeyFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsRegenerateKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsRegenerateKeyFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsUpdateFuture) 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 DatabaseAccountsUpdateFuture.Result. -func (future *DatabaseAccountsUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.UpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountUpdateParameters parameters for patching Azure Cosmos DB database account properties. -type DatabaseAccountUpdateParameters struct { - Tags map[string]*string `json:"tags"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - *DatabaseAccountUpdateProperties `json:"properties,omitempty"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountUpdateParameters. -func (daup DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if daup.Tags != nil { - objectMap["tags"] = daup.Tags - } - if daup.Location != nil { - objectMap["location"] = daup.Location - } - if daup.DatabaseAccountUpdateProperties != nil { - objectMap["properties"] = daup.DatabaseAccountUpdateProperties - } - if daup.Identity != nil { - objectMap["identity"] = daup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateParameters struct. -func (daup *DatabaseAccountUpdateParameters) 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 - } - daup.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - daup.Location = &location - } - case "properties": - if v != nil { - var databaseAccountUpdateProperties DatabaseAccountUpdateProperties - err = json.Unmarshal(*v, &databaseAccountUpdateProperties) - if err != nil { - return err - } - daup.DatabaseAccountUpdateProperties = &databaseAccountUpdateProperties - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - daup.Identity = &identity - } - } - } - - return nil -} - -// DatabaseAccountUpdateProperties properties to update Azure Cosmos DB database accounts. -type DatabaseAccountUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateProperties struct. -func (daup *DatabaseAccountUpdateProperties) 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 "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - daup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - daup.Locations = &locations - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - daup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - daup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - daup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - daup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - daup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - daup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - daup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - daup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - daup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - daup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - daup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - daup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - daup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - daup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - daup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - daup.Cors = &cors - } - } - } - - return nil -} - -// DatabaseRestoreResource specific Databases to restore. -type DatabaseRestoreResource struct { - // DatabaseName - The name of the database available for restore. - DatabaseName *string `json:"databaseName,omitempty"` - // CollectionNames - The names of the collections available for restore. - CollectionNames *[]string `json:"collectionNames,omitempty"` -} - -// DefaultErrorResponse an error response from the service. -type DefaultErrorResponse struct { - Error *ErrorResponse `json:"error,omitempty"` -} - -// DefaultRequestDatabaseAccountCreateUpdateProperties properties for non-restore Azure Cosmos DB database -// account requests. -type DefaultRequestDatabaseAccountCreateUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` - // CreateMode - Possible values include: 'CreateModeDatabaseAccountCreateUpdateProperties', 'CreateModeDefault', 'CreateModeRestore' - CreateMode CreateModeBasicDatabaseAccountCreateUpdateProperties `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { - drdacup.CreateMode = CreateModeDefault - objectMap := make(map[string]interface{}) - if drdacup.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = drdacup.ConsistencyPolicy - } - if drdacup.Locations != nil { - objectMap["locations"] = drdacup.Locations - } - if drdacup.DatabaseAccountOfferType != nil { - objectMap["databaseAccountOfferType"] = drdacup.DatabaseAccountOfferType - } - if drdacup.IPRules != nil { - objectMap["ipRules"] = drdacup.IPRules - } - if drdacup.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = drdacup.IsVirtualNetworkFilterEnabled - } - if drdacup.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = drdacup.EnableAutomaticFailover - } - if drdacup.Capabilities != nil { - objectMap["capabilities"] = drdacup.Capabilities - } - if drdacup.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = drdacup.VirtualNetworkRules - } - if drdacup.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = drdacup.EnableMultipleWriteLocations - } - if drdacup.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = drdacup.EnableCassandraConnector - } - if drdacup.ConnectorOffer != "" { - objectMap["connectorOffer"] = drdacup.ConnectorOffer - } - if drdacup.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = drdacup.DisableKeyBasedMetadataWriteAccess - } - if drdacup.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = drdacup.KeyVaultKeyURI - } - if drdacup.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = drdacup.PublicNetworkAccess - } - if drdacup.EnableFreeTier != nil { - objectMap["enableFreeTier"] = drdacup.EnableFreeTier - } - if drdacup.APIProperties != nil { - objectMap["apiProperties"] = drdacup.APIProperties - } - if drdacup.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = drdacup.EnableAnalyticalStorage - } - objectMap["backupPolicy"] = drdacup.BackupPolicy - if drdacup.Cors != nil { - objectMap["cors"] = drdacup.Cors - } - if drdacup.CreateMode != "" { - objectMap["createMode"] = drdacup.CreateMode - } - return json.Marshal(objectMap) -} - -// AsDefaultRequestDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) AsDefaultRequestDatabaseAccountCreateUpdateProperties() (*DefaultRequestDatabaseAccountCreateUpdateProperties, bool) { - return &drdacup, true -} - -// AsRestoreReqeustDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) AsRestoreReqeustDatabaseAccountCreateUpdateProperties() (*RestoreReqeustDatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) AsDatabaseAccountCreateUpdateProperties() (*DatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsBasicDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) AsBasicDatabaseAccountCreateUpdateProperties() (BasicDatabaseAccountCreateUpdateProperties, bool) { - return &drdacup, true -} - -// UnmarshalJSON is the custom unmarshaler for DefaultRequestDatabaseAccountCreateUpdateProperties struct. -func (drdacup *DefaultRequestDatabaseAccountCreateUpdateProperties) 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 "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - drdacup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - drdacup.Locations = &locations - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType string - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - drdacup.DatabaseAccountOfferType = &databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - drdacup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - drdacup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - drdacup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - drdacup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - drdacup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - drdacup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - drdacup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - drdacup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - drdacup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - drdacup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - drdacup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - drdacup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - drdacup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - drdacup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - drdacup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - drdacup.Cors = &cors - } - case "createMode": - if v != nil { - var createMode CreateModeBasicDatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &createMode) - if err != nil { - return err - } - drdacup.CreateMode = createMode - } - } - } - - return nil -} - -// ErrorResponse 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"` -} - -// ExcludedPath ... -type ExcludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` -} - -// ExtendedResourceProperties the system generated resource properties associated with SQL databases, SQL -// containers, Gremlin databases and Gremlin graphs. -type ExtendedResourceProperties struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedResourceProperties. -func (erp ExtendedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverPolicies the list of new failover policies for the failover priority change. -type FailoverPolicies struct { - // FailoverPolicies - List of failover policies. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` -} - -// FailoverPolicy the failover policy for a given region of a database account. -type FailoverPolicy struct { - // ID - READ-ONLY; The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region in which the database account exists. - LocationName *string `json:"locationName,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverPolicy. -func (fp FailoverPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.LocationName != nil { - objectMap["locationName"] = fp.LocationName - } - if fp.FailoverPriority != nil { - objectMap["failoverPriority"] = fp.FailoverPriority - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseCreateUpdateParameters parameters to create and update Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateParameters struct { - // GremlinDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin database. - *GremlinDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseCreateUpdateParameters. -func (gdcup GremlinDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdcup.GremlinDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = gdcup.GremlinDatabaseCreateUpdateProperties - } - if gdcup.Location != nil { - objectMap["location"] = gdcup.Location - } - if gdcup.Tags != nil { - objectMap["tags"] = gdcup.Tags - } - if gdcup.Identity != nil { - objectMap["identity"] = gdcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseCreateUpdateParameters struct. -func (gdcup *GremlinDatabaseCreateUpdateParameters) 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 gremlinDatabaseCreateUpdateProperties GremlinDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinDatabaseCreateUpdateProperties) - if err != nil { - return err - } - gdcup.GremlinDatabaseCreateUpdateProperties = &gremlinDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - gdcup.Identity = &identity - } - } - } - - return nil -} - -// GremlinDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin database - Resource *GremlinDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type GremlinDatabaseGetProperties struct { - Resource *GremlinDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetPropertiesOptions ... -type GremlinDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// GremlinDatabaseGetPropertiesResource ... -type GremlinDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetPropertiesResource. -func (gdgp GremlinDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgp.ID != nil { - objectMap["id"] = gdgp.ID - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseGetResults an Azure Cosmos DB Gremlin database. -type GremlinDatabaseGetResults struct { - autorest.Response `json:"-"` - // GremlinDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *GremlinDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetResults. -func (gdgr GremlinDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgr.GremlinDatabaseGetProperties != nil { - objectMap["properties"] = gdgr.GremlinDatabaseGetProperties - } - if gdgr.Location != nil { - objectMap["location"] = gdgr.Location - } - if gdgr.Tags != nil { - objectMap["tags"] = gdgr.Tags - } - if gdgr.Identity != nil { - objectMap["identity"] = gdgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseGetResults struct. -func (gdgr *GremlinDatabaseGetResults) 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 gremlinDatabaseGetProperties GremlinDatabaseGetProperties - err = json.Unmarshal(*v, &gremlinDatabaseGetProperties) - if err != nil { - return err - } - gdgr.GremlinDatabaseGetProperties = &gremlinDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - gdgr.Identity = &identity - } - } - } - - return nil -} - -// GremlinDatabaseListResult the List operation response, that contains the Gremlin databases and their -// properties. -type GremlinDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Gremlin databases and their properties. - Value *[]GremlinDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseListResult. -func (gdlr GremlinDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinDatabaseResource cosmos DB Gremlin database resource object -type GremlinDatabaseResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` -} - -// GremlinGraphCreateUpdateParameters parameters to create and update Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateParameters struct { - // GremlinGraphCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin graph. - *GremlinGraphCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphCreateUpdateParameters. -func (ggcup GremlinGraphCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ggcup.GremlinGraphCreateUpdateProperties != nil { - objectMap["properties"] = ggcup.GremlinGraphCreateUpdateProperties - } - if ggcup.Location != nil { - objectMap["location"] = ggcup.Location - } - if ggcup.Tags != nil { - objectMap["tags"] = ggcup.Tags - } - if ggcup.Identity != nil { - objectMap["identity"] = ggcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphCreateUpdateParameters struct. -func (ggcup *GremlinGraphCreateUpdateParameters) 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 gremlinGraphCreateUpdateProperties GremlinGraphCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinGraphCreateUpdateProperties) - if err != nil { - return err - } - ggcup.GremlinGraphCreateUpdateProperties = &gremlinGraphCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ggcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ggcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ggcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ggcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ggcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ggcup.Identity = &identity - } - } - } - - return nil -} - -// GremlinGraphCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin graph - Resource *GremlinGraphResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinGraphGetProperties the properties of an Azure Cosmos DB Gremlin graph -type GremlinGraphGetProperties struct { - Resource *GremlinGraphGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinGraphGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinGraphGetPropertiesOptions ... -type GremlinGraphGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// GremlinGraphGetPropertiesResource ... -type GremlinGraphGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetPropertiesResource. -func (gggp GremlinGraphGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggp.ID != nil { - objectMap["id"] = gggp.ID - } - if gggp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = gggp.IndexingPolicy - } - if gggp.PartitionKey != nil { - objectMap["partitionKey"] = gggp.PartitionKey - } - if gggp.DefaultTTL != nil { - objectMap["defaultTtl"] = gggp.DefaultTTL - } - if gggp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = gggp.UniqueKeyPolicy - } - if gggp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = gggp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// GremlinGraphGetResults an Azure Cosmos DB Gremlin graph. -type GremlinGraphGetResults struct { - autorest.Response `json:"-"` - // GremlinGraphGetProperties - The properties of an Azure Cosmos DB Gremlin graph - *GremlinGraphGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetResults. -func (gggr GremlinGraphGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggr.GremlinGraphGetProperties != nil { - objectMap["properties"] = gggr.GremlinGraphGetProperties - } - if gggr.Location != nil { - objectMap["location"] = gggr.Location - } - if gggr.Tags != nil { - objectMap["tags"] = gggr.Tags - } - if gggr.Identity != nil { - objectMap["identity"] = gggr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphGetResults struct. -func (gggr *GremlinGraphGetResults) 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 gremlinGraphGetProperties GremlinGraphGetProperties - err = json.Unmarshal(*v, &gremlinGraphGetProperties) - if err != nil { - return err - } - gggr.GremlinGraphGetProperties = &gremlinGraphGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gggr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gggr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gggr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gggr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gggr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - gggr.Identity = &identity - } - } - } - - return nil -} - -// GremlinGraphListResult the List operation response, that contains the graphs and their properties. -type GremlinGraphListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of graphs and their properties. - Value *[]GremlinGraphGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphListResult. -func (gglr GremlinGraphListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinGraphResource cosmos DB Gremlin graph resource object -type GremlinGraphResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// GremlinResourcesCreateUpdateGremlinDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesCreateUpdateGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) 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 GremlinResourcesCreateUpdateGremlinDatabaseFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) result(client GremlinResourcesClient) (gdgr GremlinDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gdgr.Response.Response, err = future.GetResult(sender); err == nil && gdgr.Response.Response.StatusCode != http.StatusNoContent { - gdgr, err = client.CreateUpdateGremlinDatabaseResponder(gdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", gdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesCreateUpdateGremlinGraphFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type GremlinResourcesCreateUpdateGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinGraphGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) 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 GremlinResourcesCreateUpdateGremlinGraphFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) result(client GremlinResourcesClient) (gggr GremlinGraphGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gggr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gggr.Response.Response, err = future.GetResult(sender); err == nil && gggr.Response.Response.StatusCode != http.StatusNoContent { - gggr, err = client.CreateUpdateGremlinGraphResponder(gggr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", gggr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesDeleteGremlinDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type GremlinResourcesDeleteGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) 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 GremlinResourcesDeleteGremlinDatabaseFuture.Result. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesDeleteGremlinGraphFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GremlinResourcesDeleteGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinGraphFuture) 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 GremlinResourcesDeleteGremlinGraphFuture.Result. -func (future *GremlinResourcesDeleteGremlinGraphFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinGraphFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesUpdateGremlinDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) 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 GremlinResourcesUpdateGremlinDatabaseThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinGraphThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinGraphThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) 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 GremlinResourcesUpdateGremlinGraphThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinGraphThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// IncludedPath the paths that are included in indexing -type IncludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Indexes - List of indexes for this path - Indexes *[]Indexes `json:"indexes,omitempty"` -} - -// Indexes the indexes for the path. -type Indexes struct { - // DataType - The datatype for which the indexing behavior is applied to. Possible values include: 'String', 'Number', 'Point', 'Polygon', 'LineString', 'MultiPolygon' - DataType DataType `json:"dataType,omitempty"` - // Precision - The precision of the index. -1 is maximum precision. - Precision *int32 `json:"precision,omitempty"` - // Kind - Indicates the type of index. Possible values include: 'Hash', 'Range', 'Spatial' - Kind IndexKind `json:"kind,omitempty"` -} - -// IndexingPolicy cosmos DB indexing policy -type IndexingPolicy struct { - // Automatic - Indicates if the indexing policy is automatic - Automatic *bool `json:"automatic,omitempty"` - // IndexingMode - Indicates the indexing mode. Possible values include: 'Consistent', 'Lazy', 'None' - IndexingMode IndexingMode `json:"indexingMode,omitempty"` - // IncludedPaths - List of paths to include in the indexing - IncludedPaths *[]IncludedPath `json:"includedPaths,omitempty"` - // ExcludedPaths - List of paths to exclude from indexing - ExcludedPaths *[]ExcludedPath `json:"excludedPaths,omitempty"` - // CompositeIndexes - List of composite path list - CompositeIndexes *[][]CompositePath `json:"compositeIndexes,omitempty"` - // SpatialIndexes - List of spatial specifics - SpatialIndexes *[]SpatialSpec `json:"spatialIndexes,omitempty"` -} - -// IPAddressOrRange ipAddressOrRange object -type IPAddressOrRange struct { - // IPAddressOrRange - A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. - IPAddressOrRange *string `json:"ipAddressOrRange,omitempty"` -} - -// Location a region in which the Azure Cosmos DB database account is deployed. -type Location struct { - // ID - READ-ONLY; The unique identifier of the region within the database account. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region. - LocationName *string `json:"locationName,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` - // IsZoneRedundant - Flag to indicate whether or not this region is an AvailabilityZone region - IsZoneRedundant *bool `json:"isZoneRedundant,omitempty"` -} - -// MarshalJSON is the custom marshaler for Location. -func (l Location) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if l.LocationName != nil { - objectMap["locationName"] = l.LocationName - } - if l.ProvisioningState != nil { - objectMap["provisioningState"] = l.ProvisioningState - } - if l.FailoverPriority != nil { - objectMap["failoverPriority"] = l.FailoverPriority - } - if l.IsZoneRedundant != nil { - objectMap["isZoneRedundant"] = l.IsZoneRedundant - } - return json.Marshal(objectMap) -} - -// ManagedServiceIdentity identity for the resource. -type ManagedServiceIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the system assigned identity. This property will only be provided for a system assigned identity. - PrincipalID *string `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 *string `json:"tenantId,omitempty"` - // Type - The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*ManagedServiceIdentityUserAssignedIdentitiesValue `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) -} - -// ManagedServiceIdentityUserAssignedIdentitiesValue ... -type ManagedServiceIdentityUserAssignedIdentitiesValue 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 ManagedServiceIdentityUserAssignedIdentitiesValue. -func (msiAiv ManagedServiceIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Metric metric data -type Metric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for Metric. -func (mVar Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.Unit != "" { - objectMap["unit"] = mVar.Unit - } - return json.Marshal(objectMap) -} - -// MetricAvailability the availability of the metric. -type MetricAvailability struct { - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - READ-ONLY; The retention for the metric values. - Retention *string `json:"retention,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAvailability. -func (ma MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinition the definition of a metric. -type MetricDefinition struct { - // MetricAvailabilities - READ-ONLY; The list of metric availabilities for the account. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type of the metric. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeTotal', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeLast' - PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // ResourceURI - READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinition. -func (md MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if md.Unit != "" { - objectMap["unit"] = md.Unit - } - return json.Marshal(objectMap) -} - -// MetricDefinitionsListResult the response to a list metric definitions request. -type MetricDefinitionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metric definitions for the account. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinitionsListResult. -func (mdlr MetricDefinitionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricListResult the response to a list metrics request. -type MetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metrics for the account. - Value *[]Metric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricListResult. -func (mlr MetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricName a metric name. -type MetricName struct { - // Value - READ-ONLY; The name of the metric. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The friendly name of the metric. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricName. -func (mn MetricName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricValue represents metrics values. -type MetricValue struct { - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricValue. -func (mv MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionCreateUpdateParameters parameters to create and update Cosmos DB MongoDB collection. -type MongoDBCollectionCreateUpdateParameters struct { - // MongoDBCollectionCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB collection. - *MongoDBCollectionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionCreateUpdateParameters. -func (mdccup MongoDBCollectionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdccup.MongoDBCollectionCreateUpdateProperties != nil { - objectMap["properties"] = mdccup.MongoDBCollectionCreateUpdateProperties - } - if mdccup.Location != nil { - objectMap["location"] = mdccup.Location - } - if mdccup.Tags != nil { - objectMap["tags"] = mdccup.Tags - } - if mdccup.Identity != nil { - objectMap["identity"] = mdccup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionCreateUpdateParameters struct. -func (mdccup *MongoDBCollectionCreateUpdateParameters) 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 mongoDBCollectionCreateUpdateProperties MongoDBCollectionCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBCollectionCreateUpdateProperties) - if err != nil { - return err - } - mdccup.MongoDBCollectionCreateUpdateProperties = &mongoDBCollectionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdccup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mdccup.Identity = &identity - } - } - } - - return nil -} - -// MongoDBCollectionCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB -// collection. -type MongoDBCollectionCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB collection - Resource *MongoDBCollectionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetProperties the properties of an Azure Cosmos DB MongoDB collection -type MongoDBCollectionGetProperties struct { - Resource *MongoDBCollectionGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBCollectionGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetPropertiesOptions ... -type MongoDBCollectionGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// MongoDBCollectionGetPropertiesResource ... -type MongoDBCollectionGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetPropertiesResource. -func (mdcgp MongoDBCollectionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgp.ID != nil { - objectMap["id"] = mdcgp.ID - } - if mdcgp.ShardKey != nil { - objectMap["shardKey"] = mdcgp.ShardKey - } - if mdcgp.Indexes != nil { - objectMap["indexes"] = mdcgp.Indexes - } - if mdcgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = mdcgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// MongoDBCollectionGetResults an Azure Cosmos DB MongoDB collection. -type MongoDBCollectionGetResults struct { - autorest.Response `json:"-"` - // MongoDBCollectionGetProperties - The properties of an Azure Cosmos DB MongoDB collection - *MongoDBCollectionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetResults. -func (mdcgr MongoDBCollectionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgr.MongoDBCollectionGetProperties != nil { - objectMap["properties"] = mdcgr.MongoDBCollectionGetProperties - } - if mdcgr.Location != nil { - objectMap["location"] = mdcgr.Location - } - if mdcgr.Tags != nil { - objectMap["tags"] = mdcgr.Tags - } - if mdcgr.Identity != nil { - objectMap["identity"] = mdcgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionGetResults struct. -func (mdcgr *MongoDBCollectionGetResults) 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 mongoDBCollectionGetProperties MongoDBCollectionGetProperties - err = json.Unmarshal(*v, &mongoDBCollectionGetProperties) - if err != nil { - return err - } - mdcgr.MongoDBCollectionGetProperties = &mongoDBCollectionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdcgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdcgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdcgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdcgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdcgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mdcgr.Identity = &identity - } - } - } - - return nil -} - -// MongoDBCollectionListResult the List operation response, that contains the MongoDB collections and their -// properties. -type MongoDBCollectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB collections and their properties. - Value *[]MongoDBCollectionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionListResult. -func (mdclr MongoDBCollectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionResource cosmos DB MongoDB collection resource object -type MongoDBCollectionResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionResource. -func (mdcr MongoDBCollectionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcr.ID != nil { - objectMap["id"] = mdcr.ID - } - if mdcr.ShardKey != nil { - objectMap["shardKey"] = mdcr.ShardKey - } - if mdcr.Indexes != nil { - objectMap["indexes"] = mdcr.Indexes - } - if mdcr.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = mdcr.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseCreateUpdateParameters parameters to create and update Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateParameters struct { - // MongoDBDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB database. - *MongoDBDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseCreateUpdateParameters. -func (mddcup MongoDBDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddcup.MongoDBDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = mddcup.MongoDBDatabaseCreateUpdateProperties - } - if mddcup.Location != nil { - objectMap["location"] = mddcup.Location - } - if mddcup.Tags != nil { - objectMap["tags"] = mddcup.Tags - } - if mddcup.Identity != nil { - objectMap["identity"] = mddcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseCreateUpdateParameters struct. -func (mddcup *MongoDBDatabaseCreateUpdateParameters) 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 mongoDBDatabaseCreateUpdateProperties MongoDBDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBDatabaseCreateUpdateProperties) - if err != nil { - return err - } - mddcup.MongoDBDatabaseCreateUpdateProperties = &mongoDBDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mddcup.Identity = &identity - } - } - } - - return nil -} - -// MongoDBDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB database - Resource *MongoDBDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetProperties the properties of an Azure Cosmos DB MongoDB database -type MongoDBDatabaseGetProperties struct { - Resource *MongoDBDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetPropertiesOptions ... -type MongoDBDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// MongoDBDatabaseGetPropertiesResource ... -type MongoDBDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetPropertiesResource. -func (mddgp MongoDBDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgp.ID != nil { - objectMap["id"] = mddgp.ID - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseGetResults an Azure Cosmos DB MongoDB database. -type MongoDBDatabaseGetResults struct { - autorest.Response `json:"-"` - // MongoDBDatabaseGetProperties - The properties of an Azure Cosmos DB MongoDB database - *MongoDBDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetResults. -func (mddgr MongoDBDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgr.MongoDBDatabaseGetProperties != nil { - objectMap["properties"] = mddgr.MongoDBDatabaseGetProperties - } - if mddgr.Location != nil { - objectMap["location"] = mddgr.Location - } - if mddgr.Tags != nil { - objectMap["tags"] = mddgr.Tags - } - if mddgr.Identity != nil { - objectMap["identity"] = mddgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseGetResults struct. -func (mddgr *MongoDBDatabaseGetResults) 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 mongoDBDatabaseGetProperties MongoDBDatabaseGetProperties - err = json.Unmarshal(*v, &mongoDBDatabaseGetProperties) - if err != nil { - return err - } - mddgr.MongoDBDatabaseGetProperties = &mongoDBDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mddgr.Identity = &identity - } - } - } - - return nil -} - -// MongoDBDatabaseListResult the List operation response, that contains the MongoDB databases and their -// properties. -type MongoDBDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB databases and their properties. - Value *[]MongoDBDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseListResult. -func (mddlr MongoDBDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBDatabaseResource cosmos DB MongoDB database resource object -type MongoDBDatabaseResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` -} - -// MongoDBResourcesCreateUpdateMongoDBCollectionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBCollectionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) 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 MongoDBResourcesCreateUpdateMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) result(client MongoDBResourcesClient) (mdcgr MongoDBCollectionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mdcgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mdcgr.Response.Response, err = future.GetResult(sender); err == nil && mdcgr.Response.Response.StatusCode != http.StatusNoContent { - mdcgr, err = client.CreateUpdateMongoDBCollectionResponder(mdcgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", mdcgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesCreateUpdateMongoDBDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) 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 MongoDBResourcesCreateUpdateMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (mddgr MongoDBDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mddgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mddgr.Response.Response, err = future.GetResult(sender); err == nil && mddgr.Response.Response.StatusCode != http.StatusNoContent { - mddgr, err = client.CreateUpdateMongoDBDatabaseResponder(mddgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", mddgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesDeleteMongoDBCollectionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type MongoDBResourcesDeleteMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) 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 MongoDBResourcesDeleteMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesDeleteMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type MongoDBResourcesDeleteMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) 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 MongoDBResourcesDeleteMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesUpdateMongoDBCollectionThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBCollectionThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) 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 MongoDBResourcesUpdateMongoDBCollectionThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBCollectionThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) 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 MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoIndex cosmos DB MongoDB collection index key -type MongoIndex struct { - // Key - Cosmos DB MongoDB collection index keys - Key *MongoIndexKeys `json:"key,omitempty"` - // Options - Cosmos DB MongoDB collection index key options - Options *MongoIndexOptions `json:"options,omitempty"` -} - -// MongoIndexKeys cosmos DB MongoDB collection resource object -type MongoIndexKeys struct { - // Keys - List of keys for each MongoDB collection in the Azure Cosmos DB service - Keys *[]string `json:"keys,omitempty"` -} - -// MongoIndexOptions cosmos DB MongoDB collection index options -type MongoIndexOptions struct { - // ExpireAfterSeconds - Expire after seconds - ExpireAfterSeconds *int32 `json:"expireAfterSeconds,omitempty"` - // Unique - Is unique or not - Unique *bool `json:"unique,omitempty"` -} - -// NotebookWorkspace a notebook workspace resource -type NotebookWorkspace struct { - autorest.Response `json:"-"` - // NotebookWorkspaceProperties - Resource properties. - *NotebookWorkspaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspace. -func (nw NotebookWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nw.NotebookWorkspaceProperties != nil { - objectMap["properties"] = nw.NotebookWorkspaceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotebookWorkspace struct. -func (nw *NotebookWorkspace) 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 notebookWorkspaceProperties NotebookWorkspaceProperties - err = json.Unmarshal(*v, ¬ebookWorkspaceProperties) - if err != nil { - return err - } - nw.NotebookWorkspaceProperties = ¬ebookWorkspaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nw.Type = &typeVar - } - } - } - - return nil -} - -// NotebookWorkspaceConnectionInfoResult the connection info for the given notebook workspace -type NotebookWorkspaceConnectionInfoResult struct { - autorest.Response `json:"-"` - // AuthToken - READ-ONLY; Specifies auth token used for connecting to Notebook server (uses token-based auth). - AuthToken *string `json:"authToken,omitempty"` - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceConnectionInfoResult. -func (nwcir NotebookWorkspaceConnectionInfoResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceCreateUpdateParameters parameters to create a notebook workspace resource -type NotebookWorkspaceCreateUpdateParameters struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceCreateUpdateParameters. -func (nwcup NotebookWorkspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceListResult a list of notebook workspace resources -type NotebookWorkspaceListResult struct { - autorest.Response `json:"-"` - // Value - Array of notebook workspace resources - Value *[]NotebookWorkspace `json:"value,omitempty"` -} - -// NotebookWorkspaceProperties properties of a notebook workspace resource. -type NotebookWorkspaceProperties struct { - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` - // Status - READ-ONLY; Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceProperties. -func (nwp NotebookWorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (NotebookWorkspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesCreateOrUpdateFuture) 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 NotebookWorkspacesCreateOrUpdateFuture.Result. -func (future *NotebookWorkspacesCreateOrUpdateFuture) result(client NotebookWorkspacesClient) (nw NotebookWorkspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nw.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nw.Response.Response, err = future.GetResult(sender); err == nil && nw.Response.Response.StatusCode != http.StatusNoContent { - nw, err = client.CreateOrUpdateResponder(nw.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", nw.Response.Response, "Failure responding to request") - } - } - return -} - -// NotebookWorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesDeleteFuture) 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 NotebookWorkspacesDeleteFuture.Result. -func (future *NotebookWorkspacesDeleteFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesRegenerateAuthTokenFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type NotebookWorkspacesRegenerateAuthTokenFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) 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 NotebookWorkspacesRegenerateAuthTokenFuture.Result. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesRegenerateAuthTokenFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesRegenerateAuthTokenFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NotebookWorkspacesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesStartFuture) 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 NotebookWorkspacesStartFuture.Result. -func (future *NotebookWorkspacesStartFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// Operation 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.ResourceProvider - 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"` - // Description - Description of operation - Description *string `json:"Description,omitempty"` -} - -// OperationListResult 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 OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the 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, - } -} - -// OptionsResource cosmos DB options resource object -type OptionsResource struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// PartitionMetric the metric values for a single partition. -type PartitionMetric struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the metric values. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the metric values. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetric. -func (pm PartitionMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PartitionMetricListResult the response to a list partition metrics request. -type PartitionMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level metrics for the account. - Value *[]PartitionMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetricListResult. -func (pmlr PartitionMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PartitionUsage the partition level usage data for a usage request. -type PartitionUsage struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the usages. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the usages. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsage. -func (pu PartitionUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pu.Unit != "" { - objectMap["unit"] = pu.Unit - } - return json.Marshal(objectMap) -} - -// PartitionUsagesResult the response to a list partition level usage request. -type PartitionUsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level usages for the database. A usage is a point in time metric - Value *[]PartitionUsage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsagesResult. -func (pur PartitionUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetric percentile Metric data -type PercentileMetric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The percentile metric values for the specified time window and timestep. - MetricValues *[]PercentileMetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetric. -func (pm PercentileMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PercentileMetricListResult the response to a list percentile metrics request. -type PercentileMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of percentile metrics for the account. - Value *[]PercentileMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricListResult. -func (pmlr PercentileMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetricValue represents percentile metrics values. -type PercentileMetricValue struct { - // P10 - READ-ONLY; The 10th percentile value for the metric. - P10 *float64 `json:"P10,omitempty"` - // P25 - READ-ONLY; The 25th percentile value for the metric. - P25 *float64 `json:"P25,omitempty"` - // P50 - READ-ONLY; The 50th percentile value for the metric. - P50 *float64 `json:"P50,omitempty"` - // P75 - READ-ONLY; The 75th percentile value for the metric. - P75 *float64 `json:"P75,omitempty"` - // P90 - READ-ONLY; The 90th percentile value for the metric. - P90 *float64 `json:"P90,omitempty"` - // P95 - READ-ONLY; The 95th percentile value for the metric. - P95 *float64 `json:"P95,omitempty"` - // P99 - READ-ONLY; The 99th percentile value for the metric. - P99 *float64 `json:"P99,omitempty"` - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricValue. -func (pmv PercentileMetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PeriodicModeBackupPolicy the object representing periodic mode backup policy. -type PeriodicModeBackupPolicy struct { - // PeriodicModeProperties - Configuration values for periodic mode backup - PeriodicModeProperties *PeriodicModeProperties `json:"periodicModeProperties,omitempty"` - // Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) MarshalJSON() ([]byte, error) { - pmbp.Type = TypePeriodic - objectMap := make(map[string]interface{}) - if pmbp.PeriodicModeProperties != nil { - objectMap["periodicModeProperties"] = pmbp.PeriodicModeProperties - } - if pmbp.Type != "" { - objectMap["type"] = pmbp.Type - } - return json.Marshal(objectMap) -} - -// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) { - return &pmbp, true -} - -// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) { - return nil, false -} - -// AsBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return nil, false -} - -// AsBasicBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) { - return &pmbp, true -} - -// PeriodicModeProperties configuration values for periodic mode backup -type PeriodicModeProperties struct { - // BackupIntervalInMinutes - An integer representing the interval in minutes between two backups - BackupIntervalInMinutes *int32 `json:"backupIntervalInMinutes,omitempty"` - // BackupRetentionIntervalInHours - An integer representing the time (in hours) that each backup is retained - BackupRetentionIntervalInHours *int32 `json:"backupRetentionIntervalInHours,omitempty"` -} - -// Permission the set of data plane operations permitted through this Role Definition. -type Permission struct { - // DataActions - An array of data actions that are allowed. - DataActions *[]string `json:"dataActions,omitempty"` - // NotDataActions - An array of data actions that are denied. - NotDataActions *[]string `json:"notDataActions,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // GroupID - Group id of the private endpoint. - GroupID *string `json:"groupId,omitempty"` - // ProvisioningState - Provisioning state of the private endpoint. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource required zone names. - 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) -} - -// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) - ActionsRequired *string `json:"actionsRequired,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// 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) -} - -// RegionForOnlineOffline cosmos DB region to online or offline. -type RegionForOnlineOffline struct { - // Region - Cosmos DB region, with spaces between words and each word capitalized. - Region *string `json:"region,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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableDatabaseAccountGetResult a Azure Cosmos DB restorable database account. -type RestorableDatabaseAccountGetResult struct { - autorest.Response `json:"-"` - // RestorableDatabaseAccountProperties - The properties of a restorable database account. - *RestorableDatabaseAccountProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDatabaseAccountGetResult. -func (rdagr RestorableDatabaseAccountGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdagr.RestorableDatabaseAccountProperties != nil { - objectMap["properties"] = rdagr.RestorableDatabaseAccountProperties - } - if rdagr.Location != nil { - objectMap["location"] = rdagr.Location - } - if rdagr.Tags != nil { - objectMap["tags"] = rdagr.Tags - } - if rdagr.Identity != nil { - objectMap["identity"] = rdagr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableDatabaseAccountGetResult struct. -func (rdagr *RestorableDatabaseAccountGetResult) 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 restorableDatabaseAccountProperties RestorableDatabaseAccountProperties - err = json.Unmarshal(*v, &restorableDatabaseAccountProperties) - if err != nil { - return err - } - rdagr.RestorableDatabaseAccountProperties = &restorableDatabaseAccountProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rdagr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rdagr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rdagr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rdagr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rdagr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rdagr.Identity = &identity - } - } - } - - return nil -} - -// RestorableDatabaseAccountProperties the properties of a restorable database account. -type RestorableDatabaseAccountProperties struct { - // AccountName - The name of the global database account - AccountName *string `json:"accountName,omitempty"` - // CreationTime - The creation time of the restorable database account (ISO-8601 format). - CreationTime *date.Time `json:"creationTime,omitempty"` - // DeletionTime - The time at which the restorable database account has been deleted (ISO-8601 format). - DeletionTime *date.Time `json:"deletionTime,omitempty"` - // APIType - READ-ONLY; The API type of the restorable database account. Possible values include: 'MongoDB', 'Gremlin', 'Cassandra', 'Table', 'SQL', 'GremlinV2' - APIType APIType `json:"apiType,omitempty"` - // RestorableLocations - READ-ONLY; List of regions where the of the database account can be restored from. - RestorableLocations *[]RestorableLocationResource `json:"restorableLocations,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDatabaseAccountProperties. -func (rdap RestorableDatabaseAccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdap.AccountName != nil { - objectMap["accountName"] = rdap.AccountName - } - if rdap.CreationTime != nil { - objectMap["creationTime"] = rdap.CreationTime - } - if rdap.DeletionTime != nil { - objectMap["deletionTime"] = rdap.DeletionTime - } - return json.Marshal(objectMap) -} - -// RestorableDatabaseAccountsListResult the List operation response, that contains the restorable database -// accounts and their properties. -type RestorableDatabaseAccountsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable database accounts and their properties. - Value *[]RestorableDatabaseAccountGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDatabaseAccountsListResult. -func (rdalr RestorableDatabaseAccountsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableLocationResource properties of the regional restorable account. -type RestorableLocationResource struct { - // LocationName - READ-ONLY; The location of the regional restorable account. - LocationName *string `json:"locationName,omitempty"` - // RegionalDatabaseAccountInstanceID - READ-ONLY; The instance id of the regional restorable account. - RegionalDatabaseAccountInstanceID *string `json:"regionalDatabaseAccountInstanceId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the regional restorable database account (ISO-8601 format). - CreationTime *date.Time `json:"creationTime,omitempty"` - // DeletionTime - READ-ONLY; The time at which the regional restorable database account has been deleted (ISO-8601 format). - DeletionTime *date.Time `json:"deletionTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableLocationResource. -func (rlr RestorableLocationResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbCollectionGetResult an Azure Cosmos DB restorable MongoDB collection -type RestorableMongodbCollectionGetResult struct { - // RestorableMongodbCollectionProperties - The properties of a restorable MongoDB collection. - *RestorableMongodbCollectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbCollectionGetResult. -func (rmcgr RestorableMongodbCollectionGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmcgr.RestorableMongodbCollectionProperties != nil { - objectMap["properties"] = rmcgr.RestorableMongodbCollectionProperties - } - if rmcgr.Location != nil { - objectMap["location"] = rmcgr.Location - } - if rmcgr.Tags != nil { - objectMap["tags"] = rmcgr.Tags - } - if rmcgr.Identity != nil { - objectMap["identity"] = rmcgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableMongodbCollectionGetResult struct. -func (rmcgr *RestorableMongodbCollectionGetResult) 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 restorableMongodbCollectionProperties RestorableMongodbCollectionProperties - err = json.Unmarshal(*v, &restorableMongodbCollectionProperties) - if err != nil { - return err - } - rmcgr.RestorableMongodbCollectionProperties = &restorableMongodbCollectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rmcgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rmcgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rmcgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rmcgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rmcgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rmcgr.Identity = &identity - } - } - } - - return nil -} - -// RestorableMongodbCollectionProperties the properties of an Azure Cosmos DB restorable MongoDB collection -type RestorableMongodbCollectionProperties struct { - Resource *RestorableMongodbCollectionPropertiesResource `json:"resource,omitempty"` -} - -// RestorableMongodbCollectionPropertiesResource ... -type RestorableMongodbCollectionPropertiesResource struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // OperationType - READ-ONLY; The operation type of this collection event. Possible values include: 'Create', 'Replace', 'Delete', 'SystemOperation' - OperationType OperationType `json:"operationType,omitempty"` - // EventTimestamp - READ-ONLY; The timestamp of this collection event. - EventTimestamp *string `json:"eventTimestamp,omitempty"` - // OwnerID - READ-ONLY; The name of this restorable MongoDB collection. - OwnerID *string `json:"ownerId,omitempty"` - // OwnerResourceID - READ-ONLY; The resource Id of this restorable MongoDB collection. - OwnerResourceID *string `json:"ownerResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbCollectionPropertiesResource. -func (rmcp RestorableMongodbCollectionPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbCollectionsListResult the List operation response, that contains the restorable MongoDB -// collections and their properties. -type RestorableMongodbCollectionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable MongoDB collections and their properties. - Value *[]RestorableMongodbCollectionGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbCollectionsListResult. -func (rmclr RestorableMongodbCollectionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbDatabaseGetResult an Azure Cosmos DB restorable MongoDB database -type RestorableMongodbDatabaseGetResult struct { - // RestorableMongodbDatabaseProperties - The properties of a restorable MongoDB database. - *RestorableMongodbDatabaseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbDatabaseGetResult. -func (rmdgr RestorableMongodbDatabaseGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmdgr.RestorableMongodbDatabaseProperties != nil { - objectMap["properties"] = rmdgr.RestorableMongodbDatabaseProperties - } - if rmdgr.Location != nil { - objectMap["location"] = rmdgr.Location - } - if rmdgr.Tags != nil { - objectMap["tags"] = rmdgr.Tags - } - if rmdgr.Identity != nil { - objectMap["identity"] = rmdgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableMongodbDatabaseGetResult struct. -func (rmdgr *RestorableMongodbDatabaseGetResult) 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 restorableMongodbDatabaseProperties RestorableMongodbDatabaseProperties - err = json.Unmarshal(*v, &restorableMongodbDatabaseProperties) - if err != nil { - return err - } - rmdgr.RestorableMongodbDatabaseProperties = &restorableMongodbDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rmdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rmdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rmdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rmdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rmdgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rmdgr.Identity = &identity - } - } - } - - return nil -} - -// RestorableMongodbDatabaseProperties the properties of an Azure Cosmos DB restorable MongoDB database -type RestorableMongodbDatabaseProperties struct { - Resource *RestorableMongodbDatabasePropertiesResource `json:"resource,omitempty"` -} - -// RestorableMongodbDatabasePropertiesResource ... -type RestorableMongodbDatabasePropertiesResource struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // OperationType - READ-ONLY; The operation type of this database event. Possible values include: 'Create', 'Replace', 'Delete', 'SystemOperation' - OperationType OperationType `json:"operationType,omitempty"` - // EventTimestamp - READ-ONLY; The timestamp of this database event. - EventTimestamp *string `json:"eventTimestamp,omitempty"` - // OwnerID - READ-ONLY; The name of this restorable MongoDB database. - OwnerID *string `json:"ownerId,omitempty"` - // OwnerResourceID - READ-ONLY; The resource Id of this restorable MongoDB database. - OwnerResourceID *string `json:"ownerResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbDatabasePropertiesResource. -func (rmdp RestorableMongodbDatabasePropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbDatabasesListResult the List operation response, that contains the restorable MongoDB -// databases and their properties. -type RestorableMongodbDatabasesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable MongoDB databases and their properties. - Value *[]RestorableMongodbDatabaseGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbDatabasesListResult. -func (rmdlr RestorableMongodbDatabasesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbResourcesListResult the List operation response, that contains the restorable MongoDB -// resources. -type RestorableMongodbResourcesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable MongoDB resources, including the database and collection names. - Value *[]DatabaseRestoreResource `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbResourcesListResult. -func (rmrlr RestorableMongodbResourcesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableSQLContainerGetResult an Azure Cosmos DB restorable SQL container -type RestorableSQLContainerGetResult struct { - // RestorableSQLContainerProperties - The properties of a restorable SQL container. - *RestorableSQLContainerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLContainerGetResult. -func (rscgr RestorableSQLContainerGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rscgr.RestorableSQLContainerProperties != nil { - objectMap["properties"] = rscgr.RestorableSQLContainerProperties - } - if rscgr.Location != nil { - objectMap["location"] = rscgr.Location - } - if rscgr.Tags != nil { - objectMap["tags"] = rscgr.Tags - } - if rscgr.Identity != nil { - objectMap["identity"] = rscgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableSQLContainerGetResult struct. -func (rscgr *RestorableSQLContainerGetResult) 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 restorableSQLContainerProperties RestorableSQLContainerProperties - err = json.Unmarshal(*v, &restorableSQLContainerProperties) - if err != nil { - return err - } - rscgr.RestorableSQLContainerProperties = &restorableSQLContainerProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rscgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rscgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rscgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rscgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rscgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rscgr.Identity = &identity - } - } - } - - return nil -} - -// RestorableSQLContainerProperties the properties of an Azure Cosmos DB restorable SQL container -type RestorableSQLContainerProperties struct { - Resource *RestorableSQLContainerPropertiesResource `json:"resource,omitempty"` -} - -// RestorableSQLContainerPropertiesResource ... -type RestorableSQLContainerPropertiesResource struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // OperationType - READ-ONLY; The operation type of this container event. Possible values include: 'Create', 'Replace', 'Delete', 'SystemOperation' - OperationType OperationType `json:"operationType,omitempty"` - // EventTimestamp - READ-ONLY; The timestamp of this container event. - EventTimestamp *string `json:"eventTimestamp,omitempty"` - // OwnerID - READ-ONLY; The name of this restorable SQL container. - OwnerID *string `json:"ownerId,omitempty"` - // OwnerResourceID - READ-ONLY; The resource Id of this restorable SQL container. - OwnerResourceID *string `json:"ownerResourceId,omitempty"` - Container *RestorableSQLContainerPropertiesResourceContainer `json:"container,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLContainerPropertiesResource. -func (rscp RestorableSQLContainerPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rscp.Container != nil { - objectMap["container"] = rscp.Container - } - return json.Marshal(objectMap) -} - -// RestorableSQLContainerPropertiesResourceContainer ... -type RestorableSQLContainerPropertiesResourceContainer struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Self - READ-ONLY; A system generated property that specifies the addressable path of the container resource. - Self *string `json:"_self,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLContainerPropertiesResourceContainer. -func (rscp RestorableSQLContainerPropertiesResourceContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rscp.ID != nil { - objectMap["id"] = rscp.ID - } - if rscp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = rscp.IndexingPolicy - } - if rscp.PartitionKey != nil { - objectMap["partitionKey"] = rscp.PartitionKey - } - if rscp.DefaultTTL != nil { - objectMap["defaultTtl"] = rscp.DefaultTTL - } - if rscp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = rscp.UniqueKeyPolicy - } - if rscp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = rscp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// RestorableSQLContainersListResult the List operation response, that contains the restorable SQL -// containers and their properties. -type RestorableSQLContainersListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable SQL containers and their properties. - Value *[]RestorableSQLContainerGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLContainersListResult. -func (rsclr RestorableSQLContainersListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableSQLDatabaseGetResult an Azure Cosmos DB restorable SQL database -type RestorableSQLDatabaseGetResult struct { - // RestorableSQLDatabaseProperties - The properties of a restorable SQL database. - *RestorableSQLDatabaseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLDatabaseGetResult. -func (rsdgr RestorableSQLDatabaseGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsdgr.RestorableSQLDatabaseProperties != nil { - objectMap["properties"] = rsdgr.RestorableSQLDatabaseProperties - } - if rsdgr.Location != nil { - objectMap["location"] = rsdgr.Location - } - if rsdgr.Tags != nil { - objectMap["tags"] = rsdgr.Tags - } - if rsdgr.Identity != nil { - objectMap["identity"] = rsdgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableSQLDatabaseGetResult struct. -func (rsdgr *RestorableSQLDatabaseGetResult) 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 restorableSQLDatabaseProperties RestorableSQLDatabaseProperties - err = json.Unmarshal(*v, &restorableSQLDatabaseProperties) - if err != nil { - return err - } - rsdgr.RestorableSQLDatabaseProperties = &restorableSQLDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rsdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rsdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rsdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rsdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rsdgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rsdgr.Identity = &identity - } - } - } - - return nil -} - -// RestorableSQLDatabaseProperties the properties of an Azure Cosmos DB restorable SQL database -type RestorableSQLDatabaseProperties struct { - Resource *RestorableSQLDatabasePropertiesResource `json:"resource,omitempty"` -} - -// RestorableSQLDatabasePropertiesResource ... -type RestorableSQLDatabasePropertiesResource struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // OperationType - READ-ONLY; The operation type of this database event. Possible values include: 'Create', 'Replace', 'Delete', 'SystemOperation' - OperationType OperationType `json:"operationType,omitempty"` - // EventTimestamp - READ-ONLY; The timestamp of this database event. - EventTimestamp *string `json:"eventTimestamp,omitempty"` - // OwnerID - READ-ONLY; The name of this restorable SQL database. - OwnerID *string `json:"ownerId,omitempty"` - // OwnerResourceID - READ-ONLY; The resource Id of this restorable SQL database. - OwnerResourceID *string `json:"ownerResourceId,omitempty"` - Database *RestorableSQLDatabasePropertiesResourceDatabase `json:"database,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLDatabasePropertiesResource. -func (rsdp RestorableSQLDatabasePropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsdp.Database != nil { - objectMap["database"] = rsdp.Database - } - return json.Marshal(objectMap) -} - -// RestorableSQLDatabasePropertiesResourceDatabase ... -type RestorableSQLDatabasePropertiesResourceDatabase struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Colls - READ-ONLY; A system generated property that specified the addressable path of the collections resource. - Colls *string `json:"_colls,omitempty"` - // Users - READ-ONLY; A system generated property that specifies the addressable path of the users resource. - Users *string `json:"_users,omitempty"` - // Self - READ-ONLY; A system generated property that specifies the addressable path of the database resource. - Self *string `json:"_self,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLDatabasePropertiesResourceDatabase. -func (rsdp RestorableSQLDatabasePropertiesResourceDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsdp.ID != nil { - objectMap["id"] = rsdp.ID - } - return json.Marshal(objectMap) -} - -// RestorableSQLDatabasesListResult the List operation response, that contains the restorable SQL databases -// and their properties. -type RestorableSQLDatabasesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable SQL databases and their properties. - Value *[]RestorableSQLDatabaseGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLDatabasesListResult. -func (rsdlr RestorableSQLDatabasesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableSQLResourcesListResult the List operation response, that contains the restorable SQL -// resources. -type RestorableSQLResourcesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable SQL resources, including the database and collection names. - Value *[]DatabaseRestoreResource `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLResourcesListResult. -func (rsrlr RestorableSQLResourcesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestoreParameters parameters to indicate the information about the restore. -type RestoreParameters struct { - // RestoreMode - Describes the mode of the restore. Possible values include: 'PointInTime' - RestoreMode RestoreMode `json:"restoreMode,omitempty"` - // RestoreSource - The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} - RestoreSource *string `json:"restoreSource,omitempty"` - // RestoreTimestampInUtc - Time to which the account has to be restored (ISO-8601 format). - RestoreTimestampInUtc *date.Time `json:"restoreTimestampInUtc,omitempty"` - // DatabasesToRestore - List of specific databases available for restore. - DatabasesToRestore *[]DatabaseRestoreResource `json:"databasesToRestore,omitempty"` -} - -// RestoreReqeustDatabaseAccountCreateUpdateProperties properties to restore Azure Cosmos DB database -// account. -type RestoreReqeustDatabaseAccountCreateUpdateProperties struct { - // RestoreParameters - Parameters to indicate the information about the restore. - RestoreParameters *RestoreParameters `json:"restoreParameters,omitempty"` - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` - // CreateMode - Possible values include: 'CreateModeDatabaseAccountCreateUpdateProperties', 'CreateModeDefault', 'CreateModeRestore' - CreateMode CreateModeBasicDatabaseAccountCreateUpdateProperties `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { - rrdacup.CreateMode = CreateModeRestore - objectMap := make(map[string]interface{}) - if rrdacup.RestoreParameters != nil { - objectMap["restoreParameters"] = rrdacup.RestoreParameters - } - if rrdacup.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = rrdacup.ConsistencyPolicy - } - if rrdacup.Locations != nil { - objectMap["locations"] = rrdacup.Locations - } - if rrdacup.DatabaseAccountOfferType != nil { - objectMap["databaseAccountOfferType"] = rrdacup.DatabaseAccountOfferType - } - if rrdacup.IPRules != nil { - objectMap["ipRules"] = rrdacup.IPRules - } - if rrdacup.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = rrdacup.IsVirtualNetworkFilterEnabled - } - if rrdacup.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = rrdacup.EnableAutomaticFailover - } - if rrdacup.Capabilities != nil { - objectMap["capabilities"] = rrdacup.Capabilities - } - if rrdacup.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = rrdacup.VirtualNetworkRules - } - if rrdacup.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = rrdacup.EnableMultipleWriteLocations - } - if rrdacup.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = rrdacup.EnableCassandraConnector - } - if rrdacup.ConnectorOffer != "" { - objectMap["connectorOffer"] = rrdacup.ConnectorOffer - } - if rrdacup.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = rrdacup.DisableKeyBasedMetadataWriteAccess - } - if rrdacup.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = rrdacup.KeyVaultKeyURI - } - if rrdacup.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = rrdacup.PublicNetworkAccess - } - if rrdacup.EnableFreeTier != nil { - objectMap["enableFreeTier"] = rrdacup.EnableFreeTier - } - if rrdacup.APIProperties != nil { - objectMap["apiProperties"] = rrdacup.APIProperties - } - if rrdacup.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = rrdacup.EnableAnalyticalStorage - } - objectMap["backupPolicy"] = rrdacup.BackupPolicy - if rrdacup.Cors != nil { - objectMap["cors"] = rrdacup.Cors - } - if rrdacup.CreateMode != "" { - objectMap["createMode"] = rrdacup.CreateMode - } - return json.Marshal(objectMap) -} - -// AsDefaultRequestDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) AsDefaultRequestDatabaseAccountCreateUpdateProperties() (*DefaultRequestDatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsRestoreReqeustDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) AsRestoreReqeustDatabaseAccountCreateUpdateProperties() (*RestoreReqeustDatabaseAccountCreateUpdateProperties, bool) { - return &rrdacup, true -} - -// AsDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) AsDatabaseAccountCreateUpdateProperties() (*DatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsBasicDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) AsBasicDatabaseAccountCreateUpdateProperties() (BasicDatabaseAccountCreateUpdateProperties, bool) { - return &rrdacup, true -} - -// UnmarshalJSON is the custom unmarshaler for RestoreReqeustDatabaseAccountCreateUpdateProperties struct. -func (rrdacup *RestoreReqeustDatabaseAccountCreateUpdateProperties) 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 "restoreParameters": - if v != nil { - var restoreParameters RestoreParameters - err = json.Unmarshal(*v, &restoreParameters) - if err != nil { - return err - } - rrdacup.RestoreParameters = &restoreParameters - } - case "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - rrdacup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - rrdacup.Locations = &locations - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType string - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - rrdacup.DatabaseAccountOfferType = &databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - rrdacup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - rrdacup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - rrdacup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - rrdacup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - rrdacup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - rrdacup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - rrdacup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - rrdacup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - rrdacup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - rrdacup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - rrdacup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - rrdacup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - rrdacup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - rrdacup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - rrdacup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - rrdacup.Cors = &cors - } - case "createMode": - if v != nil { - var createMode CreateModeBasicDatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &createMode) - if err != nil { - return err - } - rrdacup.CreateMode = createMode - } - } - } - - return nil -} - -// SpatialSpec ... -type SpatialSpec struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Types - List of path's spatial type - Types *[]SpatialType `json:"types,omitempty"` -} - -// SQLContainerCreateUpdateParameters parameters to create and update Cosmos DB container. -type SQLContainerCreateUpdateParameters struct { - // SQLContainerCreateUpdateProperties - Properties to create and update Azure Cosmos DB container. - *SQLContainerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerCreateUpdateParameters. -func (sccup SQLContainerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccup.SQLContainerCreateUpdateProperties != nil { - objectMap["properties"] = sccup.SQLContainerCreateUpdateProperties - } - if sccup.Location != nil { - objectMap["location"] = sccup.Location - } - if sccup.Tags != nil { - objectMap["tags"] = sccup.Tags - } - if sccup.Identity != nil { - objectMap["identity"] = sccup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerCreateUpdateParameters struct. -func (sccup *SQLContainerCreateUpdateParameters) 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 SQLContainerCreateUpdateProperties SQLContainerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLContainerCreateUpdateProperties) - if err != nil { - return err - } - sccup.SQLContainerCreateUpdateProperties = &SQLContainerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sccup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sccup.Identity = &identity - } - } - } - - return nil -} - -// SQLContainerCreateUpdateProperties properties to create and update Azure Cosmos DB container. -type SQLContainerCreateUpdateProperties struct { - // Resource - The standard JSON format of a container - Resource *SQLContainerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLContainerGetProperties the properties of an Azure Cosmos DB container -type SQLContainerGetProperties struct { - Resource *SQLContainerGetPropertiesResource `json:"resource,omitempty"` - Options *SQLContainerGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLContainerGetPropertiesOptions ... -type SQLContainerGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// SQLContainerGetPropertiesResource ... -type SQLContainerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetPropertiesResource. -func (scgp SQLContainerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgp.ID != nil { - objectMap["id"] = scgp.ID - } - if scgp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = scgp.IndexingPolicy - } - if scgp.PartitionKey != nil { - objectMap["partitionKey"] = scgp.PartitionKey - } - if scgp.DefaultTTL != nil { - objectMap["defaultTtl"] = scgp.DefaultTTL - } - if scgp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = scgp.UniqueKeyPolicy - } - if scgp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = scgp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// SQLContainerGetResults an Azure Cosmos DB container. -type SQLContainerGetResults struct { - autorest.Response `json:"-"` - // SQLContainerGetProperties - The properties of an Azure Cosmos DB container - *SQLContainerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetResults. -func (scgr SQLContainerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgr.SQLContainerGetProperties != nil { - objectMap["properties"] = scgr.SQLContainerGetProperties - } - if scgr.Location != nil { - objectMap["location"] = scgr.Location - } - if scgr.Tags != nil { - objectMap["tags"] = scgr.Tags - } - if scgr.Identity != nil { - objectMap["identity"] = scgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerGetResults struct. -func (scgr *SQLContainerGetResults) 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 SQLContainerGetProperties SQLContainerGetProperties - err = json.Unmarshal(*v, &SQLContainerGetProperties) - if err != nil { - return err - } - scgr.SQLContainerGetProperties = &SQLContainerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - scgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - scgr.Identity = &identity - } - } - } - - return nil -} - -// SQLContainerListResult the List operation response, that contains the containers and their properties. -type SQLContainerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of containers and their properties. - Value *[]SQLContainerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerListResult. -func (sclr SQLContainerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLContainerResource cosmos DB SQL container resource object -type SQLContainerResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// SQLDatabaseCreateUpdateParameters parameters to create and update Cosmos DB SQL database. -type SQLDatabaseCreateUpdateParameters struct { - // SQLDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB SQL database. - *SQLDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseCreateUpdateParameters. -func (sdcup SQLDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdcup.SQLDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = sdcup.SQLDatabaseCreateUpdateProperties - } - if sdcup.Location != nil { - objectMap["location"] = sdcup.Location - } - if sdcup.Tags != nil { - objectMap["tags"] = sdcup.Tags - } - if sdcup.Identity != nil { - objectMap["identity"] = sdcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseCreateUpdateParameters struct. -func (sdcup *SQLDatabaseCreateUpdateParameters) 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 SQLDatabaseCreateUpdateProperties SQLDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &SQLDatabaseCreateUpdateProperties) - if err != nil { - return err - } - sdcup.SQLDatabaseCreateUpdateProperties = &SQLDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sdcup.Identity = &identity - } - } - } - - return nil -} - -// SQLDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB SQL database. -type SQLDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a SQL database - Resource *SQLDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type SQLDatabaseGetProperties struct { - Resource *SQLDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *SQLDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetPropertiesOptions ... -type SQLDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// SQLDatabaseGetPropertiesResource ... -type SQLDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Colls - A system generated property that specified the addressable path of the collections resource. - Colls *string `json:"_colls,omitempty"` - // Users - A system generated property that specifies the addressable path of the users resource. - Users *string `json:"_users,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetPropertiesResource. -func (sdgp SQLDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgp.ID != nil { - objectMap["id"] = sdgp.ID - } - if sdgp.Colls != nil { - objectMap["_colls"] = sdgp.Colls - } - if sdgp.Users != nil { - objectMap["_users"] = sdgp.Users - } - return json.Marshal(objectMap) -} - -// SQLDatabaseGetResults an Azure Cosmos DB SQL database. -type SQLDatabaseGetResults struct { - autorest.Response `json:"-"` - // SQLDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *SQLDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetResults. -func (sdgr SQLDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgr.SQLDatabaseGetProperties != nil { - objectMap["properties"] = sdgr.SQLDatabaseGetProperties - } - if sdgr.Location != nil { - objectMap["location"] = sdgr.Location - } - if sdgr.Tags != nil { - objectMap["tags"] = sdgr.Tags - } - if sdgr.Identity != nil { - objectMap["identity"] = sdgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseGetResults struct. -func (sdgr *SQLDatabaseGetResults) 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 SQLDatabaseGetProperties SQLDatabaseGetProperties - err = json.Unmarshal(*v, &SQLDatabaseGetProperties) - if err != nil { - return err - } - sdgr.SQLDatabaseGetProperties = &SQLDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sdgr.Identity = &identity - } - } - } - - return nil -} - -// SQLDatabaseListResult the List operation response, that contains the SQL databases and their properties. -type SQLDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of SQL databases and their properties. - Value *[]SQLDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseListResult. -func (sdlr SQLDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLDatabaseResource cosmos DB SQL database resource object -type SQLDatabaseResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` -} - -// SQLResourcesCreateUpdateSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLContainerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) 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 SQLResourcesCreateUpdateSQLContainerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) result(client SQLResourcesClient) (scgr SQLContainerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - scgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLContainerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if scgr.Response.Response, err = future.GetResult(sender); err == nil && scgr.Response.Response.StatusCode != http.StatusNoContent { - scgr, err = client.CreateUpdateSQLContainerResponder(scgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", scgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) 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 SQLResourcesCreateUpdateSQLDatabaseFuture.Result. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) result(client SQLResourcesClient) (sdgr SQLDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sdgr.Response.Response, err = future.GetResult(sender); err == nil && sdgr.Response.Response.StatusCode != http.StatusNoContent { - sdgr, err = client.CreateUpdateSQLDatabaseResponder(sdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", sdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLRoleAssignmentFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesCreateUpdateSQLRoleAssignmentFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLRoleAssignmentGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLRoleAssignmentFuture) 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 SQLResourcesCreateUpdateSQLRoleAssignmentFuture.Result. -func (future *SQLResourcesCreateUpdateSQLRoleAssignmentFuture) result(client SQLResourcesClient) (sragr SQLRoleAssignmentGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sragr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sragr.Response.Response, err = future.GetResult(sender); err == nil && sragr.Response.Response.StatusCode != http.StatusNoContent { - sragr, err = client.CreateUpdateSQLRoleAssignmentResponder(sragr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture", "Result", sragr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLRoleDefinitionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesCreateUpdateSQLRoleDefinitionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLRoleDefinitionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLRoleDefinitionFuture) 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 SQLResourcesCreateUpdateSQLRoleDefinitionFuture.Result. -func (future *SQLResourcesCreateUpdateSQLRoleDefinitionFuture) result(client SQLResourcesClient) (srdgr SQLRoleDefinitionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - srdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if srdgr.Response.Response, err = future.GetResult(sender); err == nil && srdgr.Response.Response.StatusCode != http.StatusNoContent { - srdgr, err = client.CreateUpdateSQLRoleDefinitionResponder(srdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture", "Result", srdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLStoredProcedureFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLStoredProcedureGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) 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 SQLResourcesCreateUpdateSQLStoredProcedureFuture.Result. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) result(client SQLResourcesClient) (sspgr SQLStoredProcedureGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sspgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sspgr.Response.Response, err = future.GetResult(sender); err == nil && sspgr.Response.Response.StatusCode != http.StatusNoContent { - sspgr, err = client.CreateUpdateSQLStoredProcedureResponder(sspgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", sspgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLTriggerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) 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 SQLResourcesCreateUpdateSQLTriggerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) result(client SQLResourcesClient) (stgr SQLTriggerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - stgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLTriggerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if stgr.Response.Response, err = future.GetResult(sender); err == nil && stgr.Response.Response.StatusCode != http.StatusNoContent { - stgr, err = client.CreateUpdateSQLTriggerResponder(stgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", stgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLUserDefinedFunctionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) 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 SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (sudfgr SQLUserDefinedFunctionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sudfgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sudfgr.Response.Response, err = future.GetResult(sender); err == nil && sudfgr.Response.Response.StatusCode != http.StatusNoContent { - sudfgr, err = client.CreateUpdateSQLUserDefinedFunctionResponder(sudfgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", sudfgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesDeleteSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLContainerFuture) 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 SQLResourcesDeleteSQLContainerFuture.Result. -func (future *SQLResourcesDeleteSQLContainerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLContainerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLDatabaseFuture) 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 SQLResourcesDeleteSQLDatabaseFuture.Result. -func (future *SQLResourcesDeleteSQLDatabaseFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLRoleAssignmentFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLRoleAssignmentFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLRoleAssignmentFuture) 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 SQLResourcesDeleteSQLRoleAssignmentFuture.Result. -func (future *SQLResourcesDeleteSQLRoleAssignmentFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLRoleAssignmentFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLRoleAssignmentFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLRoleDefinitionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLRoleDefinitionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLRoleDefinitionFuture) 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 SQLResourcesDeleteSQLRoleDefinitionFuture.Result. -func (future *SQLResourcesDeleteSQLRoleDefinitionFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLRoleDefinitionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLRoleDefinitionFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLStoredProcedureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) 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 SQLResourcesDeleteSQLStoredProcedureFuture.Result. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLStoredProcedureFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLTriggerFuture) 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 SQLResourcesDeleteSQLTriggerFuture.Result. -func (future *SQLResourcesDeleteSQLTriggerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLTriggerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesDeleteSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) 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 SQLResourcesDeleteSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesUpdateSQLContainerThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLContainerThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) 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 SQLResourcesUpdateSQLContainerThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLContainerThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLContainerThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLDatabaseThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) 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 SQLResourcesUpdateSQLDatabaseThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLRoleAssignmentCreateUpdateParameters parameters to create and update an Azure Cosmos DB SQL Role -// Assignment. -type SQLRoleAssignmentCreateUpdateParameters struct { - // SQLRoleAssignmentResource - Properties to create and update an Azure Cosmos DB SQL Role Assignment. - *SQLRoleAssignmentResource `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleAssignmentCreateUpdateParameters. -func (sracup SQLRoleAssignmentCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sracup.SQLRoleAssignmentResource != nil { - objectMap["properties"] = sracup.SQLRoleAssignmentResource - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLRoleAssignmentCreateUpdateParameters struct. -func (sracup *SQLRoleAssignmentCreateUpdateParameters) 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 SQLRoleAssignmentResource SQLRoleAssignmentResource - err = json.Unmarshal(*v, &SQLRoleAssignmentResource) - if err != nil { - return err - } - sracup.SQLRoleAssignmentResource = &SQLRoleAssignmentResource - } - } - } - - return nil -} - -// SQLRoleAssignmentGetResults an Azure Cosmos DB Role Assignment -type SQLRoleAssignmentGetResults struct { - autorest.Response `json:"-"` - // SQLRoleAssignmentResource - Properties related to the Role Assignment. - *SQLRoleAssignmentResource `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleAssignmentGetResults. -func (sragr SQLRoleAssignmentGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sragr.SQLRoleAssignmentResource != nil { - objectMap["properties"] = sragr.SQLRoleAssignmentResource - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLRoleAssignmentGetResults struct. -func (sragr *SQLRoleAssignmentGetResults) 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 SQLRoleAssignmentResource SQLRoleAssignmentResource - err = json.Unmarshal(*v, &SQLRoleAssignmentResource) - if err != nil { - return err - } - sragr.SQLRoleAssignmentResource = &SQLRoleAssignmentResource - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sragr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sragr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sragr.Type = &typeVar - } - } - } - - return nil -} - -// SQLRoleAssignmentListResult the relevant Role Assignments. -type SQLRoleAssignmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Role Assignments and their properties - Value *[]SQLRoleAssignmentGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleAssignmentListResult. -func (sralr SQLRoleAssignmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLRoleAssignmentResource azure Cosmos DB SQL Role Assignment resource object. -type SQLRoleAssignmentResource struct { - // RoleDefinitionID - The unique identifier for the associated Role Definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - // Scope - The data plane resource path for which access is being granted through this Role Assignment. - Scope *string `json:"scope,omitempty"` - // PrincipalID - The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription. - PrincipalID *string `json:"principalId,omitempty"` -} - -// SQLRoleDefinitionCreateUpdateParameters parameters to create and update an Azure Cosmos DB SQL Role -// Definition. -type SQLRoleDefinitionCreateUpdateParameters struct { - // SQLRoleDefinitionResource - Properties to create and update an Azure Cosmos DB SQL Role Definition. - *SQLRoleDefinitionResource `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleDefinitionCreateUpdateParameters. -func (srdcup SQLRoleDefinitionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srdcup.SQLRoleDefinitionResource != nil { - objectMap["properties"] = srdcup.SQLRoleDefinitionResource - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLRoleDefinitionCreateUpdateParameters struct. -func (srdcup *SQLRoleDefinitionCreateUpdateParameters) 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 SQLRoleDefinitionResource SQLRoleDefinitionResource - err = json.Unmarshal(*v, &SQLRoleDefinitionResource) - if err != nil { - return err - } - srdcup.SQLRoleDefinitionResource = &SQLRoleDefinitionResource - } - } - } - - return nil -} - -// SQLRoleDefinitionGetResults an Azure Cosmos DB SQL Role Definition. -type SQLRoleDefinitionGetResults struct { - autorest.Response `json:"-"` - // SQLRoleDefinitionResource - Properties related to the Role Definition. - *SQLRoleDefinitionResource `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleDefinitionGetResults. -func (srdgr SQLRoleDefinitionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srdgr.SQLRoleDefinitionResource != nil { - objectMap["properties"] = srdgr.SQLRoleDefinitionResource - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLRoleDefinitionGetResults struct. -func (srdgr *SQLRoleDefinitionGetResults) 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 SQLRoleDefinitionResource SQLRoleDefinitionResource - err = json.Unmarshal(*v, &SQLRoleDefinitionResource) - if err != nil { - return err - } - srdgr.SQLRoleDefinitionResource = &SQLRoleDefinitionResource - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - srdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - srdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - srdgr.Type = &typeVar - } - } - } - - return nil -} - -// SQLRoleDefinitionListResult the relevant Role Definitions. -type SQLRoleDefinitionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Role Definitions and their properties. - Value *[]SQLRoleDefinitionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleDefinitionListResult. -func (srdlr SQLRoleDefinitionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLRoleDefinitionResource azure Cosmos DB SQL Role Definition resource object. -type SQLRoleDefinitionResource struct { - // RoleName - A user-friendly name for the Role Definition. Must be unique for the database account. - RoleName *string `json:"roleName,omitempty"` - // Type - Indicates whether the Role Definition was built-in or user created. Possible values include: 'BuiltInRole', 'CustomRole' - Type RoleDefinitionType `json:"type,omitempty"` - // AssignableScopes - A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not exist. - AssignableScopes *[]string `json:"assignableScopes,omitempty"` - // Permissions - The set of operations allowed through this Role Definition. - Permissions *[]Permission `json:"permissions,omitempty"` -} - -// SQLStoredProcedureCreateUpdateParameters parameters to create and update Cosmos DB storedProcedure. -type SQLStoredProcedureCreateUpdateParameters struct { - // SQLStoredProcedureCreateUpdateProperties - Properties to create and update Azure Cosmos DB storedProcedure. - *SQLStoredProcedureCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureCreateUpdateParameters. -func (sspcup SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspcup.SQLStoredProcedureCreateUpdateProperties != nil { - objectMap["properties"] = sspcup.SQLStoredProcedureCreateUpdateProperties - } - if sspcup.Location != nil { - objectMap["location"] = sspcup.Location - } - if sspcup.Tags != nil { - objectMap["tags"] = sspcup.Tags - } - if sspcup.Identity != nil { - objectMap["identity"] = sspcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureCreateUpdateParameters struct. -func (sspcup *SQLStoredProcedureCreateUpdateParameters) 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 SQLStoredProcedureCreateUpdateProperties SQLStoredProcedureCreateUpdateProperties - err = json.Unmarshal(*v, &SQLStoredProcedureCreateUpdateProperties) - if err != nil { - return err - } - sspcup.SQLStoredProcedureCreateUpdateProperties = &SQLStoredProcedureCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sspcup.Identity = &identity - } - } - } - - return nil -} - -// SQLStoredProcedureCreateUpdateProperties properties to create and update Azure Cosmos DB -// storedProcedure. -type SQLStoredProcedureCreateUpdateProperties struct { - // Resource - The standard JSON format of a storedProcedure - Resource *SQLStoredProcedureResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLStoredProcedureGetProperties the properties of an Azure Cosmos DB StoredProcedure -type SQLStoredProcedureGetProperties struct { - Resource *SQLStoredProcedureGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLStoredProcedureGetPropertiesResource ... -type SQLStoredProcedureGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetPropertiesResource. -func (sspgp SQLStoredProcedureGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgp.ID != nil { - objectMap["id"] = sspgp.ID - } - if sspgp.Body != nil { - objectMap["body"] = sspgp.Body - } - return json.Marshal(objectMap) -} - -// SQLStoredProcedureGetResults an Azure Cosmos DB storedProcedure. -type SQLStoredProcedureGetResults struct { - autorest.Response `json:"-"` - // SQLStoredProcedureGetProperties - The properties of an Azure Cosmos DB storedProcedure - *SQLStoredProcedureGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetResults. -func (sspgr SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgr.SQLStoredProcedureGetProperties != nil { - objectMap["properties"] = sspgr.SQLStoredProcedureGetProperties - } - if sspgr.Location != nil { - objectMap["location"] = sspgr.Location - } - if sspgr.Tags != nil { - objectMap["tags"] = sspgr.Tags - } - if sspgr.Identity != nil { - objectMap["identity"] = sspgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureGetResults struct. -func (sspgr *SQLStoredProcedureGetResults) 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 SQLStoredProcedureGetProperties SQLStoredProcedureGetProperties - err = json.Unmarshal(*v, &SQLStoredProcedureGetProperties) - if err != nil { - return err - } - sspgr.SQLStoredProcedureGetProperties = &SQLStoredProcedureGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sspgr.Identity = &identity - } - } - } - - return nil -} - -// SQLStoredProcedureListResult the List operation response, that contains the storedProcedures and their -// properties. -type SQLStoredProcedureListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of storedProcedures and their properties. - Value *[]SQLStoredProcedureGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureListResult. -func (ssplr SQLStoredProcedureListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLStoredProcedureResource cosmos DB SQL storedProcedure resource object -type SQLStoredProcedureResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` -} - -// SQLTriggerCreateUpdateParameters parameters to create and update Cosmos DB trigger. -type SQLTriggerCreateUpdateParameters struct { - // SQLTriggerCreateUpdateProperties - Properties to create and update Azure Cosmos DB trigger. - *SQLTriggerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerCreateUpdateParameters. -func (stcup SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stcup.SQLTriggerCreateUpdateProperties != nil { - objectMap["properties"] = stcup.SQLTriggerCreateUpdateProperties - } - if stcup.Location != nil { - objectMap["location"] = stcup.Location - } - if stcup.Tags != nil { - objectMap["tags"] = stcup.Tags - } - if stcup.Identity != nil { - objectMap["identity"] = stcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerCreateUpdateParameters struct. -func (stcup *SQLTriggerCreateUpdateParameters) 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 SQLTriggerCreateUpdateProperties SQLTriggerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLTriggerCreateUpdateProperties) - if err != nil { - return err - } - stcup.SQLTriggerCreateUpdateProperties = &SQLTriggerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - stcup.Identity = &identity - } - } - } - - return nil -} - -// SQLTriggerCreateUpdateProperties properties to create and update Azure Cosmos DB trigger. -type SQLTriggerCreateUpdateProperties struct { - // Resource - The standard JSON format of a trigger - Resource *SQLTriggerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLTriggerGetProperties the properties of an Azure Cosmos DB trigger -type SQLTriggerGetProperties struct { - Resource *SQLTriggerGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLTriggerGetPropertiesResource ... -type SQLTriggerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'TriggerOperationAll', 'TriggerOperationCreate', 'TriggerOperationUpdate', 'TriggerOperationDelete', 'TriggerOperationReplace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetPropertiesResource. -func (stgp SQLTriggerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgp.ID != nil { - objectMap["id"] = stgp.ID - } - if stgp.Body != nil { - objectMap["body"] = stgp.Body - } - if stgp.TriggerType != "" { - objectMap["triggerType"] = stgp.TriggerType - } - if stgp.TriggerOperation != "" { - objectMap["triggerOperation"] = stgp.TriggerOperation - } - return json.Marshal(objectMap) -} - -// SQLTriggerGetResults an Azure Cosmos DB trigger. -type SQLTriggerGetResults struct { - autorest.Response `json:"-"` - // SQLTriggerGetProperties - The properties of an Azure Cosmos DB trigger - *SQLTriggerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetResults. -func (stgr SQLTriggerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgr.SQLTriggerGetProperties != nil { - objectMap["properties"] = stgr.SQLTriggerGetProperties - } - if stgr.Location != nil { - objectMap["location"] = stgr.Location - } - if stgr.Tags != nil { - objectMap["tags"] = stgr.Tags - } - if stgr.Identity != nil { - objectMap["identity"] = stgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerGetResults struct. -func (stgr *SQLTriggerGetResults) 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 SQLTriggerGetProperties SQLTriggerGetProperties - err = json.Unmarshal(*v, &SQLTriggerGetProperties) - if err != nil { - return err - } - stgr.SQLTriggerGetProperties = &SQLTriggerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - stgr.Identity = &identity - } - } - } - - return nil -} - -// SQLTriggerListResult the List operation response, that contains the triggers and their properties. -type SQLTriggerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of triggers and their properties. - Value *[]SQLTriggerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerListResult. -func (stlr SQLTriggerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLTriggerResource cosmos DB SQL trigger resource object -type SQLTriggerResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'TriggerOperationAll', 'TriggerOperationCreate', 'TriggerOperationUpdate', 'TriggerOperationDelete', 'TriggerOperationReplace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` -} - -// SQLUserDefinedFunctionCreateUpdateParameters parameters to create and update Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateParameters struct { - // SQLUserDefinedFunctionCreateUpdateProperties - Properties to create and update Azure Cosmos DB userDefinedFunction. - *SQLUserDefinedFunctionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionCreateUpdateParameters. -func (sudfcup SQLUserDefinedFunctionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfcup.SQLUserDefinedFunctionCreateUpdateProperties != nil { - objectMap["properties"] = sudfcup.SQLUserDefinedFunctionCreateUpdateProperties - } - if sudfcup.Location != nil { - objectMap["location"] = sudfcup.Location - } - if sudfcup.Tags != nil { - objectMap["tags"] = sudfcup.Tags - } - if sudfcup.Identity != nil { - objectMap["identity"] = sudfcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionCreateUpdateParameters struct. -func (sudfcup *SQLUserDefinedFunctionCreateUpdateParameters) 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 SQLUserDefinedFunctionCreateUpdateProperties SQLUserDefinedFunctionCreateUpdateProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionCreateUpdateProperties) - if err != nil { - return err - } - sudfcup.SQLUserDefinedFunctionCreateUpdateProperties = &SQLUserDefinedFunctionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sudfcup.Identity = &identity - } - } - } - - return nil -} - -// SQLUserDefinedFunctionCreateUpdateProperties properties to create and update Azure Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateProperties struct { - // Resource - The standard JSON format of a userDefinedFunction - Resource *SQLUserDefinedFunctionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLUserDefinedFunctionGetProperties the properties of an Azure Cosmos DB userDefinedFunction -type SQLUserDefinedFunctionGetProperties struct { - Resource *SQLUserDefinedFunctionGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLUserDefinedFunctionGetPropertiesResource ... -type SQLUserDefinedFunctionGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetPropertiesResource. -func (sudfgp SQLUserDefinedFunctionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgp.ID != nil { - objectMap["id"] = sudfgp.ID - } - if sudfgp.Body != nil { - objectMap["body"] = sudfgp.Body - } - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionGetResults an Azure Cosmos DB userDefinedFunction. -type SQLUserDefinedFunctionGetResults struct { - autorest.Response `json:"-"` - // SQLUserDefinedFunctionGetProperties - The properties of an Azure Cosmos DB userDefinedFunction - *SQLUserDefinedFunctionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetResults. -func (sudfgr SQLUserDefinedFunctionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgr.SQLUserDefinedFunctionGetProperties != nil { - objectMap["properties"] = sudfgr.SQLUserDefinedFunctionGetProperties - } - if sudfgr.Location != nil { - objectMap["location"] = sudfgr.Location - } - if sudfgr.Tags != nil { - objectMap["tags"] = sudfgr.Tags - } - if sudfgr.Identity != nil { - objectMap["identity"] = sudfgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionGetResults struct. -func (sudfgr *SQLUserDefinedFunctionGetResults) 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 SQLUserDefinedFunctionGetProperties SQLUserDefinedFunctionGetProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionGetProperties) - if err != nil { - return err - } - sudfgr.SQLUserDefinedFunctionGetProperties = &SQLUserDefinedFunctionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sudfgr.Identity = &identity - } - } - } - - return nil -} - -// SQLUserDefinedFunctionListResult the List operation response, that contains the userDefinedFunctions and -// their properties. -type SQLUserDefinedFunctionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of userDefinedFunctions and their properties. - Value *[]SQLUserDefinedFunctionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionListResult. -func (sudflr SQLUserDefinedFunctionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionResource cosmos DB SQL userDefinedFunction resource object -type SQLUserDefinedFunctionResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` -} - -// 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: 'User', 'Application', 'ManagedIdentity', 'Key' - 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: 'User', 'Application', 'ManagedIdentity', 'Key' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TableCreateUpdateParameters parameters to create and update Cosmos DB Table. -type TableCreateUpdateParameters struct { - // TableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Table. - *TableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableCreateUpdateParameters. -func (tcup TableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TableCreateUpdateProperties != nil { - objectMap["properties"] = tcup.TableCreateUpdateProperties - } - if tcup.Location != nil { - objectMap["location"] = tcup.Location - } - if tcup.Tags != nil { - objectMap["tags"] = tcup.Tags - } - if tcup.Identity != nil { - objectMap["identity"] = tcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableCreateUpdateParameters struct. -func (tcup *TableCreateUpdateParameters) 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 tableCreateUpdateProperties TableCreateUpdateProperties - err = json.Unmarshal(*v, &tableCreateUpdateProperties) - if err != nil { - return err - } - tcup.TableCreateUpdateProperties = &tableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tcup.Identity = &identity - } - } - } - - return nil -} - -// TableCreateUpdateProperties properties to create and update Azure Cosmos DB Table. -type TableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Table - Resource *TableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// TableGetProperties the properties of an Azure Cosmos Table -type TableGetProperties struct { - Resource *TableGetPropertiesResource `json:"resource,omitempty"` - Options *TableGetPropertiesOptions `json:"options,omitempty"` -} - -// TableGetPropertiesOptions ... -type TableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// TableGetPropertiesResource ... -type TableGetPropertiesResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableGetPropertiesResource. -func (tgp TableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgp.ID != nil { - objectMap["id"] = tgp.ID - } - return json.Marshal(objectMap) -} - -// TableGetResults an Azure Cosmos DB Table. -type TableGetResults struct { - autorest.Response `json:"-"` - // TableGetProperties - The properties of an Azure Cosmos DB Table - *TableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableGetResults. -func (tgr TableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgr.TableGetProperties != nil { - objectMap["properties"] = tgr.TableGetProperties - } - if tgr.Location != nil { - objectMap["location"] = tgr.Location - } - if tgr.Tags != nil { - objectMap["tags"] = tgr.Tags - } - if tgr.Identity != nil { - objectMap["identity"] = tgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableGetResults struct. -func (tgr *TableGetResults) 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 tableGetProperties TableGetProperties - err = json.Unmarshal(*v, &tableGetProperties) - if err != nil { - return err - } - tgr.TableGetProperties = &tableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tgr.Identity = &identity - } - } - } - - return nil -} - -// TableListResult the List operation response, that contains the Table and their properties. -type TableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Table and their properties. - Value *[]TableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableListResult. -func (tlr TableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TableResource cosmos DB table resource object -type TableResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` -} - -// TableResourcesCreateUpdateTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesCreateUpdateTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (TableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesCreateUpdateTableFuture) 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 TableResourcesCreateUpdateTableFuture.Result. -func (future *TableResourcesCreateUpdateTableFuture) result(client TableResourcesClient) (tgr TableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesCreateUpdateTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tgr.Response.Response, err = future.GetResult(sender); err == nil && tgr.Response.Response.StatusCode != http.StatusNoContent { - tgr, err = client.CreateUpdateTableResponder(tgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", tgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesDeleteTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesDeleteTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesDeleteTableFuture) 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 TableResourcesDeleteTableFuture.Result. -func (future *TableResourcesDeleteTableFuture) result(client TableResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesDeleteTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesDeleteTableFuture") - return - } - ar.Response = future.Response() - return -} - -// TableResourcesUpdateTableThroughputFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesUpdateTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesUpdateTableThroughputFuture) 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 TableResourcesUpdateTableThroughputFuture.Result. -func (future *TableResourcesUpdateTableThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesUpdateTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// ThroughputPolicyResource cosmos DB resource throughput policy -type ThroughputPolicyResource struct { - // IsEnabled - Determines whether the ThroughputPolicy is active or not - IsEnabled *bool `json:"isEnabled,omitempty"` - // IncrementPercent - Represents the percentage by which throughput can increase every time throughput policy kicks in. - IncrementPercent *int32 `json:"incrementPercent,omitempty"` -} - -// ThroughputSettingsGetProperties the properties of an Azure Cosmos DB resource throughput -type ThroughputSettingsGetProperties struct { - Resource *ThroughputSettingsGetPropertiesResource `json:"resource,omitempty"` -} - -// ThroughputSettingsGetPropertiesResource ... -type ThroughputSettingsGetPropertiesResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. - AutoscaleSettings *AutoscaleSettingsResource `json:"autoscaleSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts interface{} `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetPropertiesResource. -func (tsgp ThroughputSettingsGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgp.Throughput != nil { - objectMap["throughput"] = tsgp.Throughput - } - if tsgp.AutoscaleSettings != nil { - objectMap["autoscaleSettings"] = tsgp.AutoscaleSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsGetResults an Azure Cosmos DB resource throughput. -type ThroughputSettingsGetResults struct { - autorest.Response `json:"-"` - // ThroughputSettingsGetProperties - The properties of an Azure Cosmos DB resource throughput - *ThroughputSettingsGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetResults. -func (tsgr ThroughputSettingsGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgr.ThroughputSettingsGetProperties != nil { - objectMap["properties"] = tsgr.ThroughputSettingsGetProperties - } - if tsgr.Location != nil { - objectMap["location"] = tsgr.Location - } - if tsgr.Tags != nil { - objectMap["tags"] = tsgr.Tags - } - if tsgr.Identity != nil { - objectMap["identity"] = tsgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsGetResults struct. -func (tsgr *ThroughputSettingsGetResults) 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 throughputSettingsGetProperties ThroughputSettingsGetProperties - err = json.Unmarshal(*v, &throughputSettingsGetProperties) - if err != nil { - return err - } - tsgr.ThroughputSettingsGetProperties = &throughputSettingsGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tsgr.Identity = &identity - } - } - } - - return nil -} - -// ThroughputSettingsResource cosmos DB resource throughput object. Either throughput is required or -// autoscaleSettings is required, but not both. -type ThroughputSettingsResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. - AutoscaleSettings *AutoscaleSettingsResource `json:"autoscaleSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsResource. -func (tsr ThroughputSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsr.Throughput != nil { - objectMap["throughput"] = tsr.Throughput - } - if tsr.AutoscaleSettings != nil { - objectMap["autoscaleSettings"] = tsr.AutoscaleSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsUpdateParameters parameters to update Cosmos DB resource throughput. -type ThroughputSettingsUpdateParameters struct { - // ThroughputSettingsUpdateProperties - Properties to update Azure Cosmos DB resource throughput. - *ThroughputSettingsUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsUpdateParameters. -func (tsup ThroughputSettingsUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsup.ThroughputSettingsUpdateProperties != nil { - objectMap["properties"] = tsup.ThroughputSettingsUpdateProperties - } - if tsup.Location != nil { - objectMap["location"] = tsup.Location - } - if tsup.Tags != nil { - objectMap["tags"] = tsup.Tags - } - if tsup.Identity != nil { - objectMap["identity"] = tsup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsUpdateParameters struct. -func (tsup *ThroughputSettingsUpdateParameters) 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 throughputSettingsUpdateProperties ThroughputSettingsUpdateProperties - err = json.Unmarshal(*v, &throughputSettingsUpdateProperties) - if err != nil { - return err - } - tsup.ThroughputSettingsUpdateProperties = &throughputSettingsUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tsup.Identity = &identity - } - } - } - - return nil -} - -// ThroughputSettingsUpdateProperties properties to update Azure Cosmos DB resource throughput. -type ThroughputSettingsUpdateProperties struct { - // Resource - The standard JSON format of a resource throughput - Resource *ThroughputSettingsResource `json:"resource,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"` -} - -// 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) -} - -// UniqueKey the unique key on that enforces uniqueness constraint on documents in the collection in the -// Azure Cosmos DB service. -type UniqueKey struct { - // Paths - List of paths must be unique for each document in the Azure Cosmos DB service - Paths *[]string `json:"paths,omitempty"` -} - -// UniqueKeyPolicy the unique key policy configuration for specifying uniqueness constraints on documents -// in the collection in the Azure Cosmos DB service. -type UniqueKeyPolicy struct { - // UniqueKeys - List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - UniqueKeys *[]UniqueKey `json:"uniqueKeys,omitempty"` -} - -// Usage the usage data for a usage request. -type Usage struct { - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.Unit != "" { - objectMap["unit"] = u.Unit - } - return json.Marshal(objectMap) -} - -// UsagesResult the response to a list usage request. -type UsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of usages for the database. A usage is a point in time metric - Value *[]Usage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsagesResult. -func (ur UsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRule virtual Network ACL Rule object -type VirtualNetworkRule struct { - // ID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. - ID *string `json:"id,omitempty"` - // IgnoreMissingVNetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVNetServiceEndpoint *bool `json:"ignoreMissingVNetServiceEndpoint,omitempty"` -} diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/mongodbresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/mongodbresources.go deleted file mode 100644 index ef2421a5331a..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/mongodbresources.go +++ /dev/null @@ -1,1204 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// MongoDBResourcesClient is the client for the MongoDBResources methods of the Documentdb service. -type MongoDBResourcesClient struct { - BaseClient -} - -// NewMongoDBResourcesClient creates an instance of the MongoDBResourcesClient client. -func NewMongoDBResourcesClient(subscriptionID string) MongoDBResourcesClient { - return NewMongoDBResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMongoDBResourcesClientWithBaseURI creates an instance of the MongoDBResourcesClient 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 NewMongoDBResourcesClientWithBaseURI(baseURI string, subscriptionID string) MongoDBResourcesClient { - return MongoDBResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateMongoDBCollection create or update an Azure Cosmos DB MongoDB Collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// createUpdateMongoDBCollectionParameters - the parameters to provide for the current MongoDB Collection. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBCollectionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", err.Error()) - } - - req, err := client.CreateUpdateMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBCollectionPreparer prepares the CreateUpdateMongoDBCollection request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBCollectionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBCollectionSender sends the CreateUpdateMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBCollectionFuture, 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 -} - -// CreateUpdateMongoDBCollectionResponder handles the response to the CreateUpdateMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateMongoDBDatabase create or updates Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateMongoDBDatabaseParameters - the parameters to provide for the current MongoDB database. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", err.Error()) - } - - req, err := client.CreateUpdateMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBDatabasePreparer prepares the CreateUpdateMongoDBDatabase request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBDatabaseSender sends the CreateUpdateMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, 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 -} - -// CreateUpdateMongoDBDatabaseResponder handles the response to the CreateUpdateMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteMongoDBCollection deletes an existing Azure Cosmos DB MongoDB Collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesDeleteMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", err.Error()) - } - - req, err := client.DeleteMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBCollectionPreparer prepares the DeleteMongoDBCollection request. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBCollectionSender sends the DeleteMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBCollectionFuture, 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 -} - -// DeleteMongoDBCollectionResponder handles the response to the DeleteMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionResponder(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 -} - -// DeleteMongoDBDatabase deletes an existing Azure Cosmos DB MongoDB database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", err.Error()) - } - - req, err := client.DeleteMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBDatabasePreparer prepares the DeleteMongoDBDatabase request. -func (client MongoDBResourcesClient) DeleteMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBDatabaseSender sends the DeleteMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBDatabaseFuture, 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 -} - -// DeleteMongoDBDatabaseResponder handles the response to the DeleteMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseResponder(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 -} - -// GetMongoDBCollection gets the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBCollectionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollection") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollection", err.Error()) - } - - req, err := client.GetMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionPreparer prepares the GetMongoDBCollection request. -func (client MongoDBResourcesClient) GetMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionSender sends the GetMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionResponder handles the response to the GetMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBCollectionThroughput gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollectionThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.GetMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionThroughputPreparer prepares the GetMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionThroughputSender sends the GetMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionThroughputResponder handles the response to the GetMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabase gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", err.Error()) - } - - req, err := client.GetMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabasePreparer prepares the GetMongoDBDatabase request. -func (client MongoDBResourcesClient) GetMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseSender sends the GetMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseResponder handles the response to the GetMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabaseThroughput gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.GetMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabaseThroughputPreparer prepares the GetMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseThroughputSender sends the GetMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseThroughputResponder handles the response to the GetMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBCollections lists the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBCollectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBCollections") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBCollections", err.Error()) - } - - req, err := client.ListMongoDBCollectionsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBCollectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBCollectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBCollectionsPreparer prepares the ListMongoDBCollections request. -func (client MongoDBResourcesClient) ListMongoDBCollectionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBCollectionsSender sends the ListMongoDBCollections request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBCollectionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBCollectionsResponder handles the response to the ListMongoDBCollections request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBCollectionsResponder(resp *http.Response) (result MongoDBCollectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBDatabases lists the MongoDB databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client MongoDBResourcesClient) ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result MongoDBDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", err.Error()) - } - - req, err := client.ListMongoDBDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBDatabasesPreparer prepares the ListMongoDBDatabases request. -func (client MongoDBResourcesClient) ListMongoDBDatabasesPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBDatabasesSender sends the ListMongoDBDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBDatabasesResponder handles the response to the ListMongoDBDatabases request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBDatabasesResponder(resp *http.Response) (result MongoDBDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBCollectionThroughput update the RUs per second of an Azure Cosmos DB MongoDB collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// collection. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBCollectionThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBCollectionThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBCollectionThroughputPreparer prepares the UpdateMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBCollectionThroughputSender sends the UpdateMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, 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 -} - -// UpdateMongoDBCollectionThroughputResponder handles the response to the UpdateMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBDatabaseThroughput update RUs per second of the an Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// database. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBDatabaseThroughputPreparer prepares the UpdateMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBDatabaseThroughputSender sends the UpdateMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, 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 -} - -// UpdateMongoDBDatabaseThroughputResponder handles the response to the UpdateMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/notebookworkspaces.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/notebookworkspaces.go deleted file mode 100644 index cfa41642098e..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/notebookworkspaces.go +++ /dev/null @@ -1,681 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotebookWorkspacesClient is the client for the NotebookWorkspaces methods of the Documentdb service. -type NotebookWorkspacesClient struct { - BaseClient -} - -// NewNotebookWorkspacesClient creates an instance of the NotebookWorkspacesClient client. -func NewNotebookWorkspacesClient(subscriptionID string) NotebookWorkspacesClient { - return NewNotebookWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotebookWorkspacesClientWithBaseURI creates an instance of the NotebookWorkspacesClient 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 NewNotebookWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) NotebookWorkspacesClient { - return NotebookWorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// notebookCreateUpdateParameters - the notebook workspace to create for the current database account. -func (client NotebookWorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (result NotebookWorkspacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, notebookCreateUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotebookWorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", pathParameters), - autorest.WithJSON(notebookCreateUpdateParameters), - 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 NotebookWorkspacesClient) CreateOrUpdateSender(req *http.Request) (future NotebookWorkspacesCreateOrUpdateFuture, 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 NotebookWorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result NotebookWorkspace, 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 notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotebookWorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) DeleteSender(req *http.Request) (future NotebookWorkspacesDeleteFuture, 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 NotebookWorkspacesClient) 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 the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotebookWorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) 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 NotebookWorkspacesClient) GetResponder(resp *http.Response) (result NotebookWorkspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabaseAccount gets the notebook workspace resources of an existing Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client NotebookWorkspacesClient) ListByDatabaseAccountPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListByDatabaseAccountResponder(resp *http.Response) (result NotebookWorkspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionInfo retrieves the connection info for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceConnectionInfoResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListConnectionInfo") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListConnectionInfo", err.Error()) - } - - req, err := client.ListConnectionInfoPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionInfoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionInfoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionInfoPreparer prepares the ListConnectionInfo request. -func (client NotebookWorkspacesClient) ListConnectionInfoPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionInfoSender sends the ListConnectionInfo request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListConnectionInfoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionInfoResponder handles the response to the ListConnectionInfo request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListConnectionInfoResponder(resp *http.Response) (result NotebookWorkspaceConnectionInfoResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateAuthToken regenerates the auth token for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesRegenerateAuthTokenFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.RegenerateAuthToken") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", err.Error()) - } - - req, err := client.RegenerateAuthTokenPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateAuthTokenSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateAuthTokenPreparer prepares the RegenerateAuthToken request. -func (client NotebookWorkspacesClient) RegenerateAuthTokenPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateAuthTokenSender sends the RegenerateAuthToken request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) RegenerateAuthTokenSender(req *http.Request) (future NotebookWorkspacesRegenerateAuthTokenFuture, 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 -} - -// RegenerateAuthTokenResponder handles the response to the RegenerateAuthToken request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) RegenerateAuthTokenResponder(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 the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Start(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client NotebookWorkspacesClient) StartPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/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 NotebookWorkspacesClient) StartSender(req *http.Request) (future NotebookWorkspacesStartFuture, 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 NotebookWorkspacesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/operations.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/operations.go deleted file mode 100644 index 1f41ed4a18a6..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 client for the Operations methods of the Documentdb service. -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 Cosmos DB Resource Provider 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, "documentdb.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, "documentdb.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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 = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DocumentDB/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, "documentdb.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, "documentdb.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeid.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeid.go deleted file mode 100644 index f82c4be0cbb4..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeid.go +++ /dev/null @@ -1,133 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDClient is the client for the PartitionKeyRangeID methods of the Documentdb service. -type PartitionKeyRangeIDClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDClient creates an instance of the PartitionKeyRangeIDClient client. -func NewPartitionKeyRangeIDClient(subscriptionID string) PartitionKeyRangeIDClient { - return NewPartitionKeyRangeIDClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDClientWithBaseURI creates an instance of the PartitionKeyRangeIDClient 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 NewPartitionKeyRangeIDClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDClient { - return PartitionKeyRangeIDClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeidregion.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeidregion.go deleted file mode 100644 index 38b33e59e1f0..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeidregion.go +++ /dev/null @@ -1,135 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDRegionClient is the client for the PartitionKeyRangeIDRegion methods of the Documentdb service. -type PartitionKeyRangeIDRegionClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDRegionClient creates an instance of the PartitionKeyRangeIDRegionClient client. -func NewPartitionKeyRangeIDRegionClient(subscriptionID string) PartitionKeyRangeIDRegionClient { - return NewPartitionKeyRangeIDRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDRegionClientWithBaseURI creates an instance of the PartitionKeyRangeIDRegionClient 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 NewPartitionKeyRangeIDRegionClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDRegionClient { - return PartitionKeyRangeIDRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentile.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentile.go deleted file mode 100644 index dcb239cb849c..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentile.go +++ /dev/null @@ -1,127 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileClient is the client for the Percentile methods of the Documentdb service. -type PercentileClient struct { - BaseClient -} - -// NewPercentileClient creates an instance of the PercentileClient client. -func NewPercentileClient(subscriptionID string) PercentileClient { - return NewPercentileClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileClientWithBaseURI creates an instance of the PercentileClient 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 NewPercentileClientWithBaseURI(baseURI string, subscriptionID string) PercentileClient { - return PercentileClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. This url is only -// for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentilesourcetarget.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentilesourcetarget.go deleted file mode 100644 index a366c6387a6b..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentilesourcetarget.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileSourceTargetClient is the client for the PercentileSourceTarget methods of the Documentdb service. -type PercentileSourceTargetClient struct { - BaseClient -} - -// NewPercentileSourceTargetClient creates an instance of the PercentileSourceTargetClient client. -func NewPercentileSourceTargetClient(subscriptionID string) PercentileSourceTargetClient { - return NewPercentileSourceTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileSourceTargetClientWithBaseURI creates an instance of the PercentileSourceTargetClient 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 NewPercentileSourceTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileSourceTargetClient { - return PercentileSourceTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account, source and target region. -// This url is only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// sourceRegion - source region from which data is written. Cosmos DB region, with spaces between words and -// each word capitalized. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileSourceTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileSourceTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileSourceTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, sourceRegion, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileSourceTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceRegion": autorest.Encode("path", sourceRegion), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileSourceTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileSourceTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentiletarget.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentiletarget.go deleted file mode 100644 index 9e26ed0ab726..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentiletarget.go +++ /dev/null @@ -1,131 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileTargetClient is the client for the PercentileTarget methods of the Documentdb service. -type PercentileTargetClient struct { - BaseClient -} - -// NewPercentileTargetClient creates an instance of the PercentileTargetClient client. -func NewPercentileTargetClient(subscriptionID string) PercentileTargetClient { - return NewPercentileTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileTargetClientWithBaseURI creates an instance of the PercentileTargetClient 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 NewPercentileTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileTargetClient { - return PercentileTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account target region. This url is -// only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, targetRegion 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), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/privateendpointconnections.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privateendpointconnections.go deleted file mode 100644 index 61e8111492bc..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privateendpointconnections.go +++ /dev/null @@ -1,406 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the Documentdb service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) 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 = "2019-08-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.DocumentDB/databaseAccounts/{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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByDatabaseAccount list all private endpoint connections on a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/privatelinkresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privatelinkresources.go deleted file mode 100644 index f58cda077eb4..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privatelinkresources.go +++ /dev/null @@ -1,215 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the client for the PrivateLinkResources methods of the Documentdb service. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByDatabaseAccount gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateLinkResourcesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorabledatabaseaccounts.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorabledatabaseaccounts.go deleted file mode 100644 index b17a884f51dc..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorabledatabaseaccounts.go +++ /dev/null @@ -1,273 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableDatabaseAccountsClient is the client for the RestorableDatabaseAccounts methods of the Documentdb service. -type RestorableDatabaseAccountsClient struct { - BaseClient -} - -// NewRestorableDatabaseAccountsClient creates an instance of the RestorableDatabaseAccountsClient client. -func NewRestorableDatabaseAccountsClient(subscriptionID string) RestorableDatabaseAccountsClient { - return NewRestorableDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableDatabaseAccountsClientWithBaseURI creates an instance of the RestorableDatabaseAccountsClient 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 NewRestorableDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) RestorableDatabaseAccountsClient { - return RestorableDatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByLocation retrieves the properties of an existing Azure Cosmos DB restorable database account. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -func (client RestorableDatabaseAccountsClient) GetByLocation(ctx context.Context, location string, instanceID string) (result RestorableDatabaseAccountGetResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDatabaseAccountsClient.GetByLocation") - 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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableDatabaseAccountsClient", "GetByLocation", err.Error()) - } - - req, err := client.GetByLocationPreparer(ctx, location, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "GetByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.GetByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "GetByLocation", resp, "Failure sending request") - return - } - - result, err = client.GetByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "GetByLocation", resp, "Failure responding to request") - return - } - - return -} - -// GetByLocationPreparer prepares the GetByLocation request. -func (client RestorableDatabaseAccountsClient) GetByLocationPreparer(ctx context.Context, location string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByLocationSender sends the GetByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableDatabaseAccountsClient) GetByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByLocationResponder handles the response to the GetByLocation request. The method always -// closes the http.Response Body. -func (client RestorableDatabaseAccountsClient) GetByLocationResponder(resp *http.Response) (result RestorableDatabaseAccountGetResult, 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 the restorable Azure Cosmos DB database accounts available under the subscription. -func (client RestorableDatabaseAccountsClient) List(ctx context.Context) (result RestorableDatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDatabaseAccountsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableDatabaseAccountsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableDatabaseAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts", 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 RestorableDatabaseAccountsClient) 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 RestorableDatabaseAccountsClient) ListResponder(resp *http.Response) (result RestorableDatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByLocation lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a -// region. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -func (client RestorableDatabaseAccountsClient) ListByLocation(ctx context.Context, location string) (result RestorableDatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDatabaseAccountsClient.ListByLocation") - 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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableDatabaseAccountsClient", "ListByLocation", err.Error()) - } - - req, err := client.ListByLocationPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "ListByLocation", resp, "Failure sending request") - return - } - - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "ListByLocation", resp, "Failure responding to request") - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client RestorableDatabaseAccountsClient) ListByLocationPreparer(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 = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableDatabaseAccountsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client RestorableDatabaseAccountsClient) ListByLocationResponder(resp *http.Response) (result RestorableDatabaseAccountsListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbcollections.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbcollections.go deleted file mode 100644 index 20ebf476ee8d..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbcollections.go +++ /dev/null @@ -1,120 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableMongodbCollectionsClient is the client for the RestorableMongodbCollections methods of the Documentdb -// service. -type RestorableMongodbCollectionsClient struct { - BaseClient -} - -// NewRestorableMongodbCollectionsClient creates an instance of the RestorableMongodbCollectionsClient client. -func NewRestorableMongodbCollectionsClient(subscriptionID string) RestorableMongodbCollectionsClient { - return NewRestorableMongodbCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableMongodbCollectionsClientWithBaseURI creates an instance of the RestorableMongodbCollectionsClient -// 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 NewRestorableMongodbCollectionsClientWithBaseURI(baseURI string, subscriptionID string) RestorableMongodbCollectionsClient { - return RestorableMongodbCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the restorable Azure Cosmos DB MongoDB collection available for a specific database. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -// restorableMongodbDatabaseRid - the resource id of the restorable Mongo database. -func (client RestorableMongodbCollectionsClient) List(ctx context.Context, location string, instanceID string, restorableMongodbDatabaseRid string) (result RestorableMongodbCollectionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableMongodbCollectionsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableMongodbCollectionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID, restorableMongodbDatabaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbCollectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbCollectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbCollectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableMongodbCollectionsClient) ListPreparer(ctx context.Context, location string, instanceID string, restorableMongodbDatabaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(restorableMongodbDatabaseRid) > 0 { - queryParameters["restorableMongodbDatabaseRid"] = autorest.Encode("query", restorableMongodbDatabaseRid) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections", 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 RestorableMongodbCollectionsClient) 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 RestorableMongodbCollectionsClient) ListResponder(resp *http.Response) (result RestorableMongodbCollectionsListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbdatabases.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbdatabases.go deleted file mode 100644 index b84a7ab5e380..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbdatabases.go +++ /dev/null @@ -1,115 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableMongodbDatabasesClient is the client for the RestorableMongodbDatabases methods of the Documentdb service. -type RestorableMongodbDatabasesClient struct { - BaseClient -} - -// NewRestorableMongodbDatabasesClient creates an instance of the RestorableMongodbDatabasesClient client. -func NewRestorableMongodbDatabasesClient(subscriptionID string) RestorableMongodbDatabasesClient { - return NewRestorableMongodbDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableMongodbDatabasesClientWithBaseURI creates an instance of the RestorableMongodbDatabasesClient 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 NewRestorableMongodbDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableMongodbDatabasesClient { - return RestorableMongodbDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the restorable Azure Cosmos DB MongoDB databases available under the restorable account. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -func (client RestorableMongodbDatabasesClient) List(ctx context.Context, location string, instanceID string) (result RestorableMongodbDatabasesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableMongodbDatabasesClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableMongodbDatabasesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbDatabasesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbDatabasesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbDatabasesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableMongodbDatabasesClient) ListPreparer(ctx context.Context, location string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases", 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 RestorableMongodbDatabasesClient) 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 RestorableMongodbDatabasesClient) ListResponder(resp *http.Response) (result RestorableMongodbDatabasesListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbresources.go deleted file mode 100644 index 8ad4b9cd4146..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablemongodbresources.go +++ /dev/null @@ -1,124 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableMongodbResourcesClient is the client for the RestorableMongodbResources methods of the Documentdb service. -type RestorableMongodbResourcesClient struct { - BaseClient -} - -// NewRestorableMongodbResourcesClient creates an instance of the RestorableMongodbResourcesClient client. -func NewRestorableMongodbResourcesClient(subscriptionID string) RestorableMongodbResourcesClient { - return NewRestorableMongodbResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableMongodbResourcesClientWithBaseURI creates an instance of the RestorableMongodbResourcesClient 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 NewRestorableMongodbResourcesClientWithBaseURI(baseURI string, subscriptionID string) RestorableMongodbResourcesClient { - return RestorableMongodbResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the restorable Azure Cosmos DB MongoDB resources available for a specific database account at a given -// time and location. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -// restoreLocation - the location where the restorable resources are located. -// restoreTimestampInUtc - the timestamp when the restorable resources existed. -func (client RestorableMongodbResourcesClient) List(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (result RestorableMongodbResourcesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableMongodbResourcesClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableMongodbResourcesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID, restoreLocation, restoreTimestampInUtc) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbResourcesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbResourcesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableMongodbResourcesClient) ListPreparer(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(restoreLocation) > 0 { - queryParameters["restoreLocation"] = autorest.Encode("query", restoreLocation) - } - if len(restoreTimestampInUtc) > 0 { - queryParameters["restoreTimestampInUtc"] = autorest.Encode("query", restoreTimestampInUtc) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources", 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 RestorableMongodbResourcesClient) 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 RestorableMongodbResourcesClient) ListResponder(resp *http.Response) (result RestorableMongodbResourcesListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqlcontainers.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqlcontainers.go deleted file mode 100644 index 6d2a70e25d4a..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqlcontainers.go +++ /dev/null @@ -1,119 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableSQLContainersClient is the client for the RestorableSQLContainers methods of the Documentdb service. -type RestorableSQLContainersClient struct { - BaseClient -} - -// NewRestorableSQLContainersClient creates an instance of the RestorableSQLContainersClient client. -func NewRestorableSQLContainersClient(subscriptionID string) RestorableSQLContainersClient { - return NewRestorableSQLContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableSQLContainersClientWithBaseURI creates an instance of the RestorableSQLContainersClient 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 NewRestorableSQLContainersClientWithBaseURI(baseURI string, subscriptionID string) RestorableSQLContainersClient { - return RestorableSQLContainersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the restorable Azure Cosmos DB SQL containers available for a specific database. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -// restorableSQLDatabaseRid - the resource id of the restorable SQL database. -func (client RestorableSQLContainersClient) List(ctx context.Context, location string, instanceID string, restorableSQLDatabaseRid string) (result RestorableSQLContainersListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableSQLContainersClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableSQLContainersClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID, restorableSQLDatabaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLContainersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLContainersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLContainersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableSQLContainersClient) ListPreparer(ctx context.Context, location string, instanceID string, restorableSQLDatabaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(restorableSQLDatabaseRid) > 0 { - queryParameters["restorableSqlDatabaseRid"] = autorest.Encode("query", restorableSQLDatabaseRid) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers", 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 RestorableSQLContainersClient) 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 RestorableSQLContainersClient) ListResponder(resp *http.Response) (result RestorableSQLContainersListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqldatabases.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqldatabases.go deleted file mode 100644 index e0876b1df311..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqldatabases.go +++ /dev/null @@ -1,115 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableSQLDatabasesClient is the client for the RestorableSQLDatabases methods of the Documentdb service. -type RestorableSQLDatabasesClient struct { - BaseClient -} - -// NewRestorableSQLDatabasesClient creates an instance of the RestorableSQLDatabasesClient client. -func NewRestorableSQLDatabasesClient(subscriptionID string) RestorableSQLDatabasesClient { - return NewRestorableSQLDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableSQLDatabasesClientWithBaseURI creates an instance of the RestorableSQLDatabasesClient 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 NewRestorableSQLDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableSQLDatabasesClient { - return RestorableSQLDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the restorable Azure Cosmos DB SQL databases available under the restorable account. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -func (client RestorableSQLDatabasesClient) List(ctx context.Context, location string, instanceID string) (result RestorableSQLDatabasesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableSQLDatabasesClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableSQLDatabasesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLDatabasesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLDatabasesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLDatabasesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableSQLDatabasesClient) ListPreparer(ctx context.Context, location string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases", 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 RestorableSQLDatabasesClient) 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 RestorableSQLDatabasesClient) ListResponder(resp *http.Response) (result RestorableSQLDatabasesListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqlresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqlresources.go deleted file mode 100644 index 6de7eeadea87..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorablesqlresources.go +++ /dev/null @@ -1,124 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableSQLResourcesClient is the client for the RestorableSQLResources methods of the Documentdb service. -type RestorableSQLResourcesClient struct { - BaseClient -} - -// NewRestorableSQLResourcesClient creates an instance of the RestorableSQLResourcesClient client. -func NewRestorableSQLResourcesClient(subscriptionID string) RestorableSQLResourcesClient { - return NewRestorableSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableSQLResourcesClientWithBaseURI creates an instance of the RestorableSQLResourcesClient 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 NewRestorableSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string) RestorableSQLResourcesClient { - return RestorableSQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the restorable Azure Cosmos DB SQL resources available for a specific database account at a given -// time and location. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -// restoreLocation - the location where the restorable resources are located. -// restoreTimestampInUtc - the timestamp when the restorable resources existed. -func (client RestorableSQLResourcesClient) List(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (result RestorableSQLResourcesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableSQLResourcesClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableSQLResourcesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID, restoreLocation, restoreTimestampInUtc) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLResourcesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLResourcesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableSQLResourcesClient) ListPreparer(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(restoreLocation) > 0 { - queryParameters["restoreLocation"] = autorest.Encode("query", restoreLocation) - } - if len(restoreTimestampInUtc) > 0 { - queryParameters["restoreTimestampInUtc"] = autorest.Encode("query", restoreTimestampInUtc) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources", 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 RestorableSQLResourcesClient) 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 RestorableSQLResourcesClient) ListResponder(resp *http.Response) (result RestorableSQLResourcesListResult, 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/cosmos-db/mgmt/2020-06-01-preview/documentdb/sqlresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/sqlresources.go deleted file mode 100644 index 67e9a987efad..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/sqlresources.go +++ /dev/null @@ -1,3144 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLResourcesClient is the client for the SQLResources methods of the Documentdb service. -type SQLResourcesClient struct { - BaseClient -} - -// NewSQLResourcesClient creates an instance of the SQLResourcesClient client. -func NewSQLResourcesClient(subscriptionID string) SQLResourcesClient { - return NewSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLResourcesClientWithBaseURI creates an instance of the SQLResourcesClient 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 NewSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string) SQLResourcesClient { - return SQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateSQLContainer create or update an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// createUpdateSQLContainerParameters - the parameters to provide for the current SQL container. -func (client SQLResourcesClient) CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLContainerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", err.Error()) - } - - req, err := client.CreateUpdateSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, createUpdateSQLContainerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLContainerPreparer prepares the CreateUpdateSQLContainer request. -func (client SQLResourcesClient) CreateUpdateSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithJSON(createUpdateSQLContainerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLContainerSender sends the CreateUpdateSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLContainerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLContainerFuture, 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 -} - -// CreateUpdateSQLContainerResponder handles the response to the CreateUpdateSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLDatabase create or update an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateSQLDatabaseParameters - the parameters to provide for the current SQL database. -func (client SQLResourcesClient) CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", err.Error()) - } - - req, err := client.CreateUpdateSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateSQLDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLDatabasePreparer prepares the CreateUpdateSQLDatabase request. -func (client SQLResourcesClient) CreateUpdateSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateSQLDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLDatabaseSender sends the CreateUpdateSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseSender(req *http.Request) (future SQLResourcesCreateUpdateSQLDatabaseFuture, 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 -} - -// CreateUpdateSQLDatabaseResponder handles the response to the CreateUpdateSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLRoleAssignment creates or updates an Azure Cosmos DB SQL Role Assignment. -// Parameters: -// roleAssignmentID - the GUID for the Role Assignment. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// createUpdateSQLRoleAssignmentParameters - the properties required to create or update a Role Assignment. -func (client SQLResourcesClient) CreateUpdateSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLRoleAssignmentFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLRoleAssignment") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", err.Error()) - } - - req, err := client.CreateUpdateSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName, createUpdateSQLRoleAssignmentParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLRoleAssignmentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLRoleAssignmentPreparer prepares the CreateUpdateSQLRoleAssignment request. -func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleAssignmentId": autorest.Encode("path", roleAssignmentID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters), - autorest.WithJSON(createUpdateSQLRoleAssignmentParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLRoleAssignmentSender sends the CreateUpdateSQLRoleAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentSender(req *http.Request) (future SQLResourcesCreateUpdateSQLRoleAssignmentFuture, 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 -} - -// CreateUpdateSQLRoleAssignmentResponder handles the response to the CreateUpdateSQLRoleAssignment request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentResponder(resp *http.Response) (result SQLRoleAssignmentGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLRoleDefinition creates or updates an Azure Cosmos DB SQL Role Definition. -// Parameters: -// roleDefinitionID - the GUID for the Role Definition. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// createUpdateSQLRoleDefinitionParameters - the properties required to create or update a Role Definition. -func (client SQLResourcesClient) CreateUpdateSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLRoleDefinitionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLRoleDefinition") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", err.Error()) - } - - req, err := client.CreateUpdateSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName, createUpdateSQLRoleDefinitionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLRoleDefinitionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLRoleDefinitionPreparer prepares the CreateUpdateSQLRoleDefinition request. -func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithJSON(createUpdateSQLRoleDefinitionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLRoleDefinitionSender sends the CreateUpdateSQLRoleDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLRoleDefinitionFuture, 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 -} - -// CreateUpdateSQLRoleDefinitionResponder handles the response to the CreateUpdateSQLRoleDefinition request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionResponder(resp *http.Response) (result SQLRoleDefinitionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLStoredProcedure create or update an Azure Cosmos DB SQL storedProcedure -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -// createUpdateSQLStoredProcedureParameters - the parameters to provide for the current SQL storedProcedure. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLStoredProcedureParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", err.Error()) - } - - req, err := client.CreateUpdateSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSQLStoredProcedureParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLStoredProcedurePreparer prepares the CreateUpdateSQLStoredProcedure request. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithJSON(createUpdateSQLStoredProcedureParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLStoredProcedureSender sends the CreateUpdateSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureSender(req *http.Request) (future SQLResourcesCreateUpdateSQLStoredProcedureFuture, 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 -} - -// CreateUpdateSQLStoredProcedureResponder handles the response to the CreateUpdateSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLTrigger create or update an Azure Cosmos DB SQL trigger -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -// createUpdateSQLTriggerParameters - the parameters to provide for the current SQL trigger. -func (client SQLResourcesClient) CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLTriggerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", err.Error()) - } - - req, err := client.CreateUpdateSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSQLTriggerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLTriggerPreparer prepares the CreateUpdateSQLTrigger request. -func (client SQLResourcesClient) CreateUpdateSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithJSON(createUpdateSQLTriggerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLTriggerSender sends the CreateUpdateSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLTriggerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLTriggerFuture, 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 -} - -// CreateUpdateSQLTriggerResponder handles the response to the CreateUpdateSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLUserDefinedFunction create or update an Azure Cosmos DB SQL userDefinedFunction -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -// createUpdateSQLUserDefinedFunctionParameters - the parameters to provide for the current SQL -// userDefinedFunction. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLUserDefinedFunctionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", err.Error()) - } - - req, err := client.CreateUpdateSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSQLUserDefinedFunctionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLUserDefinedFunctionPreparer prepares the CreateUpdateSQLUserDefinedFunction request. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithJSON(createUpdateSQLUserDefinedFunctionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLUserDefinedFunctionSender sends the CreateUpdateSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, 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 -} - -// CreateUpdateSQLUserDefinedFunctionResponder handles the response to the CreateUpdateSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSQLContainer deletes an existing Azure Cosmos DB SQL container. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesDeleteSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLContainer", err.Error()) - } - - req, err := client.DeleteSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLContainerPreparer prepares the DeleteSQLContainer request. -func (client SQLResourcesClient) DeleteSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLContainerSender sends the DeleteSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLContainerSender(req *http.Request) (future SQLResourcesDeleteSQLContainerFuture, 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 -} - -// DeleteSQLContainerResponder handles the response to the DeleteSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLContainerResponder(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 -} - -// DeleteSQLDatabase deletes an existing Azure Cosmos DB SQL database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesDeleteSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLDatabase", err.Error()) - } - - req, err := client.DeleteSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLDatabasePreparer prepares the DeleteSQLDatabase request. -func (client SQLResourcesClient) DeleteSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLDatabaseSender sends the DeleteSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLDatabaseSender(req *http.Request) (future SQLResourcesDeleteSQLDatabaseFuture, 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 -} - -// DeleteSQLDatabaseResponder handles the response to the DeleteSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLDatabaseResponder(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 -} - -// DeleteSQLRoleAssignment deletes an existing Azure Cosmos DB SQL Role Assignment. -// Parameters: -// roleAssignmentID - the GUID for the Role Assignment. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) DeleteSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result SQLResourcesDeleteSQLRoleAssignmentFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLRoleAssignment") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", err.Error()) - } - - req, err := client.DeleteSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLRoleAssignmentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLRoleAssignmentPreparer prepares the DeleteSQLRoleAssignment request. -func (client SQLResourcesClient) DeleteSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleAssignmentId": autorest.Encode("path", roleAssignmentID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLRoleAssignmentSender sends the DeleteSQLRoleAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLRoleAssignmentSender(req *http.Request) (future SQLResourcesDeleteSQLRoleAssignmentFuture, 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 -} - -// DeleteSQLRoleAssignmentResponder handles the response to the DeleteSQLRoleAssignment request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLRoleAssignmentResponder(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 -} - -// DeleteSQLRoleDefinition deletes an existing Azure Cosmos DB SQL Role Definition. -// Parameters: -// roleDefinitionID - the GUID for the Role Definition. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) DeleteSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result SQLResourcesDeleteSQLRoleDefinitionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLRoleDefinition") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", err.Error()) - } - - req, err := client.DeleteSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLRoleDefinitionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLRoleDefinitionPreparer prepares the DeleteSQLRoleDefinition request. -func (client SQLResourcesClient) DeleteSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLRoleDefinitionSender sends the DeleteSQLRoleDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLRoleDefinitionSender(req *http.Request) (future SQLResourcesDeleteSQLRoleDefinitionFuture, 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 -} - -// DeleteSQLRoleDefinitionResponder handles the response to the DeleteSQLRoleDefinition request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLRoleDefinitionResponder(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 -} - -// DeleteSQLStoredProcedure deletes an existing Azure Cosmos DB SQL storedProcedure. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLResourcesDeleteSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", err.Error()) - } - - req, err := client.DeleteSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLStoredProcedurePreparer prepares the DeleteSQLStoredProcedure request. -func (client SQLResourcesClient) DeleteSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLStoredProcedureSender sends the DeleteSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLStoredProcedureSender(req *http.Request) (future SQLResourcesDeleteSQLStoredProcedureFuture, 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 -} - -// DeleteSQLStoredProcedureResponder handles the response to the DeleteSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLStoredProcedureResponder(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 -} - -// DeleteSQLTrigger deletes an existing Azure Cosmos DB SQL trigger. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLResourcesDeleteSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLTrigger", err.Error()) - } - - req, err := client.DeleteSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLTriggerPreparer prepares the DeleteSQLTrigger request. -func (client SQLResourcesClient) DeleteSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLTriggerSender sends the DeleteSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLTriggerSender(req *http.Request) (future SQLResourcesDeleteSQLTriggerFuture, 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 -} - -// DeleteSQLTriggerResponder handles the response to the DeleteSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLTriggerResponder(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 -} - -// DeleteSQLUserDefinedFunction deletes an existing Azure Cosmos DB SQL userDefinedFunction. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", err.Error()) - } - - req, err := client.DeleteSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLUserDefinedFunctionPreparer prepares the DeleteSQLUserDefinedFunction request. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLUserDefinedFunctionSender sends the DeleteSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesDeleteSQLUserDefinedFunctionFuture, 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 -} - -// DeleteSQLUserDefinedFunctionResponder handles the response to the DeleteSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionResponder(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 -} - -// GetSQLContainer gets the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error()) - } - - req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerPreparer prepares the GetSQLContainer request. -func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerSender sends the GetSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database -// account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error()) - } - - req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request. -func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error()) - } - - req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabasePreparer prepares the GetSQLDatabase request. -func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database -// account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error()) - } - - req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request. -func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLRoleAssignment retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. -// Parameters: -// roleAssignmentID - the GUID for the Role Assignment. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) GetSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result SQLRoleAssignmentGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLRoleAssignment") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLRoleAssignment", err.Error()) - } - - req, err := client.GetSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLRoleAssignmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", resp, "Failure sending request") - return - } - - result, err = client.GetSQLRoleAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLRoleAssignmentPreparer prepares the GetSQLRoleAssignment request. -func (client SQLResourcesClient) GetSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleAssignmentId": autorest.Encode("path", roleAssignmentID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLRoleAssignmentSender sends the GetSQLRoleAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLRoleAssignmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLRoleAssignmentResponder handles the response to the GetSQLRoleAssignment request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLRoleAssignmentResponder(resp *http.Response) (result SQLRoleAssignmentGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLRoleDefinition retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. -// Parameters: -// roleDefinitionID - the GUID for the Role Definition. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) GetSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result SQLRoleDefinitionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLRoleDefinition") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLRoleDefinition", err.Error()) - } - - req, err := client.GetSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLRoleDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", resp, "Failure sending request") - return - } - - result, err = client.GetSQLRoleDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLRoleDefinitionPreparer prepares the GetSQLRoleDefinition request. -func (client SQLResourcesClient) GetSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLRoleDefinitionSender sends the GetSQLRoleDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLRoleDefinitionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLRoleDefinitionResponder handles the response to the GetSQLRoleDefinition request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLRoleDefinitionResponder(resp *http.Response) (result SQLRoleDefinitionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLStoredProcedure gets the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLStoredProcedureGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLStoredProcedure") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLStoredProcedure", err.Error()) - } - - req, err := client.GetSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLStoredProcedureSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure sending request") - return - } - - result, err = client.GetSQLStoredProcedureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLStoredProcedurePreparer prepares the GetSQLStoredProcedure request. -func (client SQLResourcesClient) GetSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLStoredProcedureSender sends the GetSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLStoredProcedureSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLStoredProcedureResponder handles the response to the GetSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLTrigger gets the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLTriggerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLTrigger") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLTrigger", err.Error()) - } - - req, err := client.GetSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLTriggerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure sending request") - return - } - - result, err = client.GetSQLTriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLTriggerPreparer prepares the GetSQLTrigger request. -func (client SQLResourcesClient) GetSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLTriggerSender sends the GetSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLTriggerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLTriggerResponder handles the response to the GetSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLUserDefinedFunction gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLUserDefinedFunctionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLUserDefinedFunction") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", err.Error()) - } - - req, err := client.GetSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLUserDefinedFunctionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure sending request") - return - } - - result, err = client.GetSQLUserDefinedFunctionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLUserDefinedFunctionPreparer prepares the GetSQLUserDefinedFunction request. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLUserDefinedFunctionSender sends the GetSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLUserDefinedFunctionResponder handles the response to the GetSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLContainers lists the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLContainerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLContainers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLContainers", err.Error()) - } - - req, err := client.ListSQLContainersPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLContainersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLContainersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLContainersPreparer prepares the ListSQLContainers request. -func (client SQLResourcesClient) ListSQLContainersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLContainersSender sends the ListSQLContainers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLContainersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLContainersResponder handles the response to the ListSQLContainers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLContainersResponder(resp *http.Response) (result SQLContainerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLDatabases lists the SQL databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result SQLDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLDatabases", err.Error()) - } - - req, err := client.ListSQLDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListSQLDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLDatabasesPreparer prepares the ListSQLDatabases request. -func (client SQLResourcesClient) ListSQLDatabasesPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLDatabasesSender sends the ListSQLDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLDatabasesResponder handles the response to the ListSQLDatabases request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLDatabasesResponder(resp *http.Response) (result SQLDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLRoleAssignments retrieves the list of all Azure Cosmos DB SQL Role Assignments. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLRoleAssignments(ctx context.Context, resourceGroupName string, accountName string) (result SQLRoleAssignmentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLRoleAssignments") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLRoleAssignments", err.Error()) - } - - req, err := client.ListSQLRoleAssignmentsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLRoleAssignmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", resp, "Failure sending request") - return - } - - result, err = client.ListSQLRoleAssignmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLRoleAssignmentsPreparer prepares the ListSQLRoleAssignments request. -func (client SQLResourcesClient) ListSQLRoleAssignmentsPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLRoleAssignmentsSender sends the ListSQLRoleAssignments request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLRoleAssignmentsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLRoleAssignmentsResponder handles the response to the ListSQLRoleAssignments request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLRoleAssignmentsResponder(resp *http.Response) (result SQLRoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLRoleDefinitions retrieves the list of all Azure Cosmos DB SQL Role Definitions. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLRoleDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result SQLRoleDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLRoleDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", err.Error()) - } - - req, err := client.ListSQLRoleDefinitionsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLRoleDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListSQLRoleDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLRoleDefinitionsPreparer prepares the ListSQLRoleDefinitions request. -func (client SQLResourcesClient) ListSQLRoleDefinitionsPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLRoleDefinitionsSender sends the ListSQLRoleDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLRoleDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLRoleDefinitionsResponder handles the response to the ListSQLRoleDefinitions request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLRoleDefinitionsResponder(resp *http.Response) (result SQLRoleDefinitionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLStoredProcedures lists the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLStoredProcedureListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLStoredProcedures") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLStoredProcedures", err.Error()) - } - - req, err := client.ListSQLStoredProceduresPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLStoredProceduresSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure sending request") - return - } - - result, err = client.ListSQLStoredProceduresResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLStoredProceduresPreparer prepares the ListSQLStoredProcedures request. -func (client SQLResourcesClient) ListSQLStoredProceduresPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLStoredProceduresSender sends the ListSQLStoredProcedures request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLStoredProceduresSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLStoredProceduresResponder handles the response to the ListSQLStoredProcedures request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLStoredProceduresResponder(resp *http.Response) (result SQLStoredProcedureListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLTriggers lists the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLTriggerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLTriggers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLTriggers", err.Error()) - } - - req, err := client.ListSQLTriggersPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLTriggersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLTriggersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLTriggersPreparer prepares the ListSQLTriggers request. -func (client SQLResourcesClient) ListSQLTriggersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLTriggersSender sends the ListSQLTriggers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLTriggersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLTriggersResponder handles the response to the ListSQLTriggers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLTriggersResponder(resp *http.Response) (result SQLTriggerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLUserDefinedFunctions lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLUserDefinedFunctionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLUserDefinedFunctions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", err.Error()) - } - - req, err := client.ListSQLUserDefinedFunctionsPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLUserDefinedFunctionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure sending request") - return - } - - result, err = client.ListSQLUserDefinedFunctionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLUserDefinedFunctionsPreparer prepares the ListSQLUserDefinedFunctions request. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLUserDefinedFunctionsSender sends the ListSQLUserDefinedFunctions request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLUserDefinedFunctionsResponder handles the response to the ListSQLUserDefinedFunctions request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsResponder(resp *http.Response) (result SQLUserDefinedFunctionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLContainerThroughput update RUs per second of an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL container. -func (client SQLResourcesClient) UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLContainerThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLContainerThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", err.Error()) - } - - req, err := client.UpdateSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLContainerThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLContainerThroughputPreparer prepares the UpdateSQLContainerThroughput request. -func (client SQLResourcesClient) UpdateSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLContainerThroughputSender sends the UpdateSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLContainerThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLContainerThroughputFuture, 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 -} - -// UpdateSQLContainerThroughputResponder handles the response to the UpdateSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLDatabaseThroughput update RUs per second of an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL database. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLDatabaseThroughputPreparer prepares the UpdateSQLDatabaseThroughput request. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLDatabaseThroughputSender sends the UpdateSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLDatabaseThroughputFuture, 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 -} - -// UpdateSQLDatabaseThroughputResponder handles the response to the UpdateSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/tableresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/tableresources.go deleted file mode 100644 index 84f949e83013..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/tableresources.go +++ /dev/null @@ -1,610 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TableResourcesClient is the client for the TableResources methods of the Documentdb service. -type TableResourcesClient struct { - BaseClient -} - -// NewTableResourcesClient creates an instance of the TableResourcesClient client. -func NewTableResourcesClient(subscriptionID string) TableResourcesClient { - return NewTableResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTableResourcesClientWithBaseURI creates an instance of the TableResourcesClient 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 NewTableResourcesClientWithBaseURI(baseURI string, subscriptionID string) TableResourcesClient { - return TableResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateTable create or update an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// createUpdateTableParameters - the parameters to provide for the current Table. -func (client TableResourcesClient) CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (result TableResourcesCreateUpdateTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.CreateUpdateTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createUpdateTableParameters.TableCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "CreateUpdateTable", err.Error()) - } - - req, err := client.CreateUpdateTablePreparer(ctx, resourceGroupName, accountName, tableName, createUpdateTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateTablePreparer prepares the CreateUpdateTable request. -func (client TableResourcesClient) CreateUpdateTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateTableSender sends the CreateUpdateTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) CreateUpdateTableSender(req *http.Request) (future TableResourcesCreateUpdateTableFuture, 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 -} - -// CreateUpdateTableResponder handles the response to the CreateUpdateTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) CreateUpdateTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteTable deletes an existing Azure Cosmos DB Table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesDeleteTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.DeleteTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "DeleteTable", err.Error()) - } - - req, err := client.DeleteTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteTablePreparer prepares the DeleteTable request. -func (client TableResourcesClient) DeleteTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteTableSender sends the DeleteTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) DeleteTableSender(req *http.Request) (future TableResourcesDeleteTableFuture, 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 -} - -// DeleteTableResponder handles the response to the DeleteTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) DeleteTableResponder(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 -} - -// GetTable gets the Tables under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTable", err.Error()) - } - - req, err := client.GetTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure sending request") - return - } - - result, err = client.GetTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure responding to request") - return - } - - return -} - -// GetTablePreparer prepares the GetTable request. -func (client TableResourcesClient) GetTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableSender sends the GetTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableResponder handles the response to the GetTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTableThroughput gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTableThroughput", err.Error()) - } - - req, err := client.GetTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetTableThroughputPreparer prepares the GetTableThroughput request. -func (client TableResourcesClient) GetTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableThroughputSender sends the GetTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableThroughputResponder handles the response to the GetTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListTables lists the Tables under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client TableResourcesClient) ListTables(ctx context.Context, resourceGroupName string, accountName string) (result TableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.ListTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "ListTables", err.Error()) - } - - req, err := client.ListTablesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure sending request") - return - } - - result, err = client.ListTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure responding to request") - return - } - - return -} - -// ListTablesPreparer prepares the ListTables request. -func (client TableResourcesClient) ListTablesPreparer(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 = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListTablesSender sends the ListTables request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) ListTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListTablesResponder handles the response to the ListTables request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) ListTablesResponder(resp *http.Response) (result TableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateTableThroughput update RUs per second of an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current Table. -func (client TableResourcesClient) UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result TableResourcesUpdateTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.UpdateTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "UpdateTableThroughput", err.Error()) - } - - req, err := client.UpdateTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTableThroughputPreparer prepares the UpdateTableThroughput request. -func (client TableResourcesClient) UpdateTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-06-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTableThroughputSender sends the UpdateTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) UpdateTableThroughputSender(req *http.Request) (future TableResourcesUpdateTableThroughputFuture, 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 -} - -// UpdateTableThroughputResponder handles the response to the UpdateTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) UpdateTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/version.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/version.go deleted file mode 100644 index c0c3984696cc..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package documentdb - -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() + " documentdb/2020-06-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/cosmos-db/mgmt/2020-09-01-preview/documentdb/CHANGELOG.md b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/_meta.json b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/_meta.json deleted file mode 100644 index 7c1fbc873d2e..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "2601b21eccaab01da2feb65d232ab6c3cb9c1c45", - "readme": "/_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "tag": "package-2020-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-2020-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/cassandraresources.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/cassandraresources.go deleted file mode 100644 index 65c09d4d90f2..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/cassandraresources.go +++ /dev/null @@ -1,1589 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CassandraResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type CassandraResourcesClient struct { - BaseClient -} - -// NewCassandraResourcesClient creates an instance of the CassandraResourcesClient client. -func NewCassandraResourcesClient(subscriptionID string) CassandraResourcesClient { - return NewCassandraResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCassandraResourcesClientWithBaseURI creates an instance of the CassandraResourcesClient 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 NewCassandraResourcesClientWithBaseURI(baseURI string, subscriptionID string) CassandraResourcesClient { - return CassandraResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateCassandraKeyspace create or update an Azure Cosmos DB Cassandra keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// createUpdateCassandraKeyspaceParameters - the parameters to provide for the current Cassandra keyspace. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraKeyspaceParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", err.Error()) - } - - req, err := client.CreateUpdateCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraKeyspacePreparer prepares the CreateUpdateCassandraKeyspace request. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithJSON(createUpdateCassandraKeyspaceParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraKeyspaceSender sends the CreateUpdateCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraKeyspaceFuture, 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 -} - -// CreateUpdateCassandraKeyspaceResponder handles the response to the CreateUpdateCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateCassandraTable create or update an Azure Cosmos DB Cassandra Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// createUpdateCassandraTableParameters - the parameters to provide for the current Cassandra Table. -func (client CassandraResourcesClient) CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", err.Error()) - } - - req, err := client.CreateUpdateCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraTablePreparer prepares the CreateUpdateCassandraTable request. -func (client CassandraResourcesClient) CreateUpdateCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateCassandraTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraTableSender sends the CreateUpdateCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraTableSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraTableFuture, 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 -} - -// CreateUpdateCassandraTableResponder handles the response to the CreateUpdateCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCassandraKeyspace deletes an existing Azure Cosmos DB Cassandra keyspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesDeleteCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraKeyspace") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", err.Error()) - } - - req, err := client.DeleteCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraKeyspacePreparer prepares the DeleteCassandraKeyspace request. -func (client CassandraResourcesClient) DeleteCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraKeyspaceSender sends the DeleteCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesDeleteCassandraKeyspaceFuture, 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 -} - -// DeleteCassandraKeyspaceResponder handles the response to the DeleteCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceResponder(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 -} - -// DeleteCassandraTable deletes an existing Azure Cosmos DB Cassandra table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesDeleteCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraTable", err.Error()) - } - - req, err := client.DeleteCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraTablePreparer prepares the DeleteCassandraTable request. -func (client CassandraResourcesClient) DeleteCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraTableSender sends the DeleteCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraTableSender(req *http.Request) (future CassandraResourcesDeleteCassandraTableFuture, 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 -} - -// DeleteCassandraTableResponder handles the response to the DeleteCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraTableResponder(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 -} - -// GetCassandraKeyspace gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraKeyspaceGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspace") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspace", err.Error()) - } - - req, err := client.GetCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspacePreparer prepares the GetCassandraKeyspace request. -func (client CassandraResourcesClient) GetCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceSender sends the GetCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceResponder handles the response to the GetCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraKeyspaceThroughput gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspaceThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.GetCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspaceThroughputPreparer prepares the GetCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceThroughputSender sends the GetCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceThroughputResponder handles the response to the GetCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTable gets the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraTableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTable", err.Error()) - } - - req, err := client.GetCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTablePreparer prepares the GetCassandraTable request. -func (client CassandraResourcesClient) GetCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableSender sends the GetCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableResponder handles the response to the GetCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTableThroughput gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", err.Error()) - } - - req, err := client.GetCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTableThroughputPreparer prepares the GetCassandraTableThroughput request. -func (client CassandraResourcesClient) GetCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableThroughputSender sends the GetCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableThroughputResponder handles the response to the GetCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraKeyspaces lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client CassandraResourcesClient) ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result CassandraKeyspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraKeyspaces") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", err.Error()) - } - - req, err := client.ListCassandraKeyspacesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraKeyspacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraKeyspacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraKeyspacesPreparer prepares the ListCassandraKeyspaces request. -func (client CassandraResourcesClient) ListCassandraKeyspacesPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraKeyspacesSender sends the ListCassandraKeyspaces request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraKeyspacesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraKeyspacesResponder handles the response to the ListCassandraKeyspaces request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraKeyspacesResponder(resp *http.Response) (result CassandraKeyspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraTables lists the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraTableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraTables", err.Error()) - } - - req, err := client.ListCassandraTablesPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraTablesPreparer prepares the ListCassandraTables request. -func (client CassandraResourcesClient) ListCassandraTablesPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraTablesSender sends the ListCassandraTables request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraTablesResponder handles the response to the ListCassandraTables request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraTablesResponder(resp *http.Response) (result CassandraTableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraKeyspaceToAutoscale migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to -// autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", err.Error()) - } - - req, err := client.MigrateCassandraKeyspaceToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraKeyspaceToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraKeyspaceToAutoscalePreparer prepares the MigrateCassandraKeyspaceToAutoscale request. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraKeyspaceToAutoscaleSender sends the MigrateCassandraKeyspaceToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, 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 -} - -// MigrateCassandraKeyspaceToAutoscaleResponder handles the response to the MigrateCassandraKeyspaceToAutoscale request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraKeyspaceToManualThroughput migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", err.Error()) - } - - req, err := client.MigrateCassandraKeyspaceToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraKeyspaceToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraKeyspaceToManualThroughputPreparer prepares the MigrateCassandraKeyspaceToManualThroughput request. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraKeyspaceToManualThroughputSender sends the MigrateCassandraKeyspaceToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, 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 -} - -// MigrateCassandraKeyspaceToManualThroughputResponder handles the response to the MigrateCassandraKeyspaceToManualThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraTableToAutoscale migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", err.Error()) - } - - req, err := client.MigrateCassandraTableToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraTableToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraTableToAutoscalePreparer prepares the MigrateCassandraTableToAutoscale request. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraTableToAutoscaleSender sends the MigrateCassandraTableToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToAutoscaleFuture, 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 -} - -// MigrateCassandraTableToAutoscaleResponder handles the response to the MigrateCassandraTableToAutoscale request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraTableToManualThroughput migrate an Azure Cosmos DB Cassandra table from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", err.Error()) - } - - req, err := client.MigrateCassandraTableToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraTableToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraTableToManualThroughputPreparer prepares the MigrateCassandraTableToManualThroughput request. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraTableToManualThroughputSender sends the MigrateCassandraTableToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToManualThroughputFuture, 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 -} - -// MigrateCassandraTableToManualThroughputResponder handles the response to the MigrateCassandraTableToManualThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraKeyspaceThroughput update RUs per second of an Azure Cosmos DB Cassandra Keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// Keyspace. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraKeyspaceThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.UpdateCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraKeyspaceThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraKeyspaceThroughputPreparer prepares the UpdateCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraKeyspaceThroughputSender sends the UpdateCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, 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 -} - -// UpdateCassandraKeyspaceThroughputResponder handles the response to the UpdateCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraTableThroughput update RUs per second of an Azure Cosmos DB Cassandra table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// table. -func (client CassandraResourcesClient) UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", err.Error()) - } - - req, err := client.UpdateCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraTableThroughputPreparer prepares the UpdateCassandraTableThroughput request. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraTableThroughputSender sends the UpdateCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraTableThroughputFuture, 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 -} - -// UpdateCassandraTableThroughputResponder handles the response to the UpdateCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/client.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/client.go deleted file mode 100644 index 441fa83a45d3..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package documentdb implements the Azure ARM Documentdb service API version . -// -// Azure Cosmos DB Database Service Resource Provider REST API -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Documentdb - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Documentdb. -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/cosmos-db/mgmt/2020-09-01-preview/documentdb/collection.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collection.go deleted file mode 100644 index e7d10f0eae3a..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collection.go +++ /dev/null @@ -1,323 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionClient struct { - BaseClient -} - -// NewCollectionClient creates an instance of the CollectionClient client. -func NewCollectionClient(subscriptionID string) CollectionClient { - return NewCollectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionClientWithBaseURI creates an instance of the CollectionClient 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 NewCollectionClientWithBaseURI(baseURI string, subscriptionID string) CollectionClient { - return CollectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -func (client CollectionClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client CollectionClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionpartition.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionpartition.go deleted file mode 100644 index e32d74d0f543..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionpartition.go +++ /dev/null @@ -1,230 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionClient struct { - BaseClient -} - -// NewCollectionPartitionClient creates an instance of the CollectionPartitionClient client. -func NewCollectionPartitionClient(subscriptionID string) CollectionPartitionClient { - return NewCollectionPartitionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionClientWithBaseURI creates an instance of the CollectionPartitionClient 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 NewCollectionPartitionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionClient { - return CollectionPartitionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionPartitionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionUsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionPartitionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListUsagesResponder(resp *http.Response) (result PartitionUsagesResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionpartitionregion.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionpartitionregion.go deleted file mode 100644 index 1c9b5fcf3b99..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionpartitionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionPartitionRegionClient struct { - BaseClient -} - -// NewCollectionPartitionRegionClient creates an instance of the CollectionPartitionRegionClient client. -func NewCollectionPartitionRegionClient(subscriptionID string) CollectionPartitionRegionClient { - return NewCollectionPartitionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionRegionClientWithBaseURI creates an instance of the CollectionPartitionRegionClient 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 NewCollectionPartitionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionRegionClient { - return CollectionPartitionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection and region, split by -// partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionregion.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionregion.go deleted file mode 100644 index 6f6853da00f2..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/collectionregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type CollectionRegionClient struct { - BaseClient -} - -// NewCollectionRegionClient creates an instance of the CollectionRegionClient client. -func NewCollectionRegionClient(subscriptionID string) CollectionRegionClient { - return NewCollectionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionRegionClientWithBaseURI creates an instance of the CollectionRegionClient 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 NewCollectionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionRegionClient { - return CollectionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account, collection and -// region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/database.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/database.go deleted file mode 100644 index 17f6e808d371..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/database.go +++ /dev/null @@ -1,317 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseClient struct { - BaseClient -} - -// NewDatabaseClient creates an instance of the DatabaseClient client. -func NewDatabaseClient(subscriptionID string) DatabaseClient { - return NewDatabaseClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseClientWithBaseURI creates an instance of the DatabaseClient 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 NewDatabaseClientWithBaseURI(baseURI string, subscriptionID string) DatabaseClient { - return DatabaseClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -func (client DatabaseClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/databaseaccountregion.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/databaseaccountregion.go deleted file mode 100644 index d46f959eb57f..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/databaseaccountregion.go +++ /dev/null @@ -1,129 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountRegionClient struct { - BaseClient -} - -// NewDatabaseAccountRegionClient creates an instance of the DatabaseAccountRegionClient client. -func NewDatabaseAccountRegionClient(subscriptionID string) DatabaseAccountRegionClient { - return NewDatabaseAccountRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountRegionClientWithBaseURI creates an instance of the DatabaseAccountRegionClient 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 NewDatabaseAccountRegionClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountRegionClient { - return DatabaseAccountRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/databaseaccounts.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/databaseaccounts.go deleted file mode 100644 index 4113fae70737..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/databaseaccounts.go +++ /dev/null @@ -1,1692 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountsClient is the azure Cosmos DB Database Service Resource Provider REST API -type DatabaseAccountsClient struct { - BaseClient -} - -// NewDatabaseAccountsClient creates an instance of the DatabaseAccountsClient client. -func NewDatabaseAccountsClient(subscriptionID string) DatabaseAccountsClient { - return NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountsClientWithBaseURI creates an instance of the DatabaseAccountsClient 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 NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountsClient { - return DatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameExists checks that the Azure Cosmos DB account name already exists. A valid account name may contain only -// lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. -// Parameters: -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.CheckNameExists") - 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: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CheckNameExists", err.Error()) - } - - req, err := client.CheckNameExistsPreparer(ctx, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") - return - } - - result, err = client.CheckNameExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameExistsPreparer prepares the CheckNameExists request. -func (client DatabaseAccountsClient) CheckNameExistsPreparer(ctx context.Context, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameExistsSender sends the CheckNameExists request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) CheckNameExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CheckNameExistsResponder handles the response to the CheckNameExists request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when -// performing updates on an account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// createUpdateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (result DatabaseAccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateParameters, - Constraints: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMaximum, Rule: int64(2147483647), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: int64(86400), Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: int64(5), Chain: nil}, - }}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.DatabaseAccountOfferType", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, createUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (*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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(createUpdateParameters), - 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 DatabaseAccountsClient) CreateOrUpdateSender(req *http.Request) (future DatabaseAccountsCreateOrUpdateFuture, 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 DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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 existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseAccountsClient) 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 = "2020-09-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) DeleteSender(req *http.Request) (future DatabaseAccountsDeleteFuture, 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 DatabaseAccountsClient) 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 -} - -// FailoverPriorityChange changes the failover priority for the Azure Cosmos DB database account. A failover priority -// of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover -// priority values must be unique for each of the regions in which the database account exists. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// failoverParameters - the new failover policies for the database account. -func (client DatabaseAccountsClient) FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (result DatabaseAccountsFailoverPriorityChangeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.FailoverPriorityChange") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: failoverParameters, - Constraints: []validation.Constraint{{Target: "failoverParameters.FailoverPolicies", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "FailoverPriorityChange", err.Error()) - } - - req, err := client.FailoverPriorityChangePreparer(ctx, resourceGroupName, accountName, failoverParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") - return - } - - result, err = client.FailoverPriorityChangeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPriorityChangePreparer prepares the FailoverPriorityChange request. -func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (*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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", pathParameters), - autorest.WithJSON(failoverParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverPriorityChangeSender sends the FailoverPriorityChange request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) FailoverPriorityChangeSender(req *http.Request) (future DatabaseAccountsFailoverPriorityChangeFuture, 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 -} - -// FailoverPriorityChangeResponder handles the response to the FailoverPriorityChange request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(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 retrieves the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseAccountsClient) 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 = "2020-09-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) 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 DatabaseAccountsClient) GetResponder(resp *http.Response) (result DatabaseAccountGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.GetReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", err.Error()) - } - - req, err := client.GetReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.GetReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// GetReadOnlyKeysPreparer prepares the GetReadOnlyKeys request. -func (client DatabaseAccountsClient) GetReadOnlyKeysPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetReadOnlyKeysSender sends the GetReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) GetReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetReadOnlyKeysResponder handles the response to the GetReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) GetReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, 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 the Azure Cosmos DB database accounts available under the subscription. -func (client DatabaseAccountsClient) List(ctx context.Context) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DatabaseAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the Azure Cosmos DB database accounts available under the given resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client DatabaseAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DatabaseAccountsClient) 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-09-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.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionStrings lists the connection strings for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListConnectionStrings") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListConnectionStrings", err.Error()) - } - - req, err := client.ListConnectionStringsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionStringsPreparer prepares the ListConnectionStrings request. -func (client DatabaseAccountsClient) ListConnectionStringsPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.Response) (result DatabaseAccountListConnectionStringsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DatabaseAccountsClient) ListKeysPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (result DatabaseAccountListKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions retrieves metric definitions for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetricDefinitions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseAccountsClient) ListMetricDefinitionsPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountsClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListReadOnlyKeys") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", err.Error()) - } - - req, err := client.ListReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.ListReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListReadOnlyKeysPreparer prepares the ListReadOnlyKeys request. -func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListReadOnlyKeysSender sends the ListReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListReadOnlyKeysResponder handles the response to the ListReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseAccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListUsages") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseAccountsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOffline - cosmos DB region to offline for the database account. -func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (result DatabaseAccountsOfflineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OfflineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOffline, - Constraints: []validation.Constraint{{Target: "regionParameterForOffline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OfflineRegion", err.Error()) - } - - req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOffline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OfflineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OfflineRegionPreparer prepares the OfflineRegion request. -func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (*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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/offlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOffline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OfflineRegionSender sends the OfflineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OfflineRegionSender(req *http.Request) (future DatabaseAccountsOfflineRegionFuture, 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 -} - -// OfflineRegionResponder handles the response to the OfflineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// OnlineRegion online the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOnline - cosmos DB region to online for the database account. -func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (result DatabaseAccountsOnlineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OnlineRegion") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOnline, - Constraints: []validation.Constraint{{Target: "regionParameterForOnline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OnlineRegion", err.Error()) - } - - req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOnline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OnlineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OnlineRegionPreparer prepares the OnlineRegion request. -func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (*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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/onlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOnline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OnlineRegionSender sends the OnlineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OnlineRegionSender(req *http.Request) (future DatabaseAccountsOnlineRegionFuture, 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 -} - -// OnlineRegionResponder handles the response to the OnlineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OnlineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateKey regenerates an access key for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyToRegenerate - the name of the key to regenerate. -func (client DatabaseAccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (result DatabaseAccountsRegenerateKeyFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.RegenerateKey") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, keyToRegenerate) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateKeySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DatabaseAccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (*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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(keyToRegenerate), - 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 DatabaseAccountsClient) RegenerateKeySender(req *http.Request) (future DatabaseAccountsRegenerateKeyFuture, 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 -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) RegenerateKeyResponder(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 the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// updateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (result DatabaseAccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabaseAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (*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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 DatabaseAccountsClient) UpdateSender(req *http.Request) (future DatabaseAccountsUpdateFuture, 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 DatabaseAccountsClient) UpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/documentdbapi/interfaces.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/documentdbapi/interfaces.go deleted file mode 100644 index 8e452caf71ea..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/documentdbapi/interfaces.go +++ /dev/null @@ -1,272 +0,0 @@ -package documentdbapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/cosmos-db/mgmt/2020-09-01-preview/documentdb" - "github.com/Azure/go-autorest/autorest" -) - -// DatabaseAccountsClientAPI contains the set of methods on the DatabaseAccountsClient type. -type DatabaseAccountsClientAPI interface { - CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters documentdb.DatabaseAccountCreateUpdateParameters) (result documentdb.DatabaseAccountsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountsDeleteFuture, err error) - FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters documentdb.FailoverPolicies) (result documentdb.DatabaseAccountsFailoverPriorityChangeFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountGetResults, err error) - GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - List(ctx context.Context) (result documentdb.DatabaseAccountsListResult, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result documentdb.DatabaseAccountsListResult, err error) - ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListConnectionStringsResult, err error) - ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListKeysResult, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.MetricListResult, err error) - ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.UsagesResult, err error) - OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOfflineRegionFuture, err error) - OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOnlineRegionFuture, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate documentdb.DatabaseAccountRegenerateKeyParameters) (result documentdb.DatabaseAccountsRegenerateKeyFuture, err error) - Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters documentdb.DatabaseAccountUpdateParameters) (result documentdb.DatabaseAccountsUpdateFuture, err error) -} - -var _ DatabaseAccountsClientAPI = (*documentdb.DatabaseAccountsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result documentdb.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result documentdb.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*documentdb.OperationsClient)(nil) - -// DatabaseClientAPI contains the set of methods on the DatabaseClient type. -type DatabaseClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ DatabaseClientAPI = (*documentdb.DatabaseClient)(nil) - -// CollectionClientAPI contains the set of methods on the CollectionClient type. -type CollectionClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ CollectionClientAPI = (*documentdb.CollectionClient)(nil) - -// CollectionRegionClientAPI contains the set of methods on the CollectionRegionClient type. -type CollectionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ CollectionRegionClientAPI = (*documentdb.CollectionRegionClient)(nil) - -// DatabaseAccountRegionClientAPI contains the set of methods on the DatabaseAccountRegionClient type. -type DatabaseAccountRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ DatabaseAccountRegionClientAPI = (*documentdb.DatabaseAccountRegionClient)(nil) - -// PercentileSourceTargetClientAPI contains the set of methods on the PercentileSourceTargetClient type. -type PercentileSourceTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileSourceTargetClientAPI = (*documentdb.PercentileSourceTargetClient)(nil) - -// PercentileTargetClientAPI contains the set of methods on the PercentileTargetClient type. -type PercentileTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileTargetClientAPI = (*documentdb.PercentileTargetClient)(nil) - -// PercentileClientAPI contains the set of methods on the PercentileClient type. -type PercentileClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileClientAPI = (*documentdb.PercentileClient)(nil) - -// CollectionPartitionRegionClientAPI contains the set of methods on the CollectionPartitionRegionClient type. -type CollectionPartitionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ CollectionPartitionRegionClientAPI = (*documentdb.CollectionPartitionRegionClient)(nil) - -// CollectionPartitionClientAPI contains the set of methods on the CollectionPartitionClient type. -type CollectionPartitionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionUsagesResult, err error) -} - -var _ CollectionPartitionClientAPI = (*documentdb.CollectionPartitionClient)(nil) - -// PartitionKeyRangeIDClientAPI contains the set of methods on the PartitionKeyRangeIDClient type. -type PartitionKeyRangeIDClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDClientAPI = (*documentdb.PartitionKeyRangeIDClient)(nil) - -// PartitionKeyRangeIDRegionClientAPI contains the set of methods on the PartitionKeyRangeIDRegionClient type. -type PartitionKeyRangeIDRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDRegionClientAPI = (*documentdb.PartitionKeyRangeIDRegionClient)(nil) - -// SQLResourcesClientAPI contains the set of methods on the SQLResourcesClient type. -type SQLResourcesClientAPI interface { - CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters documentdb.SQLContainerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLContainerFuture, err error) - CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters documentdb.SQLDatabaseCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture, err error) - CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters documentdb.SQLStoredProcedureCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) - CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters documentdb.SQLTriggerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLTriggerFuture, err error) - CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters documentdb.SQLUserDefinedFunctionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) - DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesDeleteSQLContainerFuture, err error) - DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesDeleteSQLDatabaseFuture, err error) - DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLResourcesDeleteSQLStoredProcedureFuture, err error) - DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLResourcesDeleteSQLTriggerFuture, err error) - DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) - GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLContainerGetResults, err error) - GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLDatabaseGetResults, err error) - GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLStoredProcedureGetResults, err error) - GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLTriggerGetResults, err error) - GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLUserDefinedFunctionGetResults, err error) - ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLContainerListResult, err error) - ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLDatabaseListResult, err error) - ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLStoredProcedureListResult, err error) - ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLTriggerListResult, err error) - ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLUserDefinedFunctionListResult, err error) - MigrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) - MigrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) - MigrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) - MigrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) - UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLContainerThroughputFuture, err error) - UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) -} - -var _ SQLResourcesClientAPI = (*documentdb.SQLResourcesClient)(nil) - -// MongoDBResourcesClientAPI contains the set of methods on the MongoDBResourcesClient type. -type MongoDBResourcesClientAPI interface { - CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters documentdb.MongoDBCollectionCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) - CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters documentdb.MongoDBDatabaseCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) - DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture, err error) - DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) - GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBCollectionGetResults, err error) - GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBDatabaseGetResults, err error) - GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBCollectionListResult, err error) - ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MongoDBDatabaseListResult, err error) - MigrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) - MigrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) - MigrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) - MigrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) - UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) - UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) -} - -var _ MongoDBResourcesClientAPI = (*documentdb.MongoDBResourcesClient)(nil) - -// TableResourcesClientAPI contains the set of methods on the TableResourcesClient type. -type TableResourcesClientAPI interface { - CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters documentdb.TableCreateUpdateParameters) (result documentdb.TableResourcesCreateUpdateTableFuture, err error) - DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesDeleteTableFuture, err error) - GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableGetResults, err error) - GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListTables(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.TableListResult, err error) - MigrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesMigrateTableToAutoscaleFuture, err error) - MigrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesMigrateTableToManualThroughputFuture, err error) - UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.TableResourcesUpdateTableThroughputFuture, err error) -} - -var _ TableResourcesClientAPI = (*documentdb.TableResourcesClient)(nil) - -// CassandraResourcesClientAPI contains the set of methods on the CassandraResourcesClient type. -type CassandraResourcesClientAPI interface { - CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters documentdb.CassandraKeyspaceCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) - CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters documentdb.CassandraTableCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraTableFuture, err error) - DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture, err error) - DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesDeleteCassandraTableFuture, err error) - GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraKeyspaceGetResults, err error) - GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraTableGetResults, err error) - GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.CassandraKeyspaceListResult, err error) - ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraTableListResult, err error) - MigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) - MigrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) - MigrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) - MigrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) - UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) - UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture, err error) -} - -var _ CassandraResourcesClientAPI = (*documentdb.CassandraResourcesClient)(nil) - -// GremlinResourcesClientAPI contains the set of methods on the GremlinResourcesClient type. -type GremlinResourcesClientAPI interface { - CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters documentdb.GremlinDatabaseCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) - CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters documentdb.GremlinGraphCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture, err error) - DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesDeleteGremlinDatabaseFuture, err error) - DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesDeleteGremlinGraphFuture, err error) - GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinDatabaseGetResults, err error) - GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinGraphGetResults, err error) - GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.GremlinDatabaseListResult, err error) - ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinGraphListResult, err error) - MigrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) - MigrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) - MigrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) - MigrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) - UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) - UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) -} - -var _ GremlinResourcesClientAPI = (*documentdb.GremlinResourcesClient)(nil) - -// NotebookWorkspacesClientAPI contains the set of methods on the NotebookWorkspacesClient type. -type NotebookWorkspacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters documentdb.NotebookWorkspaceCreateUpdateParameters) (result documentdb.NotebookWorkspacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspace, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceListResult, err error) - ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceConnectionInfoResult, err error) - RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesRegenerateAuthTokenFuture, err error) - Start(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesStartFuture, err error) -} - -var _ NotebookWorkspacesClientAPI = (*documentdb.NotebookWorkspacesClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result documentdb.PrivateLinkResource, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateLinkResourceListResult, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*documentdb.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters documentdb.PrivateEndpointConnection) (result documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnection, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateEndpointConnectionListResult, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*documentdb.PrivateEndpointConnectionsClient)(nil) diff --git a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/enums.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/enums.go deleted file mode 100644 index 5f5c212f9fe8..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/enums.go +++ /dev/null @@ -1,357 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// BackupPolicyType enumerates the values for backup policy type. -type BackupPolicyType string - -const ( - // Continuous ... - Continuous BackupPolicyType = "Continuous" - // Periodic ... - Periodic BackupPolicyType = "Periodic" -) - -// PossibleBackupPolicyTypeValues returns an array of possible values for the BackupPolicyType const type. -func PossibleBackupPolicyTypeValues() []BackupPolicyType { - return []BackupPolicyType{Continuous, Periodic} -} - -// CompositePathSortOrder enumerates the values for composite path sort order. -type CompositePathSortOrder string - -const ( - // Ascending ... - Ascending CompositePathSortOrder = "Ascending" - // Descending ... - Descending CompositePathSortOrder = "Descending" -) - -// PossibleCompositePathSortOrderValues returns an array of possible values for the CompositePathSortOrder const type. -func PossibleCompositePathSortOrderValues() []CompositePathSortOrder { - return []CompositePathSortOrder{Ascending, Descending} -} - -// ConflictResolutionMode enumerates the values for conflict resolution mode. -type ConflictResolutionMode string - -const ( - // Custom ... - Custom ConflictResolutionMode = "Custom" - // LastWriterWins ... - LastWriterWins ConflictResolutionMode = "LastWriterWins" -) - -// PossibleConflictResolutionModeValues returns an array of possible values for the ConflictResolutionMode const type. -func PossibleConflictResolutionModeValues() []ConflictResolutionMode { - return []ConflictResolutionMode{Custom, LastWriterWins} -} - -// ConnectorOffer enumerates the values for connector offer. -type ConnectorOffer string - -const ( - // Small ... - Small ConnectorOffer = "Small" -) - -// PossibleConnectorOfferValues returns an array of possible values for the ConnectorOffer const type. -func PossibleConnectorOfferValues() []ConnectorOffer { - return []ConnectorOffer{Small} -} - -// DatabaseAccountKind enumerates the values for database account kind. -type DatabaseAccountKind string - -const ( - // GlobalDocumentDB ... - GlobalDocumentDB DatabaseAccountKind = "GlobalDocumentDB" - // MongoDB ... - MongoDB DatabaseAccountKind = "MongoDB" - // Parse ... - Parse DatabaseAccountKind = "Parse" -) - -// PossibleDatabaseAccountKindValues returns an array of possible values for the DatabaseAccountKind const type. -func PossibleDatabaseAccountKindValues() []DatabaseAccountKind { - return []DatabaseAccountKind{GlobalDocumentDB, MongoDB, Parse} -} - -// DatabaseAccountOfferType enumerates the values for database account offer type. -type DatabaseAccountOfferType string - -const ( - // Standard ... - Standard DatabaseAccountOfferType = "Standard" -) - -// PossibleDatabaseAccountOfferTypeValues returns an array of possible values for the DatabaseAccountOfferType const type. -func PossibleDatabaseAccountOfferTypeValues() []DatabaseAccountOfferType { - return []DatabaseAccountOfferType{Standard} -} - -// DataType enumerates the values for data type. -type DataType string - -const ( - // LineString ... - LineString DataType = "LineString" - // MultiPolygon ... - MultiPolygon DataType = "MultiPolygon" - // Number ... - Number DataType = "Number" - // Point ... - Point DataType = "Point" - // Polygon ... - Polygon DataType = "Polygon" - // String ... - String DataType = "String" -) - -// PossibleDataTypeValues returns an array of possible values for the DataType const type. -func PossibleDataTypeValues() []DataType { - return []DataType{LineString, MultiPolygon, Number, Point, Polygon, String} -} - -// DefaultConsistencyLevel enumerates the values for default consistency level. -type DefaultConsistencyLevel string - -const ( - // BoundedStaleness ... - BoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" - // ConsistentPrefix ... - ConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" - // Eventual ... - Eventual DefaultConsistencyLevel = "Eventual" - // Session ... - Session DefaultConsistencyLevel = "Session" - // Strong ... - Strong DefaultConsistencyLevel = "Strong" -) - -// PossibleDefaultConsistencyLevelValues returns an array of possible values for the DefaultConsistencyLevel const type. -func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { - return []DefaultConsistencyLevel{BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong} -} - -// IndexingMode enumerates the values for indexing mode. -type IndexingMode string - -const ( - // Consistent ... - Consistent IndexingMode = "Consistent" - // Lazy ... - Lazy IndexingMode = "Lazy" - // None ... - None IndexingMode = "None" -) - -// PossibleIndexingModeValues returns an array of possible values for the IndexingMode const type. -func PossibleIndexingModeValues() []IndexingMode { - return []IndexingMode{Consistent, Lazy, None} -} - -// IndexKind enumerates the values for index kind. -type IndexKind string - -const ( - // Hash ... - Hash IndexKind = "Hash" - // Range ... - Range IndexKind = "Range" - // Spatial ... - Spatial IndexKind = "Spatial" -) - -// PossibleIndexKindValues returns an array of possible values for the IndexKind const type. -func PossibleIndexKindValues() []IndexKind { - return []IndexKind{Hash, Range, Spatial} -} - -// KeyKind enumerates the values for key kind. -type KeyKind string - -const ( - // Primary ... - Primary KeyKind = "primary" - // PrimaryReadonly ... - PrimaryReadonly KeyKind = "primaryReadonly" - // Secondary ... - Secondary KeyKind = "secondary" - // SecondaryReadonly ... - SecondaryReadonly KeyKind = "secondaryReadonly" -) - -// PossibleKeyKindValues returns an array of possible values for the KeyKind const type. -func PossibleKeyKindValues() []KeyKind { - return []KeyKind{Primary, PrimaryReadonly, Secondary, SecondaryReadonly} -} - -// PartitionKind enumerates the values for partition kind. -type PartitionKind string - -const ( - // PartitionKindHash ... - PartitionKindHash PartitionKind = "Hash" - // PartitionKindRange ... - PartitionKindRange PartitionKind = "Range" -) - -// PossiblePartitionKindValues returns an array of possible values for the PartitionKind const type. -func PossiblePartitionKindValues() []PartitionKind { - return []PartitionKind{PartitionKindHash, PartitionKindRange} -} - -// PrimaryAggregationType enumerates the values for primary aggregation type. -type PrimaryAggregationType string - -const ( - // PrimaryAggregationTypeAverage ... - PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" - // PrimaryAggregationTypeLast ... - PrimaryAggregationTypeLast PrimaryAggregationType = "Last" - // PrimaryAggregationTypeMaximum ... - PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" - // PrimaryAggregationTypeMinimum ... - PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" - // PrimaryAggregationTypeNone ... - PrimaryAggregationTypeNone PrimaryAggregationType = "None" - // PrimaryAggregationTypeTotal ... - PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" -) - -// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeLast, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // Disabled ... - Disabled PublicNetworkAccess = "Disabled" - // Enabled ... - Enabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{Disabled, Enabled} -} - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // ThreeFullStopSix ... - ThreeFullStopSix ServerVersion = "3.6" - // ThreeFullStopTwo ... - ThreeFullStopTwo ServerVersion = "3.2" -) - -// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. -func PossibleServerVersionValues() []ServerVersion { - return []ServerVersion{ThreeFullStopSix, ThreeFullStopTwo} -} - -// SpatialType enumerates the values for spatial type. -type SpatialType string - -const ( - // SpatialTypeLineString ... - SpatialTypeLineString SpatialType = "LineString" - // SpatialTypeMultiPolygon ... - SpatialTypeMultiPolygon SpatialType = "MultiPolygon" - // SpatialTypePoint ... - SpatialTypePoint SpatialType = "Point" - // SpatialTypePolygon ... - SpatialTypePolygon SpatialType = "Polygon" -) - -// PossibleSpatialTypeValues returns an array of possible values for the SpatialType const type. -func PossibleSpatialTypeValues() []SpatialType { - return []SpatialType{SpatialTypeLineString, SpatialTypeMultiPolygon, SpatialTypePoint, SpatialTypePolygon} -} - -// TriggerOperation enumerates the values for trigger operation. -type TriggerOperation string - -const ( - // All ... - All TriggerOperation = "All" - // Create ... - Create TriggerOperation = "Create" - // Delete ... - Delete TriggerOperation = "Delete" - // Replace ... - Replace TriggerOperation = "Replace" - // Update ... - Update TriggerOperation = "Update" -) - -// PossibleTriggerOperationValues returns an array of possible values for the TriggerOperation const type. -func PossibleTriggerOperationValues() []TriggerOperation { - return []TriggerOperation{All, Create, Delete, Replace, Update} -} - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // Post ... - Post TriggerType = "Post" - // Pre ... - Pre TriggerType = "Pre" -) - -// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. -func PossibleTriggerTypeValues() []TriggerType { - return []TriggerType{Post, Pre} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeBackupPolicy ... - TypeBackupPolicy Type = "BackupPolicy" - // TypeContinuous ... - TypeContinuous Type = "Continuous" - // TypePeriodic ... - TypePeriodic Type = "Periodic" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeBackupPolicy, TypeContinuous, TypePeriodic} -} - -// UnitType enumerates the values for unit type. -type UnitType string - -const ( - // Bytes ... - Bytes UnitType = "Bytes" - // BytesPerSecond ... - BytesPerSecond UnitType = "BytesPerSecond" - // Count ... - Count UnitType = "Count" - // CountPerSecond ... - CountPerSecond UnitType = "CountPerSecond" - // Milliseconds ... - Milliseconds UnitType = "Milliseconds" - // Percent ... - Percent UnitType = "Percent" - // Seconds ... - Seconds UnitType = "Seconds" -) - -// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{Bytes, BytesPerSecond, Count, CountPerSecond, Milliseconds, Percent, Seconds} -} diff --git a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/gremlinresources.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/gremlinresources.go deleted file mode 100644 index c06231bdaf60..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/gremlinresources.go +++ /dev/null @@ -1,1593 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GremlinResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type GremlinResourcesClient struct { - BaseClient -} - -// NewGremlinResourcesClient creates an instance of the GremlinResourcesClient client. -func NewGremlinResourcesClient(subscriptionID string) GremlinResourcesClient { - return NewGremlinResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGremlinResourcesClientWithBaseURI creates an instance of the GremlinResourcesClient 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 NewGremlinResourcesClientWithBaseURI(baseURI string, subscriptionID string) GremlinResourcesClient { - return GremlinResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateGremlinDatabase create or update an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateGremlinDatabaseParameters - the parameters to provide for the current Gremlin database. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", err.Error()) - } - - req, err := client.CreateUpdateGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinDatabasePreparer prepares the CreateUpdateGremlinDatabase request. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateGremlinDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinDatabaseSender sends the CreateUpdateGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinDatabaseFuture, 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 -} - -// CreateUpdateGremlinDatabaseResponder handles the response to the CreateUpdateGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateGremlinGraph create or update an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// createUpdateGremlinGraphParameters - the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinGraphParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", err.Error()) - } - - req, err := client.CreateUpdateGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinGraphPreparer prepares the CreateUpdateGremlinGraph request. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithJSON(createUpdateGremlinGraphParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinGraphSender sends the CreateUpdateGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinGraphFuture, 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 -} - -// CreateUpdateGremlinGraphResponder handles the response to the CreateUpdateGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteGremlinDatabase deletes an existing Azure Cosmos DB Gremlin database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesDeleteGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", err.Error()) - } - - req, err := client.DeleteGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinDatabasePreparer prepares the DeleteGremlinDatabase request. -func (client GremlinResourcesClient) DeleteGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinDatabaseSender sends the DeleteGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinDatabaseSender(req *http.Request) (future GremlinResourcesDeleteGremlinDatabaseFuture, 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 -} - -// DeleteGremlinDatabaseResponder handles the response to the DeleteGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinDatabaseResponder(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 -} - -// DeleteGremlinGraph deletes an existing Azure Cosmos DB Gremlin graph. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesDeleteGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinGraph") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinGraph", err.Error()) - } - - req, err := client.DeleteGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinGraphPreparer prepares the DeleteGremlinGraph request. -func (client GremlinResourcesClient) DeleteGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinGraphSender sends the DeleteGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinGraphSender(req *http.Request) (future GremlinResourcesDeleteGremlinGraphFuture, 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 -} - -// DeleteGremlinGraphResponder handles the response to the DeleteGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinGraphResponder(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 -} - -// GetGremlinDatabase gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabase", err.Error()) - } - - req, err := client.GetGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabasePreparer prepares the GetGremlinDatabase request. -func (client GremlinResourcesClient) GetGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseSender sends the GetGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseResponder handles the response to the GetGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinDatabaseThroughput gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.GetGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabaseThroughputPreparer prepares the GetGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseThroughputSender sends the GetGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseThroughputResponder handles the response to the GetGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraph gets the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinGraphGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraph") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraph", err.Error()) - } - - req, err := client.GetGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphPreparer prepares the GetGremlinGraph request. -func (client GremlinResourcesClient) GetGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphSender sends the GetGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphResponder handles the response to the GetGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraphThroughput gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with -// the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraphThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", err.Error()) - } - - req, err := client.GetGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphThroughputPreparer prepares the GetGremlinGraphThroughput request. -func (client GremlinResourcesClient) GetGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphThroughputSender sends the GetGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphThroughputResponder handles the response to the GetGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinDatabases lists the Gremlin databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client GremlinResourcesClient) ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result GremlinDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinDatabases", err.Error()) - } - - req, err := client.ListGremlinDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinDatabasesPreparer prepares the ListGremlinDatabases request. -func (client GremlinResourcesClient) ListGremlinDatabasesPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinDatabasesSender sends the ListGremlinDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinDatabasesResponder handles the response to the ListGremlinDatabases request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinDatabasesResponder(resp *http.Response) (result GremlinDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinGraphs lists the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinGraphListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinGraphs") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinGraphs", err.Error()) - } - - req, err := client.ListGremlinGraphsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinGraphsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinGraphsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinGraphsPreparer prepares the ListGremlinGraphs request. -func (client GremlinResourcesClient) ListGremlinGraphsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinGraphsSender sends the ListGremlinGraphs request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinGraphsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinGraphsResponder handles the response to the ListGremlinGraphs request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinGraphsResponder(resp *http.Response) (result GremlinGraphListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinDatabaseToAutoscale migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateGremlinDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinDatabaseToAutoscalePreparer prepares the MigrateGremlinDatabaseToAutoscale request. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinDatabaseToAutoscaleSender sends the MigrateGremlinDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, 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 -} - -// MigrateGremlinDatabaseToAutoscaleResponder handles the response to the MigrateGremlinDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinDatabaseToManualThroughput migrate an Azure Cosmos DB Gremlin database from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateGremlinDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinDatabaseToManualThroughputPreparer prepares the MigrateGremlinDatabaseToManualThroughput request. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinDatabaseToManualThroughputSender sends the MigrateGremlinDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, 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 -} - -// MigrateGremlinDatabaseToManualThroughputResponder handles the response to the MigrateGremlinDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinGraphToAutoscale migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", err.Error()) - } - - req, err := client.MigrateGremlinGraphToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinGraphToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinGraphToAutoscalePreparer prepares the MigrateGremlinGraphToAutoscale request. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinGraphToAutoscaleSender sends the MigrateGremlinGraphToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, 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 -} - -// MigrateGremlinGraphToAutoscaleResponder handles the response to the MigrateGremlinGraphToAutoscale request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinGraphToManualThroughput migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", err.Error()) - } - - req, err := client.MigrateGremlinGraphToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinGraphToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinGraphToManualThroughputPreparer prepares the MigrateGremlinGraphToManualThroughput request. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinGraphToManualThroughputSender sends the MigrateGremlinGraphToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, 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 -} - -// MigrateGremlinGraphToManualThroughputResponder handles the response to the MigrateGremlinGraphToManualThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinDatabaseThroughput update RUs per second of an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin -// database. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinDatabaseThroughputPreparer prepares the UpdateGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinDatabaseThroughputSender sends the UpdateGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinDatabaseThroughputFuture, 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 -} - -// UpdateGremlinDatabaseThroughputResponder handles the response to the UpdateGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinGraphThroughput update RUs per second of an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinGraphThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", err.Error()) - } - - req, err := client.UpdateGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinGraphThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinGraphThroughputPreparer prepares the UpdateGremlinGraphThroughput request. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinGraphThroughputSender sends the UpdateGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinGraphThroughputFuture, 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 -} - -// UpdateGremlinGraphThroughputResponder handles the response to the UpdateGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/models.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/models.go deleted file mode 100644 index 1bf24383a13e..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/models.go +++ /dev/null @@ -1,8846 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb" - -// APIProperties ... -type APIProperties struct { - // ServerVersion - Describes the ServerVersion of an a MongoDB account. Possible values include: 'ThreeFullStopTwo', 'ThreeFullStopSix' - ServerVersion ServerVersion `json:"serverVersion,omitempty"` -} - -// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other -// than required location and tags -type ARMProxyResource struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ARMProxyResource. -func (apr ARMProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ARMResourceProperties the core properties of ARM resources. -type ARMResourceProperties struct { - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ARMResourceProperties. -func (arp ARMResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Location != nil { - objectMap["location"] = arp.Location - } - if arp.Tags != nil { - objectMap["tags"] = arp.Tags - } - return json.Marshal(objectMap) -} - -// AutoscaleSettings ... -type AutoscaleSettings struct { - // MaxThroughput - Represents maximum throughput, the resource can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` -} - -// AutoscaleSettingsResource cosmos DB provisioned throughput settings object -type AutoscaleSettingsResource struct { - // MaxThroughput - Represents maximum throughput container can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` - // AutoUpgradePolicy - Cosmos DB resource auto-upgrade policy - AutoUpgradePolicy *AutoUpgradePolicyResource `json:"autoUpgradePolicy,omitempty"` - // TargetMaxThroughput - READ-ONLY; Represents target maximum throughput container can scale up to once offer is no longer in pending state. - TargetMaxThroughput *int32 `json:"targetMaxThroughput,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingsResource. -func (asr AutoscaleSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.MaxThroughput != nil { - objectMap["maxThroughput"] = asr.MaxThroughput - } - if asr.AutoUpgradePolicy != nil { - objectMap["autoUpgradePolicy"] = asr.AutoUpgradePolicy - } - return json.Marshal(objectMap) -} - -// AutoUpgradePolicyResource cosmos DB resource auto-upgrade policy -type AutoUpgradePolicyResource struct { - // ThroughputPolicy - Represents throughput policy which service must adhere to for auto-upgrade - ThroughputPolicy *ThroughputPolicyResource `json:"throughputPolicy,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) -} - -// BasicBackupPolicy the object representing the policy for taking backups on an account. -type BasicBackupPolicy interface { - AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) - AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) - AsBackupPolicy() (*BackupPolicy, bool) -} - -// BackupPolicy the object representing the policy for taking backups on an account. -type BackupPolicy struct { - // Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicBackupPolicy(body []byte) (BasicBackupPolicy, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypePeriodic): - var pmbp PeriodicModeBackupPolicy - err := json.Unmarshal(body, &pmbp) - return pmbp, err - case string(TypeContinuous): - var cmbp ContinuousModeBackupPolicy - err := json.Unmarshal(body, &cmbp) - return cmbp, err - default: - var bp BackupPolicy - err := json.Unmarshal(body, &bp) - return bp, err - } -} -func unmarshalBasicBackupPolicyArray(body []byte) ([]BasicBackupPolicy, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - bpArray := make([]BasicBackupPolicy, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bp, err := unmarshalBasicBackupPolicy(*rawMessage) - if err != nil { - return nil, err - } - bpArray[index] = bp - } - return bpArray, nil -} - -// MarshalJSON is the custom marshaler for BackupPolicy. -func (bp BackupPolicy) MarshalJSON() ([]byte, error) { - bp.Type = TypeBackupPolicy - objectMap := make(map[string]interface{}) - if bp.Type != "" { - objectMap["type"] = bp.Type - } - return json.Marshal(objectMap) -} - -// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) { - return nil, false -} - -// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) { - return nil, false -} - -// AsBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return &bp, true -} - -// AsBasicBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) { - return &bp, true -} - -// Capability cosmos DB capability object -type Capability struct { - // Name - Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". - Name *string `json:"name,omitempty"` -} - -// CassandraKeyspaceCreateUpdateParameters parameters to create and update Cosmos DB Cassandra keyspace. -type CassandraKeyspaceCreateUpdateParameters struct { - // CassandraKeyspaceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra keyspace. - *CassandraKeyspaceCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceCreateUpdateParameters. -func (ckcup CassandraKeyspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckcup.CassandraKeyspaceCreateUpdateProperties != nil { - objectMap["properties"] = ckcup.CassandraKeyspaceCreateUpdateProperties - } - if ckcup.Location != nil { - objectMap["location"] = ckcup.Location - } - if ckcup.Tags != nil { - objectMap["tags"] = ckcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceCreateUpdateParameters struct. -func (ckcup *CassandraKeyspaceCreateUpdateParameters) 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 cassandraKeyspaceCreateUpdateProperties CassandraKeyspaceCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraKeyspaceCreateUpdateProperties) - if err != nil { - return err - } - ckcup.CassandraKeyspaceCreateUpdateProperties = &cassandraKeyspaceCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckcup.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra -// keyspace. -type CassandraKeyspaceCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra keyspace - Resource *CassandraKeyspaceResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetProperties the properties of an Azure Cosmos DB Cassandra keyspace -type CassandraKeyspaceGetProperties struct { - Resource *CassandraKeyspaceGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraKeyspaceGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetPropertiesOptions ... -type CassandraKeyspaceGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// CassandraKeyspaceGetPropertiesResource ... -type CassandraKeyspaceGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetPropertiesResource. -func (ckgp CassandraKeyspaceGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgp.ID != nil { - objectMap["id"] = ckgp.ID - } - return json.Marshal(objectMap) -} - -// CassandraKeyspaceGetResults an Azure Cosmos DB Cassandra keyspace. -type CassandraKeyspaceGetResults struct { - autorest.Response `json:"-"` - // CassandraKeyspaceGetProperties - The properties of an Azure Cosmos DB Cassandra keyspace - *CassandraKeyspaceGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetResults. -func (ckgr CassandraKeyspaceGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgr.CassandraKeyspaceGetProperties != nil { - objectMap["properties"] = ckgr.CassandraKeyspaceGetProperties - } - if ckgr.Location != nil { - objectMap["location"] = ckgr.Location - } - if ckgr.Tags != nil { - objectMap["tags"] = ckgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceGetResults struct. -func (ckgr *CassandraKeyspaceGetResults) 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 cassandraKeyspaceGetProperties CassandraKeyspaceGetProperties - err = json.Unmarshal(*v, &cassandraKeyspaceGetProperties) - if err != nil { - return err - } - ckgr.CassandraKeyspaceGetProperties = &cassandraKeyspaceGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckgr.Tags = tags - } - } - } - - return nil -} - -// CassandraKeyspaceListResult the List operation response, that contains the Cassandra keyspaces and their -// properties. -type CassandraKeyspaceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra keyspaces and their properties. - Value *[]CassandraKeyspaceGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceListResult. -func (cklr CassandraKeyspaceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraKeyspaceResource cosmos DB Cassandra keyspace resource object -type CassandraKeyspaceResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` -} - -// CassandraPartitionKey cosmos DB Cassandra table partition key -type CassandraPartitionKey struct { - // Name - Name of the Cosmos DB Cassandra table partition key - Name *string `json:"name,omitempty"` -} - -// CassandraResourcesCreateUpdateCassandraKeyspaceFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraKeyspaceGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) 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 CassandraResourcesCreateUpdateCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ckgr CassandraKeyspaceGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ckgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ckgr.Response.Response, err = future.GetResult(sender); err == nil && ckgr.Response.Response.StatusCode != http.StatusNoContent { - ckgr, err = client.CreateUpdateCassandraKeyspaceResponder(ckgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", ckgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraTableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) 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 CassandraResourcesCreateUpdateCassandraTableFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) result(client CassandraResourcesClient) (ctgr CassandraTableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ctgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ctgr.Response.Response, err = future.GetResult(sender); err == nil && ctgr.Response.Response.StatusCode != http.StatusNoContent { - ctgr, err = client.CreateUpdateCassandraTableResponder(ctgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", ctgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type CassandraResourcesDeleteCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) 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 CassandraResourcesDeleteCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type CassandraResourcesDeleteCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraTableFuture) 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 CassandraResourcesDeleteCassandraTableFuture.Result. -func (future *CassandraResourcesDeleteCassandraTableFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraTableFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture) 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 CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture.Result. -func (future *CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraKeyspaceToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture) 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 CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture.Result. -func (future *CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraKeyspaceToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraTableToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesMigrateCassandraTableToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraTableToAutoscaleFuture) 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 CassandraResourcesMigrateCassandraTableToAutoscaleFuture.Result. -func (future *CassandraResourcesMigrateCassandraTableToAutoscaleFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraTableToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraTableToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type CassandraResourcesMigrateCassandraTableToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraTableToManualThroughputFuture) 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 CassandraResourcesMigrateCassandraTableToManualThroughputFuture.Result. -func (future *CassandraResourcesMigrateCassandraTableToManualThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraTableToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesUpdateCassandraKeyspaceThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) 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 CassandraResourcesUpdateCassandraKeyspaceThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraKeyspaceThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraTableThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesUpdateCassandraTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) 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 CassandraResourcesUpdateCassandraTableThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraSchema cosmos DB Cassandra table schema -type CassandraSchema struct { - // Columns - List of Cassandra table columns. - Columns *[]Column `json:"columns,omitempty"` - // PartitionKeys - List of partition key. - PartitionKeys *[]CassandraPartitionKey `json:"partitionKeys,omitempty"` - // ClusterKeys - List of cluster key. - ClusterKeys *[]ClusterKey `json:"clusterKeys,omitempty"` -} - -// CassandraTableCreateUpdateParameters parameters to create and update Cosmos DB Cassandra table. -type CassandraTableCreateUpdateParameters struct { - // CassandraTableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra table. - *CassandraTableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableCreateUpdateParameters. -func (ctcup CassandraTableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcup.CassandraTableCreateUpdateProperties != nil { - objectMap["properties"] = ctcup.CassandraTableCreateUpdateProperties - } - if ctcup.Location != nil { - objectMap["location"] = ctcup.Location - } - if ctcup.Tags != nil { - objectMap["tags"] = ctcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableCreateUpdateParameters struct. -func (ctcup *CassandraTableCreateUpdateParameters) 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 cassandraTableCreateUpdateProperties CassandraTableCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraTableCreateUpdateProperties) - if err != nil { - return err - } - ctcup.CassandraTableCreateUpdateProperties = &cassandraTableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctcup.Tags = tags - } - } - } - - return nil -} - -// CassandraTableCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra table. -type CassandraTableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra table - Resource *CassandraTableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraTableGetProperties the properties of an Azure Cosmos DB Cassandra table -type CassandraTableGetProperties struct { - Resource *CassandraTableGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraTableGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraTableGetPropertiesOptions ... -type CassandraTableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// CassandraTableGetPropertiesResource ... -type CassandraTableGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetPropertiesResource. -func (ctgp CassandraTableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgp.ID != nil { - objectMap["id"] = ctgp.ID - } - if ctgp.DefaultTTL != nil { - objectMap["defaultTtl"] = ctgp.DefaultTTL - } - if ctgp.Schema != nil { - objectMap["schema"] = ctgp.Schema - } - if ctgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = ctgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// CassandraTableGetResults an Azure Cosmos DB Cassandra table. -type CassandraTableGetResults struct { - autorest.Response `json:"-"` - // CassandraTableGetProperties - The properties of an Azure Cosmos DB Cassandra table - *CassandraTableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetResults. -func (ctgr CassandraTableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgr.CassandraTableGetProperties != nil { - objectMap["properties"] = ctgr.CassandraTableGetProperties - } - if ctgr.Location != nil { - objectMap["location"] = ctgr.Location - } - if ctgr.Tags != nil { - objectMap["tags"] = ctgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableGetResults struct. -func (ctgr *CassandraTableGetResults) 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 cassandraTableGetProperties CassandraTableGetProperties - err = json.Unmarshal(*v, &cassandraTableGetProperties) - if err != nil { - return err - } - ctgr.CassandraTableGetProperties = &cassandraTableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctgr.Tags = tags - } - } - } - - return nil -} - -// CassandraTableListResult the List operation response, that contains the Cassandra tables and their -// properties. -type CassandraTableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra tables and their properties. - Value *[]CassandraTableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableListResult. -func (ctlr CassandraTableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraTableResource cosmos DB Cassandra table resource object -type CassandraTableResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` -} - -// ClusterKey cosmos DB Cassandra table cluster key -type ClusterKey struct { - // Name - Name of the Cosmos DB Cassandra table cluster key - Name *string `json:"name,omitempty"` - // OrderBy - Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" - OrderBy *string `json:"orderBy,omitempty"` -} - -// Column cosmos DB Cassandra table column -type Column struct { - // Name - Name of the Cosmos DB Cassandra table column - Name *string `json:"name,omitempty"` - // Type - Type of the Cosmos DB Cassandra table column - Type *string `json:"type,omitempty"` -} - -// CompositePath ... -type CompositePath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Order - Sort order for composite paths. Possible values include: 'Ascending', 'Descending' - Order CompositePathSortOrder `json:"order,omitempty"` -} - -// ConflictResolutionPolicy the conflict resolution policy for the container. -type ConflictResolutionPolicy struct { - // Mode - Indicates the conflict resolution mode. Possible values include: 'LastWriterWins', 'Custom' - Mode ConflictResolutionMode `json:"mode,omitempty"` - // ConflictResolutionPath - The conflict resolution path in the case of LastWriterWins mode. - ConflictResolutionPath *string `json:"conflictResolutionPath,omitempty"` - // ConflictResolutionProcedure - The procedure to resolve conflicts in the case of custom mode. - ConflictResolutionProcedure *string `json:"conflictResolutionProcedure,omitempty"` -} - -// ConsistencyPolicy the consistency policy for the Cosmos DB database account. -type ConsistencyPolicy struct { - // DefaultConsistencyLevel - The default consistency level and configuration settings of the Cosmos DB account. Possible values include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix' - DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` - // MaxStalenessPrefix - When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` - // MaxIntervalInSeconds - When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` -} - -// ContainerPartitionKey the configuration of the partition key to be used for partitioning data into -// multiple partitions -type ContainerPartitionKey struct { - // Paths - List of paths using which data within the container can be partitioned - Paths *[]string `json:"paths,omitempty"` - // Kind - Indicates the kind of algorithm used for partitioning. Possible values include: 'PartitionKindHash', 'PartitionKindRange' - Kind PartitionKind `json:"kind,omitempty"` - // Version - Indicates the version of the partition key definition - Version *int32 `json:"version,omitempty"` -} - -// ContinuousModeBackupPolicy the object representing continuous mode backup policy. -type ContinuousModeBackupPolicy struct { - // Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) MarshalJSON() ([]byte, error) { - cmbp.Type = TypeContinuous - objectMap := make(map[string]interface{}) - if cmbp.Type != "" { - objectMap["type"] = cmbp.Type - } - return json.Marshal(objectMap) -} - -// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) { - return nil, false -} - -// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) { - return &cmbp, true -} - -// AsBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return nil, false -} - -// AsBasicBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) { - return &cmbp, true -} - -// CorsPolicy the CORS policy for the Cosmos DB database account. -type CorsPolicy struct { - // AllowedOrigins - The origin domains that are permitted to make a request against the service via CORS. - AllowedOrigins *string `json:"allowedOrigins,omitempty"` - // AllowedMethods - The methods (HTTP request verbs) that the origin domain may use for a CORS request. - AllowedMethods *string `json:"allowedMethods,omitempty"` - // AllowedHeaders - The request headers that the origin domain may specify on the CORS request. - AllowedHeaders *string `json:"allowedHeaders,omitempty"` - // ExposedHeaders - The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - ExposedHeaders *string `json:"exposedHeaders,omitempty"` - // MaxAgeInSeconds - The maximum amount time that a browser should cache the preflight OPTIONS request. - MaxAgeInSeconds *int64 `json:"maxAgeInSeconds,omitempty"` -} - -// CreateUpdateOptions createUpdateOptions are a list of key-value pairs that describe the resource. -// Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" -type CreateUpdateOptions struct { - // Throughput - Request Units per second. For example, "throughput": 10000. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// DatabaseAccountConnectionString connection string for the Cosmos DB account -type DatabaseAccountConnectionString struct { - // ConnectionString - READ-ONLY; Value of the connection string - ConnectionString *string `json:"connectionString,omitempty"` - // Description - READ-ONLY; Description of the connection string - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountConnectionString. -func (dacs DatabaseAccountConnectionString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountCreateUpdateParameters parameters to create and update Cosmos DB database accounts. -type DatabaseAccountCreateUpdateParameters struct { - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountCreateUpdateParameters. -func (dacup DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dacup.Kind != "" { - objectMap["kind"] = dacup.Kind - } - if dacup.DatabaseAccountCreateUpdateProperties != nil { - objectMap["properties"] = dacup.DatabaseAccountCreateUpdateProperties - } - if dacup.Location != nil { - objectMap["location"] = dacup.Location - } - if dacup.Tags != nil { - objectMap["tags"] = dacup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateParameters struct. -func (dacup *DatabaseAccountCreateUpdateParameters) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dacup.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountCreateUpdateProperties DatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &databaseAccountCreateUpdateProperties) - if err != nil { - return err - } - dacup.DatabaseAccountCreateUpdateProperties = &databaseAccountCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dacup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dacup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dacup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dacup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dacup.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountCreateUpdateProperties properties to create and update Azure Cosmos DB database accounts. -type DatabaseAccountCreateUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateProperties struct. -func (dacup *DatabaseAccountCreateUpdateProperties) 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 "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - dacup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - dacup.Locations = &locations - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType string - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - dacup.DatabaseAccountOfferType = &databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - dacup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - dacup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - dacup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - dacup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - dacup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - dacup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - dacup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - dacup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - dacup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - dacup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - dacup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - dacup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - dacup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - dacup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - dacup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - dacup.Cors = &cors - } - } - } - - return nil -} - -// DatabaseAccountGetProperties properties for the database account. -type DatabaseAccountGetProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the Cosmos DB database account. - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - // DatabaseAccountOfferType - READ-ONLY; The offer type for the Cosmos DB database account. Default value: Standard. Possible values include: 'Standard' - DatabaseAccountOfferType DatabaseAccountOfferType `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // ConsistencyPolicy - The consistency policy for the Cosmos DB database account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // WriteLocations - READ-ONLY; An array that contains the write location for the Cosmos DB account. - WriteLocations *[]Location `json:"writeLocations,omitempty"` - // ReadLocations - READ-ONLY; An array that contains of the read locations enabled for the Cosmos DB account. - ReadLocations *[]Location `json:"readLocations,omitempty"` - // Locations - READ-ONLY; An array that contains all of the locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // FailoverPolicies - READ-ONLY; An array that contains the regions ordered by their failover priorities. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of Private Endpoint Connections configured for the Cosmos DB account. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetProperties. -func (dagp DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagp.ProvisioningState != nil { - objectMap["provisioningState"] = dagp.ProvisioningState - } - if dagp.IPRules != nil { - objectMap["ipRules"] = dagp.IPRules - } - if dagp.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = dagp.IsVirtualNetworkFilterEnabled - } - if dagp.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = dagp.EnableAutomaticFailover - } - if dagp.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = dagp.ConsistencyPolicy - } - if dagp.Capabilities != nil { - objectMap["capabilities"] = dagp.Capabilities - } - if dagp.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = dagp.VirtualNetworkRules - } - if dagp.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = dagp.EnableMultipleWriteLocations - } - if dagp.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = dagp.EnableCassandraConnector - } - if dagp.ConnectorOffer != "" { - objectMap["connectorOffer"] = dagp.ConnectorOffer - } - if dagp.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = dagp.DisableKeyBasedMetadataWriteAccess - } - if dagp.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = dagp.KeyVaultKeyURI - } - if dagp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = dagp.PublicNetworkAccess - } - if dagp.EnableFreeTier != nil { - objectMap["enableFreeTier"] = dagp.EnableFreeTier - } - if dagp.APIProperties != nil { - objectMap["apiProperties"] = dagp.APIProperties - } - if dagp.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = dagp.EnableAnalyticalStorage - } - objectMap["backupPolicy"] = dagp.BackupPolicy - if dagp.Cors != nil { - objectMap["cors"] = dagp.Cors - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetProperties struct. -func (dagp *DatabaseAccountGetProperties) 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 "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - dagp.ProvisioningState = &provisioningState - } - case "documentEndpoint": - if v != nil { - var documentEndpoint string - err = json.Unmarshal(*v, &documentEndpoint) - if err != nil { - return err - } - dagp.DocumentEndpoint = &documentEndpoint - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType DatabaseAccountOfferType - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - dagp.DatabaseAccountOfferType = databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - dagp.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - dagp.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - dagp.EnableAutomaticFailover = &enableAutomaticFailover - } - case "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - dagp.ConsistencyPolicy = &consistencyPolicy - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - dagp.Capabilities = &capabilities - } - case "writeLocations": - if v != nil { - var writeLocations []Location - err = json.Unmarshal(*v, &writeLocations) - if err != nil { - return err - } - dagp.WriteLocations = &writeLocations - } - case "readLocations": - if v != nil { - var readLocations []Location - err = json.Unmarshal(*v, &readLocations) - if err != nil { - return err - } - dagp.ReadLocations = &readLocations - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - dagp.Locations = &locations - } - case "failoverPolicies": - if v != nil { - var failoverPolicies []FailoverPolicy - err = json.Unmarshal(*v, &failoverPolicies) - if err != nil { - return err - } - dagp.FailoverPolicies = &failoverPolicies - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - dagp.VirtualNetworkRules = &virtualNetworkRules - } - case "privateEndpointConnections": - if v != nil { - var privateEndpointConnections []PrivateEndpointConnection - err = json.Unmarshal(*v, &privateEndpointConnections) - if err != nil { - return err - } - dagp.PrivateEndpointConnections = &privateEndpointConnections - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - dagp.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - dagp.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - dagp.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - dagp.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - dagp.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - dagp.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - dagp.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - dagp.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - dagp.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - dagp.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - dagp.Cors = &cors - } - } - } - - return nil -} - -// DatabaseAccountGetResults an Azure Cosmos DB database account. -type DatabaseAccountGetResults struct { - autorest.Response `json:"-"` - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetResults. -func (dagr DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagr.Kind != "" { - objectMap["kind"] = dagr.Kind - } - if dagr.DatabaseAccountGetProperties != nil { - objectMap["properties"] = dagr.DatabaseAccountGetProperties - } - if dagr.Location != nil { - objectMap["location"] = dagr.Location - } - if dagr.Tags != nil { - objectMap["tags"] = dagr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetResults struct. -func (dagr *DatabaseAccountGetResults) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dagr.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountGetProperties DatabaseAccountGetProperties - err = json.Unmarshal(*v, &databaseAccountGetProperties) - if err != nil { - return err - } - dagr.DatabaseAccountGetProperties = &databaseAccountGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dagr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dagr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dagr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dagr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dagr.Tags = tags - } - } - } - - return nil -} - -// DatabaseAccountListConnectionStringsResult the connection strings for the given database account. -type DatabaseAccountListConnectionStringsResult struct { - autorest.Response `json:"-"` - // ConnectionStrings - An array that contains the connection strings for the Cosmos DB account. - ConnectionStrings *[]DatabaseAccountConnectionString `json:"connectionStrings,omitempty"` -} - -// DatabaseAccountListKeysResult the access keys for the given database account. -type DatabaseAccountListKeysResult struct { - autorest.Response `json:"-"` - // PrimaryMasterKey - READ-ONLY; Base 64 encoded value of the primary read-write key. - PrimaryMasterKey *string `json:"primaryMasterKey,omitempty"` - // SecondaryMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-write key. - SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListKeysResult. -func (dalkr DatabaseAccountListKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountListReadOnlyKeysResult the read-only access keys for the given database account. -type DatabaseAccountListReadOnlyKeysResult struct { - autorest.Response `json:"-"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListReadOnlyKeysResult. -func (dalrokr DatabaseAccountListReadOnlyKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountRegenerateKeyParameters parameters to regenerate the keys within the database account. -type DatabaseAccountRegenerateKeyParameters struct { - // KeyKind - The access key to regenerate. Possible values include: 'Primary', 'Secondary', 'PrimaryReadonly', 'SecondaryReadonly' - KeyKind KeyKind `json:"keyKind,omitempty"` -} - -// DatabaseAccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsCreateOrUpdateFuture) 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 DatabaseAccountsCreateOrUpdateFuture.Result. -func (future *DatabaseAccountsCreateOrUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.CreateOrUpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsDeleteFuture) 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 DatabaseAccountsDeleteFuture.Result. -func (future *DatabaseAccountsDeleteFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsFailoverPriorityChangeFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type DatabaseAccountsFailoverPriorityChangeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) 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 DatabaseAccountsFailoverPriorityChangeFuture.Result. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsFailoverPriorityChangeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsFailoverPriorityChangeFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsListResult the List operation response, that contains the database accounts and their -// properties. -type DatabaseAccountsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of database account and their properties. - Value *[]DatabaseAccountGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountsListResult. -func (dalr DatabaseAccountsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountsOfflineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOfflineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOfflineRegionFuture) 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 DatabaseAccountsOfflineRegionFuture.Result. -func (future *DatabaseAccountsOfflineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOfflineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsOnlineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOnlineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOnlineRegionFuture) 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 DatabaseAccountsOnlineRegionFuture.Result. -func (future *DatabaseAccountsOnlineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOnlineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsRegenerateKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsRegenerateKeyFuture) 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 DatabaseAccountsRegenerateKeyFuture.Result. -func (future *DatabaseAccountsRegenerateKeyFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsRegenerateKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsRegenerateKeyFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsUpdateFuture) 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 DatabaseAccountsUpdateFuture.Result. -func (future *DatabaseAccountsUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.UpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountUpdateParameters parameters for patching Azure Cosmos DB database account properties. -type DatabaseAccountUpdateParameters struct { - Tags map[string]*string `json:"tags"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - *DatabaseAccountUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountUpdateParameters. -func (daup DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if daup.Tags != nil { - objectMap["tags"] = daup.Tags - } - if daup.Location != nil { - objectMap["location"] = daup.Location - } - if daup.DatabaseAccountUpdateProperties != nil { - objectMap["properties"] = daup.DatabaseAccountUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateParameters struct. -func (daup *DatabaseAccountUpdateParameters) 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 - } - daup.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - daup.Location = &location - } - case "properties": - if v != nil { - var databaseAccountUpdateProperties DatabaseAccountUpdateProperties - err = json.Unmarshal(*v, &databaseAccountUpdateProperties) - if err != nil { - return err - } - daup.DatabaseAccountUpdateProperties = &databaseAccountUpdateProperties - } - } - } - - return nil -} - -// DatabaseAccountUpdateProperties properties to update Azure Cosmos DB database accounts. -type DatabaseAccountUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateProperties struct. -func (daup *DatabaseAccountUpdateProperties) 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 "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - daup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - daup.Locations = &locations - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - daup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - daup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - daup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - daup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - daup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - daup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - daup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - daup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - daup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - daup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - daup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - daup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - daup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - daup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - daup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - daup.Cors = &cors - } - } - } - - return nil -} - -// ErrorResponse 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"` -} - -// ErrorResponseUpdatedFormat an error response from the service. -type ErrorResponseUpdatedFormat struct { - Error *ErrorResponse `json:"error,omitempty"` -} - -// ExcludedPath ... -type ExcludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` -} - -// ExtendedResourceProperties the system generated resource properties associated with SQL databases, SQL -// containers, Gremlin databases and Gremlin graphs. -type ExtendedResourceProperties struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedResourceProperties. -func (erp ExtendedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverPolicies the list of new failover policies for the failover priority change. -type FailoverPolicies struct { - // FailoverPolicies - List of failover policies. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` -} - -// FailoverPolicy the failover policy for a given region of a database account. -type FailoverPolicy struct { - // ID - READ-ONLY; The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region in which the database account exists. - LocationName *string `json:"locationName,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverPolicy. -func (fp FailoverPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.LocationName != nil { - objectMap["locationName"] = fp.LocationName - } - if fp.FailoverPriority != nil { - objectMap["failoverPriority"] = fp.FailoverPriority - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseCreateUpdateParameters parameters to create and update Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateParameters struct { - // GremlinDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin database. - *GremlinDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseCreateUpdateParameters. -func (gdcup GremlinDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdcup.GremlinDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = gdcup.GremlinDatabaseCreateUpdateProperties - } - if gdcup.Location != nil { - objectMap["location"] = gdcup.Location - } - if gdcup.Tags != nil { - objectMap["tags"] = gdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseCreateUpdateParameters struct. -func (gdcup *GremlinDatabaseCreateUpdateParameters) 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 gremlinDatabaseCreateUpdateProperties GremlinDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinDatabaseCreateUpdateProperties) - if err != nil { - return err - } - gdcup.GremlinDatabaseCreateUpdateProperties = &gremlinDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdcup.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin database - Resource *GremlinDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type GremlinDatabaseGetProperties struct { - Resource *GremlinDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetPropertiesOptions ... -type GremlinDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// GremlinDatabaseGetPropertiesResource ... -type GremlinDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetPropertiesResource. -func (gdgp GremlinDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgp.ID != nil { - objectMap["id"] = gdgp.ID - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseGetResults an Azure Cosmos DB Gremlin database. -type GremlinDatabaseGetResults struct { - autorest.Response `json:"-"` - // GremlinDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *GremlinDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetResults. -func (gdgr GremlinDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgr.GremlinDatabaseGetProperties != nil { - objectMap["properties"] = gdgr.GremlinDatabaseGetProperties - } - if gdgr.Location != nil { - objectMap["location"] = gdgr.Location - } - if gdgr.Tags != nil { - objectMap["tags"] = gdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseGetResults struct. -func (gdgr *GremlinDatabaseGetResults) 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 gremlinDatabaseGetProperties GremlinDatabaseGetProperties - err = json.Unmarshal(*v, &gremlinDatabaseGetProperties) - if err != nil { - return err - } - gdgr.GremlinDatabaseGetProperties = &gremlinDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdgr.Tags = tags - } - } - } - - return nil -} - -// GremlinDatabaseListResult the List operation response, that contains the Gremlin databases and their -// properties. -type GremlinDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Gremlin databases and their properties. - Value *[]GremlinDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseListResult. -func (gdlr GremlinDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinDatabaseResource cosmos DB Gremlin database resource object -type GremlinDatabaseResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` -} - -// GremlinGraphCreateUpdateParameters parameters to create and update Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateParameters struct { - // GremlinGraphCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin graph. - *GremlinGraphCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphCreateUpdateParameters. -func (ggcup GremlinGraphCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ggcup.GremlinGraphCreateUpdateProperties != nil { - objectMap["properties"] = ggcup.GremlinGraphCreateUpdateProperties - } - if ggcup.Location != nil { - objectMap["location"] = ggcup.Location - } - if ggcup.Tags != nil { - objectMap["tags"] = ggcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphCreateUpdateParameters struct. -func (ggcup *GremlinGraphCreateUpdateParameters) 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 gremlinGraphCreateUpdateProperties GremlinGraphCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinGraphCreateUpdateProperties) - if err != nil { - return err - } - ggcup.GremlinGraphCreateUpdateProperties = &gremlinGraphCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ggcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ggcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ggcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ggcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ggcup.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin graph - Resource *GremlinGraphResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinGraphGetProperties the properties of an Azure Cosmos DB Gremlin graph -type GremlinGraphGetProperties struct { - Resource *GremlinGraphGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinGraphGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinGraphGetPropertiesOptions ... -type GremlinGraphGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// GremlinGraphGetPropertiesResource ... -type GremlinGraphGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetPropertiesResource. -func (gggp GremlinGraphGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggp.ID != nil { - objectMap["id"] = gggp.ID - } - if gggp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = gggp.IndexingPolicy - } - if gggp.PartitionKey != nil { - objectMap["partitionKey"] = gggp.PartitionKey - } - if gggp.DefaultTTL != nil { - objectMap["defaultTtl"] = gggp.DefaultTTL - } - if gggp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = gggp.UniqueKeyPolicy - } - if gggp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = gggp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// GremlinGraphGetResults an Azure Cosmos DB Gremlin graph. -type GremlinGraphGetResults struct { - autorest.Response `json:"-"` - // GremlinGraphGetProperties - The properties of an Azure Cosmos DB Gremlin graph - *GremlinGraphGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetResults. -func (gggr GremlinGraphGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggr.GremlinGraphGetProperties != nil { - objectMap["properties"] = gggr.GremlinGraphGetProperties - } - if gggr.Location != nil { - objectMap["location"] = gggr.Location - } - if gggr.Tags != nil { - objectMap["tags"] = gggr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphGetResults struct. -func (gggr *GremlinGraphGetResults) 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 gremlinGraphGetProperties GremlinGraphGetProperties - err = json.Unmarshal(*v, &gremlinGraphGetProperties) - if err != nil { - return err - } - gggr.GremlinGraphGetProperties = &gremlinGraphGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gggr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gggr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gggr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gggr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gggr.Tags = tags - } - } - } - - return nil -} - -// GremlinGraphListResult the List operation response, that contains the graphs and their properties. -type GremlinGraphListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of graphs and their properties. - Value *[]GremlinGraphGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphListResult. -func (gglr GremlinGraphListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinGraphResource cosmos DB Gremlin graph resource object -type GremlinGraphResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// GremlinResourcesCreateUpdateGremlinDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesCreateUpdateGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) 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 GremlinResourcesCreateUpdateGremlinDatabaseFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) result(client GremlinResourcesClient) (gdgr GremlinDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gdgr.Response.Response, err = future.GetResult(sender); err == nil && gdgr.Response.Response.StatusCode != http.StatusNoContent { - gdgr, err = client.CreateUpdateGremlinDatabaseResponder(gdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", gdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesCreateUpdateGremlinGraphFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type GremlinResourcesCreateUpdateGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinGraphGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) 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 GremlinResourcesCreateUpdateGremlinGraphFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) result(client GremlinResourcesClient) (gggr GremlinGraphGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gggr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gggr.Response.Response, err = future.GetResult(sender); err == nil && gggr.Response.Response.StatusCode != http.StatusNoContent { - gggr, err = client.CreateUpdateGremlinGraphResponder(gggr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", gggr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesDeleteGremlinDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type GremlinResourcesDeleteGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) 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 GremlinResourcesDeleteGremlinDatabaseFuture.Result. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesDeleteGremlinGraphFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GremlinResourcesDeleteGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinGraphFuture) 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 GremlinResourcesDeleteGremlinGraphFuture.Result. -func (future *GremlinResourcesDeleteGremlinGraphFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinGraphFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture) 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 GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture.Result. -func (future *GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture) 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 GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture.Result. -func (future *GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinGraphToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesMigrateGremlinGraphToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinGraphToAutoscaleFuture) 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 GremlinResourcesMigrateGremlinGraphToAutoscaleFuture.Result. -func (future *GremlinResourcesMigrateGremlinGraphToAutoscaleFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinGraphToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinGraphToManualThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type GremlinResourcesMigrateGremlinGraphToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinGraphToManualThroughputFuture) 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 GremlinResourcesMigrateGremlinGraphToManualThroughputFuture.Result. -func (future *GremlinResourcesMigrateGremlinGraphToManualThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinGraphToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) 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 GremlinResourcesUpdateGremlinDatabaseThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinGraphThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinGraphThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) 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 GremlinResourcesUpdateGremlinGraphThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinGraphThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// IncludedPath the paths that are included in indexing -type IncludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Indexes - List of indexes for this path - Indexes *[]Indexes `json:"indexes,omitempty"` -} - -// Indexes the indexes for the path. -type Indexes struct { - // DataType - The datatype for which the indexing behavior is applied to. Possible values include: 'String', 'Number', 'Point', 'Polygon', 'LineString', 'MultiPolygon' - DataType DataType `json:"dataType,omitempty"` - // Precision - The precision of the index. -1 is maximum precision. - Precision *int32 `json:"precision,omitempty"` - // Kind - Indicates the type of index. Possible values include: 'Hash', 'Range', 'Spatial' - Kind IndexKind `json:"kind,omitempty"` -} - -// IndexingPolicy cosmos DB indexing policy -type IndexingPolicy struct { - // Automatic - Indicates if the indexing policy is automatic - Automatic *bool `json:"automatic,omitempty"` - // IndexingMode - Indicates the indexing mode. Possible values include: 'Consistent', 'Lazy', 'None' - IndexingMode IndexingMode `json:"indexingMode,omitempty"` - // IncludedPaths - List of paths to include in the indexing - IncludedPaths *[]IncludedPath `json:"includedPaths,omitempty"` - // ExcludedPaths - List of paths to exclude from indexing - ExcludedPaths *[]ExcludedPath `json:"excludedPaths,omitempty"` - // CompositeIndexes - List of composite path list - CompositeIndexes *[][]CompositePath `json:"compositeIndexes,omitempty"` - // SpatialIndexes - List of spatial specifics - SpatialIndexes *[]SpatialSpec `json:"spatialIndexes,omitempty"` -} - -// IPAddressOrRange ipAddressOrRange object -type IPAddressOrRange struct { - // IPAddressOrRange - A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. - IPAddressOrRange *string `json:"ipAddressOrRange,omitempty"` -} - -// Location a region in which the Azure Cosmos DB database account is deployed. -type Location struct { - // ID - READ-ONLY; The unique identifier of the region within the database account. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region. - LocationName *string `json:"locationName,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` - // IsZoneRedundant - Flag to indicate whether or not this region is an AvailabilityZone region - IsZoneRedundant *bool `json:"isZoneRedundant,omitempty"` -} - -// MarshalJSON is the custom marshaler for Location. -func (l Location) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if l.LocationName != nil { - objectMap["locationName"] = l.LocationName - } - if l.ProvisioningState != nil { - objectMap["provisioningState"] = l.ProvisioningState - } - if l.FailoverPriority != nil { - objectMap["failoverPriority"] = l.FailoverPriority - } - if l.IsZoneRedundant != nil { - objectMap["isZoneRedundant"] = l.IsZoneRedundant - } - return json.Marshal(objectMap) -} - -// Metric metric data -type Metric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for Metric. -func (mVar Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.Unit != "" { - objectMap["unit"] = mVar.Unit - } - return json.Marshal(objectMap) -} - -// MetricAvailability the availability of the metric. -type MetricAvailability struct { - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - READ-ONLY; The retention for the metric values. - Retention *string `json:"retention,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAvailability. -func (ma MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinition the definition of a metric. -type MetricDefinition struct { - // MetricAvailabilities - READ-ONLY; The list of metric availabilities for the account. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type of the metric. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeTotal', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeLast' - PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // ResourceURI - READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinition. -func (md MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if md.Unit != "" { - objectMap["unit"] = md.Unit - } - return json.Marshal(objectMap) -} - -// MetricDefinitionsListResult the response to a list metric definitions request. -type MetricDefinitionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metric definitions for the account. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinitionsListResult. -func (mdlr MetricDefinitionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricListResult the response to a list metrics request. -type MetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metrics for the account. - Value *[]Metric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricListResult. -func (mlr MetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricName a metric name. -type MetricName struct { - // Value - READ-ONLY; The name of the metric. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The friendly name of the metric. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricName. -func (mn MetricName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricValue represents metrics values. -type MetricValue struct { - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricValue. -func (mv MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionCreateUpdateParameters parameters to create and update Cosmos DB MongoDB collection. -type MongoDBCollectionCreateUpdateParameters struct { - // MongoDBCollectionCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB collection. - *MongoDBCollectionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionCreateUpdateParameters. -func (mdccup MongoDBCollectionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdccup.MongoDBCollectionCreateUpdateProperties != nil { - objectMap["properties"] = mdccup.MongoDBCollectionCreateUpdateProperties - } - if mdccup.Location != nil { - objectMap["location"] = mdccup.Location - } - if mdccup.Tags != nil { - objectMap["tags"] = mdccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionCreateUpdateParameters struct. -func (mdccup *MongoDBCollectionCreateUpdateParameters) 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 mongoDBCollectionCreateUpdateProperties MongoDBCollectionCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBCollectionCreateUpdateProperties) - if err != nil { - return err - } - mdccup.MongoDBCollectionCreateUpdateProperties = &mongoDBCollectionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdccup.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB -// collection. -type MongoDBCollectionCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB collection - Resource *MongoDBCollectionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetProperties the properties of an Azure Cosmos DB MongoDB collection -type MongoDBCollectionGetProperties struct { - Resource *MongoDBCollectionGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBCollectionGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetPropertiesOptions ... -type MongoDBCollectionGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// MongoDBCollectionGetPropertiesResource ... -type MongoDBCollectionGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetPropertiesResource. -func (mdcgp MongoDBCollectionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgp.ID != nil { - objectMap["id"] = mdcgp.ID - } - if mdcgp.ShardKey != nil { - objectMap["shardKey"] = mdcgp.ShardKey - } - if mdcgp.Indexes != nil { - objectMap["indexes"] = mdcgp.Indexes - } - if mdcgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = mdcgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// MongoDBCollectionGetResults an Azure Cosmos DB MongoDB collection. -type MongoDBCollectionGetResults struct { - autorest.Response `json:"-"` - // MongoDBCollectionGetProperties - The properties of an Azure Cosmos DB MongoDB collection - *MongoDBCollectionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetResults. -func (mdcgr MongoDBCollectionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgr.MongoDBCollectionGetProperties != nil { - objectMap["properties"] = mdcgr.MongoDBCollectionGetProperties - } - if mdcgr.Location != nil { - objectMap["location"] = mdcgr.Location - } - if mdcgr.Tags != nil { - objectMap["tags"] = mdcgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionGetResults struct. -func (mdcgr *MongoDBCollectionGetResults) 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 mongoDBCollectionGetProperties MongoDBCollectionGetProperties - err = json.Unmarshal(*v, &mongoDBCollectionGetProperties) - if err != nil { - return err - } - mdcgr.MongoDBCollectionGetProperties = &mongoDBCollectionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdcgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdcgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdcgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdcgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdcgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBCollectionListResult the List operation response, that contains the MongoDB collections and their -// properties. -type MongoDBCollectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB collections and their properties. - Value *[]MongoDBCollectionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionListResult. -func (mdclr MongoDBCollectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionResource cosmos DB MongoDB collection resource object -type MongoDBCollectionResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionResource. -func (mdcr MongoDBCollectionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcr.ID != nil { - objectMap["id"] = mdcr.ID - } - if mdcr.ShardKey != nil { - objectMap["shardKey"] = mdcr.ShardKey - } - if mdcr.Indexes != nil { - objectMap["indexes"] = mdcr.Indexes - } - if mdcr.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = mdcr.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseCreateUpdateParameters parameters to create and update Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateParameters struct { - // MongoDBDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB database. - *MongoDBDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseCreateUpdateParameters. -func (mddcup MongoDBDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddcup.MongoDBDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = mddcup.MongoDBDatabaseCreateUpdateProperties - } - if mddcup.Location != nil { - objectMap["location"] = mddcup.Location - } - if mddcup.Tags != nil { - objectMap["tags"] = mddcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseCreateUpdateParameters struct. -func (mddcup *MongoDBDatabaseCreateUpdateParameters) 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 mongoDBDatabaseCreateUpdateProperties MongoDBDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBDatabaseCreateUpdateProperties) - if err != nil { - return err - } - mddcup.MongoDBDatabaseCreateUpdateProperties = &mongoDBDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddcup.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB database - Resource *MongoDBDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetProperties the properties of an Azure Cosmos DB MongoDB database -type MongoDBDatabaseGetProperties struct { - Resource *MongoDBDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetPropertiesOptions ... -type MongoDBDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// MongoDBDatabaseGetPropertiesResource ... -type MongoDBDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetPropertiesResource. -func (mddgp MongoDBDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgp.ID != nil { - objectMap["id"] = mddgp.ID - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseGetResults an Azure Cosmos DB MongoDB database. -type MongoDBDatabaseGetResults struct { - autorest.Response `json:"-"` - // MongoDBDatabaseGetProperties - The properties of an Azure Cosmos DB MongoDB database - *MongoDBDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetResults. -func (mddgr MongoDBDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgr.MongoDBDatabaseGetProperties != nil { - objectMap["properties"] = mddgr.MongoDBDatabaseGetProperties - } - if mddgr.Location != nil { - objectMap["location"] = mddgr.Location - } - if mddgr.Tags != nil { - objectMap["tags"] = mddgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseGetResults struct. -func (mddgr *MongoDBDatabaseGetResults) 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 mongoDBDatabaseGetProperties MongoDBDatabaseGetProperties - err = json.Unmarshal(*v, &mongoDBDatabaseGetProperties) - if err != nil { - return err - } - mddgr.MongoDBDatabaseGetProperties = &mongoDBDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddgr.Tags = tags - } - } - } - - return nil -} - -// MongoDBDatabaseListResult the List operation response, that contains the MongoDB databases and their -// properties. -type MongoDBDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB databases and their properties. - Value *[]MongoDBDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseListResult. -func (mddlr MongoDBDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBDatabaseResource cosmos DB MongoDB database resource object -type MongoDBDatabaseResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` -} - -// MongoDBResourcesCreateUpdateMongoDBCollectionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBCollectionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) 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 MongoDBResourcesCreateUpdateMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) result(client MongoDBResourcesClient) (mdcgr MongoDBCollectionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mdcgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mdcgr.Response.Response, err = future.GetResult(sender); err == nil && mdcgr.Response.Response.StatusCode != http.StatusNoContent { - mdcgr, err = client.CreateUpdateMongoDBCollectionResponder(mdcgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", mdcgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesCreateUpdateMongoDBDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) 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 MongoDBResourcesCreateUpdateMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (mddgr MongoDBDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mddgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mddgr.Response.Response, err = future.GetResult(sender); err == nil && mddgr.Response.Response.StatusCode != http.StatusNoContent { - mddgr, err = client.CreateUpdateMongoDBDatabaseResponder(mddgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", mddgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesDeleteMongoDBCollectionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type MongoDBResourcesDeleteMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) 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 MongoDBResourcesDeleteMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesDeleteMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type MongoDBResourcesDeleteMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) 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 MongoDBResourcesDeleteMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture) 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 MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBCollectionToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture) 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 MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBCollectionToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture) 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 MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture) 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 MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBCollectionThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBCollectionThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) 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 MongoDBResourcesUpdateMongoDBCollectionThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBCollectionThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) 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 MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoIndex cosmos DB MongoDB collection index key -type MongoIndex struct { - // Key - Cosmos DB MongoDB collection index keys - Key *MongoIndexKeys `json:"key,omitempty"` - // Options - Cosmos DB MongoDB collection index key options - Options *MongoIndexOptions `json:"options,omitempty"` -} - -// MongoIndexKeys cosmos DB MongoDB collection resource object -type MongoIndexKeys struct { - // Keys - List of keys for each MongoDB collection in the Azure Cosmos DB service - Keys *[]string `json:"keys,omitempty"` -} - -// MongoIndexOptions cosmos DB MongoDB collection index options -type MongoIndexOptions struct { - // ExpireAfterSeconds - Expire after seconds - ExpireAfterSeconds *int32 `json:"expireAfterSeconds,omitempty"` - // Unique - Is unique or not - Unique *bool `json:"unique,omitempty"` -} - -// NotebookWorkspace a notebook workspace resource -type NotebookWorkspace struct { - autorest.Response `json:"-"` - // NotebookWorkspaceProperties - Resource properties. - *NotebookWorkspaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspace. -func (nw NotebookWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nw.NotebookWorkspaceProperties != nil { - objectMap["properties"] = nw.NotebookWorkspaceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotebookWorkspace struct. -func (nw *NotebookWorkspace) 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 notebookWorkspaceProperties NotebookWorkspaceProperties - err = json.Unmarshal(*v, ¬ebookWorkspaceProperties) - if err != nil { - return err - } - nw.NotebookWorkspaceProperties = ¬ebookWorkspaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nw.Type = &typeVar - } - } - } - - return nil -} - -// NotebookWorkspaceConnectionInfoResult the connection info for the given notebook workspace -type NotebookWorkspaceConnectionInfoResult struct { - autorest.Response `json:"-"` - // AuthToken - READ-ONLY; Specifies auth token used for connecting to Notebook server (uses token-based auth). - AuthToken *string `json:"authToken,omitempty"` - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceConnectionInfoResult. -func (nwcir NotebookWorkspaceConnectionInfoResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceCreateUpdateParameters parameters to create a notebook workspace resource -type NotebookWorkspaceCreateUpdateParameters struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceCreateUpdateParameters. -func (nwcup NotebookWorkspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceListResult a list of notebook workspace resources -type NotebookWorkspaceListResult struct { - autorest.Response `json:"-"` - // Value - Array of notebook workspace resources - Value *[]NotebookWorkspace `json:"value,omitempty"` -} - -// NotebookWorkspaceProperties properties of a notebook workspace resource. -type NotebookWorkspaceProperties struct { - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` - // Status - READ-ONLY; Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceProperties. -func (nwp NotebookWorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (NotebookWorkspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesCreateOrUpdateFuture) 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 NotebookWorkspacesCreateOrUpdateFuture.Result. -func (future *NotebookWorkspacesCreateOrUpdateFuture) result(client NotebookWorkspacesClient) (nw NotebookWorkspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nw.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nw.Response.Response, err = future.GetResult(sender); err == nil && nw.Response.Response.StatusCode != http.StatusNoContent { - nw, err = client.CreateOrUpdateResponder(nw.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", nw.Response.Response, "Failure responding to request") - } - } - return -} - -// NotebookWorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesDeleteFuture) 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 NotebookWorkspacesDeleteFuture.Result. -func (future *NotebookWorkspacesDeleteFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesRegenerateAuthTokenFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type NotebookWorkspacesRegenerateAuthTokenFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) 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 NotebookWorkspacesRegenerateAuthTokenFuture.Result. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesRegenerateAuthTokenFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesRegenerateAuthTokenFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NotebookWorkspacesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesStartFuture) 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 NotebookWorkspacesStartFuture.Result. -func (future *NotebookWorkspacesStartFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// Operation 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.ResourceProvider - 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"` - // Description - Description of operation - Description *string `json:"Description,omitempty"` -} - -// OperationListResult 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 OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the 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, - } -} - -// OptionsResource cosmos DB options resource object -type OptionsResource struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// PartitionMetric the metric values for a single partition. -type PartitionMetric struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the metric values. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the metric values. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetric. -func (pm PartitionMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PartitionMetricListResult the response to a list partition metrics request. -type PartitionMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level metrics for the account. - Value *[]PartitionMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetricListResult. -func (pmlr PartitionMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PartitionUsage the partition level usage data for a usage request. -type PartitionUsage struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the usages. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the usages. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsage. -func (pu PartitionUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pu.Unit != "" { - objectMap["unit"] = pu.Unit - } - return json.Marshal(objectMap) -} - -// PartitionUsagesResult the response to a list partition level usage request. -type PartitionUsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level usages for the database. A usage is a point in time metric - Value *[]PartitionUsage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsagesResult. -func (pur PartitionUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetric percentile Metric data -type PercentileMetric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The percentile metric values for the specified time window and timestep. - MetricValues *[]PercentileMetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetric. -func (pm PercentileMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PercentileMetricListResult the response to a list percentile metrics request. -type PercentileMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of percentile metrics for the account. - Value *[]PercentileMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricListResult. -func (pmlr PercentileMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetricValue represents percentile metrics values. -type PercentileMetricValue struct { - // P10 - READ-ONLY; The 10th percentile value for the metric. - P10 *float64 `json:"P10,omitempty"` - // P25 - READ-ONLY; The 25th percentile value for the metric. - P25 *float64 `json:"P25,omitempty"` - // P50 - READ-ONLY; The 50th percentile value for the metric. - P50 *float64 `json:"P50,omitempty"` - // P75 - READ-ONLY; The 75th percentile value for the metric. - P75 *float64 `json:"P75,omitempty"` - // P90 - READ-ONLY; The 90th percentile value for the metric. - P90 *float64 `json:"P90,omitempty"` - // P95 - READ-ONLY; The 95th percentile value for the metric. - P95 *float64 `json:"P95,omitempty"` - // P99 - READ-ONLY; The 99th percentile value for the metric. - P99 *float64 `json:"P99,omitempty"` - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricValue. -func (pmv PercentileMetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PeriodicModeBackupPolicy the object representing periodic mode backup policy. -type PeriodicModeBackupPolicy struct { - // PeriodicModeProperties - Configuration values for periodic mode backup - PeriodicModeProperties *PeriodicModeProperties `json:"periodicModeProperties,omitempty"` - // Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) MarshalJSON() ([]byte, error) { - pmbp.Type = TypePeriodic - objectMap := make(map[string]interface{}) - if pmbp.PeriodicModeProperties != nil { - objectMap["periodicModeProperties"] = pmbp.PeriodicModeProperties - } - if pmbp.Type != "" { - objectMap["type"] = pmbp.Type - } - return json.Marshal(objectMap) -} - -// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) { - return &pmbp, true -} - -// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) { - return nil, false -} - -// AsBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return nil, false -} - -// AsBasicBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) { - return &pmbp, true -} - -// PeriodicModeProperties configuration values for periodic mode backup -type PeriodicModeProperties struct { - // BackupIntervalInMinutes - An integer representing the interval in minutes between two backups - BackupIntervalInMinutes *int32 `json:"backupIntervalInMinutes,omitempty"` - // BackupRetentionIntervalInHours - An integer representing the time (in hours) that each backup is retained - BackupRetentionIntervalInHours *int32 `json:"backupRetentionIntervalInHours,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // GroupID - Group id of the private endpoint. - GroupID *string `json:"groupId,omitempty"` - // ProvisioningState - Provisioning state of the private endpoint. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource required zone names. - 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) -} - -// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) - ActionsRequired *string `json:"actionsRequired,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// 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) -} - -// RegionForOnlineOffline cosmos DB region to online or offline. -type RegionForOnlineOffline struct { - // Region - Cosmos DB region, with spaces between words and each word capitalized. - Region *string `json:"region,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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SpatialSpec ... -type SpatialSpec struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Types - List of path's spatial type - Types *[]SpatialType `json:"types,omitempty"` -} - -// SQLContainerCreateUpdateParameters parameters to create and update Cosmos DB container. -type SQLContainerCreateUpdateParameters struct { - // SQLContainerCreateUpdateProperties - Properties to create and update Azure Cosmos DB container. - *SQLContainerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerCreateUpdateParameters. -func (sccup SQLContainerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccup.SQLContainerCreateUpdateProperties != nil { - objectMap["properties"] = sccup.SQLContainerCreateUpdateProperties - } - if sccup.Location != nil { - objectMap["location"] = sccup.Location - } - if sccup.Tags != nil { - objectMap["tags"] = sccup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerCreateUpdateParameters struct. -func (sccup *SQLContainerCreateUpdateParameters) 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 SQLContainerCreateUpdateProperties SQLContainerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLContainerCreateUpdateProperties) - if err != nil { - return err - } - sccup.SQLContainerCreateUpdateProperties = &SQLContainerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sccup.Tags = tags - } - } - } - - return nil -} - -// SQLContainerCreateUpdateProperties properties to create and update Azure Cosmos DB container. -type SQLContainerCreateUpdateProperties struct { - // Resource - The standard JSON format of a container - Resource *SQLContainerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLContainerGetProperties the properties of an Azure Cosmos DB container -type SQLContainerGetProperties struct { - Resource *SQLContainerGetPropertiesResource `json:"resource,omitempty"` - Options *SQLContainerGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLContainerGetPropertiesOptions ... -type SQLContainerGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// SQLContainerGetPropertiesResource ... -type SQLContainerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int64 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetPropertiesResource. -func (scgp SQLContainerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgp.ID != nil { - objectMap["id"] = scgp.ID - } - if scgp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = scgp.IndexingPolicy - } - if scgp.PartitionKey != nil { - objectMap["partitionKey"] = scgp.PartitionKey - } - if scgp.DefaultTTL != nil { - objectMap["defaultTtl"] = scgp.DefaultTTL - } - if scgp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = scgp.UniqueKeyPolicy - } - if scgp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = scgp.ConflictResolutionPolicy - } - if scgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = scgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// SQLContainerGetResults an Azure Cosmos DB container. -type SQLContainerGetResults struct { - autorest.Response `json:"-"` - // SQLContainerGetProperties - The properties of an Azure Cosmos DB container - *SQLContainerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetResults. -func (scgr SQLContainerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgr.SQLContainerGetProperties != nil { - objectMap["properties"] = scgr.SQLContainerGetProperties - } - if scgr.Location != nil { - objectMap["location"] = scgr.Location - } - if scgr.Tags != nil { - objectMap["tags"] = scgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerGetResults struct. -func (scgr *SQLContainerGetResults) 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 SQLContainerGetProperties SQLContainerGetProperties - err = json.Unmarshal(*v, &SQLContainerGetProperties) - if err != nil { - return err - } - scgr.SQLContainerGetProperties = &SQLContainerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - scgr.Tags = tags - } - } - } - - return nil -} - -// SQLContainerListResult the List operation response, that contains the containers and their properties. -type SQLContainerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of containers and their properties. - Value *[]SQLContainerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerListResult. -func (sclr SQLContainerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLContainerResource cosmos DB SQL container resource object -type SQLContainerResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int64 `json:"analyticalStorageTtl,omitempty"` -} - -// SQLDatabaseCreateUpdateParameters parameters to create and update Cosmos DB SQL database. -type SQLDatabaseCreateUpdateParameters struct { - // SQLDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB SQL database. - *SQLDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseCreateUpdateParameters. -func (sdcup SQLDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdcup.SQLDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = sdcup.SQLDatabaseCreateUpdateProperties - } - if sdcup.Location != nil { - objectMap["location"] = sdcup.Location - } - if sdcup.Tags != nil { - objectMap["tags"] = sdcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseCreateUpdateParameters struct. -func (sdcup *SQLDatabaseCreateUpdateParameters) 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 SQLDatabaseCreateUpdateProperties SQLDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &SQLDatabaseCreateUpdateProperties) - if err != nil { - return err - } - sdcup.SQLDatabaseCreateUpdateProperties = &SQLDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdcup.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB SQL database. -type SQLDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a SQL database - Resource *SQLDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type SQLDatabaseGetProperties struct { - Resource *SQLDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *SQLDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetPropertiesOptions ... -type SQLDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// SQLDatabaseGetPropertiesResource ... -type SQLDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Colls - A system generated property that specified the addressable path of the collections resource. - Colls *string `json:"_colls,omitempty"` - // Users - A system generated property that specifies the addressable path of the users resource. - Users *string `json:"_users,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetPropertiesResource. -func (sdgp SQLDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgp.ID != nil { - objectMap["id"] = sdgp.ID - } - if sdgp.Colls != nil { - objectMap["_colls"] = sdgp.Colls - } - if sdgp.Users != nil { - objectMap["_users"] = sdgp.Users - } - return json.Marshal(objectMap) -} - -// SQLDatabaseGetResults an Azure Cosmos DB SQL database. -type SQLDatabaseGetResults struct { - autorest.Response `json:"-"` - // SQLDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *SQLDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetResults. -func (sdgr SQLDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgr.SQLDatabaseGetProperties != nil { - objectMap["properties"] = sdgr.SQLDatabaseGetProperties - } - if sdgr.Location != nil { - objectMap["location"] = sdgr.Location - } - if sdgr.Tags != nil { - objectMap["tags"] = sdgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseGetResults struct. -func (sdgr *SQLDatabaseGetResults) 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 SQLDatabaseGetProperties SQLDatabaseGetProperties - err = json.Unmarshal(*v, &SQLDatabaseGetProperties) - if err != nil { - return err - } - sdgr.SQLDatabaseGetProperties = &SQLDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdgr.Tags = tags - } - } - } - - return nil -} - -// SQLDatabaseListResult the List operation response, that contains the SQL databases and their properties. -type SQLDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of SQL databases and their properties. - Value *[]SQLDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseListResult. -func (sdlr SQLDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLDatabaseResource cosmos DB SQL database resource object -type SQLDatabaseResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` -} - -// SQLResourcesCreateUpdateSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLContainerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) 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 SQLResourcesCreateUpdateSQLContainerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) result(client SQLResourcesClient) (scgr SQLContainerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - scgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLContainerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if scgr.Response.Response, err = future.GetResult(sender); err == nil && scgr.Response.Response.StatusCode != http.StatusNoContent { - scgr, err = client.CreateUpdateSQLContainerResponder(scgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", scgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) 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 SQLResourcesCreateUpdateSQLDatabaseFuture.Result. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) result(client SQLResourcesClient) (sdgr SQLDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sdgr.Response.Response, err = future.GetResult(sender); err == nil && sdgr.Response.Response.StatusCode != http.StatusNoContent { - sdgr, err = client.CreateUpdateSQLDatabaseResponder(sdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", sdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLStoredProcedureFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLStoredProcedureGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) 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 SQLResourcesCreateUpdateSQLStoredProcedureFuture.Result. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) result(client SQLResourcesClient) (sspgr SQLStoredProcedureGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sspgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sspgr.Response.Response, err = future.GetResult(sender); err == nil && sspgr.Response.Response.StatusCode != http.StatusNoContent { - sspgr, err = client.CreateUpdateSQLStoredProcedureResponder(sspgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", sspgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLTriggerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) 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 SQLResourcesCreateUpdateSQLTriggerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) result(client SQLResourcesClient) (stgr SQLTriggerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - stgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLTriggerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if stgr.Response.Response, err = future.GetResult(sender); err == nil && stgr.Response.Response.StatusCode != http.StatusNoContent { - stgr, err = client.CreateUpdateSQLTriggerResponder(stgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", stgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLUserDefinedFunctionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) 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 SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (sudfgr SQLUserDefinedFunctionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sudfgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sudfgr.Response.Response, err = future.GetResult(sender); err == nil && sudfgr.Response.Response.StatusCode != http.StatusNoContent { - sudfgr, err = client.CreateUpdateSQLUserDefinedFunctionResponder(sudfgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", sudfgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesDeleteSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLContainerFuture) 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 SQLResourcesDeleteSQLContainerFuture.Result. -func (future *SQLResourcesDeleteSQLContainerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLContainerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLDatabaseFuture) 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 SQLResourcesDeleteSQLDatabaseFuture.Result. -func (future *SQLResourcesDeleteSQLDatabaseFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLStoredProcedureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) 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 SQLResourcesDeleteSQLStoredProcedureFuture.Result. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLStoredProcedureFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLTriggerFuture) 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 SQLResourcesDeleteSQLTriggerFuture.Result. -func (future *SQLResourcesDeleteSQLTriggerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLTriggerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesDeleteSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) 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 SQLResourcesDeleteSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesMigrateSQLContainerToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLContainerToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLContainerToAutoscaleFuture) 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 SQLResourcesMigrateSQLContainerToAutoscaleFuture.Result. -func (future *SQLResourcesMigrateSQLContainerToAutoscaleFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLContainerToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLContainerToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLContainerToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLContainerToManualThroughputFuture) 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 SQLResourcesMigrateSQLContainerToManualThroughputFuture.Result. -func (future *SQLResourcesMigrateSQLContainerToManualThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLContainerToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesMigrateSQLDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLDatabaseToAutoscaleFuture) 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 SQLResourcesMigrateSQLDatabaseToAutoscaleFuture.Result. -func (future *SQLResourcesMigrateSQLDatabaseToAutoscaleFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLDatabaseToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLDatabaseToManualThroughputFuture) 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 SQLResourcesMigrateSQLDatabaseToManualThroughputFuture.Result. -func (future *SQLResourcesMigrateSQLDatabaseToManualThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLContainerThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLContainerThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) 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 SQLResourcesUpdateSQLContainerThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLContainerThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLContainerThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLDatabaseThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) 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 SQLResourcesUpdateSQLDatabaseThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLStoredProcedureCreateUpdateParameters parameters to create and update Cosmos DB storedProcedure. -type SQLStoredProcedureCreateUpdateParameters struct { - // SQLStoredProcedureCreateUpdateProperties - Properties to create and update Azure Cosmos DB storedProcedure. - *SQLStoredProcedureCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureCreateUpdateParameters. -func (sspcup SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspcup.SQLStoredProcedureCreateUpdateProperties != nil { - objectMap["properties"] = sspcup.SQLStoredProcedureCreateUpdateProperties - } - if sspcup.Location != nil { - objectMap["location"] = sspcup.Location - } - if sspcup.Tags != nil { - objectMap["tags"] = sspcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureCreateUpdateParameters struct. -func (sspcup *SQLStoredProcedureCreateUpdateParameters) 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 SQLStoredProcedureCreateUpdateProperties SQLStoredProcedureCreateUpdateProperties - err = json.Unmarshal(*v, &SQLStoredProcedureCreateUpdateProperties) - if err != nil { - return err - } - sspcup.SQLStoredProcedureCreateUpdateProperties = &SQLStoredProcedureCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspcup.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureCreateUpdateProperties properties to create and update Azure Cosmos DB -// storedProcedure. -type SQLStoredProcedureCreateUpdateProperties struct { - // Resource - The standard JSON format of a storedProcedure - Resource *SQLStoredProcedureResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLStoredProcedureGetProperties the properties of an Azure Cosmos DB StoredProcedure -type SQLStoredProcedureGetProperties struct { - Resource *SQLStoredProcedureGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLStoredProcedureGetPropertiesResource ... -type SQLStoredProcedureGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetPropertiesResource. -func (sspgp SQLStoredProcedureGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgp.ID != nil { - objectMap["id"] = sspgp.ID - } - if sspgp.Body != nil { - objectMap["body"] = sspgp.Body - } - return json.Marshal(objectMap) -} - -// SQLStoredProcedureGetResults an Azure Cosmos DB storedProcedure. -type SQLStoredProcedureGetResults struct { - autorest.Response `json:"-"` - // SQLStoredProcedureGetProperties - The properties of an Azure Cosmos DB storedProcedure - *SQLStoredProcedureGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetResults. -func (sspgr SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgr.SQLStoredProcedureGetProperties != nil { - objectMap["properties"] = sspgr.SQLStoredProcedureGetProperties - } - if sspgr.Location != nil { - objectMap["location"] = sspgr.Location - } - if sspgr.Tags != nil { - objectMap["tags"] = sspgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureGetResults struct. -func (sspgr *SQLStoredProcedureGetResults) 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 SQLStoredProcedureGetProperties SQLStoredProcedureGetProperties - err = json.Unmarshal(*v, &SQLStoredProcedureGetProperties) - if err != nil { - return err - } - sspgr.SQLStoredProcedureGetProperties = &SQLStoredProcedureGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspgr.Tags = tags - } - } - } - - return nil -} - -// SQLStoredProcedureListResult the List operation response, that contains the storedProcedures and their -// properties. -type SQLStoredProcedureListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of storedProcedures and their properties. - Value *[]SQLStoredProcedureGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureListResult. -func (ssplr SQLStoredProcedureListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLStoredProcedureResource cosmos DB SQL storedProcedure resource object -type SQLStoredProcedureResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` -} - -// SQLTriggerCreateUpdateParameters parameters to create and update Cosmos DB trigger. -type SQLTriggerCreateUpdateParameters struct { - // SQLTriggerCreateUpdateProperties - Properties to create and update Azure Cosmos DB trigger. - *SQLTriggerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerCreateUpdateParameters. -func (stcup SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stcup.SQLTriggerCreateUpdateProperties != nil { - objectMap["properties"] = stcup.SQLTriggerCreateUpdateProperties - } - if stcup.Location != nil { - objectMap["location"] = stcup.Location - } - if stcup.Tags != nil { - objectMap["tags"] = stcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerCreateUpdateParameters struct. -func (stcup *SQLTriggerCreateUpdateParameters) 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 SQLTriggerCreateUpdateProperties SQLTriggerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLTriggerCreateUpdateProperties) - if err != nil { - return err - } - stcup.SQLTriggerCreateUpdateProperties = &SQLTriggerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stcup.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerCreateUpdateProperties properties to create and update Azure Cosmos DB trigger. -type SQLTriggerCreateUpdateProperties struct { - // Resource - The standard JSON format of a trigger - Resource *SQLTriggerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLTriggerGetProperties the properties of an Azure Cosmos DB trigger -type SQLTriggerGetProperties struct { - Resource *SQLTriggerGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLTriggerGetPropertiesResource ... -type SQLTriggerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetPropertiesResource. -func (stgp SQLTriggerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgp.ID != nil { - objectMap["id"] = stgp.ID - } - if stgp.Body != nil { - objectMap["body"] = stgp.Body - } - if stgp.TriggerType != "" { - objectMap["triggerType"] = stgp.TriggerType - } - if stgp.TriggerOperation != "" { - objectMap["triggerOperation"] = stgp.TriggerOperation - } - return json.Marshal(objectMap) -} - -// SQLTriggerGetResults an Azure Cosmos DB trigger. -type SQLTriggerGetResults struct { - autorest.Response `json:"-"` - // SQLTriggerGetProperties - The properties of an Azure Cosmos DB trigger - *SQLTriggerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetResults. -func (stgr SQLTriggerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgr.SQLTriggerGetProperties != nil { - objectMap["properties"] = stgr.SQLTriggerGetProperties - } - if stgr.Location != nil { - objectMap["location"] = stgr.Location - } - if stgr.Tags != nil { - objectMap["tags"] = stgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerGetResults struct. -func (stgr *SQLTriggerGetResults) 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 SQLTriggerGetProperties SQLTriggerGetProperties - err = json.Unmarshal(*v, &SQLTriggerGetProperties) - if err != nil { - return err - } - stgr.SQLTriggerGetProperties = &SQLTriggerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stgr.Tags = tags - } - } - } - - return nil -} - -// SQLTriggerListResult the List operation response, that contains the triggers and their properties. -type SQLTriggerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of triggers and their properties. - Value *[]SQLTriggerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerListResult. -func (stlr SQLTriggerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLTriggerResource cosmos DB SQL trigger resource object -type SQLTriggerResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'Pre', 'Post' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` -} - -// SQLUserDefinedFunctionCreateUpdateParameters parameters to create and update Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateParameters struct { - // SQLUserDefinedFunctionCreateUpdateProperties - Properties to create and update Azure Cosmos DB userDefinedFunction. - *SQLUserDefinedFunctionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionCreateUpdateParameters. -func (sudfcup SQLUserDefinedFunctionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfcup.SQLUserDefinedFunctionCreateUpdateProperties != nil { - objectMap["properties"] = sudfcup.SQLUserDefinedFunctionCreateUpdateProperties - } - if sudfcup.Location != nil { - objectMap["location"] = sudfcup.Location - } - if sudfcup.Tags != nil { - objectMap["tags"] = sudfcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionCreateUpdateParameters struct. -func (sudfcup *SQLUserDefinedFunctionCreateUpdateParameters) 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 SQLUserDefinedFunctionCreateUpdateProperties SQLUserDefinedFunctionCreateUpdateProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionCreateUpdateProperties) - if err != nil { - return err - } - sudfcup.SQLUserDefinedFunctionCreateUpdateProperties = &SQLUserDefinedFunctionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfcup.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionCreateUpdateProperties properties to create and update Azure Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateProperties struct { - // Resource - The standard JSON format of a userDefinedFunction - Resource *SQLUserDefinedFunctionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLUserDefinedFunctionGetProperties the properties of an Azure Cosmos DB userDefinedFunction -type SQLUserDefinedFunctionGetProperties struct { - Resource *SQLUserDefinedFunctionGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLUserDefinedFunctionGetPropertiesResource ... -type SQLUserDefinedFunctionGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetPropertiesResource. -func (sudfgp SQLUserDefinedFunctionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgp.ID != nil { - objectMap["id"] = sudfgp.ID - } - if sudfgp.Body != nil { - objectMap["body"] = sudfgp.Body - } - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionGetResults an Azure Cosmos DB userDefinedFunction. -type SQLUserDefinedFunctionGetResults struct { - autorest.Response `json:"-"` - // SQLUserDefinedFunctionGetProperties - The properties of an Azure Cosmos DB userDefinedFunction - *SQLUserDefinedFunctionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetResults. -func (sudfgr SQLUserDefinedFunctionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgr.SQLUserDefinedFunctionGetProperties != nil { - objectMap["properties"] = sudfgr.SQLUserDefinedFunctionGetProperties - } - if sudfgr.Location != nil { - objectMap["location"] = sudfgr.Location - } - if sudfgr.Tags != nil { - objectMap["tags"] = sudfgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionGetResults struct. -func (sudfgr *SQLUserDefinedFunctionGetResults) 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 SQLUserDefinedFunctionGetProperties SQLUserDefinedFunctionGetProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionGetProperties) - if err != nil { - return err - } - sudfgr.SQLUserDefinedFunctionGetProperties = &SQLUserDefinedFunctionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfgr.Tags = tags - } - } - } - - return nil -} - -// SQLUserDefinedFunctionListResult the List operation response, that contains the userDefinedFunctions and -// their properties. -type SQLUserDefinedFunctionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of userDefinedFunctions and their properties. - Value *[]SQLUserDefinedFunctionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionListResult. -func (sudflr SQLUserDefinedFunctionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionResource cosmos DB SQL userDefinedFunction resource object -type SQLUserDefinedFunctionResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` -} - -// TableCreateUpdateParameters parameters to create and update Cosmos DB Table. -type TableCreateUpdateParameters struct { - // TableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Table. - *TableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableCreateUpdateParameters. -func (tcup TableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TableCreateUpdateProperties != nil { - objectMap["properties"] = tcup.TableCreateUpdateProperties - } - if tcup.Location != nil { - objectMap["location"] = tcup.Location - } - if tcup.Tags != nil { - objectMap["tags"] = tcup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableCreateUpdateParameters struct. -func (tcup *TableCreateUpdateParameters) 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 tableCreateUpdateProperties TableCreateUpdateProperties - err = json.Unmarshal(*v, &tableCreateUpdateProperties) - if err != nil { - return err - } - tcup.TableCreateUpdateProperties = &tableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tcup.Tags = tags - } - } - } - - return nil -} - -// TableCreateUpdateProperties properties to create and update Azure Cosmos DB Table. -type TableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Table - Resource *TableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// TableGetProperties the properties of an Azure Cosmos Table -type TableGetProperties struct { - Resource *TableGetPropertiesResource `json:"resource,omitempty"` - Options *TableGetPropertiesOptions `json:"options,omitempty"` -} - -// TableGetPropertiesOptions ... -type TableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// TableGetPropertiesResource ... -type TableGetPropertiesResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableGetPropertiesResource. -func (tgp TableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgp.ID != nil { - objectMap["id"] = tgp.ID - } - return json.Marshal(objectMap) -} - -// TableGetResults an Azure Cosmos DB Table. -type TableGetResults struct { - autorest.Response `json:"-"` - // TableGetProperties - The properties of an Azure Cosmos DB Table - *TableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TableGetResults. -func (tgr TableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgr.TableGetProperties != nil { - objectMap["properties"] = tgr.TableGetProperties - } - if tgr.Location != nil { - objectMap["location"] = tgr.Location - } - if tgr.Tags != nil { - objectMap["tags"] = tgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableGetResults struct. -func (tgr *TableGetResults) 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 tableGetProperties TableGetProperties - err = json.Unmarshal(*v, &tableGetProperties) - if err != nil { - return err - } - tgr.TableGetProperties = &tableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tgr.Tags = tags - } - } - } - - return nil -} - -// TableListResult the List operation response, that contains the Table and their properties. -type TableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Table and their properties. - Value *[]TableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableListResult. -func (tlr TableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TableResource cosmos DB table resource object -type TableResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` -} - -// TableResourcesCreateUpdateTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesCreateUpdateTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (TableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesCreateUpdateTableFuture) 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 TableResourcesCreateUpdateTableFuture.Result. -func (future *TableResourcesCreateUpdateTableFuture) result(client TableResourcesClient) (tgr TableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesCreateUpdateTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tgr.Response.Response, err = future.GetResult(sender); err == nil && tgr.Response.Response.StatusCode != http.StatusNoContent { - tgr, err = client.CreateUpdateTableResponder(tgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", tgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesDeleteTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesDeleteTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesDeleteTableFuture) 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 TableResourcesDeleteTableFuture.Result. -func (future *TableResourcesDeleteTableFuture) result(client TableResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesDeleteTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesDeleteTableFuture") - return - } - ar.Response = future.Response() - return -} - -// TableResourcesMigrateTableToAutoscaleFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type TableResourcesMigrateTableToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesMigrateTableToAutoscaleFuture) 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 TableResourcesMigrateTableToAutoscaleFuture.Result. -func (future *TableResourcesMigrateTableToAutoscaleFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesMigrateTableToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateTableToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesMigrateTableToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type TableResourcesMigrateTableToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesMigrateTableToManualThroughputFuture) 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 TableResourcesMigrateTableToManualThroughputFuture.Result. -func (future *TableResourcesMigrateTableToManualThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesMigrateTableToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateTableToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesUpdateTableThroughputFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesUpdateTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesUpdateTableThroughputFuture) 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 TableResourcesUpdateTableThroughputFuture.Result. -func (future *TableResourcesUpdateTableThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesUpdateTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// ThroughputPolicyResource cosmos DB resource throughput policy -type ThroughputPolicyResource struct { - // IsEnabled - Determines whether the ThroughputPolicy is active or not - IsEnabled *bool `json:"isEnabled,omitempty"` - // IncrementPercent - Represents the percentage by which throughput can increase every time throughput policy kicks in. - IncrementPercent *int32 `json:"incrementPercent,omitempty"` -} - -// ThroughputSettingsGetProperties the properties of an Azure Cosmos DB resource throughput -type ThroughputSettingsGetProperties struct { - Resource *ThroughputSettingsGetPropertiesResource `json:"resource,omitempty"` -} - -// ThroughputSettingsGetPropertiesResource ... -type ThroughputSettingsGetPropertiesResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. - AutoscaleSettings *AutoscaleSettingsResource `json:"autoscaleSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetPropertiesResource. -func (tsgp ThroughputSettingsGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgp.Throughput != nil { - objectMap["throughput"] = tsgp.Throughput - } - if tsgp.AutoscaleSettings != nil { - objectMap["autoscaleSettings"] = tsgp.AutoscaleSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsGetResults an Azure Cosmos DB resource throughput. -type ThroughputSettingsGetResults struct { - autorest.Response `json:"-"` - // ThroughputSettingsGetProperties - The properties of an Azure Cosmos DB resource throughput - *ThroughputSettingsGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetResults. -func (tsgr ThroughputSettingsGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgr.ThroughputSettingsGetProperties != nil { - objectMap["properties"] = tsgr.ThroughputSettingsGetProperties - } - if tsgr.Location != nil { - objectMap["location"] = tsgr.Location - } - if tsgr.Tags != nil { - objectMap["tags"] = tsgr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsGetResults struct. -func (tsgr *ThroughputSettingsGetResults) 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 throughputSettingsGetProperties ThroughputSettingsGetProperties - err = json.Unmarshal(*v, &throughputSettingsGetProperties) - if err != nil { - return err - } - tsgr.ThroughputSettingsGetProperties = &throughputSettingsGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsgr.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsResource cosmos DB resource throughput object. Either throughput is required or -// autoscaleSettings is required, but not both. -type ThroughputSettingsResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. - AutoscaleSettings *AutoscaleSettingsResource `json:"autoscaleSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsResource. -func (tsr ThroughputSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsr.Throughput != nil { - objectMap["throughput"] = tsr.Throughput - } - if tsr.AutoscaleSettings != nil { - objectMap["autoscaleSettings"] = tsr.AutoscaleSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsUpdateParameters parameters to update Cosmos DB resource throughput. -type ThroughputSettingsUpdateParameters struct { - // ThroughputSettingsUpdateProperties - Properties to update Azure Cosmos DB resource throughput. - *ThroughputSettingsUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsUpdateParameters. -func (tsup ThroughputSettingsUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsup.ThroughputSettingsUpdateProperties != nil { - objectMap["properties"] = tsup.ThroughputSettingsUpdateProperties - } - if tsup.Location != nil { - objectMap["location"] = tsup.Location - } - if tsup.Tags != nil { - objectMap["tags"] = tsup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsUpdateParameters struct. -func (tsup *ThroughputSettingsUpdateParameters) 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 throughputSettingsUpdateProperties ThroughputSettingsUpdateProperties - err = json.Unmarshal(*v, &throughputSettingsUpdateProperties) - if err != nil { - return err - } - tsup.ThroughputSettingsUpdateProperties = &throughputSettingsUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsup.Tags = tags - } - } - } - - return nil -} - -// ThroughputSettingsUpdateProperties properties to update Azure Cosmos DB resource throughput. -type ThroughputSettingsUpdateProperties struct { - // Resource - The standard JSON format of a resource throughput - Resource *ThroughputSettingsResource `json:"resource,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"` -} - -// 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) -} - -// UniqueKey the unique key on that enforces uniqueness constraint on documents in the collection in the -// Azure Cosmos DB service. -type UniqueKey struct { - // Paths - List of paths must be unique for each document in the Azure Cosmos DB service - Paths *[]string `json:"paths,omitempty"` -} - -// UniqueKeyPolicy the unique key policy configuration for specifying uniqueness constraints on documents -// in the collection in the Azure Cosmos DB service. -type UniqueKeyPolicy struct { - // UniqueKeys - List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - UniqueKeys *[]UniqueKey `json:"uniqueKeys,omitempty"` -} - -// Usage the usage data for a usage request. -type Usage struct { - // Unit - The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.Unit != "" { - objectMap["unit"] = u.Unit - } - return json.Marshal(objectMap) -} - -// UsagesResult the response to a list usage request. -type UsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of usages for the database. A usage is a point in time metric - Value *[]Usage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsagesResult. -func (ur UsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRule virtual Network ACL Rule object -type VirtualNetworkRule struct { - // ID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. - ID *string `json:"id,omitempty"` - // IgnoreMissingVNetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVNetServiceEndpoint *bool `json:"ignoreMissingVNetServiceEndpoint,omitempty"` -} diff --git a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/mongodbresources.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/mongodbresources.go deleted file mode 100644 index f8271f5cee65..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/mongodbresources.go +++ /dev/null @@ -1,1589 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// MongoDBResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type MongoDBResourcesClient struct { - BaseClient -} - -// NewMongoDBResourcesClient creates an instance of the MongoDBResourcesClient client. -func NewMongoDBResourcesClient(subscriptionID string) MongoDBResourcesClient { - return NewMongoDBResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMongoDBResourcesClientWithBaseURI creates an instance of the MongoDBResourcesClient 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 NewMongoDBResourcesClientWithBaseURI(baseURI string, subscriptionID string) MongoDBResourcesClient { - return MongoDBResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateMongoDBCollection create or update an Azure Cosmos DB MongoDB Collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// createUpdateMongoDBCollectionParameters - the parameters to provide for the current MongoDB Collection. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBCollectionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", err.Error()) - } - - req, err := client.CreateUpdateMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBCollectionPreparer prepares the CreateUpdateMongoDBCollection request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBCollectionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBCollectionSender sends the CreateUpdateMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBCollectionFuture, 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 -} - -// CreateUpdateMongoDBCollectionResponder handles the response to the CreateUpdateMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateMongoDBDatabase create or updates Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateMongoDBDatabaseParameters - the parameters to provide for the current MongoDB database. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", err.Error()) - } - - req, err := client.CreateUpdateMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBDatabasePreparer prepares the CreateUpdateMongoDBDatabase request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBDatabaseSender sends the CreateUpdateMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, 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 -} - -// CreateUpdateMongoDBDatabaseResponder handles the response to the CreateUpdateMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteMongoDBCollection deletes an existing Azure Cosmos DB MongoDB Collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesDeleteMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBCollection") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", err.Error()) - } - - req, err := client.DeleteMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBCollectionPreparer prepares the DeleteMongoDBCollection request. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBCollectionSender sends the DeleteMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBCollectionFuture, 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 -} - -// DeleteMongoDBCollectionResponder handles the response to the DeleteMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionResponder(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 -} - -// DeleteMongoDBDatabase deletes an existing Azure Cosmos DB MongoDB database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", err.Error()) - } - - req, err := client.DeleteMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBDatabasePreparer prepares the DeleteMongoDBDatabase request. -func (client MongoDBResourcesClient) DeleteMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBDatabaseSender sends the DeleteMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBDatabaseFuture, 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 -} - -// DeleteMongoDBDatabaseResponder handles the response to the DeleteMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseResponder(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 -} - -// GetMongoDBCollection gets the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBCollectionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollection") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollection", err.Error()) - } - - req, err := client.GetMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionPreparer prepares the GetMongoDBCollection request. -func (client MongoDBResourcesClient) GetMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionSender sends the GetMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionResponder handles the response to the GetMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBCollectionThroughput gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollectionThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.GetMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionThroughputPreparer prepares the GetMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionThroughputSender sends the GetMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionThroughputResponder handles the response to the GetMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabase gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", err.Error()) - } - - req, err := client.GetMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabasePreparer prepares the GetMongoDBDatabase request. -func (client MongoDBResourcesClient) GetMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseSender sends the GetMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseResponder handles the response to the GetMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabaseThroughput gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.GetMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabaseThroughputPreparer prepares the GetMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseThroughputSender sends the GetMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseThroughputResponder handles the response to the GetMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBCollections lists the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBCollectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBCollections") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBCollections", err.Error()) - } - - req, err := client.ListMongoDBCollectionsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBCollectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBCollectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBCollectionsPreparer prepares the ListMongoDBCollections request. -func (client MongoDBResourcesClient) ListMongoDBCollectionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBCollectionsSender sends the ListMongoDBCollections request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBCollectionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBCollectionsResponder handles the response to the ListMongoDBCollections request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBCollectionsResponder(resp *http.Response) (result MongoDBCollectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBDatabases lists the MongoDB databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client MongoDBResourcesClient) ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result MongoDBDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", err.Error()) - } - - req, err := client.ListMongoDBDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBDatabasesPreparer prepares the ListMongoDBDatabases request. -func (client MongoDBResourcesClient) ListMongoDBDatabasesPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBDatabasesSender sends the ListMongoDBDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBDatabasesResponder handles the response to the ListMongoDBDatabases request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBDatabasesResponder(resp *http.Response) (result MongoDBDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBCollectionToAutoscale migrate an Azure Cosmos DB MongoDB collection from manual throughput to -// autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", err.Error()) - } - - req, err := client.MigrateMongoDBCollectionToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBCollectionToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBCollectionToAutoscalePreparer prepares the MigrateMongoDBCollectionToAutoscale request. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBCollectionToAutoscaleSender sends the MigrateMongoDBCollectionToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, 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 -} - -// MigrateMongoDBCollectionToAutoscaleResponder handles the response to the MigrateMongoDBCollectionToAutoscale request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBCollectionToManualThroughput migrate an Azure Cosmos DB MongoDB collection from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", err.Error()) - } - - req, err := client.MigrateMongoDBCollectionToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBCollectionToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBCollectionToManualThroughputPreparer prepares the MigrateMongoDBCollectionToManualThroughput request. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBCollectionToManualThroughputSender sends the MigrateMongoDBCollectionToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, 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 -} - -// MigrateMongoDBCollectionToManualThroughputResponder handles the response to the MigrateMongoDBCollectionToManualThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBDatabaseToAutoscale migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateMongoDBDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBDatabaseToAutoscalePreparer prepares the MigrateMongoDBDatabaseToAutoscale request. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBDatabaseToAutoscaleSender sends the MigrateMongoDBDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, 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 -} - -// MigrateMongoDBDatabaseToAutoscaleResponder handles the response to the MigrateMongoDBDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBDatabaseToManualThroughput migrate an Azure Cosmos DB MongoDB database from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateMongoDBDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBDatabaseToManualThroughputPreparer prepares the MigrateMongoDBDatabaseToManualThroughput request. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBDatabaseToManualThroughputSender sends the MigrateMongoDBDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, 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 -} - -// MigrateMongoDBDatabaseToManualThroughputResponder handles the response to the MigrateMongoDBDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBCollectionThroughput update the RUs per second of an Azure Cosmos DB MongoDB collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// collection. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBCollectionThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBCollectionThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBCollectionThroughputPreparer prepares the UpdateMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBCollectionThroughputSender sends the UpdateMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, 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 -} - -// UpdateMongoDBCollectionThroughputResponder handles the response to the UpdateMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBDatabaseThroughput update RUs per second of the an Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// database. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBDatabaseThroughputPreparer prepares the UpdateMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBDatabaseThroughputSender sends the UpdateMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, 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 -} - -// UpdateMongoDBDatabaseThroughputResponder handles the response to the UpdateMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/notebookworkspaces.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/notebookworkspaces.go deleted file mode 100644 index 3949881a1565..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/notebookworkspaces.go +++ /dev/null @@ -1,681 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotebookWorkspacesClient is the azure Cosmos DB Database Service Resource Provider REST API -type NotebookWorkspacesClient struct { - BaseClient -} - -// NewNotebookWorkspacesClient creates an instance of the NotebookWorkspacesClient client. -func NewNotebookWorkspacesClient(subscriptionID string) NotebookWorkspacesClient { - return NewNotebookWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotebookWorkspacesClientWithBaseURI creates an instance of the NotebookWorkspacesClient 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 NewNotebookWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) NotebookWorkspacesClient { - return NotebookWorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// notebookCreateUpdateParameters - the notebook workspace to create for the current database account. -func (client NotebookWorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (result NotebookWorkspacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, notebookCreateUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotebookWorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", pathParameters), - autorest.WithJSON(notebookCreateUpdateParameters), - 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 NotebookWorkspacesClient) CreateOrUpdateSender(req *http.Request) (future NotebookWorkspacesCreateOrUpdateFuture, 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 NotebookWorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result NotebookWorkspace, 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 notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotebookWorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) DeleteSender(req *http.Request) (future NotebookWorkspacesDeleteFuture, 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 NotebookWorkspacesClient) 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 the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotebookWorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) 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 NotebookWorkspacesClient) GetResponder(resp *http.Response) (result NotebookWorkspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabaseAccount gets the notebook workspace resources of an existing Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client NotebookWorkspacesClient) ListByDatabaseAccountPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListByDatabaseAccountResponder(resp *http.Response) (result NotebookWorkspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionInfo retrieves the connection info for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceConnectionInfoResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListConnectionInfo") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListConnectionInfo", err.Error()) - } - - req, err := client.ListConnectionInfoPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionInfoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionInfoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionInfoPreparer prepares the ListConnectionInfo request. -func (client NotebookWorkspacesClient) ListConnectionInfoPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionInfoSender sends the ListConnectionInfo request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListConnectionInfoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionInfoResponder handles the response to the ListConnectionInfo request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListConnectionInfoResponder(resp *http.Response) (result NotebookWorkspaceConnectionInfoResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateAuthToken regenerates the auth token for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesRegenerateAuthTokenFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.RegenerateAuthToken") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", err.Error()) - } - - req, err := client.RegenerateAuthTokenPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateAuthTokenSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateAuthTokenPreparer prepares the RegenerateAuthToken request. -func (client NotebookWorkspacesClient) RegenerateAuthTokenPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateAuthTokenSender sends the RegenerateAuthToken request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) RegenerateAuthTokenSender(req *http.Request) (future NotebookWorkspacesRegenerateAuthTokenFuture, 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 -} - -// RegenerateAuthTokenResponder handles the response to the RegenerateAuthToken request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) RegenerateAuthTokenResponder(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 the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Start(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client NotebookWorkspacesClient) StartPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/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 NotebookWorkspacesClient) StartSender(req *http.Request) (future NotebookWorkspacesStartFuture, 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 NotebookWorkspacesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/operations.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/operations.go deleted file mode 100644 index 510d7e5790a6..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure Cosmos DB Database Service Resource Provider REST API -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 Cosmos DB Resource Provider 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, "documentdb.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, "documentdb.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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 = "2020-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DocumentDB/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, "documentdb.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, "documentdb.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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/cosmos-db/mgmt/2020-09-01-preview/documentdb/partitionkeyrangeid.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/partitionkeyrangeid.go deleted file mode 100644 index 211e79a88622..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/partitionkeyrangeid.go +++ /dev/null @@ -1,133 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDClient creates an instance of the PartitionKeyRangeIDClient client. -func NewPartitionKeyRangeIDClient(subscriptionID string) PartitionKeyRangeIDClient { - return NewPartitionKeyRangeIDClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDClientWithBaseURI creates an instance of the PartitionKeyRangeIDClient 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 NewPartitionKeyRangeIDClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDClient { - return PartitionKeyRangeIDClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/partitionkeyrangeidregion.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/partitionkeyrangeidregion.go deleted file mode 100644 index 10c4fef010c2..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/partitionkeyrangeidregion.go +++ /dev/null @@ -1,135 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDRegionClient is the azure Cosmos DB Database Service Resource Provider REST API -type PartitionKeyRangeIDRegionClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDRegionClient creates an instance of the PartitionKeyRangeIDRegionClient client. -func NewPartitionKeyRangeIDRegionClient(subscriptionID string) PartitionKeyRangeIDRegionClient { - return NewPartitionKeyRangeIDRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDRegionClientWithBaseURI creates an instance of the PartitionKeyRangeIDRegionClient 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 NewPartitionKeyRangeIDRegionClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDRegionClient { - return PartitionKeyRangeIDRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDRegionClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentile.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentile.go deleted file mode 100644 index ba7324d1c083..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentile.go +++ /dev/null @@ -1,127 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileClient struct { - BaseClient -} - -// NewPercentileClient creates an instance of the PercentileClient client. -func NewPercentileClient(subscriptionID string) PercentileClient { - return NewPercentileClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileClientWithBaseURI creates an instance of the PercentileClient 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 NewPercentileClientWithBaseURI(baseURI string, subscriptionID string) PercentileClient { - return PercentileClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. This url is only -// for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentilesourcetarget.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentilesourcetarget.go deleted file mode 100644 index f77efb30ebd3..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentilesourcetarget.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileSourceTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileSourceTargetClient struct { - BaseClient -} - -// NewPercentileSourceTargetClient creates an instance of the PercentileSourceTargetClient client. -func NewPercentileSourceTargetClient(subscriptionID string) PercentileSourceTargetClient { - return NewPercentileSourceTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileSourceTargetClientWithBaseURI creates an instance of the PercentileSourceTargetClient 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 NewPercentileSourceTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileSourceTargetClient { - return PercentileSourceTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account, source and target region. -// This url is only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// sourceRegion - source region from which data is written. Cosmos DB region, with spaces between words and -// each word capitalized. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileSourceTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileSourceTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileSourceTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, sourceRegion, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileSourceTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceRegion": autorest.Encode("path", sourceRegion), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileSourceTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileSourceTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentiletarget.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentiletarget.go deleted file mode 100644 index 55aac5bb131a..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/percentiletarget.go +++ /dev/null @@ -1,131 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileTargetClient is the azure Cosmos DB Database Service Resource Provider REST API -type PercentileTargetClient struct { - BaseClient -} - -// NewPercentileTargetClient creates an instance of the PercentileTargetClient client. -func NewPercentileTargetClient(subscriptionID string) PercentileTargetClient { - return NewPercentileTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileTargetClientWithBaseURI creates an instance of the PercentileTargetClient 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 NewPercentileTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileTargetClient { - return PercentileTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account target region. This url is -// only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileTargetClient.ListMetrics") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, targetRegion 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), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2020-09-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/privateendpointconnections.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/privateendpointconnections.go deleted file mode 100644 index a084a08ec5ab..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/privateendpointconnections.go +++ /dev/null @@ -1,406 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) 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 = "2019-08-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.DocumentDB/databaseAccounts/{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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByDatabaseAccount list all private endpoint connections on a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/privatelinkresources.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/privatelinkresources.go deleted file mode 100644 index 42aee63e6a66..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/privatelinkresources.go +++ /dev/null @@ -1,215 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByDatabaseAccount gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateLinkResourcesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByDatabaseAccount") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountPreparer(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 = "2019-08-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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/cosmos-db/mgmt/2020-09-01-preview/documentdb/sqlresources.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/sqlresources.go deleted file mode 100644 index 904f0fdc8a2b..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/sqlresources.go +++ /dev/null @@ -1,2775 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type SQLResourcesClient struct { - BaseClient -} - -// NewSQLResourcesClient creates an instance of the SQLResourcesClient client. -func NewSQLResourcesClient(subscriptionID string) SQLResourcesClient { - return NewSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLResourcesClientWithBaseURI creates an instance of the SQLResourcesClient 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 NewSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string) SQLResourcesClient { - return SQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateSQLContainer create or update an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// createUpdateSQLContainerParameters - the parameters to provide for the current SQL container. -func (client SQLResourcesClient) CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLContainerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", err.Error()) - } - - req, err := client.CreateUpdateSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, createUpdateSQLContainerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLContainerPreparer prepares the CreateUpdateSQLContainer request. -func (client SQLResourcesClient) CreateUpdateSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithJSON(createUpdateSQLContainerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLContainerSender sends the CreateUpdateSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLContainerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLContainerFuture, 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 -} - -// CreateUpdateSQLContainerResponder handles the response to the CreateUpdateSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLDatabase create or update an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateSQLDatabaseParameters - the parameters to provide for the current SQL database. -func (client SQLResourcesClient) CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", err.Error()) - } - - req, err := client.CreateUpdateSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateSQLDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLDatabasePreparer prepares the CreateUpdateSQLDatabase request. -func (client SQLResourcesClient) CreateUpdateSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateSQLDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLDatabaseSender sends the CreateUpdateSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseSender(req *http.Request) (future SQLResourcesCreateUpdateSQLDatabaseFuture, 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 -} - -// CreateUpdateSQLDatabaseResponder handles the response to the CreateUpdateSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLStoredProcedure create or update an Azure Cosmos DB SQL storedProcedure -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -// createUpdateSQLStoredProcedureParameters - the parameters to provide for the current SQL storedProcedure. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLStoredProcedureParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", err.Error()) - } - - req, err := client.CreateUpdateSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSQLStoredProcedureParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLStoredProcedurePreparer prepares the CreateUpdateSQLStoredProcedure request. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithJSON(createUpdateSQLStoredProcedureParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLStoredProcedureSender sends the CreateUpdateSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureSender(req *http.Request) (future SQLResourcesCreateUpdateSQLStoredProcedureFuture, 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 -} - -// CreateUpdateSQLStoredProcedureResponder handles the response to the CreateUpdateSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLTrigger create or update an Azure Cosmos DB SQL trigger -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -// createUpdateSQLTriggerParameters - the parameters to provide for the current SQL trigger. -func (client SQLResourcesClient) CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLTriggerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", err.Error()) - } - - req, err := client.CreateUpdateSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSQLTriggerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLTriggerPreparer prepares the CreateUpdateSQLTrigger request. -func (client SQLResourcesClient) CreateUpdateSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithJSON(createUpdateSQLTriggerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLTriggerSender sends the CreateUpdateSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLTriggerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLTriggerFuture, 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 -} - -// CreateUpdateSQLTriggerResponder handles the response to the CreateUpdateSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLUserDefinedFunction create or update an Azure Cosmos DB SQL userDefinedFunction -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -// createUpdateSQLUserDefinedFunctionParameters - the parameters to provide for the current SQL -// userDefinedFunction. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLUserDefinedFunctionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", err.Error()) - } - - req, err := client.CreateUpdateSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSQLUserDefinedFunctionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLUserDefinedFunctionPreparer prepares the CreateUpdateSQLUserDefinedFunction request. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithJSON(createUpdateSQLUserDefinedFunctionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLUserDefinedFunctionSender sends the CreateUpdateSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, 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 -} - -// CreateUpdateSQLUserDefinedFunctionResponder handles the response to the CreateUpdateSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSQLContainer deletes an existing Azure Cosmos DB SQL container. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesDeleteSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLContainer") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLContainer", err.Error()) - } - - req, err := client.DeleteSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLContainerPreparer prepares the DeleteSQLContainer request. -func (client SQLResourcesClient) DeleteSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLContainerSender sends the DeleteSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLContainerSender(req *http.Request) (future SQLResourcesDeleteSQLContainerFuture, 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 -} - -// DeleteSQLContainerResponder handles the response to the DeleteSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLContainerResponder(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 -} - -// DeleteSQLDatabase deletes an existing Azure Cosmos DB SQL database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesDeleteSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLDatabase") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLDatabase", err.Error()) - } - - req, err := client.DeleteSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLDatabasePreparer prepares the DeleteSQLDatabase request. -func (client SQLResourcesClient) DeleteSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLDatabaseSender sends the DeleteSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLDatabaseSender(req *http.Request) (future SQLResourcesDeleteSQLDatabaseFuture, 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 -} - -// DeleteSQLDatabaseResponder handles the response to the DeleteSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLDatabaseResponder(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 -} - -// DeleteSQLStoredProcedure deletes an existing Azure Cosmos DB SQL storedProcedure. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLResourcesDeleteSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLStoredProcedure") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", err.Error()) - } - - req, err := client.DeleteSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLStoredProcedurePreparer prepares the DeleteSQLStoredProcedure request. -func (client SQLResourcesClient) DeleteSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLStoredProcedureSender sends the DeleteSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLStoredProcedureSender(req *http.Request) (future SQLResourcesDeleteSQLStoredProcedureFuture, 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 -} - -// DeleteSQLStoredProcedureResponder handles the response to the DeleteSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLStoredProcedureResponder(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 -} - -// DeleteSQLTrigger deletes an existing Azure Cosmos DB SQL trigger. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLResourcesDeleteSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLTrigger") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLTrigger", err.Error()) - } - - req, err := client.DeleteSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLTriggerPreparer prepares the DeleteSQLTrigger request. -func (client SQLResourcesClient) DeleteSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLTriggerSender sends the DeleteSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLTriggerSender(req *http.Request) (future SQLResourcesDeleteSQLTriggerFuture, 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 -} - -// DeleteSQLTriggerResponder handles the response to the DeleteSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLTriggerResponder(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 -} - -// DeleteSQLUserDefinedFunction deletes an existing Azure Cosmos DB SQL userDefinedFunction. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLUserDefinedFunction") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", err.Error()) - } - - req, err := client.DeleteSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLUserDefinedFunctionPreparer prepares the DeleteSQLUserDefinedFunction request. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLUserDefinedFunctionSender sends the DeleteSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesDeleteSQLUserDefinedFunctionFuture, 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 -} - -// DeleteSQLUserDefinedFunctionResponder handles the response to the DeleteSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionResponder(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 -} - -// GetSQLContainer gets the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error()) - } - - req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerPreparer prepares the GetSQLContainer request. -func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerSender sends the GetSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database -// account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error()) - } - - req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request. -func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error()) - } - - req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabasePreparer prepares the GetSQLDatabase request. -func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database -// account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error()) - } - - req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request. -func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLStoredProcedure gets the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLStoredProcedureGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLStoredProcedure") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLStoredProcedure", err.Error()) - } - - req, err := client.GetSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLStoredProcedureSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure sending request") - return - } - - result, err = client.GetSQLStoredProcedureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLStoredProcedurePreparer prepares the GetSQLStoredProcedure request. -func (client SQLResourcesClient) GetSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLStoredProcedureSender sends the GetSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLStoredProcedureSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLStoredProcedureResponder handles the response to the GetSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLTrigger gets the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLTriggerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLTrigger") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLTrigger", err.Error()) - } - - req, err := client.GetSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLTriggerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure sending request") - return - } - - result, err = client.GetSQLTriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLTriggerPreparer prepares the GetSQLTrigger request. -func (client SQLResourcesClient) GetSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLTriggerSender sends the GetSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLTriggerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLTriggerResponder handles the response to the GetSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLUserDefinedFunction gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLUserDefinedFunctionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLUserDefinedFunction") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", err.Error()) - } - - req, err := client.GetSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLUserDefinedFunctionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure sending request") - return - } - - result, err = client.GetSQLUserDefinedFunctionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLUserDefinedFunctionPreparer prepares the GetSQLUserDefinedFunction request. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLUserDefinedFunctionSender sends the GetSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLUserDefinedFunctionResponder handles the response to the GetSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLContainers lists the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLContainerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLContainers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLContainers", err.Error()) - } - - req, err := client.ListSQLContainersPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLContainersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLContainersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLContainersPreparer prepares the ListSQLContainers request. -func (client SQLResourcesClient) ListSQLContainersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLContainersSender sends the ListSQLContainers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLContainersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLContainersResponder handles the response to the ListSQLContainers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLContainersResponder(resp *http.Response) (result SQLContainerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLDatabases lists the SQL databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result SQLDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLDatabases") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLDatabases", err.Error()) - } - - req, err := client.ListSQLDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListSQLDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLDatabasesPreparer prepares the ListSQLDatabases request. -func (client SQLResourcesClient) ListSQLDatabasesPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLDatabasesSender sends the ListSQLDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLDatabasesResponder handles the response to the ListSQLDatabases request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLDatabasesResponder(resp *http.Response) (result SQLDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLStoredProcedures lists the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLStoredProcedureListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLStoredProcedures") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLStoredProcedures", err.Error()) - } - - req, err := client.ListSQLStoredProceduresPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLStoredProceduresSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure sending request") - return - } - - result, err = client.ListSQLStoredProceduresResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLStoredProceduresPreparer prepares the ListSQLStoredProcedures request. -func (client SQLResourcesClient) ListSQLStoredProceduresPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLStoredProceduresSender sends the ListSQLStoredProcedures request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLStoredProceduresSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLStoredProceduresResponder handles the response to the ListSQLStoredProcedures request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLStoredProceduresResponder(resp *http.Response) (result SQLStoredProcedureListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLTriggers lists the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLTriggerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLTriggers") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLTriggers", err.Error()) - } - - req, err := client.ListSQLTriggersPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLTriggersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLTriggersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLTriggersPreparer prepares the ListSQLTriggers request. -func (client SQLResourcesClient) ListSQLTriggersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLTriggersSender sends the ListSQLTriggers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLTriggersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLTriggersResponder handles the response to the ListSQLTriggers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLTriggersResponder(resp *http.Response) (result SQLTriggerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLUserDefinedFunctions lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLUserDefinedFunctionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLUserDefinedFunctions") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", err.Error()) - } - - req, err := client.ListSQLUserDefinedFunctionsPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLUserDefinedFunctionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure sending request") - return - } - - result, err = client.ListSQLUserDefinedFunctionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLUserDefinedFunctionsPreparer prepares the ListSQLUserDefinedFunctions request. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLUserDefinedFunctionsSender sends the ListSQLUserDefinedFunctions request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLUserDefinedFunctionsResponder handles the response to the ListSQLUserDefinedFunctions request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsResponder(resp *http.Response) (result SQLUserDefinedFunctionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLContainerToAutoscale migrate an Azure Cosmos DB SQL container from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", err.Error()) - } - - req, err := client.MigrateSQLContainerToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLContainerToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLContainerToAutoscalePreparer prepares the MigrateSQLContainerToAutoscale request. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLContainerToAutoscaleSender sends the MigrateSQLContainerToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToAutoscaleFuture, 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 -} - -// MigrateSQLContainerToAutoscaleResponder handles the response to the MigrateSQLContainerToAutoscale request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLContainerToManualThroughput migrate an Azure Cosmos DB SQL container from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", err.Error()) - } - - req, err := client.MigrateSQLContainerToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLContainerToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLContainerToManualThroughputPreparer prepares the MigrateSQLContainerToManualThroughput request. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLContainerToManualThroughputSender sends the MigrateSQLContainerToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToManualThroughputFuture, 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 -} - -// MigrateSQLContainerToManualThroughputResponder handles the response to the MigrateSQLContainerToManualThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLDatabaseToAutoscale migrate an Azure Cosmos DB SQL database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateSQLDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLDatabaseToAutoscalePreparer prepares the MigrateSQLDatabaseToAutoscale request. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLDatabaseToAutoscaleSender sends the MigrateSQLDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, 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 -} - -// MigrateSQLDatabaseToAutoscaleResponder handles the response to the MigrateSQLDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLDatabaseToManualThroughput migrate an Azure Cosmos DB SQL database from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateSQLDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLDatabaseToManualThroughputPreparer prepares the MigrateSQLDatabaseToManualThroughput request. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLDatabaseToManualThroughputSender sends the MigrateSQLDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, 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 -} - -// MigrateSQLDatabaseToManualThroughputResponder handles the response to the MigrateSQLDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLContainerThroughput update RUs per second of an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL container. -func (client SQLResourcesClient) UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLContainerThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLContainerThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", err.Error()) - } - - req, err := client.UpdateSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLContainerThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLContainerThroughputPreparer prepares the UpdateSQLContainerThroughput request. -func (client SQLResourcesClient) UpdateSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLContainerThroughputSender sends the UpdateSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLContainerThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLContainerThroughputFuture, 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 -} - -// UpdateSQLContainerThroughputResponder handles the response to the UpdateSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLDatabaseThroughput update RUs per second of an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL database. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLDatabaseThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLDatabaseThroughputPreparer prepares the UpdateSQLDatabaseThroughput request. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLDatabaseThroughputSender sends the UpdateSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLDatabaseThroughputFuture, 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 -} - -// UpdateSQLDatabaseThroughputResponder handles the response to the UpdateSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/tableresources.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/tableresources.go deleted file mode 100644 index f6cb679a8bbb..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/tableresources.go +++ /dev/null @@ -1,799 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TableResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API -type TableResourcesClient struct { - BaseClient -} - -// NewTableResourcesClient creates an instance of the TableResourcesClient client. -func NewTableResourcesClient(subscriptionID string) TableResourcesClient { - return NewTableResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTableResourcesClientWithBaseURI creates an instance of the TableResourcesClient 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 NewTableResourcesClientWithBaseURI(baseURI string, subscriptionID string) TableResourcesClient { - return TableResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateTable create or update an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// createUpdateTableParameters - the parameters to provide for the current Table. -func (client TableResourcesClient) CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (result TableResourcesCreateUpdateTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.CreateUpdateTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "CreateUpdateTable", err.Error()) - } - - req, err := client.CreateUpdateTablePreparer(ctx, resourceGroupName, accountName, tableName, createUpdateTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateTablePreparer prepares the CreateUpdateTable request. -func (client TableResourcesClient) CreateUpdateTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateTableSender sends the CreateUpdateTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) CreateUpdateTableSender(req *http.Request) (future TableResourcesCreateUpdateTableFuture, 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 -} - -// CreateUpdateTableResponder handles the response to the CreateUpdateTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) CreateUpdateTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteTable deletes an existing Azure Cosmos DB Table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesDeleteTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.DeleteTable") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "DeleteTable", err.Error()) - } - - req, err := client.DeleteTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteTablePreparer prepares the DeleteTable request. -func (client TableResourcesClient) DeleteTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteTableSender sends the DeleteTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) DeleteTableSender(req *http.Request) (future TableResourcesDeleteTableFuture, 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 -} - -// DeleteTableResponder handles the response to the DeleteTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) DeleteTableResponder(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 -} - -// GetTable gets the Tables under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTable") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTable", err.Error()) - } - - req, err := client.GetTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure sending request") - return - } - - result, err = client.GetTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure responding to request") - return - } - - return -} - -// GetTablePreparer prepares the GetTable request. -func (client TableResourcesClient) GetTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableSender sends the GetTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableResponder handles the response to the GetTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTableThroughput gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTableThroughput") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTableThroughput", err.Error()) - } - - req, err := client.GetTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetTableThroughputPreparer prepares the GetTableThroughput request. -func (client TableResourcesClient) GetTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableThroughputSender sends the GetTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableThroughputResponder handles the response to the GetTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListTables lists the Tables under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client TableResourcesClient) ListTables(ctx context.Context, resourceGroupName string, accountName string) (result TableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.ListTables") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "ListTables", err.Error()) - } - - req, err := client.ListTablesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure sending request") - return - } - - result, err = client.ListTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure responding to request") - return - } - - return -} - -// ListTablesPreparer prepares the ListTables request. -func (client TableResourcesClient) ListTablesPreparer(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 = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListTablesSender sends the ListTables request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) ListTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListTablesResponder handles the response to the ListTables request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) ListTablesResponder(resp *http.Response) (result TableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateTableToAutoscale migrate an Azure Cosmos DB Table from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) MigrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesMigrateTableToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.MigrateTableToAutoscale") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "MigrateTableToAutoscale", err.Error()) - } - - req, err := client.MigrateTableToAutoscalePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateTableToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateTableToAutoscalePreparer prepares the MigrateTableToAutoscale request. -func (client TableResourcesClient) MigrateTableToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateTableToAutoscaleSender sends the MigrateTableToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) MigrateTableToAutoscaleSender(req *http.Request) (future TableResourcesMigrateTableToAutoscaleFuture, 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 -} - -// MigrateTableToAutoscaleResponder handles the response to the MigrateTableToAutoscale request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) MigrateTableToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateTableToManualThroughput migrate an Azure Cosmos DB Table from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) MigrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesMigrateTableToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.MigrateTableToManualThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "MigrateTableToManualThroughput", err.Error()) - } - - req, err := client.MigrateTableToManualThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateTableToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateTableToManualThroughputPreparer prepares the MigrateTableToManualThroughput request. -func (client TableResourcesClient) MigrateTableToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateTableToManualThroughputSender sends the MigrateTableToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) MigrateTableToManualThroughputSender(req *http.Request) (future TableResourcesMigrateTableToManualThroughputFuture, 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 -} - -// MigrateTableToManualThroughputResponder handles the response to the MigrateTableToManualThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) MigrateTableToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateTableThroughput update RUs per second of an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current Table. -func (client TableResourcesClient) UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result TableResourcesUpdateTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.UpdateTableThroughput") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "UpdateTableThroughput", err.Error()) - } - - req, err := client.UpdateTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTableThroughputPreparer prepares the UpdateTableThroughput request. -func (client TableResourcesClient) UpdateTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2020-09-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTableThroughputSender sends the UpdateTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) UpdateTableThroughputSender(req *http.Request) (future TableResourcesUpdateTableThroughputFuture, 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 -} - -// UpdateTableThroughputResponder handles the response to the UpdateTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) UpdateTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/version.go b/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/version.go deleted file mode 100644 index a6055fa3ac22..000000000000 --- a/services/preview/cosmos-db/mgmt/2020-09-01-preview/documentdb/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package documentdb - -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() + " documentdb/2020-09-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/cosmos-db/mgmt/2021-03-01-preview/documentdb/CHANGELOG.md b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/_meta.json b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/_meta.json deleted file mode 100644 index 2c84a9ab7e7d..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "6e95cd4c6086d61bb3de67cf6e4209a7b84efa23", - "readme": "/_/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md", - "tag": "package-2021-03-preview", - "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-03-preview --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/cosmos-db/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/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandraclusters.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandraclusters.go deleted file mode 100644 index bc94868a8ddd..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandraclusters.go +++ /dev/null @@ -1,936 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CassandraClustersClient is the client for the CassandraClusters methods of the Documentdb service. -type CassandraClustersClient struct { - BaseClient -} - -// NewCassandraClustersClient creates an instance of the CassandraClustersClient client. -func NewCassandraClustersClient(subscriptionID string) CassandraClustersClient { - return NewCassandraClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCassandraClustersClientWithBaseURI creates an instance of the CassandraClustersClient 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 NewCassandraClustersClientWithBaseURI(baseURI string, subscriptionID string) CassandraClustersClient { - return CassandraClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdate create or update a managed Cassandra cluster. When updating, you must specify all writable properties. -// To update only some properties, use PATCH. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -// body - the properties specifying the desired state of the managed Cassandra cluster. -func (client CassandraClustersClient) CreateUpdate(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource) (result CassandraClustersCreateUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.CreateUpdate") - 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: 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraClustersClient", "CreateUpdate", err.Error()) - } - - req, err := client.CreateUpdatePreparer(ctx, resourceGroupName, clusterName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "CreateUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "CreateUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdatePreparer prepares the CreateUpdate request. -func (client CassandraClustersClient) CreateUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSender sends the CreateUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraClustersClient) CreateUpdateSender(req *http.Request) (future CassandraClustersCreateUpdateFuture, 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 -} - -// CreateUpdateResponder handles the response to the CreateUpdate request. The method always -// closes the http.Response Body. -func (client CassandraClustersClient) CreateUpdateResponder(resp *http.Response) (result ClusterResource, 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 a managed Cassandra cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -func (client CassandraClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result CassandraClustersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.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: 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraClustersClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CassandraClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}", 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 CassandraClustersClient) DeleteSender(req *http.Request) (future CassandraClustersDeleteFuture, 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 CassandraClustersClient) 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 -} - -// FetchNodeStatus request the status of all nodes in the cluster (as returned by 'nodetool status'). -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -func (client CassandraClustersClient) FetchNodeStatus(ctx context.Context, resourceGroupName string, clusterName string) (result CassandraClustersFetchNodeStatusFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.FetchNodeStatus") - 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: 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraClustersClient", "FetchNodeStatus", err.Error()) - } - - req, err := client.FetchNodeStatusPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "FetchNodeStatus", nil, "Failure preparing request") - return - } - - result, err = client.FetchNodeStatusSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "FetchNodeStatus", result.Response(), "Failure sending request") - return - } - - return -} - -// FetchNodeStatusPreparer prepares the FetchNodeStatus request. -func (client CassandraClustersClient) FetchNodeStatusPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/cassandraClusters/{clusterName}/fetchNodeStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FetchNodeStatusSender sends the FetchNodeStatus request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraClustersClient) FetchNodeStatusSender(req *http.Request) (future CassandraClustersFetchNodeStatusFuture, 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 -} - -// FetchNodeStatusResponder handles the response to the FetchNodeStatus request. The method always -// closes the http.Response Body. -func (client CassandraClustersClient) FetchNodeStatusResponder(resp *http.Response) (result ClusterNodeStatus, 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 get the properties of a managed Cassandra cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -func (client CassandraClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result ClusterResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraClustersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CassandraClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}", 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 CassandraClustersClient) 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 CassandraClustersClient) GetResponder(resp *http.Response) (result ClusterResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBackup get the properties of an individual backup of this cluster that is available to restore. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -// backupID - id of a restorable backup of a Cassandra cluster. -func (client CassandraClustersClient) GetBackup(ctx context.Context, resourceGroupName string, clusterName string, backupID string) (result BackupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.GetBackup") - 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}, - {TargetValue: backupID, - Constraints: []validation.Constraint{{Target: "backupID", Name: validation.MaxLength, Rule: 15, Chain: nil}, - {Target: "backupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backupID", Name: validation.Pattern, Rule: `^[0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraClustersClient", "GetBackup", err.Error()) - } - - req, err := client.GetBackupPreparer(ctx, resourceGroupName, clusterName, backupID) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "GetBackup", nil, "Failure preparing request") - return - } - - resp, err := client.GetBackupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "GetBackup", resp, "Failure sending request") - return - } - - result, err = client.GetBackupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "GetBackup", resp, "Failure responding to request") - return - } - - return -} - -// GetBackupPreparer prepares the GetBackup request. -func (client CassandraClustersClient) GetBackupPreparer(ctx context.Context, resourceGroupName string, clusterName string, backupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBackupSender sends the GetBackup request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraClustersClient) GetBackupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetBackupResponder handles the response to the GetBackup request. The method always -// closes the http.Response Body. -func (client CassandraClustersClient) GetBackupResponder(resp *http.Response) (result BackupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBackupsMethod list the backups of this cluster that are available to restore. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -func (client CassandraClustersClient) ListBackupsMethod(ctx context.Context, resourceGroupName string, clusterName string) (result ListBackups, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.ListBackupsMethod") - 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraClustersClient", "ListBackupsMethod", err.Error()) - } - - req, err := client.ListBackupsMethodPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListBackupsMethod", nil, "Failure preparing request") - return - } - - resp, err := client.ListBackupsMethodSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListBackupsMethod", resp, "Failure sending request") - return - } - - result, err = client.ListBackupsMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListBackupsMethod", resp, "Failure responding to request") - return - } - - return -} - -// ListBackupsMethodPreparer prepares the ListBackupsMethod request. -func (client CassandraClustersClient) ListBackupsMethodPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}/backups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBackupsMethodSender sends the ListBackupsMethod request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraClustersClient) ListBackupsMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBackupsMethodResponder handles the response to the ListBackupsMethod request. The method always -// closes the http.Response Body. -func (client CassandraClustersClient) ListBackupsMethodResponder(resp *http.Response) (result ListBackups, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all managed Cassandra clusters in this resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client CassandraClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListClusters, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.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("documentdb.CassandraClustersClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client CassandraClustersClient) 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-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.DocumentDB/cassandraClusters", 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 CassandraClustersClient) 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 CassandraClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ListClusters, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list all managed Cassandra clusters in this subscription. -func (client CassandraClustersClient) ListBySubscription(ctx context.Context) (result ListClusters, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.ListBySubscription") - 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}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraClustersClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client CassandraClustersClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters", 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 CassandraClustersClient) 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 CassandraClustersClient) ListBySubscriptionResponder(resp *http.Response) (result ListClusters, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RequestRepair request that repair begin on this cluster as soon as possible. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -// body - specification of what keyspaces and tables to run repair on. -func (client CassandraClustersClient) RequestRepair(ctx context.Context, resourceGroupName string, clusterName string, body RepairPostBody) (result CassandraClustersRequestRepairFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.RequestRepair") - 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: 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Keyspace", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraClustersClient", "RequestRepair", err.Error()) - } - - req, err := client.RequestRepairPreparer(ctx, resourceGroupName, clusterName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "RequestRepair", nil, "Failure preparing request") - return - } - - result, err = client.RequestRepairSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "RequestRepair", result.Response(), "Failure sending request") - return - } - - return -} - -// RequestRepairPreparer prepares the RequestRepair request. -func (client CassandraClustersClient) RequestRepairPreparer(ctx context.Context, resourceGroupName string, clusterName string, body RepairPostBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/cassandraClusters/{clusterName}/repair", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RequestRepairSender sends the RequestRepair request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraClustersClient) RequestRepairSender(req *http.Request) (future CassandraClustersRequestRepairFuture, 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 -} - -// RequestRepairResponder handles the response to the RequestRepair request. The method always -// closes the http.Response Body. -func (client CassandraClustersClient) RequestRepairResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates some of the properties of a managed Cassandra cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -// body - parameters to provide for specifying the managed Cassandra cluster. -func (client CassandraClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource) (result CassandraClustersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraClustersClient.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: 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraClustersClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CassandraClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}", pathParameters), - autorest.WithJSON(body), - 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 CassandraClustersClient) UpdateSender(req *http.Request) (future CassandraClustersUpdateFuture, 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 CassandraClustersClient) UpdateResponder(resp *http.Response) (result ClusterResource, 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/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandradatacenters.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandradatacenters.go deleted file mode 100644 index 1780e6323da9..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandradatacenters.go +++ /dev/null @@ -1,517 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CassandraDataCentersClient is the client for the CassandraDataCenters methods of the Documentdb service. -type CassandraDataCentersClient struct { - BaseClient -} - -// NewCassandraDataCentersClient creates an instance of the CassandraDataCentersClient client. -func NewCassandraDataCentersClient(subscriptionID string) CassandraDataCentersClient { - return NewCassandraDataCentersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCassandraDataCentersClientWithBaseURI creates an instance of the CassandraDataCentersClient 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 NewCassandraDataCentersClientWithBaseURI(baseURI string, subscriptionID string) CassandraDataCentersClient { - return CassandraDataCentersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdate create or update a managed Cassandra data center. When updating, overwrite all properties. To update -// only some properties, use PATCH. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -// dataCenterName - data center name in a managed Cassandra cluster. -// body - parameters specifying the managed Cassandra data center. -func (client CassandraDataCentersClient) CreateUpdate(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body DataCenterResource) (result CassandraDataCentersCreateUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraDataCentersClient.CreateUpdate") - 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: 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}, - {TargetValue: dataCenterName, - Constraints: []validation.Constraint{{Target: "dataCenterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "dataCenterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "dataCenterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraDataCentersClient", "CreateUpdate", err.Error()) - } - - req, err := client.CreateUpdatePreparer(ctx, resourceGroupName, clusterName, dataCenterName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "CreateUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "CreateUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdatePreparer prepares the CreateUpdate request. -func (client CassandraDataCentersClient) CreateUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body DataCenterResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "dataCenterName": autorest.Encode("path", dataCenterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSender sends the CreateUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraDataCentersClient) CreateUpdateSender(req *http.Request) (future CassandraDataCentersCreateUpdateFuture, 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 -} - -// CreateUpdateResponder handles the response to the CreateUpdate request. The method always -// closes the http.Response Body. -func (client CassandraDataCentersClient) CreateUpdateResponder(resp *http.Response) (result DataCenterResource, 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 managed Cassandra data center. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -// dataCenterName - data center name in a managed Cassandra cluster. -func (client CassandraDataCentersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string) (result CassandraDataCentersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraDataCentersClient.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: 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}, - {TargetValue: dataCenterName, - Constraints: []validation.Constraint{{Target: "dataCenterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "dataCenterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "dataCenterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraDataCentersClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, dataCenterName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CassandraDataCentersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "dataCenterName": autorest.Encode("path", dataCenterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}", 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 CassandraDataCentersClient) DeleteSender(req *http.Request) (future CassandraDataCentersDeleteFuture, 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 CassandraDataCentersClient) 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 get the properties of a managed Cassandra data center. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -// dataCenterName - data center name in a managed Cassandra cluster. -func (client CassandraDataCentersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string) (result DataCenterResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraDataCentersClient.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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}, - {TargetValue: dataCenterName, - Constraints: []validation.Constraint{{Target: "dataCenterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "dataCenterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "dataCenterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraDataCentersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, dataCenterName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CassandraDataCentersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "dataCenterName": autorest.Encode("path", dataCenterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}", 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 CassandraDataCentersClient) 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 CassandraDataCentersClient) GetResponder(resp *http.Response) (result DataCenterResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all data centers in a particular managed Cassandra cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -func (client CassandraDataCentersClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result ListDataCenters, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraDataCentersClient.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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraDataCentersClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client CassandraDataCentersClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}/dataCenters", 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 CassandraDataCentersClient) 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 CassandraDataCentersClient) ListResponder(resp *http.Response) (result ListDataCenters, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update some of the properties of a managed Cassandra data center. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - managed Cassandra cluster name. -// dataCenterName - data center name in a managed Cassandra cluster. -// body - parameters to provide for specifying the managed Cassandra data center. -func (client CassandraDataCentersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body DataCenterResource) (result CassandraDataCentersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraDataCentersClient.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: 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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "clusterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "clusterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}, - {TargetValue: dataCenterName, - Constraints: []validation.Constraint{{Target: "dataCenterName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "dataCenterName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "dataCenterName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraDataCentersClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, dataCenterName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CassandraDataCentersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body DataCenterResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "dataCenterName": autorest.Encode("path", dataCenterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}", pathParameters), - autorest.WithJSON(body), - 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 CassandraDataCentersClient) UpdateSender(req *http.Request) (future CassandraDataCentersUpdateFuture, 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 CassandraDataCentersClient) UpdateResponder(resp *http.Response) (result DataCenterResource, 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/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandraresources.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandraresources.go deleted file mode 100644 index 74d50673c1fc..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/cassandraresources.go +++ /dev/null @@ -1,1573 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CassandraResourcesClient is the client for the CassandraResources methods of the Documentdb service. -type CassandraResourcesClient struct { - BaseClient -} - -// NewCassandraResourcesClient creates an instance of the CassandraResourcesClient client. -func NewCassandraResourcesClient(subscriptionID string) CassandraResourcesClient { - return NewCassandraResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCassandraResourcesClientWithBaseURI creates an instance of the CassandraResourcesClient 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 NewCassandraResourcesClientWithBaseURI(baseURI string, subscriptionID string) CassandraResourcesClient { - return CassandraResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateCassandraKeyspace create or update an Azure Cosmos DB Cassandra keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// createUpdateCassandraKeyspaceParameters - the parameters to provide for the current Cassandra keyspace. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraKeyspace") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraKeyspaceParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraKeyspaceParameters.CassandraKeyspaceCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", err.Error()) - } - - req, err := client.CreateUpdateCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraKeyspacePreparer prepares the CreateUpdateCassandraKeyspace request. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithJSON(createUpdateCassandraKeyspaceParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraKeyspaceSender sends the CreateUpdateCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraKeyspaceFuture, 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 -} - -// CreateUpdateCassandraKeyspaceResponder handles the response to the CreateUpdateCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateCassandraTable create or update an Azure Cosmos DB Cassandra Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// createUpdateCassandraTableParameters - the parameters to provide for the current Cassandra Table. -func (client CassandraResourcesClient) CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (result CassandraResourcesCreateUpdateCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.CreateUpdateCassandraTable") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateCassandraTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateCassandraTableParameters.CassandraTableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", err.Error()) - } - - req, err := client.CreateUpdateCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "CreateUpdateCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateCassandraTablePreparer prepares the CreateUpdateCassandraTable request. -func (client CassandraResourcesClient) CreateUpdateCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateCassandraTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateCassandraTableSender sends the CreateUpdateCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) CreateUpdateCassandraTableSender(req *http.Request) (future CassandraResourcesCreateUpdateCassandraTableFuture, 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 -} - -// CreateUpdateCassandraTableResponder handles the response to the CreateUpdateCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) CreateUpdateCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCassandraKeyspace deletes an existing Azure Cosmos DB Cassandra keyspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesDeleteCassandraKeyspaceFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraKeyspace") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", err.Error()) - } - - req, err := client.DeleteCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraKeyspaceSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraKeyspace", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraKeyspacePreparer prepares the DeleteCassandraKeyspace request. -func (client CassandraResourcesClient) DeleteCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraKeyspaceSender sends the DeleteCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceSender(req *http.Request) (future CassandraResourcesDeleteCassandraKeyspaceFuture, 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 -} - -// DeleteCassandraKeyspaceResponder handles the response to the DeleteCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraKeyspaceResponder(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 -} - -// DeleteCassandraTable deletes an existing Azure Cosmos DB Cassandra table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesDeleteCassandraTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.DeleteCassandraTable") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "DeleteCassandraTable", err.Error()) - } - - req, err := client.DeleteCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteCassandraTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "DeleteCassandraTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteCassandraTablePreparer prepares the DeleteCassandraTable request. -func (client CassandraResourcesClient) DeleteCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteCassandraTableSender sends the DeleteCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) DeleteCassandraTableSender(req *http.Request) (future CassandraResourcesDeleteCassandraTableFuture, 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 -} - -// DeleteCassandraTableResponder handles the response to the DeleteCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) DeleteCassandraTableResponder(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 -} - -// GetCassandraKeyspace gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraKeyspaceGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspace") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspace", err.Error()) - } - - req, err := client.GetCassandraKeyspacePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspace", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspacePreparer prepares the GetCassandraKeyspace request. -func (client CassandraResourcesClient) GetCassandraKeyspacePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceSender sends the GetCassandraKeyspace request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceResponder handles the response to the GetCassandraKeyspace request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceResponder(resp *http.Response) (result CassandraKeyspaceGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraKeyspaceThroughput gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraKeyspaceThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.GetCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraKeyspaceThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraKeyspaceThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraKeyspaceThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraKeyspaceThroughputPreparer prepares the GetCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraKeyspaceThroughputSender sends the GetCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraKeyspaceThroughputResponder handles the response to the GetCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTable gets the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraTableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTable") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTable", err.Error()) - } - - req, err := client.GetCassandraTablePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTable", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTablePreparer prepares the GetCassandraTable request. -func (client CassandraResourcesClient) GetCassandraTablePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableSender sends the GetCassandraTable request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableResponder handles the response to the GetCassandraTable request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableResponder(resp *http.Response) (result CassandraTableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCassandraTableThroughput gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.GetCassandraTableThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", err.Error()) - } - - req, err := client.GetCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetCassandraTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetCassandraTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "GetCassandraTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetCassandraTableThroughputPreparer prepares the GetCassandraTableThroughput request. -func (client CassandraResourcesClient) GetCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCassandraTableThroughputSender sends the GetCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) GetCassandraTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCassandraTableThroughputResponder handles the response to the GetCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) GetCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraKeyspaces lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client CassandraResourcesClient) ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result CassandraKeyspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraKeyspaces") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", err.Error()) - } - - req, err := client.ListCassandraKeyspacesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraKeyspacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraKeyspacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraKeyspaces", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraKeyspacesPreparer prepares the ListCassandraKeyspaces request. -func (client CassandraResourcesClient) ListCassandraKeyspacesPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraKeyspacesSender sends the ListCassandraKeyspaces request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraKeyspacesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraKeyspacesResponder handles the response to the ListCassandraKeyspaces request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraKeyspacesResponder(resp *http.Response) (result CassandraKeyspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCassandraTables lists the Cassandra table under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraTableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.ListCassandraTables") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "ListCassandraTables", err.Error()) - } - - req, err := client.ListCassandraTablesPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListCassandraTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure sending request") - return - } - - result, err = client.ListCassandraTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "ListCassandraTables", resp, "Failure responding to request") - return - } - - return -} - -// ListCassandraTablesPreparer prepares the ListCassandraTables request. -func (client CassandraResourcesClient) ListCassandraTablesPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCassandraTablesSender sends the ListCassandraTables request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) ListCassandraTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCassandraTablesResponder handles the response to the ListCassandraTables request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) ListCassandraTablesResponder(resp *http.Response) (result CassandraTableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraKeyspaceToAutoscale migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to -// autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToAutoscale") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", err.Error()) - } - - req, err := client.MigrateCassandraKeyspaceToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraKeyspaceToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraKeyspaceToAutoscalePreparer prepares the MigrateCassandraKeyspaceToAutoscale request. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraKeyspaceToAutoscaleSender sends the MigrateCassandraKeyspaceToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, 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 -} - -// MigrateCassandraKeyspaceToAutoscaleResponder handles the response to the MigrateCassandraKeyspaceToAutoscale request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraKeyspaceToManualThroughput migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraKeyspaceToManualThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", err.Error()) - } - - req, err := client.MigrateCassandraKeyspaceToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraKeyspaceToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraKeyspaceToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraKeyspaceToManualThroughputPreparer prepares the MigrateCassandraKeyspaceToManualThroughput request. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraKeyspaceToManualThroughputSender sends the MigrateCassandraKeyspaceToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, 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 -} - -// MigrateCassandraKeyspaceToManualThroughputResponder handles the response to the MigrateCassandraKeyspaceToManualThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraKeyspaceToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraTableToAutoscale migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToAutoscale") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", err.Error()) - } - - req, err := client.MigrateCassandraTableToAutoscalePreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraTableToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraTableToAutoscalePreparer prepares the MigrateCassandraTableToAutoscale request. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraTableToAutoscaleSender sends the MigrateCassandraTableToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToAutoscaleFuture, 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 -} - -// MigrateCassandraTableToAutoscaleResponder handles the response to the MigrateCassandraTableToAutoscale request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraTableToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateCassandraTableToManualThroughput migrate an Azure Cosmos DB Cassandra table from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.MigrateCassandraTableToManualThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", err.Error()) - } - - req, err := client.MigrateCassandraTableToManualThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateCassandraTableToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "MigrateCassandraTableToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateCassandraTableToManualThroughputPreparer prepares the MigrateCassandraTableToManualThroughput request. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateCassandraTableToManualThroughputSender sends the MigrateCassandraTableToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputSender(req *http.Request) (future CassandraResourcesMigrateCassandraTableToManualThroughputFuture, 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 -} - -// MigrateCassandraTableToManualThroughputResponder handles the response to the MigrateCassandraTableToManualThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) MigrateCassandraTableToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraKeyspaceThroughput update RUs per second of an Azure Cosmos DB Cassandra Keyspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// Keyspace. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraKeyspaceThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", err.Error()) - } - - req, err := client.UpdateCassandraKeyspaceThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraKeyspaceThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraKeyspaceThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraKeyspaceThroughputPreparer prepares the UpdateCassandraKeyspaceThroughput request. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraKeyspaceThroughputSender sends the UpdateCassandraKeyspaceThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, 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 -} - -// UpdateCassandraKeyspaceThroughputResponder handles the response to the UpdateCassandraKeyspaceThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraKeyspaceThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCassandraTableThroughput update RUs per second of an Azure Cosmos DB Cassandra table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyspaceName - cosmos DB keyspace name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Cassandra -// table. -func (client CassandraResourcesClient) UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result CassandraResourcesUpdateCassandraTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CassandraResourcesClient.UpdateCassandraTableThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", err.Error()) - } - - req, err := client.UpdateCassandraTableThroughputPreparer(ctx, resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateCassandraTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesClient", "UpdateCassandraTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateCassandraTableThroughputPreparer prepares the UpdateCassandraTableThroughput request. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "keyspaceName": autorest.Encode("path", keyspaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateCassandraTableThroughputSender sends the UpdateCassandraTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputSender(req *http.Request) (future CassandraResourcesUpdateCassandraTableThroughputFuture, 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 -} - -// UpdateCassandraTableThroughputResponder handles the response to the UpdateCassandraTableThroughput request. The method always -// closes the http.Response Body. -func (client CassandraResourcesClient) UpdateCassandraTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/client.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/client.go deleted file mode 100644 index 06cac31f5106..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/client.go +++ /dev/null @@ -1,203 +0,0 @@ -// Package documentdb implements the Azure ARM Documentdb service API version 2021-03-01-preview. -// -// -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Documentdb - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Documentdb. -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, - } -} - -// LocationGet get the properties of an existing Cosmos DB location -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -func (client BaseClient) LocationGet(ctx context.Context, location string) (result LocationGetResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.LocationGet") - 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}}}}); err != nil { - return result, validation.NewError("documentdb.BaseClient", "LocationGet", err.Error()) - } - - req, err := client.LocationGetPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.BaseClient", "LocationGet", nil, "Failure preparing request") - return - } - - resp, err := client.LocationGetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.BaseClient", "LocationGet", resp, "Failure sending request") - return - } - - result, err = client.LocationGetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.BaseClient", "LocationGet", resp, "Failure responding to request") - return - } - - return -} - -// LocationGetPreparer prepares the LocationGet request. -func (client BaseClient) LocationGetPreparer(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 = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// LocationGetSender sends the LocationGet request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) LocationGetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// LocationGetResponder handles the response to the LocationGet request. The method always -// closes the http.Response Body. -func (client BaseClient) LocationGetResponder(resp *http.Response) (result LocationGetResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// LocationList list Cosmos DB locations and their properties -func (client BaseClient) LocationList(ctx context.Context) (result LocationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.LocationList") - 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}}}}); err != nil { - return result, validation.NewError("documentdb.BaseClient", "LocationList", err.Error()) - } - - req, err := client.LocationListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.BaseClient", "LocationList", nil, "Failure preparing request") - return - } - - resp, err := client.LocationListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.BaseClient", "LocationList", resp, "Failure sending request") - return - } - - result, err = client.LocationListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.BaseClient", "LocationList", resp, "Failure responding to request") - return - } - - return -} - -// LocationListPreparer prepares the LocationList request. -func (client BaseClient) LocationListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// LocationListSender sends the LocationList request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) LocationListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// LocationListResponder handles the response to the LocationList request. The method always -// closes the http.Response Body. -func (client BaseClient) LocationListResponder(resp *http.Response) (result LocationListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/collection.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collection.go deleted file mode 100644 index 6966a51ec1bd..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collection.go +++ /dev/null @@ -1,320 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionClient is the client for the Collection methods of the Documentdb service. -type CollectionClient struct { - BaseClient -} - -// NewCollectionClient creates an instance of the CollectionClient client. -func NewCollectionClient(subscriptionID string) CollectionClient { - return NewCollectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionClientWithBaseURI creates an instance of the CollectionClient 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 NewCollectionClientWithBaseURI(baseURI string, subscriptionID string) CollectionClient { - return CollectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -func (client CollectionClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetricDefinitions") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client CollectionClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionClient.ListUsages") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionpartition.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionpartition.go deleted file mode 100644 index 0c2d0ae1de6a..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionpartition.go +++ /dev/null @@ -1,228 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionClient is the client for the CollectionPartition methods of the Documentdb service. -type CollectionPartitionClient struct { - BaseClient -} - -// NewCollectionPartitionClient creates an instance of the CollectionPartitionClient client. -func NewCollectionPartitionClient(subscriptionID string) CollectionPartitionClient { - return NewCollectionPartitionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionClientWithBaseURI creates an instance of the CollectionPartitionClient 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 NewCollectionPartitionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionClient { - return CollectionPartitionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent storage data) for the given collection, split by partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client CollectionPartitionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionUsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionClient.ListUsages") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client CollectionPartitionClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client CollectionPartitionClient) ListUsagesResponder(resp *http.Response) (result PartitionUsagesResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionpartitionregion.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionpartitionregion.go deleted file mode 100644 index e71b2bcb7de0..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionpartitionregion.go +++ /dev/null @@ -1,133 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionPartitionRegionClient is the client for the CollectionPartitionRegion methods of the Documentdb service. -type CollectionPartitionRegionClient struct { - BaseClient -} - -// NewCollectionPartitionRegionClient creates an instance of the CollectionPartitionRegionClient client. -func NewCollectionPartitionRegionClient(subscriptionID string) CollectionPartitionRegionClient { - return NewCollectionPartitionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionPartitionRegionClientWithBaseURI creates an instance of the CollectionPartitionRegionClient 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 NewCollectionPartitionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionPartitionRegionClient { - return CollectionPartitionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given collection and region, split by -// partition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionPartitionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionPartitionRegionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionPartitionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionPartitionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionPartitionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionPartitionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionPartitionRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionregion.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionregion.go deleted file mode 100644 index e58e2e14bd69..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/collectionregion.go +++ /dev/null @@ -1,133 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CollectionRegionClient is the client for the CollectionRegion methods of the Documentdb service. -type CollectionRegionClient struct { - BaseClient -} - -// NewCollectionRegionClient creates an instance of the CollectionRegionClient client. -func NewCollectionRegionClient(subscriptionID string) CollectionRegionClient { - return NewCollectionRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCollectionRegionClientWithBaseURI creates an instance of the CollectionRegionClient 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 NewCollectionRegionClientWithBaseURI(baseURI string, subscriptionID string) CollectionRegionClient { - return CollectionRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account, collection and -// region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client CollectionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CollectionRegionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.CollectionRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CollectionRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client CollectionRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client CollectionRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client CollectionRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/database.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/database.go deleted file mode 100644 index 431102be52ba..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/database.go +++ /dev/null @@ -1,314 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseClient is the client for the Database methods of the Documentdb service. -type DatabaseClient struct { - BaseClient -} - -// NewDatabaseClient creates an instance of the DatabaseClient client. -func NewDatabaseClient(subscriptionID string) DatabaseClient { - return NewDatabaseClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseClientWithBaseURI creates an instance of the DatabaseClient 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 NewDatabaseClientWithBaseURI(baseURI string, subscriptionID string) DatabaseClient { - return DatabaseClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetricDefinitions retrieves metric definitions for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -func (client DatabaseClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetricDefinitions") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName, databaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseClient.ListUsages") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, databaseRid, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseRid": autorest.Encode("path", databaseRid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/databaseaccountregion.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/databaseaccountregion.go deleted file mode 100644 index 328727938288..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/databaseaccountregion.go +++ /dev/null @@ -1,128 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountRegionClient is the client for the DatabaseAccountRegion methods of the Documentdb service. -type DatabaseAccountRegionClient struct { - BaseClient -} - -// NewDatabaseAccountRegionClient creates an instance of the DatabaseAccountRegionClient client. -func NewDatabaseAccountRegionClient(subscriptionID string) DatabaseAccountRegionClient { - return NewDatabaseAccountRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountRegionClientWithBaseURI creates an instance of the DatabaseAccountRegionClient 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 NewDatabaseAccountRegionClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountRegionClient { - return DatabaseAccountRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountRegionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountRegionClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/databaseaccounts.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/databaseaccounts.go deleted file mode 100644 index 49178c5dd0df..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/databaseaccounts.go +++ /dev/null @@ -1,1661 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAccountsClient is the client for the DatabaseAccounts methods of the Documentdb service. -type DatabaseAccountsClient struct { - BaseClient -} - -// NewDatabaseAccountsClient creates an instance of the DatabaseAccountsClient client. -func NewDatabaseAccountsClient(subscriptionID string) DatabaseAccountsClient { - return NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountsClientWithBaseURI creates an instance of the DatabaseAccountsClient 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 NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountsClient { - return DatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameExists checks that the Azure Cosmos DB account name already exists. A valid account name may contain only -// lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. -// Parameters: -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.CheckNameExists") - 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: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CheckNameExists", err.Error()) - } - - req, err := client.CheckNameExistsPreparer(ctx, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") - return - } - - result, err = client.CheckNameExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameExistsPreparer prepares the CheckNameExists request. -func (client DatabaseAccountsClient) CheckNameExistsPreparer(ctx context.Context, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameExistsSender sends the CheckNameExists request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) CheckNameExistsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CheckNameExistsResponder handles the response to the CheckNameExists request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when -// performing updates on an account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// createUpdateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (result DatabaseAccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, createUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (*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 = "2021-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(createUpdateParameters), - 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 DatabaseAccountsClient) CreateOrUpdateSender(req *http.Request) (future DatabaseAccountsCreateOrUpdateFuture, 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 DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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 existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseAccountsClient) 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 = "2021-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) DeleteSender(req *http.Request) (future DatabaseAccountsDeleteFuture, 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 DatabaseAccountsClient) 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 -} - -// FailoverPriorityChange changes the failover priority for the Azure Cosmos DB database account. A failover priority -// of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover -// priority values must be unique for each of the regions in which the database account exists. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// failoverParameters - the new failover policies for the database account. -func (client DatabaseAccountsClient) FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (result DatabaseAccountsFailoverPriorityChangeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.FailoverPriorityChange") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: failoverParameters, - Constraints: []validation.Constraint{{Target: "failoverParameters.FailoverPolicies", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "FailoverPriorityChange", err.Error()) - } - - req, err := client.FailoverPriorityChangePreparer(ctx, resourceGroupName, accountName, failoverParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") - return - } - - result, err = client.FailoverPriorityChangeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPriorityChangePreparer prepares the FailoverPriorityChange request. -func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (*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 = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", pathParameters), - autorest.WithJSON(failoverParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverPriorityChangeSender sends the FailoverPriorityChange request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) FailoverPriorityChangeSender(req *http.Request) (future DatabaseAccountsFailoverPriorityChangeFuture, 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 -} - -// FailoverPriorityChangeResponder handles the response to the FailoverPriorityChange request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(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 retrieves the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseAccountsClient) 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 = "2021-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.DocumentDB/databaseAccounts/{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 DatabaseAccountsClient) 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 DatabaseAccountsClient) GetResponder(resp *http.Response) (result DatabaseAccountGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.GetReadOnlyKeys") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", err.Error()) - } - - req, err := client.GetReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.GetReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "GetReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// GetReadOnlyKeysPreparer prepares the GetReadOnlyKeys request. -func (client DatabaseAccountsClient) GetReadOnlyKeysPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetReadOnlyKeysSender sends the GetReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) GetReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetReadOnlyKeysResponder handles the response to the GetReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) GetReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, 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 the Azure Cosmos DB database accounts available under the subscription. -func (client DatabaseAccountsClient) List(ctx context.Context) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DatabaseAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the Azure Cosmos DB database accounts available under the given resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client DatabaseAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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("documentdb.DatabaseAccountsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DatabaseAccountsClient) 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-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.DocumentDB/databaseAccounts", 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 DatabaseAccountsClient) 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 DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionStrings lists the connection strings for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListConnectionStrings") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListConnectionStrings", err.Error()) - } - - req, err := client.ListConnectionStringsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionStringsPreparer prepares the ListConnectionStrings request. -func (client DatabaseAccountsClient) ListConnectionStringsPreparer(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 = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.Response) (result DatabaseAccountListConnectionStringsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListKeys") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DatabaseAccountsClient) ListKeysPreparer(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 = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (result DatabaseAccountListKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions retrieves metric definitions for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MetricDefinitionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetricDefinitions") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetricDefinitions", err.Error()) - } - - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabaseAccountsClient) ListMetricDefinitionsPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client DatabaseAccountsClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabaseAccountsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client DatabaseAccountsClient) ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListReadOnlyKeys") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", err.Error()) - } - - req, err := client.ListReadOnlyKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.ListReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListReadOnlyKeysPreparer prepares the ListReadOnlyKeys request. -func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(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 = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListReadOnlyKeysSender sends the ListReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListReadOnlyKeysResponder handles the response to the ListReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages retrieves the usages (most recent data) for the given database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is -// name.value (name of the metric, can have an or of multiple names). -func (client DatabaseAccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsagesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.ListUsages") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "ListUsages", err.Error()) - } - - req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListUsages", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabaseAccountsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.DocumentDB/databaseAccounts/{accountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (result UsagesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOffline - cosmos DB region to offline for the database account. -func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (result DatabaseAccountsOfflineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OfflineRegion") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOffline, - Constraints: []validation.Constraint{{Target: "regionParameterForOffline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OfflineRegion", err.Error()) - } - - req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOffline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OfflineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OfflineRegionPreparer prepares the OfflineRegion request. -func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (*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 = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/offlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOffline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OfflineRegionSender sends the OfflineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OfflineRegionSender(req *http.Request) (future DatabaseAccountsOfflineRegionFuture, 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 -} - -// OfflineRegionResponder handles the response to the OfflineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// OnlineRegion online the specified region for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// regionParameterForOnline - cosmos DB region to online for the database account. -func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (result DatabaseAccountsOnlineRegionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.OnlineRegion") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: regionParameterForOnline, - Constraints: []validation.Constraint{{Target: "regionParameterForOnline.Region", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "OnlineRegion", err.Error()) - } - - req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOnline) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", nil, "Failure preparing request") - return - } - - result, err = client.OnlineRegionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", result.Response(), "Failure sending request") - return - } - - return -} - -// OnlineRegionPreparer prepares the OnlineRegion request. -func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (*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 = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/onlineRegion", pathParameters), - autorest.WithJSON(regionParameterForOnline), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// OnlineRegionSender sends the OnlineRegion request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) OnlineRegionSender(req *http.Request) (future DatabaseAccountsOnlineRegionFuture, 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 -} - -// OnlineRegionResponder handles the response to the OnlineRegion request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) OnlineRegionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateKey regenerates an access key for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// keyToRegenerate - the name of the key to regenerate. -func (client DatabaseAccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (result DatabaseAccountsRegenerateKeyFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.RegenerateKey") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, keyToRegenerate) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateKeySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DatabaseAccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (*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 = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(keyToRegenerate), - 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 DatabaseAccountsClient) RegenerateKeySender(req *http.Request) (future DatabaseAccountsRegenerateKeyFuture, 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 -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) RegenerateKeyResponder(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 the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// updateParameters - the parameters to provide for the current database account. -func (client DatabaseAccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (result DatabaseAccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAccountsClient.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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.DatabaseAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabaseAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters) (*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 = "2021-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.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 DatabaseAccountsClient) UpdateSender(req *http.Request) (future DatabaseAccountsUpdateFuture, 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 DatabaseAccountsClient) UpdateResponder(resp *http.Response) (result DatabaseAccountGetResults, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/documentdbapi/interfaces.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/documentdbapi/interfaces.go deleted file mode 100644 index a838ba733917..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/documentdbapi/interfaces.go +++ /dev/null @@ -1,366 +0,0 @@ -package documentdbapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/cosmos-db/mgmt/2021-03-01-preview/documentdb" - "github.com/Azure/go-autorest/autorest" -) - -// BaseClientAPI contains the set of methods on the BaseClient type. -type BaseClientAPI interface { - LocationGet(ctx context.Context, location string) (result documentdb.LocationGetResult, err error) - LocationList(ctx context.Context) (result documentdb.LocationListResult, err error) -} - -var _ BaseClientAPI = (*documentdb.BaseClient)(nil) - -// DatabaseAccountsClientAPI contains the set of methods on the DatabaseAccountsClient type. -type DatabaseAccountsClientAPI interface { - CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters documentdb.DatabaseAccountCreateUpdateParameters) (result documentdb.DatabaseAccountsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountsDeleteFuture, err error) - FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters documentdb.FailoverPolicies) (result documentdb.DatabaseAccountsFailoverPriorityChangeFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountGetResults, err error) - GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - List(ctx context.Context) (result documentdb.DatabaseAccountsListResult, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result documentdb.DatabaseAccountsListResult, err error) - ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListConnectionStringsResult, err error) - ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListKeysResult, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.MetricListResult, err error) - ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.DatabaseAccountListReadOnlyKeysResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.UsagesResult, err error) - OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOfflineRegionFuture, err error) - OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline documentdb.RegionForOnlineOffline) (result documentdb.DatabaseAccountsOnlineRegionFuture, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate documentdb.DatabaseAccountRegenerateKeyParameters) (result documentdb.DatabaseAccountsRegenerateKeyFuture, err error) - Update(ctx context.Context, resourceGroupName string, accountName string, updateParameters documentdb.DatabaseAccountUpdateParameters) (result documentdb.DatabaseAccountsUpdateFuture, err error) -} - -var _ DatabaseAccountsClientAPI = (*documentdb.DatabaseAccountsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result documentdb.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result documentdb.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*documentdb.OperationsClient)(nil) - -// DatabaseClientAPI contains the set of methods on the DatabaseClient type. -type DatabaseClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ DatabaseClientAPI = (*documentdb.DatabaseClient)(nil) - -// CollectionClientAPI contains the set of methods on the CollectionClient type. -type CollectionClientAPI interface { - ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result documentdb.MetricDefinitionsListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.UsagesResult, err error) -} - -var _ CollectionClientAPI = (*documentdb.CollectionClient)(nil) - -// CollectionRegionClientAPI contains the set of methods on the CollectionRegionClient type. -type CollectionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ CollectionRegionClientAPI = (*documentdb.CollectionRegionClient)(nil) - -// DatabaseAccountRegionClientAPI contains the set of methods on the DatabaseAccountRegionClient type. -type DatabaseAccountRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result documentdb.MetricListResult, err error) -} - -var _ DatabaseAccountRegionClientAPI = (*documentdb.DatabaseAccountRegionClient)(nil) - -// PercentileSourceTargetClientAPI contains the set of methods on the PercentileSourceTargetClient type. -type PercentileSourceTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileSourceTargetClientAPI = (*documentdb.PercentileSourceTargetClient)(nil) - -// PercentileTargetClientAPI contains the set of methods on the PercentileTargetClient type. -type PercentileTargetClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileTargetClientAPI = (*documentdb.PercentileTargetClient)(nil) - -// PercentileClientAPI contains the set of methods on the PercentileClient type. -type PercentileClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result documentdb.PercentileMetricListResult, err error) -} - -var _ PercentileClientAPI = (*documentdb.PercentileClient)(nil) - -// CollectionPartitionRegionClientAPI contains the set of methods on the CollectionPartitionRegionClient type. -type CollectionPartitionRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ CollectionPartitionRegionClientAPI = (*documentdb.CollectionPartitionRegionClient)(nil) - -// CollectionPartitionClientAPI contains the set of methods on the CollectionPartitionClient type. -type CollectionPartitionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionMetricListResult, err error) - ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result documentdb.PartitionUsagesResult, err error) -} - -var _ CollectionPartitionClientAPI = (*documentdb.CollectionPartitionClient)(nil) - -// PartitionKeyRangeIDClientAPI contains the set of methods on the PartitionKeyRangeIDClient type. -type PartitionKeyRangeIDClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDClientAPI = (*documentdb.PartitionKeyRangeIDClient)(nil) - -// PartitionKeyRangeIDRegionClientAPI contains the set of methods on the PartitionKeyRangeIDRegionClient type. -type PartitionKeyRangeIDRegionClientAPI interface { - ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result documentdb.PartitionMetricListResult, err error) -} - -var _ PartitionKeyRangeIDRegionClientAPI = (*documentdb.PartitionKeyRangeIDRegionClient)(nil) - -// SQLResourcesClientAPI contains the set of methods on the SQLResourcesClient type. -type SQLResourcesClientAPI interface { - CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters documentdb.SQLContainerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLContainerFuture, err error) - CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters documentdb.SQLDatabaseCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture, err error) - CreateUpdateSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters documentdb.SQLRoleAssignmentCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture, err error) - CreateUpdateSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters documentdb.SQLRoleDefinitionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture, err error) - CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters documentdb.SQLStoredProcedureCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) - CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters documentdb.SQLTriggerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLTriggerFuture, err error) - CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters documentdb.SQLUserDefinedFunctionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) - DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesDeleteSQLContainerFuture, err error) - DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesDeleteSQLDatabaseFuture, err error) - DeleteSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result documentdb.SQLResourcesDeleteSQLRoleAssignmentFuture, err error) - DeleteSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result documentdb.SQLResourcesDeleteSQLRoleDefinitionFuture, err error) - DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLResourcesDeleteSQLStoredProcedureFuture, err error) - DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLResourcesDeleteSQLTriggerFuture, err error) - DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) - GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLContainerGetResults, err error) - GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLDatabaseGetResults, err error) - GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result documentdb.SQLRoleAssignmentGetResults, err error) - GetSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result documentdb.SQLRoleDefinitionGetResults, err error) - GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLStoredProcedureGetResults, err error) - GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLTriggerGetResults, err error) - GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLUserDefinedFunctionGetResults, err error) - ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLContainerListResult, err error) - ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLDatabaseListResult, err error) - ListSQLRoleAssignments(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLRoleAssignmentListResult, err error) - ListSQLRoleDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLRoleDefinitionListResult, err error) - ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLStoredProcedureListResult, err error) - ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLTriggerListResult, err error) - ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLUserDefinedFunctionListResult, err error) - MigrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) - MigrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) - MigrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) - MigrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) - UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLContainerThroughputFuture, err error) - UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) -} - -var _ SQLResourcesClientAPI = (*documentdb.SQLResourcesClient)(nil) - -// MongoDBResourcesClientAPI contains the set of methods on the MongoDBResourcesClient type. -type MongoDBResourcesClientAPI interface { - CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters documentdb.MongoDBCollectionCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) - CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters documentdb.MongoDBDatabaseCreateUpdateParameters) (result documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) - DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture, err error) - DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) - GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBCollectionGetResults, err error) - GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBDatabaseGetResults, err error) - GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBCollectionListResult, err error) - ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.MongoDBDatabaseListResult, err error) - MigrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) - MigrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) - MigrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) - MigrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) - UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) - UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) -} - -var _ MongoDBResourcesClientAPI = (*documentdb.MongoDBResourcesClient)(nil) - -// TableResourcesClientAPI contains the set of methods on the TableResourcesClient type. -type TableResourcesClientAPI interface { - CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters documentdb.TableCreateUpdateParameters) (result documentdb.TableResourcesCreateUpdateTableFuture, err error) - DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesDeleteTableFuture, err error) - GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableGetResults, err error) - GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListTables(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.TableListResult, err error) - MigrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesMigrateTableToAutoscaleFuture, err error) - MigrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result documentdb.TableResourcesMigrateTableToManualThroughputFuture, err error) - UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.TableResourcesUpdateTableThroughputFuture, err error) -} - -var _ TableResourcesClientAPI = (*documentdb.TableResourcesClient)(nil) - -// CassandraResourcesClientAPI contains the set of methods on the CassandraResourcesClient type. -type CassandraResourcesClientAPI interface { - CreateUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters documentdb.CassandraKeyspaceCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture, err error) - CreateUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters documentdb.CassandraTableCreateUpdateParameters) (result documentdb.CassandraResourcesCreateUpdateCassandraTableFuture, err error) - DeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture, err error) - DeleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesDeleteCassandraTableFuture, err error) - GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraKeyspaceGetResults, err error) - GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraTableGetResults, err error) - GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.CassandraKeyspaceListResult, err error) - ListCassandraTables(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraTableListResult, err error) - MigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture, err error) - MigrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string) (result documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture, err error) - MigrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture, err error) - MigrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string) (result documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture, err error) - UpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture, err error) - UpdateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture, err error) -} - -var _ CassandraResourcesClientAPI = (*documentdb.CassandraResourcesClient)(nil) - -// GremlinResourcesClientAPI contains the set of methods on the GremlinResourcesClient type. -type GremlinResourcesClientAPI interface { - CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters documentdb.GremlinDatabaseCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) - CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters documentdb.GremlinGraphCreateUpdateParameters) (result documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture, err error) - DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesDeleteGremlinDatabaseFuture, err error) - DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesDeleteGremlinGraphFuture, err error) - GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinDatabaseGetResults, err error) - GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) - GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinGraphGetResults, err error) - GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.ThroughputSettingsGetResults, err error) - ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.GremlinDatabaseListResult, err error) - ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinGraphListResult, err error) - MigrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) - MigrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) - MigrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) - MigrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) - UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) - UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters documentdb.ThroughputSettingsUpdateParameters) (result documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) -} - -var _ GremlinResourcesClientAPI = (*documentdb.GremlinResourcesClient)(nil) - -// RestorableDatabaseAccountsClientAPI contains the set of methods on the RestorableDatabaseAccountsClient type. -type RestorableDatabaseAccountsClientAPI interface { - GetByLocation(ctx context.Context, location string, instanceID string) (result documentdb.RestorableDatabaseAccountGetResult, err error) - List(ctx context.Context) (result documentdb.RestorableDatabaseAccountsListResult, err error) - ListByLocation(ctx context.Context, location string) (result documentdb.RestorableDatabaseAccountsListResult, err error) -} - -var _ RestorableDatabaseAccountsClientAPI = (*documentdb.RestorableDatabaseAccountsClient)(nil) - -// NotebookWorkspacesClientAPI contains the set of methods on the NotebookWorkspacesClient type. -type NotebookWorkspacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters documentdb.NotebookWorkspaceCreateUpdateParameters) (result documentdb.NotebookWorkspacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspace, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceListResult, err error) - ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspaceConnectionInfoResult, err error) - RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesRegenerateAuthTokenFuture, err error) - Start(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.NotebookWorkspacesStartFuture, err error) -} - -var _ NotebookWorkspacesClientAPI = (*documentdb.NotebookWorkspacesClient)(nil) - -// RestorableSQLDatabasesClientAPI contains the set of methods on the RestorableSQLDatabasesClient type. -type RestorableSQLDatabasesClientAPI interface { - List(ctx context.Context, location string, instanceID string) (result documentdb.RestorableSQLDatabasesListResult, err error) -} - -var _ RestorableSQLDatabasesClientAPI = (*documentdb.RestorableSQLDatabasesClient)(nil) - -// RestorableSQLContainersClientAPI contains the set of methods on the RestorableSQLContainersClient type. -type RestorableSQLContainersClientAPI interface { - List(ctx context.Context, location string, instanceID string, restorableSQLDatabaseRid string) (result documentdb.RestorableSQLContainersListResult, err error) -} - -var _ RestorableSQLContainersClientAPI = (*documentdb.RestorableSQLContainersClient)(nil) - -// RestorableSQLResourcesClientAPI contains the set of methods on the RestorableSQLResourcesClient type. -type RestorableSQLResourcesClientAPI interface { - List(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (result documentdb.RestorableSQLResourcesListResult, err error) -} - -var _ RestorableSQLResourcesClientAPI = (*documentdb.RestorableSQLResourcesClient)(nil) - -// RestorableMongodbDatabasesClientAPI contains the set of methods on the RestorableMongodbDatabasesClient type. -type RestorableMongodbDatabasesClientAPI interface { - List(ctx context.Context, location string, instanceID string) (result documentdb.RestorableMongodbDatabasesListResult, err error) -} - -var _ RestorableMongodbDatabasesClientAPI = (*documentdb.RestorableMongodbDatabasesClient)(nil) - -// RestorableMongodbCollectionsClientAPI contains the set of methods on the RestorableMongodbCollectionsClient type. -type RestorableMongodbCollectionsClientAPI interface { - List(ctx context.Context, location string, instanceID string, restorableMongodbDatabaseRid string) (result documentdb.RestorableMongodbCollectionsListResult, err error) -} - -var _ RestorableMongodbCollectionsClientAPI = (*documentdb.RestorableMongodbCollectionsClient)(nil) - -// RestorableMongodbResourcesClientAPI contains the set of methods on the RestorableMongodbResourcesClient type. -type RestorableMongodbResourcesClientAPI interface { - List(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (result documentdb.RestorableMongodbResourcesListResult, err error) -} - -var _ RestorableMongodbResourcesClientAPI = (*documentdb.RestorableMongodbResourcesClient)(nil) - -// CassandraClustersClientAPI contains the set of methods on the CassandraClustersClient type. -type CassandraClustersClientAPI interface { - CreateUpdate(ctx context.Context, resourceGroupName string, clusterName string, body documentdb.ClusterResource) (result documentdb.CassandraClustersCreateUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, clusterName string) (result documentdb.CassandraClustersDeleteFuture, err error) - FetchNodeStatus(ctx context.Context, resourceGroupName string, clusterName string) (result documentdb.CassandraClustersFetchNodeStatusFuture, err error) - Get(ctx context.Context, resourceGroupName string, clusterName string) (result documentdb.ClusterResource, err error) - GetBackup(ctx context.Context, resourceGroupName string, clusterName string, backupID string) (result documentdb.BackupResource, err error) - ListBackupsMethod(ctx context.Context, resourceGroupName string, clusterName string) (result documentdb.ListBackups, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result documentdb.ListClusters, err error) - ListBySubscription(ctx context.Context) (result documentdb.ListClusters, err error) - RequestRepair(ctx context.Context, resourceGroupName string, clusterName string, body documentdb.RepairPostBody) (result documentdb.CassandraClustersRequestRepairFuture, err error) - Update(ctx context.Context, resourceGroupName string, clusterName string, body documentdb.ClusterResource) (result documentdb.CassandraClustersUpdateFuture, err error) -} - -var _ CassandraClustersClientAPI = (*documentdb.CassandraClustersClient)(nil) - -// CassandraDataCentersClientAPI contains the set of methods on the CassandraDataCentersClient type. -type CassandraDataCentersClientAPI interface { - CreateUpdate(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body documentdb.DataCenterResource) (result documentdb.CassandraDataCentersCreateUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string) (result documentdb.CassandraDataCentersDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string) (result documentdb.DataCenterResource, err error) - List(ctx context.Context, resourceGroupName string, clusterName string) (result documentdb.ListDataCenters, err error) - Update(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body documentdb.DataCenterResource) (result documentdb.CassandraDataCentersUpdateFuture, err error) -} - -var _ CassandraDataCentersClientAPI = (*documentdb.CassandraDataCentersClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result documentdb.PrivateLinkResource, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateLinkResourceListResult, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*documentdb.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters documentdb.PrivateEndpointConnection) (result documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result documentdb.PrivateEndpointConnection, err error) - ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.PrivateEndpointConnectionListResult, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*documentdb.PrivateEndpointConnectionsClient)(nil) diff --git a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/enums.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/enums.go deleted file mode 100644 index 864d56abc08c..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/enums.go +++ /dev/null @@ -1,608 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// APIType enumerates the values for api type. -type APIType string - -const ( - // APITypeCassandra ... - APITypeCassandra APIType = "Cassandra" - // APITypeGremlin ... - APITypeGremlin APIType = "Gremlin" - // APITypeGremlinV2 ... - APITypeGremlinV2 APIType = "GremlinV2" - // APITypeMongoDB ... - APITypeMongoDB APIType = "MongoDB" - // APITypeSQL ... - APITypeSQL APIType = "Sql" - // APITypeTable ... - APITypeTable APIType = "Table" -) - -// PossibleAPITypeValues returns an array of possible values for the APIType const type. -func PossibleAPITypeValues() []APIType { - return []APIType{APITypeCassandra, APITypeGremlin, APITypeGremlinV2, APITypeMongoDB, APITypeSQL, APITypeTable} -} - -// AuthenticationMethod enumerates the values for authentication method. -type AuthenticationMethod string - -const ( - // AuthenticationMethodCassandra ... - AuthenticationMethodCassandra AuthenticationMethod = "Cassandra" - // AuthenticationMethodNone ... - AuthenticationMethodNone AuthenticationMethod = "None" -) - -// PossibleAuthenticationMethodValues returns an array of possible values for the AuthenticationMethod const type. -func PossibleAuthenticationMethodValues() []AuthenticationMethod { - return []AuthenticationMethod{AuthenticationMethodCassandra, AuthenticationMethodNone} -} - -// BackupPolicyType enumerates the values for backup policy type. -type BackupPolicyType string - -const ( - // BackupPolicyTypeContinuous ... - BackupPolicyTypeContinuous BackupPolicyType = "Continuous" - // BackupPolicyTypePeriodic ... - BackupPolicyTypePeriodic BackupPolicyType = "Periodic" -) - -// PossibleBackupPolicyTypeValues returns an array of possible values for the BackupPolicyType const type. -func PossibleBackupPolicyTypeValues() []BackupPolicyType { - return []BackupPolicyType{BackupPolicyTypeContinuous, BackupPolicyTypePeriodic} -} - -// BackupStorageRedundancy enumerates the values for backup storage redundancy. -type BackupStorageRedundancy string - -const ( - // BackupStorageRedundancyGeo ... - BackupStorageRedundancyGeo BackupStorageRedundancy = "Geo" - // BackupStorageRedundancyLocal ... - BackupStorageRedundancyLocal BackupStorageRedundancy = "Local" - // BackupStorageRedundancyZone ... - BackupStorageRedundancyZone BackupStorageRedundancy = "Zone" -) - -// PossibleBackupStorageRedundancyValues returns an array of possible values for the BackupStorageRedundancy const type. -func PossibleBackupStorageRedundancyValues() []BackupStorageRedundancy { - return []BackupStorageRedundancy{BackupStorageRedundancyGeo, BackupStorageRedundancyLocal, BackupStorageRedundancyZone} -} - -// CompositePathSortOrder enumerates the values for composite path sort order. -type CompositePathSortOrder string - -const ( - // CompositePathSortOrderAscending ... - CompositePathSortOrderAscending CompositePathSortOrder = "ascending" - // CompositePathSortOrderDescending ... - CompositePathSortOrderDescending CompositePathSortOrder = "descending" -) - -// PossibleCompositePathSortOrderValues returns an array of possible values for the CompositePathSortOrder const type. -func PossibleCompositePathSortOrderValues() []CompositePathSortOrder { - return []CompositePathSortOrder{CompositePathSortOrderAscending, CompositePathSortOrderDescending} -} - -// ConflictResolutionMode enumerates the values for conflict resolution mode. -type ConflictResolutionMode string - -const ( - // ConflictResolutionModeCustom ... - ConflictResolutionModeCustom ConflictResolutionMode = "Custom" - // ConflictResolutionModeLastWriterWins ... - ConflictResolutionModeLastWriterWins ConflictResolutionMode = "LastWriterWins" -) - -// PossibleConflictResolutionModeValues returns an array of possible values for the ConflictResolutionMode const type. -func PossibleConflictResolutionModeValues() []ConflictResolutionMode { - return []ConflictResolutionMode{ConflictResolutionModeCustom, ConflictResolutionModeLastWriterWins} -} - -// ConnectorOffer enumerates the values for connector offer. -type ConnectorOffer string - -const ( - // ConnectorOfferSmall ... - ConnectorOfferSmall ConnectorOffer = "Small" -) - -// PossibleConnectorOfferValues returns an array of possible values for the ConnectorOffer const type. -func PossibleConnectorOfferValues() []ConnectorOffer { - return []ConnectorOffer{ConnectorOfferSmall} -} - -// 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} -} - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // CreateModeDefault ... - CreateModeDefault CreateMode = "Default" - // CreateModeRestore ... - CreateModeRestore CreateMode = "Restore" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{CreateModeDefault, CreateModeRestore} -} - -// CreateModeBasicDatabaseAccountCreateUpdateProperties enumerates the values for create mode basic database -// account create update properties. -type CreateModeBasicDatabaseAccountCreateUpdateProperties string - -const ( - // CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDatabaseAccountCreateUpdateProperties ... - CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDatabaseAccountCreateUpdateProperties CreateModeBasicDatabaseAccountCreateUpdateProperties = "DatabaseAccountCreateUpdateProperties" - // CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDefault ... - CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDefault CreateModeBasicDatabaseAccountCreateUpdateProperties = "Default" - // CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeRestore ... - CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeRestore CreateModeBasicDatabaseAccountCreateUpdateProperties = "Restore" -) - -// PossibleCreateModeBasicDatabaseAccountCreateUpdatePropertiesValues returns an array of possible values for the CreateModeBasicDatabaseAccountCreateUpdateProperties const type. -func PossibleCreateModeBasicDatabaseAccountCreateUpdatePropertiesValues() []CreateModeBasicDatabaseAccountCreateUpdateProperties { - return []CreateModeBasicDatabaseAccountCreateUpdateProperties{CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDatabaseAccountCreateUpdateProperties, CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDefault, CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeRestore} -} - -// DatabaseAccountKind enumerates the values for database account kind. -type DatabaseAccountKind string - -const ( - // DatabaseAccountKindGlobalDocumentDB ... - DatabaseAccountKindGlobalDocumentDB DatabaseAccountKind = "GlobalDocumentDB" - // DatabaseAccountKindMongoDB ... - DatabaseAccountKindMongoDB DatabaseAccountKind = "MongoDB" - // DatabaseAccountKindParse ... - DatabaseAccountKindParse DatabaseAccountKind = "Parse" -) - -// PossibleDatabaseAccountKindValues returns an array of possible values for the DatabaseAccountKind const type. -func PossibleDatabaseAccountKindValues() []DatabaseAccountKind { - return []DatabaseAccountKind{DatabaseAccountKindGlobalDocumentDB, DatabaseAccountKindMongoDB, DatabaseAccountKindParse} -} - -// DatabaseAccountOfferType enumerates the values for database account offer type. -type DatabaseAccountOfferType string - -const ( - // DatabaseAccountOfferTypeStandard ... - DatabaseAccountOfferTypeStandard DatabaseAccountOfferType = "Standard" -) - -// PossibleDatabaseAccountOfferTypeValues returns an array of possible values for the DatabaseAccountOfferType const type. -func PossibleDatabaseAccountOfferTypeValues() []DatabaseAccountOfferType { - return []DatabaseAccountOfferType{DatabaseAccountOfferTypeStandard} -} - -// DataType enumerates the values for data type. -type DataType string - -const ( - // DataTypeLineString ... - DataTypeLineString DataType = "LineString" - // DataTypeMultiPolygon ... - DataTypeMultiPolygon DataType = "MultiPolygon" - // DataTypeNumber ... - DataTypeNumber DataType = "Number" - // DataTypePoint ... - DataTypePoint DataType = "Point" - // DataTypePolygon ... - DataTypePolygon DataType = "Polygon" - // DataTypeString ... - DataTypeString DataType = "String" -) - -// PossibleDataTypeValues returns an array of possible values for the DataType const type. -func PossibleDataTypeValues() []DataType { - return []DataType{DataTypeLineString, DataTypeMultiPolygon, DataTypeNumber, DataTypePoint, DataTypePolygon, DataTypeString} -} - -// DefaultConsistencyLevel enumerates the values for default consistency level. -type DefaultConsistencyLevel string - -const ( - // DefaultConsistencyLevelBoundedStaleness ... - DefaultConsistencyLevelBoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" - // DefaultConsistencyLevelConsistentPrefix ... - DefaultConsistencyLevelConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" - // DefaultConsistencyLevelEventual ... - DefaultConsistencyLevelEventual DefaultConsistencyLevel = "Eventual" - // DefaultConsistencyLevelSession ... - DefaultConsistencyLevelSession DefaultConsistencyLevel = "Session" - // DefaultConsistencyLevelStrong ... - DefaultConsistencyLevelStrong DefaultConsistencyLevel = "Strong" -) - -// PossibleDefaultConsistencyLevelValues returns an array of possible values for the DefaultConsistencyLevel const type. -func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { - return []DefaultConsistencyLevel{DefaultConsistencyLevelBoundedStaleness, DefaultConsistencyLevelConsistentPrefix, DefaultConsistencyLevelEventual, DefaultConsistencyLevelSession, DefaultConsistencyLevelStrong} -} - -// IndexingMode enumerates the values for indexing mode. -type IndexingMode string - -const ( - // IndexingModeConsistent ... - IndexingModeConsistent IndexingMode = "consistent" - // IndexingModeLazy ... - IndexingModeLazy IndexingMode = "lazy" - // IndexingModeNone ... - IndexingModeNone IndexingMode = "none" -) - -// PossibleIndexingModeValues returns an array of possible values for the IndexingMode const type. -func PossibleIndexingModeValues() []IndexingMode { - return []IndexingMode{IndexingModeConsistent, IndexingModeLazy, IndexingModeNone} -} - -// IndexKind enumerates the values for index kind. -type IndexKind string - -const ( - // IndexKindHash ... - IndexKindHash IndexKind = "Hash" - // IndexKindRange ... - IndexKindRange IndexKind = "Range" - // IndexKindSpatial ... - IndexKindSpatial IndexKind = "Spatial" -) - -// PossibleIndexKindValues returns an array of possible values for the IndexKind const type. -func PossibleIndexKindValues() []IndexKind { - return []IndexKind{IndexKindHash, IndexKindRange, IndexKindSpatial} -} - -// KeyKind enumerates the values for key kind. -type KeyKind string - -const ( - // KeyKindPrimary ... - KeyKindPrimary KeyKind = "primary" - // KeyKindPrimaryReadonly ... - KeyKindPrimaryReadonly KeyKind = "primaryReadonly" - // KeyKindSecondary ... - KeyKindSecondary KeyKind = "secondary" - // KeyKindSecondaryReadonly ... - KeyKindSecondaryReadonly KeyKind = "secondaryReadonly" -) - -// PossibleKeyKindValues returns an array of possible values for the KeyKind const type. -func PossibleKeyKindValues() []KeyKind { - return []KeyKind{KeyKindPrimary, KeyKindPrimaryReadonly, KeyKindSecondary, KeyKindSecondaryReadonly} -} - -// ManagedCassandraProvisioningState enumerates the values for managed cassandra provisioning state. -type ManagedCassandraProvisioningState string - -const ( - // ManagedCassandraProvisioningStateCanceled ... - ManagedCassandraProvisioningStateCanceled ManagedCassandraProvisioningState = "Canceled" - // ManagedCassandraProvisioningStateCreating ... - ManagedCassandraProvisioningStateCreating ManagedCassandraProvisioningState = "Creating" - // ManagedCassandraProvisioningStateDeleting ... - ManagedCassandraProvisioningStateDeleting ManagedCassandraProvisioningState = "Deleting" - // ManagedCassandraProvisioningStateFailed ... - ManagedCassandraProvisioningStateFailed ManagedCassandraProvisioningState = "Failed" - // ManagedCassandraProvisioningStateSucceeded ... - ManagedCassandraProvisioningStateSucceeded ManagedCassandraProvisioningState = "Succeeded" - // ManagedCassandraProvisioningStateUpdating ... - ManagedCassandraProvisioningStateUpdating ManagedCassandraProvisioningState = "Updating" -) - -// PossibleManagedCassandraProvisioningStateValues returns an array of possible values for the ManagedCassandraProvisioningState const type. -func PossibleManagedCassandraProvisioningStateValues() []ManagedCassandraProvisioningState { - return []ManagedCassandraProvisioningState{ManagedCassandraProvisioningStateCanceled, ManagedCassandraProvisioningStateCreating, ManagedCassandraProvisioningStateDeleting, ManagedCassandraProvisioningStateFailed, ManagedCassandraProvisioningStateSucceeded, ManagedCassandraProvisioningStateUpdating} -} - -// NetworkACLBypass enumerates the values for network acl bypass. -type NetworkACLBypass string - -const ( - // NetworkACLBypassAzureServices ... - NetworkACLBypassAzureServices NetworkACLBypass = "AzureServices" - // NetworkACLBypassNone ... - NetworkACLBypassNone NetworkACLBypass = "None" -) - -// PossibleNetworkACLBypassValues returns an array of possible values for the NetworkACLBypass const type. -func PossibleNetworkACLBypassValues() []NetworkACLBypass { - return []NetworkACLBypass{NetworkACLBypassAzureServices, NetworkACLBypassNone} -} - -// NodeState enumerates the values for node state. -type NodeState string - -const ( - // NodeStateJoining ... - NodeStateJoining NodeState = "Joining" - // NodeStateLeaving ... - NodeStateLeaving NodeState = "Leaving" - // NodeStateMoving ... - NodeStateMoving NodeState = "Moving" - // NodeStateNormal ... - NodeStateNormal NodeState = "Normal" - // NodeStateStopped ... - NodeStateStopped NodeState = "Stopped" -) - -// PossibleNodeStateValues returns an array of possible values for the NodeState const type. -func PossibleNodeStateValues() []NodeState { - return []NodeState{NodeStateJoining, NodeStateLeaving, NodeStateMoving, NodeStateNormal, NodeStateStopped} -} - -// NodeStatus enumerates the values for node status. -type NodeStatus string - -const ( - // NodeStatusDown ... - NodeStatusDown NodeStatus = "Down" - // NodeStatusUp ... - NodeStatusUp NodeStatus = "Up" -) - -// PossibleNodeStatusValues returns an array of possible values for the NodeStatus const type. -func PossibleNodeStatusValues() []NodeStatus { - return []NodeStatus{NodeStatusDown, NodeStatusUp} -} - -// OperationType enumerates the values for operation type. -type OperationType string - -const ( - // OperationTypeCreate ... - OperationTypeCreate OperationType = "Create" - // OperationTypeDelete ... - OperationTypeDelete OperationType = "Delete" - // OperationTypeReplace ... - OperationTypeReplace OperationType = "Replace" - // OperationTypeSystemOperation ... - OperationTypeSystemOperation OperationType = "SystemOperation" -) - -// PossibleOperationTypeValues returns an array of possible values for the OperationType const type. -func PossibleOperationTypeValues() []OperationType { - return []OperationType{OperationTypeCreate, OperationTypeDelete, OperationTypeReplace, OperationTypeSystemOperation} -} - -// PartitionKind enumerates the values for partition kind. -type PartitionKind string - -const ( - // PartitionKindHash ... - PartitionKindHash PartitionKind = "Hash" - // PartitionKindMultiHash ... - PartitionKindMultiHash PartitionKind = "MultiHash" - // PartitionKindRange ... - PartitionKindRange PartitionKind = "Range" -) - -// PossiblePartitionKindValues returns an array of possible values for the PartitionKind const type. -func PossiblePartitionKindValues() []PartitionKind { - return []PartitionKind{PartitionKindHash, PartitionKindMultiHash, PartitionKindRange} -} - -// PrimaryAggregationType enumerates the values for primary aggregation type. -type PrimaryAggregationType string - -const ( - // PrimaryAggregationTypeAverage ... - PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" - // PrimaryAggregationTypeLast ... - PrimaryAggregationTypeLast PrimaryAggregationType = "Last" - // PrimaryAggregationTypeMaximum ... - PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" - // PrimaryAggregationTypeMinimum ... - PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" - // PrimaryAggregationTypeNone ... - PrimaryAggregationTypeNone PrimaryAggregationType = "None" - // PrimaryAggregationTypeTotal ... - PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" -) - -// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeLast, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned,UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// RestoreMode enumerates the values for restore mode. -type RestoreMode string - -const ( - // RestoreModePointInTime ... - RestoreModePointInTime RestoreMode = "PointInTime" -) - -// PossibleRestoreModeValues returns an array of possible values for the RestoreMode const type. -func PossibleRestoreModeValues() []RestoreMode { - return []RestoreMode{RestoreModePointInTime} -} - -// RoleDefinitionType enumerates the values for role definition type. -type RoleDefinitionType string - -const ( - // RoleDefinitionTypeBuiltInRole ... - RoleDefinitionTypeBuiltInRole RoleDefinitionType = "BuiltInRole" - // RoleDefinitionTypeCustomRole ... - RoleDefinitionTypeCustomRole RoleDefinitionType = "CustomRole" -) - -// PossibleRoleDefinitionTypeValues returns an array of possible values for the RoleDefinitionType const type. -func PossibleRoleDefinitionTypeValues() []RoleDefinitionType { - return []RoleDefinitionType{RoleDefinitionTypeBuiltInRole, RoleDefinitionTypeCustomRole} -} - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // ServerVersionFourFullStopZero ... - ServerVersionFourFullStopZero ServerVersion = "4.0" - // ServerVersionThreeFullStopSix ... - ServerVersionThreeFullStopSix ServerVersion = "3.6" - // ServerVersionThreeFullStopTwo ... - ServerVersionThreeFullStopTwo ServerVersion = "3.2" -) - -// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. -func PossibleServerVersionValues() []ServerVersion { - return []ServerVersion{ServerVersionFourFullStopZero, ServerVersionThreeFullStopSix, ServerVersionThreeFullStopTwo} -} - -// SpatialType enumerates the values for spatial type. -type SpatialType string - -const ( - // SpatialTypeLineString ... - SpatialTypeLineString SpatialType = "LineString" - // SpatialTypeMultiPolygon ... - SpatialTypeMultiPolygon SpatialType = "MultiPolygon" - // SpatialTypePoint ... - SpatialTypePoint SpatialType = "Point" - // SpatialTypePolygon ... - SpatialTypePolygon SpatialType = "Polygon" -) - -// PossibleSpatialTypeValues returns an array of possible values for the SpatialType const type. -func PossibleSpatialTypeValues() []SpatialType { - return []SpatialType{SpatialTypeLineString, SpatialTypeMultiPolygon, SpatialTypePoint, SpatialTypePolygon} -} - -// TriggerOperation enumerates the values for trigger operation. -type TriggerOperation string - -const ( - // TriggerOperationAll ... - TriggerOperationAll TriggerOperation = "All" - // TriggerOperationCreate ... - TriggerOperationCreate TriggerOperation = "Create" - // TriggerOperationDelete ... - TriggerOperationDelete TriggerOperation = "Delete" - // TriggerOperationReplace ... - TriggerOperationReplace TriggerOperation = "Replace" - // TriggerOperationUpdate ... - TriggerOperationUpdate TriggerOperation = "Update" -) - -// PossibleTriggerOperationValues returns an array of possible values for the TriggerOperation const type. -func PossibleTriggerOperationValues() []TriggerOperation { - return []TriggerOperation{TriggerOperationAll, TriggerOperationCreate, TriggerOperationDelete, TriggerOperationReplace, TriggerOperationUpdate} -} - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // TriggerTypePost ... - TriggerTypePost TriggerType = "Post" - // TriggerTypePre ... - TriggerTypePre TriggerType = "Pre" -) - -// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. -func PossibleTriggerTypeValues() []TriggerType { - return []TriggerType{TriggerTypePost, TriggerTypePre} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeBackupPolicy ... - TypeBackupPolicy Type = "BackupPolicy" - // TypeContinuous ... - TypeContinuous Type = "Continuous" - // TypePeriodic ... - TypePeriodic Type = "Periodic" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeBackupPolicy, TypeContinuous, TypePeriodic} -} - -// UnitType enumerates the values for unit type. -type UnitType string - -const ( - // UnitTypeBytes ... - UnitTypeBytes UnitType = "Bytes" - // UnitTypeBytesPerSecond ... - UnitTypeBytesPerSecond UnitType = "BytesPerSecond" - // UnitTypeCount ... - UnitTypeCount UnitType = "Count" - // UnitTypeCountPerSecond ... - UnitTypeCountPerSecond UnitType = "CountPerSecond" - // UnitTypeMilliseconds ... - UnitTypeMilliseconds UnitType = "Milliseconds" - // UnitTypePercent ... - UnitTypePercent UnitType = "Percent" - // UnitTypeSeconds ... - UnitTypeSeconds UnitType = "Seconds" -) - -// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{UnitTypeBytes, UnitTypeBytesPerSecond, UnitTypeCount, UnitTypeCountPerSecond, UnitTypeMilliseconds, UnitTypePercent, UnitTypeSeconds} -} diff --git a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/gremlinresources.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/gremlinresources.go deleted file mode 100644 index 89b733aafcd9..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/gremlinresources.go +++ /dev/null @@ -1,1577 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GremlinResourcesClient is the client for the GremlinResources methods of the Documentdb service. -type GremlinResourcesClient struct { - BaseClient -} - -// NewGremlinResourcesClient creates an instance of the GremlinResourcesClient client. -func NewGremlinResourcesClient(subscriptionID string) GremlinResourcesClient { - return NewGremlinResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGremlinResourcesClientWithBaseURI creates an instance of the GremlinResourcesClient 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 NewGremlinResourcesClientWithBaseURI(baseURI string, subscriptionID string) GremlinResourcesClient { - return GremlinResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateGremlinDatabase create or update an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateGremlinDatabaseParameters - the parameters to provide for the current Gremlin database. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinDatabase") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", err.Error()) - } - - req, err := client.CreateUpdateGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinDatabasePreparer prepares the CreateUpdateGremlinDatabase request. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateGremlinDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinDatabaseSender sends the CreateUpdateGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinDatabaseFuture, 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 -} - -// CreateUpdateGremlinDatabaseResponder handles the response to the CreateUpdateGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateGremlinGraph create or update an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// createUpdateGremlinGraphParameters - the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinGraph") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateGremlinGraphParameters, - Constraints: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", err.Error()) - } - - req, err := client.CreateUpdateGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateGremlinGraphPreparer prepares the CreateUpdateGremlinGraph request. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithJSON(createUpdateGremlinGraphParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateGremlinGraphSender sends the CreateUpdateGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinGraphFuture, 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 -} - -// CreateUpdateGremlinGraphResponder handles the response to the CreateUpdateGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) CreateUpdateGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteGremlinDatabase deletes an existing Azure Cosmos DB Gremlin database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesDeleteGremlinDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinDatabase") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", err.Error()) - } - - req, err := client.DeleteGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinDatabasePreparer prepares the DeleteGremlinDatabase request. -func (client GremlinResourcesClient) DeleteGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinDatabaseSender sends the DeleteGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinDatabaseSender(req *http.Request) (future GremlinResourcesDeleteGremlinDatabaseFuture, 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 -} - -// DeleteGremlinDatabaseResponder handles the response to the DeleteGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinDatabaseResponder(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 -} - -// DeleteGremlinGraph deletes an existing Azure Cosmos DB Gremlin graph. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesDeleteGremlinGraphFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinGraph") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinGraph", err.Error()) - } - - req, err := client.DeleteGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", nil, "Failure preparing request") - return - } - - result, err = client.DeleteGremlinGraphSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteGremlinGraphPreparer prepares the DeleteGremlinGraph request. -func (client GremlinResourcesClient) DeleteGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteGremlinGraphSender sends the DeleteGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) DeleteGremlinGraphSender(req *http.Request) (future GremlinResourcesDeleteGremlinGraphFuture, 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 -} - -// DeleteGremlinGraphResponder handles the response to the DeleteGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) DeleteGremlinGraphResponder(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 -} - -// GetGremlinDatabase gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabase", err.Error()) - } - - req, err := client.GetGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabasePreparer prepares the GetGremlinDatabase request. -func (client GremlinResourcesClient) GetGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseSender sends the GetGremlinDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseResponder handles the response to the GetGremlinDatabase request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinDatabaseThroughput gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabaseThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.GetGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinDatabaseThroughputPreparer prepares the GetGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinDatabaseThroughputSender sends the GetGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinDatabaseThroughputResponder handles the response to the GetGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraph gets the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinGraphGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraph") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraph", err.Error()) - } - - req, err := client.GetGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphPreparer prepares the GetGremlinGraph request. -func (client GremlinResourcesClient) GetGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphSender sends the GetGremlinGraph request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphResponder handles the response to the GetGremlinGraph request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGremlinGraphThroughput gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with -// the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraphThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", err.Error()) - } - - req, err := client.GetGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetGremlinGraphThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetGremlinGraphThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetGremlinGraphThroughputPreparer prepares the GetGremlinGraphThroughput request. -func (client GremlinResourcesClient) GetGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGremlinGraphThroughputSender sends the GetGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) GetGremlinGraphThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetGremlinGraphThroughputResponder handles the response to the GetGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) GetGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinDatabases lists the Gremlin databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client GremlinResourcesClient) ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result GremlinDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinDatabases") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinDatabases", err.Error()) - } - - req, err := client.ListGremlinDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinDatabasesPreparer prepares the ListGremlinDatabases request. -func (client GremlinResourcesClient) ListGremlinDatabasesPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinDatabasesSender sends the ListGremlinDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinDatabasesResponder handles the response to the ListGremlinDatabases request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinDatabasesResponder(resp *http.Response) (result GremlinDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGremlinGraphs lists the Gremlin graph under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinGraphListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinGraphs") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinGraphs", err.Error()) - } - - req, err := client.ListGremlinGraphsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", nil, "Failure preparing request") - return - } - - resp, err := client.ListGremlinGraphsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure sending request") - return - } - - result, err = client.ListGremlinGraphsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure responding to request") - return - } - - return -} - -// ListGremlinGraphsPreparer prepares the ListGremlinGraphs request. -func (client GremlinResourcesClient) ListGremlinGraphsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGremlinGraphsSender sends the ListGremlinGraphs request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) ListGremlinGraphsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGremlinGraphsResponder handles the response to the ListGremlinGraphs request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) ListGremlinGraphsResponder(resp *http.Response) (result GremlinGraphListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinDatabaseToAutoscale migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToAutoscale") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateGremlinDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinDatabaseToAutoscalePreparer prepares the MigrateGremlinDatabaseToAutoscale request. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinDatabaseToAutoscaleSender sends the MigrateGremlinDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, 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 -} - -// MigrateGremlinDatabaseToAutoscaleResponder handles the response to the MigrateGremlinDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinDatabaseToManualThroughput migrate an Azure Cosmos DB Gremlin database from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToManualThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateGremlinDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinDatabaseToManualThroughputPreparer prepares the MigrateGremlinDatabaseToManualThroughput request. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinDatabaseToManualThroughputSender sends the MigrateGremlinDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, 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 -} - -// MigrateGremlinDatabaseToManualThroughputResponder handles the response to the MigrateGremlinDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinGraphToAutoscale migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToAutoscale") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", err.Error()) - } - - req, err := client.MigrateGremlinGraphToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinGraphToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinGraphToAutoscalePreparer prepares the MigrateGremlinGraphToAutoscale request. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinGraphToAutoscaleSender sends the MigrateGremlinGraphToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, 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 -} - -// MigrateGremlinGraphToAutoscaleResponder handles the response to the MigrateGremlinGraphToAutoscale request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateGremlinGraphToManualThroughput migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToManualThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", err.Error()) - } - - req, err := client.MigrateGremlinGraphToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateGremlinGraphToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateGremlinGraphToManualThroughputPreparer prepares the MigrateGremlinGraphToManualThroughput request. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateGremlinGraphToManualThroughputSender sends the MigrateGremlinGraphToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, 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 -} - -// MigrateGremlinGraphToManualThroughputResponder handles the response to the MigrateGremlinGraphToManualThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinDatabaseThroughput update RUs per second of an Azure Cosmos DB Gremlin database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin -// database. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinDatabaseThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinDatabaseThroughputPreparer prepares the UpdateGremlinDatabaseThroughput request. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinDatabaseThroughputSender sends the UpdateGremlinDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinDatabaseThroughputFuture, 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 -} - -// UpdateGremlinDatabaseThroughputResponder handles the response to the UpdateGremlinDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateGremlinGraphThroughput update RUs per second of an Azure Cosmos DB Gremlin graph -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// graphName - cosmos DB graph name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current Gremlin graph. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinGraphThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", err.Error()) - } - - req, err := client.UpdateGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateGremlinGraphThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateGremlinGraphThroughputPreparer prepares the UpdateGremlinGraphThroughput request. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "graphName": autorest.Encode("path", graphName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateGremlinGraphThroughputSender sends the UpdateGremlinGraphThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinGraphThroughputFuture, 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 -} - -// UpdateGremlinGraphThroughputResponder handles the response to the UpdateGremlinGraphThroughput request. The method always -// closes the http.Response Body. -func (client GremlinResourcesClient) UpdateGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/models.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/models.go deleted file mode 100644 index 0c31768c3711..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/models.go +++ /dev/null @@ -1,12125 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb" - -// APIProperties ... -type APIProperties struct { - // ServerVersion - Describes the ServerVersion of an a MongoDB account. Possible values include: 'ServerVersionThreeFullStopTwo', 'ServerVersionThreeFullStopSix', 'ServerVersionFourFullStopZero' - ServerVersion ServerVersion `json:"serverVersion,omitempty"` -} - -// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other -// than required location and tags -type ARMProxyResource struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ARMProxyResource. -func (apr ARMProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ARMResourceProperties the core properties of ARM resources. -type ARMResourceProperties struct { - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ARMResourceProperties. -func (arp ARMResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Location != nil { - objectMap["location"] = arp.Location - } - if arp.Tags != nil { - objectMap["tags"] = arp.Tags - } - if arp.Identity != nil { - objectMap["identity"] = arp.Identity - } - return json.Marshal(objectMap) -} - -// AutoscaleSettings ... -type AutoscaleSettings struct { - // MaxThroughput - Represents maximum throughput, the resource can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` -} - -// AutoscaleSettingsResource cosmos DB provisioned throughput settings object -type AutoscaleSettingsResource struct { - // MaxThroughput - Represents maximum throughput container can scale up to. - MaxThroughput *int32 `json:"maxThroughput,omitempty"` - // AutoUpgradePolicy - Cosmos DB resource auto-upgrade policy - AutoUpgradePolicy *AutoUpgradePolicyResource `json:"autoUpgradePolicy,omitempty"` - // TargetMaxThroughput - READ-ONLY; Represents target maximum throughput container can scale up to once offer is no longer in pending state. - TargetMaxThroughput *int32 `json:"targetMaxThroughput,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingsResource. -func (asr AutoscaleSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.MaxThroughput != nil { - objectMap["maxThroughput"] = asr.MaxThroughput - } - if asr.AutoUpgradePolicy != nil { - objectMap["autoUpgradePolicy"] = asr.AutoUpgradePolicy - } - return json.Marshal(objectMap) -} - -// AutoUpgradePolicyResource cosmos DB resource auto-upgrade policy -type AutoUpgradePolicyResource struct { - // ThroughputPolicy - Represents throughput policy which service must adhere to for auto-upgrade - ThroughputPolicy *ThroughputPolicyResource `json:"throughputPolicy,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) -} - -// BasicBackupPolicy the object representing the policy for taking backups on an account. -type BasicBackupPolicy interface { - AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) - AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) - AsBackupPolicy() (*BackupPolicy, bool) -} - -// BackupPolicy the object representing the policy for taking backups on an account. -type BackupPolicy struct { - // Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicBackupPolicy(body []byte) (BasicBackupPolicy, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypePeriodic): - var pmbp PeriodicModeBackupPolicy - err := json.Unmarshal(body, &pmbp) - return pmbp, err - case string(TypeContinuous): - var cmbp ContinuousModeBackupPolicy - err := json.Unmarshal(body, &cmbp) - return cmbp, err - default: - var bp BackupPolicy - err := json.Unmarshal(body, &bp) - return bp, err - } -} -func unmarshalBasicBackupPolicyArray(body []byte) ([]BasicBackupPolicy, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - bpArray := make([]BasicBackupPolicy, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bp, err := unmarshalBasicBackupPolicy(*rawMessage) - if err != nil { - return nil, err - } - bpArray[index] = bp - } - return bpArray, nil -} - -// MarshalJSON is the custom marshaler for BackupPolicy. -func (bp BackupPolicy) MarshalJSON() ([]byte, error) { - bp.Type = TypeBackupPolicy - objectMap := make(map[string]interface{}) - if bp.Type != "" { - objectMap["type"] = bp.Type - } - return json.Marshal(objectMap) -} - -// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) { - return nil, false -} - -// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) { - return nil, false -} - -// AsBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return &bp, true -} - -// AsBasicBackupPolicy is the BasicBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) { - return &bp, true -} - -// BackupResource a restorable backup of a Cassandra cluster. -type BackupResource struct { - autorest.Response `json:"-"` - Properties *BackupResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupResource. -func (br BackupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.Properties != nil { - objectMap["properties"] = br.Properties - } - return json.Marshal(objectMap) -} - -// BackupResourceProperties ... -type BackupResourceProperties struct { - // Timestamp - The time this backup was taken, formatted like 2021-01-21T17:35:21 - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// Capability cosmos DB capability object -type Capability struct { - // Name - Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". - Name *string `json:"name,omitempty"` -} - -// CassandraClustersCreateUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CassandraClustersCreateUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraClustersClient) (ClusterResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraClustersCreateUpdateFuture) 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 CassandraClustersCreateUpdateFuture.Result. -func (future *CassandraClustersCreateUpdateFuture) result(client CassandraClustersClient) (cr ClusterResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersCreateUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraClustersCreateUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { - cr, err = client.CreateUpdateResponder(cr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersCreateUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CassandraClustersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraClustersDeleteFuture) 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 CassandraClustersDeleteFuture.Result. -func (future *CassandraClustersDeleteFuture) result(client CassandraClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraClustersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraClustersFetchNodeStatusFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CassandraClustersFetchNodeStatusFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraClustersClient) (ClusterNodeStatus, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraClustersFetchNodeStatusFuture) 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 CassandraClustersFetchNodeStatusFuture.Result. -func (future *CassandraClustersFetchNodeStatusFuture) result(client CassandraClustersClient) (cns ClusterNodeStatus, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersFetchNodeStatusFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cns.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraClustersFetchNodeStatusFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cns.Response.Response, err = future.GetResult(sender); err == nil && cns.Response.Response.StatusCode != http.StatusNoContent { - cns, err = client.FetchNodeStatusResponder(cns.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersFetchNodeStatusFuture", "Result", cns.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraClustersRequestRepairFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CassandraClustersRequestRepairFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraClustersRequestRepairFuture) 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 CassandraClustersRequestRepairFuture.Result. -func (future *CassandraClustersRequestRepairFuture) result(client CassandraClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersRequestRepairFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraClustersRequestRepairFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CassandraClustersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraClustersClient) (ClusterResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraClustersUpdateFuture) 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 CassandraClustersUpdateFuture.Result. -func (future *CassandraClustersUpdateFuture) result(client CassandraClustersClient) (cr ClusterResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraClustersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { - cr, err = client.UpdateResponder(cr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraClustersUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraDataCentersCreateUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CassandraDataCentersCreateUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraDataCentersClient) (DataCenterResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraDataCentersCreateUpdateFuture) 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 CassandraDataCentersCreateUpdateFuture.Result. -func (future *CassandraDataCentersCreateUpdateFuture) result(client CassandraDataCentersClient) (dcr DataCenterResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersCreateUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraDataCentersCreateUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcr.Response.Response, err = future.GetResult(sender); err == nil && dcr.Response.Response.StatusCode != http.StatusNoContent { - dcr, err = client.CreateUpdateResponder(dcr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersCreateUpdateFuture", "Result", dcr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraDataCentersDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CassandraDataCentersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraDataCentersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraDataCentersDeleteFuture) 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 CassandraDataCentersDeleteFuture.Result. -func (future *CassandraDataCentersDeleteFuture) result(client CassandraDataCentersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraDataCentersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraDataCentersUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CassandraDataCentersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraDataCentersClient) (DataCenterResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraDataCentersUpdateFuture) 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 CassandraDataCentersUpdateFuture.Result. -func (future *CassandraDataCentersUpdateFuture) result(client CassandraDataCentersClient) (dcr DataCenterResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraDataCentersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcr.Response.Response, err = future.GetResult(sender); err == nil && dcr.Response.Response.StatusCode != http.StatusNoContent { - dcr, err = client.UpdateResponder(dcr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraDataCentersUpdateFuture", "Result", dcr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraKeyspaceCreateUpdateParameters parameters to create and update Cosmos DB Cassandra keyspace. -type CassandraKeyspaceCreateUpdateParameters struct { - // CassandraKeyspaceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra keyspace. - *CassandraKeyspaceCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceCreateUpdateParameters. -func (ckcup CassandraKeyspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckcup.CassandraKeyspaceCreateUpdateProperties != nil { - objectMap["properties"] = ckcup.CassandraKeyspaceCreateUpdateProperties - } - if ckcup.Location != nil { - objectMap["location"] = ckcup.Location - } - if ckcup.Tags != nil { - objectMap["tags"] = ckcup.Tags - } - if ckcup.Identity != nil { - objectMap["identity"] = ckcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceCreateUpdateParameters struct. -func (ckcup *CassandraKeyspaceCreateUpdateParameters) 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 cassandraKeyspaceCreateUpdateProperties CassandraKeyspaceCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraKeyspaceCreateUpdateProperties) - if err != nil { - return err - } - ckcup.CassandraKeyspaceCreateUpdateProperties = &cassandraKeyspaceCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ckcup.Identity = &identity - } - } - } - - return nil -} - -// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra -// keyspace. -type CassandraKeyspaceCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra keyspace - Resource *CassandraKeyspaceResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetProperties the properties of an Azure Cosmos DB Cassandra keyspace -type CassandraKeyspaceGetProperties struct { - Resource *CassandraKeyspaceGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraKeyspaceGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraKeyspaceGetPropertiesOptions ... -type CassandraKeyspaceGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// CassandraKeyspaceGetPropertiesResource ... -type CassandraKeyspaceGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetPropertiesResource. -func (ckgp CassandraKeyspaceGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgp.ID != nil { - objectMap["id"] = ckgp.ID - } - return json.Marshal(objectMap) -} - -// CassandraKeyspaceGetResults an Azure Cosmos DB Cassandra keyspace. -type CassandraKeyspaceGetResults struct { - autorest.Response `json:"-"` - // CassandraKeyspaceGetProperties - The properties of an Azure Cosmos DB Cassandra keyspace - *CassandraKeyspaceGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceGetResults. -func (ckgr CassandraKeyspaceGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ckgr.CassandraKeyspaceGetProperties != nil { - objectMap["properties"] = ckgr.CassandraKeyspaceGetProperties - } - if ckgr.Location != nil { - objectMap["location"] = ckgr.Location - } - if ckgr.Tags != nil { - objectMap["tags"] = ckgr.Tags - } - if ckgr.Identity != nil { - objectMap["identity"] = ckgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraKeyspaceGetResults struct. -func (ckgr *CassandraKeyspaceGetResults) 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 cassandraKeyspaceGetProperties CassandraKeyspaceGetProperties - err = json.Unmarshal(*v, &cassandraKeyspaceGetProperties) - if err != nil { - return err - } - ckgr.CassandraKeyspaceGetProperties = &cassandraKeyspaceGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ckgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ckgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ckgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ckgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ckgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ckgr.Identity = &identity - } - } - } - - return nil -} - -// CassandraKeyspaceListResult the List operation response, that contains the Cassandra keyspaces and their -// properties. -type CassandraKeyspaceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra keyspaces and their properties. - Value *[]CassandraKeyspaceGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraKeyspaceListResult. -func (cklr CassandraKeyspaceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraKeyspaceResource cosmos DB Cassandra keyspace resource object -type CassandraKeyspaceResource struct { - // ID - Name of the Cosmos DB Cassandra keyspace - ID *string `json:"id,omitempty"` -} - -// CassandraPartitionKey cosmos DB Cassandra table partition key -type CassandraPartitionKey struct { - // Name - Name of the Cosmos DB Cassandra table partition key - Name *string `json:"name,omitempty"` -} - -// CassandraResourcesCreateUpdateCassandraKeyspaceFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraKeyspaceGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) 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 CassandraResourcesCreateUpdateCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ckgr CassandraKeyspaceGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ckgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ckgr.Response.Response, err = future.GetResult(sender); err == nil && ckgr.Response.Response.StatusCode != http.StatusNoContent { - ckgr, err = client.CreateUpdateCassandraKeyspaceResponder(ckgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraKeyspaceFuture", "Result", ckgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesCreateUpdateCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (CassandraTableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) 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 CassandraResourcesCreateUpdateCassandraTableFuture.Result. -func (future *CassandraResourcesCreateUpdateCassandraTableFuture) result(client CassandraResourcesClient) (ctgr CassandraTableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ctgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesCreateUpdateCassandraTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ctgr.Response.Response, err = future.GetResult(sender); err == nil && ctgr.Response.Response.StatusCode != http.StatusNoContent { - ctgr, err = client.CreateUpdateCassandraTableResponder(ctgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesCreateUpdateCassandraTableFuture", "Result", ctgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type CassandraResourcesDeleteCassandraKeyspaceFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) 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 CassandraResourcesDeleteCassandraKeyspaceFuture.Result. -func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraKeyspaceFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type CassandraResourcesDeleteCassandraTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesDeleteCassandraTableFuture) 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 CassandraResourcesDeleteCassandraTableFuture.Result. -func (future *CassandraResourcesDeleteCassandraTableFuture) result(client CassandraResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesDeleteCassandraTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesDeleteCassandraTableFuture") - return - } - ar.Response = future.Response() - return -} - -// CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture) 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 CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture.Result. -func (future *CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraKeyspaceToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture) 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 CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture.Result. -func (future *CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraKeyspaceToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraTableToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesMigrateCassandraTableToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraTableToAutoscaleFuture) 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 CassandraResourcesMigrateCassandraTableToAutoscaleFuture.Result. -func (future *CassandraResourcesMigrateCassandraTableToAutoscaleFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraTableToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesMigrateCassandraTableToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type CassandraResourcesMigrateCassandraTableToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesMigrateCassandraTableToManualThroughputFuture) 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 CassandraResourcesMigrateCassandraTableToManualThroughputFuture.Result. -func (future *CassandraResourcesMigrateCassandraTableToManualThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateCassandraTableToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesMigrateCassandraTableToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type CassandraResourcesUpdateCassandraKeyspaceThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) 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 CassandraResourcesUpdateCassandraKeyspaceThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraKeyspaceThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraKeyspaceThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraKeyspaceThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraResourcesUpdateCassandraTableThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type CassandraResourcesUpdateCassandraTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CassandraResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) 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 CassandraResourcesUpdateCassandraTableThroughputFuture.Result. -func (future *CassandraResourcesUpdateCassandraTableThroughputFuture) result(client CassandraResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateCassandraTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.CassandraResourcesUpdateCassandraTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// CassandraSchema cosmos DB Cassandra table schema -type CassandraSchema struct { - // Columns - List of Cassandra table columns. - Columns *[]Column `json:"columns,omitempty"` - // PartitionKeys - List of partition key. - PartitionKeys *[]CassandraPartitionKey `json:"partitionKeys,omitempty"` - // ClusterKeys - List of cluster key. - ClusterKeys *[]ClusterKey `json:"clusterKeys,omitempty"` -} - -// CassandraTableCreateUpdateParameters parameters to create and update Cosmos DB Cassandra table. -type CassandraTableCreateUpdateParameters struct { - // CassandraTableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra table. - *CassandraTableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableCreateUpdateParameters. -func (ctcup CassandraTableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctcup.CassandraTableCreateUpdateProperties != nil { - objectMap["properties"] = ctcup.CassandraTableCreateUpdateProperties - } - if ctcup.Location != nil { - objectMap["location"] = ctcup.Location - } - if ctcup.Tags != nil { - objectMap["tags"] = ctcup.Tags - } - if ctcup.Identity != nil { - objectMap["identity"] = ctcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableCreateUpdateParameters struct. -func (ctcup *CassandraTableCreateUpdateParameters) 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 cassandraTableCreateUpdateProperties CassandraTableCreateUpdateProperties - err = json.Unmarshal(*v, &cassandraTableCreateUpdateProperties) - if err != nil { - return err - } - ctcup.CassandraTableCreateUpdateProperties = &cassandraTableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ctcup.Identity = &identity - } - } - } - - return nil -} - -// CassandraTableCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra table. -type CassandraTableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Cassandra table - Resource *CassandraTableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraTableGetProperties the properties of an Azure Cosmos DB Cassandra table -type CassandraTableGetProperties struct { - Resource *CassandraTableGetPropertiesResource `json:"resource,omitempty"` - Options *CassandraTableGetPropertiesOptions `json:"options,omitempty"` -} - -// CassandraTableGetPropertiesOptions ... -type CassandraTableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// CassandraTableGetPropertiesResource ... -type CassandraTableGetPropertiesResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetPropertiesResource. -func (ctgp CassandraTableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgp.ID != nil { - objectMap["id"] = ctgp.ID - } - if ctgp.DefaultTTL != nil { - objectMap["defaultTtl"] = ctgp.DefaultTTL - } - if ctgp.Schema != nil { - objectMap["schema"] = ctgp.Schema - } - if ctgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = ctgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// CassandraTableGetResults an Azure Cosmos DB Cassandra table. -type CassandraTableGetResults struct { - autorest.Response `json:"-"` - // CassandraTableGetProperties - The properties of an Azure Cosmos DB Cassandra table - *CassandraTableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableGetResults. -func (ctgr CassandraTableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ctgr.CassandraTableGetProperties != nil { - objectMap["properties"] = ctgr.CassandraTableGetProperties - } - if ctgr.Location != nil { - objectMap["location"] = ctgr.Location - } - if ctgr.Tags != nil { - objectMap["tags"] = ctgr.Tags - } - if ctgr.Identity != nil { - objectMap["identity"] = ctgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CassandraTableGetResults struct. -func (ctgr *CassandraTableGetResults) 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 cassandraTableGetProperties CassandraTableGetProperties - err = json.Unmarshal(*v, &cassandraTableGetProperties) - if err != nil { - return err - } - ctgr.CassandraTableGetProperties = &cassandraTableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ctgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ctgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ctgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ctgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ctgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ctgr.Identity = &identity - } - } - } - - return nil -} - -// CassandraTableListResult the List operation response, that contains the Cassandra tables and their -// properties. -type CassandraTableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cassandra tables and their properties. - Value *[]CassandraTableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CassandraTableListResult. -func (ctlr CassandraTableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CassandraTableResource cosmos DB Cassandra table resource object -type CassandraTableResource struct { - // ID - Name of the Cosmos DB Cassandra table - ID *string `json:"id,omitempty"` - // DefaultTTL - Time to live of the Cosmos DB Cassandra table - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // Schema - Schema of the Cosmos DB Cassandra table - Schema *CassandraSchema `json:"schema,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` -} - -// Certificate ... -type Certificate struct { - // Pem - PEM formatted public key. - Pem *string `json:"pem,omitempty"` -} - -// CloudError an error response from the service. -type CloudError struct { - Error *ErrorResponse `json:"error,omitempty"` -} - -// ClusterKey cosmos DB Cassandra table cluster key -type ClusterKey struct { - // Name - Name of the Cosmos DB Cassandra table cluster key - Name *string `json:"name,omitempty"` - // OrderBy - Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc" - OrderBy *string `json:"orderBy,omitempty"` -} - -// ClusterNodeStatus the status of all nodes in the cluster (as returned by 'nodetool status'). -type ClusterNodeStatus struct { - autorest.Response `json:"-"` - // Nodes - Information about nodes in the cluster (corresponds to what is returned from nodetool info). - Nodes *[]ClusterNodeStatusNodesItem `json:"nodes,omitempty"` -} - -// ClusterNodeStatusNodesItem ... -type ClusterNodeStatusNodesItem struct { - // Datacenter - The Cassandra data center this node resides in. - Datacenter *string `json:"datacenter,omitempty"` - // Status - Indicates whether the node is functioning or not. Possible values include: 'NodeStatusUp', 'NodeStatusDown' - Status NodeStatus `json:"status,omitempty"` - // State - The state of the node in relation to the cluster. Possible values include: 'NodeStateNormal', 'NodeStateLeaving', 'NodeStateJoining', 'NodeStateMoving', 'NodeStateStopped' - State NodeState `json:"state,omitempty"` - // Address - The node's URL. - Address *string `json:"address,omitempty"` - // Load - The amount of file system data in the data directory (e.g., 47.66 KB), excluding all content in the snapshots subdirectories. Because all SSTable data files are included, any data that is not cleaned up (such as TTL-expired cell or tombstoned data) is counted. - Load *string `json:"load,omitempty"` - // Tokens - List of tokens. - Tokens *[]string `json:"tokens,omitempty"` - // Owns - The percentage of the data owned by the node per datacenter times the replication factor (e.g., 33.3, or null if the data is not available). For example, a node can own 33% of the ring, but shows 100% if the replication factor is 3. For non-system keyspaces, the endpoint percentage ownership information is shown. - Owns *float64 `json:"owns,omitempty"` - // HostID - The network ID of the node. - HostID *string `json:"hostId,omitempty"` - // Rack - The rack this node is part of. - Rack *string `json:"rack,omitempty"` -} - -// ClusterResource representation of a managed Cassandra cluster. -type ClusterResource struct { - autorest.Response `json:"-"` - // Properties - Properties of a managed Cassandra cluster. - Properties *ClusterResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterResource. -func (cr ClusterResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cr.Properties != nil { - objectMap["properties"] = cr.Properties - } - if cr.Location != nil { - objectMap["location"] = cr.Location - } - if cr.Tags != nil { - objectMap["tags"] = cr.Tags - } - if cr.Identity != nil { - objectMap["identity"] = cr.Identity - } - return json.Marshal(objectMap) -} - -// ClusterResourceProperties properties of a managed Cassandra cluster. -type ClusterResourceProperties struct { - // ProvisioningState - Possible values include: 'ManagedCassandraProvisioningStateCreating', 'ManagedCassandraProvisioningStateUpdating', 'ManagedCassandraProvisioningStateDeleting', 'ManagedCassandraProvisioningStateSucceeded', 'ManagedCassandraProvisioningStateFailed', 'ManagedCassandraProvisioningStateCanceled' - ProvisioningState ManagedCassandraProvisioningState `json:"provisioningState,omitempty"` - // RestoreFromBackupID - To create an empty cluster, omit this field or set it to null. To restore a backup into a new cluster, set this field to the resource id of the backup. - RestoreFromBackupID *string `json:"restoreFromBackupId,omitempty"` - // DelegatedManagementSubnetID - Resource id of a subnet that this cluster's management service should have its network interface attached to. The subnet must be routable to all subnets that will be delegated to data centers. The resource id must be of the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/' - DelegatedManagementSubnetID *string `json:"delegatedManagementSubnetId,omitempty"` - // CassandraVersion - Which version of Cassandra should this cluster converge to running (e.g., 3.11). When updated, the cluster may take some time to migrate to the new version. - CassandraVersion *string `json:"cassandraVersion,omitempty"` - // ClusterNameOverride - If you need to set the clusterName property in cassandra.yaml to something besides the resource name of the cluster, set the value to use on this property. - ClusterNameOverride *string `json:"clusterNameOverride,omitempty"` - // AuthenticationMethod - Which authentication method Cassandra should use to authenticate clients. 'None' turns off authentication, so should not be used except in emergencies. 'Cassandra' is the default password based authentication. The default is 'Cassandra'. Possible values include: 'AuthenticationMethodNone', 'AuthenticationMethodCassandra' - AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` - // InitialCassandraAdminPassword - Initial password for clients connecting as admin to the cluster. Should be changed after cluster creation. Returns null on GET. This field only applies when the authenticationMethod field is 'Cassandra'. - InitialCassandraAdminPassword *string `json:"initialCassandraAdminPassword,omitempty"` - // HoursBetweenBackups - Number of hours to wait between taking a backup of the cluster. To disable backups, set this property to 0. - HoursBetweenBackups *int32 `json:"hoursBetweenBackups,omitempty"` - // PrometheusEndpoint - Hostname or IP address where the Prometheus endpoint containing data about the managed Cassandra nodes can be reached. - PrometheusEndpoint *SeedNode `json:"prometheusEndpoint,omitempty"` - // RepairEnabled - Should automatic repairs run on this cluster? If omitted, this is true, and should stay true unless you are running a hybrid cluster where you are already doing your own repairs. - RepairEnabled *bool `json:"repairEnabled,omitempty"` - // ClientCertificates - List of TLS certificates used to authorize clients connecting to the cluster. All connections are TLS encrypted whether clientCertificates is set or not, but if clientCertificates is set, the managed Cassandra cluster will reject all connections not bearing a TLS client certificate that can be validated from one or more of the public certificates in this property. - ClientCertificates *[]Certificate `json:"clientCertificates,omitempty"` - // ExternalGossipCertificates - List of TLS certificates used to authorize gossip from unmanaged data centers. The TLS certificates of all nodes in unmanaged data centers must be verifiable using one of the certificates provided in this property. - ExternalGossipCertificates *[]Certificate `json:"externalGossipCertificates,omitempty"` - // GossipCertificates - READ-ONLY; List of TLS certificates that unmanaged nodes must trust for gossip with managed nodes. All managed nodes will present TLS client certificates that are verifiable using one of the certificates provided in this property. - GossipCertificates *[]Certificate `json:"gossipCertificates,omitempty"` - // ExternalSeedNodes - List of IP addresses of seed nodes in unmanaged data centers. These will be added to the seed node lists of all managed nodes. - ExternalSeedNodes *[]SeedNode `json:"externalSeedNodes,omitempty"` - // SeedNodes - READ-ONLY; List of IP addresses of seed nodes in the managed data centers. These should be added to the seed node lists of all unmanaged nodes. - SeedNodes *[]SeedNode `json:"seedNodes,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterResourceProperties. -func (cr ClusterResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cr.ProvisioningState != "" { - objectMap["provisioningState"] = cr.ProvisioningState - } - if cr.RestoreFromBackupID != nil { - objectMap["restoreFromBackupId"] = cr.RestoreFromBackupID - } - if cr.DelegatedManagementSubnetID != nil { - objectMap["delegatedManagementSubnetId"] = cr.DelegatedManagementSubnetID - } - if cr.CassandraVersion != nil { - objectMap["cassandraVersion"] = cr.CassandraVersion - } - if cr.ClusterNameOverride != nil { - objectMap["clusterNameOverride"] = cr.ClusterNameOverride - } - if cr.AuthenticationMethod != "" { - objectMap["authenticationMethod"] = cr.AuthenticationMethod - } - if cr.InitialCassandraAdminPassword != nil { - objectMap["initialCassandraAdminPassword"] = cr.InitialCassandraAdminPassword - } - if cr.HoursBetweenBackups != nil { - objectMap["hoursBetweenBackups"] = cr.HoursBetweenBackups - } - if cr.PrometheusEndpoint != nil { - objectMap["prometheusEndpoint"] = cr.PrometheusEndpoint - } - if cr.RepairEnabled != nil { - objectMap["repairEnabled"] = cr.RepairEnabled - } - if cr.ClientCertificates != nil { - objectMap["clientCertificates"] = cr.ClientCertificates - } - if cr.ExternalGossipCertificates != nil { - objectMap["externalGossipCertificates"] = cr.ExternalGossipCertificates - } - if cr.ExternalSeedNodes != nil { - objectMap["externalSeedNodes"] = cr.ExternalSeedNodes - } - return json.Marshal(objectMap) -} - -// Column cosmos DB Cassandra table column -type Column struct { - // Name - Name of the Cosmos DB Cassandra table column - Name *string `json:"name,omitempty"` - // Type - Type of the Cosmos DB Cassandra table column - Type *string `json:"type,omitempty"` -} - -// CompositePath ... -type CompositePath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Order - Sort order for composite paths. Possible values include: 'CompositePathSortOrderAscending', 'CompositePathSortOrderDescending' - Order CompositePathSortOrder `json:"order,omitempty"` -} - -// ConflictResolutionPolicy the conflict resolution policy for the container. -type ConflictResolutionPolicy struct { - // Mode - Indicates the conflict resolution mode. Possible values include: 'ConflictResolutionModeLastWriterWins', 'ConflictResolutionModeCustom' - Mode ConflictResolutionMode `json:"mode,omitempty"` - // ConflictResolutionPath - The conflict resolution path in the case of LastWriterWins mode. - ConflictResolutionPath *string `json:"conflictResolutionPath,omitempty"` - // ConflictResolutionProcedure - The procedure to resolve conflicts in the case of custom mode. - ConflictResolutionProcedure *string `json:"conflictResolutionProcedure,omitempty"` -} - -// ConsistencyPolicy the consistency policy for the Cosmos DB database account. -type ConsistencyPolicy struct { - // DefaultConsistencyLevel - The default consistency level and configuration settings of the Cosmos DB account. Possible values include: 'DefaultConsistencyLevelEventual', 'DefaultConsistencyLevelSession', 'DefaultConsistencyLevelBoundedStaleness', 'DefaultConsistencyLevelStrong', 'DefaultConsistencyLevelConsistentPrefix' - DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` - // MaxStalenessPrefix - When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` - // MaxIntervalInSeconds - When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` -} - -// ContainerPartitionKey the configuration of the partition key to be used for partitioning data into -// multiple partitions -type ContainerPartitionKey struct { - // Paths - List of paths using which data within the container can be partitioned - Paths *[]string `json:"paths,omitempty"` - // Kind - Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create. Possible values include: 'PartitionKindHash', 'PartitionKindRange', 'PartitionKindMultiHash' - Kind PartitionKind `json:"kind,omitempty"` - // Version - Indicates the version of the partition key definition - Version *int32 `json:"version,omitempty"` - // SystemKey - READ-ONLY; Indicates if the container is using a system generated partition key - SystemKey *bool `json:"systemKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerPartitionKey. -func (cpk ContainerPartitionKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cpk.Paths != nil { - objectMap["paths"] = cpk.Paths - } - if cpk.Kind != "" { - objectMap["kind"] = cpk.Kind - } - if cpk.Version != nil { - objectMap["version"] = cpk.Version - } - return json.Marshal(objectMap) -} - -// ContinuousModeBackupPolicy the object representing continuous mode backup policy. -type ContinuousModeBackupPolicy struct { - // Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) MarshalJSON() ([]byte, error) { - cmbp.Type = TypeContinuous - objectMap := make(map[string]interface{}) - if cmbp.Type != "" { - objectMap["type"] = cmbp.Type - } - return json.Marshal(objectMap) -} - -// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) { - return nil, false -} - -// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) { - return &cmbp, true -} - -// AsBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return nil, false -} - -// AsBasicBackupPolicy is the BasicBackupPolicy implementation for ContinuousModeBackupPolicy. -func (cmbp ContinuousModeBackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) { - return &cmbp, true -} - -// CorsPolicy the CORS policy for the Cosmos DB database account. -type CorsPolicy struct { - // AllowedOrigins - The origin domains that are permitted to make a request against the service via CORS. - AllowedOrigins *string `json:"allowedOrigins,omitempty"` - // AllowedMethods - The methods (HTTP request verbs) that the origin domain may use for a CORS request. - AllowedMethods *string `json:"allowedMethods,omitempty"` - // AllowedHeaders - The request headers that the origin domain may specify on the CORS request. - AllowedHeaders *string `json:"allowedHeaders,omitempty"` - // ExposedHeaders - The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - ExposedHeaders *string `json:"exposedHeaders,omitempty"` - // MaxAgeInSeconds - The maximum amount time that a browser should cache the preflight OPTIONS request. - MaxAgeInSeconds *int64 `json:"maxAgeInSeconds,omitempty"` -} - -// CreateUpdateOptions createUpdateOptions are a list of key-value pairs that describe the resource. -// Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" -type CreateUpdateOptions struct { - // Throughput - Request Units per second. For example, "throughput": 10000. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// DatabaseAccountConnectionString connection string for the Cosmos DB account -type DatabaseAccountConnectionString struct { - // ConnectionString - READ-ONLY; Value of the connection string - ConnectionString *string `json:"connectionString,omitempty"` - // Description - READ-ONLY; Description of the connection string - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountConnectionString. -func (dacs DatabaseAccountConnectionString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountCreateUpdateParameters parameters to create and update Cosmos DB database accounts. -type DatabaseAccountCreateUpdateParameters struct { - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'DatabaseAccountKindGlobalDocumentDB', 'DatabaseAccountKindMongoDB', 'DatabaseAccountKindParse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - Properties BasicDatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountCreateUpdateParameters. -func (dacup DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dacup.Kind != "" { - objectMap["kind"] = dacup.Kind - } - objectMap["properties"] = dacup.Properties - if dacup.Location != nil { - objectMap["location"] = dacup.Location - } - if dacup.Tags != nil { - objectMap["tags"] = dacup.Tags - } - if dacup.Identity != nil { - objectMap["identity"] = dacup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateParameters struct. -func (dacup *DatabaseAccountCreateUpdateParameters) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dacup.Kind = kind - } - case "properties": - if v != nil { - properties, err := unmarshalBasicDatabaseAccountCreateUpdateProperties(*v) - if err != nil { - return err - } - dacup.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dacup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dacup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dacup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dacup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dacup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dacup.Identity = &identity - } - } - } - - return nil -} - -// BasicDatabaseAccountCreateUpdateProperties properties to create and update Azure Cosmos DB database accounts. -type BasicDatabaseAccountCreateUpdateProperties interface { - AsDefaultRequestDatabaseAccountCreateUpdateProperties() (*DefaultRequestDatabaseAccountCreateUpdateProperties, bool) - AsRestoreReqeustDatabaseAccountCreateUpdateProperties() (*RestoreReqeustDatabaseAccountCreateUpdateProperties, bool) - AsDatabaseAccountCreateUpdateProperties() (*DatabaseAccountCreateUpdateProperties, bool) -} - -// DatabaseAccountCreateUpdateProperties properties to create and update Azure Cosmos DB database accounts. -type DatabaseAccountCreateUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'ConnectorOfferSmall' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` - // NetworkACLBypass - Indicates what services are allowed to bypass firewall checks. Possible values include: 'NetworkACLBypassNone', 'NetworkACLBypassAzureServices' - NetworkACLBypass NetworkACLBypass `json:"networkAclBypass,omitempty"` - // NetworkACLBypassResourceIds - An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. - NetworkACLBypassResourceIds *[]string `json:"networkAclBypassResourceIds,omitempty"` - // CreateMode - Possible values include: 'CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDatabaseAccountCreateUpdateProperties', 'CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDefault', 'CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeRestore' - CreateMode CreateModeBasicDatabaseAccountCreateUpdateProperties `json:"createMode,omitempty"` -} - -func unmarshalBasicDatabaseAccountCreateUpdateProperties(body []byte) (BasicDatabaseAccountCreateUpdateProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["createMode"] { - case string(CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDefault): - var drdacup DefaultRequestDatabaseAccountCreateUpdateProperties - err := json.Unmarshal(body, &drdacup) - return drdacup, err - case string(CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeRestore): - var rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties - err := json.Unmarshal(body, &rrdacup) - return rrdacup, err - default: - var dacup DatabaseAccountCreateUpdateProperties - err := json.Unmarshal(body, &dacup) - return dacup, err - } -} -func unmarshalBasicDatabaseAccountCreateUpdatePropertiesArray(body []byte) ([]BasicDatabaseAccountCreateUpdateProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dacupArray := make([]BasicDatabaseAccountCreateUpdateProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dacup, err := unmarshalBasicDatabaseAccountCreateUpdateProperties(*rawMessage) - if err != nil { - return nil, err - } - dacupArray[index] = dacup - } - return dacupArray, nil -} - -// MarshalJSON is the custom marshaler for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { - dacup.CreateMode = CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDatabaseAccountCreateUpdateProperties - objectMap := make(map[string]interface{}) - if dacup.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = dacup.ConsistencyPolicy - } - if dacup.Locations != nil { - objectMap["locations"] = dacup.Locations - } - if dacup.DatabaseAccountOfferType != nil { - objectMap["databaseAccountOfferType"] = dacup.DatabaseAccountOfferType - } - if dacup.IPRules != nil { - objectMap["ipRules"] = dacup.IPRules - } - if dacup.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = dacup.IsVirtualNetworkFilterEnabled - } - if dacup.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = dacup.EnableAutomaticFailover - } - if dacup.Capabilities != nil { - objectMap["capabilities"] = dacup.Capabilities - } - if dacup.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = dacup.VirtualNetworkRules - } - if dacup.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = dacup.EnableMultipleWriteLocations - } - if dacup.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = dacup.EnableCassandraConnector - } - if dacup.ConnectorOffer != "" { - objectMap["connectorOffer"] = dacup.ConnectorOffer - } - if dacup.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = dacup.DisableKeyBasedMetadataWriteAccess - } - if dacup.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = dacup.KeyVaultKeyURI - } - if dacup.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = dacup.PublicNetworkAccess - } - if dacup.EnableFreeTier != nil { - objectMap["enableFreeTier"] = dacup.EnableFreeTier - } - if dacup.APIProperties != nil { - objectMap["apiProperties"] = dacup.APIProperties - } - if dacup.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = dacup.EnableAnalyticalStorage - } - objectMap["backupPolicy"] = dacup.BackupPolicy - if dacup.Cors != nil { - objectMap["cors"] = dacup.Cors - } - if dacup.NetworkACLBypass != "" { - objectMap["networkAclBypass"] = dacup.NetworkACLBypass - } - if dacup.NetworkACLBypassResourceIds != nil { - objectMap["networkAclBypassResourceIds"] = dacup.NetworkACLBypassResourceIds - } - if dacup.CreateMode != "" { - objectMap["createMode"] = dacup.CreateMode - } - return json.Marshal(objectMap) -} - -// AsDefaultRequestDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) AsDefaultRequestDatabaseAccountCreateUpdateProperties() (*DefaultRequestDatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsRestoreReqeustDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) AsRestoreReqeustDatabaseAccountCreateUpdateProperties() (*RestoreReqeustDatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) AsDatabaseAccountCreateUpdateProperties() (*DatabaseAccountCreateUpdateProperties, bool) { - return &dacup, true -} - -// AsBasicDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DatabaseAccountCreateUpdateProperties. -func (dacup DatabaseAccountCreateUpdateProperties) AsBasicDatabaseAccountCreateUpdateProperties() (BasicDatabaseAccountCreateUpdateProperties, bool) { - return &dacup, true -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountCreateUpdateProperties struct. -func (dacup *DatabaseAccountCreateUpdateProperties) 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 "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - dacup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - dacup.Locations = &locations - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType string - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - dacup.DatabaseAccountOfferType = &databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - dacup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - dacup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - dacup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - dacup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - dacup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - dacup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - dacup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - dacup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - dacup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - dacup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - dacup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - dacup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - dacup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - dacup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - dacup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - dacup.Cors = &cors - } - case "networkAclBypass": - if v != nil { - var networkACLBypass NetworkACLBypass - err = json.Unmarshal(*v, &networkACLBypass) - if err != nil { - return err - } - dacup.NetworkACLBypass = networkACLBypass - } - case "networkAclBypassResourceIds": - if v != nil { - var networkACLBypassResourceIds []string - err = json.Unmarshal(*v, &networkACLBypassResourceIds) - if err != nil { - return err - } - dacup.NetworkACLBypassResourceIds = &networkACLBypassResourceIds - } - case "createMode": - if v != nil { - var createMode CreateModeBasicDatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &createMode) - if err != nil { - return err - } - dacup.CreateMode = createMode - } - } - } - - return nil -} - -// DatabaseAccountGetProperties properties for the database account. -type DatabaseAccountGetProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the Cosmos DB database account. - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - // DatabaseAccountOfferType - READ-ONLY; The offer type for the Cosmos DB database account. Default value: Standard. Possible values include: 'DatabaseAccountOfferTypeStandard' - DatabaseAccountOfferType DatabaseAccountOfferType `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // ConsistencyPolicy - The consistency policy for the Cosmos DB database account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // WriteLocations - READ-ONLY; An array that contains the write location for the Cosmos DB account. - WriteLocations *[]Location `json:"writeLocations,omitempty"` - // ReadLocations - READ-ONLY; An array that contains of the read locations enabled for the Cosmos DB account. - ReadLocations *[]Location `json:"readLocations,omitempty"` - // Locations - READ-ONLY; An array that contains all of the locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // FailoverPolicies - READ-ONLY; An array that contains the regions ordered by their failover priorities. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of Private Endpoint Connections configured for the Cosmos DB account. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'ConnectorOfferSmall' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // InstanceID - READ-ONLY; A unique identifier assigned to the database account - InstanceID *string `json:"instanceId,omitempty"` - // CreateMode - Enum to indicate the mode of account creation. Possible values include: 'CreateModeDefault', 'CreateModeRestore' - CreateMode CreateMode `json:"createMode,omitempty"` - // RestoreParameters - Parameters to indicate the information about the restore. - RestoreParameters *RestoreParameters `json:"restoreParameters,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` - // NetworkACLBypass - Indicates what services are allowed to bypass firewall checks. Possible values include: 'NetworkACLBypassNone', 'NetworkACLBypassAzureServices' - NetworkACLBypass NetworkACLBypass `json:"networkAclBypass,omitempty"` - // NetworkACLBypassResourceIds - An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. - NetworkACLBypassResourceIds *[]string `json:"networkAclBypassResourceIds,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetProperties. -func (dagp DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagp.ProvisioningState != nil { - objectMap["provisioningState"] = dagp.ProvisioningState - } - if dagp.IPRules != nil { - objectMap["ipRules"] = dagp.IPRules - } - if dagp.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = dagp.IsVirtualNetworkFilterEnabled - } - if dagp.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = dagp.EnableAutomaticFailover - } - if dagp.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = dagp.ConsistencyPolicy - } - if dagp.Capabilities != nil { - objectMap["capabilities"] = dagp.Capabilities - } - if dagp.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = dagp.VirtualNetworkRules - } - if dagp.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = dagp.EnableMultipleWriteLocations - } - if dagp.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = dagp.EnableCassandraConnector - } - if dagp.ConnectorOffer != "" { - objectMap["connectorOffer"] = dagp.ConnectorOffer - } - if dagp.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = dagp.DisableKeyBasedMetadataWriteAccess - } - if dagp.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = dagp.KeyVaultKeyURI - } - if dagp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = dagp.PublicNetworkAccess - } - if dagp.EnableFreeTier != nil { - objectMap["enableFreeTier"] = dagp.EnableFreeTier - } - if dagp.APIProperties != nil { - objectMap["apiProperties"] = dagp.APIProperties - } - if dagp.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = dagp.EnableAnalyticalStorage - } - if dagp.CreateMode != "" { - objectMap["createMode"] = dagp.CreateMode - } - if dagp.RestoreParameters != nil { - objectMap["restoreParameters"] = dagp.RestoreParameters - } - objectMap["backupPolicy"] = dagp.BackupPolicy - if dagp.Cors != nil { - objectMap["cors"] = dagp.Cors - } - if dagp.NetworkACLBypass != "" { - objectMap["networkAclBypass"] = dagp.NetworkACLBypass - } - if dagp.NetworkACLBypassResourceIds != nil { - objectMap["networkAclBypassResourceIds"] = dagp.NetworkACLBypassResourceIds - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetProperties struct. -func (dagp *DatabaseAccountGetProperties) 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 "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - dagp.ProvisioningState = &provisioningState - } - case "documentEndpoint": - if v != nil { - var documentEndpoint string - err = json.Unmarshal(*v, &documentEndpoint) - if err != nil { - return err - } - dagp.DocumentEndpoint = &documentEndpoint - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType DatabaseAccountOfferType - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - dagp.DatabaseAccountOfferType = databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - dagp.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - dagp.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - dagp.EnableAutomaticFailover = &enableAutomaticFailover - } - case "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - dagp.ConsistencyPolicy = &consistencyPolicy - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - dagp.Capabilities = &capabilities - } - case "writeLocations": - if v != nil { - var writeLocations []Location - err = json.Unmarshal(*v, &writeLocations) - if err != nil { - return err - } - dagp.WriteLocations = &writeLocations - } - case "readLocations": - if v != nil { - var readLocations []Location - err = json.Unmarshal(*v, &readLocations) - if err != nil { - return err - } - dagp.ReadLocations = &readLocations - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - dagp.Locations = &locations - } - case "failoverPolicies": - if v != nil { - var failoverPolicies []FailoverPolicy - err = json.Unmarshal(*v, &failoverPolicies) - if err != nil { - return err - } - dagp.FailoverPolicies = &failoverPolicies - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - dagp.VirtualNetworkRules = &virtualNetworkRules - } - case "privateEndpointConnections": - if v != nil { - var privateEndpointConnections []PrivateEndpointConnection - err = json.Unmarshal(*v, &privateEndpointConnections) - if err != nil { - return err - } - dagp.PrivateEndpointConnections = &privateEndpointConnections - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - dagp.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - dagp.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - dagp.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - dagp.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - dagp.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - dagp.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - dagp.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - dagp.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - dagp.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "instanceId": - if v != nil { - var instanceID string - err = json.Unmarshal(*v, &instanceID) - if err != nil { - return err - } - dagp.InstanceID = &instanceID - } - case "createMode": - if v != nil { - var createMode CreateMode - err = json.Unmarshal(*v, &createMode) - if err != nil { - return err - } - dagp.CreateMode = createMode - } - case "restoreParameters": - if v != nil { - var restoreParameters RestoreParameters - err = json.Unmarshal(*v, &restoreParameters) - if err != nil { - return err - } - dagp.RestoreParameters = &restoreParameters - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - dagp.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - dagp.Cors = &cors - } - case "networkAclBypass": - if v != nil { - var networkACLBypass NetworkACLBypass - err = json.Unmarshal(*v, &networkACLBypass) - if err != nil { - return err - } - dagp.NetworkACLBypass = networkACLBypass - } - case "networkAclBypassResourceIds": - if v != nil { - var networkACLBypassResourceIds []string - err = json.Unmarshal(*v, &networkACLBypassResourceIds) - if err != nil { - return err - } - dagp.NetworkACLBypassResourceIds = &networkACLBypassResourceIds - } - } - } - - return nil -} - -// DatabaseAccountGetResults an Azure Cosmos DB database account. -type DatabaseAccountGetResults struct { - autorest.Response `json:"-"` - // Kind - Indicates the type of database account. This can only be set at database account creation. Possible values include: 'DatabaseAccountKindGlobalDocumentDB', 'DatabaseAccountKindMongoDB', 'DatabaseAccountKindParse' - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountGetProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountGetResults. -func (dagr DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dagr.Kind != "" { - objectMap["kind"] = dagr.Kind - } - if dagr.DatabaseAccountGetProperties != nil { - objectMap["properties"] = dagr.DatabaseAccountGetProperties - } - if dagr.Location != nil { - objectMap["location"] = dagr.Location - } - if dagr.Tags != nil { - objectMap["tags"] = dagr.Tags - } - if dagr.Identity != nil { - objectMap["identity"] = dagr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountGetResults struct. -func (dagr *DatabaseAccountGetResults) 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 DatabaseAccountKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dagr.Kind = kind - } - case "properties": - if v != nil { - var databaseAccountGetProperties DatabaseAccountGetProperties - err = json.Unmarshal(*v, &databaseAccountGetProperties) - if err != nil { - return err - } - dagr.DatabaseAccountGetProperties = &databaseAccountGetProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - dagr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dagr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dagr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dagr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dagr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dagr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dagr.Identity = &identity - } - } - } - - return nil -} - -// DatabaseAccountListConnectionStringsResult the connection strings for the given database account. -type DatabaseAccountListConnectionStringsResult struct { - autorest.Response `json:"-"` - // ConnectionStrings - An array that contains the connection strings for the Cosmos DB account. - ConnectionStrings *[]DatabaseAccountConnectionString `json:"connectionStrings,omitempty"` -} - -// DatabaseAccountListKeysResult the access keys for the given database account. -type DatabaseAccountListKeysResult struct { - autorest.Response `json:"-"` - // PrimaryMasterKey - READ-ONLY; Base 64 encoded value of the primary read-write key. - PrimaryMasterKey *string `json:"primaryMasterKey,omitempty"` - // SecondaryMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-write key. - SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListKeysResult. -func (dalkr DatabaseAccountListKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountListReadOnlyKeysResult the read-only access keys for the given database account. -type DatabaseAccountListReadOnlyKeysResult struct { - autorest.Response `json:"-"` - // PrimaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the primary read-only key. - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - // SecondaryReadonlyMasterKey - READ-ONLY; Base 64 encoded value of the secondary read-only key. - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountListReadOnlyKeysResult. -func (dalrokr DatabaseAccountListReadOnlyKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountRegenerateKeyParameters parameters to regenerate the keys within the database account. -type DatabaseAccountRegenerateKeyParameters struct { - // KeyKind - The access key to regenerate. Possible values include: 'KeyKindPrimary', 'KeyKindSecondary', 'KeyKindPrimaryReadonly', 'KeyKindSecondaryReadonly' - KeyKind KeyKind `json:"keyKind,omitempty"` -} - -// DatabaseAccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsCreateOrUpdateFuture) 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 DatabaseAccountsCreateOrUpdateFuture.Result. -func (future *DatabaseAccountsCreateOrUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.CreateOrUpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsCreateOrUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsDeleteFuture) 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 DatabaseAccountsDeleteFuture.Result. -func (future *DatabaseAccountsDeleteFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsFailoverPriorityChangeFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type DatabaseAccountsFailoverPriorityChangeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) 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 DatabaseAccountsFailoverPriorityChangeFuture.Result. -func (future *DatabaseAccountsFailoverPriorityChangeFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsFailoverPriorityChangeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsFailoverPriorityChangeFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsListResult the List operation response, that contains the database accounts and their -// properties. -type DatabaseAccountsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of database account and their properties. - Value *[]DatabaseAccountGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountsListResult. -func (dalr DatabaseAccountsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseAccountsOfflineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOfflineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOfflineRegionFuture) 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 DatabaseAccountsOfflineRegionFuture.Result. -func (future *DatabaseAccountsOfflineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOfflineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsOnlineRegionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsOnlineRegionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsOnlineRegionFuture) 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 DatabaseAccountsOnlineRegionFuture.Result. -func (future *DatabaseAccountsOnlineRegionFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOnlineRegionFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabaseAccountsRegenerateKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsRegenerateKeyFuture) 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 DatabaseAccountsRegenerateKeyFuture.Result. -func (future *DatabaseAccountsRegenerateKeyFuture) result(client DatabaseAccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsRegenerateKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsRegenerateKeyFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseAccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabaseAccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseAccountsClient) (DatabaseAccountGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseAccountsUpdateFuture) 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 DatabaseAccountsUpdateFuture.Result. -func (future *DatabaseAccountsUpdateFuture) result(client DatabaseAccountsClient) (dagr DatabaseAccountGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dagr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dagr.Response.Response, err = future.GetResult(sender); err == nil && dagr.Response.Response.StatusCode != http.StatusNoContent { - dagr, err = client.UpdateResponder(dagr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsUpdateFuture", "Result", dagr.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseAccountUpdateParameters parameters for patching Azure Cosmos DB database account properties. -type DatabaseAccountUpdateParameters struct { - Tags map[string]*string `json:"tags"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - *DatabaseAccountUpdateProperties `json:"properties,omitempty"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseAccountUpdateParameters. -func (daup DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if daup.Tags != nil { - objectMap["tags"] = daup.Tags - } - if daup.Location != nil { - objectMap["location"] = daup.Location - } - if daup.DatabaseAccountUpdateProperties != nil { - objectMap["properties"] = daup.DatabaseAccountUpdateProperties - } - if daup.Identity != nil { - objectMap["identity"] = daup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateParameters struct. -func (daup *DatabaseAccountUpdateParameters) 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 - } - daup.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - daup.Location = &location - } - case "properties": - if v != nil { - var databaseAccountUpdateProperties DatabaseAccountUpdateProperties - err = json.Unmarshal(*v, &databaseAccountUpdateProperties) - if err != nil { - return err - } - daup.DatabaseAccountUpdateProperties = &databaseAccountUpdateProperties - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - daup.Identity = &identity - } - } - } - - return nil -} - -// DatabaseAccountUpdateProperties properties to update Azure Cosmos DB database accounts. -type DatabaseAccountUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'ConnectorOfferSmall' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` - // NetworkACLBypass - Indicates what services are allowed to bypass firewall checks. Possible values include: 'NetworkACLBypassNone', 'NetworkACLBypassAzureServices' - NetworkACLBypass NetworkACLBypass `json:"networkAclBypass,omitempty"` - // NetworkACLBypassResourceIds - An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. - NetworkACLBypassResourceIds *[]string `json:"networkAclBypassResourceIds,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateProperties struct. -func (daup *DatabaseAccountUpdateProperties) 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 "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - daup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - daup.Locations = &locations - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - daup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - daup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - daup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - daup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - daup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - daup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - daup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - daup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - daup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - daup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - daup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - daup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - daup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - daup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - daup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - daup.Cors = &cors - } - case "networkAclBypass": - if v != nil { - var networkACLBypass NetworkACLBypass - err = json.Unmarshal(*v, &networkACLBypass) - if err != nil { - return err - } - daup.NetworkACLBypass = networkACLBypass - } - case "networkAclBypassResourceIds": - if v != nil { - var networkACLBypassResourceIds []string - err = json.Unmarshal(*v, &networkACLBypassResourceIds) - if err != nil { - return err - } - daup.NetworkACLBypassResourceIds = &networkACLBypassResourceIds - } - } - } - - return nil -} - -// DatabaseRestoreResource specific Databases to restore. -type DatabaseRestoreResource struct { - // DatabaseName - The name of the database available for restore. - DatabaseName *string `json:"databaseName,omitempty"` - // CollectionNames - The names of the collections available for restore. - CollectionNames *[]string `json:"collectionNames,omitempty"` -} - -// DataCenterResource a managed Cassandra data center. -type DataCenterResource struct { - autorest.Response `json:"-"` - // Properties - Properties of a managed Cassandra data center. - Properties *DataCenterResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCenterResource. -func (dcr DataCenterResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcr.Properties != nil { - objectMap["properties"] = dcr.Properties - } - return json.Marshal(objectMap) -} - -// DataCenterResourceProperties properties of a managed Cassandra data center. -type DataCenterResourceProperties struct { - // ProvisioningState - Possible values include: 'ManagedCassandraProvisioningStateCreating', 'ManagedCassandraProvisioningStateUpdating', 'ManagedCassandraProvisioningStateDeleting', 'ManagedCassandraProvisioningStateSucceeded', 'ManagedCassandraProvisioningStateFailed', 'ManagedCassandraProvisioningStateCanceled' - ProvisioningState ManagedCassandraProvisioningState `json:"provisioningState,omitempty"` - // DataCenterLocation - The region this data center should be created in. - DataCenterLocation *string `json:"dataCenterLocation,omitempty"` - // DelegatedSubnetID - Resource id of a subnet the nodes in this data center should have their network interfaces connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' property. This resource id will be of the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. - DelegatedSubnetID *string `json:"delegatedSubnetId,omitempty"` - // NodeCount - The number of nodes the data center should have. This is the desired number. After it is set, it may take some time for the data center to be scaled to match. To monitor the number of nodes and their status, use the fetchNodeStatus method on the cluster. - NodeCount *int32 `json:"nodeCount,omitempty"` - // SeedNodes - READ-ONLY; IP addresses for seed nodes in this data center. This is for reference. Generally you will want to use the seedNodes property on the cluster, which aggregates the seed nodes from all data centers in the cluster. - SeedNodes *[]SeedNode `json:"seedNodes,omitempty"` - // Base64EncodedCassandraYamlFragment - A fragment of a cassandra.yaml configuration file to be included in the cassandra.yaml for all nodes in this data center. The fragment should be Base64 encoded, and only a subset of keys are allowed. - Base64EncodedCassandraYamlFragment *string `json:"base64EncodedCassandraYamlFragment,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCenterResourceProperties. -func (dcr DataCenterResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcr.ProvisioningState != "" { - objectMap["provisioningState"] = dcr.ProvisioningState - } - if dcr.DataCenterLocation != nil { - objectMap["dataCenterLocation"] = dcr.DataCenterLocation - } - if dcr.DelegatedSubnetID != nil { - objectMap["delegatedSubnetId"] = dcr.DelegatedSubnetID - } - if dcr.NodeCount != nil { - objectMap["nodeCount"] = dcr.NodeCount - } - if dcr.Base64EncodedCassandraYamlFragment != nil { - objectMap["base64EncodedCassandraYamlFragment"] = dcr.Base64EncodedCassandraYamlFragment - } - return json.Marshal(objectMap) -} - -// DefaultRequestDatabaseAccountCreateUpdateProperties properties for non-restore Azure Cosmos DB database -// account requests. -type DefaultRequestDatabaseAccountCreateUpdateProperties struct { - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'ConnectorOfferSmall' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` - // NetworkACLBypass - Indicates what services are allowed to bypass firewall checks. Possible values include: 'NetworkACLBypassNone', 'NetworkACLBypassAzureServices' - NetworkACLBypass NetworkACLBypass `json:"networkAclBypass,omitempty"` - // NetworkACLBypassResourceIds - An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. - NetworkACLBypassResourceIds *[]string `json:"networkAclBypassResourceIds,omitempty"` - // CreateMode - Possible values include: 'CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDatabaseAccountCreateUpdateProperties', 'CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDefault', 'CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeRestore' - CreateMode CreateModeBasicDatabaseAccountCreateUpdateProperties `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { - drdacup.CreateMode = CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDefault - objectMap := make(map[string]interface{}) - if drdacup.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = drdacup.ConsistencyPolicy - } - if drdacup.Locations != nil { - objectMap["locations"] = drdacup.Locations - } - if drdacup.DatabaseAccountOfferType != nil { - objectMap["databaseAccountOfferType"] = drdacup.DatabaseAccountOfferType - } - if drdacup.IPRules != nil { - objectMap["ipRules"] = drdacup.IPRules - } - if drdacup.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = drdacup.IsVirtualNetworkFilterEnabled - } - if drdacup.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = drdacup.EnableAutomaticFailover - } - if drdacup.Capabilities != nil { - objectMap["capabilities"] = drdacup.Capabilities - } - if drdacup.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = drdacup.VirtualNetworkRules - } - if drdacup.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = drdacup.EnableMultipleWriteLocations - } - if drdacup.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = drdacup.EnableCassandraConnector - } - if drdacup.ConnectorOffer != "" { - objectMap["connectorOffer"] = drdacup.ConnectorOffer - } - if drdacup.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = drdacup.DisableKeyBasedMetadataWriteAccess - } - if drdacup.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = drdacup.KeyVaultKeyURI - } - if drdacup.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = drdacup.PublicNetworkAccess - } - if drdacup.EnableFreeTier != nil { - objectMap["enableFreeTier"] = drdacup.EnableFreeTier - } - if drdacup.APIProperties != nil { - objectMap["apiProperties"] = drdacup.APIProperties - } - if drdacup.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = drdacup.EnableAnalyticalStorage - } - objectMap["backupPolicy"] = drdacup.BackupPolicy - if drdacup.Cors != nil { - objectMap["cors"] = drdacup.Cors - } - if drdacup.NetworkACLBypass != "" { - objectMap["networkAclBypass"] = drdacup.NetworkACLBypass - } - if drdacup.NetworkACLBypassResourceIds != nil { - objectMap["networkAclBypassResourceIds"] = drdacup.NetworkACLBypassResourceIds - } - if drdacup.CreateMode != "" { - objectMap["createMode"] = drdacup.CreateMode - } - return json.Marshal(objectMap) -} - -// AsDefaultRequestDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) AsDefaultRequestDatabaseAccountCreateUpdateProperties() (*DefaultRequestDatabaseAccountCreateUpdateProperties, bool) { - return &drdacup, true -} - -// AsRestoreReqeustDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) AsRestoreReqeustDatabaseAccountCreateUpdateProperties() (*RestoreReqeustDatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) AsDatabaseAccountCreateUpdateProperties() (*DatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsBasicDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for DefaultRequestDatabaseAccountCreateUpdateProperties. -func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) AsBasicDatabaseAccountCreateUpdateProperties() (BasicDatabaseAccountCreateUpdateProperties, bool) { - return &drdacup, true -} - -// UnmarshalJSON is the custom unmarshaler for DefaultRequestDatabaseAccountCreateUpdateProperties struct. -func (drdacup *DefaultRequestDatabaseAccountCreateUpdateProperties) 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 "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - drdacup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - drdacup.Locations = &locations - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType string - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - drdacup.DatabaseAccountOfferType = &databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - drdacup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - drdacup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - drdacup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - drdacup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - drdacup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - drdacup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - drdacup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - drdacup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - drdacup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - drdacup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - drdacup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - drdacup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - drdacup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - drdacup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - drdacup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - drdacup.Cors = &cors - } - case "networkAclBypass": - if v != nil { - var networkACLBypass NetworkACLBypass - err = json.Unmarshal(*v, &networkACLBypass) - if err != nil { - return err - } - drdacup.NetworkACLBypass = networkACLBypass - } - case "networkAclBypassResourceIds": - if v != nil { - var networkACLBypassResourceIds []string - err = json.Unmarshal(*v, &networkACLBypassResourceIds) - if err != nil { - return err - } - drdacup.NetworkACLBypassResourceIds = &networkACLBypassResourceIds - } - case "createMode": - if v != nil { - var createMode CreateModeBasicDatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &createMode) - if err != nil { - return err - } - drdacup.CreateMode = createMode - } - } - } - - return nil -} - -// ErrorResponse 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"` -} - -// ExcludedPath ... -type ExcludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` -} - -// ExtendedResourceProperties the system generated resource properties associated with SQL databases, SQL -// containers, Gremlin databases and Gremlin graphs. -type ExtendedResourceProperties struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedResourceProperties. -func (erp ExtendedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverPolicies the list of new failover policies for the failover priority change. -type FailoverPolicies struct { - // FailoverPolicies - List of failover policies. - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` -} - -// FailoverPolicy the failover policy for a given region of a database account. -type FailoverPolicy struct { - // ID - READ-ONLY; The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region in which the database account exists. - LocationName *string `json:"locationName,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverPolicy. -func (fp FailoverPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.LocationName != nil { - objectMap["locationName"] = fp.LocationName - } - if fp.FailoverPriority != nil { - objectMap["failoverPriority"] = fp.FailoverPriority - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseCreateUpdateParameters parameters to create and update Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateParameters struct { - // GremlinDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin database. - *GremlinDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseCreateUpdateParameters. -func (gdcup GremlinDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdcup.GremlinDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = gdcup.GremlinDatabaseCreateUpdateProperties - } - if gdcup.Location != nil { - objectMap["location"] = gdcup.Location - } - if gdcup.Tags != nil { - objectMap["tags"] = gdcup.Tags - } - if gdcup.Identity != nil { - objectMap["identity"] = gdcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseCreateUpdateParameters struct. -func (gdcup *GremlinDatabaseCreateUpdateParameters) 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 gremlinDatabaseCreateUpdateProperties GremlinDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinDatabaseCreateUpdateProperties) - if err != nil { - return err - } - gdcup.GremlinDatabaseCreateUpdateProperties = &gremlinDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - gdcup.Identity = &identity - } - } - } - - return nil -} - -// GremlinDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin database. -type GremlinDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin database - Resource *GremlinDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type GremlinDatabaseGetProperties struct { - Resource *GremlinDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinDatabaseGetPropertiesOptions ... -type GremlinDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// GremlinDatabaseGetPropertiesResource ... -type GremlinDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetPropertiesResource. -func (gdgp GremlinDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgp.ID != nil { - objectMap["id"] = gdgp.ID - } - return json.Marshal(objectMap) -} - -// GremlinDatabaseGetResults an Azure Cosmos DB Gremlin database. -type GremlinDatabaseGetResults struct { - autorest.Response `json:"-"` - // GremlinDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *GremlinDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseGetResults. -func (gdgr GremlinDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gdgr.GremlinDatabaseGetProperties != nil { - objectMap["properties"] = gdgr.GremlinDatabaseGetProperties - } - if gdgr.Location != nil { - objectMap["location"] = gdgr.Location - } - if gdgr.Tags != nil { - objectMap["tags"] = gdgr.Tags - } - if gdgr.Identity != nil { - objectMap["identity"] = gdgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinDatabaseGetResults struct. -func (gdgr *GremlinDatabaseGetResults) 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 gremlinDatabaseGetProperties GremlinDatabaseGetProperties - err = json.Unmarshal(*v, &gremlinDatabaseGetProperties) - if err != nil { - return err - } - gdgr.GremlinDatabaseGetProperties = &gremlinDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gdgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - gdgr.Identity = &identity - } - } - } - - return nil -} - -// GremlinDatabaseListResult the List operation response, that contains the Gremlin databases and their -// properties. -type GremlinDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Gremlin databases and their properties. - Value *[]GremlinDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinDatabaseListResult. -func (gdlr GremlinDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinDatabaseResource cosmos DB Gremlin database resource object -type GremlinDatabaseResource struct { - // ID - Name of the Cosmos DB Gremlin database - ID *string `json:"id,omitempty"` -} - -// GremlinGraphCreateUpdateParameters parameters to create and update Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateParameters struct { - // GremlinGraphCreateUpdateProperties - Properties to create and update Azure Cosmos DB Gremlin graph. - *GremlinGraphCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphCreateUpdateParameters. -func (ggcup GremlinGraphCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ggcup.GremlinGraphCreateUpdateProperties != nil { - objectMap["properties"] = ggcup.GremlinGraphCreateUpdateProperties - } - if ggcup.Location != nil { - objectMap["location"] = ggcup.Location - } - if ggcup.Tags != nil { - objectMap["tags"] = ggcup.Tags - } - if ggcup.Identity != nil { - objectMap["identity"] = ggcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphCreateUpdateParameters struct. -func (ggcup *GremlinGraphCreateUpdateParameters) 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 gremlinGraphCreateUpdateProperties GremlinGraphCreateUpdateProperties - err = json.Unmarshal(*v, &gremlinGraphCreateUpdateProperties) - if err != nil { - return err - } - ggcup.GremlinGraphCreateUpdateProperties = &gremlinGraphCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ggcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ggcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ggcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ggcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ggcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ggcup.Identity = &identity - } - } - } - - return nil -} - -// GremlinGraphCreateUpdateProperties properties to create and update Azure Cosmos DB Gremlin graph. -type GremlinGraphCreateUpdateProperties struct { - // Resource - The standard JSON format of a Gremlin graph - Resource *GremlinGraphResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GremlinGraphGetProperties the properties of an Azure Cosmos DB Gremlin graph -type GremlinGraphGetProperties struct { - Resource *GremlinGraphGetPropertiesResource `json:"resource,omitempty"` - Options *GremlinGraphGetPropertiesOptions `json:"options,omitempty"` -} - -// GremlinGraphGetPropertiesOptions ... -type GremlinGraphGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// GremlinGraphGetPropertiesResource ... -type GremlinGraphGetPropertiesResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetPropertiesResource. -func (gggp GremlinGraphGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggp.ID != nil { - objectMap["id"] = gggp.ID - } - if gggp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = gggp.IndexingPolicy - } - if gggp.PartitionKey != nil { - objectMap["partitionKey"] = gggp.PartitionKey - } - if gggp.DefaultTTL != nil { - objectMap["defaultTtl"] = gggp.DefaultTTL - } - if gggp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = gggp.UniqueKeyPolicy - } - if gggp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = gggp.ConflictResolutionPolicy - } - return json.Marshal(objectMap) -} - -// GremlinGraphGetResults an Azure Cosmos DB Gremlin graph. -type GremlinGraphGetResults struct { - autorest.Response `json:"-"` - // GremlinGraphGetProperties - The properties of an Azure Cosmos DB Gremlin graph - *GremlinGraphGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphGetResults. -func (gggr GremlinGraphGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gggr.GremlinGraphGetProperties != nil { - objectMap["properties"] = gggr.GremlinGraphGetProperties - } - if gggr.Location != nil { - objectMap["location"] = gggr.Location - } - if gggr.Tags != nil { - objectMap["tags"] = gggr.Tags - } - if gggr.Identity != nil { - objectMap["identity"] = gggr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GremlinGraphGetResults struct. -func (gggr *GremlinGraphGetResults) 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 gremlinGraphGetProperties GremlinGraphGetProperties - err = json.Unmarshal(*v, &gremlinGraphGetProperties) - if err != nil { - return err - } - gggr.GremlinGraphGetProperties = &gremlinGraphGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gggr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gggr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gggr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gggr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gggr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - gggr.Identity = &identity - } - } - } - - return nil -} - -// GremlinGraphListResult the List operation response, that contains the graphs and their properties. -type GremlinGraphListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of graphs and their properties. - Value *[]GremlinGraphGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for GremlinGraphListResult. -func (gglr GremlinGraphListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GremlinGraphResource cosmos DB Gremlin graph resource object -type GremlinGraphResource struct { - // ID - Name of the Cosmos DB Gremlin graph - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the graph. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` -} - -// GremlinResourcesCreateUpdateGremlinDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesCreateUpdateGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) 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 GremlinResourcesCreateUpdateGremlinDatabaseFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) result(client GremlinResourcesClient) (gdgr GremlinDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gdgr.Response.Response, err = future.GetResult(sender); err == nil && gdgr.Response.Response.StatusCode != http.StatusNoContent { - gdgr, err = client.CreateUpdateGremlinDatabaseResponder(gdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinDatabaseFuture", "Result", gdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesCreateUpdateGremlinGraphFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type GremlinResourcesCreateUpdateGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (GremlinGraphGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) 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 GremlinResourcesCreateUpdateGremlinGraphFuture.Result. -func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) result(client GremlinResourcesClient) (gggr GremlinGraphGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gggr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gggr.Response.Response, err = future.GetResult(sender); err == nil && gggr.Response.Response.StatusCode != http.StatusNoContent { - gggr, err = client.CreateUpdateGremlinGraphResponder(gggr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesCreateUpdateGremlinGraphFuture", "Result", gggr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesDeleteGremlinDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type GremlinResourcesDeleteGremlinDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) 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 GremlinResourcesDeleteGremlinDatabaseFuture.Result. -func (future *GremlinResourcesDeleteGremlinDatabaseFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesDeleteGremlinGraphFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GremlinResourcesDeleteGremlinGraphFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesDeleteGremlinGraphFuture) 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 GremlinResourcesDeleteGremlinGraphFuture.Result. -func (future *GremlinResourcesDeleteGremlinGraphFuture) result(client GremlinResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesDeleteGremlinGraphFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesDeleteGremlinGraphFuture") - return - } - ar.Response = future.Response() - return -} - -// GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture) 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 GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture.Result. -func (future *GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture) 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 GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture.Result. -func (future *GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinGraphToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesMigrateGremlinGraphToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinGraphToAutoscaleFuture) 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 GremlinResourcesMigrateGremlinGraphToAutoscaleFuture.Result. -func (future *GremlinResourcesMigrateGremlinGraphToAutoscaleFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinGraphToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesMigrateGremlinGraphToManualThroughputFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type GremlinResourcesMigrateGremlinGraphToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesMigrateGremlinGraphToManualThroughputFuture) 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 GremlinResourcesMigrateGremlinGraphToManualThroughputFuture.Result. -func (future *GremlinResourcesMigrateGremlinGraphToManualThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateGremlinGraphToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesMigrateGremlinGraphToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) 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 GremlinResourcesUpdateGremlinDatabaseThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// GremlinResourcesUpdateGremlinGraphThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type GremlinResourcesUpdateGremlinGraphThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GremlinResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) 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 GremlinResourcesUpdateGremlinGraphThroughputFuture.Result. -func (future *GremlinResourcesUpdateGremlinGraphThroughputFuture) result(client GremlinResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateGremlinGraphThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesUpdateGremlinGraphThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// IncludedPath the paths that are included in indexing -type IncludedPath struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Indexes - List of indexes for this path - Indexes *[]Indexes `json:"indexes,omitempty"` -} - -// Indexes the indexes for the path. -type Indexes struct { - // DataType - The datatype for which the indexing behavior is applied to. Possible values include: 'DataTypeString', 'DataTypeNumber', 'DataTypePoint', 'DataTypePolygon', 'DataTypeLineString', 'DataTypeMultiPolygon' - DataType DataType `json:"dataType,omitempty"` - // Precision - The precision of the index. -1 is maximum precision. - Precision *int32 `json:"precision,omitempty"` - // Kind - Indicates the type of index. Possible values include: 'IndexKindHash', 'IndexKindRange', 'IndexKindSpatial' - Kind IndexKind `json:"kind,omitempty"` -} - -// IndexingPolicy cosmos DB indexing policy -type IndexingPolicy struct { - // Automatic - Indicates if the indexing policy is automatic - Automatic *bool `json:"automatic,omitempty"` - // IndexingMode - Indicates the indexing mode. Possible values include: 'IndexingModeConsistent', 'IndexingModeLazy', 'IndexingModeNone' - IndexingMode IndexingMode `json:"indexingMode,omitempty"` - // IncludedPaths - List of paths to include in the indexing - IncludedPaths *[]IncludedPath `json:"includedPaths,omitempty"` - // ExcludedPaths - List of paths to exclude from indexing - ExcludedPaths *[]ExcludedPath `json:"excludedPaths,omitempty"` - // CompositeIndexes - List of composite path list - CompositeIndexes *[][]CompositePath `json:"compositeIndexes,omitempty"` - // SpatialIndexes - List of spatial specifics - SpatialIndexes *[]SpatialSpec `json:"spatialIndexes,omitempty"` -} - -// IPAddressOrRange ipAddressOrRange object -type IPAddressOrRange struct { - // IPAddressOrRange - A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. - IPAddressOrRange *string `json:"ipAddressOrRange,omitempty"` -} - -// ListBackups list of restorable backups for a Cassandra cluster. -type ListBackups struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Container for array of backups. - Value *[]BackupResource `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListBackups. -func (lb ListBackups) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListClusters list of managed Cassandra clusters. -type ListClusters struct { - autorest.Response `json:"-"` - // Value - Container for the array of clusters. - Value *[]ClusterResource `json:"value,omitempty"` -} - -// ListDataCenters list of managed Cassandra data centers and their properties. -type ListDataCenters struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Container for array of data centers. - Value *[]DataCenterResource `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListDataCenters. -func (ldc ListDataCenters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Location a region in which the Azure Cosmos DB database account is deployed. -type Location struct { - // ID - READ-ONLY; The unique identifier of the region within the database account. Example: <accountName>-<locationName>. - ID *string `json:"id,omitempty"` - // LocationName - The name of the region. - LocationName *string `json:"locationName,omitempty"` - // DocumentEndpoint - READ-ONLY; The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/ - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - // FailoverPriority - The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - FailoverPriority *int32 `json:"failoverPriority,omitempty"` - // IsZoneRedundant - Flag to indicate whether or not this region is an AvailabilityZone region - IsZoneRedundant *bool `json:"isZoneRedundant,omitempty"` -} - -// MarshalJSON is the custom marshaler for Location. -func (l Location) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if l.LocationName != nil { - objectMap["locationName"] = l.LocationName - } - if l.ProvisioningState != nil { - objectMap["provisioningState"] = l.ProvisioningState - } - if l.FailoverPriority != nil { - objectMap["failoverPriority"] = l.FailoverPriority - } - if l.IsZoneRedundant != nil { - objectMap["isZoneRedundant"] = l.IsZoneRedundant - } - return json.Marshal(objectMap) -} - -// LocationGetResult cosmos DB location get result -type LocationGetResult struct { - autorest.Response `json:"-"` - // Properties - Cosmos DB location metadata - Properties *LocationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationGetResult. -func (lgr LocationGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lgr.Properties != nil { - objectMap["properties"] = lgr.Properties - } - return json.Marshal(objectMap) -} - -// LocationListResult the List operation response, that contains Cosmos DB locations and their properties. -type LocationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Cosmos DB locations and their properties. - Value *[]LocationGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationListResult. -func (llr LocationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LocationProperties cosmos DB location metadata -type LocationProperties struct { - // Status - READ-ONLY; The current status of location in Azure. - Status *string `json:"status,omitempty"` - // SupportsAvailabilityZone - READ-ONLY; Flag indicating whether the location supports availability zones or not. - SupportsAvailabilityZone *bool `json:"supportsAvailabilityZone,omitempty"` - // IsResidencyRestricted - READ-ONLY; Flag indicating whether the location is residency sensitive. - IsResidencyRestricted *bool `json:"isResidencyRestricted,omitempty"` - // BackupStorageRedundancies - READ-ONLY; The properties of available backup storage redundancies. - BackupStorageRedundancies *[]BackupStorageRedundancy `json:"backupStorageRedundancies,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationProperties. -func (lp LocationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedServiceIdentity identity for the resource. -type ManagedServiceIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the system assigned identity. This property will only be provided for a system assigned identity. - PrincipalID *string `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 *string `json:"tenantId,omitempty"` - // Type - The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*ManagedServiceIdentityUserAssignedIdentitiesValue `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) -} - -// ManagedServiceIdentityUserAssignedIdentitiesValue ... -type ManagedServiceIdentityUserAssignedIdentitiesValue 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 ManagedServiceIdentityUserAssignedIdentitiesValue. -func (msiAiv ManagedServiceIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Metric metric data -type Metric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond', 'UnitTypeMilliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for Metric. -func (mVar Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.Unit != "" { - objectMap["unit"] = mVar.Unit - } - return json.Marshal(objectMap) -} - -// MetricAvailability the availability of the metric. -type MetricAvailability struct { - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - READ-ONLY; The retention for the metric values. - Retention *string `json:"retention,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAvailability. -func (ma MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinition the definition of a metric. -type MetricDefinition struct { - // MetricAvailabilities - READ-ONLY; The list of metric availabilities for the account. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type of the metric. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeTotal', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeLast' - PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` - // Unit - The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond', 'UnitTypeMilliseconds' - Unit UnitType `json:"unit,omitempty"` - // ResourceURI - READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinition. -func (md MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if md.Unit != "" { - objectMap["unit"] = md.Unit - } - return json.Marshal(objectMap) -} - -// MetricDefinitionsListResult the response to a list metric definitions request. -type MetricDefinitionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metric definitions for the account. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinitionsListResult. -func (mdlr MetricDefinitionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricListResult the response to a list metrics request. -type MetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of metrics for the account. - Value *[]Metric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricListResult. -func (mlr MetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricName a metric name. -type MetricName struct { - // Value - READ-ONLY; The name of the metric. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The friendly name of the metric. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricName. -func (mn MetricName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricValue represents metrics values. -type MetricValue struct { - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricValue. -func (mv MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionCreateUpdateParameters parameters to create and update Cosmos DB MongoDB collection. -type MongoDBCollectionCreateUpdateParameters struct { - // MongoDBCollectionCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB collection. - *MongoDBCollectionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionCreateUpdateParameters. -func (mdccup MongoDBCollectionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdccup.MongoDBCollectionCreateUpdateProperties != nil { - objectMap["properties"] = mdccup.MongoDBCollectionCreateUpdateProperties - } - if mdccup.Location != nil { - objectMap["location"] = mdccup.Location - } - if mdccup.Tags != nil { - objectMap["tags"] = mdccup.Tags - } - if mdccup.Identity != nil { - objectMap["identity"] = mdccup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionCreateUpdateParameters struct. -func (mdccup *MongoDBCollectionCreateUpdateParameters) 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 mongoDBCollectionCreateUpdateProperties MongoDBCollectionCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBCollectionCreateUpdateProperties) - if err != nil { - return err - } - mdccup.MongoDBCollectionCreateUpdateProperties = &mongoDBCollectionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdccup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mdccup.Identity = &identity - } - } - } - - return nil -} - -// MongoDBCollectionCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB -// collection. -type MongoDBCollectionCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB collection - Resource *MongoDBCollectionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetProperties the properties of an Azure Cosmos DB MongoDB collection -type MongoDBCollectionGetProperties struct { - Resource *MongoDBCollectionGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBCollectionGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBCollectionGetPropertiesOptions ... -type MongoDBCollectionGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// MongoDBCollectionGetPropertiesResource ... -type MongoDBCollectionGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetPropertiesResource. -func (mdcgp MongoDBCollectionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgp.ID != nil { - objectMap["id"] = mdcgp.ID - } - if mdcgp.ShardKey != nil { - objectMap["shardKey"] = mdcgp.ShardKey - } - if mdcgp.Indexes != nil { - objectMap["indexes"] = mdcgp.Indexes - } - if mdcgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = mdcgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// MongoDBCollectionGetResults an Azure Cosmos DB MongoDB collection. -type MongoDBCollectionGetResults struct { - autorest.Response `json:"-"` - // MongoDBCollectionGetProperties - The properties of an Azure Cosmos DB MongoDB collection - *MongoDBCollectionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionGetResults. -func (mdcgr MongoDBCollectionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcgr.MongoDBCollectionGetProperties != nil { - objectMap["properties"] = mdcgr.MongoDBCollectionGetProperties - } - if mdcgr.Location != nil { - objectMap["location"] = mdcgr.Location - } - if mdcgr.Tags != nil { - objectMap["tags"] = mdcgr.Tags - } - if mdcgr.Identity != nil { - objectMap["identity"] = mdcgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBCollectionGetResults struct. -func (mdcgr *MongoDBCollectionGetResults) 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 mongoDBCollectionGetProperties MongoDBCollectionGetProperties - err = json.Unmarshal(*v, &mongoDBCollectionGetProperties) - if err != nil { - return err - } - mdcgr.MongoDBCollectionGetProperties = &mongoDBCollectionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdcgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdcgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdcgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mdcgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdcgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mdcgr.Identity = &identity - } - } - } - - return nil -} - -// MongoDBCollectionListResult the List operation response, that contains the MongoDB collections and their -// properties. -type MongoDBCollectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB collections and their properties. - Value *[]MongoDBCollectionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionListResult. -func (mdclr MongoDBCollectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBCollectionResource cosmos DB MongoDB collection resource object -type MongoDBCollectionResource struct { - // ID - Name of the Cosmos DB MongoDB collection - ID *string `json:"id,omitempty"` - // ShardKey - A key-value pair of shard keys to be applied for the request. - ShardKey map[string]*string `json:"shardKey"` - // Indexes - List of index keys - Indexes *[]MongoIndex `json:"indexes,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int32 `json:"analyticalStorageTtl,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBCollectionResource. -func (mdcr MongoDBCollectionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdcr.ID != nil { - objectMap["id"] = mdcr.ID - } - if mdcr.ShardKey != nil { - objectMap["shardKey"] = mdcr.ShardKey - } - if mdcr.Indexes != nil { - objectMap["indexes"] = mdcr.Indexes - } - if mdcr.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = mdcr.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseCreateUpdateParameters parameters to create and update Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateParameters struct { - // MongoDBDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB MongoDB database. - *MongoDBDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseCreateUpdateParameters. -func (mddcup MongoDBDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddcup.MongoDBDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = mddcup.MongoDBDatabaseCreateUpdateProperties - } - if mddcup.Location != nil { - objectMap["location"] = mddcup.Location - } - if mddcup.Tags != nil { - objectMap["tags"] = mddcup.Tags - } - if mddcup.Identity != nil { - objectMap["identity"] = mddcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseCreateUpdateParameters struct. -func (mddcup *MongoDBDatabaseCreateUpdateParameters) 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 mongoDBDatabaseCreateUpdateProperties MongoDBDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &mongoDBDatabaseCreateUpdateProperties) - if err != nil { - return err - } - mddcup.MongoDBDatabaseCreateUpdateProperties = &mongoDBDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mddcup.Identity = &identity - } - } - } - - return nil -} - -// MongoDBDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB database. -type MongoDBDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a MongoDB database - Resource *MongoDBDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetProperties the properties of an Azure Cosmos DB MongoDB database -type MongoDBDatabaseGetProperties struct { - Resource *MongoDBDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *MongoDBDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// MongoDBDatabaseGetPropertiesOptions ... -type MongoDBDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// MongoDBDatabaseGetPropertiesResource ... -type MongoDBDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetPropertiesResource. -func (mddgp MongoDBDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgp.ID != nil { - objectMap["id"] = mddgp.ID - } - return json.Marshal(objectMap) -} - -// MongoDBDatabaseGetResults an Azure Cosmos DB MongoDB database. -type MongoDBDatabaseGetResults struct { - autorest.Response `json:"-"` - // MongoDBDatabaseGetProperties - The properties of an Azure Cosmos DB MongoDB database - *MongoDBDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseGetResults. -func (mddgr MongoDBDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mddgr.MongoDBDatabaseGetProperties != nil { - objectMap["properties"] = mddgr.MongoDBDatabaseGetProperties - } - if mddgr.Location != nil { - objectMap["location"] = mddgr.Location - } - if mddgr.Tags != nil { - objectMap["tags"] = mddgr.Tags - } - if mddgr.Identity != nil { - objectMap["identity"] = mddgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MongoDBDatabaseGetResults struct. -func (mddgr *MongoDBDatabaseGetResults) 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 mongoDBDatabaseGetProperties MongoDBDatabaseGetProperties - err = json.Unmarshal(*v, &mongoDBDatabaseGetProperties) - if err != nil { - return err - } - mddgr.MongoDBDatabaseGetProperties = &mongoDBDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mddgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mddgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mddgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mddgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mddgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mddgr.Identity = &identity - } - } - } - - return nil -} - -// MongoDBDatabaseListResult the List operation response, that contains the MongoDB databases and their -// properties. -type MongoDBDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB databases and their properties. - Value *[]MongoDBDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MongoDBDatabaseListResult. -func (mddlr MongoDBDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MongoDBDatabaseResource cosmos DB MongoDB database resource object -type MongoDBDatabaseResource struct { - // ID - Name of the Cosmos DB MongoDB database - ID *string `json:"id,omitempty"` -} - -// MongoDBResourcesCreateUpdateMongoDBCollectionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBCollectionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) 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 MongoDBResourcesCreateUpdateMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) result(client MongoDBResourcesClient) (mdcgr MongoDBCollectionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mdcgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mdcgr.Response.Response, err = future.GetResult(sender); err == nil && mdcgr.Response.Response.StatusCode != http.StatusNoContent { - mdcgr, err = client.CreateUpdateMongoDBCollectionResponder(mdcgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBCollectionFuture", "Result", mdcgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesCreateUpdateMongoDBDatabaseFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesCreateUpdateMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (MongoDBDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) 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 MongoDBResourcesCreateUpdateMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (mddgr MongoDBDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mddgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mddgr.Response.Response, err = future.GetResult(sender); err == nil && mddgr.Response.Response.StatusCode != http.StatusNoContent { - mddgr, err = client.CreateUpdateMongoDBDatabaseResponder(mddgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesCreateUpdateMongoDBDatabaseFuture", "Result", mddgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesDeleteMongoDBCollectionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type MongoDBResourcesDeleteMongoDBCollectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) 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 MongoDBResourcesDeleteMongoDBCollectionFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBCollectionFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesDeleteMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type MongoDBResourcesDeleteMongoDBDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) 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 MongoDBResourcesDeleteMongoDBDatabaseFuture.Result. -func (future *MongoDBResourcesDeleteMongoDBDatabaseFuture) result(client MongoDBResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesDeleteMongoDBDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture) 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 MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBCollectionToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture) 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 MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBCollectionToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture) 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 MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture) 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 MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture.Result. -func (future *MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateMongoDBDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBCollectionThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBCollectionThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) 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 MongoDBResourcesUpdateMongoDBCollectionThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBCollectionThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBCollectionThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBCollectionThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MongoDBResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) 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 MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture.Result. -func (future *MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture) result(client MongoDBResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateMongoDBDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// MongoIndex cosmos DB MongoDB collection index key -type MongoIndex struct { - // Key - Cosmos DB MongoDB collection index keys - Key *MongoIndexKeys `json:"key,omitempty"` - // Options - Cosmos DB MongoDB collection index key options - Options *MongoIndexOptions `json:"options,omitempty"` -} - -// MongoIndexKeys cosmos DB MongoDB collection resource object -type MongoIndexKeys struct { - // Keys - List of keys for each MongoDB collection in the Azure Cosmos DB service - Keys *[]string `json:"keys,omitempty"` -} - -// MongoIndexOptions cosmos DB MongoDB collection index options -type MongoIndexOptions struct { - // ExpireAfterSeconds - Expire after seconds - ExpireAfterSeconds *int32 `json:"expireAfterSeconds,omitempty"` - // Unique - Is unique or not - Unique *bool `json:"unique,omitempty"` -} - -// NotebookWorkspace a notebook workspace resource -type NotebookWorkspace struct { - autorest.Response `json:"-"` - // NotebookWorkspaceProperties - Resource properties. - *NotebookWorkspaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspace. -func (nw NotebookWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nw.NotebookWorkspaceProperties != nil { - objectMap["properties"] = nw.NotebookWorkspaceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotebookWorkspace struct. -func (nw *NotebookWorkspace) 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 notebookWorkspaceProperties NotebookWorkspaceProperties - err = json.Unmarshal(*v, ¬ebookWorkspaceProperties) - if err != nil { - return err - } - nw.NotebookWorkspaceProperties = ¬ebookWorkspaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nw.Type = &typeVar - } - } - } - - return nil -} - -// NotebookWorkspaceConnectionInfoResult the connection info for the given notebook workspace -type NotebookWorkspaceConnectionInfoResult struct { - autorest.Response `json:"-"` - // AuthToken - READ-ONLY; Specifies auth token used for connecting to Notebook server (uses token-based auth). - AuthToken *string `json:"authToken,omitempty"` - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceConnectionInfoResult. -func (nwcir NotebookWorkspaceConnectionInfoResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceCreateUpdateParameters parameters to create a notebook workspace resource -type NotebookWorkspaceCreateUpdateParameters struct { - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceCreateUpdateParameters. -func (nwcup NotebookWorkspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspaceListResult a list of notebook workspace resources -type NotebookWorkspaceListResult struct { - autorest.Response `json:"-"` - // Value - Array of notebook workspace resources - Value *[]NotebookWorkspace `json:"value,omitempty"` -} - -// NotebookWorkspaceProperties properties of a notebook workspace resource. -type NotebookWorkspaceProperties struct { - // NotebookServerEndpoint - READ-ONLY; Specifies the endpoint of Notebook server. - NotebookServerEndpoint *string `json:"notebookServerEndpoint,omitempty"` - // Status - READ-ONLY; Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, Updating. - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotebookWorkspaceProperties. -func (nwp NotebookWorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NotebookWorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (NotebookWorkspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesCreateOrUpdateFuture) 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 NotebookWorkspacesCreateOrUpdateFuture.Result. -func (future *NotebookWorkspacesCreateOrUpdateFuture) result(client NotebookWorkspacesClient) (nw NotebookWorkspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nw.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nw.Response.Response, err = future.GetResult(sender); err == nil && nw.Response.Response.StatusCode != http.StatusNoContent { - nw, err = client.CreateOrUpdateResponder(nw.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesCreateOrUpdateFuture", "Result", nw.Response.Response, "Failure responding to request") - } - } - return -} - -// NotebookWorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NotebookWorkspacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesDeleteFuture) 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 NotebookWorkspacesDeleteFuture.Result. -func (future *NotebookWorkspacesDeleteFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesRegenerateAuthTokenFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type NotebookWorkspacesRegenerateAuthTokenFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) 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 NotebookWorkspacesRegenerateAuthTokenFuture.Result. -func (future *NotebookWorkspacesRegenerateAuthTokenFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesRegenerateAuthTokenFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesRegenerateAuthTokenFuture") - return - } - ar.Response = future.Response() - return -} - -// NotebookWorkspacesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NotebookWorkspacesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NotebookWorkspacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NotebookWorkspacesStartFuture) 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 NotebookWorkspacesStartFuture.Result. -func (future *NotebookWorkspacesStartFuture) result(client NotebookWorkspacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.NotebookWorkspacesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// Operation 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.ResourceProvider - 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"` - // Description - Description of operation - Description *string `json:"Description,omitempty"` -} - -// OperationListResult 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 OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the 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, - } -} - -// OptionsResource cosmos DB options resource object -type OptionsResource struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// PartitionMetric the metric values for a single partition. -type PartitionMetric struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the metric values. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the metric values. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond', 'UnitTypeMilliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetric. -func (pm PartitionMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PartitionMetricListResult the response to a list partition metrics request. -type PartitionMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level metrics for the account. - Value *[]PartitionMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionMetricListResult. -func (pmlr PartitionMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PartitionUsage the partition level usage data for a usage request. -type PartitionUsage struct { - // PartitionID - READ-ONLY; The partition id (GUID identifier) of the usages. - PartitionID *string `json:"partitionId,omitempty"` - // PartitionKeyRangeID - READ-ONLY; The partition key range id (integer identifier) of the usages. - PartitionKeyRangeID *string `json:"partitionKeyRangeId,omitempty"` - // Unit - The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond', 'UnitTypeMilliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsage. -func (pu PartitionUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pu.Unit != "" { - objectMap["unit"] = pu.Unit - } - return json.Marshal(objectMap) -} - -// PartitionUsagesResult the response to a list partition level usage request. -type PartitionUsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of partition-level usages for the database. A usage is a point in time metric - Value *[]PartitionUsage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartitionUsagesResult. -func (pur PartitionUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetric percentile Metric data -type PercentileMetric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time grain to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond', 'UnitTypeMilliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The percentile metric values for the specified time window and timestep. - MetricValues *[]PercentileMetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetric. -func (pm PercentileMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.Unit != "" { - objectMap["unit"] = pm.Unit - } - return json.Marshal(objectMap) -} - -// PercentileMetricListResult the response to a list percentile metrics request. -type PercentileMetricListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of percentile metrics for the account. - Value *[]PercentileMetric `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricListResult. -func (pmlr PercentileMetricListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PercentileMetricValue represents percentile metrics values. -type PercentileMetricValue struct { - // P10 - READ-ONLY; The 10th percentile value for the metric. - P10 *float64 `json:"P10,omitempty"` - // P25 - READ-ONLY; The 25th percentile value for the metric. - P25 *float64 `json:"P25,omitempty"` - // P50 - READ-ONLY; The 50th percentile value for the metric. - P50 *float64 `json:"P50,omitempty"` - // P75 - READ-ONLY; The 75th percentile value for the metric. - P75 *float64 `json:"P75,omitempty"` - // P90 - READ-ONLY; The 90th percentile value for the metric. - P90 *float64 `json:"P90,omitempty"` - // P95 - READ-ONLY; The 95th percentile value for the metric. - P95 *float64 `json:"P95,omitempty"` - // P99 - READ-ONLY; The 99th percentile value for the metric. - P99 *float64 `json:"P99,omitempty"` - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"_count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for PercentileMetricValue. -func (pmv PercentileMetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PeriodicModeBackupPolicy the object representing periodic mode backup policy. -type PeriodicModeBackupPolicy struct { - // PeriodicModeProperties - Configuration values for periodic mode backup - PeriodicModeProperties *PeriodicModeProperties `json:"periodicModeProperties,omitempty"` - // Type - Possible values include: 'TypeBackupPolicy', 'TypePeriodic', 'TypeContinuous' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) MarshalJSON() ([]byte, error) { - pmbp.Type = TypePeriodic - objectMap := make(map[string]interface{}) - if pmbp.PeriodicModeProperties != nil { - objectMap["periodicModeProperties"] = pmbp.PeriodicModeProperties - } - if pmbp.Type != "" { - objectMap["type"] = pmbp.Type - } - return json.Marshal(objectMap) -} - -// AsPeriodicModeBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsPeriodicModeBackupPolicy() (*PeriodicModeBackupPolicy, bool) { - return &pmbp, true -} - -// AsContinuousModeBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsContinuousModeBackupPolicy() (*ContinuousModeBackupPolicy, bool) { - return nil, false -} - -// AsBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return nil, false -} - -// AsBasicBackupPolicy is the BasicBackupPolicy implementation for PeriodicModeBackupPolicy. -func (pmbp PeriodicModeBackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, bool) { - return &pmbp, true -} - -// PeriodicModeProperties configuration values for periodic mode backup -type PeriodicModeProperties struct { - // BackupIntervalInMinutes - An integer representing the interval in minutes between two backups - BackupIntervalInMinutes *int32 `json:"backupIntervalInMinutes,omitempty"` - // BackupRetentionIntervalInHours - An integer representing the time (in hours) that each backup is retained - BackupRetentionIntervalInHours *int32 `json:"backupRetentionIntervalInHours,omitempty"` - // BackupStorageRedundancy - Enum to indicate type of backup residency. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone' - BackupStorageRedundancy BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty"` -} - -// Permission the set of data plane operations permitted through this Role Definition. -type Permission struct { - // DataActions - An array of data actions that are allowed. - DataActions *[]string `json:"dataActions,omitempty"` - // NotDataActions - An array of data actions that are denied. - NotDataActions *[]string `json:"notDataActions,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // GroupID - Group id of the private endpoint. - GroupID *string `json:"groupId,omitempty"` - // ProvisioningState - Provisioning state of the private endpoint. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource required zone names. - 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) -} - -// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// 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) -} - -// RegionForOnlineOffline cosmos DB region to online or offline. -type RegionForOnlineOffline struct { - // Region - Cosmos DB region, with spaces between words and each word capitalized. - Region *string `json:"region,omitempty"` -} - -// RepairPostBody specification of the keyspaces and tables to run repair on. -type RepairPostBody struct { - // Keyspace - The name of the keyspace that repair should be run on. - Keyspace *string `json:"keyspace,omitempty"` - // Tables - List of tables in the keyspace to repair. If omitted, repair all tables in the keyspace. - Tables *[]string `json:"tables,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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableDatabaseAccountGetResult a Azure Cosmos DB restorable database account. -type RestorableDatabaseAccountGetResult struct { - autorest.Response `json:"-"` - // RestorableDatabaseAccountProperties - The properties of a restorable database account. - *RestorableDatabaseAccountProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDatabaseAccountGetResult. -func (rdagr RestorableDatabaseAccountGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdagr.RestorableDatabaseAccountProperties != nil { - objectMap["properties"] = rdagr.RestorableDatabaseAccountProperties - } - if rdagr.Location != nil { - objectMap["location"] = rdagr.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableDatabaseAccountGetResult struct. -func (rdagr *RestorableDatabaseAccountGetResult) 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 restorableDatabaseAccountProperties RestorableDatabaseAccountProperties - err = json.Unmarshal(*v, &restorableDatabaseAccountProperties) - if err != nil { - return err - } - rdagr.RestorableDatabaseAccountProperties = &restorableDatabaseAccountProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rdagr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rdagr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rdagr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rdagr.Location = &location - } - } - } - - return nil -} - -// RestorableDatabaseAccountProperties the properties of a restorable database account. -type RestorableDatabaseAccountProperties struct { - // AccountName - The name of the global database account - AccountName *string `json:"accountName,omitempty"` - // CreationTime - The creation time of the restorable database account (ISO-8601 format). - CreationTime *date.Time `json:"creationTime,omitempty"` - // DeletionTime - The time at which the restorable database account has been deleted (ISO-8601 format). - DeletionTime *date.Time `json:"deletionTime,omitempty"` - // APIType - READ-ONLY; The API type of the restorable database account. Possible values include: 'APITypeMongoDB', 'APITypeGremlin', 'APITypeCassandra', 'APITypeTable', 'APITypeSQL', 'APITypeGremlinV2' - APIType APIType `json:"apiType,omitempty"` - // RestorableLocations - READ-ONLY; List of regions where the of the database account can be restored from. - RestorableLocations *[]RestorableLocationResource `json:"restorableLocations,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDatabaseAccountProperties. -func (rdap RestorableDatabaseAccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdap.AccountName != nil { - objectMap["accountName"] = rdap.AccountName - } - if rdap.CreationTime != nil { - objectMap["creationTime"] = rdap.CreationTime - } - if rdap.DeletionTime != nil { - objectMap["deletionTime"] = rdap.DeletionTime - } - return json.Marshal(objectMap) -} - -// RestorableDatabaseAccountsListResult the List operation response, that contains the restorable database -// accounts and their properties. -type RestorableDatabaseAccountsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable database accounts and their properties. - Value *[]RestorableDatabaseAccountGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDatabaseAccountsListResult. -func (rdalr RestorableDatabaseAccountsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableLocationResource properties of the regional restorable account. -type RestorableLocationResource struct { - // LocationName - READ-ONLY; The location of the regional restorable account. - LocationName *string `json:"locationName,omitempty"` - // RegionalDatabaseAccountInstanceID - READ-ONLY; The instance id of the regional restorable account. - RegionalDatabaseAccountInstanceID *string `json:"regionalDatabaseAccountInstanceId,omitempty"` - // CreationTime - READ-ONLY; The creation time of the regional restorable database account (ISO-8601 format). - CreationTime *date.Time `json:"creationTime,omitempty"` - // DeletionTime - READ-ONLY; The time at which the regional restorable database account has been deleted (ISO-8601 format). - DeletionTime *date.Time `json:"deletionTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableLocationResource. -func (rlr RestorableLocationResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbCollectionGetResult an Azure Cosmos DB MongoDB collection event -type RestorableMongodbCollectionGetResult struct { - // RestorableMongodbCollectionProperties - The properties of a MongoDB collection event. - *RestorableMongodbCollectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource Identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbCollectionGetResult. -func (rmcgr RestorableMongodbCollectionGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmcgr.RestorableMongodbCollectionProperties != nil { - objectMap["properties"] = rmcgr.RestorableMongodbCollectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableMongodbCollectionGetResult struct. -func (rmcgr *RestorableMongodbCollectionGetResult) 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 restorableMongodbCollectionProperties RestorableMongodbCollectionProperties - err = json.Unmarshal(*v, &restorableMongodbCollectionProperties) - if err != nil { - return err - } - rmcgr.RestorableMongodbCollectionProperties = &restorableMongodbCollectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rmcgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rmcgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rmcgr.Type = &typeVar - } - } - } - - return nil -} - -// RestorableMongodbCollectionProperties the properties of an Azure Cosmos DB MongoDB collection event -type RestorableMongodbCollectionProperties struct { - // Resource - The resource of an Azure Cosmos DB MongoDB collection event - Resource *RestorableMongodbCollectionPropertiesResource `json:"resource,omitempty"` -} - -// RestorableMongodbCollectionPropertiesResource the resource of an Azure Cosmos DB MongoDB collection -// event -type RestorableMongodbCollectionPropertiesResource struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // OperationType - READ-ONLY; The operation type of this collection event. Possible values include: 'OperationTypeCreate', 'OperationTypeReplace', 'OperationTypeDelete', 'OperationTypeSystemOperation' - OperationType OperationType `json:"operationType,omitempty"` - // EventTimestamp - READ-ONLY; The time when this collection event happened. - EventTimestamp *string `json:"eventTimestamp,omitempty"` - // OwnerID - READ-ONLY; The name of this MongoDB collection. - OwnerID *string `json:"ownerId,omitempty"` - // OwnerResourceID - READ-ONLY; The resource ID of this MongoDB collection. - OwnerResourceID *string `json:"ownerResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbCollectionPropertiesResource. -func (rmcp RestorableMongodbCollectionPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbCollectionsListResult the List operation response, that contains the MongoDB collection -// events and their properties. -type RestorableMongodbCollectionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB collection events and their properties. - Value *[]RestorableMongodbCollectionGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbCollectionsListResult. -func (rmclr RestorableMongodbCollectionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbDatabaseGetResult an Azure Cosmos DB MongoDB database event -type RestorableMongodbDatabaseGetResult struct { - // RestorableMongodbDatabaseProperties - The properties of a MongoDB database event. - *RestorableMongodbDatabaseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource Identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbDatabaseGetResult. -func (rmdgr RestorableMongodbDatabaseGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmdgr.RestorableMongodbDatabaseProperties != nil { - objectMap["properties"] = rmdgr.RestorableMongodbDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableMongodbDatabaseGetResult struct. -func (rmdgr *RestorableMongodbDatabaseGetResult) 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 restorableMongodbDatabaseProperties RestorableMongodbDatabaseProperties - err = json.Unmarshal(*v, &restorableMongodbDatabaseProperties) - if err != nil { - return err - } - rmdgr.RestorableMongodbDatabaseProperties = &restorableMongodbDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rmdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rmdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rmdgr.Type = &typeVar - } - } - } - - return nil -} - -// RestorableMongodbDatabaseProperties the properties of an Azure Cosmos DB MongoDB database event -type RestorableMongodbDatabaseProperties struct { - // Resource - The resource of an Azure Cosmos DB MongoDB database event - Resource *RestorableMongodbDatabasePropertiesResource `json:"resource,omitempty"` -} - -// RestorableMongodbDatabasePropertiesResource the resource of an Azure Cosmos DB MongoDB database event -type RestorableMongodbDatabasePropertiesResource struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // OperationType - READ-ONLY; The operation type of this database event. Possible values include: 'OperationTypeCreate', 'OperationTypeReplace', 'OperationTypeDelete', 'OperationTypeSystemOperation' - OperationType OperationType `json:"operationType,omitempty"` - // EventTimestamp - READ-ONLY; The time when this database event happened. - EventTimestamp *string `json:"eventTimestamp,omitempty"` - // OwnerID - READ-ONLY; The name of this MongoDB database. - OwnerID *string `json:"ownerId,omitempty"` - // OwnerResourceID - READ-ONLY; The resource ID of this MongoDB database. - OwnerResourceID *string `json:"ownerResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbDatabasePropertiesResource. -func (rmdp RestorableMongodbDatabasePropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbDatabasesListResult the List operation response, that contains the MongoDB database -// events and their properties. -type RestorableMongodbDatabasesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of MongoDB database events and their properties. - Value *[]RestorableMongodbDatabaseGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbDatabasesListResult. -func (rmdlr RestorableMongodbDatabasesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableMongodbResourcesListResult the List operation response, that contains the restorable MongoDB -// resources. -type RestorableMongodbResourcesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable MongoDB resources, including the database and collection names. - Value *[]DatabaseRestoreResource `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableMongodbResourcesListResult. -func (rmrlr RestorableMongodbResourcesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableSQLContainerGetResult an Azure Cosmos DB SQL container event -type RestorableSQLContainerGetResult struct { - // RestorableSQLContainerProperties - The properties of a SQL container event. - *RestorableSQLContainerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource Identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLContainerGetResult. -func (rscgr RestorableSQLContainerGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rscgr.RestorableSQLContainerProperties != nil { - objectMap["properties"] = rscgr.RestorableSQLContainerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableSQLContainerGetResult struct. -func (rscgr *RestorableSQLContainerGetResult) 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 restorableSQLContainerProperties RestorableSQLContainerProperties - err = json.Unmarshal(*v, &restorableSQLContainerProperties) - if err != nil { - return err - } - rscgr.RestorableSQLContainerProperties = &restorableSQLContainerProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rscgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rscgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rscgr.Type = &typeVar - } - } - } - - return nil -} - -// RestorableSQLContainerProperties the properties of an Azure Cosmos DB SQL container event -type RestorableSQLContainerProperties struct { - // Resource - The resource of an Azure Cosmos DB SQL container event - Resource *RestorableSQLContainerPropertiesResource `json:"resource,omitempty"` -} - -// RestorableSQLContainerPropertiesResource the resource of an Azure Cosmos DB SQL container event -type RestorableSQLContainerPropertiesResource struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // OperationType - READ-ONLY; The operation type of this container event. Possible values include: 'OperationTypeCreate', 'OperationTypeReplace', 'OperationTypeDelete', 'OperationTypeSystemOperation' - OperationType OperationType `json:"operationType,omitempty"` - // EventTimestamp - READ-ONLY; The when this container event happened. - EventTimestamp *string `json:"eventTimestamp,omitempty"` - // OwnerID - READ-ONLY; The name of this SQL container. - OwnerID *string `json:"ownerId,omitempty"` - // OwnerResourceID - READ-ONLY; The resource ID of this SQL container. - OwnerResourceID *string `json:"ownerResourceId,omitempty"` - // Container - Cosmos DB SQL container resource object - Container *RestorableSQLContainerPropertiesResourceContainer `json:"container,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLContainerPropertiesResource. -func (rscp RestorableSQLContainerPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rscp.Container != nil { - objectMap["container"] = rscp.Container - } - return json.Marshal(objectMap) -} - -// RestorableSQLContainerPropertiesResourceContainer cosmos DB SQL container resource object -type RestorableSQLContainerPropertiesResourceContainer struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int64 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Self - READ-ONLY; A system generated property that specifies the addressable path of the container resource. - Self *string `json:"_self,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLContainerPropertiesResourceContainer. -func (rscp RestorableSQLContainerPropertiesResourceContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rscp.ID != nil { - objectMap["id"] = rscp.ID - } - if rscp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = rscp.IndexingPolicy - } - if rscp.PartitionKey != nil { - objectMap["partitionKey"] = rscp.PartitionKey - } - if rscp.DefaultTTL != nil { - objectMap["defaultTtl"] = rscp.DefaultTTL - } - if rscp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = rscp.UniqueKeyPolicy - } - if rscp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = rscp.ConflictResolutionPolicy - } - if rscp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = rscp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// RestorableSQLContainersListResult the List operation response, that contains the SQL container events -// and their properties. -type RestorableSQLContainersListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of SQL container events and their properties. - Value *[]RestorableSQLContainerGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLContainersListResult. -func (rsclr RestorableSQLContainersListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableSQLDatabaseGetResult an Azure Cosmos DB SQL database event -type RestorableSQLDatabaseGetResult struct { - // RestorableSQLDatabaseProperties - The properties of a SQL database event. - *RestorableSQLDatabaseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource Identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLDatabaseGetResult. -func (rsdgr RestorableSQLDatabaseGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsdgr.RestorableSQLDatabaseProperties != nil { - objectMap["properties"] = rsdgr.RestorableSQLDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableSQLDatabaseGetResult struct. -func (rsdgr *RestorableSQLDatabaseGetResult) 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 restorableSQLDatabaseProperties RestorableSQLDatabaseProperties - err = json.Unmarshal(*v, &restorableSQLDatabaseProperties) - if err != nil { - return err - } - rsdgr.RestorableSQLDatabaseProperties = &restorableSQLDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rsdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rsdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rsdgr.Type = &typeVar - } - } - } - - return nil -} - -// RestorableSQLDatabaseProperties the properties of an Azure Cosmos DB SQL database event -type RestorableSQLDatabaseProperties struct { - // Resource - The resource of an Azure Cosmos DB SQL database event - Resource *RestorableSQLDatabasePropertiesResource `json:"resource,omitempty"` -} - -// RestorableSQLDatabasePropertiesResource the resource of an Azure Cosmos DB SQL database event -type RestorableSQLDatabasePropertiesResource struct { - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // OperationType - READ-ONLY; The operation type of this database event. Possible values include: 'OperationTypeCreate', 'OperationTypeReplace', 'OperationTypeDelete', 'OperationTypeSystemOperation' - OperationType OperationType `json:"operationType,omitempty"` - // EventTimestamp - READ-ONLY; The time when this database event happened. - EventTimestamp *string `json:"eventTimestamp,omitempty"` - // OwnerID - READ-ONLY; The name of the SQL database. - OwnerID *string `json:"ownerId,omitempty"` - // OwnerResourceID - READ-ONLY; The resource ID of the SQL database. - OwnerResourceID *string `json:"ownerResourceId,omitempty"` - // Database - Cosmos DB SQL database resource object - Database *RestorableSQLDatabasePropertiesResourceDatabase `json:"database,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLDatabasePropertiesResource. -func (rsdp RestorableSQLDatabasePropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsdp.Database != nil { - objectMap["database"] = rsdp.Database - } - return json.Marshal(objectMap) -} - -// RestorableSQLDatabasePropertiesResourceDatabase cosmos DB SQL database resource object -type RestorableSQLDatabasePropertiesResourceDatabase struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Colls - READ-ONLY; A system generated property that specified the addressable path of the collections resource. - Colls *string `json:"_colls,omitempty"` - // Users - READ-ONLY; A system generated property that specifies the addressable path of the users resource. - Users *string `json:"_users,omitempty"` - // Self - READ-ONLY; A system generated property that specifies the addressable path of the database resource. - Self *string `json:"_self,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLDatabasePropertiesResourceDatabase. -func (rsdp RestorableSQLDatabasePropertiesResourceDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsdp.ID != nil { - objectMap["id"] = rsdp.ID - } - return json.Marshal(objectMap) -} - -// RestorableSQLDatabasesListResult the List operation response, that contains the SQL database events and -// their properties. -type RestorableSQLDatabasesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of SQL database events and their properties. - Value *[]RestorableSQLDatabaseGetResult `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLDatabasesListResult. -func (rsdlr RestorableSQLDatabasesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableSQLResourcesListResult the List operation response, that contains the restorable SQL -// resources. -type RestorableSQLResourcesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of restorable SQL resources, including the database and collection names. - Value *[]DatabaseRestoreResource `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableSQLResourcesListResult. -func (rsrlr RestorableSQLResourcesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestoreParameters parameters to indicate the information about the restore. -type RestoreParameters struct { - // RestoreMode - Describes the mode of the restore. Possible values include: 'RestoreModePointInTime' - RestoreMode RestoreMode `json:"restoreMode,omitempty"` - // RestoreSource - The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} - RestoreSource *string `json:"restoreSource,omitempty"` - // RestoreTimestampInUtc - Time to which the account has to be restored (ISO-8601 format). - RestoreTimestampInUtc *date.Time `json:"restoreTimestampInUtc,omitempty"` - // DatabasesToRestore - List of specific databases available for restore. - DatabasesToRestore *[]DatabaseRestoreResource `json:"databasesToRestore,omitempty"` -} - -// RestoreReqeustDatabaseAccountCreateUpdateProperties properties to restore Azure Cosmos DB database -// account. -type RestoreReqeustDatabaseAccountCreateUpdateProperties struct { - // RestoreParameters - Parameters to indicate the information about the restore. - RestoreParameters *RestoreParameters `json:"restoreParameters,omitempty"` - // ConsistencyPolicy - The consistency policy for the Cosmos DB account. - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - // Locations - An array that contains the georeplication locations enabled for the Cosmos DB account. - Locations *[]Location `json:"locations,omitempty"` - // DatabaseAccountOfferType - The offer type for the database - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - // IPRules - List of IpRules. - IPRules *[]IPAddressOrRange `json:"ipRules,omitempty"` - // IsVirtualNetworkFilterEnabled - Flag to indicate whether to enable/disable Virtual Network ACL rules. - IsVirtualNetworkFilterEnabled *bool `json:"isVirtualNetworkFilterEnabled,omitempty"` - // EnableAutomaticFailover - Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. - EnableAutomaticFailover *bool `json:"enableAutomaticFailover,omitempty"` - // Capabilities - List of Cosmos DB capabilities for the account - Capabilities *[]Capability `json:"capabilities,omitempty"` - // VirtualNetworkRules - List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // EnableMultipleWriteLocations - Enables the account to write in multiple locations - EnableMultipleWriteLocations *bool `json:"enableMultipleWriteLocations,omitempty"` - // EnableCassandraConnector - Enables the cassandra connector on the Cosmos DB C* account - EnableCassandraConnector *bool `json:"enableCassandraConnector,omitempty"` - // ConnectorOffer - The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'ConnectorOfferSmall' - ConnectorOffer ConnectorOffer `json:"connectorOffer,omitempty"` - // DisableKeyBasedMetadataWriteAccess - Disable write operations on metadata resources (databases, containers, throughput) via account keys - DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` - // KeyVaultKeyURI - The URI of the key vault - KeyVaultKeyURI *string `json:"keyVaultKeyUri,omitempty"` - // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // EnableFreeTier - Flag to indicate whether Free Tier is enabled. - EnableFreeTier *bool `json:"enableFreeTier,omitempty"` - // APIProperties - API specific properties. Currently, supported only for MongoDB API. - APIProperties *APIProperties `json:"apiProperties,omitempty"` - // EnableAnalyticalStorage - Flag to indicate whether to enable storage analytics. - EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` - // BackupPolicy - The object representing the policy for taking backups on an account. - BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` - // Cors - The CORS policy for the Cosmos DB database account. - Cors *[]CorsPolicy `json:"cors,omitempty"` - // NetworkACLBypass - Indicates what services are allowed to bypass firewall checks. Possible values include: 'NetworkACLBypassNone', 'NetworkACLBypassAzureServices' - NetworkACLBypass NetworkACLBypass `json:"networkAclBypass,omitempty"` - // NetworkACLBypassResourceIds - An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. - NetworkACLBypassResourceIds *[]string `json:"networkAclBypassResourceIds,omitempty"` - // CreateMode - Possible values include: 'CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDatabaseAccountCreateUpdateProperties', 'CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeDefault', 'CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeRestore' - CreateMode CreateModeBasicDatabaseAccountCreateUpdateProperties `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { - rrdacup.CreateMode = CreateModeBasicDatabaseAccountCreateUpdatePropertiesCreateModeRestore - objectMap := make(map[string]interface{}) - if rrdacup.RestoreParameters != nil { - objectMap["restoreParameters"] = rrdacup.RestoreParameters - } - if rrdacup.ConsistencyPolicy != nil { - objectMap["consistencyPolicy"] = rrdacup.ConsistencyPolicy - } - if rrdacup.Locations != nil { - objectMap["locations"] = rrdacup.Locations - } - if rrdacup.DatabaseAccountOfferType != nil { - objectMap["databaseAccountOfferType"] = rrdacup.DatabaseAccountOfferType - } - if rrdacup.IPRules != nil { - objectMap["ipRules"] = rrdacup.IPRules - } - if rrdacup.IsVirtualNetworkFilterEnabled != nil { - objectMap["isVirtualNetworkFilterEnabled"] = rrdacup.IsVirtualNetworkFilterEnabled - } - if rrdacup.EnableAutomaticFailover != nil { - objectMap["enableAutomaticFailover"] = rrdacup.EnableAutomaticFailover - } - if rrdacup.Capabilities != nil { - objectMap["capabilities"] = rrdacup.Capabilities - } - if rrdacup.VirtualNetworkRules != nil { - objectMap["virtualNetworkRules"] = rrdacup.VirtualNetworkRules - } - if rrdacup.EnableMultipleWriteLocations != nil { - objectMap["enableMultipleWriteLocations"] = rrdacup.EnableMultipleWriteLocations - } - if rrdacup.EnableCassandraConnector != nil { - objectMap["enableCassandraConnector"] = rrdacup.EnableCassandraConnector - } - if rrdacup.ConnectorOffer != "" { - objectMap["connectorOffer"] = rrdacup.ConnectorOffer - } - if rrdacup.DisableKeyBasedMetadataWriteAccess != nil { - objectMap["disableKeyBasedMetadataWriteAccess"] = rrdacup.DisableKeyBasedMetadataWriteAccess - } - if rrdacup.KeyVaultKeyURI != nil { - objectMap["keyVaultKeyUri"] = rrdacup.KeyVaultKeyURI - } - if rrdacup.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = rrdacup.PublicNetworkAccess - } - if rrdacup.EnableFreeTier != nil { - objectMap["enableFreeTier"] = rrdacup.EnableFreeTier - } - if rrdacup.APIProperties != nil { - objectMap["apiProperties"] = rrdacup.APIProperties - } - if rrdacup.EnableAnalyticalStorage != nil { - objectMap["enableAnalyticalStorage"] = rrdacup.EnableAnalyticalStorage - } - objectMap["backupPolicy"] = rrdacup.BackupPolicy - if rrdacup.Cors != nil { - objectMap["cors"] = rrdacup.Cors - } - if rrdacup.NetworkACLBypass != "" { - objectMap["networkAclBypass"] = rrdacup.NetworkACLBypass - } - if rrdacup.NetworkACLBypassResourceIds != nil { - objectMap["networkAclBypassResourceIds"] = rrdacup.NetworkACLBypassResourceIds - } - if rrdacup.CreateMode != "" { - objectMap["createMode"] = rrdacup.CreateMode - } - return json.Marshal(objectMap) -} - -// AsDefaultRequestDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) AsDefaultRequestDatabaseAccountCreateUpdateProperties() (*DefaultRequestDatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsRestoreReqeustDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) AsRestoreReqeustDatabaseAccountCreateUpdateProperties() (*RestoreReqeustDatabaseAccountCreateUpdateProperties, bool) { - return &rrdacup, true -} - -// AsDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) AsDatabaseAccountCreateUpdateProperties() (*DatabaseAccountCreateUpdateProperties, bool) { - return nil, false -} - -// AsBasicDatabaseAccountCreateUpdateProperties is the BasicDatabaseAccountCreateUpdateProperties implementation for RestoreReqeustDatabaseAccountCreateUpdateProperties. -func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) AsBasicDatabaseAccountCreateUpdateProperties() (BasicDatabaseAccountCreateUpdateProperties, bool) { - return &rrdacup, true -} - -// UnmarshalJSON is the custom unmarshaler for RestoreReqeustDatabaseAccountCreateUpdateProperties struct. -func (rrdacup *RestoreReqeustDatabaseAccountCreateUpdateProperties) 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 "restoreParameters": - if v != nil { - var restoreParameters RestoreParameters - err = json.Unmarshal(*v, &restoreParameters) - if err != nil { - return err - } - rrdacup.RestoreParameters = &restoreParameters - } - case "consistencyPolicy": - if v != nil { - var consistencyPolicy ConsistencyPolicy - err = json.Unmarshal(*v, &consistencyPolicy) - if err != nil { - return err - } - rrdacup.ConsistencyPolicy = &consistencyPolicy - } - case "locations": - if v != nil { - var locations []Location - err = json.Unmarshal(*v, &locations) - if err != nil { - return err - } - rrdacup.Locations = &locations - } - case "databaseAccountOfferType": - if v != nil { - var databaseAccountOfferType string - err = json.Unmarshal(*v, &databaseAccountOfferType) - if err != nil { - return err - } - rrdacup.DatabaseAccountOfferType = &databaseAccountOfferType - } - case "ipRules": - if v != nil { - var IPRules []IPAddressOrRange - err = json.Unmarshal(*v, &IPRules) - if err != nil { - return err - } - rrdacup.IPRules = &IPRules - } - case "isVirtualNetworkFilterEnabled": - if v != nil { - var isVirtualNetworkFilterEnabled bool - err = json.Unmarshal(*v, &isVirtualNetworkFilterEnabled) - if err != nil { - return err - } - rrdacup.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled - } - case "enableAutomaticFailover": - if v != nil { - var enableAutomaticFailover bool - err = json.Unmarshal(*v, &enableAutomaticFailover) - if err != nil { - return err - } - rrdacup.EnableAutomaticFailover = &enableAutomaticFailover - } - case "capabilities": - if v != nil { - var capabilities []Capability - err = json.Unmarshal(*v, &capabilities) - if err != nil { - return err - } - rrdacup.Capabilities = &capabilities - } - case "virtualNetworkRules": - if v != nil { - var virtualNetworkRules []VirtualNetworkRule - err = json.Unmarshal(*v, &virtualNetworkRules) - if err != nil { - return err - } - rrdacup.VirtualNetworkRules = &virtualNetworkRules - } - case "enableMultipleWriteLocations": - if v != nil { - var enableMultipleWriteLocations bool - err = json.Unmarshal(*v, &enableMultipleWriteLocations) - if err != nil { - return err - } - rrdacup.EnableMultipleWriteLocations = &enableMultipleWriteLocations - } - case "enableCassandraConnector": - if v != nil { - var enableCassandraConnector bool - err = json.Unmarshal(*v, &enableCassandraConnector) - if err != nil { - return err - } - rrdacup.EnableCassandraConnector = &enableCassandraConnector - } - case "connectorOffer": - if v != nil { - var connectorOffer ConnectorOffer - err = json.Unmarshal(*v, &connectorOffer) - if err != nil { - return err - } - rrdacup.ConnectorOffer = connectorOffer - } - case "disableKeyBasedMetadataWriteAccess": - if v != nil { - var disableKeyBasedMetadataWriteAccess bool - err = json.Unmarshal(*v, &disableKeyBasedMetadataWriteAccess) - if err != nil { - return err - } - rrdacup.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess - } - case "keyVaultKeyUri": - if v != nil { - var keyVaultKeyURI string - err = json.Unmarshal(*v, &keyVaultKeyURI) - if err != nil { - return err - } - rrdacup.KeyVaultKeyURI = &keyVaultKeyURI - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - rrdacup.PublicNetworkAccess = publicNetworkAccess - } - case "enableFreeTier": - if v != nil { - var enableFreeTier bool - err = json.Unmarshal(*v, &enableFreeTier) - if err != nil { - return err - } - rrdacup.EnableFreeTier = &enableFreeTier - } - case "apiProperties": - if v != nil { - var APIProperties APIProperties - err = json.Unmarshal(*v, &APIProperties) - if err != nil { - return err - } - rrdacup.APIProperties = &APIProperties - } - case "enableAnalyticalStorage": - if v != nil { - var enableAnalyticalStorage bool - err = json.Unmarshal(*v, &enableAnalyticalStorage) - if err != nil { - return err - } - rrdacup.EnableAnalyticalStorage = &enableAnalyticalStorage - } - case "backupPolicy": - if v != nil { - backupPolicy, err := unmarshalBasicBackupPolicy(*v) - if err != nil { - return err - } - rrdacup.BackupPolicy = backupPolicy - } - case "cors": - if v != nil { - var cors []CorsPolicy - err = json.Unmarshal(*v, &cors) - if err != nil { - return err - } - rrdacup.Cors = &cors - } - case "networkAclBypass": - if v != nil { - var networkACLBypass NetworkACLBypass - err = json.Unmarshal(*v, &networkACLBypass) - if err != nil { - return err - } - rrdacup.NetworkACLBypass = networkACLBypass - } - case "networkAclBypassResourceIds": - if v != nil { - var networkACLBypassResourceIds []string - err = json.Unmarshal(*v, &networkACLBypassResourceIds) - if err != nil { - return err - } - rrdacup.NetworkACLBypassResourceIds = &networkACLBypassResourceIds - } - case "createMode": - if v != nil { - var createMode CreateModeBasicDatabaseAccountCreateUpdateProperties - err = json.Unmarshal(*v, &createMode) - if err != nil { - return err - } - rrdacup.CreateMode = createMode - } - } - } - - return nil -} - -// SeedNode ... -type SeedNode struct { - // IPAddress - IP address of this seed node. - IPAddress *string `json:"ipAddress,omitempty"` -} - -// SpatialSpec ... -type SpatialSpec struct { - // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - Path *string `json:"path,omitempty"` - // Types - List of path's spatial type - Types *[]SpatialType `json:"types,omitempty"` -} - -// SQLContainerCreateUpdateParameters parameters to create and update Cosmos DB container. -type SQLContainerCreateUpdateParameters struct { - // SQLContainerCreateUpdateProperties - Properties to create and update Azure Cosmos DB container. - *SQLContainerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerCreateUpdateParameters. -func (sccup SQLContainerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sccup.SQLContainerCreateUpdateProperties != nil { - objectMap["properties"] = sccup.SQLContainerCreateUpdateProperties - } - if sccup.Location != nil { - objectMap["location"] = sccup.Location - } - if sccup.Tags != nil { - objectMap["tags"] = sccup.Tags - } - if sccup.Identity != nil { - objectMap["identity"] = sccup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerCreateUpdateParameters struct. -func (sccup *SQLContainerCreateUpdateParameters) 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 SQLContainerCreateUpdateProperties SQLContainerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLContainerCreateUpdateProperties) - if err != nil { - return err - } - sccup.SQLContainerCreateUpdateProperties = &SQLContainerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sccup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sccup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sccup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sccup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sccup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sccup.Identity = &identity - } - } - } - - return nil -} - -// SQLContainerCreateUpdateProperties properties to create and update Azure Cosmos DB container. -type SQLContainerCreateUpdateProperties struct { - // Resource - The standard JSON format of a container - Resource *SQLContainerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLContainerGetProperties the properties of an Azure Cosmos DB container -type SQLContainerGetProperties struct { - Resource *SQLContainerGetPropertiesResource `json:"resource,omitempty"` - Options *SQLContainerGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLContainerGetPropertiesOptions ... -type SQLContainerGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// SQLContainerGetPropertiesResource ... -type SQLContainerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int64 `json:"analyticalStorageTtl,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetPropertiesResource. -func (scgp SQLContainerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgp.ID != nil { - objectMap["id"] = scgp.ID - } - if scgp.IndexingPolicy != nil { - objectMap["indexingPolicy"] = scgp.IndexingPolicy - } - if scgp.PartitionKey != nil { - objectMap["partitionKey"] = scgp.PartitionKey - } - if scgp.DefaultTTL != nil { - objectMap["defaultTtl"] = scgp.DefaultTTL - } - if scgp.UniqueKeyPolicy != nil { - objectMap["uniqueKeyPolicy"] = scgp.UniqueKeyPolicy - } - if scgp.ConflictResolutionPolicy != nil { - objectMap["conflictResolutionPolicy"] = scgp.ConflictResolutionPolicy - } - if scgp.AnalyticalStorageTTL != nil { - objectMap["analyticalStorageTtl"] = scgp.AnalyticalStorageTTL - } - return json.Marshal(objectMap) -} - -// SQLContainerGetResults an Azure Cosmos DB container. -type SQLContainerGetResults struct { - autorest.Response `json:"-"` - // SQLContainerGetProperties - The properties of an Azure Cosmos DB container - *SQLContainerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerGetResults. -func (scgr SQLContainerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scgr.SQLContainerGetProperties != nil { - objectMap["properties"] = scgr.SQLContainerGetProperties - } - if scgr.Location != nil { - objectMap["location"] = scgr.Location - } - if scgr.Tags != nil { - objectMap["tags"] = scgr.Tags - } - if scgr.Identity != nil { - objectMap["identity"] = scgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLContainerGetResults struct. -func (scgr *SQLContainerGetResults) 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 SQLContainerGetProperties SQLContainerGetProperties - err = json.Unmarshal(*v, &SQLContainerGetProperties) - if err != nil { - return err - } - scgr.SQLContainerGetProperties = &SQLContainerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - scgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - scgr.Identity = &identity - } - } - } - - return nil -} - -// SQLContainerListResult the List operation response, that contains the containers and their properties. -type SQLContainerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of containers and their properties. - Value *[]SQLContainerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLContainerListResult. -func (sclr SQLContainerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLContainerResource cosmos DB SQL container resource object -type SQLContainerResource struct { - // ID - Name of the Cosmos DB SQL container - ID *string `json:"id,omitempty"` - // IndexingPolicy - The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - IndexingPolicy *IndexingPolicy `json:"indexingPolicy,omitempty"` - // PartitionKey - The configuration of the partition key to be used for partitioning data into multiple partitions - PartitionKey *ContainerPartitionKey `json:"partitionKey,omitempty"` - // DefaultTTL - Default time to live - DefaultTTL *int32 `json:"defaultTtl,omitempty"` - // UniqueKeyPolicy - The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - UniqueKeyPolicy *UniqueKeyPolicy `json:"uniqueKeyPolicy,omitempty"` - // ConflictResolutionPolicy - The conflict resolution policy for the container. - ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // AnalyticalStorageTTL - Analytical TTL. - AnalyticalStorageTTL *int64 `json:"analyticalStorageTtl,omitempty"` -} - -// SQLDatabaseCreateUpdateParameters parameters to create and update Cosmos DB SQL database. -type SQLDatabaseCreateUpdateParameters struct { - // SQLDatabaseCreateUpdateProperties - Properties to create and update Azure Cosmos DB SQL database. - *SQLDatabaseCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseCreateUpdateParameters. -func (sdcup SQLDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdcup.SQLDatabaseCreateUpdateProperties != nil { - objectMap["properties"] = sdcup.SQLDatabaseCreateUpdateProperties - } - if sdcup.Location != nil { - objectMap["location"] = sdcup.Location - } - if sdcup.Tags != nil { - objectMap["tags"] = sdcup.Tags - } - if sdcup.Identity != nil { - objectMap["identity"] = sdcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseCreateUpdateParameters struct. -func (sdcup *SQLDatabaseCreateUpdateParameters) 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 SQLDatabaseCreateUpdateProperties SQLDatabaseCreateUpdateProperties - err = json.Unmarshal(*v, &SQLDatabaseCreateUpdateProperties) - if err != nil { - return err - } - sdcup.SQLDatabaseCreateUpdateProperties = &SQLDatabaseCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sdcup.Identity = &identity - } - } - } - - return nil -} - -// SQLDatabaseCreateUpdateProperties properties to create and update Azure Cosmos DB SQL database. -type SQLDatabaseCreateUpdateProperties struct { - // Resource - The standard JSON format of a SQL database - Resource *SQLDatabaseResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetProperties the properties of an Azure Cosmos DB SQL database -type SQLDatabaseGetProperties struct { - Resource *SQLDatabaseGetPropertiesResource `json:"resource,omitempty"` - Options *SQLDatabaseGetPropertiesOptions `json:"options,omitempty"` -} - -// SQLDatabaseGetPropertiesOptions ... -type SQLDatabaseGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// SQLDatabaseGetPropertiesResource ... -type SQLDatabaseGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` - // Colls - A system generated property that specified the addressable path of the collections resource. - Colls *string `json:"_colls,omitempty"` - // Users - A system generated property that specifies the addressable path of the users resource. - Users *string `json:"_users,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetPropertiesResource. -func (sdgp SQLDatabaseGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgp.ID != nil { - objectMap["id"] = sdgp.ID - } - if sdgp.Colls != nil { - objectMap["_colls"] = sdgp.Colls - } - if sdgp.Users != nil { - objectMap["_users"] = sdgp.Users - } - return json.Marshal(objectMap) -} - -// SQLDatabaseGetResults an Azure Cosmos DB SQL database. -type SQLDatabaseGetResults struct { - autorest.Response `json:"-"` - // SQLDatabaseGetProperties - The properties of an Azure Cosmos DB SQL database - *SQLDatabaseGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseGetResults. -func (sdgr SQLDatabaseGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdgr.SQLDatabaseGetProperties != nil { - objectMap["properties"] = sdgr.SQLDatabaseGetProperties - } - if sdgr.Location != nil { - objectMap["location"] = sdgr.Location - } - if sdgr.Tags != nil { - objectMap["tags"] = sdgr.Tags - } - if sdgr.Identity != nil { - objectMap["identity"] = sdgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLDatabaseGetResults struct. -func (sdgr *SQLDatabaseGetResults) 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 SQLDatabaseGetProperties SQLDatabaseGetProperties - err = json.Unmarshal(*v, &SQLDatabaseGetProperties) - if err != nil { - return err - } - sdgr.SQLDatabaseGetProperties = &SQLDatabaseGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sdgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sdgr.Identity = &identity - } - } - } - - return nil -} - -// SQLDatabaseListResult the List operation response, that contains the SQL databases and their properties. -type SQLDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of SQL databases and their properties. - Value *[]SQLDatabaseGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDatabaseListResult. -func (sdlr SQLDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLDatabaseResource cosmos DB SQL database resource object -type SQLDatabaseResource struct { - // ID - Name of the Cosmos DB SQL database - ID *string `json:"id,omitempty"` -} - -// SQLResourcesCreateUpdateSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLContainerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) 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 SQLResourcesCreateUpdateSQLContainerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLContainerFuture) result(client SQLResourcesClient) (scgr SQLContainerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - scgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLContainerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if scgr.Response.Response, err = future.GetResult(sender); err == nil && scgr.Response.Response.StatusCode != http.StatusNoContent { - scgr, err = client.CreateUpdateSQLContainerResponder(scgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLContainerFuture", "Result", scgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLDatabaseGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) 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 SQLResourcesCreateUpdateSQLDatabaseFuture.Result. -func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) result(client SQLResourcesClient) (sdgr SQLDatabaseGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sdgr.Response.Response, err = future.GetResult(sender); err == nil && sdgr.Response.Response.StatusCode != http.StatusNoContent { - sdgr, err = client.CreateUpdateSQLDatabaseResponder(sdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture", "Result", sdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLRoleAssignmentFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesCreateUpdateSQLRoleAssignmentFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLRoleAssignmentGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLRoleAssignmentFuture) 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 SQLResourcesCreateUpdateSQLRoleAssignmentFuture.Result. -func (future *SQLResourcesCreateUpdateSQLRoleAssignmentFuture) result(client SQLResourcesClient) (sragr SQLRoleAssignmentGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sragr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sragr.Response.Response, err = future.GetResult(sender); err == nil && sragr.Response.Response.StatusCode != http.StatusNoContent { - sragr, err = client.CreateUpdateSQLRoleAssignmentResponder(sragr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture", "Result", sragr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLRoleDefinitionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesCreateUpdateSQLRoleDefinitionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLRoleDefinitionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLRoleDefinitionFuture) 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 SQLResourcesCreateUpdateSQLRoleDefinitionFuture.Result. -func (future *SQLResourcesCreateUpdateSQLRoleDefinitionFuture) result(client SQLResourcesClient) (srdgr SQLRoleDefinitionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - srdgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if srdgr.Response.Response, err = future.GetResult(sender); err == nil && srdgr.Response.Response.StatusCode != http.StatusNoContent { - srdgr, err = client.CreateUpdateSQLRoleDefinitionResponder(srdgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture", "Result", srdgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLStoredProcedureFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLStoredProcedureGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) 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 SQLResourcesCreateUpdateSQLStoredProcedureFuture.Result. -func (future *SQLResourcesCreateUpdateSQLStoredProcedureFuture) result(client SQLResourcesClient) (sspgr SQLStoredProcedureGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sspgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sspgr.Response.Response, err = future.GetResult(sender); err == nil && sspgr.Response.Response.StatusCode != http.StatusNoContent { - sspgr, err = client.CreateUpdateSQLStoredProcedureResponder(sspgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture", "Result", sspgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesCreateUpdateSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLTriggerGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) 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 SQLResourcesCreateUpdateSQLTriggerFuture.Result. -func (future *SQLResourcesCreateUpdateSQLTriggerFuture) result(client SQLResourcesClient) (stgr SQLTriggerGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - stgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLTriggerFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if stgr.Response.Response, err = future.GetResult(sender); err == nil && stgr.Response.Response.StatusCode != http.StatusNoContent { - stgr, err = client.CreateUpdateSQLTriggerResponder(stgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLTriggerFuture", "Result", stgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (SQLUserDefinedFunctionGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) 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 SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (sudfgr SQLUserDefinedFunctionGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sudfgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sudfgr.Response.Response, err = future.GetResult(sender); err == nil && sudfgr.Response.Response.StatusCode != http.StatusNoContent { - sudfgr, err = client.CreateUpdateSQLUserDefinedFunctionResponder(sudfgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture", "Result", sudfgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesDeleteSQLContainerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLContainerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLContainerFuture) 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 SQLResourcesDeleteSQLContainerFuture.Result. -func (future *SQLResourcesDeleteSQLContainerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLContainerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLContainerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLDatabaseFuture) 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 SQLResourcesDeleteSQLDatabaseFuture.Result. -func (future *SQLResourcesDeleteSQLDatabaseFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLDatabaseFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLRoleAssignmentFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLRoleAssignmentFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLRoleAssignmentFuture) 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 SQLResourcesDeleteSQLRoleAssignmentFuture.Result. -func (future *SQLResourcesDeleteSQLRoleAssignmentFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLRoleAssignmentFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLRoleAssignmentFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLRoleDefinitionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLRoleDefinitionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLRoleDefinitionFuture) 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 SQLResourcesDeleteSQLRoleDefinitionFuture.Result. -func (future *SQLResourcesDeleteSQLRoleDefinitionFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLRoleDefinitionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLRoleDefinitionFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLStoredProcedureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLStoredProcedureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) 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 SQLResourcesDeleteSQLStoredProcedureFuture.Result. -func (future *SQLResourcesDeleteSQLStoredProcedureFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLStoredProcedureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLStoredProcedureFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLTriggerFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLResourcesDeleteSQLTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLTriggerFuture) 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 SQLResourcesDeleteSQLTriggerFuture.Result. -func (future *SQLResourcesDeleteSQLTriggerFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLTriggerFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesDeleteSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesDeleteSQLUserDefinedFunctionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) 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 SQLResourcesDeleteSQLUserDefinedFunctionFuture.Result. -func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) result(client SQLResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLResourcesMigrateSQLContainerToAutoscaleFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLContainerToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLContainerToAutoscaleFuture) 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 SQLResourcesMigrateSQLContainerToAutoscaleFuture.Result. -func (future *SQLResourcesMigrateSQLContainerToAutoscaleFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLContainerToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLContainerToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLContainerToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLContainerToManualThroughputFuture) 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 SQLResourcesMigrateSQLContainerToManualThroughputFuture.Result. -func (future *SQLResourcesMigrateSQLContainerToManualThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLContainerToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLContainerToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLDatabaseToAutoscaleFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesMigrateSQLDatabaseToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLDatabaseToAutoscaleFuture) 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 SQLResourcesMigrateSQLDatabaseToAutoscaleFuture.Result. -func (future *SQLResourcesMigrateSQLDatabaseToAutoscaleFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLDatabaseToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesMigrateSQLDatabaseToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLResourcesMigrateSQLDatabaseToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesMigrateSQLDatabaseToManualThroughputFuture) 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 SQLResourcesMigrateSQLDatabaseToManualThroughputFuture.Result. -func (future *SQLResourcesMigrateSQLDatabaseToManualThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateSQLDatabaseToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesMigrateSQLDatabaseToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLContainerThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLContainerThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) 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 SQLResourcesUpdateSQLContainerThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLContainerThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLContainerThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLContainerThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLContainerThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLResourcesUpdateSQLDatabaseThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLResourcesUpdateSQLDatabaseThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) 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 SQLResourcesUpdateSQLDatabaseThroughputFuture.Result. -func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) result(client SQLResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateSQLDatabaseThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesUpdateSQLDatabaseThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLRoleAssignmentCreateUpdateParameters parameters to create and update an Azure Cosmos DB SQL Role -// Assignment. -type SQLRoleAssignmentCreateUpdateParameters struct { - // SQLRoleAssignmentResource - Properties to create and update an Azure Cosmos DB SQL Role Assignment. - *SQLRoleAssignmentResource `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleAssignmentCreateUpdateParameters. -func (sracup SQLRoleAssignmentCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sracup.SQLRoleAssignmentResource != nil { - objectMap["properties"] = sracup.SQLRoleAssignmentResource - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLRoleAssignmentCreateUpdateParameters struct. -func (sracup *SQLRoleAssignmentCreateUpdateParameters) 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 SQLRoleAssignmentResource SQLRoleAssignmentResource - err = json.Unmarshal(*v, &SQLRoleAssignmentResource) - if err != nil { - return err - } - sracup.SQLRoleAssignmentResource = &SQLRoleAssignmentResource - } - } - } - - return nil -} - -// SQLRoleAssignmentGetResults an Azure Cosmos DB Role Assignment -type SQLRoleAssignmentGetResults struct { - autorest.Response `json:"-"` - // SQLRoleAssignmentResource - Properties related to the Role Assignment. - *SQLRoleAssignmentResource `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleAssignmentGetResults. -func (sragr SQLRoleAssignmentGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sragr.SQLRoleAssignmentResource != nil { - objectMap["properties"] = sragr.SQLRoleAssignmentResource - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLRoleAssignmentGetResults struct. -func (sragr *SQLRoleAssignmentGetResults) 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 SQLRoleAssignmentResource SQLRoleAssignmentResource - err = json.Unmarshal(*v, &SQLRoleAssignmentResource) - if err != nil { - return err - } - sragr.SQLRoleAssignmentResource = &SQLRoleAssignmentResource - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sragr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sragr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sragr.Type = &typeVar - } - } - } - - return nil -} - -// SQLRoleAssignmentListResult the relevant Role Assignments. -type SQLRoleAssignmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Role Assignments and their properties - Value *[]SQLRoleAssignmentGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleAssignmentListResult. -func (sralr SQLRoleAssignmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLRoleAssignmentResource azure Cosmos DB SQL Role Assignment resource object. -type SQLRoleAssignmentResource struct { - // RoleDefinitionID - The unique identifier for the associated Role Definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - // Scope - The data plane resource path for which access is being granted through this Role Assignment. - Scope *string `json:"scope,omitempty"` - // PrincipalID - The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription. - PrincipalID *string `json:"principalId,omitempty"` -} - -// SQLRoleDefinitionCreateUpdateParameters parameters to create and update an Azure Cosmos DB SQL Role -// Definition. -type SQLRoleDefinitionCreateUpdateParameters struct { - // SQLRoleDefinitionResource - Properties to create and update an Azure Cosmos DB SQL Role Definition. - *SQLRoleDefinitionResource `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleDefinitionCreateUpdateParameters. -func (srdcup SQLRoleDefinitionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srdcup.SQLRoleDefinitionResource != nil { - objectMap["properties"] = srdcup.SQLRoleDefinitionResource - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLRoleDefinitionCreateUpdateParameters struct. -func (srdcup *SQLRoleDefinitionCreateUpdateParameters) 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 SQLRoleDefinitionResource SQLRoleDefinitionResource - err = json.Unmarshal(*v, &SQLRoleDefinitionResource) - if err != nil { - return err - } - srdcup.SQLRoleDefinitionResource = &SQLRoleDefinitionResource - } - } - } - - return nil -} - -// SQLRoleDefinitionGetResults an Azure Cosmos DB SQL Role Definition. -type SQLRoleDefinitionGetResults struct { - autorest.Response `json:"-"` - // SQLRoleDefinitionResource - Properties related to the Role Definition. - *SQLRoleDefinitionResource `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the database account. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the database account. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleDefinitionGetResults. -func (srdgr SQLRoleDefinitionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srdgr.SQLRoleDefinitionResource != nil { - objectMap["properties"] = srdgr.SQLRoleDefinitionResource - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLRoleDefinitionGetResults struct. -func (srdgr *SQLRoleDefinitionGetResults) 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 SQLRoleDefinitionResource SQLRoleDefinitionResource - err = json.Unmarshal(*v, &SQLRoleDefinitionResource) - if err != nil { - return err - } - srdgr.SQLRoleDefinitionResource = &SQLRoleDefinitionResource - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - srdgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - srdgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - srdgr.Type = &typeVar - } - } - } - - return nil -} - -// SQLRoleDefinitionListResult the relevant Role Definitions. -type SQLRoleDefinitionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Role Definitions and their properties. - Value *[]SQLRoleDefinitionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLRoleDefinitionListResult. -func (srdlr SQLRoleDefinitionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLRoleDefinitionResource azure Cosmos DB SQL Role Definition resource object. -type SQLRoleDefinitionResource struct { - // RoleName - A user-friendly name for the Role Definition. Must be unique for the database account. - RoleName *string `json:"roleName,omitempty"` - // Type - Indicates whether the Role Definition was built-in or user created. Possible values include: 'RoleDefinitionTypeBuiltInRole', 'RoleDefinitionTypeCustomRole' - Type RoleDefinitionType `json:"type,omitempty"` - // AssignableScopes - A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not exist. - AssignableScopes *[]string `json:"assignableScopes,omitempty"` - // Permissions - The set of operations allowed through this Role Definition. - Permissions *[]Permission `json:"permissions,omitempty"` -} - -// SQLStoredProcedureCreateUpdateParameters parameters to create and update Cosmos DB storedProcedure. -type SQLStoredProcedureCreateUpdateParameters struct { - // SQLStoredProcedureCreateUpdateProperties - Properties to create and update Azure Cosmos DB storedProcedure. - *SQLStoredProcedureCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureCreateUpdateParameters. -func (sspcup SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspcup.SQLStoredProcedureCreateUpdateProperties != nil { - objectMap["properties"] = sspcup.SQLStoredProcedureCreateUpdateProperties - } - if sspcup.Location != nil { - objectMap["location"] = sspcup.Location - } - if sspcup.Tags != nil { - objectMap["tags"] = sspcup.Tags - } - if sspcup.Identity != nil { - objectMap["identity"] = sspcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureCreateUpdateParameters struct. -func (sspcup *SQLStoredProcedureCreateUpdateParameters) 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 SQLStoredProcedureCreateUpdateProperties SQLStoredProcedureCreateUpdateProperties - err = json.Unmarshal(*v, &SQLStoredProcedureCreateUpdateProperties) - if err != nil { - return err - } - sspcup.SQLStoredProcedureCreateUpdateProperties = &SQLStoredProcedureCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sspcup.Identity = &identity - } - } - } - - return nil -} - -// SQLStoredProcedureCreateUpdateProperties properties to create and update Azure Cosmos DB -// storedProcedure. -type SQLStoredProcedureCreateUpdateProperties struct { - // Resource - The standard JSON format of a storedProcedure - Resource *SQLStoredProcedureResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLStoredProcedureGetProperties the properties of an Azure Cosmos DB StoredProcedure -type SQLStoredProcedureGetProperties struct { - Resource *SQLStoredProcedureGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLStoredProcedureGetPropertiesResource ... -type SQLStoredProcedureGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetPropertiesResource. -func (sspgp SQLStoredProcedureGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgp.ID != nil { - objectMap["id"] = sspgp.ID - } - if sspgp.Body != nil { - objectMap["body"] = sspgp.Body - } - return json.Marshal(objectMap) -} - -// SQLStoredProcedureGetResults an Azure Cosmos DB storedProcedure. -type SQLStoredProcedureGetResults struct { - autorest.Response `json:"-"` - // SQLStoredProcedureGetProperties - The properties of an Azure Cosmos DB storedProcedure - *SQLStoredProcedureGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureGetResults. -func (sspgr SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sspgr.SQLStoredProcedureGetProperties != nil { - objectMap["properties"] = sspgr.SQLStoredProcedureGetProperties - } - if sspgr.Location != nil { - objectMap["location"] = sspgr.Location - } - if sspgr.Tags != nil { - objectMap["tags"] = sspgr.Tags - } - if sspgr.Identity != nil { - objectMap["identity"] = sspgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLStoredProcedureGetResults struct. -func (sspgr *SQLStoredProcedureGetResults) 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 SQLStoredProcedureGetProperties SQLStoredProcedureGetProperties - err = json.Unmarshal(*v, &SQLStoredProcedureGetProperties) - if err != nil { - return err - } - sspgr.SQLStoredProcedureGetProperties = &SQLStoredProcedureGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sspgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sspgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sspgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sspgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sspgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sspgr.Identity = &identity - } - } - } - - return nil -} - -// SQLStoredProcedureListResult the List operation response, that contains the storedProcedures and their -// properties. -type SQLStoredProcedureListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of storedProcedures and their properties. - Value *[]SQLStoredProcedureGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLStoredProcedureListResult. -func (ssplr SQLStoredProcedureListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLStoredProcedureResource cosmos DB SQL storedProcedure resource object -type SQLStoredProcedureResource struct { - // ID - Name of the Cosmos DB SQL storedProcedure - ID *string `json:"id,omitempty"` - // Body - Body of the Stored Procedure - Body *string `json:"body,omitempty"` -} - -// SQLTriggerCreateUpdateParameters parameters to create and update Cosmos DB trigger. -type SQLTriggerCreateUpdateParameters struct { - // SQLTriggerCreateUpdateProperties - Properties to create and update Azure Cosmos DB trigger. - *SQLTriggerCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerCreateUpdateParameters. -func (stcup SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stcup.SQLTriggerCreateUpdateProperties != nil { - objectMap["properties"] = stcup.SQLTriggerCreateUpdateProperties - } - if stcup.Location != nil { - objectMap["location"] = stcup.Location - } - if stcup.Tags != nil { - objectMap["tags"] = stcup.Tags - } - if stcup.Identity != nil { - objectMap["identity"] = stcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerCreateUpdateParameters struct. -func (stcup *SQLTriggerCreateUpdateParameters) 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 SQLTriggerCreateUpdateProperties SQLTriggerCreateUpdateProperties - err = json.Unmarshal(*v, &SQLTriggerCreateUpdateProperties) - if err != nil { - return err - } - stcup.SQLTriggerCreateUpdateProperties = &SQLTriggerCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - stcup.Identity = &identity - } - } - } - - return nil -} - -// SQLTriggerCreateUpdateProperties properties to create and update Azure Cosmos DB trigger. -type SQLTriggerCreateUpdateProperties struct { - // Resource - The standard JSON format of a trigger - Resource *SQLTriggerResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLTriggerGetProperties the properties of an Azure Cosmos DB trigger -type SQLTriggerGetProperties struct { - Resource *SQLTriggerGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLTriggerGetPropertiesResource ... -type SQLTriggerGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'TriggerTypePre', 'TriggerTypePost' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'TriggerOperationAll', 'TriggerOperationCreate', 'TriggerOperationUpdate', 'TriggerOperationDelete', 'TriggerOperationReplace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetPropertiesResource. -func (stgp SQLTriggerGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgp.ID != nil { - objectMap["id"] = stgp.ID - } - if stgp.Body != nil { - objectMap["body"] = stgp.Body - } - if stgp.TriggerType != "" { - objectMap["triggerType"] = stgp.TriggerType - } - if stgp.TriggerOperation != "" { - objectMap["triggerOperation"] = stgp.TriggerOperation - } - return json.Marshal(objectMap) -} - -// SQLTriggerGetResults an Azure Cosmos DB trigger. -type SQLTriggerGetResults struct { - autorest.Response `json:"-"` - // SQLTriggerGetProperties - The properties of an Azure Cosmos DB trigger - *SQLTriggerGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerGetResults. -func (stgr SQLTriggerGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stgr.SQLTriggerGetProperties != nil { - objectMap["properties"] = stgr.SQLTriggerGetProperties - } - if stgr.Location != nil { - objectMap["location"] = stgr.Location - } - if stgr.Tags != nil { - objectMap["tags"] = stgr.Tags - } - if stgr.Identity != nil { - objectMap["identity"] = stgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLTriggerGetResults struct. -func (stgr *SQLTriggerGetResults) 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 SQLTriggerGetProperties SQLTriggerGetProperties - err = json.Unmarshal(*v, &SQLTriggerGetProperties) - if err != nil { - return err - } - stgr.SQLTriggerGetProperties = &SQLTriggerGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - stgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - stgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - stgr.Identity = &identity - } - } - } - - return nil -} - -// SQLTriggerListResult the List operation response, that contains the triggers and their properties. -type SQLTriggerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of triggers and their properties. - Value *[]SQLTriggerGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLTriggerListResult. -func (stlr SQLTriggerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLTriggerResource cosmos DB SQL trigger resource object -type SQLTriggerResource struct { - // ID - Name of the Cosmos DB SQL trigger - ID *string `json:"id,omitempty"` - // Body - Body of the Trigger - Body *string `json:"body,omitempty"` - // TriggerType - Type of the Trigger. Possible values include: 'TriggerTypePre', 'TriggerTypePost' - TriggerType TriggerType `json:"triggerType,omitempty"` - // TriggerOperation - The operation the trigger is associated with. Possible values include: 'TriggerOperationAll', 'TriggerOperationCreate', 'TriggerOperationUpdate', 'TriggerOperationDelete', 'TriggerOperationReplace' - TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` -} - -// SQLUserDefinedFunctionCreateUpdateParameters parameters to create and update Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateParameters struct { - // SQLUserDefinedFunctionCreateUpdateProperties - Properties to create and update Azure Cosmos DB userDefinedFunction. - *SQLUserDefinedFunctionCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionCreateUpdateParameters. -func (sudfcup SQLUserDefinedFunctionCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfcup.SQLUserDefinedFunctionCreateUpdateProperties != nil { - objectMap["properties"] = sudfcup.SQLUserDefinedFunctionCreateUpdateProperties - } - if sudfcup.Location != nil { - objectMap["location"] = sudfcup.Location - } - if sudfcup.Tags != nil { - objectMap["tags"] = sudfcup.Tags - } - if sudfcup.Identity != nil { - objectMap["identity"] = sudfcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionCreateUpdateParameters struct. -func (sudfcup *SQLUserDefinedFunctionCreateUpdateParameters) 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 SQLUserDefinedFunctionCreateUpdateProperties SQLUserDefinedFunctionCreateUpdateProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionCreateUpdateProperties) - if err != nil { - return err - } - sudfcup.SQLUserDefinedFunctionCreateUpdateProperties = &SQLUserDefinedFunctionCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sudfcup.Identity = &identity - } - } - } - - return nil -} - -// SQLUserDefinedFunctionCreateUpdateProperties properties to create and update Azure Cosmos DB -// userDefinedFunction. -type SQLUserDefinedFunctionCreateUpdateProperties struct { - // Resource - The standard JSON format of a userDefinedFunction - Resource *SQLUserDefinedFunctionResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// SQLUserDefinedFunctionGetProperties the properties of an Azure Cosmos DB userDefinedFunction -type SQLUserDefinedFunctionGetProperties struct { - Resource *SQLUserDefinedFunctionGetPropertiesResource `json:"resource,omitempty"` -} - -// SQLUserDefinedFunctionGetPropertiesResource ... -type SQLUserDefinedFunctionGetPropertiesResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetPropertiesResource. -func (sudfgp SQLUserDefinedFunctionGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgp.ID != nil { - objectMap["id"] = sudfgp.ID - } - if sudfgp.Body != nil { - objectMap["body"] = sudfgp.Body - } - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionGetResults an Azure Cosmos DB userDefinedFunction. -type SQLUserDefinedFunctionGetResults struct { - autorest.Response `json:"-"` - // SQLUserDefinedFunctionGetProperties - The properties of an Azure Cosmos DB userDefinedFunction - *SQLUserDefinedFunctionGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionGetResults. -func (sudfgr SQLUserDefinedFunctionGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sudfgr.SQLUserDefinedFunctionGetProperties != nil { - objectMap["properties"] = sudfgr.SQLUserDefinedFunctionGetProperties - } - if sudfgr.Location != nil { - objectMap["location"] = sudfgr.Location - } - if sudfgr.Tags != nil { - objectMap["tags"] = sudfgr.Tags - } - if sudfgr.Identity != nil { - objectMap["identity"] = sudfgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLUserDefinedFunctionGetResults struct. -func (sudfgr *SQLUserDefinedFunctionGetResults) 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 SQLUserDefinedFunctionGetProperties SQLUserDefinedFunctionGetProperties - err = json.Unmarshal(*v, &SQLUserDefinedFunctionGetProperties) - if err != nil { - return err - } - sudfgr.SQLUserDefinedFunctionGetProperties = &SQLUserDefinedFunctionGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sudfgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sudfgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sudfgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sudfgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sudfgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sudfgr.Identity = &identity - } - } - } - - return nil -} - -// SQLUserDefinedFunctionListResult the List operation response, that contains the userDefinedFunctions and -// their properties. -type SQLUserDefinedFunctionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of userDefinedFunctions and their properties. - Value *[]SQLUserDefinedFunctionGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLUserDefinedFunctionListResult. -func (sudflr SQLUserDefinedFunctionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLUserDefinedFunctionResource cosmos DB SQL userDefinedFunction resource object -type SQLUserDefinedFunctionResource struct { - // ID - Name of the Cosmos DB SQL userDefinedFunction - ID *string `json:"id,omitempty"` - // Body - Body of the User Defined Function - Body *string `json:"body,omitempty"` -} - -// 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"` -} - -// TableCreateUpdateParameters parameters to create and update Cosmos DB Table. -type TableCreateUpdateParameters struct { - // TableCreateUpdateProperties - Properties to create and update Azure Cosmos DB Table. - *TableCreateUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableCreateUpdateParameters. -func (tcup TableCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tcup.TableCreateUpdateProperties != nil { - objectMap["properties"] = tcup.TableCreateUpdateProperties - } - if tcup.Location != nil { - objectMap["location"] = tcup.Location - } - if tcup.Tags != nil { - objectMap["tags"] = tcup.Tags - } - if tcup.Identity != nil { - objectMap["identity"] = tcup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableCreateUpdateParameters struct. -func (tcup *TableCreateUpdateParameters) 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 tableCreateUpdateProperties TableCreateUpdateProperties - err = json.Unmarshal(*v, &tableCreateUpdateProperties) - if err != nil { - return err - } - tcup.TableCreateUpdateProperties = &tableCreateUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tcup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tcup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tcup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tcup.Identity = &identity - } - } - } - - return nil -} - -// TableCreateUpdateProperties properties to create and update Azure Cosmos DB Table. -type TableCreateUpdateProperties struct { - // Resource - The standard JSON format of a Table - Resource *TableResource `json:"resource,omitempty"` - // Options - A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// TableGetProperties the properties of an Azure Cosmos Table -type TableGetProperties struct { - Resource *TableGetPropertiesResource `json:"resource,omitempty"` - Options *TableGetPropertiesOptions `json:"options,omitempty"` -} - -// TableGetPropertiesOptions ... -type TableGetPropertiesOptions struct { - // Throughput - Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Specifies the Autoscale settings. - AutoscaleSettings *AutoscaleSettings `json:"autoscaleSettings,omitempty"` -} - -// TableGetPropertiesResource ... -type TableGetPropertiesResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableGetPropertiesResource. -func (tgp TableGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgp.ID != nil { - objectMap["id"] = tgp.ID - } - return json.Marshal(objectMap) -} - -// TableGetResults an Azure Cosmos DB Table. -type TableGetResults struct { - autorest.Response `json:"-"` - // TableGetProperties - The properties of an Azure Cosmos DB Table - *TableGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableGetResults. -func (tgr TableGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tgr.TableGetProperties != nil { - objectMap["properties"] = tgr.TableGetProperties - } - if tgr.Location != nil { - objectMap["location"] = tgr.Location - } - if tgr.Tags != nil { - objectMap["tags"] = tgr.Tags - } - if tgr.Identity != nil { - objectMap["identity"] = tgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableGetResults struct. -func (tgr *TableGetResults) 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 tableGetProperties TableGetProperties - err = json.Unmarshal(*v, &tableGetProperties) - if err != nil { - return err - } - tgr.TableGetProperties = &tableGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tgr.Identity = &identity - } - } - } - - return nil -} - -// TableListResult the List operation response, that contains the Table and their properties. -type TableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Table and their properties. - Value *[]TableGetResults `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableListResult. -func (tlr TableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TableResource cosmos DB table resource object -type TableResource struct { - // ID - Name of the Cosmos DB table - ID *string `json:"id,omitempty"` -} - -// TableResourcesCreateUpdateTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesCreateUpdateTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (TableGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesCreateUpdateTableFuture) 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 TableResourcesCreateUpdateTableFuture.Result. -func (future *TableResourcesCreateUpdateTableFuture) result(client TableResourcesClient) (tgr TableGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesCreateUpdateTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tgr.Response.Response, err = future.GetResult(sender); err == nil && tgr.Response.Response.StatusCode != http.StatusNoContent { - tgr, err = client.CreateUpdateTableResponder(tgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesCreateUpdateTableFuture", "Result", tgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesDeleteTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesDeleteTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesDeleteTableFuture) 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 TableResourcesDeleteTableFuture.Result. -func (future *TableResourcesDeleteTableFuture) result(client TableResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesDeleteTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesDeleteTableFuture") - return - } - ar.Response = future.Response() - return -} - -// TableResourcesMigrateTableToAutoscaleFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type TableResourcesMigrateTableToAutoscaleFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesMigrateTableToAutoscaleFuture) 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 TableResourcesMigrateTableToAutoscaleFuture.Result. -func (future *TableResourcesMigrateTableToAutoscaleFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToAutoscaleFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesMigrateTableToAutoscaleFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateTableToAutoscaleResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToAutoscaleFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesMigrateTableToManualThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type TableResourcesMigrateTableToManualThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesMigrateTableToManualThroughputFuture) 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 TableResourcesMigrateTableToManualThroughputFuture.Result. -func (future *TableResourcesMigrateTableToManualThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToManualThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesMigrateTableToManualThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.MigrateTableToManualThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesMigrateTableToManualThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// TableResourcesUpdateTableThroughputFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type TableResourcesUpdateTableThroughputFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TableResourcesClient) (ThroughputSettingsGetResults, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TableResourcesUpdateTableThroughputFuture) 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 TableResourcesUpdateTableThroughputFuture.Result. -func (future *TableResourcesUpdateTableThroughputFuture) result(client TableResourcesClient) (tsgr ThroughputSettingsGetResults, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsgr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("documentdb.TableResourcesUpdateTableThroughputFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsgr.Response.Response, err = future.GetResult(sender); err == nil && tsgr.Response.Response.StatusCode != http.StatusNoContent { - tsgr, err = client.UpdateTableThroughputResponder(tsgr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesUpdateTableThroughputFuture", "Result", tsgr.Response.Response, "Failure responding to request") - } - } - return -} - -// ThroughputPolicyResource cosmos DB resource throughput policy -type ThroughputPolicyResource struct { - // IsEnabled - Determines whether the ThroughputPolicy is active or not - IsEnabled *bool `json:"isEnabled,omitempty"` - // IncrementPercent - Represents the percentage by which throughput can increase every time throughput policy kicks in. - IncrementPercent *int32 `json:"incrementPercent,omitempty"` -} - -// ThroughputSettingsGetProperties the properties of an Azure Cosmos DB resource throughput -type ThroughputSettingsGetProperties struct { - Resource *ThroughputSettingsGetPropertiesResource `json:"resource,omitempty"` -} - -// ThroughputSettingsGetPropertiesResource ... -type ThroughputSettingsGetPropertiesResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. - AutoscaleSettings *AutoscaleSettingsResource `json:"autoscaleSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` - // Rid - READ-ONLY; A system generated property. A unique identifier. - Rid *string `json:"_rid,omitempty"` - // Ts - READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. - Ts *float64 `json:"_ts,omitempty"` - // Etag - READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. - Etag *string `json:"_etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetPropertiesResource. -func (tsgp ThroughputSettingsGetPropertiesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgp.Throughput != nil { - objectMap["throughput"] = tsgp.Throughput - } - if tsgp.AutoscaleSettings != nil { - objectMap["autoscaleSettings"] = tsgp.AutoscaleSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsGetResults an Azure Cosmos DB resource throughput. -type ThroughputSettingsGetResults struct { - autorest.Response `json:"-"` - // ThroughputSettingsGetProperties - The properties of an Azure Cosmos DB resource throughput - *ThroughputSettingsGetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsGetResults. -func (tsgr ThroughputSettingsGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsgr.ThroughputSettingsGetProperties != nil { - objectMap["properties"] = tsgr.ThroughputSettingsGetProperties - } - if tsgr.Location != nil { - objectMap["location"] = tsgr.Location - } - if tsgr.Tags != nil { - objectMap["tags"] = tsgr.Tags - } - if tsgr.Identity != nil { - objectMap["identity"] = tsgr.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsGetResults struct. -func (tsgr *ThroughputSettingsGetResults) 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 throughputSettingsGetProperties ThroughputSettingsGetProperties - err = json.Unmarshal(*v, &throughputSettingsGetProperties) - if err != nil { - return err - } - tsgr.ThroughputSettingsGetProperties = &throughputSettingsGetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsgr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsgr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsgr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsgr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsgr.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tsgr.Identity = &identity - } - } - } - - return nil -} - -// ThroughputSettingsResource cosmos DB resource throughput object. Either throughput is required or -// autoscaleSettings is required, but not both. -type ThroughputSettingsResource struct { - // Throughput - Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. - Throughput *int32 `json:"throughput,omitempty"` - // AutoscaleSettings - Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. - AutoscaleSettings *AutoscaleSettingsResource `json:"autoscaleSettings,omitempty"` - // MinimumThroughput - READ-ONLY; The minimum throughput of the resource - MinimumThroughput *string `json:"minimumThroughput,omitempty"` - // OfferReplacePending - READ-ONLY; The throughput replace is pending - OfferReplacePending *string `json:"offerReplacePending,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsResource. -func (tsr ThroughputSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsr.Throughput != nil { - objectMap["throughput"] = tsr.Throughput - } - if tsr.AutoscaleSettings != nil { - objectMap["autoscaleSettings"] = tsr.AutoscaleSettings - } - return json.Marshal(objectMap) -} - -// ThroughputSettingsUpdateParameters parameters to update Cosmos DB resource throughput. -type ThroughputSettingsUpdateParameters struct { - // ThroughputSettingsUpdateProperties - Properties to update Azure Cosmos DB resource throughput. - *ThroughputSettingsUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The unique resource identifier of the ARM resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the ARM resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of Azure resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource group to which the resource belongs. - Location *string `json:"location,omitempty"` - Tags map[string]*string `json:"tags"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThroughputSettingsUpdateParameters. -func (tsup ThroughputSettingsUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsup.ThroughputSettingsUpdateProperties != nil { - objectMap["properties"] = tsup.ThroughputSettingsUpdateProperties - } - if tsup.Location != nil { - objectMap["location"] = tsup.Location - } - if tsup.Tags != nil { - objectMap["tags"] = tsup.Tags - } - if tsup.Identity != nil { - objectMap["identity"] = tsup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ThroughputSettingsUpdateParameters struct. -func (tsup *ThroughputSettingsUpdateParameters) 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 throughputSettingsUpdateProperties ThroughputSettingsUpdateProperties - err = json.Unmarshal(*v, &throughputSettingsUpdateProperties) - if err != nil { - return err - } - tsup.ThroughputSettingsUpdateProperties = &throughputSettingsUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tsup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - tsup.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tsup.Identity = &identity - } - } - } - - return nil -} - -// ThroughputSettingsUpdateProperties properties to update Azure Cosmos DB resource throughput. -type ThroughputSettingsUpdateProperties struct { - // Resource - The standard JSON format of a resource throughput - Resource *ThroughputSettingsResource `json:"resource,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"` -} - -// 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) -} - -// UniqueKey the unique key on that enforces uniqueness constraint on documents in the collection in the -// Azure Cosmos DB service. -type UniqueKey struct { - // Paths - List of paths must be unique for each document in the Azure Cosmos DB service - Paths *[]string `json:"paths,omitempty"` -} - -// UniqueKeyPolicy the unique key policy configuration for specifying uniqueness constraints on documents -// in the collection in the Azure Cosmos DB service. -type UniqueKeyPolicy struct { - // UniqueKeys - List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - UniqueKeys *[]UniqueKey `json:"uniqueKeys,omitempty"` -} - -// Usage the usage data for a usage request. -type Usage struct { - // Unit - The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond', 'UnitTypeMilliseconds' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // QuotaPeriod - READ-ONLY; The quota period used to summarize the usage values. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // Limit - READ-ONLY; Maximum value for this metric - Limit *int64 `json:"limit,omitempty"` - // CurrentValue - READ-ONLY; Current value for this metric - CurrentValue *int64 `json:"currentValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.Unit != "" { - objectMap["unit"] = u.Unit - } - return json.Marshal(objectMap) -} - -// UsagesResult the response to a list usage request. -type UsagesResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of usages for the database. A usage is a point in time metric - Value *[]Usage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsagesResult. -func (ur UsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRule virtual Network ACL Rule object -type VirtualNetworkRule struct { - // ID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. - ID *string `json:"id,omitempty"` - // IgnoreMissingVNetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVNetServiceEndpoint *bool `json:"ignoreMissingVNetServiceEndpoint,omitempty"` -} diff --git a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/mongodbresources.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/mongodbresources.go deleted file mode 100644 index b528e796ec36..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/mongodbresources.go +++ /dev/null @@ -1,1573 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// MongoDBResourcesClient is the client for the MongoDBResources methods of the Documentdb service. -type MongoDBResourcesClient struct { - BaseClient -} - -// NewMongoDBResourcesClient creates an instance of the MongoDBResourcesClient client. -func NewMongoDBResourcesClient(subscriptionID string) MongoDBResourcesClient { - return NewMongoDBResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMongoDBResourcesClientWithBaseURI creates an instance of the MongoDBResourcesClient 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 NewMongoDBResourcesClientWithBaseURI(baseURI string, subscriptionID string) MongoDBResourcesClient { - return MongoDBResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateMongoDBCollection create or update an Azure Cosmos DB MongoDB Collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// createUpdateMongoDBCollectionParameters - the parameters to provide for the current MongoDB Collection. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBCollection") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBCollectionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBCollectionParameters.MongoDBCollectionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", err.Error()) - } - - req, err := client.CreateUpdateMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBCollectionPreparer prepares the CreateUpdateMongoDBCollection request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBCollectionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBCollectionSender sends the CreateUpdateMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBCollectionFuture, 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 -} - -// CreateUpdateMongoDBCollectionResponder handles the response to the CreateUpdateMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateMongoDBDatabase create or updates Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateMongoDBDatabaseParameters - the parameters to provide for the current MongoDB database. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (result MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.CreateUpdateMongoDBDatabase") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateMongoDBDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateMongoDBDatabaseParameters.MongoDBDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", err.Error()) - } - - req, err := client.CreateUpdateMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "CreateUpdateMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateMongoDBDatabasePreparer prepares the CreateUpdateMongoDBDatabase request. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateMongoDBDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateMongoDBDatabaseSender sends the CreateUpdateMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesCreateUpdateMongoDBDatabaseFuture, 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 -} - -// CreateUpdateMongoDBDatabaseResponder handles the response to the CreateUpdateMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) CreateUpdateMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteMongoDBCollection deletes an existing Azure Cosmos DB MongoDB Collection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) DeleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesDeleteMongoDBCollectionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBCollection") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", err.Error()) - } - - req, err := client.DeleteMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBCollectionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBCollection", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBCollectionPreparer prepares the DeleteMongoDBCollection request. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBCollectionSender sends the DeleteMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBCollectionFuture, 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 -} - -// DeleteMongoDBCollectionResponder handles the response to the DeleteMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBCollectionResponder(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 -} - -// DeleteMongoDBDatabase deletes an existing Azure Cosmos DB MongoDB database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) DeleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesDeleteMongoDBDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.DeleteMongoDBDatabase") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", err.Error()) - } - - req, err := client.DeleteMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteMongoDBDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "DeleteMongoDBDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteMongoDBDatabasePreparer prepares the DeleteMongoDBDatabase request. -func (client MongoDBResourcesClient) DeleteMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteMongoDBDatabaseSender sends the DeleteMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseSender(req *http.Request) (future MongoDBResourcesDeleteMongoDBDatabaseFuture, 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 -} - -// DeleteMongoDBDatabaseResponder handles the response to the DeleteMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) DeleteMongoDBDatabaseResponder(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 -} - -// GetMongoDBCollection gets the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBCollectionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollection") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollection", err.Error()) - } - - req, err := client.GetMongoDBCollectionPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollection", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionPreparer prepares the GetMongoDBCollection request. -func (client MongoDBResourcesClient) GetMongoDBCollectionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionSender sends the GetMongoDBCollection request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionResponder handles the response to the GetMongoDBCollection request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionResponder(resp *http.Response) (result MongoDBCollectionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBCollectionThroughput gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBCollectionThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.GetMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBCollectionThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBCollectionThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBCollectionThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBCollectionThroughputPreparer prepares the GetMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBCollectionThroughputSender sends the GetMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBCollectionThroughputResponder handles the response to the GetMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabase gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided -// name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", err.Error()) - } - - req, err := client.GetMongoDBDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabasePreparer prepares the GetMongoDBDatabase request. -func (client MongoDBResourcesClient) GetMongoDBDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseSender sends the GetMongoDBDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseResponder handles the response to the GetMongoDBDatabase request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseResponder(resp *http.Response) (result MongoDBDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMongoDBDatabaseThroughput gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB -// database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.GetMongoDBDatabaseThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.GetMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetMongoDBDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetMongoDBDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "GetMongoDBDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetMongoDBDatabaseThroughputPreparer prepares the GetMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMongoDBDatabaseThroughputSender sends the GetMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMongoDBDatabaseThroughputResponder handles the response to the GetMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) GetMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBCollections lists the MongoDB collection under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) ListMongoDBCollections(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBCollectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBCollections") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBCollections", err.Error()) - } - - req, err := client.ListMongoDBCollectionsPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBCollectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBCollectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBCollections", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBCollectionsPreparer prepares the ListMongoDBCollections request. -func (client MongoDBResourcesClient) ListMongoDBCollectionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBCollectionsSender sends the ListMongoDBCollections request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBCollectionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBCollectionsResponder handles the response to the ListMongoDBCollections request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBCollectionsResponder(resp *http.Response) (result MongoDBCollectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMongoDBDatabases lists the MongoDB databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client MongoDBResourcesClient) ListMongoDBDatabases(ctx context.Context, resourceGroupName string, accountName string) (result MongoDBDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.ListMongoDBDatabases") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", err.Error()) - } - - req, err := client.ListMongoDBDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListMongoDBDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListMongoDBDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "ListMongoDBDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListMongoDBDatabasesPreparer prepares the ListMongoDBDatabases request. -func (client MongoDBResourcesClient) ListMongoDBDatabasesPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMongoDBDatabasesSender sends the ListMongoDBDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) ListMongoDBDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMongoDBDatabasesResponder handles the response to the ListMongoDBDatabases request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) ListMongoDBDatabasesResponder(resp *http.Response) (result MongoDBDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBCollectionToAutoscale migrate an Azure Cosmos DB MongoDB collection from manual throughput to -// autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToAutoscale") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", err.Error()) - } - - req, err := client.MigrateMongoDBCollectionToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBCollectionToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBCollectionToAutoscalePreparer prepares the MigrateMongoDBCollectionToAutoscale request. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBCollectionToAutoscaleSender sends the MigrateMongoDBCollectionToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToAutoscaleFuture, 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 -} - -// MigrateMongoDBCollectionToAutoscaleResponder handles the response to the MigrateMongoDBCollectionToAutoscale request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBCollectionToManualThroughput migrate an Azure Cosmos DB MongoDB collection from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (result MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBCollectionToManualThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", err.Error()) - } - - req, err := client.MigrateMongoDBCollectionToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBCollectionToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBCollectionToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBCollectionToManualThroughputPreparer prepares the MigrateMongoDBCollectionToManualThroughput request. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBCollectionToManualThroughputSender sends the MigrateMongoDBCollectionToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBCollectionToManualThroughputFuture, 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 -} - -// MigrateMongoDBCollectionToManualThroughputResponder handles the response to the MigrateMongoDBCollectionToManualThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBCollectionToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBDatabaseToAutoscale migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToAutoscale") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateMongoDBDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBDatabaseToAutoscalePreparer prepares the MigrateMongoDBDatabaseToAutoscale request. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBDatabaseToAutoscaleSender sends the MigrateMongoDBDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleFuture, 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 -} - -// MigrateMongoDBDatabaseToAutoscaleResponder handles the response to the MigrateMongoDBDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMongoDBDatabaseToManualThroughput migrate an Azure Cosmos DB MongoDB database from autoscale to manual -// throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.MigrateMongoDBDatabaseToManualThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateMongoDBDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateMongoDBDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "MigrateMongoDBDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateMongoDBDatabaseToManualThroughputPreparer prepares the MigrateMongoDBDatabaseToManualThroughput request. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateMongoDBDatabaseToManualThroughputSender sends the MigrateMongoDBDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputSender(req *http.Request) (future MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputFuture, 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 -} - -// MigrateMongoDBDatabaseToManualThroughputResponder handles the response to the MigrateMongoDBDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) MigrateMongoDBDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBCollectionThroughput update the RUs per second of an Azure Cosmos DB MongoDB collection -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// collectionName - cosmos DB collection name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// collection. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBCollectionThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBCollectionThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBCollectionThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBCollectionThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBCollectionThroughputPreparer prepares the UpdateMongoDBCollectionThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionName": autorest.Encode("path", collectionName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBCollectionThroughputSender sends the UpdateMongoDBCollectionThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBCollectionThroughputFuture, 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 -} - -// UpdateMongoDBCollectionThroughputResponder handles the response to the UpdateMongoDBCollectionThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBCollectionThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMongoDBDatabaseThroughput update RUs per second of the an Azure Cosmos DB MongoDB database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the RUs per second of the parameters to provide for the current MongoDB -// database. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MongoDBResourcesClient.UpdateMongoDBDatabaseThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateMongoDBDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateMongoDBDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.MongoDBResourcesClient", "UpdateMongoDBDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateMongoDBDatabaseThroughputPreparer prepares the UpdateMongoDBDatabaseThroughput request. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMongoDBDatabaseThroughputSender sends the UpdateMongoDBDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputSender(req *http.Request) (future MongoDBResourcesUpdateMongoDBDatabaseThroughputFuture, 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 -} - -// UpdateMongoDBDatabaseThroughputResponder handles the response to the UpdateMongoDBDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client MongoDBResourcesClient) UpdateMongoDBDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/notebookworkspaces.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/notebookworkspaces.go deleted file mode 100644 index 863a18e7a81d..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/notebookworkspaces.go +++ /dev/null @@ -1,674 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NotebookWorkspacesClient is the client for the NotebookWorkspaces methods of the Documentdb service. -type NotebookWorkspacesClient struct { - BaseClient -} - -// NewNotebookWorkspacesClient creates an instance of the NotebookWorkspacesClient client. -func NewNotebookWorkspacesClient(subscriptionID string) NotebookWorkspacesClient { - return NewNotebookWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotebookWorkspacesClientWithBaseURI creates an instance of the NotebookWorkspacesClient 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 NewNotebookWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) NotebookWorkspacesClient { - return NotebookWorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// notebookCreateUpdateParameters - the notebook workspace to create for the current database account. -func (client NotebookWorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (result NotebookWorkspacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, notebookCreateUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotebookWorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", pathParameters), - autorest.WithJSON(notebookCreateUpdateParameters), - 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 NotebookWorkspacesClient) CreateOrUpdateSender(req *http.Request) (future NotebookWorkspacesCreateOrUpdateFuture, 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 NotebookWorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result NotebookWorkspace, 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 notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotebookWorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) DeleteSender(req *http.Request) (future NotebookWorkspacesDeleteFuture, 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 NotebookWorkspacesClient) 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 the notebook workspace for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotebookWorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", 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 NotebookWorkspacesClient) 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 NotebookWorkspacesClient) GetResponder(resp *http.Response) (result NotebookWorkspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabaseAccount gets the notebook workspace resources of an existing Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListByDatabaseAccount") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client NotebookWorkspacesClient) ListByDatabaseAccountPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListByDatabaseAccountResponder(resp *http.Response) (result NotebookWorkspaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionInfo retrieves the connection info for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspaceConnectionInfoResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.ListConnectionInfo") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "ListConnectionInfo", err.Error()) - } - - req, err := client.ListConnectionInfoPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionInfoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionInfoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "ListConnectionInfo", resp, "Failure responding to request") - return - } - - return -} - -// ListConnectionInfoPreparer prepares the ListConnectionInfo request. -func (client NotebookWorkspacesClient) ListConnectionInfoPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListConnectionInfoSender sends the ListConnectionInfo request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) ListConnectionInfoSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListConnectionInfoResponder handles the response to the ListConnectionInfo request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) ListConnectionInfoResponder(resp *http.Response) (result NotebookWorkspaceConnectionInfoResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateAuthToken regenerates the auth token for the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) RegenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesRegenerateAuthTokenFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.RegenerateAuthToken") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", err.Error()) - } - - req, err := client.RegenerateAuthTokenPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateAuthTokenSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "RegenerateAuthToken", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateAuthTokenPreparer prepares the RegenerateAuthToken request. -func (client NotebookWorkspacesClient) RegenerateAuthTokenPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateAuthTokenSender sends the RegenerateAuthToken request. The method will close the -// http.Response Body if it receives an error. -func (client NotebookWorkspacesClient) RegenerateAuthTokenSender(req *http.Request) (future NotebookWorkspacesRegenerateAuthTokenFuture, 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 -} - -// RegenerateAuthTokenResponder handles the response to the RegenerateAuthToken request. The method always -// closes the http.Response Body. -func (client NotebookWorkspacesClient) RegenerateAuthTokenResponder(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 the notebook workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client NotebookWorkspacesClient) Start(ctx context.Context, resourceGroupName string, accountName string) (result NotebookWorkspacesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotebookWorkspacesClient.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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.NotebookWorkspacesClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.NotebookWorkspacesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client NotebookWorkspacesClient) StartPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "notebookWorkspaceName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/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 NotebookWorkspacesClient) StartSender(req *http.Request) (future NotebookWorkspacesStartFuture, 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 NotebookWorkspacesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/operations.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/operations.go deleted file mode 100644 index 8bcd949384fd..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 client for the Operations methods of the Documentdb service. -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 Cosmos DB Resource Provider 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, "documentdb.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, "documentdb.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DocumentDB/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, "documentdb.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, "documentdb.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.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/cosmos-db/mgmt/2021-03-01-preview/documentdb/partitionkeyrangeid.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/partitionkeyrangeid.go deleted file mode 100644 index 7f98ba95ccb1..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/partitionkeyrangeid.go +++ /dev/null @@ -1,132 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDClient is the client for the PartitionKeyRangeID methods of the Documentdb service. -type PartitionKeyRangeIDClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDClient creates an instance of the PartitionKeyRangeIDClient client. -func NewPartitionKeyRangeIDClient(subscriptionID string) PartitionKeyRangeIDClient { - return NewPartitionKeyRangeIDClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDClientWithBaseURI creates an instance of the PartitionKeyRangeIDClient 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 NewPartitionKeyRangeIDClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDClient { - return PartitionKeyRangeIDClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/partitionkeyrangeidregion.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/partitionkeyrangeidregion.go deleted file mode 100644 index 2ad2ccffcecf..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/partitionkeyrangeidregion.go +++ /dev/null @@ -1,134 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartitionKeyRangeIDRegionClient is the client for the PartitionKeyRangeIDRegion methods of the Documentdb service. -type PartitionKeyRangeIDRegionClient struct { - BaseClient -} - -// NewPartitionKeyRangeIDRegionClient creates an instance of the PartitionKeyRangeIDRegionClient client. -func NewPartitionKeyRangeIDRegionClient(subscriptionID string) PartitionKeyRangeIDRegionClient { - return NewPartitionKeyRangeIDRegionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartitionKeyRangeIDRegionClientWithBaseURI creates an instance of the PartitionKeyRangeIDRegionClient 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 NewPartitionKeyRangeIDRegionClientWithBaseURI(baseURI string, subscriptionID string) PartitionKeyRangeIDRegionClient { - return PartitionKeyRangeIDRegionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given partition key range id and region. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PartitionKeyRangeIDRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartitionKeyRangeIDRegionClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PartitionKeyRangeIDRegionClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PartitionKeyRangeIDRegionClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "collectionRid": autorest.Encode("path", collectionRid), - "databaseRid": autorest.Encode("path", databaseRid), - "partitionKeyRangeId": autorest.Encode("path", partitionKeyRangeID), - "region": autorest.Encode("path", region), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PartitionKeyRangeIDRegionClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PartitionKeyRangeIDRegionClient) ListMetricsResponder(resp *http.Response) (result PartitionMetricListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentile.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentile.go deleted file mode 100644 index 8d3b38089334..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentile.go +++ /dev/null @@ -1,126 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileClient is the client for the Percentile methods of the Documentdb service. -type PercentileClient struct { - BaseClient -} - -// NewPercentileClient creates an instance of the PercentileClient client. -func NewPercentileClient(subscriptionID string) PercentileClient { - return NewPercentileClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileClientWithBaseURI creates an instance of the PercentileClient 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 NewPercentileClientWithBaseURI(baseURI string, subscriptionID string) PercentileClient { - return PercentileClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given database account. This url is only -// for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName 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 = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentilesourcetarget.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentilesourcetarget.go deleted file mode 100644 index b800272c74e8..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentilesourcetarget.go +++ /dev/null @@ -1,133 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileSourceTargetClient is the client for the PercentileSourceTarget methods of the Documentdb service. -type PercentileSourceTargetClient struct { - BaseClient -} - -// NewPercentileSourceTargetClient creates an instance of the PercentileSourceTargetClient client. -func NewPercentileSourceTargetClient(subscriptionID string) PercentileSourceTargetClient { - return NewPercentileSourceTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileSourceTargetClientWithBaseURI creates an instance of the PercentileSourceTargetClient 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 NewPercentileSourceTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileSourceTargetClient { - return PercentileSourceTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account, source and target region. -// This url is only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// sourceRegion - source region from which data is written. Cosmos DB region, with spaces between words and -// each word capitalized. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileSourceTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileSourceTargetClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileSourceTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, sourceRegion, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileSourceTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileSourceTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sourceRegion": autorest.Encode("path", sourceRegion), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileSourceTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileSourceTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentiletarget.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentiletarget.go deleted file mode 100644 index 2d7b5ad75d12..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/percentiletarget.go +++ /dev/null @@ -1,130 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PercentileTargetClient is the client for the PercentileTarget methods of the Documentdb service. -type PercentileTargetClient struct { - BaseClient -} - -// NewPercentileTargetClient creates an instance of the PercentileTargetClient client. -func NewPercentileTargetClient(subscriptionID string) PercentileTargetClient { - return NewPercentileTargetClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPercentileTargetClientWithBaseURI creates an instance of the PercentileTargetClient 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 NewPercentileTargetClientWithBaseURI(baseURI string, subscriptionID string) PercentileTargetClient { - return PercentileTargetClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListMetrics retrieves the metrics determined by the given filter for the given account target region. This url is -// only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. -func (client PercentileTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PercentileTargetClient.ListMetrics") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PercentileTargetClient", "ListMetrics", err.Error()) - } - - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, accountName, targetRegion, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PercentileTargetClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client PercentileTargetClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, accountName string, targetRegion 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), - "targetRegion": autorest.Encode("path", targetRegion), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client PercentileTargetClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client PercentileTargetClient) ListMetricsResponder(resp *http.Response) (result PercentileMetricListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/privateendpointconnections.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/privateendpointconnections.go deleted file mode 100644 index 88658a11feb0..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/privateendpointconnections.go +++ /dev/null @@ -1,402 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the Documentdb service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) 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 = "2021-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.DocumentDB/databaseAccounts/{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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByDatabaseAccount list all private endpoint connections on a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByDatabaseAccount") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateEndpointConnectionsClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/privatelinkresources.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/privatelinkresources.go deleted file mode 100644 index 7ff4e4918c77..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/privatelinkresources.go +++ /dev/null @@ -1,213 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the client for the PrivateLinkResources methods of the Documentdb service. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, accountName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByDatabaseAccount gets the private link resources that need to be created for a Cosmos DB account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client PrivateLinkResourcesClient) ListByDatabaseAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByDatabaseAccount") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", err.Error()) - } - - req, err := client.ListByDatabaseAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.PrivateLinkResourcesClient", "ListByDatabaseAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabaseAccountPreparer prepares the ListByDatabaseAccount request. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseAccountSender sends the ListByDatabaseAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseAccountResponder handles the response to the ListByDatabaseAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByDatabaseAccountResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorabledatabaseaccounts.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorabledatabaseaccounts.go deleted file mode 100644 index b733412c64dc..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorabledatabaseaccounts.go +++ /dev/null @@ -1,275 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableDatabaseAccountsClient is the client for the RestorableDatabaseAccounts methods of the Documentdb service. -type RestorableDatabaseAccountsClient struct { - BaseClient -} - -// NewRestorableDatabaseAccountsClient creates an instance of the RestorableDatabaseAccountsClient client. -func NewRestorableDatabaseAccountsClient(subscriptionID string) RestorableDatabaseAccountsClient { - return NewRestorableDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableDatabaseAccountsClientWithBaseURI creates an instance of the RestorableDatabaseAccountsClient 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 NewRestorableDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) RestorableDatabaseAccountsClient { - return RestorableDatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByLocation retrieves the properties of an existing Azure Cosmos DB restorable database account. This call -// requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -func (client RestorableDatabaseAccountsClient) GetByLocation(ctx context.Context, location string, instanceID string) (result RestorableDatabaseAccountGetResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDatabaseAccountsClient.GetByLocation") - 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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableDatabaseAccountsClient", "GetByLocation", err.Error()) - } - - req, err := client.GetByLocationPreparer(ctx, location, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "GetByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.GetByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "GetByLocation", resp, "Failure sending request") - return - } - - result, err = client.GetByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "GetByLocation", resp, "Failure responding to request") - return - } - - return -} - -// GetByLocationPreparer prepares the GetByLocation request. -func (client RestorableDatabaseAccountsClient) GetByLocationPreparer(ctx context.Context, location string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByLocationSender sends the GetByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableDatabaseAccountsClient) GetByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByLocationResponder handles the response to the GetByLocation request. The method always -// closes the http.Response Body. -func (client RestorableDatabaseAccountsClient) GetByLocationResponder(resp *http.Response) (result RestorableDatabaseAccountGetResult, 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 the restorable Azure Cosmos DB database accounts available under the subscription. This call requires -// 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. -func (client RestorableDatabaseAccountsClient) List(ctx context.Context) (result RestorableDatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDatabaseAccountsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableDatabaseAccountsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableDatabaseAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts", 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 RestorableDatabaseAccountsClient) 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 RestorableDatabaseAccountsClient) ListResponder(resp *http.Response) (result RestorableDatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByLocation lists all the restorable Azure Cosmos DB database accounts available under the subscription and in a -// region. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -func (client RestorableDatabaseAccountsClient) ListByLocation(ctx context.Context, location string) (result RestorableDatabaseAccountsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDatabaseAccountsClient.ListByLocation") - 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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableDatabaseAccountsClient", "ListByLocation", err.Error()) - } - - req, err := client.ListByLocationPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "ListByLocation", resp, "Failure sending request") - return - } - - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableDatabaseAccountsClient", "ListByLocation", resp, "Failure responding to request") - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client RestorableDatabaseAccountsClient) ListByLocationPreparer(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 = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableDatabaseAccountsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client RestorableDatabaseAccountsClient) ListByLocationResponder(resp *http.Response) (result RestorableDatabaseAccountsListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbcollections.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbcollections.go deleted file mode 100644 index 2736665a9c59..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbcollections.go +++ /dev/null @@ -1,122 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableMongodbCollectionsClient is the client for the RestorableMongodbCollections methods of the Documentdb -// service. -type RestorableMongodbCollectionsClient struct { - BaseClient -} - -// NewRestorableMongodbCollectionsClient creates an instance of the RestorableMongodbCollectionsClient client. -func NewRestorableMongodbCollectionsClient(subscriptionID string) RestorableMongodbCollectionsClient { - return NewRestorableMongodbCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableMongodbCollectionsClientWithBaseURI creates an instance of the RestorableMongodbCollectionsClient -// 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 NewRestorableMongodbCollectionsClientWithBaseURI(baseURI string, subscriptionID string) RestorableMongodbCollectionsClient { - return RestorableMongodbCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific -// database. This helps in scenario where container was accidentally deleted. This API requires -// 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -// restorableMongodbDatabaseRid - the resource ID of the MongoDB database. -func (client RestorableMongodbCollectionsClient) List(ctx context.Context, location string, instanceID string, restorableMongodbDatabaseRid string) (result RestorableMongodbCollectionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableMongodbCollectionsClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableMongodbCollectionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID, restorableMongodbDatabaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbCollectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbCollectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbCollectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableMongodbCollectionsClient) ListPreparer(ctx context.Context, location string, instanceID string, restorableMongodbDatabaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(restorableMongodbDatabaseRid) > 0 { - queryParameters["restorableMongodbDatabaseRid"] = autorest.Encode("query", restorableMongodbDatabaseRid) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections", 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 RestorableMongodbCollectionsClient) 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 RestorableMongodbCollectionsClient) ListResponder(resp *http.Response) (result RestorableMongodbCollectionsListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbdatabases.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbdatabases.go deleted file mode 100644 index c73eb4f5163a..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbdatabases.go +++ /dev/null @@ -1,117 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableMongodbDatabasesClient is the client for the RestorableMongodbDatabases methods of the Documentdb service. -type RestorableMongodbDatabasesClient struct { - BaseClient -} - -// NewRestorableMongodbDatabasesClient creates an instance of the RestorableMongodbDatabasesClient client. -func NewRestorableMongodbDatabasesClient(subscriptionID string) RestorableMongodbDatabasesClient { - return NewRestorableMongodbDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableMongodbDatabasesClientWithBaseURI creates an instance of the RestorableMongodbDatabasesClient 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 NewRestorableMongodbDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableMongodbDatabasesClient { - return RestorableMongodbDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable -// account. This helps in scenario where database was accidentally deleted to get the deletion time. This API -// requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -func (client RestorableMongodbDatabasesClient) List(ctx context.Context, location string, instanceID string) (result RestorableMongodbDatabasesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableMongodbDatabasesClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableMongodbDatabasesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbDatabasesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbDatabasesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbDatabasesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableMongodbDatabasesClient) ListPreparer(ctx context.Context, location string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases", 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 RestorableMongodbDatabasesClient) 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 RestorableMongodbDatabasesClient) ListResponder(resp *http.Response) (result RestorableMongodbDatabasesListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbresources.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbresources.go deleted file mode 100644 index 60ab989ab448..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablemongodbresources.go +++ /dev/null @@ -1,125 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableMongodbResourcesClient is the client for the RestorableMongodbResources methods of the Documentdb service. -type RestorableMongodbResourcesClient struct { - BaseClient -} - -// NewRestorableMongodbResourcesClient creates an instance of the RestorableMongodbResourcesClient client. -func NewRestorableMongodbResourcesClient(subscriptionID string) RestorableMongodbResourcesClient { - return NewRestorableMongodbResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableMongodbResourcesClientWithBaseURI creates an instance of the RestorableMongodbResourcesClient 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 NewRestorableMongodbResourcesClientWithBaseURI(baseURI string, subscriptionID string) RestorableMongodbResourcesClient { - return RestorableMongodbResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List return a list of database and collection combo that exist on the account at the given timestamp and location. -// This helps in scenarios to validate what resources exist at given timestamp and location. This API requires -// 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -// restoreLocation - the location where the restorable resources are located. -// restoreTimestampInUtc - the timestamp when the restorable resources existed. -func (client RestorableMongodbResourcesClient) List(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (result RestorableMongodbResourcesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableMongodbResourcesClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableMongodbResourcesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID, restoreLocation, restoreTimestampInUtc) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbResourcesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableMongodbResourcesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableMongodbResourcesClient) ListPreparer(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(restoreLocation) > 0 { - queryParameters["restoreLocation"] = autorest.Encode("query", restoreLocation) - } - if len(restoreTimestampInUtc) > 0 { - queryParameters["restoreTimestampInUtc"] = autorest.Encode("query", restoreTimestampInUtc) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources", 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 RestorableMongodbResourcesClient) 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 RestorableMongodbResourcesClient) ListResponder(resp *http.Response) (result RestorableMongodbResourcesListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqlcontainers.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqlcontainers.go deleted file mode 100644 index 8fb877bd5618..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqlcontainers.go +++ /dev/null @@ -1,121 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableSQLContainersClient is the client for the RestorableSQLContainers methods of the Documentdb service. -type RestorableSQLContainersClient struct { - BaseClient -} - -// NewRestorableSQLContainersClient creates an instance of the RestorableSQLContainersClient client. -func NewRestorableSQLContainersClient(subscriptionID string) RestorableSQLContainersClient { - return NewRestorableSQLContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableSQLContainersClientWithBaseURI creates an instance of the RestorableSQLContainersClient 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 NewRestorableSQLContainersClientWithBaseURI(baseURI string, subscriptionID string) RestorableSQLContainersClient { - return RestorableSQLContainersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. -// This helps in scenario where container was accidentally deleted. This API requires -// 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -// restorableSQLDatabaseRid - the resource ID of the SQL database. -func (client RestorableSQLContainersClient) List(ctx context.Context, location string, instanceID string, restorableSQLDatabaseRid string) (result RestorableSQLContainersListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableSQLContainersClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableSQLContainersClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID, restorableSQLDatabaseRid) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLContainersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLContainersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLContainersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableSQLContainersClient) ListPreparer(ctx context.Context, location string, instanceID string, restorableSQLDatabaseRid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(restorableSQLDatabaseRid) > 0 { - queryParameters["restorableSqlDatabaseRid"] = autorest.Encode("query", restorableSQLDatabaseRid) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers", 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 RestorableSQLContainersClient) 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 RestorableSQLContainersClient) ListResponder(resp *http.Response) (result RestorableSQLContainersListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqldatabases.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqldatabases.go deleted file mode 100644 index 72c6dfc85f3a..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqldatabases.go +++ /dev/null @@ -1,117 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableSQLDatabasesClient is the client for the RestorableSQLDatabases methods of the Documentdb service. -type RestorableSQLDatabasesClient struct { - BaseClient -} - -// NewRestorableSQLDatabasesClient creates an instance of the RestorableSQLDatabasesClient client. -func NewRestorableSQLDatabasesClient(subscriptionID string) RestorableSQLDatabasesClient { - return NewRestorableSQLDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableSQLDatabasesClientWithBaseURI creates an instance of the RestorableSQLDatabasesClient 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 NewRestorableSQLDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableSQLDatabasesClient { - return RestorableSQLDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable -// account. This helps in scenario where database was accidentally deleted to get the deletion time. This API -// requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -func (client RestorableSQLDatabasesClient) List(ctx context.Context, location string, instanceID string) (result RestorableSQLDatabasesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableSQLDatabasesClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableSQLDatabasesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLDatabasesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLDatabasesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLDatabasesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableSQLDatabasesClient) ListPreparer(ctx context.Context, location string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases", 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 RestorableSQLDatabasesClient) 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 RestorableSQLDatabasesClient) ListResponder(resp *http.Response) (result RestorableSQLDatabasesListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqlresources.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqlresources.go deleted file mode 100644 index 2e69740ac230..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/restorablesqlresources.go +++ /dev/null @@ -1,125 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableSQLResourcesClient is the client for the RestorableSQLResources methods of the Documentdb service. -type RestorableSQLResourcesClient struct { - BaseClient -} - -// NewRestorableSQLResourcesClient creates an instance of the RestorableSQLResourcesClient client. -func NewRestorableSQLResourcesClient(subscriptionID string) RestorableSQLResourcesClient { - return NewRestorableSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableSQLResourcesClientWithBaseURI creates an instance of the RestorableSQLResourcesClient 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 NewRestorableSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string) RestorableSQLResourcesClient { - return RestorableSQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List return a list of database and container combo that exist on the account at the given timestamp and location. -// This helps in scenarios to validate what resources exist at given timestamp and location. This API requires -// 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. -// Parameters: -// location - cosmos DB region, with spaces between words and each word capitalized. -// instanceID - the instanceId GUID of a restorable database account. -// restoreLocation - the location where the restorable resources are located. -// restoreTimestampInUtc - the timestamp when the restorable resources existed. -func (client RestorableSQLResourcesClient) List(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (result RestorableSQLResourcesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableSQLResourcesClient.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}}}}); err != nil { - return result, validation.NewError("documentdb.RestorableSQLResourcesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, instanceID, restoreLocation, restoreTimestampInUtc) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLResourcesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.RestorableSQLResourcesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RestorableSQLResourcesClient) ListPreparer(ctx context.Context, location string, instanceID string, restoreLocation string, restoreTimestampInUtc string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(restoreLocation) > 0 { - queryParameters["restoreLocation"] = autorest.Encode("query", restoreLocation) - } - if len(restoreTimestampInUtc) > 0 { - queryParameters["restoreTimestampInUtc"] = autorest.Encode("query", restoreTimestampInUtc) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources", 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 RestorableSQLResourcesClient) 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 RestorableSQLResourcesClient) ListResponder(resp *http.Response) (result RestorableSQLResourcesListResult, 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/cosmos-db/mgmt/2021-03-01-preview/documentdb/sqlresources.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/sqlresources.go deleted file mode 100644 index b52474badcb1..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/sqlresources.go +++ /dev/null @@ -1,3487 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLResourcesClient is the client for the SQLResources methods of the Documentdb service. -type SQLResourcesClient struct { - BaseClient -} - -// NewSQLResourcesClient creates an instance of the SQLResourcesClient client. -func NewSQLResourcesClient(subscriptionID string) SQLResourcesClient { - return NewSQLResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLResourcesClientWithBaseURI creates an instance of the SQLResourcesClient 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 NewSQLResourcesClientWithBaseURI(baseURI string, subscriptionID string) SQLResourcesClient { - return SQLResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateSQLContainer create or update an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// createUpdateSQLContainerParameters - the parameters to provide for the current SQL container. -func (client SQLResourcesClient) CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLContainer") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLContainerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil}, - {Target: "createUpdateSQLContainerParameters.SQLContainerCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", err.Error()) - } - - req, err := client.CreateUpdateSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, createUpdateSQLContainerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLContainerPreparer prepares the CreateUpdateSQLContainer request. -func (client SQLResourcesClient) CreateUpdateSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithJSON(createUpdateSQLContainerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLContainerSender sends the CreateUpdateSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLContainerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLContainerFuture, 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 -} - -// CreateUpdateSQLContainerResponder handles the response to the CreateUpdateSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLDatabase create or update an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// createUpdateSQLDatabaseParameters - the parameters to provide for the current SQL database. -func (client SQLResourcesClient) CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLDatabase") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLDatabaseParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLDatabaseParameters.SQLDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", err.Error()) - } - - req, err := client.CreateUpdateSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateSQLDatabaseParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLDatabasePreparer prepares the CreateUpdateSQLDatabase request. -func (client SQLResourcesClient) CreateUpdateSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithJSON(createUpdateSQLDatabaseParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLDatabaseSender sends the CreateUpdateSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseSender(req *http.Request) (future SQLResourcesCreateUpdateSQLDatabaseFuture, 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 -} - -// CreateUpdateSQLDatabaseResponder handles the response to the CreateUpdateSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLRoleAssignment creates or updates an Azure Cosmos DB SQL Role Assignment. -// Parameters: -// roleAssignmentID - the GUID for the Role Assignment. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// createUpdateSQLRoleAssignmentParameters - the properties required to create or update a Role Assignment. -func (client SQLResourcesClient) CreateUpdateSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLRoleAssignmentFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLRoleAssignment") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", err.Error()) - } - - req, err := client.CreateUpdateSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName, createUpdateSQLRoleAssignmentParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLRoleAssignmentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLRoleAssignmentPreparer prepares the CreateUpdateSQLRoleAssignment request. -func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleAssignmentId": autorest.Encode("path", roleAssignmentID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters), - autorest.WithJSON(createUpdateSQLRoleAssignmentParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLRoleAssignmentSender sends the CreateUpdateSQLRoleAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentSender(req *http.Request) (future SQLResourcesCreateUpdateSQLRoleAssignmentFuture, 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 -} - -// CreateUpdateSQLRoleAssignmentResponder handles the response to the CreateUpdateSQLRoleAssignment request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentResponder(resp *http.Response) (result SQLRoleAssignmentGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLRoleDefinition creates or updates an Azure Cosmos DB SQL Role Definition. -// Parameters: -// roleDefinitionID - the GUID for the Role Definition. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// createUpdateSQLRoleDefinitionParameters - the properties required to create or update a Role Definition. -func (client SQLResourcesClient) CreateUpdateSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLRoleDefinitionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLRoleDefinition") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", err.Error()) - } - - req, err := client.CreateUpdateSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName, createUpdateSQLRoleDefinitionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLRoleDefinitionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLRoleDefinitionPreparer prepares the CreateUpdateSQLRoleDefinition request. -func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithJSON(createUpdateSQLRoleDefinitionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLRoleDefinitionSender sends the CreateUpdateSQLRoleDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLRoleDefinitionFuture, 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 -} - -// CreateUpdateSQLRoleDefinitionResponder handles the response to the CreateUpdateSQLRoleDefinition request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionResponder(resp *http.Response) (result SQLRoleDefinitionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLStoredProcedure create or update an Azure Cosmos DB SQL storedProcedure -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -// createUpdateSQLStoredProcedureParameters - the parameters to provide for the current SQL storedProcedure. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLStoredProcedure") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLStoredProcedureParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLStoredProcedureParameters.SQLStoredProcedureCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", err.Error()) - } - - req, err := client.CreateUpdateSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSQLStoredProcedureParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLStoredProcedurePreparer prepares the CreateUpdateSQLStoredProcedure request. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithJSON(createUpdateSQLStoredProcedureParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLStoredProcedureSender sends the CreateUpdateSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureSender(req *http.Request) (future SQLResourcesCreateUpdateSQLStoredProcedureFuture, 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 -} - -// CreateUpdateSQLStoredProcedureResponder handles the response to the CreateUpdateSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLTrigger create or update an Azure Cosmos DB SQL trigger -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -// createUpdateSQLTriggerParameters - the parameters to provide for the current SQL trigger. -func (client SQLResourcesClient) CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLTrigger") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLTriggerParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLTriggerParameters.SQLTriggerCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", err.Error()) - } - - req, err := client.CreateUpdateSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSQLTriggerParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLTriggerPreparer prepares the CreateUpdateSQLTrigger request. -func (client SQLResourcesClient) CreateUpdateSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithJSON(createUpdateSQLTriggerParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLTriggerSender sends the CreateUpdateSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLTriggerSender(req *http.Request) (future SQLResourcesCreateUpdateSQLTriggerFuture, 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 -} - -// CreateUpdateSQLTriggerResponder handles the response to the CreateUpdateSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateUpdateSQLUserDefinedFunction create or update an Azure Cosmos DB SQL userDefinedFunction -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -// createUpdateSQLUserDefinedFunctionParameters - the parameters to provide for the current SQL -// userDefinedFunction. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLUserDefinedFunction") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateSQLUserDefinedFunctionParameters, - Constraints: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateSQLUserDefinedFunctionParameters.SQLUserDefinedFunctionCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", err.Error()) - } - - req, err := client.CreateUpdateSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSQLUserDefinedFunctionParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateSQLUserDefinedFunctionPreparer prepares the CreateUpdateSQLUserDefinedFunction request. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithJSON(createUpdateSQLUserDefinedFunctionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateSQLUserDefinedFunctionSender sends the CreateUpdateSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, 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 -} - -// CreateUpdateSQLUserDefinedFunctionResponder handles the response to the CreateUpdateSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) CreateUpdateSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSQLContainer deletes an existing Azure Cosmos DB SQL container. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesDeleteSQLContainerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLContainer") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLContainer", err.Error()) - } - - req, err := client.DeleteSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLContainerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLContainer", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLContainerPreparer prepares the DeleteSQLContainer request. -func (client SQLResourcesClient) DeleteSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLContainerSender sends the DeleteSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLContainerSender(req *http.Request) (future SQLResourcesDeleteSQLContainerFuture, 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 -} - -// DeleteSQLContainerResponder handles the response to the DeleteSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLContainerResponder(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 -} - -// DeleteSQLDatabase deletes an existing Azure Cosmos DB SQL database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesDeleteSQLDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLDatabase") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLDatabase", err.Error()) - } - - req, err := client.DeleteSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLDatabasePreparer prepares the DeleteSQLDatabase request. -func (client SQLResourcesClient) DeleteSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLDatabaseSender sends the DeleteSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLDatabaseSender(req *http.Request) (future SQLResourcesDeleteSQLDatabaseFuture, 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 -} - -// DeleteSQLDatabaseResponder handles the response to the DeleteSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLDatabaseResponder(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 -} - -// DeleteSQLRoleAssignment deletes an existing Azure Cosmos DB SQL Role Assignment. -// Parameters: -// roleAssignmentID - the GUID for the Role Assignment. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) DeleteSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result SQLResourcesDeleteSQLRoleAssignmentFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLRoleAssignment") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", err.Error()) - } - - req, err := client.DeleteSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLRoleAssignmentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLRoleAssignmentPreparer prepares the DeleteSQLRoleAssignment request. -func (client SQLResourcesClient) DeleteSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleAssignmentId": autorest.Encode("path", roleAssignmentID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLRoleAssignmentSender sends the DeleteSQLRoleAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLRoleAssignmentSender(req *http.Request) (future SQLResourcesDeleteSQLRoleAssignmentFuture, 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 -} - -// DeleteSQLRoleAssignmentResponder handles the response to the DeleteSQLRoleAssignment request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLRoleAssignmentResponder(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 -} - -// DeleteSQLRoleDefinition deletes an existing Azure Cosmos DB SQL Role Definition. -// Parameters: -// roleDefinitionID - the GUID for the Role Definition. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) DeleteSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result SQLResourcesDeleteSQLRoleDefinitionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLRoleDefinition") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", err.Error()) - } - - req, err := client.DeleteSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLRoleDefinitionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLRoleDefinitionPreparer prepares the DeleteSQLRoleDefinition request. -func (client SQLResourcesClient) DeleteSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLRoleDefinitionSender sends the DeleteSQLRoleDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLRoleDefinitionSender(req *http.Request) (future SQLResourcesDeleteSQLRoleDefinitionFuture, 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 -} - -// DeleteSQLRoleDefinitionResponder handles the response to the DeleteSQLRoleDefinition request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLRoleDefinitionResponder(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 -} - -// DeleteSQLStoredProcedure deletes an existing Azure Cosmos DB SQL storedProcedure. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLResourcesDeleteSQLStoredProcedureFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLStoredProcedure") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", err.Error()) - } - - req, err := client.DeleteSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLStoredProcedureSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLStoredProcedure", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLStoredProcedurePreparer prepares the DeleteSQLStoredProcedure request. -func (client SQLResourcesClient) DeleteSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLStoredProcedureSender sends the DeleteSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLStoredProcedureSender(req *http.Request) (future SQLResourcesDeleteSQLStoredProcedureFuture, 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 -} - -// DeleteSQLStoredProcedureResponder handles the response to the DeleteSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLStoredProcedureResponder(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 -} - -// DeleteSQLTrigger deletes an existing Azure Cosmos DB SQL trigger. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLResourcesDeleteSQLTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLTrigger") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLTrigger", err.Error()) - } - - req, err := client.DeleteSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLTriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLTrigger", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLTriggerPreparer prepares the DeleteSQLTrigger request. -func (client SQLResourcesClient) DeleteSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLTriggerSender sends the DeleteSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLTriggerSender(req *http.Request) (future SQLResourcesDeleteSQLTriggerFuture, 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 -} - -// DeleteSQLTriggerResponder handles the response to the DeleteSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLTriggerResponder(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 -} - -// DeleteSQLUserDefinedFunction deletes an existing Azure Cosmos DB SQL userDefinedFunction. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLUserDefinedFunction") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", err.Error()) - } - - req, err := client.DeleteSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSQLUserDefinedFunctionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLUserDefinedFunction", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteSQLUserDefinedFunctionPreparer prepares the DeleteSQLUserDefinedFunction request. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSQLUserDefinedFunctionSender sends the DeleteSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionSender(req *http.Request) (future SQLResourcesDeleteSQLUserDefinedFunctionFuture, 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 -} - -// DeleteSQLUserDefinedFunctionResponder handles the response to the DeleteSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionResponder(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 -} - -// GetSQLContainer gets the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error()) - } - - req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerPreparer prepares the GetSQLContainer request. -func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerSender sends the GetSQLContainer request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database -// account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error()) - } - - req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLContainerThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLContainerThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request. -func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error()) - } - - req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabasePreparer prepares the GetSQLDatabase request. -func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database -// account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error()) - } - - req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLDatabaseThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetSQLDatabaseThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request. -func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLRoleAssignment retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. -// Parameters: -// roleAssignmentID - the GUID for the Role Assignment. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) GetSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result SQLRoleAssignmentGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLRoleAssignment") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLRoleAssignment", err.Error()) - } - - req, err := client.GetSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLRoleAssignmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", resp, "Failure sending request") - return - } - - result, err = client.GetSQLRoleAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLRoleAssignmentPreparer prepares the GetSQLRoleAssignment request. -func (client SQLResourcesClient) GetSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleAssignmentId": autorest.Encode("path", roleAssignmentID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLRoleAssignmentSender sends the GetSQLRoleAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLRoleAssignmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLRoleAssignmentResponder handles the response to the GetSQLRoleAssignment request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLRoleAssignmentResponder(resp *http.Response) (result SQLRoleAssignmentGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLRoleDefinition retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. -// Parameters: -// roleDefinitionID - the GUID for the Role Definition. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) GetSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result SQLRoleDefinitionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLRoleDefinition") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLRoleDefinition", err.Error()) - } - - req, err := client.GetSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLRoleDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", resp, "Failure sending request") - return - } - - result, err = client.GetSQLRoleDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLRoleDefinitionPreparer prepares the GetSQLRoleDefinition request. -func (client SQLResourcesClient) GetSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLRoleDefinitionSender sends the GetSQLRoleDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLRoleDefinitionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLRoleDefinitionResponder handles the response to the GetSQLRoleDefinition request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLRoleDefinitionResponder(resp *http.Response) (result SQLRoleDefinitionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLStoredProcedure gets the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// storedProcedureName - cosmos DB storedProcedure name. -func (client SQLResourcesClient) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result SQLStoredProcedureGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLStoredProcedure") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLStoredProcedure", err.Error()) - } - - req, err := client.GetSQLStoredProcedurePreparer(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLStoredProcedureSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure sending request") - return - } - - result, err = client.GetSQLStoredProcedureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLStoredProcedure", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLStoredProcedurePreparer prepares the GetSQLStoredProcedure request. -func (client SQLResourcesClient) GetSQLStoredProcedurePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storedProcedureName": autorest.Encode("path", storedProcedureName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLStoredProcedureSender sends the GetSQLStoredProcedure request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLStoredProcedureSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLStoredProcedureResponder handles the response to the GetSQLStoredProcedure request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLStoredProcedureResponder(resp *http.Response) (result SQLStoredProcedureGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLTrigger gets the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// triggerName - cosmos DB trigger name. -func (client SQLResourcesClient) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result SQLTriggerGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLTrigger") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLTrigger", err.Error()) - } - - req, err := client.GetSQLTriggerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLTriggerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure sending request") - return - } - - result, err = client.GetSQLTriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLTrigger", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLTriggerPreparer prepares the GetSQLTrigger request. -func (client SQLResourcesClient) GetSQLTriggerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLTriggerSender sends the GetSQLTrigger request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLTriggerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLTriggerResponder handles the response to the GetSQLTrigger request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLTriggerResponder(resp *http.Response) (result SQLTriggerGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLUserDefinedFunction gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// userDefinedFunctionName - cosmos DB userDefinedFunction name. -func (client SQLResourcesClient) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result SQLUserDefinedFunctionGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLUserDefinedFunction") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", err.Error()) - } - - req, err := client.GetSQLUserDefinedFunctionPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLUserDefinedFunctionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure sending request") - return - } - - result, err = client.GetSQLUserDefinedFunctionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLUserDefinedFunction", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLUserDefinedFunctionPreparer prepares the GetSQLUserDefinedFunction request. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userDefinedFunctionName": autorest.Encode("path", userDefinedFunctionName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLUserDefinedFunctionSender sends the GetSQLUserDefinedFunction request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSQLUserDefinedFunctionResponder handles the response to the GetSQLUserDefinedFunction request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) GetSQLUserDefinedFunctionResponder(resp *http.Response) (result SQLUserDefinedFunctionGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLContainers lists the SQL container under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLContainerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLContainers") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLContainers", err.Error()) - } - - req, err := client.ListSQLContainersPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLContainersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLContainersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLContainers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLContainersPreparer prepares the ListSQLContainers request. -func (client SQLResourcesClient) ListSQLContainersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLContainersSender sends the ListSQLContainers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLContainersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLContainersResponder handles the response to the ListSQLContainers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLContainersResponder(resp *http.Response) (result SQLContainerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLDatabases lists the SQL databases under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result SQLDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLDatabases") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLDatabases", err.Error()) - } - - req, err := client.ListSQLDatabasesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListSQLDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLDatabasesPreparer prepares the ListSQLDatabases request. -func (client SQLResourcesClient) ListSQLDatabasesPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLDatabasesSender sends the ListSQLDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLDatabasesResponder handles the response to the ListSQLDatabases request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLDatabasesResponder(resp *http.Response) (result SQLDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLRoleAssignments retrieves the list of all Azure Cosmos DB SQL Role Assignments. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLRoleAssignments(ctx context.Context, resourceGroupName string, accountName string) (result SQLRoleAssignmentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLRoleAssignments") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLRoleAssignments", err.Error()) - } - - req, err := client.ListSQLRoleAssignmentsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLRoleAssignmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", resp, "Failure sending request") - return - } - - result, err = client.ListSQLRoleAssignmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLRoleAssignmentsPreparer prepares the ListSQLRoleAssignments request. -func (client SQLResourcesClient) ListSQLRoleAssignmentsPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLRoleAssignmentsSender sends the ListSQLRoleAssignments request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLRoleAssignmentsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLRoleAssignmentsResponder handles the response to the ListSQLRoleAssignments request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLRoleAssignmentsResponder(resp *http.Response) (result SQLRoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLRoleDefinitions retrieves the list of all Azure Cosmos DB SQL Role Definitions. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client SQLResourcesClient) ListSQLRoleDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result SQLRoleDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLRoleDefinitions") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", err.Error()) - } - - req, err := client.ListSQLRoleDefinitionsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLRoleDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListSQLRoleDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLRoleDefinitionsPreparer prepares the ListSQLRoleDefinitions request. -func (client SQLResourcesClient) ListSQLRoleDefinitionsPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLRoleDefinitionsSender sends the ListSQLRoleDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLRoleDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLRoleDefinitionsResponder handles the response to the ListSQLRoleDefinitions request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLRoleDefinitionsResponder(resp *http.Response) (result SQLRoleDefinitionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLStoredProcedures lists the SQL storedProcedure under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLStoredProcedureListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLStoredProcedures") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLStoredProcedures", err.Error()) - } - - req, err := client.ListSQLStoredProceduresPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLStoredProceduresSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure sending request") - return - } - - result, err = client.ListSQLStoredProceduresResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLStoredProcedures", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLStoredProceduresPreparer prepares the ListSQLStoredProcedures request. -func (client SQLResourcesClient) ListSQLStoredProceduresPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLStoredProceduresSender sends the ListSQLStoredProcedures request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLStoredProceduresSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLStoredProceduresResponder handles the response to the ListSQLStoredProcedures request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLStoredProceduresResponder(resp *http.Response) (result SQLStoredProcedureListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLTriggers lists the SQL trigger under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLTriggerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLTriggers") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLTriggers", err.Error()) - } - - req, err := client.ListSQLTriggersPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLTriggersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure sending request") - return - } - - result, err = client.ListSQLTriggersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLTriggers", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLTriggersPreparer prepares the ListSQLTriggers request. -func (client SQLResourcesClient) ListSQLTriggersPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLTriggersSender sends the ListSQLTriggers request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLTriggersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLTriggersResponder handles the response to the ListSQLTriggers request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLTriggersResponder(resp *http.Response) (result SQLTriggerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSQLUserDefinedFunctions lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLUserDefinedFunctionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLUserDefinedFunctions") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", err.Error()) - } - - req, err := client.ListSQLUserDefinedFunctionsPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", nil, "Failure preparing request") - return - } - - resp, err := client.ListSQLUserDefinedFunctionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure sending request") - return - } - - result, err = client.ListSQLUserDefinedFunctionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLUserDefinedFunctions", resp, "Failure responding to request") - return - } - - return -} - -// ListSQLUserDefinedFunctionsPreparer prepares the ListSQLUserDefinedFunctions request. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSQLUserDefinedFunctionsSender sends the ListSQLUserDefinedFunctions request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSQLUserDefinedFunctionsResponder handles the response to the ListSQLUserDefinedFunctions request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) ListSQLUserDefinedFunctionsResponder(resp *http.Response) (result SQLUserDefinedFunctionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLContainerToAutoscale migrate an Azure Cosmos DB SQL container from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToAutoscale") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", err.Error()) - } - - req, err := client.MigrateSQLContainerToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLContainerToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLContainerToAutoscalePreparer prepares the MigrateSQLContainerToAutoscale request. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLContainerToAutoscaleSender sends the MigrateSQLContainerToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToAutoscaleFuture, 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 -} - -// MigrateSQLContainerToAutoscaleResponder handles the response to the MigrateSQLContainerToAutoscale request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLContainerToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLContainerToManualThroughput migrate an Azure Cosmos DB SQL container from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLResourcesMigrateSQLContainerToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLContainerToManualThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", err.Error()) - } - - req, err := client.MigrateSQLContainerToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLContainerToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLContainerToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLContainerToManualThroughputPreparer prepares the MigrateSQLContainerToManualThroughput request. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLContainerToManualThroughputSender sends the MigrateSQLContainerToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLContainerToManualThroughputFuture, 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 -} - -// MigrateSQLContainerToManualThroughputResponder handles the response to the MigrateSQLContainerToManualThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLContainerToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLDatabaseToAutoscale migrate an Azure Cosmos DB SQL database from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToAutoscale") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", err.Error()) - } - - req, err := client.MigrateSQLDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLDatabaseToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLDatabaseToAutoscalePreparer prepares the MigrateSQLDatabaseToAutoscale request. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLDatabaseToAutoscaleSender sends the MigrateSQLDatabaseToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToAutoscaleFuture, 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 -} - -// MigrateSQLDatabaseToAutoscaleResponder handles the response to the MigrateSQLDatabaseToAutoscale request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateSQLDatabaseToManualThroughput migrate an Azure Cosmos DB SQL database from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.MigrateSQLDatabaseToManualThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", err.Error()) - } - - req, err := client.MigrateSQLDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateSQLDatabaseToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "MigrateSQLDatabaseToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateSQLDatabaseToManualThroughputPreparer prepares the MigrateSQLDatabaseToManualThroughput request. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateSQLDatabaseToManualThroughputSender sends the MigrateSQLDatabaseToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputSender(req *http.Request) (future SQLResourcesMigrateSQLDatabaseToManualThroughputFuture, 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 -} - -// MigrateSQLDatabaseToManualThroughputResponder handles the response to the MigrateSQLDatabaseToManualThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) MigrateSQLDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLContainerThroughput update RUs per second of an Azure Cosmos DB SQL container -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL container. -func (client SQLResourcesClient) UpdateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLContainerThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLContainerThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", err.Error()) - } - - req, err := client.UpdateSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLContainerThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLContainerThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLContainerThroughputPreparer prepares the UpdateSQLContainerThroughput request. -func (client SQLResourcesClient) UpdateSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLContainerThroughputSender sends the UpdateSQLContainerThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLContainerThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLContainerThroughputFuture, 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 -} - -// UpdateSQLContainerThroughputResponder handles the response to the UpdateSQLContainerThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSQLDatabaseThroughput update RUs per second of an Azure Cosmos DB SQL database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current SQL database. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result SQLResourcesUpdateSQLDatabaseThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.UpdateSQLDatabaseThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", err.Error()) - } - - req, err := client.UpdateSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSQLDatabaseThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "UpdateSQLDatabaseThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateSQLDatabaseThroughputPreparer prepares the UpdateSQLDatabaseThroughput request. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSQLDatabaseThroughputSender sends the UpdateSQLDatabaseThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputSender(req *http.Request) (future SQLResourcesUpdateSQLDatabaseThroughputFuture, 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 -} - -// UpdateSQLDatabaseThroughputResponder handles the response to the UpdateSQLDatabaseThroughput request. The method always -// closes the http.Response Body. -func (client SQLResourcesClient) UpdateSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/tableresources.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/tableresources.go deleted file mode 100644 index dd02e62d6ad3..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/tableresources.go +++ /dev/null @@ -1,791 +0,0 @@ -package documentdb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TableResourcesClient is the client for the TableResources methods of the Documentdb service. -type TableResourcesClient struct { - BaseClient -} - -// NewTableResourcesClient creates an instance of the TableResourcesClient client. -func NewTableResourcesClient(subscriptionID string) TableResourcesClient { - return NewTableResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTableResourcesClientWithBaseURI creates an instance of the TableResourcesClient 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 NewTableResourcesClientWithBaseURI(baseURI string, subscriptionID string) TableResourcesClient { - return TableResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateUpdateTable create or update an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// createUpdateTableParameters - the parameters to provide for the current Table. -func (client TableResourcesClient) CreateUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (result TableResourcesCreateUpdateTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.CreateUpdateTable") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: createUpdateTableParameters, - Constraints: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateTableParameters.TableCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "CreateUpdateTable", err.Error()) - } - - req, err := client.CreateUpdateTablePreparer(ctx, resourceGroupName, accountName, tableName, createUpdateTableParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", nil, "Failure preparing request") - return - } - - result, err = client.CreateUpdateTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "CreateUpdateTable", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateUpdateTablePreparer prepares the CreateUpdateTable request. -func (client TableResourcesClient) CreateUpdateTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithJSON(createUpdateTableParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateUpdateTableSender sends the CreateUpdateTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) CreateUpdateTableSender(req *http.Request) (future TableResourcesCreateUpdateTableFuture, 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 -} - -// CreateUpdateTableResponder handles the response to the CreateUpdateTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) CreateUpdateTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteTable deletes an existing Azure Cosmos DB Table. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) DeleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesDeleteTableFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.DeleteTable") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "DeleteTable", err.Error()) - } - - req, err := client.DeleteTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", nil, "Failure preparing request") - return - } - - result, err = client.DeleteTableSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "DeleteTable", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteTablePreparer prepares the DeleteTable request. -func (client TableResourcesClient) DeleteTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteTableSender sends the DeleteTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) DeleteTableSender(req *http.Request) (future TableResourcesDeleteTableFuture, 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 -} - -// DeleteTableResponder handles the response to the DeleteTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) DeleteTableResponder(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 -} - -// GetTable gets the Tables under an existing Azure Cosmos DB database account with the provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTable") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTable", err.Error()) - } - - req, err := client.GetTablePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure sending request") - return - } - - result, err = client.GetTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTable", resp, "Failure responding to request") - return - } - - return -} - -// GetTablePreparer prepares the GetTable request. -func (client TableResourcesClient) GetTablePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableSender sends the GetTable request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableResponder handles the response to the GetTable request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableResponder(resp *http.Response) (result TableGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTableThroughput gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the -// provided name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result ThroughputSettingsGetResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.GetTableThroughput") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "GetTableThroughput", err.Error()) - } - - req, err := client.GetTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", nil, "Failure preparing request") - return - } - - resp, err := client.GetTableThroughputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure sending request") - return - } - - result, err = client.GetTableThroughputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "GetTableThroughput", resp, "Failure responding to request") - return - } - - return -} - -// GetTableThroughputPreparer prepares the GetTableThroughput request. -func (client TableResourcesClient) GetTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTableThroughputSender sends the GetTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) GetTableThroughputSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTableThroughputResponder handles the response to the GetTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) GetTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListTables lists the Tables under an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -func (client TableResourcesClient) ListTables(ctx context.Context, resourceGroupName string, accountName string) (result TableListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.ListTables") - 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "ListTables", err.Error()) - } - - req, err := client.ListTablesPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", nil, "Failure preparing request") - return - } - - resp, err := client.ListTablesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure sending request") - return - } - - result, err = client.ListTablesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "ListTables", resp, "Failure responding to request") - return - } - - return -} - -// ListTablesPreparer prepares the ListTables request. -func (client TableResourcesClient) ListTablesPreparer(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 = "2021-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.DocumentDB/databaseAccounts/{accountName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListTablesSender sends the ListTables request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) ListTablesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListTablesResponder handles the response to the ListTables request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) ListTablesResponder(resp *http.Response) (result TableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateTableToAutoscale migrate an Azure Cosmos DB Table from manual throughput to autoscale -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) MigrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesMigrateTableToAutoscaleFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.MigrateTableToAutoscale") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "MigrateTableToAutoscale", err.Error()) - } - - req, err := client.MigrateTableToAutoscalePreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToAutoscale", nil, "Failure preparing request") - return - } - - result, err = client.MigrateTableToAutoscaleSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToAutoscale", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateTableToAutoscalePreparer prepares the MigrateTableToAutoscale request. -func (client TableResourcesClient) MigrateTableToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateTableToAutoscaleSender sends the MigrateTableToAutoscale request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) MigrateTableToAutoscaleSender(req *http.Request) (future TableResourcesMigrateTableToAutoscaleFuture, 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 -} - -// MigrateTableToAutoscaleResponder handles the response to the MigrateTableToAutoscale request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) MigrateTableToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateTableToManualThroughput migrate an Azure Cosmos DB Table from autoscale to manual throughput -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -func (client TableResourcesClient) MigrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result TableResourcesMigrateTableToManualThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.MigrateTableToManualThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "MigrateTableToManualThroughput", err.Error()) - } - - req, err := client.MigrateTableToManualThroughputPreparer(ctx, resourceGroupName, accountName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToManualThroughput", nil, "Failure preparing request") - return - } - - result, err = client.MigrateTableToManualThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "MigrateTableToManualThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// MigrateTableToManualThroughputPreparer prepares the MigrateTableToManualThroughput request. -func (client TableResourcesClient) MigrateTableToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-03-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MigrateTableToManualThroughputSender sends the MigrateTableToManualThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) MigrateTableToManualThroughputSender(req *http.Request) (future TableResourcesMigrateTableToManualThroughputFuture, 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 -} - -// MigrateTableToManualThroughputResponder handles the response to the MigrateTableToManualThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) MigrateTableToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateTableThroughput update RUs per second of an Azure Cosmos DB Table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - cosmos DB database account name. -// tableName - cosmos DB table name. -// updateThroughputParameters - the parameters to provide for the RUs per second of the current Table. -func (client TableResourcesClient) UpdateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result TableResourcesUpdateTableThroughputFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TableResourcesClient.UpdateTableThroughput") - 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: 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: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}, - {TargetValue: updateThroughputParameters, - Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("documentdb.TableResourcesClient", "UpdateTableThroughput", err.Error()) - } - - req, err := client.UpdateTableThroughputPreparer(ctx, resourceGroupName, accountName, tableName, updateThroughputParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTableThroughputSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.TableResourcesClient", "UpdateTableThroughput", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTableThroughputPreparer prepares the UpdateTableThroughput request. -func (client TableResourcesClient) UpdateTableThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2021-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.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", pathParameters), - autorest.WithJSON(updateThroughputParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTableThroughputSender sends the UpdateTableThroughput request. The method will close the -// http.Response Body if it receives an error. -func (client TableResourcesClient) UpdateTableThroughputSender(req *http.Request) (future TableResourcesUpdateTableThroughputFuture, 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 -} - -// UpdateTableThroughputResponder handles the response to the UpdateTableThroughput request. The method always -// closes the http.Response Body. -func (client TableResourcesClient) UpdateTableThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, 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/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/version.go b/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/version.go deleted file mode 100644 index 778f3ac2734f..000000000000 --- a/services/preview/cosmos-db/mgmt/2021-03-01-preview/documentdb/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package documentdb - -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() + " documentdb/2021-03-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/eventgrid/mgmt/2017-06-15-preview/eventgrid/CHANGELOG.md b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/_meta.json b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/_meta.json deleted file mode 100644 index f1d3cb0a3f0a..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "tag": "package-2017-06-preview", - "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-2017-06-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/client.go b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/client.go deleted file mode 100644 index 654cc95ea009..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2017-06-15-preview. -// -// Azure EventGrid Management Client -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Eventgrid - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Eventgrid. -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/eventgrid/mgmt/2017-06-15-preview/eventgrid/enums.go b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/enums.go deleted file mode 100644 index e628c0abd3d0..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/enums.go +++ /dev/null @@ -1,121 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // WebHook ... - WebHook EndpointType = "WebHook" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{WebHook} -} - -// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. -type EventSubscriptionProvisioningState string - -const ( - // Canceled ... - Canceled EventSubscriptionProvisioningState = "Canceled" - // Creating ... - Creating EventSubscriptionProvisioningState = "Creating" - // Deleting ... - Deleting EventSubscriptionProvisioningState = "Deleting" - // Failed ... - Failed EventSubscriptionProvisioningState = "Failed" - // Succeeded ... - Succeeded EventSubscriptionProvisioningState = "Succeeded" - // Updating ... - Updating EventSubscriptionProvisioningState = "Updating" -) - -// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. -func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { - return []EventSubscriptionProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // System ... - System OperationOrigin = "System" - // User ... - User OperationOrigin = "User" - // UserAndSystem ... - UserAndSystem OperationOrigin = "UserAndSystem" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{System, User, UserAndSystem} -} - -// ResourceRegionType enumerates the values for resource region type. -type ResourceRegionType string - -const ( - // GlobalResource ... - GlobalResource ResourceRegionType = "GlobalResource" - // RegionalResource ... - RegionalResource ResourceRegionType = "RegionalResource" -) - -// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. -func PossibleResourceRegionTypeValues() []ResourceRegionType { - return []ResourceRegionType{GlobalResource, RegionalResource} -} - -// TopicProvisioningState enumerates the values for topic provisioning state. -type TopicProvisioningState string - -const ( - // TopicProvisioningStateCanceled ... - TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" - // TopicProvisioningStateCreating ... - TopicProvisioningStateCreating TopicProvisioningState = "Creating" - // TopicProvisioningStateDeleting ... - TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" - // TopicProvisioningStateFailed ... - TopicProvisioningStateFailed TopicProvisioningState = "Failed" - // TopicProvisioningStateSucceeded ... - TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" - // TopicProvisioningStateUpdating ... - TopicProvisioningStateUpdating TopicProvisioningState = "Updating" -) - -// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. -func PossibleTopicProvisioningStateValues() []TopicProvisioningState { - return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} -} - -// TopicTypeProvisioningState enumerates the values for topic type provisioning state. -type TopicTypeProvisioningState string - -const ( - // TopicTypeProvisioningStateCanceled ... - TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" - // TopicTypeProvisioningStateCreating ... - TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" - // TopicTypeProvisioningStateDeleting ... - TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" - // TopicTypeProvisioningStateFailed ... - TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" - // TopicTypeProvisioningStateSucceeded ... - TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" - // TopicTypeProvisioningStateUpdating ... - TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" -) - -// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. -func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { - return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} -} diff --git a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/eventgridapi/interfaces.go b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/eventgridapi/interfaces.go deleted file mode 100644 index 0b6093458341..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/eventgridapi/interfaces.go +++ /dev/null @@ -1,62 +0,0 @@ -package eventgridapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/eventgrid/mgmt/2017-06-15-preview/eventgrid" -) - -// EventSubscriptionsClientAPI contains the set of methods on the EventSubscriptionsClient type. -type EventSubscriptionsClientAPI interface { - Create(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.EventSubscriptionsCreateFuture, err error) - Delete(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalBySubscription(ctx context.Context) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalBySubscription(ctx context.Context, location string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.EventSubscriptionsUpdateFuture, err error) -} - -var _ EventSubscriptionsClientAPI = (*eventgrid.EventSubscriptionsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result eventgrid.OperationsListResult, err error) -} - -var _ OperationsClientAPI = (*eventgrid.OperationsClient)(nil) - -// TopicsClientAPI contains the set of methods on the TopicsClient type. -type TopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo eventgrid.Topic) (result eventgrid.TopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.Topic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result eventgrid.TopicsListResult, err error) - ListBySubscription(ctx context.Context) (result eventgrid.TopicsListResult, err error) - ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventTypesListResult, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest eventgrid.TopicRegenerateKeyRequest) (result eventgrid.TopicSharedAccessKeys, err error) -} - -var _ TopicsClientAPI = (*eventgrid.TopicsClient)(nil) - -// TopicTypesClientAPI contains the set of methods on the TopicTypesClient type. -type TopicTypesClientAPI interface { - Get(ctx context.Context, topicTypeName string) (result eventgrid.TopicTypeInfo, err error) - List(ctx context.Context) (result eventgrid.TopicTypesListResult, err error) - ListEventTypes(ctx context.Context, topicTypeName string) (result eventgrid.EventTypesListResult, err error) -} - -var _ TopicTypesClientAPI = (*eventgrid.TopicTypesClient)(nil) diff --git a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/eventsubscriptions.go b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/eventsubscriptions.go deleted file mode 100644 index 0e8d8d6af3b4..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/eventsubscriptions.go +++ /dev/null @@ -1,1142 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventSubscriptionsClient is the azure EventGrid Management Client -type EventSubscriptionsClient struct { - BaseClient -} - -// NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. -func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { - return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient 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 NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { - return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create asynchronously creates a new event subscription to the specified scope. Existing event subscriptions cannot -// be updated with this API and should instead use the Update event subscription API. -// Parameters: -// scope - the scope of the resource to which the event subscription needs to be created. The scope can be a -// subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an -// EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 64 characters in length and use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information -func (client EventSubscriptionsClient) Create(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client EventSubscriptionsClient) CreatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-06-15-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 EventSubscriptionsClient) CreateSender(req *http.Request) (future EventSubscriptionsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) CreateResponder(resp *http.Response) (result EventSubscription, 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 an existing event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) 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 get properties of an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.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, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) 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 EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResource list all event subscriptions that have been created for a specific topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the resource type -// resourceName - name of the resource -func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(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 = "2017-06-15-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.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific -// topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-06-15-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.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription -func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic -// type. -// Parameters: -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription -// and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-15-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.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and resource group and topic type -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-06-15-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.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription -// Parameters: -// location - name of the location -func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalBySubscriptionPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(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 = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and topic type. -// Parameters: -// location - name of the location -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates an existing event subscription. -// Parameters: -// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a -// top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be created -// eventSubscriptionUpdateParameters - updated event subscription information -func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-06-15-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2017-06-15-preview/eventgrid/models.go b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/models.go deleted file mode 100644 index 2587b594b562..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/models.go +++ /dev/null @@ -1,826 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid" - -// EventSubscription event Subscription -type EventSubscription struct { - autorest.Response `json:"-"` - // EventSubscriptionProperties - Properties of the event subscription - *EventSubscriptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscription. -func (es EventSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EventSubscriptionProperties != nil { - objectMap["properties"] = es.EventSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. -func (es *EventSubscription) 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 eventSubscriptionProperties EventSubscriptionProperties - err = json.Unmarshal(*v, &eventSubscriptionProperties) - if err != nil { - return err - } - es.EventSubscriptionProperties = &eventSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// EventSubscriptionDestination information about the destination for an event subscription -type EventSubscriptionDestination struct { - // EndpointType - Type of the endpoint for the event subscription destination. Possible values include: 'WebHook' - EndpointType EndpointType `json:"endpointType,omitempty"` - // EventSubscriptionDestinationProperties - Properties of the event subscription destination - *EventSubscriptionDestinationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if esd.EndpointType != "" { - objectMap["endpointType"] = esd.EndpointType - } - if esd.EventSubscriptionDestinationProperties != nil { - objectMap["properties"] = esd.EventSubscriptionDestinationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionDestination struct. -func (esd *EventSubscriptionDestination) 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 "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - esd.EndpointType = endpointType - } - case "properties": - if v != nil { - var eventSubscriptionDestinationProperties EventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &eventSubscriptionDestinationProperties) - if err != nil { - return err - } - esd.EventSubscriptionDestinationProperties = &eventSubscriptionDestinationProperties - } - } - } - - return nil -} - -// EventSubscriptionDestinationProperties properties of the event subscription destination -type EventSubscriptionDestinationProperties struct { - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` - // EndpointBaseURL - READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. - EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestinationProperties. -func (esdp EventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if esdp.EndpointURL != nil { - objectMap["endpointUrl"] = esdp.EndpointURL - } - return json.Marshal(objectMap) -} - -// EventSubscriptionFilter filter for the Event Subscription -type EventSubscriptionFilter struct { - // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. - // The format of this depends on the publisher of the events. - // Wildcard characters are not supported in this path. - SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` - // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. - // Wildcard characters are not supported in this path. - SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` - // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. - // If it is desired to subscribe to all event types, the string "all" needs to be specified as an element in this list. - IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` - // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter - // should be compared in a case sensitive manner. - IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` -} - -// EventSubscriptionFullURL full endpoint url of an event subscription -type EventSubscriptionFullURL struct { - autorest.Response `json:"-"` - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` -} - -// EventSubscriptionProperties properties of the Event Subscription -type EventSubscriptionProperties struct { - // Topic - READ-ONLY; Name of the topic of the event subscription. - Topic *string `json:"topic,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event subscription. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' - ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination *EventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionProperties. -func (esp EventSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if esp.Destination != nil { - objectMap["destination"] = esp.Destination - } - if esp.Filter != nil { - objectMap["filter"] = esp.Filter - } - if esp.Labels != nil { - objectMap["labels"] = esp.Labels - } - return json.Marshal(objectMap) -} - -// EventSubscriptionsCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsCreateFuture) 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 EventSubscriptionsCreateFuture.Result. -func (future *EventSubscriptionsCreateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsDeleteFuture) 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 EventSubscriptionsDeleteFuture.Result. -func (future *EventSubscriptionsDeleteFuture) result(client EventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventSubscriptionsListResult result of the List EventSubscriptions operation -type EventSubscriptionsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of EventSubscriptions - Value *[]EventSubscription `json:"value,omitempty"` -} - -// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsUpdateFuture) 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 EventSubscriptionsUpdateFuture.Result. -func (future *EventSubscriptionsUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionUpdateParameters properties of the Event Subscription update -type EventSubscriptionUpdateParameters struct { - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination *EventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` -} - -// EventType event Type for a subject under a topic -type EventType struct { - // EventTypeProperties - Properties of the event type. - *EventTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventType. -func (et EventType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.EventTypeProperties != nil { - objectMap["properties"] = et.EventTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventType struct. -func (et *EventType) 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 eventTypeProperties EventTypeProperties - err = json.Unmarshal(*v, &eventTypeProperties) - if err != nil { - return err - } - et.EventTypeProperties = &eventTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// EventTypeProperties properties of the event type -type EventTypeProperties struct { - // DisplayName - Display name of the event type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the event type. - Description *string `json:"description,omitempty"` - // SchemaURL - Url of the schema for this event type. - SchemaURL *string `json:"schemaUrl,omitempty"` -} - -// EventTypesListResult result of the List Event Types operation -type EventTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of event types - Value *[]EventType `json:"value,omitempty"` -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,omitempty"` - // Display - Display name of the operation - Display *OperationInfo `json:"display,omitempty"` - // Origin - Origin of the operation. Possible values include: 'User', 'System', 'UserAndSystem' - Origin OperationOrigin `json:"origin,omitempty"` - // Properties - Properties of the operation - Properties interface{} `json:"properties,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"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// Resource definition of a Resource -type Resource struct { - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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) -} - -// Topic eventGrid Topic -type Topic struct { - autorest.Response `json:"-"` - // TopicProperties - Properties of the topic - *TopicProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TopicProperties != nil { - objectMap["properties"] = t.TopicProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Topic struct. -func (t *Topic) 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 topicProperties TopicProperties - err = json.Unmarshal(*v, &topicProperties) - if err != nil { - return err - } - t.TopicProperties = &topicProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TopicProperties properties of the Topic -type TopicProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' - ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the topic. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicProperties. -func (tp TopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TopicRegenerateKeyRequest topic regenerate share access key request -type TopicRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsCreateOrUpdateFuture) 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 TopicsCreateOrUpdateFuture.Result. -func (future *TopicsCreateOrUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateOrUpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsDeleteFuture) 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 TopicsDeleteFuture.Result. -func (future *TopicsDeleteFuture) result(client TopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TopicSharedAccessKeys shared access keys of the Topic -type TopicSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the topic. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the topic. - Key2 *string `json:"key2,omitempty"` -} - -// TopicsListResult result of the List Topics operation -type TopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Topics - Value *[]Topic `json:"value,omitempty"` -} - -// TopicTypeInfo properties of a topic type info. -type TopicTypeInfo struct { - autorest.Response `json:"-"` - // TopicTypeProperties - Properties of the topic type info - *TopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicTypeInfo. -func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tti.TopicTypeProperties != nil { - objectMap["properties"] = tti.TopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. -func (tti *TopicTypeInfo) 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 topicTypeProperties TopicTypeProperties - err = json.Unmarshal(*v, &topicTypeProperties) - if err != nil { - return err - } - tti.TopicTypeProperties = &topicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tti.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tti.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tti.Type = &typeVar - } - } - } - - return nil -} - -// TopicTypeProperties properties of a topic type. -type TopicTypeProperties struct { - // Provider - Namespace of the provider of the topic type. - Provider *string `json:"provider,omitempty"` - // DisplayName - Display Name for the topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the topic type. - Description *string `json:"description,omitempty"` - // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' - ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` - // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' - ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` -} - -// TopicTypesListResult result of the List Topic Types operation -type TopicTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of topic types - Value *[]TopicTypeInfo `json:"value,omitempty"` -} - -// TrackedResource definition of a Tracked Resource -type TrackedResource struct { - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} diff --git a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/operations.go b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/operations.go deleted file mode 100644 index 05c6119093e8..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure EventGrid 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 list the available operations supported by the Microsoft.EventGrid resource provider -func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/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 -} diff --git a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/topics.go b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/topics.go deleted file mode 100644 index 7ba5746173c3..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/topics.go +++ /dev/null @@ -1,654 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicsClient is the azure EventGrid Management Client -type TopicsClient struct { - BaseClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient 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 NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicInfo - topic information -func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-06-15-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicInfo), - 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 TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, 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 TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, 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 existing topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-06-15-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.EventGrid/topics/{topicName}", 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 TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, 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 TopicsClient) 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 get properties of a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-06-15-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.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the topics under a resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result TopicsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client TopicsClient) 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 = "2017-06-15-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.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list all the topics under an Azure subscription -func (client TopicsClient) ListBySubscription(ctx context.Context) (result TopicsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the topic type -// resourceName - name of the topic -func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSharedAccessKeys list the two keys used to publish to a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-06-15-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.EventGrid/topics/{topicName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// regenerateKeyRequest - request body to regenerate key -func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.TopicsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, topicName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-06-15-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.EventGrid/topics/{topicName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 TopicsClient) 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 TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, 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/eventgrid/mgmt/2017-06-15-preview/eventgrid/topictypes.go b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/topictypes.go deleted file mode 100644 index 4cbd2ea28b76..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/topictypes.go +++ /dev/null @@ -1,244 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicTypesClient is the azure EventGrid Management Client -type TopicTypesClient struct { - BaseClient -} - -// NewTopicTypesClient creates an instance of the TopicTypesClient client. -func NewTopicTypesClient(subscriptionID string) TopicTypesClient { - return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient 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 NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { - return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get information about a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.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, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all registered topic types -func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"), - 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 TopicTypesClient) 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 TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-06-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, 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/eventgrid/mgmt/2017-06-15-preview/eventgrid/version.go b/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/version.go deleted file mode 100644 index 2c4b86747c50..000000000000 --- a/services/preview/eventgrid/mgmt/2017-06-15-preview/eventgrid/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package eventgrid - -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() + " eventgrid/2017-06-15-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/CHANGELOG.md b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/_meta.json b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/_meta.json deleted file mode 100644 index 63d6ec6816cf..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "tag": "package-2017-09-preview", - "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-2017-09-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/client.go b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/client.go deleted file mode 100644 index d1cbae1a20c8..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2017-09-15-preview. -// -// Azure EventGrid Management Client -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Eventgrid - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Eventgrid. -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/eventgrid/mgmt/2017-09-15-preview/eventgrid/enums.go b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/enums.go deleted file mode 100644 index 5d49e778a568..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/enums.go +++ /dev/null @@ -1,125 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeEventHub ... - EndpointTypeEventHub EndpointType = "EventHub" - // EndpointTypeEventSubscriptionDestination ... - EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" - // EndpointTypeWebHook ... - EndpointTypeWebHook EndpointType = "WebHook" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeWebHook} -} - -// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. -type EventSubscriptionProvisioningState string - -const ( - // Canceled ... - Canceled EventSubscriptionProvisioningState = "Canceled" - // Creating ... - Creating EventSubscriptionProvisioningState = "Creating" - // Deleting ... - Deleting EventSubscriptionProvisioningState = "Deleting" - // Failed ... - Failed EventSubscriptionProvisioningState = "Failed" - // Succeeded ... - Succeeded EventSubscriptionProvisioningState = "Succeeded" - // Updating ... - Updating EventSubscriptionProvisioningState = "Updating" -) - -// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. -func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { - return []EventSubscriptionProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // System ... - System OperationOrigin = "System" - // User ... - User OperationOrigin = "User" - // UserAndSystem ... - UserAndSystem OperationOrigin = "UserAndSystem" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{System, User, UserAndSystem} -} - -// ResourceRegionType enumerates the values for resource region type. -type ResourceRegionType string - -const ( - // GlobalResource ... - GlobalResource ResourceRegionType = "GlobalResource" - // RegionalResource ... - RegionalResource ResourceRegionType = "RegionalResource" -) - -// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. -func PossibleResourceRegionTypeValues() []ResourceRegionType { - return []ResourceRegionType{GlobalResource, RegionalResource} -} - -// TopicProvisioningState enumerates the values for topic provisioning state. -type TopicProvisioningState string - -const ( - // TopicProvisioningStateCanceled ... - TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" - // TopicProvisioningStateCreating ... - TopicProvisioningStateCreating TopicProvisioningState = "Creating" - // TopicProvisioningStateDeleting ... - TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" - // TopicProvisioningStateFailed ... - TopicProvisioningStateFailed TopicProvisioningState = "Failed" - // TopicProvisioningStateSucceeded ... - TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" - // TopicProvisioningStateUpdating ... - TopicProvisioningStateUpdating TopicProvisioningState = "Updating" -) - -// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. -func PossibleTopicProvisioningStateValues() []TopicProvisioningState { - return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} -} - -// TopicTypeProvisioningState enumerates the values for topic type provisioning state. -type TopicTypeProvisioningState string - -const ( - // TopicTypeProvisioningStateCanceled ... - TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" - // TopicTypeProvisioningStateCreating ... - TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" - // TopicTypeProvisioningStateDeleting ... - TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" - // TopicTypeProvisioningStateFailed ... - TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" - // TopicTypeProvisioningStateSucceeded ... - TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" - // TopicTypeProvisioningStateUpdating ... - TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" -) - -// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. -func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { - return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} -} diff --git a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventgridapi/interfaces.go b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventgridapi/interfaces.go deleted file mode 100644 index 982db0488985..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventgridapi/interfaces.go +++ /dev/null @@ -1,63 +0,0 @@ -package eventgridapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/eventgrid/mgmt/2017-09-15-preview/eventgrid" -) - -// EventSubscriptionsClientAPI contains the set of methods on the EventSubscriptionsClient type. -type EventSubscriptionsClientAPI interface { - Create(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.EventSubscriptionsCreateFuture, err error) - Delete(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalBySubscription(ctx context.Context) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalBySubscription(ctx context.Context, location string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.EventSubscriptionsUpdateFuture, err error) -} - -var _ EventSubscriptionsClientAPI = (*eventgrid.EventSubscriptionsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result eventgrid.OperationsListResult, err error) -} - -var _ OperationsClientAPI = (*eventgrid.OperationsClient)(nil) - -// TopicsClientAPI contains the set of methods on the TopicsClient type. -type TopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo eventgrid.Topic) (result eventgrid.TopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.Topic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result eventgrid.TopicsListResult, err error) - ListBySubscription(ctx context.Context) (result eventgrid.TopicsListResult, err error) - ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventTypesListResult, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest eventgrid.TopicRegenerateKeyRequest) (result eventgrid.TopicSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters eventgrid.TopicUpdateParameters) (result eventgrid.TopicsUpdateFuture, err error) -} - -var _ TopicsClientAPI = (*eventgrid.TopicsClient)(nil) - -// TopicTypesClientAPI contains the set of methods on the TopicTypesClient type. -type TopicTypesClientAPI interface { - Get(ctx context.Context, topicTypeName string) (result eventgrid.TopicTypeInfo, err error) - List(ctx context.Context) (result eventgrid.TopicTypesListResult, err error) - ListEventTypes(ctx context.Context, topicTypeName string) (result eventgrid.EventTypesListResult, err error) -} - -var _ TopicTypesClientAPI = (*eventgrid.TopicTypesClient)(nil) diff --git a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventsubscriptions.go b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventsubscriptions.go deleted file mode 100644 index ec8c486a3e06..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/eventsubscriptions.go +++ /dev/null @@ -1,1142 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventSubscriptionsClient is the azure EventGrid Management Client -type EventSubscriptionsClient struct { - BaseClient -} - -// NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. -func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { - return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient 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 NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { - return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create asynchronously creates a new event subscription to the specified scope. Existing event subscriptions cannot -// be updated with this API and should instead use the Update event subscription API. -// Parameters: -// scope - the scope of the resource to which the event subscription needs to be created. The scope can be a -// subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an -// EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 64 characters in length and use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information -func (client EventSubscriptionsClient) Create(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client EventSubscriptionsClient) CreatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-09-15-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 EventSubscriptionsClient) CreateSender(req *http.Request) (future EventSubscriptionsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) CreateResponder(resp *http.Response) (result EventSubscription, 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 an existing event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) 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 get properties of an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.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, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) 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 EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResource list all event subscriptions that have been created for a specific topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the resource type -// resourceName - name of the resource -func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(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 = "2017-09-15-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.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific -// topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-09-15-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.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription -func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic -// type. -// Parameters: -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription -// and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-09-15-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.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and resource group and topic type -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-09-15-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.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription -// Parameters: -// location - name of the location -func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalBySubscriptionPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(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 = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and topic type. -// Parameters: -// location - name of the location -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates an existing event subscription. -// Parameters: -// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a -// top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be created -// eventSubscriptionUpdateParameters - updated event subscription information -func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2017-09-15-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2017-09-15-preview/eventgrid/models.go b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/models.go deleted file mode 100644 index 47db32f3c4d3..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/models.go +++ /dev/null @@ -1,1170 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid" - -// EventHubEventSubscriptionDestination information about the event hub destination for an event -// subscription -type EventHubEventSubscriptionDestination struct { - // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination - *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - ehesd.EndpointType = EndpointTypeEventHub - objectMap := make(map[string]interface{}) - if ehesd.EventHubEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties - } - if ehesd.EndpointType != "" { - objectMap["endpointType"] = ehesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. -func (ehesd *EventHubEventSubscriptionDestination) 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 eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) - if err != nil { - return err - } - ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - ehesd.EndpointType = endpointType - } - } - } - - return nil -} - -// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. -type EventHubEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// EventSubscription event Subscription -type EventSubscription struct { - autorest.Response `json:"-"` - // EventSubscriptionProperties - Properties of the event subscription - *EventSubscriptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscription. -func (es EventSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EventSubscriptionProperties != nil { - objectMap["properties"] = es.EventSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. -func (es *EventSubscription) 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 eventSubscriptionProperties EventSubscriptionProperties - err = json.Unmarshal(*v, &eventSubscriptionProperties) - if err != nil { - return err - } - es.EventSubscriptionProperties = &eventSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// BasicEventSubscriptionDestination information about the destination for an event subscription -type BasicEventSubscriptionDestination interface { - AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) - AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) - AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) -} - -// EventSubscriptionDestination information about the destination for an event subscription -type EventSubscriptionDestination struct { - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeWebHook): - var whesd WebHookEventSubscriptionDestination - err := json.Unmarshal(body, &whesd) - return whesd, err - case string(EndpointTypeEventHub): - var ehesd EventHubEventSubscriptionDestination - err := json.Unmarshal(body, &ehesd) - return ehesd, err - default: - var esd EventSubscriptionDestination - err := json.Unmarshal(body, &esd) - return esd, err - } -} -func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) - if err != nil { - return nil, err - } - esdArray[index] = esd - } - return esdArray, nil -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { - esd.EndpointType = EndpointTypeEventSubscriptionDestination - objectMap := make(map[string]interface{}) - if esd.EndpointType != "" { - objectMap["endpointType"] = esd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return &esd, true -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &esd, true -} - -// EventSubscriptionFilter filter for the Event Subscription -type EventSubscriptionFilter struct { - // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. - // The format of this depends on the publisher of the events. - // Wildcard characters are not supported in this path. - SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` - // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. - // Wildcard characters are not supported in this path. - SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` - // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. - // If it is desired to subscribe to all event types, the string "all" needs to be specified as an element in this list. - IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` - // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter - // should be compared in a case sensitive manner. - IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` -} - -// EventSubscriptionFullURL full endpoint url of an event subscription -type EventSubscriptionFullURL struct { - autorest.Response `json:"-"` - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` -} - -// EventSubscriptionProperties properties of the Event Subscription -type EventSubscriptionProperties struct { - // Topic - READ-ONLY; Name of the topic of the event subscription. - Topic *string `json:"topic,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event subscription. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' - ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionProperties. -func (esp EventSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["destination"] = esp.Destination - if esp.Filter != nil { - objectMap["filter"] = esp.Filter - } - if esp.Labels != nil { - objectMap["labels"] = esp.Labels - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. -func (esp *EventSubscriptionProperties) 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 "topic": - if v != nil { - var topic string - err = json.Unmarshal(*v, &topic) - if err != nil { - return err - } - esp.Topic = &topic - } - case "provisioningState": - if v != nil { - var provisioningState EventSubscriptionProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - esp.ProvisioningState = provisioningState - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esp.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esp.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esp.Labels = &labels - } - } - } - - return nil -} - -// EventSubscriptionsCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsCreateFuture) 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 EventSubscriptionsCreateFuture.Result. -func (future *EventSubscriptionsCreateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsDeleteFuture) 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 EventSubscriptionsDeleteFuture.Result. -func (future *EventSubscriptionsDeleteFuture) result(client EventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventSubscriptionsListResult result of the List EventSubscriptions operation -type EventSubscriptionsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of EventSubscriptions - Value *[]EventSubscription `json:"value,omitempty"` -} - -// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsUpdateFuture) 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 EventSubscriptionsUpdateFuture.Result. -func (future *EventSubscriptionsUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionUpdateParameters properties of the Event Subscription update -type EventSubscriptionUpdateParameters struct { - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. -func (esup *EventSubscriptionUpdateParameters) 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 "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esup.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esup.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esup.Labels = &labels - } - } - } - - return nil -} - -// EventType event Type for a subject under a topic -type EventType struct { - // EventTypeProperties - Properties of the event type. - *EventTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventType. -func (et EventType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.EventTypeProperties != nil { - objectMap["properties"] = et.EventTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventType struct. -func (et *EventType) 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 eventTypeProperties EventTypeProperties - err = json.Unmarshal(*v, &eventTypeProperties) - if err != nil { - return err - } - et.EventTypeProperties = &eventTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// EventTypeProperties properties of the event type -type EventTypeProperties struct { - // DisplayName - Display name of the event type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the event type. - Description *string `json:"description,omitempty"` - // SchemaURL - Url of the schema for this event type. - SchemaURL *string `json:"schemaUrl,omitempty"` -} - -// EventTypesListResult result of the List Event Types operation -type EventTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of event types - Value *[]EventType `json:"value,omitempty"` -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,omitempty"` - // Display - Display name of the operation - Display *OperationInfo `json:"display,omitempty"` - // Origin - Origin of the operation. Possible values include: 'User', 'System', 'UserAndSystem' - Origin OperationOrigin `json:"origin,omitempty"` - // Properties - Properties of the operation - Properties interface{} `json:"properties,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"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// Resource definition of a Resource -type Resource struct { - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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) -} - -// Topic eventGrid Topic -type Topic struct { - autorest.Response `json:"-"` - // TopicProperties - Properties of the topic - *TopicProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TopicProperties != nil { - objectMap["properties"] = t.TopicProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Topic struct. -func (t *Topic) 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 topicProperties TopicProperties - err = json.Unmarshal(*v, &topicProperties) - if err != nil { - return err - } - t.TopicProperties = &topicProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TopicProperties properties of the Topic -type TopicProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' - ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the topic. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicProperties. -func (tp TopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TopicRegenerateKeyRequest topic regenerate share access key request -type TopicRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsCreateOrUpdateFuture) 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 TopicsCreateOrUpdateFuture.Result. -func (future *TopicsCreateOrUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateOrUpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsDeleteFuture) 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 TopicsDeleteFuture.Result. -func (future *TopicsDeleteFuture) result(client TopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TopicSharedAccessKeys shared access keys of the Topic -type TopicSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the topic. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the topic. - Key2 *string `json:"key2,omitempty"` -} - -// TopicsListResult result of the List Topics operation -type TopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Topics - Value *[]Topic `json:"value,omitempty"` -} - -// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsUpdateFuture) 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 TopicsUpdateFuture.Result. -func (future *TopicsUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicTypeInfo properties of a topic type info. -type TopicTypeInfo struct { - autorest.Response `json:"-"` - // TopicTypeProperties - Properties of the topic type info - *TopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicTypeInfo. -func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tti.TopicTypeProperties != nil { - objectMap["properties"] = tti.TopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. -func (tti *TopicTypeInfo) 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 topicTypeProperties TopicTypeProperties - err = json.Unmarshal(*v, &topicTypeProperties) - if err != nil { - return err - } - tti.TopicTypeProperties = &topicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tti.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tti.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tti.Type = &typeVar - } - } - } - - return nil -} - -// TopicTypeProperties properties of a topic type. -type TopicTypeProperties struct { - // Provider - Namespace of the provider of the topic type. - Provider *string `json:"provider,omitempty"` - // DisplayName - Display Name for the topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the topic type. - Description *string `json:"description,omitempty"` - // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' - ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` - // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' - ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` - // SupportedLocations - List of locations supported by this topic type. - SupportedLocations *[]string `json:"supportedLocations,omitempty"` -} - -// TopicTypesListResult result of the List Topic Types operation -type TopicTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of topic types - Value *[]TopicTypeInfo `json:"value,omitempty"` -} - -// TopicUpdateParameters properties of the Topic update -type TopicUpdateParameters struct { - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TopicUpdateParameters. -func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// TrackedResource definition of a Tracked Resource -type TrackedResource struct { - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription -type WebHookEventSubscriptionDestination struct { - // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination - *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - whesd.EndpointType = EndpointTypeWebHook - objectMap := make(map[string]interface{}) - if whesd.WebHookEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties - } - if whesd.EndpointType != "" { - objectMap["endpointType"] = whesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return &whesd, true -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &whesd, true -} - -// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. -func (whesd *WebHookEventSubscriptionDestination) 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 webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) - if err != nil { - return err - } - whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - whesd.EndpointType = endpointType - } - } - } - - return nil -} - -// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for -// an event subscription -type WebHookEventSubscriptionDestinationProperties struct { - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` - // EndpointBaseURL - READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. - EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestinationProperties. -func (whesdp WebHookEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if whesdp.EndpointURL != nil { - objectMap["endpointUrl"] = whesdp.EndpointURL - } - return json.Marshal(objectMap) -} diff --git a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/operations.go b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/operations.go deleted file mode 100644 index c6fd04c2b3ee..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure EventGrid 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 list the available operations supported by the Microsoft.EventGrid resource provider -func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/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 -} diff --git a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/topics.go b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/topics.go deleted file mode 100644 index 80205e327471..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/topics.go +++ /dev/null @@ -1,736 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicsClient is the azure EventGrid Management Client -type TopicsClient struct { - BaseClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient 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 NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicInfo - topic information -func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-09-15-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicInfo), - 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 TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, 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 TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, 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 existing topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-09-15-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.EventGrid/topics/{topicName}", 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 TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, 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 TopicsClient) 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 get properties of a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-09-15-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.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the topics under a resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result TopicsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client TopicsClient) 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 = "2017-09-15-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.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list all the topics under an Azure subscription -func (client TopicsClient) ListBySubscription(ctx context.Context) (result TopicsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the topic type -// resourceName - name of the topic -func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSharedAccessKeys list the two keys used to publish to a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-09-15-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.EventGrid/topics/{topicName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// regenerateKeyRequest - request body to regenerate key -func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.TopicsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, topicName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-09-15-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.EventGrid/topics/{topicName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 TopicsClient) 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 TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicUpdateParameters - topic update information -func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2017-09-15-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicUpdateParameters), - 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 TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, 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 TopicsClient) UpdateResponder(resp *http.Response) (result Topic, 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/eventgrid/mgmt/2017-09-15-preview/eventgrid/topictypes.go b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/topictypes.go deleted file mode 100644 index 06ae150f9bb0..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/topictypes.go +++ /dev/null @@ -1,244 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicTypesClient is the azure EventGrid Management Client -type TopicTypesClient struct { - BaseClient -} - -// NewTopicTypesClient creates an instance of the TopicTypesClient client. -func NewTopicTypesClient(subscriptionID string) TopicTypesClient { - return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient 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 NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { - return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get information about a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.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, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all registered topic types -func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"), - 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 TopicTypesClient) 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 TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2017-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, 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/eventgrid/mgmt/2017-09-15-preview/eventgrid/version.go b/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/version.go deleted file mode 100644 index 5545031c7c87..000000000000 --- a/services/preview/eventgrid/mgmt/2017-09-15-preview/eventgrid/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package eventgrid - -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() + " eventgrid/2017-09-15-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/CHANGELOG.md b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/_meta.json b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/_meta.json deleted file mode 100644 index b45dedc5c3ef..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "tag": "package-2018-05-preview", - "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-2018-05-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/client.go b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/client.go deleted file mode 100644 index 668db80a9ff2..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2018-05-01-preview. -// -// Azure EventGrid Management Client -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Eventgrid - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Eventgrid. -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/eventgrid/mgmt/2018-05-01-preview/eventgrid/enums.go b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/enums.go deleted file mode 100644 index 1cdb2cca7b50..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/enums.go +++ /dev/null @@ -1,179 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeEventHub ... - EndpointTypeEventHub EndpointType = "EventHub" - // EndpointTypeEventSubscriptionDestination ... - EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" - // EndpointTypeHybridConnection ... - EndpointTypeHybridConnection EndpointType = "HybridConnection" - // EndpointTypeStorageQueue ... - EndpointTypeStorageQueue EndpointType = "StorageQueue" - // EndpointTypeWebHook ... - EndpointTypeWebHook EndpointType = "WebHook" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeHybridConnection, EndpointTypeStorageQueue, EndpointTypeWebHook} -} - -// EndpointTypeBasicDeadLetterDestination enumerates the values for endpoint type basic dead letter -// destination. -type EndpointTypeBasicDeadLetterDestination string - -const ( - // EndpointTypeDeadLetterDestination ... - EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = "DeadLetterDestination" - // EndpointTypeStorageBlob ... - EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = "StorageBlob" -) - -// PossibleEndpointTypeBasicDeadLetterDestinationValues returns an array of possible values for the EndpointTypeBasicDeadLetterDestination const type. -func PossibleEndpointTypeBasicDeadLetterDestinationValues() []EndpointTypeBasicDeadLetterDestination { - return []EndpointTypeBasicDeadLetterDestination{EndpointTypeDeadLetterDestination, EndpointTypeStorageBlob} -} - -// EventDeliverySchema enumerates the values for event delivery schema. -type EventDeliverySchema string - -const ( - // CloudEventV01Schema ... - CloudEventV01Schema EventDeliverySchema = "CloudEventV01Schema" - // EventGridSchema ... - EventGridSchema EventDeliverySchema = "EventGridSchema" - // InputEventSchema ... - InputEventSchema EventDeliverySchema = "InputEventSchema" -) - -// PossibleEventDeliverySchemaValues returns an array of possible values for the EventDeliverySchema const type. -func PossibleEventDeliverySchemaValues() []EventDeliverySchema { - return []EventDeliverySchema{CloudEventV01Schema, EventGridSchema, InputEventSchema} -} - -// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. -type EventSubscriptionProvisioningState string - -const ( - // AwaitingManualAction ... - AwaitingManualAction EventSubscriptionProvisioningState = "AwaitingManualAction" - // Canceled ... - Canceled EventSubscriptionProvisioningState = "Canceled" - // Creating ... - Creating EventSubscriptionProvisioningState = "Creating" - // Deleting ... - Deleting EventSubscriptionProvisioningState = "Deleting" - // Failed ... - Failed EventSubscriptionProvisioningState = "Failed" - // Succeeded ... - Succeeded EventSubscriptionProvisioningState = "Succeeded" - // Updating ... - Updating EventSubscriptionProvisioningState = "Updating" -) - -// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. -func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { - return []EventSubscriptionProvisioningState{AwaitingManualAction, Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// InputSchema enumerates the values for input schema. -type InputSchema string - -const ( - // InputSchemaCloudEventV01Schema ... - InputSchemaCloudEventV01Schema InputSchema = "CloudEventV01Schema" - // InputSchemaCustomEventSchema ... - InputSchemaCustomEventSchema InputSchema = "CustomEventSchema" - // InputSchemaEventGridSchema ... - InputSchemaEventGridSchema InputSchema = "EventGridSchema" -) - -// PossibleInputSchemaValues returns an array of possible values for the InputSchema const type. -func PossibleInputSchemaValues() []InputSchema { - return []InputSchema{InputSchemaCloudEventV01Schema, InputSchemaCustomEventSchema, InputSchemaEventGridSchema} -} - -// InputSchemaMappingType enumerates the values for input schema mapping type. -type InputSchemaMappingType string - -const ( - // InputSchemaMappingTypeInputSchemaMapping ... - InputSchemaMappingTypeInputSchemaMapping InputSchemaMappingType = "InputSchemaMapping" - // InputSchemaMappingTypeJSON ... - InputSchemaMappingTypeJSON InputSchemaMappingType = "Json" -) - -// PossibleInputSchemaMappingTypeValues returns an array of possible values for the InputSchemaMappingType const type. -func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { - return []InputSchemaMappingType{InputSchemaMappingTypeInputSchemaMapping, InputSchemaMappingTypeJSON} -} - -// ResourceRegionType enumerates the values for resource region type. -type ResourceRegionType string - -const ( - // GlobalResource ... - GlobalResource ResourceRegionType = "GlobalResource" - // RegionalResource ... - RegionalResource ResourceRegionType = "RegionalResource" -) - -// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. -func PossibleResourceRegionTypeValues() []ResourceRegionType { - return []ResourceRegionType{GlobalResource, RegionalResource} -} - -// TopicProvisioningState enumerates the values for topic provisioning state. -type TopicProvisioningState string - -const ( - // TopicProvisioningStateCanceled ... - TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" - // TopicProvisioningStateCreating ... - TopicProvisioningStateCreating TopicProvisioningState = "Creating" - // TopicProvisioningStateDeleting ... - TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" - // TopicProvisioningStateFailed ... - TopicProvisioningStateFailed TopicProvisioningState = "Failed" - // TopicProvisioningStateSucceeded ... - TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" - // TopicProvisioningStateUpdating ... - TopicProvisioningStateUpdating TopicProvisioningState = "Updating" -) - -// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. -func PossibleTopicProvisioningStateValues() []TopicProvisioningState { - return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} -} - -// TopicTypeProvisioningState enumerates the values for topic type provisioning state. -type TopicTypeProvisioningState string - -const ( - // TopicTypeProvisioningStateCanceled ... - TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" - // TopicTypeProvisioningStateCreating ... - TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" - // TopicTypeProvisioningStateDeleting ... - TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" - // TopicTypeProvisioningStateFailed ... - TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" - // TopicTypeProvisioningStateSucceeded ... - TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" - // TopicTypeProvisioningStateUpdating ... - TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" -) - -// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. -func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { - return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} -} diff --git a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/eventgridapi/interfaces.go b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/eventgridapi/interfaces.go deleted file mode 100644 index 9fccb41377d2..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/eventgridapi/interfaces.go +++ /dev/null @@ -1,63 +0,0 @@ -package eventgridapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/eventgrid/mgmt/2018-05-01-preview/eventgrid" -) - -// EventSubscriptionsClientAPI contains the set of methods on the EventSubscriptionsClient type. -type EventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.EventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalBySubscription(ctx context.Context) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalBySubscription(ctx context.Context, location string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.EventSubscriptionsUpdateFuture, err error) -} - -var _ EventSubscriptionsClientAPI = (*eventgrid.EventSubscriptionsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result eventgrid.OperationsListResult, err error) -} - -var _ OperationsClientAPI = (*eventgrid.OperationsClient)(nil) - -// TopicsClientAPI contains the set of methods on the TopicsClient type. -type TopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo eventgrid.Topic) (result eventgrid.TopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.Topic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result eventgrid.TopicsListResult, err error) - ListBySubscription(ctx context.Context) (result eventgrid.TopicsListResult, err error) - ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventTypesListResult, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest eventgrid.TopicRegenerateKeyRequest) (result eventgrid.TopicSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters eventgrid.TopicUpdateParameters) (result eventgrid.TopicsUpdateFuture, err error) -} - -var _ TopicsClientAPI = (*eventgrid.TopicsClient)(nil) - -// TopicTypesClientAPI contains the set of methods on the TopicTypesClient type. -type TopicTypesClientAPI interface { - Get(ctx context.Context, topicTypeName string) (result eventgrid.TopicTypeInfo, err error) - List(ctx context.Context) (result eventgrid.TopicTypesListResult, err error) - ListEventTypes(ctx context.Context, topicTypeName string) (result eventgrid.EventTypesListResult, err error) -} - -var _ TopicTypesClientAPI = (*eventgrid.TopicTypesClient)(nil) diff --git a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/eventsubscriptions.go b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/eventsubscriptions.go deleted file mode 100644 index 2f08d7f1a645..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/eventsubscriptions.go +++ /dev/null @@ -1,1142 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventSubscriptionsClient is the azure EventGrid Management Client -type EventSubscriptionsClient struct { - BaseClient -} - -// NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. -func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { - return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient 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 NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { - return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new event subscription or updates an existing event subscription based on -// the specified scope. -// Parameters: -// scope - the identifier of the resource to which the event subscription needs to be created or updated. The -// scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider -// namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. Event subscription names must be between 3 and 64 -// characters in length and should use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information -func (client EventSubscriptionsClient) CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-05-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 EventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future EventSubscriptionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an existing event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) 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 get properties of an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.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, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) 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 EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResource list all event subscriptions that have been created for a specific topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the resource type -// resourceName - name of the resource -func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-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/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(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 = "2018-05-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.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific -// topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-05-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.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription -func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic -// type. -// Parameters: -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription -// and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-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.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and resource group and topic type -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-05-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.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription -// Parameters: -// location - name of the location -func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalBySubscriptionPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(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 = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and topic type. -// Parameters: -// location - name of the location -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates an existing event subscription. -// Parameters: -// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a -// top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be updated -// eventSubscriptionUpdateParameters - updated event subscription information -func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-05-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2018-05-01-preview/eventgrid/models.go b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/models.go deleted file mode 100644 index 62b5210541c7..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/models.go +++ /dev/null @@ -1,1872 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid" - -// BasicDeadLetterDestination information about the dead letter destination for an event subscription. To configure a -// deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a -// derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. -type BasicDeadLetterDestination interface { - AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) - AsDeadLetterDestination() (*DeadLetterDestination, bool) -} - -// DeadLetterDestination information about the dead letter destination for an event subscription. To configure -// a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an -// object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from -// this class. -type DeadLetterDestination struct { - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -func unmarshalBasicDeadLetterDestination(body []byte) (BasicDeadLetterDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeStorageBlob): - var sbdld StorageBlobDeadLetterDestination - err := json.Unmarshal(body, &sbdld) - return sbdld, err - default: - var dld DeadLetterDestination - err := json.Unmarshal(body, &dld) - return dld, err - } -} -func unmarshalBasicDeadLetterDestinationArray(body []byte) ([]BasicDeadLetterDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dldArray := make([]BasicDeadLetterDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dld, err := unmarshalBasicDeadLetterDestination(*rawMessage) - if err != nil { - return nil, err - } - dldArray[index] = dld - } - return dldArray, nil -} - -// MarshalJSON is the custom marshaler for DeadLetterDestination. -func (dld DeadLetterDestination) MarshalJSON() ([]byte, error) { - dld.EndpointType = EndpointTypeDeadLetterDestination - objectMap := make(map[string]interface{}) - if dld.EndpointType != "" { - objectMap["endpointType"] = dld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return nil, false -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return &dld, true -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &dld, true -} - -// EventHubEventSubscriptionDestination information about the event hub destination for an event -// subscription -type EventHubEventSubscriptionDestination struct { - // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination - *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - ehesd.EndpointType = EndpointTypeEventHub - objectMap := make(map[string]interface{}) - if ehesd.EventHubEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties - } - if ehesd.EndpointType != "" { - objectMap["endpointType"] = ehesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. -func (ehesd *EventHubEventSubscriptionDestination) 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 eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) - if err != nil { - return err - } - ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - ehesd.EndpointType = endpointType - } - } - } - - return nil -} - -// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. -type EventHubEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// EventSubscription event Subscription -type EventSubscription struct { - autorest.Response `json:"-"` - // EventSubscriptionProperties - Properties of the event subscription - *EventSubscriptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscription. -func (es EventSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EventSubscriptionProperties != nil { - objectMap["properties"] = es.EventSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. -func (es *EventSubscription) 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 eventSubscriptionProperties EventSubscriptionProperties - err = json.Unmarshal(*v, &eventSubscriptionProperties) - if err != nil { - return err - } - es.EventSubscriptionProperties = &eventSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// BasicEventSubscriptionDestination information about the destination for an event subscription -type BasicEventSubscriptionDestination interface { - AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) - AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) - AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) - AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) - AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) -} - -// EventSubscriptionDestination information about the destination for an event subscription -type EventSubscriptionDestination struct { - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeWebHook): - var whesd WebHookEventSubscriptionDestination - err := json.Unmarshal(body, &whesd) - return whesd, err - case string(EndpointTypeEventHub): - var ehesd EventHubEventSubscriptionDestination - err := json.Unmarshal(body, &ehesd) - return ehesd, err - case string(EndpointTypeStorageQueue): - var sqesd StorageQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sqesd) - return sqesd, err - case string(EndpointTypeHybridConnection): - var hcesd HybridConnectionEventSubscriptionDestination - err := json.Unmarshal(body, &hcesd) - return hcesd, err - default: - var esd EventSubscriptionDestination - err := json.Unmarshal(body, &esd) - return esd, err - } -} -func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) - if err != nil { - return nil, err - } - esdArray[index] = esd - } - return esdArray, nil -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { - esd.EndpointType = EndpointTypeEventSubscriptionDestination - objectMap := make(map[string]interface{}) - if esd.EndpointType != "" { - objectMap["endpointType"] = esd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return &esd, true -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &esd, true -} - -// EventSubscriptionFilter filter for the Event Subscription -type EventSubscriptionFilter struct { - // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. - // The format of this depends on the publisher of the events. - // Wildcard characters are not supported in this path. - SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` - // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. - // Wildcard characters are not supported in this path. - SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` - // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. - // If it is desired to subscribe to all event types, the string "all" needs to be specified as an element in this list. - IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` - // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter - // should be compared in a case sensitive manner. - IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` -} - -// EventSubscriptionFullURL full endpoint url of an event subscription -type EventSubscriptionFullURL struct { - autorest.Response `json:"-"` - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` -} - -// EventSubscriptionProperties properties of the Event Subscription -type EventSubscriptionProperties struct { - // Topic - READ-ONLY; Name of the topic of the event subscription. - Topic *string `json:"topic,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event subscription. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed', 'AwaitingManualAction' - ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The DeadLetter destination of the event subscription. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionProperties. -func (esp EventSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["destination"] = esp.Destination - if esp.Filter != nil { - objectMap["filter"] = esp.Filter - } - if esp.Labels != nil { - objectMap["labels"] = esp.Labels - } - if esp.EventDeliverySchema != "" { - objectMap["eventDeliverySchema"] = esp.EventDeliverySchema - } - if esp.RetryPolicy != nil { - objectMap["retryPolicy"] = esp.RetryPolicy - } - objectMap["deadLetterDestination"] = esp.DeadLetterDestination - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. -func (esp *EventSubscriptionProperties) 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 "topic": - if v != nil { - var topic string - err = json.Unmarshal(*v, &topic) - if err != nil { - return err - } - esp.Topic = &topic - } - case "provisioningState": - if v != nil { - var provisioningState EventSubscriptionProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - esp.ProvisioningState = provisioningState - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esp.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esp.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esp.Labels = &labels - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esp.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esp.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esp.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsCreateOrUpdateFuture) 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 EventSubscriptionsCreateOrUpdateFuture.Result. -func (future *EventSubscriptionsCreateOrUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsDeleteFuture) 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 EventSubscriptionsDeleteFuture.Result. -func (future *EventSubscriptionsDeleteFuture) result(client EventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventSubscriptionsListResult result of the List EventSubscriptions operation -type EventSubscriptionsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of EventSubscriptions - Value *[]EventSubscription `json:"value,omitempty"` -} - -// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsUpdateFuture) 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 EventSubscriptionsUpdateFuture.Result. -func (future *EventSubscriptionsUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionUpdateParameters properties of the Event Subscription update -type EventSubscriptionUpdateParameters struct { - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'InputEventSchema', 'CloudEventV01Schema' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The DeadLetter destination of the event subscription. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. -func (esup *EventSubscriptionUpdateParameters) 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 "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esup.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esup.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esup.Labels = &labels - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esup.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esup.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esup.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// EventType event Type for a subject under a topic -type EventType struct { - // EventTypeProperties - Properties of the event type. - *EventTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventType. -func (et EventType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.EventTypeProperties != nil { - objectMap["properties"] = et.EventTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventType struct. -func (et *EventType) 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 eventTypeProperties EventTypeProperties - err = json.Unmarshal(*v, &eventTypeProperties) - if err != nil { - return err - } - et.EventTypeProperties = &eventTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// EventTypeProperties properties of the event type -type EventTypeProperties struct { - // DisplayName - Display name of the event type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the event type. - Description *string `json:"description,omitempty"` - // SchemaURL - Url of the schema for this event type. - SchemaURL *string `json:"schemaUrl,omitempty"` -} - -// EventTypesListResult result of the List Event Types operation -type EventTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of event types - Value *[]EventType `json:"value,omitempty"` -} - -// HybridConnectionEventSubscriptionDestination information about the HybridConnection destination for an -// event subscription. -type HybridConnectionEventSubscriptionDestination struct { - // HybridConnectionEventSubscriptionDestinationProperties - Hybrid connection Properties of the event subscription destination - *HybridConnectionEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - hcesd.EndpointType = EndpointTypeHybridConnection - objectMap := make(map[string]interface{}) - if hcesd.HybridConnectionEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = hcesd.HybridConnectionEventSubscriptionDestinationProperties - } - if hcesd.EndpointType != "" { - objectMap["endpointType"] = hcesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestination struct. -func (hcesd *HybridConnectionEventSubscriptionDestination) 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 hybridConnectionEventSubscriptionDestinationProperties HybridConnectionEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &hybridConnectionEventSubscriptionDestinationProperties) - if err != nil { - return err - } - hcesd.HybridConnectionEventSubscriptionDestinationProperties = &hybridConnectionEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - hcesd.EndpointType = endpointType - } - } - } - - return nil -} - -// HybridConnectionEventSubscriptionDestinationProperties the properties for a hybrid connection -// destination. -type HybridConnectionEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of an hybrid connection that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// BasicInputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported -// type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type BasicInputSchemaMapping interface { - AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) - AsInputSchemaMapping() (*InputSchemaMapping, bool) -} - -// InputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only -// supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type InputSchemaMapping struct { - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -func unmarshalBasicInputSchemaMapping(body []byte) (BasicInputSchemaMapping, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["inputSchemaMappingType"] { - case string(InputSchemaMappingTypeJSON): - var jism JSONInputSchemaMapping - err := json.Unmarshal(body, &jism) - return jism, err - default: - var ism InputSchemaMapping - err := json.Unmarshal(body, &ism) - return ism, err - } -} -func unmarshalBasicInputSchemaMappingArray(body []byte) ([]BasicInputSchemaMapping, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ismArray := make([]BasicInputSchemaMapping, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ism, err := unmarshalBasicInputSchemaMapping(*rawMessage) - if err != nil { - return nil, err - } - ismArray[index] = ism - } - return ismArray, nil -} - -// MarshalJSON is the custom marshaler for InputSchemaMapping. -func (ism InputSchemaMapping) MarshalJSON() ([]byte, error) { - ism.InputSchemaMappingType = InputSchemaMappingTypeInputSchemaMapping - objectMap := make(map[string]interface{}) - if ism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = ism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return nil, false -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return &ism, true -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &ism, true -} - -// JSONField this is used to express the source of an input schema mapping for a single target field in the -// Event Grid Event schema. This is currently used in the mappings for the 'id','topic' and 'eventTime' -// properties. This represents a field in the input event schema. -type JSONField struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` -} - -// JSONFieldWithDefault this is used to express the source of an input schema mapping for a single target -// field in the Event Grid Event schema. This is currently used in the mappings for the -// 'subject','eventType' and 'dataVersion' properties. This represents a field in the input event schema -// along with a default value to be used, and at least one of these two properties should be provided. -type JSONFieldWithDefault struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` - // DefaultValue - The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// JSONInputSchemaMapping this enables publishing to Event Grid using a custom input schema. This can be -// used to map properties from a custom input JSON schema to the Event Grid event schema. -type JSONInputSchemaMapping struct { - // JSONInputSchemaMappingProperties - JSON Properties of the input schema mapping - *JSONInputSchemaMappingProperties `json:"properties,omitempty"` - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -// MarshalJSON is the custom marshaler for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { - jism.InputSchemaMappingType = InputSchemaMappingTypeJSON - objectMap := make(map[string]interface{}) - if jism.JSONInputSchemaMappingProperties != nil { - objectMap["properties"] = jism.JSONInputSchemaMappingProperties - } - if jism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = jism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return &jism, true -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return nil, false -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &jism, true -} - -// UnmarshalJSON is the custom unmarshaler for JSONInputSchemaMapping struct. -func (jism *JSONInputSchemaMapping) 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 JSONInputSchemaMappingProperties JSONInputSchemaMappingProperties - err = json.Unmarshal(*v, &JSONInputSchemaMappingProperties) - if err != nil { - return err - } - jism.JSONInputSchemaMappingProperties = &JSONInputSchemaMappingProperties - } - case "inputSchemaMappingType": - if v != nil { - var inputSchemaMappingType InputSchemaMappingType - err = json.Unmarshal(*v, &inputSchemaMappingType) - if err != nil { - return err - } - jism.InputSchemaMappingType = inputSchemaMappingType - } - } - } - - return nil -} - -// JSONInputSchemaMappingProperties this can be used to map properties of a source schema (or default -// values, for certain supported properties) to properties of the EventGridEvent schema. -type JSONInputSchemaMappingProperties struct { - // ID - The mapping information for the Id property of the Event Grid Event. - ID *JSONField `json:"id,omitempty"` - // Topic - The mapping information for the Topic property of the Event Grid Event. - Topic *JSONField `json:"topic,omitempty"` - // EventTime - The mapping information for the EventTime property of the Event Grid Event. - EventTime *JSONField `json:"eventTime,omitempty"` - // EventType - The mapping information for the EventType property of the Event Grid Event. - EventType *JSONFieldWithDefault `json:"eventType,omitempty"` - // Subject - The mapping information for the Subject property of the Event Grid Event. - Subject *JSONFieldWithDefault `json:"subject,omitempty"` - // DataVersion - The mapping information for the DataVersion property of the Event Grid Event. - DataVersion *JSONFieldWithDefault `json:"dataVersion,omitempty"` -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,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"` -} - -// 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"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// Resource definition of a Resource -type Resource struct { - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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) -} - -// RetryPolicy information about the retry policy for an event subscription -type RetryPolicy struct { - // MaxDeliveryAttempts - Maximum number of delivery retry attempts for events. - MaxDeliveryAttempts *int32 `json:"maxDeliveryAttempts,omitempty"` - // EventTimeToLiveInMinutes - Time To Live (in minutes) for events. - EventTimeToLiveInMinutes *int32 `json:"eventTimeToLiveInMinutes,omitempty"` -} - -// StorageBlobDeadLetterDestination information about the storage blob based dead letter destination. -type StorageBlobDeadLetterDestination struct { - // StorageBlobDeadLetterDestinationProperties - The properties of the Storage Blob based deadletter destination - *StorageBlobDeadLetterDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { - sbdld.EndpointType = EndpointTypeStorageBlob - objectMap := make(map[string]interface{}) - if sbdld.StorageBlobDeadLetterDestinationProperties != nil { - objectMap["properties"] = sbdld.StorageBlobDeadLetterDestinationProperties - } - if sbdld.EndpointType != "" { - objectMap["endpointType"] = sbdld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return &sbdld, true -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return nil, false -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &sbdld, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageBlobDeadLetterDestination struct. -func (sbdld *StorageBlobDeadLetterDestination) 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 storageBlobDeadLetterDestinationProperties StorageBlobDeadLetterDestinationProperties - err = json.Unmarshal(*v, &storageBlobDeadLetterDestinationProperties) - if err != nil { - return err - } - sbdld.StorageBlobDeadLetterDestinationProperties = &storageBlobDeadLetterDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointTypeBasicDeadLetterDestination - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbdld.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageBlobDeadLetterDestinationProperties properties of the storage blob based dead letter destination. -type StorageBlobDeadLetterDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that is the destination of the deadletter events - ResourceID *string `json:"resourceId,omitempty"` - // BlobContainerName - The name of the Storage blob container that is the destination of the deadletter events - BlobContainerName *string `json:"blobContainerName,omitempty"` -} - -// StorageQueueEventSubscriptionDestination information about the storage queue destination for an event -// subscription. -type StorageQueueEventSubscriptionDestination struct { - // StorageQueueEventSubscriptionDestinationProperties - Storage Queue Properties of the event subscription destination - *StorageQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sqesd.EndpointType = EndpointTypeStorageQueue - objectMap := make(map[string]interface{}) - if sqesd.StorageQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sqesd.StorageQueueEventSubscriptionDestinationProperties - } - if sqesd.EndpointType != "" { - objectMap["endpointType"] = sqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageQueueEventSubscriptionDestination struct. -func (sqesd *StorageQueueEventSubscriptionDestination) 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 storageQueueEventSubscriptionDestinationProperties StorageQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &storageQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sqesd.StorageQueueEventSubscriptionDestinationProperties = &storageQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageQueueEventSubscriptionDestinationProperties the properties for a storage queue destination. -type StorageQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // QueueName - The name of the Storage queue under a storage account that is the destination of an event subscription. - QueueName *string `json:"queueName,omitempty"` -} - -// Topic eventGrid Topic -type Topic struct { - autorest.Response `json:"-"` - // TopicProperties - Properties of the topic - *TopicProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TopicProperties != nil { - objectMap["properties"] = t.TopicProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Topic struct. -func (t *Topic) 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 topicProperties TopicProperties - err = json.Unmarshal(*v, &topicProperties) - if err != nil { - return err - } - t.TopicProperties = &topicProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TopicProperties properties of the Topic -type TopicProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' - ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the topic. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventV01Schema' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicProperties. -func (tp TopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.InputSchema != "" { - objectMap["inputSchema"] = tp.InputSchema - } - objectMap["inputSchemaMapping"] = tp.InputSchemaMapping - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicProperties struct. -func (tp *TopicProperties) 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 "provisioningState": - if v != nil { - var provisioningState TopicProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - tp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - tp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - tp.InputSchemaMapping = inputSchemaMapping - } - } - } - - return nil -} - -// TopicRegenerateKeyRequest topic regenerate share access key request -type TopicRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsCreateOrUpdateFuture) 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 TopicsCreateOrUpdateFuture.Result. -func (future *TopicsCreateOrUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateOrUpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsDeleteFuture) 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 TopicsDeleteFuture.Result. -func (future *TopicsDeleteFuture) result(client TopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TopicSharedAccessKeys shared access keys of the Topic -type TopicSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the topic. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the topic. - Key2 *string `json:"key2,omitempty"` -} - -// TopicsListResult result of the List Topics operation -type TopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Topics - Value *[]Topic `json:"value,omitempty"` -} - -// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsUpdateFuture) 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 TopicsUpdateFuture.Result. -func (future *TopicsUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicTypeInfo properties of a topic type info. -type TopicTypeInfo struct { - autorest.Response `json:"-"` - // TopicTypeProperties - Properties of the topic type info - *TopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicTypeInfo. -func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tti.TopicTypeProperties != nil { - objectMap["properties"] = tti.TopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. -func (tti *TopicTypeInfo) 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 topicTypeProperties TopicTypeProperties - err = json.Unmarshal(*v, &topicTypeProperties) - if err != nil { - return err - } - tti.TopicTypeProperties = &topicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tti.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tti.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tti.Type = &typeVar - } - } - } - - return nil -} - -// TopicTypeProperties properties of a topic type. -type TopicTypeProperties struct { - // Provider - Namespace of the provider of the topic type. - Provider *string `json:"provider,omitempty"` - // DisplayName - Display Name for the topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the topic type. - Description *string `json:"description,omitempty"` - // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' - ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` - // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' - ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` - // SupportedLocations - List of locations supported by this topic type. - SupportedLocations *[]string `json:"supportedLocations,omitempty"` -} - -// TopicTypesListResult result of the List Topic Types operation -type TopicTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of topic types - Value *[]TopicTypeInfo `json:"value,omitempty"` -} - -// TopicUpdateParameters properties of the Topic update -type TopicUpdateParameters struct { - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TopicUpdateParameters. -func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// TrackedResource definition of a Tracked Resource -type TrackedResource struct { - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription -type WebHookEventSubscriptionDestination struct { - // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination - *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - whesd.EndpointType = EndpointTypeWebHook - objectMap := make(map[string]interface{}) - if whesd.WebHookEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties - } - if whesd.EndpointType != "" { - objectMap["endpointType"] = whesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return &whesd, true -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &whesd, true -} - -// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. -func (whesd *WebHookEventSubscriptionDestination) 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 webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) - if err != nil { - return err - } - whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - whesd.EndpointType = endpointType - } - } - } - - return nil -} - -// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for -// an event subscription. -type WebHookEventSubscriptionDestinationProperties struct { - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` - // EndpointBaseURL - READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. - EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestinationProperties. -func (whesdp WebHookEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if whesdp.EndpointURL != nil { - objectMap["endpointUrl"] = whesdp.EndpointURL - } - return json.Marshal(objectMap) -} diff --git a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/operations.go b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/operations.go deleted file mode 100644 index 89be0fda358e..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure EventGrid 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 list the available operations supported by the Microsoft.EventGrid resource provider -func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/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 -} diff --git a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/topics.go b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/topics.go deleted file mode 100644 index 22020184a623..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/topics.go +++ /dev/null @@ -1,736 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicsClient is the azure EventGrid Management Client -type TopicsClient struct { - BaseClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient 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 NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicInfo - topic information -func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-05-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicInfo), - 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 TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, 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 TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, 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 existing topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-05-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.EventGrid/topics/{topicName}", 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 TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, 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 TopicsClient) 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 get properties of a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-05-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.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the topics under a resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result TopicsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client TopicsClient) 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 = "2018-05-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.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list all the topics under an Azure subscription -func (client TopicsClient) ListBySubscription(ctx context.Context) (result TopicsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the topic type -// resourceName - name of the topic -func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-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/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSharedAccessKeys list the two keys used to publish to a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-05-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.EventGrid/topics/{topicName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// regenerateKeyRequest - request body to regenerate key -func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.TopicsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, topicName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-05-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.EventGrid/topics/{topicName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 TopicsClient) 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 TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicUpdateParameters - topic update information -func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-05-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicUpdateParameters), - 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 TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, 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 TopicsClient) UpdateResponder(resp *http.Response) (result Topic, 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/eventgrid/mgmt/2018-05-01-preview/eventgrid/topictypes.go b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/topictypes.go deleted file mode 100644 index ca1a27b35907..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/topictypes.go +++ /dev/null @@ -1,244 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicTypesClient is the azure EventGrid Management Client -type TopicTypesClient struct { - BaseClient -} - -// NewTopicTypesClient creates an instance of the TopicTypesClient client. -func NewTopicTypesClient(subscriptionID string) TopicTypesClient { - return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient 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 NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { - return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get information about a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.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, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all registered topic types -func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"), - 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 TopicTypesClient) 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 TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, 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/eventgrid/mgmt/2018-05-01-preview/eventgrid/version.go b/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/version.go deleted file mode 100644 index df6572c734b0..000000000000 --- a/services/preview/eventgrid/mgmt/2018-05-01-preview/eventgrid/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package eventgrid - -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() + " eventgrid/2018-05-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/eventgrid/mgmt/2018-09-15-preview/eventgrid/CHANGELOG.md b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/_meta.json b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/_meta.json deleted file mode 100644 index b2910c094247..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "tag": "package-2018-09-preview", - "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-2018-09-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/client.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/client.go deleted file mode 100644 index b8d2b2997acd..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2018-09-15-preview. -// -// Azure EventGrid Management Client -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Eventgrid - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Eventgrid. -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/eventgrid/mgmt/2018-09-15-preview/eventgrid/domains.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domains.go deleted file mode 100644 index 94a40293e3c2..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domains.go +++ /dev/null @@ -1,656 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainsClient is the azure EventGrid Management Client -type DomainsClient struct { - BaseClient -} - -// NewDomainsClient creates an instance of the DomainsClient client. -func NewDomainsClient(subscriptionID string) DomainsClient { - return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainsClientWithBaseURI creates an instance of the DomainsClient 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 NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { - return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainInfo - domain information -func (client DomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (result DomainsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainInfo), - 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 DomainsClient) CreateOrUpdateSender(req *http.Request) (future DomainsCreateOrUpdateFuture, 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 DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, 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 existing domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -func (client DomainsClient) Delete(ctx context.Context, resourceGroupName string, domainName string) (result DomainsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-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.EventGrid/domains/{domainName}", 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 DomainsClient) DeleteSender(req *http.Request) (future DomainsDeleteFuture, 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 DomainsClient) 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 get properties of a domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -func (client DomainsClient) Get(ctx context.Context, resourceGroupName string, domainName string) (result Domain, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-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.EventGrid/domains/{domainName}", 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 DomainsClient) 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 DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the domains under a resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -func (client DomainsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DomainsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DomainsClient) 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 = "2018-09-15-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.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list all the domains under an Azure subscription -func (client DomainsClient) ListBySubscription(ctx context.Context) (result DomainsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DomainsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListBySubscriptionResponder(resp *http.Response) (result DomainsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSharedAccessKeys list the two keys used to publish to a domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -func (client DomainsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client DomainsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-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.EventGrid/domains/{domainName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListSharedAccessKeysResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// regenerateKeyRequest - request body to regenerate key -func (client DomainsClient) RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.DomainsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, domainName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DomainsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-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.EventGrid/domains/{domainName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 DomainsClient) 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 DomainsClient) RegenerateKeyResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainUpdateParameters - domain update information -func (client DomainsClient) Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (result DomainsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainName, domainUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainUpdateParameters), - 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 DomainsClient) UpdateSender(req *http.Request) (future DomainsUpdateFuture, 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 DomainsClient) UpdateResponder(resp *http.Response) (result Domain, 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/eventgrid/mgmt/2018-09-15-preview/eventgrid/domaintopics.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domaintopics.go deleted file mode 100644 index 6eafb03b7bcc..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domaintopics.go +++ /dev/null @@ -1,185 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainTopicsClient is the azure EventGrid Management Client -type DomainTopicsClient struct { - BaseClient -} - -// NewDomainTopicsClient creates an instance of the DomainTopicsClient client. -func NewDomainTopicsClient(subscriptionID string) DomainTopicsClient { - return NewDomainTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainTopicsClientWithBaseURI creates an instance of the DomainTopicsClient 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 NewDomainTopicsClientWithBaseURI(baseURI string, subscriptionID string) DomainTopicsClient { - return DomainTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get properties of a domain topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// topicName - name of the topic -func (client DomainTopicsClient) Get(ctx context.Context, resourceGroupName string, domainName string, topicName string) (result DomainTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.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, domainName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-09-15-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.EventGrid/domains/{domainName}/topics/{topicName}", 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 DomainTopicsClient) 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 DomainTopicsClient) GetResponder(resp *http.Response) (result DomainTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomain list all the topics in a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - domain name. -func (client DomainTopicsClient) ListByDomain(ctx context.Context, resourceGroupName string, domainName string) (result DomainTopicsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDomainPreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure sending request") - return - } - - result, err = client.ListByDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure responding to request") - return - } - - return -} - -// ListByDomainPreparer prepares the ListByDomain request. -func (client DomainTopicsClient) ListByDomainPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-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.EventGrid/domains/{domainName}/topics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainSender sends the ListByDomain request. The method will close the -// http.Response Body if it receives an error. -func (client DomainTopicsClient) ListByDomainSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainResponder handles the response to the ListByDomain request. The method always -// closes the http.Response Body. -func (client DomainTopicsClient) ListByDomainResponder(resp *http.Response) (result DomainTopicsListResult, 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/eventgrid/mgmt/2018-09-15-preview/eventgrid/enums.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/enums.go deleted file mode 100644 index b6613c449cf1..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/enums.go +++ /dev/null @@ -1,239 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DomainProvisioningState enumerates the values for domain provisioning state. -type DomainProvisioningState string - -const ( - // Canceled ... - Canceled DomainProvisioningState = "Canceled" - // Creating ... - Creating DomainProvisioningState = "Creating" - // Deleting ... - Deleting DomainProvisioningState = "Deleting" - // Failed ... - Failed DomainProvisioningState = "Failed" - // Succeeded ... - Succeeded DomainProvisioningState = "Succeeded" - // Updating ... - Updating DomainProvisioningState = "Updating" -) - -// PossibleDomainProvisioningStateValues returns an array of possible values for the DomainProvisioningState const type. -func PossibleDomainProvisioningStateValues() []DomainProvisioningState { - return []DomainProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeEventHub ... - EndpointTypeEventHub EndpointType = "EventHub" - // EndpointTypeEventSubscriptionDestination ... - EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" - // EndpointTypeHybridConnection ... - EndpointTypeHybridConnection EndpointType = "HybridConnection" - // EndpointTypeStorageQueue ... - EndpointTypeStorageQueue EndpointType = "StorageQueue" - // EndpointTypeWebHook ... - EndpointTypeWebHook EndpointType = "WebHook" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeHybridConnection, EndpointTypeStorageQueue, EndpointTypeWebHook} -} - -// EndpointTypeBasicDeadLetterDestination enumerates the values for endpoint type basic dead letter -// destination. -type EndpointTypeBasicDeadLetterDestination string - -const ( - // EndpointTypeDeadLetterDestination ... - EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = "DeadLetterDestination" - // EndpointTypeStorageBlob ... - EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = "StorageBlob" -) - -// PossibleEndpointTypeBasicDeadLetterDestinationValues returns an array of possible values for the EndpointTypeBasicDeadLetterDestination const type. -func PossibleEndpointTypeBasicDeadLetterDestinationValues() []EndpointTypeBasicDeadLetterDestination { - return []EndpointTypeBasicDeadLetterDestination{EndpointTypeDeadLetterDestination, EndpointTypeStorageBlob} -} - -// EventDeliverySchema enumerates the values for event delivery schema. -type EventDeliverySchema string - -const ( - // CloudEventV01Schema ... - CloudEventV01Schema EventDeliverySchema = "CloudEventV01Schema" - // CustomInputSchema ... - CustomInputSchema EventDeliverySchema = "CustomInputSchema" - // EventGridSchema ... - EventGridSchema EventDeliverySchema = "EventGridSchema" -) - -// PossibleEventDeliverySchemaValues returns an array of possible values for the EventDeliverySchema const type. -func PossibleEventDeliverySchemaValues() []EventDeliverySchema { - return []EventDeliverySchema{CloudEventV01Schema, CustomInputSchema, EventGridSchema} -} - -// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. -type EventSubscriptionProvisioningState string - -const ( - // EventSubscriptionProvisioningStateAwaitingManualAction ... - EventSubscriptionProvisioningStateAwaitingManualAction EventSubscriptionProvisioningState = "AwaitingManualAction" - // EventSubscriptionProvisioningStateCanceled ... - EventSubscriptionProvisioningStateCanceled EventSubscriptionProvisioningState = "Canceled" - // EventSubscriptionProvisioningStateCreating ... - EventSubscriptionProvisioningStateCreating EventSubscriptionProvisioningState = "Creating" - // EventSubscriptionProvisioningStateDeleting ... - EventSubscriptionProvisioningStateDeleting EventSubscriptionProvisioningState = "Deleting" - // EventSubscriptionProvisioningStateFailed ... - EventSubscriptionProvisioningStateFailed EventSubscriptionProvisioningState = "Failed" - // EventSubscriptionProvisioningStateSucceeded ... - EventSubscriptionProvisioningStateSucceeded EventSubscriptionProvisioningState = "Succeeded" - // EventSubscriptionProvisioningStateUpdating ... - EventSubscriptionProvisioningStateUpdating EventSubscriptionProvisioningState = "Updating" -) - -// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. -func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { - return []EventSubscriptionProvisioningState{EventSubscriptionProvisioningStateAwaitingManualAction, EventSubscriptionProvisioningStateCanceled, EventSubscriptionProvisioningStateCreating, EventSubscriptionProvisioningStateDeleting, EventSubscriptionProvisioningStateFailed, EventSubscriptionProvisioningStateSucceeded, EventSubscriptionProvisioningStateUpdating} -} - -// InputSchema enumerates the values for input schema. -type InputSchema string - -const ( - // InputSchemaCloudEventV01Schema ... - InputSchemaCloudEventV01Schema InputSchema = "CloudEventV01Schema" - // InputSchemaCustomEventSchema ... - InputSchemaCustomEventSchema InputSchema = "CustomEventSchema" - // InputSchemaEventGridSchema ... - InputSchemaEventGridSchema InputSchema = "EventGridSchema" -) - -// PossibleInputSchemaValues returns an array of possible values for the InputSchema const type. -func PossibleInputSchemaValues() []InputSchema { - return []InputSchema{InputSchemaCloudEventV01Schema, InputSchemaCustomEventSchema, InputSchemaEventGridSchema} -} - -// InputSchemaMappingType enumerates the values for input schema mapping type. -type InputSchemaMappingType string - -const ( - // InputSchemaMappingTypeInputSchemaMapping ... - InputSchemaMappingTypeInputSchemaMapping InputSchemaMappingType = "InputSchemaMapping" - // InputSchemaMappingTypeJSON ... - InputSchemaMappingTypeJSON InputSchemaMappingType = "Json" -) - -// PossibleInputSchemaMappingTypeValues returns an array of possible values for the InputSchemaMappingType const type. -func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { - return []InputSchemaMappingType{InputSchemaMappingTypeInputSchemaMapping, InputSchemaMappingTypeJSON} -} - -// OperatorType enumerates the values for operator type. -type OperatorType string - -const ( - // OperatorTypeAdvancedFilter ... - OperatorTypeAdvancedFilter OperatorType = "AdvancedFilter" - // OperatorTypeBoolEquals ... - OperatorTypeBoolEquals OperatorType = "BoolEquals" - // OperatorTypeNumberGreaterThan ... - OperatorTypeNumberGreaterThan OperatorType = "NumberGreaterThan" - // OperatorTypeNumberGreaterThanOrEquals ... - OperatorTypeNumberGreaterThanOrEquals OperatorType = "NumberGreaterThanOrEquals" - // OperatorTypeNumberIn ... - OperatorTypeNumberIn OperatorType = "NumberIn" - // OperatorTypeNumberLessThan ... - OperatorTypeNumberLessThan OperatorType = "NumberLessThan" - // OperatorTypeNumberLessThanOrEquals ... - OperatorTypeNumberLessThanOrEquals OperatorType = "NumberLessThanOrEquals" - // OperatorTypeNumberNotIn ... - OperatorTypeNumberNotIn OperatorType = "NumberNotIn" - // OperatorTypeStringBeginsWith ... - OperatorTypeStringBeginsWith OperatorType = "StringBeginsWith" - // OperatorTypeStringContains ... - OperatorTypeStringContains OperatorType = "StringContains" - // OperatorTypeStringEndsWith ... - OperatorTypeStringEndsWith OperatorType = "StringEndsWith" - // OperatorTypeStringIn ... - OperatorTypeStringIn OperatorType = "StringIn" - // OperatorTypeStringNotIn ... - OperatorTypeStringNotIn OperatorType = "StringNotIn" -) - -// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. -func PossibleOperatorTypeValues() []OperatorType { - return []OperatorType{OperatorTypeAdvancedFilter, OperatorTypeBoolEquals, OperatorTypeNumberGreaterThan, OperatorTypeNumberGreaterThanOrEquals, OperatorTypeNumberIn, OperatorTypeNumberLessThan, OperatorTypeNumberLessThanOrEquals, OperatorTypeNumberNotIn, OperatorTypeStringBeginsWith, OperatorTypeStringContains, OperatorTypeStringEndsWith, OperatorTypeStringIn, OperatorTypeStringNotIn} -} - -// ResourceRegionType enumerates the values for resource region type. -type ResourceRegionType string - -const ( - // GlobalResource ... - GlobalResource ResourceRegionType = "GlobalResource" - // RegionalResource ... - RegionalResource ResourceRegionType = "RegionalResource" -) - -// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. -func PossibleResourceRegionTypeValues() []ResourceRegionType { - return []ResourceRegionType{GlobalResource, RegionalResource} -} - -// TopicProvisioningState enumerates the values for topic provisioning state. -type TopicProvisioningState string - -const ( - // TopicProvisioningStateCanceled ... - TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" - // TopicProvisioningStateCreating ... - TopicProvisioningStateCreating TopicProvisioningState = "Creating" - // TopicProvisioningStateDeleting ... - TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" - // TopicProvisioningStateFailed ... - TopicProvisioningStateFailed TopicProvisioningState = "Failed" - // TopicProvisioningStateSucceeded ... - TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" - // TopicProvisioningStateUpdating ... - TopicProvisioningStateUpdating TopicProvisioningState = "Updating" -) - -// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. -func PossibleTopicProvisioningStateValues() []TopicProvisioningState { - return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} -} - -// TopicTypeProvisioningState enumerates the values for topic type provisioning state. -type TopicTypeProvisioningState string - -const ( - // TopicTypeProvisioningStateCanceled ... - TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" - // TopicTypeProvisioningStateCreating ... - TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" - // TopicTypeProvisioningStateDeleting ... - TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" - // TopicTypeProvisioningStateFailed ... - TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" - // TopicTypeProvisioningStateSucceeded ... - TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" - // TopicTypeProvisioningStateUpdating ... - TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" -) - -// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. -func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { - return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} -} diff --git a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventgridapi/interfaces.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventgridapi/interfaces.go deleted file mode 100644 index c96181b13bb7..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventgridapi/interfaces.go +++ /dev/null @@ -1,86 +0,0 @@ -package eventgridapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/eventgrid/mgmt/2018-09-15-preview/eventgrid" -) - -// DomainsClientAPI contains the set of methods on the DomainsClient type. -type DomainsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo eventgrid.Domain) (result eventgrid.DomainsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.Domain, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result eventgrid.DomainsListResult, err error) - ListBySubscription(ctx context.Context) (result eventgrid.DomainsListResult, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest eventgrid.DomainRegenerateKeyRequest) (result eventgrid.DomainSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters eventgrid.DomainUpdateParameters) (result eventgrid.DomainsUpdateFuture, err error) -} - -var _ DomainsClientAPI = (*eventgrid.DomainsClient)(nil) - -// DomainTopicsClientAPI contains the set of methods on the DomainTopicsClient type. -type DomainTopicsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, domainName string, topicName string) (result eventgrid.DomainTopic, err error) - ListByDomain(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainTopicsListResult, err error) -} - -var _ DomainTopicsClientAPI = (*eventgrid.DomainTopicsClient)(nil) - -// EventSubscriptionsClientAPI contains the set of methods on the EventSubscriptionsClient type. -type EventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.EventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalBySubscription(ctx context.Context) (result eventgrid.EventSubscriptionsListResult, err error) - ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalBySubscription(ctx context.Context, location string) (result eventgrid.EventSubscriptionsListResult, err error) - ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string) (result eventgrid.EventSubscriptionsListResult, err error) - Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.EventSubscriptionsUpdateFuture, err error) -} - -var _ EventSubscriptionsClientAPI = (*eventgrid.EventSubscriptionsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result eventgrid.OperationsListResult, err error) -} - -var _ OperationsClientAPI = (*eventgrid.OperationsClient)(nil) - -// TopicsClientAPI contains the set of methods on the TopicsClient type. -type TopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo eventgrid.Topic) (result eventgrid.TopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.Topic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result eventgrid.TopicsListResult, err error) - ListBySubscription(ctx context.Context) (result eventgrid.TopicsListResult, err error) - ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventTypesListResult, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest eventgrid.TopicRegenerateKeyRequest) (result eventgrid.TopicSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters eventgrid.TopicUpdateParameters) (result eventgrid.TopicsUpdateFuture, err error) -} - -var _ TopicsClientAPI = (*eventgrid.TopicsClient)(nil) - -// TopicTypesClientAPI contains the set of methods on the TopicTypesClient type. -type TopicTypesClientAPI interface { - Get(ctx context.Context, topicTypeName string) (result eventgrid.TopicTypeInfo, err error) - List(ctx context.Context) (result eventgrid.TopicTypesListResult, err error) - ListEventTypes(ctx context.Context, topicTypeName string) (result eventgrid.EventTypesListResult, err error) -} - -var _ TopicTypesClientAPI = (*eventgrid.TopicTypesClient)(nil) diff --git a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventsubscriptions.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventsubscriptions.go deleted file mode 100644 index 1dbed7840ded..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventsubscriptions.go +++ /dev/null @@ -1,1220 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventSubscriptionsClient is the azure EventGrid Management Client -type EventSubscriptionsClient struct { - BaseClient -} - -// NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. -func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { - return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient 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 NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { - return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new event subscription or updates an existing event subscription based on -// the specified scope. -// Parameters: -// scope - the identifier of the resource to which the event subscription needs to be created or updated. The -// scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider -// namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. Event subscription names must be between 3 and 64 -// characters in length and should use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information -func (client EventSubscriptionsClient) CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-09-15-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 EventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future EventSubscriptionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an existing event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) 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 get properties of an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.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, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) 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 EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomainTopic list all event subscriptions that have been created for a specific domain topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the top level domain -// topicName - name of the domain topic -func (client EventSubscriptionsClient) ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDomainTopicPreparer(ctx, resourceGroupName, domainName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure sending request") - return - } - - result, err = client.ListByDomainTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure responding to request") - return - } - - return -} - -// ListByDomainTopicPreparer prepares the ListByDomainTopic request. -func (client EventSubscriptionsClient) ListByDomainTopicPreparer(ctx context.Context, resourceGroupName string, domainName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-09-15-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.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainTopicSender sends the ListByDomainTopic request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByDomainTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainTopicResponder handles the response to the ListByDomainTopic request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByDomainTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResource list all event subscriptions that have been created for a specific topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the resource type -// resourceName - name of the resource -func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(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 = "2018-09-15-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.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific -// topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-09-15-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.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription -func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic -// type. -// Parameters: -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription -// and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-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.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and resource group and topic type -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-09-15-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.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription -// Parameters: -// location - name of the location -func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalBySubscriptionPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(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 = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and topic type. -// Parameters: -// location - name of the location -// topicTypeName - name of the topic type -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string) (result EventSubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - - return -} - -// ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates an existing event subscription. -// Parameters: -// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a -// top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be updated -// eventSubscriptionUpdateParameters - updated event subscription information -func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2018-09-15-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2018-09-15-preview/eventgrid/models.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/models.go deleted file mode 100644 index c9d06339c200..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/models.go +++ /dev/null @@ -1,3659 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid" - -// BasicAdvancedFilter represents an advanced filter that can be used to filter events based on various event -// envelope/data fields. -type BasicAdvancedFilter interface { - AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) - AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) - AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) - AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) - AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) - AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) - AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) - AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) - AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) - AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) - AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) - AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) - AsAdvancedFilter() (*AdvancedFilter, bool) -} - -// AdvancedFilter represents an advanced filter that can be used to filter events based on various event -// envelope/data fields. -type AdvancedFilter struct { - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -func unmarshalBasicAdvancedFilter(body []byte) (BasicAdvancedFilter, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["operatorType"] { - case string(OperatorTypeNumberIn): - var niaf NumberInAdvancedFilter - err := json.Unmarshal(body, &niaf) - return niaf, err - case string(OperatorTypeNumberNotIn): - var nniaf NumberNotInAdvancedFilter - err := json.Unmarshal(body, &nniaf) - return nniaf, err - case string(OperatorTypeNumberLessThan): - var nltaf NumberLessThanAdvancedFilter - err := json.Unmarshal(body, &nltaf) - return nltaf, err - case string(OperatorTypeNumberGreaterThan): - var ngtaf NumberGreaterThanAdvancedFilter - err := json.Unmarshal(body, &ngtaf) - return ngtaf, err - case string(OperatorTypeNumberLessThanOrEquals): - var nltoeaf NumberLessThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &nltoeaf) - return nltoeaf, err - case string(OperatorTypeNumberGreaterThanOrEquals): - var ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &ngtoeaf) - return ngtoeaf, err - case string(OperatorTypeBoolEquals): - var beaf BoolEqualsAdvancedFilter - err := json.Unmarshal(body, &beaf) - return beaf, err - case string(OperatorTypeStringIn): - var siaf StringInAdvancedFilter - err := json.Unmarshal(body, &siaf) - return siaf, err - case string(OperatorTypeStringNotIn): - var sniaf StringNotInAdvancedFilter - err := json.Unmarshal(body, &sniaf) - return sniaf, err - case string(OperatorTypeStringBeginsWith): - var sbwaf StringBeginsWithAdvancedFilter - err := json.Unmarshal(body, &sbwaf) - return sbwaf, err - case string(OperatorTypeStringEndsWith): - var sewaf StringEndsWithAdvancedFilter - err := json.Unmarshal(body, &sewaf) - return sewaf, err - case string(OperatorTypeStringContains): - var scaf StringContainsAdvancedFilter - err := json.Unmarshal(body, &scaf) - return scaf, err - default: - var af AdvancedFilter - err := json.Unmarshal(body, &af) - return af, err - } -} -func unmarshalBasicAdvancedFilterArray(body []byte) ([]BasicAdvancedFilter, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - afArray := make([]BasicAdvancedFilter, len(rawMessages)) - - for index, rawMessage := range rawMessages { - af, err := unmarshalBasicAdvancedFilter(*rawMessage) - if err != nil { - return nil, err - } - afArray[index] = af - } - return afArray, nil -} - -// MarshalJSON is the custom marshaler for AdvancedFilter. -func (af AdvancedFilter) MarshalJSON() ([]byte, error) { - af.OperatorType = OperatorTypeAdvancedFilter - objectMap := make(map[string]interface{}) - if af.Key != nil { - objectMap["key"] = af.Key - } - if af.OperatorType != "" { - objectMap["operatorType"] = af.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return &af, true -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &af, true -} - -// BoolEqualsAdvancedFilter boolEquals Filter -type BoolEqualsAdvancedFilter struct { - // Value - The filter value - Value *bool `json:"value,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - beaf.OperatorType = OperatorTypeBoolEquals - objectMap := make(map[string]interface{}) - if beaf.Value != nil { - objectMap["value"] = beaf.Value - } - if beaf.Key != nil { - objectMap["key"] = beaf.Key - } - if beaf.OperatorType != "" { - objectMap["operatorType"] = beaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return &beaf, true -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &beaf, true -} - -// BasicDeadLetterDestination information about the dead letter destination for an event subscription. To configure a -// deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a -// derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. -type BasicDeadLetterDestination interface { - AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) - AsDeadLetterDestination() (*DeadLetterDestination, bool) -} - -// DeadLetterDestination information about the dead letter destination for an event subscription. To configure -// a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an -// object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from -// this class. -type DeadLetterDestination struct { - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -func unmarshalBasicDeadLetterDestination(body []byte) (BasicDeadLetterDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeStorageBlob): - var sbdld StorageBlobDeadLetterDestination - err := json.Unmarshal(body, &sbdld) - return sbdld, err - default: - var dld DeadLetterDestination - err := json.Unmarshal(body, &dld) - return dld, err - } -} -func unmarshalBasicDeadLetterDestinationArray(body []byte) ([]BasicDeadLetterDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dldArray := make([]BasicDeadLetterDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dld, err := unmarshalBasicDeadLetterDestination(*rawMessage) - if err != nil { - return nil, err - } - dldArray[index] = dld - } - return dldArray, nil -} - -// MarshalJSON is the custom marshaler for DeadLetterDestination. -func (dld DeadLetterDestination) MarshalJSON() ([]byte, error) { - dld.EndpointType = EndpointTypeDeadLetterDestination - objectMap := make(map[string]interface{}) - if dld.EndpointType != "" { - objectMap["endpointType"] = dld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return nil, false -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return &dld, true -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &dld, true -} - -// Domain eventGrid Domain -type Domain struct { - autorest.Response `json:"-"` - // DomainProperties - Properties of the domain - *DomainProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Domain. -func (d Domain) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DomainProperties != nil { - objectMap["properties"] = d.DomainProperties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Domain struct. -func (d *Domain) 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 domainProperties DomainProperties - err = json.Unmarshal(*v, &domainProperties) - if err != nil { - return err - } - d.DomainProperties = &domainProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DomainProperties properties of the Domain -type DomainProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the domain. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' - ProvisioningState DomainProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the domain. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the domain. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventV01Schema' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - Information about the InputSchemaMapping which specified the info about mapping event payload. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainProperties. -func (dp DomainProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.InputSchema != "" { - objectMap["inputSchema"] = dp.InputSchema - } - objectMap["inputSchemaMapping"] = dp.InputSchemaMapping - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainProperties struct. -func (dp *DomainProperties) 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 "provisioningState": - if v != nil { - var provisioningState DomainProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - dp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - dp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - dp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - dp.InputSchemaMapping = inputSchemaMapping - } - } - } - - return nil -} - -// DomainRegenerateKeyRequest domain regenerate share access key request -type DomainRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// DomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsCreateOrUpdateFuture) 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 DomainsCreateOrUpdateFuture.Result. -func (future *DomainsCreateOrUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsDeleteFuture) 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 DomainsDeleteFuture.Result. -func (future *DomainsDeleteFuture) result(client DomainsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainSharedAccessKeys shared access keys of the Domain -type DomainSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the domain. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the domain. - Key2 *string `json:"key2,omitempty"` -} - -// DomainsListResult result of the List Domains operation -type DomainsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domains - Value *[]Domain `json:"value,omitempty"` -} - -// DomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsUpdateFuture) 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 DomainsUpdateFuture.Result. -func (future *DomainsUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainTopic domain Topic -type DomainTopic struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainTopic. -func (dt DomainTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DomainTopicsListResult result of the List Domain Topics operation -type DomainTopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domain Topics - Value *[]DomainTopic `json:"value,omitempty"` -} - -// DomainUpdateParameters properties of the Domain update -type DomainUpdateParameters struct { - // Tags - Tags of the domains resource - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DomainUpdateParameters. -func (dup DomainUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dup.Tags != nil { - objectMap["tags"] = dup.Tags - } - return json.Marshal(objectMap) -} - -// EventHubEventSubscriptionDestination information about the event hub destination for an event -// subscription -type EventHubEventSubscriptionDestination struct { - // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination - *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - ehesd.EndpointType = EndpointTypeEventHub - objectMap := make(map[string]interface{}) - if ehesd.EventHubEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties - } - if ehesd.EndpointType != "" { - objectMap["endpointType"] = ehesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. -func (ehesd *EventHubEventSubscriptionDestination) 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 eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) - if err != nil { - return err - } - ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - ehesd.EndpointType = endpointType - } - } - } - - return nil -} - -// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. -type EventHubEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// EventSubscription event Subscription -type EventSubscription struct { - autorest.Response `json:"-"` - // EventSubscriptionProperties - Properties of the event subscription - *EventSubscriptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscription. -func (es EventSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EventSubscriptionProperties != nil { - objectMap["properties"] = es.EventSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. -func (es *EventSubscription) 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 eventSubscriptionProperties EventSubscriptionProperties - err = json.Unmarshal(*v, &eventSubscriptionProperties) - if err != nil { - return err - } - es.EventSubscriptionProperties = &eventSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// BasicEventSubscriptionDestination information about the destination for an event subscription -type BasicEventSubscriptionDestination interface { - AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) - AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) - AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) - AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) - AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) -} - -// EventSubscriptionDestination information about the destination for an event subscription -type EventSubscriptionDestination struct { - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeWebHook): - var whesd WebHookEventSubscriptionDestination - err := json.Unmarshal(body, &whesd) - return whesd, err - case string(EndpointTypeEventHub): - var ehesd EventHubEventSubscriptionDestination - err := json.Unmarshal(body, &ehesd) - return ehesd, err - case string(EndpointTypeStorageQueue): - var sqesd StorageQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sqesd) - return sqesd, err - case string(EndpointTypeHybridConnection): - var hcesd HybridConnectionEventSubscriptionDestination - err := json.Unmarshal(body, &hcesd) - return hcesd, err - default: - var esd EventSubscriptionDestination - err := json.Unmarshal(body, &esd) - return esd, err - } -} -func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) - if err != nil { - return nil, err - } - esdArray[index] = esd - } - return esdArray, nil -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { - esd.EndpointType = EndpointTypeEventSubscriptionDestination - objectMap := make(map[string]interface{}) - if esd.EndpointType != "" { - objectMap["endpointType"] = esd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return &esd, true -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &esd, true -} - -// EventSubscriptionFilter filter for the Event Subscription -type EventSubscriptionFilter struct { - // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. - // The format of this depends on the publisher of the events. - // Wildcard characters are not supported in this path. - SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` - // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. - // Wildcard characters are not supported in this path. - SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` - // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. - // If it is desired to subscribe to all event types, the string "all" needs to be specified as an element in this list. - IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` - // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter - // should be compared in a case sensitive manner. - IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` - // AdvancedFilters - A list of advanced filters. - AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionFilter struct. -func (esf *EventSubscriptionFilter) 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 "subjectBeginsWith": - if v != nil { - var subjectBeginsWith string - err = json.Unmarshal(*v, &subjectBeginsWith) - if err != nil { - return err - } - esf.SubjectBeginsWith = &subjectBeginsWith - } - case "subjectEndsWith": - if v != nil { - var subjectEndsWith string - err = json.Unmarshal(*v, &subjectEndsWith) - if err != nil { - return err - } - esf.SubjectEndsWith = &subjectEndsWith - } - case "includedEventTypes": - if v != nil { - var includedEventTypes []string - err = json.Unmarshal(*v, &includedEventTypes) - if err != nil { - return err - } - esf.IncludedEventTypes = &includedEventTypes - } - case "isSubjectCaseSensitive": - if v != nil { - var isSubjectCaseSensitive bool - err = json.Unmarshal(*v, &isSubjectCaseSensitive) - if err != nil { - return err - } - esf.IsSubjectCaseSensitive = &isSubjectCaseSensitive - } - case "advancedFilters": - if v != nil { - advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) - if err != nil { - return err - } - esf.AdvancedFilters = &advancedFilters - } - } - } - - return nil -} - -// EventSubscriptionFullURL full endpoint url of an event subscription -type EventSubscriptionFullURL struct { - autorest.Response `json:"-"` - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` -} - -// EventSubscriptionProperties properties of the Event Subscription -type EventSubscriptionProperties struct { - // Topic - READ-ONLY; Name of the topic of the event subscription. - Topic *string `json:"topic,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event subscription. Possible values include: 'EventSubscriptionProvisioningStateCreating', 'EventSubscriptionProvisioningStateUpdating', 'EventSubscriptionProvisioningStateDeleting', 'EventSubscriptionProvisioningStateSucceeded', 'EventSubscriptionProvisioningStateCanceled', 'EventSubscriptionProvisioningStateFailed', 'EventSubscriptionProvisioningStateAwaitingManualAction' - ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Expiration time of the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The DeadLetter destination of the event subscription. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionProperties. -func (esp EventSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["destination"] = esp.Destination - if esp.Filter != nil { - objectMap["filter"] = esp.Filter - } - if esp.Labels != nil { - objectMap["labels"] = esp.Labels - } - if esp.ExpirationTimeUtc != nil { - objectMap["expirationTimeUtc"] = esp.ExpirationTimeUtc - } - if esp.EventDeliverySchema != "" { - objectMap["eventDeliverySchema"] = esp.EventDeliverySchema - } - if esp.RetryPolicy != nil { - objectMap["retryPolicy"] = esp.RetryPolicy - } - objectMap["deadLetterDestination"] = esp.DeadLetterDestination - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. -func (esp *EventSubscriptionProperties) 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 "topic": - if v != nil { - var topic string - err = json.Unmarshal(*v, &topic) - if err != nil { - return err - } - esp.Topic = &topic - } - case "provisioningState": - if v != nil { - var provisioningState EventSubscriptionProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - esp.ProvisioningState = provisioningState - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esp.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esp.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esp.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esp.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esp.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esp.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esp.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsCreateOrUpdateFuture) 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 EventSubscriptionsCreateOrUpdateFuture.Result. -func (future *EventSubscriptionsCreateOrUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsDeleteFuture) 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 EventSubscriptionsDeleteFuture.Result. -func (future *EventSubscriptionsDeleteFuture) result(client EventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventSubscriptionsListResult result of the List EventSubscriptions operation -type EventSubscriptionsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of EventSubscriptions - Value *[]EventSubscription `json:"value,omitempty"` -} - -// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsUpdateFuture) 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 EventSubscriptionsUpdateFuture.Result. -func (future *EventSubscriptionsUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionUpdateParameters properties of the Event Subscription update -type EventSubscriptionUpdateParameters struct { - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Information about the expiration time for the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The DeadLetter destination of the event subscription. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. -func (esup *EventSubscriptionUpdateParameters) 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 "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esup.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esup.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esup.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esup.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esup.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esup.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esup.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// EventType event Type for a subject under a topic -type EventType struct { - // EventTypeProperties - Properties of the event type. - *EventTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventType. -func (et EventType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.EventTypeProperties != nil { - objectMap["properties"] = et.EventTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventType struct. -func (et *EventType) 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 eventTypeProperties EventTypeProperties - err = json.Unmarshal(*v, &eventTypeProperties) - if err != nil { - return err - } - et.EventTypeProperties = &eventTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// EventTypeProperties properties of the event type -type EventTypeProperties struct { - // DisplayName - Display name of the event type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the event type. - Description *string `json:"description,omitempty"` - // SchemaURL - Url of the schema for this event type. - SchemaURL *string `json:"schemaUrl,omitempty"` -} - -// EventTypesListResult result of the List Event Types operation -type EventTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of event types - Value *[]EventType `json:"value,omitempty"` -} - -// HybridConnectionEventSubscriptionDestination information about the HybridConnection destination for an -// event subscription. -type HybridConnectionEventSubscriptionDestination struct { - // HybridConnectionEventSubscriptionDestinationProperties - Hybrid connection Properties of the event subscription destination - *HybridConnectionEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - hcesd.EndpointType = EndpointTypeHybridConnection - objectMap := make(map[string]interface{}) - if hcesd.HybridConnectionEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = hcesd.HybridConnectionEventSubscriptionDestinationProperties - } - if hcesd.EndpointType != "" { - objectMap["endpointType"] = hcesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestination struct. -func (hcesd *HybridConnectionEventSubscriptionDestination) 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 hybridConnectionEventSubscriptionDestinationProperties HybridConnectionEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &hybridConnectionEventSubscriptionDestinationProperties) - if err != nil { - return err - } - hcesd.HybridConnectionEventSubscriptionDestinationProperties = &hybridConnectionEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - hcesd.EndpointType = endpointType - } - } - } - - return nil -} - -// HybridConnectionEventSubscriptionDestinationProperties the properties for a hybrid connection -// destination. -type HybridConnectionEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of an hybrid connection that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// BasicInputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported -// type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type BasicInputSchemaMapping interface { - AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) - AsInputSchemaMapping() (*InputSchemaMapping, bool) -} - -// InputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only -// supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type InputSchemaMapping struct { - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -func unmarshalBasicInputSchemaMapping(body []byte) (BasicInputSchemaMapping, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["inputSchemaMappingType"] { - case string(InputSchemaMappingTypeJSON): - var jism JSONInputSchemaMapping - err := json.Unmarshal(body, &jism) - return jism, err - default: - var ism InputSchemaMapping - err := json.Unmarshal(body, &ism) - return ism, err - } -} -func unmarshalBasicInputSchemaMappingArray(body []byte) ([]BasicInputSchemaMapping, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ismArray := make([]BasicInputSchemaMapping, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ism, err := unmarshalBasicInputSchemaMapping(*rawMessage) - if err != nil { - return nil, err - } - ismArray[index] = ism - } - return ismArray, nil -} - -// MarshalJSON is the custom marshaler for InputSchemaMapping. -func (ism InputSchemaMapping) MarshalJSON() ([]byte, error) { - ism.InputSchemaMappingType = InputSchemaMappingTypeInputSchemaMapping - objectMap := make(map[string]interface{}) - if ism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = ism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return nil, false -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return &ism, true -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &ism, true -} - -// JSONField this is used to express the source of an input schema mapping for a single target field in the -// Event Grid Event schema. This is currently used in the mappings for the 'id','topic' and 'eventTime' -// properties. This represents a field in the input event schema. -type JSONField struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` -} - -// JSONFieldWithDefault this is used to express the source of an input schema mapping for a single target -// field in the Event Grid Event schema. This is currently used in the mappings for the -// 'subject','eventType' and 'dataVersion' properties. This represents a field in the input event schema -// along with a default value to be used, and at least one of these two properties should be provided. -type JSONFieldWithDefault struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` - // DefaultValue - The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// JSONInputSchemaMapping this enables publishing to Event Grid using a custom input schema. This can be -// used to map properties from a custom input JSON schema to the Event Grid event schema. -type JSONInputSchemaMapping struct { - // JSONInputSchemaMappingProperties - JSON Properties of the input schema mapping - *JSONInputSchemaMappingProperties `json:"properties,omitempty"` - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -// MarshalJSON is the custom marshaler for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { - jism.InputSchemaMappingType = InputSchemaMappingTypeJSON - objectMap := make(map[string]interface{}) - if jism.JSONInputSchemaMappingProperties != nil { - objectMap["properties"] = jism.JSONInputSchemaMappingProperties - } - if jism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = jism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return &jism, true -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return nil, false -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &jism, true -} - -// UnmarshalJSON is the custom unmarshaler for JSONInputSchemaMapping struct. -func (jism *JSONInputSchemaMapping) 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 JSONInputSchemaMappingProperties JSONInputSchemaMappingProperties - err = json.Unmarshal(*v, &JSONInputSchemaMappingProperties) - if err != nil { - return err - } - jism.JSONInputSchemaMappingProperties = &JSONInputSchemaMappingProperties - } - case "inputSchemaMappingType": - if v != nil { - var inputSchemaMappingType InputSchemaMappingType - err = json.Unmarshal(*v, &inputSchemaMappingType) - if err != nil { - return err - } - jism.InputSchemaMappingType = inputSchemaMappingType - } - } - } - - return nil -} - -// JSONInputSchemaMappingProperties this can be used to map properties of a source schema (or default -// values, for certain supported properties) to properties of the EventGridEvent schema. -type JSONInputSchemaMappingProperties struct { - // ID - The mapping information for the Id property of the Event Grid Event. - ID *JSONField `json:"id,omitempty"` - // Topic - The mapping information for the Topic property of the Event Grid Event. - Topic *JSONField `json:"topic,omitempty"` - // EventTime - The mapping information for the EventTime property of the Event Grid Event. - EventTime *JSONField `json:"eventTime,omitempty"` - // EventType - The mapping information for the EventType property of the Event Grid Event. - EventType *JSONFieldWithDefault `json:"eventType,omitempty"` - // Subject - The mapping information for the Subject property of the Event Grid Event. - Subject *JSONFieldWithDefault `json:"subject,omitempty"` - // DataVersion - The mapping information for the DataVersion property of the Event Grid Event. - DataVersion *JSONFieldWithDefault `json:"dataVersion,omitempty"` -} - -// NumberGreaterThanAdvancedFilter numberGreaterThan Filter -type NumberGreaterThanAdvancedFilter struct { - // Value - The filter value - Value *float64 `json:"value,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtaf.OperatorType = OperatorTypeNumberGreaterThan - objectMap := make(map[string]interface{}) - if ngtaf.Value != nil { - objectMap["value"] = ngtaf.Value - } - if ngtaf.Key != nil { - objectMap["key"] = ngtaf.Key - } - if ngtaf.OperatorType != "" { - objectMap["operatorType"] = ngtaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return &ngtaf, true -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtaf, true -} - -// NumberGreaterThanOrEqualsAdvancedFilter numberGreaterThanOrEquals Filter -type NumberGreaterThanOrEqualsAdvancedFilter struct { - // Value - The filter value - Value *float64 `json:"value,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtoeaf.OperatorType = OperatorTypeNumberGreaterThanOrEquals - objectMap := make(map[string]interface{}) - if ngtoeaf.Value != nil { - objectMap["value"] = ngtoeaf.Value - } - if ngtoeaf.Key != nil { - objectMap["key"] = ngtoeaf.Key - } - if ngtoeaf.OperatorType != "" { - objectMap["operatorType"] = ngtoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// NumberInAdvancedFilter numberIn filter -type NumberInAdvancedFilter struct { - // Values - The set of filter values - Values *[]float64 `json:"values,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) MarshalJSON() ([]byte, error) { - niaf.OperatorType = OperatorTypeNumberIn - objectMap := make(map[string]interface{}) - if niaf.Values != nil { - objectMap["values"] = niaf.Values - } - if niaf.Key != nil { - objectMap["key"] = niaf.Key - } - if niaf.OperatorType != "" { - objectMap["operatorType"] = niaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return &niaf, true -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &niaf, true -} - -// NumberLessThanAdvancedFilter numberLessThan Filter -type NumberLessThanAdvancedFilter struct { - // Value - The filter value - Value *float64 `json:"value,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) MarshalJSON() ([]byte, error) { - nltaf.OperatorType = OperatorTypeNumberLessThan - objectMap := make(map[string]interface{}) - if nltaf.Value != nil { - objectMap["value"] = nltaf.Value - } - if nltaf.Key != nil { - objectMap["key"] = nltaf.Key - } - if nltaf.OperatorType != "" { - objectMap["operatorType"] = nltaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return &nltaf, true -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltaf, true -} - -// NumberLessThanOrEqualsAdvancedFilter numberLessThanOrEquals Filter -type NumberLessThanOrEqualsAdvancedFilter struct { - // Value - The filter value - Value *float64 `json:"value,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - nltoeaf.OperatorType = OperatorTypeNumberLessThanOrEquals - objectMap := make(map[string]interface{}) - if nltoeaf.Value != nil { - objectMap["value"] = nltoeaf.Value - } - if nltoeaf.Key != nil { - objectMap["key"] = nltoeaf.Key - } - if nltoeaf.OperatorType != "" { - objectMap["operatorType"] = nltoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return &nltoeaf, true -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltoeaf, true -} - -// NumberNotInAdvancedFilter numberNotIn Filter -type NumberNotInAdvancedFilter struct { - // Values - The set of filter values - Values *[]float64 `json:"values,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - nniaf.OperatorType = OperatorTypeNumberNotIn - objectMap := make(map[string]interface{}) - if nniaf.Values != nil { - objectMap["values"] = nniaf.Values - } - if nniaf.Key != nil { - objectMap["key"] = nniaf.Key - } - if nniaf.OperatorType != "" { - objectMap["operatorType"] = nniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return &nniaf, true -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nniaf, true -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,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"` -} - -// 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"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// Resource definition of a Resource -type Resource struct { - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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) -} - -// RetryPolicy information about the retry policy for an event subscription -type RetryPolicy struct { - // MaxDeliveryAttempts - Maximum number of delivery retry attempts for events. - MaxDeliveryAttempts *int32 `json:"maxDeliveryAttempts,omitempty"` - // EventTimeToLiveInMinutes - Time To Live (in minutes) for events. - EventTimeToLiveInMinutes *int32 `json:"eventTimeToLiveInMinutes,omitempty"` -} - -// StorageBlobDeadLetterDestination information about the storage blob based dead letter destination. -type StorageBlobDeadLetterDestination struct { - // StorageBlobDeadLetterDestinationProperties - The properties of the Storage Blob based deadletter destination - *StorageBlobDeadLetterDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { - sbdld.EndpointType = EndpointTypeStorageBlob - objectMap := make(map[string]interface{}) - if sbdld.StorageBlobDeadLetterDestinationProperties != nil { - objectMap["properties"] = sbdld.StorageBlobDeadLetterDestinationProperties - } - if sbdld.EndpointType != "" { - objectMap["endpointType"] = sbdld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return &sbdld, true -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return nil, false -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &sbdld, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageBlobDeadLetterDestination struct. -func (sbdld *StorageBlobDeadLetterDestination) 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 storageBlobDeadLetterDestinationProperties StorageBlobDeadLetterDestinationProperties - err = json.Unmarshal(*v, &storageBlobDeadLetterDestinationProperties) - if err != nil { - return err - } - sbdld.StorageBlobDeadLetterDestinationProperties = &storageBlobDeadLetterDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointTypeBasicDeadLetterDestination - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbdld.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageBlobDeadLetterDestinationProperties properties of the storage blob based dead letter destination. -type StorageBlobDeadLetterDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that is the destination of the deadletter events - ResourceID *string `json:"resourceId,omitempty"` - // BlobContainerName - The name of the Storage blob container that is the destination of the deadletter events - BlobContainerName *string `json:"blobContainerName,omitempty"` -} - -// StorageQueueEventSubscriptionDestination information about the storage queue destination for an event -// subscription. -type StorageQueueEventSubscriptionDestination struct { - // StorageQueueEventSubscriptionDestinationProperties - Storage Queue Properties of the event subscription destination - *StorageQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sqesd.EndpointType = EndpointTypeStorageQueue - objectMap := make(map[string]interface{}) - if sqesd.StorageQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sqesd.StorageQueueEventSubscriptionDestinationProperties - } - if sqesd.EndpointType != "" { - objectMap["endpointType"] = sqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageQueueEventSubscriptionDestination struct. -func (sqesd *StorageQueueEventSubscriptionDestination) 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 storageQueueEventSubscriptionDestinationProperties StorageQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &storageQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sqesd.StorageQueueEventSubscriptionDestinationProperties = &storageQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageQueueEventSubscriptionDestinationProperties the properties for a storage queue destination. -type StorageQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // QueueName - The name of the Storage queue under a storage account that is the destination of an event subscription. - QueueName *string `json:"queueName,omitempty"` -} - -// StringBeginsWithAdvancedFilter stringBeginsWith Filter -type StringBeginsWithAdvancedFilter struct { - // Values - The set of filter values - Values *[]string `json:"values,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sbwaf.OperatorType = OperatorTypeStringBeginsWith - objectMap := make(map[string]interface{}) - if sbwaf.Values != nil { - objectMap["values"] = sbwaf.Values - } - if sbwaf.Key != nil { - objectMap["key"] = sbwaf.Key - } - if sbwaf.OperatorType != "" { - objectMap["operatorType"] = sbwaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return &sbwaf, true -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sbwaf, true -} - -// StringContainsAdvancedFilter stringContains Filter -type StringContainsAdvancedFilter struct { - // Values - The set of filter values - Values *[]string `json:"values,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) MarshalJSON() ([]byte, error) { - scaf.OperatorType = OperatorTypeStringContains - objectMap := make(map[string]interface{}) - if scaf.Values != nil { - objectMap["values"] = scaf.Values - } - if scaf.Key != nil { - objectMap["key"] = scaf.Key - } - if scaf.OperatorType != "" { - objectMap["operatorType"] = scaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return &scaf, true -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &scaf, true -} - -// StringEndsWithAdvancedFilter stringEndsWith Filter -type StringEndsWithAdvancedFilter struct { - // Values - The set of filter values - Values *[]string `json:"values,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sewaf.OperatorType = OperatorTypeStringEndsWith - objectMap := make(map[string]interface{}) - if sewaf.Values != nil { - objectMap["values"] = sewaf.Values - } - if sewaf.Key != nil { - objectMap["key"] = sewaf.Key - } - if sewaf.OperatorType != "" { - objectMap["operatorType"] = sewaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return &sewaf, true -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sewaf, true -} - -// StringInAdvancedFilter stringIn Filter -type StringInAdvancedFilter struct { - // Values - The set of filter values - Values *[]string `json:"values,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) MarshalJSON() ([]byte, error) { - siaf.OperatorType = OperatorTypeStringIn - objectMap := make(map[string]interface{}) - if siaf.Values != nil { - objectMap["values"] = siaf.Values - } - if siaf.Key != nil { - objectMap["key"] = siaf.Key - } - if siaf.OperatorType != "" { - objectMap["operatorType"] = siaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return &siaf, true -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &siaf, true -} - -// StringNotInAdvancedFilter stringNotIn Filter -type StringNotInAdvancedFilter struct { - // Values - The set of filter values - Values *[]string `json:"values,omitempty"` - // Key - The filter key. Represents an event property with up to two levels of nesting. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - sniaf.OperatorType = OperatorTypeStringNotIn - objectMap := make(map[string]interface{}) - if sniaf.Values != nil { - objectMap["values"] = sniaf.Values - } - if sniaf.Key != nil { - objectMap["key"] = sniaf.Key - } - if sniaf.OperatorType != "" { - objectMap["operatorType"] = sniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return &sniaf, true -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sniaf, true -} - -// Topic eventGrid Topic -type Topic struct { - autorest.Response `json:"-"` - // TopicProperties - Properties of the topic - *TopicProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TopicProperties != nil { - objectMap["properties"] = t.TopicProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Topic struct. -func (t *Topic) 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 topicProperties TopicProperties - err = json.Unmarshal(*v, &topicProperties) - if err != nil { - return err - } - t.TopicProperties = &topicProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TopicProperties properties of the Topic -type TopicProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' - ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the topic. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventV01Schema' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicProperties. -func (tp TopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.InputSchema != "" { - objectMap["inputSchema"] = tp.InputSchema - } - objectMap["inputSchemaMapping"] = tp.InputSchemaMapping - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicProperties struct. -func (tp *TopicProperties) 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 "provisioningState": - if v != nil { - var provisioningState TopicProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - tp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - tp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - tp.InputSchemaMapping = inputSchemaMapping - } - } - } - - return nil -} - -// TopicRegenerateKeyRequest topic regenerate share access key request -type TopicRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsCreateOrUpdateFuture) 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 TopicsCreateOrUpdateFuture.Result. -func (future *TopicsCreateOrUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateOrUpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsDeleteFuture) 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 TopicsDeleteFuture.Result. -func (future *TopicsDeleteFuture) result(client TopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TopicSharedAccessKeys shared access keys of the Topic -type TopicSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the topic. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the topic. - Key2 *string `json:"key2,omitempty"` -} - -// TopicsListResult result of the List Topics operation -type TopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Topics - Value *[]Topic `json:"value,omitempty"` -} - -// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsUpdateFuture) 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 TopicsUpdateFuture.Result. -func (future *TopicsUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicTypeInfo properties of a topic type info. -type TopicTypeInfo struct { - autorest.Response `json:"-"` - // TopicTypeProperties - Properties of the topic type info - *TopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicTypeInfo. -func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tti.TopicTypeProperties != nil { - objectMap["properties"] = tti.TopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. -func (tti *TopicTypeInfo) 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 topicTypeProperties TopicTypeProperties - err = json.Unmarshal(*v, &topicTypeProperties) - if err != nil { - return err - } - tti.TopicTypeProperties = &topicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tti.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tti.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tti.Type = &typeVar - } - } - } - - return nil -} - -// TopicTypeProperties properties of a topic type. -type TopicTypeProperties struct { - // Provider - Namespace of the provider of the topic type. - Provider *string `json:"provider,omitempty"` - // DisplayName - Display Name for the topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the topic type. - Description *string `json:"description,omitempty"` - // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' - ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` - // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' - ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` - // SupportedLocations - List of locations supported by this topic type. - SupportedLocations *[]string `json:"supportedLocations,omitempty"` -} - -// TopicTypesListResult result of the List Topic Types operation -type TopicTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of topic types - Value *[]TopicTypeInfo `json:"value,omitempty"` -} - -// TopicUpdateParameters properties of the Topic update -type TopicUpdateParameters struct { - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TopicUpdateParameters. -func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// TrackedResource definition of a Tracked Resource -type TrackedResource struct { - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription -type WebHookEventSubscriptionDestination struct { - // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination - *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - whesd.EndpointType = EndpointTypeWebHook - objectMap := make(map[string]interface{}) - if whesd.WebHookEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties - } - if whesd.EndpointType != "" { - objectMap["endpointType"] = whesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return &whesd, true -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &whesd, true -} - -// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. -func (whesd *WebHookEventSubscriptionDestination) 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 webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) - if err != nil { - return err - } - whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - whesd.EndpointType = endpointType - } - } - } - - return nil -} - -// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for -// an event subscription. -type WebHookEventSubscriptionDestinationProperties struct { - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` - // EndpointBaseURL - READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. - EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestinationProperties. -func (whesdp WebHookEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if whesdp.EndpointURL != nil { - objectMap["endpointUrl"] = whesdp.EndpointURL - } - return json.Marshal(objectMap) -} diff --git a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/operations.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/operations.go deleted file mode 100644 index be0ad08c8cfe..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure EventGrid 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 list the available operations supported by the Microsoft.EventGrid resource provider -func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/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 -} diff --git a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topics.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topics.go deleted file mode 100644 index b4a1016287ec..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topics.go +++ /dev/null @@ -1,736 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicsClient is the azure EventGrid Management Client -type TopicsClient struct { - BaseClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient 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 NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicInfo - topic information -func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-09-15-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicInfo), - 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 TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, 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 TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, 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 existing topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-09-15-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.EventGrid/topics/{topicName}", 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 TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, 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 TopicsClient) 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 get properties of a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-09-15-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.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the topics under a resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result TopicsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client TopicsClient) 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 = "2018-09-15-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.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list all the topics under an Azure subscription -func (client TopicsClient) ListBySubscription(ctx context.Context) (result TopicsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the topic type -// resourceName - name of the topic -func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSharedAccessKeys list the two keys used to publish to a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-09-15-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.EventGrid/topics/{topicName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// regenerateKeyRequest - request body to regenerate key -func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.TopicsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, topicName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-09-15-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.EventGrid/topics/{topicName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 TopicsClient) 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 TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicUpdateParameters - topic update information -func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2018-09-15-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicUpdateParameters), - 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 TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, 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 TopicsClient) UpdateResponder(resp *http.Response) (result Topic, 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/eventgrid/mgmt/2018-09-15-preview/eventgrid/topictypes.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topictypes.go deleted file mode 100644 index 9c1ad1fa038c..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topictypes.go +++ /dev/null @@ -1,244 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicTypesClient is the azure EventGrid Management Client -type TopicTypesClient struct { - BaseClient -} - -// NewTopicTypesClient creates an instance of the TopicTypesClient client. -func NewTopicTypesClient(subscriptionID string) TopicTypesClient { - return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient 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 NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { - return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get information about a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.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, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all registered topic types -func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"), - 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 TopicTypesClient) 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 TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2018-09-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, 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/eventgrid/mgmt/2018-09-15-preview/eventgrid/version.go b/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/version.go deleted file mode 100644 index d8014ccc1cfa..000000000000 --- a/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package eventgrid - -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() + " eventgrid/2018-09-15-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/CHANGELOG.md b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/_meta.json b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/_meta.json deleted file mode 100644 index 63dde0e4afc9..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "tag": "package-2019-02-preview", - "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-2019-02-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/client.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/client.go deleted file mode 100644 index af3181deb4e0..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2019-02-01-preview. -// -// Azure EventGrid Management Client -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Eventgrid - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Eventgrid. -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/eventgrid/mgmt/2019-02-01-preview/eventgrid/domains.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/domains.go deleted file mode 100644 index 8a3008d536f8..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/domains.go +++ /dev/null @@ -1,757 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainsClient is the azure EventGrid Management Client -type DomainsClient struct { - BaseClient -} - -// NewDomainsClient creates an instance of the DomainsClient client. -func NewDomainsClient(subscriptionID string) DomainsClient { - return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainsClientWithBaseURI creates an instance of the DomainsClient 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 NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { - return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates a new domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainInfo - domain information -func (client DomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (result DomainsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainInfo), - 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 DomainsClient) CreateOrUpdateSender(req *http.Request) (future DomainsCreateOrUpdateFuture, 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 DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, 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 existing domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -func (client DomainsClient) Delete(ctx context.Context, resourceGroupName string, domainName string) (result DomainsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-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.EventGrid/domains/{domainName}", 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 DomainsClient) DeleteSender(req *http.Request) (future DomainsDeleteFuture, 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 DomainsClient) 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 get properties of a domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -func (client DomainsClient) Get(ctx context.Context, resourceGroupName string, domainName string) (result Domain, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-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.EventGrid/domains/{domainName}", 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 DomainsClient) 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 DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the domains under a resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - filter the results using OData syntax. -// top - the number of results to return. -func (client DomainsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DomainsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { - req, err := lastResults.domainsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) - return -} - -// ListBySubscription list all the domains under an Azure subscription -// Parameters: -// filter - filter the results using OData syntax. -// top - the number of results to return. -func (client DomainsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result DomainsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListBySubscription") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DomainsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListBySubscriptionResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { - req, err := lastResults.domainsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result DomainsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) - return -} - -// ListSharedAccessKeys list the two keys used to publish to a domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -func (client DomainsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client DomainsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-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.EventGrid/domains/{domainName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListSharedAccessKeysResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// regenerateKeyRequest - request body to regenerate key -func (client DomainsClient) RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.DomainsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, domainName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DomainsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-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.EventGrid/domains/{domainName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 DomainsClient) 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 DomainsClient) RegenerateKeyResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainUpdateParameters - domain update information -func (client DomainsClient) Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (result DomainsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainName, domainUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainUpdateParameters), - 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 DomainsClient) UpdateSender(req *http.Request) (future DomainsUpdateFuture, 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 DomainsClient) UpdateResponder(resp *http.Response) (result Domain, 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/eventgrid/mgmt/2019-02-01-preview/eventgrid/domaintopics.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/domaintopics.go deleted file mode 100644 index c9b554208332..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/domaintopics.go +++ /dev/null @@ -1,396 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainTopicsClient is the azure EventGrid Management Client -type DomainTopicsClient struct { - BaseClient -} - -// NewDomainTopicsClient creates an instance of the DomainTopicsClient client. -func NewDomainTopicsClient(subscriptionID string) DomainTopicsClient { - return NewDomainTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainTopicsClientWithBaseURI creates an instance of the DomainTopicsClient 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 NewDomainTopicsClientWithBaseURI(baseURI string, subscriptionID string) DomainTopicsClient { - return DomainTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates a new domain topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainTopicName - name of the domain topic -func (client DomainTopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainTopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}", pathParameters), - 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 DomainTopicsClient) CreateOrUpdateSender(req *http.Request) (future DomainTopicsCreateOrUpdateFuture, 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 DomainTopicsClient) CreateOrUpdateResponder(resp *http.Response) (result DomainTopic, 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 existing domain topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainTopicName - name of the domain topic -func (client DomainTopicsClient) Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-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.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) DeleteSender(req *http.Request) (future DomainTopicsDeleteFuture, 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 DomainTopicsClient) 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 get properties of a domain topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainTopicName - name of the topic -func (client DomainTopicsClient) Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.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, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-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.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) 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 DomainTopicsClient) GetResponder(resp *http.Response) (result DomainTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomain list all the topics in a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - domain name. -// filter - filter the results using OData syntax. -// top - the number of results to return. -func (client DomainTopicsClient) ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") - defer func() { - sc := -1 - if result.dtlr.Response.Response != nil { - sc = result.dtlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDomainNextResults - req, err := client.ListByDomainPreparer(ctx, resourceGroupName, domainName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainSender(req) - if err != nil { - result.dtlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure sending request") - return - } - - result.dtlr, err = client.ListByDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure responding to request") - return - } - if result.dtlr.hasNextLink() && result.dtlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDomainPreparer prepares the ListByDomain request. -func (client DomainTopicsClient) ListByDomainPreparer(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainSender sends the ListByDomain request. The method will close the -// http.Response Body if it receives an error. -func (client DomainTopicsClient) ListByDomainSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainResponder handles the response to the ListByDomain request. The method always -// closes the http.Response Body. -func (client DomainTopicsClient) ListByDomainResponder(resp *http.Response) (result DomainTopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDomainNextResults retrieves the next set of results, if any. -func (client DomainTopicsClient) listByDomainNextResults(ctx context.Context, lastResults DomainTopicsListResult) (result DomainTopicsListResult, err error) { - req, err := lastResults.domainTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDomainSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDomainComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainTopicsClient) ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") - 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.ListByDomain(ctx, resourceGroupName, domainName, filter, top) - return -} diff --git a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/enums.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/enums.go deleted file mode 100644 index 5d4093b82468..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/enums.go +++ /dev/null @@ -1,264 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DomainProvisioningState enumerates the values for domain provisioning state. -type DomainProvisioningState string - -const ( - // Canceled ... - Canceled DomainProvisioningState = "Canceled" - // Creating ... - Creating DomainProvisioningState = "Creating" - // Deleting ... - Deleting DomainProvisioningState = "Deleting" - // Failed ... - Failed DomainProvisioningState = "Failed" - // Succeeded ... - Succeeded DomainProvisioningState = "Succeeded" - // Updating ... - Updating DomainProvisioningState = "Updating" -) - -// PossibleDomainProvisioningStateValues returns an array of possible values for the DomainProvisioningState const type. -func PossibleDomainProvisioningStateValues() []DomainProvisioningState { - return []DomainProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// DomainTopicProvisioningState enumerates the values for domain topic provisioning state. -type DomainTopicProvisioningState string - -const ( - // DomainTopicProvisioningStateCanceled ... - DomainTopicProvisioningStateCanceled DomainTopicProvisioningState = "Canceled" - // DomainTopicProvisioningStateCreating ... - DomainTopicProvisioningStateCreating DomainTopicProvisioningState = "Creating" - // DomainTopicProvisioningStateDeleting ... - DomainTopicProvisioningStateDeleting DomainTopicProvisioningState = "Deleting" - // DomainTopicProvisioningStateFailed ... - DomainTopicProvisioningStateFailed DomainTopicProvisioningState = "Failed" - // DomainTopicProvisioningStateSucceeded ... - DomainTopicProvisioningStateSucceeded DomainTopicProvisioningState = "Succeeded" - // DomainTopicProvisioningStateUpdating ... - DomainTopicProvisioningStateUpdating DomainTopicProvisioningState = "Updating" -) - -// PossibleDomainTopicProvisioningStateValues returns an array of possible values for the DomainTopicProvisioningState const type. -func PossibleDomainTopicProvisioningStateValues() []DomainTopicProvisioningState { - return []DomainTopicProvisioningState{DomainTopicProvisioningStateCanceled, DomainTopicProvisioningStateCreating, DomainTopicProvisioningStateDeleting, DomainTopicProvisioningStateFailed, DomainTopicProvisioningStateSucceeded, DomainTopicProvisioningStateUpdating} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeEventHub ... - EndpointTypeEventHub EndpointType = "EventHub" - // EndpointTypeEventSubscriptionDestination ... - EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" - // EndpointTypeHybridConnection ... - EndpointTypeHybridConnection EndpointType = "HybridConnection" - // EndpointTypeServiceBusQueue ... - EndpointTypeServiceBusQueue EndpointType = "ServiceBusQueue" - // EndpointTypeStorageQueue ... - EndpointTypeStorageQueue EndpointType = "StorageQueue" - // EndpointTypeWebHook ... - EndpointTypeWebHook EndpointType = "WebHook" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeHybridConnection, EndpointTypeServiceBusQueue, EndpointTypeStorageQueue, EndpointTypeWebHook} -} - -// EndpointTypeBasicDeadLetterDestination enumerates the values for endpoint type basic dead letter -// destination. -type EndpointTypeBasicDeadLetterDestination string - -const ( - // EndpointTypeDeadLetterDestination ... - EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = "DeadLetterDestination" - // EndpointTypeStorageBlob ... - EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = "StorageBlob" -) - -// PossibleEndpointTypeBasicDeadLetterDestinationValues returns an array of possible values for the EndpointTypeBasicDeadLetterDestination const type. -func PossibleEndpointTypeBasicDeadLetterDestinationValues() []EndpointTypeBasicDeadLetterDestination { - return []EndpointTypeBasicDeadLetterDestination{EndpointTypeDeadLetterDestination, EndpointTypeStorageBlob} -} - -// EventDeliverySchema enumerates the values for event delivery schema. -type EventDeliverySchema string - -const ( - // CloudEventV01Schema ... - CloudEventV01Schema EventDeliverySchema = "CloudEventV01Schema" - // CustomInputSchema ... - CustomInputSchema EventDeliverySchema = "CustomInputSchema" - // EventGridSchema ... - EventGridSchema EventDeliverySchema = "EventGridSchema" -) - -// PossibleEventDeliverySchemaValues returns an array of possible values for the EventDeliverySchema const type. -func PossibleEventDeliverySchemaValues() []EventDeliverySchema { - return []EventDeliverySchema{CloudEventV01Schema, CustomInputSchema, EventGridSchema} -} - -// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. -type EventSubscriptionProvisioningState string - -const ( - // EventSubscriptionProvisioningStateAwaitingManualAction ... - EventSubscriptionProvisioningStateAwaitingManualAction EventSubscriptionProvisioningState = "AwaitingManualAction" - // EventSubscriptionProvisioningStateCanceled ... - EventSubscriptionProvisioningStateCanceled EventSubscriptionProvisioningState = "Canceled" - // EventSubscriptionProvisioningStateCreating ... - EventSubscriptionProvisioningStateCreating EventSubscriptionProvisioningState = "Creating" - // EventSubscriptionProvisioningStateDeleting ... - EventSubscriptionProvisioningStateDeleting EventSubscriptionProvisioningState = "Deleting" - // EventSubscriptionProvisioningStateFailed ... - EventSubscriptionProvisioningStateFailed EventSubscriptionProvisioningState = "Failed" - // EventSubscriptionProvisioningStateSucceeded ... - EventSubscriptionProvisioningStateSucceeded EventSubscriptionProvisioningState = "Succeeded" - // EventSubscriptionProvisioningStateUpdating ... - EventSubscriptionProvisioningStateUpdating EventSubscriptionProvisioningState = "Updating" -) - -// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. -func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { - return []EventSubscriptionProvisioningState{EventSubscriptionProvisioningStateAwaitingManualAction, EventSubscriptionProvisioningStateCanceled, EventSubscriptionProvisioningStateCreating, EventSubscriptionProvisioningStateDeleting, EventSubscriptionProvisioningStateFailed, EventSubscriptionProvisioningStateSucceeded, EventSubscriptionProvisioningStateUpdating} -} - -// InputSchema enumerates the values for input schema. -type InputSchema string - -const ( - // InputSchemaCloudEventV01Schema ... - InputSchemaCloudEventV01Schema InputSchema = "CloudEventV01Schema" - // InputSchemaCustomEventSchema ... - InputSchemaCustomEventSchema InputSchema = "CustomEventSchema" - // InputSchemaEventGridSchema ... - InputSchemaEventGridSchema InputSchema = "EventGridSchema" -) - -// PossibleInputSchemaValues returns an array of possible values for the InputSchema const type. -func PossibleInputSchemaValues() []InputSchema { - return []InputSchema{InputSchemaCloudEventV01Schema, InputSchemaCustomEventSchema, InputSchemaEventGridSchema} -} - -// InputSchemaMappingType enumerates the values for input schema mapping type. -type InputSchemaMappingType string - -const ( - // InputSchemaMappingTypeInputSchemaMapping ... - InputSchemaMappingTypeInputSchemaMapping InputSchemaMappingType = "InputSchemaMapping" - // InputSchemaMappingTypeJSON ... - InputSchemaMappingTypeJSON InputSchemaMappingType = "Json" -) - -// PossibleInputSchemaMappingTypeValues returns an array of possible values for the InputSchemaMappingType const type. -func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { - return []InputSchemaMappingType{InputSchemaMappingTypeInputSchemaMapping, InputSchemaMappingTypeJSON} -} - -// OperatorType enumerates the values for operator type. -type OperatorType string - -const ( - // OperatorTypeAdvancedFilter ... - OperatorTypeAdvancedFilter OperatorType = "AdvancedFilter" - // OperatorTypeBoolEquals ... - OperatorTypeBoolEquals OperatorType = "BoolEquals" - // OperatorTypeNumberGreaterThan ... - OperatorTypeNumberGreaterThan OperatorType = "NumberGreaterThan" - // OperatorTypeNumberGreaterThanOrEquals ... - OperatorTypeNumberGreaterThanOrEquals OperatorType = "NumberGreaterThanOrEquals" - // OperatorTypeNumberIn ... - OperatorTypeNumberIn OperatorType = "NumberIn" - // OperatorTypeNumberLessThan ... - OperatorTypeNumberLessThan OperatorType = "NumberLessThan" - // OperatorTypeNumberLessThanOrEquals ... - OperatorTypeNumberLessThanOrEquals OperatorType = "NumberLessThanOrEquals" - // OperatorTypeNumberNotIn ... - OperatorTypeNumberNotIn OperatorType = "NumberNotIn" - // OperatorTypeStringBeginsWith ... - OperatorTypeStringBeginsWith OperatorType = "StringBeginsWith" - // OperatorTypeStringContains ... - OperatorTypeStringContains OperatorType = "StringContains" - // OperatorTypeStringEndsWith ... - OperatorTypeStringEndsWith OperatorType = "StringEndsWith" - // OperatorTypeStringIn ... - OperatorTypeStringIn OperatorType = "StringIn" - // OperatorTypeStringNotIn ... - OperatorTypeStringNotIn OperatorType = "StringNotIn" -) - -// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. -func PossibleOperatorTypeValues() []OperatorType { - return []OperatorType{OperatorTypeAdvancedFilter, OperatorTypeBoolEquals, OperatorTypeNumberGreaterThan, OperatorTypeNumberGreaterThanOrEquals, OperatorTypeNumberIn, OperatorTypeNumberLessThan, OperatorTypeNumberLessThanOrEquals, OperatorTypeNumberNotIn, OperatorTypeStringBeginsWith, OperatorTypeStringContains, OperatorTypeStringEndsWith, OperatorTypeStringIn, OperatorTypeStringNotIn} -} - -// ResourceRegionType enumerates the values for resource region type. -type ResourceRegionType string - -const ( - // GlobalResource ... - GlobalResource ResourceRegionType = "GlobalResource" - // RegionalResource ... - RegionalResource ResourceRegionType = "RegionalResource" -) - -// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. -func PossibleResourceRegionTypeValues() []ResourceRegionType { - return []ResourceRegionType{GlobalResource, RegionalResource} -} - -// TopicProvisioningState enumerates the values for topic provisioning state. -type TopicProvisioningState string - -const ( - // TopicProvisioningStateCanceled ... - TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" - // TopicProvisioningStateCreating ... - TopicProvisioningStateCreating TopicProvisioningState = "Creating" - // TopicProvisioningStateDeleting ... - TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" - // TopicProvisioningStateFailed ... - TopicProvisioningStateFailed TopicProvisioningState = "Failed" - // TopicProvisioningStateSucceeded ... - TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" - // TopicProvisioningStateUpdating ... - TopicProvisioningStateUpdating TopicProvisioningState = "Updating" -) - -// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. -func PossibleTopicProvisioningStateValues() []TopicProvisioningState { - return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} -} - -// TopicTypeProvisioningState enumerates the values for topic type provisioning state. -type TopicTypeProvisioningState string - -const ( - // TopicTypeProvisioningStateCanceled ... - TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" - // TopicTypeProvisioningStateCreating ... - TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" - // TopicTypeProvisioningStateDeleting ... - TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" - // TopicTypeProvisioningStateFailed ... - TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" - // TopicTypeProvisioningStateSucceeded ... - TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" - // TopicTypeProvisioningStateUpdating ... - TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" -) - -// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. -func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { - return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} -} diff --git a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/eventgridapi/interfaces.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/eventgridapi/interfaces.go deleted file mode 100644 index b8a6242abb51..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/eventgridapi/interfaces.go +++ /dev/null @@ -1,103 +0,0 @@ -package eventgridapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/eventgrid/mgmt/2019-02-01-preview/eventgrid" -) - -// DomainsClientAPI contains the set of methods on the DomainsClient type. -type DomainsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo eventgrid.Domain) (result eventgrid.DomainsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.Domain, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest eventgrid.DomainRegenerateKeyRequest) (result eventgrid.DomainSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters eventgrid.DomainUpdateParameters) (result eventgrid.DomainsUpdateFuture, err error) -} - -var _ DomainsClientAPI = (*eventgrid.DomainsClient)(nil) - -// DomainTopicsClientAPI contains the set of methods on the DomainTopicsClient type. -type DomainTopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopic, err error) - ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultPage, err error) - ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultIterator, err error) -} - -var _ DomainTopicsClientAPI = (*eventgrid.DomainTopicsClient)(nil) - -// EventSubscriptionsClientAPI contains the set of methods on the EventSubscriptionsClient type. -type EventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.EventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalBySubscription(ctx context.Context, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32, label string) (result eventgrid.EventSubscriptionsListResultIterator, err error) - Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.EventSubscriptionsUpdateFuture, err error) -} - -var _ EventSubscriptionsClientAPI = (*eventgrid.EventSubscriptionsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result eventgrid.OperationsListResult, err error) -} - -var _ OperationsClientAPI = (*eventgrid.OperationsClient)(nil) - -// TopicsClientAPI contains the set of methods on the TopicsClient type. -type TopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo eventgrid.Topic) (result eventgrid.TopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.Topic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) - ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventTypesListResult, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest eventgrid.TopicRegenerateKeyRequest) (result eventgrid.TopicSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters eventgrid.TopicUpdateParameters) (result eventgrid.TopicsUpdateFuture, err error) -} - -var _ TopicsClientAPI = (*eventgrid.TopicsClient)(nil) - -// TopicTypesClientAPI contains the set of methods on the TopicTypesClient type. -type TopicTypesClientAPI interface { - Get(ctx context.Context, topicTypeName string) (result eventgrid.TopicTypeInfo, err error) - List(ctx context.Context) (result eventgrid.TopicTypesListResult, err error) - ListEventTypes(ctx context.Context, topicTypeName string) (result eventgrid.EventTypesListResult, err error) -} - -var _ TopicTypesClientAPI = (*eventgrid.TopicTypesClient)(nil) diff --git a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/eventsubscriptions.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/eventsubscriptions.go deleted file mode 100644 index 040ede5fdcd5..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/eventsubscriptions.go +++ /dev/null @@ -1,1761 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventSubscriptionsClient is the azure EventGrid Management Client -type EventSubscriptionsClient struct { - BaseClient -} - -// NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. -func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { - return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient 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 NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { - return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new event subscription or updates an existing event subscription based on -// the specified scope. -// Parameters: -// scope - the identifier of the resource to which the event subscription needs to be created or updated. The -// scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider -// namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. Event subscription names must be between 3 and 64 -// characters in length and should use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information -func (client EventSubscriptionsClient) CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2019-02-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 EventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future EventSubscriptionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an existing event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) 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 get properties of an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.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, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) 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 EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomainTopic list all event subscriptions that have been created for a specific domain topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the top level domain -// topicName - name of the domain topic -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDomainTopicNextResults - req, err := client.ListByDomainTopicPreparer(ctx, resourceGroupName, domainName, topicName, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainTopicSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByDomainTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDomainTopicPreparer prepares the ListByDomainTopic request. -func (client EventSubscriptionsClient) ListByDomainTopicPreparer(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainTopicSender sends the ListByDomainTopic request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByDomainTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainTopicResponder handles the response to the ListByDomainTopic request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByDomainTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDomainTopicNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listByDomainTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDomainTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDomainTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDomainTopicComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") - 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.ListByDomainTopic(ctx, resourceGroupName, domainName, topicName, filter, top, label) - return -} - -// ListByResource list all event subscriptions that have been created for a specific topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the resource type -// resourceName - name of the resource -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listByResourceNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - 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.ListByResource(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top, label) - return -} - -// ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalByResourceGroupNextResults - req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalByResourceGroupNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - 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.ListGlobalByResourceGroup(ctx, resourceGroupName, filter, top, label) - return -} - -// ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific -// topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicTypeName - name of the topic type -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalByResourceGroupForTopicTypeNextResults - req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - 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.ListGlobalByResourceGroupForTopicType(ctx, resourceGroupName, topicTypeName, filter, top, label) - return -} - -// ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription -// Parameters: -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalBySubscriptionNextResults - req, err := client.ListGlobalBySubscriptionPreparer(ctx, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalBySubscriptionNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - 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.ListGlobalBySubscription(ctx, filter, top, label) - return -} - -// ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic -// type. -// Parameters: -// topicTypeName - name of the topic type -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalBySubscriptionForTopicTypeNextResults - req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - 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.ListGlobalBySubscriptionForTopicType(ctx, topicTypeName, filter, top, label) - return -} - -// ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription -// and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalByResourceGroupNextResults - req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalByResourceGroupNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - 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.ListRegionalByResourceGroup(ctx, resourceGroupName, location, filter, top, label) - return -} - -// ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and resource group and topic type -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -// topicTypeName - name of the topic type -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalByResourceGroupForTopicTypeNextResults - req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - 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.ListRegionalByResourceGroupForTopicType(ctx, resourceGroupName, location, topicTypeName, filter, top, label) - return -} - -// ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription -// Parameters: -// location - name of the location -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalBySubscriptionNextResults - req, err := client.ListRegionalBySubscriptionPreparer(ctx, location, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(ctx context.Context, location string, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalBySubscriptionNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - 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.ListRegionalBySubscription(ctx, location, filter, top, label) - return -} - -// ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and topic type. -// Parameters: -// location - name of the location -// topicTypeName - name of the topic type -// filter - filter the results using OData syntax. -// top - the number of results to return. -// label - the label used to filter the results for event subscriptions list. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32, label string) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalBySubscriptionForTopicTypeNextResults - req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName, filter, top, label) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string, filter string, top *int32, label string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(label) > 0 { - queryParameters["label"] = autorest.Encode("query", label) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32, label string) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - 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.ListRegionalBySubscriptionForTopicType(ctx, location, topicTypeName, filter, top, label) - return -} - -// Update asynchronously updates an existing event subscription. -// Parameters: -// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a -// top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be updated -// eventSubscriptionUpdateParameters - updated event subscription information -func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2019-02-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2019-02-01-preview/eventgrid/models.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/models.go deleted file mode 100644 index 2d6097bb5dde..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/models.go +++ /dev/null @@ -1,4544 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid" - -// BasicAdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do -// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as -// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of the key -// based on which you want to filter. -type BasicAdvancedFilter interface { - AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) - AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) - AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) - AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) - AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) - AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) - AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) - AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) - AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) - AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) - AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) - AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) - AsAdvancedFilter() (*AdvancedFilter, bool) -} - -// AdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do -// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as -// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of -// the key based on which you want to filter. -type AdvancedFilter struct { - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -func unmarshalBasicAdvancedFilter(body []byte) (BasicAdvancedFilter, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["operatorType"] { - case string(OperatorTypeNumberIn): - var niaf NumberInAdvancedFilter - err := json.Unmarshal(body, &niaf) - return niaf, err - case string(OperatorTypeNumberNotIn): - var nniaf NumberNotInAdvancedFilter - err := json.Unmarshal(body, &nniaf) - return nniaf, err - case string(OperatorTypeNumberLessThan): - var nltaf NumberLessThanAdvancedFilter - err := json.Unmarshal(body, &nltaf) - return nltaf, err - case string(OperatorTypeNumberGreaterThan): - var ngtaf NumberGreaterThanAdvancedFilter - err := json.Unmarshal(body, &ngtaf) - return ngtaf, err - case string(OperatorTypeNumberLessThanOrEquals): - var nltoeaf NumberLessThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &nltoeaf) - return nltoeaf, err - case string(OperatorTypeNumberGreaterThanOrEquals): - var ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &ngtoeaf) - return ngtoeaf, err - case string(OperatorTypeBoolEquals): - var beaf BoolEqualsAdvancedFilter - err := json.Unmarshal(body, &beaf) - return beaf, err - case string(OperatorTypeStringIn): - var siaf StringInAdvancedFilter - err := json.Unmarshal(body, &siaf) - return siaf, err - case string(OperatorTypeStringNotIn): - var sniaf StringNotInAdvancedFilter - err := json.Unmarshal(body, &sniaf) - return sniaf, err - case string(OperatorTypeStringBeginsWith): - var sbwaf StringBeginsWithAdvancedFilter - err := json.Unmarshal(body, &sbwaf) - return sbwaf, err - case string(OperatorTypeStringEndsWith): - var sewaf StringEndsWithAdvancedFilter - err := json.Unmarshal(body, &sewaf) - return sewaf, err - case string(OperatorTypeStringContains): - var scaf StringContainsAdvancedFilter - err := json.Unmarshal(body, &scaf) - return scaf, err - default: - var af AdvancedFilter - err := json.Unmarshal(body, &af) - return af, err - } -} -func unmarshalBasicAdvancedFilterArray(body []byte) ([]BasicAdvancedFilter, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - afArray := make([]BasicAdvancedFilter, len(rawMessages)) - - for index, rawMessage := range rawMessages { - af, err := unmarshalBasicAdvancedFilter(*rawMessage) - if err != nil { - return nil, err - } - afArray[index] = af - } - return afArray, nil -} - -// MarshalJSON is the custom marshaler for AdvancedFilter. -func (af AdvancedFilter) MarshalJSON() ([]byte, error) { - af.OperatorType = OperatorTypeAdvancedFilter - objectMap := make(map[string]interface{}) - if af.Key != nil { - objectMap["key"] = af.Key - } - if af.OperatorType != "" { - objectMap["operatorType"] = af.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return &af, true -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &af, true -} - -// BoolEqualsAdvancedFilter boolEquals Advanced Filter. -type BoolEqualsAdvancedFilter struct { - // Value - The boolean filter value. - Value *bool `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - beaf.OperatorType = OperatorTypeBoolEquals - objectMap := make(map[string]interface{}) - if beaf.Value != nil { - objectMap["value"] = beaf.Value - } - if beaf.Key != nil { - objectMap["key"] = beaf.Key - } - if beaf.OperatorType != "" { - objectMap["operatorType"] = beaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return &beaf, true -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &beaf, true -} - -// BasicDeadLetterDestination information about the dead letter destination for an event subscription. To configure a -// deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a -// derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. -type BasicDeadLetterDestination interface { - AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) - AsDeadLetterDestination() (*DeadLetterDestination, bool) -} - -// DeadLetterDestination information about the dead letter destination for an event subscription. To configure -// a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an -// object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from -// this class. -type DeadLetterDestination struct { - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -func unmarshalBasicDeadLetterDestination(body []byte) (BasicDeadLetterDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeStorageBlob): - var sbdld StorageBlobDeadLetterDestination - err := json.Unmarshal(body, &sbdld) - return sbdld, err - default: - var dld DeadLetterDestination - err := json.Unmarshal(body, &dld) - return dld, err - } -} -func unmarshalBasicDeadLetterDestinationArray(body []byte) ([]BasicDeadLetterDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dldArray := make([]BasicDeadLetterDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dld, err := unmarshalBasicDeadLetterDestination(*rawMessage) - if err != nil { - return nil, err - } - dldArray[index] = dld - } - return dldArray, nil -} - -// MarshalJSON is the custom marshaler for DeadLetterDestination. -func (dld DeadLetterDestination) MarshalJSON() ([]byte, error) { - dld.EndpointType = EndpointTypeDeadLetterDestination - objectMap := make(map[string]interface{}) - if dld.EndpointType != "" { - objectMap["endpointType"] = dld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return nil, false -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return &dld, true -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &dld, true -} - -// Domain eventGrid Domain -type Domain struct { - autorest.Response `json:"-"` - // DomainProperties - Properties of the domain - *DomainProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Domain. -func (d Domain) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DomainProperties != nil { - objectMap["properties"] = d.DomainProperties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Domain struct. -func (d *Domain) 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 domainProperties DomainProperties - err = json.Unmarshal(*v, &domainProperties) - if err != nil { - return err - } - d.DomainProperties = &domainProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DomainProperties properties of the Domain -type DomainProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the domain. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' - ProvisioningState DomainProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the domain. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the domain. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventV01Schema' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - Information about the InputSchemaMapping which specified the info about mapping event payload. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainProperties. -func (dp DomainProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.InputSchema != "" { - objectMap["inputSchema"] = dp.InputSchema - } - objectMap["inputSchemaMapping"] = dp.InputSchemaMapping - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainProperties struct. -func (dp *DomainProperties) 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 "provisioningState": - if v != nil { - var provisioningState DomainProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - dp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - dp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - dp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - dp.InputSchemaMapping = inputSchemaMapping - } - } - } - - return nil -} - -// DomainRegenerateKeyRequest domain regenerate share access key request -type DomainRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// DomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsCreateOrUpdateFuture) 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 DomainsCreateOrUpdateFuture.Result. -func (future *DomainsCreateOrUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsDeleteFuture) 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 DomainsDeleteFuture.Result. -func (future *DomainsDeleteFuture) result(client DomainsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainSharedAccessKeys shared access keys of the Domain -type DomainSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the domain. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the domain. - Key2 *string `json:"key2,omitempty"` -} - -// DomainsListResult result of the List Domains operation -type DomainsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domains - Value *[]Domain `json:"value,omitempty"` - // NextLink - A link for the next page of domains - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainsListResultIterator provides access to a complete listing of Domain values. -type DomainsListResultIterator struct { - i int - page DomainsListResultPage -} - -// 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 *DomainsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultIterator.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 *DomainsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainsListResultIterator) 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 DomainsListResultIterator) Response() DomainsListResult { - 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 DomainsListResultIterator) Value() Domain { - if !iter.page.NotDone() { - return Domain{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainsListResultIterator type. -func NewDomainsListResultIterator(page DomainsListResultPage) DomainsListResultIterator { - return DomainsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DomainsListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DomainsListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// domainsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DomainsListResult) domainsListResultPreparer(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))) -} - -// DomainsListResultPage contains a page of Domain values. -type DomainsListResultPage struct { - fn func(context.Context, DomainsListResult) (DomainsListResult, error) - dlr DomainsListResult -} - -// 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 *DomainsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultPage.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 *DomainsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainsListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainsListResultPage) Response() DomainsListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainsListResultPage) Values() []Domain { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DomainsListResultPage type. -func NewDomainsListResultPage(cur DomainsListResult, getNextPage func(context.Context, DomainsListResult) (DomainsListResult, error)) DomainsListResultPage { - return DomainsListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsUpdateFuture) 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 DomainsUpdateFuture.Result. -func (future *DomainsUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainTopic domain Topic -type DomainTopic struct { - autorest.Response `json:"-"` - // DomainTopicProperties - Properties of the Domain Topic - *DomainTopicProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainTopic. -func (dt DomainTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dt.DomainTopicProperties != nil { - objectMap["properties"] = dt.DomainTopicProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainTopic struct. -func (dt *DomainTopic) 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 domainTopicProperties DomainTopicProperties - err = json.Unmarshal(*v, &domainTopicProperties) - if err != nil { - return err - } - dt.DomainTopicProperties = &domainTopicProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dt.Type = &typeVar - } - } - } - - return nil -} - -// DomainTopicProperties properties of the Domain Topic -type DomainTopicProperties struct { - // ProvisioningState - Provisioning state of the domain topic. Possible values include: 'DomainTopicProvisioningStateCreating', 'DomainTopicProvisioningStateUpdating', 'DomainTopicProvisioningStateDeleting', 'DomainTopicProvisioningStateSucceeded', 'DomainTopicProvisioningStateCanceled', 'DomainTopicProvisioningStateFailed' - ProvisioningState DomainTopicProvisioningState `json:"provisioningState,omitempty"` -} - -// DomainTopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DomainTopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainTopicsClient) (DomainTopic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainTopicsCreateOrUpdateFuture) 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 DomainTopicsCreateOrUpdateFuture.Result. -func (future *DomainTopicsCreateOrUpdateFuture) result(client DomainTopicsClient) (dt DomainTopic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dt.Response.Response, err = future.GetResult(sender); err == nil && dt.Response.Response.StatusCode != http.StatusNoContent { - dt, err = client.CreateOrUpdateResponder(dt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", dt.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainTopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainTopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainTopicsDeleteFuture) 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 DomainTopicsDeleteFuture.Result. -func (future *DomainTopicsDeleteFuture) result(client DomainTopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainTopicsListResult result of the List Domain Topics operation -type DomainTopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domain Topics - Value *[]DomainTopic `json:"value,omitempty"` - // NextLink - A link for the next page of domain topics - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainTopicsListResultIterator provides access to a complete listing of DomainTopic values. -type DomainTopicsListResultIterator struct { - i int - page DomainTopicsListResultPage -} - -// 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 *DomainTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultIterator.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 *DomainTopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainTopicsListResultIterator) 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 DomainTopicsListResultIterator) Response() DomainTopicsListResult { - 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 DomainTopicsListResultIterator) Value() DomainTopic { - if !iter.page.NotDone() { - return DomainTopic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainTopicsListResultIterator type. -func NewDomainTopicsListResultIterator(page DomainTopicsListResultPage) DomainTopicsListResultIterator { - return DomainTopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dtlr DomainTopicsListResult) IsEmpty() bool { - return dtlr.Value == nil || len(*dtlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dtlr DomainTopicsListResult) hasNextLink() bool { - return dtlr.NextLink != nil && len(*dtlr.NextLink) != 0 -} - -// domainTopicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dtlr DomainTopicsListResult) domainTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dtlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dtlr.NextLink))) -} - -// DomainTopicsListResultPage contains a page of DomainTopic values. -type DomainTopicsListResultPage struct { - fn func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error) - dtlr DomainTopicsListResult -} - -// 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 *DomainTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultPage.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.dtlr) - if err != nil { - return err - } - page.dtlr = 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 *DomainTopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainTopicsListResultPage) NotDone() bool { - return !page.dtlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainTopicsListResultPage) Response() DomainTopicsListResult { - return page.dtlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainTopicsListResultPage) Values() []DomainTopic { - if page.dtlr.IsEmpty() { - return nil - } - return *page.dtlr.Value -} - -// Creates a new instance of the DomainTopicsListResultPage type. -func NewDomainTopicsListResultPage(cur DomainTopicsListResult, getNextPage func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error)) DomainTopicsListResultPage { - return DomainTopicsListResultPage{ - fn: getNextPage, - dtlr: cur, - } -} - -// DomainUpdateParameters properties of the Domain update -type DomainUpdateParameters struct { - // Tags - Tags of the domains resource - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DomainUpdateParameters. -func (dup DomainUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dup.Tags != nil { - objectMap["tags"] = dup.Tags - } - return json.Marshal(objectMap) -} - -// EventHubEventSubscriptionDestination information about the event hub destination for an event -// subscription -type EventHubEventSubscriptionDestination struct { - // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination - *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - ehesd.EndpointType = EndpointTypeEventHub - objectMap := make(map[string]interface{}) - if ehesd.EventHubEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties - } - if ehesd.EndpointType != "" { - objectMap["endpointType"] = ehesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. -func (ehesd *EventHubEventSubscriptionDestination) 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 eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) - if err != nil { - return err - } - ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - ehesd.EndpointType = endpointType - } - } - } - - return nil -} - -// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. -type EventHubEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// EventSubscription event Subscription -type EventSubscription struct { - autorest.Response `json:"-"` - // EventSubscriptionProperties - Properties of the event subscription - *EventSubscriptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscription. -func (es EventSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EventSubscriptionProperties != nil { - objectMap["properties"] = es.EventSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. -func (es *EventSubscription) 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 eventSubscriptionProperties EventSubscriptionProperties - err = json.Unmarshal(*v, &eventSubscriptionProperties) - if err != nil { - return err - } - es.EventSubscriptionProperties = &eventSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// BasicEventSubscriptionDestination information about the destination for an event subscription -type BasicEventSubscriptionDestination interface { - AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) - AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) - AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) - AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) - AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) - AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) -} - -// EventSubscriptionDestination information about the destination for an event subscription -type EventSubscriptionDestination struct { - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeWebHook): - var whesd WebHookEventSubscriptionDestination - err := json.Unmarshal(body, &whesd) - return whesd, err - case string(EndpointTypeEventHub): - var ehesd EventHubEventSubscriptionDestination - err := json.Unmarshal(body, &ehesd) - return ehesd, err - case string(EndpointTypeStorageQueue): - var sqesd StorageQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sqesd) - return sqesd, err - case string(EndpointTypeHybridConnection): - var hcesd HybridConnectionEventSubscriptionDestination - err := json.Unmarshal(body, &hcesd) - return hcesd, err - case string(EndpointTypeServiceBusQueue): - var sbqesd ServiceBusQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sbqesd) - return sbqesd, err - default: - var esd EventSubscriptionDestination - err := json.Unmarshal(body, &esd) - return esd, err - } -} -func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) - if err != nil { - return nil, err - } - esdArray[index] = esd - } - return esdArray, nil -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { - esd.EndpointType = EndpointTypeEventSubscriptionDestination - objectMap := make(map[string]interface{}) - if esd.EndpointType != "" { - objectMap["endpointType"] = esd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return &esd, true -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &esd, true -} - -// EventSubscriptionFilter filter for the Event Subscription -type EventSubscriptionFilter struct { - // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. - // The format of this depends on the publisher of the events. - // Wildcard characters are not supported in this path. - SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` - // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. - // Wildcard characters are not supported in this path. - SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` - // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null. - IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` - // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter - // should be compared in a case sensitive manner. - IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` - // AdvancedFilters - An array of advanced filters that are used for filtering event subscriptions. - AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionFilter struct. -func (esf *EventSubscriptionFilter) 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 "subjectBeginsWith": - if v != nil { - var subjectBeginsWith string - err = json.Unmarshal(*v, &subjectBeginsWith) - if err != nil { - return err - } - esf.SubjectBeginsWith = &subjectBeginsWith - } - case "subjectEndsWith": - if v != nil { - var subjectEndsWith string - err = json.Unmarshal(*v, &subjectEndsWith) - if err != nil { - return err - } - esf.SubjectEndsWith = &subjectEndsWith - } - case "includedEventTypes": - if v != nil { - var includedEventTypes []string - err = json.Unmarshal(*v, &includedEventTypes) - if err != nil { - return err - } - esf.IncludedEventTypes = &includedEventTypes - } - case "isSubjectCaseSensitive": - if v != nil { - var isSubjectCaseSensitive bool - err = json.Unmarshal(*v, &isSubjectCaseSensitive) - if err != nil { - return err - } - esf.IsSubjectCaseSensitive = &isSubjectCaseSensitive - } - case "advancedFilters": - if v != nil { - advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) - if err != nil { - return err - } - esf.AdvancedFilters = &advancedFilters - } - } - } - - return nil -} - -// EventSubscriptionFullURL full endpoint url of an event subscription -type EventSubscriptionFullURL struct { - autorest.Response `json:"-"` - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` -} - -// EventSubscriptionProperties properties of the Event Subscription -type EventSubscriptionProperties struct { - // Topic - READ-ONLY; Name of the topic of the event subscription. - Topic *string `json:"topic,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event subscription. Possible values include: 'EventSubscriptionProvisioningStateCreating', 'EventSubscriptionProvisioningStateUpdating', 'EventSubscriptionProvisioningStateDeleting', 'EventSubscriptionProvisioningStateSucceeded', 'EventSubscriptionProvisioningStateCanceled', 'EventSubscriptionProvisioningStateFailed', 'EventSubscriptionProvisioningStateAwaitingManualAction' - ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Expiration time of the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The DeadLetter destination of the event subscription. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionProperties. -func (esp EventSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["destination"] = esp.Destination - if esp.Filter != nil { - objectMap["filter"] = esp.Filter - } - if esp.Labels != nil { - objectMap["labels"] = esp.Labels - } - if esp.ExpirationTimeUtc != nil { - objectMap["expirationTimeUtc"] = esp.ExpirationTimeUtc - } - if esp.EventDeliverySchema != "" { - objectMap["eventDeliverySchema"] = esp.EventDeliverySchema - } - if esp.RetryPolicy != nil { - objectMap["retryPolicy"] = esp.RetryPolicy - } - objectMap["deadLetterDestination"] = esp.DeadLetterDestination - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. -func (esp *EventSubscriptionProperties) 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 "topic": - if v != nil { - var topic string - err = json.Unmarshal(*v, &topic) - if err != nil { - return err - } - esp.Topic = &topic - } - case "provisioningState": - if v != nil { - var provisioningState EventSubscriptionProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - esp.ProvisioningState = provisioningState - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esp.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esp.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esp.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esp.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esp.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esp.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esp.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsCreateOrUpdateFuture) 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 EventSubscriptionsCreateOrUpdateFuture.Result. -func (future *EventSubscriptionsCreateOrUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsDeleteFuture) 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 EventSubscriptionsDeleteFuture.Result. -func (future *EventSubscriptionsDeleteFuture) result(client EventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventSubscriptionsListResult result of the List EventSubscriptions operation -type EventSubscriptionsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of EventSubscriptions - Value *[]EventSubscription `json:"value,omitempty"` - // NextLink - A link for the next page of event subscriptions - NextLink *string `json:"nextLink,omitempty"` -} - -// EventSubscriptionsListResultIterator provides access to a complete listing of EventSubscription values. -type EventSubscriptionsListResultIterator struct { - i int - page EventSubscriptionsListResultPage -} - -// 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 *EventSubscriptionsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultIterator.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 *EventSubscriptionsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventSubscriptionsListResultIterator) 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 EventSubscriptionsListResultIterator) Response() EventSubscriptionsListResult { - 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 EventSubscriptionsListResultIterator) Value() EventSubscription { - if !iter.page.NotDone() { - return EventSubscription{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventSubscriptionsListResultIterator type. -func NewEventSubscriptionsListResultIterator(page EventSubscriptionsListResultPage) EventSubscriptionsListResultIterator { - return EventSubscriptionsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eslr EventSubscriptionsListResult) IsEmpty() bool { - return eslr.Value == nil || len(*eslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eslr EventSubscriptionsListResult) hasNextLink() bool { - return eslr.NextLink != nil && len(*eslr.NextLink) != 0 -} - -// eventSubscriptionsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eslr EventSubscriptionsListResult) eventSubscriptionsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eslr.NextLink))) -} - -// EventSubscriptionsListResultPage contains a page of EventSubscription values. -type EventSubscriptionsListResultPage struct { - fn func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error) - eslr EventSubscriptionsListResult -} - -// 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 *EventSubscriptionsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultPage.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.eslr) - if err != nil { - return err - } - page.eslr = 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 *EventSubscriptionsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventSubscriptionsListResultPage) NotDone() bool { - return !page.eslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventSubscriptionsListResultPage) Response() EventSubscriptionsListResult { - return page.eslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventSubscriptionsListResultPage) Values() []EventSubscription { - if page.eslr.IsEmpty() { - return nil - } - return *page.eslr.Value -} - -// Creates a new instance of the EventSubscriptionsListResultPage type. -func NewEventSubscriptionsListResultPage(cur EventSubscriptionsListResult, getNextPage func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error)) EventSubscriptionsListResultPage { - return EventSubscriptionsListResultPage{ - fn: getNextPage, - eslr: cur, - } -} - -// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsUpdateFuture) 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 EventSubscriptionsUpdateFuture.Result. -func (future *EventSubscriptionsUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionUpdateParameters properties of the Event Subscription update -type EventSubscriptionUpdateParameters struct { - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Information about the expiration time for the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The DeadLetter destination of the event subscription. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. -func (esup *EventSubscriptionUpdateParameters) 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 "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esup.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esup.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esup.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esup.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esup.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esup.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esup.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// EventType event Type for a subject under a topic -type EventType struct { - // EventTypeProperties - Properties of the event type. - *EventTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventType. -func (et EventType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.EventTypeProperties != nil { - objectMap["properties"] = et.EventTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventType struct. -func (et *EventType) 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 eventTypeProperties EventTypeProperties - err = json.Unmarshal(*v, &eventTypeProperties) - if err != nil { - return err - } - et.EventTypeProperties = &eventTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// EventTypeProperties properties of the event type -type EventTypeProperties struct { - // DisplayName - Display name of the event type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the event type. - Description *string `json:"description,omitempty"` - // SchemaURL - Url of the schema for this event type. - SchemaURL *string `json:"schemaUrl,omitempty"` - // IsInDefaultSet - IsInDefaultSet flag of the event type. - IsInDefaultSet *bool `json:"isInDefaultSet,omitempty"` -} - -// EventTypesListResult result of the List Event Types operation -type EventTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of event types - Value *[]EventType `json:"value,omitempty"` -} - -// HybridConnectionEventSubscriptionDestination information about the HybridConnection destination for an -// event subscription. -type HybridConnectionEventSubscriptionDestination struct { - // HybridConnectionEventSubscriptionDestinationProperties - Hybrid connection Properties of the event subscription destination - *HybridConnectionEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - hcesd.EndpointType = EndpointTypeHybridConnection - objectMap := make(map[string]interface{}) - if hcesd.HybridConnectionEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = hcesd.HybridConnectionEventSubscriptionDestinationProperties - } - if hcesd.EndpointType != "" { - objectMap["endpointType"] = hcesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestination struct. -func (hcesd *HybridConnectionEventSubscriptionDestination) 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 hybridConnectionEventSubscriptionDestinationProperties HybridConnectionEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &hybridConnectionEventSubscriptionDestinationProperties) - if err != nil { - return err - } - hcesd.HybridConnectionEventSubscriptionDestinationProperties = &hybridConnectionEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - hcesd.EndpointType = endpointType - } - } - } - - return nil -} - -// HybridConnectionEventSubscriptionDestinationProperties the properties for a hybrid connection -// destination. -type HybridConnectionEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of an hybrid connection that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// BasicInputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported -// type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type BasicInputSchemaMapping interface { - AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) - AsInputSchemaMapping() (*InputSchemaMapping, bool) -} - -// InputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only -// supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type InputSchemaMapping struct { - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -func unmarshalBasicInputSchemaMapping(body []byte) (BasicInputSchemaMapping, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["inputSchemaMappingType"] { - case string(InputSchemaMappingTypeJSON): - var jism JSONInputSchemaMapping - err := json.Unmarshal(body, &jism) - return jism, err - default: - var ism InputSchemaMapping - err := json.Unmarshal(body, &ism) - return ism, err - } -} -func unmarshalBasicInputSchemaMappingArray(body []byte) ([]BasicInputSchemaMapping, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ismArray := make([]BasicInputSchemaMapping, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ism, err := unmarshalBasicInputSchemaMapping(*rawMessage) - if err != nil { - return nil, err - } - ismArray[index] = ism - } - return ismArray, nil -} - -// MarshalJSON is the custom marshaler for InputSchemaMapping. -func (ism InputSchemaMapping) MarshalJSON() ([]byte, error) { - ism.InputSchemaMappingType = InputSchemaMappingTypeInputSchemaMapping - objectMap := make(map[string]interface{}) - if ism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = ism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return nil, false -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return &ism, true -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &ism, true -} - -// JSONField this is used to express the source of an input schema mapping for a single target field in the -// Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and 'eventtime' -// properties. This represents a field in the input event schema. -type JSONField struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` -} - -// JSONFieldWithDefault this is used to express the source of an input schema mapping for a single target -// field -// in the Event Grid Event schema. This is currently used in the mappings for the 'subject', -// 'eventtype' and 'dataversion' properties. This represents a field in the input event schema -// along with a default value to be used, and at least one of these two properties should be provided. -type JSONFieldWithDefault struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` - // DefaultValue - The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// JSONInputSchemaMapping this enables publishing to Event Grid using a custom input schema. This can be -// used to map properties from a custom input JSON schema to the Event Grid event schema. -type JSONInputSchemaMapping struct { - // JSONInputSchemaMappingProperties - JSON Properties of the input schema mapping - *JSONInputSchemaMappingProperties `json:"properties,omitempty"` - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -// MarshalJSON is the custom marshaler for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { - jism.InputSchemaMappingType = InputSchemaMappingTypeJSON - objectMap := make(map[string]interface{}) - if jism.JSONInputSchemaMappingProperties != nil { - objectMap["properties"] = jism.JSONInputSchemaMappingProperties - } - if jism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = jism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return &jism, true -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return nil, false -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &jism, true -} - -// UnmarshalJSON is the custom unmarshaler for JSONInputSchemaMapping struct. -func (jism *JSONInputSchemaMapping) 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 JSONInputSchemaMappingProperties JSONInputSchemaMappingProperties - err = json.Unmarshal(*v, &JSONInputSchemaMappingProperties) - if err != nil { - return err - } - jism.JSONInputSchemaMappingProperties = &JSONInputSchemaMappingProperties - } - case "inputSchemaMappingType": - if v != nil { - var inputSchemaMappingType InputSchemaMappingType - err = json.Unmarshal(*v, &inputSchemaMappingType) - if err != nil { - return err - } - jism.InputSchemaMappingType = inputSchemaMappingType - } - } - } - - return nil -} - -// JSONInputSchemaMappingProperties this can be used to map properties of a source schema (or default -// values, for certain supported properties) to properties of the EventGridEvent schema. -type JSONInputSchemaMappingProperties struct { - // ID - The mapping information for the Id property of the Event Grid Event. - ID *JSONField `json:"id,omitempty"` - // Topic - The mapping information for the Topic property of the Event Grid Event. - Topic *JSONField `json:"topic,omitempty"` - // EventTime - The mapping information for the EventTime property of the Event Grid Event. - EventTime *JSONField `json:"eventTime,omitempty"` - // EventType - The mapping information for the EventType property of the Event Grid Event. - EventType *JSONFieldWithDefault `json:"eventType,omitempty"` - // Subject - The mapping information for the Subject property of the Event Grid Event. - Subject *JSONFieldWithDefault `json:"subject,omitempty"` - // DataVersion - The mapping information for the DataVersion property of the Event Grid Event. - DataVersion *JSONFieldWithDefault `json:"dataVersion,omitempty"` -} - -// NumberGreaterThanAdvancedFilter numberGreaterThan Advanced Filter. -type NumberGreaterThanAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtaf.OperatorType = OperatorTypeNumberGreaterThan - objectMap := make(map[string]interface{}) - if ngtaf.Value != nil { - objectMap["value"] = ngtaf.Value - } - if ngtaf.Key != nil { - objectMap["key"] = ngtaf.Key - } - if ngtaf.OperatorType != "" { - objectMap["operatorType"] = ngtaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return &ngtaf, true -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtaf, true -} - -// NumberGreaterThanOrEqualsAdvancedFilter numberGreaterThanOrEquals Advanced Filter. -type NumberGreaterThanOrEqualsAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtoeaf.OperatorType = OperatorTypeNumberGreaterThanOrEquals - objectMap := make(map[string]interface{}) - if ngtoeaf.Value != nil { - objectMap["value"] = ngtoeaf.Value - } - if ngtoeaf.Key != nil { - objectMap["key"] = ngtoeaf.Key - } - if ngtoeaf.OperatorType != "" { - objectMap["operatorType"] = ngtoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// NumberInAdvancedFilter numberIn Advanced Filter. -type NumberInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) MarshalJSON() ([]byte, error) { - niaf.OperatorType = OperatorTypeNumberIn - objectMap := make(map[string]interface{}) - if niaf.Values != nil { - objectMap["values"] = niaf.Values - } - if niaf.Key != nil { - objectMap["key"] = niaf.Key - } - if niaf.OperatorType != "" { - objectMap["operatorType"] = niaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return &niaf, true -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &niaf, true -} - -// NumberLessThanAdvancedFilter numberLessThan Advanced Filter. -type NumberLessThanAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) MarshalJSON() ([]byte, error) { - nltaf.OperatorType = OperatorTypeNumberLessThan - objectMap := make(map[string]interface{}) - if nltaf.Value != nil { - objectMap["value"] = nltaf.Value - } - if nltaf.Key != nil { - objectMap["key"] = nltaf.Key - } - if nltaf.OperatorType != "" { - objectMap["operatorType"] = nltaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return &nltaf, true -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltaf, true -} - -// NumberLessThanOrEqualsAdvancedFilter numberLessThanOrEquals Advanced Filter. -type NumberLessThanOrEqualsAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - nltoeaf.OperatorType = OperatorTypeNumberLessThanOrEquals - objectMap := make(map[string]interface{}) - if nltoeaf.Value != nil { - objectMap["value"] = nltoeaf.Value - } - if nltoeaf.Key != nil { - objectMap["key"] = nltoeaf.Key - } - if nltoeaf.OperatorType != "" { - objectMap["operatorType"] = nltoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return &nltoeaf, true -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltoeaf, true -} - -// NumberNotInAdvancedFilter numberNotIn Advanced Filter. -type NumberNotInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - nniaf.OperatorType = OperatorTypeNumberNotIn - objectMap := make(map[string]interface{}) - if nniaf.Values != nil { - objectMap["values"] = nniaf.Values - } - if nniaf.Key != nil { - objectMap["key"] = nniaf.Key - } - if nniaf.OperatorType != "" { - objectMap["operatorType"] = nniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return &nniaf, true -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nniaf, true -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,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"` -} - -// 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"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// Resource definition of a Resource -type Resource struct { - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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) -} - -// RetryPolicy information about the retry policy for an event subscription -type RetryPolicy struct { - // MaxDeliveryAttempts - Maximum number of delivery retry attempts for events. - MaxDeliveryAttempts *int32 `json:"maxDeliveryAttempts,omitempty"` - // EventTimeToLiveInMinutes - Time To Live (in minutes) for events. - EventTimeToLiveInMinutes *int32 `json:"eventTimeToLiveInMinutes,omitempty"` -} - -// ServiceBusQueueEventSubscriptionDestination information about the service bus destination for an event -// subscription -type ServiceBusQueueEventSubscriptionDestination struct { - // ServiceBusQueueEventSubscriptionDestinationProperties - Service Bus Properties of the event subscription destination - *ServiceBusQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sbqesd.EndpointType = EndpointTypeServiceBusQueue - objectMap := make(map[string]interface{}) - if sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties - } - if sbqesd.EndpointType != "" { - objectMap["endpointType"] = sbqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return &sbqesd, true -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sbqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceBusQueueEventSubscriptionDestination struct. -func (sbqesd *ServiceBusQueueEventSubscriptionDestination) 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 serviceBusQueueEventSubscriptionDestinationProperties ServiceBusQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &serviceBusQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties = &serviceBusQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// ServiceBusQueueEventSubscriptionDestinationProperties the properties that represent the Service Bus -// destination of an event subscription. -type ServiceBusQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Service Bus destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// StorageBlobDeadLetterDestination information about the storage blob based dead letter destination. -type StorageBlobDeadLetterDestination struct { - // StorageBlobDeadLetterDestinationProperties - The properties of the Storage Blob based deadletter destination - *StorageBlobDeadLetterDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { - sbdld.EndpointType = EndpointTypeStorageBlob - objectMap := make(map[string]interface{}) - if sbdld.StorageBlobDeadLetterDestinationProperties != nil { - objectMap["properties"] = sbdld.StorageBlobDeadLetterDestinationProperties - } - if sbdld.EndpointType != "" { - objectMap["endpointType"] = sbdld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return &sbdld, true -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return nil, false -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &sbdld, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageBlobDeadLetterDestination struct. -func (sbdld *StorageBlobDeadLetterDestination) 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 storageBlobDeadLetterDestinationProperties StorageBlobDeadLetterDestinationProperties - err = json.Unmarshal(*v, &storageBlobDeadLetterDestinationProperties) - if err != nil { - return err - } - sbdld.StorageBlobDeadLetterDestinationProperties = &storageBlobDeadLetterDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointTypeBasicDeadLetterDestination - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbdld.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageBlobDeadLetterDestinationProperties properties of the storage blob based dead letter destination. -type StorageBlobDeadLetterDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that is the destination of the deadletter events - ResourceID *string `json:"resourceId,omitempty"` - // BlobContainerName - The name of the Storage blob container that is the destination of the deadletter events - BlobContainerName *string `json:"blobContainerName,omitempty"` -} - -// StorageQueueEventSubscriptionDestination information about the storage queue destination for an event -// subscription. -type StorageQueueEventSubscriptionDestination struct { - // StorageQueueEventSubscriptionDestinationProperties - Storage Queue Properties of the event subscription destination - *StorageQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sqesd.EndpointType = EndpointTypeStorageQueue - objectMap := make(map[string]interface{}) - if sqesd.StorageQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sqesd.StorageQueueEventSubscriptionDestinationProperties - } - if sqesd.EndpointType != "" { - objectMap["endpointType"] = sqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageQueueEventSubscriptionDestination struct. -func (sqesd *StorageQueueEventSubscriptionDestination) 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 storageQueueEventSubscriptionDestinationProperties StorageQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &storageQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sqesd.StorageQueueEventSubscriptionDestinationProperties = &storageQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageQueueEventSubscriptionDestinationProperties the properties for a storage queue destination. -type StorageQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // QueueName - The name of the Storage queue under a storage account that is the destination of an event subscription. - QueueName *string `json:"queueName,omitempty"` -} - -// StringBeginsWithAdvancedFilter stringBeginsWith Advanced Filter. -type StringBeginsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sbwaf.OperatorType = OperatorTypeStringBeginsWith - objectMap := make(map[string]interface{}) - if sbwaf.Values != nil { - objectMap["values"] = sbwaf.Values - } - if sbwaf.Key != nil { - objectMap["key"] = sbwaf.Key - } - if sbwaf.OperatorType != "" { - objectMap["operatorType"] = sbwaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return &sbwaf, true -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sbwaf, true -} - -// StringContainsAdvancedFilter stringContains Advanced Filter. -type StringContainsAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) MarshalJSON() ([]byte, error) { - scaf.OperatorType = OperatorTypeStringContains - objectMap := make(map[string]interface{}) - if scaf.Values != nil { - objectMap["values"] = scaf.Values - } - if scaf.Key != nil { - objectMap["key"] = scaf.Key - } - if scaf.OperatorType != "" { - objectMap["operatorType"] = scaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return &scaf, true -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &scaf, true -} - -// StringEndsWithAdvancedFilter stringEndsWith Advanced Filter. -type StringEndsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sewaf.OperatorType = OperatorTypeStringEndsWith - objectMap := make(map[string]interface{}) - if sewaf.Values != nil { - objectMap["values"] = sewaf.Values - } - if sewaf.Key != nil { - objectMap["key"] = sewaf.Key - } - if sewaf.OperatorType != "" { - objectMap["operatorType"] = sewaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return &sewaf, true -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sewaf, true -} - -// StringInAdvancedFilter stringIn Advanced Filter. -type StringInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) MarshalJSON() ([]byte, error) { - siaf.OperatorType = OperatorTypeStringIn - objectMap := make(map[string]interface{}) - if siaf.Values != nil { - objectMap["values"] = siaf.Values - } - if siaf.Key != nil { - objectMap["key"] = siaf.Key - } - if siaf.OperatorType != "" { - objectMap["operatorType"] = siaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return &siaf, true -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &siaf, true -} - -// StringNotInAdvancedFilter stringNotIn Advanced Filter. -type StringNotInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - sniaf.OperatorType = OperatorTypeStringNotIn - objectMap := make(map[string]interface{}) - if sniaf.Values != nil { - objectMap["values"] = sniaf.Values - } - if sniaf.Key != nil { - objectMap["key"] = sniaf.Key - } - if sniaf.OperatorType != "" { - objectMap["operatorType"] = sniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return &sniaf, true -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sniaf, true -} - -// Topic eventGrid Topic -type Topic struct { - autorest.Response `json:"-"` - // TopicProperties - Properties of the topic - *TopicProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TopicProperties != nil { - objectMap["properties"] = t.TopicProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Topic struct. -func (t *Topic) 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 topicProperties TopicProperties - err = json.Unmarshal(*v, &topicProperties) - if err != nil { - return err - } - t.TopicProperties = &topicProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TopicProperties properties of the Topic -type TopicProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' - ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the topic. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventV01Schema' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicProperties. -func (tp TopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.InputSchema != "" { - objectMap["inputSchema"] = tp.InputSchema - } - objectMap["inputSchemaMapping"] = tp.InputSchemaMapping - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicProperties struct. -func (tp *TopicProperties) 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 "provisioningState": - if v != nil { - var provisioningState TopicProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - tp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - tp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - tp.InputSchemaMapping = inputSchemaMapping - } - } - } - - return nil -} - -// TopicRegenerateKeyRequest topic regenerate share access key request -type TopicRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsCreateOrUpdateFuture) 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 TopicsCreateOrUpdateFuture.Result. -func (future *TopicsCreateOrUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateOrUpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsDeleteFuture) 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 TopicsDeleteFuture.Result. -func (future *TopicsDeleteFuture) result(client TopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TopicSharedAccessKeys shared access keys of the Topic -type TopicSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the topic. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the topic. - Key2 *string `json:"key2,omitempty"` -} - -// TopicsListResult result of the List Topics operation -type TopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Topics - Value *[]Topic `json:"value,omitempty"` - // NextLink - A link for the next page of topics - NextLink *string `json:"nextLink,omitempty"` -} - -// TopicsListResultIterator provides access to a complete listing of Topic values. -type TopicsListResultIterator struct { - i int - page TopicsListResultPage -} - -// 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 *TopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultIterator.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 *TopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TopicsListResultIterator) 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 TopicsListResultIterator) Response() TopicsListResult { - 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 TopicsListResultIterator) Value() Topic { - if !iter.page.NotDone() { - return Topic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TopicsListResultIterator type. -func NewTopicsListResultIterator(page TopicsListResultPage) TopicsListResultIterator { - return TopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TopicsListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TopicsListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// topicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TopicsListResult) topicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TopicsListResultPage contains a page of Topic values. -type TopicsListResultPage struct { - fn func(context.Context, TopicsListResult) (TopicsListResult, error) - tlr TopicsListResult -} - -// 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 *TopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TopicsListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TopicsListResultPage) Response() TopicsListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TopicsListResultPage) Values() []Topic { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TopicsListResultPage type. -func NewTopicsListResultPage(cur TopicsListResult, getNextPage func(context.Context, TopicsListResult) (TopicsListResult, error)) TopicsListResultPage { - return TopicsListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsUpdateFuture) 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 TopicsUpdateFuture.Result. -func (future *TopicsUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicTypeInfo properties of a topic type info. -type TopicTypeInfo struct { - autorest.Response `json:"-"` - // TopicTypeProperties - Properties of the topic type info - *TopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicTypeInfo. -func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tti.TopicTypeProperties != nil { - objectMap["properties"] = tti.TopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. -func (tti *TopicTypeInfo) 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 topicTypeProperties TopicTypeProperties - err = json.Unmarshal(*v, &topicTypeProperties) - if err != nil { - return err - } - tti.TopicTypeProperties = &topicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tti.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tti.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tti.Type = &typeVar - } - } - } - - return nil -} - -// TopicTypeProperties properties of a topic type. -type TopicTypeProperties struct { - // Provider - Namespace of the provider of the topic type. - Provider *string `json:"provider,omitempty"` - // DisplayName - Display Name for the topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the topic type. - Description *string `json:"description,omitempty"` - // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' - ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` - // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' - ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` - // SupportedLocations - List of locations supported by this topic type. - SupportedLocations *[]string `json:"supportedLocations,omitempty"` -} - -// TopicTypesListResult result of the List Topic Types operation -type TopicTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of topic types - Value *[]TopicTypeInfo `json:"value,omitempty"` -} - -// TopicUpdateParameters properties of the Topic update -type TopicUpdateParameters struct { - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TopicUpdateParameters. -func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// TrackedResource definition of a Tracked Resource -type TrackedResource struct { - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription -type WebHookEventSubscriptionDestination struct { - // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination - *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - whesd.EndpointType = EndpointTypeWebHook - objectMap := make(map[string]interface{}) - if whesd.WebHookEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties - } - if whesd.EndpointType != "" { - objectMap["endpointType"] = whesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return &whesd, true -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &whesd, true -} - -// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. -func (whesd *WebHookEventSubscriptionDestination) 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 webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) - if err != nil { - return err - } - whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - whesd.EndpointType = endpointType - } - } - } - - return nil -} - -// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for -// an event subscription. -type WebHookEventSubscriptionDestinationProperties struct { - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` - // EndpointBaseURL - READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. - EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestinationProperties. -func (whesdp WebHookEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if whesdp.EndpointURL != nil { - objectMap["endpointUrl"] = whesdp.EndpointURL - } - return json.Marshal(objectMap) -} diff --git a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/operations.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/operations.go deleted file mode 100644 index a3be0656e335..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure EventGrid 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 list the available operations supported by the Microsoft.EventGrid resource provider -func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/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 -} diff --git a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/topics.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/topics.go deleted file mode 100644 index 0b91b55b038c..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/topics.go +++ /dev/null @@ -1,837 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicsClient is the azure EventGrid Management Client -type TopicsClient struct { - BaseClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient 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 NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicInfo - topic information -func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2019-02-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicInfo), - 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 TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, 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 TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, 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 existing topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2019-02-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.EventGrid/topics/{topicName}", 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 TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, 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 TopicsClient) 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 get properties of a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2019-02-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.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the topics under a resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - filter the results using OData syntax. -// top - the number of results to return. -func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client TopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { - req, err := lastResults.topicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) - return -} - -// ListBySubscription list all the topics under an Azure subscription -// Parameters: -// filter - filter the results using OData syntax. -// top - the number of results to return. -func (client TopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result TopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { - req, err := lastResults.topicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result TopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) - return -} - -// ListEventTypes list event types for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the topic type -// resourceName - name of the topic -func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-02-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/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSharedAccessKeys list the two keys used to publish to a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2019-02-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.EventGrid/topics/{topicName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// regenerateKeyRequest - request body to regenerate key -func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.TopicsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, topicName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2019-02-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.EventGrid/topics/{topicName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 TopicsClient) 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 TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicUpdateParameters - topic update information -func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2019-02-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicUpdateParameters), - 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 TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, 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 TopicsClient) UpdateResponder(resp *http.Response) (result Topic, 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/eventgrid/mgmt/2019-02-01-preview/eventgrid/topictypes.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/topictypes.go deleted file mode 100644 index 3ab40c7adc5c..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/topictypes.go +++ /dev/null @@ -1,244 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicTypesClient is the azure EventGrid Management Client -type TopicTypesClient struct { - BaseClient -} - -// NewTopicTypesClient creates an instance of the TopicTypesClient client. -func NewTopicTypesClient(subscriptionID string) TopicTypesClient { - return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient 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 NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { - return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get information about a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.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, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all registered topic types -func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"), - 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 TopicTypesClient) 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 TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2019-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, 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/eventgrid/mgmt/2019-02-01-preview/eventgrid/version.go b/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/version.go deleted file mode 100644 index 73dd1f8b9e27..000000000000 --- a/services/preview/eventgrid/mgmt/2019-02-01-preview/eventgrid/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package eventgrid - -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() + " eventgrid/2019-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/eventgrid/mgmt/2020-01-01-preview/eventgrid/CHANGELOG.md b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/_meta.json b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/_meta.json deleted file mode 100644 index 215ed5aa5c03..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "tag": "package-2020-01-preview", - "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-2020-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/client.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/client.go deleted file mode 100644 index c1b30d077458..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2020-01-01-preview. -// -// Azure EventGrid Management Client -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Eventgrid - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Eventgrid. -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/eventgrid/mgmt/2020-01-01-preview/eventgrid/domains.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/domains.go deleted file mode 100644 index 3746ced107eb..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/domains.go +++ /dev/null @@ -1,769 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainsClient is the azure EventGrid Management Client -type DomainsClient struct { - BaseClient -} - -// NewDomainsClient creates an instance of the DomainsClient client. -func NewDomainsClient(subscriptionID string) DomainsClient { - return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainsClientWithBaseURI creates an instance of the DomainsClient 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 NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { - return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates a new domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainInfo - domain information -func (client DomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (result DomainsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainInfo), - 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 DomainsClient) CreateOrUpdateSender(req *http.Request) (future DomainsCreateOrUpdateFuture, 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 DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, 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 existing domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -func (client DomainsClient) Delete(ctx context.Context, resourceGroupName string, domainName string) (result DomainsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-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.EventGrid/domains/{domainName}", 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 DomainsClient) DeleteSender(req *http.Request) (future DomainsDeleteFuture, 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 DomainsClient) 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 get properties of a domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -func (client DomainsClient) Get(ctx context.Context, resourceGroupName string, domainName string) (result Domain, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-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.EventGrid/domains/{domainName}", 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 DomainsClient) 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 DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the domains under a resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client DomainsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DomainsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { - req, err := lastResults.domainsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) - return -} - -// ListBySubscription list all the domains under an Azure subscription -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client DomainsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result DomainsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListBySubscription") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DomainsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListBySubscriptionResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { - req, err := lastResults.domainsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result DomainsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) - return -} - -// ListSharedAccessKeys list the two keys used to publish to a domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -func (client DomainsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client DomainsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-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.EventGrid/domains/{domainName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListSharedAccessKeysResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a domain -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// regenerateKeyRequest - request body to regenerate key -func (client DomainsClient) RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.DomainsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, domainName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DomainsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-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.EventGrid/domains/{domainName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 DomainsClient) 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 DomainsClient) RegenerateKeyResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainUpdateParameters - domain update information -func (client DomainsClient) Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (result DomainsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainName, domainUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainUpdateParameters), - 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 DomainsClient) UpdateSender(req *http.Request) (future DomainsUpdateFuture, 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 DomainsClient) UpdateResponder(resp *http.Response) (result Domain, 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/eventgrid/mgmt/2020-01-01-preview/eventgrid/domaintopics.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/domaintopics.go deleted file mode 100644 index eadc2406c8ed..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/domaintopics.go +++ /dev/null @@ -1,402 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainTopicsClient is the azure EventGrid Management Client -type DomainTopicsClient struct { - BaseClient -} - -// NewDomainTopicsClient creates an instance of the DomainTopicsClient client. -func NewDomainTopicsClient(subscriptionID string) DomainTopicsClient { - return NewDomainTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainTopicsClientWithBaseURI creates an instance of the DomainTopicsClient 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 NewDomainTopicsClientWithBaseURI(baseURI string, subscriptionID string) DomainTopicsClient { - return DomainTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates a new domain topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainTopicName - name of the domain topic -func (client DomainTopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainTopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}", pathParameters), - 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 DomainTopicsClient) CreateOrUpdateSender(req *http.Request) (future DomainTopicsCreateOrUpdateFuture, 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 DomainTopicsClient) CreateOrUpdateResponder(resp *http.Response) (result DomainTopic, 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 existing domain topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainTopicName - name of the domain topic -func (client DomainTopicsClient) Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-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.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) DeleteSender(req *http.Request) (future DomainTopicsDeleteFuture, 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 DomainTopicsClient) 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 get properties of a domain topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain -// domainTopicName - name of the topic -func (client DomainTopicsClient) Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.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, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-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.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) 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 DomainTopicsClient) GetResponder(resp *http.Response) (result DomainTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomain list all the topics in a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - domain name. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client DomainTopicsClient) ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") - defer func() { - sc := -1 - if result.dtlr.Response.Response != nil { - sc = result.dtlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDomainNextResults - req, err := client.ListByDomainPreparer(ctx, resourceGroupName, domainName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainSender(req) - if err != nil { - result.dtlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure sending request") - return - } - - result.dtlr, err = client.ListByDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure responding to request") - return - } - if result.dtlr.hasNextLink() && result.dtlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDomainPreparer prepares the ListByDomain request. -func (client DomainTopicsClient) ListByDomainPreparer(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainSender sends the ListByDomain request. The method will close the -// http.Response Body if it receives an error. -func (client DomainTopicsClient) ListByDomainSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainResponder handles the response to the ListByDomain request. The method always -// closes the http.Response Body. -func (client DomainTopicsClient) ListByDomainResponder(resp *http.Response) (result DomainTopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDomainNextResults retrieves the next set of results, if any. -func (client DomainTopicsClient) listByDomainNextResults(ctx context.Context, lastResults DomainTopicsListResult) (result DomainTopicsListResult, err error) { - req, err := lastResults.domainTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDomainSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDomainComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainTopicsClient) ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") - 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.ListByDomain(ctx, resourceGroupName, domainName, filter, top) - return -} diff --git a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/enums.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/enums.go deleted file mode 100644 index 2ff1bc4a3d5a..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/enums.go +++ /dev/null @@ -1,268 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DomainProvisioningState enumerates the values for domain provisioning state. -type DomainProvisioningState string - -const ( - // Canceled ... - Canceled DomainProvisioningState = "Canceled" - // Creating ... - Creating DomainProvisioningState = "Creating" - // Deleting ... - Deleting DomainProvisioningState = "Deleting" - // Failed ... - Failed DomainProvisioningState = "Failed" - // Succeeded ... - Succeeded DomainProvisioningState = "Succeeded" - // Updating ... - Updating DomainProvisioningState = "Updating" -) - -// PossibleDomainProvisioningStateValues returns an array of possible values for the DomainProvisioningState const type. -func PossibleDomainProvisioningStateValues() []DomainProvisioningState { - return []DomainProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// DomainTopicProvisioningState enumerates the values for domain topic provisioning state. -type DomainTopicProvisioningState string - -const ( - // DomainTopicProvisioningStateCanceled ... - DomainTopicProvisioningStateCanceled DomainTopicProvisioningState = "Canceled" - // DomainTopicProvisioningStateCreating ... - DomainTopicProvisioningStateCreating DomainTopicProvisioningState = "Creating" - // DomainTopicProvisioningStateDeleting ... - DomainTopicProvisioningStateDeleting DomainTopicProvisioningState = "Deleting" - // DomainTopicProvisioningStateFailed ... - DomainTopicProvisioningStateFailed DomainTopicProvisioningState = "Failed" - // DomainTopicProvisioningStateSucceeded ... - DomainTopicProvisioningStateSucceeded DomainTopicProvisioningState = "Succeeded" - // DomainTopicProvisioningStateUpdating ... - DomainTopicProvisioningStateUpdating DomainTopicProvisioningState = "Updating" -) - -// PossibleDomainTopicProvisioningStateValues returns an array of possible values for the DomainTopicProvisioningState const type. -func PossibleDomainTopicProvisioningStateValues() []DomainTopicProvisioningState { - return []DomainTopicProvisioningState{DomainTopicProvisioningStateCanceled, DomainTopicProvisioningStateCreating, DomainTopicProvisioningStateDeleting, DomainTopicProvisioningStateFailed, DomainTopicProvisioningStateSucceeded, DomainTopicProvisioningStateUpdating} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeAzureFunction ... - EndpointTypeAzureFunction EndpointType = "AzureFunction" - // EndpointTypeEventHub ... - EndpointTypeEventHub EndpointType = "EventHub" - // EndpointTypeEventSubscriptionDestination ... - EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" - // EndpointTypeHybridConnection ... - EndpointTypeHybridConnection EndpointType = "HybridConnection" - // EndpointTypeServiceBusQueue ... - EndpointTypeServiceBusQueue EndpointType = "ServiceBusQueue" - // EndpointTypeServiceBusTopic ... - EndpointTypeServiceBusTopic EndpointType = "ServiceBusTopic" - // EndpointTypeStorageQueue ... - EndpointTypeStorageQueue EndpointType = "StorageQueue" - // EndpointTypeWebHook ... - EndpointTypeWebHook EndpointType = "WebHook" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeAzureFunction, EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeHybridConnection, EndpointTypeServiceBusQueue, EndpointTypeServiceBusTopic, EndpointTypeStorageQueue, EndpointTypeWebHook} -} - -// EndpointTypeBasicDeadLetterDestination enumerates the values for endpoint type basic dead letter -// destination. -type EndpointTypeBasicDeadLetterDestination string - -const ( - // EndpointTypeDeadLetterDestination ... - EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = "DeadLetterDestination" - // EndpointTypeStorageBlob ... - EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = "StorageBlob" -) - -// PossibleEndpointTypeBasicDeadLetterDestinationValues returns an array of possible values for the EndpointTypeBasicDeadLetterDestination const type. -func PossibleEndpointTypeBasicDeadLetterDestinationValues() []EndpointTypeBasicDeadLetterDestination { - return []EndpointTypeBasicDeadLetterDestination{EndpointTypeDeadLetterDestination, EndpointTypeStorageBlob} -} - -// EventDeliverySchema enumerates the values for event delivery schema. -type EventDeliverySchema string - -const ( - // CloudEventSchemaV10 ... - CloudEventSchemaV10 EventDeliverySchema = "CloudEventSchemaV1_0" - // CustomInputSchema ... - CustomInputSchema EventDeliverySchema = "CustomInputSchema" - // EventGridSchema ... - EventGridSchema EventDeliverySchema = "EventGridSchema" -) - -// PossibleEventDeliverySchemaValues returns an array of possible values for the EventDeliverySchema const type. -func PossibleEventDeliverySchemaValues() []EventDeliverySchema { - return []EventDeliverySchema{CloudEventSchemaV10, CustomInputSchema, EventGridSchema} -} - -// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. -type EventSubscriptionProvisioningState string - -const ( - // EventSubscriptionProvisioningStateAwaitingManualAction ... - EventSubscriptionProvisioningStateAwaitingManualAction EventSubscriptionProvisioningState = "AwaitingManualAction" - // EventSubscriptionProvisioningStateCanceled ... - EventSubscriptionProvisioningStateCanceled EventSubscriptionProvisioningState = "Canceled" - // EventSubscriptionProvisioningStateCreating ... - EventSubscriptionProvisioningStateCreating EventSubscriptionProvisioningState = "Creating" - // EventSubscriptionProvisioningStateDeleting ... - EventSubscriptionProvisioningStateDeleting EventSubscriptionProvisioningState = "Deleting" - // EventSubscriptionProvisioningStateFailed ... - EventSubscriptionProvisioningStateFailed EventSubscriptionProvisioningState = "Failed" - // EventSubscriptionProvisioningStateSucceeded ... - EventSubscriptionProvisioningStateSucceeded EventSubscriptionProvisioningState = "Succeeded" - // EventSubscriptionProvisioningStateUpdating ... - EventSubscriptionProvisioningStateUpdating EventSubscriptionProvisioningState = "Updating" -) - -// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. -func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { - return []EventSubscriptionProvisioningState{EventSubscriptionProvisioningStateAwaitingManualAction, EventSubscriptionProvisioningStateCanceled, EventSubscriptionProvisioningStateCreating, EventSubscriptionProvisioningStateDeleting, EventSubscriptionProvisioningStateFailed, EventSubscriptionProvisioningStateSucceeded, EventSubscriptionProvisioningStateUpdating} -} - -// InputSchema enumerates the values for input schema. -type InputSchema string - -const ( - // InputSchemaCloudEventSchemaV10 ... - InputSchemaCloudEventSchemaV10 InputSchema = "CloudEventSchemaV1_0" - // InputSchemaCustomEventSchema ... - InputSchemaCustomEventSchema InputSchema = "CustomEventSchema" - // InputSchemaEventGridSchema ... - InputSchemaEventGridSchema InputSchema = "EventGridSchema" -) - -// PossibleInputSchemaValues returns an array of possible values for the InputSchema const type. -func PossibleInputSchemaValues() []InputSchema { - return []InputSchema{InputSchemaCloudEventSchemaV10, InputSchemaCustomEventSchema, InputSchemaEventGridSchema} -} - -// InputSchemaMappingType enumerates the values for input schema mapping type. -type InputSchemaMappingType string - -const ( - // InputSchemaMappingTypeInputSchemaMapping ... - InputSchemaMappingTypeInputSchemaMapping InputSchemaMappingType = "InputSchemaMapping" - // InputSchemaMappingTypeJSON ... - InputSchemaMappingTypeJSON InputSchemaMappingType = "Json" -) - -// PossibleInputSchemaMappingTypeValues returns an array of possible values for the InputSchemaMappingType const type. -func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { - return []InputSchemaMappingType{InputSchemaMappingTypeInputSchemaMapping, InputSchemaMappingTypeJSON} -} - -// OperatorType enumerates the values for operator type. -type OperatorType string - -const ( - // OperatorTypeAdvancedFilter ... - OperatorTypeAdvancedFilter OperatorType = "AdvancedFilter" - // OperatorTypeBoolEquals ... - OperatorTypeBoolEquals OperatorType = "BoolEquals" - // OperatorTypeNumberGreaterThan ... - OperatorTypeNumberGreaterThan OperatorType = "NumberGreaterThan" - // OperatorTypeNumberGreaterThanOrEquals ... - OperatorTypeNumberGreaterThanOrEquals OperatorType = "NumberGreaterThanOrEquals" - // OperatorTypeNumberIn ... - OperatorTypeNumberIn OperatorType = "NumberIn" - // OperatorTypeNumberLessThan ... - OperatorTypeNumberLessThan OperatorType = "NumberLessThan" - // OperatorTypeNumberLessThanOrEquals ... - OperatorTypeNumberLessThanOrEquals OperatorType = "NumberLessThanOrEquals" - // OperatorTypeNumberNotIn ... - OperatorTypeNumberNotIn OperatorType = "NumberNotIn" - // OperatorTypeStringBeginsWith ... - OperatorTypeStringBeginsWith OperatorType = "StringBeginsWith" - // OperatorTypeStringContains ... - OperatorTypeStringContains OperatorType = "StringContains" - // OperatorTypeStringEndsWith ... - OperatorTypeStringEndsWith OperatorType = "StringEndsWith" - // OperatorTypeStringIn ... - OperatorTypeStringIn OperatorType = "StringIn" - // OperatorTypeStringNotIn ... - OperatorTypeStringNotIn OperatorType = "StringNotIn" -) - -// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. -func PossibleOperatorTypeValues() []OperatorType { - return []OperatorType{OperatorTypeAdvancedFilter, OperatorTypeBoolEquals, OperatorTypeNumberGreaterThan, OperatorTypeNumberGreaterThanOrEquals, OperatorTypeNumberIn, OperatorTypeNumberLessThan, OperatorTypeNumberLessThanOrEquals, OperatorTypeNumberNotIn, OperatorTypeStringBeginsWith, OperatorTypeStringContains, OperatorTypeStringEndsWith, OperatorTypeStringIn, OperatorTypeStringNotIn} -} - -// ResourceRegionType enumerates the values for resource region type. -type ResourceRegionType string - -const ( - // GlobalResource ... - GlobalResource ResourceRegionType = "GlobalResource" - // RegionalResource ... - RegionalResource ResourceRegionType = "RegionalResource" -) - -// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. -func PossibleResourceRegionTypeValues() []ResourceRegionType { - return []ResourceRegionType{GlobalResource, RegionalResource} -} - -// TopicProvisioningState enumerates the values for topic provisioning state. -type TopicProvisioningState string - -const ( - // TopicProvisioningStateCanceled ... - TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" - // TopicProvisioningStateCreating ... - TopicProvisioningStateCreating TopicProvisioningState = "Creating" - // TopicProvisioningStateDeleting ... - TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" - // TopicProvisioningStateFailed ... - TopicProvisioningStateFailed TopicProvisioningState = "Failed" - // TopicProvisioningStateSucceeded ... - TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" - // TopicProvisioningStateUpdating ... - TopicProvisioningStateUpdating TopicProvisioningState = "Updating" -) - -// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. -func PossibleTopicProvisioningStateValues() []TopicProvisioningState { - return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} -} - -// TopicTypeProvisioningState enumerates the values for topic type provisioning state. -type TopicTypeProvisioningState string - -const ( - // TopicTypeProvisioningStateCanceled ... - TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" - // TopicTypeProvisioningStateCreating ... - TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" - // TopicTypeProvisioningStateDeleting ... - TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" - // TopicTypeProvisioningStateFailed ... - TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" - // TopicTypeProvisioningStateSucceeded ... - TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" - // TopicTypeProvisioningStateUpdating ... - TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" -) - -// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. -func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { - return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} -} diff --git a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/eventgridapi/interfaces.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/eventgridapi/interfaces.go deleted file mode 100644 index e247d2b8bb10..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/eventgridapi/interfaces.go +++ /dev/null @@ -1,103 +0,0 @@ -package eventgridapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/eventgrid/mgmt/2020-01-01-preview/eventgrid" -) - -// DomainsClientAPI contains the set of methods on the DomainsClient type. -type DomainsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo eventgrid.Domain) (result eventgrid.DomainsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.Domain, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest eventgrid.DomainRegenerateKeyRequest) (result eventgrid.DomainSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters eventgrid.DomainUpdateParameters) (result eventgrid.DomainsUpdateFuture, err error) -} - -var _ DomainsClientAPI = (*eventgrid.DomainsClient)(nil) - -// DomainTopicsClientAPI contains the set of methods on the DomainTopicsClient type. -type DomainTopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopic, err error) - ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultPage, err error) - ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultIterator, err error) -} - -var _ DomainTopicsClientAPI = (*eventgrid.DomainTopicsClient)(nil) - -// EventSubscriptionsClientAPI contains the set of methods on the EventSubscriptionsClient type. -type EventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.EventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.EventSubscriptionsUpdateFuture, err error) -} - -var _ EventSubscriptionsClientAPI = (*eventgrid.EventSubscriptionsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result eventgrid.OperationsListResult, err error) -} - -var _ OperationsClientAPI = (*eventgrid.OperationsClient)(nil) - -// TopicsClientAPI contains the set of methods on the TopicsClient type. -type TopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo eventgrid.Topic) (result eventgrid.TopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.Topic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) - ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventTypesListResult, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest eventgrid.TopicRegenerateKeyRequest) (result eventgrid.TopicSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters eventgrid.TopicUpdateParameters) (result eventgrid.TopicsUpdateFuture, err error) -} - -var _ TopicsClientAPI = (*eventgrid.TopicsClient)(nil) - -// TopicTypesClientAPI contains the set of methods on the TopicTypesClient type. -type TopicTypesClientAPI interface { - Get(ctx context.Context, topicTypeName string) (result eventgrid.TopicTypeInfo, err error) - List(ctx context.Context) (result eventgrid.TopicTypesListResult, err error) - ListEventTypes(ctx context.Context, topicTypeName string) (result eventgrid.EventTypesListResult, err error) -} - -var _ TopicTypesClientAPI = (*eventgrid.TopicTypesClient)(nil) diff --git a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/eventsubscriptions.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/eventsubscriptions.go deleted file mode 100644 index 9409cbb7b7e2..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/eventsubscriptions.go +++ /dev/null @@ -1,1781 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventSubscriptionsClient is the azure EventGrid Management Client -type EventSubscriptionsClient struct { - BaseClient -} - -// NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. -func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { - return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient 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 NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { - return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new event subscription or updates an existing event subscription based on -// the specified scope. -// Parameters: -// scope - the identifier of the resource to which the event subscription needs to be created or updated. The -// scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider -// namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. Event subscription names must be between 3 and 64 -// characters in length and should use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information -func (client EventSubscriptionsClient) CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 EventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future EventSubscriptionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an existing event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) 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 get properties of an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.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, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) 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 EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription -func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomainTopic list all event subscriptions that have been created for a specific domain topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the top level domain -// topicName - name of the domain topic -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDomainTopicNextResults - req, err := client.ListByDomainTopicPreparer(ctx, resourceGroupName, domainName, topicName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainTopicSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByDomainTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDomainTopicPreparer prepares the ListByDomainTopic request. -func (client EventSubscriptionsClient) ListByDomainTopicPreparer(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainTopicSender sends the ListByDomainTopic request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByDomainTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainTopicResponder handles the response to the ListByDomainTopic request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByDomainTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDomainTopicNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listByDomainTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDomainTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDomainTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDomainTopicComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") - 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.ListByDomainTopic(ctx, resourceGroupName, domainName, topicName, filter, top) - return -} - -// ListByResource list all event subscriptions that have been created for a specific topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the resource type -// resourceName - name of the resource -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listByResourceNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - 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.ListByResource(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top) - return -} - -// ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalByResourceGroupNextResults - req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalByResourceGroupNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - 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.ListGlobalByResourceGroup(ctx, resourceGroupName, filter, top) - return -} - -// ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific -// topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicTypeName - name of the topic type -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalByResourceGroupForTopicTypeNextResults - req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - 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.ListGlobalByResourceGroupForTopicType(ctx, resourceGroupName, topicTypeName, filter, top) - return -} - -// ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalBySubscriptionNextResults - req, err := client.ListGlobalBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalBySubscriptionNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - 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.ListGlobalBySubscription(ctx, filter, top) - return -} - -// ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic -// type. -// Parameters: -// topicTypeName - name of the topic type -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalBySubscriptionForTopicTypeNextResults - req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - 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.ListGlobalBySubscriptionForTopicType(ctx, topicTypeName, filter, top) - return -} - -// ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription -// and resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalByResourceGroupNextResults - req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalByResourceGroupNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - 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.ListRegionalByResourceGroup(ctx, resourceGroupName, location, filter, top) - return -} - -// ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and resource group and topic type -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location -// topicTypeName - name of the topic type -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalByResourceGroupForTopicTypeNextResults - req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - 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.ListRegionalByResourceGroupForTopicType(ctx, resourceGroupName, location, topicTypeName, filter, top) - return -} - -// ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription -// Parameters: -// location - name of the location -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalBySubscriptionNextResults - req, err := client.ListRegionalBySubscriptionPreparer(ctx, location, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(ctx context.Context, location string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalBySubscriptionNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - 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.ListRegionalBySubscription(ctx, location, filter, top) - return -} - -// ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and topic type. -// Parameters: -// location - name of the location -// topicTypeName - name of the topic type -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalBySubscriptionForTopicTypeNextResults - req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - 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.ListRegionalBySubscriptionForTopicType(ctx, location, topicTypeName, filter, top) - return -} - -// Update asynchronously updates an existing event subscription. -// Parameters: -// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a -// top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be updated -// eventSubscriptionUpdateParameters - updated event subscription information -func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2020-01-01-preview/eventgrid/models.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/models.go deleted file mode 100644 index ddb504006979..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/models.go +++ /dev/null @@ -1,4874 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid" - -// BasicAdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do -// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as -// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of the key -// based on which you want to filter. -type BasicAdvancedFilter interface { - AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) - AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) - AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) - AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) - AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) - AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) - AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) - AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) - AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) - AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) - AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) - AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) - AsAdvancedFilter() (*AdvancedFilter, bool) -} - -// AdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do -// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as -// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of -// the key based on which you want to filter. -type AdvancedFilter struct { - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -func unmarshalBasicAdvancedFilter(body []byte) (BasicAdvancedFilter, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["operatorType"] { - case string(OperatorTypeNumberIn): - var niaf NumberInAdvancedFilter - err := json.Unmarshal(body, &niaf) - return niaf, err - case string(OperatorTypeNumberNotIn): - var nniaf NumberNotInAdvancedFilter - err := json.Unmarshal(body, &nniaf) - return nniaf, err - case string(OperatorTypeNumberLessThan): - var nltaf NumberLessThanAdvancedFilter - err := json.Unmarshal(body, &nltaf) - return nltaf, err - case string(OperatorTypeNumberGreaterThan): - var ngtaf NumberGreaterThanAdvancedFilter - err := json.Unmarshal(body, &ngtaf) - return ngtaf, err - case string(OperatorTypeNumberLessThanOrEquals): - var nltoeaf NumberLessThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &nltoeaf) - return nltoeaf, err - case string(OperatorTypeNumberGreaterThanOrEquals): - var ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &ngtoeaf) - return ngtoeaf, err - case string(OperatorTypeBoolEquals): - var beaf BoolEqualsAdvancedFilter - err := json.Unmarshal(body, &beaf) - return beaf, err - case string(OperatorTypeStringIn): - var siaf StringInAdvancedFilter - err := json.Unmarshal(body, &siaf) - return siaf, err - case string(OperatorTypeStringNotIn): - var sniaf StringNotInAdvancedFilter - err := json.Unmarshal(body, &sniaf) - return sniaf, err - case string(OperatorTypeStringBeginsWith): - var sbwaf StringBeginsWithAdvancedFilter - err := json.Unmarshal(body, &sbwaf) - return sbwaf, err - case string(OperatorTypeStringEndsWith): - var sewaf StringEndsWithAdvancedFilter - err := json.Unmarshal(body, &sewaf) - return sewaf, err - case string(OperatorTypeStringContains): - var scaf StringContainsAdvancedFilter - err := json.Unmarshal(body, &scaf) - return scaf, err - default: - var af AdvancedFilter - err := json.Unmarshal(body, &af) - return af, err - } -} -func unmarshalBasicAdvancedFilterArray(body []byte) ([]BasicAdvancedFilter, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - afArray := make([]BasicAdvancedFilter, len(rawMessages)) - - for index, rawMessage := range rawMessages { - af, err := unmarshalBasicAdvancedFilter(*rawMessage) - if err != nil { - return nil, err - } - afArray[index] = af - } - return afArray, nil -} - -// MarshalJSON is the custom marshaler for AdvancedFilter. -func (af AdvancedFilter) MarshalJSON() ([]byte, error) { - af.OperatorType = OperatorTypeAdvancedFilter - objectMap := make(map[string]interface{}) - if af.Key != nil { - objectMap["key"] = af.Key - } - if af.OperatorType != "" { - objectMap["operatorType"] = af.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return &af, true -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &af, true -} - -// AzureFunctionEventSubscriptionDestination information about the azure function destination for an event -// subscription. -type AzureFunctionEventSubscriptionDestination struct { - // AzureFunctionEventSubscriptionDestinationProperties - Azure Function Properties of the event subscription destination. - *AzureFunctionEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - afesd.EndpointType = EndpointTypeAzureFunction - objectMap := make(map[string]interface{}) - if afesd.AzureFunctionEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = afesd.AzureFunctionEventSubscriptionDestinationProperties - } - if afesd.EndpointType != "" { - objectMap["endpointType"] = afesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return &afesd, true -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &afesd, true -} - -// UnmarshalJSON is the custom unmarshaler for AzureFunctionEventSubscriptionDestination struct. -func (afesd *AzureFunctionEventSubscriptionDestination) 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 azureFunctionEventSubscriptionDestinationProperties AzureFunctionEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &azureFunctionEventSubscriptionDestinationProperties) - if err != nil { - return err - } - afesd.AzureFunctionEventSubscriptionDestinationProperties = &azureFunctionEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - afesd.EndpointType = endpointType - } - } - } - - return nil -} - -// AzureFunctionEventSubscriptionDestinationProperties the properties that represent the Azure Function -// destination of an event subscription. -type AzureFunctionEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Azure Function destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // MaxEventsPerBatch - Maximum number of events per batch. - MaxEventsPerBatch *int32 `json:"maxEventsPerBatch,omitempty"` - // PreferredBatchSizeInKilobytes - Preferred batch size in Kilobytes. - PreferredBatchSizeInKilobytes *int32 `json:"preferredBatchSizeInKilobytes,omitempty"` -} - -// BoolEqualsAdvancedFilter boolEquals Advanced Filter. -type BoolEqualsAdvancedFilter struct { - // Value - The boolean filter value. - Value *bool `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - beaf.OperatorType = OperatorTypeBoolEquals - objectMap := make(map[string]interface{}) - if beaf.Value != nil { - objectMap["value"] = beaf.Value - } - if beaf.Key != nil { - objectMap["key"] = beaf.Key - } - if beaf.OperatorType != "" { - objectMap["operatorType"] = beaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return &beaf, true -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &beaf, true -} - -// BasicDeadLetterDestination information about the dead letter destination for an event subscription. To configure a -// deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a -// derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. -type BasicDeadLetterDestination interface { - AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) - AsDeadLetterDestination() (*DeadLetterDestination, bool) -} - -// DeadLetterDestination information about the dead letter destination for an event subscription. To configure -// a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an -// object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from -// this class. -type DeadLetterDestination struct { - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -func unmarshalBasicDeadLetterDestination(body []byte) (BasicDeadLetterDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeStorageBlob): - var sbdld StorageBlobDeadLetterDestination - err := json.Unmarshal(body, &sbdld) - return sbdld, err - default: - var dld DeadLetterDestination - err := json.Unmarshal(body, &dld) - return dld, err - } -} -func unmarshalBasicDeadLetterDestinationArray(body []byte) ([]BasicDeadLetterDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dldArray := make([]BasicDeadLetterDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dld, err := unmarshalBasicDeadLetterDestination(*rawMessage) - if err != nil { - return nil, err - } - dldArray[index] = dld - } - return dldArray, nil -} - -// MarshalJSON is the custom marshaler for DeadLetterDestination. -func (dld DeadLetterDestination) MarshalJSON() ([]byte, error) { - dld.EndpointType = EndpointTypeDeadLetterDestination - objectMap := make(map[string]interface{}) - if dld.EndpointType != "" { - objectMap["endpointType"] = dld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return nil, false -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return &dld, true -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &dld, true -} - -// Domain eventGrid Domain -type Domain struct { - autorest.Response `json:"-"` - // DomainProperties - Properties of the domain - *DomainProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Domain. -func (d Domain) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DomainProperties != nil { - objectMap["properties"] = d.DomainProperties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Domain struct. -func (d *Domain) 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 domainProperties DomainProperties - err = json.Unmarshal(*v, &domainProperties) - if err != nil { - return err - } - d.DomainProperties = &domainProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DomainProperties properties of the Domain -type DomainProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the domain. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' - ProvisioningState DomainProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the domain. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the domain. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventSchemaV10' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - Information about the InputSchemaMapping which specified the info about mapping event payload. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` - // MetricResourceID - READ-ONLY; Metric resource id for the domain. - MetricResourceID *string `json:"metricResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainProperties. -func (dp DomainProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.InputSchema != "" { - objectMap["inputSchema"] = dp.InputSchema - } - objectMap["inputSchemaMapping"] = dp.InputSchemaMapping - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainProperties struct. -func (dp *DomainProperties) 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 "provisioningState": - if v != nil { - var provisioningState DomainProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - dp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - dp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - dp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - dp.InputSchemaMapping = inputSchemaMapping - } - case "metricResourceId": - if v != nil { - var metricResourceID string - err = json.Unmarshal(*v, &metricResourceID) - if err != nil { - return err - } - dp.MetricResourceID = &metricResourceID - } - } - } - - return nil -} - -// DomainRegenerateKeyRequest domain regenerate share access key request -type DomainRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// DomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsCreateOrUpdateFuture) 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 DomainsCreateOrUpdateFuture.Result. -func (future *DomainsCreateOrUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsDeleteFuture) 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 DomainsDeleteFuture.Result. -func (future *DomainsDeleteFuture) result(client DomainsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainSharedAccessKeys shared access keys of the Domain -type DomainSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the domain. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the domain. - Key2 *string `json:"key2,omitempty"` -} - -// DomainsListResult result of the List Domains operation -type DomainsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domains - Value *[]Domain `json:"value,omitempty"` - // NextLink - A link for the next page of domains - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainsListResultIterator provides access to a complete listing of Domain values. -type DomainsListResultIterator struct { - i int - page DomainsListResultPage -} - -// 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 *DomainsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultIterator.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 *DomainsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainsListResultIterator) 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 DomainsListResultIterator) Response() DomainsListResult { - 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 DomainsListResultIterator) Value() Domain { - if !iter.page.NotDone() { - return Domain{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainsListResultIterator type. -func NewDomainsListResultIterator(page DomainsListResultPage) DomainsListResultIterator { - return DomainsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DomainsListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DomainsListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// domainsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DomainsListResult) domainsListResultPreparer(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))) -} - -// DomainsListResultPage contains a page of Domain values. -type DomainsListResultPage struct { - fn func(context.Context, DomainsListResult) (DomainsListResult, error) - dlr DomainsListResult -} - -// 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 *DomainsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultPage.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 *DomainsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainsListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainsListResultPage) Response() DomainsListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainsListResultPage) Values() []Domain { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DomainsListResultPage type. -func NewDomainsListResultPage(cur DomainsListResult, getNextPage func(context.Context, DomainsListResult) (DomainsListResult, error)) DomainsListResultPage { - return DomainsListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsUpdateFuture) 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 DomainsUpdateFuture.Result. -func (future *DomainsUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainTopic domain Topic -type DomainTopic struct { - autorest.Response `json:"-"` - // DomainTopicProperties - Properties of the Domain Topic - *DomainTopicProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainTopic. -func (dt DomainTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dt.DomainTopicProperties != nil { - objectMap["properties"] = dt.DomainTopicProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainTopic struct. -func (dt *DomainTopic) 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 domainTopicProperties DomainTopicProperties - err = json.Unmarshal(*v, &domainTopicProperties) - if err != nil { - return err - } - dt.DomainTopicProperties = &domainTopicProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dt.Type = &typeVar - } - } - } - - return nil -} - -// DomainTopicProperties properties of the Domain Topic -type DomainTopicProperties struct { - // ProvisioningState - Provisioning state of the domain topic. Possible values include: 'DomainTopicProvisioningStateCreating', 'DomainTopicProvisioningStateUpdating', 'DomainTopicProvisioningStateDeleting', 'DomainTopicProvisioningStateSucceeded', 'DomainTopicProvisioningStateCanceled', 'DomainTopicProvisioningStateFailed' - ProvisioningState DomainTopicProvisioningState `json:"provisioningState,omitempty"` -} - -// DomainTopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DomainTopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainTopicsClient) (DomainTopic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainTopicsCreateOrUpdateFuture) 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 DomainTopicsCreateOrUpdateFuture.Result. -func (future *DomainTopicsCreateOrUpdateFuture) result(client DomainTopicsClient) (dt DomainTopic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dt.Response.Response, err = future.GetResult(sender); err == nil && dt.Response.Response.StatusCode != http.StatusNoContent { - dt, err = client.CreateOrUpdateResponder(dt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", dt.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainTopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainTopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainTopicsDeleteFuture) 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 DomainTopicsDeleteFuture.Result. -func (future *DomainTopicsDeleteFuture) result(client DomainTopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainTopicsListResult result of the List Domain Topics operation -type DomainTopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domain Topics - Value *[]DomainTopic `json:"value,omitempty"` - // NextLink - A link for the next page of domain topics - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainTopicsListResultIterator provides access to a complete listing of DomainTopic values. -type DomainTopicsListResultIterator struct { - i int - page DomainTopicsListResultPage -} - -// 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 *DomainTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultIterator.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 *DomainTopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainTopicsListResultIterator) 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 DomainTopicsListResultIterator) Response() DomainTopicsListResult { - 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 DomainTopicsListResultIterator) Value() DomainTopic { - if !iter.page.NotDone() { - return DomainTopic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainTopicsListResultIterator type. -func NewDomainTopicsListResultIterator(page DomainTopicsListResultPage) DomainTopicsListResultIterator { - return DomainTopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dtlr DomainTopicsListResult) IsEmpty() bool { - return dtlr.Value == nil || len(*dtlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dtlr DomainTopicsListResult) hasNextLink() bool { - return dtlr.NextLink != nil && len(*dtlr.NextLink) != 0 -} - -// domainTopicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dtlr DomainTopicsListResult) domainTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dtlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dtlr.NextLink))) -} - -// DomainTopicsListResultPage contains a page of DomainTopic values. -type DomainTopicsListResultPage struct { - fn func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error) - dtlr DomainTopicsListResult -} - -// 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 *DomainTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultPage.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.dtlr) - if err != nil { - return err - } - page.dtlr = 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 *DomainTopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainTopicsListResultPage) NotDone() bool { - return !page.dtlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainTopicsListResultPage) Response() DomainTopicsListResult { - return page.dtlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainTopicsListResultPage) Values() []DomainTopic { - if page.dtlr.IsEmpty() { - return nil - } - return *page.dtlr.Value -} - -// Creates a new instance of the DomainTopicsListResultPage type. -func NewDomainTopicsListResultPage(cur DomainTopicsListResult, getNextPage func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error)) DomainTopicsListResultPage { - return DomainTopicsListResultPage{ - fn: getNextPage, - dtlr: cur, - } -} - -// DomainUpdateParameters properties of the Domain update -type DomainUpdateParameters struct { - // Tags - Tags of the domains resource - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DomainUpdateParameters. -func (dup DomainUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dup.Tags != nil { - objectMap["tags"] = dup.Tags - } - return json.Marshal(objectMap) -} - -// EventHubEventSubscriptionDestination information about the event hub destination for an event -// subscription -type EventHubEventSubscriptionDestination struct { - // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination - *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - ehesd.EndpointType = EndpointTypeEventHub - objectMap := make(map[string]interface{}) - if ehesd.EventHubEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties - } - if ehesd.EndpointType != "" { - objectMap["endpointType"] = ehesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. -func (ehesd *EventHubEventSubscriptionDestination) 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 eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) - if err != nil { - return err - } - ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - ehesd.EndpointType = endpointType - } - } - } - - return nil -} - -// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. -type EventHubEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// EventSubscription event Subscription -type EventSubscription struct { - autorest.Response `json:"-"` - // EventSubscriptionProperties - Properties of the event subscription - *EventSubscriptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscription. -func (es EventSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EventSubscriptionProperties != nil { - objectMap["properties"] = es.EventSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. -func (es *EventSubscription) 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 eventSubscriptionProperties EventSubscriptionProperties - err = json.Unmarshal(*v, &eventSubscriptionProperties) - if err != nil { - return err - } - es.EventSubscriptionProperties = &eventSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// BasicEventSubscriptionDestination information about the destination for an event subscription -type BasicEventSubscriptionDestination interface { - AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) - AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) - AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) - AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) - AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) - AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) - AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) - AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) -} - -// EventSubscriptionDestination information about the destination for an event subscription -type EventSubscriptionDestination struct { - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeWebHook): - var whesd WebHookEventSubscriptionDestination - err := json.Unmarshal(body, &whesd) - return whesd, err - case string(EndpointTypeEventHub): - var ehesd EventHubEventSubscriptionDestination - err := json.Unmarshal(body, &ehesd) - return ehesd, err - case string(EndpointTypeStorageQueue): - var sqesd StorageQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sqesd) - return sqesd, err - case string(EndpointTypeHybridConnection): - var hcesd HybridConnectionEventSubscriptionDestination - err := json.Unmarshal(body, &hcesd) - return hcesd, err - case string(EndpointTypeServiceBusQueue): - var sbqesd ServiceBusQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sbqesd) - return sbqesd, err - case string(EndpointTypeServiceBusTopic): - var sbtesd ServiceBusTopicEventSubscriptionDestination - err := json.Unmarshal(body, &sbtesd) - return sbtesd, err - case string(EndpointTypeAzureFunction): - var afesd AzureFunctionEventSubscriptionDestination - err := json.Unmarshal(body, &afesd) - return afesd, err - default: - var esd EventSubscriptionDestination - err := json.Unmarshal(body, &esd) - return esd, err - } -} -func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) - if err != nil { - return nil, err - } - esdArray[index] = esd - } - return esdArray, nil -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { - esd.EndpointType = EndpointTypeEventSubscriptionDestination - objectMap := make(map[string]interface{}) - if esd.EndpointType != "" { - objectMap["endpointType"] = esd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return &esd, true -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &esd, true -} - -// EventSubscriptionFilter filter for the Event Subscription -type EventSubscriptionFilter struct { - // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. - // The format of this depends on the publisher of the events. - // Wildcard characters are not supported in this path. - SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` - // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. - // Wildcard characters are not supported in this path. - SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` - // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null. - IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` - // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter - // should be compared in a case sensitive manner. - IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` - // AdvancedFilters - An array of advanced filters that are used for filtering event subscriptions. - AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionFilter struct. -func (esf *EventSubscriptionFilter) 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 "subjectBeginsWith": - if v != nil { - var subjectBeginsWith string - err = json.Unmarshal(*v, &subjectBeginsWith) - if err != nil { - return err - } - esf.SubjectBeginsWith = &subjectBeginsWith - } - case "subjectEndsWith": - if v != nil { - var subjectEndsWith string - err = json.Unmarshal(*v, &subjectEndsWith) - if err != nil { - return err - } - esf.SubjectEndsWith = &subjectEndsWith - } - case "includedEventTypes": - if v != nil { - var includedEventTypes []string - err = json.Unmarshal(*v, &includedEventTypes) - if err != nil { - return err - } - esf.IncludedEventTypes = &includedEventTypes - } - case "isSubjectCaseSensitive": - if v != nil { - var isSubjectCaseSensitive bool - err = json.Unmarshal(*v, &isSubjectCaseSensitive) - if err != nil { - return err - } - esf.IsSubjectCaseSensitive = &isSubjectCaseSensitive - } - case "advancedFilters": - if v != nil { - advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) - if err != nil { - return err - } - esf.AdvancedFilters = &advancedFilters - } - } - } - - return nil -} - -// EventSubscriptionFullURL full endpoint url of an event subscription -type EventSubscriptionFullURL struct { - autorest.Response `json:"-"` - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` -} - -// EventSubscriptionProperties properties of the Event Subscription -type EventSubscriptionProperties struct { - // Topic - READ-ONLY; Name of the topic of the event subscription. - Topic *string `json:"topic,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event subscription. Possible values include: 'EventSubscriptionProvisioningStateCreating', 'EventSubscriptionProvisioningStateUpdating', 'EventSubscriptionProvisioningStateDeleting', 'EventSubscriptionProvisioningStateSucceeded', 'EventSubscriptionProvisioningStateCanceled', 'EventSubscriptionProvisioningStateFailed', 'EventSubscriptionProvisioningStateAwaitingManualAction' - ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Expiration time of the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CustomInputSchema', 'CloudEventSchemaV10' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The DeadLetter destination of the event subscription. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionProperties. -func (esp EventSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["destination"] = esp.Destination - if esp.Filter != nil { - objectMap["filter"] = esp.Filter - } - if esp.Labels != nil { - objectMap["labels"] = esp.Labels - } - if esp.ExpirationTimeUtc != nil { - objectMap["expirationTimeUtc"] = esp.ExpirationTimeUtc - } - if esp.EventDeliverySchema != "" { - objectMap["eventDeliverySchema"] = esp.EventDeliverySchema - } - if esp.RetryPolicy != nil { - objectMap["retryPolicy"] = esp.RetryPolicy - } - objectMap["deadLetterDestination"] = esp.DeadLetterDestination - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. -func (esp *EventSubscriptionProperties) 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 "topic": - if v != nil { - var topic string - err = json.Unmarshal(*v, &topic) - if err != nil { - return err - } - esp.Topic = &topic - } - case "provisioningState": - if v != nil { - var provisioningState EventSubscriptionProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - esp.ProvisioningState = provisioningState - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esp.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esp.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esp.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esp.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esp.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esp.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esp.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsCreateOrUpdateFuture) 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 EventSubscriptionsCreateOrUpdateFuture.Result. -func (future *EventSubscriptionsCreateOrUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsDeleteFuture) 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 EventSubscriptionsDeleteFuture.Result. -func (future *EventSubscriptionsDeleteFuture) result(client EventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventSubscriptionsListResult result of the List EventSubscriptions operation -type EventSubscriptionsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of EventSubscriptions - Value *[]EventSubscription `json:"value,omitempty"` - // NextLink - A link for the next page of event subscriptions - NextLink *string `json:"nextLink,omitempty"` -} - -// EventSubscriptionsListResultIterator provides access to a complete listing of EventSubscription values. -type EventSubscriptionsListResultIterator struct { - i int - page EventSubscriptionsListResultPage -} - -// 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 *EventSubscriptionsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultIterator.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 *EventSubscriptionsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventSubscriptionsListResultIterator) 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 EventSubscriptionsListResultIterator) Response() EventSubscriptionsListResult { - 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 EventSubscriptionsListResultIterator) Value() EventSubscription { - if !iter.page.NotDone() { - return EventSubscription{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventSubscriptionsListResultIterator type. -func NewEventSubscriptionsListResultIterator(page EventSubscriptionsListResultPage) EventSubscriptionsListResultIterator { - return EventSubscriptionsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eslr EventSubscriptionsListResult) IsEmpty() bool { - return eslr.Value == nil || len(*eslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eslr EventSubscriptionsListResult) hasNextLink() bool { - return eslr.NextLink != nil && len(*eslr.NextLink) != 0 -} - -// eventSubscriptionsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eslr EventSubscriptionsListResult) eventSubscriptionsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eslr.NextLink))) -} - -// EventSubscriptionsListResultPage contains a page of EventSubscription values. -type EventSubscriptionsListResultPage struct { - fn func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error) - eslr EventSubscriptionsListResult -} - -// 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 *EventSubscriptionsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultPage.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.eslr) - if err != nil { - return err - } - page.eslr = 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 *EventSubscriptionsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventSubscriptionsListResultPage) NotDone() bool { - return !page.eslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventSubscriptionsListResultPage) Response() EventSubscriptionsListResult { - return page.eslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventSubscriptionsListResultPage) Values() []EventSubscription { - if page.eslr.IsEmpty() { - return nil - } - return *page.eslr.Value -} - -// Creates a new instance of the EventSubscriptionsListResultPage type. -func NewEventSubscriptionsListResultPage(cur EventSubscriptionsListResult, getNextPage func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error)) EventSubscriptionsListResultPage { - return EventSubscriptionsListResultPage{ - fn: getNextPage, - eslr: cur, - } -} - -// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsUpdateFuture) 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 EventSubscriptionsUpdateFuture.Result. -func (future *EventSubscriptionsUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionUpdateParameters properties of the Event Subscription update -type EventSubscriptionUpdateParameters struct { - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Information about the expiration time for the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CustomInputSchema', 'CloudEventSchemaV10' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The DeadLetter destination of the event subscription. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. -func (esup *EventSubscriptionUpdateParameters) 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 "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esup.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esup.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esup.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esup.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esup.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esup.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esup.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// EventType event Type for a subject under a topic -type EventType struct { - // EventTypeProperties - Properties of the event type. - *EventTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventType. -func (et EventType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.EventTypeProperties != nil { - objectMap["properties"] = et.EventTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventType struct. -func (et *EventType) 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 eventTypeProperties EventTypeProperties - err = json.Unmarshal(*v, &eventTypeProperties) - if err != nil { - return err - } - et.EventTypeProperties = &eventTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// EventTypeProperties properties of the event type -type EventTypeProperties struct { - // DisplayName - Display name of the event type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the event type. - Description *string `json:"description,omitempty"` - // SchemaURL - Url of the schema for this event type. - SchemaURL *string `json:"schemaUrl,omitempty"` - // IsInDefaultSet - IsInDefaultSet flag of the event type. - IsInDefaultSet *bool `json:"isInDefaultSet,omitempty"` -} - -// EventTypesListResult result of the List Event Types operation -type EventTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of event types - Value *[]EventType `json:"value,omitempty"` -} - -// HybridConnectionEventSubscriptionDestination information about the HybridConnection destination for an -// event subscription. -type HybridConnectionEventSubscriptionDestination struct { - // HybridConnectionEventSubscriptionDestinationProperties - Hybrid connection Properties of the event subscription destination - *HybridConnectionEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - hcesd.EndpointType = EndpointTypeHybridConnection - objectMap := make(map[string]interface{}) - if hcesd.HybridConnectionEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = hcesd.HybridConnectionEventSubscriptionDestinationProperties - } - if hcesd.EndpointType != "" { - objectMap["endpointType"] = hcesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestination struct. -func (hcesd *HybridConnectionEventSubscriptionDestination) 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 hybridConnectionEventSubscriptionDestinationProperties HybridConnectionEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &hybridConnectionEventSubscriptionDestinationProperties) - if err != nil { - return err - } - hcesd.HybridConnectionEventSubscriptionDestinationProperties = &hybridConnectionEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - hcesd.EndpointType = endpointType - } - } - } - - return nil -} - -// HybridConnectionEventSubscriptionDestinationProperties the properties for a hybrid connection -// destination. -type HybridConnectionEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of an hybrid connection that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// BasicInputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported -// type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type BasicInputSchemaMapping interface { - AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) - AsInputSchemaMapping() (*InputSchemaMapping, bool) -} - -// InputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only -// supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type InputSchemaMapping struct { - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -func unmarshalBasicInputSchemaMapping(body []byte) (BasicInputSchemaMapping, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["inputSchemaMappingType"] { - case string(InputSchemaMappingTypeJSON): - var jism JSONInputSchemaMapping - err := json.Unmarshal(body, &jism) - return jism, err - default: - var ism InputSchemaMapping - err := json.Unmarshal(body, &ism) - return ism, err - } -} -func unmarshalBasicInputSchemaMappingArray(body []byte) ([]BasicInputSchemaMapping, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ismArray := make([]BasicInputSchemaMapping, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ism, err := unmarshalBasicInputSchemaMapping(*rawMessage) - if err != nil { - return nil, err - } - ismArray[index] = ism - } - return ismArray, nil -} - -// MarshalJSON is the custom marshaler for InputSchemaMapping. -func (ism InputSchemaMapping) MarshalJSON() ([]byte, error) { - ism.InputSchemaMappingType = InputSchemaMappingTypeInputSchemaMapping - objectMap := make(map[string]interface{}) - if ism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = ism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return nil, false -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return &ism, true -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &ism, true -} - -// JSONField this is used to express the source of an input schema mapping for a single target field in the -// Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and 'eventtime' -// properties. This represents a field in the input event schema. -type JSONField struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` -} - -// JSONFieldWithDefault this is used to express the source of an input schema mapping for a single target -// field -// in the Event Grid Event schema. This is currently used in the mappings for the 'subject', -// 'eventtype' and 'dataversion' properties. This represents a field in the input event schema -// along with a default value to be used, and at least one of these two properties should be provided. -type JSONFieldWithDefault struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` - // DefaultValue - The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// JSONInputSchemaMapping this enables publishing to Event Grid using a custom input schema. This can be -// used to map properties from a custom input JSON schema to the Event Grid event schema. -type JSONInputSchemaMapping struct { - // JSONInputSchemaMappingProperties - JSON Properties of the input schema mapping - *JSONInputSchemaMappingProperties `json:"properties,omitempty"` - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -// MarshalJSON is the custom marshaler for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { - jism.InputSchemaMappingType = InputSchemaMappingTypeJSON - objectMap := make(map[string]interface{}) - if jism.JSONInputSchemaMappingProperties != nil { - objectMap["properties"] = jism.JSONInputSchemaMappingProperties - } - if jism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = jism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return &jism, true -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return nil, false -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &jism, true -} - -// UnmarshalJSON is the custom unmarshaler for JSONInputSchemaMapping struct. -func (jism *JSONInputSchemaMapping) 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 JSONInputSchemaMappingProperties JSONInputSchemaMappingProperties - err = json.Unmarshal(*v, &JSONInputSchemaMappingProperties) - if err != nil { - return err - } - jism.JSONInputSchemaMappingProperties = &JSONInputSchemaMappingProperties - } - case "inputSchemaMappingType": - if v != nil { - var inputSchemaMappingType InputSchemaMappingType - err = json.Unmarshal(*v, &inputSchemaMappingType) - if err != nil { - return err - } - jism.InputSchemaMappingType = inputSchemaMappingType - } - } - } - - return nil -} - -// JSONInputSchemaMappingProperties this can be used to map properties of a source schema (or default -// values, for certain supported properties) to properties of the EventGridEvent schema. -type JSONInputSchemaMappingProperties struct { - // ID - The mapping information for the Id property of the Event Grid Event. - ID *JSONField `json:"id,omitempty"` - // Topic - The mapping information for the Topic property of the Event Grid Event. - Topic *JSONField `json:"topic,omitempty"` - // EventTime - The mapping information for the EventTime property of the Event Grid Event. - EventTime *JSONField `json:"eventTime,omitempty"` - // EventType - The mapping information for the EventType property of the Event Grid Event. - EventType *JSONFieldWithDefault `json:"eventType,omitempty"` - // Subject - The mapping information for the Subject property of the Event Grid Event. - Subject *JSONFieldWithDefault `json:"subject,omitempty"` - // DataVersion - The mapping information for the DataVersion property of the Event Grid Event. - DataVersion *JSONFieldWithDefault `json:"dataVersion,omitempty"` -} - -// NumberGreaterThanAdvancedFilter numberGreaterThan Advanced Filter. -type NumberGreaterThanAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtaf.OperatorType = OperatorTypeNumberGreaterThan - objectMap := make(map[string]interface{}) - if ngtaf.Value != nil { - objectMap["value"] = ngtaf.Value - } - if ngtaf.Key != nil { - objectMap["key"] = ngtaf.Key - } - if ngtaf.OperatorType != "" { - objectMap["operatorType"] = ngtaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return &ngtaf, true -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtaf, true -} - -// NumberGreaterThanOrEqualsAdvancedFilter numberGreaterThanOrEquals Advanced Filter. -type NumberGreaterThanOrEqualsAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtoeaf.OperatorType = OperatorTypeNumberGreaterThanOrEquals - objectMap := make(map[string]interface{}) - if ngtoeaf.Value != nil { - objectMap["value"] = ngtoeaf.Value - } - if ngtoeaf.Key != nil { - objectMap["key"] = ngtoeaf.Key - } - if ngtoeaf.OperatorType != "" { - objectMap["operatorType"] = ngtoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// NumberInAdvancedFilter numberIn Advanced Filter. -type NumberInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) MarshalJSON() ([]byte, error) { - niaf.OperatorType = OperatorTypeNumberIn - objectMap := make(map[string]interface{}) - if niaf.Values != nil { - objectMap["values"] = niaf.Values - } - if niaf.Key != nil { - objectMap["key"] = niaf.Key - } - if niaf.OperatorType != "" { - objectMap["operatorType"] = niaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return &niaf, true -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &niaf, true -} - -// NumberLessThanAdvancedFilter numberLessThan Advanced Filter. -type NumberLessThanAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) MarshalJSON() ([]byte, error) { - nltaf.OperatorType = OperatorTypeNumberLessThan - objectMap := make(map[string]interface{}) - if nltaf.Value != nil { - objectMap["value"] = nltaf.Value - } - if nltaf.Key != nil { - objectMap["key"] = nltaf.Key - } - if nltaf.OperatorType != "" { - objectMap["operatorType"] = nltaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return &nltaf, true -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltaf, true -} - -// NumberLessThanOrEqualsAdvancedFilter numberLessThanOrEquals Advanced Filter. -type NumberLessThanOrEqualsAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - nltoeaf.OperatorType = OperatorTypeNumberLessThanOrEquals - objectMap := make(map[string]interface{}) - if nltoeaf.Value != nil { - objectMap["value"] = nltoeaf.Value - } - if nltoeaf.Key != nil { - objectMap["key"] = nltoeaf.Key - } - if nltoeaf.OperatorType != "" { - objectMap["operatorType"] = nltoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return &nltoeaf, true -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltoeaf, true -} - -// NumberNotInAdvancedFilter numberNotIn Advanced Filter. -type NumberNotInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - nniaf.OperatorType = OperatorTypeNumberNotIn - objectMap := make(map[string]interface{}) - if nniaf.Values != nil { - objectMap["values"] = nniaf.Values - } - if nniaf.Key != nil { - objectMap["key"] = nniaf.Key - } - if nniaf.OperatorType != "" { - objectMap["operatorType"] = nniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return &nniaf, true -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nniaf, true -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,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"` -} - -// 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"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// Resource definition of a Resource -type Resource struct { - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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) -} - -// RetryPolicy information about the retry policy for an event subscription -type RetryPolicy struct { - // MaxDeliveryAttempts - Maximum number of delivery retry attempts for events. - MaxDeliveryAttempts *int32 `json:"maxDeliveryAttempts,omitempty"` - // EventTimeToLiveInMinutes - Time To Live (in minutes) for events. - EventTimeToLiveInMinutes *int32 `json:"eventTimeToLiveInMinutes,omitempty"` -} - -// ServiceBusQueueEventSubscriptionDestination information about the service bus destination for an event -// subscription -type ServiceBusQueueEventSubscriptionDestination struct { - // ServiceBusQueueEventSubscriptionDestinationProperties - Service Bus Properties of the event subscription destination - *ServiceBusQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sbqesd.EndpointType = EndpointTypeServiceBusQueue - objectMap := make(map[string]interface{}) - if sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties - } - if sbqesd.EndpointType != "" { - objectMap["endpointType"] = sbqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return &sbqesd, true -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sbqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceBusQueueEventSubscriptionDestination struct. -func (sbqesd *ServiceBusQueueEventSubscriptionDestination) 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 serviceBusQueueEventSubscriptionDestinationProperties ServiceBusQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &serviceBusQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties = &serviceBusQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// ServiceBusQueueEventSubscriptionDestinationProperties the properties that represent the Service Bus -// destination of an event subscription. -type ServiceBusQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Service Bus destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// ServiceBusTopicEventSubscriptionDestination information about the service bus topic destination for an -// event subscription. -type ServiceBusTopicEventSubscriptionDestination struct { - // ServiceBusTopicEventSubscriptionDestinationProperties - Service Bus Topic Properties of the event subscription destination. - *ServiceBusTopicEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sbtesd.EndpointType = EndpointTypeServiceBusTopic - objectMap := make(map[string]interface{}) - if sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties - } - if sbtesd.EndpointType != "" { - objectMap["endpointType"] = sbtesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return &sbtesd, true -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sbtesd, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceBusTopicEventSubscriptionDestination struct. -func (sbtesd *ServiceBusTopicEventSubscriptionDestination) 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 serviceBusTopicEventSubscriptionDestinationProperties ServiceBusTopicEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &serviceBusTopicEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties = &serviceBusTopicEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbtesd.EndpointType = endpointType - } - } - } - - return nil -} - -// ServiceBusTopicEventSubscriptionDestinationProperties the properties that represent the Service Bus -// Topic destination of an event subscription. -type ServiceBusTopicEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Service Bus Topic destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// StorageBlobDeadLetterDestination information about the storage blob based dead letter destination. -type StorageBlobDeadLetterDestination struct { - // StorageBlobDeadLetterDestinationProperties - The properties of the Storage Blob based deadletter destination - *StorageBlobDeadLetterDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { - sbdld.EndpointType = EndpointTypeStorageBlob - objectMap := make(map[string]interface{}) - if sbdld.StorageBlobDeadLetterDestinationProperties != nil { - objectMap["properties"] = sbdld.StorageBlobDeadLetterDestinationProperties - } - if sbdld.EndpointType != "" { - objectMap["endpointType"] = sbdld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return &sbdld, true -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return nil, false -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &sbdld, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageBlobDeadLetterDestination struct. -func (sbdld *StorageBlobDeadLetterDestination) 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 storageBlobDeadLetterDestinationProperties StorageBlobDeadLetterDestinationProperties - err = json.Unmarshal(*v, &storageBlobDeadLetterDestinationProperties) - if err != nil { - return err - } - sbdld.StorageBlobDeadLetterDestinationProperties = &storageBlobDeadLetterDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointTypeBasicDeadLetterDestination - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbdld.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageBlobDeadLetterDestinationProperties properties of the storage blob based dead letter destination. -type StorageBlobDeadLetterDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that is the destination of the deadletter events - ResourceID *string `json:"resourceId,omitempty"` - // BlobContainerName - The name of the Storage blob container that is the destination of the deadletter events - BlobContainerName *string `json:"blobContainerName,omitempty"` -} - -// StorageQueueEventSubscriptionDestination information about the storage queue destination for an event -// subscription. -type StorageQueueEventSubscriptionDestination struct { - // StorageQueueEventSubscriptionDestinationProperties - Storage Queue Properties of the event subscription destination - *StorageQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sqesd.EndpointType = EndpointTypeStorageQueue - objectMap := make(map[string]interface{}) - if sqesd.StorageQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sqesd.StorageQueueEventSubscriptionDestinationProperties - } - if sqesd.EndpointType != "" { - objectMap["endpointType"] = sqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageQueueEventSubscriptionDestination struct. -func (sqesd *StorageQueueEventSubscriptionDestination) 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 storageQueueEventSubscriptionDestinationProperties StorageQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &storageQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sqesd.StorageQueueEventSubscriptionDestinationProperties = &storageQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageQueueEventSubscriptionDestinationProperties the properties for a storage queue destination. -type StorageQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // QueueName - The name of the Storage queue under a storage account that is the destination of an event subscription. - QueueName *string `json:"queueName,omitempty"` -} - -// StringBeginsWithAdvancedFilter stringBeginsWith Advanced Filter. -type StringBeginsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sbwaf.OperatorType = OperatorTypeStringBeginsWith - objectMap := make(map[string]interface{}) - if sbwaf.Values != nil { - objectMap["values"] = sbwaf.Values - } - if sbwaf.Key != nil { - objectMap["key"] = sbwaf.Key - } - if sbwaf.OperatorType != "" { - objectMap["operatorType"] = sbwaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return &sbwaf, true -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sbwaf, true -} - -// StringContainsAdvancedFilter stringContains Advanced Filter. -type StringContainsAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) MarshalJSON() ([]byte, error) { - scaf.OperatorType = OperatorTypeStringContains - objectMap := make(map[string]interface{}) - if scaf.Values != nil { - objectMap["values"] = scaf.Values - } - if scaf.Key != nil { - objectMap["key"] = scaf.Key - } - if scaf.OperatorType != "" { - objectMap["operatorType"] = scaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return &scaf, true -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &scaf, true -} - -// StringEndsWithAdvancedFilter stringEndsWith Advanced Filter. -type StringEndsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sewaf.OperatorType = OperatorTypeStringEndsWith - objectMap := make(map[string]interface{}) - if sewaf.Values != nil { - objectMap["values"] = sewaf.Values - } - if sewaf.Key != nil { - objectMap["key"] = sewaf.Key - } - if sewaf.OperatorType != "" { - objectMap["operatorType"] = sewaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return &sewaf, true -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sewaf, true -} - -// StringInAdvancedFilter stringIn Advanced Filter. -type StringInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) MarshalJSON() ([]byte, error) { - siaf.OperatorType = OperatorTypeStringIn - objectMap := make(map[string]interface{}) - if siaf.Values != nil { - objectMap["values"] = siaf.Values - } - if siaf.Key != nil { - objectMap["key"] = siaf.Key - } - if siaf.OperatorType != "" { - objectMap["operatorType"] = siaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return &siaf, true -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &siaf, true -} - -// StringNotInAdvancedFilter stringNotIn Advanced Filter. -type StringNotInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - sniaf.OperatorType = OperatorTypeStringNotIn - objectMap := make(map[string]interface{}) - if sniaf.Values != nil { - objectMap["values"] = sniaf.Values - } - if sniaf.Key != nil { - objectMap["key"] = sniaf.Key - } - if sniaf.OperatorType != "" { - objectMap["operatorType"] = sniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return &sniaf, true -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sniaf, true -} - -// Topic eventGrid Topic -type Topic struct { - autorest.Response `json:"-"` - // TopicProperties - Properties of the topic - *TopicProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TopicProperties != nil { - objectMap["properties"] = t.TopicProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Topic struct. -func (t *Topic) 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 topicProperties TopicProperties - err = json.Unmarshal(*v, &topicProperties) - if err != nil { - return err - } - t.TopicProperties = &topicProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TopicProperties properties of the Topic -type TopicProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' - ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the topic. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventSchemaV10' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` - // MetricResourceID - READ-ONLY; Metric resource id for the topic. - MetricResourceID *string `json:"metricResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicProperties. -func (tp TopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.InputSchema != "" { - objectMap["inputSchema"] = tp.InputSchema - } - objectMap["inputSchemaMapping"] = tp.InputSchemaMapping - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicProperties struct. -func (tp *TopicProperties) 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 "provisioningState": - if v != nil { - var provisioningState TopicProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - tp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - tp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - tp.InputSchemaMapping = inputSchemaMapping - } - case "metricResourceId": - if v != nil { - var metricResourceID string - err = json.Unmarshal(*v, &metricResourceID) - if err != nil { - return err - } - tp.MetricResourceID = &metricResourceID - } - } - } - - return nil -} - -// TopicRegenerateKeyRequest topic regenerate share access key request -type TopicRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsCreateOrUpdateFuture) 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 TopicsCreateOrUpdateFuture.Result. -func (future *TopicsCreateOrUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateOrUpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsDeleteFuture) 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 TopicsDeleteFuture.Result. -func (future *TopicsDeleteFuture) result(client TopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TopicSharedAccessKeys shared access keys of the Topic -type TopicSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the topic. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the topic. - Key2 *string `json:"key2,omitempty"` -} - -// TopicsListResult result of the List Topics operation -type TopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Topics - Value *[]Topic `json:"value,omitempty"` - // NextLink - A link for the next page of topics - NextLink *string `json:"nextLink,omitempty"` -} - -// TopicsListResultIterator provides access to a complete listing of Topic values. -type TopicsListResultIterator struct { - i int - page TopicsListResultPage -} - -// 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 *TopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultIterator.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 *TopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TopicsListResultIterator) 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 TopicsListResultIterator) Response() TopicsListResult { - 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 TopicsListResultIterator) Value() Topic { - if !iter.page.NotDone() { - return Topic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TopicsListResultIterator type. -func NewTopicsListResultIterator(page TopicsListResultPage) TopicsListResultIterator { - return TopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TopicsListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TopicsListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// topicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TopicsListResult) topicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TopicsListResultPage contains a page of Topic values. -type TopicsListResultPage struct { - fn func(context.Context, TopicsListResult) (TopicsListResult, error) - tlr TopicsListResult -} - -// 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 *TopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TopicsListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TopicsListResultPage) Response() TopicsListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TopicsListResultPage) Values() []Topic { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TopicsListResultPage type. -func NewTopicsListResultPage(cur TopicsListResult, getNextPage func(context.Context, TopicsListResult) (TopicsListResult, error)) TopicsListResultPage { - return TopicsListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsUpdateFuture) 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 TopicsUpdateFuture.Result. -func (future *TopicsUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicTypeInfo properties of a topic type info. -type TopicTypeInfo struct { - autorest.Response `json:"-"` - // TopicTypeProperties - Properties of the topic type info - *TopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicTypeInfo. -func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tti.TopicTypeProperties != nil { - objectMap["properties"] = tti.TopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. -func (tti *TopicTypeInfo) 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 topicTypeProperties TopicTypeProperties - err = json.Unmarshal(*v, &topicTypeProperties) - if err != nil { - return err - } - tti.TopicTypeProperties = &topicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tti.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tti.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tti.Type = &typeVar - } - } - } - - return nil -} - -// TopicTypeProperties properties of a topic type. -type TopicTypeProperties struct { - // Provider - Namespace of the provider of the topic type. - Provider *string `json:"provider,omitempty"` - // DisplayName - Display Name for the topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the topic type. - Description *string `json:"description,omitempty"` - // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' - ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` - // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' - ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` - // SupportedLocations - List of locations supported by this topic type. - SupportedLocations *[]string `json:"supportedLocations,omitempty"` -} - -// TopicTypesListResult result of the List Topic Types operation -type TopicTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of topic types - Value *[]TopicTypeInfo `json:"value,omitempty"` -} - -// TopicUpdateParameters properties of the Topic update -type TopicUpdateParameters struct { - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TopicUpdateParameters. -func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// TrackedResource definition of a Tracked Resource -type TrackedResource struct { - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription -type WebHookEventSubscriptionDestination struct { - // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination - *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - whesd.EndpointType = EndpointTypeWebHook - objectMap := make(map[string]interface{}) - if whesd.WebHookEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties - } - if whesd.EndpointType != "" { - objectMap["endpointType"] = whesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return &whesd, true -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &whesd, true -} - -// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. -func (whesd *WebHookEventSubscriptionDestination) 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 webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) - if err != nil { - return err - } - whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - whesd.EndpointType = endpointType - } - } - } - - return nil -} - -// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for -// an event subscription. -type WebHookEventSubscriptionDestinationProperties struct { - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` - // EndpointBaseURL - READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. - EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` - // MaxEventsPerBatch - Maximum number of events per batch. - MaxEventsPerBatch *int32 `json:"maxEventsPerBatch,omitempty"` - // PreferredBatchSizeInKilobytes - Preferred batch size in Kilobytes. - PreferredBatchSizeInKilobytes *int32 `json:"preferredBatchSizeInKilobytes,omitempty"` - // AzureActiveDirectoryTenantID - The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. - AzureActiveDirectoryTenantID *string `json:"azureActiveDirectoryTenantId,omitempty"` - // AzureActiveDirectoryApplicationIDOrURI - The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery requests. - AzureActiveDirectoryApplicationIDOrURI *string `json:"azureActiveDirectoryApplicationIdOrUri,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestinationProperties. -func (whesdp WebHookEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if whesdp.EndpointURL != nil { - objectMap["endpointUrl"] = whesdp.EndpointURL - } - if whesdp.MaxEventsPerBatch != nil { - objectMap["maxEventsPerBatch"] = whesdp.MaxEventsPerBatch - } - if whesdp.PreferredBatchSizeInKilobytes != nil { - objectMap["preferredBatchSizeInKilobytes"] = whesdp.PreferredBatchSizeInKilobytes - } - if whesdp.AzureActiveDirectoryTenantID != nil { - objectMap["azureActiveDirectoryTenantId"] = whesdp.AzureActiveDirectoryTenantID - } - if whesdp.AzureActiveDirectoryApplicationIDOrURI != nil { - objectMap["azureActiveDirectoryApplicationIdOrUri"] = whesdp.AzureActiveDirectoryApplicationIDOrURI - } - return json.Marshal(objectMap) -} diff --git a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/operations.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/operations.go deleted file mode 100644 index 2a0aa9e0565f..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure EventGrid 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 list the available operations supported by the Microsoft.EventGrid resource provider -func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/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 -} diff --git a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/topics.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/topics.go deleted file mode 100644 index ef17b1b77549..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/topics.go +++ /dev/null @@ -1,849 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicsClient is the azure EventGrid Management Client -type TopicsClient struct { - BaseClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient 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 NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicInfo - topic information -func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicInfo), - 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 TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, 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 TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, 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 existing topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-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.EventGrid/topics/{topicName}", 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 TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, 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 TopicsClient) 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 get properties of a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-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.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the topics under a resource group -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client TopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { - req, err := lastResults.topicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) - return -} - -// ListBySubscription list all the topics under an Azure subscription -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client TopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result TopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { - req, err := lastResults.topicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result TopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) - return -} - -// ListEventTypes list event types for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic -// resourceTypeName - name of the topic type -// resourceName - name of the topic -func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-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/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSharedAccessKeys list the two keys used to publish to a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-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.EventGrid/topics/{topicName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a topic -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// regenerateKeyRequest - request body to regenerate key -func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.TopicsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, topicName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-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.EventGrid/topics/{topicName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 TopicsClient) 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 TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic -// topicUpdateParameters - topic update information -func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicUpdateParameters), - 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 TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, 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 TopicsClient) UpdateResponder(resp *http.Response) (result Topic, 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/eventgrid/mgmt/2020-01-01-preview/eventgrid/topictypes.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/topictypes.go deleted file mode 100644 index 4cda06b78814..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/topictypes.go +++ /dev/null @@ -1,244 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicTypesClient is the azure EventGrid Management Client -type TopicTypesClient struct { - BaseClient -} - -// NewTopicTypesClient creates an instance of the TopicTypesClient client. -func NewTopicTypesClient(subscriptionID string) TopicTypesClient { - return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient 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 NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { - return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get information about a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.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, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all registered topic types -func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"), - 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 TopicTypesClient) 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 TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic type -// Parameters: -// topicTypeName - name of the topic type -func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, 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/eventgrid/mgmt/2020-01-01-preview/eventgrid/version.go b/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/version.go deleted file mode 100644 index 67c272fd6658..000000000000 --- a/services/preview/eventgrid/mgmt/2020-01-01-preview/eventgrid/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package eventgrid - -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() + " eventgrid/2020-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/eventgrid/mgmt/2020-04-01-preview/eventgrid/CHANGELOG.md b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/_meta.json b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/_meta.json deleted file mode 100644 index 336a5001b8f4..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "tag": "package-2020-04-preview", - "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-2020-04-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/client.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/client.go deleted file mode 100644 index 0ec013ec31a4..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2020-04-01-preview. -// -// Azure EventGrid Management Client -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Eventgrid - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Eventgrid. -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/eventgrid/mgmt/2020-04-01-preview/eventgrid/domains.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/domains.go deleted file mode 100644 index 4ed280c82eae..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/domains.go +++ /dev/null @@ -1,769 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainsClient is the azure EventGrid Management Client -type DomainsClient struct { - BaseClient -} - -// NewDomainsClient creates an instance of the DomainsClient client. -func NewDomainsClient(subscriptionID string) DomainsClient { - return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainsClientWithBaseURI creates an instance of the DomainsClient 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 NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { - return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates a new domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainInfo - domain information. -func (client DomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (result DomainsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainInfo), - 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 DomainsClient) CreateOrUpdateSender(req *http.Request) (future DomainsCreateOrUpdateFuture, 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 DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, 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 existing domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -func (client DomainsClient) Delete(ctx context.Context, resourceGroupName string, domainName string) (result DomainsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/domains/{domainName}", 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 DomainsClient) DeleteSender(req *http.Request) (future DomainsDeleteFuture, 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 DomainsClient) 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 get properties of a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -func (client DomainsClient) Get(ctx context.Context, resourceGroupName string, domainName string) (result Domain, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/domains/{domainName}", 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 DomainsClient) 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 DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the domains under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client DomainsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DomainsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { - req, err := lastResults.domainsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) - return -} - -// ListBySubscription list all the domains under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client DomainsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result DomainsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListBySubscription") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DomainsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListBySubscriptionResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { - req, err := lastResults.domainsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result DomainsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) - return -} - -// ListSharedAccessKeys list the two keys used to publish to a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -func (client DomainsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client DomainsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/domains/{domainName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListSharedAccessKeysResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// regenerateKeyRequest - request body to regenerate key. -func (client DomainsClient) RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.DomainsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, domainName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DomainsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/domains/{domainName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 DomainsClient) 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 DomainsClient) RegenerateKeyResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainUpdateParameters - domain update information. -func (client DomainsClient) Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (result DomainsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainName, domainUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainUpdateParameters), - 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 DomainsClient) UpdateSender(req *http.Request) (future DomainsUpdateFuture, 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 DomainsClient) UpdateResponder(resp *http.Response) (result Domain, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/domaintopics.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/domaintopics.go deleted file mode 100644 index af6666296327..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/domaintopics.go +++ /dev/null @@ -1,402 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainTopicsClient is the azure EventGrid Management Client -type DomainTopicsClient struct { - BaseClient -} - -// NewDomainTopicsClient creates an instance of the DomainTopicsClient client. -func NewDomainTopicsClient(subscriptionID string) DomainTopicsClient { - return NewDomainTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainTopicsClientWithBaseURI creates an instance of the DomainTopicsClient 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 NewDomainTopicsClientWithBaseURI(baseURI string, subscriptionID string) DomainTopicsClient { - return DomainTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates a new domain topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainTopicName - name of the domain topic. -func (client DomainTopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainTopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}", pathParameters), - 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 DomainTopicsClient) CreateOrUpdateSender(req *http.Request) (future DomainTopicsCreateOrUpdateFuture, 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 DomainTopicsClient) CreateOrUpdateResponder(resp *http.Response) (result DomainTopic, 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 existing domain topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainTopicName - name of the domain topic. -func (client DomainTopicsClient) Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) DeleteSender(req *http.Request) (future DomainTopicsDeleteFuture, 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 DomainTopicsClient) 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 get properties of a domain topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainTopicName - name of the topic. -func (client DomainTopicsClient) Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.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, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) 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 DomainTopicsClient) GetResponder(resp *http.Response) (result DomainTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomain list all the topics in a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - domain name. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client DomainTopicsClient) ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") - defer func() { - sc := -1 - if result.dtlr.Response.Response != nil { - sc = result.dtlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDomainNextResults - req, err := client.ListByDomainPreparer(ctx, resourceGroupName, domainName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainSender(req) - if err != nil { - result.dtlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure sending request") - return - } - - result.dtlr, err = client.ListByDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure responding to request") - return - } - if result.dtlr.hasNextLink() && result.dtlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDomainPreparer prepares the ListByDomain request. -func (client DomainTopicsClient) ListByDomainPreparer(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainSender sends the ListByDomain request. The method will close the -// http.Response Body if it receives an error. -func (client DomainTopicsClient) ListByDomainSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainResponder handles the response to the ListByDomain request. The method always -// closes the http.Response Body. -func (client DomainTopicsClient) ListByDomainResponder(resp *http.Response) (result DomainTopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDomainNextResults retrieves the next set of results, if any. -func (client DomainTopicsClient) listByDomainNextResults(ctx context.Context, lastResults DomainTopicsListResult) (result DomainTopicsListResult, err error) { - req, err := lastResults.domainTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDomainSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDomainComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainTopicsClient) ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") - 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.ListByDomain(ctx, resourceGroupName, domainName, filter, top) - return -} diff --git a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/enums.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/enums.go deleted file mode 100644 index f447a1aa6967..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/enums.go +++ /dev/null @@ -1,549 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DomainProvisioningState enumerates the values for domain provisioning state. -type DomainProvisioningState string - -const ( - // Canceled ... - Canceled DomainProvisioningState = "Canceled" - // Creating ... - Creating DomainProvisioningState = "Creating" - // Deleting ... - Deleting DomainProvisioningState = "Deleting" - // Failed ... - Failed DomainProvisioningState = "Failed" - // Succeeded ... - Succeeded DomainProvisioningState = "Succeeded" - // Updating ... - Updating DomainProvisioningState = "Updating" -) - -// PossibleDomainProvisioningStateValues returns an array of possible values for the DomainProvisioningState const type. -func PossibleDomainProvisioningStateValues() []DomainProvisioningState { - return []DomainProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// DomainTopicProvisioningState enumerates the values for domain topic provisioning state. -type DomainTopicProvisioningState string - -const ( - // DomainTopicProvisioningStateCanceled ... - DomainTopicProvisioningStateCanceled DomainTopicProvisioningState = "Canceled" - // DomainTopicProvisioningStateCreating ... - DomainTopicProvisioningStateCreating DomainTopicProvisioningState = "Creating" - // DomainTopicProvisioningStateDeleting ... - DomainTopicProvisioningStateDeleting DomainTopicProvisioningState = "Deleting" - // DomainTopicProvisioningStateFailed ... - DomainTopicProvisioningStateFailed DomainTopicProvisioningState = "Failed" - // DomainTopicProvisioningStateSucceeded ... - DomainTopicProvisioningStateSucceeded DomainTopicProvisioningState = "Succeeded" - // DomainTopicProvisioningStateUpdating ... - DomainTopicProvisioningStateUpdating DomainTopicProvisioningState = "Updating" -) - -// PossibleDomainTopicProvisioningStateValues returns an array of possible values for the DomainTopicProvisioningState const type. -func PossibleDomainTopicProvisioningStateValues() []DomainTopicProvisioningState { - return []DomainTopicProvisioningState{DomainTopicProvisioningStateCanceled, DomainTopicProvisioningStateCreating, DomainTopicProvisioningStateDeleting, DomainTopicProvisioningStateFailed, DomainTopicProvisioningStateSucceeded, DomainTopicProvisioningStateUpdating} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeAzureFunction ... - EndpointTypeAzureFunction EndpointType = "AzureFunction" - // EndpointTypeEventHub ... - EndpointTypeEventHub EndpointType = "EventHub" - // EndpointTypeEventSubscriptionDestination ... - EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" - // EndpointTypeHybridConnection ... - EndpointTypeHybridConnection EndpointType = "HybridConnection" - // EndpointTypeServiceBusQueue ... - EndpointTypeServiceBusQueue EndpointType = "ServiceBusQueue" - // EndpointTypeServiceBusTopic ... - EndpointTypeServiceBusTopic EndpointType = "ServiceBusTopic" - // EndpointTypeStorageQueue ... - EndpointTypeStorageQueue EndpointType = "StorageQueue" - // EndpointTypeWebHook ... - EndpointTypeWebHook EndpointType = "WebHook" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeAzureFunction, EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeHybridConnection, EndpointTypeServiceBusQueue, EndpointTypeServiceBusTopic, EndpointTypeStorageQueue, EndpointTypeWebHook} -} - -// EndpointTypeBasicDeadLetterDestination enumerates the values for endpoint type basic dead letter -// destination. -type EndpointTypeBasicDeadLetterDestination string - -const ( - // EndpointTypeDeadLetterDestination ... - EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = "DeadLetterDestination" - // EndpointTypeStorageBlob ... - EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = "StorageBlob" -) - -// PossibleEndpointTypeBasicDeadLetterDestinationValues returns an array of possible values for the EndpointTypeBasicDeadLetterDestination const type. -func PossibleEndpointTypeBasicDeadLetterDestinationValues() []EndpointTypeBasicDeadLetterDestination { - return []EndpointTypeBasicDeadLetterDestination{EndpointTypeDeadLetterDestination, EndpointTypeStorageBlob} -} - -// EventChannelProvisioningState enumerates the values for event channel provisioning state. -type EventChannelProvisioningState string - -const ( - // EventChannelProvisioningStateCanceled ... - EventChannelProvisioningStateCanceled EventChannelProvisioningState = "Canceled" - // EventChannelProvisioningStateCreating ... - EventChannelProvisioningStateCreating EventChannelProvisioningState = "Creating" - // EventChannelProvisioningStateDeleting ... - EventChannelProvisioningStateDeleting EventChannelProvisioningState = "Deleting" - // EventChannelProvisioningStateFailed ... - EventChannelProvisioningStateFailed EventChannelProvisioningState = "Failed" - // EventChannelProvisioningStateSucceeded ... - EventChannelProvisioningStateSucceeded EventChannelProvisioningState = "Succeeded" - // EventChannelProvisioningStateUpdating ... - EventChannelProvisioningStateUpdating EventChannelProvisioningState = "Updating" -) - -// PossibleEventChannelProvisioningStateValues returns an array of possible values for the EventChannelProvisioningState const type. -func PossibleEventChannelProvisioningStateValues() []EventChannelProvisioningState { - return []EventChannelProvisioningState{EventChannelProvisioningStateCanceled, EventChannelProvisioningStateCreating, EventChannelProvisioningStateDeleting, EventChannelProvisioningStateFailed, EventChannelProvisioningStateSucceeded, EventChannelProvisioningStateUpdating} -} - -// EventDeliverySchema enumerates the values for event delivery schema. -type EventDeliverySchema string - -const ( - // CloudEventSchemaV10 ... - CloudEventSchemaV10 EventDeliverySchema = "CloudEventSchemaV1_0" - // CustomInputSchema ... - CustomInputSchema EventDeliverySchema = "CustomInputSchema" - // EventGridSchema ... - EventGridSchema EventDeliverySchema = "EventGridSchema" -) - -// PossibleEventDeliverySchemaValues returns an array of possible values for the EventDeliverySchema const type. -func PossibleEventDeliverySchemaValues() []EventDeliverySchema { - return []EventDeliverySchema{CloudEventSchemaV10, CustomInputSchema, EventGridSchema} -} - -// EventSubscriptionIdentityType enumerates the values for event subscription identity type. -type EventSubscriptionIdentityType string - -const ( - // SystemAssigned ... - SystemAssigned EventSubscriptionIdentityType = "SystemAssigned" - // UserAssigned ... - UserAssigned EventSubscriptionIdentityType = "UserAssigned" -) - -// PossibleEventSubscriptionIdentityTypeValues returns an array of possible values for the EventSubscriptionIdentityType const type. -func PossibleEventSubscriptionIdentityTypeValues() []EventSubscriptionIdentityType { - return []EventSubscriptionIdentityType{SystemAssigned, UserAssigned} -} - -// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. -type EventSubscriptionProvisioningState string - -const ( - // EventSubscriptionProvisioningStateAwaitingManualAction ... - EventSubscriptionProvisioningStateAwaitingManualAction EventSubscriptionProvisioningState = "AwaitingManualAction" - // EventSubscriptionProvisioningStateCanceled ... - EventSubscriptionProvisioningStateCanceled EventSubscriptionProvisioningState = "Canceled" - // EventSubscriptionProvisioningStateCreating ... - EventSubscriptionProvisioningStateCreating EventSubscriptionProvisioningState = "Creating" - // EventSubscriptionProvisioningStateDeleting ... - EventSubscriptionProvisioningStateDeleting EventSubscriptionProvisioningState = "Deleting" - // EventSubscriptionProvisioningStateFailed ... - EventSubscriptionProvisioningStateFailed EventSubscriptionProvisioningState = "Failed" - // EventSubscriptionProvisioningStateSucceeded ... - EventSubscriptionProvisioningStateSucceeded EventSubscriptionProvisioningState = "Succeeded" - // EventSubscriptionProvisioningStateUpdating ... - EventSubscriptionProvisioningStateUpdating EventSubscriptionProvisioningState = "Updating" -) - -// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. -func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { - return []EventSubscriptionProvisioningState{EventSubscriptionProvisioningStateAwaitingManualAction, EventSubscriptionProvisioningStateCanceled, EventSubscriptionProvisioningStateCreating, EventSubscriptionProvisioningStateDeleting, EventSubscriptionProvisioningStateFailed, EventSubscriptionProvisioningStateSucceeded, EventSubscriptionProvisioningStateUpdating} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // IdentityTypeNone ... - IdentityTypeNone IdentityType = "None" - // IdentityTypeSystemAssigned ... - IdentityTypeSystemAssigned IdentityType = "SystemAssigned" - // IdentityTypeSystemAssignedUserAssigned ... - IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned, UserAssigned" - // IdentityTypeUserAssigned ... - IdentityTypeUserAssigned IdentityType = "UserAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeSystemAssignedUserAssigned, IdentityTypeUserAssigned} -} - -// InputSchema enumerates the values for input schema. -type InputSchema string - -const ( - // InputSchemaCloudEventSchemaV10 ... - InputSchemaCloudEventSchemaV10 InputSchema = "CloudEventSchemaV1_0" - // InputSchemaCustomEventSchema ... - InputSchemaCustomEventSchema InputSchema = "CustomEventSchema" - // InputSchemaEventGridSchema ... - InputSchemaEventGridSchema InputSchema = "EventGridSchema" -) - -// PossibleInputSchemaValues returns an array of possible values for the InputSchema const type. -func PossibleInputSchemaValues() []InputSchema { - return []InputSchema{InputSchemaCloudEventSchemaV10, InputSchemaCustomEventSchema, InputSchemaEventGridSchema} -} - -// InputSchemaMappingType enumerates the values for input schema mapping type. -type InputSchemaMappingType string - -const ( - // InputSchemaMappingTypeInputSchemaMapping ... - InputSchemaMappingTypeInputSchemaMapping InputSchemaMappingType = "InputSchemaMapping" - // InputSchemaMappingTypeJSON ... - InputSchemaMappingTypeJSON InputSchemaMappingType = "Json" -) - -// PossibleInputSchemaMappingTypeValues returns an array of possible values for the InputSchemaMappingType const type. -func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { - return []InputSchemaMappingType{InputSchemaMappingTypeInputSchemaMapping, InputSchemaMappingTypeJSON} -} - -// IPActionType enumerates the values for ip action type. -type IPActionType string - -const ( - // Allow ... - Allow IPActionType = "Allow" -) - -// PossibleIPActionTypeValues returns an array of possible values for the IPActionType const type. -func PossibleIPActionTypeValues() []IPActionType { - return []IPActionType{Allow} -} - -// OperatorType enumerates the values for operator type. -type OperatorType string - -const ( - // OperatorTypeAdvancedFilter ... - OperatorTypeAdvancedFilter OperatorType = "AdvancedFilter" - // OperatorTypeBoolEquals ... - OperatorTypeBoolEquals OperatorType = "BoolEquals" - // OperatorTypeNumberGreaterThan ... - OperatorTypeNumberGreaterThan OperatorType = "NumberGreaterThan" - // OperatorTypeNumberGreaterThanOrEquals ... - OperatorTypeNumberGreaterThanOrEquals OperatorType = "NumberGreaterThanOrEquals" - // OperatorTypeNumberIn ... - OperatorTypeNumberIn OperatorType = "NumberIn" - // OperatorTypeNumberLessThan ... - OperatorTypeNumberLessThan OperatorType = "NumberLessThan" - // OperatorTypeNumberLessThanOrEquals ... - OperatorTypeNumberLessThanOrEquals OperatorType = "NumberLessThanOrEquals" - // OperatorTypeNumberNotIn ... - OperatorTypeNumberNotIn OperatorType = "NumberNotIn" - // OperatorTypeStringBeginsWith ... - OperatorTypeStringBeginsWith OperatorType = "StringBeginsWith" - // OperatorTypeStringContains ... - OperatorTypeStringContains OperatorType = "StringContains" - // OperatorTypeStringEndsWith ... - OperatorTypeStringEndsWith OperatorType = "StringEndsWith" - // OperatorTypeStringIn ... - OperatorTypeStringIn OperatorType = "StringIn" - // OperatorTypeStringNotIn ... - OperatorTypeStringNotIn OperatorType = "StringNotIn" -) - -// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. -func PossibleOperatorTypeValues() []OperatorType { - return []OperatorType{OperatorTypeAdvancedFilter, OperatorTypeBoolEquals, OperatorTypeNumberGreaterThan, OperatorTypeNumberGreaterThanOrEquals, OperatorTypeNumberIn, OperatorTypeNumberLessThan, OperatorTypeNumberLessThanOrEquals, OperatorTypeNumberNotIn, OperatorTypeStringBeginsWith, OperatorTypeStringContains, OperatorTypeStringEndsWith, OperatorTypeStringIn, OperatorTypeStringNotIn} -} - -// PartnerNamespaceProvisioningState enumerates the values for partner namespace provisioning state. -type PartnerNamespaceProvisioningState string - -const ( - // PartnerNamespaceProvisioningStateCanceled ... - PartnerNamespaceProvisioningStateCanceled PartnerNamespaceProvisioningState = "Canceled" - // PartnerNamespaceProvisioningStateCreating ... - PartnerNamespaceProvisioningStateCreating PartnerNamespaceProvisioningState = "Creating" - // PartnerNamespaceProvisioningStateDeleting ... - PartnerNamespaceProvisioningStateDeleting PartnerNamespaceProvisioningState = "Deleting" - // PartnerNamespaceProvisioningStateFailed ... - PartnerNamespaceProvisioningStateFailed PartnerNamespaceProvisioningState = "Failed" - // PartnerNamespaceProvisioningStateSucceeded ... - PartnerNamespaceProvisioningStateSucceeded PartnerNamespaceProvisioningState = "Succeeded" - // PartnerNamespaceProvisioningStateUpdating ... - PartnerNamespaceProvisioningStateUpdating PartnerNamespaceProvisioningState = "Updating" -) - -// PossiblePartnerNamespaceProvisioningStateValues returns an array of possible values for the PartnerNamespaceProvisioningState const type. -func PossiblePartnerNamespaceProvisioningStateValues() []PartnerNamespaceProvisioningState { - return []PartnerNamespaceProvisioningState{PartnerNamespaceProvisioningStateCanceled, PartnerNamespaceProvisioningStateCreating, PartnerNamespaceProvisioningStateDeleting, PartnerNamespaceProvisioningStateFailed, PartnerNamespaceProvisioningStateSucceeded, PartnerNamespaceProvisioningStateUpdating} -} - -// PartnerRegistrationProvisioningState enumerates the values for partner registration provisioning state. -type PartnerRegistrationProvisioningState string - -const ( - // PartnerRegistrationProvisioningStateCanceled ... - PartnerRegistrationProvisioningStateCanceled PartnerRegistrationProvisioningState = "Canceled" - // PartnerRegistrationProvisioningStateCreating ... - PartnerRegistrationProvisioningStateCreating PartnerRegistrationProvisioningState = "Creating" - // PartnerRegistrationProvisioningStateDeleting ... - PartnerRegistrationProvisioningStateDeleting PartnerRegistrationProvisioningState = "Deleting" - // PartnerRegistrationProvisioningStateFailed ... - PartnerRegistrationProvisioningStateFailed PartnerRegistrationProvisioningState = "Failed" - // PartnerRegistrationProvisioningStateSucceeded ... - PartnerRegistrationProvisioningStateSucceeded PartnerRegistrationProvisioningState = "Succeeded" - // PartnerRegistrationProvisioningStateUpdating ... - PartnerRegistrationProvisioningStateUpdating PartnerRegistrationProvisioningState = "Updating" -) - -// PossiblePartnerRegistrationProvisioningStateValues returns an array of possible values for the PartnerRegistrationProvisioningState const type. -func PossiblePartnerRegistrationProvisioningStateValues() []PartnerRegistrationProvisioningState { - return []PartnerRegistrationProvisioningState{PartnerRegistrationProvisioningStateCanceled, PartnerRegistrationProvisioningStateCreating, PartnerRegistrationProvisioningStateDeleting, PartnerRegistrationProvisioningStateFailed, PartnerRegistrationProvisioningStateSucceeded, PartnerRegistrationProvisioningStateUpdating} -} - -// PartnerRegistrationVisibilityState enumerates the values for partner registration visibility state. -type PartnerRegistrationVisibilityState string - -const ( - // GenerallyAvailable ... - GenerallyAvailable PartnerRegistrationVisibilityState = "GenerallyAvailable" - // Hidden ... - Hidden PartnerRegistrationVisibilityState = "Hidden" - // PublicPreview ... - PublicPreview PartnerRegistrationVisibilityState = "PublicPreview" -) - -// PossiblePartnerRegistrationVisibilityStateValues returns an array of possible values for the PartnerRegistrationVisibilityState const type. -func PossiblePartnerRegistrationVisibilityStateValues() []PartnerRegistrationVisibilityState { - return []PartnerRegistrationVisibilityState{GenerallyAvailable, Hidden, PublicPreview} -} - -// PartnerTopicActivationState enumerates the values for partner topic activation state. -type PartnerTopicActivationState string - -const ( - // Activated ... - Activated PartnerTopicActivationState = "Activated" - // Deactivated ... - Deactivated PartnerTopicActivationState = "Deactivated" - // NeverActivated ... - NeverActivated PartnerTopicActivationState = "NeverActivated" -) - -// PossiblePartnerTopicActivationStateValues returns an array of possible values for the PartnerTopicActivationState const type. -func PossiblePartnerTopicActivationStateValues() []PartnerTopicActivationState { - return []PartnerTopicActivationState{Activated, Deactivated, NeverActivated} -} - -// PartnerTopicProvisioningState enumerates the values for partner topic provisioning state. -type PartnerTopicProvisioningState string - -const ( - // PartnerTopicProvisioningStateCanceled ... - PartnerTopicProvisioningStateCanceled PartnerTopicProvisioningState = "Canceled" - // PartnerTopicProvisioningStateCreating ... - PartnerTopicProvisioningStateCreating PartnerTopicProvisioningState = "Creating" - // PartnerTopicProvisioningStateDeleting ... - PartnerTopicProvisioningStateDeleting PartnerTopicProvisioningState = "Deleting" - // PartnerTopicProvisioningStateFailed ... - PartnerTopicProvisioningStateFailed PartnerTopicProvisioningState = "Failed" - // PartnerTopicProvisioningStateSucceeded ... - PartnerTopicProvisioningStateSucceeded PartnerTopicProvisioningState = "Succeeded" - // PartnerTopicProvisioningStateUpdating ... - PartnerTopicProvisioningStateUpdating PartnerTopicProvisioningState = "Updating" -) - -// PossiblePartnerTopicProvisioningStateValues returns an array of possible values for the PartnerTopicProvisioningState const type. -func PossiblePartnerTopicProvisioningStateValues() []PartnerTopicProvisioningState { - return []PartnerTopicProvisioningState{PartnerTopicProvisioningStateCanceled, PartnerTopicProvisioningStateCreating, PartnerTopicProvisioningStateDeleting, PartnerTopicProvisioningStateFailed, PartnerTopicProvisioningStateSucceeded, PartnerTopicProvisioningStateUpdating} -} - -// PartnerTopicReadinessState enumerates the values for partner topic readiness state. -type PartnerTopicReadinessState string - -const ( - // ActivatedByUser ... - ActivatedByUser PartnerTopicReadinessState = "ActivatedByUser" - // DeactivatedByUser ... - DeactivatedByUser PartnerTopicReadinessState = "DeactivatedByUser" - // DeletedByUser ... - DeletedByUser PartnerTopicReadinessState = "DeletedByUser" - // NotActivatedByUserYet ... - NotActivatedByUserYet PartnerTopicReadinessState = "NotActivatedByUserYet" -) - -// PossiblePartnerTopicReadinessStateValues returns an array of possible values for the PartnerTopicReadinessState const type. -func PossiblePartnerTopicReadinessStateValues() []PartnerTopicReadinessState { - return []PartnerTopicReadinessState{ActivatedByUser, DeactivatedByUser, DeletedByUser, NotActivatedByUserYet} -} - -// PartnerTopicTypeAuthorizationState enumerates the values for partner topic type authorization state. -type PartnerTopicTypeAuthorizationState string - -const ( - // Authorized ... - Authorized PartnerTopicTypeAuthorizationState = "Authorized" - // NotApplicable ... - NotApplicable PartnerTopicTypeAuthorizationState = "NotApplicable" - // NotAuthorized ... - NotAuthorized PartnerTopicTypeAuthorizationState = "NotAuthorized" -) - -// PossiblePartnerTopicTypeAuthorizationStateValues returns an array of possible values for the PartnerTopicTypeAuthorizationState const type. -func PossiblePartnerTopicTypeAuthorizationStateValues() []PartnerTopicTypeAuthorizationState { - return []PartnerTopicTypeAuthorizationState{Authorized, NotApplicable, NotAuthorized} -} - -// PersistedConnectionStatus enumerates the values for persisted connection status. -type PersistedConnectionStatus string - -const ( - // Approved ... - Approved PersistedConnectionStatus = "Approved" - // Disconnected ... - Disconnected PersistedConnectionStatus = "Disconnected" - // Pending ... - Pending PersistedConnectionStatus = "Pending" - // Rejected ... - Rejected PersistedConnectionStatus = "Rejected" -) - -// PossiblePersistedConnectionStatusValues returns an array of possible values for the PersistedConnectionStatus const type. -func PossiblePersistedConnectionStatusValues() []PersistedConnectionStatus { - return []PersistedConnectionStatus{Approved, Disconnected, Pending, Rejected} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // Disabled ... - Disabled PublicNetworkAccess = "Disabled" - // Enabled ... - Enabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{Disabled, Enabled} -} - -// ResourceProvisioningState enumerates the values for resource provisioning state. -type ResourceProvisioningState string - -const ( - // ResourceProvisioningStateCanceled ... - ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" - // ResourceProvisioningStateCreating ... - ResourceProvisioningStateCreating ResourceProvisioningState = "Creating" - // ResourceProvisioningStateDeleting ... - ResourceProvisioningStateDeleting ResourceProvisioningState = "Deleting" - // ResourceProvisioningStateFailed ... - ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" - // ResourceProvisioningStateSucceeded ... - ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" - // ResourceProvisioningStateUpdating ... - ResourceProvisioningStateUpdating ResourceProvisioningState = "Updating" -) - -// PossibleResourceProvisioningStateValues returns an array of possible values for the ResourceProvisioningState const type. -func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { - return []ResourceProvisioningState{ResourceProvisioningStateCanceled, ResourceProvisioningStateCreating, ResourceProvisioningStateDeleting, ResourceProvisioningStateFailed, ResourceProvisioningStateSucceeded, ResourceProvisioningStateUpdating} -} - -// ResourceRegionType enumerates the values for resource region type. -type ResourceRegionType string - -const ( - // GlobalResource ... - GlobalResource ResourceRegionType = "GlobalResource" - // RegionalResource ... - RegionalResource ResourceRegionType = "RegionalResource" -) - -// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. -func PossibleResourceRegionTypeValues() []ResourceRegionType { - return []ResourceRegionType{GlobalResource, RegionalResource} -} - -// Sku enumerates the values for sku. -type Sku string - -const ( - // Basic ... - Basic Sku = "Basic" - // Premium ... - Premium Sku = "Premium" -) - -// PossibleSkuValues returns an array of possible values for the Sku const type. -func PossibleSkuValues() []Sku { - return []Sku{Basic, Premium} -} - -// TopicProvisioningState enumerates the values for topic provisioning state. -type TopicProvisioningState string - -const ( - // TopicProvisioningStateCanceled ... - TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" - // TopicProvisioningStateCreating ... - TopicProvisioningStateCreating TopicProvisioningState = "Creating" - // TopicProvisioningStateDeleting ... - TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" - // TopicProvisioningStateFailed ... - TopicProvisioningStateFailed TopicProvisioningState = "Failed" - // TopicProvisioningStateSucceeded ... - TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" - // TopicProvisioningStateUpdating ... - TopicProvisioningStateUpdating TopicProvisioningState = "Updating" -) - -// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. -func PossibleTopicProvisioningStateValues() []TopicProvisioningState { - return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} -} - -// TopicTypeProvisioningState enumerates the values for topic type provisioning state. -type TopicTypeProvisioningState string - -const ( - // TopicTypeProvisioningStateCanceled ... - TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" - // TopicTypeProvisioningStateCreating ... - TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" - // TopicTypeProvisioningStateDeleting ... - TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" - // TopicTypeProvisioningStateFailed ... - TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" - // TopicTypeProvisioningStateSucceeded ... - TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" - // TopicTypeProvisioningStateUpdating ... - TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" -) - -// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. -func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { - return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} -} diff --git a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventchannels.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventchannels.go deleted file mode 100644 index b24828af55f0..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventchannels.go +++ /dev/null @@ -1,402 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventChannelsClient is the azure EventGrid Management Client -type EventChannelsClient struct { - BaseClient -} - -// NewEventChannelsClient creates an instance of the EventChannelsClient client. -func NewEventChannelsClient(subscriptionID string) EventChannelsClient { - return NewEventChannelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventChannelsClientWithBaseURI creates an instance of the EventChannelsClient 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 NewEventChannelsClientWithBaseURI(baseURI string, subscriptionID string) EventChannelsClient { - return EventChannelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new event channel with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// eventChannelName - name of the event channel. -// eventChannelInfo - eventChannel information. -func (client EventChannelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo EventChannel) (result EventChannel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.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, partnerNamespaceName, eventChannelName, eventChannelInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventChannelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo EventChannel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventChannelName": autorest.Encode("path", eventChannelName), - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}", pathParameters), - autorest.WithJSON(eventChannelInfo), - 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 EventChannelsClient) 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 EventChannelsClient) CreateOrUpdateResponder(resp *http.Response) (result EventChannel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete existing event channel. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// eventChannelName - name of the event channel. -func (client EventChannelsClient) Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result EventChannelsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerNamespaceName, eventChannelName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventChannelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventChannelName": autorest.Encode("path", eventChannelName), - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}", 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 EventChannelsClient) DeleteSender(req *http.Request) (future EventChannelsDeleteFuture, 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 EventChannelsClient) 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 get properties of an event channel. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// eventChannelName - name of the event channel. -func (client EventChannelsClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result EventChannel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.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, partnerNamespaceName, eventChannelName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventChannelsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventChannelName": autorest.Encode("path", eventChannelName), - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}", 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 EventChannelsClient) 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 EventChannelsClient) GetResponder(resp *http.Response) (result EventChannel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByPartnerNamespace list all the event channels in a partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventChannelsClient) ListByPartnerNamespace(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result EventChannelsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.ListByPartnerNamespace") - defer func() { - sc := -1 - if result.eclr.Response.Response != nil { - sc = result.eclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByPartnerNamespaceNextResults - req, err := client.ListByPartnerNamespacePreparer(ctx, resourceGroupName, partnerNamespaceName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "ListByPartnerNamespace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPartnerNamespaceSender(req) - if err != nil { - result.eclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "ListByPartnerNamespace", resp, "Failure sending request") - return - } - - result.eclr, err = client.ListByPartnerNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "ListByPartnerNamespace", resp, "Failure responding to request") - return - } - if result.eclr.hasNextLink() && result.eclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPartnerNamespacePreparer prepares the ListByPartnerNamespace request. -func (client EventChannelsClient) ListByPartnerNamespacePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPartnerNamespaceSender sends the ListByPartnerNamespace request. The method will close the -// http.Response Body if it receives an error. -func (client EventChannelsClient) ListByPartnerNamespaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPartnerNamespaceResponder handles the response to the ListByPartnerNamespace request. The method always -// closes the http.Response Body. -func (client EventChannelsClient) ListByPartnerNamespaceResponder(resp *http.Response) (result EventChannelsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPartnerNamespaceNextResults retrieves the next set of results, if any. -func (client EventChannelsClient) listByPartnerNamespaceNextResults(ctx context.Context, lastResults EventChannelsListResult) (result EventChannelsListResult, err error) { - req, err := lastResults.eventChannelsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "listByPartnerNamespaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPartnerNamespaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "listByPartnerNamespaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPartnerNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "listByPartnerNamespaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPartnerNamespaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventChannelsClient) ListByPartnerNamespaceComplete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result EventChannelsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.ListByPartnerNamespace") - 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.ListByPartnerNamespace(ctx, resourceGroupName, partnerNamespaceName, filter, top) - return -} diff --git a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventgridapi/interfaces.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventgridapi/interfaces.go deleted file mode 100644 index ec75594c1238..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventgridapi/interfaces.go +++ /dev/null @@ -1,228 +0,0 @@ -package eventgridapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/eventgrid/mgmt/2020-04-01-preview/eventgrid" - "github.com/Azure/go-autorest/autorest" -) - -// DomainsClientAPI contains the set of methods on the DomainsClient type. -type DomainsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo eventgrid.Domain) (result eventgrid.DomainsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.Domain, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest eventgrid.DomainRegenerateKeyRequest) (result eventgrid.DomainSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters eventgrid.DomainUpdateParameters) (result eventgrid.DomainsUpdateFuture, err error) -} - -var _ DomainsClientAPI = (*eventgrid.DomainsClient)(nil) - -// DomainTopicsClientAPI contains the set of methods on the DomainTopicsClient type. -type DomainTopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopic, err error) - ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultPage, err error) - ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultIterator, err error) -} - -var _ DomainTopicsClientAPI = (*eventgrid.DomainTopicsClient)(nil) - -// EventChannelsClientAPI contains the set of methods on the EventChannelsClient type. -type EventChannelsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo eventgrid.EventChannel) (result eventgrid.EventChannel, err error) - Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result eventgrid.EventChannelsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result eventgrid.EventChannel, err error) - ListByPartnerNamespace(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result eventgrid.EventChannelsListResultPage, err error) - ListByPartnerNamespaceComplete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result eventgrid.EventChannelsListResultIterator, err error) -} - -var _ EventChannelsClientAPI = (*eventgrid.EventChannelsClient)(nil) - -// EventSubscriptionsClientAPI contains the set of methods on the EventSubscriptionsClient type. -type EventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.EventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.EventSubscriptionsUpdateFuture, err error) -} - -var _ EventSubscriptionsClientAPI = (*eventgrid.EventSubscriptionsClient)(nil) - -// SystemTopicEventSubscriptionsClientAPI contains the set of methods on the SystemTopicEventSubscriptionsClient type. -type SystemTopicEventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.SystemTopicEventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetFullURL(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListBySystemTopic(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListBySystemTopicComplete(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.SystemTopicEventSubscriptionsUpdateFuture, err error) -} - -var _ SystemTopicEventSubscriptionsClientAPI = (*eventgrid.SystemTopicEventSubscriptionsClient)(nil) - -// PartnerTopicEventSubscriptionsClientAPI contains the set of methods on the PartnerTopicEventSubscriptionsClient type. -type PartnerTopicEventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.PartnerTopicEventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetFullURL(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByPartnerTopic(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByPartnerTopicComplete(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.PartnerTopicEventSubscriptionsUpdateFuture, err error) -} - -var _ PartnerTopicEventSubscriptionsClientAPI = (*eventgrid.PartnerTopicEventSubscriptionsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result eventgrid.OperationsListResult, err error) -} - -var _ OperationsClientAPI = (*eventgrid.OperationsClient)(nil) - -// PartnerNamespacesClientAPI contains the set of methods on the PartnerNamespacesClient type. -type PartnerNamespacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo eventgrid.PartnerNamespace) (result eventgrid.PartnerNamespacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result eventgrid.PartnerNamespacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result eventgrid.PartnerNamespace, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultIterator, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result eventgrid.PartnerNamespaceSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest eventgrid.PartnerNamespaceRegenerateKeyRequest) (result eventgrid.PartnerNamespaceSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters eventgrid.PartnerNamespaceUpdateParameters) (result eventgrid.PartnerNamespacesUpdateFuture, err error) -} - -var _ PartnerNamespacesClientAPI = (*eventgrid.PartnerNamespacesClient)(nil) - -// PartnerRegistrationsClientAPI contains the set of methods on the PartnerRegistrationsClient type. -type PartnerRegistrationsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo eventgrid.PartnerRegistration) (result eventgrid.PartnerRegistration, err error) - Delete(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result eventgrid.PartnerRegistration, err error) - List(ctx context.Context) (result eventgrid.PartnerRegistrationsListResult, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters eventgrid.PartnerRegistrationUpdateParameters) (result eventgrid.PartnerRegistration, err error) -} - -var _ PartnerRegistrationsClientAPI = (*eventgrid.PartnerRegistrationsClient)(nil) - -// PartnerTopicsClientAPI contains the set of methods on the PartnerTopicsClient type. -type PartnerTopicsClientAPI interface { - Activate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopic, err error) - Deactivate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopic, err error) - Delete(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerTopicsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerTopicsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerTopicsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerTopicsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters eventgrid.PartnerTopicUpdateParameters) (result eventgrid.PartnerTopic, err error) -} - -var _ PartnerTopicsClientAPI = (*eventgrid.PartnerTopicsClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result eventgrid.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result eventgrid.PrivateEndpointConnection, err error) - ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateEndpointConnectionListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateEndpointConnectionListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string, privateEndpointConnection eventgrid.PrivateEndpointConnection) (result eventgrid.PrivateEndpointConnectionsUpdateFuture, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*eventgrid.PrivateEndpointConnectionsClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string) (result eventgrid.PrivateLinkResource, err error) - ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateLinkResourcesListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateLinkResourcesListResultIterator, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*eventgrid.PrivateLinkResourcesClient)(nil) - -// SystemTopicsClientAPI contains the set of methods on the SystemTopicsClient type. -type SystemTopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo eventgrid.SystemTopic) (result eventgrid.SystemTopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, systemTopicName string) (result eventgrid.SystemTopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, systemTopicName string) (result eventgrid.SystemTopic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.SystemTopicsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.SystemTopicsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.SystemTopicsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.SystemTopicsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters eventgrid.SystemTopicUpdateParameters) (result eventgrid.SystemTopicsUpdateFuture, err error) -} - -var _ SystemTopicsClientAPI = (*eventgrid.SystemTopicsClient)(nil) - -// TopicsClientAPI contains the set of methods on the TopicsClient type. -type TopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo eventgrid.Topic) (result eventgrid.TopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.Topic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) - ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventTypesListResult, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest eventgrid.TopicRegenerateKeyRequest) (result eventgrid.TopicSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters eventgrid.TopicUpdateParameters) (result eventgrid.TopicsUpdateFuture, err error) -} - -var _ TopicsClientAPI = (*eventgrid.TopicsClient)(nil) - -// ExtensionTopicsClientAPI contains the set of methods on the ExtensionTopicsClient type. -type ExtensionTopicsClientAPI interface { - Get(ctx context.Context, scope string) (result eventgrid.ExtensionTopic, err error) -} - -var _ ExtensionTopicsClientAPI = (*eventgrid.ExtensionTopicsClient)(nil) - -// TopicTypesClientAPI contains the set of methods on the TopicTypesClient type. -type TopicTypesClientAPI interface { - Get(ctx context.Context, topicTypeName string) (result eventgrid.TopicTypeInfo, err error) - List(ctx context.Context) (result eventgrid.TopicTypesListResult, err error) - ListEventTypes(ctx context.Context, topicTypeName string) (result eventgrid.EventTypesListResult, err error) -} - -var _ TopicTypesClientAPI = (*eventgrid.TopicTypesClient)(nil) diff --git a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventsubscriptions.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventsubscriptions.go deleted file mode 100644 index 2adcb8fe4bb6..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/eventsubscriptions.go +++ /dev/null @@ -1,1782 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventSubscriptionsClient is the azure EventGrid Management Client -type EventSubscriptionsClient struct { - BaseClient -} - -// NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. -func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { - return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient 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 NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { - return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new event subscription or updates an existing event subscription based on -// the specified scope. -// Parameters: -// scope - the identifier of the resource to which the event subscription needs to be created or updated. The -// scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider -// namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. Event subscription names must be between 3 and 64 -// characters in length and should use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information. -func (client EventSubscriptionsClient) CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-04-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 EventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future EventSubscriptionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an existing event subscription. -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. -func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) 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 get properties of an event subscription. -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. -func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.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, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) 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 EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription. -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. -func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomainTopic list all event subscriptions that have been created for a specific domain topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the top level domain. -// topicName - name of the domain topic. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDomainTopicNextResults - req, err := client.ListByDomainTopicPreparer(ctx, resourceGroupName, domainName, topicName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainTopicSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByDomainTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDomainTopicPreparer prepares the ListByDomainTopic request. -func (client EventSubscriptionsClient) ListByDomainTopicPreparer(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainTopicSender sends the ListByDomainTopic request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByDomainTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainTopicResponder handles the response to the ListByDomainTopic request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByDomainTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDomainTopicNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listByDomainTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDomainTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDomainTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDomainTopicComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") - 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.ListByDomainTopic(ctx, resourceGroupName, domainName, topicName, filter, top) - return -} - -// ListByResource list all event subscriptions that have been created for a specific topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic. -// resourceTypeName - name of the resource type. -// resourceName - name of the resource. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listByResourceNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - 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.ListByResource(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top) - return -} - -// ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource -// group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalByResourceGroupNextResults - req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalByResourceGroupNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - 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.ListGlobalByResourceGroup(ctx, resourceGroupName, filter, top) - return -} - -// ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific -// topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicTypeName - name of the topic type. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalByResourceGroupForTopicTypeNextResults - req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - 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.ListGlobalByResourceGroupForTopicType(ctx, resourceGroupName, topicTypeName, filter, top) - return -} - -// ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalBySubscriptionNextResults - req, err := client.ListGlobalBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalBySubscriptionNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - 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.ListGlobalBySubscription(ctx, filter, top) - return -} - -// ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic -// type. -// Parameters: -// topicTypeName - name of the topic type. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalBySubscriptionForTopicTypeNextResults - req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - 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.ListGlobalBySubscriptionForTopicType(ctx, topicTypeName, filter, top) - return -} - -// ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription -// and resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalByResourceGroupNextResults - req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalByResourceGroupNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - 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.ListRegionalByResourceGroup(ctx, resourceGroupName, location, filter, top) - return -} - -// ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and resource group and topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location. -// topicTypeName - name of the topic type. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalByResourceGroupForTopicTypeNextResults - req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - 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.ListRegionalByResourceGroupForTopicType(ctx, resourceGroupName, location, topicTypeName, filter, top) - return -} - -// ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription. -// Parameters: -// location - name of the location. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalBySubscriptionNextResults - req, err := client.ListRegionalBySubscriptionPreparer(ctx, location, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(ctx context.Context, location string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalBySubscriptionNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - 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.ListRegionalBySubscription(ctx, location, filter, top) - return -} - -// ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and topic type. -// Parameters: -// location - name of the location. -// topicTypeName - name of the topic type. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalBySubscriptionForTopicTypeNextResults - req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - 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.ListRegionalBySubscriptionForTopicType(ctx, location, topicTypeName, filter, top) - return -} - -// Update asynchronously updates an existing event subscription. -// Parameters: -// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a -// top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be updated. -// eventSubscriptionUpdateParameters - updated event subscription information. -func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-04-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/extensiontopics.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/extensiontopics.go deleted file mode 100644 index 49835c1b3467..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/extensiontopics.go +++ /dev/null @@ -1,109 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ExtensionTopicsClient is the azure EventGrid Management Client -type ExtensionTopicsClient struct { - BaseClient -} - -// NewExtensionTopicsClient creates an instance of the ExtensionTopicsClient client. -func NewExtensionTopicsClient(subscriptionID string) ExtensionTopicsClient { - return NewExtensionTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExtensionTopicsClientWithBaseURI creates an instance of the ExtensionTopicsClient 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 NewExtensionTopicsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTopicsClient { - return ExtensionTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the properties of an extension topic. -// Parameters: -// scope - the identifier of the resource to which extension topic is queried. The scope can be a subscription, -// or a resource group, or a top level resource belonging to a resource provider namespace. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for Azure resource. -func (client ExtensionTopicsClient) Get(ctx context.Context, scope string) (result ExtensionTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTopicsClient.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, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.ExtensionTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.ExtensionTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.ExtensionTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExtensionTopicsClient) GetPreparer(ctx context.Context, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/extensionTopics/default", 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 ExtensionTopicsClient) 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 ExtensionTopicsClient) GetResponder(resp *http.Response) (result ExtensionTopic, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/models.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/models.go deleted file mode 100644 index 1e806b513150..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/models.go +++ /dev/null @@ -1,8342 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid" - -// BasicAdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do -// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as -// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of the key -// based on which you want to filter. -type BasicAdvancedFilter interface { - AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) - AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) - AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) - AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) - AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) - AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) - AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) - AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) - AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) - AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) - AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) - AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) - AsAdvancedFilter() (*AdvancedFilter, bool) -} - -// AdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do -// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as -// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of -// the key based on which you want to filter. -type AdvancedFilter struct { - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -func unmarshalBasicAdvancedFilter(body []byte) (BasicAdvancedFilter, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["operatorType"] { - case string(OperatorTypeNumberIn): - var niaf NumberInAdvancedFilter - err := json.Unmarshal(body, &niaf) - return niaf, err - case string(OperatorTypeNumberNotIn): - var nniaf NumberNotInAdvancedFilter - err := json.Unmarshal(body, &nniaf) - return nniaf, err - case string(OperatorTypeNumberLessThan): - var nltaf NumberLessThanAdvancedFilter - err := json.Unmarshal(body, &nltaf) - return nltaf, err - case string(OperatorTypeNumberGreaterThan): - var ngtaf NumberGreaterThanAdvancedFilter - err := json.Unmarshal(body, &ngtaf) - return ngtaf, err - case string(OperatorTypeNumberLessThanOrEquals): - var nltoeaf NumberLessThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &nltoeaf) - return nltoeaf, err - case string(OperatorTypeNumberGreaterThanOrEquals): - var ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &ngtoeaf) - return ngtoeaf, err - case string(OperatorTypeBoolEquals): - var beaf BoolEqualsAdvancedFilter - err := json.Unmarshal(body, &beaf) - return beaf, err - case string(OperatorTypeStringIn): - var siaf StringInAdvancedFilter - err := json.Unmarshal(body, &siaf) - return siaf, err - case string(OperatorTypeStringNotIn): - var sniaf StringNotInAdvancedFilter - err := json.Unmarshal(body, &sniaf) - return sniaf, err - case string(OperatorTypeStringBeginsWith): - var sbwaf StringBeginsWithAdvancedFilter - err := json.Unmarshal(body, &sbwaf) - return sbwaf, err - case string(OperatorTypeStringEndsWith): - var sewaf StringEndsWithAdvancedFilter - err := json.Unmarshal(body, &sewaf) - return sewaf, err - case string(OperatorTypeStringContains): - var scaf StringContainsAdvancedFilter - err := json.Unmarshal(body, &scaf) - return scaf, err - default: - var af AdvancedFilter - err := json.Unmarshal(body, &af) - return af, err - } -} -func unmarshalBasicAdvancedFilterArray(body []byte) ([]BasicAdvancedFilter, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - afArray := make([]BasicAdvancedFilter, len(rawMessages)) - - for index, rawMessage := range rawMessages { - af, err := unmarshalBasicAdvancedFilter(*rawMessage) - if err != nil { - return nil, err - } - afArray[index] = af - } - return afArray, nil -} - -// MarshalJSON is the custom marshaler for AdvancedFilter. -func (af AdvancedFilter) MarshalJSON() ([]byte, error) { - af.OperatorType = OperatorTypeAdvancedFilter - objectMap := make(map[string]interface{}) - if af.Key != nil { - objectMap["key"] = af.Key - } - if af.OperatorType != "" { - objectMap["operatorType"] = af.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return &af, true -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &af, true -} - -// AzureFunctionEventSubscriptionDestination information about the azure function destination for an event -// subscription. -type AzureFunctionEventSubscriptionDestination struct { - // AzureFunctionEventSubscriptionDestinationProperties - Azure Function Properties of the event subscription destination. - *AzureFunctionEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - afesd.EndpointType = EndpointTypeAzureFunction - objectMap := make(map[string]interface{}) - if afesd.AzureFunctionEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = afesd.AzureFunctionEventSubscriptionDestinationProperties - } - if afesd.EndpointType != "" { - objectMap["endpointType"] = afesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return &afesd, true -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &afesd, true -} - -// UnmarshalJSON is the custom unmarshaler for AzureFunctionEventSubscriptionDestination struct. -func (afesd *AzureFunctionEventSubscriptionDestination) 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 azureFunctionEventSubscriptionDestinationProperties AzureFunctionEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &azureFunctionEventSubscriptionDestinationProperties) - if err != nil { - return err - } - afesd.AzureFunctionEventSubscriptionDestinationProperties = &azureFunctionEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - afesd.EndpointType = endpointType - } - } - } - - return nil -} - -// AzureFunctionEventSubscriptionDestinationProperties the properties that represent the Azure Function -// destination of an event subscription. -type AzureFunctionEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Azure Function destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // MaxEventsPerBatch - Maximum number of events per batch. - MaxEventsPerBatch *int32 `json:"maxEventsPerBatch,omitempty"` - // PreferredBatchSizeInKilobytes - Preferred batch size in Kilobytes. - PreferredBatchSizeInKilobytes *int32 `json:"preferredBatchSizeInKilobytes,omitempty"` -} - -// BoolEqualsAdvancedFilter boolEquals Advanced Filter. -type BoolEqualsAdvancedFilter struct { - // Value - The boolean filter value. - Value *bool `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - beaf.OperatorType = OperatorTypeBoolEquals - objectMap := make(map[string]interface{}) - if beaf.Value != nil { - objectMap["value"] = beaf.Value - } - if beaf.Key != nil { - objectMap["key"] = beaf.Key - } - if beaf.OperatorType != "" { - objectMap["operatorType"] = beaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return &beaf, true -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &beaf, true -} - -// ConnectionState connectionState information. -type ConnectionState struct { - // Status - Status of the connection. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' - Status PersistedConnectionStatus `json:"status,omitempty"` - // Description - Description of the connection state. - Description *string `json:"description,omitempty"` - // ActionsRequired - Actions required (if any). - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// BasicDeadLetterDestination information about the dead letter destination for an event subscription. To configure a -// deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a -// derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. -type BasicDeadLetterDestination interface { - AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) - AsDeadLetterDestination() (*DeadLetterDestination, bool) -} - -// DeadLetterDestination information about the dead letter destination for an event subscription. To configure -// a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an -// object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from -// this class. -type DeadLetterDestination struct { - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -func unmarshalBasicDeadLetterDestination(body []byte) (BasicDeadLetterDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeStorageBlob): - var sbdld StorageBlobDeadLetterDestination - err := json.Unmarshal(body, &sbdld) - return sbdld, err - default: - var dld DeadLetterDestination - err := json.Unmarshal(body, &dld) - return dld, err - } -} -func unmarshalBasicDeadLetterDestinationArray(body []byte) ([]BasicDeadLetterDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dldArray := make([]BasicDeadLetterDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dld, err := unmarshalBasicDeadLetterDestination(*rawMessage) - if err != nil { - return nil, err - } - dldArray[index] = dld - } - return dldArray, nil -} - -// MarshalJSON is the custom marshaler for DeadLetterDestination. -func (dld DeadLetterDestination) MarshalJSON() ([]byte, error) { - dld.EndpointType = EndpointTypeDeadLetterDestination - objectMap := make(map[string]interface{}) - if dld.EndpointType != "" { - objectMap["endpointType"] = dld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return nil, false -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return &dld, true -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &dld, true -} - -// DeadLetterWithResourceIdentity information about the deadletter destination with resource identity. -type DeadLetterWithResourceIdentity struct { - // Identity - The identity to use when dead-lettering events. - Identity *EventSubscriptionIdentity `json:"identity,omitempty"` - // DeadLetterDestination - Information about the destination where events have to be delivered for the event subscription. - // Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DeadLetterWithResourceIdentity struct. -func (dlwri *DeadLetterWithResourceIdentity) 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 "identity": - if v != nil { - var identity EventSubscriptionIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dlwri.Identity = &identity - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - dlwri.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// DeliveryWithResourceIdentity information about the delivery for an event subscription with resource -// identity. -type DeliveryWithResourceIdentity struct { - // Identity - The identity to use when delivering events. - Identity *EventSubscriptionIdentity `json:"identity,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DeliveryWithResourceIdentity struct. -func (dwri *DeliveryWithResourceIdentity) 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 "identity": - if v != nil { - var identity EventSubscriptionIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dwri.Identity = &identity - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - dwri.Destination = destination - } - } - } - - return nil -} - -// Domain eventGrid Domain. -type Domain struct { - autorest.Response `json:"-"` - // DomainProperties - Properties of the domain. - *DomainProperties `json:"properties,omitempty"` - // Sku - The Sku pricing tier for the domain. - Sku *ResourceSku `json:"sku,omitempty"` - // Identity - Identity information for the resource. - Identity *IdentityInfo `json:"identity,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Domain. -func (d Domain) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DomainProperties != nil { - objectMap["properties"] = d.DomainProperties - } - if d.Sku != nil { - objectMap["sku"] = d.Sku - } - if d.Identity != nil { - objectMap["identity"] = d.Identity - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Domain struct. -func (d *Domain) 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 domainProperties DomainProperties - err = json.Unmarshal(*v, &domainProperties) - if err != nil { - return err - } - d.DomainProperties = &domainProperties - } - case "sku": - if v != nil { - var sku ResourceSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - d.Sku = &sku - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - d.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DomainProperties properties of the Domain. -type DomainProperties struct { - // PrivateEndpointConnections - List of private endpoint connections. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the domain. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' - ProvisioningState DomainProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the domain. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the domain. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventSchemaV10' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - Information about the InputSchemaMapping which specified the info about mapping event payload. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` - // MetricResourceID - READ-ONLY; Metric resource id for the domain. - MetricResourceID *string `json:"metricResourceId,omitempty"` - // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. - // You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainProperties. -func (dp DomainProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = dp.PrivateEndpointConnections - } - if dp.InputSchema != "" { - objectMap["inputSchema"] = dp.InputSchema - } - objectMap["inputSchemaMapping"] = dp.InputSchemaMapping - if dp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = dp.PublicNetworkAccess - } - if dp.InboundIPRules != nil { - objectMap["inboundIpRules"] = dp.InboundIPRules - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainProperties struct. -func (dp *DomainProperties) 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 "privateEndpointConnections": - if v != nil { - var privateEndpointConnections []PrivateEndpointConnection - err = json.Unmarshal(*v, &privateEndpointConnections) - if err != nil { - return err - } - dp.PrivateEndpointConnections = &privateEndpointConnections - } - case "provisioningState": - if v != nil { - var provisioningState DomainProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - dp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - dp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - dp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - dp.InputSchemaMapping = inputSchemaMapping - } - case "metricResourceId": - if v != nil { - var metricResourceID string - err = json.Unmarshal(*v, &metricResourceID) - if err != nil { - return err - } - dp.MetricResourceID = &metricResourceID - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - dp.PublicNetworkAccess = publicNetworkAccess - } - case "inboundIpRules": - if v != nil { - var inboundIPRules []InboundIPRule - err = json.Unmarshal(*v, &inboundIPRules) - if err != nil { - return err - } - dp.InboundIPRules = &inboundIPRules - } - } - } - - return nil -} - -// DomainRegenerateKeyRequest domain regenerate share access key request. -type DomainRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2. - KeyName *string `json:"keyName,omitempty"` -} - -// DomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsCreateOrUpdateFuture) 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 DomainsCreateOrUpdateFuture.Result. -func (future *DomainsCreateOrUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsDeleteFuture) 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 DomainsDeleteFuture.Result. -func (future *DomainsDeleteFuture) result(client DomainsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainSharedAccessKeys shared access keys of the Domain. -type DomainSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the domain. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the domain. - Key2 *string `json:"key2,omitempty"` -} - -// DomainsListResult result of the List Domains operation -type DomainsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domains - Value *[]Domain `json:"value,omitempty"` - // NextLink - A link for the next page of domains - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainsListResultIterator provides access to a complete listing of Domain values. -type DomainsListResultIterator struct { - i int - page DomainsListResultPage -} - -// 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 *DomainsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultIterator.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 *DomainsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainsListResultIterator) 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 DomainsListResultIterator) Response() DomainsListResult { - 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 DomainsListResultIterator) Value() Domain { - if !iter.page.NotDone() { - return Domain{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainsListResultIterator type. -func NewDomainsListResultIterator(page DomainsListResultPage) DomainsListResultIterator { - return DomainsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DomainsListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DomainsListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// domainsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DomainsListResult) domainsListResultPreparer(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))) -} - -// DomainsListResultPage contains a page of Domain values. -type DomainsListResultPage struct { - fn func(context.Context, DomainsListResult) (DomainsListResult, error) - dlr DomainsListResult -} - -// 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 *DomainsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultPage.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 *DomainsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainsListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainsListResultPage) Response() DomainsListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainsListResultPage) Values() []Domain { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DomainsListResultPage type. -func NewDomainsListResultPage(cur DomainsListResult, getNextPage func(context.Context, DomainsListResult) (DomainsListResult, error)) DomainsListResultPage { - return DomainsListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsUpdateFuture) 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 DomainsUpdateFuture.Result. -func (future *DomainsUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainTopic domain Topic. -type DomainTopic struct { - autorest.Response `json:"-"` - // DomainTopicProperties - Properties of the Domain Topic. - *DomainTopicProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainTopic. -func (dt DomainTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dt.DomainTopicProperties != nil { - objectMap["properties"] = dt.DomainTopicProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainTopic struct. -func (dt *DomainTopic) 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 domainTopicProperties DomainTopicProperties - err = json.Unmarshal(*v, &domainTopicProperties) - if err != nil { - return err - } - dt.DomainTopicProperties = &domainTopicProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dt.Type = &typeVar - } - } - } - - return nil -} - -// DomainTopicProperties properties of the Domain Topic. -type DomainTopicProperties struct { - // ProvisioningState - Provisioning state of the domain topic. Possible values include: 'DomainTopicProvisioningStateCreating', 'DomainTopicProvisioningStateUpdating', 'DomainTopicProvisioningStateDeleting', 'DomainTopicProvisioningStateSucceeded', 'DomainTopicProvisioningStateCanceled', 'DomainTopicProvisioningStateFailed' - ProvisioningState DomainTopicProvisioningState `json:"provisioningState,omitempty"` -} - -// DomainTopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DomainTopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainTopicsClient) (DomainTopic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainTopicsCreateOrUpdateFuture) 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 DomainTopicsCreateOrUpdateFuture.Result. -func (future *DomainTopicsCreateOrUpdateFuture) result(client DomainTopicsClient) (dt DomainTopic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dt.Response.Response, err = future.GetResult(sender); err == nil && dt.Response.Response.StatusCode != http.StatusNoContent { - dt, err = client.CreateOrUpdateResponder(dt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", dt.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainTopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainTopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainTopicsDeleteFuture) 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 DomainTopicsDeleteFuture.Result. -func (future *DomainTopicsDeleteFuture) result(client DomainTopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainTopicsListResult result of the List Domain Topics operation -type DomainTopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domain Topics - Value *[]DomainTopic `json:"value,omitempty"` - // NextLink - A link for the next page of domain topics - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainTopicsListResultIterator provides access to a complete listing of DomainTopic values. -type DomainTopicsListResultIterator struct { - i int - page DomainTopicsListResultPage -} - -// 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 *DomainTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultIterator.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 *DomainTopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainTopicsListResultIterator) 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 DomainTopicsListResultIterator) Response() DomainTopicsListResult { - 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 DomainTopicsListResultIterator) Value() DomainTopic { - if !iter.page.NotDone() { - return DomainTopic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainTopicsListResultIterator type. -func NewDomainTopicsListResultIterator(page DomainTopicsListResultPage) DomainTopicsListResultIterator { - return DomainTopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dtlr DomainTopicsListResult) IsEmpty() bool { - return dtlr.Value == nil || len(*dtlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dtlr DomainTopicsListResult) hasNextLink() bool { - return dtlr.NextLink != nil && len(*dtlr.NextLink) != 0 -} - -// domainTopicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dtlr DomainTopicsListResult) domainTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dtlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dtlr.NextLink))) -} - -// DomainTopicsListResultPage contains a page of DomainTopic values. -type DomainTopicsListResultPage struct { - fn func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error) - dtlr DomainTopicsListResult -} - -// 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 *DomainTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultPage.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.dtlr) - if err != nil { - return err - } - page.dtlr = 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 *DomainTopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainTopicsListResultPage) NotDone() bool { - return !page.dtlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainTopicsListResultPage) Response() DomainTopicsListResult { - return page.dtlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainTopicsListResultPage) Values() []DomainTopic { - if page.dtlr.IsEmpty() { - return nil - } - return *page.dtlr.Value -} - -// Creates a new instance of the DomainTopicsListResultPage type. -func NewDomainTopicsListResultPage(cur DomainTopicsListResult, getNextPage func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error)) DomainTopicsListResultPage { - return DomainTopicsListResultPage{ - fn: getNextPage, - dtlr: cur, - } -} - -// DomainUpdateParameterProperties information of domain update parameter properties. -type DomainUpdateParameterProperties struct { - // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. - // You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` -} - -// DomainUpdateParameters properties of the Domain update. -type DomainUpdateParameters struct { - // Tags - Tags of the domains resource. - Tags map[string]*string `json:"tags"` - // DomainUpdateParameterProperties - Properties of the resource. - *DomainUpdateParameterProperties `json:"properties,omitempty"` - // Identity - Identity information for the resource. - Identity *IdentityInfo `json:"identity,omitempty"` - // Sku - The Sku pricing tier for the domain. - Sku *ResourceSku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainUpdateParameters. -func (dup DomainUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dup.Tags != nil { - objectMap["tags"] = dup.Tags - } - if dup.DomainUpdateParameterProperties != nil { - objectMap["properties"] = dup.DomainUpdateParameterProperties - } - if dup.Identity != nil { - objectMap["identity"] = dup.Identity - } - if dup.Sku != nil { - objectMap["sku"] = dup.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainUpdateParameters struct. -func (dup *DomainUpdateParameters) 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 - } - dup.Tags = tags - } - case "properties": - if v != nil { - var domainUpdateParameterProperties DomainUpdateParameterProperties - err = json.Unmarshal(*v, &domainUpdateParameterProperties) - if err != nil { - return err - } - dup.DomainUpdateParameterProperties = &domainUpdateParameterProperties - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dup.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - dup.Sku = &sku - } - } - } - - return nil -} - -// EventChannel event Channel. -type EventChannel struct { - autorest.Response `json:"-"` - // EventChannelProperties - Properties of the EventChannel. - *EventChannelProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventChannel. -func (ec EventChannel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ec.EventChannelProperties != nil { - objectMap["properties"] = ec.EventChannelProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventChannel struct. -func (ec *EventChannel) 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 eventChannelProperties EventChannelProperties - err = json.Unmarshal(*v, &eventChannelProperties) - if err != nil { - return err - } - ec.EventChannelProperties = &eventChannelProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ec.Type = &typeVar - } - } - } - - return nil -} - -// EventChannelDestination properties of the destination of an event channel. -type EventChannelDestination struct { - // AzureSubscriptionID - Azure subscription ID of the customer creating the event channel. The partner topic - // associated with the event channel will be created under this Azure subscription. - AzureSubscriptionID *string `json:"azureSubscriptionId,omitempty"` - // ResourceGroup - Azure Resource Group of the customer creating the event channel. The partner topic - // associated with the event channel will be created under this resource group. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // PartnerTopicName - Name of the partner topic associated with the event channel. - PartnerTopicName *string `json:"partnerTopicName,omitempty"` -} - -// EventChannelFilter filter for the Event Channel. -type EventChannelFilter struct { - // AdvancedFilters - An array of advanced filters that are used for filtering event channels. - AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventChannelFilter struct. -func (ecf *EventChannelFilter) 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 "advancedFilters": - if v != nil { - advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) - if err != nil { - return err - } - ecf.AdvancedFilters = &advancedFilters - } - } - } - - return nil -} - -// EventChannelProperties properties of the Event Channel. -type EventChannelProperties struct { - // Source - Source of the event channel. This represents a unique resource in the partner's resource model. - Source *EventChannelSource `json:"source,omitempty"` - // Destination - Represents the destination of an event channel. - Destination *EventChannelDestination `json:"destination,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event channel. Possible values include: 'EventChannelProvisioningStateCreating', 'EventChannelProvisioningStateUpdating', 'EventChannelProvisioningStateDeleting', 'EventChannelProvisioningStateSucceeded', 'EventChannelProvisioningStateCanceled', 'EventChannelProvisioningStateFailed' - ProvisioningState EventChannelProvisioningState `json:"provisioningState,omitempty"` - // PartnerTopicReadinessState - READ-ONLY; The readiness state of the corresponding partner topic. Possible values include: 'NotActivatedByUserYet', 'ActivatedByUser', 'DeactivatedByUser', 'DeletedByUser' - PartnerTopicReadinessState PartnerTopicReadinessState `json:"partnerTopicReadinessState,omitempty"` - // ExpirationTimeIfNotActivatedUtc - Expiration time of the event channel. If this timer expires while the corresponding partner topic is never activated, - // the event channel and corresponding partner topic are deleted. - ExpirationTimeIfNotActivatedUtc *date.Time `json:"expirationTimeIfNotActivatedUtc,omitempty"` - // Filter - Information about the filter for the event channel. - Filter *EventChannelFilter `json:"filter,omitempty"` - // PartnerTopicFriendlyDescription - Friendly description about the topic. This can be set by the publisher/partner to show custom description for the customer partner topic. - // This will be helpful to remove any ambiguity of the origin of creation of the partner topic for the customer. - PartnerTopicFriendlyDescription *string `json:"partnerTopicFriendlyDescription,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventChannelProperties. -func (ecp EventChannelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ecp.Source != nil { - objectMap["source"] = ecp.Source - } - if ecp.Destination != nil { - objectMap["destination"] = ecp.Destination - } - if ecp.ExpirationTimeIfNotActivatedUtc != nil { - objectMap["expirationTimeIfNotActivatedUtc"] = ecp.ExpirationTimeIfNotActivatedUtc - } - if ecp.Filter != nil { - objectMap["filter"] = ecp.Filter - } - if ecp.PartnerTopicFriendlyDescription != nil { - objectMap["partnerTopicFriendlyDescription"] = ecp.PartnerTopicFriendlyDescription - } - return json.Marshal(objectMap) -} - -// EventChannelsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type EventChannelsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventChannelsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventChannelsDeleteFuture) 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 EventChannelsDeleteFuture.Result. -func (future *EventChannelsDeleteFuture) result(client EventChannelsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventChannelsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventChannelsListResult result of the List Event Channels operation -type EventChannelsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Event Channels - Value *[]EventChannel `json:"value,omitempty"` - // NextLink - A link for the next page of event channels - NextLink *string `json:"nextLink,omitempty"` -} - -// EventChannelsListResultIterator provides access to a complete listing of EventChannel values. -type EventChannelsListResultIterator struct { - i int - page EventChannelsListResultPage -} - -// 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 *EventChannelsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsListResultIterator.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 *EventChannelsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventChannelsListResultIterator) 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 EventChannelsListResultIterator) Response() EventChannelsListResult { - 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 EventChannelsListResultIterator) Value() EventChannel { - if !iter.page.NotDone() { - return EventChannel{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventChannelsListResultIterator type. -func NewEventChannelsListResultIterator(page EventChannelsListResultPage) EventChannelsListResultIterator { - return EventChannelsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eclr EventChannelsListResult) IsEmpty() bool { - return eclr.Value == nil || len(*eclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eclr EventChannelsListResult) hasNextLink() bool { - return eclr.NextLink != nil && len(*eclr.NextLink) != 0 -} - -// eventChannelsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eclr EventChannelsListResult) eventChannelsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eclr.NextLink))) -} - -// EventChannelsListResultPage contains a page of EventChannel values. -type EventChannelsListResultPage struct { - fn func(context.Context, EventChannelsListResult) (EventChannelsListResult, error) - eclr EventChannelsListResult -} - -// 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 *EventChannelsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsListResultPage.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.eclr) - if err != nil { - return err - } - page.eclr = 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 *EventChannelsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventChannelsListResultPage) NotDone() bool { - return !page.eclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventChannelsListResultPage) Response() EventChannelsListResult { - return page.eclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventChannelsListResultPage) Values() []EventChannel { - if page.eclr.IsEmpty() { - return nil - } - return *page.eclr.Value -} - -// Creates a new instance of the EventChannelsListResultPage type. -func NewEventChannelsListResultPage(cur EventChannelsListResult, getNextPage func(context.Context, EventChannelsListResult) (EventChannelsListResult, error)) EventChannelsListResultPage { - return EventChannelsListResultPage{ - fn: getNextPage, - eclr: cur, - } -} - -// EventChannelSource properties of the source of an event channel. -type EventChannelSource struct { - // Source - The identifier of the resource that's the source of the events. - // This represents a unique resource in the partner's resource model. - Source *string `json:"source,omitempty"` -} - -// EventHubEventSubscriptionDestination information about the event hub destination for an event -// subscription. -type EventHubEventSubscriptionDestination struct { - // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination. - *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - ehesd.EndpointType = EndpointTypeEventHub - objectMap := make(map[string]interface{}) - if ehesd.EventHubEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties - } - if ehesd.EndpointType != "" { - objectMap["endpointType"] = ehesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. -func (ehesd *EventHubEventSubscriptionDestination) 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 eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) - if err != nil { - return err - } - ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - ehesd.EndpointType = endpointType - } - } - } - - return nil -} - -// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. -type EventHubEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// EventSubscription event Subscription -type EventSubscription struct { - autorest.Response `json:"-"` - // EventSubscriptionProperties - Properties of the event subscription. - *EventSubscriptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscription. -func (es EventSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EventSubscriptionProperties != nil { - objectMap["properties"] = es.EventSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. -func (es *EventSubscription) 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 eventSubscriptionProperties EventSubscriptionProperties - err = json.Unmarshal(*v, &eventSubscriptionProperties) - if err != nil { - return err - } - es.EventSubscriptionProperties = &eventSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// BasicEventSubscriptionDestination information about the destination for an event subscription. -type BasicEventSubscriptionDestination interface { - AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) - AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) - AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) - AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) - AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) - AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) - AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) - AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) -} - -// EventSubscriptionDestination information about the destination for an event subscription. -type EventSubscriptionDestination struct { - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeWebHook): - var whesd WebHookEventSubscriptionDestination - err := json.Unmarshal(body, &whesd) - return whesd, err - case string(EndpointTypeEventHub): - var ehesd EventHubEventSubscriptionDestination - err := json.Unmarshal(body, &ehesd) - return ehesd, err - case string(EndpointTypeStorageQueue): - var sqesd StorageQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sqesd) - return sqesd, err - case string(EndpointTypeHybridConnection): - var hcesd HybridConnectionEventSubscriptionDestination - err := json.Unmarshal(body, &hcesd) - return hcesd, err - case string(EndpointTypeServiceBusQueue): - var sbqesd ServiceBusQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sbqesd) - return sbqesd, err - case string(EndpointTypeServiceBusTopic): - var sbtesd ServiceBusTopicEventSubscriptionDestination - err := json.Unmarshal(body, &sbtesd) - return sbtesd, err - case string(EndpointTypeAzureFunction): - var afesd AzureFunctionEventSubscriptionDestination - err := json.Unmarshal(body, &afesd) - return afesd, err - default: - var esd EventSubscriptionDestination - err := json.Unmarshal(body, &esd) - return esd, err - } -} -func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) - if err != nil { - return nil, err - } - esdArray[index] = esd - } - return esdArray, nil -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { - esd.EndpointType = EndpointTypeEventSubscriptionDestination - objectMap := make(map[string]interface{}) - if esd.EndpointType != "" { - objectMap["endpointType"] = esd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return &esd, true -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &esd, true -} - -// EventSubscriptionFilter filter for the Event Subscription. -type EventSubscriptionFilter struct { - // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. - // The format of this depends on the publisher of the events. - // Wildcard characters are not supported in this path. - SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` - // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. - // Wildcard characters are not supported in this path. - SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` - // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null. - IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` - // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter - // should be compared in a case sensitive manner. - IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` - // AdvancedFilters - An array of advanced filters that are used for filtering event subscriptions. - AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionFilter struct. -func (esf *EventSubscriptionFilter) 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 "subjectBeginsWith": - if v != nil { - var subjectBeginsWith string - err = json.Unmarshal(*v, &subjectBeginsWith) - if err != nil { - return err - } - esf.SubjectBeginsWith = &subjectBeginsWith - } - case "subjectEndsWith": - if v != nil { - var subjectEndsWith string - err = json.Unmarshal(*v, &subjectEndsWith) - if err != nil { - return err - } - esf.SubjectEndsWith = &subjectEndsWith - } - case "includedEventTypes": - if v != nil { - var includedEventTypes []string - err = json.Unmarshal(*v, &includedEventTypes) - if err != nil { - return err - } - esf.IncludedEventTypes = &includedEventTypes - } - case "isSubjectCaseSensitive": - if v != nil { - var isSubjectCaseSensitive bool - err = json.Unmarshal(*v, &isSubjectCaseSensitive) - if err != nil { - return err - } - esf.IsSubjectCaseSensitive = &isSubjectCaseSensitive - } - case "advancedFilters": - if v != nil { - advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) - if err != nil { - return err - } - esf.AdvancedFilters = &advancedFilters - } - } - } - - return nil -} - -// EventSubscriptionFullURL full endpoint url of an event subscription -type EventSubscriptionFullURL struct { - autorest.Response `json:"-"` - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` -} - -// EventSubscriptionIdentity the identity information with the event subscription. -type EventSubscriptionIdentity struct { - // Type - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity. Possible values include: 'SystemAssigned', 'UserAssigned' - Type EventSubscriptionIdentityType `json:"type,omitempty"` - // UserAssignedIdentity - The user identity associated with the resource. - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} - -// EventSubscriptionProperties properties of the Event Subscription. -type EventSubscriptionProperties struct { - // Topic - READ-ONLY; Name of the topic of the event subscription. - Topic *string `json:"topic,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event subscription. Possible values include: 'EventSubscriptionProvisioningStateCreating', 'EventSubscriptionProvisioningStateUpdating', 'EventSubscriptionProvisioningStateDeleting', 'EventSubscriptionProvisioningStateSucceeded', 'EventSubscriptionProvisioningStateCanceled', 'EventSubscriptionProvisioningStateFailed', 'EventSubscriptionProvisioningStateAwaitingManualAction' - ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // DeliveryWithResourceIdentity - Information about the destination where events have to be delivered for the event subscription. - // Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeliveryWithResourceIdentity *DeliveryWithResourceIdentity `json:"deliveryWithResourceIdentity,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Expiration time of the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CustomInputSchema', 'CloudEventSchemaV10' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` - // DeadLetterWithResourceIdentity - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterWithResourceIdentity *DeadLetterWithResourceIdentity `json:"deadLetterWithResourceIdentity,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionProperties. -func (esp EventSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["destination"] = esp.Destination - if esp.DeliveryWithResourceIdentity != nil { - objectMap["deliveryWithResourceIdentity"] = esp.DeliveryWithResourceIdentity - } - if esp.Filter != nil { - objectMap["filter"] = esp.Filter - } - if esp.Labels != nil { - objectMap["labels"] = esp.Labels - } - if esp.ExpirationTimeUtc != nil { - objectMap["expirationTimeUtc"] = esp.ExpirationTimeUtc - } - if esp.EventDeliverySchema != "" { - objectMap["eventDeliverySchema"] = esp.EventDeliverySchema - } - if esp.RetryPolicy != nil { - objectMap["retryPolicy"] = esp.RetryPolicy - } - objectMap["deadLetterDestination"] = esp.DeadLetterDestination - if esp.DeadLetterWithResourceIdentity != nil { - objectMap["deadLetterWithResourceIdentity"] = esp.DeadLetterWithResourceIdentity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. -func (esp *EventSubscriptionProperties) 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 "topic": - if v != nil { - var topic string - err = json.Unmarshal(*v, &topic) - if err != nil { - return err - } - esp.Topic = &topic - } - case "provisioningState": - if v != nil { - var provisioningState EventSubscriptionProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - esp.ProvisioningState = provisioningState - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esp.Destination = destination - } - case "deliveryWithResourceIdentity": - if v != nil { - var deliveryWithResourceIdentity DeliveryWithResourceIdentity - err = json.Unmarshal(*v, &deliveryWithResourceIdentity) - if err != nil { - return err - } - esp.DeliveryWithResourceIdentity = &deliveryWithResourceIdentity - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esp.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esp.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esp.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esp.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esp.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esp.DeadLetterDestination = deadLetterDestination - } - case "deadLetterWithResourceIdentity": - if v != nil { - var deadLetterWithResourceIdentity DeadLetterWithResourceIdentity - err = json.Unmarshal(*v, &deadLetterWithResourceIdentity) - if err != nil { - return err - } - esp.DeadLetterWithResourceIdentity = &deadLetterWithResourceIdentity - } - } - } - - return nil -} - -// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsCreateOrUpdateFuture) 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 EventSubscriptionsCreateOrUpdateFuture.Result. -func (future *EventSubscriptionsCreateOrUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsDeleteFuture) 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 EventSubscriptionsDeleteFuture.Result. -func (future *EventSubscriptionsDeleteFuture) result(client EventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventSubscriptionsListResult result of the List EventSubscriptions operation -type EventSubscriptionsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of EventSubscriptions - Value *[]EventSubscription `json:"value,omitempty"` - // NextLink - A link for the next page of event subscriptions - NextLink *string `json:"nextLink,omitempty"` -} - -// EventSubscriptionsListResultIterator provides access to a complete listing of EventSubscription values. -type EventSubscriptionsListResultIterator struct { - i int - page EventSubscriptionsListResultPage -} - -// 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 *EventSubscriptionsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultIterator.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 *EventSubscriptionsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventSubscriptionsListResultIterator) 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 EventSubscriptionsListResultIterator) Response() EventSubscriptionsListResult { - 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 EventSubscriptionsListResultIterator) Value() EventSubscription { - if !iter.page.NotDone() { - return EventSubscription{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventSubscriptionsListResultIterator type. -func NewEventSubscriptionsListResultIterator(page EventSubscriptionsListResultPage) EventSubscriptionsListResultIterator { - return EventSubscriptionsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eslr EventSubscriptionsListResult) IsEmpty() bool { - return eslr.Value == nil || len(*eslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eslr EventSubscriptionsListResult) hasNextLink() bool { - return eslr.NextLink != nil && len(*eslr.NextLink) != 0 -} - -// eventSubscriptionsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eslr EventSubscriptionsListResult) eventSubscriptionsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eslr.NextLink))) -} - -// EventSubscriptionsListResultPage contains a page of EventSubscription values. -type EventSubscriptionsListResultPage struct { - fn func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error) - eslr EventSubscriptionsListResult -} - -// 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 *EventSubscriptionsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultPage.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.eslr) - if err != nil { - return err - } - page.eslr = 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 *EventSubscriptionsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventSubscriptionsListResultPage) NotDone() bool { - return !page.eslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventSubscriptionsListResultPage) Response() EventSubscriptionsListResult { - return page.eslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventSubscriptionsListResultPage) Values() []EventSubscription { - if page.eslr.IsEmpty() { - return nil - } - return *page.eslr.Value -} - -// Creates a new instance of the EventSubscriptionsListResultPage type. -func NewEventSubscriptionsListResultPage(cur EventSubscriptionsListResult, getNextPage func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error)) EventSubscriptionsListResultPage { - return EventSubscriptionsListResultPage{ - fn: getNextPage, - eslr: cur, - } -} - -// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsUpdateFuture) 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 EventSubscriptionsUpdateFuture.Result. -func (future *EventSubscriptionsUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionUpdateParameters properties of the Event Subscription update. -type EventSubscriptionUpdateParameters struct { - // Destination - Information about the destination where events have to be delivered for the event subscription. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // DeliveryWithResourceIdentity - Information about the destination where events have to be delivered for the event subscription. - // Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeliveryWithResourceIdentity *DeliveryWithResourceIdentity `json:"deliveryWithResourceIdentity,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Information about the expiration time for the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CustomInputSchema', 'CloudEventSchemaV10' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` - // DeadLetterWithResourceIdentity - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterWithResourceIdentity *DeadLetterWithResourceIdentity `json:"deadLetterWithResourceIdentity,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. -func (esup *EventSubscriptionUpdateParameters) 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 "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esup.Destination = destination - } - case "deliveryWithResourceIdentity": - if v != nil { - var deliveryWithResourceIdentity DeliveryWithResourceIdentity - err = json.Unmarshal(*v, &deliveryWithResourceIdentity) - if err != nil { - return err - } - esup.DeliveryWithResourceIdentity = &deliveryWithResourceIdentity - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esup.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esup.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esup.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esup.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esup.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esup.DeadLetterDestination = deadLetterDestination - } - case "deadLetterWithResourceIdentity": - if v != nil { - var deadLetterWithResourceIdentity DeadLetterWithResourceIdentity - err = json.Unmarshal(*v, &deadLetterWithResourceIdentity) - if err != nil { - return err - } - esup.DeadLetterWithResourceIdentity = &deadLetterWithResourceIdentity - } - } - } - - return nil -} - -// EventType event Type for a subject under a topic -type EventType struct { - // EventTypeProperties - Properties of the event type. - *EventTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventType. -func (et EventType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.EventTypeProperties != nil { - objectMap["properties"] = et.EventTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventType struct. -func (et *EventType) 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 eventTypeProperties EventTypeProperties - err = json.Unmarshal(*v, &eventTypeProperties) - if err != nil { - return err - } - et.EventTypeProperties = &eventTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// EventTypeProperties properties of the event type -type EventTypeProperties struct { - // DisplayName - Display name of the event type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the event type. - Description *string `json:"description,omitempty"` - // SchemaURL - Url of the schema for this event type. - SchemaURL *string `json:"schemaUrl,omitempty"` - // IsInDefaultSet - IsInDefaultSet flag of the event type. - IsInDefaultSet *bool `json:"isInDefaultSet,omitempty"` -} - -// EventTypesListResult result of the List Event Types operation -type EventTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of event types - Value *[]EventType `json:"value,omitempty"` -} - -// ExtensionTopic event grid Extension Topic. This is used for getting Event Grid related metrics for Azure -// resources. -type ExtensionTopic struct { - autorest.Response `json:"-"` - // ExtensionTopicProperties - Properties of the extension topic - *ExtensionTopicProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtensionTopic. -func (et ExtensionTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.ExtensionTopicProperties != nil { - objectMap["properties"] = et.ExtensionTopicProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExtensionTopic struct. -func (et *ExtensionTopic) 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 extensionTopicProperties ExtensionTopicProperties - err = json.Unmarshal(*v, &extensionTopicProperties) - if err != nil { - return err - } - et.ExtensionTopicProperties = &extensionTopicProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// ExtensionTopicProperties properties of the Extension Topic -type ExtensionTopicProperties struct { - // Description - Description of the extension topic. - Description *string `json:"description,omitempty"` - // SystemTopic - System topic resource id which is mapped to the source. - SystemTopic *string `json:"systemTopic,omitempty"` -} - -// HybridConnectionEventSubscriptionDestination information about the HybridConnection destination for an -// event subscription. -type HybridConnectionEventSubscriptionDestination struct { - // HybridConnectionEventSubscriptionDestinationProperties - Hybrid connection Properties of the event subscription destination. - *HybridConnectionEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - hcesd.EndpointType = EndpointTypeHybridConnection - objectMap := make(map[string]interface{}) - if hcesd.HybridConnectionEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = hcesd.HybridConnectionEventSubscriptionDestinationProperties - } - if hcesd.EndpointType != "" { - objectMap["endpointType"] = hcesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestination struct. -func (hcesd *HybridConnectionEventSubscriptionDestination) 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 hybridConnectionEventSubscriptionDestinationProperties HybridConnectionEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &hybridConnectionEventSubscriptionDestinationProperties) - if err != nil { - return err - } - hcesd.HybridConnectionEventSubscriptionDestinationProperties = &hybridConnectionEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - hcesd.EndpointType = endpointType - } - } - } - - return nil -} - -// HybridConnectionEventSubscriptionDestinationProperties the properties for a hybrid connection -// destination. -type HybridConnectionEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of an hybrid connection that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// IdentityInfo the identity information for the resource. -type IdentityInfo struct { - // Type - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned', 'IdentityTypeSystemAssignedUserAssigned' - Type IdentityType `json:"type,omitempty"` - // PrincipalID - The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - // This property is currently not used and reserved for future usage. - UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for IdentityInfo. -func (ii IdentityInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ii.Type != "" { - objectMap["type"] = ii.Type - } - if ii.PrincipalID != nil { - objectMap["principalId"] = ii.PrincipalID - } - if ii.TenantID != nil { - objectMap["tenantId"] = ii.TenantID - } - if ii.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = ii.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// InboundIPRule ... -type InboundIPRule struct { - // IPMask - IP Address in CIDR notation e.g., 10.0.0.0/8. - IPMask *string `json:"ipMask,omitempty"` - // Action - Action to perform based on the match or no match of the IpMask. Possible values include: 'Allow' - Action IPActionType `json:"action,omitempty"` -} - -// BasicInputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported -// type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type BasicInputSchemaMapping interface { - AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) - AsInputSchemaMapping() (*InputSchemaMapping, bool) -} - -// InputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only -// supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type InputSchemaMapping struct { - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -func unmarshalBasicInputSchemaMapping(body []byte) (BasicInputSchemaMapping, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["inputSchemaMappingType"] { - case string(InputSchemaMappingTypeJSON): - var jism JSONInputSchemaMapping - err := json.Unmarshal(body, &jism) - return jism, err - default: - var ism InputSchemaMapping - err := json.Unmarshal(body, &ism) - return ism, err - } -} -func unmarshalBasicInputSchemaMappingArray(body []byte) ([]BasicInputSchemaMapping, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ismArray := make([]BasicInputSchemaMapping, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ism, err := unmarshalBasicInputSchemaMapping(*rawMessage) - if err != nil { - return nil, err - } - ismArray[index] = ism - } - return ismArray, nil -} - -// MarshalJSON is the custom marshaler for InputSchemaMapping. -func (ism InputSchemaMapping) MarshalJSON() ([]byte, error) { - ism.InputSchemaMappingType = InputSchemaMappingTypeInputSchemaMapping - objectMap := make(map[string]interface{}) - if ism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = ism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return nil, false -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return &ism, true -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &ism, true -} - -// JSONField this is used to express the source of an input schema mapping for a single target field in the -// Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and 'eventtime' -// properties. This represents a field in the input event schema. -type JSONField struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` -} - -// JSONFieldWithDefault this is used to express the source of an input schema mapping for a single target -// field -// in the Event Grid Event schema. This is currently used in the mappings for the 'subject', -// 'eventtype' and 'dataversion' properties. This represents a field in the input event schema -// along with a default value to be used, and at least one of these two properties should be provided. -type JSONFieldWithDefault struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` - // DefaultValue - The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// JSONInputSchemaMapping this enables publishing to Event Grid using a custom input schema. This can be -// used to map properties from a custom input JSON schema to the Event Grid event schema. -type JSONInputSchemaMapping struct { - // JSONInputSchemaMappingProperties - JSON Properties of the input schema mapping - *JSONInputSchemaMappingProperties `json:"properties,omitempty"` - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -// MarshalJSON is the custom marshaler for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { - jism.InputSchemaMappingType = InputSchemaMappingTypeJSON - objectMap := make(map[string]interface{}) - if jism.JSONInputSchemaMappingProperties != nil { - objectMap["properties"] = jism.JSONInputSchemaMappingProperties - } - if jism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = jism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return &jism, true -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return nil, false -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &jism, true -} - -// UnmarshalJSON is the custom unmarshaler for JSONInputSchemaMapping struct. -func (jism *JSONInputSchemaMapping) 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 JSONInputSchemaMappingProperties JSONInputSchemaMappingProperties - err = json.Unmarshal(*v, &JSONInputSchemaMappingProperties) - if err != nil { - return err - } - jism.JSONInputSchemaMappingProperties = &JSONInputSchemaMappingProperties - } - case "inputSchemaMappingType": - if v != nil { - var inputSchemaMappingType InputSchemaMappingType - err = json.Unmarshal(*v, &inputSchemaMappingType) - if err != nil { - return err - } - jism.InputSchemaMappingType = inputSchemaMappingType - } - } - } - - return nil -} - -// JSONInputSchemaMappingProperties this can be used to map properties of a source schema (or default -// values, for certain supported properties) to properties of the EventGridEvent schema. -type JSONInputSchemaMappingProperties struct { - // ID - The mapping information for the Id property of the Event Grid Event. - ID *JSONField `json:"id,omitempty"` - // Topic - The mapping information for the Topic property of the Event Grid Event. - Topic *JSONField `json:"topic,omitempty"` - // EventTime - The mapping information for the EventTime property of the Event Grid Event. - EventTime *JSONField `json:"eventTime,omitempty"` - // EventType - The mapping information for the EventType property of the Event Grid Event. - EventType *JSONFieldWithDefault `json:"eventType,omitempty"` - // Subject - The mapping information for the Subject property of the Event Grid Event. - Subject *JSONFieldWithDefault `json:"subject,omitempty"` - // DataVersion - The mapping information for the DataVersion property of the Event Grid Event. - DataVersion *JSONFieldWithDefault `json:"dataVersion,omitempty"` -} - -// NumberGreaterThanAdvancedFilter numberGreaterThan Advanced Filter. -type NumberGreaterThanAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtaf.OperatorType = OperatorTypeNumberGreaterThan - objectMap := make(map[string]interface{}) - if ngtaf.Value != nil { - objectMap["value"] = ngtaf.Value - } - if ngtaf.Key != nil { - objectMap["key"] = ngtaf.Key - } - if ngtaf.OperatorType != "" { - objectMap["operatorType"] = ngtaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return &ngtaf, true -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtaf, true -} - -// NumberGreaterThanOrEqualsAdvancedFilter numberGreaterThanOrEquals Advanced Filter. -type NumberGreaterThanOrEqualsAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtoeaf.OperatorType = OperatorTypeNumberGreaterThanOrEquals - objectMap := make(map[string]interface{}) - if ngtoeaf.Value != nil { - objectMap["value"] = ngtoeaf.Value - } - if ngtoeaf.Key != nil { - objectMap["key"] = ngtoeaf.Key - } - if ngtoeaf.OperatorType != "" { - objectMap["operatorType"] = ngtoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// NumberInAdvancedFilter numberIn Advanced Filter. -type NumberInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) MarshalJSON() ([]byte, error) { - niaf.OperatorType = OperatorTypeNumberIn - objectMap := make(map[string]interface{}) - if niaf.Values != nil { - objectMap["values"] = niaf.Values - } - if niaf.Key != nil { - objectMap["key"] = niaf.Key - } - if niaf.OperatorType != "" { - objectMap["operatorType"] = niaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return &niaf, true -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &niaf, true -} - -// NumberLessThanAdvancedFilter numberLessThan Advanced Filter. -type NumberLessThanAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) MarshalJSON() ([]byte, error) { - nltaf.OperatorType = OperatorTypeNumberLessThan - objectMap := make(map[string]interface{}) - if nltaf.Value != nil { - objectMap["value"] = nltaf.Value - } - if nltaf.Key != nil { - objectMap["key"] = nltaf.Key - } - if nltaf.OperatorType != "" { - objectMap["operatorType"] = nltaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return &nltaf, true -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltaf, true -} - -// NumberLessThanOrEqualsAdvancedFilter numberLessThanOrEquals Advanced Filter. -type NumberLessThanOrEqualsAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - nltoeaf.OperatorType = OperatorTypeNumberLessThanOrEquals - objectMap := make(map[string]interface{}) - if nltoeaf.Value != nil { - objectMap["value"] = nltoeaf.Value - } - if nltoeaf.Key != nil { - objectMap["key"] = nltoeaf.Key - } - if nltoeaf.OperatorType != "" { - objectMap["operatorType"] = nltoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return &nltoeaf, true -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltoeaf, true -} - -// NumberNotInAdvancedFilter numberNotIn Advanced Filter. -type NumberNotInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - nniaf.OperatorType = OperatorTypeNumberNotIn - objectMap := make(map[string]interface{}) - if nniaf.Values != nil { - objectMap["values"] = nniaf.Values - } - if nniaf.Key != nil { - objectMap["key"] = nniaf.Key - } - if nniaf.OperatorType != "" { - objectMap["operatorType"] = nniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return &nniaf, true -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nniaf, true -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,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"` -} - -// 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"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// PartnerNamespace eventGrid Partner Namespace. -type PartnerNamespace struct { - autorest.Response `json:"-"` - // PartnerNamespaceProperties - Properties of the partner namespace. - *PartnerNamespaceProperties `json:"properties,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerNamespace. -func (pn PartnerNamespace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pn.PartnerNamespaceProperties != nil { - objectMap["properties"] = pn.PartnerNamespaceProperties - } - if pn.Location != nil { - objectMap["location"] = pn.Location - } - if pn.Tags != nil { - objectMap["tags"] = pn.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PartnerNamespace struct. -func (pn *PartnerNamespace) 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 partnerNamespaceProperties PartnerNamespaceProperties - err = json.Unmarshal(*v, &partnerNamespaceProperties) - if err != nil { - return err - } - pn.PartnerNamespaceProperties = &partnerNamespaceProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pn.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pn.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pn.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pn.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pn.Type = &typeVar - } - } - } - - return nil -} - -// PartnerNamespaceProperties properties of the partner namespace. -type PartnerNamespaceProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the partner namespace. Possible values include: 'PartnerNamespaceProvisioningStateCreating', 'PartnerNamespaceProvisioningStateUpdating', 'PartnerNamespaceProvisioningStateDeleting', 'PartnerNamespaceProvisioningStateSucceeded', 'PartnerNamespaceProvisioningStateCanceled', 'PartnerNamespaceProvisioningStateFailed' - ProvisioningState PartnerNamespaceProvisioningState `json:"provisioningState,omitempty"` - // PartnerRegistrationFullyQualifiedID - The fully qualified ARM Id of the partner registration that should be associated with this partner namespace. This takes the following format: - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. - PartnerRegistrationFullyQualifiedID *string `json:"partnerRegistrationFullyQualifiedId,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the partner namespace. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerNamespaceProperties. -func (pnp PartnerNamespaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pnp.PartnerRegistrationFullyQualifiedID != nil { - objectMap["partnerRegistrationFullyQualifiedId"] = pnp.PartnerRegistrationFullyQualifiedID - } - return json.Marshal(objectMap) -} - -// PartnerNamespaceRegenerateKeyRequest partnerNamespace regenerate shared access key request. -type PartnerNamespaceRegenerateKeyRequest struct { - // KeyName - Key name to regenerate (key1 or key2). - KeyName *string `json:"keyName,omitempty"` -} - -// PartnerNamespacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PartnerNamespacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerNamespacesClient) (PartnerNamespace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerNamespacesCreateOrUpdateFuture) 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 PartnerNamespacesCreateOrUpdateFuture.Result. -func (future *PartnerNamespacesCreateOrUpdateFuture) result(client PartnerNamespacesClient) (pn PartnerNamespace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pn.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerNamespacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pn.Response.Response, err = future.GetResult(sender); err == nil && pn.Response.Response.StatusCode != http.StatusNoContent { - pn, err = client.CreateOrUpdateResponder(pn.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesCreateOrUpdateFuture", "Result", pn.Response.Response, "Failure responding to request") - } - } - return -} - -// PartnerNamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PartnerNamespacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerNamespacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerNamespacesDeleteFuture) 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 PartnerNamespacesDeleteFuture.Result. -func (future *PartnerNamespacesDeleteFuture) result(client PartnerNamespacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerNamespacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PartnerNamespaceSharedAccessKeys shared access keys of the partner namespace. -type PartnerNamespaceSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the partner namespace. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the partner namespace. - Key2 *string `json:"key2,omitempty"` -} - -// PartnerNamespacesListResult result of the List Partner Namespaces operation -type PartnerNamespacesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of partner namespaces. - Value *[]PartnerNamespace `json:"value,omitempty"` - // NextLink - A link for the next page of partner namespaces. - NextLink *string `json:"nextLink,omitempty"` -} - -// PartnerNamespacesListResultIterator provides access to a complete listing of PartnerNamespace values. -type PartnerNamespacesListResultIterator struct { - i int - page PartnerNamespacesListResultPage -} - -// 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 *PartnerNamespacesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesListResultIterator.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 *PartnerNamespacesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PartnerNamespacesListResultIterator) 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 PartnerNamespacesListResultIterator) Response() PartnerNamespacesListResult { - 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 PartnerNamespacesListResultIterator) Value() PartnerNamespace { - if !iter.page.NotDone() { - return PartnerNamespace{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PartnerNamespacesListResultIterator type. -func NewPartnerNamespacesListResultIterator(page PartnerNamespacesListResultPage) PartnerNamespacesListResultIterator { - return PartnerNamespacesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pnlr PartnerNamespacesListResult) IsEmpty() bool { - return pnlr.Value == nil || len(*pnlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pnlr PartnerNamespacesListResult) hasNextLink() bool { - return pnlr.NextLink != nil && len(*pnlr.NextLink) != 0 -} - -// partnerNamespacesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pnlr PartnerNamespacesListResult) partnerNamespacesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !pnlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pnlr.NextLink))) -} - -// PartnerNamespacesListResultPage contains a page of PartnerNamespace values. -type PartnerNamespacesListResultPage struct { - fn func(context.Context, PartnerNamespacesListResult) (PartnerNamespacesListResult, error) - pnlr PartnerNamespacesListResult -} - -// 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 *PartnerNamespacesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesListResultPage.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.pnlr) - if err != nil { - return err - } - page.pnlr = 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 *PartnerNamespacesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PartnerNamespacesListResultPage) NotDone() bool { - return !page.pnlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PartnerNamespacesListResultPage) Response() PartnerNamespacesListResult { - return page.pnlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PartnerNamespacesListResultPage) Values() []PartnerNamespace { - if page.pnlr.IsEmpty() { - return nil - } - return *page.pnlr.Value -} - -// Creates a new instance of the PartnerNamespacesListResultPage type. -func NewPartnerNamespacesListResultPage(cur PartnerNamespacesListResult, getNextPage func(context.Context, PartnerNamespacesListResult) (PartnerNamespacesListResult, error)) PartnerNamespacesListResultPage { - return PartnerNamespacesListResultPage{ - fn: getNextPage, - pnlr: cur, - } -} - -// PartnerNamespacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PartnerNamespacesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerNamespacesClient) (PartnerNamespace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerNamespacesUpdateFuture) 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 PartnerNamespacesUpdateFuture.Result. -func (future *PartnerNamespacesUpdateFuture) result(client PartnerNamespacesClient) (pn PartnerNamespace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pn.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerNamespacesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pn.Response.Response, err = future.GetResult(sender); err == nil && pn.Response.Response.StatusCode != http.StatusNoContent { - pn, err = client.UpdateResponder(pn.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesUpdateFuture", "Result", pn.Response.Response, "Failure responding to request") - } - } - return -} - -// PartnerNamespaceUpdateParameters properties of the PartnerNamespace update. -type PartnerNamespaceUpdateParameters struct { - // Tags - Tags of the partner namespace. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PartnerNamespaceUpdateParameters. -func (pnup PartnerNamespaceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pnup.Tags != nil { - objectMap["tags"] = pnup.Tags - } - return json.Marshal(objectMap) -} - -// PartnerRegistration information about a partner registration. -type PartnerRegistration struct { - autorest.Response `json:"-"` - // PartnerRegistrationProperties - Properties of the partner registration. - *PartnerRegistrationProperties `json:"properties,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerRegistration. -func (pr PartnerRegistration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.PartnerRegistrationProperties != nil { - objectMap["properties"] = pr.PartnerRegistrationProperties - } - if pr.Location != nil { - objectMap["location"] = pr.Location - } - if pr.Tags != nil { - objectMap["tags"] = pr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PartnerRegistration struct. -func (pr *PartnerRegistration) 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 partnerRegistrationProperties PartnerRegistrationProperties - err = json.Unmarshal(*v, &partnerRegistrationProperties) - if err != nil { - return err - } - pr.PartnerRegistrationProperties = &partnerRegistrationProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pr.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pr.Type = &typeVar - } - } - } - - return nil -} - -// PartnerRegistrationEventTypesListResult result of the List Partner Registration Event Types operation. -type PartnerRegistrationEventTypesListResult struct { - // Value - A collection of partner registration event types. - Value *[]EventType `json:"value,omitempty"` - // NextLink - A link for the next page of partner registration event types. - NextLink *string `json:"nextLink,omitempty"` -} - -// PartnerRegistrationProperties properties of the partner registration. -type PartnerRegistrationProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the partner registration. Possible values include: 'PartnerRegistrationProvisioningStateCreating', 'PartnerRegistrationProvisioningStateUpdating', 'PartnerRegistrationProvisioningStateDeleting', 'PartnerRegistrationProvisioningStateSucceeded', 'PartnerRegistrationProvisioningStateCanceled', 'PartnerRegistrationProvisioningStateFailed' - ProvisioningState PartnerRegistrationProvisioningState `json:"provisioningState,omitempty"` - // PartnerName - Official name of the partner name. For example: "Contoso". - PartnerName *string `json:"partnerName,omitempty"` - // PartnerResourceTypeName - Name of the partner resource type. - PartnerResourceTypeName *string `json:"partnerResourceTypeName,omitempty"` - // PartnerResourceTypeDisplayName - Display name of the partner resource type. - PartnerResourceTypeDisplayName *string `json:"partnerResourceTypeDisplayName,omitempty"` - // PartnerResourceTypeDescription - Short description of the partner resource type. The length of this description should not exceed 256 characters. - PartnerResourceTypeDescription *string `json:"partnerResourceTypeDescription,omitempty"` - // LongDescription - Long description for the custom scenarios and integration to be displayed in the portal if needed. - // Length of this description should not exceed 2048 characters. - LongDescription *string `json:"longDescription,omitempty"` - // PartnerCustomerServiceNumber - The customer service number of the publisher. The expected phone format should start with a '+' sign - // followed by the country code. The remaining digits are then followed. Only digits and spaces are allowed and its - // length cannot exceed 16 digits including country code. Examples of valid phone numbers are: +1 515 123 4567 and - // +966 7 5115 2471. Examples of invalid phone numbers are: +1 (515) 123-4567, 1 515 123 4567 and +966 121 5115 24 7 551 1234 43 - PartnerCustomerServiceNumber *string `json:"partnerCustomerServiceNumber,omitempty"` - // PartnerCustomerServiceExtension - The extension of the customer service number of the publisher. Only digits are allowed and number of digits should not exceed 10. - PartnerCustomerServiceExtension *string `json:"partnerCustomerServiceExtension,omitempty"` - // CustomerServiceURI - The extension of the customer service URI of the publisher. - CustomerServiceURI *string `json:"customerServiceUri,omitempty"` - // SetupURI - URI of the partner website that can be used by Azure customers to setup Event Grid - // integration on an event source. - SetupURI *string `json:"setupUri,omitempty"` - // LogoURI - URI of the logo. - LogoURI *string `json:"logoUri,omitempty"` - // VisibilityState - Visibility state of the partner registration. Possible values include: 'Hidden', 'PublicPreview', 'GenerallyAvailable' - VisibilityState PartnerRegistrationVisibilityState `json:"visibilityState,omitempty"` - // AuthorizedAzureSubscriptionIds - List of Azure subscription Ids that are authorized to create a partner namespace - // associated with this partner registration. This is an optional property. Creating - // partner namespaces is always permitted under the same Azure subscription as the one used - // for creating the partner registration. - AuthorizedAzureSubscriptionIds *[]string `json:"authorizedAzureSubscriptionIds,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerRegistrationProperties. -func (prp PartnerRegistrationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prp.PartnerName != nil { - objectMap["partnerName"] = prp.PartnerName - } - if prp.PartnerResourceTypeName != nil { - objectMap["partnerResourceTypeName"] = prp.PartnerResourceTypeName - } - if prp.PartnerResourceTypeDisplayName != nil { - objectMap["partnerResourceTypeDisplayName"] = prp.PartnerResourceTypeDisplayName - } - if prp.PartnerResourceTypeDescription != nil { - objectMap["partnerResourceTypeDescription"] = prp.PartnerResourceTypeDescription - } - if prp.LongDescription != nil { - objectMap["longDescription"] = prp.LongDescription - } - if prp.PartnerCustomerServiceNumber != nil { - objectMap["partnerCustomerServiceNumber"] = prp.PartnerCustomerServiceNumber - } - if prp.PartnerCustomerServiceExtension != nil { - objectMap["partnerCustomerServiceExtension"] = prp.PartnerCustomerServiceExtension - } - if prp.CustomerServiceURI != nil { - objectMap["customerServiceUri"] = prp.CustomerServiceURI - } - if prp.SetupURI != nil { - objectMap["setupUri"] = prp.SetupURI - } - if prp.LogoURI != nil { - objectMap["logoUri"] = prp.LogoURI - } - if prp.VisibilityState != "" { - objectMap["visibilityState"] = prp.VisibilityState - } - if prp.AuthorizedAzureSubscriptionIds != nil { - objectMap["authorizedAzureSubscriptionIds"] = prp.AuthorizedAzureSubscriptionIds - } - return json.Marshal(objectMap) -} - -// PartnerRegistrationsListResult result of the List Partner Registrations operation. -type PartnerRegistrationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of partner registrations. - Value *[]PartnerRegistration `json:"value,omitempty"` - // NextLink - A link for the next page of partner registrations. - NextLink *string `json:"nextLink,omitempty"` -} - -// PartnerRegistrationsListResultIterator provides access to a complete listing of PartnerRegistration -// values. -type PartnerRegistrationsListResultIterator struct { - i int - page PartnerRegistrationsListResultPage -} - -// 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 *PartnerRegistrationsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsListResultIterator.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 *PartnerRegistrationsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PartnerRegistrationsListResultIterator) 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 PartnerRegistrationsListResultIterator) Response() PartnerRegistrationsListResult { - 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 PartnerRegistrationsListResultIterator) Value() PartnerRegistration { - if !iter.page.NotDone() { - return PartnerRegistration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PartnerRegistrationsListResultIterator type. -func NewPartnerRegistrationsListResultIterator(page PartnerRegistrationsListResultPage) PartnerRegistrationsListResultIterator { - return PartnerRegistrationsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (prlr PartnerRegistrationsListResult) IsEmpty() bool { - return prlr.Value == nil || len(*prlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (prlr PartnerRegistrationsListResult) hasNextLink() bool { - return prlr.NextLink != nil && len(*prlr.NextLink) != 0 -} - -// partnerRegistrationsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (prlr PartnerRegistrationsListResult) partnerRegistrationsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !prlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(prlr.NextLink))) -} - -// PartnerRegistrationsListResultPage contains a page of PartnerRegistration values. -type PartnerRegistrationsListResultPage struct { - fn func(context.Context, PartnerRegistrationsListResult) (PartnerRegistrationsListResult, error) - prlr PartnerRegistrationsListResult -} - -// 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 *PartnerRegistrationsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsListResultPage.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.prlr) - if err != nil { - return err - } - page.prlr = 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 *PartnerRegistrationsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PartnerRegistrationsListResultPage) NotDone() bool { - return !page.prlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PartnerRegistrationsListResultPage) Response() PartnerRegistrationsListResult { - return page.prlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PartnerRegistrationsListResultPage) Values() []PartnerRegistration { - if page.prlr.IsEmpty() { - return nil - } - return *page.prlr.Value -} - -// Creates a new instance of the PartnerRegistrationsListResultPage type. -func NewPartnerRegistrationsListResultPage(cur PartnerRegistrationsListResult, getNextPage func(context.Context, PartnerRegistrationsListResult) (PartnerRegistrationsListResult, error)) PartnerRegistrationsListResultPage { - return PartnerRegistrationsListResultPage{ - fn: getNextPage, - prlr: cur, - } -} - -// PartnerRegistrationUpdateParameters properties of the Partner Registration update. -type PartnerRegistrationUpdateParameters struct { - // Tags - Tags of the partner registration resource. - Tags map[string]*string `json:"tags"` - // PartnerTopicTypeName - Name of the partner topic type. - PartnerTopicTypeName *string `json:"partnerTopicTypeName,omitempty"` - // PartnerTopicTypeDisplayName - Display name of the partner topic type. - PartnerTopicTypeDisplayName *string `json:"partnerTopicTypeDisplayName,omitempty"` - // PartnerTopicTypeDescription - Description of the partner topic type. - PartnerTopicTypeDescription *string `json:"partnerTopicTypeDescription,omitempty"` - // SetupURI - URI of the partner website that can be used by Azure customers to setup Event Grid - // integration on an event source. - SetupURI *string `json:"setupUri,omitempty"` - // LogoURI - URI of the partner logo. - LogoURI *string `json:"logoUri,omitempty"` - // AuthorizedAzureSubscriptionIds - List of IDs of Azure AD applications that are authorized to create a partner namespace - // associated with this partner registration. This is an optional property. Creating - // partner namespaces is always permitted under the same Azure subscription as the one used - // for creating the partner registration. - AuthorizedAzureSubscriptionIds *[]string `json:"authorizedAzureSubscriptionIds,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerRegistrationUpdateParameters. -func (prup PartnerRegistrationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prup.Tags != nil { - objectMap["tags"] = prup.Tags - } - if prup.PartnerTopicTypeName != nil { - objectMap["partnerTopicTypeName"] = prup.PartnerTopicTypeName - } - if prup.PartnerTopicTypeDisplayName != nil { - objectMap["partnerTopicTypeDisplayName"] = prup.PartnerTopicTypeDisplayName - } - if prup.PartnerTopicTypeDescription != nil { - objectMap["partnerTopicTypeDescription"] = prup.PartnerTopicTypeDescription - } - if prup.SetupURI != nil { - objectMap["setupUri"] = prup.SetupURI - } - if prup.LogoURI != nil { - objectMap["logoUri"] = prup.LogoURI - } - if prup.AuthorizedAzureSubscriptionIds != nil { - objectMap["authorizedAzureSubscriptionIds"] = prup.AuthorizedAzureSubscriptionIds - } - return json.Marshal(objectMap) -} - -// PartnerTopic eventGrid Partner Topic. -type PartnerTopic struct { - autorest.Response `json:"-"` - // PartnerTopicProperties - Properties of the partner topic. - *PartnerTopicProperties `json:"properties,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerTopic. -func (pt PartnerTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pt.PartnerTopicProperties != nil { - objectMap["properties"] = pt.PartnerTopicProperties - } - if pt.Location != nil { - objectMap["location"] = pt.Location - } - if pt.Tags != nil { - objectMap["tags"] = pt.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PartnerTopic struct. -func (pt *PartnerTopic) 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 partnerTopicProperties PartnerTopicProperties - err = json.Unmarshal(*v, &partnerTopicProperties) - if err != nil { - return err - } - pt.PartnerTopicProperties = &partnerTopicProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pt.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pt.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pt.Type = &typeVar - } - } - } - - return nil -} - -// PartnerTopicEventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type PartnerTopicEventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerTopicEventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerTopicEventSubscriptionsCreateOrUpdateFuture) 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 PartnerTopicEventSubscriptionsCreateOrUpdateFuture.Result. -func (future *PartnerTopicEventSubscriptionsCreateOrUpdateFuture) result(client PartnerTopicEventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// PartnerTopicEventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PartnerTopicEventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerTopicEventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerTopicEventSubscriptionsDeleteFuture) 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 PartnerTopicEventSubscriptionsDeleteFuture.Result. -func (future *PartnerTopicEventSubscriptionsDeleteFuture) result(client PartnerTopicEventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicEventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PartnerTopicEventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PartnerTopicEventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerTopicEventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerTopicEventSubscriptionsUpdateFuture) 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 PartnerTopicEventSubscriptionsUpdateFuture.Result. -func (future *PartnerTopicEventSubscriptionsUpdateFuture) result(client PartnerTopicEventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicEventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// PartnerTopicProperties properties of the Partner Topic. -type PartnerTopicProperties struct { - // Source - Source associated with this partner topic. This represents a unique partner resource. - Source *string `json:"source,omitempty"` - // ExpirationTimeIfNotActivatedUtc - Expiration time of the partner topic. If this timer expires while the partner topic is still never activated, - // the partner topic and corresponding event channel are deleted. - ExpirationTimeIfNotActivatedUtc *date.Time `json:"expirationTimeIfNotActivatedUtc,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the partner topic. Possible values include: 'PartnerTopicProvisioningStateCreating', 'PartnerTopicProvisioningStateUpdating', 'PartnerTopicProvisioningStateDeleting', 'PartnerTopicProvisioningStateSucceeded', 'PartnerTopicProvisioningStateCanceled', 'PartnerTopicProvisioningStateFailed' - ProvisioningState PartnerTopicProvisioningState `json:"provisioningState,omitempty"` - // ActivationState - Activation state of the partner topic. Possible values include: 'NeverActivated', 'Activated', 'Deactivated' - ActivationState PartnerTopicActivationState `json:"activationState,omitempty"` - // PartnerTopicFriendlyDescription - Friendly description about the topic. This can be set by the publisher/partner to show custom description for the customer partner topic. - // This will be helpful to remove any ambiguity of the origin of creation of the partner topic for the customer. - PartnerTopicFriendlyDescription *string `json:"partnerTopicFriendlyDescription,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerTopicProperties. -func (ptp PartnerTopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptp.Source != nil { - objectMap["source"] = ptp.Source - } - if ptp.ExpirationTimeIfNotActivatedUtc != nil { - objectMap["expirationTimeIfNotActivatedUtc"] = ptp.ExpirationTimeIfNotActivatedUtc - } - if ptp.ActivationState != "" { - objectMap["activationState"] = ptp.ActivationState - } - if ptp.PartnerTopicFriendlyDescription != nil { - objectMap["partnerTopicFriendlyDescription"] = ptp.PartnerTopicFriendlyDescription - } - return json.Marshal(objectMap) -} - -// PartnerTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PartnerTopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerTopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerTopicsDeleteFuture) 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 PartnerTopicsDeleteFuture.Result. -func (future *PartnerTopicsDeleteFuture) result(client PartnerTopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PartnerTopicsListResult result of the List Partner Topics operation. -type PartnerTopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of partner topics. - Value *[]PartnerTopic `json:"value,omitempty"` - // NextLink - A link for the next page of partner topics. - NextLink *string `json:"nextLink,omitempty"` -} - -// PartnerTopicsListResultIterator provides access to a complete listing of PartnerTopic values. -type PartnerTopicsListResultIterator struct { - i int - page PartnerTopicsListResultPage -} - -// 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 *PartnerTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsListResultIterator.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 *PartnerTopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PartnerTopicsListResultIterator) 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 PartnerTopicsListResultIterator) Response() PartnerTopicsListResult { - 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 PartnerTopicsListResultIterator) Value() PartnerTopic { - if !iter.page.NotDone() { - return PartnerTopic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PartnerTopicsListResultIterator type. -func NewPartnerTopicsListResultIterator(page PartnerTopicsListResultPage) PartnerTopicsListResultIterator { - return PartnerTopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ptlr PartnerTopicsListResult) IsEmpty() bool { - return ptlr.Value == nil || len(*ptlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ptlr PartnerTopicsListResult) hasNextLink() bool { - return ptlr.NextLink != nil && len(*ptlr.NextLink) != 0 -} - -// partnerTopicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ptlr PartnerTopicsListResult) partnerTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ptlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ptlr.NextLink))) -} - -// PartnerTopicsListResultPage contains a page of PartnerTopic values. -type PartnerTopicsListResultPage struct { - fn func(context.Context, PartnerTopicsListResult) (PartnerTopicsListResult, error) - ptlr PartnerTopicsListResult -} - -// 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 *PartnerTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsListResultPage.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.ptlr) - if err != nil { - return err - } - page.ptlr = 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 *PartnerTopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PartnerTopicsListResultPage) NotDone() bool { - return !page.ptlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PartnerTopicsListResultPage) Response() PartnerTopicsListResult { - return page.ptlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PartnerTopicsListResultPage) Values() []PartnerTopic { - if page.ptlr.IsEmpty() { - return nil - } - return *page.ptlr.Value -} - -// Creates a new instance of the PartnerTopicsListResultPage type. -func NewPartnerTopicsListResultPage(cur PartnerTopicsListResult, getNextPage func(context.Context, PartnerTopicsListResult) (PartnerTopicsListResult, error)) PartnerTopicsListResultPage { - return PartnerTopicsListResultPage{ - fn: getNextPage, - ptlr: cur, - } -} - -// PartnerTopicType properties of a partner topic type. -type PartnerTopicType struct { - // PartnerTopicTypeProperties - Properties of the partner topic type. - *PartnerTopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerTopicType. -func (ptt PartnerTopicType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptt.PartnerTopicTypeProperties != nil { - objectMap["properties"] = ptt.PartnerTopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PartnerTopicType struct. -func (ptt *PartnerTopicType) 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 partnerTopicTypeProperties PartnerTopicTypeProperties - err = json.Unmarshal(*v, &partnerTopicTypeProperties) - if err != nil { - return err - } - ptt.PartnerTopicTypeProperties = &partnerTopicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ptt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ptt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ptt.Type = &typeVar - } - } - } - - return nil -} - -// PartnerTopicTypeProperties properties of a partner topic type. -type PartnerTopicTypeProperties struct { - // PartnerName - Official name of the partner. - PartnerName *string `json:"partnerName,omitempty"` - // TopicTypeName - Name of the partner topic type. This name should be unique among all partner topic types names. - TopicTypeName *string `json:"topicTypeName,omitempty"` - // DisplayName - Display Name for the partner topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the partner topic type. - Description *string `json:"description,omitempty"` - // SetupURI - URI of the partner website that can be used by Azure customers to setup Event Grid - // integration on an event source. - SetupURI *string `json:"setupUri,omitempty"` - // AuthorizationState - Status of whether the customer has authorized a partner to create partner topics - // in the customer's subscription. Possible values include: 'NotApplicable', 'NotAuthorized', 'Authorized' - AuthorizationState PartnerTopicTypeAuthorizationState `json:"authorizationState,omitempty"` -} - -// PartnerTopicTypesListResult result of the List Partner Topic Types operation. -type PartnerTopicTypesListResult struct { - // Value - A collection of partner topic types. - Value *[]PartnerTopicType `json:"value,omitempty"` -} - -// PartnerTopicUpdateParameters properties of the Partner Topic update. -type PartnerTopicUpdateParameters struct { - // Tags - Tags of the partner topic. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PartnerTopicUpdateParameters. -func (ptup PartnerTopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptup.Tags != nil { - objectMap["tags"] = ptup.Tags - } - return json.Marshal(objectMap) -} - -// PrivateEndpoint privateEndpoint information. -type PrivateEndpoint struct { - // ID - The ARM identifier for Private Endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateEndpointConnection ... -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult result of the list of all private endpoint connections operation. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - A collection of private endpoint connection resources. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - A link for the next page of private endpoint connection resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) - if err != nil { - return err - } - page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of the private endpoint connection resource. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The Private Endpoint resource for this Connection. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // GroupIds - GroupIds from the private link service resource. - GroupIds *[]string `json:"groupIds,omitempty"` - // PrivateLinkServiceConnectionState - Details about the state of the connection. - PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - Provisioning state of the Private Endpoint Connection. Possible values include: 'ResourceProvisioningStateCreating', 'ResourceProvisioningStateUpdating', 'ResourceProvisioningStateDeleting', 'ResourceProvisioningStateSucceeded', 'ResourceProvisioningStateCanceled', 'ResourceProvisioningStateFailed' - ProvisioningState ResourceProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsUpdateFuture) 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 PrivateEndpointConnectionsUpdateFuture.Result. -func (future *PrivateEndpointConnectionsUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PrivateEndpointConnectionsUpdateFuture") - 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, "eventgrid.PrivateEndpointConnectionsUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkResource information of the private link resource. -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Properties of the private link resource. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - Name of the resource - Name *string `json:"name,omitempty"` - // Type - Type of the resource - Type *string `json:"type,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 - } - if plr.ID != nil { - objectMap["id"] = plr.ID - } - if plr.Name != nil { - objectMap["name"] = plr.Name - } - if plr.Type != nil { - objectMap["type"] = plr.Type - } - 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 - } - } - } - - return nil -} - -// PrivateLinkResourceProperties ... -type PrivateLinkResourceProperties struct { - GroupID *string `json:"groupId,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// PrivateLinkResourcesListResult result of the List private link resources operation. -type PrivateLinkResourcesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - A link for the next page of private link resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateLinkResourcesListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourcesListResultIterator struct { - i int - page PrivateLinkResourcesListResultPage -} - -// 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 *PrivateLinkResourcesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListResultIterator.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 *PrivateLinkResourcesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourcesListResultIterator) 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 PrivateLinkResourcesListResultIterator) Response() PrivateLinkResourcesListResult { - 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 PrivateLinkResourcesListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourcesListResultIterator type. -func NewPrivateLinkResourcesListResultIterator(page PrivateLinkResourcesListResultPage) PrivateLinkResourcesListResultIterator { - return PrivateLinkResourcesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourcesListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourcesListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourcesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourcesListResult) privateLinkResourcesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourcesListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourcesListResultPage struct { - fn func(context.Context, PrivateLinkResourcesListResult) (PrivateLinkResourcesListResult, error) - plrlr PrivateLinkResourcesListResult -} - -// 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 *PrivateLinkResourcesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourcesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourcesListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourcesListResultPage) Response() PrivateLinkResourcesListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourcesListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourcesListResultPage type. -func NewPrivateLinkResourcesListResultPage(cur PrivateLinkResourcesListResult, getNextPage func(context.Context, PrivateLinkResourcesListResult) (PrivateLinkResourcesListResult, error)) PrivateLinkResourcesListResultPage { - return PrivateLinkResourcesListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// Resource definition of a Resource -type Resource struct { - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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) -} - -// ResourceSku describes an EventGrid Resource Sku. -type ResourceSku struct { - // Name - The Sku name of the resource. The possible values are: Basic or Premium. Possible values include: 'Basic', 'Premium' - Name Sku `json:"name,omitempty"` -} - -// RetryPolicy information about the retry policy for an event subscription. -type RetryPolicy struct { - // MaxDeliveryAttempts - Maximum number of delivery retry attempts for events. - MaxDeliveryAttempts *int32 `json:"maxDeliveryAttempts,omitempty"` - // EventTimeToLiveInMinutes - Time To Live (in minutes) for events. - EventTimeToLiveInMinutes *int32 `json:"eventTimeToLiveInMinutes,omitempty"` -} - -// ServiceBusQueueEventSubscriptionDestination information about the service bus destination for an event -// subscription. -type ServiceBusQueueEventSubscriptionDestination struct { - // ServiceBusQueueEventSubscriptionDestinationProperties - Service Bus Properties of the event subscription destination. - *ServiceBusQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sbqesd.EndpointType = EndpointTypeServiceBusQueue - objectMap := make(map[string]interface{}) - if sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties - } - if sbqesd.EndpointType != "" { - objectMap["endpointType"] = sbqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return &sbqesd, true -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sbqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceBusQueueEventSubscriptionDestination struct. -func (sbqesd *ServiceBusQueueEventSubscriptionDestination) 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 serviceBusQueueEventSubscriptionDestinationProperties ServiceBusQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &serviceBusQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties = &serviceBusQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// ServiceBusQueueEventSubscriptionDestinationProperties the properties that represent the Service Bus -// destination of an event subscription. -type ServiceBusQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Service Bus destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// ServiceBusTopicEventSubscriptionDestination information about the service bus topic destination for an -// event subscription. -type ServiceBusTopicEventSubscriptionDestination struct { - // ServiceBusTopicEventSubscriptionDestinationProperties - Service Bus Topic Properties of the event subscription destination. - *ServiceBusTopicEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sbtesd.EndpointType = EndpointTypeServiceBusTopic - objectMap := make(map[string]interface{}) - if sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties - } - if sbtesd.EndpointType != "" { - objectMap["endpointType"] = sbtesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return &sbtesd, true -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sbtesd, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceBusTopicEventSubscriptionDestination struct. -func (sbtesd *ServiceBusTopicEventSubscriptionDestination) 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 serviceBusTopicEventSubscriptionDestinationProperties ServiceBusTopicEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &serviceBusTopicEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties = &serviceBusTopicEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbtesd.EndpointType = endpointType - } - } - } - - return nil -} - -// ServiceBusTopicEventSubscriptionDestinationProperties the properties that represent the Service Bus -// Topic destination of an event subscription. -type ServiceBusTopicEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Service Bus Topic destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// StorageBlobDeadLetterDestination information about the storage blob based dead letter destination. -type StorageBlobDeadLetterDestination struct { - // StorageBlobDeadLetterDestinationProperties - The properties of the Storage Blob based deadletter destination - *StorageBlobDeadLetterDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { - sbdld.EndpointType = EndpointTypeStorageBlob - objectMap := make(map[string]interface{}) - if sbdld.StorageBlobDeadLetterDestinationProperties != nil { - objectMap["properties"] = sbdld.StorageBlobDeadLetterDestinationProperties - } - if sbdld.EndpointType != "" { - objectMap["endpointType"] = sbdld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return &sbdld, true -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return nil, false -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &sbdld, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageBlobDeadLetterDestination struct. -func (sbdld *StorageBlobDeadLetterDestination) 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 storageBlobDeadLetterDestinationProperties StorageBlobDeadLetterDestinationProperties - err = json.Unmarshal(*v, &storageBlobDeadLetterDestinationProperties) - if err != nil { - return err - } - sbdld.StorageBlobDeadLetterDestinationProperties = &storageBlobDeadLetterDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointTypeBasicDeadLetterDestination - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbdld.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageBlobDeadLetterDestinationProperties properties of the storage blob based dead letter destination. -type StorageBlobDeadLetterDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that is the destination of the deadletter events - ResourceID *string `json:"resourceId,omitempty"` - // BlobContainerName - The name of the Storage blob container that is the destination of the deadletter events - BlobContainerName *string `json:"blobContainerName,omitempty"` -} - -// StorageQueueEventSubscriptionDestination information about the storage queue destination for an event -// subscription. -type StorageQueueEventSubscriptionDestination struct { - // StorageQueueEventSubscriptionDestinationProperties - Storage Queue Properties of the event subscription destination. - *StorageQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sqesd.EndpointType = EndpointTypeStorageQueue - objectMap := make(map[string]interface{}) - if sqesd.StorageQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sqesd.StorageQueueEventSubscriptionDestinationProperties - } - if sqesd.EndpointType != "" { - objectMap["endpointType"] = sqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageQueueEventSubscriptionDestination struct. -func (sqesd *StorageQueueEventSubscriptionDestination) 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 storageQueueEventSubscriptionDestinationProperties StorageQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &storageQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sqesd.StorageQueueEventSubscriptionDestinationProperties = &storageQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageQueueEventSubscriptionDestinationProperties the properties for a storage queue destination. -type StorageQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // QueueName - The name of the Storage queue under a storage account that is the destination of an event subscription. - QueueName *string `json:"queueName,omitempty"` -} - -// StringBeginsWithAdvancedFilter stringBeginsWith Advanced Filter. -type StringBeginsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sbwaf.OperatorType = OperatorTypeStringBeginsWith - objectMap := make(map[string]interface{}) - if sbwaf.Values != nil { - objectMap["values"] = sbwaf.Values - } - if sbwaf.Key != nil { - objectMap["key"] = sbwaf.Key - } - if sbwaf.OperatorType != "" { - objectMap["operatorType"] = sbwaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return &sbwaf, true -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sbwaf, true -} - -// StringContainsAdvancedFilter stringContains Advanced Filter. -type StringContainsAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) MarshalJSON() ([]byte, error) { - scaf.OperatorType = OperatorTypeStringContains - objectMap := make(map[string]interface{}) - if scaf.Values != nil { - objectMap["values"] = scaf.Values - } - if scaf.Key != nil { - objectMap["key"] = scaf.Key - } - if scaf.OperatorType != "" { - objectMap["operatorType"] = scaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return &scaf, true -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &scaf, true -} - -// StringEndsWithAdvancedFilter stringEndsWith Advanced Filter. -type StringEndsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sewaf.OperatorType = OperatorTypeStringEndsWith - objectMap := make(map[string]interface{}) - if sewaf.Values != nil { - objectMap["values"] = sewaf.Values - } - if sewaf.Key != nil { - objectMap["key"] = sewaf.Key - } - if sewaf.OperatorType != "" { - objectMap["operatorType"] = sewaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return &sewaf, true -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sewaf, true -} - -// StringInAdvancedFilter stringIn Advanced Filter. -type StringInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) MarshalJSON() ([]byte, error) { - siaf.OperatorType = OperatorTypeStringIn - objectMap := make(map[string]interface{}) - if siaf.Values != nil { - objectMap["values"] = siaf.Values - } - if siaf.Key != nil { - objectMap["key"] = siaf.Key - } - if siaf.OperatorType != "" { - objectMap["operatorType"] = siaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return &siaf, true -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &siaf, true -} - -// StringNotInAdvancedFilter stringNotIn Advanced Filter. -type StringNotInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - sniaf.OperatorType = OperatorTypeStringNotIn - objectMap := make(map[string]interface{}) - if sniaf.Values != nil { - objectMap["values"] = sniaf.Values - } - if sniaf.Key != nil { - objectMap["key"] = sniaf.Key - } - if sniaf.OperatorType != "" { - objectMap["operatorType"] = sniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return &sniaf, true -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sniaf, true -} - -// SystemTopic eventGrid System Topic. -type SystemTopic struct { - autorest.Response `json:"-"` - // SystemTopicProperties - Properties of the system topic. - *SystemTopicProperties `json:"properties,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SystemTopic. -func (st SystemTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if st.SystemTopicProperties != nil { - objectMap["properties"] = st.SystemTopicProperties - } - if st.Location != nil { - objectMap["location"] = st.Location - } - if st.Tags != nil { - objectMap["tags"] = st.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SystemTopic struct. -func (st *SystemTopic) 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 systemTopicProperties SystemTopicProperties - err = json.Unmarshal(*v, &systemTopicProperties) - if err != nil { - return err - } - st.SystemTopicProperties = &systemTopicProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - st.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - st.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - st.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - st.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - st.Type = &typeVar - } - } - } - - return nil -} - -// SystemTopicEventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SystemTopicEventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicEventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicEventSubscriptionsCreateOrUpdateFuture) 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 SystemTopicEventSubscriptionsCreateOrUpdateFuture.Result. -func (future *SystemTopicEventSubscriptionsCreateOrUpdateFuture) result(client SystemTopicEventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemTopicEventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SystemTopicEventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicEventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicEventSubscriptionsDeleteFuture) 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 SystemTopicEventSubscriptionsDeleteFuture.Result. -func (future *SystemTopicEventSubscriptionsDeleteFuture) result(client SystemTopicEventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicEventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SystemTopicEventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SystemTopicEventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicEventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicEventSubscriptionsUpdateFuture) 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 SystemTopicEventSubscriptionsUpdateFuture.Result. -func (future *SystemTopicEventSubscriptionsUpdateFuture) result(client SystemTopicEventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicEventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemTopicProperties properties of the System Topic. -type SystemTopicProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the system topic. Possible values include: 'ResourceProvisioningStateCreating', 'ResourceProvisioningStateUpdating', 'ResourceProvisioningStateDeleting', 'ResourceProvisioningStateSucceeded', 'ResourceProvisioningStateCanceled', 'ResourceProvisioningStateFailed' - ProvisioningState ResourceProvisioningState `json:"provisioningState,omitempty"` - // Source - Source for the system topic. - Source *string `json:"source,omitempty"` - // TopicType - TopicType for the system topic. - TopicType *string `json:"topicType,omitempty"` - // MetricResourceID - READ-ONLY; Metric resource id for the system topic. - MetricResourceID *string `json:"metricResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for SystemTopicProperties. -func (stp SystemTopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stp.Source != nil { - objectMap["source"] = stp.Source - } - if stp.TopicType != nil { - objectMap["topicType"] = stp.TopicType - } - return json.Marshal(objectMap) -} - -// SystemTopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SystemTopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicsClient) (SystemTopic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicsCreateOrUpdateFuture) 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 SystemTopicsCreateOrUpdateFuture.Result. -func (future *SystemTopicsCreateOrUpdateFuture) result(client SystemTopicsClient) (st SystemTopic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - st.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicsCreateOrUpdateFuture") - 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, "eventgrid.SystemTopicsCreateOrUpdateFuture", "Result", st.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SystemTopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicsDeleteFuture) 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 SystemTopicsDeleteFuture.Result. -func (future *SystemTopicsDeleteFuture) result(client SystemTopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SystemTopicsListResult result of the List System topics operation. -type SystemTopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of system Topics. - Value *[]SystemTopic `json:"value,omitempty"` - // NextLink - A link for the next page of topics. - NextLink *string `json:"nextLink,omitempty"` -} - -// SystemTopicsListResultIterator provides access to a complete listing of SystemTopic values. -type SystemTopicsListResultIterator struct { - i int - page SystemTopicsListResultPage -} - -// 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 *SystemTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsListResultIterator.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 *SystemTopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SystemTopicsListResultIterator) 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 SystemTopicsListResultIterator) Response() SystemTopicsListResult { - 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 SystemTopicsListResultIterator) Value() SystemTopic { - if !iter.page.NotDone() { - return SystemTopic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SystemTopicsListResultIterator type. -func NewSystemTopicsListResultIterator(page SystemTopicsListResultPage) SystemTopicsListResultIterator { - return SystemTopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (stlr SystemTopicsListResult) IsEmpty() bool { - return stlr.Value == nil || len(*stlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (stlr SystemTopicsListResult) hasNextLink() bool { - return stlr.NextLink != nil && len(*stlr.NextLink) != 0 -} - -// systemTopicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (stlr SystemTopicsListResult) systemTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !stlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(stlr.NextLink))) -} - -// SystemTopicsListResultPage contains a page of SystemTopic values. -type SystemTopicsListResultPage struct { - fn func(context.Context, SystemTopicsListResult) (SystemTopicsListResult, error) - stlr SystemTopicsListResult -} - -// 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 *SystemTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsListResultPage.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.stlr) - if err != nil { - return err - } - page.stlr = 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 *SystemTopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SystemTopicsListResultPage) NotDone() bool { - return !page.stlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SystemTopicsListResultPage) Response() SystemTopicsListResult { - return page.stlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SystemTopicsListResultPage) Values() []SystemTopic { - if page.stlr.IsEmpty() { - return nil - } - return *page.stlr.Value -} - -// Creates a new instance of the SystemTopicsListResultPage type. -func NewSystemTopicsListResultPage(cur SystemTopicsListResult, getNextPage func(context.Context, SystemTopicsListResult) (SystemTopicsListResult, error)) SystemTopicsListResultPage { - return SystemTopicsListResultPage{ - fn: getNextPage, - stlr: cur, - } -} - -// SystemTopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SystemTopicsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicsClient) (SystemTopic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicsUpdateFuture) 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 SystemTopicsUpdateFuture.Result. -func (future *SystemTopicsUpdateFuture) result(client SystemTopicsClient) (st SystemTopic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - st.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicsUpdateFuture") - 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.UpdateResponder(st.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsUpdateFuture", "Result", st.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemTopicUpdateParameters properties of the System Topic update. -type SystemTopicUpdateParameters struct { - // Tags - Tags of the system topic. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SystemTopicUpdateParameters. -func (stup SystemTopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stup.Tags != nil { - objectMap["tags"] = stup.Tags - } - return json.Marshal(objectMap) -} - -// Topic eventGrid Topic -type Topic struct { - autorest.Response `json:"-"` - // TopicProperties - Properties of the topic. - *TopicProperties `json:"properties,omitempty"` - // Sku - The Sku pricing tier for the topic. - Sku *ResourceSku `json:"sku,omitempty"` - // Identity - Identity information for the resource. - Identity *IdentityInfo `json:"identity,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TopicProperties != nil { - objectMap["properties"] = t.TopicProperties - } - if t.Sku != nil { - objectMap["sku"] = t.Sku - } - if t.Identity != nil { - objectMap["identity"] = t.Identity - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Topic struct. -func (t *Topic) 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 topicProperties TopicProperties - err = json.Unmarshal(*v, &topicProperties) - if err != nil { - return err - } - t.TopicProperties = &topicProperties - } - case "sku": - if v != nil { - var sku ResourceSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - t.Sku = &sku - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - t.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TopicProperties properties of the Topic -type TopicProperties struct { - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' - ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the topic. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventSchemaV10' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` - // MetricResourceID - READ-ONLY; Metric resource id for the topic. - MetricResourceID *string `json:"metricResourceId,omitempty"` - // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. - // You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicProperties. -func (tp TopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = tp.PrivateEndpointConnections - } - if tp.InputSchema != "" { - objectMap["inputSchema"] = tp.InputSchema - } - objectMap["inputSchemaMapping"] = tp.InputSchemaMapping - if tp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = tp.PublicNetworkAccess - } - if tp.InboundIPRules != nil { - objectMap["inboundIpRules"] = tp.InboundIPRules - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicProperties struct. -func (tp *TopicProperties) 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 "privateEndpointConnections": - if v != nil { - var privateEndpointConnections []PrivateEndpointConnection - err = json.Unmarshal(*v, &privateEndpointConnections) - if err != nil { - return err - } - tp.PrivateEndpointConnections = &privateEndpointConnections - } - case "provisioningState": - if v != nil { - var provisioningState TopicProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - tp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - tp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - tp.InputSchemaMapping = inputSchemaMapping - } - case "metricResourceId": - if v != nil { - var metricResourceID string - err = json.Unmarshal(*v, &metricResourceID) - if err != nil { - return err - } - tp.MetricResourceID = &metricResourceID - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - tp.PublicNetworkAccess = publicNetworkAccess - } - case "inboundIpRules": - if v != nil { - var inboundIPRules []InboundIPRule - err = json.Unmarshal(*v, &inboundIPRules) - if err != nil { - return err - } - tp.InboundIPRules = &inboundIPRules - } - } - } - - return nil -} - -// TopicRegenerateKeyRequest topic regenerate share access key request -type TopicRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsCreateOrUpdateFuture) 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 TopicsCreateOrUpdateFuture.Result. -func (future *TopicsCreateOrUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateOrUpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsDeleteFuture) 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 TopicsDeleteFuture.Result. -func (future *TopicsDeleteFuture) result(client TopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TopicSharedAccessKeys shared access keys of the Topic -type TopicSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the topic. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the topic. - Key2 *string `json:"key2,omitempty"` -} - -// TopicsListResult result of the List Topics operation -type TopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Topics - Value *[]Topic `json:"value,omitempty"` - // NextLink - A link for the next page of topics - NextLink *string `json:"nextLink,omitempty"` -} - -// TopicsListResultIterator provides access to a complete listing of Topic values. -type TopicsListResultIterator struct { - i int - page TopicsListResultPage -} - -// 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 *TopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultIterator.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 *TopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TopicsListResultIterator) 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 TopicsListResultIterator) Response() TopicsListResult { - 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 TopicsListResultIterator) Value() Topic { - if !iter.page.NotDone() { - return Topic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TopicsListResultIterator type. -func NewTopicsListResultIterator(page TopicsListResultPage) TopicsListResultIterator { - return TopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TopicsListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TopicsListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// topicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TopicsListResult) topicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TopicsListResultPage contains a page of Topic values. -type TopicsListResultPage struct { - fn func(context.Context, TopicsListResult) (TopicsListResult, error) - tlr TopicsListResult -} - -// 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 *TopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TopicsListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TopicsListResultPage) Response() TopicsListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TopicsListResultPage) Values() []Topic { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TopicsListResultPage type. -func NewTopicsListResultPage(cur TopicsListResult, getNextPage func(context.Context, TopicsListResult) (TopicsListResult, error)) TopicsListResultPage { - return TopicsListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsUpdateFuture) 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 TopicsUpdateFuture.Result. -func (future *TopicsUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicTypeInfo properties of a topic type info. -type TopicTypeInfo struct { - autorest.Response `json:"-"` - // TopicTypeProperties - Properties of the topic type info - *TopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicTypeInfo. -func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tti.TopicTypeProperties != nil { - objectMap["properties"] = tti.TopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. -func (tti *TopicTypeInfo) 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 topicTypeProperties TopicTypeProperties - err = json.Unmarshal(*v, &topicTypeProperties) - if err != nil { - return err - } - tti.TopicTypeProperties = &topicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tti.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tti.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tti.Type = &typeVar - } - } - } - - return nil -} - -// TopicTypeProperties properties of a topic type. -type TopicTypeProperties struct { - // Provider - Namespace of the provider of the topic type. - Provider *string `json:"provider,omitempty"` - // DisplayName - Display Name for the topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the topic type. - Description *string `json:"description,omitempty"` - // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' - ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` - // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' - ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` - // SupportedLocations - List of locations supported by this topic type. - SupportedLocations *[]string `json:"supportedLocations,omitempty"` - // SourceResourceFormat - Source resource format. - SourceResourceFormat *string `json:"sourceResourceFormat,omitempty"` -} - -// TopicTypesListResult result of the List Topic Types operation -type TopicTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of topic types - Value *[]TopicTypeInfo `json:"value,omitempty"` -} - -// TopicUpdateParameterProperties information of topic update parameter properties. -type TopicUpdateParameterProperties struct { - // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. - // You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` -} - -// TopicUpdateParameters properties of the Topic update -type TopicUpdateParameters struct { - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // Identity - Resource identity information. - Identity *IdentityInfo `json:"identity,omitempty"` - // TopicUpdateParameterProperties - Properties of the resource. - *TopicUpdateParameterProperties `json:"properties,omitempty"` - // Sku - The Sku pricing tier for the topic. - Sku *ResourceSku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicUpdateParameters. -func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - if tup.Identity != nil { - objectMap["identity"] = tup.Identity - } - if tup.TopicUpdateParameterProperties != nil { - objectMap["properties"] = tup.TopicUpdateParameterProperties - } - if tup.Sku != nil { - objectMap["sku"] = tup.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicUpdateParameters struct. -func (tup *TopicUpdateParameters) 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 - } - tup.Tags = tags - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tup.Identity = &identity - } - case "properties": - if v != nil { - var topicUpdateParameterProperties TopicUpdateParameterProperties - err = json.Unmarshal(*v, &topicUpdateParameterProperties) - if err != nil { - return err - } - tup.TopicUpdateParameterProperties = &topicUpdateParameterProperties - } - case "sku": - if v != nil { - var sku ResourceSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - tup.Sku = &sku - } - } - } - - return nil -} - -// TrackedResource definition of a Tracked Resource. -type TrackedResource struct { - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - 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.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// UserIdentityProperties the information about the user identity. -type UserIdentityProperties struct { - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription. -type WebHookEventSubscriptionDestination struct { - // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination. - *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - whesd.EndpointType = EndpointTypeWebHook - objectMap := make(map[string]interface{}) - if whesd.WebHookEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties - } - if whesd.EndpointType != "" { - objectMap["endpointType"] = whesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return &whesd, true -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &whesd, true -} - -// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. -func (whesd *WebHookEventSubscriptionDestination) 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 webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) - if err != nil { - return err - } - whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - whesd.EndpointType = endpointType - } - } - } - - return nil -} - -// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for -// an event subscription. -type WebHookEventSubscriptionDestinationProperties struct { - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` - // EndpointBaseURL - READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. - EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` - // MaxEventsPerBatch - Maximum number of events per batch. - MaxEventsPerBatch *int32 `json:"maxEventsPerBatch,omitempty"` - // PreferredBatchSizeInKilobytes - Preferred batch size in Kilobytes. - PreferredBatchSizeInKilobytes *int32 `json:"preferredBatchSizeInKilobytes,omitempty"` - // AzureActiveDirectoryTenantID - The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. - AzureActiveDirectoryTenantID *string `json:"azureActiveDirectoryTenantId,omitempty"` - // AzureActiveDirectoryApplicationIDOrURI - The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery requests. - AzureActiveDirectoryApplicationIDOrURI *string `json:"azureActiveDirectoryApplicationIdOrUri,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestinationProperties. -func (whesdp WebHookEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if whesdp.EndpointURL != nil { - objectMap["endpointUrl"] = whesdp.EndpointURL - } - if whesdp.MaxEventsPerBatch != nil { - objectMap["maxEventsPerBatch"] = whesdp.MaxEventsPerBatch - } - if whesdp.PreferredBatchSizeInKilobytes != nil { - objectMap["preferredBatchSizeInKilobytes"] = whesdp.PreferredBatchSizeInKilobytes - } - if whesdp.AzureActiveDirectoryTenantID != nil { - objectMap["azureActiveDirectoryTenantId"] = whesdp.AzureActiveDirectoryTenantID - } - if whesdp.AzureActiveDirectoryApplicationIDOrURI != nil { - objectMap["azureActiveDirectoryApplicationIdOrUri"] = whesdp.AzureActiveDirectoryApplicationIDOrURI - } - return json.Marshal(objectMap) -} diff --git a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/operations.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/operations.go deleted file mode 100644 index ae5c5102207d..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure EventGrid 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 list the available operations supported by the Microsoft.EventGrid resource provider. -func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/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 -} diff --git a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnernamespaces.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnernamespaces.go deleted file mode 100644 index 2dcdc00f47f9..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnernamespaces.go +++ /dev/null @@ -1,770 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartnerNamespacesClient is the azure EventGrid Management Client -type PartnerNamespacesClient struct { - BaseClient -} - -// NewPartnerNamespacesClient creates an instance of the PartnerNamespacesClient client. -func NewPartnerNamespacesClient(subscriptionID string) PartnerNamespacesClient { - return NewPartnerNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartnerNamespacesClientWithBaseURI creates an instance of the PartnerNamespacesClient 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 NewPartnerNamespacesClientWithBaseURI(baseURI string, subscriptionID string) PartnerNamespacesClient { - return PartnerNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new partner namespace with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// partnerNamespaceInfo - partnerNamespace information. -func (client PartnerNamespacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace) (result PartnerNamespacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PartnerNamespacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerNamespaces/{partnerNamespaceName}", pathParameters), - autorest.WithJSON(partnerNamespaceInfo), - 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 PartnerNamespacesClient) CreateOrUpdateSender(req *http.Request) (future PartnerNamespacesCreateOrUpdateFuture, 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 PartnerNamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result PartnerNamespace, 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 existing partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -func (client PartnerNamespacesClient) Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result PartnerNamespacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerNamespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PartnerNamespacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerNamespaces/{partnerNamespaceName}", 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 PartnerNamespacesClient) DeleteSender(req *http.Request) (future PartnerNamespacesDeleteFuture, 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 PartnerNamespacesClient) 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 get properties of a partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -func (client PartnerNamespacesClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result PartnerNamespace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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, partnerNamespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PartnerNamespacesClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerNamespaces/{partnerNamespaceName}", 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) GetResponder(resp *http.Response) (result PartnerNamespace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the partner namespaces under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerNamespacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerNamespacesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.pnlr.Response.Response != nil { - sc = result.pnlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.pnlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.pnlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.pnlr.hasNextLink() && result.pnlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PartnerNamespacesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces", 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerNamespacesListResult, 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 PartnerNamespacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults PartnerNamespacesListResult) (result PartnerNamespacesListResult, err error) { - req, err := lastResults.partnerNamespacesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "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, "eventgrid.PartnerNamespacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerNamespacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerNamespacesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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, filter, top) - return -} - -// ListBySubscription list all the partner namespaces under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerNamespacesClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerNamespacesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.ListBySubscription") - defer func() { - sc := -1 - if result.pnlr.Response.Response != nil { - sc = result.pnlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.pnlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.pnlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.pnlr.hasNextLink() && result.pnlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client PartnerNamespacesClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces", 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerNamespacesListResult, 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 PartnerNamespacesClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerNamespacesListResult) (result PartnerNamespacesListResult, err error) { - req, err := lastResults.partnerNamespacesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "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, "eventgrid.PartnerNamespacesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerNamespacesClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerNamespacesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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, filter, top) - return -} - -// ListSharedAccessKeys list the two keys used to publish to a partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -func (client PartnerNamespacesClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result PartnerNamespaceSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, partnerNamespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client PartnerNamespacesClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerNamespaces/{partnerNamespaceName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client PartnerNamespacesClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client PartnerNamespacesClient) ListSharedAccessKeysResponder(resp *http.Response) (result PartnerNamespaceSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// regenerateKeyRequest - request body to regenerate key. -func (client PartnerNamespacesClient) RegenerateKey(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest PartnerNamespaceRegenerateKeyRequest) (result PartnerNamespaceSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.PartnerNamespacesClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, partnerNamespaceName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client PartnerNamespacesClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest PartnerNamespaceRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerNamespaces/{partnerNamespaceName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) RegenerateKeyResponder(resp *http.Response) (result PartnerNamespaceSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a partner namespace with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// partnerNamespaceUpdateParameters - partner namespace update information. -func (client PartnerNamespacesClient) Update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters) (result PartnerNamespacesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PartnerNamespacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerNamespaces/{partnerNamespaceName}", pathParameters), - autorest.WithJSON(partnerNamespaceUpdateParameters), - 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 PartnerNamespacesClient) UpdateSender(req *http.Request) (future PartnerNamespacesUpdateFuture, 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 PartnerNamespacesClient) UpdateResponder(resp *http.Response) (result PartnerNamespace, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnerregistrations.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnerregistrations.go deleted file mode 100644 index 70b4c7d7edaa..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnerregistrations.go +++ /dev/null @@ -1,666 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartnerRegistrationsClient is the azure EventGrid Management Client -type PartnerRegistrationsClient struct { - BaseClient -} - -// NewPartnerRegistrationsClient creates an instance of the PartnerRegistrationsClient client. -func NewPartnerRegistrationsClient(subscriptionID string) PartnerRegistrationsClient { - return NewPartnerRegistrationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartnerRegistrationsClientWithBaseURI creates an instance of the PartnerRegistrationsClient 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 NewPartnerRegistrationsClientWithBaseURI(baseURI string, subscriptionID string) PartnerRegistrationsClient { - return PartnerRegistrationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new partner registration with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerRegistrationName - name of the partner registration. -// partnerRegistrationInfo - partnerRegistration information. -func (client PartnerRegistrationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration) (result PartnerRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, partnerRegistrationName, partnerRegistrationInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PartnerRegistrationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerRegistrations/{partnerRegistrationName}", pathParameters), - autorest.WithJSON(partnerRegistrationInfo), - 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) CreateOrUpdateResponder(resp *http.Response) (result PartnerRegistration, 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 a partner registration with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerRegistrationName - name of the partner registration. -func (client PartnerRegistrationsClient) Delete(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerRegistrationName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PartnerRegistrationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerRegistrations/{partnerRegistrationName}", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) 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 a partner registration with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerRegistrationName - name of the partner registration. -func (client PartnerRegistrationsClient) Get(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result PartnerRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, partnerRegistrationName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PartnerRegistrationsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerRegistrations/{partnerRegistrationName}", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) GetResponder(resp *http.Response) (result PartnerRegistration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all partners registrations. -func (client PartnerRegistrationsClient) List(ctx context.Context) (result PartnerRegistrationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PartnerRegistrationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/partnerRegistrations"), - 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) ListResponder(resp *http.Response) (result PartnerRegistrationsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the partner registrations under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerRegistrationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerRegistrationsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.prlr.Response.Response != nil { - sc = result.prlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.prlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.prlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.prlr.hasNextLink() && result.prlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PartnerRegistrationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerRegistrationsListResult, 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 PartnerRegistrationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PartnerRegistrationsListResult) (result PartnerRegistrationsListResult, err error) { - req, err := lastResults.partnerRegistrationsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "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, "eventgrid.PartnerRegistrationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerRegistrationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerRegistrationsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, filter, top) - return -} - -// ListBySubscription list all the partner registrations under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerRegistrationsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerRegistrationsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.ListBySubscription") - defer func() { - sc := -1 - if result.prlr.Response.Response != nil { - sc = result.prlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.prlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.prlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.prlr.hasNextLink() && result.prlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client PartnerRegistrationsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerRegistrationsListResult, 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 PartnerRegistrationsClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerRegistrationsListResult) (result PartnerRegistrationsListResult, err error) { - req, err := lastResults.partnerRegistrationsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "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, "eventgrid.PartnerRegistrationsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerRegistrationsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerRegistrationsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, filter, top) - return -} - -// Update updates a partner registration with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerRegistrationName - name of the partner registration. -// partnerRegistrationUpdateParameters - partner registration update information. -func (client PartnerRegistrationsClient) Update(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters) (result PartnerRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, partnerRegistrationName, partnerRegistrationUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PartnerRegistrationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerRegistrations/{partnerRegistrationName}", pathParameters), - autorest.WithJSON(partnerRegistrationUpdateParameters), - 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) UpdateResponder(resp *http.Response) (result PartnerRegistration, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnertopiceventsubscriptions.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnertopiceventsubscriptions.go deleted file mode 100644 index 9eb4f6a105b8..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnertopiceventsubscriptions.go +++ /dev/null @@ -1,574 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartnerTopicEventSubscriptionsClient is the azure EventGrid Management Client -type PartnerTopicEventSubscriptionsClient struct { - BaseClient -} - -// NewPartnerTopicEventSubscriptionsClient creates an instance of the PartnerTopicEventSubscriptionsClient client. -func NewPartnerTopicEventSubscriptionsClient(subscriptionID string) PartnerTopicEventSubscriptionsClient { - return NewPartnerTopicEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartnerTopicEventSubscriptionsClientWithBaseURI creates an instance of the PartnerTopicEventSubscriptionsClient -// 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 NewPartnerTopicEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) PartnerTopicEventSubscriptionsClient { - return PartnerTopicEventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates an event subscription of a partner topic with the specified -// parameters. Existing event subscriptions will be updated with this API. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information. -func (client PartnerTopicEventSubscriptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result PartnerTopicEventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PartnerTopicEventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 PartnerTopicEventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future PartnerTopicEventSubscriptionsCreateOrUpdateFuture, 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 PartnerTopicEventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an event subscription of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client PartnerTopicEventSubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result PartnerTopicEventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PartnerTopicEventSubscriptionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 PartnerTopicEventSubscriptionsClient) DeleteSender(req *http.Request) (future PartnerTopicEventSubscriptionsDeleteFuture, 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 PartnerTopicEventSubscriptionsClient) 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 get an event subscription of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be found. Event subscription names must be between -// 3 and 100 characters in length and use alphanumeric letters only. -func (client PartnerTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.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, partnerTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PartnerTopicEventSubscriptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 PartnerTopicEventSubscriptionsClient) 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 PartnerTopicEventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client PartnerTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client PartnerTopicEventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client PartnerTopicEventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client PartnerTopicEventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByPartnerTopic list event subscriptions that belong to a specific partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopic(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.ListByPartnerTopic") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByPartnerTopicNextResults - req, err := client.ListByPartnerTopicPreparer(ctx, resourceGroupName, partnerTopicName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "ListByPartnerTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPartnerTopicSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "ListByPartnerTopic", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByPartnerTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "ListByPartnerTopic", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPartnerTopicPreparer prepares the ListByPartnerTopic request. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPartnerTopicSender sends the ListByPartnerTopic request. The method will close the -// http.Response Body if it receives an error. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPartnerTopicResponder handles the response to the ListByPartnerTopic request. The method always -// closes the http.Response Body. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPartnerTopicNextResults retrieves the next set of results, if any. -func (client PartnerTopicEventSubscriptionsClient) listByPartnerTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "listByPartnerTopicNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPartnerTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "listByPartnerTopicNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPartnerTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "listByPartnerTopicNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPartnerTopicComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicComplete(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.ListByPartnerTopic") - 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.ListByPartnerTopic(ctx, resourceGroupName, partnerTopicName, filter, top) - return -} - -// Update update event subscription of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -// eventSubscriptionUpdateParameters - updated event subscription information. -func (client PartnerTopicEventSubscriptionsClient) Update(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result PartnerTopicEventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PartnerTopicEventSubscriptionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 PartnerTopicEventSubscriptionsClient) UpdateSender(req *http.Request) (future PartnerTopicEventSubscriptionsUpdateFuture, 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 PartnerTopicEventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnertopics.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnertopics.go deleted file mode 100644 index 0ea829b208fa..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/partnertopics.go +++ /dev/null @@ -1,674 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartnerTopicsClient is the azure EventGrid Management Client -type PartnerTopicsClient struct { - BaseClient -} - -// NewPartnerTopicsClient creates an instance of the PartnerTopicsClient client. -func NewPartnerTopicsClient(subscriptionID string) PartnerTopicsClient { - return NewPartnerTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartnerTopicsClientWithBaseURI creates an instance of the PartnerTopicsClient 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 NewPartnerTopicsClientWithBaseURI(baseURI string, subscriptionID string) PartnerTopicsClient { - return PartnerTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Activate activate a newly created partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -func (client PartnerTopicsClient) Activate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Activate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ActivatePreparer(ctx, resourceGroupName, partnerTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Activate", nil, "Failure preparing request") - return - } - - resp, err := client.ActivateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Activate", resp, "Failure sending request") - return - } - - result, err = client.ActivateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Activate", resp, "Failure responding to request") - return - } - - return -} - -// ActivatePreparer prepares the Activate request. -func (client PartnerTopicsClient) ActivatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}/activate", pathParameters), - 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 PartnerTopicsClient) 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 PartnerTopicsClient) ActivateResponder(resp *http.Response) (result PartnerTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Deactivate deactivate specific partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -func (client PartnerTopicsClient) Deactivate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Deactivate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeactivatePreparer(ctx, resourceGroupName, partnerTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Deactivate", nil, "Failure preparing request") - return - } - - resp, err := client.DeactivateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Deactivate", resp, "Failure sending request") - return - } - - result, err = client.DeactivateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Deactivate", resp, "Failure responding to request") - return - } - - return -} - -// DeactivatePreparer prepares the Deactivate request. -func (client PartnerTopicsClient) DeactivatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}/deactivate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeactivateSender sends the Deactivate request. The method will close the -// http.Response Body if it receives an error. -func (client PartnerTopicsClient) DeactivateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeactivateResponder handles the response to the Deactivate request. The method always -// closes the http.Response Body. -func (client PartnerTopicsClient) DeactivateResponder(resp *http.Response) (result PartnerTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete existing partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -func (client PartnerTopicsClient) Delete(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PartnerTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}", 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 PartnerTopicsClient) DeleteSender(req *http.Request) (future PartnerTopicsDeleteFuture, 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 PartnerTopicsClient) 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 get properties of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -func (client PartnerTopicsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, partnerTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PartnerTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}", 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 PartnerTopicsClient) 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 PartnerTopicsClient) GetResponder(resp *http.Response) (result PartnerTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the partner topics under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerTopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.ptlr.Response.Response != nil { - sc = result.ptlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.ptlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.ptlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.ptlr.hasNextLink() && result.ptlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PartnerTopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics", 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 PartnerTopicsClient) 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 PartnerTopicsClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerTopicsListResult, 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 PartnerTopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PartnerTopicsListResult) (result PartnerTopicsListResult, err error) { - req, err := lastResults.partnerTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "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, "eventgrid.PartnerTopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerTopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, filter, top) - return -} - -// ListBySubscription list all the partner topics under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerTopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.ptlr.Response.Response != nil { - sc = result.ptlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.ptlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.ptlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.ptlr.hasNextLink() && result.ptlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client PartnerTopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics", 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 PartnerTopicsClient) 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 PartnerTopicsClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerTopicsListResult, 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 PartnerTopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerTopicsListResult) (result PartnerTopicsListResult, err error) { - req, err := lastResults.partnerTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "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, "eventgrid.PartnerTopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerTopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, filter, top) - return -} - -// Update asynchronously updates a partner topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// partnerTopicUpdateParameters - partnerTopic update information. -func (client PartnerTopicsClient) Update(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters PartnerTopicUpdateParameters) (result PartnerTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, partnerTopicName, partnerTopicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PartnerTopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters PartnerTopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/partnerTopics/{partnerTopicName}", pathParameters), - autorest.WithJSON(partnerTopicUpdateParameters), - 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 PartnerTopicsClient) 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 PartnerTopicsClient) UpdateResponder(resp *http.Response) (result PartnerTopic, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/privateendpointconnections.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/privateendpointconnections.go deleted file mode 100644 index 278ef1a8e5aa..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/privateendpointconnections.go +++ /dev/null @@ -1,414 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the azure EventGrid Management Client -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete a specific private endpoint connection under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// privateEndpointConnectionName - the name of the private endpoint connection connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 get a specific private endpoint connection under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// privateEndpointConnectionName - the name of the private endpoint connection connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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, parentType, parentName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/{parentType}/{parentName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByResource get all private endpoint connections under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PrivateEndpointConnectionsClient) ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByResource") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, parentType, parentName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client PrivateEndpointConnectionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByResourceResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByResourceNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByResource") - 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.ListByResource(ctx, resourceGroupName, parentType, parentName, filter, top) - return -} - -// Update update a specific private endpoint connection under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// privateEndpointConnectionName - the name of the private endpoint connection connection. -// privateEndpointConnection - the private endpoint connection object to update. -func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, privateEndpointConnection) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(privateEndpointConnection), - 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 PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionsUpdateFuture, 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 PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/privatelinkresources.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/privatelinkresources.go deleted file mode 100644 index 4c7d0298e544..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/privatelinkresources.go +++ /dev/null @@ -1,246 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the azure EventGrid Management Client -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get properties of a private link resource. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// privateLinkResourceName - the name of private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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, parentType, parentName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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.EventGrid/{parentType}/{parentName}/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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByResource list all the private link resources under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PrivateLinkResourcesClient) ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateLinkResourcesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByResource") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, parentType, parentName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "ListByResource", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client PrivateLinkResourcesClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByResourceResponder(resp *http.Response) (result PrivateLinkResourcesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByResourceNextResults(ctx context.Context, lastResults PrivateLinkResourcesListResult) (result PrivateLinkResourcesListResult, err error) { - req, err := lastResults.privateLinkResourcesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateLinkResourcesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByResource") - 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.ListByResource(ctx, resourceGroupName, parentType, parentName, filter, top) - return -} diff --git a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/systemtopiceventsubscriptions.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/systemtopiceventsubscriptions.go deleted file mode 100644 index b3082202c8d4..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/systemtopiceventsubscriptions.go +++ /dev/null @@ -1,574 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SystemTopicEventSubscriptionsClient is the azure EventGrid Management Client -type SystemTopicEventSubscriptionsClient struct { - BaseClient -} - -// NewSystemTopicEventSubscriptionsClient creates an instance of the SystemTopicEventSubscriptionsClient client. -func NewSystemTopicEventSubscriptionsClient(subscriptionID string) SystemTopicEventSubscriptionsClient { - return NewSystemTopicEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSystemTopicEventSubscriptionsClientWithBaseURI creates an instance of the SystemTopicEventSubscriptionsClient -// 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 NewSystemTopicEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicEventSubscriptionsClient { - return SystemTopicEventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates an event subscription with the specified parameters. Existing event -// subscriptions will be updated with this API. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information. -func (client SystemTopicEventSubscriptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result SystemTopicEventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SystemTopicEventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 SystemTopicEventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future SystemTopicEventSubscriptionsCreateOrUpdateFuture, 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 SystemTopicEventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an event subscription of a system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client SystemTopicEventSubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result SystemTopicEventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SystemTopicEventSubscriptionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 SystemTopicEventSubscriptionsClient) DeleteSender(req *http.Request) (future SystemTopicEventSubscriptionsDeleteFuture, 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 SystemTopicEventSubscriptionsClient) 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 get an event subscription. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client SystemTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.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, systemTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SystemTopicEventSubscriptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 SystemTopicEventSubscriptionsClient) 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 SystemTopicEventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription of a system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client SystemTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client SystemTopicEventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client SystemTopicEventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client SystemTopicEventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySystemTopic list event subscriptions that belong to a specific system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopic(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.ListBySystemTopic") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySystemTopicNextResults - req, err := client.ListBySystemTopicPreparer(ctx, resourceGroupName, systemTopicName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "ListBySystemTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySystemTopicSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "ListBySystemTopic", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListBySystemTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "ListBySystemTopic", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySystemTopicPreparer prepares the ListBySystemTopic request. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySystemTopicSender sends the ListBySystemTopic request. The method will close the -// http.Response Body if it receives an error. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySystemTopicResponder handles the response to the ListBySystemTopic request. The method always -// closes the http.Response Body. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySystemTopicNextResults retrieves the next set of results, if any. -func (client SystemTopicEventSubscriptionsClient) listBySystemTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "listBySystemTopicNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySystemTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "listBySystemTopicNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySystemTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "listBySystemTopicNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySystemTopicComplete enumerates all values, automatically crossing page boundaries as required. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicComplete(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.ListBySystemTopic") - 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.ListBySystemTopic(ctx, resourceGroupName, systemTopicName, filter, top) - return -} - -// Update update event subscription of a system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -// eventSubscriptionUpdateParameters - updated event subscription information. -func (client SystemTopicEventSubscriptionsClient) Update(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result SystemTopicEventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SystemTopicEventSubscriptionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 SystemTopicEventSubscriptionsClient) UpdateSender(req *http.Request) (future SystemTopicEventSubscriptionsUpdateFuture, 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 SystemTopicEventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/systemtopics.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/systemtopics.go deleted file mode 100644 index ef636422e1d3..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/systemtopics.go +++ /dev/null @@ -1,607 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SystemTopicsClient is the azure EventGrid Management Client -type SystemTopicsClient struct { - BaseClient -} - -// NewSystemTopicsClient creates an instance of the SystemTopicsClient client. -func NewSystemTopicsClient(subscriptionID string) SystemTopicsClient { - return NewSystemTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSystemTopicsClientWithBaseURI creates an instance of the SystemTopicsClient 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 NewSystemTopicsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicsClient { - return SystemTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new system topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// systemTopicInfo - system Topic information. -func (client SystemTopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo SystemTopic) (result SystemTopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, systemTopicName, systemTopicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SystemTopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo SystemTopic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-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.EventGrid/systemTopics/{systemTopicName}", pathParameters), - autorest.WithJSON(systemTopicInfo), - 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 SystemTopicsClient) CreateOrUpdateSender(req *http.Request) (future SystemTopicsCreateOrUpdateFuture, 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 SystemTopicsClient) CreateOrUpdateResponder(resp *http.Response) (result SystemTopic, 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 existing system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -func (client SystemTopicsClient) Delete(ctx context.Context, resourceGroupName string, systemTopicName string) (result SystemTopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, systemTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SystemTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, systemTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-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.EventGrid/systemTopics/{systemTopicName}", 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 SystemTopicsClient) DeleteSender(req *http.Request) (future SystemTopicsDeleteFuture, 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 SystemTopicsClient) 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 get properties of a system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -func (client SystemTopicsClient) Get(ctx context.Context, resourceGroupName string, systemTopicName string) (result SystemTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.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, systemTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SystemTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, systemTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-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.EventGrid/systemTopics/{systemTopicName}", 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 SystemTopicsClient) 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 SystemTopicsClient) GetResponder(resp *http.Response) (result SystemTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the system topics under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client SystemTopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result SystemTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.stlr.Response.Response != nil { - sc = result.stlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.stlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.stlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.stlr.hasNextLink() && result.stlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client SystemTopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics", 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 SystemTopicsClient) 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 SystemTopicsClient) ListByResourceGroupResponder(resp *http.Response) (result SystemTopicsListResult, 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 SystemTopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SystemTopicsListResult) (result SystemTopicsListResult, err error) { - req, err := lastResults.systemTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "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, "eventgrid.SystemTopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client SystemTopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result SystemTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.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, filter, top) - return -} - -// ListBySubscription list all the system topics under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client SystemTopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result SystemTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.stlr.Response.Response != nil { - sc = result.stlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.stlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.stlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.stlr.hasNextLink() && result.stlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client SystemTopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics", 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 SystemTopicsClient) 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 SystemTopicsClient) ListBySubscriptionResponder(resp *http.Response) (result SystemTopicsListResult, 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 SystemTopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults SystemTopicsListResult) (result SystemTopicsListResult, err error) { - req, err := lastResults.systemTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "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, "eventgrid.SystemTopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client SystemTopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result SystemTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.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, filter, top) - return -} - -// Update asynchronously updates a system topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// systemTopicUpdateParameters - systemTopic update information. -func (client SystemTopicsClient) Update(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters SystemTopicUpdateParameters) (result SystemTopicsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, systemTopicName, systemTopicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SystemTopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters SystemTopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-04-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.EventGrid/systemTopics/{systemTopicName}", pathParameters), - autorest.WithJSON(systemTopicUpdateParameters), - 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 SystemTopicsClient) UpdateSender(req *http.Request) (future SystemTopicsUpdateFuture, 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 SystemTopicsClient) UpdateResponder(resp *http.Response) (result SystemTopic, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/topics.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/topics.go deleted file mode 100644 index 4366286dded3..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/topics.go +++ /dev/null @@ -1,849 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicsClient is the azure EventGrid Management Client -type TopicsClient struct { - BaseClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient 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 NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -// topicInfo - topic information. -func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-04-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicInfo), - 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 TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, 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 TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, 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 existing topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-04-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.EventGrid/topics/{topicName}", 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 TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, 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 TopicsClient) 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 get properties of a topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-04-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.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the topics under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client TopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { - req, err := lastResults.topicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) - return -} - -// ListBySubscription list all the topics under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client TopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result TopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { - req, err := lastResults.topicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result TopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) - return -} - -// ListEventTypes list event types for a topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic. -// resourceTypeName - name of the topic type. -// resourceName - name of the topic. -func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-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/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSharedAccessKeys list the two keys used to publish to a topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-04-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.EventGrid/topics/{topicName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -// regenerateKeyRequest - request body to regenerate key. -func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.TopicsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, topicName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-04-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.EventGrid/topics/{topicName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 TopicsClient) 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 TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -// topicUpdateParameters - topic update information. -func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-04-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicUpdateParameters), - 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 TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, 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 TopicsClient) UpdateResponder(resp *http.Response) (result Topic, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/topictypes.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/topictypes.go deleted file mode 100644 index ca275f3ef527..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/topictypes.go +++ /dev/null @@ -1,244 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicTypesClient is the azure EventGrid Management Client -type TopicTypesClient struct { - BaseClient -} - -// NewTopicTypesClient creates an instance of the TopicTypesClient client. -func NewTopicTypesClient(subscriptionID string) TopicTypesClient { - return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient 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 NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { - return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get information about a topic type. -// Parameters: -// topicTypeName - name of the topic type. -func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.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, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all registered topic types. -func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"), - 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 TopicTypesClient) 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 TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic type. -// Parameters: -// topicTypeName - name of the topic type. -func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, 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/eventgrid/mgmt/2020-04-01-preview/eventgrid/version.go b/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/version.go deleted file mode 100644 index 91a00389d5bd..000000000000 --- a/services/preview/eventgrid/mgmt/2020-04-01-preview/eventgrid/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package eventgrid - -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() + " eventgrid/2020-04-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/eventgrid/mgmt/2020-10-15-preview/eventgrid/CHANGELOG.md b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/_meta.json b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/_meta.json deleted file mode 100644 index 27e63e4d658d..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "8240593bde5350e6762015523ccd57cb61e32da5", - "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "tag": "package-2020-10-preview", - "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-2020-10-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/client.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/client.go deleted file mode 100644 index 76595b74cd40..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2020-10-15-preview. -// -// Azure EventGrid Management Client -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Eventgrid - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Eventgrid. -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/eventgrid/mgmt/2020-10-15-preview/eventgrid/domains.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/domains.go deleted file mode 100644 index b2501c98a27b..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/domains.go +++ /dev/null @@ -1,769 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainsClient is the azure EventGrid Management Client -type DomainsClient struct { - BaseClient -} - -// NewDomainsClient creates an instance of the DomainsClient client. -func NewDomainsClient(subscriptionID string) DomainsClient { - return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainsClientWithBaseURI creates an instance of the DomainsClient 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 NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { - return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates a new domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainInfo - domain information. -func (client DomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (result DomainsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainInfo), - 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 DomainsClient) CreateOrUpdateSender(req *http.Request) (future DomainsCreateOrUpdateFuture, 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 DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, 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 existing domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -func (client DomainsClient) Delete(ctx context.Context, resourceGroupName string, domainName string) (result DomainsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/domains/{domainName}", 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 DomainsClient) DeleteSender(req *http.Request) (future DomainsDeleteFuture, 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 DomainsClient) 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 get properties of a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -func (client DomainsClient) Get(ctx context.Context, resourceGroupName string, domainName string) (result Domain, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/domains/{domainName}", 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 DomainsClient) 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 DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the domains under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client DomainsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DomainsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { - req, err := lastResults.domainsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) - return -} - -// ListBySubscription list all the domains under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client DomainsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result DomainsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListBySubscription") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DomainsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListBySubscriptionResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { - req, err := lastResults.domainsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result DomainsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) - return -} - -// ListSharedAccessKeys list the two keys used to publish to a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -func (client DomainsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client DomainsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/domains/{domainName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListSharedAccessKeysResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// regenerateKeyRequest - request body to regenerate key. -func (client DomainsClient) RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (result DomainSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.DomainsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, domainName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DomainsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/domains/{domainName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 DomainsClient) 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 DomainsClient) RegenerateKeyResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a domain with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainUpdateParameters - domain update information. -func (client DomainsClient) Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (result DomainsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainName, domainUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/domains/{domainName}", pathParameters), - autorest.WithJSON(domainUpdateParameters), - 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 DomainsClient) UpdateSender(req *http.Request) (future DomainsUpdateFuture, 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 DomainsClient) UpdateResponder(resp *http.Response) (result Domain, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/domaintopics.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/domaintopics.go deleted file mode 100644 index 7bb3a251b02f..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/domaintopics.go +++ /dev/null @@ -1,402 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DomainTopicsClient is the azure EventGrid Management Client -type DomainTopicsClient struct { - BaseClient -} - -// NewDomainTopicsClient creates an instance of the DomainTopicsClient client. -func NewDomainTopicsClient(subscriptionID string) DomainTopicsClient { - return NewDomainTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainTopicsClientWithBaseURI creates an instance of the DomainTopicsClient 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 NewDomainTopicsClientWithBaseURI(baseURI string, subscriptionID string) DomainTopicsClient { - return DomainTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates a new domain topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainTopicName - name of the domain topic. -func (client DomainTopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainTopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}", pathParameters), - 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 DomainTopicsClient) CreateOrUpdateSender(req *http.Request) (future DomainTopicsCreateOrUpdateFuture, 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 DomainTopicsClient) CreateOrUpdateResponder(resp *http.Response) (result DomainTopic, 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 existing domain topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainTopicName - name of the domain topic. -func (client DomainTopicsClient) Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) DeleteSender(req *http.Request) (future DomainTopicsDeleteFuture, 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 DomainTopicsClient) 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 get properties of a domain topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the domain. -// domainTopicName - name of the topic. -func (client DomainTopicsClient) Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.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, domainName, domainTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "domainTopicName": autorest.Encode("path", domainTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) 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 DomainTopicsClient) GetResponder(resp *http.Response) (result DomainTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomain list all the topics in a domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - domain name. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client DomainTopicsClient) ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") - defer func() { - sc := -1 - if result.dtlr.Response.Response != nil { - sc = result.dtlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDomainNextResults - req, err := client.ListByDomainPreparer(ctx, resourceGroupName, domainName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainSender(req) - if err != nil { - result.dtlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure sending request") - return - } - - result.dtlr, err = client.ListByDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure responding to request") - return - } - if result.dtlr.hasNextLink() && result.dtlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDomainPreparer prepares the ListByDomain request. -func (client DomainTopicsClient) ListByDomainPreparer(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainSender sends the ListByDomain request. The method will close the -// http.Response Body if it receives an error. -func (client DomainTopicsClient) ListByDomainSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainResponder handles the response to the ListByDomain request. The method always -// closes the http.Response Body. -func (client DomainTopicsClient) ListByDomainResponder(resp *http.Response) (result DomainTopicsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDomainNextResults retrieves the next set of results, if any. -func (client DomainTopicsClient) listByDomainNextResults(ctx context.Context, lastResults DomainTopicsListResult) (result DomainTopicsListResult, err error) { - req, err := lastResults.domainTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDomainSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDomainComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainTopicsClient) ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") - 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.ListByDomain(ctx, resourceGroupName, domainName, filter, top) - return -} diff --git a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/enums.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/enums.go deleted file mode 100644 index 1e4f765d4337..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/enums.go +++ /dev/null @@ -1,614 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // Application ... - Application CreatedByType = "Application" - // Key ... - Key CreatedByType = "Key" - // ManagedIdentity ... - ManagedIdentity CreatedByType = "ManagedIdentity" - // User ... - User CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{Application, Key, ManagedIdentity, User} -} - -// DomainProvisioningState enumerates the values for domain provisioning state. -type DomainProvisioningState string - -const ( - // Canceled ... - Canceled DomainProvisioningState = "Canceled" - // Creating ... - Creating DomainProvisioningState = "Creating" - // Deleting ... - Deleting DomainProvisioningState = "Deleting" - // Failed ... - Failed DomainProvisioningState = "Failed" - // Succeeded ... - Succeeded DomainProvisioningState = "Succeeded" - // Updating ... - Updating DomainProvisioningState = "Updating" -) - -// PossibleDomainProvisioningStateValues returns an array of possible values for the DomainProvisioningState const type. -func PossibleDomainProvisioningStateValues() []DomainProvisioningState { - return []DomainProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// DomainTopicProvisioningState enumerates the values for domain topic provisioning state. -type DomainTopicProvisioningState string - -const ( - // DomainTopicProvisioningStateCanceled ... - DomainTopicProvisioningStateCanceled DomainTopicProvisioningState = "Canceled" - // DomainTopicProvisioningStateCreating ... - DomainTopicProvisioningStateCreating DomainTopicProvisioningState = "Creating" - // DomainTopicProvisioningStateDeleting ... - DomainTopicProvisioningStateDeleting DomainTopicProvisioningState = "Deleting" - // DomainTopicProvisioningStateFailed ... - DomainTopicProvisioningStateFailed DomainTopicProvisioningState = "Failed" - // DomainTopicProvisioningStateSucceeded ... - DomainTopicProvisioningStateSucceeded DomainTopicProvisioningState = "Succeeded" - // DomainTopicProvisioningStateUpdating ... - DomainTopicProvisioningStateUpdating DomainTopicProvisioningState = "Updating" -) - -// PossibleDomainTopicProvisioningStateValues returns an array of possible values for the DomainTopicProvisioningState const type. -func PossibleDomainTopicProvisioningStateValues() []DomainTopicProvisioningState { - return []DomainTopicProvisioningState{DomainTopicProvisioningStateCanceled, DomainTopicProvisioningStateCreating, DomainTopicProvisioningStateDeleting, DomainTopicProvisioningStateFailed, DomainTopicProvisioningStateSucceeded, DomainTopicProvisioningStateUpdating} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeAzureFunction ... - EndpointTypeAzureFunction EndpointType = "AzureFunction" - // EndpointTypeEventHub ... - EndpointTypeEventHub EndpointType = "EventHub" - // EndpointTypeEventSubscriptionDestination ... - EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" - // EndpointTypeHybridConnection ... - EndpointTypeHybridConnection EndpointType = "HybridConnection" - // EndpointTypeServiceBusQueue ... - EndpointTypeServiceBusQueue EndpointType = "ServiceBusQueue" - // EndpointTypeServiceBusTopic ... - EndpointTypeServiceBusTopic EndpointType = "ServiceBusTopic" - // EndpointTypeStorageQueue ... - EndpointTypeStorageQueue EndpointType = "StorageQueue" - // EndpointTypeWebHook ... - EndpointTypeWebHook EndpointType = "WebHook" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeAzureFunction, EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeHybridConnection, EndpointTypeServiceBusQueue, EndpointTypeServiceBusTopic, EndpointTypeStorageQueue, EndpointTypeWebHook} -} - -// EndpointTypeBasicDeadLetterDestination enumerates the values for endpoint type basic dead letter -// destination. -type EndpointTypeBasicDeadLetterDestination string - -const ( - // EndpointTypeDeadLetterDestination ... - EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = "DeadLetterDestination" - // EndpointTypeStorageBlob ... - EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = "StorageBlob" -) - -// PossibleEndpointTypeBasicDeadLetterDestinationValues returns an array of possible values for the EndpointTypeBasicDeadLetterDestination const type. -func PossibleEndpointTypeBasicDeadLetterDestinationValues() []EndpointTypeBasicDeadLetterDestination { - return []EndpointTypeBasicDeadLetterDestination{EndpointTypeDeadLetterDestination, EndpointTypeStorageBlob} -} - -// EventChannelProvisioningState enumerates the values for event channel provisioning state. -type EventChannelProvisioningState string - -const ( - // EventChannelProvisioningStateCanceled ... - EventChannelProvisioningStateCanceled EventChannelProvisioningState = "Canceled" - // EventChannelProvisioningStateCreating ... - EventChannelProvisioningStateCreating EventChannelProvisioningState = "Creating" - // EventChannelProvisioningStateDeleting ... - EventChannelProvisioningStateDeleting EventChannelProvisioningState = "Deleting" - // EventChannelProvisioningStateFailed ... - EventChannelProvisioningStateFailed EventChannelProvisioningState = "Failed" - // EventChannelProvisioningStateSucceeded ... - EventChannelProvisioningStateSucceeded EventChannelProvisioningState = "Succeeded" - // EventChannelProvisioningStateUpdating ... - EventChannelProvisioningStateUpdating EventChannelProvisioningState = "Updating" -) - -// PossibleEventChannelProvisioningStateValues returns an array of possible values for the EventChannelProvisioningState const type. -func PossibleEventChannelProvisioningStateValues() []EventChannelProvisioningState { - return []EventChannelProvisioningState{EventChannelProvisioningStateCanceled, EventChannelProvisioningStateCreating, EventChannelProvisioningStateDeleting, EventChannelProvisioningStateFailed, EventChannelProvisioningStateSucceeded, EventChannelProvisioningStateUpdating} -} - -// EventDeliverySchema enumerates the values for event delivery schema. -type EventDeliverySchema string - -const ( - // CloudEventSchemaV10 ... - CloudEventSchemaV10 EventDeliverySchema = "CloudEventSchemaV1_0" - // CustomInputSchema ... - CustomInputSchema EventDeliverySchema = "CustomInputSchema" - // EventGridSchema ... - EventGridSchema EventDeliverySchema = "EventGridSchema" -) - -// PossibleEventDeliverySchemaValues returns an array of possible values for the EventDeliverySchema const type. -func PossibleEventDeliverySchemaValues() []EventDeliverySchema { - return []EventDeliverySchema{CloudEventSchemaV10, CustomInputSchema, EventGridSchema} -} - -// EventSubscriptionIdentityType enumerates the values for event subscription identity type. -type EventSubscriptionIdentityType string - -const ( - // SystemAssigned ... - SystemAssigned EventSubscriptionIdentityType = "SystemAssigned" - // UserAssigned ... - UserAssigned EventSubscriptionIdentityType = "UserAssigned" -) - -// PossibleEventSubscriptionIdentityTypeValues returns an array of possible values for the EventSubscriptionIdentityType const type. -func PossibleEventSubscriptionIdentityTypeValues() []EventSubscriptionIdentityType { - return []EventSubscriptionIdentityType{SystemAssigned, UserAssigned} -} - -// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. -type EventSubscriptionProvisioningState string - -const ( - // EventSubscriptionProvisioningStateAwaitingManualAction ... - EventSubscriptionProvisioningStateAwaitingManualAction EventSubscriptionProvisioningState = "AwaitingManualAction" - // EventSubscriptionProvisioningStateCanceled ... - EventSubscriptionProvisioningStateCanceled EventSubscriptionProvisioningState = "Canceled" - // EventSubscriptionProvisioningStateCreating ... - EventSubscriptionProvisioningStateCreating EventSubscriptionProvisioningState = "Creating" - // EventSubscriptionProvisioningStateDeleting ... - EventSubscriptionProvisioningStateDeleting EventSubscriptionProvisioningState = "Deleting" - // EventSubscriptionProvisioningStateFailed ... - EventSubscriptionProvisioningStateFailed EventSubscriptionProvisioningState = "Failed" - // EventSubscriptionProvisioningStateSucceeded ... - EventSubscriptionProvisioningStateSucceeded EventSubscriptionProvisioningState = "Succeeded" - // EventSubscriptionProvisioningStateUpdating ... - EventSubscriptionProvisioningStateUpdating EventSubscriptionProvisioningState = "Updating" -) - -// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. -func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { - return []EventSubscriptionProvisioningState{EventSubscriptionProvisioningStateAwaitingManualAction, EventSubscriptionProvisioningStateCanceled, EventSubscriptionProvisioningStateCreating, EventSubscriptionProvisioningStateDeleting, EventSubscriptionProvisioningStateFailed, EventSubscriptionProvisioningStateSucceeded, EventSubscriptionProvisioningStateUpdating} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // IdentityTypeNone ... - IdentityTypeNone IdentityType = "None" - // IdentityTypeSystemAssigned ... - IdentityTypeSystemAssigned IdentityType = "SystemAssigned" - // IdentityTypeSystemAssignedUserAssigned ... - IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned, UserAssigned" - // IdentityTypeUserAssigned ... - IdentityTypeUserAssigned IdentityType = "UserAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeSystemAssignedUserAssigned, IdentityTypeUserAssigned} -} - -// InputSchema enumerates the values for input schema. -type InputSchema string - -const ( - // InputSchemaCloudEventSchemaV10 ... - InputSchemaCloudEventSchemaV10 InputSchema = "CloudEventSchemaV1_0" - // InputSchemaCustomEventSchema ... - InputSchemaCustomEventSchema InputSchema = "CustomEventSchema" - // InputSchemaEventGridSchema ... - InputSchemaEventGridSchema InputSchema = "EventGridSchema" -) - -// PossibleInputSchemaValues returns an array of possible values for the InputSchema const type. -func PossibleInputSchemaValues() []InputSchema { - return []InputSchema{InputSchemaCloudEventSchemaV10, InputSchemaCustomEventSchema, InputSchemaEventGridSchema} -} - -// InputSchemaMappingType enumerates the values for input schema mapping type. -type InputSchemaMappingType string - -const ( - // InputSchemaMappingTypeInputSchemaMapping ... - InputSchemaMappingTypeInputSchemaMapping InputSchemaMappingType = "InputSchemaMapping" - // InputSchemaMappingTypeJSON ... - InputSchemaMappingTypeJSON InputSchemaMappingType = "Json" -) - -// PossibleInputSchemaMappingTypeValues returns an array of possible values for the InputSchemaMappingType const type. -func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { - return []InputSchemaMappingType{InputSchemaMappingTypeInputSchemaMapping, InputSchemaMappingTypeJSON} -} - -// IPActionType enumerates the values for ip action type. -type IPActionType string - -const ( - // Allow ... - Allow IPActionType = "Allow" -) - -// PossibleIPActionTypeValues returns an array of possible values for the IPActionType const type. -func PossibleIPActionTypeValues() []IPActionType { - return []IPActionType{Allow} -} - -// OperatorType enumerates the values for operator type. -type OperatorType string - -const ( - // OperatorTypeAdvancedFilter ... - OperatorTypeAdvancedFilter OperatorType = "AdvancedFilter" - // OperatorTypeBoolEquals ... - OperatorTypeBoolEquals OperatorType = "BoolEquals" - // OperatorTypeIsNotNull ... - OperatorTypeIsNotNull OperatorType = "IsNotNull" - // OperatorTypeIsNullOrUndefined ... - OperatorTypeIsNullOrUndefined OperatorType = "IsNullOrUndefined" - // OperatorTypeNumberGreaterThan ... - OperatorTypeNumberGreaterThan OperatorType = "NumberGreaterThan" - // OperatorTypeNumberGreaterThanOrEquals ... - OperatorTypeNumberGreaterThanOrEquals OperatorType = "NumberGreaterThanOrEquals" - // OperatorTypeNumberIn ... - OperatorTypeNumberIn OperatorType = "NumberIn" - // OperatorTypeNumberInRange ... - OperatorTypeNumberInRange OperatorType = "NumberInRange" - // OperatorTypeNumberLessThan ... - OperatorTypeNumberLessThan OperatorType = "NumberLessThan" - // OperatorTypeNumberLessThanOrEquals ... - OperatorTypeNumberLessThanOrEquals OperatorType = "NumberLessThanOrEquals" - // OperatorTypeNumberNotIn ... - OperatorTypeNumberNotIn OperatorType = "NumberNotIn" - // OperatorTypeNumberNotInRange ... - OperatorTypeNumberNotInRange OperatorType = "NumberNotInRange" - // OperatorTypeStringBeginsWith ... - OperatorTypeStringBeginsWith OperatorType = "StringBeginsWith" - // OperatorTypeStringContains ... - OperatorTypeStringContains OperatorType = "StringContains" - // OperatorTypeStringEndsWith ... - OperatorTypeStringEndsWith OperatorType = "StringEndsWith" - // OperatorTypeStringIn ... - OperatorTypeStringIn OperatorType = "StringIn" - // OperatorTypeStringNotBeginsWith ... - OperatorTypeStringNotBeginsWith OperatorType = "StringNotBeginsWith" - // OperatorTypeStringNotContains ... - OperatorTypeStringNotContains OperatorType = "StringNotContains" - // OperatorTypeStringNotEndsWith ... - OperatorTypeStringNotEndsWith OperatorType = "StringNotEndsWith" - // OperatorTypeStringNotIn ... - OperatorTypeStringNotIn OperatorType = "StringNotIn" -) - -// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. -func PossibleOperatorTypeValues() []OperatorType { - return []OperatorType{OperatorTypeAdvancedFilter, OperatorTypeBoolEquals, OperatorTypeIsNotNull, OperatorTypeIsNullOrUndefined, OperatorTypeNumberGreaterThan, OperatorTypeNumberGreaterThanOrEquals, OperatorTypeNumberIn, OperatorTypeNumberInRange, OperatorTypeNumberLessThan, OperatorTypeNumberLessThanOrEquals, OperatorTypeNumberNotIn, OperatorTypeNumberNotInRange, OperatorTypeStringBeginsWith, OperatorTypeStringContains, OperatorTypeStringEndsWith, OperatorTypeStringIn, OperatorTypeStringNotBeginsWith, OperatorTypeStringNotContains, OperatorTypeStringNotEndsWith, OperatorTypeStringNotIn} -} - -// PartnerNamespaceProvisioningState enumerates the values for partner namespace provisioning state. -type PartnerNamespaceProvisioningState string - -const ( - // PartnerNamespaceProvisioningStateCanceled ... - PartnerNamespaceProvisioningStateCanceled PartnerNamespaceProvisioningState = "Canceled" - // PartnerNamespaceProvisioningStateCreating ... - PartnerNamespaceProvisioningStateCreating PartnerNamespaceProvisioningState = "Creating" - // PartnerNamespaceProvisioningStateDeleting ... - PartnerNamespaceProvisioningStateDeleting PartnerNamespaceProvisioningState = "Deleting" - // PartnerNamespaceProvisioningStateFailed ... - PartnerNamespaceProvisioningStateFailed PartnerNamespaceProvisioningState = "Failed" - // PartnerNamespaceProvisioningStateSucceeded ... - PartnerNamespaceProvisioningStateSucceeded PartnerNamespaceProvisioningState = "Succeeded" - // PartnerNamespaceProvisioningStateUpdating ... - PartnerNamespaceProvisioningStateUpdating PartnerNamespaceProvisioningState = "Updating" -) - -// PossiblePartnerNamespaceProvisioningStateValues returns an array of possible values for the PartnerNamespaceProvisioningState const type. -func PossiblePartnerNamespaceProvisioningStateValues() []PartnerNamespaceProvisioningState { - return []PartnerNamespaceProvisioningState{PartnerNamespaceProvisioningStateCanceled, PartnerNamespaceProvisioningStateCreating, PartnerNamespaceProvisioningStateDeleting, PartnerNamespaceProvisioningStateFailed, PartnerNamespaceProvisioningStateSucceeded, PartnerNamespaceProvisioningStateUpdating} -} - -// PartnerRegistrationProvisioningState enumerates the values for partner registration provisioning state. -type PartnerRegistrationProvisioningState string - -const ( - // PartnerRegistrationProvisioningStateCanceled ... - PartnerRegistrationProvisioningStateCanceled PartnerRegistrationProvisioningState = "Canceled" - // PartnerRegistrationProvisioningStateCreating ... - PartnerRegistrationProvisioningStateCreating PartnerRegistrationProvisioningState = "Creating" - // PartnerRegistrationProvisioningStateDeleting ... - PartnerRegistrationProvisioningStateDeleting PartnerRegistrationProvisioningState = "Deleting" - // PartnerRegistrationProvisioningStateFailed ... - PartnerRegistrationProvisioningStateFailed PartnerRegistrationProvisioningState = "Failed" - // PartnerRegistrationProvisioningStateSucceeded ... - PartnerRegistrationProvisioningStateSucceeded PartnerRegistrationProvisioningState = "Succeeded" - // PartnerRegistrationProvisioningStateUpdating ... - PartnerRegistrationProvisioningStateUpdating PartnerRegistrationProvisioningState = "Updating" -) - -// PossiblePartnerRegistrationProvisioningStateValues returns an array of possible values for the PartnerRegistrationProvisioningState const type. -func PossiblePartnerRegistrationProvisioningStateValues() []PartnerRegistrationProvisioningState { - return []PartnerRegistrationProvisioningState{PartnerRegistrationProvisioningStateCanceled, PartnerRegistrationProvisioningStateCreating, PartnerRegistrationProvisioningStateDeleting, PartnerRegistrationProvisioningStateFailed, PartnerRegistrationProvisioningStateSucceeded, PartnerRegistrationProvisioningStateUpdating} -} - -// PartnerRegistrationVisibilityState enumerates the values for partner registration visibility state. -type PartnerRegistrationVisibilityState string - -const ( - // GenerallyAvailable ... - GenerallyAvailable PartnerRegistrationVisibilityState = "GenerallyAvailable" - // Hidden ... - Hidden PartnerRegistrationVisibilityState = "Hidden" - // PublicPreview ... - PublicPreview PartnerRegistrationVisibilityState = "PublicPreview" -) - -// PossiblePartnerRegistrationVisibilityStateValues returns an array of possible values for the PartnerRegistrationVisibilityState const type. -func PossiblePartnerRegistrationVisibilityStateValues() []PartnerRegistrationVisibilityState { - return []PartnerRegistrationVisibilityState{GenerallyAvailable, Hidden, PublicPreview} -} - -// PartnerTopicActivationState enumerates the values for partner topic activation state. -type PartnerTopicActivationState string - -const ( - // Activated ... - Activated PartnerTopicActivationState = "Activated" - // Deactivated ... - Deactivated PartnerTopicActivationState = "Deactivated" - // NeverActivated ... - NeverActivated PartnerTopicActivationState = "NeverActivated" -) - -// PossiblePartnerTopicActivationStateValues returns an array of possible values for the PartnerTopicActivationState const type. -func PossiblePartnerTopicActivationStateValues() []PartnerTopicActivationState { - return []PartnerTopicActivationState{Activated, Deactivated, NeverActivated} -} - -// PartnerTopicProvisioningState enumerates the values for partner topic provisioning state. -type PartnerTopicProvisioningState string - -const ( - // PartnerTopicProvisioningStateCanceled ... - PartnerTopicProvisioningStateCanceled PartnerTopicProvisioningState = "Canceled" - // PartnerTopicProvisioningStateCreating ... - PartnerTopicProvisioningStateCreating PartnerTopicProvisioningState = "Creating" - // PartnerTopicProvisioningStateDeleting ... - PartnerTopicProvisioningStateDeleting PartnerTopicProvisioningState = "Deleting" - // PartnerTopicProvisioningStateFailed ... - PartnerTopicProvisioningStateFailed PartnerTopicProvisioningState = "Failed" - // PartnerTopicProvisioningStateSucceeded ... - PartnerTopicProvisioningStateSucceeded PartnerTopicProvisioningState = "Succeeded" - // PartnerTopicProvisioningStateUpdating ... - PartnerTopicProvisioningStateUpdating PartnerTopicProvisioningState = "Updating" -) - -// PossiblePartnerTopicProvisioningStateValues returns an array of possible values for the PartnerTopicProvisioningState const type. -func PossiblePartnerTopicProvisioningStateValues() []PartnerTopicProvisioningState { - return []PartnerTopicProvisioningState{PartnerTopicProvisioningStateCanceled, PartnerTopicProvisioningStateCreating, PartnerTopicProvisioningStateDeleting, PartnerTopicProvisioningStateFailed, PartnerTopicProvisioningStateSucceeded, PartnerTopicProvisioningStateUpdating} -} - -// PartnerTopicReadinessState enumerates the values for partner topic readiness state. -type PartnerTopicReadinessState string - -const ( - // ActivatedByUser ... - ActivatedByUser PartnerTopicReadinessState = "ActivatedByUser" - // DeactivatedByUser ... - DeactivatedByUser PartnerTopicReadinessState = "DeactivatedByUser" - // DeletedByUser ... - DeletedByUser PartnerTopicReadinessState = "DeletedByUser" - // NotActivatedByUserYet ... - NotActivatedByUserYet PartnerTopicReadinessState = "NotActivatedByUserYet" -) - -// PossiblePartnerTopicReadinessStateValues returns an array of possible values for the PartnerTopicReadinessState const type. -func PossiblePartnerTopicReadinessStateValues() []PartnerTopicReadinessState { - return []PartnerTopicReadinessState{ActivatedByUser, DeactivatedByUser, DeletedByUser, NotActivatedByUserYet} -} - -// PartnerTopicTypeAuthorizationState enumerates the values for partner topic type authorization state. -type PartnerTopicTypeAuthorizationState string - -const ( - // Authorized ... - Authorized PartnerTopicTypeAuthorizationState = "Authorized" - // NotApplicable ... - NotApplicable PartnerTopicTypeAuthorizationState = "NotApplicable" - // NotAuthorized ... - NotAuthorized PartnerTopicTypeAuthorizationState = "NotAuthorized" -) - -// PossiblePartnerTopicTypeAuthorizationStateValues returns an array of possible values for the PartnerTopicTypeAuthorizationState const type. -func PossiblePartnerTopicTypeAuthorizationStateValues() []PartnerTopicTypeAuthorizationState { - return []PartnerTopicTypeAuthorizationState{Authorized, NotApplicable, NotAuthorized} -} - -// PersistedConnectionStatus enumerates the values for persisted connection status. -type PersistedConnectionStatus string - -const ( - // Approved ... - Approved PersistedConnectionStatus = "Approved" - // Disconnected ... - Disconnected PersistedConnectionStatus = "Disconnected" - // Pending ... - Pending PersistedConnectionStatus = "Pending" - // Rejected ... - Rejected PersistedConnectionStatus = "Rejected" -) - -// PossiblePersistedConnectionStatusValues returns an array of possible values for the PersistedConnectionStatus const type. -func PossiblePersistedConnectionStatusValues() []PersistedConnectionStatus { - return []PersistedConnectionStatus{Approved, Disconnected, Pending, Rejected} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // Disabled ... - Disabled PublicNetworkAccess = "Disabled" - // Enabled ... - Enabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{Disabled, Enabled} -} - -// ResourceKind enumerates the values for resource kind. -type ResourceKind string - -const ( - // Azure ... - Azure ResourceKind = "Azure" - // AzureArc ... - AzureArc ResourceKind = "AzureArc" -) - -// PossibleResourceKindValues returns an array of possible values for the ResourceKind const type. -func PossibleResourceKindValues() []ResourceKind { - return []ResourceKind{Azure, AzureArc} -} - -// ResourceProvisioningState enumerates the values for resource provisioning state. -type ResourceProvisioningState string - -const ( - // ResourceProvisioningStateCanceled ... - ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" - // ResourceProvisioningStateCreating ... - ResourceProvisioningStateCreating ResourceProvisioningState = "Creating" - // ResourceProvisioningStateDeleting ... - ResourceProvisioningStateDeleting ResourceProvisioningState = "Deleting" - // ResourceProvisioningStateFailed ... - ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" - // ResourceProvisioningStateSucceeded ... - ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" - // ResourceProvisioningStateUpdating ... - ResourceProvisioningStateUpdating ResourceProvisioningState = "Updating" -) - -// PossibleResourceProvisioningStateValues returns an array of possible values for the ResourceProvisioningState const type. -func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { - return []ResourceProvisioningState{ResourceProvisioningStateCanceled, ResourceProvisioningStateCreating, ResourceProvisioningStateDeleting, ResourceProvisioningStateFailed, ResourceProvisioningStateSucceeded, ResourceProvisioningStateUpdating} -} - -// ResourceRegionType enumerates the values for resource region type. -type ResourceRegionType string - -const ( - // GlobalResource ... - GlobalResource ResourceRegionType = "GlobalResource" - // RegionalResource ... - RegionalResource ResourceRegionType = "RegionalResource" -) - -// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. -func PossibleResourceRegionTypeValues() []ResourceRegionType { - return []ResourceRegionType{GlobalResource, RegionalResource} -} - -// Sku enumerates the values for sku. -type Sku string - -const ( - // Basic ... - Basic Sku = "Basic" - // Premium ... - Premium Sku = "Premium" -) - -// PossibleSkuValues returns an array of possible values for the Sku const type. -func PossibleSkuValues() []Sku { - return []Sku{Basic, Premium} -} - -// TopicProvisioningState enumerates the values for topic provisioning state. -type TopicProvisioningState string - -const ( - // TopicProvisioningStateCanceled ... - TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" - // TopicProvisioningStateCreating ... - TopicProvisioningStateCreating TopicProvisioningState = "Creating" - // TopicProvisioningStateDeleting ... - TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" - // TopicProvisioningStateFailed ... - TopicProvisioningStateFailed TopicProvisioningState = "Failed" - // TopicProvisioningStateSucceeded ... - TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" - // TopicProvisioningStateUpdating ... - TopicProvisioningStateUpdating TopicProvisioningState = "Updating" -) - -// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. -func PossibleTopicProvisioningStateValues() []TopicProvisioningState { - return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} -} - -// TopicTypeProvisioningState enumerates the values for topic type provisioning state. -type TopicTypeProvisioningState string - -const ( - // TopicTypeProvisioningStateCanceled ... - TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" - // TopicTypeProvisioningStateCreating ... - TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" - // TopicTypeProvisioningStateDeleting ... - TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" - // TopicTypeProvisioningStateFailed ... - TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" - // TopicTypeProvisioningStateSucceeded ... - TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" - // TopicTypeProvisioningStateUpdating ... - TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" -) - -// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. -func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { - return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeDeliveryAttributeMapping ... - TypeDeliveryAttributeMapping Type = "DeliveryAttributeMapping" - // TypeDynamic ... - TypeDynamic Type = "Dynamic" - // TypeStatic ... - TypeStatic Type = "Static" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeDeliveryAttributeMapping, TypeDynamic, TypeStatic} -} diff --git a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventchannels.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventchannels.go deleted file mode 100644 index f673813782d1..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventchannels.go +++ /dev/null @@ -1,403 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventChannelsClient is the azure EventGrid Management Client -type EventChannelsClient struct { - BaseClient -} - -// NewEventChannelsClient creates an instance of the EventChannelsClient client. -func NewEventChannelsClient(subscriptionID string) EventChannelsClient { - return NewEventChannelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventChannelsClientWithBaseURI creates an instance of the EventChannelsClient 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 NewEventChannelsClientWithBaseURI(baseURI string, subscriptionID string) EventChannelsClient { - return EventChannelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new event channel with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// eventChannelName - name of the event channel. -// eventChannelInfo - eventChannel information. -func (client EventChannelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo EventChannel) (result EventChannel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.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, partnerNamespaceName, eventChannelName, eventChannelInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventChannelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo EventChannel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventChannelName": autorest.Encode("path", eventChannelName), - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - eventChannelInfo.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.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}", pathParameters), - autorest.WithJSON(eventChannelInfo), - 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 EventChannelsClient) 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 EventChannelsClient) CreateOrUpdateResponder(resp *http.Response) (result EventChannel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete existing event channel. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// eventChannelName - name of the event channel. -func (client EventChannelsClient) Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result EventChannelsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerNamespaceName, eventChannelName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventChannelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventChannelName": autorest.Encode("path", eventChannelName), - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}", 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 EventChannelsClient) DeleteSender(req *http.Request) (future EventChannelsDeleteFuture, 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 EventChannelsClient) 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 get properties of an event channel. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// eventChannelName - name of the event channel. -func (client EventChannelsClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result EventChannel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.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, partnerNamespaceName, eventChannelName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventChannelsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventChannelName": autorest.Encode("path", eventChannelName), - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}", 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 EventChannelsClient) 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 EventChannelsClient) GetResponder(resp *http.Response) (result EventChannel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByPartnerNamespace list all the event channels in a partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventChannelsClient) ListByPartnerNamespace(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result EventChannelsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.ListByPartnerNamespace") - defer func() { - sc := -1 - if result.eclr.Response.Response != nil { - sc = result.eclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByPartnerNamespaceNextResults - req, err := client.ListByPartnerNamespacePreparer(ctx, resourceGroupName, partnerNamespaceName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "ListByPartnerNamespace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPartnerNamespaceSender(req) - if err != nil { - result.eclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "ListByPartnerNamespace", resp, "Failure sending request") - return - } - - result.eclr, err = client.ListByPartnerNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "ListByPartnerNamespace", resp, "Failure responding to request") - return - } - if result.eclr.hasNextLink() && result.eclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPartnerNamespacePreparer prepares the ListByPartnerNamespace request. -func (client EventChannelsClient) ListByPartnerNamespacePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPartnerNamespaceSender sends the ListByPartnerNamespace request. The method will close the -// http.Response Body if it receives an error. -func (client EventChannelsClient) ListByPartnerNamespaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPartnerNamespaceResponder handles the response to the ListByPartnerNamespace request. The method always -// closes the http.Response Body. -func (client EventChannelsClient) ListByPartnerNamespaceResponder(resp *http.Response) (result EventChannelsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPartnerNamespaceNextResults retrieves the next set of results, if any. -func (client EventChannelsClient) listByPartnerNamespaceNextResults(ctx context.Context, lastResults EventChannelsListResult) (result EventChannelsListResult, err error) { - req, err := lastResults.eventChannelsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "listByPartnerNamespaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPartnerNamespaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "listByPartnerNamespaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPartnerNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "listByPartnerNamespaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPartnerNamespaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventChannelsClient) ListByPartnerNamespaceComplete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result EventChannelsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.ListByPartnerNamespace") - 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.ListByPartnerNamespace(ctx, resourceGroupName, partnerNamespaceName, filter, top) - return -} diff --git a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventgridapi/interfaces.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventgridapi/interfaces.go deleted file mode 100644 index 5563daa428e5..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventgridapi/interfaces.go +++ /dev/null @@ -1,231 +0,0 @@ -package eventgridapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/eventgrid/mgmt/2020-10-15-preview/eventgrid" - "github.com/Azure/go-autorest/autorest" -) - -// DomainsClientAPI contains the set of methods on the DomainsClient type. -type DomainsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo eventgrid.Domain) (result eventgrid.DomainsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.Domain, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest eventgrid.DomainRegenerateKeyRequest) (result eventgrid.DomainSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters eventgrid.DomainUpdateParameters) (result eventgrid.DomainsUpdateFuture, err error) -} - -var _ DomainsClientAPI = (*eventgrid.DomainsClient)(nil) - -// DomainTopicsClientAPI contains the set of methods on the DomainTopicsClient type. -type DomainTopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopic, err error) - ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultPage, err error) - ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultIterator, err error) -} - -var _ DomainTopicsClientAPI = (*eventgrid.DomainTopicsClient)(nil) - -// EventChannelsClientAPI contains the set of methods on the EventChannelsClient type. -type EventChannelsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo eventgrid.EventChannel) (result eventgrid.EventChannel, err error) - Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result eventgrid.EventChannelsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result eventgrid.EventChannel, err error) - ListByPartnerNamespace(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result eventgrid.EventChannelsListResultPage, err error) - ListByPartnerNamespaceComplete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result eventgrid.EventChannelsListResultIterator, err error) -} - -var _ EventChannelsClientAPI = (*eventgrid.EventChannelsClient)(nil) - -// EventSubscriptionsClientAPI contains the set of methods on the EventSubscriptionsClient type. -type EventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.EventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetDeliveryAttributes(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.DeliveryAttributeListResult, err error) - GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.EventSubscriptionsUpdateFuture, err error) -} - -var _ EventSubscriptionsClientAPI = (*eventgrid.EventSubscriptionsClient)(nil) - -// SystemTopicEventSubscriptionsClientAPI contains the set of methods on the SystemTopicEventSubscriptionsClient type. -type SystemTopicEventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.SystemTopicEventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetDeliveryAttributes(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.DeliveryAttributeListResult, err error) - GetFullURL(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListBySystemTopic(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListBySystemTopicComplete(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.SystemTopicEventSubscriptionsUpdateFuture, err error) -} - -var _ SystemTopicEventSubscriptionsClientAPI = (*eventgrid.SystemTopicEventSubscriptionsClient)(nil) - -// PartnerTopicEventSubscriptionsClientAPI contains the set of methods on the PartnerTopicEventSubscriptionsClient type. -type PartnerTopicEventSubscriptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.PartnerTopicEventSubscriptionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) - GetDeliveryAttributes(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.DeliveryAttributeListResult, err error) - GetFullURL(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) - ListByPartnerTopic(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) - ListByPartnerTopicComplete(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.PartnerTopicEventSubscriptionsUpdateFuture, err error) -} - -var _ PartnerTopicEventSubscriptionsClientAPI = (*eventgrid.PartnerTopicEventSubscriptionsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result eventgrid.OperationsListResult, err error) -} - -var _ OperationsClientAPI = (*eventgrid.OperationsClient)(nil) - -// PartnerNamespacesClientAPI contains the set of methods on the PartnerNamespacesClient type. -type PartnerNamespacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo eventgrid.PartnerNamespace) (result eventgrid.PartnerNamespacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result eventgrid.PartnerNamespacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result eventgrid.PartnerNamespace, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultIterator, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result eventgrid.PartnerNamespaceSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest eventgrid.PartnerNamespaceRegenerateKeyRequest) (result eventgrid.PartnerNamespaceSharedAccessKeys, err error) - Update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters eventgrid.PartnerNamespaceUpdateParameters) (result eventgrid.PartnerNamespacesUpdateFuture, err error) -} - -var _ PartnerNamespacesClientAPI = (*eventgrid.PartnerNamespacesClient)(nil) - -// PartnerRegistrationsClientAPI contains the set of methods on the PartnerRegistrationsClient type. -type PartnerRegistrationsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo eventgrid.PartnerRegistration) (result eventgrid.PartnerRegistration, err error) - Delete(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result eventgrid.PartnerRegistration, err error) - List(ctx context.Context) (result eventgrid.PartnerRegistrationsListResult, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters eventgrid.PartnerRegistrationUpdateParameters) (result eventgrid.PartnerRegistration, err error) -} - -var _ PartnerRegistrationsClientAPI = (*eventgrid.PartnerRegistrationsClient)(nil) - -// PartnerTopicsClientAPI contains the set of methods on the PartnerTopicsClient type. -type PartnerTopicsClientAPI interface { - Activate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopic, err error) - Deactivate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopic, err error) - Delete(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerTopicsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerTopicsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerTopicsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerTopicsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters eventgrid.PartnerTopicUpdateParameters) (result eventgrid.PartnerTopic, err error) -} - -var _ PartnerTopicsClientAPI = (*eventgrid.PartnerTopicsClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result eventgrid.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result eventgrid.PrivateEndpointConnection, err error) - ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateEndpointConnectionListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateEndpointConnectionListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string, privateEndpointConnection eventgrid.PrivateEndpointConnection) (result eventgrid.PrivateEndpointConnectionsUpdateFuture, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*eventgrid.PrivateEndpointConnectionsClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string) (result eventgrid.PrivateLinkResource, err error) - ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateLinkResourcesListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateLinkResourcesListResultIterator, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*eventgrid.PrivateLinkResourcesClient)(nil) - -// SystemTopicsClientAPI contains the set of methods on the SystemTopicsClient type. -type SystemTopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo eventgrid.SystemTopic) (result eventgrid.SystemTopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, systemTopicName string) (result eventgrid.SystemTopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, systemTopicName string) (result eventgrid.SystemTopic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.SystemTopicsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.SystemTopicsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.SystemTopicsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.SystemTopicsListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters eventgrid.SystemTopicUpdateParameters) (result eventgrid.SystemTopicsUpdateFuture, err error) -} - -var _ SystemTopicsClientAPI = (*eventgrid.SystemTopicsClient)(nil) - -// TopicsClientAPI contains the set of methods on the TopicsClient type. -type TopicsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo eventgrid.Topic) (result eventgrid.TopicsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.Topic, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) - ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) - ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventTypesListResult, err error) - ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicSharedAccessKeys, err error) - RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest eventgrid.TopicRegenerateKeyRequest) (result eventgrid.TopicsRegenerateKeyFuture, err error) - Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters eventgrid.TopicUpdateParameters) (result eventgrid.TopicsUpdateFuture, err error) -} - -var _ TopicsClientAPI = (*eventgrid.TopicsClient)(nil) - -// ExtensionTopicsClientAPI contains the set of methods on the ExtensionTopicsClient type. -type ExtensionTopicsClientAPI interface { - Get(ctx context.Context, scope string) (result eventgrid.ExtensionTopic, err error) -} - -var _ ExtensionTopicsClientAPI = (*eventgrid.ExtensionTopicsClient)(nil) - -// TopicTypesClientAPI contains the set of methods on the TopicTypesClient type. -type TopicTypesClientAPI interface { - Get(ctx context.Context, topicTypeName string) (result eventgrid.TopicTypeInfo, err error) - List(ctx context.Context) (result eventgrid.TopicTypesListResult, err error) - ListEventTypes(ctx context.Context, topicTypeName string) (result eventgrid.EventTypesListResult, err error) -} - -var _ TopicTypesClientAPI = (*eventgrid.TopicTypesClient)(nil) diff --git a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventsubscriptions.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventsubscriptions.go deleted file mode 100644 index e75c274cea32..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventsubscriptions.go +++ /dev/null @@ -1,1865 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventSubscriptionsClient is the azure EventGrid Management Client -type EventSubscriptionsClient struct { - BaseClient -} - -// NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. -func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { - return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient 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 NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { - return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new event subscription or updates an existing event subscription based on -// the specified scope. -// Parameters: -// scope - the identifier of the resource to which the event subscription needs to be created or updated. The -// scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider -// namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. Event subscription names must be between 3 and 64 -// characters in length and should use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information. -func (client EventSubscriptionsClient) CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - eventSubscriptionInfo.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 EventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future EventSubscriptionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an existing event subscription. -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. -func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) 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 get properties of an event subscription. -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. -func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.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, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) 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 EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeliveryAttributes get all delivery attributes for an event subscription. -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. -func (client EventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, scope string, eventSubscriptionName string) (result DeliveryAttributeListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetDeliveryAttributes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDeliveryAttributesPreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetDeliveryAttributes", nil, "Failure preparing request") - return - } - - resp, err := client.GetDeliveryAttributesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure sending request") - return - } - - result, err = client.GetDeliveryAttributesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure responding to request") - return - } - - return -} - -// GetDeliveryAttributesPreparer prepares the GetDeliveryAttributes request. -func (client EventSubscriptionsClient) GetDeliveryAttributesPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDeliveryAttributesSender sends the GetDeliveryAttributes request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) GetDeliveryAttributesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetDeliveryAttributesResponder handles the response to the GetDeliveryAttributes request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) GetDeliveryAttributesResponder(resp *http.Response) (result DeliveryAttributeListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription. -// Parameters: -// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top -// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription. -func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDomainTopic list all event subscriptions that have been created for a specific domain topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// domainName - name of the top level domain. -// topicName - name of the domain topic. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDomainTopicNextResults - req, err := client.ListByDomainTopicPreparer(ctx, resourceGroupName, domainName, topicName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDomainTopicSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByDomainTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDomainTopicPreparer prepares the ListByDomainTopic request. -func (client EventSubscriptionsClient) ListByDomainTopicPreparer(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDomainTopicSender sends the ListByDomainTopic request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByDomainTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDomainTopicResponder handles the response to the ListByDomainTopic request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByDomainTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDomainTopicNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listByDomainTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDomainTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDomainTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDomainTopicComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") - 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.ListByDomainTopic(ctx, resourceGroupName, domainName, topicName, filter, top) - return -} - -// ListByResource list all event subscriptions that have been created for a specific topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic. -// resourceTypeName - name of the resource type. -// resourceName - name of the resource. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listByResourceNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") - 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.ListByResource(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top) - return -} - -// ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource -// group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalByResourceGroupNextResults - req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalByResourceGroupNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") - 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.ListGlobalByResourceGroup(ctx, resourceGroupName, filter, top) - return -} - -// ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific -// topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicTypeName - name of the topic type. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalByResourceGroupForTopicTypeNextResults - req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") - 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.ListGlobalByResourceGroupForTopicType(ctx, resourceGroupName, topicTypeName, filter, top) - return -} - -// ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalBySubscriptionNextResults - req, err := client.ListGlobalBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalBySubscriptionNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") - 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.ListGlobalBySubscription(ctx, filter, top) - return -} - -// ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic -// type. -// Parameters: -// topicTypeName - name of the topic type. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listGlobalBySubscriptionForTopicTypeNextResults - req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listGlobalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListGlobalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") - 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.ListGlobalBySubscriptionForTopicType(ctx, topicTypeName, filter, top) - return -} - -// ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription -// and resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalByResourceGroupNextResults - req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalByResourceGroupNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") - 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.ListRegionalByResourceGroup(ctx, resourceGroupName, location, filter, top) - return -} - -// ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and resource group and topic type. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// location - name of the location. -// topicTypeName - name of the topic type. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalByResourceGroupForTopicTypeNextResults - req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") - 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.ListRegionalByResourceGroupForTopicType(ctx, resourceGroupName, location, topicTypeName, filter, top) - return -} - -// ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription. -// Parameters: -// location - name of the location. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalBySubscriptionNextResults - req, err := client.ListRegionalBySubscriptionPreparer(ctx, location, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(ctx context.Context, location string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalBySubscriptionNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") - 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.ListRegionalBySubscription(ctx, location, filter, top) - return -} - -// ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure -// subscription and topic type. -// Parameters: -// location - name of the location. -// topicTypeName - name of the topic type. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRegionalBySubscriptionForTopicTypeNextResults - req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", nil, "Failure preparing request") - return - } - - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the -// http.Response Body if it receives an error. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always -// closes the http.Response Body. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRegionalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. -func (client EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRegionalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") - 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.ListRegionalBySubscriptionForTopicType(ctx, location, topicTypeName, filter, top) - return -} - -// Update asynchronously updates an existing event subscription. -// Parameters: -// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a -// top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for a resource, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' -// for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be updated. -// eventSubscriptionUpdateParameters - updated event subscription information. -func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "scope": scope, - } - - const APIVersion = "2020-10-15-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("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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 EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/extensiontopics.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/extensiontopics.go deleted file mode 100644 index 437637c7044b..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/extensiontopics.go +++ /dev/null @@ -1,109 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ExtensionTopicsClient is the azure EventGrid Management Client -type ExtensionTopicsClient struct { - BaseClient -} - -// NewExtensionTopicsClient creates an instance of the ExtensionTopicsClient client. -func NewExtensionTopicsClient(subscriptionID string) ExtensionTopicsClient { - return NewExtensionTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExtensionTopicsClientWithBaseURI creates an instance of the ExtensionTopicsClient 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 NewExtensionTopicsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTopicsClient { - return ExtensionTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the properties of an extension topic. -// Parameters: -// scope - the identifier of the resource to which extension topic is queried. The scope can be a subscription, -// or a resource group, or a top level resource belonging to a resource provider namespace. For example, use -// '/subscriptions/{subscriptionId}/' for a subscription, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' -// for Azure resource. -func (client ExtensionTopicsClient) Get(ctx context.Context, scope string) (result ExtensionTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTopicsClient.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, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.ExtensionTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.ExtensionTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.ExtensionTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExtensionTopicsClient) GetPreparer(ctx context.Context, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/extensionTopics/default", 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 ExtensionTopicsClient) 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 ExtensionTopicsClient) GetResponder(resp *http.Response) (result ExtensionTopic, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/models.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/models.go deleted file mode 100644 index d72a7a4212d1..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/models.go +++ /dev/null @@ -1,10538 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid" - -// BasicAdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do -// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as -// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of the key -// based on which you want to filter. -type BasicAdvancedFilter interface { - AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) - AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) - AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) - AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) - AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) - AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) - AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) - AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) - AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) - AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) - AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) - AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) - AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) - AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) - AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) - AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) - AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) - AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) - AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) - AsAdvancedFilter() (*AdvancedFilter, bool) -} - -// AdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do -// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as -// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of -// the key based on which you want to filter. -type AdvancedFilter struct { - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -func unmarshalBasicAdvancedFilter(body []byte) (BasicAdvancedFilter, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["operatorType"] { - case string(OperatorTypeNumberIn): - var niaf NumberInAdvancedFilter - err := json.Unmarshal(body, &niaf) - return niaf, err - case string(OperatorTypeNumberNotIn): - var nniaf NumberNotInAdvancedFilter - err := json.Unmarshal(body, &nniaf) - return nniaf, err - case string(OperatorTypeNumberLessThan): - var nltaf NumberLessThanAdvancedFilter - err := json.Unmarshal(body, &nltaf) - return nltaf, err - case string(OperatorTypeNumberGreaterThan): - var ngtaf NumberGreaterThanAdvancedFilter - err := json.Unmarshal(body, &ngtaf) - return ngtaf, err - case string(OperatorTypeNumberLessThanOrEquals): - var nltoeaf NumberLessThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &nltoeaf) - return nltoeaf, err - case string(OperatorTypeNumberGreaterThanOrEquals): - var ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter - err := json.Unmarshal(body, &ngtoeaf) - return ngtoeaf, err - case string(OperatorTypeBoolEquals): - var beaf BoolEqualsAdvancedFilter - err := json.Unmarshal(body, &beaf) - return beaf, err - case string(OperatorTypeStringIn): - var siaf StringInAdvancedFilter - err := json.Unmarshal(body, &siaf) - return siaf, err - case string(OperatorTypeStringNotIn): - var sniaf StringNotInAdvancedFilter - err := json.Unmarshal(body, &sniaf) - return sniaf, err - case string(OperatorTypeStringBeginsWith): - var sbwaf StringBeginsWithAdvancedFilter - err := json.Unmarshal(body, &sbwaf) - return sbwaf, err - case string(OperatorTypeStringEndsWith): - var sewaf StringEndsWithAdvancedFilter - err := json.Unmarshal(body, &sewaf) - return sewaf, err - case string(OperatorTypeStringContains): - var scaf StringContainsAdvancedFilter - err := json.Unmarshal(body, &scaf) - return scaf, err - case string(OperatorTypeNumberInRange): - var niraf NumberInRangeAdvancedFilter - err := json.Unmarshal(body, &niraf) - return niraf, err - case string(OperatorTypeNumberNotInRange): - var nniraf NumberNotInRangeAdvancedFilter - err := json.Unmarshal(body, &nniraf) - return nniraf, err - case string(OperatorTypeStringNotBeginsWith): - var snbwaf StringNotBeginsWithAdvancedFilter - err := json.Unmarshal(body, &snbwaf) - return snbwaf, err - case string(OperatorTypeStringNotEndsWith): - var snewaf StringNotEndsWithAdvancedFilter - err := json.Unmarshal(body, &snewaf) - return snewaf, err - case string(OperatorTypeStringNotContains): - var sncaf StringNotContainsAdvancedFilter - err := json.Unmarshal(body, &sncaf) - return sncaf, err - case string(OperatorTypeIsNullOrUndefined): - var inouaf IsNullOrUndefinedAdvancedFilter - err := json.Unmarshal(body, &inouaf) - return inouaf, err - case string(OperatorTypeIsNotNull): - var innaf IsNotNullAdvancedFilter - err := json.Unmarshal(body, &innaf) - return innaf, err - default: - var af AdvancedFilter - err := json.Unmarshal(body, &af) - return af, err - } -} -func unmarshalBasicAdvancedFilterArray(body []byte) ([]BasicAdvancedFilter, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - afArray := make([]BasicAdvancedFilter, len(rawMessages)) - - for index, rawMessage := range rawMessages { - af, err := unmarshalBasicAdvancedFilter(*rawMessage) - if err != nil { - return nil, err - } - afArray[index] = af - } - return afArray, nil -} - -// MarshalJSON is the custom marshaler for AdvancedFilter. -func (af AdvancedFilter) MarshalJSON() ([]byte, error) { - af.OperatorType = OperatorTypeAdvancedFilter - objectMap := make(map[string]interface{}) - if af.Key != nil { - objectMap["key"] = af.Key - } - if af.OperatorType != "" { - objectMap["operatorType"] = af.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return &af, true -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. -func (af AdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &af, true -} - -// AzureFunctionEventSubscriptionDestination information about the azure function destination for an event -// subscription. -type AzureFunctionEventSubscriptionDestination struct { - // AzureFunctionEventSubscriptionDestinationProperties - Azure Function Properties of the event subscription destination. - *AzureFunctionEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - afesd.EndpointType = EndpointTypeAzureFunction - objectMap := make(map[string]interface{}) - if afesd.AzureFunctionEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = afesd.AzureFunctionEventSubscriptionDestinationProperties - } - if afesd.EndpointType != "" { - objectMap["endpointType"] = afesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return &afesd, true -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. -func (afesd AzureFunctionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &afesd, true -} - -// UnmarshalJSON is the custom unmarshaler for AzureFunctionEventSubscriptionDestination struct. -func (afesd *AzureFunctionEventSubscriptionDestination) 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 azureFunctionEventSubscriptionDestinationProperties AzureFunctionEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &azureFunctionEventSubscriptionDestinationProperties) - if err != nil { - return err - } - afesd.AzureFunctionEventSubscriptionDestinationProperties = &azureFunctionEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - afesd.EndpointType = endpointType - } - } - } - - return nil -} - -// AzureFunctionEventSubscriptionDestinationProperties the properties that represent the Azure Function -// destination of an event subscription. -type AzureFunctionEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Azure Function destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // MaxEventsPerBatch - Maximum number of events per batch. - MaxEventsPerBatch *int32 `json:"maxEventsPerBatch,omitempty"` - // PreferredBatchSizeInKilobytes - Preferred batch size in Kilobytes. - PreferredBatchSizeInKilobytes *int32 `json:"preferredBatchSizeInKilobytes,omitempty"` - // DeliveryAttributeMappings - Delivery attribute details. - DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for AzureFunctionEventSubscriptionDestinationProperties struct. -func (afesdp *AzureFunctionEventSubscriptionDestinationProperties) 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 "resourceId": - if v != nil { - var resourceID string - err = json.Unmarshal(*v, &resourceID) - if err != nil { - return err - } - afesdp.ResourceID = &resourceID - } - case "maxEventsPerBatch": - if v != nil { - var maxEventsPerBatch int32 - err = json.Unmarshal(*v, &maxEventsPerBatch) - if err != nil { - return err - } - afesdp.MaxEventsPerBatch = &maxEventsPerBatch - } - case "preferredBatchSizeInKilobytes": - if v != nil { - var preferredBatchSizeInKilobytes int32 - err = json.Unmarshal(*v, &preferredBatchSizeInKilobytes) - if err != nil { - return err - } - afesdp.PreferredBatchSizeInKilobytes = &preferredBatchSizeInKilobytes - } - case "deliveryAttributeMappings": - if v != nil { - deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) - if err != nil { - return err - } - afesdp.DeliveryAttributeMappings = &deliveryAttributeMappings - } - } - } - - return nil -} - -// BoolEqualsAdvancedFilter boolEquals Advanced Filter. -type BoolEqualsAdvancedFilter struct { - // Value - The boolean filter value. - Value *bool `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - beaf.OperatorType = OperatorTypeBoolEquals - objectMap := make(map[string]interface{}) - if beaf.Value != nil { - objectMap["value"] = beaf.Value - } - if beaf.Key != nil { - objectMap["key"] = beaf.Key - } - if beaf.OperatorType != "" { - objectMap["operatorType"] = beaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return &beaf, true -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. -func (beaf BoolEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &beaf, true -} - -// ConnectionState connectionState information. -type ConnectionState struct { - // Status - Status of the connection. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' - Status PersistedConnectionStatus `json:"status,omitempty"` - // Description - Description of the connection state. - Description *string `json:"description,omitempty"` - // ActionsRequired - Actions required (if any). - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// BasicDeadLetterDestination information about the dead letter destination for an event subscription. To configure a -// deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a -// derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. -type BasicDeadLetterDestination interface { - AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) - AsDeadLetterDestination() (*DeadLetterDestination, bool) -} - -// DeadLetterDestination information about the dead letter destination for an event subscription. To configure -// a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an -// object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from -// this class. -type DeadLetterDestination struct { - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -func unmarshalBasicDeadLetterDestination(body []byte) (BasicDeadLetterDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeStorageBlob): - var sbdld StorageBlobDeadLetterDestination - err := json.Unmarshal(body, &sbdld) - return sbdld, err - default: - var dld DeadLetterDestination - err := json.Unmarshal(body, &dld) - return dld, err - } -} -func unmarshalBasicDeadLetterDestinationArray(body []byte) ([]BasicDeadLetterDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dldArray := make([]BasicDeadLetterDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dld, err := unmarshalBasicDeadLetterDestination(*rawMessage) - if err != nil { - return nil, err - } - dldArray[index] = dld - } - return dldArray, nil -} - -// MarshalJSON is the custom marshaler for DeadLetterDestination. -func (dld DeadLetterDestination) MarshalJSON() ([]byte, error) { - dld.EndpointType = EndpointTypeDeadLetterDestination - objectMap := make(map[string]interface{}) - if dld.EndpointType != "" { - objectMap["endpointType"] = dld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return nil, false -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return &dld, true -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. -func (dld DeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &dld, true -} - -// DeadLetterWithResourceIdentity information about the deadletter destination with resource identity. -type DeadLetterWithResourceIdentity struct { - // Identity - The identity to use when dead-lettering events. - Identity *EventSubscriptionIdentity `json:"identity,omitempty"` - // DeadLetterDestination - Information about the destination where events have to be delivered for the event subscription. - // Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DeadLetterWithResourceIdentity struct. -func (dlwri *DeadLetterWithResourceIdentity) 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 "identity": - if v != nil { - var identity EventSubscriptionIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dlwri.Identity = &identity - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - dlwri.DeadLetterDestination = deadLetterDestination - } - } - } - - return nil -} - -// DeliveryAttributeListResult result of the Get delivery attributes operation. -type DeliveryAttributeListResult struct { - autorest.Response `json:"-"` - // Value - A collection of DeliveryAttributeMapping - Value *[]BasicDeliveryAttributeMapping `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DeliveryAttributeListResult struct. -func (dalr *DeliveryAttributeListResult) 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 := unmarshalBasicDeliveryAttributeMappingArray(*v) - if err != nil { - return err - } - dalr.Value = &value - } - } - } - - return nil -} - -// BasicDeliveryAttributeMapping delivery attribute mapping details. -type BasicDeliveryAttributeMapping interface { - AsStaticDeliveryAttributeMapping() (*StaticDeliveryAttributeMapping, bool) - AsDynamicDeliveryAttributeMapping() (*DynamicDeliveryAttributeMapping, bool) - AsDeliveryAttributeMapping() (*DeliveryAttributeMapping, bool) -} - -// DeliveryAttributeMapping delivery attribute mapping details. -type DeliveryAttributeMapping struct { - // Name - Name of the delivery attribute or header. - Name *string `json:"name,omitempty"` - // Type - Possible values include: 'TypeDeliveryAttributeMapping', 'TypeStatic', 'TypeDynamic' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicDeliveryAttributeMapping(body []byte) (BasicDeliveryAttributeMapping, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeStatic): - var sdam StaticDeliveryAttributeMapping - err := json.Unmarshal(body, &sdam) - return sdam, err - case string(TypeDynamic): - var ddam DynamicDeliveryAttributeMapping - err := json.Unmarshal(body, &ddam) - return ddam, err - default: - var dam DeliveryAttributeMapping - err := json.Unmarshal(body, &dam) - return dam, err - } -} -func unmarshalBasicDeliveryAttributeMappingArray(body []byte) ([]BasicDeliveryAttributeMapping, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - damArray := make([]BasicDeliveryAttributeMapping, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dam, err := unmarshalBasicDeliveryAttributeMapping(*rawMessage) - if err != nil { - return nil, err - } - damArray[index] = dam - } - return damArray, nil -} - -// MarshalJSON is the custom marshaler for DeliveryAttributeMapping. -func (dam DeliveryAttributeMapping) MarshalJSON() ([]byte, error) { - dam.Type = TypeDeliveryAttributeMapping - objectMap := make(map[string]interface{}) - if dam.Name != nil { - objectMap["name"] = dam.Name - } - if dam.Type != "" { - objectMap["type"] = dam.Type - } - return json.Marshal(objectMap) -} - -// AsStaticDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DeliveryAttributeMapping. -func (dam DeliveryAttributeMapping) AsStaticDeliveryAttributeMapping() (*StaticDeliveryAttributeMapping, bool) { - return nil, false -} - -// AsDynamicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DeliveryAttributeMapping. -func (dam DeliveryAttributeMapping) AsDynamicDeliveryAttributeMapping() (*DynamicDeliveryAttributeMapping, bool) { - return nil, false -} - -// AsDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DeliveryAttributeMapping. -func (dam DeliveryAttributeMapping) AsDeliveryAttributeMapping() (*DeliveryAttributeMapping, bool) { - return &dam, true -} - -// AsBasicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DeliveryAttributeMapping. -func (dam DeliveryAttributeMapping) AsBasicDeliveryAttributeMapping() (BasicDeliveryAttributeMapping, bool) { - return &dam, true -} - -// DeliveryWithResourceIdentity information about the delivery for an event subscription with resource -// identity. -type DeliveryWithResourceIdentity struct { - // Identity - The identity to use when delivering events. - Identity *EventSubscriptionIdentity `json:"identity,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DeliveryWithResourceIdentity struct. -func (dwri *DeliveryWithResourceIdentity) 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 "identity": - if v != nil { - var identity EventSubscriptionIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dwri.Identity = &identity - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - dwri.Destination = destination - } - } - } - - return nil -} - -// Domain eventGrid Domain. -type Domain struct { - autorest.Response `json:"-"` - // DomainProperties - Properties of the domain. - *DomainProperties `json:"properties,omitempty"` - // Sku - The Sku pricing tier for the domain. - Sku *ResourceSku `json:"sku,omitempty"` - // Identity - Identity information for the resource. - Identity *IdentityInfo `json:"identity,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Domain. -func (d Domain) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DomainProperties != nil { - objectMap["properties"] = d.DomainProperties - } - if d.Sku != nil { - objectMap["sku"] = d.Sku - } - if d.Identity != nil { - objectMap["identity"] = d.Identity - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Domain struct. -func (d *Domain) 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 domainProperties DomainProperties - err = json.Unmarshal(*v, &domainProperties) - if err != nil { - return err - } - d.DomainProperties = &domainProperties - } - case "sku": - if v != nil { - var sku ResourceSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - d.Sku = &sku - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - d.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DomainProperties properties of the Domain. -type DomainProperties struct { - // PrivateEndpointConnections - List of private endpoint connections. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the domain. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' - ProvisioningState DomainProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the domain. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the domain. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventSchemaV10' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - Information about the InputSchemaMapping which specified the info about mapping event payload. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` - // MetricResourceID - READ-ONLY; Metric resource id for the domain. - MetricResourceID *string `json:"metricResourceId,omitempty"` - // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. - // You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainProperties. -func (dp DomainProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = dp.PrivateEndpointConnections - } - if dp.InputSchema != "" { - objectMap["inputSchema"] = dp.InputSchema - } - objectMap["inputSchemaMapping"] = dp.InputSchemaMapping - if dp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = dp.PublicNetworkAccess - } - if dp.InboundIPRules != nil { - objectMap["inboundIpRules"] = dp.InboundIPRules - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainProperties struct. -func (dp *DomainProperties) 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 "privateEndpointConnections": - if v != nil { - var privateEndpointConnections []PrivateEndpointConnection - err = json.Unmarshal(*v, &privateEndpointConnections) - if err != nil { - return err - } - dp.PrivateEndpointConnections = &privateEndpointConnections - } - case "provisioningState": - if v != nil { - var provisioningState DomainProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - dp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - dp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - dp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - dp.InputSchemaMapping = inputSchemaMapping - } - case "metricResourceId": - if v != nil { - var metricResourceID string - err = json.Unmarshal(*v, &metricResourceID) - if err != nil { - return err - } - dp.MetricResourceID = &metricResourceID - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - dp.PublicNetworkAccess = publicNetworkAccess - } - case "inboundIpRules": - if v != nil { - var inboundIPRules []InboundIPRule - err = json.Unmarshal(*v, &inboundIPRules) - if err != nil { - return err - } - dp.InboundIPRules = &inboundIPRules - } - } - } - - return nil -} - -// DomainRegenerateKeyRequest domain regenerate share access key request. -type DomainRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2. - KeyName *string `json:"keyName,omitempty"` -} - -// DomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsCreateOrUpdateFuture) 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 DomainsCreateOrUpdateFuture.Result. -func (future *DomainsCreateOrUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsDeleteFuture) 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 DomainsDeleteFuture.Result. -func (future *DomainsDeleteFuture) result(client DomainsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainSharedAccessKeys shared access keys of the Domain. -type DomainSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the domain. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the domain. - Key2 *string `json:"key2,omitempty"` -} - -// DomainsListResult result of the List Domains operation -type DomainsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domains - Value *[]Domain `json:"value,omitempty"` - // NextLink - A link for the next page of domains - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainsListResultIterator provides access to a complete listing of Domain values. -type DomainsListResultIterator struct { - i int - page DomainsListResultPage -} - -// 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 *DomainsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultIterator.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 *DomainsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainsListResultIterator) 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 DomainsListResultIterator) Response() DomainsListResult { - 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 DomainsListResultIterator) Value() Domain { - if !iter.page.NotDone() { - return Domain{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainsListResultIterator type. -func NewDomainsListResultIterator(page DomainsListResultPage) DomainsListResultIterator { - return DomainsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DomainsListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DomainsListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// domainsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DomainsListResult) domainsListResultPreparer(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))) -} - -// DomainsListResultPage contains a page of Domain values. -type DomainsListResultPage struct { - fn func(context.Context, DomainsListResult) (DomainsListResult, error) - dlr DomainsListResult -} - -// 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 *DomainsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultPage.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 *DomainsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainsListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainsListResultPage) Response() DomainsListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainsListResultPage) Values() []Domain { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DomainsListResultPage type. -func NewDomainsListResultPage(cur DomainsListResult, getNextPage func(context.Context, DomainsListResult) (DomainsListResult, error)) DomainsListResultPage { - return DomainsListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainsClient) (Domain, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainsUpdateFuture) 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 DomainsUpdateFuture.Result. -func (future *DomainsUpdateFuture) result(client DomainsClient) (d Domain, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainTopic domain Topic. -type DomainTopic struct { - autorest.Response `json:"-"` - // DomainTopicProperties - Properties of the Domain Topic. - *DomainTopicProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainTopic. -func (dt DomainTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dt.DomainTopicProperties != nil { - objectMap["properties"] = dt.DomainTopicProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainTopic struct. -func (dt *DomainTopic) 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 domainTopicProperties DomainTopicProperties - err = json.Unmarshal(*v, &domainTopicProperties) - if err != nil { - return err - } - dt.DomainTopicProperties = &domainTopicProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dt.Type = &typeVar - } - } - } - - return nil -} - -// DomainTopicProperties properties of the Domain Topic. -type DomainTopicProperties struct { - // ProvisioningState - Provisioning state of the domain topic. Possible values include: 'DomainTopicProvisioningStateCreating', 'DomainTopicProvisioningStateUpdating', 'DomainTopicProvisioningStateDeleting', 'DomainTopicProvisioningStateSucceeded', 'DomainTopicProvisioningStateCanceled', 'DomainTopicProvisioningStateFailed' - ProvisioningState DomainTopicProvisioningState `json:"provisioningState,omitempty"` -} - -// DomainTopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DomainTopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainTopicsClient) (DomainTopic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainTopicsCreateOrUpdateFuture) 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 DomainTopicsCreateOrUpdateFuture.Result. -func (future *DomainTopicsCreateOrUpdateFuture) result(client DomainTopicsClient) (dt DomainTopic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dt.Response.Response, err = future.GetResult(sender); err == nil && dt.Response.Response.StatusCode != http.StatusNoContent { - dt, err = client.CreateOrUpdateResponder(dt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", dt.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainTopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainTopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainTopicsDeleteFuture) 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 DomainTopicsDeleteFuture.Result. -func (future *DomainTopicsDeleteFuture) result(client DomainTopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainTopicsListResult result of the List Domain Topics operation -type DomainTopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Domain Topics - Value *[]DomainTopic `json:"value,omitempty"` - // NextLink - A link for the next page of domain topics - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainTopicsListResultIterator provides access to a complete listing of DomainTopic values. -type DomainTopicsListResultIterator struct { - i int - page DomainTopicsListResultPage -} - -// 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 *DomainTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultIterator.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 *DomainTopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainTopicsListResultIterator) 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 DomainTopicsListResultIterator) Response() DomainTopicsListResult { - 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 DomainTopicsListResultIterator) Value() DomainTopic { - if !iter.page.NotDone() { - return DomainTopic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainTopicsListResultIterator type. -func NewDomainTopicsListResultIterator(page DomainTopicsListResultPage) DomainTopicsListResultIterator { - return DomainTopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dtlr DomainTopicsListResult) IsEmpty() bool { - return dtlr.Value == nil || len(*dtlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dtlr DomainTopicsListResult) hasNextLink() bool { - return dtlr.NextLink != nil && len(*dtlr.NextLink) != 0 -} - -// domainTopicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dtlr DomainTopicsListResult) domainTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dtlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dtlr.NextLink))) -} - -// DomainTopicsListResultPage contains a page of DomainTopic values. -type DomainTopicsListResultPage struct { - fn func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error) - dtlr DomainTopicsListResult -} - -// 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 *DomainTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultPage.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.dtlr) - if err != nil { - return err - } - page.dtlr = 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 *DomainTopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainTopicsListResultPage) NotDone() bool { - return !page.dtlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainTopicsListResultPage) Response() DomainTopicsListResult { - return page.dtlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainTopicsListResultPage) Values() []DomainTopic { - if page.dtlr.IsEmpty() { - return nil - } - return *page.dtlr.Value -} - -// Creates a new instance of the DomainTopicsListResultPage type. -func NewDomainTopicsListResultPage(cur DomainTopicsListResult, getNextPage func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error)) DomainTopicsListResultPage { - return DomainTopicsListResultPage{ - fn: getNextPage, - dtlr: cur, - } -} - -// DomainUpdateParameterProperties information of domain update parameter properties. -type DomainUpdateParameterProperties struct { - // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. - // You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` -} - -// DomainUpdateParameters properties of the Domain update. -type DomainUpdateParameters struct { - // Tags - Tags of the domains resource. - Tags map[string]*string `json:"tags"` - // DomainUpdateParameterProperties - Properties of the resource. - *DomainUpdateParameterProperties `json:"properties,omitempty"` - // Identity - Identity information for the resource. - Identity *IdentityInfo `json:"identity,omitempty"` - // Sku - The Sku pricing tier for the domain. - Sku *ResourceSku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainUpdateParameters. -func (dup DomainUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dup.Tags != nil { - objectMap["tags"] = dup.Tags - } - if dup.DomainUpdateParameterProperties != nil { - objectMap["properties"] = dup.DomainUpdateParameterProperties - } - if dup.Identity != nil { - objectMap["identity"] = dup.Identity - } - if dup.Sku != nil { - objectMap["sku"] = dup.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainUpdateParameters struct. -func (dup *DomainUpdateParameters) 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 - } - dup.Tags = tags - } - case "properties": - if v != nil { - var domainUpdateParameterProperties DomainUpdateParameterProperties - err = json.Unmarshal(*v, &domainUpdateParameterProperties) - if err != nil { - return err - } - dup.DomainUpdateParameterProperties = &domainUpdateParameterProperties - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - dup.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - dup.Sku = &sku - } - } - } - - return nil -} - -// DynamicDeliveryAttributeMapping dynamic delivery attribute mapping details. -type DynamicDeliveryAttributeMapping struct { - // DynamicDeliveryAttributeMappingProperties - Properties of dynamic delivery attribute mapping. - *DynamicDeliveryAttributeMappingProperties `json:"properties,omitempty"` - // Name - Name of the delivery attribute or header. - Name *string `json:"name,omitempty"` - // Type - Possible values include: 'TypeDeliveryAttributeMapping', 'TypeStatic', 'TypeDynamic' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicDeliveryAttributeMapping. -func (ddam DynamicDeliveryAttributeMapping) MarshalJSON() ([]byte, error) { - ddam.Type = TypeDynamic - objectMap := make(map[string]interface{}) - if ddam.DynamicDeliveryAttributeMappingProperties != nil { - objectMap["properties"] = ddam.DynamicDeliveryAttributeMappingProperties - } - if ddam.Name != nil { - objectMap["name"] = ddam.Name - } - if ddam.Type != "" { - objectMap["type"] = ddam.Type - } - return json.Marshal(objectMap) -} - -// AsStaticDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DynamicDeliveryAttributeMapping. -func (ddam DynamicDeliveryAttributeMapping) AsStaticDeliveryAttributeMapping() (*StaticDeliveryAttributeMapping, bool) { - return nil, false -} - -// AsDynamicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DynamicDeliveryAttributeMapping. -func (ddam DynamicDeliveryAttributeMapping) AsDynamicDeliveryAttributeMapping() (*DynamicDeliveryAttributeMapping, bool) { - return &ddam, true -} - -// AsDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DynamicDeliveryAttributeMapping. -func (ddam DynamicDeliveryAttributeMapping) AsDeliveryAttributeMapping() (*DeliveryAttributeMapping, bool) { - return nil, false -} - -// AsBasicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DynamicDeliveryAttributeMapping. -func (ddam DynamicDeliveryAttributeMapping) AsBasicDeliveryAttributeMapping() (BasicDeliveryAttributeMapping, bool) { - return &ddam, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicDeliveryAttributeMapping struct. -func (ddam *DynamicDeliveryAttributeMapping) 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 dynamicDeliveryAttributeMappingProperties DynamicDeliveryAttributeMappingProperties - err = json.Unmarshal(*v, &dynamicDeliveryAttributeMappingProperties) - if err != nil { - return err - } - ddam.DynamicDeliveryAttributeMappingProperties = &dynamicDeliveryAttributeMappingProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ddam.Name = &name - } - case "type": - if v != nil { - var typeVar Type - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ddam.Type = typeVar - } - } - } - - return nil -} - -// DynamicDeliveryAttributeMappingProperties properties of dynamic delivery attribute mapping. -type DynamicDeliveryAttributeMappingProperties struct { - // SourceField - JSON path in the event which contains attribute value. - SourceField *string `json:"sourceField,omitempty"` -} - -// EventChannel event Channel. -type EventChannel struct { - autorest.Response `json:"-"` - // EventChannelProperties - Properties of the EventChannel. - *EventChannelProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventChannel. -func (ec EventChannel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ec.EventChannelProperties != nil { - objectMap["properties"] = ec.EventChannelProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventChannel struct. -func (ec *EventChannel) 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 eventChannelProperties EventChannelProperties - err = json.Unmarshal(*v, &eventChannelProperties) - if err != nil { - return err - } - ec.EventChannelProperties = &eventChannelProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ec.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ec.Type = &typeVar - } - } - } - - return nil -} - -// EventChannelDestination properties of the destination of an event channel. -type EventChannelDestination struct { - // AzureSubscriptionID - Azure subscription ID of the customer creating the event channel. The partner topic - // associated with the event channel will be created under this Azure subscription. - AzureSubscriptionID *string `json:"azureSubscriptionId,omitempty"` - // ResourceGroup - Azure Resource Group of the customer creating the event channel. The partner topic - // associated with the event channel will be created under this resource group. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // PartnerTopicName - Name of the partner topic associated with the event channel. - PartnerTopicName *string `json:"partnerTopicName,omitempty"` -} - -// EventChannelFilter filter for the Event Channel. -type EventChannelFilter struct { - // EnableAdvancedFilteringOnArrays - Allows advanced filters to be evaluated against an array of values instead of expecting a singular value. - EnableAdvancedFilteringOnArrays *bool `json:"enableAdvancedFilteringOnArrays,omitempty"` - // AdvancedFilters - An array of advanced filters that are used for filtering event channels. - AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventChannelFilter struct. -func (ecf *EventChannelFilter) 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 "enableAdvancedFilteringOnArrays": - if v != nil { - var enableAdvancedFilteringOnArrays bool - err = json.Unmarshal(*v, &enableAdvancedFilteringOnArrays) - if err != nil { - return err - } - ecf.EnableAdvancedFilteringOnArrays = &enableAdvancedFilteringOnArrays - } - case "advancedFilters": - if v != nil { - advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) - if err != nil { - return err - } - ecf.AdvancedFilters = &advancedFilters - } - } - } - - return nil -} - -// EventChannelProperties properties of the Event Channel. -type EventChannelProperties struct { - // Source - Source of the event channel. This represents a unique resource in the partner's resource model. - Source *EventChannelSource `json:"source,omitempty"` - // Destination - Represents the destination of an event channel. - Destination *EventChannelDestination `json:"destination,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event channel. Possible values include: 'EventChannelProvisioningStateCreating', 'EventChannelProvisioningStateUpdating', 'EventChannelProvisioningStateDeleting', 'EventChannelProvisioningStateSucceeded', 'EventChannelProvisioningStateCanceled', 'EventChannelProvisioningStateFailed' - ProvisioningState EventChannelProvisioningState `json:"provisioningState,omitempty"` - // PartnerTopicReadinessState - READ-ONLY; The readiness state of the corresponding partner topic. Possible values include: 'NotActivatedByUserYet', 'ActivatedByUser', 'DeactivatedByUser', 'DeletedByUser' - PartnerTopicReadinessState PartnerTopicReadinessState `json:"partnerTopicReadinessState,omitempty"` - // ExpirationTimeIfNotActivatedUtc - Expiration time of the event channel. If this timer expires while the corresponding partner topic is never activated, - // the event channel and corresponding partner topic are deleted. - ExpirationTimeIfNotActivatedUtc *date.Time `json:"expirationTimeIfNotActivatedUtc,omitempty"` - // Filter - Information about the filter for the event channel. - Filter *EventChannelFilter `json:"filter,omitempty"` - // PartnerTopicFriendlyDescription - Friendly description about the topic. This can be set by the publisher/partner to show custom description for the customer partner topic. - // This will be helpful to remove any ambiguity of the origin of creation of the partner topic for the customer. - PartnerTopicFriendlyDescription *string `json:"partnerTopicFriendlyDescription,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventChannelProperties. -func (ecp EventChannelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ecp.Source != nil { - objectMap["source"] = ecp.Source - } - if ecp.Destination != nil { - objectMap["destination"] = ecp.Destination - } - if ecp.ExpirationTimeIfNotActivatedUtc != nil { - objectMap["expirationTimeIfNotActivatedUtc"] = ecp.ExpirationTimeIfNotActivatedUtc - } - if ecp.Filter != nil { - objectMap["filter"] = ecp.Filter - } - if ecp.PartnerTopicFriendlyDescription != nil { - objectMap["partnerTopicFriendlyDescription"] = ecp.PartnerTopicFriendlyDescription - } - return json.Marshal(objectMap) -} - -// EventChannelsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type EventChannelsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventChannelsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventChannelsDeleteFuture) 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 EventChannelsDeleteFuture.Result. -func (future *EventChannelsDeleteFuture) result(client EventChannelsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventChannelsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventChannelsListResult result of the List Event Channels operation -type EventChannelsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Event Channels - Value *[]EventChannel `json:"value,omitempty"` - // NextLink - A link for the next page of event channels - NextLink *string `json:"nextLink,omitempty"` -} - -// EventChannelsListResultIterator provides access to a complete listing of EventChannel values. -type EventChannelsListResultIterator struct { - i int - page EventChannelsListResultPage -} - -// 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 *EventChannelsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsListResultIterator.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 *EventChannelsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventChannelsListResultIterator) 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 EventChannelsListResultIterator) Response() EventChannelsListResult { - 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 EventChannelsListResultIterator) Value() EventChannel { - if !iter.page.NotDone() { - return EventChannel{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventChannelsListResultIterator type. -func NewEventChannelsListResultIterator(page EventChannelsListResultPage) EventChannelsListResultIterator { - return EventChannelsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eclr EventChannelsListResult) IsEmpty() bool { - return eclr.Value == nil || len(*eclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eclr EventChannelsListResult) hasNextLink() bool { - return eclr.NextLink != nil && len(*eclr.NextLink) != 0 -} - -// eventChannelsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eclr EventChannelsListResult) eventChannelsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eclr.NextLink))) -} - -// EventChannelsListResultPage contains a page of EventChannel values. -type EventChannelsListResultPage struct { - fn func(context.Context, EventChannelsListResult) (EventChannelsListResult, error) - eclr EventChannelsListResult -} - -// 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 *EventChannelsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsListResultPage.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.eclr) - if err != nil { - return err - } - page.eclr = 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 *EventChannelsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventChannelsListResultPage) NotDone() bool { - return !page.eclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventChannelsListResultPage) Response() EventChannelsListResult { - return page.eclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventChannelsListResultPage) Values() []EventChannel { - if page.eclr.IsEmpty() { - return nil - } - return *page.eclr.Value -} - -// Creates a new instance of the EventChannelsListResultPage type. -func NewEventChannelsListResultPage(cur EventChannelsListResult, getNextPage func(context.Context, EventChannelsListResult) (EventChannelsListResult, error)) EventChannelsListResultPage { - return EventChannelsListResultPage{ - fn: getNextPage, - eclr: cur, - } -} - -// EventChannelSource properties of the source of an event channel. -type EventChannelSource struct { - // Source - The identifier of the resource that's the source of the events. - // This represents a unique resource in the partner's resource model. - Source *string `json:"source,omitempty"` -} - -// EventHubEventSubscriptionDestination information about the event hub destination for an event -// subscription. -type EventHubEventSubscriptionDestination struct { - // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination. - *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - ehesd.EndpointType = EndpointTypeEventHub - objectMap := make(map[string]interface{}) - if ehesd.EventHubEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties - } - if ehesd.EndpointType != "" { - objectMap["endpointType"] = ehesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. -func (ehesd *EventHubEventSubscriptionDestination) 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 eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) - if err != nil { - return err - } - ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - ehesd.EndpointType = endpointType - } - } - } - - return nil -} - -// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. -type EventHubEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // DeliveryAttributeMappings - Delivery attribute details. - DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestinationProperties struct. -func (ehesdp *EventHubEventSubscriptionDestinationProperties) 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 "resourceId": - if v != nil { - var resourceID string - err = json.Unmarshal(*v, &resourceID) - if err != nil { - return err - } - ehesdp.ResourceID = &resourceID - } - case "deliveryAttributeMappings": - if v != nil { - deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) - if err != nil { - return err - } - ehesdp.DeliveryAttributeMappings = &deliveryAttributeMappings - } - } - } - - return nil -} - -// EventSubscription event Subscription -type EventSubscription struct { - autorest.Response `json:"-"` - // EventSubscriptionProperties - Properties of the event subscription. - *EventSubscriptionProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscription. -func (es EventSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EventSubscriptionProperties != nil { - objectMap["properties"] = es.EventSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. -func (es *EventSubscription) 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 eventSubscriptionProperties EventSubscriptionProperties - err = json.Unmarshal(*v, &eventSubscriptionProperties) - if err != nil { - return err - } - es.EventSubscriptionProperties = &eventSubscriptionProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - es.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// BasicEventSubscriptionDestination information about the destination for an event subscription. -type BasicEventSubscriptionDestination interface { - AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) - AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) - AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) - AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) - AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) - AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) - AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) - AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) -} - -// EventSubscriptionDestination information about the destination for an event subscription. -type EventSubscriptionDestination struct { - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeWebHook): - var whesd WebHookEventSubscriptionDestination - err := json.Unmarshal(body, &whesd) - return whesd, err - case string(EndpointTypeEventHub): - var ehesd EventHubEventSubscriptionDestination - err := json.Unmarshal(body, &ehesd) - return ehesd, err - case string(EndpointTypeStorageQueue): - var sqesd StorageQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sqesd) - return sqesd, err - case string(EndpointTypeHybridConnection): - var hcesd HybridConnectionEventSubscriptionDestination - err := json.Unmarshal(body, &hcesd) - return hcesd, err - case string(EndpointTypeServiceBusQueue): - var sbqesd ServiceBusQueueEventSubscriptionDestination - err := json.Unmarshal(body, &sbqesd) - return sbqesd, err - case string(EndpointTypeServiceBusTopic): - var sbtesd ServiceBusTopicEventSubscriptionDestination - err := json.Unmarshal(body, &sbtesd) - return sbtesd, err - case string(EndpointTypeAzureFunction): - var afesd AzureFunctionEventSubscriptionDestination - err := json.Unmarshal(body, &afesd) - return afesd, err - default: - var esd EventSubscriptionDestination - err := json.Unmarshal(body, &esd) - return esd, err - } -} -func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) - if err != nil { - return nil, err - } - esdArray[index] = esd - } - return esdArray, nil -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { - esd.EndpointType = EndpointTypeEventSubscriptionDestination - objectMap := make(map[string]interface{}) - if esd.EndpointType != "" { - objectMap["endpointType"] = esd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return &esd, true -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &esd, true -} - -// EventSubscriptionFilter filter for the Event Subscription. -type EventSubscriptionFilter struct { - // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. - // The format of this depends on the publisher of the events. - // Wildcard characters are not supported in this path. - SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` - // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. - // Wildcard characters are not supported in this path. - SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` - // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null. - IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` - // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter - // should be compared in a case sensitive manner. - IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` - // EnableAdvancedFilteringOnArrays - Allows advanced filters to be evaluated against an array of values instead of expecting a singular value. - EnableAdvancedFilteringOnArrays *bool `json:"enableAdvancedFilteringOnArrays,omitempty"` - // AdvancedFilters - An array of advanced filters that are used for filtering event subscriptions. - AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionFilter struct. -func (esf *EventSubscriptionFilter) 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 "subjectBeginsWith": - if v != nil { - var subjectBeginsWith string - err = json.Unmarshal(*v, &subjectBeginsWith) - if err != nil { - return err - } - esf.SubjectBeginsWith = &subjectBeginsWith - } - case "subjectEndsWith": - if v != nil { - var subjectEndsWith string - err = json.Unmarshal(*v, &subjectEndsWith) - if err != nil { - return err - } - esf.SubjectEndsWith = &subjectEndsWith - } - case "includedEventTypes": - if v != nil { - var includedEventTypes []string - err = json.Unmarshal(*v, &includedEventTypes) - if err != nil { - return err - } - esf.IncludedEventTypes = &includedEventTypes - } - case "isSubjectCaseSensitive": - if v != nil { - var isSubjectCaseSensitive bool - err = json.Unmarshal(*v, &isSubjectCaseSensitive) - if err != nil { - return err - } - esf.IsSubjectCaseSensitive = &isSubjectCaseSensitive - } - case "enableAdvancedFilteringOnArrays": - if v != nil { - var enableAdvancedFilteringOnArrays bool - err = json.Unmarshal(*v, &enableAdvancedFilteringOnArrays) - if err != nil { - return err - } - esf.EnableAdvancedFilteringOnArrays = &enableAdvancedFilteringOnArrays - } - case "advancedFilters": - if v != nil { - advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) - if err != nil { - return err - } - esf.AdvancedFilters = &advancedFilters - } - } - } - - return nil -} - -// EventSubscriptionFullURL full endpoint url of an event subscription -type EventSubscriptionFullURL struct { - autorest.Response `json:"-"` - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` -} - -// EventSubscriptionIdentity the identity information with the event subscription. -type EventSubscriptionIdentity struct { - // Type - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity. Possible values include: 'SystemAssigned', 'UserAssigned' - Type EventSubscriptionIdentityType `json:"type,omitempty"` - // UserAssignedIdentity - The user identity associated with the resource. - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} - -// EventSubscriptionProperties properties of the Event Subscription. -type EventSubscriptionProperties struct { - // Topic - READ-ONLY; Name of the topic of the event subscription. - Topic *string `json:"topic,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the event subscription. Possible values include: 'EventSubscriptionProvisioningStateCreating', 'EventSubscriptionProvisioningStateUpdating', 'EventSubscriptionProvisioningStateDeleting', 'EventSubscriptionProvisioningStateSucceeded', 'EventSubscriptionProvisioningStateCanceled', 'EventSubscriptionProvisioningStateFailed', 'EventSubscriptionProvisioningStateAwaitingManualAction' - ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // DeliveryWithResourceIdentity - Information about the destination where events have to be delivered for the event subscription. - // Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeliveryWithResourceIdentity *DeliveryWithResourceIdentity `json:"deliveryWithResourceIdentity,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Expiration time of the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CustomInputSchema', 'CloudEventSchemaV10' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` - // DeadLetterWithResourceIdentity - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterWithResourceIdentity *DeadLetterWithResourceIdentity `json:"deadLetterWithResourceIdentity,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscriptionProperties. -func (esp EventSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["destination"] = esp.Destination - if esp.DeliveryWithResourceIdentity != nil { - objectMap["deliveryWithResourceIdentity"] = esp.DeliveryWithResourceIdentity - } - if esp.Filter != nil { - objectMap["filter"] = esp.Filter - } - if esp.Labels != nil { - objectMap["labels"] = esp.Labels - } - if esp.ExpirationTimeUtc != nil { - objectMap["expirationTimeUtc"] = esp.ExpirationTimeUtc - } - if esp.EventDeliverySchema != "" { - objectMap["eventDeliverySchema"] = esp.EventDeliverySchema - } - if esp.RetryPolicy != nil { - objectMap["retryPolicy"] = esp.RetryPolicy - } - objectMap["deadLetterDestination"] = esp.DeadLetterDestination - if esp.DeadLetterWithResourceIdentity != nil { - objectMap["deadLetterWithResourceIdentity"] = esp.DeadLetterWithResourceIdentity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. -func (esp *EventSubscriptionProperties) 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 "topic": - if v != nil { - var topic string - err = json.Unmarshal(*v, &topic) - if err != nil { - return err - } - esp.Topic = &topic - } - case "provisioningState": - if v != nil { - var provisioningState EventSubscriptionProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - esp.ProvisioningState = provisioningState - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esp.Destination = destination - } - case "deliveryWithResourceIdentity": - if v != nil { - var deliveryWithResourceIdentity DeliveryWithResourceIdentity - err = json.Unmarshal(*v, &deliveryWithResourceIdentity) - if err != nil { - return err - } - esp.DeliveryWithResourceIdentity = &deliveryWithResourceIdentity - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esp.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esp.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esp.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esp.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esp.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esp.DeadLetterDestination = deadLetterDestination - } - case "deadLetterWithResourceIdentity": - if v != nil { - var deadLetterWithResourceIdentity DeadLetterWithResourceIdentity - err = json.Unmarshal(*v, &deadLetterWithResourceIdentity) - if err != nil { - return err - } - esp.DeadLetterWithResourceIdentity = &deadLetterWithResourceIdentity - } - } - } - - return nil -} - -// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsCreateOrUpdateFuture) 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 EventSubscriptionsCreateOrUpdateFuture.Result. -func (future *EventSubscriptionsCreateOrUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsDeleteFuture) 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 EventSubscriptionsDeleteFuture.Result. -func (future *EventSubscriptionsDeleteFuture) result(client EventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventSubscriptionsListResult result of the List EventSubscriptions operation -type EventSubscriptionsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of EventSubscriptions - Value *[]EventSubscription `json:"value,omitempty"` - // NextLink - A link for the next page of event subscriptions - NextLink *string `json:"nextLink,omitempty"` -} - -// EventSubscriptionsListResultIterator provides access to a complete listing of EventSubscription values. -type EventSubscriptionsListResultIterator struct { - i int - page EventSubscriptionsListResultPage -} - -// 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 *EventSubscriptionsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultIterator.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 *EventSubscriptionsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventSubscriptionsListResultIterator) 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 EventSubscriptionsListResultIterator) Response() EventSubscriptionsListResult { - 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 EventSubscriptionsListResultIterator) Value() EventSubscription { - if !iter.page.NotDone() { - return EventSubscription{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventSubscriptionsListResultIterator type. -func NewEventSubscriptionsListResultIterator(page EventSubscriptionsListResultPage) EventSubscriptionsListResultIterator { - return EventSubscriptionsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eslr EventSubscriptionsListResult) IsEmpty() bool { - return eslr.Value == nil || len(*eslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eslr EventSubscriptionsListResult) hasNextLink() bool { - return eslr.NextLink != nil && len(*eslr.NextLink) != 0 -} - -// eventSubscriptionsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eslr EventSubscriptionsListResult) eventSubscriptionsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eslr.NextLink))) -} - -// EventSubscriptionsListResultPage contains a page of EventSubscription values. -type EventSubscriptionsListResultPage struct { - fn func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error) - eslr EventSubscriptionsListResult -} - -// 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 *EventSubscriptionsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultPage.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.eslr) - if err != nil { - return err - } - page.eslr = 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 *EventSubscriptionsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventSubscriptionsListResultPage) NotDone() bool { - return !page.eslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventSubscriptionsListResultPage) Response() EventSubscriptionsListResult { - return page.eslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventSubscriptionsListResultPage) Values() []EventSubscription { - if page.eslr.IsEmpty() { - return nil - } - return *page.eslr.Value -} - -// Creates a new instance of the EventSubscriptionsListResultPage type. -func NewEventSubscriptionsListResultPage(cur EventSubscriptionsListResult, getNextPage func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error)) EventSubscriptionsListResultPage { - return EventSubscriptionsListResultPage{ - fn: getNextPage, - eslr: cur, - } -} - -// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EventSubscriptionsUpdateFuture) 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 EventSubscriptionsUpdateFuture.Result. -func (future *EventSubscriptionsUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionUpdateParameters properties of the Event Subscription update. -type EventSubscriptionUpdateParameters struct { - // Destination - Information about the destination where events have to be delivered for the event subscription. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // DeliveryWithResourceIdentity - Information about the destination where events have to be delivered for the event subscription. - // Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeliveryWithResourceIdentity *DeliveryWithResourceIdentity `json:"deliveryWithResourceIdentity,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` - // ExpirationTimeUtc - Information about the expiration time for the event subscription. - ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` - // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CustomInputSchema', 'CloudEventSchemaV10' - EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` - // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - // DeadLetterDestination - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` - // DeadLetterWithResourceIdentity - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterWithResourceIdentity *DeadLetterWithResourceIdentity `json:"deadLetterWithResourceIdentity,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. -func (esup *EventSubscriptionUpdateParameters) 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 "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esup.Destination = destination - } - case "deliveryWithResourceIdentity": - if v != nil { - var deliveryWithResourceIdentity DeliveryWithResourceIdentity - err = json.Unmarshal(*v, &deliveryWithResourceIdentity) - if err != nil { - return err - } - esup.DeliveryWithResourceIdentity = &deliveryWithResourceIdentity - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esup.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esup.Labels = &labels - } - case "expirationTimeUtc": - if v != nil { - var expirationTimeUtc date.Time - err = json.Unmarshal(*v, &expirationTimeUtc) - if err != nil { - return err - } - esup.ExpirationTimeUtc = &expirationTimeUtc - } - case "eventDeliverySchema": - if v != nil { - var eventDeliverySchema EventDeliverySchema - err = json.Unmarshal(*v, &eventDeliverySchema) - if err != nil { - return err - } - esup.EventDeliverySchema = eventDeliverySchema - } - case "retryPolicy": - if v != nil { - var retryPolicy RetryPolicy - err = json.Unmarshal(*v, &retryPolicy) - if err != nil { - return err - } - esup.RetryPolicy = &retryPolicy - } - case "deadLetterDestination": - if v != nil { - deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) - if err != nil { - return err - } - esup.DeadLetterDestination = deadLetterDestination - } - case "deadLetterWithResourceIdentity": - if v != nil { - var deadLetterWithResourceIdentity DeadLetterWithResourceIdentity - err = json.Unmarshal(*v, &deadLetterWithResourceIdentity) - if err != nil { - return err - } - esup.DeadLetterWithResourceIdentity = &deadLetterWithResourceIdentity - } - } - } - - return nil -} - -// EventType event Type for a subject under a topic -type EventType struct { - // EventTypeProperties - Properties of the event type. - *EventTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventType. -func (et EventType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.EventTypeProperties != nil { - objectMap["properties"] = et.EventTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventType struct. -func (et *EventType) 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 eventTypeProperties EventTypeProperties - err = json.Unmarshal(*v, &eventTypeProperties) - if err != nil { - return err - } - et.EventTypeProperties = &eventTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// EventTypeProperties properties of the event type -type EventTypeProperties struct { - // DisplayName - Display name of the event type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the event type. - Description *string `json:"description,omitempty"` - // SchemaURL - Url of the schema for this event type. - SchemaURL *string `json:"schemaUrl,omitempty"` - // IsInDefaultSet - IsInDefaultSet flag of the event type. - IsInDefaultSet *bool `json:"isInDefaultSet,omitempty"` -} - -// EventTypesListResult result of the List Event Types operation -type EventTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of event types - Value *[]EventType `json:"value,omitempty"` -} - -// ExtendedLocation definition of an Extended Location -type ExtendedLocation struct { - // Name - Fully qualified name of the extended location. - Name *string `json:"name,omitempty"` - // Type - Type of the extended location. - Type *string `json:"type,omitempty"` -} - -// ExtensionTopic event grid Extension Topic. This is used for getting Event Grid related metrics for Azure -// resources. -type ExtensionTopic struct { - autorest.Response `json:"-"` - // ExtensionTopicProperties - Properties of the extension topic - *ExtensionTopicProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtensionTopic. -func (et ExtensionTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.ExtensionTopicProperties != nil { - objectMap["properties"] = et.ExtensionTopicProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExtensionTopic struct. -func (et *ExtensionTopic) 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 extensionTopicProperties ExtensionTopicProperties - err = json.Unmarshal(*v, &extensionTopicProperties) - if err != nil { - return err - } - et.ExtensionTopicProperties = &extensionTopicProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// ExtensionTopicProperties properties of the Extension Topic -type ExtensionTopicProperties struct { - // Description - Description of the extension topic. - Description *string `json:"description,omitempty"` - // SystemTopic - System topic resource id which is mapped to the source. - SystemTopic *string `json:"systemTopic,omitempty"` -} - -// HybridConnectionEventSubscriptionDestination information about the HybridConnection destination for an -// event subscription. -type HybridConnectionEventSubscriptionDestination struct { - // HybridConnectionEventSubscriptionDestinationProperties - Hybrid connection Properties of the event subscription destination. - *HybridConnectionEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - hcesd.EndpointType = EndpointTypeHybridConnection - objectMap := make(map[string]interface{}) - if hcesd.HybridConnectionEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = hcesd.HybridConnectionEventSubscriptionDestinationProperties - } - if hcesd.EndpointType != "" { - objectMap["endpointType"] = hcesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. -func (hcesd HybridConnectionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &hcesd, true -} - -// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestination struct. -func (hcesd *HybridConnectionEventSubscriptionDestination) 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 hybridConnectionEventSubscriptionDestinationProperties HybridConnectionEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &hybridConnectionEventSubscriptionDestinationProperties) - if err != nil { - return err - } - hcesd.HybridConnectionEventSubscriptionDestinationProperties = &hybridConnectionEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - hcesd.EndpointType = endpointType - } - } - } - - return nil -} - -// HybridConnectionEventSubscriptionDestinationProperties the properties for a hybrid connection -// destination. -type HybridConnectionEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of an hybrid connection that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // DeliveryAttributeMappings - Delivery attribute details. - DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestinationProperties struct. -func (hcesdp *HybridConnectionEventSubscriptionDestinationProperties) 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 "resourceId": - if v != nil { - var resourceID string - err = json.Unmarshal(*v, &resourceID) - if err != nil { - return err - } - hcesdp.ResourceID = &resourceID - } - case "deliveryAttributeMappings": - if v != nil { - deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) - if err != nil { - return err - } - hcesdp.DeliveryAttributeMappings = &deliveryAttributeMappings - } - } - } - - return nil -} - -// IdentityInfo the identity information for the resource. -type IdentityInfo struct { - // Type - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned', 'IdentityTypeSystemAssignedUserAssigned' - Type IdentityType `json:"type,omitempty"` - // PrincipalID - The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - // This property is currently not used and reserved for future usage. - UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for IdentityInfo. -func (ii IdentityInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ii.Type != "" { - objectMap["type"] = ii.Type - } - if ii.PrincipalID != nil { - objectMap["principalId"] = ii.PrincipalID - } - if ii.TenantID != nil { - objectMap["tenantId"] = ii.TenantID - } - if ii.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = ii.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// InboundIPRule ... -type InboundIPRule struct { - // IPMask - IP Address in CIDR notation e.g., 10.0.0.0/8. - IPMask *string `json:"ipMask,omitempty"` - // Action - Action to perform based on the match or no match of the IpMask. Possible values include: 'Allow' - Action IPActionType `json:"action,omitempty"` -} - -// BasicInputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported -// type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type BasicInputSchemaMapping interface { - AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) - AsInputSchemaMapping() (*InputSchemaMapping, bool) -} - -// InputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an -// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only -// supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. -type InputSchemaMapping struct { - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -func unmarshalBasicInputSchemaMapping(body []byte) (BasicInputSchemaMapping, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["inputSchemaMappingType"] { - case string(InputSchemaMappingTypeJSON): - var jism JSONInputSchemaMapping - err := json.Unmarshal(body, &jism) - return jism, err - default: - var ism InputSchemaMapping - err := json.Unmarshal(body, &ism) - return ism, err - } -} -func unmarshalBasicInputSchemaMappingArray(body []byte) ([]BasicInputSchemaMapping, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ismArray := make([]BasicInputSchemaMapping, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ism, err := unmarshalBasicInputSchemaMapping(*rawMessage) - if err != nil { - return nil, err - } - ismArray[index] = ism - } - return ismArray, nil -} - -// MarshalJSON is the custom marshaler for InputSchemaMapping. -func (ism InputSchemaMapping) MarshalJSON() ([]byte, error) { - ism.InputSchemaMappingType = InputSchemaMappingTypeInputSchemaMapping - objectMap := make(map[string]interface{}) - if ism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = ism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return nil, false -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return &ism, true -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. -func (ism InputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &ism, true -} - -// IsNotNullAdvancedFilter isNotNull Advanced Filter. -type IsNotNullAdvancedFilter struct { - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) MarshalJSON() ([]byte, error) { - innaf.OperatorType = OperatorTypeIsNotNull - objectMap := make(map[string]interface{}) - if innaf.Key != nil { - objectMap["key"] = innaf.Key - } - if innaf.OperatorType != "" { - objectMap["operatorType"] = innaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return &innaf, true -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. -func (innaf IsNotNullAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &innaf, true -} - -// IsNullOrUndefinedAdvancedFilter isNullOrUndefined Advanced Filter. -type IsNullOrUndefinedAdvancedFilter struct { - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) MarshalJSON() ([]byte, error) { - inouaf.OperatorType = OperatorTypeIsNullOrUndefined - objectMap := make(map[string]interface{}) - if inouaf.Key != nil { - objectMap["key"] = inouaf.Key - } - if inouaf.OperatorType != "" { - objectMap["operatorType"] = inouaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return &inouaf, true -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. -func (inouaf IsNullOrUndefinedAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &inouaf, true -} - -// JSONField this is used to express the source of an input schema mapping for a single target field in the -// Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and 'eventtime' -// properties. This represents a field in the input event schema. -type JSONField struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` -} - -// JSONFieldWithDefault this is used to express the source of an input schema mapping for a single target -// field -// in the Event Grid Event schema. This is currently used in the mappings for the 'subject', -// 'eventtype' and 'dataversion' properties. This represents a field in the input event schema -// along with a default value to be used, and at least one of these two properties should be provided. -type JSONFieldWithDefault struct { - // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. - SourceField *string `json:"sourceField,omitempty"` - // DefaultValue - The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// JSONInputSchemaMapping this enables publishing to Event Grid using a custom input schema. This can be -// used to map properties from a custom input JSON schema to the Event Grid event schema. -type JSONInputSchemaMapping struct { - // JSONInputSchemaMappingProperties - JSON Properties of the input schema mapping - *JSONInputSchemaMappingProperties `json:"properties,omitempty"` - // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' - InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` -} - -// MarshalJSON is the custom marshaler for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { - jism.InputSchemaMappingType = InputSchemaMappingTypeJSON - objectMap := make(map[string]interface{}) - if jism.JSONInputSchemaMappingProperties != nil { - objectMap["properties"] = jism.JSONInputSchemaMappingProperties - } - if jism.InputSchemaMappingType != "" { - objectMap["inputSchemaMappingType"] = jism.InputSchemaMappingType - } - return json.Marshal(objectMap) -} - -// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { - return &jism, true -} - -// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { - return nil, false -} - -// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. -func (jism JSONInputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { - return &jism, true -} - -// UnmarshalJSON is the custom unmarshaler for JSONInputSchemaMapping struct. -func (jism *JSONInputSchemaMapping) 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 JSONInputSchemaMappingProperties JSONInputSchemaMappingProperties - err = json.Unmarshal(*v, &JSONInputSchemaMappingProperties) - if err != nil { - return err - } - jism.JSONInputSchemaMappingProperties = &JSONInputSchemaMappingProperties - } - case "inputSchemaMappingType": - if v != nil { - var inputSchemaMappingType InputSchemaMappingType - err = json.Unmarshal(*v, &inputSchemaMappingType) - if err != nil { - return err - } - jism.InputSchemaMappingType = inputSchemaMappingType - } - } - } - - return nil -} - -// JSONInputSchemaMappingProperties this can be used to map properties of a source schema (or default -// values, for certain supported properties) to properties of the EventGridEvent schema. -type JSONInputSchemaMappingProperties struct { - // ID - The mapping information for the Id property of the Event Grid Event. - ID *JSONField `json:"id,omitempty"` - // Topic - The mapping information for the Topic property of the Event Grid Event. - Topic *JSONField `json:"topic,omitempty"` - // EventTime - The mapping information for the EventTime property of the Event Grid Event. - EventTime *JSONField `json:"eventTime,omitempty"` - // EventType - The mapping information for the EventType property of the Event Grid Event. - EventType *JSONFieldWithDefault `json:"eventType,omitempty"` - // Subject - The mapping information for the Subject property of the Event Grid Event. - Subject *JSONFieldWithDefault `json:"subject,omitempty"` - // DataVersion - The mapping information for the DataVersion property of the Event Grid Event. - DataVersion *JSONFieldWithDefault `json:"dataVersion,omitempty"` -} - -// NumberGreaterThanAdvancedFilter numberGreaterThan Advanced Filter. -type NumberGreaterThanAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtaf.OperatorType = OperatorTypeNumberGreaterThan - objectMap := make(map[string]interface{}) - if ngtaf.Value != nil { - objectMap["value"] = ngtaf.Value - } - if ngtaf.Key != nil { - objectMap["key"] = ngtaf.Key - } - if ngtaf.OperatorType != "" { - objectMap["operatorType"] = ngtaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return &ngtaf, true -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. -func (ngtaf NumberGreaterThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtaf, true -} - -// NumberGreaterThanOrEqualsAdvancedFilter numberGreaterThanOrEquals Advanced Filter. -type NumberGreaterThanOrEqualsAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - ngtoeaf.OperatorType = OperatorTypeNumberGreaterThanOrEquals - objectMap := make(map[string]interface{}) - if ngtoeaf.Value != nil { - objectMap["value"] = ngtoeaf.Value - } - if ngtoeaf.Key != nil { - objectMap["key"] = ngtoeaf.Key - } - if ngtoeaf.OperatorType != "" { - objectMap["operatorType"] = ngtoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. -func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &ngtoeaf, true -} - -// NumberInAdvancedFilter numberIn Advanced Filter. -type NumberInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) MarshalJSON() ([]byte, error) { - niaf.OperatorType = OperatorTypeNumberIn - objectMap := make(map[string]interface{}) - if niaf.Values != nil { - objectMap["values"] = niaf.Values - } - if niaf.Key != nil { - objectMap["key"] = niaf.Key - } - if niaf.OperatorType != "" { - objectMap["operatorType"] = niaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return &niaf, true -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. -func (niaf NumberInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &niaf, true -} - -// NumberInRangeAdvancedFilter numberInRange Advanced Filter. -type NumberInRangeAdvancedFilter struct { - // Values - The set of filter values. - Values *[][]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { - niraf.OperatorType = OperatorTypeNumberInRange - objectMap := make(map[string]interface{}) - if niraf.Values != nil { - objectMap["values"] = niraf.Values - } - if niraf.Key != nil { - objectMap["key"] = niraf.Key - } - if niraf.OperatorType != "" { - objectMap["operatorType"] = niraf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return &niraf, true -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. -func (niraf NumberInRangeAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &niraf, true -} - -// NumberLessThanAdvancedFilter numberLessThan Advanced Filter. -type NumberLessThanAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) MarshalJSON() ([]byte, error) { - nltaf.OperatorType = OperatorTypeNumberLessThan - objectMap := make(map[string]interface{}) - if nltaf.Value != nil { - objectMap["value"] = nltaf.Value - } - if nltaf.Key != nil { - objectMap["key"] = nltaf.Key - } - if nltaf.OperatorType != "" { - objectMap["operatorType"] = nltaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return &nltaf, true -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. -func (nltaf NumberLessThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltaf, true -} - -// NumberLessThanOrEqualsAdvancedFilter numberLessThanOrEquals Advanced Filter. -type NumberLessThanOrEqualsAdvancedFilter struct { - // Value - The filter value. - Value *float64 `json:"value,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - nltoeaf.OperatorType = OperatorTypeNumberLessThanOrEquals - objectMap := make(map[string]interface{}) - if nltoeaf.Value != nil { - objectMap["value"] = nltoeaf.Value - } - if nltoeaf.Key != nil { - objectMap["key"] = nltoeaf.Key - } - if nltoeaf.OperatorType != "" { - objectMap["operatorType"] = nltoeaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return &nltoeaf, true -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. -func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nltoeaf, true -} - -// NumberNotInAdvancedFilter numberNotIn Advanced Filter. -type NumberNotInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - nniaf.OperatorType = OperatorTypeNumberNotIn - objectMap := make(map[string]interface{}) - if nniaf.Values != nil { - objectMap["values"] = nniaf.Values - } - if nniaf.Key != nil { - objectMap["key"] = nniaf.Key - } - if nniaf.OperatorType != "" { - objectMap["operatorType"] = nniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return &nniaf, true -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. -func (nniaf NumberNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nniaf, true -} - -// NumberNotInRangeAdvancedFilter numberNotInRange Advanced Filter. -type NumberNotInRangeAdvancedFilter struct { - // Values - The set of filter values. - Values *[][]float64 `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { - nniraf.OperatorType = OperatorTypeNumberNotInRange - objectMap := make(map[string]interface{}) - if nniraf.Values != nil { - objectMap["values"] = nniraf.Values - } - if nniraf.Key != nil { - objectMap["key"] = nniraf.Key - } - if nniraf.OperatorType != "" { - objectMap["operatorType"] = nniraf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return &nniraf, true -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. -func (nniraf NumberNotInRangeAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &nniraf, true -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,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"` -} - -// 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"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// PartnerNamespace eventGrid Partner Namespace. -type PartnerNamespace struct { - autorest.Response `json:"-"` - // PartnerNamespaceProperties - Properties of the partner namespace. - *PartnerNamespaceProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerNamespace. -func (pn PartnerNamespace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pn.PartnerNamespaceProperties != nil { - objectMap["properties"] = pn.PartnerNamespaceProperties - } - if pn.Location != nil { - objectMap["location"] = pn.Location - } - if pn.Tags != nil { - objectMap["tags"] = pn.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PartnerNamespace struct. -func (pn *PartnerNamespace) 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 partnerNamespaceProperties PartnerNamespaceProperties - err = json.Unmarshal(*v, &partnerNamespaceProperties) - if err != nil { - return err - } - pn.PartnerNamespaceProperties = &partnerNamespaceProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pn.SystemData = &systemData - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pn.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pn.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pn.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pn.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pn.Type = &typeVar - } - } - } - - return nil -} - -// PartnerNamespaceProperties properties of the partner namespace. -type PartnerNamespaceProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the partner namespace. Possible values include: 'PartnerNamespaceProvisioningStateCreating', 'PartnerNamespaceProvisioningStateUpdating', 'PartnerNamespaceProvisioningStateDeleting', 'PartnerNamespaceProvisioningStateSucceeded', 'PartnerNamespaceProvisioningStateCanceled', 'PartnerNamespaceProvisioningStateFailed' - ProvisioningState PartnerNamespaceProvisioningState `json:"provisioningState,omitempty"` - // PartnerRegistrationFullyQualifiedID - The fully qualified ARM Id of the partner registration that should be associated with this partner namespace. This takes the following format: - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. - PartnerRegistrationFullyQualifiedID *string `json:"partnerRegistrationFullyQualifiedId,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the partner namespace. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerNamespaceProperties. -func (pnp PartnerNamespaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pnp.PartnerRegistrationFullyQualifiedID != nil { - objectMap["partnerRegistrationFullyQualifiedId"] = pnp.PartnerRegistrationFullyQualifiedID - } - return json.Marshal(objectMap) -} - -// PartnerNamespaceRegenerateKeyRequest partnerNamespace regenerate shared access key request. -type PartnerNamespaceRegenerateKeyRequest struct { - // KeyName - Key name to regenerate (key1 or key2). - KeyName *string `json:"keyName,omitempty"` -} - -// PartnerNamespacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PartnerNamespacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerNamespacesClient) (PartnerNamespace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerNamespacesCreateOrUpdateFuture) 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 PartnerNamespacesCreateOrUpdateFuture.Result. -func (future *PartnerNamespacesCreateOrUpdateFuture) result(client PartnerNamespacesClient) (pn PartnerNamespace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pn.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerNamespacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pn.Response.Response, err = future.GetResult(sender); err == nil && pn.Response.Response.StatusCode != http.StatusNoContent { - pn, err = client.CreateOrUpdateResponder(pn.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesCreateOrUpdateFuture", "Result", pn.Response.Response, "Failure responding to request") - } - } - return -} - -// PartnerNamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PartnerNamespacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerNamespacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerNamespacesDeleteFuture) 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 PartnerNamespacesDeleteFuture.Result. -func (future *PartnerNamespacesDeleteFuture) result(client PartnerNamespacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerNamespacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PartnerNamespaceSharedAccessKeys shared access keys of the partner namespace. -type PartnerNamespaceSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the partner namespace. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the partner namespace. - Key2 *string `json:"key2,omitempty"` -} - -// PartnerNamespacesListResult result of the List Partner Namespaces operation -type PartnerNamespacesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of partner namespaces. - Value *[]PartnerNamespace `json:"value,omitempty"` - // NextLink - A link for the next page of partner namespaces. - NextLink *string `json:"nextLink,omitempty"` -} - -// PartnerNamespacesListResultIterator provides access to a complete listing of PartnerNamespace values. -type PartnerNamespacesListResultIterator struct { - i int - page PartnerNamespacesListResultPage -} - -// 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 *PartnerNamespacesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesListResultIterator.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 *PartnerNamespacesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PartnerNamespacesListResultIterator) 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 PartnerNamespacesListResultIterator) Response() PartnerNamespacesListResult { - 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 PartnerNamespacesListResultIterator) Value() PartnerNamespace { - if !iter.page.NotDone() { - return PartnerNamespace{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PartnerNamespacesListResultIterator type. -func NewPartnerNamespacesListResultIterator(page PartnerNamespacesListResultPage) PartnerNamespacesListResultIterator { - return PartnerNamespacesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pnlr PartnerNamespacesListResult) IsEmpty() bool { - return pnlr.Value == nil || len(*pnlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pnlr PartnerNamespacesListResult) hasNextLink() bool { - return pnlr.NextLink != nil && len(*pnlr.NextLink) != 0 -} - -// partnerNamespacesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pnlr PartnerNamespacesListResult) partnerNamespacesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !pnlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pnlr.NextLink))) -} - -// PartnerNamespacesListResultPage contains a page of PartnerNamespace values. -type PartnerNamespacesListResultPage struct { - fn func(context.Context, PartnerNamespacesListResult) (PartnerNamespacesListResult, error) - pnlr PartnerNamespacesListResult -} - -// 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 *PartnerNamespacesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesListResultPage.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.pnlr) - if err != nil { - return err - } - page.pnlr = 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 *PartnerNamespacesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PartnerNamespacesListResultPage) NotDone() bool { - return !page.pnlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PartnerNamespacesListResultPage) Response() PartnerNamespacesListResult { - return page.pnlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PartnerNamespacesListResultPage) Values() []PartnerNamespace { - if page.pnlr.IsEmpty() { - return nil - } - return *page.pnlr.Value -} - -// Creates a new instance of the PartnerNamespacesListResultPage type. -func NewPartnerNamespacesListResultPage(cur PartnerNamespacesListResult, getNextPage func(context.Context, PartnerNamespacesListResult) (PartnerNamespacesListResult, error)) PartnerNamespacesListResultPage { - return PartnerNamespacesListResultPage{ - fn: getNextPage, - pnlr: cur, - } -} - -// PartnerNamespacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PartnerNamespacesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerNamespacesClient) (PartnerNamespace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerNamespacesUpdateFuture) 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 PartnerNamespacesUpdateFuture.Result. -func (future *PartnerNamespacesUpdateFuture) result(client PartnerNamespacesClient) (pn PartnerNamespace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pn.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerNamespacesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pn.Response.Response, err = future.GetResult(sender); err == nil && pn.Response.Response.StatusCode != http.StatusNoContent { - pn, err = client.UpdateResponder(pn.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesUpdateFuture", "Result", pn.Response.Response, "Failure responding to request") - } - } - return -} - -// PartnerNamespaceUpdateParameters properties of the PartnerNamespace update. -type PartnerNamespaceUpdateParameters struct { - // Tags - Tags of the partner namespace. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PartnerNamespaceUpdateParameters. -func (pnup PartnerNamespaceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pnup.Tags != nil { - objectMap["tags"] = pnup.Tags - } - return json.Marshal(objectMap) -} - -// PartnerRegistration information about a partner registration. -type PartnerRegistration struct { - autorest.Response `json:"-"` - // PartnerRegistrationProperties - Properties of the partner registration. - *PartnerRegistrationProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerRegistration. -func (pr PartnerRegistration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.PartnerRegistrationProperties != nil { - objectMap["properties"] = pr.PartnerRegistrationProperties - } - if pr.Location != nil { - objectMap["location"] = pr.Location - } - if pr.Tags != nil { - objectMap["tags"] = pr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PartnerRegistration struct. -func (pr *PartnerRegistration) 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 partnerRegistrationProperties PartnerRegistrationProperties - err = json.Unmarshal(*v, &partnerRegistrationProperties) - if err != nil { - return err - } - pr.PartnerRegistrationProperties = &partnerRegistrationProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pr.SystemData = &systemData - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pr.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pr.Type = &typeVar - } - } - } - - return nil -} - -// PartnerRegistrationEventTypesListResult result of the List Partner Registration Event Types operation. -type PartnerRegistrationEventTypesListResult struct { - // Value - A collection of partner registration event types. - Value *[]EventType `json:"value,omitempty"` - // NextLink - A link for the next page of partner registration event types. - NextLink *string `json:"nextLink,omitempty"` -} - -// PartnerRegistrationProperties properties of the partner registration. -type PartnerRegistrationProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the partner registration. Possible values include: 'PartnerRegistrationProvisioningStateCreating', 'PartnerRegistrationProvisioningStateUpdating', 'PartnerRegistrationProvisioningStateDeleting', 'PartnerRegistrationProvisioningStateSucceeded', 'PartnerRegistrationProvisioningStateCanceled', 'PartnerRegistrationProvisioningStateFailed' - ProvisioningState PartnerRegistrationProvisioningState `json:"provisioningState,omitempty"` - // PartnerName - Official name of the partner name. For example: "Contoso". - PartnerName *string `json:"partnerName,omitempty"` - // PartnerResourceTypeName - Name of the partner resource type. - PartnerResourceTypeName *string `json:"partnerResourceTypeName,omitempty"` - // PartnerResourceTypeDisplayName - Display name of the partner resource type. - PartnerResourceTypeDisplayName *string `json:"partnerResourceTypeDisplayName,omitempty"` - // PartnerResourceTypeDescription - Short description of the partner resource type. The length of this description should not exceed 256 characters. - PartnerResourceTypeDescription *string `json:"partnerResourceTypeDescription,omitempty"` - // LongDescription - Long description for the custom scenarios and integration to be displayed in the portal if needed. - // Length of this description should not exceed 2048 characters. - LongDescription *string `json:"longDescription,omitempty"` - // PartnerCustomerServiceNumber - The customer service number of the publisher. The expected phone format should start with a '+' sign - // followed by the country code. The remaining digits are then followed. Only digits and spaces are allowed and its - // length cannot exceed 16 digits including country code. Examples of valid phone numbers are: +1 515 123 4567 and - // +966 7 5115 2471. Examples of invalid phone numbers are: +1 (515) 123-4567, 1 515 123 4567 and +966 121 5115 24 7 551 1234 43 - PartnerCustomerServiceNumber *string `json:"partnerCustomerServiceNumber,omitempty"` - // PartnerCustomerServiceExtension - The extension of the customer service number of the publisher. Only digits are allowed and number of digits should not exceed 10. - PartnerCustomerServiceExtension *string `json:"partnerCustomerServiceExtension,omitempty"` - // CustomerServiceURI - The extension of the customer service URI of the publisher. - CustomerServiceURI *string `json:"customerServiceUri,omitempty"` - // SetupURI - URI of the partner website that can be used by Azure customers to setup Event Grid - // integration on an event source. - SetupURI *string `json:"setupUri,omitempty"` - // LogoURI - URI of the logo. - LogoURI *string `json:"logoUri,omitempty"` - // VisibilityState - Visibility state of the partner registration. Possible values include: 'Hidden', 'PublicPreview', 'GenerallyAvailable' - VisibilityState PartnerRegistrationVisibilityState `json:"visibilityState,omitempty"` - // AuthorizedAzureSubscriptionIds - List of Azure subscription Ids that are authorized to create a partner namespace - // associated with this partner registration. This is an optional property. Creating - // partner namespaces is always permitted under the same Azure subscription as the one used - // for creating the partner registration. - AuthorizedAzureSubscriptionIds *[]string `json:"authorizedAzureSubscriptionIds,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerRegistrationProperties. -func (prp PartnerRegistrationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prp.PartnerName != nil { - objectMap["partnerName"] = prp.PartnerName - } - if prp.PartnerResourceTypeName != nil { - objectMap["partnerResourceTypeName"] = prp.PartnerResourceTypeName - } - if prp.PartnerResourceTypeDisplayName != nil { - objectMap["partnerResourceTypeDisplayName"] = prp.PartnerResourceTypeDisplayName - } - if prp.PartnerResourceTypeDescription != nil { - objectMap["partnerResourceTypeDescription"] = prp.PartnerResourceTypeDescription - } - if prp.LongDescription != nil { - objectMap["longDescription"] = prp.LongDescription - } - if prp.PartnerCustomerServiceNumber != nil { - objectMap["partnerCustomerServiceNumber"] = prp.PartnerCustomerServiceNumber - } - if prp.PartnerCustomerServiceExtension != nil { - objectMap["partnerCustomerServiceExtension"] = prp.PartnerCustomerServiceExtension - } - if prp.CustomerServiceURI != nil { - objectMap["customerServiceUri"] = prp.CustomerServiceURI - } - if prp.SetupURI != nil { - objectMap["setupUri"] = prp.SetupURI - } - if prp.LogoURI != nil { - objectMap["logoUri"] = prp.LogoURI - } - if prp.VisibilityState != "" { - objectMap["visibilityState"] = prp.VisibilityState - } - if prp.AuthorizedAzureSubscriptionIds != nil { - objectMap["authorizedAzureSubscriptionIds"] = prp.AuthorizedAzureSubscriptionIds - } - return json.Marshal(objectMap) -} - -// PartnerRegistrationsListResult result of the List Partner Registrations operation. -type PartnerRegistrationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of partner registrations. - Value *[]PartnerRegistration `json:"value,omitempty"` - // NextLink - A link for the next page of partner registrations. - NextLink *string `json:"nextLink,omitempty"` -} - -// PartnerRegistrationsListResultIterator provides access to a complete listing of PartnerRegistration -// values. -type PartnerRegistrationsListResultIterator struct { - i int - page PartnerRegistrationsListResultPage -} - -// 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 *PartnerRegistrationsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsListResultIterator.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 *PartnerRegistrationsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PartnerRegistrationsListResultIterator) 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 PartnerRegistrationsListResultIterator) Response() PartnerRegistrationsListResult { - 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 PartnerRegistrationsListResultIterator) Value() PartnerRegistration { - if !iter.page.NotDone() { - return PartnerRegistration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PartnerRegistrationsListResultIterator type. -func NewPartnerRegistrationsListResultIterator(page PartnerRegistrationsListResultPage) PartnerRegistrationsListResultIterator { - return PartnerRegistrationsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (prlr PartnerRegistrationsListResult) IsEmpty() bool { - return prlr.Value == nil || len(*prlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (prlr PartnerRegistrationsListResult) hasNextLink() bool { - return prlr.NextLink != nil && len(*prlr.NextLink) != 0 -} - -// partnerRegistrationsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (prlr PartnerRegistrationsListResult) partnerRegistrationsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !prlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(prlr.NextLink))) -} - -// PartnerRegistrationsListResultPage contains a page of PartnerRegistration values. -type PartnerRegistrationsListResultPage struct { - fn func(context.Context, PartnerRegistrationsListResult) (PartnerRegistrationsListResult, error) - prlr PartnerRegistrationsListResult -} - -// 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 *PartnerRegistrationsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsListResultPage.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.prlr) - if err != nil { - return err - } - page.prlr = 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 *PartnerRegistrationsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PartnerRegistrationsListResultPage) NotDone() bool { - return !page.prlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PartnerRegistrationsListResultPage) Response() PartnerRegistrationsListResult { - return page.prlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PartnerRegistrationsListResultPage) Values() []PartnerRegistration { - if page.prlr.IsEmpty() { - return nil - } - return *page.prlr.Value -} - -// Creates a new instance of the PartnerRegistrationsListResultPage type. -func NewPartnerRegistrationsListResultPage(cur PartnerRegistrationsListResult, getNextPage func(context.Context, PartnerRegistrationsListResult) (PartnerRegistrationsListResult, error)) PartnerRegistrationsListResultPage { - return PartnerRegistrationsListResultPage{ - fn: getNextPage, - prlr: cur, - } -} - -// PartnerRegistrationUpdateParameters properties of the Partner Registration update. -type PartnerRegistrationUpdateParameters struct { - // Tags - Tags of the partner registration resource. - Tags map[string]*string `json:"tags"` - // PartnerTopicTypeName - Name of the partner topic type. - PartnerTopicTypeName *string `json:"partnerTopicTypeName,omitempty"` - // PartnerTopicTypeDisplayName - Display name of the partner topic type. - PartnerTopicTypeDisplayName *string `json:"partnerTopicTypeDisplayName,omitempty"` - // PartnerTopicTypeDescription - Description of the partner topic type. - PartnerTopicTypeDescription *string `json:"partnerTopicTypeDescription,omitempty"` - // SetupURI - URI of the partner website that can be used by Azure customers to setup Event Grid - // integration on an event source. - SetupURI *string `json:"setupUri,omitempty"` - // LogoURI - URI of the partner logo. - LogoURI *string `json:"logoUri,omitempty"` - // AuthorizedAzureSubscriptionIds - List of IDs of Azure AD applications that are authorized to create a partner namespace - // associated with this partner registration. This is an optional property. Creating - // partner namespaces is always permitted under the same Azure subscription as the one used - // for creating the partner registration. - AuthorizedAzureSubscriptionIds *[]string `json:"authorizedAzureSubscriptionIds,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerRegistrationUpdateParameters. -func (prup PartnerRegistrationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prup.Tags != nil { - objectMap["tags"] = prup.Tags - } - if prup.PartnerTopicTypeName != nil { - objectMap["partnerTopicTypeName"] = prup.PartnerTopicTypeName - } - if prup.PartnerTopicTypeDisplayName != nil { - objectMap["partnerTopicTypeDisplayName"] = prup.PartnerTopicTypeDisplayName - } - if prup.PartnerTopicTypeDescription != nil { - objectMap["partnerTopicTypeDescription"] = prup.PartnerTopicTypeDescription - } - if prup.SetupURI != nil { - objectMap["setupUri"] = prup.SetupURI - } - if prup.LogoURI != nil { - objectMap["logoUri"] = prup.LogoURI - } - if prup.AuthorizedAzureSubscriptionIds != nil { - objectMap["authorizedAzureSubscriptionIds"] = prup.AuthorizedAzureSubscriptionIds - } - return json.Marshal(objectMap) -} - -// PartnerTopic eventGrid Partner Topic. -type PartnerTopic struct { - autorest.Response `json:"-"` - // PartnerTopicProperties - Properties of the partner topic. - *PartnerTopicProperties `json:"properties,omitempty"` - // Identity - Identity information for the resource. - Identity *IdentityInfo `json:"identity,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerTopic. -func (pt PartnerTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pt.PartnerTopicProperties != nil { - objectMap["properties"] = pt.PartnerTopicProperties - } - if pt.Identity != nil { - objectMap["identity"] = pt.Identity - } - if pt.Location != nil { - objectMap["location"] = pt.Location - } - if pt.Tags != nil { - objectMap["tags"] = pt.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PartnerTopic struct. -func (pt *PartnerTopic) 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 partnerTopicProperties PartnerTopicProperties - err = json.Unmarshal(*v, &partnerTopicProperties) - if err != nil { - return err - } - pt.PartnerTopicProperties = &partnerTopicProperties - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - pt.Identity = &identity - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pt.SystemData = &systemData - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pt.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pt.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pt.Type = &typeVar - } - } - } - - return nil -} - -// PartnerTopicEventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type PartnerTopicEventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerTopicEventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerTopicEventSubscriptionsCreateOrUpdateFuture) 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 PartnerTopicEventSubscriptionsCreateOrUpdateFuture.Result. -func (future *PartnerTopicEventSubscriptionsCreateOrUpdateFuture) result(client PartnerTopicEventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// PartnerTopicEventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PartnerTopicEventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerTopicEventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerTopicEventSubscriptionsDeleteFuture) 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 PartnerTopicEventSubscriptionsDeleteFuture.Result. -func (future *PartnerTopicEventSubscriptionsDeleteFuture) result(client PartnerTopicEventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicEventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PartnerTopicEventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PartnerTopicEventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerTopicEventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerTopicEventSubscriptionsUpdateFuture) 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 PartnerTopicEventSubscriptionsUpdateFuture.Result. -func (future *PartnerTopicEventSubscriptionsUpdateFuture) result(client PartnerTopicEventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicEventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// PartnerTopicProperties properties of the Partner Topic. -type PartnerTopicProperties struct { - // Source - Source associated with this partner topic. This represents a unique partner resource. - Source *string `json:"source,omitempty"` - // ExpirationTimeIfNotActivatedUtc - Expiration time of the partner topic. If this timer expires while the partner topic is still never activated, - // the partner topic and corresponding event channel are deleted. - ExpirationTimeIfNotActivatedUtc *date.Time `json:"expirationTimeIfNotActivatedUtc,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the partner topic. Possible values include: 'PartnerTopicProvisioningStateCreating', 'PartnerTopicProvisioningStateUpdating', 'PartnerTopicProvisioningStateDeleting', 'PartnerTopicProvisioningStateSucceeded', 'PartnerTopicProvisioningStateCanceled', 'PartnerTopicProvisioningStateFailed' - ProvisioningState PartnerTopicProvisioningState `json:"provisioningState,omitempty"` - // ActivationState - Activation state of the partner topic. Possible values include: 'NeverActivated', 'Activated', 'Deactivated' - ActivationState PartnerTopicActivationState `json:"activationState,omitempty"` - // PartnerTopicFriendlyDescription - Friendly description about the topic. This can be set by the publisher/partner to show custom description for the customer partner topic. - // This will be helpful to remove any ambiguity of the origin of creation of the partner topic for the customer. - PartnerTopicFriendlyDescription *string `json:"partnerTopicFriendlyDescription,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerTopicProperties. -func (ptp PartnerTopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptp.Source != nil { - objectMap["source"] = ptp.Source - } - if ptp.ExpirationTimeIfNotActivatedUtc != nil { - objectMap["expirationTimeIfNotActivatedUtc"] = ptp.ExpirationTimeIfNotActivatedUtc - } - if ptp.ActivationState != "" { - objectMap["activationState"] = ptp.ActivationState - } - if ptp.PartnerTopicFriendlyDescription != nil { - objectMap["partnerTopicFriendlyDescription"] = ptp.PartnerTopicFriendlyDescription - } - return json.Marshal(objectMap) -} - -// PartnerTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PartnerTopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PartnerTopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PartnerTopicsDeleteFuture) 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 PartnerTopicsDeleteFuture.Result. -func (future *PartnerTopicsDeleteFuture) result(client PartnerTopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PartnerTopicsListResult result of the List Partner Topics operation. -type PartnerTopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of partner topics. - Value *[]PartnerTopic `json:"value,omitempty"` - // NextLink - A link for the next page of partner topics. - NextLink *string `json:"nextLink,omitempty"` -} - -// PartnerTopicsListResultIterator provides access to a complete listing of PartnerTopic values. -type PartnerTopicsListResultIterator struct { - i int - page PartnerTopicsListResultPage -} - -// 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 *PartnerTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsListResultIterator.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 *PartnerTopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PartnerTopicsListResultIterator) 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 PartnerTopicsListResultIterator) Response() PartnerTopicsListResult { - 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 PartnerTopicsListResultIterator) Value() PartnerTopic { - if !iter.page.NotDone() { - return PartnerTopic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PartnerTopicsListResultIterator type. -func NewPartnerTopicsListResultIterator(page PartnerTopicsListResultPage) PartnerTopicsListResultIterator { - return PartnerTopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ptlr PartnerTopicsListResult) IsEmpty() bool { - return ptlr.Value == nil || len(*ptlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ptlr PartnerTopicsListResult) hasNextLink() bool { - return ptlr.NextLink != nil && len(*ptlr.NextLink) != 0 -} - -// partnerTopicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ptlr PartnerTopicsListResult) partnerTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ptlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ptlr.NextLink))) -} - -// PartnerTopicsListResultPage contains a page of PartnerTopic values. -type PartnerTopicsListResultPage struct { - fn func(context.Context, PartnerTopicsListResult) (PartnerTopicsListResult, error) - ptlr PartnerTopicsListResult -} - -// 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 *PartnerTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsListResultPage.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.ptlr) - if err != nil { - return err - } - page.ptlr = 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 *PartnerTopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PartnerTopicsListResultPage) NotDone() bool { - return !page.ptlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PartnerTopicsListResultPage) Response() PartnerTopicsListResult { - return page.ptlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PartnerTopicsListResultPage) Values() []PartnerTopic { - if page.ptlr.IsEmpty() { - return nil - } - return *page.ptlr.Value -} - -// Creates a new instance of the PartnerTopicsListResultPage type. -func NewPartnerTopicsListResultPage(cur PartnerTopicsListResult, getNextPage func(context.Context, PartnerTopicsListResult) (PartnerTopicsListResult, error)) PartnerTopicsListResultPage { - return PartnerTopicsListResultPage{ - fn: getNextPage, - ptlr: cur, - } -} - -// PartnerTopicType properties of a partner topic type. -type PartnerTopicType struct { - // PartnerTopicTypeProperties - Properties of the partner topic type. - *PartnerTopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerTopicType. -func (ptt PartnerTopicType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptt.PartnerTopicTypeProperties != nil { - objectMap["properties"] = ptt.PartnerTopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PartnerTopicType struct. -func (ptt *PartnerTopicType) 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 partnerTopicTypeProperties PartnerTopicTypeProperties - err = json.Unmarshal(*v, &partnerTopicTypeProperties) - if err != nil { - return err - } - ptt.PartnerTopicTypeProperties = &partnerTopicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ptt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ptt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ptt.Type = &typeVar - } - } - } - - return nil -} - -// PartnerTopicTypeProperties properties of a partner topic type. -type PartnerTopicTypeProperties struct { - // PartnerName - Official name of the partner. - PartnerName *string `json:"partnerName,omitempty"` - // TopicTypeName - Name of the partner topic type. This name should be unique among all partner topic types names. - TopicTypeName *string `json:"topicTypeName,omitempty"` - // DisplayName - Display Name for the partner topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the partner topic type. - Description *string `json:"description,omitempty"` - // SetupURI - URI of the partner website that can be used by Azure customers to setup Event Grid - // integration on an event source. - SetupURI *string `json:"setupUri,omitempty"` - // AuthorizationState - Status of whether the customer has authorized a partner to create partner topics - // in the customer's subscription. Possible values include: 'NotApplicable', 'NotAuthorized', 'Authorized' - AuthorizationState PartnerTopicTypeAuthorizationState `json:"authorizationState,omitempty"` -} - -// PartnerTopicTypesListResult result of the List Partner Topic Types operation. -type PartnerTopicTypesListResult struct { - // Value - A collection of partner topic types. - Value *[]PartnerTopicType `json:"value,omitempty"` -} - -// PartnerTopicUpdateParameters properties of the Partner Topic update. -type PartnerTopicUpdateParameters struct { - // Tags - Tags of the partner topic. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PartnerTopicUpdateParameters. -func (ptup PartnerTopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptup.Tags != nil { - objectMap["tags"] = ptup.Tags - } - return json.Marshal(objectMap) -} - -// PrivateEndpoint privateEndpoint information. -type PrivateEndpoint struct { - // ID - The ARM identifier for Private Endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateEndpointConnection ... -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult result of the list of all private endpoint connections operation. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - A collection of private endpoint connection resources. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - A link for the next page of private endpoint connection resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) - if err != nil { - return err - } - page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of the private endpoint connection resource. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The Private Endpoint resource for this Connection. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // GroupIds - GroupIds from the private link service resource. - GroupIds *[]string `json:"groupIds,omitempty"` - // PrivateLinkServiceConnectionState - Details about the state of the connection. - PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - Provisioning state of the Private Endpoint Connection. Possible values include: 'ResourceProvisioningStateCreating', 'ResourceProvisioningStateUpdating', 'ResourceProvisioningStateDeleting', 'ResourceProvisioningStateSucceeded', 'ResourceProvisioningStateCanceled', 'ResourceProvisioningStateFailed' - ProvisioningState ResourceProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsUpdateFuture) 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 PrivateEndpointConnectionsUpdateFuture.Result. -func (future *PrivateEndpointConnectionsUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.PrivateEndpointConnectionsUpdateFuture") - 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, "eventgrid.PrivateEndpointConnectionsUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkResource information of the private link resource. -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Properties of the private link resource. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - Name of the resource. - Name *string `json:"name,omitempty"` - // Type - Type of the resource. - Type *string `json:"type,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 - } - if plr.ID != nil { - objectMap["id"] = plr.ID - } - if plr.Name != nil { - objectMap["name"] = plr.Name - } - if plr.Type != nil { - objectMap["type"] = plr.Type - } - 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 - } - } - } - - return nil -} - -// PrivateLinkResourceProperties ... -type PrivateLinkResourceProperties struct { - GroupID *string `json:"groupId,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// PrivateLinkResourcesListResult result of the List private link resources operation. -type PrivateLinkResourcesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - A link for the next page of private link resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateLinkResourcesListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourcesListResultIterator struct { - i int - page PrivateLinkResourcesListResultPage -} - -// 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 *PrivateLinkResourcesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListResultIterator.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 *PrivateLinkResourcesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourcesListResultIterator) 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 PrivateLinkResourcesListResultIterator) Response() PrivateLinkResourcesListResult { - 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 PrivateLinkResourcesListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourcesListResultIterator type. -func NewPrivateLinkResourcesListResultIterator(page PrivateLinkResourcesListResultPage) PrivateLinkResourcesListResultIterator { - return PrivateLinkResourcesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourcesListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourcesListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourcesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourcesListResult) privateLinkResourcesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourcesListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourcesListResultPage struct { - fn func(context.Context, PrivateLinkResourcesListResult) (PrivateLinkResourcesListResult, error) - plrlr PrivateLinkResourcesListResult -} - -// 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 *PrivateLinkResourcesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourcesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourcesListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourcesListResultPage) Response() PrivateLinkResourcesListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourcesListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourcesListResultPage type. -func NewPrivateLinkResourcesListResultPage(cur PrivateLinkResourcesListResult, getNextPage func(context.Context, PrivateLinkResourcesListResult) (PrivateLinkResourcesListResult, error)) PrivateLinkResourcesListResultPage { - return PrivateLinkResourcesListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// Resource definition of a Resource -type Resource struct { - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - 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) -} - -// ResourceSku describes an EventGrid Resource Sku. -type ResourceSku struct { - // Name - The Sku name of the resource. The possible values are: Basic or Premium. Possible values include: 'Basic', 'Premium' - Name Sku `json:"name,omitempty"` -} - -// RetryPolicy information about the retry policy for an event subscription. -type RetryPolicy struct { - // MaxDeliveryAttempts - Maximum number of delivery retry attempts for events. - MaxDeliveryAttempts *int32 `json:"maxDeliveryAttempts,omitempty"` - // EventTimeToLiveInMinutes - Time To Live (in minutes) for events. - EventTimeToLiveInMinutes *int32 `json:"eventTimeToLiveInMinutes,omitempty"` -} - -// ServiceBusQueueEventSubscriptionDestination information about the service bus destination for an event -// subscription. -type ServiceBusQueueEventSubscriptionDestination struct { - // ServiceBusQueueEventSubscriptionDestinationProperties - Service Bus Properties of the event subscription destination. - *ServiceBusQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sbqesd.EndpointType = EndpointTypeServiceBusQueue - objectMap := make(map[string]interface{}) - if sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties - } - if sbqesd.EndpointType != "" { - objectMap["endpointType"] = sbqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return &sbqesd, true -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. -func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sbqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceBusQueueEventSubscriptionDestination struct. -func (sbqesd *ServiceBusQueueEventSubscriptionDestination) 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 serviceBusQueueEventSubscriptionDestinationProperties ServiceBusQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &serviceBusQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties = &serviceBusQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// ServiceBusQueueEventSubscriptionDestinationProperties the properties that represent the Service Bus -// destination of an event subscription. -type ServiceBusQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Service Bus destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // DeliveryAttributeMappings - Delivery attribute details. - DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for ServiceBusQueueEventSubscriptionDestinationProperties struct. -func (sbqesdp *ServiceBusQueueEventSubscriptionDestinationProperties) 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 "resourceId": - if v != nil { - var resourceID string - err = json.Unmarshal(*v, &resourceID) - if err != nil { - return err - } - sbqesdp.ResourceID = &resourceID - } - case "deliveryAttributeMappings": - if v != nil { - deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) - if err != nil { - return err - } - sbqesdp.DeliveryAttributeMappings = &deliveryAttributeMappings - } - } - } - - return nil -} - -// ServiceBusTopicEventSubscriptionDestination information about the service bus topic destination for an -// event subscription. -type ServiceBusTopicEventSubscriptionDestination struct { - // ServiceBusTopicEventSubscriptionDestinationProperties - Service Bus Topic Properties of the event subscription destination. - *ServiceBusTopicEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sbtesd.EndpointType = EndpointTypeServiceBusTopic - objectMap := make(map[string]interface{}) - if sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties - } - if sbtesd.EndpointType != "" { - objectMap["endpointType"] = sbtesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return &sbtesd, true -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. -func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sbtesd, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceBusTopicEventSubscriptionDestination struct. -func (sbtesd *ServiceBusTopicEventSubscriptionDestination) 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 serviceBusTopicEventSubscriptionDestinationProperties ServiceBusTopicEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &serviceBusTopicEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties = &serviceBusTopicEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbtesd.EndpointType = endpointType - } - } - } - - return nil -} - -// ServiceBusTopicEventSubscriptionDestinationProperties the properties that represent the Service Bus -// Topic destination of an event subscription. -type ServiceBusTopicEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of the Service Bus Topic destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // DeliveryAttributeMappings - Delivery attribute details. - DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for ServiceBusTopicEventSubscriptionDestinationProperties struct. -func (sbtesdp *ServiceBusTopicEventSubscriptionDestinationProperties) 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 "resourceId": - if v != nil { - var resourceID string - err = json.Unmarshal(*v, &resourceID) - if err != nil { - return err - } - sbtesdp.ResourceID = &resourceID - } - case "deliveryAttributeMappings": - if v != nil { - deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) - if err != nil { - return err - } - sbtesdp.DeliveryAttributeMappings = &deliveryAttributeMappings - } - } - } - - return nil -} - -// StaticDeliveryAttributeMapping static delivery attribute mapping details. -type StaticDeliveryAttributeMapping struct { - // StaticDeliveryAttributeMappingProperties - Properties of static delivery attribute mapping. - *StaticDeliveryAttributeMappingProperties `json:"properties,omitempty"` - // Name - Name of the delivery attribute or header. - Name *string `json:"name,omitempty"` - // Type - Possible values include: 'TypeDeliveryAttributeMapping', 'TypeStatic', 'TypeDynamic' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for StaticDeliveryAttributeMapping. -func (sdam StaticDeliveryAttributeMapping) MarshalJSON() ([]byte, error) { - sdam.Type = TypeStatic - objectMap := make(map[string]interface{}) - if sdam.StaticDeliveryAttributeMappingProperties != nil { - objectMap["properties"] = sdam.StaticDeliveryAttributeMappingProperties - } - if sdam.Name != nil { - objectMap["name"] = sdam.Name - } - if sdam.Type != "" { - objectMap["type"] = sdam.Type - } - return json.Marshal(objectMap) -} - -// AsStaticDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for StaticDeliveryAttributeMapping. -func (sdam StaticDeliveryAttributeMapping) AsStaticDeliveryAttributeMapping() (*StaticDeliveryAttributeMapping, bool) { - return &sdam, true -} - -// AsDynamicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for StaticDeliveryAttributeMapping. -func (sdam StaticDeliveryAttributeMapping) AsDynamicDeliveryAttributeMapping() (*DynamicDeliveryAttributeMapping, bool) { - return nil, false -} - -// AsDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for StaticDeliveryAttributeMapping. -func (sdam StaticDeliveryAttributeMapping) AsDeliveryAttributeMapping() (*DeliveryAttributeMapping, bool) { - return nil, false -} - -// AsBasicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for StaticDeliveryAttributeMapping. -func (sdam StaticDeliveryAttributeMapping) AsBasicDeliveryAttributeMapping() (BasicDeliveryAttributeMapping, bool) { - return &sdam, true -} - -// UnmarshalJSON is the custom unmarshaler for StaticDeliveryAttributeMapping struct. -func (sdam *StaticDeliveryAttributeMapping) 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 staticDeliveryAttributeMappingProperties StaticDeliveryAttributeMappingProperties - err = json.Unmarshal(*v, &staticDeliveryAttributeMappingProperties) - if err != nil { - return err - } - sdam.StaticDeliveryAttributeMappingProperties = &staticDeliveryAttributeMappingProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdam.Name = &name - } - case "type": - if v != nil { - var typeVar Type - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdam.Type = typeVar - } - } - } - - return nil -} - -// StaticDeliveryAttributeMappingProperties properties of static delivery attribute mapping. -type StaticDeliveryAttributeMappingProperties struct { - // Value - Value of the delivery attribute. - Value *string `json:"value,omitempty"` - // IsSecret - Boolean flag to tell if the attribute contains sensitive information . - IsSecret *bool `json:"isSecret,omitempty"` -} - -// StorageBlobDeadLetterDestination information about the storage blob based dead letter destination. -type StorageBlobDeadLetterDestination struct { - // StorageBlobDeadLetterDestinationProperties - The properties of the Storage Blob based deadletter destination - *StorageBlobDeadLetterDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' - EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { - sbdld.EndpointType = EndpointTypeStorageBlob - objectMap := make(map[string]interface{}) - if sbdld.StorageBlobDeadLetterDestinationProperties != nil { - objectMap["properties"] = sbdld.StorageBlobDeadLetterDestinationProperties - } - if sbdld.EndpointType != "" { - objectMap["endpointType"] = sbdld.EndpointType - } - return json.Marshal(objectMap) -} - -// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { - return &sbdld, true -} - -// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { - return nil, false -} - -// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. -func (sbdld StorageBlobDeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { - return &sbdld, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageBlobDeadLetterDestination struct. -func (sbdld *StorageBlobDeadLetterDestination) 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 storageBlobDeadLetterDestinationProperties StorageBlobDeadLetterDestinationProperties - err = json.Unmarshal(*v, &storageBlobDeadLetterDestinationProperties) - if err != nil { - return err - } - sbdld.StorageBlobDeadLetterDestinationProperties = &storageBlobDeadLetterDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointTypeBasicDeadLetterDestination - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sbdld.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageBlobDeadLetterDestinationProperties properties of the storage blob based dead letter destination. -type StorageBlobDeadLetterDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that is the destination of the deadletter events - ResourceID *string `json:"resourceId,omitempty"` - // BlobContainerName - The name of the Storage blob container that is the destination of the deadletter events - BlobContainerName *string `json:"blobContainerName,omitempty"` -} - -// StorageQueueEventSubscriptionDestination information about the storage queue destination for an event -// subscription. -type StorageQueueEventSubscriptionDestination struct { - // StorageQueueEventSubscriptionDestinationProperties - Storage Queue Properties of the event subscription destination. - *StorageQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - sqesd.EndpointType = EndpointTypeStorageQueue - objectMap := make(map[string]interface{}) - if sqesd.StorageQueueEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = sqesd.StorageQueueEventSubscriptionDestinationProperties - } - if sqesd.EndpointType != "" { - objectMap["endpointType"] = sqesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. -func (sqesd StorageQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &sqesd, true -} - -// UnmarshalJSON is the custom unmarshaler for StorageQueueEventSubscriptionDestination struct. -func (sqesd *StorageQueueEventSubscriptionDestination) 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 storageQueueEventSubscriptionDestinationProperties StorageQueueEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &storageQueueEventSubscriptionDestinationProperties) - if err != nil { - return err - } - sqesd.StorageQueueEventSubscriptionDestinationProperties = &storageQueueEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - sqesd.EndpointType = endpointType - } - } - } - - return nil -} - -// StorageQueueEventSubscriptionDestinationProperties the properties for a storage queue destination. -type StorageQueueEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` - // QueueName - The name of the Storage queue under a storage account that is the destination of an event subscription. - QueueName *string `json:"queueName,omitempty"` - // QueueMessageTimeToLiveInSeconds - Storage queue message time to live in seconds. - QueueMessageTimeToLiveInSeconds *int64 `json:"queueMessageTimeToLiveInSeconds,omitempty"` -} - -// StringBeginsWithAdvancedFilter stringBeginsWith Advanced Filter. -type StringBeginsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sbwaf.OperatorType = OperatorTypeStringBeginsWith - objectMap := make(map[string]interface{}) - if sbwaf.Values != nil { - objectMap["values"] = sbwaf.Values - } - if sbwaf.Key != nil { - objectMap["key"] = sbwaf.Key - } - if sbwaf.OperatorType != "" { - objectMap["operatorType"] = sbwaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return &sbwaf, true -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. -func (sbwaf StringBeginsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sbwaf, true -} - -// StringContainsAdvancedFilter stringContains Advanced Filter. -type StringContainsAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) MarshalJSON() ([]byte, error) { - scaf.OperatorType = OperatorTypeStringContains - objectMap := make(map[string]interface{}) - if scaf.Values != nil { - objectMap["values"] = scaf.Values - } - if scaf.Key != nil { - objectMap["key"] = scaf.Key - } - if scaf.OperatorType != "" { - objectMap["operatorType"] = scaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return &scaf, true -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. -func (scaf StringContainsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &scaf, true -} - -// StringEndsWithAdvancedFilter stringEndsWith Advanced Filter. -type StringEndsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - sewaf.OperatorType = OperatorTypeStringEndsWith - objectMap := make(map[string]interface{}) - if sewaf.Values != nil { - objectMap["values"] = sewaf.Values - } - if sewaf.Key != nil { - objectMap["key"] = sewaf.Key - } - if sewaf.OperatorType != "" { - objectMap["operatorType"] = sewaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return &sewaf, true -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. -func (sewaf StringEndsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sewaf, true -} - -// StringInAdvancedFilter stringIn Advanced Filter. -type StringInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) MarshalJSON() ([]byte, error) { - siaf.OperatorType = OperatorTypeStringIn - objectMap := make(map[string]interface{}) - if siaf.Values != nil { - objectMap["values"] = siaf.Values - } - if siaf.Key != nil { - objectMap["key"] = siaf.Key - } - if siaf.OperatorType != "" { - objectMap["operatorType"] = siaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return &siaf, true -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. -func (siaf StringInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &siaf, true -} - -// StringNotBeginsWithAdvancedFilter stringNotBeginsWith Advanced Filter. -type StringNotBeginsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - snbwaf.OperatorType = OperatorTypeStringNotBeginsWith - objectMap := make(map[string]interface{}) - if snbwaf.Values != nil { - objectMap["values"] = snbwaf.Values - } - if snbwaf.Key != nil { - objectMap["key"] = snbwaf.Key - } - if snbwaf.OperatorType != "" { - objectMap["operatorType"] = snbwaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return &snbwaf, true -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. -func (snbwaf StringNotBeginsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &snbwaf, true -} - -// StringNotContainsAdvancedFilter stringNotContains Advanced Filter. -type StringNotContainsAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) MarshalJSON() ([]byte, error) { - sncaf.OperatorType = OperatorTypeStringNotContains - objectMap := make(map[string]interface{}) - if sncaf.Values != nil { - objectMap["values"] = sncaf.Values - } - if sncaf.Key != nil { - objectMap["key"] = sncaf.Key - } - if sncaf.OperatorType != "" { - objectMap["operatorType"] = sncaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return &sncaf, true -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. -func (sncaf StringNotContainsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sncaf, true -} - -// StringNotEndsWithAdvancedFilter stringNotEndsWith Advanced Filter. -type StringNotEndsWithAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - snewaf.OperatorType = OperatorTypeStringNotEndsWith - objectMap := make(map[string]interface{}) - if snewaf.Values != nil { - objectMap["values"] = snewaf.Values - } - if snewaf.Key != nil { - objectMap["key"] = snewaf.Key - } - if snewaf.OperatorType != "" { - objectMap["operatorType"] = snewaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return nil, false -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return &snewaf, true -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. -func (snewaf StringNotEndsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &snewaf, true -} - -// StringNotInAdvancedFilter stringNotIn Advanced Filter. -type StringNotInAdvancedFilter struct { - // Values - The set of filter values. - Values *[]string `json:"values,omitempty"` - // Key - The field/property in the event based on which you want to filter. - Key *string `json:"key,omitempty"` - // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' - OperatorType OperatorType `json:"operatorType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - sniaf.OperatorType = OperatorTypeStringNotIn - objectMap := make(map[string]interface{}) - if sniaf.Values != nil { - objectMap["values"] = sniaf.Values - } - if sniaf.Key != nil { - objectMap["key"] = sniaf.Key - } - if sniaf.OperatorType != "" { - objectMap["operatorType"] = sniaf.OperatorType - } - return json.Marshal(objectMap) -} - -// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { - return nil, false -} - -// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { - return nil, false -} - -// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { - return &sniaf, true -} - -// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { - return nil, false -} - -// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { - return nil, false -} - -// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { - return nil, false -} - -// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { - return nil, false -} - -// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { - return nil, false -} - -// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { - return nil, false -} - -// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. -func (sniaf StringNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { - return &sniaf, true -} - -// 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: 'User', 'Application', 'ManagedIdentity', 'Key' - 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: 'User', 'Application', 'ManagedIdentity', 'Key' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// SystemTopic eventGrid System Topic. -type SystemTopic struct { - autorest.Response `json:"-"` - // SystemTopicProperties - Properties of the system topic. - *SystemTopicProperties `json:"properties,omitempty"` - // Identity - Identity information for the resource. - Identity *IdentityInfo `json:"identity,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SystemTopic. -func (st SystemTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if st.SystemTopicProperties != nil { - objectMap["properties"] = st.SystemTopicProperties - } - if st.Identity != nil { - objectMap["identity"] = st.Identity - } - if st.Location != nil { - objectMap["location"] = st.Location - } - if st.Tags != nil { - objectMap["tags"] = st.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SystemTopic struct. -func (st *SystemTopic) 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 systemTopicProperties SystemTopicProperties - err = json.Unmarshal(*v, &systemTopicProperties) - if err != nil { - return err - } - st.SystemTopicProperties = &systemTopicProperties - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - st.Identity = &identity - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - st.SystemData = &systemData - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - st.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - st.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - st.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - st.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - st.Type = &typeVar - } - } - } - - return nil -} - -// SystemTopicEventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SystemTopicEventSubscriptionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicEventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicEventSubscriptionsCreateOrUpdateFuture) 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 SystemTopicEventSubscriptionsCreateOrUpdateFuture.Result. -func (future *SystemTopicEventSubscriptionsCreateOrUpdateFuture) result(client SystemTopicEventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemTopicEventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SystemTopicEventSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicEventSubscriptionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicEventSubscriptionsDeleteFuture) 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 SystemTopicEventSubscriptionsDeleteFuture.Result. -func (future *SystemTopicEventSubscriptionsDeleteFuture) result(client SystemTopicEventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicEventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SystemTopicEventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SystemTopicEventSubscriptionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicEventSubscriptionsClient) (EventSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicEventSubscriptionsUpdateFuture) 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 SystemTopicEventSubscriptionsUpdateFuture.Result. -func (future *SystemTopicEventSubscriptionsUpdateFuture) result(client SystemTopicEventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - es.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicEventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemTopicProperties properties of the System Topic. -type SystemTopicProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the system topic. Possible values include: 'ResourceProvisioningStateCreating', 'ResourceProvisioningStateUpdating', 'ResourceProvisioningStateDeleting', 'ResourceProvisioningStateSucceeded', 'ResourceProvisioningStateCanceled', 'ResourceProvisioningStateFailed' - ProvisioningState ResourceProvisioningState `json:"provisioningState,omitempty"` - // Source - Source for the system topic. - Source *string `json:"source,omitempty"` - // TopicType - TopicType for the system topic. - TopicType *string `json:"topicType,omitempty"` - // MetricResourceID - READ-ONLY; Metric resource id for the system topic. - MetricResourceID *string `json:"metricResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for SystemTopicProperties. -func (stp SystemTopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stp.Source != nil { - objectMap["source"] = stp.Source - } - if stp.TopicType != nil { - objectMap["topicType"] = stp.TopicType - } - return json.Marshal(objectMap) -} - -// SystemTopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SystemTopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicsClient) (SystemTopic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicsCreateOrUpdateFuture) 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 SystemTopicsCreateOrUpdateFuture.Result. -func (future *SystemTopicsCreateOrUpdateFuture) result(client SystemTopicsClient) (st SystemTopic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - st.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicsCreateOrUpdateFuture") - 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, "eventgrid.SystemTopicsCreateOrUpdateFuture", "Result", st.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SystemTopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicsDeleteFuture) 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 SystemTopicsDeleteFuture.Result. -func (future *SystemTopicsDeleteFuture) result(client SystemTopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SystemTopicsListResult result of the List System topics operation. -type SystemTopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of system Topics. - Value *[]SystemTopic `json:"value,omitempty"` - // NextLink - A link for the next page of topics. - NextLink *string `json:"nextLink,omitempty"` -} - -// SystemTopicsListResultIterator provides access to a complete listing of SystemTopic values. -type SystemTopicsListResultIterator struct { - i int - page SystemTopicsListResultPage -} - -// 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 *SystemTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsListResultIterator.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 *SystemTopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SystemTopicsListResultIterator) 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 SystemTopicsListResultIterator) Response() SystemTopicsListResult { - 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 SystemTopicsListResultIterator) Value() SystemTopic { - if !iter.page.NotDone() { - return SystemTopic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SystemTopicsListResultIterator type. -func NewSystemTopicsListResultIterator(page SystemTopicsListResultPage) SystemTopicsListResultIterator { - return SystemTopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (stlr SystemTopicsListResult) IsEmpty() bool { - return stlr.Value == nil || len(*stlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (stlr SystemTopicsListResult) hasNextLink() bool { - return stlr.NextLink != nil && len(*stlr.NextLink) != 0 -} - -// systemTopicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (stlr SystemTopicsListResult) systemTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !stlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(stlr.NextLink))) -} - -// SystemTopicsListResultPage contains a page of SystemTopic values. -type SystemTopicsListResultPage struct { - fn func(context.Context, SystemTopicsListResult) (SystemTopicsListResult, error) - stlr SystemTopicsListResult -} - -// 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 *SystemTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsListResultPage.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.stlr) - if err != nil { - return err - } - page.stlr = 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 *SystemTopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SystemTopicsListResultPage) NotDone() bool { - return !page.stlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SystemTopicsListResultPage) Response() SystemTopicsListResult { - return page.stlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SystemTopicsListResultPage) Values() []SystemTopic { - if page.stlr.IsEmpty() { - return nil - } - return *page.stlr.Value -} - -// Creates a new instance of the SystemTopicsListResultPage type. -func NewSystemTopicsListResultPage(cur SystemTopicsListResult, getNextPage func(context.Context, SystemTopicsListResult) (SystemTopicsListResult, error)) SystemTopicsListResultPage { - return SystemTopicsListResultPage{ - fn: getNextPage, - stlr: cur, - } -} - -// SystemTopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SystemTopicsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SystemTopicsClient) (SystemTopic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SystemTopicsUpdateFuture) 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 SystemTopicsUpdateFuture.Result. -func (future *SystemTopicsUpdateFuture) result(client SystemTopicsClient) (st SystemTopic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - st.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicsUpdateFuture") - 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.UpdateResponder(st.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsUpdateFuture", "Result", st.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemTopicUpdateParameters properties of the System Topic update. -type SystemTopicUpdateParameters struct { - // Tags - Tags of the system topic. - Tags map[string]*string `json:"tags"` - // Identity - Resource identity information. - Identity *IdentityInfo `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for SystemTopicUpdateParameters. -func (stup SystemTopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stup.Tags != nil { - objectMap["tags"] = stup.Tags - } - if stup.Identity != nil { - objectMap["identity"] = stup.Identity - } - return json.Marshal(objectMap) -} - -// Topic eventGrid Topic -type Topic struct { - autorest.Response `json:"-"` - // TopicProperties - Properties of the topic. - *TopicProperties `json:"properties,omitempty"` - // Sku - The Sku pricing tier for the topic. - Sku *ResourceSku `json:"sku,omitempty"` - // Identity - Identity information for the resource. - Identity *IdentityInfo `json:"identity,omitempty"` - // Kind - Kind of the resource. Possible values include: 'Azure', 'AzureArc' - Kind ResourceKind `json:"kind,omitempty"` - // ExtendedLocation - Extended location of the resource. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TopicProperties != nil { - objectMap["properties"] = t.TopicProperties - } - if t.Sku != nil { - objectMap["sku"] = t.Sku - } - if t.Identity != nil { - objectMap["identity"] = t.Identity - } - if t.Kind != "" { - objectMap["kind"] = t.Kind - } - if t.ExtendedLocation != nil { - objectMap["extendedLocation"] = t.ExtendedLocation - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Topic struct. -func (t *Topic) 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 topicProperties TopicProperties - err = json.Unmarshal(*v, &topicProperties) - if err != nil { - return err - } - t.TopicProperties = &topicProperties - } - case "sku": - if v != nil { - var sku ResourceSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - t.Sku = &sku - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - t.Identity = &identity - } - case "kind": - if v != nil { - var kind ResourceKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - t.Kind = kind - } - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - t.ExtendedLocation = &extendedLocation - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TopicProperties properties of the Topic -type TopicProperties struct { - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' - ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - READ-ONLY; Endpoint for the topic. - Endpoint *string `json:"endpoint,omitempty"` - // InputSchema - This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventSchemaV10' - InputSchema InputSchema `json:"inputSchema,omitempty"` - // InputSchemaMapping - This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. - InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` - // MetricResourceID - READ-ONLY; Metric resource id for the topic. - MetricResourceID *string `json:"metricResourceId,omitempty"` - // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. - // You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicProperties. -func (tp TopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = tp.PrivateEndpointConnections - } - if tp.InputSchema != "" { - objectMap["inputSchema"] = tp.InputSchema - } - objectMap["inputSchemaMapping"] = tp.InputSchemaMapping - if tp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = tp.PublicNetworkAccess - } - if tp.InboundIPRules != nil { - objectMap["inboundIpRules"] = tp.InboundIPRules - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicProperties struct. -func (tp *TopicProperties) 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 "privateEndpointConnections": - if v != nil { - var privateEndpointConnections []PrivateEndpointConnection - err = json.Unmarshal(*v, &privateEndpointConnections) - if err != nil { - return err - } - tp.PrivateEndpointConnections = &privateEndpointConnections - } - case "provisioningState": - if v != nil { - var provisioningState TopicProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "endpoint": - if v != nil { - var endpoint string - err = json.Unmarshal(*v, &endpoint) - if err != nil { - return err - } - tp.Endpoint = &endpoint - } - case "inputSchema": - if v != nil { - var inputSchema InputSchema - err = json.Unmarshal(*v, &inputSchema) - if err != nil { - return err - } - tp.InputSchema = inputSchema - } - case "inputSchemaMapping": - if v != nil { - inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) - if err != nil { - return err - } - tp.InputSchemaMapping = inputSchemaMapping - } - case "metricResourceId": - if v != nil { - var metricResourceID string - err = json.Unmarshal(*v, &metricResourceID) - if err != nil { - return err - } - tp.MetricResourceID = &metricResourceID - } - case "publicNetworkAccess": - if v != nil { - var publicNetworkAccess PublicNetworkAccess - err = json.Unmarshal(*v, &publicNetworkAccess) - if err != nil { - return err - } - tp.PublicNetworkAccess = publicNetworkAccess - } - case "inboundIpRules": - if v != nil { - var inboundIPRules []InboundIPRule - err = json.Unmarshal(*v, &inboundIPRules) - if err != nil { - return err - } - tp.InboundIPRules = &inboundIPRules - } - } - } - - return nil -} - -// TopicRegenerateKeyRequest topic regenerate share access key request -type TopicRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsCreateOrUpdateFuture) 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 TopicsCreateOrUpdateFuture.Result. -func (future *TopicsCreateOrUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateOrUpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsDeleteFuture) 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 TopicsDeleteFuture.Result. -func (future *TopicsDeleteFuture) result(client TopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TopicSharedAccessKeys shared access keys of the Topic -type TopicSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the topic. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the topic. - Key2 *string `json:"key2,omitempty"` -} - -// TopicsListResult result of the List Topics operation -type TopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Topics - Value *[]Topic `json:"value,omitempty"` - // NextLink - A link for the next page of topics - NextLink *string `json:"nextLink,omitempty"` -} - -// TopicsListResultIterator provides access to a complete listing of Topic values. -type TopicsListResultIterator struct { - i int - page TopicsListResultPage -} - -// 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 *TopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultIterator.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 *TopicsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TopicsListResultIterator) 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 TopicsListResultIterator) Response() TopicsListResult { - 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 TopicsListResultIterator) Value() Topic { - if !iter.page.NotDone() { - return Topic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TopicsListResultIterator type. -func NewTopicsListResultIterator(page TopicsListResultPage) TopicsListResultIterator { - return TopicsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tlr TopicsListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tlr TopicsListResult) hasNextLink() bool { - return tlr.NextLink != nil && len(*tlr.NextLink) != 0 -} - -// topicsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tlr TopicsListResult) topicsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) -} - -// TopicsListResultPage contains a page of Topic values. -type TopicsListResultPage struct { - fn func(context.Context, TopicsListResult) (TopicsListResult, error) - tlr TopicsListResult -} - -// 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 *TopicsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultPage.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.tlr) - if err != nil { - return err - } - page.tlr = 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 *TopicsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TopicsListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TopicsListResultPage) Response() TopicsListResult { - return page.tlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TopicsListResultPage) Values() []Topic { - if page.tlr.IsEmpty() { - return nil - } - return *page.tlr.Value -} - -// Creates a new instance of the TopicsListResultPage type. -func NewTopicsListResultPage(cur TopicsListResult, getNextPage func(context.Context, TopicsListResult) (TopicsListResult, error)) TopicsListResultPage { - return TopicsListResultPage{ - fn: getNextPage, - tlr: cur, - } -} - -// TopicsRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsRegenerateKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (TopicSharedAccessKeys, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsRegenerateKeyFuture) 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 TopicsRegenerateKeyFuture.Result. -func (future *TopicsRegenerateKeyFuture) result(client TopicsClient) (tsak TopicSharedAccessKeys, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsRegenerateKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tsak.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsRegenerateKeyFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tsak.Response.Response, err = future.GetResult(sender); err == nil && tsak.Response.Response.StatusCode != http.StatusNoContent { - tsak, err = client.RegenerateKeyResponder(tsak.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsRegenerateKeyFuture", "Result", tsak.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TopicsClient) (Topic, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TopicsUpdateFuture) 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 TopicsUpdateFuture.Result. -func (future *TopicsUpdateFuture) result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - t.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicTypeInfo properties of a topic type info. -type TopicTypeInfo struct { - autorest.Response `json:"-"` - // TopicTypeProperties - Properties of the topic type info - *TopicTypeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicTypeInfo. -func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tti.TopicTypeProperties != nil { - objectMap["properties"] = tti.TopicTypeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. -func (tti *TopicTypeInfo) 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 topicTypeProperties TopicTypeProperties - err = json.Unmarshal(*v, &topicTypeProperties) - if err != nil { - return err - } - tti.TopicTypeProperties = &topicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tti.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tti.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tti.Type = &typeVar - } - } - } - - return nil -} - -// TopicTypeProperties properties of a topic type. -type TopicTypeProperties struct { - // Provider - Namespace of the provider of the topic type. - Provider *string `json:"provider,omitempty"` - // DisplayName - Display Name for the topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the topic type. - Description *string `json:"description,omitempty"` - // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' - ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` - // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' - ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` - // SupportedLocations - List of locations supported by this topic type. - SupportedLocations *[]string `json:"supportedLocations,omitempty"` - // SourceResourceFormat - Source resource format. - SourceResourceFormat *string `json:"sourceResourceFormat,omitempty"` - // SupportedScopesForSource - Supported source scopes. - SupportedScopesForSource *[]string `json:"supportedScopesForSource,omitempty"` -} - -// TopicTypesListResult result of the List Topic Types operation -type TopicTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of topic types - Value *[]TopicTypeInfo `json:"value,omitempty"` -} - -// TopicUpdateParameterProperties information of topic update parameter properties. -type TopicUpdateParameterProperties struct { - // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. - // You can further restrict to specific IPs by configuring . Possible values include: 'Enabled', 'Disabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` -} - -// TopicUpdateParameters properties of the Topic update -type TopicUpdateParameters struct { - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // Identity - Resource identity information. - Identity *IdentityInfo `json:"identity,omitempty"` - // TopicUpdateParameterProperties - Properties of the resource. - *TopicUpdateParameterProperties `json:"properties,omitempty"` - // Sku - The Sku pricing tier for the topic. - Sku *ResourceSku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicUpdateParameters. -func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - if tup.Identity != nil { - objectMap["identity"] = tup.Identity - } - if tup.TopicUpdateParameterProperties != nil { - objectMap["properties"] = tup.TopicUpdateParameterProperties - } - if tup.Sku != nil { - objectMap["sku"] = tup.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicUpdateParameters struct. -func (tup *TopicUpdateParameters) 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 - } - tup.Tags = tags - } - case "identity": - if v != nil { - var identity IdentityInfo - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tup.Identity = &identity - } - case "properties": - if v != nil { - var topicUpdateParameterProperties TopicUpdateParameterProperties - err = json.Unmarshal(*v, &topicUpdateParameterProperties) - if err != nil { - return err - } - tup.TopicUpdateParameterProperties = &topicUpdateParameterProperties - } - case "sku": - if v != nil { - var sku ResourceSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - tup.Sku = &sku - } - } - } - - return nil -} - -// TrackedResource definition of a Tracked Resource. -type TrackedResource struct { - // Location - Location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource. - 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.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// UserIdentityProperties the information about the user identity. -type UserIdentityProperties struct { - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription. -type WebHookEventSubscriptionDestination struct { - // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination. - *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - whesd.EndpointType = EndpointTypeWebHook - objectMap := make(map[string]interface{}) - if whesd.WebHookEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties - } - if whesd.EndpointType != "" { - objectMap["endpointType"] = whesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return &whesd, true -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { - return nil, false -} - -// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { - return nil, false -} - -// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &whesd, true -} - -// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. -func (whesd *WebHookEventSubscriptionDestination) 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 webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) - if err != nil { - return err - } - whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - whesd.EndpointType = endpointType - } - } - } - - return nil -} - -// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for -// an event subscription. -type WebHookEventSubscriptionDestinationProperties struct { - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` - // EndpointBaseURL - READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. - EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` - // MaxEventsPerBatch - Maximum number of events per batch. - MaxEventsPerBatch *int32 `json:"maxEventsPerBatch,omitempty"` - // PreferredBatchSizeInKilobytes - Preferred batch size in Kilobytes. - PreferredBatchSizeInKilobytes *int32 `json:"preferredBatchSizeInKilobytes,omitempty"` - // AzureActiveDirectoryTenantID - The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. - AzureActiveDirectoryTenantID *string `json:"azureActiveDirectoryTenantId,omitempty"` - // AzureActiveDirectoryApplicationIDOrURI - The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery requests. - AzureActiveDirectoryApplicationIDOrURI *string `json:"azureActiveDirectoryApplicationIdOrUri,omitempty"` - // DeliveryAttributeMappings - Delivery attribute details. - DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestinationProperties. -func (whesdp WebHookEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if whesdp.EndpointURL != nil { - objectMap["endpointUrl"] = whesdp.EndpointURL - } - if whesdp.MaxEventsPerBatch != nil { - objectMap["maxEventsPerBatch"] = whesdp.MaxEventsPerBatch - } - if whesdp.PreferredBatchSizeInKilobytes != nil { - objectMap["preferredBatchSizeInKilobytes"] = whesdp.PreferredBatchSizeInKilobytes - } - if whesdp.AzureActiveDirectoryTenantID != nil { - objectMap["azureActiveDirectoryTenantId"] = whesdp.AzureActiveDirectoryTenantID - } - if whesdp.AzureActiveDirectoryApplicationIDOrURI != nil { - objectMap["azureActiveDirectoryApplicationIdOrUri"] = whesdp.AzureActiveDirectoryApplicationIDOrURI - } - if whesdp.DeliveryAttributeMappings != nil { - objectMap["deliveryAttributeMappings"] = whesdp.DeliveryAttributeMappings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestinationProperties struct. -func (whesdp *WebHookEventSubscriptionDestinationProperties) 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 "endpointUrl": - if v != nil { - var endpointURL string - err = json.Unmarshal(*v, &endpointURL) - if err != nil { - return err - } - whesdp.EndpointURL = &endpointURL - } - case "endpointBaseUrl": - if v != nil { - var endpointBaseURL string - err = json.Unmarshal(*v, &endpointBaseURL) - if err != nil { - return err - } - whesdp.EndpointBaseURL = &endpointBaseURL - } - case "maxEventsPerBatch": - if v != nil { - var maxEventsPerBatch int32 - err = json.Unmarshal(*v, &maxEventsPerBatch) - if err != nil { - return err - } - whesdp.MaxEventsPerBatch = &maxEventsPerBatch - } - case "preferredBatchSizeInKilobytes": - if v != nil { - var preferredBatchSizeInKilobytes int32 - err = json.Unmarshal(*v, &preferredBatchSizeInKilobytes) - if err != nil { - return err - } - whesdp.PreferredBatchSizeInKilobytes = &preferredBatchSizeInKilobytes - } - case "azureActiveDirectoryTenantId": - if v != nil { - var azureActiveDirectoryTenantID string - err = json.Unmarshal(*v, &azureActiveDirectoryTenantID) - if err != nil { - return err - } - whesdp.AzureActiveDirectoryTenantID = &azureActiveDirectoryTenantID - } - case "azureActiveDirectoryApplicationIdOrUri": - if v != nil { - var azureActiveDirectoryApplicationIDOrURI string - err = json.Unmarshal(*v, &azureActiveDirectoryApplicationIDOrURI) - if err != nil { - return err - } - whesdp.AzureActiveDirectoryApplicationIDOrURI = &azureActiveDirectoryApplicationIDOrURI - } - case "deliveryAttributeMappings": - if v != nil { - deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) - if err != nil { - return err - } - whesdp.DeliveryAttributeMappings = &deliveryAttributeMappings - } - } - } - - return nil -} diff --git a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/operations.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/operations.go deleted file mode 100644 index bb954bf1dc12..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 azure EventGrid 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 list the available operations supported by the Microsoft.EventGrid resource provider. -func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/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 -} diff --git a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnernamespaces.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnernamespaces.go deleted file mode 100644 index 919069fd6d7f..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnernamespaces.go +++ /dev/null @@ -1,771 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartnerNamespacesClient is the azure EventGrid Management Client -type PartnerNamespacesClient struct { - BaseClient -} - -// NewPartnerNamespacesClient creates an instance of the PartnerNamespacesClient client. -func NewPartnerNamespacesClient(subscriptionID string) PartnerNamespacesClient { - return NewPartnerNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartnerNamespacesClientWithBaseURI creates an instance of the PartnerNamespacesClient 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 NewPartnerNamespacesClientWithBaseURI(baseURI string, subscriptionID string) PartnerNamespacesClient { - return PartnerNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new partner namespace with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// partnerNamespaceInfo - partnerNamespace information. -func (client PartnerNamespacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace) (result PartnerNamespacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PartnerNamespacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - partnerNamespaceInfo.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.EventGrid/partnerNamespaces/{partnerNamespaceName}", pathParameters), - autorest.WithJSON(partnerNamespaceInfo), - 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 PartnerNamespacesClient) CreateOrUpdateSender(req *http.Request) (future PartnerNamespacesCreateOrUpdateFuture, 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 PartnerNamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result PartnerNamespace, 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 existing partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -func (client PartnerNamespacesClient) Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result PartnerNamespacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerNamespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PartnerNamespacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerNamespaces/{partnerNamespaceName}", 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 PartnerNamespacesClient) DeleteSender(req *http.Request) (future PartnerNamespacesDeleteFuture, 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 PartnerNamespacesClient) 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 get properties of a partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -func (client PartnerNamespacesClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result PartnerNamespace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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, partnerNamespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PartnerNamespacesClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerNamespaces/{partnerNamespaceName}", 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) GetResponder(resp *http.Response) (result PartnerNamespace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the partner namespaces under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerNamespacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerNamespacesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.pnlr.Response.Response != nil { - sc = result.pnlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.pnlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.pnlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.pnlr.hasNextLink() && result.pnlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PartnerNamespacesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces", 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerNamespacesListResult, 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 PartnerNamespacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults PartnerNamespacesListResult) (result PartnerNamespacesListResult, err error) { - req, err := lastResults.partnerNamespacesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "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, "eventgrid.PartnerNamespacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerNamespacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerNamespacesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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, filter, top) - return -} - -// ListBySubscription list all the partner namespaces under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerNamespacesClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerNamespacesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.ListBySubscription") - defer func() { - sc := -1 - if result.pnlr.Response.Response != nil { - sc = result.pnlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.pnlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.pnlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.pnlr.hasNextLink() && result.pnlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client PartnerNamespacesClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces", 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerNamespacesListResult, 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 PartnerNamespacesClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerNamespacesListResult) (result PartnerNamespacesListResult, err error) { - req, err := lastResults.partnerNamespacesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "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, "eventgrid.PartnerNamespacesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerNamespacesClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerNamespacesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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, filter, top) - return -} - -// ListSharedAccessKeys list the two keys used to publish to a partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -func (client PartnerNamespacesClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result PartnerNamespaceSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, partnerNamespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client PartnerNamespacesClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerNamespaces/{partnerNamespaceName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client PartnerNamespacesClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client PartnerNamespacesClient) ListSharedAccessKeysResponder(resp *http.Response) (result PartnerNamespaceSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a partner namespace. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// regenerateKeyRequest - request body to regenerate key. -func (client PartnerNamespacesClient) RegenerateKey(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest PartnerNamespaceRegenerateKeyRequest) (result PartnerNamespaceSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.PartnerNamespacesClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, partnerNamespaceName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client PartnerNamespacesClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest PartnerNamespaceRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerNamespaces/{partnerNamespaceName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) RegenerateKeyResponder(resp *http.Response) (result PartnerNamespaceSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update asynchronously updates a partner namespace with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerNamespaceName - name of the partner namespace. -// partnerNamespaceUpdateParameters - partner namespace update information. -func (client PartnerNamespacesClient) Update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters) (result PartnerNamespacesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PartnerNamespacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerNamespaces/{partnerNamespaceName}", pathParameters), - autorest.WithJSON(partnerNamespaceUpdateParameters), - 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 PartnerNamespacesClient) UpdateSender(req *http.Request) (future PartnerNamespacesUpdateFuture, 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 PartnerNamespacesClient) UpdateResponder(resp *http.Response) (result PartnerNamespace, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnerregistrations.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnerregistrations.go deleted file mode 100644 index e3e09f052e05..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnerregistrations.go +++ /dev/null @@ -1,667 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartnerRegistrationsClient is the azure EventGrid Management Client -type PartnerRegistrationsClient struct { - BaseClient -} - -// NewPartnerRegistrationsClient creates an instance of the PartnerRegistrationsClient client. -func NewPartnerRegistrationsClient(subscriptionID string) PartnerRegistrationsClient { - return NewPartnerRegistrationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartnerRegistrationsClientWithBaseURI creates an instance of the PartnerRegistrationsClient 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 NewPartnerRegistrationsClientWithBaseURI(baseURI string, subscriptionID string) PartnerRegistrationsClient { - return PartnerRegistrationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new partner registration with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerRegistrationName - name of the partner registration. -// partnerRegistrationInfo - partnerRegistration information. -func (client PartnerRegistrationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration) (result PartnerRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, partnerRegistrationName, partnerRegistrationInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PartnerRegistrationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - partnerRegistrationInfo.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.EventGrid/partnerRegistrations/{partnerRegistrationName}", pathParameters), - autorest.WithJSON(partnerRegistrationInfo), - 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) CreateOrUpdateResponder(resp *http.Response) (result PartnerRegistration, 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 a partner registration with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerRegistrationName - name of the partner registration. -func (client PartnerRegistrationsClient) Delete(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerRegistrationName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PartnerRegistrationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerRegistrations/{partnerRegistrationName}", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) 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 a partner registration with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerRegistrationName - name of the partner registration. -func (client PartnerRegistrationsClient) Get(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result PartnerRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, partnerRegistrationName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PartnerRegistrationsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerRegistrations/{partnerRegistrationName}", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) GetResponder(resp *http.Response) (result PartnerRegistration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all partners registrations. -func (client PartnerRegistrationsClient) List(ctx context.Context) (result PartnerRegistrationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PartnerRegistrationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/partnerRegistrations"), - 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) ListResponder(resp *http.Response) (result PartnerRegistrationsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the partner registrations under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerRegistrationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerRegistrationsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.prlr.Response.Response != nil { - sc = result.prlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.prlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.prlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.prlr.hasNextLink() && result.prlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PartnerRegistrationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerRegistrationsListResult, 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 PartnerRegistrationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PartnerRegistrationsListResult) (result PartnerRegistrationsListResult, err error) { - req, err := lastResults.partnerRegistrationsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "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, "eventgrid.PartnerRegistrationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerRegistrationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerRegistrationsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, filter, top) - return -} - -// ListBySubscription list all the partner registrations under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerRegistrationsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerRegistrationsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.ListBySubscription") - defer func() { - sc := -1 - if result.prlr.Response.Response != nil { - sc = result.prlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.prlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.prlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.prlr.hasNextLink() && result.prlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client PartnerRegistrationsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerRegistrationsListResult, 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 PartnerRegistrationsClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerRegistrationsListResult) (result PartnerRegistrationsListResult, err error) { - req, err := lastResults.partnerRegistrationsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "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, "eventgrid.PartnerRegistrationsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerRegistrationsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerRegistrationsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, filter, top) - return -} - -// Update updates a partner registration with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerRegistrationName - name of the partner registration. -// partnerRegistrationUpdateParameters - partner registration update information. -func (client PartnerRegistrationsClient) Update(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters) (result PartnerRegistration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, partnerRegistrationName, partnerRegistrationUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PartnerRegistrationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerRegistrations/{partnerRegistrationName}", pathParameters), - autorest.WithJSON(partnerRegistrationUpdateParameters), - 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) UpdateResponder(resp *http.Response) (result PartnerRegistration, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnertopiceventsubscriptions.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnertopiceventsubscriptions.go deleted file mode 100644 index 591c4130a3f9..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnertopiceventsubscriptions.go +++ /dev/null @@ -1,654 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartnerTopicEventSubscriptionsClient is the azure EventGrid Management Client -type PartnerTopicEventSubscriptionsClient struct { - BaseClient -} - -// NewPartnerTopicEventSubscriptionsClient creates an instance of the PartnerTopicEventSubscriptionsClient client. -func NewPartnerTopicEventSubscriptionsClient(subscriptionID string) PartnerTopicEventSubscriptionsClient { - return NewPartnerTopicEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartnerTopicEventSubscriptionsClientWithBaseURI creates an instance of the PartnerTopicEventSubscriptionsClient -// 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 NewPartnerTopicEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) PartnerTopicEventSubscriptionsClient { - return PartnerTopicEventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates an event subscription of a partner topic with the specified -// parameters. Existing event subscriptions will be updated with this API. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information. -func (client PartnerTopicEventSubscriptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result PartnerTopicEventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PartnerTopicEventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - eventSubscriptionInfo.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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 PartnerTopicEventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future PartnerTopicEventSubscriptionsCreateOrUpdateFuture, 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 PartnerTopicEventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an event subscription of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client PartnerTopicEventSubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result PartnerTopicEventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PartnerTopicEventSubscriptionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 PartnerTopicEventSubscriptionsClient) DeleteSender(req *http.Request) (future PartnerTopicEventSubscriptionsDeleteFuture, 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 PartnerTopicEventSubscriptionsClient) 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 get an event subscription of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be found. Event subscription names must be between -// 3 and 100 characters in length and use alphanumeric letters only. -func (client PartnerTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.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, partnerTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PartnerTopicEventSubscriptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 PartnerTopicEventSubscriptionsClient) 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 PartnerTopicEventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeliveryAttributes get all delivery attributes for an event subscription of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client PartnerTopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result DeliveryAttributeListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.GetDeliveryAttributes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDeliveryAttributesPreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetDeliveryAttributes", nil, "Failure preparing request") - return - } - - resp, err := client.GetDeliveryAttributesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure sending request") - return - } - - result, err = client.GetDeliveryAttributesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure responding to request") - return - } - - return -} - -// GetDeliveryAttributesPreparer prepares the GetDeliveryAttributes request. -func (client PartnerTopicEventSubscriptionsClient) GetDeliveryAttributesPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDeliveryAttributesSender sends the GetDeliveryAttributes request. The method will close the -// http.Response Body if it receives an error. -func (client PartnerTopicEventSubscriptionsClient) GetDeliveryAttributesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDeliveryAttributesResponder handles the response to the GetDeliveryAttributes request. The method always -// closes the http.Response Body. -func (client PartnerTopicEventSubscriptionsClient) GetDeliveryAttributesResponder(resp *http.Response) (result DeliveryAttributeListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client PartnerTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client PartnerTopicEventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client PartnerTopicEventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client PartnerTopicEventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByPartnerTopic list event subscriptions that belong to a specific partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopic(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.ListByPartnerTopic") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByPartnerTopicNextResults - req, err := client.ListByPartnerTopicPreparer(ctx, resourceGroupName, partnerTopicName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "ListByPartnerTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPartnerTopicSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "ListByPartnerTopic", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListByPartnerTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "ListByPartnerTopic", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPartnerTopicPreparer prepares the ListByPartnerTopic request. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPartnerTopicSender sends the ListByPartnerTopic request. The method will close the -// http.Response Body if it receives an error. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPartnerTopicResponder handles the response to the ListByPartnerTopic request. The method always -// closes the http.Response Body. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPartnerTopicNextResults retrieves the next set of results, if any. -func (client PartnerTopicEventSubscriptionsClient) listByPartnerTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "listByPartnerTopicNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPartnerTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "listByPartnerTopicNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPartnerTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "listByPartnerTopicNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPartnerTopicComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicComplete(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.ListByPartnerTopic") - 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.ListByPartnerTopic(ctx, resourceGroupName, partnerTopicName, filter, top) - return -} - -// Update update event subscription of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -// eventSubscriptionUpdateParameters - updated event subscription information. -func (client PartnerTopicEventSubscriptionsClient) Update(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result PartnerTopicEventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PartnerTopicEventSubscriptionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 PartnerTopicEventSubscriptionsClient) UpdateSender(req *http.Request) (future PartnerTopicEventSubscriptionsUpdateFuture, 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 PartnerTopicEventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnertopics.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnertopics.go deleted file mode 100644 index 92c41397631c..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/partnertopics.go +++ /dev/null @@ -1,674 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PartnerTopicsClient is the azure EventGrid Management Client -type PartnerTopicsClient struct { - BaseClient -} - -// NewPartnerTopicsClient creates an instance of the PartnerTopicsClient client. -func NewPartnerTopicsClient(subscriptionID string) PartnerTopicsClient { - return NewPartnerTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartnerTopicsClientWithBaseURI creates an instance of the PartnerTopicsClient 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 NewPartnerTopicsClientWithBaseURI(baseURI string, subscriptionID string) PartnerTopicsClient { - return PartnerTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Activate activate a newly created partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -func (client PartnerTopicsClient) Activate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Activate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ActivatePreparer(ctx, resourceGroupName, partnerTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Activate", nil, "Failure preparing request") - return - } - - resp, err := client.ActivateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Activate", resp, "Failure sending request") - return - } - - result, err = client.ActivateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Activate", resp, "Failure responding to request") - return - } - - return -} - -// ActivatePreparer prepares the Activate request. -func (client PartnerTopicsClient) ActivatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}/activate", pathParameters), - 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 PartnerTopicsClient) 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 PartnerTopicsClient) ActivateResponder(resp *http.Response) (result PartnerTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Deactivate deactivate specific partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -func (client PartnerTopicsClient) Deactivate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Deactivate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeactivatePreparer(ctx, resourceGroupName, partnerTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Deactivate", nil, "Failure preparing request") - return - } - - resp, err := client.DeactivateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Deactivate", resp, "Failure sending request") - return - } - - result, err = client.DeactivateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Deactivate", resp, "Failure responding to request") - return - } - - return -} - -// DeactivatePreparer prepares the Deactivate request. -func (client PartnerTopicsClient) DeactivatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}/deactivate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeactivateSender sends the Deactivate request. The method will close the -// http.Response Body if it receives an error. -func (client PartnerTopicsClient) DeactivateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeactivateResponder handles the response to the Deactivate request. The method always -// closes the http.Response Body. -func (client PartnerTopicsClient) DeactivateResponder(resp *http.Response) (result PartnerTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete existing partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -func (client PartnerTopicsClient) Delete(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, partnerTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PartnerTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}", 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 PartnerTopicsClient) DeleteSender(req *http.Request) (future PartnerTopicsDeleteFuture, 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 PartnerTopicsClient) 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 get properties of a partner topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -func (client PartnerTopicsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, partnerTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PartnerTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}", 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 PartnerTopicsClient) 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 PartnerTopicsClient) GetResponder(resp *http.Response) (result PartnerTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the partner topics under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerTopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.ptlr.Response.Response != nil { - sc = result.ptlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.ptlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.ptlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.ptlr.hasNextLink() && result.ptlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PartnerTopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics", 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 PartnerTopicsClient) 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 PartnerTopicsClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerTopicsListResult, 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 PartnerTopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PartnerTopicsListResult) (result PartnerTopicsListResult, err error) { - req, err := lastResults.partnerTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "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, "eventgrid.PartnerTopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerTopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, filter, top) - return -} - -// ListBySubscription list all the partner topics under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PartnerTopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.ptlr.Response.Response != nil { - sc = result.ptlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.ptlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.ptlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.ptlr.hasNextLink() && result.ptlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client PartnerTopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics", 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 PartnerTopicsClient) 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 PartnerTopicsClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerTopicsListResult, 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 PartnerTopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerTopicsListResult) (result PartnerTopicsListResult, err error) { - req, err := lastResults.partnerTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "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, "eventgrid.PartnerTopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PartnerTopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, filter, top) - return -} - -// Update asynchronously updates a partner topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// partnerTopicName - name of the partner topic. -// partnerTopicUpdateParameters - partnerTopic update information. -func (client PartnerTopicsClient) Update(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters PartnerTopicUpdateParameters) (result PartnerTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, partnerTopicName, partnerTopicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PartnerTopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters PartnerTopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "partnerTopicName": autorest.Encode("path", partnerTopicName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/partnerTopics/{partnerTopicName}", pathParameters), - autorest.WithJSON(partnerTopicUpdateParameters), - 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 PartnerTopicsClient) 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 PartnerTopicsClient) UpdateResponder(resp *http.Response) (result PartnerTopic, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/privateendpointconnections.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/privateendpointconnections.go deleted file mode 100644 index 6cbad0e16cc5..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/privateendpointconnections.go +++ /dev/null @@ -1,414 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the azure EventGrid Management Client -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete a specific private endpoint connection under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// privateEndpointConnectionName - the name of the private endpoint connection connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 get a specific private endpoint connection under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// privateEndpointConnectionName - the name of the private endpoint connection connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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, parentType, parentName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/{parentType}/{parentName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByResource get all private endpoint connections under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PrivateEndpointConnectionsClient) ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByResource") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, parentType, parentName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "ListByResource", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client PrivateEndpointConnectionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByResourceResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByResourceNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByResource") - 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.ListByResource(ctx, resourceGroupName, parentType, parentName, filter, top) - return -} - -// Update update a specific private endpoint connection under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// privateEndpointConnectionName - the name of the private endpoint connection connection. -// privateEndpointConnection - the private endpoint connection object to update. -func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, privateEndpointConnection) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(privateEndpointConnection), - 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 PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionsUpdateFuture, 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 PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/privatelinkresources.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/privatelinkresources.go deleted file mode 100644 index a440a34c60e3..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/privatelinkresources.go +++ /dev/null @@ -1,246 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the azure EventGrid Management Client -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get properties of a private link resource. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// privateLinkResourceName - the name of private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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, parentType, parentName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-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.EventGrid/{parentType}/{parentName}/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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByResource list all the private link resources under a topic or domain. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// parentType - the type of the parent resource. This can be either \'topics\' or \'domains\'. -// parentName - the name of the parent resource (namely, either, the topic name or domain name). -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client PrivateLinkResourcesClient) ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateLinkResourcesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByResource") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceGroupName, parentType, parentName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "ListByResource", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client PrivateLinkResourcesClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentName": autorest.Encode("path", parentName), - "parentType": autorest.Encode("path", parentType), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByResourceResponder(resp *http.Response) (result PrivateLinkResourcesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByResourceNextResults(ctx context.Context, lastResults PrivateLinkResourcesListResult) (result PrivateLinkResourcesListResult, err error) { - req, err := lastResults.privateLinkResourcesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateLinkResourcesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByResource") - 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.ListByResource(ctx, resourceGroupName, parentType, parentName, filter, top) - return -} diff --git a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/systemtopiceventsubscriptions.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/systemtopiceventsubscriptions.go deleted file mode 100644 index ff45cf35968e..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/systemtopiceventsubscriptions.go +++ /dev/null @@ -1,654 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SystemTopicEventSubscriptionsClient is the azure EventGrid Management Client -type SystemTopicEventSubscriptionsClient struct { - BaseClient -} - -// NewSystemTopicEventSubscriptionsClient creates an instance of the SystemTopicEventSubscriptionsClient client. -func NewSystemTopicEventSubscriptionsClient(subscriptionID string) SystemTopicEventSubscriptionsClient { - return NewSystemTopicEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSystemTopicEventSubscriptionsClientWithBaseURI creates an instance of the SystemTopicEventSubscriptionsClient -// 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 NewSystemTopicEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicEventSubscriptionsClient { - return SystemTopicEventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates or updates an event subscription with the specified parameters. Existing event -// subscriptions will be updated with this API. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -// eventSubscriptionInfo - event subscription properties containing the destination and filter information. -func (client SystemTopicEventSubscriptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result SystemTopicEventSubscriptionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, eventSubscriptionInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SystemTopicEventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - eventSubscriptionInfo.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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionInfo), - 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 SystemTopicEventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future SystemTopicEventSubscriptionsCreateOrUpdateFuture, 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 SystemTopicEventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 an event subscription of a system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client SystemTopicEventSubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result SystemTopicEventSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SystemTopicEventSubscriptionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 SystemTopicEventSubscriptionsClient) DeleteSender(req *http.Request) (future SystemTopicEventSubscriptionsDeleteFuture, 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 SystemTopicEventSubscriptionsClient) 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 get an event subscription. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client SystemTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result EventSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.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, systemTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SystemTopicEventSubscriptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 SystemTopicEventSubscriptionsClient) 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 SystemTopicEventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeliveryAttributes get all delivery attributes for an event subscription. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client SystemTopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result DeliveryAttributeListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.GetDeliveryAttributes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDeliveryAttributesPreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetDeliveryAttributes", nil, "Failure preparing request") - return - } - - resp, err := client.GetDeliveryAttributesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure sending request") - return - } - - result, err = client.GetDeliveryAttributesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure responding to request") - return - } - - return -} - -// GetDeliveryAttributesPreparer prepares the GetDeliveryAttributes request. -func (client SystemTopicEventSubscriptionsClient) GetDeliveryAttributesPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDeliveryAttributesSender sends the GetDeliveryAttributes request. The method will close the -// http.Response Body if it receives an error. -func (client SystemTopicEventSubscriptionsClient) GetDeliveryAttributesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDeliveryAttributesResponder handles the response to the GetDeliveryAttributes request. The method always -// closes the http.Response Body. -func (client SystemTopicEventSubscriptionsClient) GetDeliveryAttributesResponder(resp *http.Response) (result DeliveryAttributeListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFullURL get the full endpoint URL for an event subscription of a system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -func (client SystemTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.GetFullURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetFullURLPreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetFullURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") - return - } - - result, err = client.GetFullURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") - return - } - - return -} - -// GetFullURLPreparer prepares the GetFullURL request. -func (client SystemTopicEventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetFullURLSender sends the GetFullURL request. The method will close the -// http.Response Body if it receives an error. -func (client SystemTopicEventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetFullURLResponder handles the response to the GetFullURL request. The method always -// closes the http.Response Body. -func (client SystemTopicEventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySystemTopic list event subscriptions that belong to a specific system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopic(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.ListBySystemTopic") - defer func() { - sc := -1 - if result.eslr.Response.Response != nil { - sc = result.eslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySystemTopicNextResults - req, err := client.ListBySystemTopicPreparer(ctx, resourceGroupName, systemTopicName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "ListBySystemTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySystemTopicSender(req) - if err != nil { - result.eslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "ListBySystemTopic", resp, "Failure sending request") - return - } - - result.eslr, err = client.ListBySystemTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "ListBySystemTopic", resp, "Failure responding to request") - return - } - if result.eslr.hasNextLink() && result.eslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySystemTopicPreparer prepares the ListBySystemTopic request. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySystemTopicSender sends the ListBySystemTopic request. The method will close the -// http.Response Body if it receives an error. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySystemTopicResponder handles the response to the ListBySystemTopic request. The method always -// closes the http.Response Body. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySystemTopicNextResults retrieves the next set of results, if any. -func (client SystemTopicEventSubscriptionsClient) listBySystemTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { - req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "listBySystemTopicNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySystemTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "listBySystemTopicNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySystemTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "listBySystemTopicNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySystemTopicComplete enumerates all values, automatically crossing page boundaries as required. -func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicComplete(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.ListBySystemTopic") - 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.ListBySystemTopic(ctx, resourceGroupName, systemTopicName, filter, top) - return -} - -// Update update event subscription of a system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be -// between 3 and 100 characters in length and use alphanumeric letters only. -// eventSubscriptionUpdateParameters - updated event subscription information. -func (client SystemTopicEventSubscriptionsClient) Update(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result SystemTopicEventSubscriptionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SystemTopicEventSubscriptionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), - autorest.WithJSON(eventSubscriptionUpdateParameters), - 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 SystemTopicEventSubscriptionsClient) UpdateSender(req *http.Request) (future SystemTopicEventSubscriptionsUpdateFuture, 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 SystemTopicEventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/systemtopics.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/systemtopics.go deleted file mode 100644 index 4bb6ca86ff31..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/systemtopics.go +++ /dev/null @@ -1,608 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SystemTopicsClient is the azure EventGrid Management Client -type SystemTopicsClient struct { - BaseClient -} - -// NewSystemTopicsClient creates an instance of the SystemTopicsClient client. -func NewSystemTopicsClient(subscriptionID string) SystemTopicsClient { - return NewSystemTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSystemTopicsClientWithBaseURI creates an instance of the SystemTopicsClient 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 NewSystemTopicsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicsClient { - return SystemTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new system topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// systemTopicInfo - system Topic information. -func (client SystemTopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo SystemTopic) (result SystemTopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, systemTopicName, systemTopicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SystemTopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo SystemTopic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - systemTopicInfo.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.EventGrid/systemTopics/{systemTopicName}", pathParameters), - autorest.WithJSON(systemTopicInfo), - 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 SystemTopicsClient) CreateOrUpdateSender(req *http.Request) (future SystemTopicsCreateOrUpdateFuture, 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 SystemTopicsClient) CreateOrUpdateResponder(resp *http.Response) (result SystemTopic, 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 existing system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -func (client SystemTopicsClient) Delete(ctx context.Context, resourceGroupName string, systemTopicName string) (result SystemTopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, systemTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SystemTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, systemTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/systemTopics/{systemTopicName}", 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 SystemTopicsClient) DeleteSender(req *http.Request) (future SystemTopicsDeleteFuture, 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 SystemTopicsClient) 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 get properties of a system topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -func (client SystemTopicsClient) Get(ctx context.Context, resourceGroupName string, systemTopicName string) (result SystemTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.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, systemTopicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SystemTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, systemTopicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/systemTopics/{systemTopicName}", 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 SystemTopicsClient) 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 SystemTopicsClient) GetResponder(resp *http.Response) (result SystemTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the system topics under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client SystemTopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result SystemTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.stlr.Response.Response != nil { - sc = result.stlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.stlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.stlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.stlr.hasNextLink() && result.stlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client SystemTopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics", 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 SystemTopicsClient) 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 SystemTopicsClient) ListByResourceGroupResponder(resp *http.Response) (result SystemTopicsListResult, 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 SystemTopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SystemTopicsListResult) (result SystemTopicsListResult, err error) { - req, err := lastResults.systemTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "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, "eventgrid.SystemTopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client SystemTopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result SystemTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.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, filter, top) - return -} - -// ListBySubscription list all the system topics under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client SystemTopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result SystemTopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.stlr.Response.Response != nil { - sc = result.stlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.stlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.stlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.stlr.hasNextLink() && result.stlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client SystemTopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics", 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 SystemTopicsClient) 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 SystemTopicsClient) ListBySubscriptionResponder(resp *http.Response) (result SystemTopicsListResult, 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 SystemTopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults SystemTopicsListResult) (result SystemTopicsListResult, err error) { - req, err := lastResults.systemTopicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "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, "eventgrid.SystemTopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client SystemTopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result SystemTopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.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, filter, top) - return -} - -// Update asynchronously updates a system topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// systemTopicName - name of the system topic. -// systemTopicUpdateParameters - systemTopic update information. -func (client SystemTopicsClient) Update(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters SystemTopicUpdateParameters) (result SystemTopicsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, systemTopicName, systemTopicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SystemTopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters SystemTopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "systemTopicName": autorest.Encode("path", systemTopicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/systemTopics/{systemTopicName}", pathParameters), - autorest.WithJSON(systemTopicUpdateParameters), - 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 SystemTopicsClient) UpdateSender(req *http.Request) (future SystemTopicsUpdateFuture, 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 SystemTopicsClient) UpdateResponder(resp *http.Response) (result SystemTopic, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/topics.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/topics.go deleted file mode 100644 index 6e94208a9b7a..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/topics.go +++ /dev/null @@ -1,852 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicsClient is the azure EventGrid Management Client -type TopicsClient struct { - BaseClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient 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 NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate asynchronously creates a new topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -// topicInfo - topic information. -func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicInfo), - 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 TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, 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 TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, 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 existing topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/topics/{topicName}", 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 TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, 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 TopicsClient) 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 get properties of a topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the topics under a resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client TopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { - req, err := lastResults.topicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) - return -} - -// ListBySubscription list all the topics under an Azure subscription. -// Parameters: -// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the -// 'name' property only and with limited number of OData operations. These operations are: the 'contains' -// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). -// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, -// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq -// 'westus'. -// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to -// 100. If not specified, the default number of results to be returned is 20 items per page. -func (client TopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result TopicsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListBySubscription") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { - req, err := lastResults.topicsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result TopicsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) - return -} - -// ListEventTypes list event types for a topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// providerNamespace - namespace of the provider of the topic. -// resourceTypeName - name of the topic type. -// resourceName - name of the topic. -func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerNamespace": autorest.Encode("path", providerNamespace), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceTypeName": autorest.Encode("path", resourceTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSharedAccessKeys list the two keys used to publish to a topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListSharedAccessKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListSharedAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.ListSharedAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. -func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/topics/{topicName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a shared access key for a topic. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -// regenerateKeyRequest - request body to regenerate key. -func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicsRegenerateKeyFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.RegenerateKey") - 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: regenerateKeyRequest, - Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("eventgrid.TopicsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, topicName, regenerateKeyRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateKeySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/topics/{topicName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyRequest), - 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 TopicsClient) RegenerateKeySender(req *http.Request) (future TopicsRegenerateKeyFuture, 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 -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, 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 asynchronously updates a topic with the specified parameters. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. -// topicName - name of the topic. -// topicUpdateParameters - topic update information. -func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2020-10-15-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.EventGrid/topics/{topicName}", pathParameters), - autorest.WithJSON(topicUpdateParameters), - 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 TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, 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 TopicsClient) UpdateResponder(resp *http.Response) (result Topic, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/topictypes.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/topictypes.go deleted file mode 100644 index 23e8cd7bba06..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/topictypes.go +++ /dev/null @@ -1,244 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TopicTypesClient is the azure EventGrid Management Client -type TopicTypesClient struct { - BaseClient -} - -// NewTopicTypesClient creates an instance of the TopicTypesClient client. -func NewTopicTypesClient(subscriptionID string) TopicTypesClient { - return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient 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 NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { - return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get information about a topic type. -// Parameters: -// topicTypeName - name of the topic type. -func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.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, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all registered topic types. -func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"), - 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 TopicTypesClient) 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 TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventTypes list event types for a topic type. -// Parameters: -// topicTypeName - name of the topic type. -func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.ListEventTypes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListEventTypesPreparer(ctx, topicTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request") - return - } - - result, err = client.ListEventTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request") - return - } - - return -} - -// ListEventTypesPreparer prepares the ListEventTypes request. -func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "topicTypeName": autorest.Encode("path", topicTypeName), - } - - const APIVersion = "2020-10-15-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventTypesSender sends the ListEventTypes request. The method will close the -// http.Response Body if it receives an error. -func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListEventTypesResponder handles the response to the ListEventTypes request. The method always -// closes the http.Response Body. -func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, 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/eventgrid/mgmt/2020-10-15-preview/eventgrid/version.go b/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/version.go deleted file mode 100644 index 96bb0d2f8332..000000000000 --- a/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package eventgrid - -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() + " eventgrid/2020-10-15-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/CHANGELOG.md b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/_meta.json b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/_meta.json deleted file mode 100644 index 8545759ac54a..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "9d8640319ef481ae301b67b033d6ae0bd30422c3", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2016-03-preview-monitorlegacy", - "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-2016-03-preview-monitorlegacy --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/monitor/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/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertruleincidents.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertruleincidents.go deleted file mode 100644 index 1fccc97f9f1b..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertruleincidents.go +++ /dev/null @@ -1,205 +0,0 @@ -package monitorlegacy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AlertRuleIncidentsClient is the monitor Management Client -type AlertRuleIncidentsClient struct { - BaseClient -} - -// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// incidentName - the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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("monitorlegacy.AlertRuleIncidentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) 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 -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") - 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("monitorlegacy.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) - } - - req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - return - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertrules.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertrules.go deleted file mode 100644 index 5a78bf9b356c..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/alertrules.go +++ /dev/null @@ -1,542 +0,0 @@ -package monitorlegacy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 monitor Management Client -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 a classic metric alert rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, 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: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("monitorlegacy.AlertRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.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, "monitorlegacy.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 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 AlertRuleResource, 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName 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: 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("monitorlegacy.AlertRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, 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: 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("monitorlegacy.AlertRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.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, "monitorlegacy.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 AlertRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the classic metric alert rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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: 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("monitorlegacy.AlertRulesClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) 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 = "2016-03-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/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the classic metric alert rules within a subscription. -func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") - 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}}}}); err != nil { - return result, validation.NewError("monitorlegacy.AlertRulesClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// alertRulesResource - parameters supplied to the operation. -func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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("monitorlegacy.AlertRulesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.AlertRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(alertRulesResource), - 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 AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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/monitor/mgmt/2016-03-01-preview/monitorlegacy/client.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/client.go deleted file mode 100644 index a5d40514c20e..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package monitorlegacy implements the Azure ARM Monitorlegacy service API version . -// -// Monitor Management Client -package monitorlegacy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Monitorlegacy - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Monitorlegacy. -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/monitor/mgmt/2016-03-01-preview/monitorlegacy/enums.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/enums.go deleted file mode 100644 index e11523b0b33e..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/enums.go +++ /dev/null @@ -1,132 +0,0 @@ -package monitorlegacy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// DataStatus enumerates the values for data status. -type DataStatus string - -const ( - // DataStatusNotPresent ... - DataStatusNotPresent DataStatus = "notPresent" - // DataStatusPresent ... - DataStatusPresent DataStatus = "present" -) - -// PossibleDataStatusValues returns an array of possible values for the DataStatus const type. -func PossibleDataStatusValues() []DataStatus { - return []DataStatus{DataStatusNotPresent, DataStatusPresent} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeBasicRuleActionOdataTypeRuleAction ... - OdataTypeBasicRuleActionOdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeBasicRuleActionOdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeBasicRuleConditionOdataTypeRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeBasicRuleConditionOdataTypeRuleCondition} -} - -// OnboardingStatus enumerates the values for onboarding status. -type OnboardingStatus string - -const ( - // OnboardingStatusNotOnboarded ... - OnboardingStatusNotOnboarded OnboardingStatus = "notOnboarded" - // OnboardingStatusOnboarded ... - OnboardingStatusOnboarded OnboardingStatus = "onboarded" - // OnboardingStatusUnknown ... - OnboardingStatusUnknown OnboardingStatus = "unknown" -) - -// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. -func PossibleOnboardingStatusValues() []OnboardingStatus { - return []OnboardingStatus{OnboardingStatusNotOnboarded, OnboardingStatusOnboarded, OnboardingStatusUnknown} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/eventcategories.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/eventcategories.go deleted file mode 100644 index 5806b06c0524..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/eventcategories.go +++ /dev/null @@ -1,99 +0,0 @@ -package monitorlegacy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EventCategoriesClient is the monitor Management Client -type EventCategoriesClient struct { - BaseClient -} - -// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. -func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { - return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { - return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available event categories supported in the Activity Logs Service.
The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.EventCategoriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.EventCategoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.EventCategoriesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), - 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2016-03-01-preview/monitorlegacy/logprofiles.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/logprofiles.go deleted file mode 100644 index 762a7e64bc28..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/logprofiles.go +++ /dev/null @@ -1,444 +0,0 @@ -package monitorlegacy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LogProfilesClient is the monitor Management Client -type LogProfilesClient struct { - BaseClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// Parameters: -// logProfileName - the name of the log profile. -// parameters - parameters supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("monitorlegacy.LogProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/Microsoft.Insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("monitorlegacy.LogProfilesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) 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 the log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("monitorlegacy.LogProfilesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("monitorlegacy.LogProfilesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 LogProfilesResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// logProfileName - the name of the log profile. -// logProfilesResource - parameters supplied to the operation. -func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("monitorlegacy.LogProfilesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.LogProfilesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(logProfilesResource), - 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 LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2016-03-01-preview/monitorlegacy/models.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/models.go deleted file mode 100644 index cd7713b06185..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/models.go +++ /dev/null @@ -1,1678 +0,0 @@ -package monitorlegacy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy" - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // ProvisioningState - the provisioning state. - ProvisioningState *string `json:"provisioningState,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. - Action BasicRuleAction `json:"action,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.ProvisioningState != nil { - objectMap["provisioningState"] = ar.ProvisioningState - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - objectMap["action"] = ar.Action - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) 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 - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - ar.ProvisioningState = &provisioningState - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "action": - if v != nil { - action, err := unmarshalBasicRuleAction(*v) - if err != nil { - return err - } - ar.Action = action - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `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 AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) 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 alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) 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 - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// DataContainer information about a container with data for a given resource. -type DataContainer struct { - // Workspace - Log Analytics workspace information. - Workspace *WorkspaceInfo `json:"workspace,omitempty"` -} - -// Error error details. -type Error struct { - // Code - Error code identifying the specific error. - Code *string `json:"code,omitempty"` - // Message - Error message in the caller's locale. - Message *string `json:"message,omitempty"` -} - -// 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"` -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) 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 "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `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 LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) 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 logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) 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 - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) 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 "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// ProxyResource an azure resource object -type ProxyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource an azure resource object -type Resource 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResponseWithError an error response from the API. -type ResponseWithError struct { - // Error - Error information. - Error *Error `json:"error,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeBasicRuleActionOdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeBasicRuleConditionOdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) 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 "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - LegacyResourceID *string `json:"legacyResourceId,omitempty"` - // ResourceLocation - the location of the resource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // MetricNamespace - the namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.LegacyResourceID != nil { - objectMap["legacyResourceId"] = rds.LegacyResourceID - } - if rds.ResourceLocation != nil { - objectMap["resourceLocation"] = rds.ResourceLocation - } - if rds.MetricNamespace != nil { - objectMap["metricNamespace"] = rds.MetricNamespace - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - LegacyResourceID *string `json:"legacyResourceId,omitempty"` - // ResourceLocation - the location of the resource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // MetricNamespace - the namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.LegacyResourceID != nil { - objectMap["legacyResourceId"] = rmeds.LegacyResourceID - } - if rmeds.ResourceLocation != nil { - objectMap["resourceLocation"] = rmeds.ResourceLocation - } - if rmeds.MetricNamespace != nil { - objectMap["metricNamespace"] = rmeds.MetricNamespace - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - LegacyResourceID *string `json:"legacyResourceId,omitempty"` - // ResourceLocation - the location of the resource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // MetricNamespace - the namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.LegacyResourceID != nil { - objectMap["legacyResourceId"] = rmds.LegacyResourceID - } - if rmds.ResourceLocation != nil { - objectMap["resourceLocation"] = rmds.ResourceLocation - } - if rmds.MetricNamespace != nil { - objectMap["metricNamespace"] = rmds.MetricNamespace - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) 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 "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. -type VMInsightsOnboardingStatus struct { - autorest.Response `json:"-"` - // VMInsightsOnboardingStatusProperties - Resource properties. - *VMInsightsOnboardingStatusProperties `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"` -} - -// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. -func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vios.VMInsightsOnboardingStatusProperties != nil { - objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. -func (vios *VMInsightsOnboardingStatus) 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 VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties - err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) - if err != nil { - return err - } - vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vios.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vios.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vios.Type = &typeVar - } - } - } - - return nil -} - -// VMInsightsOnboardingStatusProperties resource properties. -type VMInsightsOnboardingStatusProperties struct { - // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. - ResourceID *string `json:"resourceId,omitempty"` - // OnboardingStatus - The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: 'OnboardingStatusOnboarded', 'OnboardingStatusNotOnboarded', 'OnboardingStatusUnknown' - OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` - // DataStatus - The status of VM Insights data from the resource. When reported as `present` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: 'DataStatusPresent', 'DataStatusNotPresent' - DataStatus DataStatus `json:"dataStatus,omitempty"` - // Data - Containers that currently store VM Insights data for the specified resource. - Data *[]DataContainer `json:"data,omitempty"` -} - -// WorkspaceInfo information about a Log Analytics Workspace. -type WorkspaceInfo struct { - // ID - Azure Resource Manager identifier of the Log Analytics Workspace. - ID *string `json:"id,omitempty"` - // Location - Location of the Log Analytics workspace. - Location *string `json:"location,omitempty"` - // WorkspaceInfoProperties - Resource properties. - *WorkspaceInfoProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceInfo. -func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wi.ID != nil { - objectMap["id"] = wi.ID - } - if wi.Location != nil { - objectMap["location"] = wi.Location - } - if wi.WorkspaceInfoProperties != nil { - objectMap["properties"] = wi.WorkspaceInfoProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. -func (wi *WorkspaceInfo) 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 - } - wi.ID = &ID - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wi.Location = &location - } - case "properties": - if v != nil { - var workspaceInfoProperties WorkspaceInfoProperties - err = json.Unmarshal(*v, &workspaceInfoProperties) - if err != nil { - return err - } - wi.WorkspaceInfoProperties = &workspaceInfoProperties - } - } - } - - return nil -} - -// WorkspaceInfoProperties resource properties. -type WorkspaceInfoProperties struct { - // CustomerID - Log Analytics workspace identifier. - CustomerID *string `json:"customerId,omitempty"` -} diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/monitorlegacyapi/interfaces.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/monitorlegacyapi/interfaces.go deleted file mode 100644 index 05314cce0559..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/monitorlegacyapi/interfaces.go +++ /dev/null @@ -1,58 +0,0 @@ -package monitorlegacyapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/monitor/mgmt/2016-03-01-preview/monitorlegacy" - "github.com/Azure/go-autorest/autorest" -) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result monitorlegacy.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*monitorlegacy.EventCategoriesClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters monitorlegacy.AlertRuleResource) (result monitorlegacy.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result monitorlegacy.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result monitorlegacy.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result monitorlegacy.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource monitorlegacy.AlertRuleResourcePatch) (result monitorlegacy.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*monitorlegacy.AlertRulesClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result monitorlegacy.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result monitorlegacy.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*monitorlegacy.AlertRuleIncidentsClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters monitorlegacy.LogProfileResource) (result monitorlegacy.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result monitorlegacy.LogProfileResource, err error) - List(ctx context.Context) (result monitorlegacy.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource monitorlegacy.LogProfileResourcePatch) (result monitorlegacy.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*monitorlegacy.LogProfilesClient)(nil) - -// VMInsightsClientAPI contains the set of methods on the VMInsightsClient type. -type VMInsightsClientAPI interface { - GetOnboardingStatus(ctx context.Context, resourceURI string) (result monitorlegacy.VMInsightsOnboardingStatus, err error) -} - -var _ VMInsightsClientAPI = (*monitorlegacy.VMInsightsClient)(nil) diff --git a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/version.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/version.go deleted file mode 100644 index 96e256f563e7..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package monitorlegacy - -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() + " monitorlegacy/2016-03-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/monitor/mgmt/2016-03-01-preview/monitorlegacy/vminsights.go b/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/vminsights.go deleted file mode 100644 index c252f9ff3867..000000000000 --- a/services/preview/monitor/mgmt/2016-03-01-preview/monitorlegacy/vminsights.go +++ /dev/null @@ -1,105 +0,0 @@ -package monitorlegacy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// VMInsightsClient is the monitor Management Client -type VMInsightsClient struct { - BaseClient -} - -// NewVMInsightsClient creates an instance of the VMInsightsClient client. -func NewVMInsightsClient(subscriptionID string) VMInsightsClient { - return NewVMInsightsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVMInsightsClientWithBaseURI creates an instance of the VMInsightsClient 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 NewVMInsightsClientWithBaseURI(baseURI string, subscriptionID string) VMInsightsClient { - return VMInsightsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetOnboardingStatus retrieves the VM Insights onboarding status for the specified resource or resource scope. -// Parameters: -// resourceURI - the fully qualified Azure Resource manager identifier of the resource, or scope, whose status -// to retrieve. -func (client VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string) (result VMInsightsOnboardingStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VMInsightsClient.GetOnboardingStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOnboardingStatusPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.VMInsightsClient", "GetOnboardingStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetOnboardingStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitorlegacy.VMInsightsClient", "GetOnboardingStatus", resp, "Failure sending request") - return - } - - result, err = client.GetOnboardingStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitorlegacy.VMInsightsClient", "GetOnboardingStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetOnboardingStatusPreparer prepares the GetOnboardingStatus request. -func (client VMInsightsClient) GetOnboardingStatusPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-11-27-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOnboardingStatusSender sends the GetOnboardingStatus request. The method will close the -// http.Response Body if it receives an error. -func (client VMInsightsClient) GetOnboardingStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetOnboardingStatusResponder handles the response to the GetOnboardingStatus request. The method always -// closes the http.Response Body. -func (client VMInsightsClient) GetOnboardingStatusResponder(resp *http.Response) (result VMInsightsOnboardingStatus, 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/monitor/mgmt/2017-05-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2017-05-01-preview/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2017-05-01-preview/insights/_meta.json deleted file mode 100644 index 9c53dafc00b1..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2017-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-2017-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go deleted file mode 100644 index 20bdb629e8c1..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go +++ /dev/null @@ -1,581 +0,0 @@ -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" -) - -// ActionGroupsClient is the monitor Management Client -type ActionGroupsClient struct { - BaseClient -} - -// NewActionGroupsClient creates an instance of the ActionGroupsClient client. -func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { - return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { - return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new action group or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroup - the action group to create or use for the update. -func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: actionGroup, - Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, - {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroup), - 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 ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) 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 -} - -// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. -// This operation is only supported for Email or SMS receivers. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// enableRequest - the receiver to re-enable. -func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) - } - - req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") - return - } - - resp, err := client.EnableReceiverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") - return - } - - result, err = client.EnableReceiverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") - return - } - - return -} - -// EnableReceiverPreparer prepares the EnableReceiver request. -func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}/subscribe", pathParameters), - autorest.WithJSON(enableRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableReceiverSender sends the EnableReceiver request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableReceiverResponder handles the response to the EnableReceiver request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all action groups in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActionGroupsClient) 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 = "2018-09-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/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all action groups in a subscription. -func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, 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 action group's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroupPatch - parameters supplied to the operation. -func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName, actionGroupPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroupPatch), - 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 ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go deleted file mode 100644 index 44aaf3ef1e4a..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// ActivityLogAlertsClient is the monitor Management Client -type ActivityLogAlertsClient struct { - BaseClient -} - -// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient 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 NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new activity log alert or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlert - the activity log alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all activity log alerts in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) 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 = "2017-04-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/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all activity log alerts in a subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, 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 ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlertPatch - parameters supplied to the operation. -func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName, activityLogAlertPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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/monitor/mgmt/2017-05-01-preview/insights/activitylogs.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogs.go deleted file mode 100644 index 16dd215e6ad9..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/activitylogs.go +++ /dev/null @@ -1,166 +0,0 @@ -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" -) - -// ActivityLogsClient is the monitor Management Client -type ActivityLogsClient struct { - BaseClient -} - -// NewActivityLogsClient creates an instance of the ActivityLogsClient client. -func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { - return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient 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 NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { - return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides the list of records from the activity logs. -// Parameters: -// filter - reduces the set of data collected.
This argument is required and it also requires at least the -// start date/time.
The **$filter** argument is very restricted and allows only the following patterns.
- -// *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and -// eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
- *List -// events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a subscription in a -// time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq -// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq -// 'correlationID'.

**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go deleted file mode 100644 index c3bf26828d8e..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// AlertRuleIncidentsClient is the monitor Management Client -type AlertRuleIncidentsClient struct { - BaseClient -} - -// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// incidentName - the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "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.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) 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 -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - return - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2017-05-01-preview/insights/alertrules.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertrules.go deleted file mode 100644 index f5a2ab682384..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/alertrules.go +++ /dev/null @@ -1,495 +0,0 @@ -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" -) - -// AlertRulesClient is the monitor Management Client -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 a classic metric alert rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 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 AlertRuleResource, 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName 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) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, 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) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 AlertRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the classic metric alert rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) 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 = "2016-03-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/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the classic metric alert rules within a subscription. -func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// alertRulesResource - parameters supplied to the operation. -func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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, ruleName, alertRulesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(alertRulesResource), - 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 AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go deleted file mode 100644 index 86f253d0fb89..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go +++ /dev/null @@ -1,580 +0,0 @@ -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" -) - -// AutoscaleSettingsClient is the monitor Management Client -type AutoscaleSettingsClient struct { - BaseClient -} - -// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// parameters - parameters supplied to the operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) 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-04-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/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 the autoscale settings for a subscription -func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// autoscaleSettingResource - parameters supplied to the operation. -func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName, autoscaleSettingResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(autoscaleSettingResource), - 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2017-05-01-preview/insights/client.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/client.go deleted file mode 100644 index a777181b0785..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package insights implements the Azure ARM Insights service API version . -// -// Monitor 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/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go deleted file mode 100644 index 9708c52c2499..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go +++ /dev/null @@ -1,332 +0,0 @@ -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" -) - -// DiagnosticSettingsClient is the monitor Management Client -type DiagnosticSettingsClient struct { - BaseClient -} - -// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. -func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { - return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient 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 NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { - return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, resourceURI, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-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("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) 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 active diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 active diagnostic settings list for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", 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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, 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/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go deleted file mode 100644 index 48365ed67e65..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettingscategory.go +++ /dev/null @@ -1,180 +0,0 @@ -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" -) - -// DiagnosticSettingsCategoryClient is the monitor Management Client -type DiagnosticSettingsCategoryClient struct { - BaseClient -} - -// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. -func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { - return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient 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 NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { - return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, 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/monitor/mgmt/2017-05-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/enums.go deleted file mode 100644 index 2c1f3faef4f7..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/enums.go +++ /dev/null @@ -1,378 +0,0 @@ -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. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // Average ... - Average AggregationType = "Average" - // Count ... - Count AggregationType = "Count" - // Maximum ... - Maximum AggregationType = "Maximum" - // Minimum ... - Minimum AggregationType = "Minimum" - // None ... - None AggregationType = "None" - // Total ... - Total AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{Average, Count, Maximum, Minimum, None, Total} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // Logs ... - Logs CategoryType = "Logs" - // Metrics ... - Metrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{Logs, Metrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // Equals ... - Equals ComparisonOperationType = "Equals" - // GreaterThan ... - GreaterThan ComparisonOperationType = "GreaterThan" - // GreaterThanOrEqual ... - GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // LessThan ... - LessThan ComparisonOperationType = "LessThan" - // LessThanOrEqual ... - LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // NotEquals ... - NotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} -} - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // Critical ... - Critical EventLevel = "Critical" - // Error ... - Error EventLevel = "Error" - // Informational ... - Informational EventLevel = "Informational" - // Verbose ... - Verbose EventLevel = "Verbose" - // Warning ... - Warning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{Critical, Error, Informational, Verbose, Warning} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeRuleAction ... - OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeRuleCondition ... - OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // Disabled ... - Disabled ReceiverStatus = "Disabled" - // Enabled ... - Enabled ReceiverStatus = "Enabled" - // NotSpecified ... - NotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{Disabled, Enabled, NotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // Data ... - Data ResultType = "Data" - // Metadata ... - Metadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{Data, Metadata} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ChangeCount ... - ChangeCount ScaleType = "ChangeCount" - // ExactCount ... - ExactCount ScaleType = "ExactCount" - // PercentChangeCount ... - PercentChangeCount ScaleType = "PercentChangeCount" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // High ... - High Sensitivity = "High" - // Low ... - Low Sensitivity = "Low" - // Medium ... - Medium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{High, Low, Medium} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCount, UnitCountPerSecond, UnitMilliSeconds, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/eventcategories.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/eventcategories.go deleted file mode 100644 index 86e59b424363..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/eventcategories.go +++ /dev/null @@ -1,99 +0,0 @@ -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" -) - -// EventCategoriesClient is the monitor Management Client -type EventCategoriesClient struct { - BaseClient -} - -// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. -func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { - return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { - return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available event categories supported in the Activity Logs Service.
The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "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.EventCategoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), - 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2017-05-01-preview/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/insightsapi/interfaces.go deleted file mode 100644 index 3c72f0831326..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,153 +0,0 @@ -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/monitor/mgmt/2017-05-01-preview/insights" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) - List(ctx context.Context) (result insights.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) - -// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. -type DiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) -} - -var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) - -// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) -} - -var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) - -// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. -type ActivityLogAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActivityLogAlertList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActivityLogAlertList, err error) - Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch insights.ActivityLogAlertPatchBody) (result insights.ActivityLogAlertResource, err error) -} - -var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) - -// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. -type ActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result insights.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) - -// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. -type TenantActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) - -// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. -type MetricDefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string) (result insights.MetricDefinitionCollection, err error) -} - -var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) - -// MetricsClientAPI contains the set of methods on the MetricsClient type. -type MetricsClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metric string, aggregation string, top *float64, orderby string, filter string, resultType insights.ResultType) (result insights.Response, err error) -} - -var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go deleted file mode 100644 index ad1500b87bc9..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go +++ /dev/null @@ -1,418 +0,0 @@ -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" -) - -// LogProfilesClient is the monitor Management Client -type LogProfilesClient struct { - BaseClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// Parameters: -// logProfileName - the name of the log profile. -// parameters - parameters supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) 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 the log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 LogProfilesResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// logProfileName - the name of the log profile. -// logProfilesResource - parameters supplied to the operation. -func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName, logProfilesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(logProfilesResource), - 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 LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2017-05-01-preview/insights/metricbaseline.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -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" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient 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 NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - 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: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-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("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.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, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "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.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", 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 MetricBaselineClient) 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 MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, 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/monitor/mgmt/2017-05-01-preview/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/metricdefinitions.go deleted file mode 100644 index fd0c5b9f7ddb..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/metricdefinitions.go +++ /dev/null @@ -1,105 +0,0 @@ -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" -) - -// MetricDefinitionsClient is the monitor Management Client -type MetricDefinitionsClient struct { - BaseClient -} - -// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. -func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { - return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient 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 NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { - return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string) (result MetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "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.MetricDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", 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 MetricDefinitionsClient) 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 MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, 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/monitor/mgmt/2017-05-01-preview/insights/metrics.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/metrics.go deleted file mode 100644 index 252135ed78af..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/metrics.go +++ /dev/null @@ -1,148 +0,0 @@ -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" -) - -// MetricsClient is the monitor Management Client -type MetricsClient struct { - BaseClient -} - -// NewMetricsClient creates an instance of the MetricsClient client. -func NewMetricsClient(subscriptionID string) MetricsClient { - return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricsClientWithBaseURI creates an instance of the MetricsClient 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 NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { - return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metric - the name of the metric to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metric string, aggregation string, top *float64, orderby string, filter string, resultType ResultType) (result Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metric, aggregation, top, orderby, filter, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "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.MetricsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metric string, aggregation string, top *float64, orderby string, filter string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metric) > 0 { - queryParameters["metric"] = autorest.Encode("query", metric) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/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 MetricsClient) 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 MetricsClient) ListResponder(resp *http.Response) (result Response, 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/monitor/mgmt/2017-05-01-preview/insights/models.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/models.go deleted file mode 100644 index f992c8054196..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/models.go +++ /dev/null @@ -1,3176 +0,0 @@ -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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2017-05-01-preview/insights" - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) 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 - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `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 ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) 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 actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActivityLogAlert an Azure activity log alert. -type ActivityLogAlert struct { - // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. - Scopes *[]string `json:"scopes,omitempty"` - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` - // Condition - The condition that will cause this alert to activate. - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - // Actions - The actions that will activate when the condition is met. - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - // Description - A description of this activity log alert. - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - // ActionGroupID - The resourceId of the action group. This cannot be null or empty. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string `json:"webhookProperties"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. -func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alaag.ActionGroupID != nil { - objectMap["actionGroupId"] = alaag.ActionGroupID - } - if alaag.WebhookProperties != nil { - objectMap["webhookProperties"] = alaag.WebhookProperties - } - return json.Marshal(objectMap) -} - -// ActivityLogAlertActionList a list of activity log alert actions. -type ActivityLogAlertActionList struct { - // ActionGroups - The list of activity log alerts. - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member -// conditions are met. -type ActivityLogAlertAllOfCondition struct { - // AllOf - The list of activity log alert conditions. - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log -// field and value. -type ActivityLogAlertLeafCondition struct { - // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. - Field *string `json:"field,omitempty"` - // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - // Value - The list of activity log alerts. - Value *[]ActivityLogAlertResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityLogAlertPatch an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. -type ActivityLogAlertPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActivityLogAlertPatch - The activity log alert settings for an update operation. - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. -func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alapb.Tags != nil { - objectMap["tags"] = alapb.Tags - } - if alapb.ActivityLogAlertPatch != nil { - objectMap["properties"] = alapb.ActivityLogAlertPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. -func (alapb *ActivityLogAlertPatchBody) 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 - } - alapb.Tags = tags - } - case "properties": - if v != nil { - var activityLogAlertPatch ActivityLogAlertPatch - err = json.Unmarshal(*v, &activityLogAlertPatch) - if err != nil { - return err - } - alapb.ActivityLogAlertPatch = &activityLogAlertPatch - } - } - } - - return nil -} - -// ActivityLogAlertResource an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `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 ActivityLogAlertResource. -func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alar.ActivityLogAlert != nil { - objectMap["properties"] = alar.ActivityLogAlert - } - if alar.Location != nil { - objectMap["location"] = alar.Location - } - if alar.Tags != nil { - objectMap["tags"] = alar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) 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 activityLogAlert ActivityLogAlert - err = json.Unmarshal(*v, &activityLogAlert) - if err != nil { - return err - } - alar.ActivityLogAlert = &activityLogAlert - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - alar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - alar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - alar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alar.Tags = tags - } - } - } - - return nil -} - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) 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 - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `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 AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) 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 alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) 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 - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// ArmRoleReceiver an arm role receiver. -type ArmRoleReceiver struct { - // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // RoleID - The arm role id. - RoleID *string `json:"roleId,omitempty"` -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `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 AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) 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 autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) - if err != nil { - return err - } - page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) 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 - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` -} - -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) 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 - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - -// DiagnosticSettings the diagnostic settings. -type DiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// DiagnosticSettingsCategory the diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' - CategoryType CategoryType `json:"categoryType,omitempty"` -} - -// DiagnosticSettingsCategoryResource the diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` - // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. - *DiagnosticSettingsCategory `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. -func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dscr.DiagnosticSettingsCategory != nil { - objectMap["properties"] = dscr.DiagnosticSettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. -func (dscr *DiagnosticSettingsCategoryResource) 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 diagnosticSettingsCategory DiagnosticSettingsCategory - err = json.Unmarshal(*v, &diagnosticSettingsCategory) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dscr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category -// resources. -type DiagnosticSettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` -} - -// DiagnosticSettingsResource the diagnostic setting resource. -type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // DiagnosticSettings - Properties of a Diagnostic Settings Resource. - *DiagnosticSettings `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. -func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DiagnosticSettings != nil { - objectMap["properties"] = dsr.DiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. -func (dsr *DiagnosticSettingsResource) 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 diagnosticSettings DiagnosticSettings - err = json.Unmarshal(*v, &diagnosticSettings) - if err != nil { - return err - } - dsr.DiagnosticSettings = &diagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]DiagnosticSettingsResource `json:"value,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'NotSpecified', 'Enabled', 'Disabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// 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"` -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// EventData the Azure event log entries are of type EventData -type EventData struct { - // Authorization - READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization `json:"authorization,omitempty"` - // Claims - READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string `json:"claims"` - // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string `json:"caller,omitempty"` - // Description - READ-ONLY; the description of the event. - Description *string `json:"description,omitempty"` - // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string `json:"id,omitempty"` - // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string `json:"eventDataId,omitempty"` - // CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. - CorrelationID *string `json:"correlationId,omitempty"` - // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. - EventName *LocalizableString `json:"eventName,omitempty"` - // Category - READ-ONLY; the event category. - Category *LocalizableString `json:"category,omitempty"` - // HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). - HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` - // Level - READ-ONLY; the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' - Level EventLevel `json:"level,omitempty"` - // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` - // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - READ-ONLY; the resource type - ResourceType *LocalizableString `json:"resourceType,omitempty"` - // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. - OperationID *string `json:"operationId,omitempty"` - // OperationName - READ-ONLY; the operation name. - OperationName *LocalizableString `json:"operationName,omitempty"` - // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string `json:"properties"` - // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - Status *LocalizableString `json:"status,omitempty"` - // SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) - SubStatus *LocalizableString `json:"subStatus,omitempty"` - // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. - EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` - // SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. - SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` - // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // TenantID - READ-ONLY; the Azure tenant Id - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventData. -func (ed EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EventDataCollection represents collection of events. -type EventDataCollection struct { - autorest.Response `json:"-"` - // Value - this list that includes the Azure audit logs. - Value *[]EventData `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventDataCollectionIterator provides access to a complete listing of EventData values. -type EventDataCollectionIterator struct { - i int - page EventDataCollectionPage -} - -// 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 *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.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 *EventDataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventDataCollectionIterator) 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 EventDataCollectionIterator) Response() EventDataCollection { - 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 EventDataCollectionIterator) Value() EventData { - if !iter.page.NotDone() { - return EventData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventDataCollectionIterator type. -func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { - return EventDataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edc EventDataCollection) IsEmpty() bool { - return edc.Value == nil || len(*edc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edc EventDataCollection) hasNextLink() bool { - return edc.NextLink != nil && len(*edc.NextLink) != 0 -} - -// eventDataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !edc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edc.NextLink))) -} - -// EventDataCollectionPage contains a page of EventData values. -type EventDataCollectionPage struct { - fn func(context.Context, EventDataCollection) (EventDataCollection, error) - edc EventDataCollection -} - -// 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 *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.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.edc) - if err != nil { - return err - } - page.edc = 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 *EventDataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventDataCollectionPage) NotDone() bool { - return !page.edc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventDataCollectionPage) Response() EventDataCollection { - return page.edc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventDataCollectionPage) Values() []EventData { - if page.edc.IsEmpty() { - return nil - } - return *page.edc.Value -} - -// Creates a new instance of the EventDataCollectionPage type. -func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { - return EventDataCollectionPage{ - fn: getNextPage, - edc: cur, - } -} - -// HTTPRequestInfo the Http request info. -type HTTPRequestInfo struct { - // ClientRequestID - the client request id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ClientIPAddress - the client Ip Address - ClientIPAddress *string `json:"clientIpAddress,omitempty"` - // Method - the Http request method. - Method *string `json:"method,omitempty"` - // URI - the Uri. - URI *string `json:"uri,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) 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 "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `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 LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) 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 logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) 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 - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) 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 "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' - Unit Unit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and -// the retention period for that time grain. -type MetricAvailability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// MetricDefinition metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' - Unit Unit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// MetricDefinitionCollection represents collection of metric definitions. -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` -} - -// MetricValue represents a metric value. -type MetricValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *int64 `json:"count,omitempty"` -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Insights 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 operations supported by the Microsoft.Insights 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"` -} - -// ProxyOnlyResource a proxy only azure resource object -type ProxyOnlyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyOnlyResource. -func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource an azure resource object -type Resource 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) 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 "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. - Maximum *string `json:"maximum,omitempty"` - // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// SenderAuthorization the authorization used by the user who has performed the operation that led to this -// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and -// the 'scope' -type SenderAuthorization struct { - // Action - the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string `json:"action,omitempty"` - // Role - the role of the user. For instance: Subscription Admin - Role *string `json:"role,omitempty"` - // Scope - the scope. - Scope *string `json:"scope,omitempty"` -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'NotSpecified', 'Enabled', 'Disabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) 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 "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]MetricValue `json:"data,omitempty"` -} - -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,omitempty"` -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` -} diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/operations.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/operations.go deleted file mode 100644 index 3f82351c7f23..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -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 monitor 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 operations from Microsoft.Insights provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-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 -} diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/tenantactivitylogs.go deleted file mode 100644 index 7501f047bb38..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/tenantactivitylogs.go +++ /dev/null @@ -1,168 +0,0 @@ -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" -) - -// TenantActivityLogsClient is the monitor Management Client -type TenantActivityLogsClient struct { - BaseClient -} - -// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. -func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { - return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient 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 NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { - return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for -// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that -// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that -// were generated at the tenant level. -// Parameters: -// filter - reduces the set of data collected.
The **$filter** is very restricted and allows only the -// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq -// ''.
- List events for resource: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq -// ''.
- List events for a subscription: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation'.
- List events for a resource -// provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq -// 'Admin, Operation' and resourceProvider eq ''.
- List events for a correlation Id: -// api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq -// ''.
**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), - 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 TenantActivityLogsClient) 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 TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2017-05-01-preview/insights/version.go b/services/preview/monitor/mgmt/2017-05-01-preview/insights/version.go deleted file mode 100644 index bb39014c5f30..000000000000 --- a/services/preview/monitor/mgmt/2017-05-01-preview/insights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -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/2017-05-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/monitor/mgmt/2018-03-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json b/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json deleted file mode 100644 index b55c341f8840..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2018-03", - "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-2018-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go deleted file mode 100644 index 43753cb5b294..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go +++ /dev/null @@ -1,581 +0,0 @@ -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" -) - -// ActionGroupsClient is the monitor Management Client -type ActionGroupsClient struct { - BaseClient -} - -// NewActionGroupsClient creates an instance of the ActionGroupsClient client. -func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { - return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { - return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new action group or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroup - the action group to create or use for the update. -func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: actionGroup, - Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, - {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroup), - 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 ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) 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 -} - -// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. -// This operation is only supported for Email or SMS receivers. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// enableRequest - the receiver to re-enable. -func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) - } - - req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") - return - } - - resp, err := client.EnableReceiverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") - return - } - - result, err = client.EnableReceiverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") - return - } - - return -} - -// EnableReceiverPreparer prepares the EnableReceiver request. -func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/actionGroups/{actionGroupName}/subscribe", pathParameters), - autorest.WithJSON(enableRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableReceiverSender sends the EnableReceiver request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableReceiverResponder handles the response to the EnableReceiver request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all action groups in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActionGroupsClient) 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 = "2018-03-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/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all action groups in a subscription. -func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, 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 action group's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroupPatch - parameters supplied to the operation. -func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName, actionGroupPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroupPatch), - 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 ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2018-03-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go deleted file mode 100644 index 44aaf3ef1e4a..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// ActivityLogAlertsClient is the monitor Management Client -type ActivityLogAlertsClient struct { - BaseClient -} - -// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient 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 NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new activity log alert or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlert - the activity log alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all activity log alerts in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) 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 = "2017-04-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/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all activity log alerts in a subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, 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 ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlertPatch - parameters supplied to the operation. -func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName, activityLogAlertPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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/monitor/mgmt/2018-03-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go deleted file mode 100644 index 16dd215e6ad9..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go +++ /dev/null @@ -1,166 +0,0 @@ -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" -) - -// ActivityLogsClient is the monitor Management Client -type ActivityLogsClient struct { - BaseClient -} - -// NewActivityLogsClient creates an instance of the ActivityLogsClient client. -func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { - return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient 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 NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { - return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides the list of records from the activity logs. -// Parameters: -// filter - reduces the set of data collected.
This argument is required and it also requires at least the -// start date/time.
The **$filter** argument is very restricted and allows only the following patterns.
- -// *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and -// eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
- *List -// events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a subscription in a -// time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq -// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq -// 'correlationID'.

**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go deleted file mode 100644 index c3bf26828d8e..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// AlertRuleIncidentsClient is the monitor Management Client -type AlertRuleIncidentsClient struct { - BaseClient -} - -// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// incidentName - the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "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.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) 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 -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - return - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2018-03-01/insights/alertrules.go b/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go deleted file mode 100644 index f5a2ab682384..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go +++ /dev/null @@ -1,495 +0,0 @@ -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" -) - -// AlertRulesClient is the monitor Management Client -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 a classic metric alert rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 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 AlertRuleResource, 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName 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) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, 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) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 AlertRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the classic metric alert rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) 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 = "2016-03-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/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the classic metric alert rules within a subscription. -func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// alertRulesResource - parameters supplied to the operation. -func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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, ruleName, alertRulesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(alertRulesResource), - 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 AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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/monitor/mgmt/2018-03-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go deleted file mode 100644 index 86f253d0fb89..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go +++ /dev/null @@ -1,580 +0,0 @@ -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" -) - -// AutoscaleSettingsClient is the monitor Management Client -type AutoscaleSettingsClient struct { - BaseClient -} - -// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// parameters - parameters supplied to the operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) 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-04-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/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 the autoscale settings for a subscription -func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// autoscaleSettingResource - parameters supplied to the operation. -func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName, autoscaleSettingResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(autoscaleSettingResource), - 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2018-03-01/insights/client.go b/services/preview/monitor/mgmt/2018-03-01/insights/client.go deleted file mode 100644 index a777181b0785..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package insights implements the Azure ARM Insights service API version . -// -// Monitor 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/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go deleted file mode 100644 index 9708c52c2499..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettings.go +++ /dev/null @@ -1,332 +0,0 @@ -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" -) - -// DiagnosticSettingsClient is the monitor Management Client -type DiagnosticSettingsClient struct { - BaseClient -} - -// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. -func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { - return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient 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 NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { - return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, resourceURI, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-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("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) 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 active diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 active diagnostic settings list for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", 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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, 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/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go deleted file mode 100644 index 48365ed67e65..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategory.go +++ /dev/null @@ -1,180 +0,0 @@ -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" -) - -// DiagnosticSettingsCategoryClient is the monitor Management Client -type DiagnosticSettingsCategoryClient struct { - BaseClient -} - -// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. -func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { - return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient 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 NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { - return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, 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/monitor/mgmt/2018-03-01/insights/enums.go b/services/preview/monitor/mgmt/2018-03-01/insights/enums.go deleted file mode 100644 index 1bab3243cf63..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/enums.go +++ /dev/null @@ -1,596 +0,0 @@ -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. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // Average ... - Average AggregationType = "Average" - // Count ... - Count AggregationType = "Count" - // Maximum ... - Maximum AggregationType = "Maximum" - // Minimum ... - Minimum AggregationType = "Minimum" - // None ... - None AggregationType = "None" - // Total ... - Total AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{Average, Count, Maximum, Minimum, None, Total} -} - -// AlertSeverity enumerates the values for alert severity. -type AlertSeverity string - -const ( - // Four ... - Four AlertSeverity = "4" - // One ... - One AlertSeverity = "1" - // Three ... - Three AlertSeverity = "3" - // Two ... - Two AlertSeverity = "2" - // Zero ... - Zero AlertSeverity = "0" -) - -// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. -func PossibleAlertSeverityValues() []AlertSeverity { - return []AlertSeverity{Four, One, Three, Two, Zero} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // Logs ... - Logs CategoryType = "Logs" - // Metrics ... - Metrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{Logs, Metrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // Equals ... - Equals ComparisonOperationType = "Equals" - // GreaterThan ... - GreaterThan ComparisonOperationType = "GreaterThan" - // GreaterThanOrEqual ... - GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // LessThan ... - LessThan ComparisonOperationType = "LessThan" - // LessThanOrEqual ... - LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // NotEquals ... - NotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} -} - -// ConditionalOperator enumerates the values for conditional operator. -type ConditionalOperator string - -const ( - // ConditionalOperatorEqual ... - ConditionalOperatorEqual ConditionalOperator = "Equal" - // ConditionalOperatorGreaterThan ... - ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" - // ConditionalOperatorLessThan ... - ConditionalOperatorLessThan ConditionalOperator = "LessThan" -) - -// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. -func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} -} - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// CriterionType enumerates the values for criterion type. -type CriterionType string - -const ( - // CriterionTypeDynamicThresholdCriterion ... - CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - // CriterionTypeMultiMetricCriteria ... - CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" - // CriterionTypeStaticThresholdCriterion ... - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" -) - -// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. -func PossibleCriterionTypeValues() []CriterionType { - return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} -} - -// DynamicThresholdOperator enumerates the values for dynamic threshold operator. -type DynamicThresholdOperator string - -const ( - // DynamicThresholdOperatorGreaterOrLessThan ... - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - // DynamicThresholdOperatorGreaterThan ... - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - // DynamicThresholdOperatorLessThan ... - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} -} - -// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. -type DynamicThresholdSensitivity string - -const ( - // High ... - High DynamicThresholdSensitivity = "High" - // Low ... - Low DynamicThresholdSensitivity = "Low" - // Medium ... - Medium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{High, Low, Medium} -} - -// Enabled enumerates the values for enabled. -type Enabled string - -const ( - // False ... - False Enabled = "false" - // True ... - True Enabled = "true" -) - -// PossibleEnabledValues returns an array of possible values for the Enabled const type. -func PossibleEnabledValues() []Enabled { - return []Enabled{False, True} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // Critical ... - Critical EventLevel = "Critical" - // Error ... - Error EventLevel = "Error" - // Informational ... - Informational EventLevel = "Informational" - // Verbose ... - Verbose EventLevel = "Verbose" - // Warning ... - Warning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{Critical, Error, Informational, Verbose, Warning} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// MetricTriggerType enumerates the values for metric trigger type. -type MetricTriggerType string - -const ( - // MetricTriggerTypeConsecutive ... - MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" - // MetricTriggerTypeTotal ... - MetricTriggerTypeTotal MetricTriggerType = "Total" -) - -// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. -func PossibleMetricTriggerTypeValues() []MetricTriggerType { - return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicAction enumerates the values for odata type basic action. -type OdataTypeBasicAction string - -const ( - // OdataTypeAction ... - OdataTypeAction OdataTypeBasicAction = "Action" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" -) - -// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. -func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} -} - -// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. -type OdataTypeBasicMetricAlertCriteria string - -const ( - // OdataTypeMetricAlertCriteria ... - OdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" - // OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... - OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. -func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { - return []OdataTypeBasicMetricAlertCriteria{OdataTypeMetricAlertCriteria, OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeRuleAction ... - OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeRuleCondition ... - OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorEquals ... - OperatorEquals Operator = "Equals" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Deploying ... - Deploying ProvisioningState = "Deploying" - // Failed ... - Failed ProvisioningState = "Failed" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Deploying, Failed, Succeeded} -} - -// QueryType enumerates the values for query type. -type QueryType string - -const ( - // ResultCount ... - ResultCount QueryType = "ResultCount" -) - -// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. -func PossibleQueryTypeValues() []QueryType { - return []QueryType{ResultCount} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // ReceiverStatusDisabled ... - ReceiverStatusDisabled ReceiverStatus = "Disabled" - // ReceiverStatusEnabled ... - ReceiverStatusEnabled ReceiverStatus = "Enabled" - // ReceiverStatusNotSpecified ... - ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // Data ... - Data ResultType = "Data" - // Metadata ... - Metadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{Data, Metadata} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ChangeCount ... - ChangeCount ScaleType = "ChangeCount" - // ExactCount ... - ExactCount ScaleType = "ExactCount" - // PercentChangeCount ... - PercentChangeCount ScaleType = "PercentChangeCount" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/eventcategories.go b/services/preview/monitor/mgmt/2018-03-01/insights/eventcategories.go deleted file mode 100644 index 86e59b424363..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/eventcategories.go +++ /dev/null @@ -1,99 +0,0 @@ -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" -) - -// EventCategoriesClient is the monitor Management Client -type EventCategoriesClient struct { - BaseClient -} - -// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. -func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { - return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { - return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available event categories supported in the Activity Logs Service.
The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "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.EventCategoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), - 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2018-03-01/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2018-03-01/insights/insightsapi/interfaces.go deleted file mode 100644 index 90e873ce9135..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,185 +0,0 @@ -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/monitor/mgmt/2018-03-01/insights" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) - List(ctx context.Context) (result insights.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) - -// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. -type DiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) -} - -var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) - -// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) -} - -var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) - -// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. -type ActivityLogAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActivityLogAlertList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActivityLogAlertList, err error) - Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch insights.ActivityLogAlertPatchBody) (result insights.ActivityLogAlertResource, err error) -} - -var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) - -// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. -type ActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result insights.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) - -// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. -type TenantActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) - -// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. -type MetricDefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string, metricnamespace string) (result insights.MetricDefinitionCollection, err error) -} - -var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) - -// MetricsClientAPI contains the set of methods on the MetricsClient type. -type MetricsClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType insights.ResultType, metricnamespace string) (result insights.Response, err error) -} - -var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - -// MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. -type MetricAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.MetricAlertResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.MetricAlertResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResourcePatch) (result insights.MetricAlertResource, err error) -} - -var _ MetricAlertsClientAPI = (*insights.MetricAlertsClient)(nil) - -// MetricAlertsStatusClientAPI contains the set of methods on the MetricAlertsStatusClient type. -type MetricAlertsStatusClientAPI interface { - List(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertStatusCollection, err error) - ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result insights.MetricAlertStatusCollection, err error) -} - -var _ MetricAlertsStatusClientAPI = (*insights.MetricAlertsStatusClient)(nil) - -// ScheduledQueryRulesClientAPI contains the set of methods on the ScheduledQueryRulesClient type. -type ScheduledQueryRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResource) (result insights.LogSearchRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.LogSearchRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result insights.LogSearchRuleResourceCollection, err error) - ListBySubscription(ctx context.Context, filter string) (result insights.LogSearchRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResourcePatch) (result insights.LogSearchRuleResource, err error) -} - -var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go deleted file mode 100644 index ad1500b87bc9..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go +++ /dev/null @@ -1,418 +0,0 @@ -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" -) - -// LogProfilesClient is the monitor Management Client -type LogProfilesClient struct { - BaseClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// Parameters: -// logProfileName - the name of the log profile. -// parameters - parameters supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) 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 the log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 LogProfilesResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// logProfileName - the name of the log profile. -// logProfilesResource - parameters supplied to the operation. -func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName, logProfilesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(logProfilesResource), - 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 LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2018-03-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go deleted file mode 100644 index 94231b6fa34e..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// MetricAlertsClient is the monitor Management Client -type MetricAlertsClient struct { - BaseClient -} - -// NewMetricAlertsClient creates an instance of the MetricAlertsClient client. -func NewMetricAlertsClient(subscriptionID string) MetricAlertsClient { - return NewMetricAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsClientWithBaseURI creates an instance of the MetricAlertsClient 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 NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsClient { - return MetricAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result MetricAlertResource, 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 alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) 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 an alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) GetResponder(resp *http.Response) (result MetricAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve alert rule definitions in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MetricAlertsClient) 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 = "2018-03-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/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieve alert rule definitions in a subscription. -func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) UpdateResponder(resp *http.Response) (result MetricAlertResource, 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/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go deleted file mode 100644 index 43cfaed42765..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// MetricAlertsStatusClient is the monitor Management Client -type MetricAlertsStatusClient struct { - BaseClient -} - -// NewMetricAlertsStatusClient creates an instance of the MetricAlertsStatusClient client. -func NewMetricAlertsStatusClient(subscriptionID string) MetricAlertsStatusClient { - return NewMetricAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsStatusClientWithBaseURI creates an instance of the MetricAlertsStatusClient 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 NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsStatusClient { - return MetricAlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "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.MetricAlertsStatusClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status", 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 MetricAlertsStatusClient) 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 MetricAlertsStatusClient) ListResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByName retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// statusName - the name of the status. -func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.ListByName") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure sending request") - return - } - - result, err = client.ListByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure responding to request") - return - } - - return -} - -// ListByNamePreparer prepares the ListByName request. -func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "statusName": autorest.Encode("path", statusName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status/{statusName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNameSender sends the ListByName request. The method will close the -// http.Response Body if it receives an error. -func (client MetricAlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNameResponder handles the response to the ListByName request. The method always -// closes the http.Response Body. -func (client MetricAlertsStatusClient) ListByNameResponder(resp *http.Response) (result MetricAlertStatusCollection, 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/monitor/mgmt/2018-03-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -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" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient 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 NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - 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: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-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("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.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, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "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.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", 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 MetricBaselineClient) 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 MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, 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/monitor/mgmt/2018-03-01/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go deleted file mode 100644 index 69fc2e0b465a..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricDefinitionsClient is the monitor Management Client -type MetricDefinitionsClient struct { - BaseClient -} - -// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. -func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { - return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient 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 NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { - return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result MetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "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.MetricDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", 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 MetricDefinitionsClient) 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 MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, 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/monitor/mgmt/2018-03-01/insights/metrics.go b/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go deleted file mode 100644 index 97687a09b498..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go +++ /dev/null @@ -1,152 +0,0 @@ -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" -) - -// MetricsClient is the monitor Management Client -type MetricsClient struct { - BaseClient -} - -// NewMetricsClient creates an instance of the MetricsClient client. -func NewMetricsClient(subscriptionID string) MetricsClient { - return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricsClientWithBaseURI creates an instance of the MetricsClient 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 NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { - return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (result Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "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.MetricsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/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 MetricsClient) 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 MetricsClient) ListResponder(resp *http.Response) (result Response, 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/monitor/mgmt/2018-03-01/insights/models.go b/services/preview/monitor/mgmt/2018-03-01/insights/models.go deleted file mode 100644 index f9cabd91d30a..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/models.go +++ /dev/null @@ -1,5204 +0,0 @@ -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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights" - -// BasicAction action descriptor. -type BasicAction interface { - AsAlertingAction() (*AlertingAction, bool) - AsLogToMetricAction() (*LogToMetricAction, bool) - AsAction() (*Action, bool) -} - -// Action action descriptor. -type Action struct { - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicAction(body []byte) (BasicAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): - var aa AlertingAction - err := json.Unmarshal(body, &aa) - return aa, err - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): - var ltma LogToMetricAction - err := json.Unmarshal(body, <ma) - return ltma, err - default: - var a Action - err := json.Unmarshal(body, &a) - return a, err - } -} -func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - aArray := make([]BasicAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - a, err := unmarshalBasicAction(*rawMessage) - if err != nil { - return nil, err - } - aArray[index] = a - } - return aArray, nil -} - -// MarshalJSON is the custom marshaler for Action. -func (a Action) MarshalJSON() ([]byte, error) { - a.OdataType = OdataTypeAction - objectMap := make(map[string]interface{}) - if a.OdataType != "" { - objectMap["odata.type"] = a.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for Action. -func (a Action) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for Action. -func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for Action. -func (a Action) AsAction() (*Action, bool) { - return &a, true -} - -// AsBasicAction is the BasicAction implementation for Action. -func (a Action) AsBasicAction() (BasicAction, bool) { - return &a, true -} - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) 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 - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `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 ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) 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 actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActivityLogAlert an Azure activity log alert. -type ActivityLogAlert struct { - // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. - Scopes *[]string `json:"scopes,omitempty"` - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` - // Condition - The condition that will cause this alert to activate. - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - // Actions - The actions that will activate when the condition is met. - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - // Description - A description of this activity log alert. - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - // ActionGroupID - The resourceId of the action group. This cannot be null or empty. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string `json:"webhookProperties"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. -func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alaag.ActionGroupID != nil { - objectMap["actionGroupId"] = alaag.ActionGroupID - } - if alaag.WebhookProperties != nil { - objectMap["webhookProperties"] = alaag.WebhookProperties - } - return json.Marshal(objectMap) -} - -// ActivityLogAlertActionList a list of activity log alert actions. -type ActivityLogAlertActionList struct { - // ActionGroups - The list of activity log alerts. - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member -// conditions are met. -type ActivityLogAlertAllOfCondition struct { - // AllOf - The list of activity log alert conditions. - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log -// field and value. -type ActivityLogAlertLeafCondition struct { - // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. - Field *string `json:"field,omitempty"` - // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - // Value - The list of activity log alerts. - Value *[]ActivityLogAlertResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityLogAlertPatch an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. -type ActivityLogAlertPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActivityLogAlertPatch - The activity log alert settings for an update operation. - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. -func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alapb.Tags != nil { - objectMap["tags"] = alapb.Tags - } - if alapb.ActivityLogAlertPatch != nil { - objectMap["properties"] = alapb.ActivityLogAlertPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. -func (alapb *ActivityLogAlertPatchBody) 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 - } - alapb.Tags = tags - } - case "properties": - if v != nil { - var activityLogAlertPatch ActivityLogAlertPatch - err = json.Unmarshal(*v, &activityLogAlertPatch) - if err != nil { - return err - } - alapb.ActivityLogAlertPatch = &activityLogAlertPatch - } - } - } - - return nil -} - -// ActivityLogAlertResource an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `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 ActivityLogAlertResource. -func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alar.ActivityLogAlert != nil { - objectMap["properties"] = alar.ActivityLogAlert - } - if alar.Location != nil { - objectMap["location"] = alar.Location - } - if alar.Tags != nil { - objectMap["tags"] = alar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) 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 activityLogAlert ActivityLogAlert - err = json.Unmarshal(*v, &activityLogAlert) - if err != nil { - return err - } - alar.ActivityLogAlert = &activityLogAlert - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - alar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - alar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - alar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alar.Tags = tags - } - } - } - - return nil -} - -// AlertingAction specify action need to be taken when rule type is Alert -type AlertingAction struct { - // Severity - Severity of the alert. Possible values include: 'Zero', 'One', 'Two', 'Three', 'Four' - Severity AlertSeverity `json:"severity,omitempty"` - // AznsAction - Azure action group reference. - AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` - // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. - ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` - // Trigger - The trigger condition that results in the alert rule being. - Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertingAction. -func (aa AlertingAction) MarshalJSON() ([]byte, error) { - aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction - objectMap := make(map[string]interface{}) - if aa.Severity != "" { - objectMap["severity"] = aa.Severity - } - if aa.AznsAction != nil { - objectMap["aznsAction"] = aa.AznsAction - } - if aa.ThrottlingInMin != nil { - objectMap["throttlingInMin"] = aa.ThrottlingInMin - } - if aa.Trigger != nil { - objectMap["trigger"] = aa.Trigger - } - if aa.OdataType != "" { - objectMap["odata.type"] = aa.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { - return &aa, true -} - -// AsLogToMetricAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { - return &aa, true -} - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) 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 - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `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 AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) 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 alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) 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 - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `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 AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) 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 autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) - if err != nil { - return err - } - page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) 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 - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzNsActionGroup azure action group -type AzNsActionGroup struct { - // ActionGroup - Azure Action Group reference. - ActionGroup *[]string `json:"actionGroup,omitempty"` - // EmailSubject - Custom subject override for all email ids in Azure action group - EmailSubject *string `json:"emailSubject,omitempty"` - // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group - CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` -} - -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) 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 - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - -// Criteria specifies the criteria for converting log to metric. -type Criteria struct { - // MetricName - Name of the metric - MetricName *string `json:"metricName,omitempty"` - // Dimensions - List of Dimensions for creating metric - Dimensions *[]Dimension `json:"dimensions,omitempty"` -} - -// DiagnosticSettings the diagnostic settings. -type DiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// DiagnosticSettingsCategory the diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' - CategoryType CategoryType `json:"categoryType,omitempty"` -} - -// DiagnosticSettingsCategoryResource the diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` - // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. - *DiagnosticSettingsCategory `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. -func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dscr.DiagnosticSettingsCategory != nil { - objectMap["properties"] = dscr.DiagnosticSettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. -func (dscr *DiagnosticSettingsCategoryResource) 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 diagnosticSettingsCategory DiagnosticSettingsCategory - err = json.Unmarshal(*v, &diagnosticSettingsCategory) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dscr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category -// resources. -type DiagnosticSettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` -} - -// DiagnosticSettingsResource the diagnostic setting resource. -type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // DiagnosticSettings - Properties of a Diagnostic Settings Resource. - *DiagnosticSettings `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. -func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DiagnosticSettings != nil { - objectMap["properties"] = dsr.DiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. -func (dsr *DiagnosticSettingsResource) 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 diagnosticSettings DiagnosticSettings - err = json.Unmarshal(*v, &diagnosticSettings) - if err != nil { - return err - } - dsr.DiagnosticSettings = &diagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]DiagnosticSettingsResource `json:"value,omitempty"` -} - -// Dimension specifies the criteria for converting log to metric. -type Dimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // Operator - Operator for dimension values - Operator *string `json:"operator,omitempty"` - // Values - List of dimension values - Values *[]string `json:"values,omitempty"` -} - -// DynamicMetricCriteria criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' - Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'Low', 'Medium', 'High' - AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` - // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` - // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) - IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - dmc.CriterionType = CriterionTypeDynamicThresholdCriterion - objectMap := make(map[string]interface{}) - if dmc.Operator != "" { - objectMap["operator"] = dmc.Operator - } - if dmc.AlertSensitivity != "" { - objectMap["alertSensitivity"] = dmc.AlertSensitivity - } - if dmc.FailingPeriods != nil { - objectMap["failingPeriods"] = dmc.FailingPeriods - } - if dmc.IgnoreDataBefore != nil { - objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore - } - if dmc.Name != nil { - objectMap["name"] = dmc.Name - } - if dmc.MetricName != nil { - objectMap["metricName"] = dmc.MetricName - } - if dmc.MetricNamespace != nil { - objectMap["metricNamespace"] = dmc.MetricNamespace - } - if dmc.TimeAggregation != nil { - objectMap["timeAggregation"] = dmc.TimeAggregation - } - if dmc.Dimensions != nil { - objectMap["dimensions"] = dmc.Dimensions - } - if dmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = dmc.SkipMetricValidation - } - if dmc.CriterionType != "" { - objectMap["criterionType"] = dmc.CriterionType - } - for k, v := range dmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return &dmc, true -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &dmc, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. -func (dmc *DynamicMetricCriteria) 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 "operator": - if v != nil { - var operator DynamicThresholdOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - dmc.Operator = operator - } - case "alertSensitivity": - if v != nil { - var alertSensitivity DynamicThresholdSensitivity - err = json.Unmarshal(*v, &alertSensitivity) - if err != nil { - return err - } - dmc.AlertSensitivity = alertSensitivity - } - case "failingPeriods": - if v != nil { - var failingPeriods DynamicThresholdFailingPeriods - err = json.Unmarshal(*v, &failingPeriods) - if err != nil { - return err - } - dmc.FailingPeriods = &failingPeriods - } - case "ignoreDataBefore": - if v != nil { - var ignoreDataBefore date.Time - err = json.Unmarshal(*v, &ignoreDataBefore) - if err != nil { - return err - } - dmc.IgnoreDataBefore = &ignoreDataBefore - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if dmc.AdditionalProperties == nil { - dmc.AdditionalProperties = make(map[string]interface{}) - } - dmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - dmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - dmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - dmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - dmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - dmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - dmc.CriterionType = criterionType - } - } - } - - return nil -} - -// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback -// time window required to raise an alert. -type DynamicThresholdFailingPeriods struct { - // NumberOfEvaluationPeriods - The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. - NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` - // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// 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"` -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// EventData the Azure event log entries are of type EventData -type EventData struct { - // Authorization - READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization `json:"authorization,omitempty"` - // Claims - READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string `json:"claims"` - // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string `json:"caller,omitempty"` - // Description - READ-ONLY; the description of the event. - Description *string `json:"description,omitempty"` - // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string `json:"id,omitempty"` - // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string `json:"eventDataId,omitempty"` - // CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. - CorrelationID *string `json:"correlationId,omitempty"` - // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. - EventName *LocalizableString `json:"eventName,omitempty"` - // Category - READ-ONLY; the event category. - Category *LocalizableString `json:"category,omitempty"` - // HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). - HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` - // Level - READ-ONLY; the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' - Level EventLevel `json:"level,omitempty"` - // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` - // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - READ-ONLY; the resource type - ResourceType *LocalizableString `json:"resourceType,omitempty"` - // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. - OperationID *string `json:"operationId,omitempty"` - // OperationName - READ-ONLY; the operation name. - OperationName *LocalizableString `json:"operationName,omitempty"` - // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string `json:"properties"` - // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - Status *LocalizableString `json:"status,omitempty"` - // SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) - SubStatus *LocalizableString `json:"subStatus,omitempty"` - // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. - EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` - // SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. - SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` - // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // TenantID - READ-ONLY; the Azure tenant Id - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventData. -func (ed EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EventDataCollection represents collection of events. -type EventDataCollection struct { - autorest.Response `json:"-"` - // Value - this list that includes the Azure audit logs. - Value *[]EventData `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventDataCollectionIterator provides access to a complete listing of EventData values. -type EventDataCollectionIterator struct { - i int - page EventDataCollectionPage -} - -// 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 *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.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 *EventDataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventDataCollectionIterator) 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 EventDataCollectionIterator) Response() EventDataCollection { - 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 EventDataCollectionIterator) Value() EventData { - if !iter.page.NotDone() { - return EventData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventDataCollectionIterator type. -func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { - return EventDataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edc EventDataCollection) IsEmpty() bool { - return edc.Value == nil || len(*edc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edc EventDataCollection) hasNextLink() bool { - return edc.NextLink != nil && len(*edc.NextLink) != 0 -} - -// eventDataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !edc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edc.NextLink))) -} - -// EventDataCollectionPage contains a page of EventData values. -type EventDataCollectionPage struct { - fn func(context.Context, EventDataCollection) (EventDataCollection, error) - edc EventDataCollection -} - -// 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 *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.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.edc) - if err != nil { - return err - } - page.edc = 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 *EventDataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventDataCollectionPage) NotDone() bool { - return !page.edc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventDataCollectionPage) Response() EventDataCollection { - return page.edc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventDataCollectionPage) Values() []EventData { - if page.edc.IsEmpty() { - return nil - } - return *page.edc.Value -} - -// Creates a new instance of the EventDataCollectionPage type. -func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { - return EventDataCollectionPage{ - fn: getNextPage, - edc: cur, - } -} - -// HTTPRequestInfo the Http request info. -type HTTPRequestInfo struct { - // ClientRequestID - the client request id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ClientIPAddress - the client Ip Address - ClientIPAddress *string `json:"clientIpAddress,omitempty"` - // Method - the Http request method. - Method *string `json:"method,omitempty"` - // URI - the Uri. - URI *string `json:"uri,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) 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 "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` -} - -// LogMetricTrigger a log metrics trigger descriptor. -type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - The threshold of the metric trigger. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' - MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` - // MetricColumn - Evaluation of metric on a particular column - MetricColumn *string `json:"metricColumn,omitempty"` -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `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 LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) 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 logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) 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 - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// LogSearchRule log Search Rule Definition -type LogSearchRule struct { - // Description - The description of the Log Search rule. - Description *string `json:"description,omitempty"` - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Source - Data Source against which rule will Query Data - Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule *Schedule `json:"schedule,omitempty"` - // Action - Action needs to be taken on rule execution. - Action BasicAction `json:"action,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRule. -func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsr.Description != nil { - objectMap["description"] = lsr.Description - } - if lsr.Enabled != "" { - objectMap["enabled"] = lsr.Enabled - } - if lsr.Source != nil { - objectMap["source"] = lsr.Source - } - if lsr.Schedule != nil { - objectMap["schedule"] = lsr.Schedule - } - objectMap["action"] = lsr.Action - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. -func (lsr *LogSearchRule) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - lsr.Description = &description - } - case "enabled": - if v != nil { - var enabled Enabled - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - lsr.Enabled = enabled - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - lsr.LastUpdatedTime = &lastUpdatedTime - } - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - lsr.ProvisioningState = provisioningState - } - case "source": - if v != nil { - var source Source - err = json.Unmarshal(*v, &source) - if err != nil { - return err - } - lsr.Source = &source - } - case "schedule": - if v != nil { - var schedule Schedule - err = json.Unmarshal(*v, &schedule) - if err != nil { - return err - } - lsr.Schedule = &schedule - } - case "action": - if v != nil { - action, err := unmarshalBasicAction(*v) - if err != nil { - return err - } - lsr.Action = action - } - } - } - - return nil -} - -// LogSearchRulePatch log Search Rule Definition for Patching -type LogSearchRulePatch struct { - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` -} - -// LogSearchRuleResource the Log Search Rule resource. -type LogSearchRuleResource struct { - autorest.Response `json:"-"` - // LogSearchRule - The rule properties of the resource. - *LogSearchRule `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 LogSearchRuleResource. -func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrr.LogSearchRule != nil { - objectMap["properties"] = lsrr.LogSearchRule - } - if lsrr.Location != nil { - objectMap["location"] = lsrr.Location - } - if lsrr.Tags != nil { - objectMap["tags"] = lsrr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. -func (lsrr *LogSearchRuleResource) 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 logSearchRule LogSearchRule - err = json.Unmarshal(*v, &logSearchRule) - if err != nil { - return err - } - lsrr.LogSearchRule = &logSearchRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lsrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lsrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lsrr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lsrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lsrr.Tags = tags - } - } - } - - return nil -} - -// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. -type LogSearchRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the Log Search Rule resources. - Value *[]LogSearchRuleResource `json:"value,omitempty"` -} - -// LogSearchRuleResourcePatch the log search rule resource for patch operations. -type LogSearchRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogSearchRulePatch - The log search rule properties of the resource. - *LogSearchRulePatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. -func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrrp.Tags != nil { - objectMap["tags"] = lsrrp.Tags - } - if lsrrp.LogSearchRulePatch != nil { - objectMap["properties"] = lsrrp.LogSearchRulePatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. -func (lsrrp *LogSearchRuleResourcePatch) 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 - } - lsrrp.Tags = tags - } - case "properties": - if v != nil { - var logSearchRulePatch LogSearchRulePatch - err = json.Unmarshal(*v, &logSearchRulePatch) - if err != nil { - return err - } - lsrrp.LogSearchRulePatch = &logSearchRulePatch - } - } - } - - return nil -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogToMetricAction specify action need to be taken when rule type is converting log to metric -type LogToMetricAction struct { - // Criteria - Criteria of Metric - Criteria *[]Criteria `json:"criteria,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogToMetricAction. -func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { - ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction - objectMap := make(map[string]interface{}) - if ltma.Criteria != nil { - objectMap["criteria"] = ltma.Criteria - } - if ltma.OdataType != "" { - objectMap["odata.type"] = ltma.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return <ma, true -} - -// AsAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { - return <ma, true -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) 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 "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// MetricAlertAction an alert action. -type MetricAlertAction struct { - // ActionGroupID - the id of the action group to use. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. - WebHookProperties map[string]*string `json:"webHookProperties"` -} - -// MarshalJSON is the custom marshaler for MetricAlertAction. -func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if maa.ActionGroupID != nil { - objectMap["actionGroupId"] = maa.ActionGroupID - } - if maa.WebHookProperties != nil { - objectMap["webHookProperties"] = maa.WebHookProperties - } - return json.Marshal(objectMap) -} - -// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type BasicMetricAlertCriteria interface { - AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) - AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) - AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) - AsMetricAlertCriteria() (*MetricAlertCriteria, bool) -} - -// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - var masrmmc MetricAlertSingleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &masrmmc) - return masrmmc, err - case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - var wlac WebtestLocationAvailabilityCriteria - err := json.Unmarshal(body, &wlac) - return wlac, err - case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &mamrmmc) - return mamrmmc, err - default: - var mac MetricAlertCriteria - err := json.Unmarshal(body, &mac) - return mac, err - } -} -func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) - if err != nil { - return nil, err - } - macArray[index] = mac - } - return macArray, nil -} - -// MarshalJSON is the custom marshaler for MetricAlertCriteria. -func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { - mac.OdataType = OdataTypeMetricAlertCriteria - objectMap := make(map[string]interface{}) - if mac.OdataType != "" { - objectMap["odata.type"] = mac.OdataType - } - for k, v := range mac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return &mac, true -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mac, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. -func (mac *MetricAlertCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mac.AdditionalProperties == nil { - mac.AdditionalProperties = make(map[string]interface{}) - } - mac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mac.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple -// resource that has multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // AllOf - the list of multiple metric criteria for this 'all of' operation. - AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - mamrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if mamrmmc.AllOf != nil { - objectMap["allOf"] = mamrmmc.AllOf - } - if mamrmmc.OdataType != "" { - objectMap["odata.type"] = mamrmmc.OdataType - } - for k, v := range mamrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return &mamrmmc, true -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mamrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. -func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) - if err != nil { - return err - } - mamrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mamrmmc.AdditionalProperties == nil { - mamrmmc.AdditionalProperties = make(map[string]interface{}) - } - mamrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mamrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertProperties an alert rule. -type MetricAlertProperties struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertProperties. -func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapVar.Description != nil { - objectMap["description"] = mapVar.Description - } - if mapVar.Severity != nil { - objectMap["severity"] = mapVar.Severity - } - if mapVar.Enabled != nil { - objectMap["enabled"] = mapVar.Enabled - } - if mapVar.Scopes != nil { - objectMap["scopes"] = mapVar.Scopes - } - if mapVar.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency - } - if mapVar.WindowSize != nil { - objectMap["windowSize"] = mapVar.WindowSize - } - if mapVar.TargetResourceType != nil { - objectMap["targetResourceType"] = mapVar.TargetResourceType - } - if mapVar.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion - } - objectMap["criteria"] = mapVar.Criteria - if mapVar.AutoMitigate != nil { - objectMap["autoMitigate"] = mapVar.AutoMitigate - } - if mapVar.Actions != nil { - objectMap["actions"] = mapVar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. -func (mapVar *MetricAlertProperties) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapVar.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapVar.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapVar.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapVar.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapVar.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapVar.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapVar.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapVar.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapVar.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapVar.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapVar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapVar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// MetricAlertResource the metric alert resource. -type MetricAlertResource struct { - autorest.Response `json:"-"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `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 MetricAlertResource. -func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mar.MetricAlertProperties != nil { - objectMap["properties"] = mar.MetricAlertProperties - } - if mar.Location != nil { - objectMap["location"] = mar.Location - } - if mar.Tags != nil { - objectMap["tags"] = mar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. -func (mar *MetricAlertResource) 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 metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - mar.MetricAlertProperties = &metricAlertProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mar.Tags = tags - } - } - } - - return nil -} - -// MetricAlertResourceCollection represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertResource `json:"value,omitempty"` -} - -// MetricAlertResourcePatch the metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. -func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if marp.Tags != nil { - objectMap["tags"] = marp.Tags - } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. -func (marp *MetricAlertResourcePatch) 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 - } - marp.Tags = tags - } - case "properties": - if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - marp.MetricAlertProperties = &metricAlertProperties - } - } - } - - return nil -} - -// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single -// resource that has multiple metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // AllOf - The list of metric criteria for this 'all of' operation. - AllOf *[]MetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if masrmmc.AllOf != nil { - objectMap["allOf"] = masrmmc.AllOf - } - if masrmmc.OdataType != "" { - objectMap["odata.type"] = masrmmc.OdataType - } - for k, v := range masrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return &masrmmc, true -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &masrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. -func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - var allOf []MetricCriteria - err = json.Unmarshal(*v, &allOf) - if err != nil { - return err - } - masrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if masrmmc.AdditionalProperties == nil { - masrmmc.AdditionalProperties = make(map[string]interface{}) - } - masrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - masrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertStatus an alert status. -type MetricAlertStatus struct { - // Name - The status name. - Name *string `json:"name,omitempty"` - // ID - The alert rule arm id. - ID *string `json:"id,omitempty"` - // Type - The extended resource type name. - Type *string `json:"type,omitempty"` - // Properties - The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties `json:"properties,omitempty"` -} - -// MetricAlertStatusCollection represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertStatus `json:"value,omitempty"` -} - -// MetricAlertStatusProperties an alert status properties. -type MetricAlertStatusProperties struct { - // Dimensions - An object describing the type of the dimensions. - Dimensions map[string]*string `json:"dimensions"` - // Status - status value - Status *string `json:"status,omitempty"` - // Timestamp - UTC time when the status was checked. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. -func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if masp.Dimensions != nil { - objectMap["dimensions"] = masp.Dimensions - } - if masp.Status != nil { - objectMap["status"] = masp.Status - } - if masp.Timestamp != nil { - objectMap["timestamp"] = masp.Timestamp - } - return json.Marshal(objectMap) -} - -// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and -// the retention period for that time grain. -type MetricAvailability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// MetricCriteria criterion to filter metrics. -type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' - Operator Operator `json:"operator,omitempty"` - // Threshold - the criteria threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricCriteria. -func (mc MetricCriteria) MarshalJSON() ([]byte, error) { - mc.CriterionType = CriterionTypeStaticThresholdCriterion - objectMap := make(map[string]interface{}) - if mc.Operator != "" { - objectMap["operator"] = mc.Operator - } - if mc.Threshold != nil { - objectMap["threshold"] = mc.Threshold - } - if mc.Name != nil { - objectMap["name"] = mc.Name - } - if mc.MetricName != nil { - objectMap["metricName"] = mc.MetricName - } - if mc.MetricNamespace != nil { - objectMap["metricNamespace"] = mc.MetricNamespace - } - if mc.TimeAggregation != nil { - objectMap["timeAggregation"] = mc.TimeAggregation - } - if mc.Dimensions != nil { - objectMap["dimensions"] = mc.Dimensions - } - if mc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mc.SkipMetricValidation - } - if mc.CriterionType != "" { - objectMap["criterionType"] = mc.CriterionType - } - for k, v := range mc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return &mc, true -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. -func (mc *MetricCriteria) 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 "operator": - if v != nil { - var operator Operator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - mc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - mc.Threshold = &threshold - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mc.AdditionalProperties == nil { - mc.AdditionalProperties = make(map[string]interface{}) - } - mc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mc.CriterionType = criterionType - } - } - } - - return nil -} - -// MetricDefinition metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// MetricDefinitionCollection represents collection of metric definitions. -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricDimension specifies a metric dimension. -type MetricDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string `json:"operator,omitempty"` - // Values - list of dimension values. - Values *[]string `json:"values,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` -} - -// MetricValue represents a metric value. -type MetricValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *float64 `json:"count,omitempty"` -} - -// BasicMultiMetricCriteria the types of conditions for a multi resource alert. -type BasicMultiMetricCriteria interface { - AsMetricCriteria() (*MetricCriteria, bool) - AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) - AsMultiMetricCriteria() (*MultiMetricCriteria, bool) -} - -// MultiMetricCriteria the types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["criterionType"] { - case string(CriterionTypeStaticThresholdCriterion): - var mc MetricCriteria - err := json.Unmarshal(body, &mc) - return mc, err - case string(CriterionTypeDynamicThresholdCriterion): - var dmc DynamicMetricCriteria - err := json.Unmarshal(body, &dmc) - return dmc, err - default: - var mmc MultiMetricCriteria - err := json.Unmarshal(body, &mmc) - return mmc, err - } -} -func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) - if err != nil { - return nil, err - } - mmcArray[index] = mmc - } - return mmcArray, nil -} - -// MarshalJSON is the custom marshaler for MultiMetricCriteria. -func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { - mmc.CriterionType = CriterionTypeMultiMetricCriteria - objectMap := make(map[string]interface{}) - if mmc.Name != nil { - objectMap["name"] = mmc.Name - } - if mmc.MetricName != nil { - objectMap["metricName"] = mmc.MetricName - } - if mmc.MetricNamespace != nil { - objectMap["metricNamespace"] = mmc.MetricNamespace - } - if mmc.TimeAggregation != nil { - objectMap["timeAggregation"] = mmc.TimeAggregation - } - if mmc.Dimensions != nil { - objectMap["dimensions"] = mmc.Dimensions - } - if mmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mmc.SkipMetricValidation - } - if mmc.CriterionType != "" { - objectMap["criterionType"] = mmc.CriterionType - } - for k, v := range mmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return &mmc, true -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. -func (mmc *MultiMetricCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mmc.AdditionalProperties == nil { - mmc.AdditionalProperties = make(map[string]interface{}) - } - mmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mmc.CriterionType = criterionType - } - } - } - - return nil -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Insights 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 operations supported by the Microsoft.Insights 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"` -} - -// ProxyOnlyResource a proxy only azure resource object -type ProxyOnlyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyOnlyResource. -func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource an azure resource object -type Resource 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) 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 "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. - Maximum *string `json:"maximum,omitempty"` - // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// Schedule defines how often to run the search and the time interval. -type Schedule struct { - // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. - FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` - // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` -} - -// SenderAuthorization the authorization used by the user who has performed the operation that led to this -// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and -// the 'scope' -type SenderAuthorization struct { - // Action - the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string `json:"action,omitempty"` - // Role - the role of the user. For instance: Subscription Admin - Role *string `json:"role,omitempty"` - // Scope - the scope. - Scope *string `json:"scope,omitempty"` -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// Source specifies the log search query. -type Source struct { - // Query - Log search query. Required for action type - AlertingAction - Query *string `json:"query,omitempty"` - // AuthorizedResources - List of Resource referred into query - AuthorizedResources *[]string `json:"authorizedResources,omitempty"` - // DataSourceID - The resource uri over which log search query is to be run. - DataSourceID *string `json:"dataSourceId,omitempty"` - // QueryType - Set value to 'ResultCount'. Possible values include: 'ResultCount' - QueryType QueryType `json:"queryType,omitempty"` -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) 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 "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]MetricValue `json:"data,omitempty"` -} - -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,omitempty"` -} - -// TriggerCondition the condition that results in the Log Search rule. -type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - Result or count threshold based on which rule should be triggered. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTrigger - Trigger condition for metric query rule - MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` -} - -// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // WebTestID - The Application Insights web test Id. - WebTestID *string `json:"webTestId,omitempty"` - // ComponentID - The Application Insights resource Id. - ComponentID *string `json:"componentId,omitempty"` - // FailedLocationCount - The number of failed locations. - FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - objectMap := make(map[string]interface{}) - if wlac.WebTestID != nil { - objectMap["webTestId"] = wlac.WebTestID - } - if wlac.ComponentID != nil { - objectMap["componentId"] = wlac.ComponentID - } - if wlac.FailedLocationCount != nil { - objectMap["failedLocationCount"] = wlac.FailedLocationCount - } - if wlac.OdataType != "" { - objectMap["odata.type"] = wlac.OdataType - } - for k, v := range wlac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return &wlac, true -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &wlac, true -} - -// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. -func (wlac *WebtestLocationAvailabilityCriteria) 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 "webTestId": - if v != nil { - var webTestID string - err = json.Unmarshal(*v, &webTestID) - if err != nil { - return err - } - wlac.WebTestID = &webTestID - } - case "componentId": - if v != nil { - var componentID string - err = json.Unmarshal(*v, &componentID) - if err != nil { - return err - } - wlac.ComponentID = &componentID - } - case "failedLocationCount": - if v != nil { - var failedLocationCount float64 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - wlac.FailedLocationCount = &failedLocationCount - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if wlac.AdditionalProperties == nil { - wlac.AdditionalProperties = make(map[string]interface{}) - } - wlac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - wlac.OdataType = odataType - } - } - } - - return nil -} diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/operations.go b/services/preview/monitor/mgmt/2018-03-01/insights/operations.go deleted file mode 100644 index 3f82351c7f23..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -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 monitor 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 operations from Microsoft.Insights provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-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 -} diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go deleted file mode 100644 index c9d43964ecb0..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go +++ /dev/null @@ -1,511 +0,0 @@ -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" -) - -// ScheduledQueryRulesClient is the monitor Management Client -type ScheduledQueryRulesClient struct { - BaseClient -} - -// NewScheduledQueryRulesClient creates an instance of the ScheduledQueryRulesClient client. -func NewScheduledQueryRulesClient(subscriptionID string) ScheduledQueryRulesClient { - return NewScheduledQueryRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduledQueryRulesClientWithBaseURI creates an instance of the ScheduledQueryRulesClient 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 NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID string) ScheduledQueryRulesClient { - return ScheduledQueryRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an log search rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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 a Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) 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 Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) GetResponder(resp *http.Response) (result LogSearchRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the Log Search rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the Log Search rules within a subscription group. -// Parameters: -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update log search Rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) UpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go deleted file mode 100644 index 7501f047bb38..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go +++ /dev/null @@ -1,168 +0,0 @@ -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" -) - -// TenantActivityLogsClient is the monitor Management Client -type TenantActivityLogsClient struct { - BaseClient -} - -// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. -func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { - return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient 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 NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { - return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for -// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that -// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that -// were generated at the tenant level. -// Parameters: -// filter - reduces the set of data collected.
The **$filter** is very restricted and allows only the -// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq -// ''.
- List events for resource: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq -// ''.
- List events for a subscription: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation'.
- List events for a resource -// provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq -// 'Admin, Operation' and resourceProvider eq ''.
- List events for a correlation Id: -// api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq -// ''.
**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), - 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 TenantActivityLogsClient) 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 TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/version.go b/services/preview/monitor/mgmt/2018-03-01/insights/version.go deleted file mode 100644 index f18278031f76..000000000000 --- a/services/preview/monitor/mgmt/2018-03-01/insights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -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/2018-03-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json b/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json deleted file mode 100644 index 481c5b77032a..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2018-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-2018-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go deleted file mode 100644 index 20bdb629e8c1..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go +++ /dev/null @@ -1,581 +0,0 @@ -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" -) - -// ActionGroupsClient is the monitor Management Client -type ActionGroupsClient struct { - BaseClient -} - -// NewActionGroupsClient creates an instance of the ActionGroupsClient client. -func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { - return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { - return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new action group or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroup - the action group to create or use for the update. -func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: actionGroup, - Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, - {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroup), - 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 ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) 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 -} - -// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. -// This operation is only supported for Email or SMS receivers. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// enableRequest - the receiver to re-enable. -func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) - } - - req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") - return - } - - resp, err := client.EnableReceiverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") - return - } - - result, err = client.EnableReceiverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") - return - } - - return -} - -// EnableReceiverPreparer prepares the EnableReceiver request. -func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}/subscribe", pathParameters), - autorest.WithJSON(enableRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableReceiverSender sends the EnableReceiver request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableReceiverResponder handles the response to the EnableReceiver request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all action groups in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActionGroupsClient) 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 = "2018-09-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/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all action groups in a subscription. -func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, 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 action group's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroupPatch - parameters supplied to the operation. -func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName, actionGroupPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroupPatch), - 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 ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2018-09-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2018-09-01/insights/activitylogalerts.go deleted file mode 100644 index 44aaf3ef1e4a..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/activitylogalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// ActivityLogAlertsClient is the monitor Management Client -type ActivityLogAlertsClient struct { - BaseClient -} - -// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient 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 NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new activity log alert or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlert - the activity log alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all activity log alerts in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) 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 = "2017-04-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/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all activity log alerts in a subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, 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 ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlertPatch - parameters supplied to the operation. -func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName, activityLogAlertPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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/monitor/mgmt/2018-09-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2018-09-01/insights/activitylogs.go deleted file mode 100644 index 16dd215e6ad9..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/activitylogs.go +++ /dev/null @@ -1,166 +0,0 @@ -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" -) - -// ActivityLogsClient is the monitor Management Client -type ActivityLogsClient struct { - BaseClient -} - -// NewActivityLogsClient creates an instance of the ActivityLogsClient client. -func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { - return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient 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 NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { - return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides the list of records from the activity logs. -// Parameters: -// filter - reduces the set of data collected.
This argument is required and it also requires at least the -// start date/time.
The **$filter** argument is very restricted and allows only the following patterns.
- -// *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and -// eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
- *List -// events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a subscription in a -// time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq -// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq -// 'correlationID'.

**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go deleted file mode 100644 index c3bf26828d8e..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// AlertRuleIncidentsClient is the monitor Management Client -type AlertRuleIncidentsClient struct { - BaseClient -} - -// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// incidentName - the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "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.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) 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 -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - return - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2018-09-01/insights/alertrules.go b/services/preview/monitor/mgmt/2018-09-01/insights/alertrules.go deleted file mode 100644 index f5a2ab682384..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/alertrules.go +++ /dev/null @@ -1,495 +0,0 @@ -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" -) - -// AlertRulesClient is the monitor Management Client -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 a classic metric alert rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 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 AlertRuleResource, 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName 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) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, 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) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 AlertRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the classic metric alert rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) 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 = "2016-03-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/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the classic metric alert rules within a subscription. -func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// alertRulesResource - parameters supplied to the operation. -func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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, ruleName, alertRulesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(alertRulesResource), - 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 AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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/monitor/mgmt/2018-09-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2018-09-01/insights/autoscalesettings.go deleted file mode 100644 index 86f253d0fb89..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/autoscalesettings.go +++ /dev/null @@ -1,580 +0,0 @@ -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" -) - -// AutoscaleSettingsClient is the monitor Management Client -type AutoscaleSettingsClient struct { - BaseClient -} - -// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// parameters - parameters supplied to the operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) 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-04-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/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 the autoscale settings for a subscription -func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// autoscaleSettingResource - parameters supplied to the operation. -func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName, autoscaleSettingResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(autoscaleSettingResource), - 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2018-09-01/insights/client.go b/services/preview/monitor/mgmt/2018-09-01/insights/client.go deleted file mode 100644 index a777181b0785..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package insights implements the Azure ARM Insights service API version . -// -// Monitor 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/monitor/mgmt/2018-09-01/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettings.go deleted file mode 100644 index 9708c52c2499..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettings.go +++ /dev/null @@ -1,332 +0,0 @@ -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" -) - -// DiagnosticSettingsClient is the monitor Management Client -type DiagnosticSettingsClient struct { - BaseClient -} - -// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. -func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { - return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient 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 NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { - return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, resourceURI, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-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("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) 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 active diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 active diagnostic settings list for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", 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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, 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/monitor/mgmt/2018-09-01/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettingscategory.go deleted file mode 100644 index 48365ed67e65..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/diagnosticsettingscategory.go +++ /dev/null @@ -1,180 +0,0 @@ -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" -) - -// DiagnosticSettingsCategoryClient is the monitor Management Client -type DiagnosticSettingsCategoryClient struct { - BaseClient -} - -// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. -func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { - return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient 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 NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { - return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, 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/monitor/mgmt/2018-09-01/insights/enums.go b/services/preview/monitor/mgmt/2018-09-01/insights/enums.go deleted file mode 100644 index 1bab3243cf63..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/enums.go +++ /dev/null @@ -1,596 +0,0 @@ -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. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // Average ... - Average AggregationType = "Average" - // Count ... - Count AggregationType = "Count" - // Maximum ... - Maximum AggregationType = "Maximum" - // Minimum ... - Minimum AggregationType = "Minimum" - // None ... - None AggregationType = "None" - // Total ... - Total AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{Average, Count, Maximum, Minimum, None, Total} -} - -// AlertSeverity enumerates the values for alert severity. -type AlertSeverity string - -const ( - // Four ... - Four AlertSeverity = "4" - // One ... - One AlertSeverity = "1" - // Three ... - Three AlertSeverity = "3" - // Two ... - Two AlertSeverity = "2" - // Zero ... - Zero AlertSeverity = "0" -) - -// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. -func PossibleAlertSeverityValues() []AlertSeverity { - return []AlertSeverity{Four, One, Three, Two, Zero} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // Logs ... - Logs CategoryType = "Logs" - // Metrics ... - Metrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{Logs, Metrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // Equals ... - Equals ComparisonOperationType = "Equals" - // GreaterThan ... - GreaterThan ComparisonOperationType = "GreaterThan" - // GreaterThanOrEqual ... - GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // LessThan ... - LessThan ComparisonOperationType = "LessThan" - // LessThanOrEqual ... - LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // NotEquals ... - NotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} -} - -// ConditionalOperator enumerates the values for conditional operator. -type ConditionalOperator string - -const ( - // ConditionalOperatorEqual ... - ConditionalOperatorEqual ConditionalOperator = "Equal" - // ConditionalOperatorGreaterThan ... - ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" - // ConditionalOperatorLessThan ... - ConditionalOperatorLessThan ConditionalOperator = "LessThan" -) - -// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. -func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} -} - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// CriterionType enumerates the values for criterion type. -type CriterionType string - -const ( - // CriterionTypeDynamicThresholdCriterion ... - CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - // CriterionTypeMultiMetricCriteria ... - CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" - // CriterionTypeStaticThresholdCriterion ... - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" -) - -// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. -func PossibleCriterionTypeValues() []CriterionType { - return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} -} - -// DynamicThresholdOperator enumerates the values for dynamic threshold operator. -type DynamicThresholdOperator string - -const ( - // DynamicThresholdOperatorGreaterOrLessThan ... - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - // DynamicThresholdOperatorGreaterThan ... - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - // DynamicThresholdOperatorLessThan ... - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} -} - -// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. -type DynamicThresholdSensitivity string - -const ( - // High ... - High DynamicThresholdSensitivity = "High" - // Low ... - Low DynamicThresholdSensitivity = "Low" - // Medium ... - Medium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{High, Low, Medium} -} - -// Enabled enumerates the values for enabled. -type Enabled string - -const ( - // False ... - False Enabled = "false" - // True ... - True Enabled = "true" -) - -// PossibleEnabledValues returns an array of possible values for the Enabled const type. -func PossibleEnabledValues() []Enabled { - return []Enabled{False, True} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // Critical ... - Critical EventLevel = "Critical" - // Error ... - Error EventLevel = "Error" - // Informational ... - Informational EventLevel = "Informational" - // Verbose ... - Verbose EventLevel = "Verbose" - // Warning ... - Warning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{Critical, Error, Informational, Verbose, Warning} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// MetricTriggerType enumerates the values for metric trigger type. -type MetricTriggerType string - -const ( - // MetricTriggerTypeConsecutive ... - MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" - // MetricTriggerTypeTotal ... - MetricTriggerTypeTotal MetricTriggerType = "Total" -) - -// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. -func PossibleMetricTriggerTypeValues() []MetricTriggerType { - return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicAction enumerates the values for odata type basic action. -type OdataTypeBasicAction string - -const ( - // OdataTypeAction ... - OdataTypeAction OdataTypeBasicAction = "Action" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" -) - -// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. -func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} -} - -// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. -type OdataTypeBasicMetricAlertCriteria string - -const ( - // OdataTypeMetricAlertCriteria ... - OdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" - // OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... - OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. -func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { - return []OdataTypeBasicMetricAlertCriteria{OdataTypeMetricAlertCriteria, OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeRuleAction ... - OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeRuleCondition ... - OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorEquals ... - OperatorEquals Operator = "Equals" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Deploying ... - Deploying ProvisioningState = "Deploying" - // Failed ... - Failed ProvisioningState = "Failed" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Deploying, Failed, Succeeded} -} - -// QueryType enumerates the values for query type. -type QueryType string - -const ( - // ResultCount ... - ResultCount QueryType = "ResultCount" -) - -// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. -func PossibleQueryTypeValues() []QueryType { - return []QueryType{ResultCount} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // ReceiverStatusDisabled ... - ReceiverStatusDisabled ReceiverStatus = "Disabled" - // ReceiverStatusEnabled ... - ReceiverStatusEnabled ReceiverStatus = "Enabled" - // ReceiverStatusNotSpecified ... - ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // Data ... - Data ResultType = "Data" - // Metadata ... - Metadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{Data, Metadata} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ChangeCount ... - ChangeCount ScaleType = "ChangeCount" - // ExactCount ... - ExactCount ScaleType = "ExactCount" - // PercentChangeCount ... - PercentChangeCount ScaleType = "PercentChangeCount" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/eventcategories.go b/services/preview/monitor/mgmt/2018-09-01/insights/eventcategories.go deleted file mode 100644 index 86e59b424363..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/eventcategories.go +++ /dev/null @@ -1,99 +0,0 @@ -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" -) - -// EventCategoriesClient is the monitor Management Client -type EventCategoriesClient struct { - BaseClient -} - -// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. -func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { - return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { - return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available event categories supported in the Activity Logs Service.
The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "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.EventCategoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), - 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go deleted file mode 100644 index 84152c80c3ca..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,192 +0,0 @@ -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/monitor/mgmt/2018-09-01/insights" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) - List(ctx context.Context) (result insights.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) - -// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. -type DiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) -} - -var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) - -// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) -} - -var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) - -// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. -type ActivityLogAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActivityLogAlertList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActivityLogAlertList, err error) - Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch insights.ActivityLogAlertPatchBody) (result insights.ActivityLogAlertResource, err error) -} - -var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) - -// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. -type ActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result insights.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) - -// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. -type TenantActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) - -// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. -type MetricDefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string, metricnamespace string) (result insights.MetricDefinitionCollection, err error) -} - -var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) - -// MetricsClientAPI contains the set of methods on the MetricsClient type. -type MetricsClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType insights.ResultType, metricnamespace string) (result insights.Response, err error) -} - -var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - -// MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. -type MetricAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.MetricAlertResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.MetricAlertResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResourcePatch) (result insights.MetricAlertResource, err error) -} - -var _ MetricAlertsClientAPI = (*insights.MetricAlertsClient)(nil) - -// MetricAlertsStatusClientAPI contains the set of methods on the MetricAlertsStatusClient type. -type MetricAlertsStatusClientAPI interface { - List(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertStatusCollection, err error) - ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result insights.MetricAlertStatusCollection, err error) -} - -var _ MetricAlertsStatusClientAPI = (*insights.MetricAlertsStatusClient)(nil) - -// ScheduledQueryRulesClientAPI contains the set of methods on the ScheduledQueryRulesClient type. -type ScheduledQueryRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResource) (result insights.LogSearchRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.LogSearchRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result insights.LogSearchRuleResourceCollection, err error) - ListBySubscription(ctx context.Context, filter string) (result insights.LogSearchRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResourcePatch) (result insights.LogSearchRuleResource, err error) -} - -var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) - -// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. -type MetricNamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) -} - -var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go deleted file mode 100644 index ad1500b87bc9..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go +++ /dev/null @@ -1,418 +0,0 @@ -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" -) - -// LogProfilesClient is the monitor Management Client -type LogProfilesClient struct { - BaseClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// Parameters: -// logProfileName - the name of the log profile. -// parameters - parameters supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) 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 the log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 LogProfilesResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// logProfileName - the name of the log profile. -// logProfilesResource - parameters supplied to the operation. -func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName, logProfilesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(logProfilesResource), - 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 LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2018-09-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricalerts.go deleted file mode 100644 index 94231b6fa34e..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// MetricAlertsClient is the monitor Management Client -type MetricAlertsClient struct { - BaseClient -} - -// NewMetricAlertsClient creates an instance of the MetricAlertsClient client. -func NewMetricAlertsClient(subscriptionID string) MetricAlertsClient { - return NewMetricAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsClientWithBaseURI creates an instance of the MetricAlertsClient 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 NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsClient { - return MetricAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result MetricAlertResource, 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 alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) 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 an alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) GetResponder(resp *http.Response) (result MetricAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve alert rule definitions in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MetricAlertsClient) 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 = "2018-03-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/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieve alert rule definitions in a subscription. -func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) UpdateResponder(resp *http.Response) (result MetricAlertResource, 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/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go deleted file mode 100644 index 43cfaed42765..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// MetricAlertsStatusClient is the monitor Management Client -type MetricAlertsStatusClient struct { - BaseClient -} - -// NewMetricAlertsStatusClient creates an instance of the MetricAlertsStatusClient client. -func NewMetricAlertsStatusClient(subscriptionID string) MetricAlertsStatusClient { - return NewMetricAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsStatusClientWithBaseURI creates an instance of the MetricAlertsStatusClient 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 NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsStatusClient { - return MetricAlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "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.MetricAlertsStatusClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status", 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 MetricAlertsStatusClient) 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 MetricAlertsStatusClient) ListResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByName retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// statusName - the name of the status. -func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.ListByName") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure sending request") - return - } - - result, err = client.ListByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure responding to request") - return - } - - return -} - -// ListByNamePreparer prepares the ListByName request. -func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "statusName": autorest.Encode("path", statusName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status/{statusName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNameSender sends the ListByName request. The method will close the -// http.Response Body if it receives an error. -func (client MetricAlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNameResponder handles the response to the ListByName request. The method always -// closes the http.Response Body. -func (client MetricAlertsStatusClient) ListByNameResponder(resp *http.Response) (result MetricAlertStatusCollection, 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/monitor/mgmt/2018-09-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -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" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient 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 NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - 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: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-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("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.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, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "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.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", 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 MetricBaselineClient) 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 MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, 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/monitor/mgmt/2018-09-01/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricdefinitions.go deleted file mode 100644 index 69fc2e0b465a..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricdefinitions.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricDefinitionsClient is the monitor Management Client -type MetricDefinitionsClient struct { - BaseClient -} - -// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. -func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { - return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient 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 NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { - return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result MetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "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.MetricDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", 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 MetricDefinitionsClient) 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 MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, 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/monitor/mgmt/2018-09-01/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricnamespaces.go deleted file mode 100644 index f2ef47baf802..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricnamespaces.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricNamespacesClient is the monitor Management Client -type MetricNamespacesClient struct { - BaseClient -} - -// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. -func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { - return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient 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 NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { - return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric namespaces for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, startTime) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "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.MetricNamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", 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 MetricNamespacesClient) 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 MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, 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/monitor/mgmt/2018-09-01/insights/metrics.go b/services/preview/monitor/mgmt/2018-09-01/insights/metrics.go deleted file mode 100644 index 97687a09b498..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metrics.go +++ /dev/null @@ -1,152 +0,0 @@ -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" -) - -// MetricsClient is the monitor Management Client -type MetricsClient struct { - BaseClient -} - -// NewMetricsClient creates an instance of the MetricsClient client. -func NewMetricsClient(subscriptionID string) MetricsClient { - return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricsClientWithBaseURI creates an instance of the MetricsClient 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 NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { - return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (result Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "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.MetricsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/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 MetricsClient) 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 MetricsClient) ListResponder(resp *http.Response) (result Response, 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/monitor/mgmt/2018-09-01/insights/models.go b/services/preview/monitor/mgmt/2018-09-01/insights/models.go deleted file mode 100644 index 9776717b154a..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/models.go +++ /dev/null @@ -1,5239 +0,0 @@ -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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-09-01/insights" - -// BasicAction action descriptor. -type BasicAction interface { - AsAlertingAction() (*AlertingAction, bool) - AsLogToMetricAction() (*LogToMetricAction, bool) - AsAction() (*Action, bool) -} - -// Action action descriptor. -type Action struct { - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicAction(body []byte) (BasicAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): - var aa AlertingAction - err := json.Unmarshal(body, &aa) - return aa, err - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): - var ltma LogToMetricAction - err := json.Unmarshal(body, <ma) - return ltma, err - default: - var a Action - err := json.Unmarshal(body, &a) - return a, err - } -} -func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - aArray := make([]BasicAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - a, err := unmarshalBasicAction(*rawMessage) - if err != nil { - return nil, err - } - aArray[index] = a - } - return aArray, nil -} - -// MarshalJSON is the custom marshaler for Action. -func (a Action) MarshalJSON() ([]byte, error) { - a.OdataType = OdataTypeAction - objectMap := make(map[string]interface{}) - if a.OdataType != "" { - objectMap["odata.type"] = a.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for Action. -func (a Action) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for Action. -func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for Action. -func (a Action) AsAction() (*Action, bool) { - return &a, true -} - -// AsBasicAction is the BasicAction implementation for Action. -func (a Action) AsBasicAction() (BasicAction, bool) { - return &a, true -} - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) 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 - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `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 ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) 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 actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActivityLogAlert an Azure activity log alert. -type ActivityLogAlert struct { - // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. - Scopes *[]string `json:"scopes,omitempty"` - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` - // Condition - The condition that will cause this alert to activate. - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - // Actions - The actions that will activate when the condition is met. - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - // Description - A description of this activity log alert. - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - // ActionGroupID - The resourceId of the action group. This cannot be null or empty. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string `json:"webhookProperties"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. -func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alaag.ActionGroupID != nil { - objectMap["actionGroupId"] = alaag.ActionGroupID - } - if alaag.WebhookProperties != nil { - objectMap["webhookProperties"] = alaag.WebhookProperties - } - return json.Marshal(objectMap) -} - -// ActivityLogAlertActionList a list of activity log alert actions. -type ActivityLogAlertActionList struct { - // ActionGroups - The list of activity log alerts. - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member -// conditions are met. -type ActivityLogAlertAllOfCondition struct { - // AllOf - The list of activity log alert conditions. - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log -// field and value. -type ActivityLogAlertLeafCondition struct { - // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. - Field *string `json:"field,omitempty"` - // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - // Value - The list of activity log alerts. - Value *[]ActivityLogAlertResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityLogAlertPatch an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. -type ActivityLogAlertPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActivityLogAlertPatch - The activity log alert settings for an update operation. - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. -func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alapb.Tags != nil { - objectMap["tags"] = alapb.Tags - } - if alapb.ActivityLogAlertPatch != nil { - objectMap["properties"] = alapb.ActivityLogAlertPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. -func (alapb *ActivityLogAlertPatchBody) 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 - } - alapb.Tags = tags - } - case "properties": - if v != nil { - var activityLogAlertPatch ActivityLogAlertPatch - err = json.Unmarshal(*v, &activityLogAlertPatch) - if err != nil { - return err - } - alapb.ActivityLogAlertPatch = &activityLogAlertPatch - } - } - } - - return nil -} - -// ActivityLogAlertResource an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `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 ActivityLogAlertResource. -func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alar.ActivityLogAlert != nil { - objectMap["properties"] = alar.ActivityLogAlert - } - if alar.Location != nil { - objectMap["location"] = alar.Location - } - if alar.Tags != nil { - objectMap["tags"] = alar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) 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 activityLogAlert ActivityLogAlert - err = json.Unmarshal(*v, &activityLogAlert) - if err != nil { - return err - } - alar.ActivityLogAlert = &activityLogAlert - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - alar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - alar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - alar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alar.Tags = tags - } - } - } - - return nil -} - -// AlertingAction specify action need to be taken when rule type is Alert -type AlertingAction struct { - // Severity - Severity of the alert. Possible values include: 'Zero', 'One', 'Two', 'Three', 'Four' - Severity AlertSeverity `json:"severity,omitempty"` - // AznsAction - Azure action group reference. - AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` - // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. - ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` - // Trigger - The trigger condition that results in the alert rule being. - Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertingAction. -func (aa AlertingAction) MarshalJSON() ([]byte, error) { - aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction - objectMap := make(map[string]interface{}) - if aa.Severity != "" { - objectMap["severity"] = aa.Severity - } - if aa.AznsAction != nil { - objectMap["aznsAction"] = aa.AznsAction - } - if aa.ThrottlingInMin != nil { - objectMap["throttlingInMin"] = aa.ThrottlingInMin - } - if aa.Trigger != nil { - objectMap["trigger"] = aa.Trigger - } - if aa.OdataType != "" { - objectMap["odata.type"] = aa.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { - return &aa, true -} - -// AsLogToMetricAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { - return &aa, true -} - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) 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 - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `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 AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) 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 alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) 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 - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// ArmRoleReceiver an arm role receiver. -type ArmRoleReceiver struct { - // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // RoleID - The arm role id. - RoleID *string `json:"roleId,omitempty"` -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `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 AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) 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 autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) - if err != nil { - return err - } - page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) 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 - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzNsActionGroup azure action group -type AzNsActionGroup struct { - // ActionGroup - Azure Action Group reference. - ActionGroup *[]string `json:"actionGroup,omitempty"` - // EmailSubject - Custom subject override for all email ids in Azure action group - EmailSubject *string `json:"emailSubject,omitempty"` - // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group - CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` -} - -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) 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 - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - -// Criteria specifies the criteria for converting log to metric. -type Criteria struct { - // MetricName - Name of the metric - MetricName *string `json:"metricName,omitempty"` - // Dimensions - List of Dimensions for creating metric - Dimensions *[]Dimension `json:"dimensions,omitempty"` -} - -// DiagnosticSettings the diagnostic settings. -type DiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// DiagnosticSettingsCategory the diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' - CategoryType CategoryType `json:"categoryType,omitempty"` -} - -// DiagnosticSettingsCategoryResource the diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` - // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. - *DiagnosticSettingsCategory `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. -func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dscr.DiagnosticSettingsCategory != nil { - objectMap["properties"] = dscr.DiagnosticSettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. -func (dscr *DiagnosticSettingsCategoryResource) 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 diagnosticSettingsCategory DiagnosticSettingsCategory - err = json.Unmarshal(*v, &diagnosticSettingsCategory) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dscr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category -// resources. -type DiagnosticSettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` -} - -// DiagnosticSettingsResource the diagnostic setting resource. -type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // DiagnosticSettings - Properties of a Diagnostic Settings Resource. - *DiagnosticSettings `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. -func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DiagnosticSettings != nil { - objectMap["properties"] = dsr.DiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. -func (dsr *DiagnosticSettingsResource) 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 diagnosticSettings DiagnosticSettings - err = json.Unmarshal(*v, &diagnosticSettings) - if err != nil { - return err - } - dsr.DiagnosticSettings = &diagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]DiagnosticSettingsResource `json:"value,omitempty"` -} - -// Dimension specifies the criteria for converting log to metric. -type Dimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // Operator - Operator for dimension values - Operator *string `json:"operator,omitempty"` - // Values - List of dimension values - Values *[]string `json:"values,omitempty"` -} - -// DynamicMetricCriteria criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' - Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'Low', 'Medium', 'High' - AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` - // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` - // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) - IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - dmc.CriterionType = CriterionTypeDynamicThresholdCriterion - objectMap := make(map[string]interface{}) - if dmc.Operator != "" { - objectMap["operator"] = dmc.Operator - } - if dmc.AlertSensitivity != "" { - objectMap["alertSensitivity"] = dmc.AlertSensitivity - } - if dmc.FailingPeriods != nil { - objectMap["failingPeriods"] = dmc.FailingPeriods - } - if dmc.IgnoreDataBefore != nil { - objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore - } - if dmc.Name != nil { - objectMap["name"] = dmc.Name - } - if dmc.MetricName != nil { - objectMap["metricName"] = dmc.MetricName - } - if dmc.MetricNamespace != nil { - objectMap["metricNamespace"] = dmc.MetricNamespace - } - if dmc.TimeAggregation != nil { - objectMap["timeAggregation"] = dmc.TimeAggregation - } - if dmc.Dimensions != nil { - objectMap["dimensions"] = dmc.Dimensions - } - if dmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = dmc.SkipMetricValidation - } - if dmc.CriterionType != "" { - objectMap["criterionType"] = dmc.CriterionType - } - for k, v := range dmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return &dmc, true -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &dmc, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. -func (dmc *DynamicMetricCriteria) 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 "operator": - if v != nil { - var operator DynamicThresholdOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - dmc.Operator = operator - } - case "alertSensitivity": - if v != nil { - var alertSensitivity DynamicThresholdSensitivity - err = json.Unmarshal(*v, &alertSensitivity) - if err != nil { - return err - } - dmc.AlertSensitivity = alertSensitivity - } - case "failingPeriods": - if v != nil { - var failingPeriods DynamicThresholdFailingPeriods - err = json.Unmarshal(*v, &failingPeriods) - if err != nil { - return err - } - dmc.FailingPeriods = &failingPeriods - } - case "ignoreDataBefore": - if v != nil { - var ignoreDataBefore date.Time - err = json.Unmarshal(*v, &ignoreDataBefore) - if err != nil { - return err - } - dmc.IgnoreDataBefore = &ignoreDataBefore - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if dmc.AdditionalProperties == nil { - dmc.AdditionalProperties = make(map[string]interface{}) - } - dmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - dmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - dmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - dmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - dmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - dmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - dmc.CriterionType = criterionType - } - } - } - - return nil -} - -// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback -// time window required to raise an alert. -type DynamicThresholdFailingPeriods struct { - // NumberOfEvaluationPeriods - The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. - NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` - // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// 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"` -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// EventData the Azure event log entries are of type EventData -type EventData struct { - // Authorization - READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization `json:"authorization,omitempty"` - // Claims - READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string `json:"claims"` - // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string `json:"caller,omitempty"` - // Description - READ-ONLY; the description of the event. - Description *string `json:"description,omitempty"` - // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string `json:"id,omitempty"` - // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string `json:"eventDataId,omitempty"` - // CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. - CorrelationID *string `json:"correlationId,omitempty"` - // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. - EventName *LocalizableString `json:"eventName,omitempty"` - // Category - READ-ONLY; the event category. - Category *LocalizableString `json:"category,omitempty"` - // HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). - HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` - // Level - READ-ONLY; the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' - Level EventLevel `json:"level,omitempty"` - // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` - // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - READ-ONLY; the resource type - ResourceType *LocalizableString `json:"resourceType,omitempty"` - // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. - OperationID *string `json:"operationId,omitempty"` - // OperationName - READ-ONLY; the operation name. - OperationName *LocalizableString `json:"operationName,omitempty"` - // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string `json:"properties"` - // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - Status *LocalizableString `json:"status,omitempty"` - // SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) - SubStatus *LocalizableString `json:"subStatus,omitempty"` - // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. - EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` - // SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. - SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` - // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // TenantID - READ-ONLY; the Azure tenant Id - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventData. -func (ed EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EventDataCollection represents collection of events. -type EventDataCollection struct { - autorest.Response `json:"-"` - // Value - this list that includes the Azure audit logs. - Value *[]EventData `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventDataCollectionIterator provides access to a complete listing of EventData values. -type EventDataCollectionIterator struct { - i int - page EventDataCollectionPage -} - -// 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 *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.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 *EventDataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventDataCollectionIterator) 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 EventDataCollectionIterator) Response() EventDataCollection { - 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 EventDataCollectionIterator) Value() EventData { - if !iter.page.NotDone() { - return EventData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventDataCollectionIterator type. -func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { - return EventDataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edc EventDataCollection) IsEmpty() bool { - return edc.Value == nil || len(*edc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edc EventDataCollection) hasNextLink() bool { - return edc.NextLink != nil && len(*edc.NextLink) != 0 -} - -// eventDataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !edc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edc.NextLink))) -} - -// EventDataCollectionPage contains a page of EventData values. -type EventDataCollectionPage struct { - fn func(context.Context, EventDataCollection) (EventDataCollection, error) - edc EventDataCollection -} - -// 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 *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.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.edc) - if err != nil { - return err - } - page.edc = 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 *EventDataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventDataCollectionPage) NotDone() bool { - return !page.edc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventDataCollectionPage) Response() EventDataCollection { - return page.edc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventDataCollectionPage) Values() []EventData { - if page.edc.IsEmpty() { - return nil - } - return *page.edc.Value -} - -// Creates a new instance of the EventDataCollectionPage type. -func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { - return EventDataCollectionPage{ - fn: getNextPage, - edc: cur, - } -} - -// HTTPRequestInfo the Http request info. -type HTTPRequestInfo struct { - // ClientRequestID - the client request id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ClientIPAddress - the client Ip Address - ClientIPAddress *string `json:"clientIpAddress,omitempty"` - // Method - the Http request method. - Method *string `json:"method,omitempty"` - // URI - the Uri. - URI *string `json:"uri,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) 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 "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` -} - -// LogMetricTrigger a log metrics trigger descriptor. -type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - The threshold of the metric trigger. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' - MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` - // MetricColumn - Evaluation of metric on a particular column - MetricColumn *string `json:"metricColumn,omitempty"` -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `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 LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) 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 logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) 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 - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// LogSearchRule log Search Rule Definition -type LogSearchRule struct { - // Description - The description of the Log Search rule. - Description *string `json:"description,omitempty"` - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Source - Data Source against which rule will Query Data - Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule *Schedule `json:"schedule,omitempty"` - // Action - Action needs to be taken on rule execution. - Action BasicAction `json:"action,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRule. -func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsr.Description != nil { - objectMap["description"] = lsr.Description - } - if lsr.Enabled != "" { - objectMap["enabled"] = lsr.Enabled - } - if lsr.Source != nil { - objectMap["source"] = lsr.Source - } - if lsr.Schedule != nil { - objectMap["schedule"] = lsr.Schedule - } - objectMap["action"] = lsr.Action - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. -func (lsr *LogSearchRule) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - lsr.Description = &description - } - case "enabled": - if v != nil { - var enabled Enabled - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - lsr.Enabled = enabled - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - lsr.LastUpdatedTime = &lastUpdatedTime - } - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - lsr.ProvisioningState = provisioningState - } - case "source": - if v != nil { - var source Source - err = json.Unmarshal(*v, &source) - if err != nil { - return err - } - lsr.Source = &source - } - case "schedule": - if v != nil { - var schedule Schedule - err = json.Unmarshal(*v, &schedule) - if err != nil { - return err - } - lsr.Schedule = &schedule - } - case "action": - if v != nil { - action, err := unmarshalBasicAction(*v) - if err != nil { - return err - } - lsr.Action = action - } - } - } - - return nil -} - -// LogSearchRulePatch log Search Rule Definition for Patching -type LogSearchRulePatch struct { - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` -} - -// LogSearchRuleResource the Log Search Rule resource. -type LogSearchRuleResource struct { - autorest.Response `json:"-"` - // LogSearchRule - The rule properties of the resource. - *LogSearchRule `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 LogSearchRuleResource. -func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrr.LogSearchRule != nil { - objectMap["properties"] = lsrr.LogSearchRule - } - if lsrr.Location != nil { - objectMap["location"] = lsrr.Location - } - if lsrr.Tags != nil { - objectMap["tags"] = lsrr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. -func (lsrr *LogSearchRuleResource) 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 logSearchRule LogSearchRule - err = json.Unmarshal(*v, &logSearchRule) - if err != nil { - return err - } - lsrr.LogSearchRule = &logSearchRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lsrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lsrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lsrr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lsrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lsrr.Tags = tags - } - } - } - - return nil -} - -// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. -type LogSearchRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the Log Search Rule resources. - Value *[]LogSearchRuleResource `json:"value,omitempty"` -} - -// LogSearchRuleResourcePatch the log search rule resource for patch operations. -type LogSearchRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogSearchRulePatch - The log search rule properties of the resource. - *LogSearchRulePatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. -func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrrp.Tags != nil { - objectMap["tags"] = lsrrp.Tags - } - if lsrrp.LogSearchRulePatch != nil { - objectMap["properties"] = lsrrp.LogSearchRulePatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. -func (lsrrp *LogSearchRuleResourcePatch) 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 - } - lsrrp.Tags = tags - } - case "properties": - if v != nil { - var logSearchRulePatch LogSearchRulePatch - err = json.Unmarshal(*v, &logSearchRulePatch) - if err != nil { - return err - } - lsrrp.LogSearchRulePatch = &logSearchRulePatch - } - } - } - - return nil -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogToMetricAction specify action need to be taken when rule type is converting log to metric -type LogToMetricAction struct { - // Criteria - Criteria of Metric - Criteria *[]Criteria `json:"criteria,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogToMetricAction. -func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { - ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction - objectMap := make(map[string]interface{}) - if ltma.Criteria != nil { - objectMap["criteria"] = ltma.Criteria - } - if ltma.OdataType != "" { - objectMap["odata.type"] = ltma.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return <ma, true -} - -// AsAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { - return <ma, true -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) 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 "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// MetricAlertAction an alert action. -type MetricAlertAction struct { - // ActionGroupID - the id of the action group to use. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. - WebHookProperties map[string]*string `json:"webHookProperties"` -} - -// MarshalJSON is the custom marshaler for MetricAlertAction. -func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if maa.ActionGroupID != nil { - objectMap["actionGroupId"] = maa.ActionGroupID - } - if maa.WebHookProperties != nil { - objectMap["webHookProperties"] = maa.WebHookProperties - } - return json.Marshal(objectMap) -} - -// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type BasicMetricAlertCriteria interface { - AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) - AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) - AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) - AsMetricAlertCriteria() (*MetricAlertCriteria, bool) -} - -// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - var masrmmc MetricAlertSingleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &masrmmc) - return masrmmc, err - case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - var wlac WebtestLocationAvailabilityCriteria - err := json.Unmarshal(body, &wlac) - return wlac, err - case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &mamrmmc) - return mamrmmc, err - default: - var mac MetricAlertCriteria - err := json.Unmarshal(body, &mac) - return mac, err - } -} -func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) - if err != nil { - return nil, err - } - macArray[index] = mac - } - return macArray, nil -} - -// MarshalJSON is the custom marshaler for MetricAlertCriteria. -func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { - mac.OdataType = OdataTypeMetricAlertCriteria - objectMap := make(map[string]interface{}) - if mac.OdataType != "" { - objectMap["odata.type"] = mac.OdataType - } - for k, v := range mac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return &mac, true -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mac, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. -func (mac *MetricAlertCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mac.AdditionalProperties == nil { - mac.AdditionalProperties = make(map[string]interface{}) - } - mac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mac.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple -// resource that has multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // AllOf - the list of multiple metric criteria for this 'all of' operation. - AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - mamrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if mamrmmc.AllOf != nil { - objectMap["allOf"] = mamrmmc.AllOf - } - if mamrmmc.OdataType != "" { - objectMap["odata.type"] = mamrmmc.OdataType - } - for k, v := range mamrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return &mamrmmc, true -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mamrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. -func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) - if err != nil { - return err - } - mamrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mamrmmc.AdditionalProperties == nil { - mamrmmc.AdditionalProperties = make(map[string]interface{}) - } - mamrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mamrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertProperties an alert rule. -type MetricAlertProperties struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertProperties. -func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapVar.Description != nil { - objectMap["description"] = mapVar.Description - } - if mapVar.Severity != nil { - objectMap["severity"] = mapVar.Severity - } - if mapVar.Enabled != nil { - objectMap["enabled"] = mapVar.Enabled - } - if mapVar.Scopes != nil { - objectMap["scopes"] = mapVar.Scopes - } - if mapVar.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency - } - if mapVar.WindowSize != nil { - objectMap["windowSize"] = mapVar.WindowSize - } - if mapVar.TargetResourceType != nil { - objectMap["targetResourceType"] = mapVar.TargetResourceType - } - if mapVar.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion - } - objectMap["criteria"] = mapVar.Criteria - if mapVar.AutoMitigate != nil { - objectMap["autoMitigate"] = mapVar.AutoMitigate - } - if mapVar.Actions != nil { - objectMap["actions"] = mapVar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. -func (mapVar *MetricAlertProperties) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapVar.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapVar.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapVar.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapVar.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapVar.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapVar.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapVar.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapVar.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapVar.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapVar.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapVar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapVar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// MetricAlertResource the metric alert resource. -type MetricAlertResource struct { - autorest.Response `json:"-"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `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 MetricAlertResource. -func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mar.MetricAlertProperties != nil { - objectMap["properties"] = mar.MetricAlertProperties - } - if mar.Location != nil { - objectMap["location"] = mar.Location - } - if mar.Tags != nil { - objectMap["tags"] = mar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. -func (mar *MetricAlertResource) 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 metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - mar.MetricAlertProperties = &metricAlertProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mar.Tags = tags - } - } - } - - return nil -} - -// MetricAlertResourceCollection represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertResource `json:"value,omitempty"` -} - -// MetricAlertResourcePatch the metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. -func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if marp.Tags != nil { - objectMap["tags"] = marp.Tags - } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. -func (marp *MetricAlertResourcePatch) 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 - } - marp.Tags = tags - } - case "properties": - if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - marp.MetricAlertProperties = &metricAlertProperties - } - } - } - - return nil -} - -// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single -// resource that has multiple metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // AllOf - The list of metric criteria for this 'all of' operation. - AllOf *[]MetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if masrmmc.AllOf != nil { - objectMap["allOf"] = masrmmc.AllOf - } - if masrmmc.OdataType != "" { - objectMap["odata.type"] = masrmmc.OdataType - } - for k, v := range masrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return &masrmmc, true -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &masrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. -func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - var allOf []MetricCriteria - err = json.Unmarshal(*v, &allOf) - if err != nil { - return err - } - masrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if masrmmc.AdditionalProperties == nil { - masrmmc.AdditionalProperties = make(map[string]interface{}) - } - masrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - masrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertStatus an alert status. -type MetricAlertStatus struct { - // Name - The status name. - Name *string `json:"name,omitempty"` - // ID - The alert rule arm id. - ID *string `json:"id,omitempty"` - // Type - The extended resource type name. - Type *string `json:"type,omitempty"` - // Properties - The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties `json:"properties,omitempty"` -} - -// MetricAlertStatusCollection represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertStatus `json:"value,omitempty"` -} - -// MetricAlertStatusProperties an alert status properties. -type MetricAlertStatusProperties struct { - // Dimensions - An object describing the type of the dimensions. - Dimensions map[string]*string `json:"dimensions"` - // Status - status value - Status *string `json:"status,omitempty"` - // Timestamp - UTC time when the status was checked. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. -func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if masp.Dimensions != nil { - objectMap["dimensions"] = masp.Dimensions - } - if masp.Status != nil { - objectMap["status"] = masp.Status - } - if masp.Timestamp != nil { - objectMap["timestamp"] = masp.Timestamp - } - return json.Marshal(objectMap) -} - -// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and -// the retention period for that time grain. -type MetricAvailability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// MetricCriteria criterion to filter metrics. -type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' - Operator Operator `json:"operator,omitempty"` - // Threshold - the criteria threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricCriteria. -func (mc MetricCriteria) MarshalJSON() ([]byte, error) { - mc.CriterionType = CriterionTypeStaticThresholdCriterion - objectMap := make(map[string]interface{}) - if mc.Operator != "" { - objectMap["operator"] = mc.Operator - } - if mc.Threshold != nil { - objectMap["threshold"] = mc.Threshold - } - if mc.Name != nil { - objectMap["name"] = mc.Name - } - if mc.MetricName != nil { - objectMap["metricName"] = mc.MetricName - } - if mc.MetricNamespace != nil { - objectMap["metricNamespace"] = mc.MetricNamespace - } - if mc.TimeAggregation != nil { - objectMap["timeAggregation"] = mc.TimeAggregation - } - if mc.Dimensions != nil { - objectMap["dimensions"] = mc.Dimensions - } - if mc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mc.SkipMetricValidation - } - if mc.CriterionType != "" { - objectMap["criterionType"] = mc.CriterionType - } - for k, v := range mc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return &mc, true -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. -func (mc *MetricCriteria) 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 "operator": - if v != nil { - var operator Operator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - mc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - mc.Threshold = &threshold - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mc.AdditionalProperties == nil { - mc.AdditionalProperties = make(map[string]interface{}) - } - mc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mc.CriterionType = criterionType - } - } - } - - return nil -} - -// MetricDefinition metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// MetricDefinitionCollection represents collection of metric definitions. -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricDimension specifies a metric dimension. -type MetricDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string `json:"operator,omitempty"` - // Values - list of dimension values. - Values *[]string `json:"values,omitempty"` -} - -// MetricNamespace metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // ID - The ID of the metricNamespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The name of the namespace. - Name *string `json:"name,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName `json:"properties,omitempty"` -} - -// MetricNamespaceCollection represents collection of metric namespaces. -type MetricNamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]MetricNamespace `json:"value,omitempty"` -} - -// MetricNamespaceName the fully qualified metric namespace name. -type MetricNamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` -} - -// MetricValue represents a metric value. -type MetricValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *float64 `json:"count,omitempty"` -} - -// BasicMultiMetricCriteria the types of conditions for a multi resource alert. -type BasicMultiMetricCriteria interface { - AsMetricCriteria() (*MetricCriteria, bool) - AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) - AsMultiMetricCriteria() (*MultiMetricCriteria, bool) -} - -// MultiMetricCriteria the types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["criterionType"] { - case string(CriterionTypeStaticThresholdCriterion): - var mc MetricCriteria - err := json.Unmarshal(body, &mc) - return mc, err - case string(CriterionTypeDynamicThresholdCriterion): - var dmc DynamicMetricCriteria - err := json.Unmarshal(body, &dmc) - return dmc, err - default: - var mmc MultiMetricCriteria - err := json.Unmarshal(body, &mmc) - return mmc, err - } -} -func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) - if err != nil { - return nil, err - } - mmcArray[index] = mmc - } - return mmcArray, nil -} - -// MarshalJSON is the custom marshaler for MultiMetricCriteria. -func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { - mmc.CriterionType = CriterionTypeMultiMetricCriteria - objectMap := make(map[string]interface{}) - if mmc.Name != nil { - objectMap["name"] = mmc.Name - } - if mmc.MetricName != nil { - objectMap["metricName"] = mmc.MetricName - } - if mmc.MetricNamespace != nil { - objectMap["metricNamespace"] = mmc.MetricNamespace - } - if mmc.TimeAggregation != nil { - objectMap["timeAggregation"] = mmc.TimeAggregation - } - if mmc.Dimensions != nil { - objectMap["dimensions"] = mmc.Dimensions - } - if mmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mmc.SkipMetricValidation - } - if mmc.CriterionType != "" { - objectMap["criterionType"] = mmc.CriterionType - } - for k, v := range mmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return &mmc, true -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. -func (mmc *MultiMetricCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mmc.AdditionalProperties == nil { - mmc.AdditionalProperties = make(map[string]interface{}) - } - mmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mmc.CriterionType = criterionType - } - } - } - - return nil -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Insights 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 operations supported by the Microsoft.Insights 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"` -} - -// ProxyOnlyResource a proxy only azure resource object -type ProxyOnlyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyOnlyResource. -func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource an azure resource object -type Resource 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) 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 "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. - Maximum *string `json:"maximum,omitempty"` - // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// Schedule defines how often to run the search and the time interval. -type Schedule struct { - // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. - FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` - // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` -} - -// SenderAuthorization the authorization used by the user who has performed the operation that led to this -// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and -// the 'scope' -type SenderAuthorization struct { - // Action - the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string `json:"action,omitempty"` - // Role - the role of the user. For instance: Subscription Admin - Role *string `json:"role,omitempty"` - // Scope - the scope. - Scope *string `json:"scope,omitempty"` -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// Source specifies the log search query. -type Source struct { - // Query - Log search query. Required for action type - AlertingAction - Query *string `json:"query,omitempty"` - // AuthorizedResources - List of Resource referred into query - AuthorizedResources *[]string `json:"authorizedResources,omitempty"` - // DataSourceID - The resource uri over which log search query is to be run. - DataSourceID *string `json:"dataSourceId,omitempty"` - // QueryType - Set value to 'ResultCount'. Possible values include: 'ResultCount' - QueryType QueryType `json:"queryType,omitempty"` -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) 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 "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]MetricValue `json:"data,omitempty"` -} - -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,omitempty"` -} - -// TriggerCondition the condition that results in the Log Search rule. -type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - Result or count threshold based on which rule should be triggered. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTrigger - Trigger condition for metric query rule - MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` -} - -// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // WebTestID - The Application Insights web test Id. - WebTestID *string `json:"webTestId,omitempty"` - // ComponentID - The Application Insights resource Id. - ComponentID *string `json:"componentId,omitempty"` - // FailedLocationCount - The number of failed locations. - FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - objectMap := make(map[string]interface{}) - if wlac.WebTestID != nil { - objectMap["webTestId"] = wlac.WebTestID - } - if wlac.ComponentID != nil { - objectMap["componentId"] = wlac.ComponentID - } - if wlac.FailedLocationCount != nil { - objectMap["failedLocationCount"] = wlac.FailedLocationCount - } - if wlac.OdataType != "" { - objectMap["odata.type"] = wlac.OdataType - } - for k, v := range wlac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return &wlac, true -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &wlac, true -} - -// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. -func (wlac *WebtestLocationAvailabilityCriteria) 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 "webTestId": - if v != nil { - var webTestID string - err = json.Unmarshal(*v, &webTestID) - if err != nil { - return err - } - wlac.WebTestID = &webTestID - } - case "componentId": - if v != nil { - var componentID string - err = json.Unmarshal(*v, &componentID) - if err != nil { - return err - } - wlac.ComponentID = &componentID - } - case "failedLocationCount": - if v != nil { - var failedLocationCount float64 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - wlac.FailedLocationCount = &failedLocationCount - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if wlac.AdditionalProperties == nil { - wlac.AdditionalProperties = make(map[string]interface{}) - } - wlac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - wlac.OdataType = odataType - } - } - } - - return nil -} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/operations.go b/services/preview/monitor/mgmt/2018-09-01/insights/operations.go deleted file mode 100644 index 3f82351c7f23..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -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 monitor 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 operations from Microsoft.Insights provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-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 -} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go deleted file mode 100644 index c9d43964ecb0..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go +++ /dev/null @@ -1,511 +0,0 @@ -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" -) - -// ScheduledQueryRulesClient is the monitor Management Client -type ScheduledQueryRulesClient struct { - BaseClient -} - -// NewScheduledQueryRulesClient creates an instance of the ScheduledQueryRulesClient client. -func NewScheduledQueryRulesClient(subscriptionID string) ScheduledQueryRulesClient { - return NewScheduledQueryRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduledQueryRulesClientWithBaseURI creates an instance of the ScheduledQueryRulesClient 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 NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID string) ScheduledQueryRulesClient { - return ScheduledQueryRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an log search rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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 a Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) 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 Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) GetResponder(resp *http.Response) (result LogSearchRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the Log Search rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the Log Search rules within a subscription group. -// Parameters: -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update log search Rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) UpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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/monitor/mgmt/2018-09-01/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2018-09-01/insights/tenantactivitylogs.go deleted file mode 100644 index 7501f047bb38..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/tenantactivitylogs.go +++ /dev/null @@ -1,168 +0,0 @@ -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" -) - -// TenantActivityLogsClient is the monitor Management Client -type TenantActivityLogsClient struct { - BaseClient -} - -// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. -func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { - return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient 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 NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { - return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for -// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that -// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that -// were generated at the tenant level. -// Parameters: -// filter - reduces the set of data collected.
The **$filter** is very restricted and allows only the -// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq -// ''.
- List events for resource: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq -// ''.
- List events for a subscription: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation'.
- List events for a resource -// provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq -// 'Admin, Operation' and resourceProvider eq ''.
- List events for a correlation Id: -// api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq -// ''.
**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), - 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 TenantActivityLogsClient) 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 TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/version.go b/services/preview/monitor/mgmt/2018-09-01/insights/version.go deleted file mode 100644 index 0a8f0e35f265..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -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/2018-09-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2018-11-01-preview/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2018-11-01-preview/insights/_meta.json deleted file mode 100644 index d95196250894..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2018-11-preview", - "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-2018-11-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/actiongroups.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/actiongroups.go deleted file mode 100644 index 20bdb629e8c1..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/actiongroups.go +++ /dev/null @@ -1,581 +0,0 @@ -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" -) - -// ActionGroupsClient is the monitor Management Client -type ActionGroupsClient struct { - BaseClient -} - -// NewActionGroupsClient creates an instance of the ActionGroupsClient client. -func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { - return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { - return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new action group or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroup - the action group to create or use for the update. -func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: actionGroup, - Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, - {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroup), - 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 ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) 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 -} - -// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. -// This operation is only supported for Email or SMS receivers. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// enableRequest - the receiver to re-enable. -func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) - } - - req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") - return - } - - resp, err := client.EnableReceiverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") - return - } - - result, err = client.EnableReceiverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") - return - } - - return -} - -// EnableReceiverPreparer prepares the EnableReceiver request. -func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}/subscribe", pathParameters), - autorest.WithJSON(enableRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableReceiverSender sends the EnableReceiver request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableReceiverResponder handles the response to the EnableReceiver request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all action groups in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActionGroupsClient) 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 = "2018-09-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/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all action groups in a subscription. -func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, 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 action group's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroupPatch - parameters supplied to the operation. -func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName, actionGroupPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroupPatch), - 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 ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2018-11-01-preview/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogalerts.go deleted file mode 100644 index 44aaf3ef1e4a..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// ActivityLogAlertsClient is the monitor Management Client -type ActivityLogAlertsClient struct { - BaseClient -} - -// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient 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 NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new activity log alert or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlert - the activity log alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all activity log alerts in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) 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 = "2017-04-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/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all activity log alerts in a subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, 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 ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlertPatch - parameters supplied to the operation. -func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName, activityLogAlertPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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/monitor/mgmt/2018-11-01-preview/insights/activitylogs.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogs.go deleted file mode 100644 index 16dd215e6ad9..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/activitylogs.go +++ /dev/null @@ -1,166 +0,0 @@ -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" -) - -// ActivityLogsClient is the monitor Management Client -type ActivityLogsClient struct { - BaseClient -} - -// NewActivityLogsClient creates an instance of the ActivityLogsClient client. -func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { - return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient 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 NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { - return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides the list of records from the activity logs. -// Parameters: -// filter - reduces the set of data collected.
This argument is required and it also requires at least the -// start date/time.
The **$filter** argument is very restricted and allows only the following patterns.
- -// *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and -// eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
- *List -// events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a subscription in a -// time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq -// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq -// 'correlationID'.

**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertruleincidents.go deleted file mode 100644 index c3bf26828d8e..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertruleincidents.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// AlertRuleIncidentsClient is the monitor Management Client -type AlertRuleIncidentsClient struct { - BaseClient -} - -// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// incidentName - the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "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.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) 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 -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - return - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2018-11-01-preview/insights/alertrules.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertrules.go deleted file mode 100644 index f5a2ab682384..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/alertrules.go +++ /dev/null @@ -1,495 +0,0 @@ -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" -) - -// AlertRulesClient is the monitor Management Client -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 a classic metric alert rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 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 AlertRuleResource, 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName 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) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, 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) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 AlertRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the classic metric alert rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) 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 = "2016-03-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/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the classic metric alert rules within a subscription. -func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// alertRulesResource - parameters supplied to the operation. -func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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, ruleName, alertRulesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(alertRulesResource), - 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 AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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/monitor/mgmt/2018-11-01-preview/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/autoscalesettings.go deleted file mode 100644 index 86f253d0fb89..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/autoscalesettings.go +++ /dev/null @@ -1,580 +0,0 @@ -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" -) - -// AutoscaleSettingsClient is the monitor Management Client -type AutoscaleSettingsClient struct { - BaseClient -} - -// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// parameters - parameters supplied to the operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) 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-04-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/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 the autoscale settings for a subscription -func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// autoscaleSettingResource - parameters supplied to the operation. -func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName, autoscaleSettingResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(autoscaleSettingResource), - 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2018-11-01-preview/insights/client.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/client.go deleted file mode 100644 index a777181b0785..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package insights implements the Azure ARM Insights service API version . -// -// Monitor 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/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettings.go deleted file mode 100644 index 9708c52c2499..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettings.go +++ /dev/null @@ -1,332 +0,0 @@ -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" -) - -// DiagnosticSettingsClient is the monitor Management Client -type DiagnosticSettingsClient struct { - BaseClient -} - -// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. -func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { - return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient 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 NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { - return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, resourceURI, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-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("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) 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 active diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 active diagnostic settings list for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", 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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, 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/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettingscategory.go deleted file mode 100644 index 48365ed67e65..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/diagnosticsettingscategory.go +++ /dev/null @@ -1,180 +0,0 @@ -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" -) - -// DiagnosticSettingsCategoryClient is the monitor Management Client -type DiagnosticSettingsCategoryClient struct { - BaseClient -} - -// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. -func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { - return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient 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 NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { - return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, 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/monitor/mgmt/2018-11-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/enums.go deleted file mode 100644 index d86190121bb5..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/enums.go +++ /dev/null @@ -1,628 +0,0 @@ -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. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // Average ... - Average AggregationType = "Average" - // Count ... - Count AggregationType = "Count" - // Maximum ... - Maximum AggregationType = "Maximum" - // Minimum ... - Minimum AggregationType = "Minimum" - // None ... - None AggregationType = "None" - // Total ... - Total AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{Average, Count, Maximum, Minimum, None, Total} -} - -// AlertSeverity enumerates the values for alert severity. -type AlertSeverity string - -const ( - // Four ... - Four AlertSeverity = "4" - // One ... - One AlertSeverity = "1" - // Three ... - Three AlertSeverity = "3" - // Two ... - Two AlertSeverity = "2" - // Zero ... - Zero AlertSeverity = "0" -) - -// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. -func PossibleAlertSeverityValues() []AlertSeverity { - return []AlertSeverity{Four, One, Three, Two, Zero} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // Logs ... - Logs CategoryType = "Logs" - // Metrics ... - Metrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{Logs, Metrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // Equals ... - Equals ComparisonOperationType = "Equals" - // GreaterThan ... - GreaterThan ComparisonOperationType = "GreaterThan" - // GreaterThanOrEqual ... - GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // LessThan ... - LessThan ComparisonOperationType = "LessThan" - // LessThanOrEqual ... - LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // NotEquals ... - NotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} -} - -// ConditionalOperator enumerates the values for conditional operator. -type ConditionalOperator string - -const ( - // ConditionalOperatorEqual ... - ConditionalOperatorEqual ConditionalOperator = "Equal" - // ConditionalOperatorGreaterThan ... - ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" - // ConditionalOperatorLessThan ... - ConditionalOperatorLessThan ConditionalOperator = "LessThan" -) - -// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. -func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} -} - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// CriterionType enumerates the values for criterion type. -type CriterionType string - -const ( - // CriterionTypeDynamicThresholdCriterion ... - CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - // CriterionTypeMultiMetricCriteria ... - CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" - // CriterionTypeStaticThresholdCriterion ... - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" -) - -// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. -func PossibleCriterionTypeValues() []CriterionType { - return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} -} - -// DataStatus enumerates the values for data status. -type DataStatus string - -const ( - // NotPresent ... - NotPresent DataStatus = "notPresent" - // Present ... - Present DataStatus = "present" -) - -// PossibleDataStatusValues returns an array of possible values for the DataStatus const type. -func PossibleDataStatusValues() []DataStatus { - return []DataStatus{NotPresent, Present} -} - -// DynamicThresholdOperator enumerates the values for dynamic threshold operator. -type DynamicThresholdOperator string - -const ( - // DynamicThresholdOperatorGreaterOrLessThan ... - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - // DynamicThresholdOperatorGreaterThan ... - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - // DynamicThresholdOperatorLessThan ... - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} -} - -// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. -type DynamicThresholdSensitivity string - -const ( - // High ... - High DynamicThresholdSensitivity = "High" - // Low ... - Low DynamicThresholdSensitivity = "Low" - // Medium ... - Medium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{High, Low, Medium} -} - -// Enabled enumerates the values for enabled. -type Enabled string - -const ( - // False ... - False Enabled = "false" - // True ... - True Enabled = "true" -) - -// PossibleEnabledValues returns an array of possible values for the Enabled const type. -func PossibleEnabledValues() []Enabled { - return []Enabled{False, True} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // EventLevelCritical ... - EventLevelCritical EventLevel = "Critical" - // EventLevelError ... - EventLevelError EventLevel = "Error" - // EventLevelInformational ... - EventLevelInformational EventLevel = "Informational" - // EventLevelVerbose ... - EventLevelVerbose EventLevel = "Verbose" - // EventLevelWarning ... - EventLevelWarning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// MetricTriggerType enumerates the values for metric trigger type. -type MetricTriggerType string - -const ( - // MetricTriggerTypeConsecutive ... - MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" - // MetricTriggerTypeTotal ... - MetricTriggerTypeTotal MetricTriggerType = "Total" -) - -// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. -func PossibleMetricTriggerTypeValues() []MetricTriggerType { - return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicAction enumerates the values for odata type basic action. -type OdataTypeBasicAction string - -const ( - // OdataTypeAction ... - OdataTypeAction OdataTypeBasicAction = "Action" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" -) - -// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. -func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} -} - -// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. -type OdataTypeBasicMetricAlertCriteria string - -const ( - // OdataTypeMetricAlertCriteria ... - OdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" - // OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... - OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. -func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { - return []OdataTypeBasicMetricAlertCriteria{OdataTypeMetricAlertCriteria, OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeRuleAction ... - OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeRuleCondition ... - OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} -} - -// OnboardingStatus enumerates the values for onboarding status. -type OnboardingStatus string - -const ( - // NotOnboarded ... - NotOnboarded OnboardingStatus = "notOnboarded" - // Onboarded ... - Onboarded OnboardingStatus = "onboarded" - // Unknown ... - Unknown OnboardingStatus = "unknown" -) - -// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. -func PossibleOnboardingStatusValues() []OnboardingStatus { - return []OnboardingStatus{NotOnboarded, Onboarded, Unknown} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorEquals ... - OperatorEquals Operator = "Equals" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Deploying ... - Deploying ProvisioningState = "Deploying" - // Failed ... - Failed ProvisioningState = "Failed" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Deploying, Failed, Succeeded} -} - -// QueryType enumerates the values for query type. -type QueryType string - -const ( - // ResultCount ... - ResultCount QueryType = "ResultCount" -) - -// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. -func PossibleQueryTypeValues() []QueryType { - return []QueryType{ResultCount} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // ReceiverStatusDisabled ... - ReceiverStatusDisabled ReceiverStatus = "Disabled" - // ReceiverStatusEnabled ... - ReceiverStatusEnabled ReceiverStatus = "Enabled" - // ReceiverStatusNotSpecified ... - ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // Data ... - Data ResultType = "Data" - // Metadata ... - Metadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{Data, Metadata} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ChangeCount ... - ChangeCount ScaleType = "ChangeCount" - // ExactCount ... - ExactCount ScaleType = "ExactCount" - // PercentChangeCount ... - PercentChangeCount ScaleType = "PercentChangeCount" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/eventcategories.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/eventcategories.go deleted file mode 100644 index 86e59b424363..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/eventcategories.go +++ /dev/null @@ -1,99 +0,0 @@ -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" -) - -// EventCategoriesClient is the monitor Management Client -type EventCategoriesClient struct { - BaseClient -} - -// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. -func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { - return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { - return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available event categories supported in the Activity Logs Service.
The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "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.EventCategoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), - 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2018-11-01-preview/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/insightsapi/interfaces.go deleted file mode 100644 index 03eab73052ba..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,199 +0,0 @@ -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/monitor/mgmt/2018-11-01-preview/insights" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) - List(ctx context.Context) (result insights.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) - -// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. -type DiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) -} - -var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) - -// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) -} - -var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) - -// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. -type ActivityLogAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActivityLogAlertList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActivityLogAlertList, err error) - Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch insights.ActivityLogAlertPatchBody) (result insights.ActivityLogAlertResource, err error) -} - -var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) - -// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. -type ActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result insights.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) - -// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. -type TenantActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) - -// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. -type MetricDefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string, metricnamespace string) (result insights.MetricDefinitionCollection, err error) -} - -var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) - -// MetricsClientAPI contains the set of methods on the MetricsClient type. -type MetricsClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType insights.ResultType, metricnamespace string) (result insights.Response, err error) -} - -var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - -// MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. -type MetricAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.MetricAlertResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.MetricAlertResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResourcePatch) (result insights.MetricAlertResource, err error) -} - -var _ MetricAlertsClientAPI = (*insights.MetricAlertsClient)(nil) - -// MetricAlertsStatusClientAPI contains the set of methods on the MetricAlertsStatusClient type. -type MetricAlertsStatusClientAPI interface { - List(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertStatusCollection, err error) - ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result insights.MetricAlertStatusCollection, err error) -} - -var _ MetricAlertsStatusClientAPI = (*insights.MetricAlertsStatusClient)(nil) - -// ScheduledQueryRulesClientAPI contains the set of methods on the ScheduledQueryRulesClient type. -type ScheduledQueryRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResource) (result insights.LogSearchRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.LogSearchRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result insights.LogSearchRuleResourceCollection, err error) - ListBySubscription(ctx context.Context, filter string) (result insights.LogSearchRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResourcePatch) (result insights.LogSearchRuleResource, err error) -} - -var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) - -// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. -type MetricNamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) -} - -var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) - -// VMInsightsClientAPI contains the set of methods on the VMInsightsClient type. -type VMInsightsClientAPI interface { - GetOnboardingStatus(ctx context.Context, resourceURI string) (result insights.VMInsightsOnboardingStatus, err error) -} - -var _ VMInsightsClientAPI = (*insights.VMInsightsClient)(nil) diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/logprofiles.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/logprofiles.go deleted file mode 100644 index ad1500b87bc9..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/logprofiles.go +++ /dev/null @@ -1,418 +0,0 @@ -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" -) - -// LogProfilesClient is the monitor Management Client -type LogProfilesClient struct { - BaseClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// Parameters: -// logProfileName - the name of the log profile. -// parameters - parameters supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) 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 the log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 LogProfilesResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// logProfileName - the name of the log profile. -// logProfilesResource - parameters supplied to the operation. -func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName, logProfilesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(logProfilesResource), - 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 LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2018-11-01-preview/insights/metricalerts.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalerts.go deleted file mode 100644 index 94231b6fa34e..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// MetricAlertsClient is the monitor Management Client -type MetricAlertsClient struct { - BaseClient -} - -// NewMetricAlertsClient creates an instance of the MetricAlertsClient client. -func NewMetricAlertsClient(subscriptionID string) MetricAlertsClient { - return NewMetricAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsClientWithBaseURI creates an instance of the MetricAlertsClient 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 NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsClient { - return MetricAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result MetricAlertResource, 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 alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) 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 an alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) GetResponder(resp *http.Response) (result MetricAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve alert rule definitions in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MetricAlertsClient) 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 = "2018-03-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/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieve alert rule definitions in a subscription. -func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) UpdateResponder(resp *http.Response) (result MetricAlertResource, 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/monitor/mgmt/2018-11-01-preview/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalertsstatus.go deleted file mode 100644 index 43cfaed42765..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricalertsstatus.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// MetricAlertsStatusClient is the monitor Management Client -type MetricAlertsStatusClient struct { - BaseClient -} - -// NewMetricAlertsStatusClient creates an instance of the MetricAlertsStatusClient client. -func NewMetricAlertsStatusClient(subscriptionID string) MetricAlertsStatusClient { - return NewMetricAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsStatusClientWithBaseURI creates an instance of the MetricAlertsStatusClient 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 NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsStatusClient { - return MetricAlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "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.MetricAlertsStatusClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status", 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 MetricAlertsStatusClient) 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 MetricAlertsStatusClient) ListResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByName retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// statusName - the name of the status. -func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.ListByName") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure sending request") - return - } - - result, err = client.ListByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure responding to request") - return - } - - return -} - -// ListByNamePreparer prepares the ListByName request. -func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "statusName": autorest.Encode("path", statusName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status/{statusName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNameSender sends the ListByName request. The method will close the -// http.Response Body if it receives an error. -func (client MetricAlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNameResponder handles the response to the ListByName request. The method always -// closes the http.Response Body. -func (client MetricAlertsStatusClient) ListByNameResponder(resp *http.Response) (result MetricAlertStatusCollection, 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/monitor/mgmt/2018-11-01-preview/insights/metricbaseline.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -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" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient 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 NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - 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: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-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("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.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, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "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.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", 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 MetricBaselineClient) 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 MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, 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/monitor/mgmt/2018-11-01-preview/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricdefinitions.go deleted file mode 100644 index 69fc2e0b465a..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricdefinitions.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricDefinitionsClient is the monitor Management Client -type MetricDefinitionsClient struct { - BaseClient -} - -// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. -func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { - return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient 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 NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { - return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result MetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "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.MetricDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", 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 MetricDefinitionsClient) 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 MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, 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/monitor/mgmt/2018-11-01-preview/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricnamespaces.go deleted file mode 100644 index f2ef47baf802..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metricnamespaces.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricNamespacesClient is the monitor Management Client -type MetricNamespacesClient struct { - BaseClient -} - -// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. -func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { - return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient 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 NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { - return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric namespaces for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, startTime) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "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.MetricNamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", 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 MetricNamespacesClient) 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 MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, 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/monitor/mgmt/2018-11-01-preview/insights/metrics.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/metrics.go deleted file mode 100644 index 97687a09b498..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/metrics.go +++ /dev/null @@ -1,152 +0,0 @@ -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" -) - -// MetricsClient is the monitor Management Client -type MetricsClient struct { - BaseClient -} - -// NewMetricsClient creates an instance of the MetricsClient client. -func NewMetricsClient(subscriptionID string) MetricsClient { - return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricsClientWithBaseURI creates an instance of the MetricsClient 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 NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { - return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (result Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "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.MetricsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/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 MetricsClient) 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 MetricsClient) ListResponder(resp *http.Response) (result Response, 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/monitor/mgmt/2018-11-01-preview/insights/models.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/models.go deleted file mode 100644 index 22dd267978f9..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/models.go +++ /dev/null @@ -1,5433 +0,0 @@ -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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-11-01-preview/insights" - -// BasicAction action descriptor. -type BasicAction interface { - AsAlertingAction() (*AlertingAction, bool) - AsLogToMetricAction() (*LogToMetricAction, bool) - AsAction() (*Action, bool) -} - -// Action action descriptor. -type Action struct { - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicAction(body []byte) (BasicAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): - var aa AlertingAction - err := json.Unmarshal(body, &aa) - return aa, err - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): - var ltma LogToMetricAction - err := json.Unmarshal(body, <ma) - return ltma, err - default: - var a Action - err := json.Unmarshal(body, &a) - return a, err - } -} -func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - aArray := make([]BasicAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - a, err := unmarshalBasicAction(*rawMessage) - if err != nil { - return nil, err - } - aArray[index] = a - } - return aArray, nil -} - -// MarshalJSON is the custom marshaler for Action. -func (a Action) MarshalJSON() ([]byte, error) { - a.OdataType = OdataTypeAction - objectMap := make(map[string]interface{}) - if a.OdataType != "" { - objectMap["odata.type"] = a.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for Action. -func (a Action) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for Action. -func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for Action. -func (a Action) AsAction() (*Action, bool) { - return &a, true -} - -// AsBasicAction is the BasicAction implementation for Action. -func (a Action) AsBasicAction() (BasicAction, bool) { - return &a, true -} - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) 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 - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `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 ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) 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 actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActivityLogAlert an Azure activity log alert. -type ActivityLogAlert struct { - // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. - Scopes *[]string `json:"scopes,omitempty"` - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` - // Condition - The condition that will cause this alert to activate. - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - // Actions - The actions that will activate when the condition is met. - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - // Description - A description of this activity log alert. - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - // ActionGroupID - The resourceId of the action group. This cannot be null or empty. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string `json:"webhookProperties"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. -func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alaag.ActionGroupID != nil { - objectMap["actionGroupId"] = alaag.ActionGroupID - } - if alaag.WebhookProperties != nil { - objectMap["webhookProperties"] = alaag.WebhookProperties - } - return json.Marshal(objectMap) -} - -// ActivityLogAlertActionList a list of activity log alert actions. -type ActivityLogAlertActionList struct { - // ActionGroups - The list of activity log alerts. - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member -// conditions are met. -type ActivityLogAlertAllOfCondition struct { - // AllOf - The list of activity log alert conditions. - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log -// field and value. -type ActivityLogAlertLeafCondition struct { - // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. - Field *string `json:"field,omitempty"` - // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - // Value - The list of activity log alerts. - Value *[]ActivityLogAlertResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityLogAlertPatch an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. -type ActivityLogAlertPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActivityLogAlertPatch - The activity log alert settings for an update operation. - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. -func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alapb.Tags != nil { - objectMap["tags"] = alapb.Tags - } - if alapb.ActivityLogAlertPatch != nil { - objectMap["properties"] = alapb.ActivityLogAlertPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. -func (alapb *ActivityLogAlertPatchBody) 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 - } - alapb.Tags = tags - } - case "properties": - if v != nil { - var activityLogAlertPatch ActivityLogAlertPatch - err = json.Unmarshal(*v, &activityLogAlertPatch) - if err != nil { - return err - } - alapb.ActivityLogAlertPatch = &activityLogAlertPatch - } - } - } - - return nil -} - -// ActivityLogAlertResource an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `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 ActivityLogAlertResource. -func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alar.ActivityLogAlert != nil { - objectMap["properties"] = alar.ActivityLogAlert - } - if alar.Location != nil { - objectMap["location"] = alar.Location - } - if alar.Tags != nil { - objectMap["tags"] = alar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) 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 activityLogAlert ActivityLogAlert - err = json.Unmarshal(*v, &activityLogAlert) - if err != nil { - return err - } - alar.ActivityLogAlert = &activityLogAlert - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - alar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - alar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - alar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alar.Tags = tags - } - } - } - - return nil -} - -// AlertingAction specify action need to be taken when rule type is Alert -type AlertingAction struct { - // Severity - Severity of the alert. Possible values include: 'Zero', 'One', 'Two', 'Three', 'Four' - Severity AlertSeverity `json:"severity,omitempty"` - // AznsAction - Azure action group reference. - AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` - // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. - ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` - // Trigger - The trigger condition that results in the alert rule being. - Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertingAction. -func (aa AlertingAction) MarshalJSON() ([]byte, error) { - aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction - objectMap := make(map[string]interface{}) - if aa.Severity != "" { - objectMap["severity"] = aa.Severity - } - if aa.AznsAction != nil { - objectMap["aznsAction"] = aa.AznsAction - } - if aa.ThrottlingInMin != nil { - objectMap["throttlingInMin"] = aa.ThrottlingInMin - } - if aa.Trigger != nil { - objectMap["trigger"] = aa.Trigger - } - if aa.OdataType != "" { - objectMap["odata.type"] = aa.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { - return &aa, true -} - -// AsLogToMetricAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { - return &aa, true -} - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) 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 - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `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 AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) 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 alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) 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 - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// ArmRoleReceiver an arm role receiver. -type ArmRoleReceiver struct { - // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // RoleID - The arm role id. - RoleID *string `json:"roleId,omitempty"` -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `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 AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) 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 autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) - if err != nil { - return err - } - page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) 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 - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzNsActionGroup azure action group -type AzNsActionGroup struct { - // ActionGroup - Azure Action Group reference. - ActionGroup *[]string `json:"actionGroup,omitempty"` - // EmailSubject - Custom subject override for all email ids in Azure action group - EmailSubject *string `json:"emailSubject,omitempty"` - // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group - CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` -} - -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) 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 - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - -// Criteria specifies the criteria for converting log to metric. -type Criteria struct { - // MetricName - Name of the metric - MetricName *string `json:"metricName,omitempty"` - // Dimensions - List of Dimensions for creating metric - Dimensions *[]Dimension `json:"dimensions,omitempty"` -} - -// DataContainer information about a container with data for a given resource. -type DataContainer struct { - // Workspace - Log Analytics workspace information. - Workspace *WorkspaceInfo `json:"workspace,omitempty"` -} - -// DiagnosticSettings the diagnostic settings. -type DiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// DiagnosticSettingsCategory the diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' - CategoryType CategoryType `json:"categoryType,omitempty"` -} - -// DiagnosticSettingsCategoryResource the diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` - // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. - *DiagnosticSettingsCategory `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. -func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dscr.DiagnosticSettingsCategory != nil { - objectMap["properties"] = dscr.DiagnosticSettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. -func (dscr *DiagnosticSettingsCategoryResource) 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 diagnosticSettingsCategory DiagnosticSettingsCategory - err = json.Unmarshal(*v, &diagnosticSettingsCategory) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dscr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category -// resources. -type DiagnosticSettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` -} - -// DiagnosticSettingsResource the diagnostic setting resource. -type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // DiagnosticSettings - Properties of a Diagnostic Settings Resource. - *DiagnosticSettings `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. -func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DiagnosticSettings != nil { - objectMap["properties"] = dsr.DiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. -func (dsr *DiagnosticSettingsResource) 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 diagnosticSettings DiagnosticSettings - err = json.Unmarshal(*v, &diagnosticSettings) - if err != nil { - return err - } - dsr.DiagnosticSettings = &diagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]DiagnosticSettingsResource `json:"value,omitempty"` -} - -// Dimension specifies the criteria for converting log to metric. -type Dimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // Operator - Operator for dimension values - Operator *string `json:"operator,omitempty"` - // Values - List of dimension values - Values *[]string `json:"values,omitempty"` -} - -// DynamicMetricCriteria criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' - Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'Low', 'Medium', 'High' - AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` - // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` - // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) - IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - dmc.CriterionType = CriterionTypeDynamicThresholdCriterion - objectMap := make(map[string]interface{}) - if dmc.Operator != "" { - objectMap["operator"] = dmc.Operator - } - if dmc.AlertSensitivity != "" { - objectMap["alertSensitivity"] = dmc.AlertSensitivity - } - if dmc.FailingPeriods != nil { - objectMap["failingPeriods"] = dmc.FailingPeriods - } - if dmc.IgnoreDataBefore != nil { - objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore - } - if dmc.Name != nil { - objectMap["name"] = dmc.Name - } - if dmc.MetricName != nil { - objectMap["metricName"] = dmc.MetricName - } - if dmc.MetricNamespace != nil { - objectMap["metricNamespace"] = dmc.MetricNamespace - } - if dmc.TimeAggregation != nil { - objectMap["timeAggregation"] = dmc.TimeAggregation - } - if dmc.Dimensions != nil { - objectMap["dimensions"] = dmc.Dimensions - } - if dmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = dmc.SkipMetricValidation - } - if dmc.CriterionType != "" { - objectMap["criterionType"] = dmc.CriterionType - } - for k, v := range dmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return &dmc, true -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &dmc, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. -func (dmc *DynamicMetricCriteria) 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 "operator": - if v != nil { - var operator DynamicThresholdOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - dmc.Operator = operator - } - case "alertSensitivity": - if v != nil { - var alertSensitivity DynamicThresholdSensitivity - err = json.Unmarshal(*v, &alertSensitivity) - if err != nil { - return err - } - dmc.AlertSensitivity = alertSensitivity - } - case "failingPeriods": - if v != nil { - var failingPeriods DynamicThresholdFailingPeriods - err = json.Unmarshal(*v, &failingPeriods) - if err != nil { - return err - } - dmc.FailingPeriods = &failingPeriods - } - case "ignoreDataBefore": - if v != nil { - var ignoreDataBefore date.Time - err = json.Unmarshal(*v, &ignoreDataBefore) - if err != nil { - return err - } - dmc.IgnoreDataBefore = &ignoreDataBefore - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if dmc.AdditionalProperties == nil { - dmc.AdditionalProperties = make(map[string]interface{}) - } - dmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - dmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - dmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - dmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - dmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - dmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - dmc.CriterionType = criterionType - } - } - } - - return nil -} - -// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback -// time window required to raise an alert. -type DynamicThresholdFailingPeriods struct { - // NumberOfEvaluationPeriods - The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. - NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` - // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// Error error details. -type Error struct { - // Code - Error code identifying the specific error. - Code *string `json:"code,omitempty"` - // Message - Error message in the caller's locale. - Message *string `json:"message,omitempty"` -} - -// 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"` -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// EventData the Azure event log entries are of type EventData -type EventData struct { - // Authorization - READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization `json:"authorization,omitempty"` - // Claims - READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string `json:"claims"` - // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string `json:"caller,omitempty"` - // Description - READ-ONLY; the description of the event. - Description *string `json:"description,omitempty"` - // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string `json:"id,omitempty"` - // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string `json:"eventDataId,omitempty"` - // CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. - CorrelationID *string `json:"correlationId,omitempty"` - // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. - EventName *LocalizableString `json:"eventName,omitempty"` - // Category - READ-ONLY; the event category. - Category *LocalizableString `json:"category,omitempty"` - // HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). - HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` - // Level - READ-ONLY; the event level. Possible values include: 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' - Level EventLevel `json:"level,omitempty"` - // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` - // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - READ-ONLY; the resource type - ResourceType *LocalizableString `json:"resourceType,omitempty"` - // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. - OperationID *string `json:"operationId,omitempty"` - // OperationName - READ-ONLY; the operation name. - OperationName *LocalizableString `json:"operationName,omitempty"` - // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string `json:"properties"` - // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - Status *LocalizableString `json:"status,omitempty"` - // SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) - SubStatus *LocalizableString `json:"subStatus,omitempty"` - // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. - EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` - // SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. - SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` - // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // TenantID - READ-ONLY; the Azure tenant Id - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventData. -func (ed EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EventDataCollection represents collection of events. -type EventDataCollection struct { - autorest.Response `json:"-"` - // Value - this list that includes the Azure audit logs. - Value *[]EventData `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventDataCollectionIterator provides access to a complete listing of EventData values. -type EventDataCollectionIterator struct { - i int - page EventDataCollectionPage -} - -// 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 *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.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 *EventDataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventDataCollectionIterator) 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 EventDataCollectionIterator) Response() EventDataCollection { - 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 EventDataCollectionIterator) Value() EventData { - if !iter.page.NotDone() { - return EventData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventDataCollectionIterator type. -func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { - return EventDataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edc EventDataCollection) IsEmpty() bool { - return edc.Value == nil || len(*edc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edc EventDataCollection) hasNextLink() bool { - return edc.NextLink != nil && len(*edc.NextLink) != 0 -} - -// eventDataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !edc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edc.NextLink))) -} - -// EventDataCollectionPage contains a page of EventData values. -type EventDataCollectionPage struct { - fn func(context.Context, EventDataCollection) (EventDataCollection, error) - edc EventDataCollection -} - -// 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 *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.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.edc) - if err != nil { - return err - } - page.edc = 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 *EventDataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventDataCollectionPage) NotDone() bool { - return !page.edc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventDataCollectionPage) Response() EventDataCollection { - return page.edc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventDataCollectionPage) Values() []EventData { - if page.edc.IsEmpty() { - return nil - } - return *page.edc.Value -} - -// Creates a new instance of the EventDataCollectionPage type. -func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { - return EventDataCollectionPage{ - fn: getNextPage, - edc: cur, - } -} - -// HTTPRequestInfo the Http request info. -type HTTPRequestInfo struct { - // ClientRequestID - the client request id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ClientIPAddress - the client Ip Address - ClientIPAddress *string `json:"clientIpAddress,omitempty"` - // Method - the Http request method. - Method *string `json:"method,omitempty"` - // URI - the Uri. - URI *string `json:"uri,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) 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 "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` -} - -// LogMetricTrigger a log metrics trigger descriptor. -type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - The threshold of the metric trigger. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' - MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` - // MetricColumn - Evaluation of metric on a particular column - MetricColumn *string `json:"metricColumn,omitempty"` -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `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 LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) 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 logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) 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 - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// LogSearchRule log Search Rule Definition -type LogSearchRule struct { - // Description - The description of the Log Search rule. - Description *string `json:"description,omitempty"` - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Source - Data Source against which rule will Query Data - Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule *Schedule `json:"schedule,omitempty"` - // Action - Action needs to be taken on rule execution. - Action BasicAction `json:"action,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRule. -func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsr.Description != nil { - objectMap["description"] = lsr.Description - } - if lsr.Enabled != "" { - objectMap["enabled"] = lsr.Enabled - } - if lsr.Source != nil { - objectMap["source"] = lsr.Source - } - if lsr.Schedule != nil { - objectMap["schedule"] = lsr.Schedule - } - objectMap["action"] = lsr.Action - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. -func (lsr *LogSearchRule) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - lsr.Description = &description - } - case "enabled": - if v != nil { - var enabled Enabled - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - lsr.Enabled = enabled - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - lsr.LastUpdatedTime = &lastUpdatedTime - } - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - lsr.ProvisioningState = provisioningState - } - case "source": - if v != nil { - var source Source - err = json.Unmarshal(*v, &source) - if err != nil { - return err - } - lsr.Source = &source - } - case "schedule": - if v != nil { - var schedule Schedule - err = json.Unmarshal(*v, &schedule) - if err != nil { - return err - } - lsr.Schedule = &schedule - } - case "action": - if v != nil { - action, err := unmarshalBasicAction(*v) - if err != nil { - return err - } - lsr.Action = action - } - } - } - - return nil -} - -// LogSearchRulePatch log Search Rule Definition for Patching -type LogSearchRulePatch struct { - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` -} - -// LogSearchRuleResource the Log Search Rule resource. -type LogSearchRuleResource struct { - autorest.Response `json:"-"` - // LogSearchRule - The rule properties of the resource. - *LogSearchRule `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 LogSearchRuleResource. -func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrr.LogSearchRule != nil { - objectMap["properties"] = lsrr.LogSearchRule - } - if lsrr.Location != nil { - objectMap["location"] = lsrr.Location - } - if lsrr.Tags != nil { - objectMap["tags"] = lsrr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. -func (lsrr *LogSearchRuleResource) 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 logSearchRule LogSearchRule - err = json.Unmarshal(*v, &logSearchRule) - if err != nil { - return err - } - lsrr.LogSearchRule = &logSearchRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lsrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lsrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lsrr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lsrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lsrr.Tags = tags - } - } - } - - return nil -} - -// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. -type LogSearchRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the Log Search Rule resources. - Value *[]LogSearchRuleResource `json:"value,omitempty"` -} - -// LogSearchRuleResourcePatch the log search rule resource for patch operations. -type LogSearchRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogSearchRulePatch - The log search rule properties of the resource. - *LogSearchRulePatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. -func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrrp.Tags != nil { - objectMap["tags"] = lsrrp.Tags - } - if lsrrp.LogSearchRulePatch != nil { - objectMap["properties"] = lsrrp.LogSearchRulePatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. -func (lsrrp *LogSearchRuleResourcePatch) 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 - } - lsrrp.Tags = tags - } - case "properties": - if v != nil { - var logSearchRulePatch LogSearchRulePatch - err = json.Unmarshal(*v, &logSearchRulePatch) - if err != nil { - return err - } - lsrrp.LogSearchRulePatch = &logSearchRulePatch - } - } - } - - return nil -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogToMetricAction specify action need to be taken when rule type is converting log to metric -type LogToMetricAction struct { - // Criteria - Criteria of Metric - Criteria *[]Criteria `json:"criteria,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogToMetricAction. -func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { - ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction - objectMap := make(map[string]interface{}) - if ltma.Criteria != nil { - objectMap["criteria"] = ltma.Criteria - } - if ltma.OdataType != "" { - objectMap["odata.type"] = ltma.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return <ma, true -} - -// AsAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { - return <ma, true -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) 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 "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// MetricAlertAction an alert action. -type MetricAlertAction struct { - // ActionGroupID - the id of the action group to use. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. - WebHookProperties map[string]*string `json:"webHookProperties"` -} - -// MarshalJSON is the custom marshaler for MetricAlertAction. -func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if maa.ActionGroupID != nil { - objectMap["actionGroupId"] = maa.ActionGroupID - } - if maa.WebHookProperties != nil { - objectMap["webHookProperties"] = maa.WebHookProperties - } - return json.Marshal(objectMap) -} - -// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type BasicMetricAlertCriteria interface { - AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) - AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) - AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) - AsMetricAlertCriteria() (*MetricAlertCriteria, bool) -} - -// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - var masrmmc MetricAlertSingleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &masrmmc) - return masrmmc, err - case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - var wlac WebtestLocationAvailabilityCriteria - err := json.Unmarshal(body, &wlac) - return wlac, err - case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &mamrmmc) - return mamrmmc, err - default: - var mac MetricAlertCriteria - err := json.Unmarshal(body, &mac) - return mac, err - } -} -func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) - if err != nil { - return nil, err - } - macArray[index] = mac - } - return macArray, nil -} - -// MarshalJSON is the custom marshaler for MetricAlertCriteria. -func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { - mac.OdataType = OdataTypeMetricAlertCriteria - objectMap := make(map[string]interface{}) - if mac.OdataType != "" { - objectMap["odata.type"] = mac.OdataType - } - for k, v := range mac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return &mac, true -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mac, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. -func (mac *MetricAlertCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mac.AdditionalProperties == nil { - mac.AdditionalProperties = make(map[string]interface{}) - } - mac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mac.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple -// resource that has multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // AllOf - the list of multiple metric criteria for this 'all of' operation. - AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - mamrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if mamrmmc.AllOf != nil { - objectMap["allOf"] = mamrmmc.AllOf - } - if mamrmmc.OdataType != "" { - objectMap["odata.type"] = mamrmmc.OdataType - } - for k, v := range mamrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return &mamrmmc, true -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mamrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. -func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) - if err != nil { - return err - } - mamrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mamrmmc.AdditionalProperties == nil { - mamrmmc.AdditionalProperties = make(map[string]interface{}) - } - mamrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mamrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertProperties an alert rule. -type MetricAlertProperties struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertProperties. -func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapVar.Description != nil { - objectMap["description"] = mapVar.Description - } - if mapVar.Severity != nil { - objectMap["severity"] = mapVar.Severity - } - if mapVar.Enabled != nil { - objectMap["enabled"] = mapVar.Enabled - } - if mapVar.Scopes != nil { - objectMap["scopes"] = mapVar.Scopes - } - if mapVar.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency - } - if mapVar.WindowSize != nil { - objectMap["windowSize"] = mapVar.WindowSize - } - if mapVar.TargetResourceType != nil { - objectMap["targetResourceType"] = mapVar.TargetResourceType - } - if mapVar.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion - } - objectMap["criteria"] = mapVar.Criteria - if mapVar.AutoMitigate != nil { - objectMap["autoMitigate"] = mapVar.AutoMitigate - } - if mapVar.Actions != nil { - objectMap["actions"] = mapVar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. -func (mapVar *MetricAlertProperties) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapVar.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapVar.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapVar.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapVar.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapVar.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapVar.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapVar.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapVar.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapVar.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapVar.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapVar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapVar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// MetricAlertResource the metric alert resource. -type MetricAlertResource struct { - autorest.Response `json:"-"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `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 MetricAlertResource. -func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mar.MetricAlertProperties != nil { - objectMap["properties"] = mar.MetricAlertProperties - } - if mar.Location != nil { - objectMap["location"] = mar.Location - } - if mar.Tags != nil { - objectMap["tags"] = mar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. -func (mar *MetricAlertResource) 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 metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - mar.MetricAlertProperties = &metricAlertProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mar.Tags = tags - } - } - } - - return nil -} - -// MetricAlertResourceCollection represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertResource `json:"value,omitempty"` -} - -// MetricAlertResourcePatch the metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. -func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if marp.Tags != nil { - objectMap["tags"] = marp.Tags - } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. -func (marp *MetricAlertResourcePatch) 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 - } - marp.Tags = tags - } - case "properties": - if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - marp.MetricAlertProperties = &metricAlertProperties - } - } - } - - return nil -} - -// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single -// resource that has multiple metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // AllOf - The list of metric criteria for this 'all of' operation. - AllOf *[]MetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if masrmmc.AllOf != nil { - objectMap["allOf"] = masrmmc.AllOf - } - if masrmmc.OdataType != "" { - objectMap["odata.type"] = masrmmc.OdataType - } - for k, v := range masrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return &masrmmc, true -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &masrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. -func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - var allOf []MetricCriteria - err = json.Unmarshal(*v, &allOf) - if err != nil { - return err - } - masrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if masrmmc.AdditionalProperties == nil { - masrmmc.AdditionalProperties = make(map[string]interface{}) - } - masrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - masrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertStatus an alert status. -type MetricAlertStatus struct { - // Name - The status name. - Name *string `json:"name,omitempty"` - // ID - The alert rule arm id. - ID *string `json:"id,omitempty"` - // Type - The extended resource type name. - Type *string `json:"type,omitempty"` - // Properties - The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties `json:"properties,omitempty"` -} - -// MetricAlertStatusCollection represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertStatus `json:"value,omitempty"` -} - -// MetricAlertStatusProperties an alert status properties. -type MetricAlertStatusProperties struct { - // Dimensions - An object describing the type of the dimensions. - Dimensions map[string]*string `json:"dimensions"` - // Status - status value - Status *string `json:"status,omitempty"` - // Timestamp - UTC time when the status was checked. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. -func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if masp.Dimensions != nil { - objectMap["dimensions"] = masp.Dimensions - } - if masp.Status != nil { - objectMap["status"] = masp.Status - } - if masp.Timestamp != nil { - objectMap["timestamp"] = masp.Timestamp - } - return json.Marshal(objectMap) -} - -// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and -// the retention period for that time grain. -type MetricAvailability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// MetricCriteria criterion to filter metrics. -type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' - Operator Operator `json:"operator,omitempty"` - // Threshold - the criteria threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricCriteria. -func (mc MetricCriteria) MarshalJSON() ([]byte, error) { - mc.CriterionType = CriterionTypeStaticThresholdCriterion - objectMap := make(map[string]interface{}) - if mc.Operator != "" { - objectMap["operator"] = mc.Operator - } - if mc.Threshold != nil { - objectMap["threshold"] = mc.Threshold - } - if mc.Name != nil { - objectMap["name"] = mc.Name - } - if mc.MetricName != nil { - objectMap["metricName"] = mc.MetricName - } - if mc.MetricNamespace != nil { - objectMap["metricNamespace"] = mc.MetricNamespace - } - if mc.TimeAggregation != nil { - objectMap["timeAggregation"] = mc.TimeAggregation - } - if mc.Dimensions != nil { - objectMap["dimensions"] = mc.Dimensions - } - if mc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mc.SkipMetricValidation - } - if mc.CriterionType != "" { - objectMap["criterionType"] = mc.CriterionType - } - for k, v := range mc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return &mc, true -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. -func (mc *MetricCriteria) 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 "operator": - if v != nil { - var operator Operator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - mc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - mc.Threshold = &threshold - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mc.AdditionalProperties == nil { - mc.AdditionalProperties = make(map[string]interface{}) - } - mc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mc.CriterionType = criterionType - } - } - } - - return nil -} - -// MetricDefinition metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// MetricDefinitionCollection represents collection of metric definitions. -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricDimension specifies a metric dimension. -type MetricDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string `json:"operator,omitempty"` - // Values - list of dimension values. - Values *[]string `json:"values,omitempty"` -} - -// MetricNamespace metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // ID - The ID of the metricNamespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The name of the namespace. - Name *string `json:"name,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName `json:"properties,omitempty"` -} - -// MetricNamespaceCollection represents collection of metric namespaces. -type MetricNamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]MetricNamespace `json:"value,omitempty"` -} - -// MetricNamespaceName the fully qualified metric namespace name. -type MetricNamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` -} - -// MetricValue represents a metric value. -type MetricValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *float64 `json:"count,omitempty"` -} - -// BasicMultiMetricCriteria the types of conditions for a multi resource alert. -type BasicMultiMetricCriteria interface { - AsMetricCriteria() (*MetricCriteria, bool) - AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) - AsMultiMetricCriteria() (*MultiMetricCriteria, bool) -} - -// MultiMetricCriteria the types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["criterionType"] { - case string(CriterionTypeStaticThresholdCriterion): - var mc MetricCriteria - err := json.Unmarshal(body, &mc) - return mc, err - case string(CriterionTypeDynamicThresholdCriterion): - var dmc DynamicMetricCriteria - err := json.Unmarshal(body, &dmc) - return dmc, err - default: - var mmc MultiMetricCriteria - err := json.Unmarshal(body, &mmc) - return mmc, err - } -} -func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) - if err != nil { - return nil, err - } - mmcArray[index] = mmc - } - return mmcArray, nil -} - -// MarshalJSON is the custom marshaler for MultiMetricCriteria. -func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { - mmc.CriterionType = CriterionTypeMultiMetricCriteria - objectMap := make(map[string]interface{}) - if mmc.Name != nil { - objectMap["name"] = mmc.Name - } - if mmc.MetricName != nil { - objectMap["metricName"] = mmc.MetricName - } - if mmc.MetricNamespace != nil { - objectMap["metricNamespace"] = mmc.MetricNamespace - } - if mmc.TimeAggregation != nil { - objectMap["timeAggregation"] = mmc.TimeAggregation - } - if mmc.Dimensions != nil { - objectMap["dimensions"] = mmc.Dimensions - } - if mmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mmc.SkipMetricValidation - } - if mmc.CriterionType != "" { - objectMap["criterionType"] = mmc.CriterionType - } - for k, v := range mmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return &mmc, true -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. -func (mmc *MultiMetricCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mmc.AdditionalProperties == nil { - mmc.AdditionalProperties = make(map[string]interface{}) - } - mmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mmc.CriterionType = criterionType - } - } - } - - return nil -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Insights 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 operations supported by the Microsoft.Insights 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"` -} - -// ProxyOnlyResource a proxy only azure resource object -type ProxyOnlyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyOnlyResource. -func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProxyResource an azure resource object -type ProxyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource an azure resource object -type Resource 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,omitempty"` -} - -// ResponseWithError an error response from the API. -type ResponseWithError struct { - // Error - Error information. - Error *Error `json:"error,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) 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 "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. - Maximum *string `json:"maximum,omitempty"` - // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// Schedule defines how often to run the search and the time interval. -type Schedule struct { - // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. - FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` - // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` -} - -// SenderAuthorization the authorization used by the user who has performed the operation that led to this -// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and -// the 'scope' -type SenderAuthorization struct { - // Action - the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string `json:"action,omitempty"` - // Role - the role of the user. For instance: Subscription Admin - Role *string `json:"role,omitempty"` - // Scope - the scope. - Scope *string `json:"scope,omitempty"` -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// Source specifies the log search query. -type Source struct { - // Query - Log search query. Required for action type - AlertingAction - Query *string `json:"query,omitempty"` - // AuthorizedResources - List of Resource referred into query - AuthorizedResources *[]string `json:"authorizedResources,omitempty"` - // DataSourceID - The resource uri over which log search query is to be run. - DataSourceID *string `json:"dataSourceId,omitempty"` - // QueryType - Set value to 'ResultCount'. Possible values include: 'ResultCount' - QueryType QueryType `json:"queryType,omitempty"` -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) 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 "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]MetricValue `json:"data,omitempty"` -} - -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,omitempty"` -} - -// TriggerCondition the condition that results in the Log Search rule. -type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - Result or count threshold based on which rule should be triggered. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTrigger - Trigger condition for metric query rule - MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` -} - -// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. -type VMInsightsOnboardingStatus struct { - autorest.Response `json:"-"` - // VMInsightsOnboardingStatusProperties - Resource properties. - *VMInsightsOnboardingStatusProperties `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"` -} - -// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. -func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vios.VMInsightsOnboardingStatusProperties != nil { - objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. -func (vios *VMInsightsOnboardingStatus) 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 VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties - err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) - if err != nil { - return err - } - vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vios.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vios.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vios.Type = &typeVar - } - } - } - - return nil -} - -// VMInsightsOnboardingStatusProperties resource properties. -type VMInsightsOnboardingStatusProperties struct { - // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. - ResourceID *string `json:"resourceId,omitempty"` - // OnboardingStatus - The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: 'Onboarded', 'NotOnboarded', 'Unknown' - OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` - // DataStatus - The status of VM Insights data from the resource. When reported as `present` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: 'Present', 'NotPresent' - DataStatus DataStatus `json:"dataStatus,omitempty"` - // Data - Containers that currently store VM Insights data for the specified resource. - Data *[]DataContainer `json:"data,omitempty"` -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` -} - -// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // WebTestID - The Application Insights web test Id. - WebTestID *string `json:"webTestId,omitempty"` - // ComponentID - The Application Insights resource Id. - ComponentID *string `json:"componentId,omitempty"` - // FailedLocationCount - The number of failed locations. - FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - objectMap := make(map[string]interface{}) - if wlac.WebTestID != nil { - objectMap["webTestId"] = wlac.WebTestID - } - if wlac.ComponentID != nil { - objectMap["componentId"] = wlac.ComponentID - } - if wlac.FailedLocationCount != nil { - objectMap["failedLocationCount"] = wlac.FailedLocationCount - } - if wlac.OdataType != "" { - objectMap["odata.type"] = wlac.OdataType - } - for k, v := range wlac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return &wlac, true -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &wlac, true -} - -// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. -func (wlac *WebtestLocationAvailabilityCriteria) 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 "webTestId": - if v != nil { - var webTestID string - err = json.Unmarshal(*v, &webTestID) - if err != nil { - return err - } - wlac.WebTestID = &webTestID - } - case "componentId": - if v != nil { - var componentID string - err = json.Unmarshal(*v, &componentID) - if err != nil { - return err - } - wlac.ComponentID = &componentID - } - case "failedLocationCount": - if v != nil { - var failedLocationCount float64 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - wlac.FailedLocationCount = &failedLocationCount - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if wlac.AdditionalProperties == nil { - wlac.AdditionalProperties = make(map[string]interface{}) - } - wlac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - wlac.OdataType = odataType - } - } - } - - return nil -} - -// WorkspaceInfo information about a Log Analytics Workspace. -type WorkspaceInfo struct { - // ID - Azure Resource Manager identifier of the Log Analytics Workspace. - ID *string `json:"id,omitempty"` - // Location - Location of the Log Analytics workspace. - Location *string `json:"location,omitempty"` - // WorkspaceInfoProperties - Resource properties. - *WorkspaceInfoProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceInfo. -func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wi.ID != nil { - objectMap["id"] = wi.ID - } - if wi.Location != nil { - objectMap["location"] = wi.Location - } - if wi.WorkspaceInfoProperties != nil { - objectMap["properties"] = wi.WorkspaceInfoProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. -func (wi *WorkspaceInfo) 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 - } - wi.ID = &ID - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wi.Location = &location - } - case "properties": - if v != nil { - var workspaceInfoProperties WorkspaceInfoProperties - err = json.Unmarshal(*v, &workspaceInfoProperties) - if err != nil { - return err - } - wi.WorkspaceInfoProperties = &workspaceInfoProperties - } - } - } - - return nil -} - -// WorkspaceInfoProperties resource properties. -type WorkspaceInfoProperties struct { - // CustomerID - Log Analytics workspace identifier. - CustomerID *string `json:"customerId,omitempty"` -} diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/operations.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/operations.go deleted file mode 100644 index 3f82351c7f23..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -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 monitor 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 operations from Microsoft.Insights provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-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 -} diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/scheduledqueryrules.go deleted file mode 100644 index c9d43964ecb0..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/scheduledqueryrules.go +++ /dev/null @@ -1,511 +0,0 @@ -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" -) - -// ScheduledQueryRulesClient is the monitor Management Client -type ScheduledQueryRulesClient struct { - BaseClient -} - -// NewScheduledQueryRulesClient creates an instance of the ScheduledQueryRulesClient client. -func NewScheduledQueryRulesClient(subscriptionID string) ScheduledQueryRulesClient { - return NewScheduledQueryRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduledQueryRulesClientWithBaseURI creates an instance of the ScheduledQueryRulesClient 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 NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID string) ScheduledQueryRulesClient { - return ScheduledQueryRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an log search rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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 a Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) 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 Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) GetResponder(resp *http.Response) (result LogSearchRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the Log Search rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the Log Search rules within a subscription group. -// Parameters: -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update log search Rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) UpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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/monitor/mgmt/2018-11-01-preview/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/tenantactivitylogs.go deleted file mode 100644 index 7501f047bb38..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/tenantactivitylogs.go +++ /dev/null @@ -1,168 +0,0 @@ -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" -) - -// TenantActivityLogsClient is the monitor Management Client -type TenantActivityLogsClient struct { - BaseClient -} - -// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. -func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { - return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient 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 NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { - return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for -// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that -// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that -// were generated at the tenant level. -// Parameters: -// filter - reduces the set of data collected.
The **$filter** is very restricted and allows only the -// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq -// ''.
- List events for resource: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq -// ''.
- List events for a subscription: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation'.
- List events for a resource -// provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq -// 'Admin, Operation' and resourceProvider eq ''.
- List events for a correlation Id: -// api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq -// ''.
**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), - 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 TenantActivityLogsClient) 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 TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2018-11-01-preview/insights/version.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/version.go deleted file mode 100644 index a6d2e116352d..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -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/2018-11-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/monitor/mgmt/2018-11-01-preview/insights/vminsights.go b/services/preview/monitor/mgmt/2018-11-01-preview/insights/vminsights.go deleted file mode 100644 index 3787cb6fc53e..000000000000 --- a/services/preview/monitor/mgmt/2018-11-01-preview/insights/vminsights.go +++ /dev/null @@ -1,105 +0,0 @@ -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" -) - -// VMInsightsClient is the monitor Management Client -type VMInsightsClient struct { - BaseClient -} - -// NewVMInsightsClient creates an instance of the VMInsightsClient client. -func NewVMInsightsClient(subscriptionID string) VMInsightsClient { - return NewVMInsightsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVMInsightsClientWithBaseURI creates an instance of the VMInsightsClient 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 NewVMInsightsClientWithBaseURI(baseURI string, subscriptionID string) VMInsightsClient { - return VMInsightsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetOnboardingStatus retrieves the VM Insights onboarding status for the specified resource or resource scope. -// Parameters: -// resourceURI - the fully qualified Azure Resource manager identifier of the resource, or scope, whose status -// to retrieve. -func (client VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string) (result VMInsightsOnboardingStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VMInsightsClient.GetOnboardingStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOnboardingStatusPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetOnboardingStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure sending request") - return - } - - result, err = client.GetOnboardingStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetOnboardingStatusPreparer prepares the GetOnboardingStatus request. -func (client VMInsightsClient) GetOnboardingStatusPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-11-27-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOnboardingStatusSender sends the GetOnboardingStatus request. The method will close the -// http.Response Body if it receives an error. -func (client VMInsightsClient) GetOnboardingStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetOnboardingStatusResponder handles the response to the GetOnboardingStatus request. The method always -// closes the http.Response Body. -func (client VMInsightsClient) GetOnboardingStatusResponder(resp *http.Response) (result VMInsightsOnboardingStatus, 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/monitor/mgmt/2019-03-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2019-03-01/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/_meta.json b/services/preview/monitor/mgmt/2019-03-01/insights/_meta.json deleted file mode 100644 index 332ce7a9eee8..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2019-03", - "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-2019-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2019-03-01/insights/actiongroups.go deleted file mode 100644 index 02b8400fdcc0..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/actiongroups.go +++ /dev/null @@ -1,581 +0,0 @@ -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" -) - -// ActionGroupsClient is the monitor Management Client -type ActionGroupsClient struct { - BaseClient -} - -// NewActionGroupsClient creates an instance of the ActionGroupsClient client. -func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { - return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { - return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new action group or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroup - the action group to create or use for the update. -func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: actionGroup, - Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, - {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-03-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroup), - 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 ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-03-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) 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 -} - -// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. -// This operation is only supported for Email or SMS receivers. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// enableRequest - the receiver to re-enable. -func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) - } - - req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") - return - } - - resp, err := client.EnableReceiverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") - return - } - - result, err = client.EnableReceiverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") - return - } - - return -} - -// EnableReceiverPreparer prepares the EnableReceiver request. -func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-03-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/actionGroups/{actionGroupName}/subscribe", pathParameters), - autorest.WithJSON(enableRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableReceiverSender sends the EnableReceiver request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableReceiverResponder handles the response to the EnableReceiver request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-03-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all action groups in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActionGroupsClient) 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 = "2019-03-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/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all action groups in a subscription. -func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, 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 action group's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroupPatch - parameters supplied to the operation. -func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName, actionGroupPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-03-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroupPatch), - 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 ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2019-03-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2019-03-01/insights/activitylogalerts.go deleted file mode 100644 index 44aaf3ef1e4a..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/activitylogalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// ActivityLogAlertsClient is the monitor Management Client -type ActivityLogAlertsClient struct { - BaseClient -} - -// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient 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 NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new activity log alert or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlert - the activity log alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all activity log alerts in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) 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 = "2017-04-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/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all activity log alerts in a subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, 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 ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlertPatch - parameters supplied to the operation. -func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName, activityLogAlertPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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/monitor/mgmt/2019-03-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2019-03-01/insights/activitylogs.go deleted file mode 100644 index 16dd215e6ad9..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/activitylogs.go +++ /dev/null @@ -1,166 +0,0 @@ -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" -) - -// ActivityLogsClient is the monitor Management Client -type ActivityLogsClient struct { - BaseClient -} - -// NewActivityLogsClient creates an instance of the ActivityLogsClient client. -func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { - return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient 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 NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { - return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides the list of records from the activity logs. -// Parameters: -// filter - reduces the set of data collected.
This argument is required and it also requires at least the -// start date/time.
The **$filter** argument is very restricted and allows only the following patterns.
- -// *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and -// eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
- *List -// events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a subscription in a -// time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq -// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq -// 'correlationID'.

**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2019-03-01/insights/alertruleincidents.go deleted file mode 100644 index c3bf26828d8e..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/alertruleincidents.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// AlertRuleIncidentsClient is the monitor Management Client -type AlertRuleIncidentsClient struct { - BaseClient -} - -// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// incidentName - the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "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.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) 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 -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - return - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2019-03-01/insights/alertrules.go b/services/preview/monitor/mgmt/2019-03-01/insights/alertrules.go deleted file mode 100644 index f5a2ab682384..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/alertrules.go +++ /dev/null @@ -1,495 +0,0 @@ -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" -) - -// AlertRulesClient is the monitor Management Client -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 a classic metric alert rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 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 AlertRuleResource, 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName 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) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, 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) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 AlertRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the classic metric alert rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) 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 = "2016-03-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/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the classic metric alert rules within a subscription. -func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// alertRulesResource - parameters supplied to the operation. -func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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, ruleName, alertRulesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(alertRulesResource), - 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 AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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/monitor/mgmt/2019-03-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2019-03-01/insights/autoscalesettings.go deleted file mode 100644 index 86f253d0fb89..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/autoscalesettings.go +++ /dev/null @@ -1,580 +0,0 @@ -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" -) - -// AutoscaleSettingsClient is the monitor Management Client -type AutoscaleSettingsClient struct { - BaseClient -} - -// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// parameters - parameters supplied to the operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) 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-04-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/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 the autoscale settings for a subscription -func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// autoscaleSettingResource - parameters supplied to the operation. -func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName, autoscaleSettingResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(autoscaleSettingResource), - 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2019-03-01/insights/baselines.go b/services/preview/monitor/mgmt/2019-03-01/insights/baselines.go deleted file mode 100644 index fd77a7d29721..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/baselines.go +++ /dev/null @@ -1,143 +0,0 @@ -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" -) - -// BaselinesClient is the monitor Management Client -type BaselinesClient struct { - BaseClient -} - -// NewBaselinesClient creates an instance of the BaselinesClient client. -func NewBaselinesClient(subscriptionID string) BaselinesClient { - return NewBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBaselinesClientWithBaseURI creates an instance of the BaselinesClient 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 NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) BaselinesClient { - return BaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnames - the names of the metrics (comma separated) to retrieve. -// metricnamespace - metric namespace to query metric definitions for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result MetricBaselinesResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaselinesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "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.BaselinesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2019-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricBaselines", 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 BaselinesClient) 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 BaselinesClient) ListResponder(resp *http.Response) (result MetricBaselinesResponse, 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/monitor/mgmt/2019-03-01/insights/client.go b/services/preview/monitor/mgmt/2019-03-01/insights/client.go deleted file mode 100644 index a777181b0785..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package insights implements the Azure ARM Insights service API version . -// -// Monitor 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/monitor/mgmt/2019-03-01/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettings.go deleted file mode 100644 index 9708c52c2499..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettings.go +++ /dev/null @@ -1,332 +0,0 @@ -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" -) - -// DiagnosticSettingsClient is the monitor Management Client -type DiagnosticSettingsClient struct { - BaseClient -} - -// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. -func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { - return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient 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 NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { - return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, resourceURI, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-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("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) 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 active diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 active diagnostic settings list for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", 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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, 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/monitor/mgmt/2019-03-01/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettingscategory.go deleted file mode 100644 index 48365ed67e65..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/diagnosticsettingscategory.go +++ /dev/null @@ -1,180 +0,0 @@ -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" -) - -// DiagnosticSettingsCategoryClient is the monitor Management Client -type DiagnosticSettingsCategoryClient struct { - BaseClient -} - -// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. -func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { - return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient 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 NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { - return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, 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/monitor/mgmt/2019-03-01/insights/enums.go b/services/preview/monitor/mgmt/2019-03-01/insights/enums.go deleted file mode 100644 index b0a6aee8f846..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/enums.go +++ /dev/null @@ -1,645 +0,0 @@ -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. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // Average ... - Average AggregationType = "Average" - // Count ... - Count AggregationType = "Count" - // Maximum ... - Maximum AggregationType = "Maximum" - // Minimum ... - Minimum AggregationType = "Minimum" - // None ... - None AggregationType = "None" - // Total ... - Total AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{Average, Count, Maximum, Minimum, None, Total} -} - -// AlertSeverity enumerates the values for alert severity. -type AlertSeverity string - -const ( - // Four ... - Four AlertSeverity = "4" - // One ... - One AlertSeverity = "1" - // Three ... - Three AlertSeverity = "3" - // Two ... - Two AlertSeverity = "2" - // Zero ... - Zero AlertSeverity = "0" -) - -// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. -func PossibleAlertSeverityValues() []AlertSeverity { - return []AlertSeverity{Four, One, Three, Two, Zero} -} - -// BaselineSensitivity enumerates the values for baseline sensitivity. -type BaselineSensitivity string - -const ( - // High ... - High BaselineSensitivity = "High" - // Low ... - Low BaselineSensitivity = "Low" - // Medium ... - Medium BaselineSensitivity = "Medium" -) - -// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. -func PossibleBaselineSensitivityValues() []BaselineSensitivity { - return []BaselineSensitivity{High, Low, Medium} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // Logs ... - Logs CategoryType = "Logs" - // Metrics ... - Metrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{Logs, Metrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // Equals ... - Equals ComparisonOperationType = "Equals" - // GreaterThan ... - GreaterThan ComparisonOperationType = "GreaterThan" - // GreaterThanOrEqual ... - GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // LessThan ... - LessThan ComparisonOperationType = "LessThan" - // LessThanOrEqual ... - LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // NotEquals ... - NotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} -} - -// ConditionalOperator enumerates the values for conditional operator. -type ConditionalOperator string - -const ( - // ConditionalOperatorEqual ... - ConditionalOperatorEqual ConditionalOperator = "Equal" - // ConditionalOperatorGreaterThan ... - ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" - // ConditionalOperatorLessThan ... - ConditionalOperatorLessThan ConditionalOperator = "LessThan" -) - -// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. -func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} -} - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// CriterionType enumerates the values for criterion type. -type CriterionType string - -const ( - // CriterionTypeDynamicThresholdCriterion ... - CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - // CriterionTypeMultiMetricCriteria ... - CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" - // CriterionTypeStaticThresholdCriterion ... - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" -) - -// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. -func PossibleCriterionTypeValues() []CriterionType { - return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} -} - -// DataStatus enumerates the values for data status. -type DataStatus string - -const ( - // NotPresent ... - NotPresent DataStatus = "notPresent" - // Present ... - Present DataStatus = "present" -) - -// PossibleDataStatusValues returns an array of possible values for the DataStatus const type. -func PossibleDataStatusValues() []DataStatus { - return []DataStatus{NotPresent, Present} -} - -// DynamicThresholdOperator enumerates the values for dynamic threshold operator. -type DynamicThresholdOperator string - -const ( - // DynamicThresholdOperatorGreaterOrLessThan ... - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - // DynamicThresholdOperatorGreaterThan ... - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - // DynamicThresholdOperatorLessThan ... - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} -} - -// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. -type DynamicThresholdSensitivity string - -const ( - // DynamicThresholdSensitivityHigh ... - DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" - // DynamicThresholdSensitivityLow ... - DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" - // DynamicThresholdSensitivityMedium ... - DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} -} - -// Enabled enumerates the values for enabled. -type Enabled string - -const ( - // False ... - False Enabled = "false" - // True ... - True Enabled = "true" -) - -// PossibleEnabledValues returns an array of possible values for the Enabled const type. -func PossibleEnabledValues() []Enabled { - return []Enabled{False, True} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // EventLevelCritical ... - EventLevelCritical EventLevel = "Critical" - // EventLevelError ... - EventLevelError EventLevel = "Error" - // EventLevelInformational ... - EventLevelInformational EventLevel = "Informational" - // EventLevelVerbose ... - EventLevelVerbose EventLevel = "Verbose" - // EventLevelWarning ... - EventLevelWarning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// MetricTriggerType enumerates the values for metric trigger type. -type MetricTriggerType string - -const ( - // MetricTriggerTypeConsecutive ... - MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" - // MetricTriggerTypeTotal ... - MetricTriggerTypeTotal MetricTriggerType = "Total" -) - -// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. -func PossibleMetricTriggerTypeValues() []MetricTriggerType { - return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicAction enumerates the values for odata type basic action. -type OdataTypeBasicAction string - -const ( - // OdataTypeAction ... - OdataTypeAction OdataTypeBasicAction = "Action" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" -) - -// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. -func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} -} - -// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. -type OdataTypeBasicMetricAlertCriteria string - -const ( - // OdataTypeMetricAlertCriteria ... - OdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" - // OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... - OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. -func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { - return []OdataTypeBasicMetricAlertCriteria{OdataTypeMetricAlertCriteria, OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeRuleAction ... - OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeRuleCondition ... - OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} -} - -// OnboardingStatus enumerates the values for onboarding status. -type OnboardingStatus string - -const ( - // NotOnboarded ... - NotOnboarded OnboardingStatus = "notOnboarded" - // Onboarded ... - Onboarded OnboardingStatus = "onboarded" - // Unknown ... - Unknown OnboardingStatus = "unknown" -) - -// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. -func PossibleOnboardingStatusValues() []OnboardingStatus { - return []OnboardingStatus{NotOnboarded, Onboarded, Unknown} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorEquals ... - OperatorEquals Operator = "Equals" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Deploying ... - Deploying ProvisioningState = "Deploying" - // Failed ... - Failed ProvisioningState = "Failed" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Deploying, Failed, Succeeded} -} - -// QueryType enumerates the values for query type. -type QueryType string - -const ( - // ResultCount ... - ResultCount QueryType = "ResultCount" -) - -// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. -func PossibleQueryTypeValues() []QueryType { - return []QueryType{ResultCount} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // ReceiverStatusDisabled ... - ReceiverStatusDisabled ReceiverStatus = "Disabled" - // ReceiverStatusEnabled ... - ReceiverStatusEnabled ReceiverStatus = "Enabled" - // ReceiverStatusNotSpecified ... - ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // Data ... - Data ResultType = "Data" - // Metadata ... - Metadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{Data, Metadata} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ChangeCount ... - ChangeCount ScaleType = "ChangeCount" - // ExactCount ... - ExactCount ScaleType = "ExactCount" - // PercentChangeCount ... - PercentChangeCount ScaleType = "PercentChangeCount" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/eventcategories.go b/services/preview/monitor/mgmt/2019-03-01/insights/eventcategories.go deleted file mode 100644 index 86e59b424363..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/eventcategories.go +++ /dev/null @@ -1,99 +0,0 @@ -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" -) - -// EventCategoriesClient is the monitor Management Client -type EventCategoriesClient struct { - BaseClient -} - -// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. -func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { - return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { - return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available event categories supported in the Activity Logs Service.
The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "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.EventCategoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), - 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2019-03-01/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2019-03-01/insights/insightsapi/interfaces.go deleted file mode 100644 index ff0f950e76d9..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,206 +0,0 @@ -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/monitor/mgmt/2019-03-01/insights" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) - List(ctx context.Context) (result insights.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) - -// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. -type DiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) -} - -var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) - -// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) -} - -var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) - -// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. -type ActivityLogAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActivityLogAlertList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActivityLogAlertList, err error) - Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch insights.ActivityLogAlertPatchBody) (result insights.ActivityLogAlertResource, err error) -} - -var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) - -// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. -type ActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result insights.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) - -// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. -type TenantActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) - -// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. -type MetricDefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string, metricnamespace string) (result insights.MetricDefinitionCollection, err error) -} - -var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) - -// MetricsClientAPI contains the set of methods on the MetricsClient type. -type MetricsClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType insights.ResultType, metricnamespace string) (result insights.Response, err error) -} - -var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - -// BaselinesClientAPI contains the set of methods on the BaselinesClient type. -type BaselinesClientAPI interface { - List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) -} - -var _ BaselinesClientAPI = (*insights.BaselinesClient)(nil) - -// MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. -type MetricAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.MetricAlertResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.MetricAlertResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResourcePatch) (result insights.MetricAlertResource, err error) -} - -var _ MetricAlertsClientAPI = (*insights.MetricAlertsClient)(nil) - -// MetricAlertsStatusClientAPI contains the set of methods on the MetricAlertsStatusClient type. -type MetricAlertsStatusClientAPI interface { - List(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertStatusCollection, err error) - ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result insights.MetricAlertStatusCollection, err error) -} - -var _ MetricAlertsStatusClientAPI = (*insights.MetricAlertsStatusClient)(nil) - -// ScheduledQueryRulesClientAPI contains the set of methods on the ScheduledQueryRulesClient type. -type ScheduledQueryRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResource) (result insights.LogSearchRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.LogSearchRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result insights.LogSearchRuleResourceCollection, err error) - ListBySubscription(ctx context.Context, filter string) (result insights.LogSearchRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResourcePatch) (result insights.LogSearchRuleResource, err error) -} - -var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) - -// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. -type MetricNamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) -} - -var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) - -// VMInsightsClientAPI contains the set of methods on the VMInsightsClient type. -type VMInsightsClientAPI interface { - GetOnboardingStatus(ctx context.Context, resourceURI string) (result insights.VMInsightsOnboardingStatus, err error) -} - -var _ VMInsightsClientAPI = (*insights.VMInsightsClient)(nil) diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2019-03-01/insights/logprofiles.go deleted file mode 100644 index ad1500b87bc9..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/logprofiles.go +++ /dev/null @@ -1,418 +0,0 @@ -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" -) - -// LogProfilesClient is the monitor Management Client -type LogProfilesClient struct { - BaseClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// Parameters: -// logProfileName - the name of the log profile. -// parameters - parameters supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) 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 the log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 LogProfilesResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// logProfileName - the name of the log profile. -// logProfilesResource - parameters supplied to the operation. -func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName, logProfilesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(logProfilesResource), - 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 LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2019-03-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2019-03-01/insights/metricalerts.go deleted file mode 100644 index 94231b6fa34e..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metricalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// MetricAlertsClient is the monitor Management Client -type MetricAlertsClient struct { - BaseClient -} - -// NewMetricAlertsClient creates an instance of the MetricAlertsClient client. -func NewMetricAlertsClient(subscriptionID string) MetricAlertsClient { - return NewMetricAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsClientWithBaseURI creates an instance of the MetricAlertsClient 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 NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsClient { - return MetricAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result MetricAlertResource, 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 alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) 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 an alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) GetResponder(resp *http.Response) (result MetricAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve alert rule definitions in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MetricAlertsClient) 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 = "2018-03-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/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieve alert rule definitions in a subscription. -func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) UpdateResponder(resp *http.Response) (result MetricAlertResource, 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/monitor/mgmt/2019-03-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2019-03-01/insights/metricalertsstatus.go deleted file mode 100644 index 43cfaed42765..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metricalertsstatus.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// MetricAlertsStatusClient is the monitor Management Client -type MetricAlertsStatusClient struct { - BaseClient -} - -// NewMetricAlertsStatusClient creates an instance of the MetricAlertsStatusClient client. -func NewMetricAlertsStatusClient(subscriptionID string) MetricAlertsStatusClient { - return NewMetricAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsStatusClientWithBaseURI creates an instance of the MetricAlertsStatusClient 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 NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsStatusClient { - return MetricAlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "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.MetricAlertsStatusClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status", 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 MetricAlertsStatusClient) 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 MetricAlertsStatusClient) ListResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByName retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// statusName - the name of the status. -func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.ListByName") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure sending request") - return - } - - result, err = client.ListByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure responding to request") - return - } - - return -} - -// ListByNamePreparer prepares the ListByName request. -func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "statusName": autorest.Encode("path", statusName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status/{statusName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNameSender sends the ListByName request. The method will close the -// http.Response Body if it receives an error. -func (client MetricAlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNameResponder handles the response to the ListByName request. The method always -// closes the http.Response Body. -func (client MetricAlertsStatusClient) ListByNameResponder(resp *http.Response) (result MetricAlertStatusCollection, 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/monitor/mgmt/2019-03-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2019-03-01/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -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" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient 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 NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - 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: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-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("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.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, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "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.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", 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 MetricBaselineClient) 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 MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, 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/monitor/mgmt/2019-03-01/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2019-03-01/insights/metricdefinitions.go deleted file mode 100644 index 69fc2e0b465a..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metricdefinitions.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricDefinitionsClient is the monitor Management Client -type MetricDefinitionsClient struct { - BaseClient -} - -// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. -func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { - return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient 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 NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { - return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result MetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "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.MetricDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", 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 MetricDefinitionsClient) 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 MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, 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/monitor/mgmt/2019-03-01/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2019-03-01/insights/metricnamespaces.go deleted file mode 100644 index f2ef47baf802..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metricnamespaces.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricNamespacesClient is the monitor Management Client -type MetricNamespacesClient struct { - BaseClient -} - -// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. -func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { - return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient 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 NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { - return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric namespaces for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, startTime) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "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.MetricNamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", 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 MetricNamespacesClient) 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 MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, 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/monitor/mgmt/2019-03-01/insights/metrics.go b/services/preview/monitor/mgmt/2019-03-01/insights/metrics.go deleted file mode 100644 index 97687a09b498..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/metrics.go +++ /dev/null @@ -1,152 +0,0 @@ -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" -) - -// MetricsClient is the monitor Management Client -type MetricsClient struct { - BaseClient -} - -// NewMetricsClient creates an instance of the MetricsClient client. -func NewMetricsClient(subscriptionID string) MetricsClient { - return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricsClientWithBaseURI creates an instance of the MetricsClient 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 NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { - return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (result Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "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.MetricsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/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 MetricsClient) 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 MetricsClient) ListResponder(resp *http.Response) (result Response, 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/monitor/mgmt/2019-03-01/insights/models.go b/services/preview/monitor/mgmt/2019-03-01/insights/models.go deleted file mode 100644 index 57c922b5a0fd..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/models.go +++ /dev/null @@ -1,5588 +0,0 @@ -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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2019-03-01/insights" - -// BasicAction action descriptor. -type BasicAction interface { - AsAlertingAction() (*AlertingAction, bool) - AsLogToMetricAction() (*LogToMetricAction, bool) - AsAction() (*Action, bool) -} - -// Action action descriptor. -type Action struct { - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicAction(body []byte) (BasicAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): - var aa AlertingAction - err := json.Unmarshal(body, &aa) - return aa, err - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): - var ltma LogToMetricAction - err := json.Unmarshal(body, <ma) - return ltma, err - default: - var a Action - err := json.Unmarshal(body, &a) - return a, err - } -} -func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - aArray := make([]BasicAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - a, err := unmarshalBasicAction(*rawMessage) - if err != nil { - return nil, err - } - aArray[index] = a - } - return aArray, nil -} - -// MarshalJSON is the custom marshaler for Action. -func (a Action) MarshalJSON() ([]byte, error) { - a.OdataType = OdataTypeAction - objectMap := make(map[string]interface{}) - if a.OdataType != "" { - objectMap["odata.type"] = a.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for Action. -func (a Action) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for Action. -func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for Action. -func (a Action) AsAction() (*Action, bool) { - return &a, true -} - -// AsBasicAction is the BasicAction implementation for Action. -func (a Action) AsBasicAction() (BasicAction, bool) { - return &a, true -} - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) 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 - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `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 ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) 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 actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActivityLogAlert an Azure activity log alert. -type ActivityLogAlert struct { - // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. - Scopes *[]string `json:"scopes,omitempty"` - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` - // Condition - The condition that will cause this alert to activate. - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - // Actions - The actions that will activate when the condition is met. - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - // Description - A description of this activity log alert. - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - // ActionGroupID - The resourceId of the action group. This cannot be null or empty. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string `json:"webhookProperties"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. -func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alaag.ActionGroupID != nil { - objectMap["actionGroupId"] = alaag.ActionGroupID - } - if alaag.WebhookProperties != nil { - objectMap["webhookProperties"] = alaag.WebhookProperties - } - return json.Marshal(objectMap) -} - -// ActivityLogAlertActionList a list of activity log alert actions. -type ActivityLogAlertActionList struct { - // ActionGroups - The list of activity log alerts. - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member -// conditions are met. -type ActivityLogAlertAllOfCondition struct { - // AllOf - The list of activity log alert conditions. - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log -// field and value. -type ActivityLogAlertLeafCondition struct { - // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. - Field *string `json:"field,omitempty"` - // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - // Value - The list of activity log alerts. - Value *[]ActivityLogAlertResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityLogAlertPatch an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. -type ActivityLogAlertPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActivityLogAlertPatch - The activity log alert settings for an update operation. - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. -func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alapb.Tags != nil { - objectMap["tags"] = alapb.Tags - } - if alapb.ActivityLogAlertPatch != nil { - objectMap["properties"] = alapb.ActivityLogAlertPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. -func (alapb *ActivityLogAlertPatchBody) 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 - } - alapb.Tags = tags - } - case "properties": - if v != nil { - var activityLogAlertPatch ActivityLogAlertPatch - err = json.Unmarshal(*v, &activityLogAlertPatch) - if err != nil { - return err - } - alapb.ActivityLogAlertPatch = &activityLogAlertPatch - } - } - } - - return nil -} - -// ActivityLogAlertResource an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `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 ActivityLogAlertResource. -func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alar.ActivityLogAlert != nil { - objectMap["properties"] = alar.ActivityLogAlert - } - if alar.Location != nil { - objectMap["location"] = alar.Location - } - if alar.Tags != nil { - objectMap["tags"] = alar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) 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 activityLogAlert ActivityLogAlert - err = json.Unmarshal(*v, &activityLogAlert) - if err != nil { - return err - } - alar.ActivityLogAlert = &activityLogAlert - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - alar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - alar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - alar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alar.Tags = tags - } - } - } - - return nil -} - -// AlertingAction specify action need to be taken when rule type is Alert -type AlertingAction struct { - // Severity - Severity of the alert. Possible values include: 'Zero', 'One', 'Two', 'Three', 'Four' - Severity AlertSeverity `json:"severity,omitempty"` - // AznsAction - Azure action group reference. - AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` - // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. - ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` - // Trigger - The trigger condition that results in the alert rule being. - Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertingAction. -func (aa AlertingAction) MarshalJSON() ([]byte, error) { - aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction - objectMap := make(map[string]interface{}) - if aa.Severity != "" { - objectMap["severity"] = aa.Severity - } - if aa.AznsAction != nil { - objectMap["aznsAction"] = aa.AznsAction - } - if aa.ThrottlingInMin != nil { - objectMap["throttlingInMin"] = aa.ThrottlingInMin - } - if aa.Trigger != nil { - objectMap["trigger"] = aa.Trigger - } - if aa.OdataType != "" { - objectMap["odata.type"] = aa.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { - return &aa, true -} - -// AsLogToMetricAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { - return &aa, true -} - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) 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 - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `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 AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) 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 alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) 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 - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// ArmRoleReceiver an arm role receiver. -type ArmRoleReceiver struct { - // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // RoleID - The arm role id. - RoleID *string `json:"roleId,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `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 AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) 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 autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) - if err != nil { - return err - } - page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) 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 - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzNsActionGroup azure action group -type AzNsActionGroup struct { - // ActionGroup - Azure Action Group reference. - ActionGroup *[]string `json:"actionGroup,omitempty"` - // EmailSubject - Custom subject override for all email ids in Azure action group - EmailSubject *string `json:"emailSubject,omitempty"` - // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group - CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadata represents a baseline metadata value. -type BaselineMetadata struct { - // Name - Name of the baseline metadata. - Name *string `json:"name,omitempty"` - // Value - Value of the baseline metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) 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 - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - -// Criteria specifies the criteria for converting log to metric. -type Criteria struct { - // MetricName - Name of the metric - MetricName *string `json:"metricName,omitempty"` - // Dimensions - List of Dimensions for creating metric - Dimensions *[]Dimension `json:"dimensions,omitempty"` -} - -// DataContainer information about a container with data for a given resource. -type DataContainer struct { - // Workspace - Log Analytics workspace information. - Workspace *WorkspaceInfo `json:"workspace,omitempty"` -} - -// DiagnosticSettings the diagnostic settings. -type DiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// DiagnosticSettingsCategory the diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' - CategoryType CategoryType `json:"categoryType,omitempty"` -} - -// DiagnosticSettingsCategoryResource the diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` - // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. - *DiagnosticSettingsCategory `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. -func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dscr.DiagnosticSettingsCategory != nil { - objectMap["properties"] = dscr.DiagnosticSettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. -func (dscr *DiagnosticSettingsCategoryResource) 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 diagnosticSettingsCategory DiagnosticSettingsCategory - err = json.Unmarshal(*v, &diagnosticSettingsCategory) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dscr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category -// resources. -type DiagnosticSettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` -} - -// DiagnosticSettingsResource the diagnostic setting resource. -type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // DiagnosticSettings - Properties of a Diagnostic Settings Resource. - *DiagnosticSettings `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. -func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DiagnosticSettings != nil { - objectMap["properties"] = dsr.DiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. -func (dsr *DiagnosticSettingsResource) 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 diagnosticSettings DiagnosticSettings - err = json.Unmarshal(*v, &diagnosticSettings) - if err != nil { - return err - } - dsr.DiagnosticSettings = &diagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]DiagnosticSettingsResource `json:"value,omitempty"` -} - -// Dimension specifies the criteria for converting log to metric. -type Dimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // Operator - Operator for dimension values - Operator *string `json:"operator,omitempty"` - // Values - List of dimension values - Values *[]string `json:"values,omitempty"` -} - -// DynamicMetricCriteria criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' - Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' - AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` - // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` - // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) - IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - dmc.CriterionType = CriterionTypeDynamicThresholdCriterion - objectMap := make(map[string]interface{}) - if dmc.Operator != "" { - objectMap["operator"] = dmc.Operator - } - if dmc.AlertSensitivity != "" { - objectMap["alertSensitivity"] = dmc.AlertSensitivity - } - if dmc.FailingPeriods != nil { - objectMap["failingPeriods"] = dmc.FailingPeriods - } - if dmc.IgnoreDataBefore != nil { - objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore - } - if dmc.Name != nil { - objectMap["name"] = dmc.Name - } - if dmc.MetricName != nil { - objectMap["metricName"] = dmc.MetricName - } - if dmc.MetricNamespace != nil { - objectMap["metricNamespace"] = dmc.MetricNamespace - } - if dmc.TimeAggregation != nil { - objectMap["timeAggregation"] = dmc.TimeAggregation - } - if dmc.Dimensions != nil { - objectMap["dimensions"] = dmc.Dimensions - } - if dmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = dmc.SkipMetricValidation - } - if dmc.CriterionType != "" { - objectMap["criterionType"] = dmc.CriterionType - } - for k, v := range dmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return &dmc, true -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &dmc, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. -func (dmc *DynamicMetricCriteria) 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 "operator": - if v != nil { - var operator DynamicThresholdOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - dmc.Operator = operator - } - case "alertSensitivity": - if v != nil { - var alertSensitivity DynamicThresholdSensitivity - err = json.Unmarshal(*v, &alertSensitivity) - if err != nil { - return err - } - dmc.AlertSensitivity = alertSensitivity - } - case "failingPeriods": - if v != nil { - var failingPeriods DynamicThresholdFailingPeriods - err = json.Unmarshal(*v, &failingPeriods) - if err != nil { - return err - } - dmc.FailingPeriods = &failingPeriods - } - case "ignoreDataBefore": - if v != nil { - var ignoreDataBefore date.Time - err = json.Unmarshal(*v, &ignoreDataBefore) - if err != nil { - return err - } - dmc.IgnoreDataBefore = &ignoreDataBefore - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if dmc.AdditionalProperties == nil { - dmc.AdditionalProperties = make(map[string]interface{}) - } - dmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - dmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - dmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - dmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - dmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - dmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - dmc.CriterionType = criterionType - } - } - } - - return nil -} - -// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback -// time window required to raise an alert. -type DynamicThresholdFailingPeriods struct { - // NumberOfEvaluationPeriods - The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. - NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` - // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - if er.UseCommonAlertSchema != nil { - objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// Error error details. -type Error struct { - // Code - Error code identifying the specific error. - Code *string `json:"code,omitempty"` - // Message - Error message in the caller's locale. - Message *string `json:"message,omitempty"` -} - -// 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"` -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// EventData the Azure event log entries are of type EventData -type EventData struct { - // Authorization - READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization `json:"authorization,omitempty"` - // Claims - READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string `json:"claims"` - // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string `json:"caller,omitempty"` - // Description - READ-ONLY; the description of the event. - Description *string `json:"description,omitempty"` - // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string `json:"id,omitempty"` - // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string `json:"eventDataId,omitempty"` - // CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. - CorrelationID *string `json:"correlationId,omitempty"` - // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. - EventName *LocalizableString `json:"eventName,omitempty"` - // Category - READ-ONLY; the event category. - Category *LocalizableString `json:"category,omitempty"` - // HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). - HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` - // Level - READ-ONLY; the event level. Possible values include: 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' - Level EventLevel `json:"level,omitempty"` - // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` - // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - READ-ONLY; the resource type - ResourceType *LocalizableString `json:"resourceType,omitempty"` - // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. - OperationID *string `json:"operationId,omitempty"` - // OperationName - READ-ONLY; the operation name. - OperationName *LocalizableString `json:"operationName,omitempty"` - // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string `json:"properties"` - // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - Status *LocalizableString `json:"status,omitempty"` - // SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) - SubStatus *LocalizableString `json:"subStatus,omitempty"` - // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. - EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` - // SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. - SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` - // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // TenantID - READ-ONLY; the Azure tenant Id - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventData. -func (ed EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EventDataCollection represents collection of events. -type EventDataCollection struct { - autorest.Response `json:"-"` - // Value - this list that includes the Azure audit logs. - Value *[]EventData `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventDataCollectionIterator provides access to a complete listing of EventData values. -type EventDataCollectionIterator struct { - i int - page EventDataCollectionPage -} - -// 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 *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.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 *EventDataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventDataCollectionIterator) 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 EventDataCollectionIterator) Response() EventDataCollection { - 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 EventDataCollectionIterator) Value() EventData { - if !iter.page.NotDone() { - return EventData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventDataCollectionIterator type. -func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { - return EventDataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edc EventDataCollection) IsEmpty() bool { - return edc.Value == nil || len(*edc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edc EventDataCollection) hasNextLink() bool { - return edc.NextLink != nil && len(*edc.NextLink) != 0 -} - -// eventDataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !edc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edc.NextLink))) -} - -// EventDataCollectionPage contains a page of EventData values. -type EventDataCollectionPage struct { - fn func(context.Context, EventDataCollection) (EventDataCollection, error) - edc EventDataCollection -} - -// 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 *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.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.edc) - if err != nil { - return err - } - page.edc = 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 *EventDataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventDataCollectionPage) NotDone() bool { - return !page.edc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventDataCollectionPage) Response() EventDataCollection { - return page.edc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventDataCollectionPage) Values() []EventData { - if page.edc.IsEmpty() { - return nil - } - return *page.edc.Value -} - -// Creates a new instance of the EventDataCollectionPage type. -func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { - return EventDataCollectionPage{ - fn: getNextPage, - edc: cur, - } -} - -// HTTPRequestInfo the Http request info. -type HTTPRequestInfo struct { - // ClientRequestID - the client request id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ClientIPAddress - the client Ip Address - ClientIPAddress *string `json:"clientIpAddress,omitempty"` - // Method - the Http request method. - Method *string `json:"method,omitempty"` - // URI - the Uri. - URI *string `json:"uri,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) 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 "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// LogMetricTrigger a log metrics trigger descriptor. -type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - The threshold of the metric trigger. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' - MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` - // MetricColumn - Evaluation of metric on a particular column - MetricColumn *string `json:"metricColumn,omitempty"` -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `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 LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) 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 logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) 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 - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// LogSearchRule log Search Rule Definition -type LogSearchRule struct { - // Description - The description of the Log Search rule. - Description *string `json:"description,omitempty"` - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Source - Data Source against which rule will Query Data - Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule *Schedule `json:"schedule,omitempty"` - // Action - Action needs to be taken on rule execution. - Action BasicAction `json:"action,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRule. -func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsr.Description != nil { - objectMap["description"] = lsr.Description - } - if lsr.Enabled != "" { - objectMap["enabled"] = lsr.Enabled - } - if lsr.Source != nil { - objectMap["source"] = lsr.Source - } - if lsr.Schedule != nil { - objectMap["schedule"] = lsr.Schedule - } - objectMap["action"] = lsr.Action - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. -func (lsr *LogSearchRule) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - lsr.Description = &description - } - case "enabled": - if v != nil { - var enabled Enabled - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - lsr.Enabled = enabled - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - lsr.LastUpdatedTime = &lastUpdatedTime - } - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - lsr.ProvisioningState = provisioningState - } - case "source": - if v != nil { - var source Source - err = json.Unmarshal(*v, &source) - if err != nil { - return err - } - lsr.Source = &source - } - case "schedule": - if v != nil { - var schedule Schedule - err = json.Unmarshal(*v, &schedule) - if err != nil { - return err - } - lsr.Schedule = &schedule - } - case "action": - if v != nil { - action, err := unmarshalBasicAction(*v) - if err != nil { - return err - } - lsr.Action = action - } - } - } - - return nil -} - -// LogSearchRulePatch log Search Rule Definition for Patching -type LogSearchRulePatch struct { - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` -} - -// LogSearchRuleResource the Log Search Rule resource. -type LogSearchRuleResource struct { - autorest.Response `json:"-"` - // LogSearchRule - The rule properties of the resource. - *LogSearchRule `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 LogSearchRuleResource. -func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrr.LogSearchRule != nil { - objectMap["properties"] = lsrr.LogSearchRule - } - if lsrr.Location != nil { - objectMap["location"] = lsrr.Location - } - if lsrr.Tags != nil { - objectMap["tags"] = lsrr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. -func (lsrr *LogSearchRuleResource) 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 logSearchRule LogSearchRule - err = json.Unmarshal(*v, &logSearchRule) - if err != nil { - return err - } - lsrr.LogSearchRule = &logSearchRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lsrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lsrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lsrr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lsrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lsrr.Tags = tags - } - } - } - - return nil -} - -// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. -type LogSearchRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the Log Search Rule resources. - Value *[]LogSearchRuleResource `json:"value,omitempty"` -} - -// LogSearchRuleResourcePatch the log search rule resource for patch operations. -type LogSearchRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogSearchRulePatch - The log search rule properties of the resource. - *LogSearchRulePatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. -func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrrp.Tags != nil { - objectMap["tags"] = lsrrp.Tags - } - if lsrrp.LogSearchRulePatch != nil { - objectMap["properties"] = lsrrp.LogSearchRulePatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. -func (lsrrp *LogSearchRuleResourcePatch) 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 - } - lsrrp.Tags = tags - } - case "properties": - if v != nil { - var logSearchRulePatch LogSearchRulePatch - err = json.Unmarshal(*v, &logSearchRulePatch) - if err != nil { - return err - } - lsrrp.LogSearchRulePatch = &logSearchRulePatch - } - } - } - - return nil -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogToMetricAction specify action need to be taken when rule type is converting log to metric -type LogToMetricAction struct { - // Criteria - Criteria of Metric - Criteria *[]Criteria `json:"criteria,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogToMetricAction. -func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { - ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction - objectMap := make(map[string]interface{}) - if ltma.Criteria != nil { - objectMap["criteria"] = ltma.Criteria - } - if ltma.OdataType != "" { - objectMap["odata.type"] = ltma.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return <ma, true -} - -// AsAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { - return <ma, true -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) 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 "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// MetricAlertAction an alert action. -type MetricAlertAction struct { - // ActionGroupID - the id of the action group to use. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. - WebHookProperties map[string]*string `json:"webHookProperties"` -} - -// MarshalJSON is the custom marshaler for MetricAlertAction. -func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if maa.ActionGroupID != nil { - objectMap["actionGroupId"] = maa.ActionGroupID - } - if maa.WebHookProperties != nil { - objectMap["webHookProperties"] = maa.WebHookProperties - } - return json.Marshal(objectMap) -} - -// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type BasicMetricAlertCriteria interface { - AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) - AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) - AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) - AsMetricAlertCriteria() (*MetricAlertCriteria, bool) -} - -// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - var masrmmc MetricAlertSingleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &masrmmc) - return masrmmc, err - case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - var wlac WebtestLocationAvailabilityCriteria - err := json.Unmarshal(body, &wlac) - return wlac, err - case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &mamrmmc) - return mamrmmc, err - default: - var mac MetricAlertCriteria - err := json.Unmarshal(body, &mac) - return mac, err - } -} -func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) - if err != nil { - return nil, err - } - macArray[index] = mac - } - return macArray, nil -} - -// MarshalJSON is the custom marshaler for MetricAlertCriteria. -func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { - mac.OdataType = OdataTypeMetricAlertCriteria - objectMap := make(map[string]interface{}) - if mac.OdataType != "" { - objectMap["odata.type"] = mac.OdataType - } - for k, v := range mac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return &mac, true -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mac, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. -func (mac *MetricAlertCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mac.AdditionalProperties == nil { - mac.AdditionalProperties = make(map[string]interface{}) - } - mac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mac.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple -// resource that has multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // AllOf - the list of multiple metric criteria for this 'all of' operation. - AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - mamrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if mamrmmc.AllOf != nil { - objectMap["allOf"] = mamrmmc.AllOf - } - if mamrmmc.OdataType != "" { - objectMap["odata.type"] = mamrmmc.OdataType - } - for k, v := range mamrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return &mamrmmc, true -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mamrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. -func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) - if err != nil { - return err - } - mamrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mamrmmc.AdditionalProperties == nil { - mamrmmc.AdditionalProperties = make(map[string]interface{}) - } - mamrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mamrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertProperties an alert rule. -type MetricAlertProperties struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertProperties. -func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapVar.Description != nil { - objectMap["description"] = mapVar.Description - } - if mapVar.Severity != nil { - objectMap["severity"] = mapVar.Severity - } - if mapVar.Enabled != nil { - objectMap["enabled"] = mapVar.Enabled - } - if mapVar.Scopes != nil { - objectMap["scopes"] = mapVar.Scopes - } - if mapVar.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency - } - if mapVar.WindowSize != nil { - objectMap["windowSize"] = mapVar.WindowSize - } - if mapVar.TargetResourceType != nil { - objectMap["targetResourceType"] = mapVar.TargetResourceType - } - if mapVar.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion - } - objectMap["criteria"] = mapVar.Criteria - if mapVar.AutoMitigate != nil { - objectMap["autoMitigate"] = mapVar.AutoMitigate - } - if mapVar.Actions != nil { - objectMap["actions"] = mapVar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. -func (mapVar *MetricAlertProperties) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapVar.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapVar.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapVar.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapVar.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapVar.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapVar.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapVar.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapVar.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapVar.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapVar.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapVar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapVar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// MetricAlertResource the metric alert resource. -type MetricAlertResource struct { - autorest.Response `json:"-"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `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 MetricAlertResource. -func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mar.MetricAlertProperties != nil { - objectMap["properties"] = mar.MetricAlertProperties - } - if mar.Location != nil { - objectMap["location"] = mar.Location - } - if mar.Tags != nil { - objectMap["tags"] = mar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. -func (mar *MetricAlertResource) 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 metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - mar.MetricAlertProperties = &metricAlertProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mar.Tags = tags - } - } - } - - return nil -} - -// MetricAlertResourceCollection represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertResource `json:"value,omitempty"` -} - -// MetricAlertResourcePatch the metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. -func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if marp.Tags != nil { - objectMap["tags"] = marp.Tags - } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. -func (marp *MetricAlertResourcePatch) 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 - } - marp.Tags = tags - } - case "properties": - if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - marp.MetricAlertProperties = &metricAlertProperties - } - } - } - - return nil -} - -// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single -// resource that has multiple metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // AllOf - The list of metric criteria for this 'all of' operation. - AllOf *[]MetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if masrmmc.AllOf != nil { - objectMap["allOf"] = masrmmc.AllOf - } - if masrmmc.OdataType != "" { - objectMap["odata.type"] = masrmmc.OdataType - } - for k, v := range masrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return &masrmmc, true -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &masrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. -func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - var allOf []MetricCriteria - err = json.Unmarshal(*v, &allOf) - if err != nil { - return err - } - masrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if masrmmc.AdditionalProperties == nil { - masrmmc.AdditionalProperties = make(map[string]interface{}) - } - masrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - masrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertStatus an alert status. -type MetricAlertStatus struct { - // Name - The status name. - Name *string `json:"name,omitempty"` - // ID - The alert rule arm id. - ID *string `json:"id,omitempty"` - // Type - The extended resource type name. - Type *string `json:"type,omitempty"` - // Properties - The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties `json:"properties,omitempty"` -} - -// MetricAlertStatusCollection represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertStatus `json:"value,omitempty"` -} - -// MetricAlertStatusProperties an alert status properties. -type MetricAlertStatusProperties struct { - // Dimensions - An object describing the type of the dimensions. - Dimensions map[string]*string `json:"dimensions"` - // Status - status value - Status *string `json:"status,omitempty"` - // Timestamp - UTC time when the status was checked. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. -func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if masp.Dimensions != nil { - objectMap["dimensions"] = masp.Dimensions - } - if masp.Status != nil { - objectMap["status"] = masp.Status - } - if masp.Timestamp != nil { - objectMap["timestamp"] = masp.Timestamp - } - return json.Marshal(objectMap) -} - -// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and -// the retention period for that time grain. -type MetricAvailability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// MetricBaselinesProperties the response to a metric baselines query. -type MetricBaselinesProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried. - Namespace *string `json:"namespace,omitempty"` - // Baselines - The baseline for each time series that was queried. - Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` -} - -// MetricBaselinesResponse a list of metric baselines. -type MetricBaselinesResponse struct { - autorest.Response `json:"-"` - // Value - The list of metric baselines. - Value *[]SingleMetricBaseline `json:"value,omitempty"` -} - -// MetricCriteria criterion to filter metrics. -type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' - Operator Operator `json:"operator,omitempty"` - // Threshold - the criteria threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricCriteria. -func (mc MetricCriteria) MarshalJSON() ([]byte, error) { - mc.CriterionType = CriterionTypeStaticThresholdCriterion - objectMap := make(map[string]interface{}) - if mc.Operator != "" { - objectMap["operator"] = mc.Operator - } - if mc.Threshold != nil { - objectMap["threshold"] = mc.Threshold - } - if mc.Name != nil { - objectMap["name"] = mc.Name - } - if mc.MetricName != nil { - objectMap["metricName"] = mc.MetricName - } - if mc.MetricNamespace != nil { - objectMap["metricNamespace"] = mc.MetricNamespace - } - if mc.TimeAggregation != nil { - objectMap["timeAggregation"] = mc.TimeAggregation - } - if mc.Dimensions != nil { - objectMap["dimensions"] = mc.Dimensions - } - if mc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mc.SkipMetricValidation - } - if mc.CriterionType != "" { - objectMap["criterionType"] = mc.CriterionType - } - for k, v := range mc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return &mc, true -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. -func (mc *MetricCriteria) 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 "operator": - if v != nil { - var operator Operator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - mc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - mc.Threshold = &threshold - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mc.AdditionalProperties == nil { - mc.AdditionalProperties = make(map[string]interface{}) - } - mc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mc.CriterionType = criterionType - } - } - } - - return nil -} - -// MetricDefinition metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// MetricDefinitionCollection represents collection of metric definitions. -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricDimension specifies a metric dimension. -type MetricDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string `json:"operator,omitempty"` - // Values - list of dimension values. - Values *[]string `json:"values,omitempty"` -} - -// MetricNamespace metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // ID - The ID of the metricNamespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The name of the namespace. - Name *string `json:"name,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName `json:"properties,omitempty"` -} - -// MetricNamespaceCollection represents collection of metric namespaces. -type MetricNamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]MetricNamespace `json:"value,omitempty"` -} - -// MetricNamespaceName the fully qualified metric namespace name. -type MetricNamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricSingleDimension the metric dimension name and value. -type MetricSingleDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Value - Value of the dimension. - Value *string `json:"value,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` -} - -// MetricValue represents a metric value. -type MetricValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *float64 `json:"count,omitempty"` -} - -// BasicMultiMetricCriteria the types of conditions for a multi resource alert. -type BasicMultiMetricCriteria interface { - AsMetricCriteria() (*MetricCriteria, bool) - AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) - AsMultiMetricCriteria() (*MultiMetricCriteria, bool) -} - -// MultiMetricCriteria the types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["criterionType"] { - case string(CriterionTypeStaticThresholdCriterion): - var mc MetricCriteria - err := json.Unmarshal(body, &mc) - return mc, err - case string(CriterionTypeDynamicThresholdCriterion): - var dmc DynamicMetricCriteria - err := json.Unmarshal(body, &dmc) - return dmc, err - default: - var mmc MultiMetricCriteria - err := json.Unmarshal(body, &mmc) - return mmc, err - } -} -func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) - if err != nil { - return nil, err - } - mmcArray[index] = mmc - } - return mmcArray, nil -} - -// MarshalJSON is the custom marshaler for MultiMetricCriteria. -func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { - mmc.CriterionType = CriterionTypeMultiMetricCriteria - objectMap := make(map[string]interface{}) - if mmc.Name != nil { - objectMap["name"] = mmc.Name - } - if mmc.MetricName != nil { - objectMap["metricName"] = mmc.MetricName - } - if mmc.MetricNamespace != nil { - objectMap["metricNamespace"] = mmc.MetricNamespace - } - if mmc.TimeAggregation != nil { - objectMap["timeAggregation"] = mmc.TimeAggregation - } - if mmc.Dimensions != nil { - objectMap["dimensions"] = mmc.Dimensions - } - if mmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mmc.SkipMetricValidation - } - if mmc.CriterionType != "" { - objectMap["criterionType"] = mmc.CriterionType - } - for k, v := range mmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return &mmc, true -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. -func (mmc *MultiMetricCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mmc.AdditionalProperties == nil { - mmc.AdditionalProperties = make(map[string]interface{}) - } - mmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mmc.CriterionType = criterionType - } - } - } - - return nil -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Insights 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 operations supported by the Microsoft.Insights 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"` -} - -// ProxyOnlyResource a proxy only azure resource object -type ProxyOnlyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyOnlyResource. -func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProxyResource an azure resource object -type ProxyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource an azure resource object -type Resource 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,omitempty"` -} - -// ResponseWithError an error response from the API. -type ResponseWithError struct { - // Error - Error information. - Error *Error `json:"error,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) 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 "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. - Maximum *string `json:"maximum,omitempty"` - // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// Schedule defines how often to run the search and the time interval. -type Schedule struct { - // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. - FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` - // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` -} - -// SenderAuthorization the authorization used by the user who has performed the operation that led to this -// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and -// the 'scope' -type SenderAuthorization struct { - // Action - the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string `json:"action,omitempty"` - // Role - the role of the user. For instance: Subscription Admin - Role *string `json:"role,omitempty"` - // Scope - the scope. - Scope *string `json:"scope,omitempty"` -} - -// SingleBaseline the baseline values for a single sensitivity value. -type SingleBaseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' - Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// SingleMetricBaseline the baseline results of a single metric. -type SingleMetricBaseline struct { - // ID - The metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - The resource type of the metric baseline resource. - Type *string `json:"type,omitempty"` - // Name - The name of the metric for which the baselines were retrieved. - Name *string `json:"name,omitempty"` - // MetricBaselinesProperties - The metric baseline properties of the metric. - *MetricBaselinesProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingleMetricBaseline. -func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smb.ID != nil { - objectMap["id"] = smb.ID - } - if smb.Type != nil { - objectMap["type"] = smb.Type - } - if smb.Name != nil { - objectMap["name"] = smb.Name - } - if smb.MetricBaselinesProperties != nil { - objectMap["properties"] = smb.MetricBaselinesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. -func (smb *SingleMetricBaseline) 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 - } - smb.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - smb.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - smb.Name = &name - } - case "properties": - if v != nil { - var metricBaselinesProperties MetricBaselinesProperties - err = json.Unmarshal(*v, &metricBaselinesProperties) - if err != nil { - return err - } - smb.MetricBaselinesProperties = &metricBaselinesProperties - } - } - } - - return nil -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// Source specifies the log search query. -type Source struct { - // Query - Log search query. Required for action type - AlertingAction - Query *string `json:"query,omitempty"` - // AuthorizedResources - List of Resource referred into query - AuthorizedResources *[]string `json:"authorizedResources,omitempty"` - // DataSourceID - The resource uri over which log search query is to be run. - DataSourceID *string `json:"dataSourceId,omitempty"` - // QueryType - Set value to 'ResultCount'. Possible values include: 'ResultCount' - QueryType QueryType `json:"queryType,omitempty"` -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) 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 "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// TimeSeriesBaseline the baseline values for a single time series. -type TimeSeriesBaseline struct { - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Dimensions - The dimensions of this time series. - Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` - // Timestamps - The list of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Data - The baseline values for each sensitivity. - Data *[]SingleBaseline `json:"data,omitempty"` - // Metadata - The baseline metadata values. - Metadata *[]BaselineMetadata `json:"metadata,omitempty"` -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]MetricValue `json:"data,omitempty"` -} - -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,omitempty"` -} - -// TriggerCondition the condition that results in the Log Search rule. -type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - Result or count threshold based on which rule should be triggered. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTrigger - Trigger condition for metric query rule - MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` -} - -// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. -type VMInsightsOnboardingStatus struct { - autorest.Response `json:"-"` - // VMInsightsOnboardingStatusProperties - Resource properties. - *VMInsightsOnboardingStatusProperties `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"` -} - -// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. -func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vios.VMInsightsOnboardingStatusProperties != nil { - objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. -func (vios *VMInsightsOnboardingStatus) 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 VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties - err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) - if err != nil { - return err - } - vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vios.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vios.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vios.Type = &typeVar - } - } - } - - return nil -} - -// VMInsightsOnboardingStatusProperties resource properties. -type VMInsightsOnboardingStatusProperties struct { - // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. - ResourceID *string `json:"resourceId,omitempty"` - // OnboardingStatus - The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: 'Onboarded', 'NotOnboarded', 'Unknown' - OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` - // DataStatus - The status of VM Insights data from the resource. When reported as `present` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: 'Present', 'NotPresent' - DataStatus DataStatus `json:"dataStatus,omitempty"` - // Data - Containers that currently store VM Insights data for the specified resource. - Data *[]DataContainer `json:"data,omitempty"` -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // WebTestID - The Application Insights web test Id. - WebTestID *string `json:"webTestId,omitempty"` - // ComponentID - The Application Insights resource Id. - ComponentID *string `json:"componentId,omitempty"` - // FailedLocationCount - The number of failed locations. - FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - objectMap := make(map[string]interface{}) - if wlac.WebTestID != nil { - objectMap["webTestId"] = wlac.WebTestID - } - if wlac.ComponentID != nil { - objectMap["componentId"] = wlac.ComponentID - } - if wlac.FailedLocationCount != nil { - objectMap["failedLocationCount"] = wlac.FailedLocationCount - } - if wlac.OdataType != "" { - objectMap["odata.type"] = wlac.OdataType - } - for k, v := range wlac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return &wlac, true -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &wlac, true -} - -// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. -func (wlac *WebtestLocationAvailabilityCriteria) 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 "webTestId": - if v != nil { - var webTestID string - err = json.Unmarshal(*v, &webTestID) - if err != nil { - return err - } - wlac.WebTestID = &webTestID - } - case "componentId": - if v != nil { - var componentID string - err = json.Unmarshal(*v, &componentID) - if err != nil { - return err - } - wlac.ComponentID = &componentID - } - case "failedLocationCount": - if v != nil { - var failedLocationCount float64 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - wlac.FailedLocationCount = &failedLocationCount - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if wlac.AdditionalProperties == nil { - wlac.AdditionalProperties = make(map[string]interface{}) - } - wlac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - wlac.OdataType = odataType - } - } - } - - return nil -} - -// WorkspaceInfo information about a Log Analytics Workspace. -type WorkspaceInfo struct { - // ID - Azure Resource Manager identifier of the Log Analytics Workspace. - ID *string `json:"id,omitempty"` - // Location - Location of the Log Analytics workspace. - Location *string `json:"location,omitempty"` - // WorkspaceInfoProperties - Resource properties. - *WorkspaceInfoProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceInfo. -func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wi.ID != nil { - objectMap["id"] = wi.ID - } - if wi.Location != nil { - objectMap["location"] = wi.Location - } - if wi.WorkspaceInfoProperties != nil { - objectMap["properties"] = wi.WorkspaceInfoProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. -func (wi *WorkspaceInfo) 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 - } - wi.ID = &ID - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wi.Location = &location - } - case "properties": - if v != nil { - var workspaceInfoProperties WorkspaceInfoProperties - err = json.Unmarshal(*v, &workspaceInfoProperties) - if err != nil { - return err - } - wi.WorkspaceInfoProperties = &workspaceInfoProperties - } - } - } - - return nil -} - -// WorkspaceInfoProperties resource properties. -type WorkspaceInfoProperties struct { - // CustomerID - Log Analytics workspace identifier. - CustomerID *string `json:"customerId,omitempty"` -} diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/operations.go b/services/preview/monitor/mgmt/2019-03-01/insights/operations.go deleted file mode 100644 index 3f82351c7f23..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -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 monitor 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 operations from Microsoft.Insights provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-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 -} diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2019-03-01/insights/scheduledqueryrules.go deleted file mode 100644 index c9d43964ecb0..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/scheduledqueryrules.go +++ /dev/null @@ -1,511 +0,0 @@ -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" -) - -// ScheduledQueryRulesClient is the monitor Management Client -type ScheduledQueryRulesClient struct { - BaseClient -} - -// NewScheduledQueryRulesClient creates an instance of the ScheduledQueryRulesClient client. -func NewScheduledQueryRulesClient(subscriptionID string) ScheduledQueryRulesClient { - return NewScheduledQueryRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduledQueryRulesClientWithBaseURI creates an instance of the ScheduledQueryRulesClient 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 NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID string) ScheduledQueryRulesClient { - return ScheduledQueryRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an log search rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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 a Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) 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 Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) GetResponder(resp *http.Response) (result LogSearchRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the Log Search rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the Log Search rules within a subscription group. -// Parameters: -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update log search Rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) UpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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/monitor/mgmt/2019-03-01/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2019-03-01/insights/tenantactivitylogs.go deleted file mode 100644 index 7501f047bb38..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/tenantactivitylogs.go +++ /dev/null @@ -1,168 +0,0 @@ -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" -) - -// TenantActivityLogsClient is the monitor Management Client -type TenantActivityLogsClient struct { - BaseClient -} - -// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. -func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { - return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient 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 NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { - return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for -// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that -// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that -// were generated at the tenant level. -// Parameters: -// filter - reduces the set of data collected.
The **$filter** is very restricted and allows only the -// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq -// ''.
- List events for resource: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq -// ''.
- List events for a subscription: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation'.
- List events for a resource -// provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq -// 'Admin, Operation' and resourceProvider eq ''.
- List events for a correlation Id: -// api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq -// ''.
**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), - 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 TenantActivityLogsClient) 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 TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/version.go b/services/preview/monitor/mgmt/2019-03-01/insights/version.go deleted file mode 100644 index 02fb5d1ba269..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -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/2019-03-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/monitor/mgmt/2019-03-01/insights/vminsights.go b/services/preview/monitor/mgmt/2019-03-01/insights/vminsights.go deleted file mode 100644 index 3787cb6fc53e..000000000000 --- a/services/preview/monitor/mgmt/2019-03-01/insights/vminsights.go +++ /dev/null @@ -1,105 +0,0 @@ -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" -) - -// VMInsightsClient is the monitor Management Client -type VMInsightsClient struct { - BaseClient -} - -// NewVMInsightsClient creates an instance of the VMInsightsClient client. -func NewVMInsightsClient(subscriptionID string) VMInsightsClient { - return NewVMInsightsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVMInsightsClientWithBaseURI creates an instance of the VMInsightsClient 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 NewVMInsightsClientWithBaseURI(baseURI string, subscriptionID string) VMInsightsClient { - return VMInsightsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetOnboardingStatus retrieves the VM Insights onboarding status for the specified resource or resource scope. -// Parameters: -// resourceURI - the fully qualified Azure Resource manager identifier of the resource, or scope, whose status -// to retrieve. -func (client VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string) (result VMInsightsOnboardingStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VMInsightsClient.GetOnboardingStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOnboardingStatusPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetOnboardingStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure sending request") - return - } - - result, err = client.GetOnboardingStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetOnboardingStatusPreparer prepares the GetOnboardingStatus request. -func (client VMInsightsClient) GetOnboardingStatusPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-11-27-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOnboardingStatusSender sends the GetOnboardingStatus request. The method will close the -// http.Response Body if it receives an error. -func (client VMInsightsClient) GetOnboardingStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetOnboardingStatusResponder handles the response to the GetOnboardingStatus request. The method always -// closes the http.Response Body. -func (client VMInsightsClient) GetOnboardingStatusResponder(resp *http.Response) (result VMInsightsOnboardingStatus, 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/monitor/mgmt/2019-06-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2019-06-01/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/_meta.json b/services/preview/monitor/mgmt/2019-06-01/insights/_meta.json deleted file mode 100644 index 59068c75e549..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2019-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-2019-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2019-06-01/insights/actiongroups.go deleted file mode 100644 index dd2ee8b7f402..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/actiongroups.go +++ /dev/null @@ -1,581 +0,0 @@ -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" -) - -// ActionGroupsClient is the monitor Management Client -type ActionGroupsClient struct { - BaseClient -} - -// NewActionGroupsClient creates an instance of the ActionGroupsClient client. -func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { - return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { - return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new action group or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroup - the action group to create or use for the update. -func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: actionGroup, - Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, - {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroup), - 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 ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) 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 -} - -// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. -// This operation is only supported for Email or SMS receivers. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// enableRequest - the receiver to re-enable. -func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) - } - - req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") - return - } - - resp, err := client.EnableReceiverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") - return - } - - result, err = client.EnableReceiverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") - return - } - - return -} - -// EnableReceiverPreparer prepares the EnableReceiver request. -func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}/subscribe", pathParameters), - autorest.WithJSON(enableRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableReceiverSender sends the EnableReceiver request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableReceiverResponder handles the response to the EnableReceiver request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all action groups in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActionGroupsClient) 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 = "2019-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.insights/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all action groups in a subscription. -func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, 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 action group's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroupPatch - parameters supplied to the operation. -func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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, actionGroupName, actionGroupPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroupPatch), - 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 ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2019-06-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2019-06-01/insights/activitylogalerts.go deleted file mode 100644 index 44aaf3ef1e4a..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/activitylogalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// ActivityLogAlertsClient is the monitor Management Client -type ActivityLogAlertsClient struct { - BaseClient -} - -// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient 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 NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new activity log alert or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlert - the activity log alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all activity log alerts in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) 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 = "2017-04-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/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all activity log alerts in a subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, 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 ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlertPatch - parameters supplied to the operation. -func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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, activityLogAlertName, activityLogAlertPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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/monitor/mgmt/2019-06-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2019-06-01/insights/activitylogs.go deleted file mode 100644 index 16dd215e6ad9..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/activitylogs.go +++ /dev/null @@ -1,166 +0,0 @@ -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" -) - -// ActivityLogsClient is the monitor Management Client -type ActivityLogsClient struct { - BaseClient -} - -// NewActivityLogsClient creates an instance of the ActivityLogsClient client. -func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { - return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient 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 NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { - return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides the list of records from the activity logs. -// Parameters: -// filter - reduces the set of data collected.
This argument is required and it also requires at least the -// start date/time.
The **$filter** argument is very restricted and allows only the following patterns.
- -// *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and -// eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
- *List -// events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a subscription in a -// time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq -// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq -// 'correlationID'.

**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2019-06-01/insights/alertruleincidents.go deleted file mode 100644 index c3bf26828d8e..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/alertruleincidents.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// AlertRuleIncidentsClient is the monitor Management Client -type AlertRuleIncidentsClient struct { - BaseClient -} - -// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// incidentName - the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "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.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) 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 -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - return - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2019-06-01/insights/alertrules.go b/services/preview/monitor/mgmt/2019-06-01/insights/alertrules.go deleted file mode 100644 index f5a2ab682384..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/alertrules.go +++ /dev/null @@ -1,495 +0,0 @@ -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" -) - -// AlertRulesClient is the monitor Management Client -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 a classic metric alert rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 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 AlertRuleResource, 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName 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) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, 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) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 AlertRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the classic metric alert rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) 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 = "2016-03-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/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the classic metric alert rules within a subscription. -func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// alertRulesResource - parameters supplied to the operation. -func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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, ruleName, alertRulesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(alertRulesResource), - 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 AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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/monitor/mgmt/2019-06-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2019-06-01/insights/autoscalesettings.go deleted file mode 100644 index 86f253d0fb89..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/autoscalesettings.go +++ /dev/null @@ -1,580 +0,0 @@ -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" -) - -// AutoscaleSettingsClient is the monitor Management Client -type AutoscaleSettingsClient struct { - BaseClient -} - -// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// parameters - parameters supplied to the operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) 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-04-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/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 the autoscale settings for a subscription -func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// autoscaleSettingResource - parameters supplied to the operation. -func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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, autoscaleSettingName, autoscaleSettingResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(autoscaleSettingResource), - 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2019-06-01/insights/baselines.go b/services/preview/monitor/mgmt/2019-06-01/insights/baselines.go deleted file mode 100644 index fd77a7d29721..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/baselines.go +++ /dev/null @@ -1,143 +0,0 @@ -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" -) - -// BaselinesClient is the monitor Management Client -type BaselinesClient struct { - BaseClient -} - -// NewBaselinesClient creates an instance of the BaselinesClient client. -func NewBaselinesClient(subscriptionID string) BaselinesClient { - return NewBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBaselinesClientWithBaseURI creates an instance of the BaselinesClient 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 NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) BaselinesClient { - return BaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnames - the names of the metrics (comma separated) to retrieve. -// metricnamespace - metric namespace to query metric definitions for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result MetricBaselinesResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaselinesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "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.BaselinesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2019-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricBaselines", 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 BaselinesClient) 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 BaselinesClient) ListResponder(resp *http.Response) (result MetricBaselinesResponse, 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/monitor/mgmt/2019-06-01/insights/client.go b/services/preview/monitor/mgmt/2019-06-01/insights/client.go deleted file mode 100644 index a777181b0785..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package insights implements the Azure ARM Insights service API version . -// -// Monitor 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/monitor/mgmt/2019-06-01/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettings.go deleted file mode 100644 index 9708c52c2499..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettings.go +++ /dev/null @@ -1,332 +0,0 @@ -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" -) - -// DiagnosticSettingsClient is the monitor Management Client -type DiagnosticSettingsClient struct { - BaseClient -} - -// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. -func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { - return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient 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 NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { - return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, resourceURI, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-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("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) 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 active diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 active diagnostic settings list for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", 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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, 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/monitor/mgmt/2019-06-01/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettingscategory.go deleted file mode 100644 index 48365ed67e65..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/diagnosticsettingscategory.go +++ /dev/null @@ -1,180 +0,0 @@ -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" -) - -// DiagnosticSettingsCategoryClient is the monitor Management Client -type DiagnosticSettingsCategoryClient struct { - BaseClient -} - -// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. -func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { - return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient 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 NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { - return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, 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/monitor/mgmt/2019-06-01/insights/enums.go b/services/preview/monitor/mgmt/2019-06-01/insights/enums.go deleted file mode 100644 index b0a6aee8f846..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/enums.go +++ /dev/null @@ -1,645 +0,0 @@ -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. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // Average ... - Average AggregationType = "Average" - // Count ... - Count AggregationType = "Count" - // Maximum ... - Maximum AggregationType = "Maximum" - // Minimum ... - Minimum AggregationType = "Minimum" - // None ... - None AggregationType = "None" - // Total ... - Total AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{Average, Count, Maximum, Minimum, None, Total} -} - -// AlertSeverity enumerates the values for alert severity. -type AlertSeverity string - -const ( - // Four ... - Four AlertSeverity = "4" - // One ... - One AlertSeverity = "1" - // Three ... - Three AlertSeverity = "3" - // Two ... - Two AlertSeverity = "2" - // Zero ... - Zero AlertSeverity = "0" -) - -// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. -func PossibleAlertSeverityValues() []AlertSeverity { - return []AlertSeverity{Four, One, Three, Two, Zero} -} - -// BaselineSensitivity enumerates the values for baseline sensitivity. -type BaselineSensitivity string - -const ( - // High ... - High BaselineSensitivity = "High" - // Low ... - Low BaselineSensitivity = "Low" - // Medium ... - Medium BaselineSensitivity = "Medium" -) - -// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. -func PossibleBaselineSensitivityValues() []BaselineSensitivity { - return []BaselineSensitivity{High, Low, Medium} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // Logs ... - Logs CategoryType = "Logs" - // Metrics ... - Metrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{Logs, Metrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // Equals ... - Equals ComparisonOperationType = "Equals" - // GreaterThan ... - GreaterThan ComparisonOperationType = "GreaterThan" - // GreaterThanOrEqual ... - GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // LessThan ... - LessThan ComparisonOperationType = "LessThan" - // LessThanOrEqual ... - LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // NotEquals ... - NotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} -} - -// ConditionalOperator enumerates the values for conditional operator. -type ConditionalOperator string - -const ( - // ConditionalOperatorEqual ... - ConditionalOperatorEqual ConditionalOperator = "Equal" - // ConditionalOperatorGreaterThan ... - ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" - // ConditionalOperatorLessThan ... - ConditionalOperatorLessThan ConditionalOperator = "LessThan" -) - -// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. -func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} -} - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// CriterionType enumerates the values for criterion type. -type CriterionType string - -const ( - // CriterionTypeDynamicThresholdCriterion ... - CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - // CriterionTypeMultiMetricCriteria ... - CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" - // CriterionTypeStaticThresholdCriterion ... - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" -) - -// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. -func PossibleCriterionTypeValues() []CriterionType { - return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} -} - -// DataStatus enumerates the values for data status. -type DataStatus string - -const ( - // NotPresent ... - NotPresent DataStatus = "notPresent" - // Present ... - Present DataStatus = "present" -) - -// PossibleDataStatusValues returns an array of possible values for the DataStatus const type. -func PossibleDataStatusValues() []DataStatus { - return []DataStatus{NotPresent, Present} -} - -// DynamicThresholdOperator enumerates the values for dynamic threshold operator. -type DynamicThresholdOperator string - -const ( - // DynamicThresholdOperatorGreaterOrLessThan ... - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - // DynamicThresholdOperatorGreaterThan ... - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - // DynamicThresholdOperatorLessThan ... - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} -} - -// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. -type DynamicThresholdSensitivity string - -const ( - // DynamicThresholdSensitivityHigh ... - DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" - // DynamicThresholdSensitivityLow ... - DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" - // DynamicThresholdSensitivityMedium ... - DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} -} - -// Enabled enumerates the values for enabled. -type Enabled string - -const ( - // False ... - False Enabled = "false" - // True ... - True Enabled = "true" -) - -// PossibleEnabledValues returns an array of possible values for the Enabled const type. -func PossibleEnabledValues() []Enabled { - return []Enabled{False, True} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // EventLevelCritical ... - EventLevelCritical EventLevel = "Critical" - // EventLevelError ... - EventLevelError EventLevel = "Error" - // EventLevelInformational ... - EventLevelInformational EventLevel = "Informational" - // EventLevelVerbose ... - EventLevelVerbose EventLevel = "Verbose" - // EventLevelWarning ... - EventLevelWarning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// MetricTriggerType enumerates the values for metric trigger type. -type MetricTriggerType string - -const ( - // MetricTriggerTypeConsecutive ... - MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" - // MetricTriggerTypeTotal ... - MetricTriggerTypeTotal MetricTriggerType = "Total" -) - -// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. -func PossibleMetricTriggerTypeValues() []MetricTriggerType { - return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicAction enumerates the values for odata type basic action. -type OdataTypeBasicAction string - -const ( - // OdataTypeAction ... - OdataTypeAction OdataTypeBasicAction = "Action" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" -) - -// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. -func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} -} - -// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. -type OdataTypeBasicMetricAlertCriteria string - -const ( - // OdataTypeMetricAlertCriteria ... - OdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" - // OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... - OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. -func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { - return []OdataTypeBasicMetricAlertCriteria{OdataTypeMetricAlertCriteria, OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeRuleAction ... - OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeRuleCondition ... - OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} -} - -// OnboardingStatus enumerates the values for onboarding status. -type OnboardingStatus string - -const ( - // NotOnboarded ... - NotOnboarded OnboardingStatus = "notOnboarded" - // Onboarded ... - Onboarded OnboardingStatus = "onboarded" - // Unknown ... - Unknown OnboardingStatus = "unknown" -) - -// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. -func PossibleOnboardingStatusValues() []OnboardingStatus { - return []OnboardingStatus{NotOnboarded, Onboarded, Unknown} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorEquals ... - OperatorEquals Operator = "Equals" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Deploying ... - Deploying ProvisioningState = "Deploying" - // Failed ... - Failed ProvisioningState = "Failed" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Deploying, Failed, Succeeded} -} - -// QueryType enumerates the values for query type. -type QueryType string - -const ( - // ResultCount ... - ResultCount QueryType = "ResultCount" -) - -// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. -func PossibleQueryTypeValues() []QueryType { - return []QueryType{ResultCount} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // ReceiverStatusDisabled ... - ReceiverStatusDisabled ReceiverStatus = "Disabled" - // ReceiverStatusEnabled ... - ReceiverStatusEnabled ReceiverStatus = "Enabled" - // ReceiverStatusNotSpecified ... - ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // Data ... - Data ResultType = "Data" - // Metadata ... - Metadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{Data, Metadata} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ChangeCount ... - ChangeCount ScaleType = "ChangeCount" - // ExactCount ... - ExactCount ScaleType = "ExactCount" - // PercentChangeCount ... - PercentChangeCount ScaleType = "PercentChangeCount" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/eventcategories.go b/services/preview/monitor/mgmt/2019-06-01/insights/eventcategories.go deleted file mode 100644 index 86e59b424363..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/eventcategories.go +++ /dev/null @@ -1,99 +0,0 @@ -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" -) - -// EventCategoriesClient is the monitor Management Client -type EventCategoriesClient struct { - BaseClient -} - -// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. -func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { - return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { - return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available event categories supported in the Activity Logs Service.
The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "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.EventCategoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), - 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2019-06-01/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2019-06-01/insights/insightsapi/interfaces.go deleted file mode 100644 index 1b56cc2f51c8..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,206 +0,0 @@ -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/monitor/mgmt/2019-06-01/insights" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) - List(ctx context.Context) (result insights.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) - -// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. -type DiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) -} - -var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) - -// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) -} - -var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) - -// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. -type ActivityLogAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActivityLogAlertList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActivityLogAlertList, err error) - Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch insights.ActivityLogAlertPatchBody) (result insights.ActivityLogAlertResource, err error) -} - -var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) - -// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. -type ActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result insights.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) - -// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. -type TenantActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) - -// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. -type MetricDefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string, metricnamespace string) (result insights.MetricDefinitionCollection, err error) -} - -var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) - -// MetricsClientAPI contains the set of methods on the MetricsClient type. -type MetricsClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType insights.ResultType, metricnamespace string) (result insights.Response, err error) -} - -var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - -// BaselinesClientAPI contains the set of methods on the BaselinesClient type. -type BaselinesClientAPI interface { - List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) -} - -var _ BaselinesClientAPI = (*insights.BaselinesClient)(nil) - -// MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. -type MetricAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.MetricAlertResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.MetricAlertResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResourcePatch) (result insights.MetricAlertResource, err error) -} - -var _ MetricAlertsClientAPI = (*insights.MetricAlertsClient)(nil) - -// MetricAlertsStatusClientAPI contains the set of methods on the MetricAlertsStatusClient type. -type MetricAlertsStatusClientAPI interface { - List(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertStatusCollection, err error) - ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result insights.MetricAlertStatusCollection, err error) -} - -var _ MetricAlertsStatusClientAPI = (*insights.MetricAlertsStatusClient)(nil) - -// ScheduledQueryRulesClientAPI contains the set of methods on the ScheduledQueryRulesClient type. -type ScheduledQueryRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResource) (result insights.LogSearchRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.LogSearchRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result insights.LogSearchRuleResourceCollection, err error) - ListBySubscription(ctx context.Context, filter string) (result insights.LogSearchRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResourcePatch) (result insights.LogSearchRuleResource, err error) -} - -var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) - -// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. -type MetricNamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) -} - -var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) - -// VMInsightsClientAPI contains the set of methods on the VMInsightsClient type. -type VMInsightsClientAPI interface { - GetOnboardingStatus(ctx context.Context, resourceURI string) (result insights.VMInsightsOnboardingStatus, err error) -} - -var _ VMInsightsClientAPI = (*insights.VMInsightsClient)(nil) diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2019-06-01/insights/logprofiles.go deleted file mode 100644 index ad1500b87bc9..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/logprofiles.go +++ /dev/null @@ -1,418 +0,0 @@ -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" -) - -// LogProfilesClient is the monitor Management Client -type LogProfilesClient struct { - BaseClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// Parameters: -// logProfileName - the name of the log profile. -// parameters - parameters supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) 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 the log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 LogProfilesResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// logProfileName - the name of the log profile. -// logProfilesResource - parameters supplied to the operation. -func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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, logProfileName, logProfilesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(logProfilesResource), - 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 LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2019-06-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2019-06-01/insights/metricalerts.go deleted file mode 100644 index 94231b6fa34e..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metricalerts.go +++ /dev/null @@ -1,498 +0,0 @@ -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" -) - -// MetricAlertsClient is the monitor Management Client -type MetricAlertsClient struct { - BaseClient -} - -// NewMetricAlertsClient creates an instance of the MetricAlertsClient client. -func NewMetricAlertsClient(subscriptionID string) MetricAlertsClient { - return NewMetricAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsClientWithBaseURI creates an instance of the MetricAlertsClient 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 NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsClient { - return MetricAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result MetricAlertResource, 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 alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) 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 an alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) GetResponder(resp *http.Response) (result MetricAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve alert rule definitions in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MetricAlertsClient) 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 = "2018-03-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/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieve alert rule definitions in a subscription. -func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) UpdateResponder(resp *http.Response) (result MetricAlertResource, 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/monitor/mgmt/2019-06-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2019-06-01/insights/metricalertsstatus.go deleted file mode 100644 index 43cfaed42765..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metricalertsstatus.go +++ /dev/null @@ -1,186 +0,0 @@ -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" -) - -// MetricAlertsStatusClient is the monitor Management Client -type MetricAlertsStatusClient struct { - BaseClient -} - -// NewMetricAlertsStatusClient creates an instance of the MetricAlertsStatusClient client. -func NewMetricAlertsStatusClient(subscriptionID string) MetricAlertsStatusClient { - return NewMetricAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsStatusClientWithBaseURI creates an instance of the MetricAlertsStatusClient 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 NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsStatusClient { - return MetricAlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "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.MetricAlertsStatusClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status", 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 MetricAlertsStatusClient) 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 MetricAlertsStatusClient) ListResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByName retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// statusName - the name of the status. -func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.ListByName") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure sending request") - return - } - - result, err = client.ListByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure responding to request") - return - } - - return -} - -// ListByNamePreparer prepares the ListByName request. -func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "statusName": autorest.Encode("path", statusName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status/{statusName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNameSender sends the ListByName request. The method will close the -// http.Response Body if it receives an error. -func (client MetricAlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNameResponder handles the response to the ListByName request. The method always -// closes the http.Response Body. -func (client MetricAlertsStatusClient) ListByNameResponder(resp *http.Response) (result MetricAlertStatusCollection, 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/monitor/mgmt/2019-06-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2019-06-01/insights/metricbaseline.go deleted file mode 100644 index d395fc67bc59..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -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" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient 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 NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - 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: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-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("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.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, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "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.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", 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 MetricBaselineClient) 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 MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, 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/monitor/mgmt/2019-06-01/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2019-06-01/insights/metricdefinitions.go deleted file mode 100644 index 69fc2e0b465a..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metricdefinitions.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricDefinitionsClient is the monitor Management Client -type MetricDefinitionsClient struct { - BaseClient -} - -// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. -func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { - return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient 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 NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { - return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result MetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "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.MetricDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", 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 MetricDefinitionsClient) 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 MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, 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/monitor/mgmt/2019-06-01/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2019-06-01/insights/metricnamespaces.go deleted file mode 100644 index f2ef47baf802..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metricnamespaces.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricNamespacesClient is the monitor Management Client -type MetricNamespacesClient struct { - BaseClient -} - -// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. -func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { - return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient 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 NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { - return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric namespaces for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, startTime) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "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.MetricNamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", 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 MetricNamespacesClient) 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 MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, 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/monitor/mgmt/2019-06-01/insights/metrics.go b/services/preview/monitor/mgmt/2019-06-01/insights/metrics.go deleted file mode 100644 index 97687a09b498..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/metrics.go +++ /dev/null @@ -1,152 +0,0 @@ -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" -) - -// MetricsClient is the monitor Management Client -type MetricsClient struct { - BaseClient -} - -// NewMetricsClient creates an instance of the MetricsClient client. -func NewMetricsClient(subscriptionID string) MetricsClient { - return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricsClientWithBaseURI creates an instance of the MetricsClient 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 NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { - return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (result Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "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.MetricsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/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 MetricsClient) 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 MetricsClient) ListResponder(resp *http.Response) (result Response, 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/monitor/mgmt/2019-06-01/insights/models.go b/services/preview/monitor/mgmt/2019-06-01/insights/models.go deleted file mode 100644 index 66f6ec4f5f19..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/models.go +++ /dev/null @@ -1,5596 +0,0 @@ -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" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2019-06-01/insights" - -// BasicAction action descriptor. -type BasicAction interface { - AsAlertingAction() (*AlertingAction, bool) - AsLogToMetricAction() (*LogToMetricAction, bool) - AsAction() (*Action, bool) -} - -// Action action descriptor. -type Action struct { - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicAction(body []byte) (BasicAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): - var aa AlertingAction - err := json.Unmarshal(body, &aa) - return aa, err - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): - var ltma LogToMetricAction - err := json.Unmarshal(body, <ma) - return ltma, err - default: - var a Action - err := json.Unmarshal(body, &a) - return a, err - } -} -func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - aArray := make([]BasicAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - a, err := unmarshalBasicAction(*rawMessage) - if err != nil { - return nil, err - } - aArray[index] = a - } - return aArray, nil -} - -// MarshalJSON is the custom marshaler for Action. -func (a Action) MarshalJSON() ([]byte, error) { - a.OdataType = OdataTypeAction - objectMap := make(map[string]interface{}) - if a.OdataType != "" { - objectMap["odata.type"] = a.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for Action. -func (a Action) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for Action. -func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for Action. -func (a Action) AsAction() (*Action, bool) { - return &a, true -} - -// AsBasicAction is the BasicAction implementation for Action. -func (a Action) AsBasicAction() (BasicAction, bool) { - return &a, true -} - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) 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 - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `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 ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) 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 actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActivityLogAlert an Azure activity log alert. -type ActivityLogAlert struct { - // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. - Scopes *[]string `json:"scopes,omitempty"` - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` - // Condition - The condition that will cause this alert to activate. - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - // Actions - The actions that will activate when the condition is met. - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - // Description - A description of this activity log alert. - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - // ActionGroupID - The resourceId of the action group. This cannot be null or empty. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string `json:"webhookProperties"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. -func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alaag.ActionGroupID != nil { - objectMap["actionGroupId"] = alaag.ActionGroupID - } - if alaag.WebhookProperties != nil { - objectMap["webhookProperties"] = alaag.WebhookProperties - } - return json.Marshal(objectMap) -} - -// ActivityLogAlertActionList a list of activity log alert actions. -type ActivityLogAlertActionList struct { - // ActionGroups - The list of activity log alerts. - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member -// conditions are met. -type ActivityLogAlertAllOfCondition struct { - // AllOf - The list of activity log alert conditions. - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log -// field and value. -type ActivityLogAlertLeafCondition struct { - // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. - Field *string `json:"field,omitempty"` - // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - // Value - The list of activity log alerts. - Value *[]ActivityLogAlertResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityLogAlertPatch an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. -type ActivityLogAlertPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActivityLogAlertPatch - The activity log alert settings for an update operation. - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. -func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alapb.Tags != nil { - objectMap["tags"] = alapb.Tags - } - if alapb.ActivityLogAlertPatch != nil { - objectMap["properties"] = alapb.ActivityLogAlertPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. -func (alapb *ActivityLogAlertPatchBody) 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 - } - alapb.Tags = tags - } - case "properties": - if v != nil { - var activityLogAlertPatch ActivityLogAlertPatch - err = json.Unmarshal(*v, &activityLogAlertPatch) - if err != nil { - return err - } - alapb.ActivityLogAlertPatch = &activityLogAlertPatch - } - } - } - - return nil -} - -// ActivityLogAlertResource an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `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 ActivityLogAlertResource. -func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alar.ActivityLogAlert != nil { - objectMap["properties"] = alar.ActivityLogAlert - } - if alar.Location != nil { - objectMap["location"] = alar.Location - } - if alar.Tags != nil { - objectMap["tags"] = alar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) 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 activityLogAlert ActivityLogAlert - err = json.Unmarshal(*v, &activityLogAlert) - if err != nil { - return err - } - alar.ActivityLogAlert = &activityLogAlert - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - alar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - alar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - alar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alar.Tags = tags - } - } - } - - return nil -} - -// AlertingAction specify action need to be taken when rule type is Alert -type AlertingAction struct { - // Severity - Severity of the alert. Possible values include: 'Zero', 'One', 'Two', 'Three', 'Four' - Severity AlertSeverity `json:"severity,omitempty"` - // AznsAction - Azure action group reference. - AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` - // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. - ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` - // Trigger - The trigger condition that results in the alert rule being. - Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertingAction. -func (aa AlertingAction) MarshalJSON() ([]byte, error) { - aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction - objectMap := make(map[string]interface{}) - if aa.Severity != "" { - objectMap["severity"] = aa.Severity - } - if aa.AznsAction != nil { - objectMap["aznsAction"] = aa.AznsAction - } - if aa.ThrottlingInMin != nil { - objectMap["throttlingInMin"] = aa.ThrottlingInMin - } - if aa.Trigger != nil { - objectMap["trigger"] = aa.Trigger - } - if aa.OdataType != "" { - objectMap["odata.type"] = aa.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { - return &aa, true -} - -// AsLogToMetricAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { - return &aa, true -} - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) 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 - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `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 AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) 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 alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) 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 - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// ArmRoleReceiver an arm role receiver. -type ArmRoleReceiver struct { - // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // RoleID - The arm role id. - RoleID *string `json:"roleId,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `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 AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) 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 autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) - if err != nil { - return err - } - page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) 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 - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzNsActionGroup azure action group -type AzNsActionGroup struct { - // ActionGroup - Azure Action Group reference. - ActionGroup *[]string `json:"actionGroup,omitempty"` - // EmailSubject - Custom subject override for all email ids in Azure action group - EmailSubject *string `json:"emailSubject,omitempty"` - // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group - CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// BaselineMetadata represents a baseline metadata value. -type BaselineMetadata struct { - // Name - Name of the baseline metadata. - Name *string `json:"name,omitempty"` - // Value - Value of the baseline metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) 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 - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - -// Criteria specifies the criteria for converting log to metric. -type Criteria struct { - // MetricName - Name of the metric - MetricName *string `json:"metricName,omitempty"` - // Dimensions - List of Dimensions for creating metric - Dimensions *[]Dimension `json:"dimensions,omitempty"` -} - -// DataContainer information about a container with data for a given resource. -type DataContainer struct { - // Workspace - Log Analytics workspace information. - Workspace *WorkspaceInfo `json:"workspace,omitempty"` -} - -// DiagnosticSettings the diagnostic settings. -type DiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// DiagnosticSettingsCategory the diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' - CategoryType CategoryType `json:"categoryType,omitempty"` -} - -// DiagnosticSettingsCategoryResource the diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` - // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. - *DiagnosticSettingsCategory `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. -func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dscr.DiagnosticSettingsCategory != nil { - objectMap["properties"] = dscr.DiagnosticSettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. -func (dscr *DiagnosticSettingsCategoryResource) 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 diagnosticSettingsCategory DiagnosticSettingsCategory - err = json.Unmarshal(*v, &diagnosticSettingsCategory) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dscr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category -// resources. -type DiagnosticSettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` -} - -// DiagnosticSettingsResource the diagnostic setting resource. -type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // DiagnosticSettings - Properties of a Diagnostic Settings Resource. - *DiagnosticSettings `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. -func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DiagnosticSettings != nil { - objectMap["properties"] = dsr.DiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. -func (dsr *DiagnosticSettingsResource) 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 diagnosticSettings DiagnosticSettings - err = json.Unmarshal(*v, &diagnosticSettings) - if err != nil { - return err - } - dsr.DiagnosticSettings = &diagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]DiagnosticSettingsResource `json:"value,omitempty"` -} - -// Dimension specifies the criteria for converting log to metric. -type Dimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // Operator - Operator for dimension values - Operator *string `json:"operator,omitempty"` - // Values - List of dimension values - Values *[]string `json:"values,omitempty"` -} - -// DynamicMetricCriteria criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' - Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' - AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` - // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` - // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) - IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - dmc.CriterionType = CriterionTypeDynamicThresholdCriterion - objectMap := make(map[string]interface{}) - if dmc.Operator != "" { - objectMap["operator"] = dmc.Operator - } - if dmc.AlertSensitivity != "" { - objectMap["alertSensitivity"] = dmc.AlertSensitivity - } - if dmc.FailingPeriods != nil { - objectMap["failingPeriods"] = dmc.FailingPeriods - } - if dmc.IgnoreDataBefore != nil { - objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore - } - if dmc.Name != nil { - objectMap["name"] = dmc.Name - } - if dmc.MetricName != nil { - objectMap["metricName"] = dmc.MetricName - } - if dmc.MetricNamespace != nil { - objectMap["metricNamespace"] = dmc.MetricNamespace - } - if dmc.TimeAggregation != nil { - objectMap["timeAggregation"] = dmc.TimeAggregation - } - if dmc.Dimensions != nil { - objectMap["dimensions"] = dmc.Dimensions - } - if dmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = dmc.SkipMetricValidation - } - if dmc.CriterionType != "" { - objectMap["criterionType"] = dmc.CriterionType - } - for k, v := range dmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return &dmc, true -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &dmc, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. -func (dmc *DynamicMetricCriteria) 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 "operator": - if v != nil { - var operator DynamicThresholdOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - dmc.Operator = operator - } - case "alertSensitivity": - if v != nil { - var alertSensitivity DynamicThresholdSensitivity - err = json.Unmarshal(*v, &alertSensitivity) - if err != nil { - return err - } - dmc.AlertSensitivity = alertSensitivity - } - case "failingPeriods": - if v != nil { - var failingPeriods DynamicThresholdFailingPeriods - err = json.Unmarshal(*v, &failingPeriods) - if err != nil { - return err - } - dmc.FailingPeriods = &failingPeriods - } - case "ignoreDataBefore": - if v != nil { - var ignoreDataBefore date.Time - err = json.Unmarshal(*v, &ignoreDataBefore) - if err != nil { - return err - } - dmc.IgnoreDataBefore = &ignoreDataBefore - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if dmc.AdditionalProperties == nil { - dmc.AdditionalProperties = make(map[string]interface{}) - } - dmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - dmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - dmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - dmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - dmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - dmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - dmc.CriterionType = criterionType - } - } - } - - return nil -} - -// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback -// time window required to raise an alert. -type DynamicThresholdFailingPeriods struct { - // NumberOfEvaluationPeriods - The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. - NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` - // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - if er.UseCommonAlertSchema != nil { - objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// Error error details. -type Error struct { - // Code - Error code identifying the specific error. - Code *string `json:"code,omitempty"` - // Message - Error message in the caller's locale. - Message *string `json:"message,omitempty"` -} - -// 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"` -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// EventData the Azure event log entries are of type EventData -type EventData struct { - // Authorization - READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization `json:"authorization,omitempty"` - // Claims - READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string `json:"claims"` - // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string `json:"caller,omitempty"` - // Description - READ-ONLY; the description of the event. - Description *string `json:"description,omitempty"` - // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string `json:"id,omitempty"` - // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string `json:"eventDataId,omitempty"` - // CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. - CorrelationID *string `json:"correlationId,omitempty"` - // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. - EventName *LocalizableString `json:"eventName,omitempty"` - // Category - READ-ONLY; the event category. - Category *LocalizableString `json:"category,omitempty"` - // HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). - HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` - // Level - READ-ONLY; the event level. Possible values include: 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' - Level EventLevel `json:"level,omitempty"` - // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` - // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - READ-ONLY; the resource type - ResourceType *LocalizableString `json:"resourceType,omitempty"` - // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. - OperationID *string `json:"operationId,omitempty"` - // OperationName - READ-ONLY; the operation name. - OperationName *LocalizableString `json:"operationName,omitempty"` - // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string `json:"properties"` - // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - Status *LocalizableString `json:"status,omitempty"` - // SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) - SubStatus *LocalizableString `json:"subStatus,omitempty"` - // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. - EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` - // SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. - SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` - // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // TenantID - READ-ONLY; the Azure tenant Id - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventData. -func (ed EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EventDataCollection represents collection of events. -type EventDataCollection struct { - autorest.Response `json:"-"` - // Value - this list that includes the Azure audit logs. - Value *[]EventData `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventDataCollectionIterator provides access to a complete listing of EventData values. -type EventDataCollectionIterator struct { - i int - page EventDataCollectionPage -} - -// 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 *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.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 *EventDataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventDataCollectionIterator) 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 EventDataCollectionIterator) Response() EventDataCollection { - 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 EventDataCollectionIterator) Value() EventData { - if !iter.page.NotDone() { - return EventData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventDataCollectionIterator type. -func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { - return EventDataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edc EventDataCollection) IsEmpty() bool { - return edc.Value == nil || len(*edc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edc EventDataCollection) hasNextLink() bool { - return edc.NextLink != nil && len(*edc.NextLink) != 0 -} - -// eventDataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !edc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edc.NextLink))) -} - -// EventDataCollectionPage contains a page of EventData values. -type EventDataCollectionPage struct { - fn func(context.Context, EventDataCollection) (EventDataCollection, error) - edc EventDataCollection -} - -// 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 *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.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.edc) - if err != nil { - return err - } - page.edc = 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 *EventDataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventDataCollectionPage) NotDone() bool { - return !page.edc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventDataCollectionPage) Response() EventDataCollection { - return page.edc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventDataCollectionPage) Values() []EventData { - if page.edc.IsEmpty() { - return nil - } - return *page.edc.Value -} - -// Creates a new instance of the EventDataCollectionPage type. -func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { - return EventDataCollectionPage{ - fn: getNextPage, - edc: cur, - } -} - -// HTTPRequestInfo the Http request info. -type HTTPRequestInfo struct { - // ClientRequestID - the client request id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ClientIPAddress - the client Ip Address - ClientIPAddress *string `json:"clientIpAddress,omitempty"` - // Method - the Http request method. - Method *string `json:"method,omitempty"` - // URI - the Uri. - URI *string `json:"uri,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) 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 "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// LogMetricTrigger a log metrics trigger descriptor. -type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - The threshold of the metric trigger. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' - MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` - // MetricColumn - Evaluation of metric on a particular column - MetricColumn *string `json:"metricColumn,omitempty"` -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `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 LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) 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 logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) 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 - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// LogSearchRule log Search Rule Definition -type LogSearchRule struct { - // Description - The description of the Log Search rule. - Description *string `json:"description,omitempty"` - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Source - Data Source against which rule will Query Data - Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule *Schedule `json:"schedule,omitempty"` - // Action - Action needs to be taken on rule execution. - Action BasicAction `json:"action,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRule. -func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsr.Description != nil { - objectMap["description"] = lsr.Description - } - if lsr.Enabled != "" { - objectMap["enabled"] = lsr.Enabled - } - if lsr.Source != nil { - objectMap["source"] = lsr.Source - } - if lsr.Schedule != nil { - objectMap["schedule"] = lsr.Schedule - } - objectMap["action"] = lsr.Action - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. -func (lsr *LogSearchRule) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - lsr.Description = &description - } - case "enabled": - if v != nil { - var enabled Enabled - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - lsr.Enabled = enabled - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - lsr.LastUpdatedTime = &lastUpdatedTime - } - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - lsr.ProvisioningState = provisioningState - } - case "source": - if v != nil { - var source Source - err = json.Unmarshal(*v, &source) - if err != nil { - return err - } - lsr.Source = &source - } - case "schedule": - if v != nil { - var schedule Schedule - err = json.Unmarshal(*v, &schedule) - if err != nil { - return err - } - lsr.Schedule = &schedule - } - case "action": - if v != nil { - action, err := unmarshalBasicAction(*v) - if err != nil { - return err - } - lsr.Action = action - } - } - } - - return nil -} - -// LogSearchRulePatch log Search Rule Definition for Patching -type LogSearchRulePatch struct { - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` -} - -// LogSearchRuleResource the Log Search Rule resource. -type LogSearchRuleResource struct { - autorest.Response `json:"-"` - // LogSearchRule - The rule properties of the resource. - *LogSearchRule `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 LogSearchRuleResource. -func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrr.LogSearchRule != nil { - objectMap["properties"] = lsrr.LogSearchRule - } - if lsrr.Location != nil { - objectMap["location"] = lsrr.Location - } - if lsrr.Tags != nil { - objectMap["tags"] = lsrr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. -func (lsrr *LogSearchRuleResource) 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 logSearchRule LogSearchRule - err = json.Unmarshal(*v, &logSearchRule) - if err != nil { - return err - } - lsrr.LogSearchRule = &logSearchRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lsrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lsrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lsrr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lsrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lsrr.Tags = tags - } - } - } - - return nil -} - -// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. -type LogSearchRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the Log Search Rule resources. - Value *[]LogSearchRuleResource `json:"value,omitempty"` -} - -// LogSearchRuleResourcePatch the log search rule resource for patch operations. -type LogSearchRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogSearchRulePatch - The log search rule properties of the resource. - *LogSearchRulePatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. -func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrrp.Tags != nil { - objectMap["tags"] = lsrrp.Tags - } - if lsrrp.LogSearchRulePatch != nil { - objectMap["properties"] = lsrrp.LogSearchRulePatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. -func (lsrrp *LogSearchRuleResourcePatch) 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 - } - lsrrp.Tags = tags - } - case "properties": - if v != nil { - var logSearchRulePatch LogSearchRulePatch - err = json.Unmarshal(*v, &logSearchRulePatch) - if err != nil { - return err - } - lsrrp.LogSearchRulePatch = &logSearchRulePatch - } - } - } - - return nil -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogToMetricAction specify action need to be taken when rule type is converting log to metric -type LogToMetricAction struct { - // Criteria - Criteria of Metric - Criteria *[]Criteria `json:"criteria,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogToMetricAction. -func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { - ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction - objectMap := make(map[string]interface{}) - if ltma.Criteria != nil { - objectMap["criteria"] = ltma.Criteria - } - if ltma.OdataType != "" { - objectMap["odata.type"] = ltma.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return <ma, true -} - -// AsAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { - return <ma, true -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) 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 "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// MetricAlertAction an alert action. -type MetricAlertAction struct { - // ActionGroupID - the id of the action group to use. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. - WebHookProperties map[string]*string `json:"webHookProperties"` -} - -// MarshalJSON is the custom marshaler for MetricAlertAction. -func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if maa.ActionGroupID != nil { - objectMap["actionGroupId"] = maa.ActionGroupID - } - if maa.WebHookProperties != nil { - objectMap["webHookProperties"] = maa.WebHookProperties - } - return json.Marshal(objectMap) -} - -// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type BasicMetricAlertCriteria interface { - AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) - AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) - AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) - AsMetricAlertCriteria() (*MetricAlertCriteria, bool) -} - -// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - var masrmmc MetricAlertSingleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &masrmmc) - return masrmmc, err - case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - var wlac WebtestLocationAvailabilityCriteria - err := json.Unmarshal(body, &wlac) - return wlac, err - case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &mamrmmc) - return mamrmmc, err - default: - var mac MetricAlertCriteria - err := json.Unmarshal(body, &mac) - return mac, err - } -} -func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) - if err != nil { - return nil, err - } - macArray[index] = mac - } - return macArray, nil -} - -// MarshalJSON is the custom marshaler for MetricAlertCriteria. -func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { - mac.OdataType = OdataTypeMetricAlertCriteria - objectMap := make(map[string]interface{}) - if mac.OdataType != "" { - objectMap["odata.type"] = mac.OdataType - } - for k, v := range mac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return &mac, true -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mac, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. -func (mac *MetricAlertCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mac.AdditionalProperties == nil { - mac.AdditionalProperties = make(map[string]interface{}) - } - mac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mac.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple -// resource that has multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // AllOf - the list of multiple metric criteria for this 'all of' operation. - AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - mamrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if mamrmmc.AllOf != nil { - objectMap["allOf"] = mamrmmc.AllOf - } - if mamrmmc.OdataType != "" { - objectMap["odata.type"] = mamrmmc.OdataType - } - for k, v := range mamrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return &mamrmmc, true -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mamrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. -func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) - if err != nil { - return err - } - mamrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mamrmmc.AdditionalProperties == nil { - mamrmmc.AdditionalProperties = make(map[string]interface{}) - } - mamrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mamrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertProperties an alert rule. -type MetricAlertProperties struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertProperties. -func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapVar.Description != nil { - objectMap["description"] = mapVar.Description - } - if mapVar.Severity != nil { - objectMap["severity"] = mapVar.Severity - } - if mapVar.Enabled != nil { - objectMap["enabled"] = mapVar.Enabled - } - if mapVar.Scopes != nil { - objectMap["scopes"] = mapVar.Scopes - } - if mapVar.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency - } - if mapVar.WindowSize != nil { - objectMap["windowSize"] = mapVar.WindowSize - } - if mapVar.TargetResourceType != nil { - objectMap["targetResourceType"] = mapVar.TargetResourceType - } - if mapVar.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion - } - objectMap["criteria"] = mapVar.Criteria - if mapVar.AutoMitigate != nil { - objectMap["autoMitigate"] = mapVar.AutoMitigate - } - if mapVar.Actions != nil { - objectMap["actions"] = mapVar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. -func (mapVar *MetricAlertProperties) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapVar.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapVar.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapVar.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapVar.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapVar.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapVar.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapVar.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapVar.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapVar.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapVar.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapVar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapVar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// MetricAlertResource the metric alert resource. -type MetricAlertResource struct { - autorest.Response `json:"-"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `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 MetricAlertResource. -func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mar.MetricAlertProperties != nil { - objectMap["properties"] = mar.MetricAlertProperties - } - if mar.Location != nil { - objectMap["location"] = mar.Location - } - if mar.Tags != nil { - objectMap["tags"] = mar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. -func (mar *MetricAlertResource) 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 metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - mar.MetricAlertProperties = &metricAlertProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mar.Tags = tags - } - } - } - - return nil -} - -// MetricAlertResourceCollection represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertResource `json:"value,omitempty"` -} - -// MetricAlertResourcePatch the metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. -func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if marp.Tags != nil { - objectMap["tags"] = marp.Tags - } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. -func (marp *MetricAlertResourcePatch) 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 - } - marp.Tags = tags - } - case "properties": - if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - marp.MetricAlertProperties = &metricAlertProperties - } - } - } - - return nil -} - -// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single -// resource that has multiple metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // AllOf - The list of metric criteria for this 'all of' operation. - AllOf *[]MetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if masrmmc.AllOf != nil { - objectMap["allOf"] = masrmmc.AllOf - } - if masrmmc.OdataType != "" { - objectMap["odata.type"] = masrmmc.OdataType - } - for k, v := range masrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return &masrmmc, true -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &masrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. -func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - var allOf []MetricCriteria - err = json.Unmarshal(*v, &allOf) - if err != nil { - return err - } - masrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if masrmmc.AdditionalProperties == nil { - masrmmc.AdditionalProperties = make(map[string]interface{}) - } - masrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - masrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertStatus an alert status. -type MetricAlertStatus struct { - // Name - The status name. - Name *string `json:"name,omitempty"` - // ID - The alert rule arm id. - ID *string `json:"id,omitempty"` - // Type - The extended resource type name. - Type *string `json:"type,omitempty"` - // Properties - The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties `json:"properties,omitempty"` -} - -// MetricAlertStatusCollection represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertStatus `json:"value,omitempty"` -} - -// MetricAlertStatusProperties an alert status properties. -type MetricAlertStatusProperties struct { - // Dimensions - An object describing the type of the dimensions. - Dimensions map[string]*string `json:"dimensions"` - // Status - status value - Status *string `json:"status,omitempty"` - // Timestamp - UTC time when the status was checked. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. -func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if masp.Dimensions != nil { - objectMap["dimensions"] = masp.Dimensions - } - if masp.Status != nil { - objectMap["status"] = masp.Status - } - if masp.Timestamp != nil { - objectMap["timestamp"] = masp.Timestamp - } - return json.Marshal(objectMap) -} - -// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and -// the retention period for that time grain. -type MetricAvailability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// MetricBaselinesProperties the response to a metric baselines query. -type MetricBaselinesProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried. - Namespace *string `json:"namespace,omitempty"` - // Baselines - The baseline for each time series that was queried. - Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` -} - -// MetricBaselinesResponse a list of metric baselines. -type MetricBaselinesResponse struct { - autorest.Response `json:"-"` - // Value - The list of metric baselines. - Value *[]SingleMetricBaseline `json:"value,omitempty"` -} - -// MetricCriteria criterion to filter metrics. -type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' - Operator Operator `json:"operator,omitempty"` - // Threshold - the criteria threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricCriteria. -func (mc MetricCriteria) MarshalJSON() ([]byte, error) { - mc.CriterionType = CriterionTypeStaticThresholdCriterion - objectMap := make(map[string]interface{}) - if mc.Operator != "" { - objectMap["operator"] = mc.Operator - } - if mc.Threshold != nil { - objectMap["threshold"] = mc.Threshold - } - if mc.Name != nil { - objectMap["name"] = mc.Name - } - if mc.MetricName != nil { - objectMap["metricName"] = mc.MetricName - } - if mc.MetricNamespace != nil { - objectMap["metricNamespace"] = mc.MetricNamespace - } - if mc.TimeAggregation != nil { - objectMap["timeAggregation"] = mc.TimeAggregation - } - if mc.Dimensions != nil { - objectMap["dimensions"] = mc.Dimensions - } - if mc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mc.SkipMetricValidation - } - if mc.CriterionType != "" { - objectMap["criterionType"] = mc.CriterionType - } - for k, v := range mc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return &mc, true -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. -func (mc *MetricCriteria) 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 "operator": - if v != nil { - var operator Operator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - mc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - mc.Threshold = &threshold - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mc.AdditionalProperties == nil { - mc.AdditionalProperties = make(map[string]interface{}) - } - mc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mc.CriterionType = criterionType - } - } - } - - return nil -} - -// MetricDefinition metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// MetricDefinitionCollection represents collection of metric definitions. -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricDimension specifies a metric dimension. -type MetricDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string `json:"operator,omitempty"` - // Values - list of dimension values. - Values *[]string `json:"values,omitempty"` -} - -// MetricNamespace metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // ID - The ID of the metricNamespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The name of the namespace. - Name *string `json:"name,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName `json:"properties,omitempty"` -} - -// MetricNamespaceCollection represents collection of metric namespaces. -type MetricNamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]MetricNamespace `json:"value,omitempty"` -} - -// MetricNamespaceName the fully qualified metric namespace name. -type MetricNamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricSingleDimension the metric dimension name and value. -type MetricSingleDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Value - Value of the dimension. - Value *string `json:"value,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` -} - -// MetricValue represents a metric value. -type MetricValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *float64 `json:"count,omitempty"` -} - -// BasicMultiMetricCriteria the types of conditions for a multi resource alert. -type BasicMultiMetricCriteria interface { - AsMetricCriteria() (*MetricCriteria, bool) - AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) - AsMultiMetricCriteria() (*MultiMetricCriteria, bool) -} - -// MultiMetricCriteria the types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["criterionType"] { - case string(CriterionTypeStaticThresholdCriterion): - var mc MetricCriteria - err := json.Unmarshal(body, &mc) - return mc, err - case string(CriterionTypeDynamicThresholdCriterion): - var dmc DynamicMetricCriteria - err := json.Unmarshal(body, &dmc) - return dmc, err - default: - var mmc MultiMetricCriteria - err := json.Unmarshal(body, &mmc) - return mmc, err - } -} -func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) - if err != nil { - return nil, err - } - mmcArray[index] = mmc - } - return mmcArray, nil -} - -// MarshalJSON is the custom marshaler for MultiMetricCriteria. -func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { - mmc.CriterionType = CriterionTypeMultiMetricCriteria - objectMap := make(map[string]interface{}) - if mmc.Name != nil { - objectMap["name"] = mmc.Name - } - if mmc.MetricName != nil { - objectMap["metricName"] = mmc.MetricName - } - if mmc.MetricNamespace != nil { - objectMap["metricNamespace"] = mmc.MetricNamespace - } - if mmc.TimeAggregation != nil { - objectMap["timeAggregation"] = mmc.TimeAggregation - } - if mmc.Dimensions != nil { - objectMap["dimensions"] = mmc.Dimensions - } - if mmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mmc.SkipMetricValidation - } - if mmc.CriterionType != "" { - objectMap["criterionType"] = mmc.CriterionType - } - for k, v := range mmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return &mmc, true -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. -func (mmc *MultiMetricCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mmc.AdditionalProperties == nil { - mmc.AdditionalProperties = make(map[string]interface{}) - } - mmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mmc.CriterionType = criterionType - } - } - } - - return nil -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Insights 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 operations supported by the Microsoft.Insights 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"` -} - -// ProxyOnlyResource a proxy only azure resource object -type ProxyOnlyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyOnlyResource. -func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProxyResource an azure resource object -type ProxyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource an azure resource object -type Resource 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,omitempty"` -} - -// ResponseWithError an error response from the API. -type ResponseWithError struct { - // Error - Error information. - Error *Error `json:"error,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) 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 "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. - Maximum *string `json:"maximum,omitempty"` - // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// Schedule defines how often to run the search and the time interval. -type Schedule struct { - // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. - FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` - // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` -} - -// SenderAuthorization the authorization used by the user who has performed the operation that led to this -// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and -// the 'scope' -type SenderAuthorization struct { - // Action - the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string `json:"action,omitempty"` - // Role - the role of the user. For instance: Subscription Admin - Role *string `json:"role,omitempty"` - // Scope - the scope. - Scope *string `json:"scope,omitempty"` -} - -// SingleBaseline the baseline values for a single sensitivity value. -type SingleBaseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' - Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// SingleMetricBaseline the baseline results of a single metric. -type SingleMetricBaseline struct { - // ID - The metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - The resource type of the metric baseline resource. - Type *string `json:"type,omitempty"` - // Name - The name of the metric for which the baselines were retrieved. - Name *string `json:"name,omitempty"` - // MetricBaselinesProperties - The metric baseline properties of the metric. - *MetricBaselinesProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingleMetricBaseline. -func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smb.ID != nil { - objectMap["id"] = smb.ID - } - if smb.Type != nil { - objectMap["type"] = smb.Type - } - if smb.Name != nil { - objectMap["name"] = smb.Name - } - if smb.MetricBaselinesProperties != nil { - objectMap["properties"] = smb.MetricBaselinesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. -func (smb *SingleMetricBaseline) 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 - } - smb.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - smb.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - smb.Name = &name - } - case "properties": - if v != nil { - var metricBaselinesProperties MetricBaselinesProperties - err = json.Unmarshal(*v, &metricBaselinesProperties) - if err != nil { - return err - } - smb.MetricBaselinesProperties = &metricBaselinesProperties - } - } - } - - return nil -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// Source specifies the log search query. -type Source struct { - // Query - Log search query. Required for action type - AlertingAction - Query *string `json:"query,omitempty"` - // AuthorizedResources - List of Resource referred into query - AuthorizedResources *[]string `json:"authorizedResources,omitempty"` - // DataSourceID - The resource uri over which log search query is to be run. - DataSourceID *string `json:"dataSourceId,omitempty"` - // QueryType - Set value to 'ResultCount'. Possible values include: 'ResultCount' - QueryType QueryType `json:"queryType,omitempty"` -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) 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 "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// TimeSeriesBaseline the baseline values for a single time series. -type TimeSeriesBaseline struct { - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Dimensions - The dimensions of this time series. - Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` - // Timestamps - The list of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Data - The baseline values for each sensitivity. - Data *[]SingleBaseline `json:"data,omitempty"` - // Metadata - The baseline metadata values. - Metadata *[]BaselineMetadata `json:"metadata,omitempty"` -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]MetricValue `json:"data,omitempty"` -} - -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,omitempty"` -} - -// TriggerCondition the condition that results in the Log Search rule. -type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - Result or count threshold based on which rule should be triggered. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTrigger - Trigger condition for metric query rule - MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` -} - -// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. -type VMInsightsOnboardingStatus struct { - autorest.Response `json:"-"` - // VMInsightsOnboardingStatusProperties - Resource properties. - *VMInsightsOnboardingStatusProperties `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"` -} - -// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. -func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vios.VMInsightsOnboardingStatusProperties != nil { - objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. -func (vios *VMInsightsOnboardingStatus) 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 VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties - err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) - if err != nil { - return err - } - vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vios.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vios.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vios.Type = &typeVar - } - } - } - - return nil -} - -// VMInsightsOnboardingStatusProperties resource properties. -type VMInsightsOnboardingStatusProperties struct { - // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. - ResourceID *string `json:"resourceId,omitempty"` - // OnboardingStatus - The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: 'Onboarded', 'NotOnboarded', 'Unknown' - OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` - // DataStatus - The status of VM Insights data from the resource. When reported as `present` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: 'Present', 'NotPresent' - DataStatus DataStatus `json:"dataStatus,omitempty"` - // Data - Containers that currently store VM Insights data for the specified resource. - Data *[]DataContainer `json:"data,omitempty"` -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // UseAadAuth - Indicates whether or not use AAD authentication. - UseAadAuth *bool `json:"useAadAuth,omitempty"` - // ObjectID - Indicates the webhook app object Id for aad auth. - ObjectID *string `json:"objectId,omitempty"` - // IdentifierURI - Indicates the identifier uri for aad auth. - IdentifierURI *string `json:"identifierUri,omitempty"` - // TenantID - Indicates the tenant id for aad auth. - TenantID *string `json:"tenantId,omitempty"` -} - -// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // WebTestID - The Application Insights web test Id. - WebTestID *string `json:"webTestId,omitempty"` - // ComponentID - The Application Insights resource Id. - ComponentID *string `json:"componentId,omitempty"` - // FailedLocationCount - The number of failed locations. - FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - objectMap := make(map[string]interface{}) - if wlac.WebTestID != nil { - objectMap["webTestId"] = wlac.WebTestID - } - if wlac.ComponentID != nil { - objectMap["componentId"] = wlac.ComponentID - } - if wlac.FailedLocationCount != nil { - objectMap["failedLocationCount"] = wlac.FailedLocationCount - } - if wlac.OdataType != "" { - objectMap["odata.type"] = wlac.OdataType - } - for k, v := range wlac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return &wlac, true -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &wlac, true -} - -// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. -func (wlac *WebtestLocationAvailabilityCriteria) 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 "webTestId": - if v != nil { - var webTestID string - err = json.Unmarshal(*v, &webTestID) - if err != nil { - return err - } - wlac.WebTestID = &webTestID - } - case "componentId": - if v != nil { - var componentID string - err = json.Unmarshal(*v, &componentID) - if err != nil { - return err - } - wlac.ComponentID = &componentID - } - case "failedLocationCount": - if v != nil { - var failedLocationCount float64 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - wlac.FailedLocationCount = &failedLocationCount - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if wlac.AdditionalProperties == nil { - wlac.AdditionalProperties = make(map[string]interface{}) - } - wlac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - wlac.OdataType = odataType - } - } - } - - return nil -} - -// WorkspaceInfo information about a Log Analytics Workspace. -type WorkspaceInfo struct { - // ID - Azure Resource Manager identifier of the Log Analytics Workspace. - ID *string `json:"id,omitempty"` - // Location - Location of the Log Analytics workspace. - Location *string `json:"location,omitempty"` - // WorkspaceInfoProperties - Resource properties. - *WorkspaceInfoProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceInfo. -func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wi.ID != nil { - objectMap["id"] = wi.ID - } - if wi.Location != nil { - objectMap["location"] = wi.Location - } - if wi.WorkspaceInfoProperties != nil { - objectMap["properties"] = wi.WorkspaceInfoProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. -func (wi *WorkspaceInfo) 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 - } - wi.ID = &ID - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wi.Location = &location - } - case "properties": - if v != nil { - var workspaceInfoProperties WorkspaceInfoProperties - err = json.Unmarshal(*v, &workspaceInfoProperties) - if err != nil { - return err - } - wi.WorkspaceInfoProperties = &workspaceInfoProperties - } - } - } - - return nil -} - -// WorkspaceInfoProperties resource properties. -type WorkspaceInfoProperties struct { - // CustomerID - Log Analytics workspace identifier. - CustomerID *string `json:"customerId,omitempty"` -} diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/operations.go b/services/preview/monitor/mgmt/2019-06-01/insights/operations.go deleted file mode 100644 index 3f82351c7f23..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -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 monitor 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 operations from Microsoft.Insights provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-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 -} diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2019-06-01/insights/scheduledqueryrules.go deleted file mode 100644 index c9d43964ecb0..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/scheduledqueryrules.go +++ /dev/null @@ -1,511 +0,0 @@ -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" -) - -// ScheduledQueryRulesClient is the monitor Management Client -type ScheduledQueryRulesClient struct { - BaseClient -} - -// NewScheduledQueryRulesClient creates an instance of the ScheduledQueryRulesClient client. -func NewScheduledQueryRulesClient(subscriptionID string) ScheduledQueryRulesClient { - return NewScheduledQueryRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduledQueryRulesClientWithBaseURI creates an instance of the ScheduledQueryRulesClient 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 NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID string) ScheduledQueryRulesClient { - return ScheduledQueryRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an log search rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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 a Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) 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 Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) GetResponder(resp *http.Response) (result LogSearchRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the Log Search rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the Log Search rules within a subscription group. -// Parameters: -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListBySubscriptionPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update log search Rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) UpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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/monitor/mgmt/2019-06-01/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2019-06-01/insights/tenantactivitylogs.go deleted file mode 100644 index 7501f047bb38..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/tenantactivitylogs.go +++ /dev/null @@ -1,168 +0,0 @@ -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" -) - -// TenantActivityLogsClient is the monitor Management Client -type TenantActivityLogsClient struct { - BaseClient -} - -// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. -func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { - return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient 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 NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { - return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for -// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that -// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that -// were generated at the tenant level. -// Parameters: -// filter - reduces the set of data collected.
The **$filter** is very restricted and allows only the -// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq -// ''.
- List events for resource: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq -// ''.
- List events for a subscription: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation'.
- List events for a resource -// provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq -// 'Admin, Operation' and resourceProvider eq ''.
- List events for a correlation Id: -// api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq -// ''.
**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), - 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 TenantActivityLogsClient) 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 TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2019-06-01/insights/version.go b/services/preview/monitor/mgmt/2019-06-01/insights/version.go deleted file mode 100644 index 219c485b1af8..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -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/2019-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/monitor/mgmt/2019-06-01/insights/vminsights.go b/services/preview/monitor/mgmt/2019-06-01/insights/vminsights.go deleted file mode 100644 index 3787cb6fc53e..000000000000 --- a/services/preview/monitor/mgmt/2019-06-01/insights/vminsights.go +++ /dev/null @@ -1,105 +0,0 @@ -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" -) - -// VMInsightsClient is the monitor Management Client -type VMInsightsClient struct { - BaseClient -} - -// NewVMInsightsClient creates an instance of the VMInsightsClient client. -func NewVMInsightsClient(subscriptionID string) VMInsightsClient { - return NewVMInsightsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVMInsightsClientWithBaseURI creates an instance of the VMInsightsClient 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 NewVMInsightsClientWithBaseURI(baseURI string, subscriptionID string) VMInsightsClient { - return VMInsightsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetOnboardingStatus retrieves the VM Insights onboarding status for the specified resource or resource scope. -// Parameters: -// resourceURI - the fully qualified Azure Resource manager identifier of the resource, or scope, whose status -// to retrieve. -func (client VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string) (result VMInsightsOnboardingStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VMInsightsClient.GetOnboardingStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOnboardingStatusPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetOnboardingStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure sending request") - return - } - - result, err = client.GetOnboardingStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetOnboardingStatusPreparer prepares the GetOnboardingStatus request. -func (client VMInsightsClient) GetOnboardingStatusPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-11-27-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOnboardingStatusSender sends the GetOnboardingStatus request. The method will close the -// http.Response Body if it receives an error. -func (client VMInsightsClient) GetOnboardingStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetOnboardingStatusResponder handles the response to the GetOnboardingStatus request. The method always -// closes the http.Response Body. -func (client VMInsightsClient) GetOnboardingStatusResponder(resp *http.Response) (result VMInsightsOnboardingStatus, 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/monitor/mgmt/2019-11-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2019-11-01-preview/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2019-11-01-preview/insights/_meta.json deleted file mode 100644 index be94626a714d..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "4c93f28f89435f6d244f4db61bbf810b5d20f09f", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2019-11", - "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-2019-11 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/actiongroups.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/actiongroups.go deleted file mode 100644 index fe4664342676..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/actiongroups.go +++ /dev/null @@ -1,615 +0,0 @@ -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" -) - -// ActionGroupsClient is the monitor Management Client -type ActionGroupsClient struct { - BaseClient -} - -// NewActionGroupsClient creates an instance of the ActionGroupsClient client. -func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { - return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { - return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new action group or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroup - the action group to create or use for the update. -func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: actionGroup, - Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, - {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, 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.ActionGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroup), - 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 ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) 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 -} - -// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. -// This operation is only supported for Email or SMS receivers. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// enableRequest - the receiver to re-enable. -func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, 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.ActionGroupsClient", "EnableReceiver", err.Error()) - } - - req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") - return - } - - resp, err := client.EnableReceiverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") - return - } - - result, err = client.EnableReceiverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") - return - } - - return -} - -// EnableReceiverPreparer prepares the EnableReceiver request. -func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}/subscribe", pathParameters), - autorest.WithJSON(enableRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableReceiverSender sends the EnableReceiver request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableReceiverResponder handles the response to the EnableReceiver request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an action group. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all action groups in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActionGroupsClient) 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 = "2019-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.insights/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all action groups in a subscription. -func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") - 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}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) - } - - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, 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 action group's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// actionGroupName - the name of the action group. -// actionGroupPatch - parameters supplied to the operation. -func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroupPatch), - 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 ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2019-11-01-preview/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogalerts.go deleted file mode 100644 index 959d56c034a6..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogalerts.go +++ /dev/null @@ -1,530 +0,0 @@ -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" -) - -// ActivityLogAlertsClient is the monitor Management Client -type ActivityLogAlertsClient struct { - BaseClient -} - -// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient 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 NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new activity log alert or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlert - the activity log alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all activity log alerts in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) 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 = "2017-04-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/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all activity log alerts in a subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") - 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}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) - } - - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, 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 ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlertPatch - parameters supplied to the operation. -func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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/monitor/mgmt/2019-11-01-preview/insights/activitylogs.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogs.go deleted file mode 100644 index 468cd15e3148..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/activitylogs.go +++ /dev/null @@ -1,173 +0,0 @@ -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" -) - -// ActivityLogsClient is the monitor Management Client -type ActivityLogsClient struct { - BaseClient -} - -// NewActivityLogsClient creates an instance of the ActivityLogsClient client. -func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { - return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient 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 NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { - return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides the list of records from the activity logs. -// Parameters: -// filter - reduces the set of data collected.
This argument is required and it also requires at least the -// start date/time.
The **$filter** argument is very restricted and allows only the following patterns.
- -// *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and -// eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
- *List -// events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a subscription in a -// time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq -// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq -// 'correlationID'.

**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.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.ActivityLogsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertruleincidents.go deleted file mode 100644 index 8ae4293a8f6f..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertruleincidents.go +++ /dev/null @@ -1,199 +0,0 @@ -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" -) - -// AlertRuleIncidentsClient is the monitor Management Client -type AlertRuleIncidentsClient struct { - BaseClient -} - -// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// incidentName - the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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}}}}); err != nil { - return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "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.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) 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 -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") - 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}}}}); err != nil { - return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) - } - - req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - return - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2019-11-01-preview/insights/alertrules.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertrules.go deleted file mode 100644 index 5d66e2a881f9..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/alertrules.go +++ /dev/null @@ -1,527 +0,0 @@ -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" -) - -// AlertRulesClient is the monitor Management Client -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 a classic metric alert rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, 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.AlertRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 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 AlertRuleResource, 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName 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}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, 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}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 AlertRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the classic metric alert rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) 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 = "2016-03-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/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the classic metric alert rules within a subscription. -func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") - 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}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// alertRulesResource - parameters supplied to the operation. -func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(alertRulesResource), - 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 AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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/monitor/mgmt/2019-11-01-preview/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/autoscalesettings.go deleted file mode 100644 index a7197859ce03..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/autoscalesettings.go +++ /dev/null @@ -1,612 +0,0 @@ -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" -) - -// AutoscaleSettingsClient is the monitor Management Client -type AutoscaleSettingsClient struct { - BaseClient -} - -// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// parameters - parameters supplied to the operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, 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.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) 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-04-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/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 the autoscale settings for a subscription -func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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.AutoscaleSettingsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// autoscaleSettingName - the autoscale setting name. -// autoscaleSettingResource - parameters supplied to the operation. -func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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}}}}); err != nil { - return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(autoscaleSettingResource), - 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2019-11-01-preview/insights/baselines.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/baselines.go deleted file mode 100644 index f9666917c515..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/baselines.go +++ /dev/null @@ -1,143 +0,0 @@ -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" -) - -// BaselinesClient is the monitor Management Client -type BaselinesClient struct { - BaseClient -} - -// NewBaselinesClient creates an instance of the BaselinesClient client. -func NewBaselinesClient(subscriptionID string) BaselinesClient { - return NewBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBaselinesClientWithBaseURI creates an instance of the BaselinesClient 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 NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) BaselinesClient { - return BaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnames - the names of the metrics (comma separated) to retrieve. -// metricnamespace - metric namespace to query metric definitions for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result MetricBaselinesResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaselinesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "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.BaselinesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2019-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricBaselines", 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 BaselinesClient) 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 BaselinesClient) ListResponder(resp *http.Response) (result MetricBaselinesResponse, 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/monitor/mgmt/2019-11-01-preview/insights/client.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/client.go deleted file mode 100644 index a777181b0785..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package insights implements the Azure ARM Insights service API version . -// -// Monitor 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/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettings.go deleted file mode 100644 index 9708c52c2499..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettings.go +++ /dev/null @@ -1,332 +0,0 @@ -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" -) - -// DiagnosticSettingsClient is the monitor Management Client -type DiagnosticSettingsClient struct { - BaseClient -} - -// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. -func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { - return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient 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 NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { - return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, resourceURI, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-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("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) 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 active diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 active diagnostic settings list for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", 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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, 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/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettingscategory.go deleted file mode 100644 index 48365ed67e65..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/diagnosticsettingscategory.go +++ /dev/null @@ -1,180 +0,0 @@ -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" -) - -// DiagnosticSettingsCategoryClient is the monitor Management Client -type DiagnosticSettingsCategoryClient struct { - BaseClient -} - -// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. -func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { - return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient 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 NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { - return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, 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/monitor/mgmt/2019-11-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/enums.go deleted file mode 100644 index b0a6aee8f846..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/enums.go +++ /dev/null @@ -1,645 +0,0 @@ -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. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // Average ... - Average AggregationType = "Average" - // Count ... - Count AggregationType = "Count" - // Maximum ... - Maximum AggregationType = "Maximum" - // Minimum ... - Minimum AggregationType = "Minimum" - // None ... - None AggregationType = "None" - // Total ... - Total AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{Average, Count, Maximum, Minimum, None, Total} -} - -// AlertSeverity enumerates the values for alert severity. -type AlertSeverity string - -const ( - // Four ... - Four AlertSeverity = "4" - // One ... - One AlertSeverity = "1" - // Three ... - Three AlertSeverity = "3" - // Two ... - Two AlertSeverity = "2" - // Zero ... - Zero AlertSeverity = "0" -) - -// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. -func PossibleAlertSeverityValues() []AlertSeverity { - return []AlertSeverity{Four, One, Three, Two, Zero} -} - -// BaselineSensitivity enumerates the values for baseline sensitivity. -type BaselineSensitivity string - -const ( - // High ... - High BaselineSensitivity = "High" - // Low ... - Low BaselineSensitivity = "Low" - // Medium ... - Medium BaselineSensitivity = "Medium" -) - -// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. -func PossibleBaselineSensitivityValues() []BaselineSensitivity { - return []BaselineSensitivity{High, Low, Medium} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // Logs ... - Logs CategoryType = "Logs" - // Metrics ... - Metrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{Logs, Metrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // Equals ... - Equals ComparisonOperationType = "Equals" - // GreaterThan ... - GreaterThan ComparisonOperationType = "GreaterThan" - // GreaterThanOrEqual ... - GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // LessThan ... - LessThan ComparisonOperationType = "LessThan" - // LessThanOrEqual ... - LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // NotEquals ... - NotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} -} - -// ConditionalOperator enumerates the values for conditional operator. -type ConditionalOperator string - -const ( - // ConditionalOperatorEqual ... - ConditionalOperatorEqual ConditionalOperator = "Equal" - // ConditionalOperatorGreaterThan ... - ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" - // ConditionalOperatorLessThan ... - ConditionalOperatorLessThan ConditionalOperator = "LessThan" -) - -// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. -func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} -} - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// CriterionType enumerates the values for criterion type. -type CriterionType string - -const ( - // CriterionTypeDynamicThresholdCriterion ... - CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - // CriterionTypeMultiMetricCriteria ... - CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" - // CriterionTypeStaticThresholdCriterion ... - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" -) - -// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. -func PossibleCriterionTypeValues() []CriterionType { - return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} -} - -// DataStatus enumerates the values for data status. -type DataStatus string - -const ( - // NotPresent ... - NotPresent DataStatus = "notPresent" - // Present ... - Present DataStatus = "present" -) - -// PossibleDataStatusValues returns an array of possible values for the DataStatus const type. -func PossibleDataStatusValues() []DataStatus { - return []DataStatus{NotPresent, Present} -} - -// DynamicThresholdOperator enumerates the values for dynamic threshold operator. -type DynamicThresholdOperator string - -const ( - // DynamicThresholdOperatorGreaterOrLessThan ... - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - // DynamicThresholdOperatorGreaterThan ... - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - // DynamicThresholdOperatorLessThan ... - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} -} - -// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. -type DynamicThresholdSensitivity string - -const ( - // DynamicThresholdSensitivityHigh ... - DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" - // DynamicThresholdSensitivityLow ... - DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" - // DynamicThresholdSensitivityMedium ... - DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} -} - -// Enabled enumerates the values for enabled. -type Enabled string - -const ( - // False ... - False Enabled = "false" - // True ... - True Enabled = "true" -) - -// PossibleEnabledValues returns an array of possible values for the Enabled const type. -func PossibleEnabledValues() []Enabled { - return []Enabled{False, True} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // EventLevelCritical ... - EventLevelCritical EventLevel = "Critical" - // EventLevelError ... - EventLevelError EventLevel = "Error" - // EventLevelInformational ... - EventLevelInformational EventLevel = "Informational" - // EventLevelVerbose ... - EventLevelVerbose EventLevel = "Verbose" - // EventLevelWarning ... - EventLevelWarning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// MetricTriggerType enumerates the values for metric trigger type. -type MetricTriggerType string - -const ( - // MetricTriggerTypeConsecutive ... - MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" - // MetricTriggerTypeTotal ... - MetricTriggerTypeTotal MetricTriggerType = "Total" -) - -// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. -func PossibleMetricTriggerTypeValues() []MetricTriggerType { - return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicAction enumerates the values for odata type basic action. -type OdataTypeBasicAction string - -const ( - // OdataTypeAction ... - OdataTypeAction OdataTypeBasicAction = "Action" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" -) - -// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. -func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} -} - -// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. -type OdataTypeBasicMetricAlertCriteria string - -const ( - // OdataTypeMetricAlertCriteria ... - OdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" - // OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... - OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. -func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { - return []OdataTypeBasicMetricAlertCriteria{OdataTypeMetricAlertCriteria, OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeRuleAction ... - OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeRuleCondition ... - OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} -} - -// OnboardingStatus enumerates the values for onboarding status. -type OnboardingStatus string - -const ( - // NotOnboarded ... - NotOnboarded OnboardingStatus = "notOnboarded" - // Onboarded ... - Onboarded OnboardingStatus = "onboarded" - // Unknown ... - Unknown OnboardingStatus = "unknown" -) - -// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. -func PossibleOnboardingStatusValues() []OnboardingStatus { - return []OnboardingStatus{NotOnboarded, Onboarded, Unknown} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorEquals ... - OperatorEquals Operator = "Equals" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Deploying ... - Deploying ProvisioningState = "Deploying" - // Failed ... - Failed ProvisioningState = "Failed" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Deploying, Failed, Succeeded} -} - -// QueryType enumerates the values for query type. -type QueryType string - -const ( - // ResultCount ... - ResultCount QueryType = "ResultCount" -) - -// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. -func PossibleQueryTypeValues() []QueryType { - return []QueryType{ResultCount} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // ReceiverStatusDisabled ... - ReceiverStatusDisabled ReceiverStatus = "Disabled" - // ReceiverStatusEnabled ... - ReceiverStatusEnabled ReceiverStatus = "Enabled" - // ReceiverStatusNotSpecified ... - ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // Data ... - Data ResultType = "Data" - // Metadata ... - Metadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{Data, Metadata} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ChangeCount ... - ChangeCount ScaleType = "ChangeCount" - // ExactCount ... - ExactCount ScaleType = "ExactCount" - // PercentChangeCount ... - PercentChangeCount ScaleType = "PercentChangeCount" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ChangeCount, ExactCount, PercentChangeCount} -} - -// Sensitivity enumerates the values for sensitivity. -type Sensitivity string - -const ( - // SensitivityHigh ... - SensitivityHigh Sensitivity = "High" - // SensitivityLow ... - SensitivityLow Sensitivity = "Low" - // SensitivityMedium ... - SensitivityMedium Sensitivity = "Medium" -) - -// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. -func PossibleSensitivityValues() []Sensitivity { - return []Sensitivity{SensitivityHigh, SensitivityLow, SensitivityMedium} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/eventcategories.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/eventcategories.go deleted file mode 100644 index 86e59b424363..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/eventcategories.go +++ /dev/null @@ -1,99 +0,0 @@ -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" -) - -// EventCategoriesClient is the monitor Management Client -type EventCategoriesClient struct { - BaseClient -} - -// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. -func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { - return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { - return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available event categories supported in the Activity Logs Service.
The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "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.EventCategoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), - 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2019-11-01-preview/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/insightsapi/interfaces.go deleted file mode 100644 index b0a7f5ed8d17..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,268 +0,0 @@ -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/monitor/mgmt/2019-11-01-preview/insights" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) - List(ctx context.Context) (result insights.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) - -// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. -type DiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) -} - -var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) - -// SubscriptionDiagnosticSettingsClientAPI contains the set of methods on the SubscriptionDiagnosticSettingsClient type. -type SubscriptionDiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, parameters insights.SubscriptionDiagnosticSettingsResource, name string) (result insights.SubscriptionDiagnosticSettingsResource, err error) - Delete(ctx context.Context, name string) (result autorest.Response, err error) - Get(ctx context.Context, name string) (result insights.SubscriptionDiagnosticSettingsResource, err error) - List(ctx context.Context) (result insights.SubscriptionDiagnosticSettingsResourceCollection, err error) -} - -var _ SubscriptionDiagnosticSettingsClientAPI = (*insights.SubscriptionDiagnosticSettingsClient)(nil) - -// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) -} - -var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) - -// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. -type ActivityLogAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActivityLogAlertList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActivityLogAlertList, err error) - Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch insights.ActivityLogAlertPatchBody) (result insights.ActivityLogAlertResource, err error) -} - -var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) - -// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. -type ActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result insights.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) - -// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. -type TenantActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) - -// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. -type MetricDefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string, metricnamespace string) (result insights.MetricDefinitionCollection, err error) -} - -var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) - -// MetricsClientAPI contains the set of methods on the MetricsClient type. -type MetricsClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType insights.ResultType, metricnamespace string) (result insights.Response, err error) -} - -var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// MetricBaselineClientAPI contains the set of methods on the MetricBaselineClient type. -type MetricBaselineClientAPI interface { - CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation insights.TimeSeriesInformation) (result insights.CalculateBaselineResponse, err error) - Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType insights.ResultType) (result insights.BaselineResponse, err error) -} - -var _ MetricBaselineClientAPI = (*insights.MetricBaselineClient)(nil) - -// BaselinesClientAPI contains the set of methods on the BaselinesClient type. -type BaselinesClientAPI interface { - List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) -} - -var _ BaselinesClientAPI = (*insights.BaselinesClient)(nil) - -// MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. -type MetricAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.MetricAlertResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.MetricAlertResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResourcePatch) (result insights.MetricAlertResource, err error) -} - -var _ MetricAlertsClientAPI = (*insights.MetricAlertsClient)(nil) - -// MetricAlertsStatusClientAPI contains the set of methods on the MetricAlertsStatusClient type. -type MetricAlertsStatusClientAPI interface { - List(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertStatusCollection, err error) - ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result insights.MetricAlertStatusCollection, err error) -} - -var _ MetricAlertsStatusClientAPI = (*insights.MetricAlertsStatusClient)(nil) - -// ScheduledQueryRulesClientAPI contains the set of methods on the ScheduledQueryRulesClient type. -type ScheduledQueryRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResource) (result insights.LogSearchRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.LogSearchRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result insights.LogSearchRuleResourceCollection, err error) - ListBySubscription(ctx context.Context, filter string) (result insights.LogSearchRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResourcePatch) (result insights.LogSearchRuleResource, err error) -} - -var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) - -// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. -type MetricNamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) -} - -var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) - -// VMInsightsClientAPI contains the set of methods on the VMInsightsClient type. -type VMInsightsClientAPI interface { - GetOnboardingStatus(ctx context.Context, resourceURI string) (result insights.VMInsightsOnboardingStatus, err error) -} - -var _ VMInsightsClientAPI = (*insights.VMInsightsClient)(nil) - -// PrivateLinkScopesClientAPI contains the set of methods on the PrivateLinkScopesClient type. -type PrivateLinkScopesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload insights.AzureMonitorPrivateLinkScope) (result insights.AzureMonitorPrivateLinkScope, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkScopesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string) (result insights.AzureMonitorPrivateLinkScope, err error) - List(ctx context.Context) (result insights.AzureMonitorPrivateLinkScopeListResultPage, err error) - ListComplete(ctx context.Context) (result insights.AzureMonitorPrivateLinkScopeListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AzureMonitorPrivateLinkScopeListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AzureMonitorPrivateLinkScopeListResultIterator, err error) - UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags insights.TagsResource) (result insights.AzureMonitorPrivateLinkScope, err error) -} - -var _ PrivateLinkScopesClientAPI = (*insights.PrivateLinkScopesClient)(nil) - -// PrivateLinkScopeOperationStatusClientAPI contains the set of methods on the PrivateLinkScopeOperationStatusClient type. -type PrivateLinkScopeOperationStatusClientAPI interface { - Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result insights.OperationStatus, err error) -} - -var _ PrivateLinkScopeOperationStatusClientAPI = (*insights.PrivateLinkScopeOperationStatusClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result insights.PrivateLinkResource, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkResourceListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkResourceListResultIterator, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*insights.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters insights.PrivateEndpointConnection) (result insights.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result insights.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result insights.PrivateEndpointConnection, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateEndpointConnectionListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*insights.PrivateEndpointConnectionsClient)(nil) - -// PrivateLinkScopedResourcesClientAPI contains the set of methods on the PrivateLinkScopedResourcesClient type. -type PrivateLinkScopedResourcesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters insights.ScopedResource) (result insights.PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result insights.PrivateLinkScopedResourcesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result insights.ScopedResource, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.ScopedResourceListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.ScopedResourceListResultIterator, err error) -} - -var _ PrivateLinkScopedResourcesClientAPI = (*insights.PrivateLinkScopedResourcesClient)(nil) diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/logprofiles.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/logprofiles.go deleted file mode 100644 index 64fda18dde7c..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/logprofiles.go +++ /dev/null @@ -1,444 +0,0 @@ -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" -) - -// LogProfilesClient is the monitor Management Client -type LogProfilesClient struct { - BaseClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// Parameters: -// logProfileName - the name of the log profile. -// parameters - parameters supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), 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.LogProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) 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 the log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 LogProfilesResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// logProfileName - the name of the log profile. -// logProfilesResource - parameters supplied to the operation. -func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(logProfilesResource), - 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 LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2019-11-01-preview/insights/metricalerts.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalerts.go deleted file mode 100644 index d31f6a2e8a9e..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalerts.go +++ /dev/null @@ -1,530 +0,0 @@ -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" -) - -// MetricAlertsClient is the monitor Management Client -type MetricAlertsClient struct { - BaseClient -} - -// NewMetricAlertsClient creates an instance of the MetricAlertsClient client. -func NewMetricAlertsClient(subscriptionID string) MetricAlertsClient { - return NewMetricAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsClientWithBaseURI creates an instance of the MetricAlertsClient 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 NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsClient { - return MetricAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result MetricAlertResource, 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 alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) 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 an alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) GetResponder(resp *http.Response) (result MetricAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve alert rule definitions in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MetricAlertsClient) 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 = "2018-03-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/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieve alert rule definitions in a subscription. -func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListBySubscription") - 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}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) UpdateResponder(resp *http.Response) (result MetricAlertResource, 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/monitor/mgmt/2019-11-01-preview/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalertsstatus.go deleted file mode 100644 index 7644133efea3..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricalertsstatus.go +++ /dev/null @@ -1,199 +0,0 @@ -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" -) - -// MetricAlertsStatusClient is the monitor Management Client -type MetricAlertsStatusClient struct { - BaseClient -} - -// NewMetricAlertsStatusClient creates an instance of the MetricAlertsStatusClient client. -func NewMetricAlertsStatusClient(subscriptionID string) MetricAlertsStatusClient { - return NewMetricAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsStatusClientWithBaseURI creates an instance of the MetricAlertsStatusClient 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 NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsStatusClient { - return MetricAlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.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}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsStatusClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "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.MetricAlertsStatusClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status", 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 MetricAlertsStatusClient) 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 MetricAlertsStatusClient) ListResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByName retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// statusName - the name of the status. -func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.ListByName") - 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}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsStatusClient", "ListByName", err.Error()) - } - - req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure sending request") - return - } - - result, err = client.ListByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure responding to request") - return - } - - return -} - -// ListByNamePreparer prepares the ListByName request. -func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "statusName": autorest.Encode("path", statusName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status/{statusName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNameSender sends the ListByName request. The method will close the -// http.Response Body if it receives an error. -func (client MetricAlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNameResponder handles the response to the ListByName request. The method always -// closes the http.Response Body. -func (client MetricAlertsStatusClient) ListByNameResponder(resp *http.Response) (result MetricAlertStatusCollection, 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/monitor/mgmt/2019-11-01-preview/insights/metricbaseline.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricbaseline.go deleted file mode 100644 index 709571486dd7..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricbaseline.go +++ /dev/null @@ -1,217 +0,0 @@ -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" -) - -// MetricBaselineClient is the monitor Management Client -type MetricBaselineClient struct { - BaseClient -} - -// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. -func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { - return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient 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 NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { - return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CalculateBaseline **Lists the baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// timeSeriesInformation - information that need to be specified to calculate a baseline on a time series. -func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.CalculateBaseline") - 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: timeSeriesInformation, - Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) - } - - req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") - return - } - - resp, err := client.CalculateBaselineSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") - return - } - - result, err = client.CalculateBaselineResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") - return - } - - return -} - -// CalculateBaselinePreparer prepares the CalculateBaseline request. -func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-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("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), - autorest.WithJSON(timeSeriesInformation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CalculateBaselineSender sends the CalculateBaseline request. The method will close the -// http.Response Body if it receives an error. -func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always -// closes the http.Response Body. -func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get **Gets the baseline values for a specific metric**. -// Parameters: -// resourceURI - the identifier of the resource. It has the following structure: -// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. -// For example: -// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 -// metricName - the name of the metric to retrieve the baseline for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the aggregation type of the metric to retrieve the baseline for. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricBaselineClient.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, metricName, timespan, interval, aggregation, sensitivities, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "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.MetricBaselineClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "metricName": autorest.Encode("path", metricName), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}", 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 MetricBaselineClient) 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 MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, 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/monitor/mgmt/2019-11-01-preview/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricdefinitions.go deleted file mode 100644 index 69fc2e0b465a..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricdefinitions.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricDefinitionsClient is the monitor Management Client -type MetricDefinitionsClient struct { - BaseClient -} - -// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. -func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { - return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient 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 NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { - return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result MetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "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.MetricDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", 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 MetricDefinitionsClient) 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 MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, 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/monitor/mgmt/2019-11-01-preview/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricnamespaces.go deleted file mode 100644 index f2ef47baf802..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metricnamespaces.go +++ /dev/null @@ -1,109 +0,0 @@ -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" -) - -// MetricNamespacesClient is the monitor Management Client -type MetricNamespacesClient struct { - BaseClient -} - -// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. -func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { - return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient 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 NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { - return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric namespaces for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, startTime) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "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.MetricNamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", 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 MetricNamespacesClient) 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 MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, 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/monitor/mgmt/2019-11-01-preview/insights/metrics.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/metrics.go deleted file mode 100644 index 97687a09b498..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/metrics.go +++ /dev/null @@ -1,152 +0,0 @@ -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" -) - -// MetricsClient is the monitor Management Client -type MetricsClient struct { - BaseClient -} - -// NewMetricsClient creates an instance of the MetricsClient client. -func NewMetricsClient(subscriptionID string) MetricsClient { - return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricsClientWithBaseURI creates an instance of the MetricsClient 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 NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { - return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (result Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "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.MetricsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/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 MetricsClient) 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 MetricsClient) ListResponder(resp *http.Response) (result Response, 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/monitor/mgmt/2019-11-01-preview/insights/models.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/models.go deleted file mode 100644 index ebc7fdbddcab..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/models.go +++ /dev/null @@ -1,7293 +0,0 @@ -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/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/preview/monitor/mgmt/2019-11-01-preview/insights" - -// BasicAction action descriptor. -type BasicAction interface { - AsAlertingAction() (*AlertingAction, bool) - AsLogToMetricAction() (*LogToMetricAction, bool) - AsAction() (*Action, bool) -} - -// Action action descriptor. -type Action struct { - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicAction(body []byte) (BasicAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): - var aa AlertingAction - err := json.Unmarshal(body, &aa) - return aa, err - case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): - var ltma LogToMetricAction - err := json.Unmarshal(body, <ma) - return ltma, err - default: - var a Action - err := json.Unmarshal(body, &a) - return a, err - } -} -func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - aArray := make([]BasicAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - a, err := unmarshalBasicAction(*rawMessage) - if err != nil { - return nil, err - } - aArray[index] = a - } - return aArray, nil -} - -// MarshalJSON is the custom marshaler for Action. -func (a Action) MarshalJSON() ([]byte, error) { - a.OdataType = OdataTypeAction - objectMap := make(map[string]interface{}) - if a.OdataType != "" { - objectMap["odata.type"] = a.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for Action. -func (a Action) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for Action. -func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for Action. -func (a Action) AsAction() (*Action, bool) { - return &a, true -} - -// AsBasicAction is the BasicAction implementation for Action. -func (a Action) AsBasicAction() (BasicAction, bool) { - return &a, true -} - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) 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 - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `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 ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) 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 actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActivityLogAlert an Azure activity log alert. -type ActivityLogAlert struct { - // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. - Scopes *[]string `json:"scopes,omitempty"` - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` - // Condition - The condition that will cause this alert to activate. - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - // Actions - The actions that will activate when the condition is met. - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - // Description - A description of this activity log alert. - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - // ActionGroupID - The resourceId of the action group. This cannot be null or empty. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string `json:"webhookProperties"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. -func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alaag.ActionGroupID != nil { - objectMap["actionGroupId"] = alaag.ActionGroupID - } - if alaag.WebhookProperties != nil { - objectMap["webhookProperties"] = alaag.WebhookProperties - } - return json.Marshal(objectMap) -} - -// ActivityLogAlertActionList a list of activity log alert actions. -type ActivityLogAlertActionList struct { - // ActionGroups - The list of activity log alerts. - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member -// conditions are met. -type ActivityLogAlertAllOfCondition struct { - // AllOf - The list of activity log alert conditions. - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log -// field and value. -type ActivityLogAlertLeafCondition struct { - // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. - Field *string `json:"field,omitempty"` - // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - // Value - The list of activity log alerts. - Value *[]ActivityLogAlertResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityLogAlertPatch an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. -type ActivityLogAlertPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActivityLogAlertPatch - The activity log alert settings for an update operation. - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. -func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alapb.Tags != nil { - objectMap["tags"] = alapb.Tags - } - if alapb.ActivityLogAlertPatch != nil { - objectMap["properties"] = alapb.ActivityLogAlertPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. -func (alapb *ActivityLogAlertPatchBody) 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 - } - alapb.Tags = tags - } - case "properties": - if v != nil { - var activityLogAlertPatch ActivityLogAlertPatch - err = json.Unmarshal(*v, &activityLogAlertPatch) - if err != nil { - return err - } - alapb.ActivityLogAlertPatch = &activityLogAlertPatch - } - } - } - - return nil -} - -// ActivityLogAlertResource an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `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 ActivityLogAlertResource. -func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alar.ActivityLogAlert != nil { - objectMap["properties"] = alar.ActivityLogAlert - } - if alar.Location != nil { - objectMap["location"] = alar.Location - } - if alar.Tags != nil { - objectMap["tags"] = alar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) 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 activityLogAlert ActivityLogAlert - err = json.Unmarshal(*v, &activityLogAlert) - if err != nil { - return err - } - alar.ActivityLogAlert = &activityLogAlert - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - alar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - alar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - alar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alar.Tags = tags - } - } - } - - return nil -} - -// AlertingAction specify action need to be taken when rule type is Alert -type AlertingAction struct { - // Severity - Severity of the alert. Possible values include: 'Zero', 'One', 'Two', 'Three', 'Four' - Severity AlertSeverity `json:"severity,omitempty"` - // AznsAction - Azure action group reference. - AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` - // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. - ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` - // Trigger - The trigger condition that results in the alert rule being. - Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertingAction. -func (aa AlertingAction) MarshalJSON() ([]byte, error) { - aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction - objectMap := make(map[string]interface{}) - if aa.Severity != "" { - objectMap["severity"] = aa.Severity - } - if aa.AznsAction != nil { - objectMap["aznsAction"] = aa.AznsAction - } - if aa.ThrottlingInMin != nil { - objectMap["throttlingInMin"] = aa.ThrottlingInMin - } - if aa.Trigger != nil { - objectMap["trigger"] = aa.Trigger - } - if aa.OdataType != "" { - objectMap["odata.type"] = aa.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { - return &aa, true -} - -// AsLogToMetricAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { - return &aa, true -} - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) 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 - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `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 AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) 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 alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) 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 - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// ArmRoleReceiver an arm role receiver. -type ArmRoleReceiver struct { - // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // RoleID - The arm role id. - RoleID *string `json:"roleId,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `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 AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) 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 autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) - if err != nil { - return err - } - page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) 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 - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzNsActionGroup azure action group -type AzNsActionGroup struct { - // ActionGroup - Azure Action Group reference. - ActionGroup *[]string `json:"actionGroup,omitempty"` - // EmailSubject - Custom subject override for all email ids in Azure action group - EmailSubject *string `json:"emailSubject,omitempty"` - // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group - CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AzureMonitorPrivateLinkScope an Azure Monitor PrivateLinkScope definition. -type AzureMonitorPrivateLinkScope struct { - autorest.Response `json:"-"` - // AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. - *AzureMonitorPrivateLinkScopeProperties `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 AzureMonitorPrivateLinkScope. -func (ampls AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ampls.AzureMonitorPrivateLinkScopeProperties != nil { - objectMap["properties"] = ampls.AzureMonitorPrivateLinkScopeProperties - } - if ampls.Location != nil { - objectMap["location"] = ampls.Location - } - if ampls.Tags != nil { - objectMap["tags"] = ampls.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureMonitorPrivateLinkScope struct. -func (ampls *AzureMonitorPrivateLinkScope) 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 azureMonitorPrivateLinkScopeProperties AzureMonitorPrivateLinkScopeProperties - err = json.Unmarshal(*v, &azureMonitorPrivateLinkScopeProperties) - if err != nil { - return err - } - ampls.AzureMonitorPrivateLinkScopeProperties = &azureMonitorPrivateLinkScopeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ampls.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ampls.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ampls.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ampls.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ampls.Tags = tags - } - } - } - - return nil -} - -// AzureMonitorPrivateLinkScopeListResult describes the list of Azure Monitor PrivateLinkScope resources. -type AzureMonitorPrivateLinkScopeListResult struct { - autorest.Response `json:"-"` - // Value - List of Azure Monitor PrivateLinkScope definitions. - Value *[]AzureMonitorPrivateLinkScope `json:"value,omitempty"` - // NextLink - The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned in the result set. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureMonitorPrivateLinkScopeListResultIterator provides access to a complete listing of -// AzureMonitorPrivateLinkScope values. -type AzureMonitorPrivateLinkScopeListResultIterator struct { - i int - page AzureMonitorPrivateLinkScopeListResultPage -} - -// 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 *AzureMonitorPrivateLinkScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultIterator.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 *AzureMonitorPrivateLinkScopeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureMonitorPrivateLinkScopeListResultIterator) 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 AzureMonitorPrivateLinkScopeListResultIterator) Response() AzureMonitorPrivateLinkScopeListResult { - 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 AzureMonitorPrivateLinkScopeListResultIterator) Value() AzureMonitorPrivateLinkScope { - if !iter.page.NotDone() { - return AzureMonitorPrivateLinkScope{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultIterator type. -func NewAzureMonitorPrivateLinkScopeListResultIterator(page AzureMonitorPrivateLinkScopeListResultPage) AzureMonitorPrivateLinkScopeListResultIterator { - return AzureMonitorPrivateLinkScopeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (amplslr AzureMonitorPrivateLinkScopeListResult) IsEmpty() bool { - return amplslr.Value == nil || len(*amplslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (amplslr AzureMonitorPrivateLinkScopeListResult) hasNextLink() bool { - return amplslr.NextLink != nil && len(*amplslr.NextLink) != 0 -} - -// azureMonitorPrivateLinkScopeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (amplslr AzureMonitorPrivateLinkScopeListResult) azureMonitorPrivateLinkScopeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !amplslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(amplslr.NextLink))) -} - -// AzureMonitorPrivateLinkScopeListResultPage contains a page of AzureMonitorPrivateLinkScope values. -type AzureMonitorPrivateLinkScopeListResultPage struct { - fn func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error) - amplslr AzureMonitorPrivateLinkScopeListResult -} - -// 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 *AzureMonitorPrivateLinkScopeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultPage.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.amplslr) - if err != nil { - return err - } - page.amplslr = 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 *AzureMonitorPrivateLinkScopeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureMonitorPrivateLinkScopeListResultPage) NotDone() bool { - return !page.amplslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureMonitorPrivateLinkScopeListResultPage) Response() AzureMonitorPrivateLinkScopeListResult { - return page.amplslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureMonitorPrivateLinkScopeListResultPage) Values() []AzureMonitorPrivateLinkScope { - if page.amplslr.IsEmpty() { - return nil - } - return *page.amplslr.Value -} - -// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultPage type. -func NewAzureMonitorPrivateLinkScopeListResultPage(cur AzureMonitorPrivateLinkScopeListResult, getNextPage func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)) AzureMonitorPrivateLinkScopeListResultPage { - return AzureMonitorPrivateLinkScopeListResultPage{ - fn: getNextPage, - amplslr: cur, - } -} - -// AzureMonitorPrivateLinkScopeProperties properties that define a Azure Monitor PrivateLinkScope resource. -type AzureMonitorPrivateLinkScopeProperties struct { - // ProvisioningState - READ-ONLY; Current state of this PrivateLinkScope: 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 Provisioning ,Succeeded, Canceled and Failed. - ProvisioningState *string `json:"provisioningState,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScopeProperties. -func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Baseline the baseline values for a single sensitivity value. -type Baseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh' - Sensitivity Sensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - -// BaselineMetadata represents a baseline metadata value. -type BaselineMetadata struct { - // Name - Name of the baseline metadata. - Name *string `json:"name,omitempty"` - // Value - Value of the baseline metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineMetadataValue represents a baseline metadata value. -type BaselineMetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// BaselineProperties the baseline properties class. -type BaselineProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` - // Metadata - the baseline metadata values. - Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` -} - -// BaselineResponse the response to a baseline query. -type BaselineResponse struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; the metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // BaselineProperties - the properties of the baseline. - *BaselineProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaselineResponse. -func (br BaselineResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.BaselineProperties != nil { - objectMap["properties"] = br.BaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. -func (br *BaselineResponse) 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 - } - br.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - br.Type = &typeVar - } - case "name": - if v != nil { - var name LocalizableString - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - br.Name = &name - } - case "properties": - if v != nil { - var baselineProperties BaselineProperties - err = json.Unmarshal(*v, &baselineProperties) - if err != nil { - return err - } - br.BaselineProperties = &baselineProperties - } - } - } - - return nil -} - -// CalculateBaselineResponse the response to a calculate baseline call. -type CalculateBaselineResponse struct { - autorest.Response `json:"-"` - // Type - the resource type of the baseline resource. - Type *string `json:"type,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Baseline - the baseline values for each sensitivity. - Baseline *[]Baseline `json:"baseline,omitempty"` -} - -// Criteria specifies the criteria for converting log to metric. -type Criteria struct { - // MetricName - Name of the metric - MetricName *string `json:"metricName,omitempty"` - // Dimensions - List of Dimensions for creating metric - Dimensions *[]Dimension `json:"dimensions,omitempty"` -} - -// DataContainer information about a container with data for a given resource. -type DataContainer struct { - // Workspace - Log Analytics workspace information. - Workspace *WorkspaceInfo `json:"workspace,omitempty"` -} - -// DiagnosticSettings the diagnostic settings. -type DiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// DiagnosticSettingsCategory the diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' - CategoryType CategoryType `json:"categoryType,omitempty"` -} - -// DiagnosticSettingsCategoryResource the diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` - // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. - *DiagnosticSettingsCategory `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. -func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dscr.DiagnosticSettingsCategory != nil { - objectMap["properties"] = dscr.DiagnosticSettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. -func (dscr *DiagnosticSettingsCategoryResource) 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 diagnosticSettingsCategory DiagnosticSettingsCategory - err = json.Unmarshal(*v, &diagnosticSettingsCategory) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dscr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category -// resources. -type DiagnosticSettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` -} - -// DiagnosticSettingsResource the diagnostic setting resource. -type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // DiagnosticSettings - Properties of a Diagnostic Settings Resource. - *DiagnosticSettings `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. -func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DiagnosticSettings != nil { - objectMap["properties"] = dsr.DiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. -func (dsr *DiagnosticSettingsResource) 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 diagnosticSettings DiagnosticSettings - err = json.Unmarshal(*v, &diagnosticSettings) - if err != nil { - return err - } - dsr.DiagnosticSettings = &diagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]DiagnosticSettingsResource `json:"value,omitempty"` -} - -// Dimension specifies the criteria for converting log to metric. -type Dimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // Operator - Operator for dimension values - Operator *string `json:"operator,omitempty"` - // Values - List of dimension values - Values *[]string `json:"values,omitempty"` -} - -// DynamicMetricCriteria criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' - Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' - AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` - // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` - // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) - IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - dmc.CriterionType = CriterionTypeDynamicThresholdCriterion - objectMap := make(map[string]interface{}) - if dmc.Operator != "" { - objectMap["operator"] = dmc.Operator - } - if dmc.AlertSensitivity != "" { - objectMap["alertSensitivity"] = dmc.AlertSensitivity - } - if dmc.FailingPeriods != nil { - objectMap["failingPeriods"] = dmc.FailingPeriods - } - if dmc.IgnoreDataBefore != nil { - objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore - } - if dmc.Name != nil { - objectMap["name"] = dmc.Name - } - if dmc.MetricName != nil { - objectMap["metricName"] = dmc.MetricName - } - if dmc.MetricNamespace != nil { - objectMap["metricNamespace"] = dmc.MetricNamespace - } - if dmc.TimeAggregation != nil { - objectMap["timeAggregation"] = dmc.TimeAggregation - } - if dmc.Dimensions != nil { - objectMap["dimensions"] = dmc.Dimensions - } - if dmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = dmc.SkipMetricValidation - } - if dmc.CriterionType != "" { - objectMap["criterionType"] = dmc.CriterionType - } - for k, v := range dmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return &dmc, true -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &dmc, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. -func (dmc *DynamicMetricCriteria) 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 "operator": - if v != nil { - var operator DynamicThresholdOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - dmc.Operator = operator - } - case "alertSensitivity": - if v != nil { - var alertSensitivity DynamicThresholdSensitivity - err = json.Unmarshal(*v, &alertSensitivity) - if err != nil { - return err - } - dmc.AlertSensitivity = alertSensitivity - } - case "failingPeriods": - if v != nil { - var failingPeriods DynamicThresholdFailingPeriods - err = json.Unmarshal(*v, &failingPeriods) - if err != nil { - return err - } - dmc.FailingPeriods = &failingPeriods - } - case "ignoreDataBefore": - if v != nil { - var ignoreDataBefore date.Time - err = json.Unmarshal(*v, &ignoreDataBefore) - if err != nil { - return err - } - dmc.IgnoreDataBefore = &ignoreDataBefore - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if dmc.AdditionalProperties == nil { - dmc.AdditionalProperties = make(map[string]interface{}) - } - dmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - dmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - dmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - dmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - dmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - dmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - dmc.CriterionType = criterionType - } - } - } - - return nil -} - -// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback -// time window required to raise an alert. -type DynamicThresholdFailingPeriods struct { - // NumberOfEvaluationPeriods - The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. - NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` - // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - if er.UseCommonAlertSchema != nil { - objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// Error error details. -type Error struct { - // Code - Error code identifying the specific error. - Code *string `json:"code,omitempty"` - // Message - Error message in the caller's locale. - Message *string `json:"message,omitempty"` -} - -// 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) -} - -// 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"` -} - -// ErrorResponseCommon the resource management error response. -type ErrorResponseCommon struct { - // Details - READ-ONLY; The error details. - Details *[]ErrorResponseCommon `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponseCommon. -func (erc ErrorResponseCommon) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erc.Code != nil { - objectMap["code"] = erc.Code - } - if erc.Message != nil { - objectMap["message"] = erc.Message - } - return json.Marshal(objectMap) -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// EventData the Azure event log entries are of type EventData -type EventData struct { - // Authorization - READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization `json:"authorization,omitempty"` - // Claims - READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string `json:"claims"` - // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string `json:"caller,omitempty"` - // Description - READ-ONLY; the description of the event. - Description *string `json:"description,omitempty"` - // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string `json:"id,omitempty"` - // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string `json:"eventDataId,omitempty"` - // CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. - CorrelationID *string `json:"correlationId,omitempty"` - // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. - EventName *LocalizableString `json:"eventName,omitempty"` - // Category - READ-ONLY; the event category. - Category *LocalizableString `json:"category,omitempty"` - // HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). - HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` - // Level - READ-ONLY; the event level. Possible values include: 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' - Level EventLevel `json:"level,omitempty"` - // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` - // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - READ-ONLY; the resource type - ResourceType *LocalizableString `json:"resourceType,omitempty"` - // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. - OperationID *string `json:"operationId,omitempty"` - // OperationName - READ-ONLY; the operation name. - OperationName *LocalizableString `json:"operationName,omitempty"` - // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string `json:"properties"` - // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - Status *LocalizableString `json:"status,omitempty"` - // SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) - SubStatus *LocalizableString `json:"subStatus,omitempty"` - // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. - EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` - // SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. - SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` - // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // TenantID - READ-ONLY; the Azure tenant Id - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventData. -func (ed EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EventDataCollection represents collection of events. -type EventDataCollection struct { - autorest.Response `json:"-"` - // Value - this list that includes the Azure audit logs. - Value *[]EventData `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventDataCollectionIterator provides access to a complete listing of EventData values. -type EventDataCollectionIterator struct { - i int - page EventDataCollectionPage -} - -// 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 *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.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 *EventDataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventDataCollectionIterator) 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 EventDataCollectionIterator) Response() EventDataCollection { - 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 EventDataCollectionIterator) Value() EventData { - if !iter.page.NotDone() { - return EventData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventDataCollectionIterator type. -func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { - return EventDataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edc EventDataCollection) IsEmpty() bool { - return edc.Value == nil || len(*edc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edc EventDataCollection) hasNextLink() bool { - return edc.NextLink != nil && len(*edc.NextLink) != 0 -} - -// eventDataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !edc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edc.NextLink))) -} - -// EventDataCollectionPage contains a page of EventData values. -type EventDataCollectionPage struct { - fn func(context.Context, EventDataCollection) (EventDataCollection, error) - edc EventDataCollection -} - -// 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 *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.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.edc) - if err != nil { - return err - } - page.edc = 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 *EventDataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventDataCollectionPage) NotDone() bool { - return !page.edc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventDataCollectionPage) Response() EventDataCollection { - return page.edc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventDataCollectionPage) Values() []EventData { - if page.edc.IsEmpty() { - return nil - } - return *page.edc.Value -} - -// Creates a new instance of the EventDataCollectionPage type. -func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { - return EventDataCollectionPage{ - fn: getNextPage, - edc: cur, - } -} - -// HTTPRequestInfo the Http request info. -type HTTPRequestInfo struct { - // ClientRequestID - the client request id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ClientIPAddress - the client Ip Address - ClientIPAddress *string `json:"clientIpAddress,omitempty"` - // Method - the Http request method. - Method *string `json:"method,omitempty"` - // URI - the Uri. - URI *string `json:"uri,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) 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 "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// LogMetricTrigger a log metrics trigger descriptor. -type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - The threshold of the metric trigger. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' - MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` - // MetricColumn - Evaluation of metric on a particular column - MetricColumn *string `json:"metricColumn,omitempty"` -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `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 LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) 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 logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) 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 - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// LogSearchRule log Search Rule Definition -type LogSearchRule struct { - // Description - The description of the Log Search rule. - Description *string `json:"description,omitempty"` - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Source - Data Source against which rule will Query Data - Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule *Schedule `json:"schedule,omitempty"` - // Action - Action needs to be taken on rule execution. - Action BasicAction `json:"action,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRule. -func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsr.Description != nil { - objectMap["description"] = lsr.Description - } - if lsr.Enabled != "" { - objectMap["enabled"] = lsr.Enabled - } - if lsr.Source != nil { - objectMap["source"] = lsr.Source - } - if lsr.Schedule != nil { - objectMap["schedule"] = lsr.Schedule - } - objectMap["action"] = lsr.Action - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. -func (lsr *LogSearchRule) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - lsr.Description = &description - } - case "enabled": - if v != nil { - var enabled Enabled - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - lsr.Enabled = enabled - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - lsr.LastUpdatedTime = &lastUpdatedTime - } - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - lsr.ProvisioningState = provisioningState - } - case "source": - if v != nil { - var source Source - err = json.Unmarshal(*v, &source) - if err != nil { - return err - } - lsr.Source = &source - } - case "schedule": - if v != nil { - var schedule Schedule - err = json.Unmarshal(*v, &schedule) - if err != nil { - return err - } - lsr.Schedule = &schedule - } - case "action": - if v != nil { - action, err := unmarshalBasicAction(*v) - if err != nil { - return err - } - lsr.Action = action - } - } - } - - return nil -} - -// LogSearchRulePatch log Search Rule Definition for Patching -type LogSearchRulePatch struct { - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' - Enabled Enabled `json:"enabled,omitempty"` -} - -// LogSearchRuleResource the Log Search Rule resource. -type LogSearchRuleResource struct { - autorest.Response `json:"-"` - // LogSearchRule - The rule properties of the resource. - *LogSearchRule `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 LogSearchRuleResource. -func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrr.LogSearchRule != nil { - objectMap["properties"] = lsrr.LogSearchRule - } - if lsrr.Location != nil { - objectMap["location"] = lsrr.Location - } - if lsrr.Tags != nil { - objectMap["tags"] = lsrr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. -func (lsrr *LogSearchRuleResource) 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 logSearchRule LogSearchRule - err = json.Unmarshal(*v, &logSearchRule) - if err != nil { - return err - } - lsrr.LogSearchRule = &logSearchRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lsrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lsrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lsrr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lsrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lsrr.Tags = tags - } - } - } - - return nil -} - -// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. -type LogSearchRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the Log Search Rule resources. - Value *[]LogSearchRuleResource `json:"value,omitempty"` -} - -// LogSearchRuleResourcePatch the log search rule resource for patch operations. -type LogSearchRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogSearchRulePatch - The log search rule properties of the resource. - *LogSearchRulePatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. -func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrrp.Tags != nil { - objectMap["tags"] = lsrrp.Tags - } - if lsrrp.LogSearchRulePatch != nil { - objectMap["properties"] = lsrrp.LogSearchRulePatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. -func (lsrrp *LogSearchRuleResourcePatch) 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 - } - lsrrp.Tags = tags - } - case "properties": - if v != nil { - var logSearchRulePatch LogSearchRulePatch - err = json.Unmarshal(*v, &logSearchRulePatch) - if err != nil { - return err - } - lsrrp.LogSearchRulePatch = &logSearchRulePatch - } - } - } - - return nil -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogToMetricAction specify action need to be taken when rule type is converting log to metric -type LogToMetricAction struct { - // Criteria - Criteria of Metric - Criteria *[]Criteria `json:"criteria,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogToMetricAction. -func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { - ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction - objectMap := make(map[string]interface{}) - if ltma.Criteria != nil { - objectMap["criteria"] = ltma.Criteria - } - if ltma.OdataType != "" { - objectMap["odata.type"] = ltma.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return <ma, true -} - -// AsAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { - return <ma, true -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) 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 "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// MetricAlertAction an alert action. -type MetricAlertAction struct { - // ActionGroupID - the id of the action group to use. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. - WebHookProperties map[string]*string `json:"webHookProperties"` -} - -// MarshalJSON is the custom marshaler for MetricAlertAction. -func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if maa.ActionGroupID != nil { - objectMap["actionGroupId"] = maa.ActionGroupID - } - if maa.WebHookProperties != nil { - objectMap["webHookProperties"] = maa.WebHookProperties - } - return json.Marshal(objectMap) -} - -// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type BasicMetricAlertCriteria interface { - AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) - AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) - AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) - AsMetricAlertCriteria() (*MetricAlertCriteria, bool) -} - -// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - var masrmmc MetricAlertSingleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &masrmmc) - return masrmmc, err - case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - var wlac WebtestLocationAvailabilityCriteria - err := json.Unmarshal(body, &wlac) - return wlac, err - case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &mamrmmc) - return mamrmmc, err - default: - var mac MetricAlertCriteria - err := json.Unmarshal(body, &mac) - return mac, err - } -} -func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) - if err != nil { - return nil, err - } - macArray[index] = mac - } - return macArray, nil -} - -// MarshalJSON is the custom marshaler for MetricAlertCriteria. -func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { - mac.OdataType = OdataTypeMetricAlertCriteria - objectMap := make(map[string]interface{}) - if mac.OdataType != "" { - objectMap["odata.type"] = mac.OdataType - } - for k, v := range mac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return &mac, true -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mac, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. -func (mac *MetricAlertCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mac.AdditionalProperties == nil { - mac.AdditionalProperties = make(map[string]interface{}) - } - mac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mac.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple -// resource that has multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // AllOf - the list of multiple metric criteria for this 'all of' operation. - AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - mamrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if mamrmmc.AllOf != nil { - objectMap["allOf"] = mamrmmc.AllOf - } - if mamrmmc.OdataType != "" { - objectMap["odata.type"] = mamrmmc.OdataType - } - for k, v := range mamrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return &mamrmmc, true -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mamrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. -func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) - if err != nil { - return err - } - mamrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mamrmmc.AdditionalProperties == nil { - mamrmmc.AdditionalProperties = make(map[string]interface{}) - } - mamrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mamrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertProperties an alert rule. -type MetricAlertProperties struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertProperties. -func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapVar.Description != nil { - objectMap["description"] = mapVar.Description - } - if mapVar.Severity != nil { - objectMap["severity"] = mapVar.Severity - } - if mapVar.Enabled != nil { - objectMap["enabled"] = mapVar.Enabled - } - if mapVar.Scopes != nil { - objectMap["scopes"] = mapVar.Scopes - } - if mapVar.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency - } - if mapVar.WindowSize != nil { - objectMap["windowSize"] = mapVar.WindowSize - } - if mapVar.TargetResourceType != nil { - objectMap["targetResourceType"] = mapVar.TargetResourceType - } - if mapVar.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion - } - objectMap["criteria"] = mapVar.Criteria - if mapVar.AutoMitigate != nil { - objectMap["autoMitigate"] = mapVar.AutoMitigate - } - if mapVar.Actions != nil { - objectMap["actions"] = mapVar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. -func (mapVar *MetricAlertProperties) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapVar.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapVar.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapVar.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapVar.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapVar.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapVar.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapVar.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapVar.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapVar.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapVar.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapVar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapVar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// MetricAlertPropertiesPatch an alert rule properties for patch. -type MetricAlertPropertiesPatch struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. -func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapp.Description != nil { - objectMap["description"] = mapp.Description - } - if mapp.Severity != nil { - objectMap["severity"] = mapp.Severity - } - if mapp.Enabled != nil { - objectMap["enabled"] = mapp.Enabled - } - if mapp.Scopes != nil { - objectMap["scopes"] = mapp.Scopes - } - if mapp.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapp.EvaluationFrequency - } - if mapp.WindowSize != nil { - objectMap["windowSize"] = mapp.WindowSize - } - if mapp.TargetResourceType != nil { - objectMap["targetResourceType"] = mapp.TargetResourceType - } - if mapp.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapp.TargetResourceRegion - } - objectMap["criteria"] = mapp.Criteria - if mapp.AutoMitigate != nil { - objectMap["autoMitigate"] = mapp.AutoMitigate - } - if mapp.Actions != nil { - objectMap["actions"] = mapp.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. -func (mapp *MetricAlertPropertiesPatch) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapp.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapp.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapp.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapp.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapp.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapp.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapp.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapp.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapp.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapp.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapp.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapp.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// MetricAlertResource the metric alert resource. -type MetricAlertResource struct { - autorest.Response `json:"-"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `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 MetricAlertResource. -func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mar.MetricAlertProperties != nil { - objectMap["properties"] = mar.MetricAlertProperties - } - if mar.Location != nil { - objectMap["location"] = mar.Location - } - if mar.Tags != nil { - objectMap["tags"] = mar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. -func (mar *MetricAlertResource) 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 metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - mar.MetricAlertProperties = &metricAlertProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mar.Tags = tags - } - } - } - - return nil -} - -// MetricAlertResourceCollection represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertResource `json:"value,omitempty"` -} - -// MetricAlertResourcePatch the metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // MetricAlertPropertiesPatch - The alert rule properties of the resource. - *MetricAlertPropertiesPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. -func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if marp.Tags != nil { - objectMap["tags"] = marp.Tags - } - if marp.MetricAlertPropertiesPatch != nil { - objectMap["properties"] = marp.MetricAlertPropertiesPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. -func (marp *MetricAlertResourcePatch) 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 - } - marp.Tags = tags - } - case "properties": - if v != nil { - var metricAlertPropertiesPatch MetricAlertPropertiesPatch - err = json.Unmarshal(*v, &metricAlertPropertiesPatch) - if err != nil { - return err - } - marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch - } - } - } - - return nil -} - -// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single -// resource that has multiple metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // AllOf - The list of metric criteria for this 'all of' operation. - AllOf *[]MetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if masrmmc.AllOf != nil { - objectMap["allOf"] = masrmmc.AllOf - } - if masrmmc.OdataType != "" { - objectMap["odata.type"] = masrmmc.OdataType - } - for k, v := range masrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return &masrmmc, true -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &masrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. -func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - var allOf []MetricCriteria - err = json.Unmarshal(*v, &allOf) - if err != nil { - return err - } - masrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if masrmmc.AdditionalProperties == nil { - masrmmc.AdditionalProperties = make(map[string]interface{}) - } - masrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - masrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertStatus an alert status. -type MetricAlertStatus struct { - // Name - The status name. - Name *string `json:"name,omitempty"` - // ID - The alert rule arm id. - ID *string `json:"id,omitempty"` - // Type - The extended resource type name. - Type *string `json:"type,omitempty"` - // Properties - The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties `json:"properties,omitempty"` -} - -// MetricAlertStatusCollection represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertStatus `json:"value,omitempty"` -} - -// MetricAlertStatusProperties an alert status properties. -type MetricAlertStatusProperties struct { - // Dimensions - An object describing the type of the dimensions. - Dimensions map[string]*string `json:"dimensions"` - // Status - status value - Status *string `json:"status,omitempty"` - // Timestamp - UTC time when the status was checked. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. -func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if masp.Dimensions != nil { - objectMap["dimensions"] = masp.Dimensions - } - if masp.Status != nil { - objectMap["status"] = masp.Status - } - if masp.Timestamp != nil { - objectMap["timestamp"] = masp.Timestamp - } - return json.Marshal(objectMap) -} - -// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and -// the retention period for that time grain. -type MetricAvailability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// MetricBaselinesProperties the response to a metric baselines query. -type MetricBaselinesProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried. - Namespace *string `json:"namespace,omitempty"` - // Baselines - The baseline for each time series that was queried. - Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` -} - -// MetricBaselinesResponse a list of metric baselines. -type MetricBaselinesResponse struct { - autorest.Response `json:"-"` - // Value - The list of metric baselines. - Value *[]SingleMetricBaseline `json:"value,omitempty"` -} - -// MetricCriteria criterion to filter metrics. -type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' - Operator Operator `json:"operator,omitempty"` - // Threshold - the criteria threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricCriteria. -func (mc MetricCriteria) MarshalJSON() ([]byte, error) { - mc.CriterionType = CriterionTypeStaticThresholdCriterion - objectMap := make(map[string]interface{}) - if mc.Operator != "" { - objectMap["operator"] = mc.Operator - } - if mc.Threshold != nil { - objectMap["threshold"] = mc.Threshold - } - if mc.Name != nil { - objectMap["name"] = mc.Name - } - if mc.MetricName != nil { - objectMap["metricName"] = mc.MetricName - } - if mc.MetricNamespace != nil { - objectMap["metricNamespace"] = mc.MetricNamespace - } - if mc.TimeAggregation != nil { - objectMap["timeAggregation"] = mc.TimeAggregation - } - if mc.Dimensions != nil { - objectMap["dimensions"] = mc.Dimensions - } - if mc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mc.SkipMetricValidation - } - if mc.CriterionType != "" { - objectMap["criterionType"] = mc.CriterionType - } - for k, v := range mc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return &mc, true -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. -func (mc *MetricCriteria) 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 "operator": - if v != nil { - var operator Operator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - mc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - mc.Threshold = &threshold - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mc.AdditionalProperties == nil { - mc.AdditionalProperties = make(map[string]interface{}) - } - mc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mc.CriterionType = criterionType - } - } - } - - return nil -} - -// MetricDefinition metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// MetricDefinitionCollection represents collection of metric definitions. -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricDimension specifies a metric dimension. -type MetricDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string `json:"operator,omitempty"` - // Values - list of dimension values. - Values *[]string `json:"values,omitempty"` -} - -// MetricNamespace metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // ID - The ID of the metricNamespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The name of the namespace. - Name *string `json:"name,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName `json:"properties,omitempty"` -} - -// MetricNamespaceCollection represents collection of metric namespaces. -type MetricNamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]MetricNamespace `json:"value,omitempty"` -} - -// MetricNamespaceName the fully qualified metric namespace name. -type MetricNamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricSingleDimension the metric dimension name and value. -type MetricSingleDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Value - Value of the dimension. - Value *string `json:"value,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` -} - -// MetricValue represents a metric value. -type MetricValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *float64 `json:"count,omitempty"` -} - -// BasicMultiMetricCriteria the types of conditions for a multi resource alert. -type BasicMultiMetricCriteria interface { - AsMetricCriteria() (*MetricCriteria, bool) - AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) - AsMultiMetricCriteria() (*MultiMetricCriteria, bool) -} - -// MultiMetricCriteria the types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["criterionType"] { - case string(CriterionTypeStaticThresholdCriterion): - var mc MetricCriteria - err := json.Unmarshal(body, &mc) - return mc, err - case string(CriterionTypeDynamicThresholdCriterion): - var dmc DynamicMetricCriteria - err := json.Unmarshal(body, &dmc) - return dmc, err - default: - var mmc MultiMetricCriteria - err := json.Unmarshal(body, &mmc) - return mmc, err - } -} -func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) - if err != nil { - return nil, err - } - mmcArray[index] = mmc - } - return mmcArray, nil -} - -// MarshalJSON is the custom marshaler for MultiMetricCriteria. -func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { - mmc.CriterionType = CriterionTypeMultiMetricCriteria - objectMap := make(map[string]interface{}) - if mmc.Name != nil { - objectMap["name"] = mmc.Name - } - if mmc.MetricName != nil { - objectMap["metricName"] = mmc.MetricName - } - if mmc.MetricNamespace != nil { - objectMap["metricNamespace"] = mmc.MetricNamespace - } - if mmc.TimeAggregation != nil { - objectMap["timeAggregation"] = mmc.TimeAggregation - } - if mmc.Dimensions != nil { - objectMap["dimensions"] = mmc.Dimensions - } - if mmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mmc.SkipMetricValidation - } - if mmc.CriterionType != "" { - objectMap["criterionType"] = mmc.CriterionType - } - for k, v := range mmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return &mmc, true -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. -func (mmc *MultiMetricCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mmc.AdditionalProperties == nil { - mmc.AdditionalProperties = make(map[string]interface{}) - } - mmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation interface{} - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mmc.CriterionType = criterionType - } - } - } - - return nil -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Insights 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 operations supported by the Microsoft.Insights 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"` -} - -// OperationStatus the status of operation. -type OperationStatus struct { - autorest.Response `json:"-"` - // ID - The operation Id. - ID *string `json:"id,omitempty"` - // Name - The operation name. - Name *string `json:"name,omitempty"` - // StartTime - Start time of the job in standard ISO8601 format. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - End time of the job in standard ISO8601 format. - EndTime *date.Time `json:"endTime,omitempty"` - // Status - The status of the operation. - Status *string `json:"status,omitempty"` - // Error - The error detail of the operation if any. - Error *ErrorResponseCommon `json:"error,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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"` -} - -// 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. -func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) - if err != nil { - return err - } - page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,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) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `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"` -} - -// 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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkScopedResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateLinkScopedResourcesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopedResourcesClient) (ScopedResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) 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 PrivateLinkScopedResourcesCreateOrUpdateFuture.Result. -func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) result(client PrivateLinkScopedResourcesClient) (sr ScopedResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkScopedResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateLinkScopedResourcesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopedResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopedResourcesDeleteFuture) 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 PrivateLinkScopedResourcesDeleteFuture.Result. -func (future *PrivateLinkScopedResourcesDeleteFuture) result(client PrivateLinkScopedResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkScopesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PrivateLinkScopesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopesDeleteFuture) 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 PrivateLinkScopesDeleteFuture.Result. -func (future *PrivateLinkScopesDeleteFuture) result(client PrivateLinkScopesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkScopesResource an azure resource object -type PrivateLinkScopesResource 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 PrivateLinkScopesResource. -func (plsr PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plsr.Location != nil { - objectMap["location"] = plsr.Location - } - if plsr.Tags != nil { - objectMap["tags"] = plsr.Tags - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionStateProperty state of the private endpoint connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProxyOnlyResource a proxy only azure resource object -type ProxyOnlyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyOnlyResource. -func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProxyResource an azure resource object -type ProxyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource an azure resource object -type Resource 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,omitempty"` -} - -// ResponseWithError an error response from the API. -type ResponseWithError struct { - // Error - Error information. - Error *Error `json:"error,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) 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 "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. - Maximum *string `json:"maximum,omitempty"` - // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// Schedule defines how often to run the search and the time interval. -type Schedule struct { - // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. - FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` - // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` -} - -// ScopedResource a private link scoped resource -type ScopedResource struct { - autorest.Response `json:"-"` - // ScopedResourceProperties - Resource properties. - *ScopedResourceProperties `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"` -} - -// MarshalJSON is the custom marshaler for ScopedResource. -func (sr ScopedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.ScopedResourceProperties != nil { - objectMap["properties"] = sr.ScopedResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopedResource struct. -func (sr *ScopedResource) 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 scopedResourceProperties ScopedResourceProperties - err = json.Unmarshal(*v, &scopedResourceProperties) - if err != nil { - return err - } - sr.ScopedResourceProperties = &scopedResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - } - } - - return nil -} - -// ScopedResourceListResult a list of scoped resources in a private link scope. -type ScopedResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ScopedResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopedResourceListResult. -func (srlr ScopedResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ScopedResourceListResultIterator provides access to a complete listing of ScopedResource values. -type ScopedResourceListResultIterator struct { - i int - page ScopedResourceListResultPage -} - -// 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 *ScopedResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultIterator.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 *ScopedResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScopedResourceListResultIterator) 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 ScopedResourceListResultIterator) Response() ScopedResourceListResult { - 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 ScopedResourceListResultIterator) Value() ScopedResource { - if !iter.page.NotDone() { - return ScopedResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScopedResourceListResultIterator type. -func NewScopedResourceListResultIterator(page ScopedResourceListResultPage) ScopedResourceListResultIterator { - return ScopedResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (srlr ScopedResourceListResult) IsEmpty() bool { - return srlr.Value == nil || len(*srlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (srlr ScopedResourceListResult) hasNextLink() bool { - return srlr.NextLink != nil && len(*srlr.NextLink) != 0 -} - -// scopedResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (srlr ScopedResourceListResult) scopedResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !srlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(srlr.NextLink))) -} - -// ScopedResourceListResultPage contains a page of ScopedResource values. -type ScopedResourceListResultPage struct { - fn func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error) - srlr ScopedResourceListResult -} - -// 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 *ScopedResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultPage.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.srlr) - if err != nil { - return err - } - page.srlr = 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 *ScopedResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScopedResourceListResultPage) NotDone() bool { - return !page.srlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScopedResourceListResultPage) Response() ScopedResourceListResult { - return page.srlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScopedResourceListResultPage) Values() []ScopedResource { - if page.srlr.IsEmpty() { - return nil - } - return *page.srlr.Value -} - -// Creates a new instance of the ScopedResourceListResultPage type. -func NewScopedResourceListResultPage(cur ScopedResourceListResult, getNextPage func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)) ScopedResourceListResultPage { - return ScopedResourceListResultPage{ - fn: getNextPage, - srlr: cur, - } -} - -// ScopedResourceProperties properties of a private link scoped resource. -type ScopedResourceProperties struct { - // LinkedResourceID - The resource id of the scoped Azure monitor resource. - LinkedResourceID *string `json:"linkedResourceId,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopedResourceProperties. -func (srp ScopedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srp.LinkedResourceID != nil { - objectMap["linkedResourceId"] = srp.LinkedResourceID - } - return json.Marshal(objectMap) -} - -// SenderAuthorization the authorization used by the user who has performed the operation that led to this -// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and -// the 'scope' -type SenderAuthorization struct { - // Action - the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string `json:"action,omitempty"` - // Role - the role of the user. For instance: Subscription Admin - Role *string `json:"role,omitempty"` - // Scope - the scope. - Scope *string `json:"scope,omitempty"` -} - -// SingleBaseline the baseline values for a single sensitivity value. -type SingleBaseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' - Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// SingleMetricBaseline the baseline results of a single metric. -type SingleMetricBaseline struct { - // ID - The metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - The resource type of the metric baseline resource. - Type *string `json:"type,omitempty"` - // Name - The name of the metric for which the baselines were retrieved. - Name *string `json:"name,omitempty"` - // MetricBaselinesProperties - The metric baseline properties of the metric. - *MetricBaselinesProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingleMetricBaseline. -func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smb.ID != nil { - objectMap["id"] = smb.ID - } - if smb.Type != nil { - objectMap["type"] = smb.Type - } - if smb.Name != nil { - objectMap["name"] = smb.Name - } - if smb.MetricBaselinesProperties != nil { - objectMap["properties"] = smb.MetricBaselinesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. -func (smb *SingleMetricBaseline) 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 - } - smb.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - smb.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - smb.Name = &name - } - case "properties": - if v != nil { - var metricBaselinesProperties MetricBaselinesProperties - err = json.Unmarshal(*v, &metricBaselinesProperties) - if err != nil { - return err - } - smb.MetricBaselinesProperties = &metricBaselinesProperties - } - } - } - - return nil -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// Source specifies the log search query. -type Source struct { - // Query - Log search query. Required for action type - AlertingAction - Query *string `json:"query,omitempty"` - // AuthorizedResources - List of Resource referred into query - AuthorizedResources *[]string `json:"authorizedResources,omitempty"` - // DataSourceID - The resource uri over which log search query is to be run. - DataSourceID *string `json:"dataSourceId,omitempty"` - // QueryType - Set value to 'ResultCount'. Possible values include: 'ResultCount' - QueryType QueryType `json:"queryType,omitempty"` -} - -// SubscriptionDiagnosticSettings the subscription diagnostic settings. -type SubscriptionDiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Logs - The list of logs settings. - Logs *[]SubscriptionLogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` -} - -// SubscriptionDiagnosticSettingsResource the subscription diagnostic setting resource. -type SubscriptionDiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // SubscriptionDiagnosticSettings - Properties of a Subscription Diagnostic Settings Resource. - *SubscriptionDiagnosticSettings `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 - Location of the resource - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionDiagnosticSettingsResource. -func (sdsr SubscriptionDiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdsr.SubscriptionDiagnosticSettings != nil { - objectMap["properties"] = sdsr.SubscriptionDiagnosticSettings - } - if sdsr.Location != nil { - objectMap["location"] = sdsr.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionDiagnosticSettingsResource struct. -func (sdsr *SubscriptionDiagnosticSettingsResource) 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 subscriptionDiagnosticSettings SubscriptionDiagnosticSettings - err = json.Unmarshal(*v, &subscriptionDiagnosticSettings) - if err != nil { - return err - } - sdsr.SubscriptionDiagnosticSettings = &subscriptionDiagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdsr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sdsr.Location = &location - } - } - } - - return nil -} - -// SubscriptionDiagnosticSettingsResourceCollection represents a collection of subscription diagnostic -// settings resources. -type SubscriptionDiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of subscription diagnostic settings resources. - Value *[]SubscriptionDiagnosticSettingsResource `json:"value,omitempty"` -} - -// SubscriptionLogSettings part of Subscription diagnostic setting. Specifies the settings for a particular -// log. -type SubscriptionLogSettings struct { - // Category - Name of a Subscription Diagnostic Log category for a resource type this setting is applied to. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// SubscriptionProxyOnlyResource a proxy only azure resource object -type SubscriptionProxyOnlyResource 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 - Location of the resource - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionProxyOnlyResource. -func (spor SubscriptionProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spor.Location != nil { - objectMap["location"] = spor.Location - } - return json.Marshal(objectMap) -} - -// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a -// PrivateLinkScope 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) -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) 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 "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// TimeSeriesBaseline the baseline values for a single time series. -type TimeSeriesBaseline struct { - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Dimensions - The dimensions of this time series. - Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` - // Timestamps - The list of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Data - The baseline values for each sensitivity. - Data *[]SingleBaseline `json:"data,omitempty"` - // Metadata - The baseline metadata values. - Metadata *[]BaselineMetadata `json:"metadata,omitempty"` -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]MetricValue `json:"data,omitempty"` -} - -// TimeSeriesInformation the time series info needed for calculating the baseline. -type TimeSeriesInformation struct { - // Sensitivities - the list of sensitivities for calculating the baseline. - Sensitivities *[]string `json:"sensitivities,omitempty"` - // Values - The metric values to calculate the baseline. - Values *[]float64 `json:"values,omitempty"` - // Timestamps - the array of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,omitempty"` -} - -// TriggerCondition the condition that results in the Log Search rule. -type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - Result or count threshold based on which rule should be triggered. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTrigger - Trigger condition for metric query rule - MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` -} - -// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. -type VMInsightsOnboardingStatus struct { - autorest.Response `json:"-"` - // VMInsightsOnboardingStatusProperties - Resource properties. - *VMInsightsOnboardingStatusProperties `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"` -} - -// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. -func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vios.VMInsightsOnboardingStatusProperties != nil { - objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. -func (vios *VMInsightsOnboardingStatus) 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 VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties - err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) - if err != nil { - return err - } - vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vios.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vios.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vios.Type = &typeVar - } - } - } - - return nil -} - -// VMInsightsOnboardingStatusProperties resource properties. -type VMInsightsOnboardingStatusProperties struct { - // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. - ResourceID *string `json:"resourceId,omitempty"` - // OnboardingStatus - The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: 'Onboarded', 'NotOnboarded', 'Unknown' - OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` - // DataStatus - The status of VM Insights data from the resource. When reported as `present` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: 'Present', 'NotPresent' - DataStatus DataStatus `json:"dataStatus,omitempty"` - // Data - Containers that currently store VM Insights data for the specified resource. - Data *[]DataContainer `json:"data,omitempty"` -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // UseAadAuth - Indicates whether or not use AAD authentication. - UseAadAuth *bool `json:"useAadAuth,omitempty"` - // ObjectID - Indicates the webhook app object Id for aad auth. - ObjectID *string `json:"objectId,omitempty"` - // IdentifierURI - Indicates the identifier uri for aad auth. - IdentifierURI *string `json:"identifierUri,omitempty"` - // TenantID - Indicates the tenant id for aad auth. - TenantID *string `json:"tenantId,omitempty"` -} - -// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // WebTestID - The Application Insights web test Id. - WebTestID *string `json:"webTestId,omitempty"` - // ComponentID - The Application Insights resource Id. - ComponentID *string `json:"componentId,omitempty"` - // FailedLocationCount - The number of failed locations. - FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - objectMap := make(map[string]interface{}) - if wlac.WebTestID != nil { - objectMap["webTestId"] = wlac.WebTestID - } - if wlac.ComponentID != nil { - objectMap["componentId"] = wlac.ComponentID - } - if wlac.FailedLocationCount != nil { - objectMap["failedLocationCount"] = wlac.FailedLocationCount - } - if wlac.OdataType != "" { - objectMap["odata.type"] = wlac.OdataType - } - for k, v := range wlac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return &wlac, true -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &wlac, true -} - -// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. -func (wlac *WebtestLocationAvailabilityCriteria) 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 "webTestId": - if v != nil { - var webTestID string - err = json.Unmarshal(*v, &webTestID) - if err != nil { - return err - } - wlac.WebTestID = &webTestID - } - case "componentId": - if v != nil { - var componentID string - err = json.Unmarshal(*v, &componentID) - if err != nil { - return err - } - wlac.ComponentID = &componentID - } - case "failedLocationCount": - if v != nil { - var failedLocationCount float64 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - wlac.FailedLocationCount = &failedLocationCount - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if wlac.AdditionalProperties == nil { - wlac.AdditionalProperties = make(map[string]interface{}) - } - wlac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - wlac.OdataType = odataType - } - } - } - - return nil -} - -// WorkspaceInfo information about a Log Analytics Workspace. -type WorkspaceInfo struct { - // ID - Azure Resource Manager identifier of the Log Analytics Workspace. - ID *string `json:"id,omitempty"` - // Location - Location of the Log Analytics workspace. - Location *string `json:"location,omitempty"` - // WorkspaceInfoProperties - Resource properties. - *WorkspaceInfoProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceInfo. -func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wi.ID != nil { - objectMap["id"] = wi.ID - } - if wi.Location != nil { - objectMap["location"] = wi.Location - } - if wi.WorkspaceInfoProperties != nil { - objectMap["properties"] = wi.WorkspaceInfoProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. -func (wi *WorkspaceInfo) 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 - } - wi.ID = &ID - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wi.Location = &location - } - case "properties": - if v != nil { - var workspaceInfoProperties WorkspaceInfoProperties - err = json.Unmarshal(*v, &workspaceInfoProperties) - if err != nil { - return err - } - wi.WorkspaceInfoProperties = &workspaceInfoProperties - } - } - } - - return nil -} - -// WorkspaceInfoProperties resource properties. -type WorkspaceInfoProperties struct { - // CustomerID - Log Analytics workspace identifier. - CustomerID *string `json:"customerId,omitempty"` -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/operations.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/operations.go deleted file mode 100644 index 3f82351c7f23..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -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 monitor 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 operations from Microsoft.Insights provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-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 -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privateendpointconnections.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privateendpointconnections.go deleted file mode 100644 index 0d69382e47aa..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privateendpointconnections.go +++ /dev/null @@ -1,423 +0,0 @@ -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" -) - -// PrivateEndpointConnectionsClient is the monitor Management Client -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Status", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Description", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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}}}}); err != nil { - return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "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.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByPrivateLinkScope gets all private endpoint connections on a private link scope. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByPrivateLinkScope") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.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.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", err.Error()) - } - - result.fn = client.listByPrivateLinkScopeNextResults - req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByPrivateLinkScope") - 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) - return -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkresources.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkresources.go deleted file mode 100644 index 649f2b047a6a..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkresources.go +++ /dev/null @@ -1,241 +0,0 @@ -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" -) - -// PrivateLinkResourcesClient is the monitor Management Client -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "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.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByPrivateLinkScope gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByPrivateLinkScope") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.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.PrivateLinkResourcesClient", "ListByPrivateLinkScope", err.Error()) - } - - result.fn = client.listByPrivateLinkScopeNextResults - req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByPrivateLinkScope") - 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) - return -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopedresources.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopedresources.go deleted file mode 100644 index b1b205008123..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopedresources.go +++ /dev/null @@ -1,416 +0,0 @@ -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" -) - -// PrivateLinkScopedResourcesClient is the monitor Management Client -type PrivateLinkScopedResourcesClient struct { - BaseClient -} - -// NewPrivateLinkScopedResourcesClient creates an instance of the PrivateLinkScopedResourcesClient client. -func NewPrivateLinkScopedResourcesClient(subscriptionID string) PrivateLinkScopedResourcesClient { - return NewPrivateLinkScopedResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkScopedResourcesClientWithBaseURI creates an instance of the PrivateLinkScopedResourcesClient 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 NewPrivateLinkScopedResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopedResourcesClient { - return PrivateLinkScopedResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// name - the name of the scoped resource object. -func (client PrivateLinkScopedResourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource) (result PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateLinkScopedResourcesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/scopedResources/{name}", 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 PrivateLinkScopedResourcesClient) CreateOrUpdateSender(req *http.Request) (future PrivateLinkScopedResourcesCreateOrUpdateFuture, 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 PrivateLinkScopedResourcesClient) CreateOrUpdateResponder(resp *http.Response) (result ScopedResource, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// name - the name of the scoped resource object. -func (client PrivateLinkScopedResourcesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result PrivateLinkScopedResourcesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateLinkScopedResourcesClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/scopedResources/{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 PrivateLinkScopedResourcesClient) DeleteSender(req *http.Request) (future PrivateLinkScopedResourcesDeleteFuture, 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 PrivateLinkScopedResourcesClient) 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 a scoped resource in a private link scope. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// name - the name of the scoped resource object. -func (client PrivateLinkScopedResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result ScopedResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopedResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "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.PrivateLinkScopedResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkScopedResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/scopedResources/{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 PrivateLinkScopedResourcesClient) 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 PrivateLinkScopedResourcesClient) GetResponder(resp *http.Response) (result ScopedResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByPrivateLinkScope gets all private endpoint connections on a private link scope. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result ScopedResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.ListByPrivateLinkScope") - defer func() { - sc := -1 - if result.srlr.Response.Response != nil { - sc = result.srlr.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.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", err.Error()) - } - - result.fn = client.listByPrivateLinkScopeNextResults - req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.srlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") - return - } - - result.srlr, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - if result.srlr.hasNextLink() && result.srlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/scopedResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result ScopedResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. -func (client PrivateLinkScopedResourcesClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults ScopedResourceListResult) (result ScopedResourceListResult, err error) { - req, err := lastResults.scopedResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result ScopedResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.ListByPrivateLinkScope") - 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) - return -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopeoperationstatus.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopeoperationstatus.go deleted file mode 100644 index 9e483edc658d..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopeoperationstatus.go +++ /dev/null @@ -1,115 +0,0 @@ -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" -) - -// PrivateLinkScopeOperationStatusClient is the monitor Management Client -type PrivateLinkScopeOperationStatusClient struct { - BaseClient -} - -// NewPrivateLinkScopeOperationStatusClient creates an instance of the PrivateLinkScopeOperationStatusClient client. -func NewPrivateLinkScopeOperationStatusClient(subscriptionID string) PrivateLinkScopeOperationStatusClient { - return NewPrivateLinkScopeOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkScopeOperationStatusClientWithBaseURI creates an instance of the PrivateLinkScopeOperationStatusClient -// 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 NewPrivateLinkScopeOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopeOperationStatusClient { - return PrivateLinkScopeOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the status of an azure asynchronous operation associated with a private link scope operation. -// Parameters: -// asyncOperationID - the operation Id. -// resourceGroupName - the name of the resource group. -func (client PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result OperationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopeOperationStatusClient.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}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopeOperationStatusClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, asyncOperationID, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "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.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkScopeOperationStatusClient) GetPreparer(ctx context.Context, asyncOperationID string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "asyncOperationId": autorest.Encode("path", asyncOperationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopeOperationStatuses/{asyncOperationId}", 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 PrivateLinkScopeOperationStatusClient) 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 PrivateLinkScopeOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatus, 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/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopes.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopes.go deleted file mode 100644 index 6d9c83285c08..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/privatelinkscopes.go +++ /dev/null @@ -1,614 +0,0 @@ -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" -) - -// PrivateLinkScopesClient is the monitor Management Client -type PrivateLinkScopesClient struct { - BaseClient -} - -// NewPrivateLinkScopesClient creates an instance of the PrivateLinkScopesClient client. -func NewPrivateLinkScopesClient(subscriptionID string) PrivateLinkScopesClient { - return NewPrivateLinkScopesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkScopesClientWithBaseURI creates an instance of the PrivateLinkScopesClient 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 NewPrivateLinkScopesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopesClient { - return PrivateLinkScopesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for -// InstrumentationKey nor AppId in the Put operation. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// azureMonitorPrivateLinkScopePayload - properties that need to be specified to create or update a Azure -// Monitor PrivateLinkScope. -func (client PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope) (result AzureMonitorPrivateLinkScope, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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: azureMonitorPrivateLinkScopePayload, - Constraints: []validation.Constraint{{Target: "azureMonitorPrivateLinkScopePayload.AzureMonitorPrivateLinkScopeProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateLinkScopesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}", pathParameters), - autorest.WithJSON(azureMonitorPrivateLinkScopePayload), - 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) CreateOrUpdateResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, 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 a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkScopesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkScopesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateLinkScopesClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}", 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 PrivateLinkScopesClient) DeleteSender(req *http.Request) (future PrivateLinkScopesDeleteFuture, 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 PrivateLinkScopesClient) 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 returns a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string) (result AzureMonitorPrivateLinkScope, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkScopesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) GetResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, 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 Azure Monitor PrivateLinkScopes within a subscription. -func (client PrivateLinkScopesClient) List(ctx context.Context) (result AzureMonitorPrivateLinkScopeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.List") - defer func() { - sc := -1 - if result.amplslr.Response.Response != nil { - sc = result.amplslr.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.PrivateLinkScopesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.amplslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", resp, "Failure sending request") - return - } - - result.amplslr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", resp, "Failure responding to request") - return - } - if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkScopesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) ListResponder(resp *http.Response) (result AzureMonitorPrivateLinkScopeListResult, 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 PrivateLinkScopesClient) listNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { - req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkScopesClient) ListComplete(ctx context.Context) (result AzureMonitorPrivateLinkScopeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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 Azure Monitor PrivateLinkScopes within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client PrivateLinkScopesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AzureMonitorPrivateLinkScopeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.amplslr.Response.Response != nil { - sc = result.amplslr.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.PrivateLinkScopesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.amplslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.amplslr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PrivateLinkScopesClient) 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 = "2019-10-17-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/privateLinkScopes", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) ListByResourceGroupResponder(resp *http.Response) (result AzureMonitorPrivateLinkScopeListResult, 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 PrivateLinkScopesClient) listByResourceGroupNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { - req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkScopesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AzureMonitorPrivateLinkScopeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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 updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateLinkScopeTags - updated tag information to set into the PrivateLinkScope instance. -func (client PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource) (result AzureMonitorPrivateLinkScope, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, scopeName, privateLinkScopeTags) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "UpdateTags", resp, "Failure sending request") - return - } - - result, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "UpdateTags", resp, "Failure responding to request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client PrivateLinkScopesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}", pathParameters), - autorest.WithJSON(privateLinkScopeTags), - 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) UpdateTagsResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, 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/monitor/mgmt/2019-11-01-preview/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/scheduledqueryrules.go deleted file mode 100644 index c6dab9c1e3c8..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/scheduledqueryrules.go +++ /dev/null @@ -1,543 +0,0 @@ -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" -) - -// ScheduledQueryRulesClient is the monitor Management Client -type ScheduledQueryRulesClient struct { - BaseClient -} - -// NewScheduledQueryRulesClient creates an instance of the ScheduledQueryRulesClient client. -func NewScheduledQueryRulesClient(subscriptionID string) ScheduledQueryRulesClient { - return NewScheduledQueryRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduledQueryRulesClientWithBaseURI creates an instance of the ScheduledQueryRulesClient 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 NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID string) ScheduledQueryRulesClient { - return ScheduledQueryRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an log search rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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 a Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) 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 Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) GetResponder(resp *http.Response) (result LogSearchRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the Log Search rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the Log Search rules within a subscription group. -// Parameters: -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListBySubscription") - 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}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update log search Rule. -// Parameters: -// resourceGroupName - the name of the resource group. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) UpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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/monitor/mgmt/2019-11-01-preview/insights/subscriptiondiagnosticsettings.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/subscriptiondiagnosticsettings.go deleted file mode 100644 index e17e7f6c302d..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/subscriptiondiagnosticsettings.go +++ /dev/null @@ -1,352 +0,0 @@ -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" -) - -// SubscriptionDiagnosticSettingsClient is the monitor Management Client -type SubscriptionDiagnosticSettingsClient struct { - BaseClient -} - -// NewSubscriptionDiagnosticSettingsClient creates an instance of the SubscriptionDiagnosticSettingsClient client. -func NewSubscriptionDiagnosticSettingsClient(subscriptionID string) SubscriptionDiagnosticSettingsClient { - return NewSubscriptionDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionDiagnosticSettingsClientWithBaseURI creates an instance of the SubscriptionDiagnosticSettingsClient -// 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 NewSubscriptionDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionDiagnosticSettingsClient { - return SubscriptionDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates subscription diagnostic settings for the specified resource. -// Parameters: -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client SubscriptionDiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, parameters SubscriptionDiagnosticSettingsResource, name string) (result SubscriptionDiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.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}}}}); err != nil { - return result, validation.NewError("insights.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.SubscriptionDiagnosticSettingsClient", "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.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SubscriptionDiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, parameters SubscriptionDiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-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}/providers/microsoft.insights/diagnosticSettings/{name}", 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 SubscriptionDiagnosticSettingsClient) 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 SubscriptionDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result SubscriptionDiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing subscription diagnostic settings for the specified resource. -// Parameters: -// name - the name of the diagnostic setting. -func (client SubscriptionDiagnosticSettingsClient) Delete(ctx context.Context, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.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}}}}); err != nil { - return result, validation.NewError("insights.SubscriptionDiagnosticSettingsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.SubscriptionDiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.SubscriptionDiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.SubscriptionDiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubscriptionDiagnosticSettingsClient) DeletePreparer(ctx context.Context, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{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 SubscriptionDiagnosticSettingsClient) 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 SubscriptionDiagnosticSettingsClient) 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 active subscription diagnostic settings for the specified resource. -// Parameters: -// name - the name of the diagnostic setting. -func (client SubscriptionDiagnosticSettingsClient) Get(ctx context.Context, name string) (result SubscriptionDiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.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}}}}); err != nil { - return result, validation.NewError("insights.SubscriptionDiagnosticSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.SubscriptionDiagnosticSettingsClient", "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.SubscriptionDiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.SubscriptionDiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionDiagnosticSettingsClient) GetPreparer(ctx context.Context, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{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 SubscriptionDiagnosticSettingsClient) 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 SubscriptionDiagnosticSettingsClient) GetResponder(resp *http.Response) (result SubscriptionDiagnosticSettingsResource, 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 active subscription diagnostic settings list for the specified subscriptionId. -func (client SubscriptionDiagnosticSettingsClient) List(ctx context.Context) (result SubscriptionDiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.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}}}}); err != nil { - return result, validation.NewError("insights.SubscriptionDiagnosticSettingsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.SubscriptionDiagnosticSettingsClient", "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.SubscriptionDiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.SubscriptionDiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SubscriptionDiagnosticSettingsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings", 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 SubscriptionDiagnosticSettingsClient) 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 SubscriptionDiagnosticSettingsClient) ListResponder(resp *http.Response) (result SubscriptionDiagnosticSettingsResourceCollection, 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/monitor/mgmt/2019-11-01-preview/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/tenantactivitylogs.go deleted file mode 100644 index 7501f047bb38..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/tenantactivitylogs.go +++ /dev/null @@ -1,168 +0,0 @@ -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" -) - -// TenantActivityLogsClient is the monitor Management Client -type TenantActivityLogsClient struct { - BaseClient -} - -// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. -func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { - return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient 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 NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { - return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for -// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that -// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that -// were generated at the tenant level. -// Parameters: -// filter - reduces the set of data collected.
The **$filter** is very restricted and allows only the -// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq -// ''.
- List events for resource: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq -// ''.
- List events for a subscription: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation'.
- List events for a resource -// provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq -// 'Admin, Operation' and resourceProvider eq ''.
- List events for a correlation Id: -// api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq -// ''.
**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), - 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 TenantActivityLogsClient) 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 TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2019-11-01-preview/insights/version.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/version.go deleted file mode 100644 index 8ab2d08c66f8..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -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/2019-11-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/monitor/mgmt/2019-11-01-preview/insights/vminsights.go b/services/preview/monitor/mgmt/2019-11-01-preview/insights/vminsights.go deleted file mode 100644 index 3787cb6fc53e..000000000000 --- a/services/preview/monitor/mgmt/2019-11-01-preview/insights/vminsights.go +++ /dev/null @@ -1,105 +0,0 @@ -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" -) - -// VMInsightsClient is the monitor Management Client -type VMInsightsClient struct { - BaseClient -} - -// NewVMInsightsClient creates an instance of the VMInsightsClient client. -func NewVMInsightsClient(subscriptionID string) VMInsightsClient { - return NewVMInsightsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVMInsightsClientWithBaseURI creates an instance of the VMInsightsClient 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 NewVMInsightsClientWithBaseURI(baseURI string, subscriptionID string) VMInsightsClient { - return VMInsightsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetOnboardingStatus retrieves the VM Insights onboarding status for the specified resource or resource scope. -// Parameters: -// resourceURI - the fully qualified Azure Resource manager identifier of the resource, or scope, whose status -// to retrieve. -func (client VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string) (result VMInsightsOnboardingStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VMInsightsClient.GetOnboardingStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOnboardingStatusPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetOnboardingStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure sending request") - return - } - - result, err = client.GetOnboardingStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetOnboardingStatusPreparer prepares the GetOnboardingStatus request. -func (client VMInsightsClient) GetOnboardingStatusPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-11-27-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOnboardingStatusSender sends the GetOnboardingStatus request. The method will close the -// http.Response Body if it receives an error. -func (client VMInsightsClient) GetOnboardingStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetOnboardingStatusResponder handles the response to the GetOnboardingStatus request. The method always -// closes the http.Response Body. -func (client VMInsightsClient) GetOnboardingStatusResponder(resp *http.Response) (result VMInsightsOnboardingStatus, 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/monitor/mgmt/2021-04-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2021-04-01-preview/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2021-04-01-preview/insights/_meta.json deleted file mode 100644 index 92647bcdbe57..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "8dff86df71bee429af84ea4713288ef3cdd1db2f", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2021-04", - "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-04 --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/monitor/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/monitor/mgmt/2021-04-01-preview/insights/actiongroups.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/actiongroups.go deleted file mode 100644 index ce2e6509e2da..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/actiongroups.go +++ /dev/null @@ -1,633 +0,0 @@ -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" -) - -// ActionGroupsClient is the monitor Management Client -type ActionGroupsClient struct { - BaseClient -} - -// NewActionGroupsClient creates an instance of the ActionGroupsClient client. -func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { - return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { - return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new action group or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -// actionGroup - the action group to create or use for the update. -func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: actionGroup, - Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, - {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, 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.ActionGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroup), - 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 ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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.ActionGroupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) 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 -} - -// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. -// This operation is only supported for Email or SMS receivers. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -// enableRequest - the receiver to re-enable. -func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") - 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: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, 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.ActionGroupsClient", "EnableReceiver", err.Error()) - } - - req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") - return - } - - resp, err := client.EnableReceiverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") - return - } - - result, err = client.EnableReceiverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") - return - } - - return -} - -// EnableReceiverPreparer prepares the EnableReceiver request. -func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}/subscribe", pathParameters), - autorest.WithJSON(enableRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableReceiverSender sends the EnableReceiver request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableReceiverResponder handles the response to the EnableReceiver request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an action group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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.ActionGroupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all action groups in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: 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.ActionGroupsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActionGroupsClient) 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 = "2019-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.insights/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all action groups in a subscription. -func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") - 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}}}}); err != nil { - return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) - } - - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, 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 action group's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -// actionGroupPatch - parameters supplied to the operation. -func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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.ActionGroupsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "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.ActionGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-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.insights/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroupPatch), - 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 ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2021-04-01-preview/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogalerts.go deleted file mode 100644 index f897b08a6f0c..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogalerts.go +++ /dev/null @@ -1,545 +0,0 @@ -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" -) - -// ActivityLogAlertsClient is the monitor Management Client -type ActivityLogAlertsClient struct { - BaseClient -} - -// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient 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 NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new activity log alert or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlert - the activity log alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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.ActivityLogAlertsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) 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 an activity log alert. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// activityLogAlertName - the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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.ActivityLogAlertsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all activity log alerts in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) 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 = "2017-04-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/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all activity log alerts in a subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") - 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}}}}); err != nil { - return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) - } - - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, 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 ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// activityLogAlertName - the name of the activity log alert. -// activityLogAlertPatch - parameters supplied to the operation. -func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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.ActivityLogAlertsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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.ActivityLogAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), - 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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/monitor/mgmt/2021-04-01-preview/insights/activitylogs.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogs.go deleted file mode 100644 index 468cd15e3148..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/activitylogs.go +++ /dev/null @@ -1,173 +0,0 @@ -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" -) - -// ActivityLogsClient is the monitor Management Client -type ActivityLogsClient struct { - BaseClient -} - -// NewActivityLogsClient creates an instance of the ActivityLogsClient client. -func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { - return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient 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 NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { - return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides the list of records from the activity logs. -// Parameters: -// filter - reduces the set of data collected.
This argument is required and it also requires at least the -// start date/time.
The **$filter** argument is very restricted and allows only the following patterns.
- -// *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and -// eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
- *List -// events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a subscription in a -// time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq -// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge -// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq -// 'correlationID'.

**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.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.ActivityLogsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/alertruleincidents.go deleted file mode 100644 index a7dcd9cba31e..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/alertruleincidents.go +++ /dev/null @@ -1,205 +0,0 @@ -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" -) - -// AlertRuleIncidentsClient is the monitor Management Client -type AlertRuleIncidentsClient struct { - BaseClient -} - -// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// incidentName - the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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.AlertRuleIncidentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "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.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) 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 -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") - 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.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) - } - - req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - return - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2021-04-01-preview/insights/alertrules.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/alertrules.go deleted file mode 100644 index 888ed122e267..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/alertrules.go +++ /dev/null @@ -1,542 +0,0 @@ -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" -) - -// AlertRulesClient is the monitor Management Client -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 a classic metric alert rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, 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: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, 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.AlertRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 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 AlertRuleResource, 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName 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: 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.AlertRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 a classic metric alert rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, 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: 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.AlertRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.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, "insights.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{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 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 AlertRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the classic metric alert rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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: 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.AlertRulesClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) 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 = "2016-03-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/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the classic metric alert rules within a subscription. -func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") - 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}}}}); err != nil { - return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// alertRulesResource - parameters supplied to the operation. -func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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.AlertRulesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "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.AlertRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(alertRulesResource), - 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 AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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/monitor/mgmt/2021-04-01-preview/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/autoscalesettings.go deleted file mode 100644 index db9b916df1d9..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/autoscalesettings.go +++ /dev/null @@ -1,627 +0,0 @@ -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" -) - -// AutoscaleSettingsClient is the monitor Management Client -type AutoscaleSettingsClient struct { - BaseClient -} - -// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// autoscaleSettingName - the autoscale setting name. -// parameters - parameters supplied to the operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, 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.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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.AutoscaleSettingsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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.AutoscaleSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) 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-04-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/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 the autoscale settings for a subscription -func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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.AutoscaleSettingsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// autoscaleSettingName - the autoscale setting name. -// autoscaleSettingResource - parameters supplied to the operation. -func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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.AutoscaleSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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.AutoscaleSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(autoscaleSettingResource), - 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2021-04-01-preview/insights/baselines.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/baselines.go deleted file mode 100644 index 337ce4d1fa0f..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/baselines.go +++ /dev/null @@ -1,154 +0,0 @@ -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" -) - -// BaselinesClient is the monitor Management Client -type BaselinesClient struct { - BaseClient -} - -// NewBaselinesClient creates an instance of the BaselinesClient client. -func NewBaselinesClient(subscriptionID string) BaselinesClient { - return NewBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBaselinesClientWithBaseURI creates an instance of the BaselinesClient 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 NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) BaselinesClient { - return BaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself -// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** -// metricnamespace - metric namespace to query metric definitions for. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// filter - the **$filter** is used to reduce the set of metric data returned. Example: Metric contains -// metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or b2 **$filter=A eq 'a1' and B -// eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' or B = -// 'b2'** This is invalid because the logical or operator cannot separate two different metadata names. - -// Return all time series where A = a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - -// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When -// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead -// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name -// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq -// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result MetricBaselinesResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaselinesClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.BaselinesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "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.BaselinesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2019-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricBaselines", 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 BaselinesClient) 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 BaselinesClient) ListResponder(resp *http.Response) (result MetricBaselinesResponse, 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/monitor/mgmt/2021-04-01-preview/insights/client.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/client.go deleted file mode 100644 index a777181b0785..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package insights implements the Azure ARM Insights service API version . -// -// Monitor 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/monitor/mgmt/2021-04-01-preview/insights/datacollectionendpoints.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionendpoints.go deleted file mode 100644 index 7369932edf27..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionendpoints.go +++ /dev/null @@ -1,636 +0,0 @@ -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" -) - -// DataCollectionEndpointsClient is the monitor Management Client -type DataCollectionEndpointsClient struct { - BaseClient -} - -// NewDataCollectionEndpointsClient creates an instance of the DataCollectionEndpointsClient client. -func NewDataCollectionEndpointsClient(subscriptionID string) DataCollectionEndpointsClient { - return NewDataCollectionEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataCollectionEndpointsClientWithBaseURI creates an instance of the DataCollectionEndpointsClient 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 NewDataCollectionEndpointsClientWithBaseURI(baseURI string, subscriptionID string) DataCollectionEndpointsClient { - return DataCollectionEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create sends the create request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. -// body - the payload -func (client DataCollectionEndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *DataCollectionEndpointResource) (result DataCollectionEndpointResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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: body, - Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionEndpointsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, dataCollectionEndpointName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "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.DataCollectionEndpointsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DataCollectionEndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *DataCollectionEndpointResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - body.Etag = nil - body.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/dataCollectionEndpoints/{dataCollectionEndpointName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) CreateResponder(resp *http.Response) (result DataCollectionEndpointResource, 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 sends the delete request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. -func (client DataCollectionEndpointsClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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.DataCollectionEndpointsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, dataCollectionEndpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DataCollectionEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-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/dataCollectionEndpoints/{dataCollectionEndpointName}", 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) 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 sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. -func (client DataCollectionEndpointsClient) Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result DataCollectionEndpointResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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.DataCollectionEndpointsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, dataCollectionEndpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "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.DataCollectionEndpointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataCollectionEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-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/dataCollectionEndpoints/{dataCollectionEndpointName}", 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) GetResponder(resp *http.Response) (result DataCollectionEndpointResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup sends the list by resource group request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client DataCollectionEndpointsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DataCollectionEndpointResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dcerlr.Response.Response != nil { - sc = result.dcerlr.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.DataCollectionEndpointsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dcerlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dcerlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dcerlr.hasNextLink() && result.dcerlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DataCollectionEndpointsClient) 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-04-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/dataCollectionEndpoints", 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) ListByResourceGroupResponder(resp *http.Response) (result DataCollectionEndpointResourceListResult, 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 DataCollectionEndpointsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DataCollectionEndpointResourceListResult) (result DataCollectionEndpointResourceListResult, err error) { - req, err := lastResults.dataCollectionEndpointResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "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.DataCollectionEndpointsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionEndpointsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DataCollectionEndpointResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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 sends the list by subscription request. -func (client DataCollectionEndpointsClient) ListBySubscription(ctx context.Context) (result DataCollectionEndpointResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.ListBySubscription") - defer func() { - sc := -1 - if result.dcerlr.Response.Response != nil { - sc = result.dcerlr.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.DataCollectionEndpointsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dcerlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dcerlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dcerlr.hasNextLink() && result.dcerlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DataCollectionEndpointsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints", 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) ListBySubscriptionResponder(resp *http.Response) (result DataCollectionEndpointResourceListResult, 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 DataCollectionEndpointsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DataCollectionEndpointResourceListResult) (result DataCollectionEndpointResourceListResult, err error) { - req, err := lastResults.dataCollectionEndpointResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "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.DataCollectionEndpointsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionEndpointsClient) ListBySubscriptionComplete(ctx context.Context) (result DataCollectionEndpointResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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 sends the update request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. -// body - the payload -func (client DataCollectionEndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *ResourceForUpdate) (result DataCollectionEndpointResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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.DataCollectionEndpointsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, dataCollectionEndpointName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "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.DataCollectionEndpointsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DataCollectionEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *ResourceForUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-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/dataCollectionEndpoints/{dataCollectionEndpointName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) UpdateResponder(resp *http.Response) (result DataCollectionEndpointResource, 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/monitor/mgmt/2021-04-01-preview/insights/datacollectionruleassociations.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionruleassociations.go deleted file mode 100644 index 59878dbc8c2f..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionruleassociations.go +++ /dev/null @@ -1,534 +0,0 @@ -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" -) - -// DataCollectionRuleAssociationsClient is the monitor Management Client -type DataCollectionRuleAssociationsClient struct { - BaseClient -} - -// NewDataCollectionRuleAssociationsClient creates an instance of the DataCollectionRuleAssociationsClient client. -func NewDataCollectionRuleAssociationsClient(subscriptionID string) DataCollectionRuleAssociationsClient { - return NewDataCollectionRuleAssociationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataCollectionRuleAssociationsClientWithBaseURI creates an instance of the DataCollectionRuleAssociationsClient -// 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 NewDataCollectionRuleAssociationsClientWithBaseURI(baseURI string, subscriptionID string) DataCollectionRuleAssociationsClient { - return DataCollectionRuleAssociationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create sends the create request. -// Parameters: -// resourceURI - the identifier of the resource. -// associationName - the name of the association. The name is case insensitive. -// body - the payload -func (client DataCollectionRuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, body *DataCollectionRuleAssociationProxyOnlyResource) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceURI, associationName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "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.DataCollectionRuleAssociationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DataCollectionRuleAssociationsClient) CreatePreparer(ctx context.Context, resourceURI string, associationName string, body *DataCollectionRuleAssociationProxyOnlyResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "associationName": autorest.Encode("path", associationName), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - body.Etag = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - 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 DataCollectionRuleAssociationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client DataCollectionRuleAssociationsClient) CreateResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResource, 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 sends the delete request. -// Parameters: -// resourceURI - the identifier of the resource. -// associationName - the name of the association. The name is case insensitive. -func (client DataCollectionRuleAssociationsClient) Delete(ctx context.Context, resourceURI string, associationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceURI, associationName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DataCollectionRuleAssociationsClient) DeletePreparer(ctx context.Context, resourceURI string, associationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "associationName": autorest.Encode("path", associationName), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", 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 DataCollectionRuleAssociationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DataCollectionRuleAssociationsClient) 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 sends the get request. -// Parameters: -// resourceURI - the identifier of the resource. -// associationName - the name of the association. The name is case insensitive. -func (client DataCollectionRuleAssociationsClient) Get(ctx context.Context, resourceURI string, associationName string) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceURI, associationName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "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.DataCollectionRuleAssociationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataCollectionRuleAssociationsClient) GetPreparer(ctx context.Context, resourceURI string, associationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "associationName": autorest.Encode("path", associationName), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", 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 DataCollectionRuleAssociationsClient) 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 DataCollectionRuleAssociationsClient) GetResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResource sends the list by resource request. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DataCollectionRuleAssociationsClient) ListByResource(ctx context.Context, resourceURI string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByResource") - defer func() { - sc := -1 - if result.dcraporlr.Response.Response != nil { - sc = result.dcraporlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "ListByResource", err.Error()) - } - - result.fn = client.listByResourceNextResults - req, err := client.ListByResourcePreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceSender(req) - if err != nil { - result.dcraporlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByResource", resp, "Failure sending request") - return - } - - result.dcraporlr, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByResource", resp, "Failure responding to request") - return - } - if result.dcraporlr.hasNextLink() && result.dcraporlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourcePreparer prepares the ListByResource request. -func (client DataCollectionRuleAssociationsClient) ListByResourcePreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceSender sends the ListByResource request. The method will close the -// http.Response Body if it receives an error. -func (client DataCollectionRuleAssociationsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListByResourceResponder handles the response to the ListByResource request. The method always -// closes the http.Response Body. -func (client DataCollectionRuleAssociationsClient) ListByResourceResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceNextResults retrieves the next set of results, if any. -func (client DataCollectionRuleAssociationsClient) listByResourceNextResults(ctx context.Context, lastResults DataCollectionRuleAssociationProxyOnlyResourceListResult) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { - req, err := lastResults.dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionRuleAssociationsClient) ListByResourceComplete(ctx context.Context, resourceURI string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByResource") - 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.ListByResource(ctx, resourceURI) - return -} - -// ListByRule sends the list by rule request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. -func (client DataCollectionRuleAssociationsClient) ListByRule(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByRule") - defer func() { - sc := -1 - if result.dcraporlr.Response.Response != nil { - sc = result.dcraporlr.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.DataCollectionRuleAssociationsClient", "ListByRule", err.Error()) - } - - result.fn = client.listByRuleNextResults - req, err := client.ListByRulePreparer(ctx, resourceGroupName, dataCollectionRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRuleSender(req) - if err != nil { - result.dcraporlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByRule", resp, "Failure sending request") - return - } - - result.dcraporlr, err = client.ListByRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByRule", resp, "Failure responding to request") - return - } - if result.dcraporlr.hasNextLink() && result.dcraporlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByRulePreparer prepares the ListByRule request. -func (client DataCollectionRuleAssociationsClient) ListByRulePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-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/dataCollectionRules/{dataCollectionRuleName}/associations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByRuleSender sends the ListByRule request. The method will close the -// http.Response Body if it receives an error. -func (client DataCollectionRuleAssociationsClient) ListByRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByRuleResponder handles the response to the ListByRule request. The method always -// closes the http.Response Body. -func (client DataCollectionRuleAssociationsClient) ListByRuleResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByRuleNextResults retrieves the next set of results, if any. -func (client DataCollectionRuleAssociationsClient) listByRuleNextResults(ctx context.Context, lastResults DataCollectionRuleAssociationProxyOnlyResourceListResult) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { - req, err := lastResults.dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByRuleNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByRuleNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByRuleNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByRuleComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionRuleAssociationsClient) ListByRuleComplete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByRule") - 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.ListByRule(ctx, resourceGroupName, dataCollectionRuleName) - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionrules.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionrules.go deleted file mode 100644 index e3baabf0f6b4..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/datacollectionrules.go +++ /dev/null @@ -1,636 +0,0 @@ -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" -) - -// DataCollectionRulesClient is the monitor Management Client -type DataCollectionRulesClient struct { - BaseClient -} - -// NewDataCollectionRulesClient creates an instance of the DataCollectionRulesClient client. -func NewDataCollectionRulesClient(subscriptionID string) DataCollectionRulesClient { - return NewDataCollectionRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataCollectionRulesClientWithBaseURI creates an instance of the DataCollectionRulesClient 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 NewDataCollectionRulesClientWithBaseURI(baseURI string, subscriptionID string) DataCollectionRulesClient { - return DataCollectionRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create sends the create request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. -// body - the payload -func (client DataCollectionRulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *DataCollectionRuleResource) (result DataCollectionRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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: body, - Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("insights.DataCollectionRulesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, dataCollectionRuleName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "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.DataCollectionRulesClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DataCollectionRulesClient) CreatePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *DataCollectionRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - body.Etag = nil - body.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/dataCollectionRules/{dataCollectionRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) CreateResponder(resp *http.Response) (result DataCollectionRuleResource, 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 sends the delete request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. -func (client DataCollectionRulesClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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.DataCollectionRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, dataCollectionRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DataCollectionRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-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/dataCollectionRules/{dataCollectionRuleName}", 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) 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 sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. -func (client DataCollectionRulesClient) Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result DataCollectionRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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.DataCollectionRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, dataCollectionRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "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.DataCollectionRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataCollectionRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-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/dataCollectionRules/{dataCollectionRuleName}", 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) GetResponder(resp *http.Response) (result DataCollectionRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup sends the list by resource group request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client DataCollectionRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DataCollectionRuleResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dcrrlr.Response.Response != nil { - sc = result.dcrrlr.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.DataCollectionRulesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dcrrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dcrrlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dcrrlr.hasNextLink() && result.dcrrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DataCollectionRulesClient) 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-04-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/dataCollectionRules", 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) ListByResourceGroupResponder(resp *http.Response) (result DataCollectionRuleResourceListResult, 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 DataCollectionRulesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DataCollectionRuleResourceListResult) (result DataCollectionRuleResourceListResult, err error) { - req, err := lastResults.dataCollectionRuleResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "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.DataCollectionRulesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionRulesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DataCollectionRuleResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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 sends the list by subscription request. -func (client DataCollectionRulesClient) ListBySubscription(ctx context.Context) (result DataCollectionRuleResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.dcrrlr.Response.Response != nil { - sc = result.dcrrlr.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.DataCollectionRulesClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dcrrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dcrrlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dcrrlr.hasNextLink() && result.dcrrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DataCollectionRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules", 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) ListBySubscriptionResponder(resp *http.Response) (result DataCollectionRuleResourceListResult, 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 DataCollectionRulesClient) listBySubscriptionNextResults(ctx context.Context, lastResults DataCollectionRuleResourceListResult) (result DataCollectionRuleResourceListResult, err error) { - req, err := lastResults.dataCollectionRuleResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "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.DataCollectionRulesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataCollectionRulesClient) ListBySubscriptionComplete(ctx context.Context) (result DataCollectionRuleResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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 sends the update request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. -// body - the payload -func (client DataCollectionRulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *ResourceForUpdate) (result DataCollectionRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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.DataCollectionRulesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, dataCollectionRuleName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "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.DataCollectionRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DataCollectionRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *ResourceForUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-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/dataCollectionRules/{dataCollectionRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) UpdateResponder(resp *http.Response) (result DataCollectionRuleResource, 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/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettings.go deleted file mode 100644 index 0c0ec82dfe29..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettings.go +++ /dev/null @@ -1,357 +0,0 @@ -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" -) - -// DiagnosticSettingsClient is the monitor Management Client -type DiagnosticSettingsClient struct { - BaseClient -} - -// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. -func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { - return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient 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 NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { - return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceURI, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-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("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DiagnosticSettingsClient) 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 active diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 active diagnostic settings list for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "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.DiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", 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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, 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/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettingscategory.go deleted file mode 100644 index bb7a66926c3e..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/diagnosticsettingscategory.go +++ /dev/null @@ -1,193 +0,0 @@ -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" -) - -// DiagnosticSettingsCategoryClient is the monitor Management Client -type DiagnosticSettingsCategoryClient struct { - BaseClient -} - -// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. -func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { - return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient 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 NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { - return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsCategoryClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.DiagnosticSettingsCategoryClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "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.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, 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/monitor/mgmt/2021-04-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/enums.go deleted file mode 100644 index bd101099eb89..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/enums.go +++ /dev/null @@ -1,989 +0,0 @@ -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. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // AggregationTypeAverage ... - AggregationTypeAverage AggregationType = "Average" - // AggregationTypeCount ... - AggregationTypeCount AggregationType = "Count" - // AggregationTypeMaximum ... - AggregationTypeMaximum AggregationType = "Maximum" - // AggregationTypeMinimum ... - AggregationTypeMinimum AggregationType = "Minimum" - // AggregationTypeNone ... - AggregationTypeNone AggregationType = "None" - // AggregationTypeTotal ... - AggregationTypeTotal AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{AggregationTypeAverage, AggregationTypeCount, AggregationTypeMaximum, AggregationTypeMinimum, AggregationTypeNone, AggregationTypeTotal} -} - -// AggregationTypeEnum enumerates the values for aggregation type enum. -type AggregationTypeEnum string - -const ( - // AggregationTypeEnumAverage ... - AggregationTypeEnumAverage AggregationTypeEnum = "Average" - // AggregationTypeEnumCount ... - AggregationTypeEnumCount AggregationTypeEnum = "Count" - // AggregationTypeEnumMaximum ... - AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" - // AggregationTypeEnumMinimum ... - AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" - // AggregationTypeEnumTotal ... - AggregationTypeEnumTotal AggregationTypeEnum = "Total" -) - -// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. -func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { - return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} -} - -// AlertSeverity enumerates the values for alert severity. -type AlertSeverity string - -const ( - // AlertSeverityFour ... - AlertSeverityFour AlertSeverity = "4" - // AlertSeverityOne ... - AlertSeverityOne AlertSeverity = "1" - // AlertSeverityThree ... - AlertSeverityThree AlertSeverity = "3" - // AlertSeverityTwo ... - AlertSeverityTwo AlertSeverity = "2" - // AlertSeverityZero ... - AlertSeverityZero AlertSeverity = "0" -) - -// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. -func PossibleAlertSeverityValues() []AlertSeverity { - return []AlertSeverity{AlertSeverityFour, AlertSeverityOne, AlertSeverityThree, AlertSeverityTwo, AlertSeverityZero} -} - -// BaselineSensitivity enumerates the values for baseline sensitivity. -type BaselineSensitivity string - -const ( - // BaselineSensitivityHigh ... - BaselineSensitivityHigh BaselineSensitivity = "High" - // BaselineSensitivityLow ... - BaselineSensitivityLow BaselineSensitivity = "Low" - // BaselineSensitivityMedium ... - BaselineSensitivityMedium BaselineSensitivity = "Medium" -) - -// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. -func PossibleBaselineSensitivityValues() []BaselineSensitivity { - return []BaselineSensitivity{BaselineSensitivityHigh, BaselineSensitivityLow, BaselineSensitivityMedium} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // CategoryTypeLogs ... - CategoryTypeLogs CategoryType = "Logs" - // CategoryTypeMetrics ... - CategoryTypeMetrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{CategoryTypeLogs, CategoryTypeMetrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // ComparisonOperationTypeEquals ... - ComparisonOperationTypeEquals ComparisonOperationType = "Equals" - // ComparisonOperationTypeGreaterThan ... - ComparisonOperationTypeGreaterThan ComparisonOperationType = "GreaterThan" - // ComparisonOperationTypeGreaterThanOrEqual ... - ComparisonOperationTypeGreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // ComparisonOperationTypeLessThan ... - ComparisonOperationTypeLessThan ComparisonOperationType = "LessThan" - // ComparisonOperationTypeLessThanOrEqual ... - ComparisonOperationTypeLessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // ComparisonOperationTypeNotEquals ... - ComparisonOperationTypeNotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{ComparisonOperationTypeEquals, ComparisonOperationTypeGreaterThan, ComparisonOperationTypeGreaterThanOrEqual, ComparisonOperationTypeLessThan, ComparisonOperationTypeLessThanOrEqual, ComparisonOperationTypeNotEquals} -} - -// ConditionalOperator enumerates the values for conditional operator. -type ConditionalOperator string - -const ( - // ConditionalOperatorEqual ... - ConditionalOperatorEqual ConditionalOperator = "Equal" - // ConditionalOperatorGreaterThan ... - ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" - // ConditionalOperatorGreaterThanOrEqual ... - ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" - // ConditionalOperatorLessThan ... - ConditionalOperatorLessThan ConditionalOperator = "LessThan" - // ConditionalOperatorLessThanOrEqual ... - ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" -) - -// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. -func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} -} - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan ... - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual ... - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan ... - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual ... - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. -func PossibleConditionOperatorValues() []ConditionOperator { - return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} -} - -// 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} -} - -// CriterionType enumerates the values for criterion type. -type CriterionType string - -const ( - // CriterionTypeDynamicThresholdCriterion ... - CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - // CriterionTypeMultiMetricCriteria ... - CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" - // CriterionTypeStaticThresholdCriterion ... - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" -) - -// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. -func PossibleCriterionTypeValues() []CriterionType { - return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} -} - -// DataStatus enumerates the values for data status. -type DataStatus string - -const ( - // DataStatusNotPresent ... - DataStatusNotPresent DataStatus = "notPresent" - // DataStatusPresent ... - DataStatusPresent DataStatus = "present" -) - -// PossibleDataStatusValues returns an array of possible values for the DataStatus const type. -func PossibleDataStatusValues() []DataStatus { - return []DataStatus{DataStatusNotPresent, DataStatusPresent} -} - -// DynamicThresholdOperator enumerates the values for dynamic threshold operator. -type DynamicThresholdOperator string - -const ( - // DynamicThresholdOperatorGreaterOrLessThan ... - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - // DynamicThresholdOperatorGreaterThan ... - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - // DynamicThresholdOperatorLessThan ... - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} -} - -// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. -type DynamicThresholdSensitivity string - -const ( - // DynamicThresholdSensitivityHigh ... - DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" - // DynamicThresholdSensitivityLow ... - DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" - // DynamicThresholdSensitivityMedium ... - DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} -} - -// Enabled enumerates the values for enabled. -type Enabled string - -const ( - // EnabledFalse ... - EnabledFalse Enabled = "false" - // EnabledTrue ... - EnabledTrue Enabled = "true" -) - -// PossibleEnabledValues returns an array of possible values for the Enabled const type. -func PossibleEnabledValues() []Enabled { - return []Enabled{EnabledFalse, EnabledTrue} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // EventLevelCritical ... - EventLevelCritical EventLevel = "Critical" - // EventLevelError ... - EventLevelError EventLevel = "Error" - // EventLevelInformational ... - EventLevelInformational EventLevel = "Informational" - // EventLevelVerbose ... - EventLevelVerbose EventLevel = "Verbose" - // EventLevelWarning ... - EventLevelWarning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} -} - -// KnownDataCollectionEndpointProvisioningState enumerates the values for known data collection endpoint -// provisioning state. -type KnownDataCollectionEndpointProvisioningState string - -const ( - // KnownDataCollectionEndpointProvisioningStateCreating ... - KnownDataCollectionEndpointProvisioningStateCreating KnownDataCollectionEndpointProvisioningState = "Creating" - // KnownDataCollectionEndpointProvisioningStateDeleting ... - KnownDataCollectionEndpointProvisioningStateDeleting KnownDataCollectionEndpointProvisioningState = "Deleting" - // KnownDataCollectionEndpointProvisioningStateFailed ... - KnownDataCollectionEndpointProvisioningStateFailed KnownDataCollectionEndpointProvisioningState = "Failed" - // KnownDataCollectionEndpointProvisioningStateSucceeded ... - KnownDataCollectionEndpointProvisioningStateSucceeded KnownDataCollectionEndpointProvisioningState = "Succeeded" - // KnownDataCollectionEndpointProvisioningStateUpdating ... - KnownDataCollectionEndpointProvisioningStateUpdating KnownDataCollectionEndpointProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionEndpointProvisioningStateValues returns an array of possible values for the KnownDataCollectionEndpointProvisioningState const type. -func PossibleKnownDataCollectionEndpointProvisioningStateValues() []KnownDataCollectionEndpointProvisioningState { - return []KnownDataCollectionEndpointProvisioningState{KnownDataCollectionEndpointProvisioningStateCreating, KnownDataCollectionEndpointProvisioningStateDeleting, KnownDataCollectionEndpointProvisioningStateFailed, KnownDataCollectionEndpointProvisioningStateSucceeded, KnownDataCollectionEndpointProvisioningStateUpdating} -} - -// KnownDataCollectionEndpointResourceKind enumerates the values for known data collection endpoint resource -// kind. -type KnownDataCollectionEndpointResourceKind string - -const ( - // KnownDataCollectionEndpointResourceKindLinux ... - KnownDataCollectionEndpointResourceKindLinux KnownDataCollectionEndpointResourceKind = "Linux" - // KnownDataCollectionEndpointResourceKindWindows ... - KnownDataCollectionEndpointResourceKindWindows KnownDataCollectionEndpointResourceKind = "Windows" -) - -// PossibleKnownDataCollectionEndpointResourceKindValues returns an array of possible values for the KnownDataCollectionEndpointResourceKind const type. -func PossibleKnownDataCollectionEndpointResourceKindValues() []KnownDataCollectionEndpointResourceKind { - return []KnownDataCollectionEndpointResourceKind{KnownDataCollectionEndpointResourceKindLinux, KnownDataCollectionEndpointResourceKindWindows} -} - -// KnownDataCollectionRuleAssociationProvisioningState enumerates the values for known data collection rule -// association provisioning state. -type KnownDataCollectionRuleAssociationProvisioningState string - -const ( - // KnownDataCollectionRuleAssociationProvisioningStateCreating ... - KnownDataCollectionRuleAssociationProvisioningStateCreating KnownDataCollectionRuleAssociationProvisioningState = "Creating" - // KnownDataCollectionRuleAssociationProvisioningStateDeleting ... - KnownDataCollectionRuleAssociationProvisioningStateDeleting KnownDataCollectionRuleAssociationProvisioningState = "Deleting" - // KnownDataCollectionRuleAssociationProvisioningStateFailed ... - KnownDataCollectionRuleAssociationProvisioningStateFailed KnownDataCollectionRuleAssociationProvisioningState = "Failed" - // KnownDataCollectionRuleAssociationProvisioningStateSucceeded ... - KnownDataCollectionRuleAssociationProvisioningStateSucceeded KnownDataCollectionRuleAssociationProvisioningState = "Succeeded" - // KnownDataCollectionRuleAssociationProvisioningStateUpdating ... - KnownDataCollectionRuleAssociationProvisioningStateUpdating KnownDataCollectionRuleAssociationProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionRuleAssociationProvisioningStateValues returns an array of possible values for the KnownDataCollectionRuleAssociationProvisioningState const type. -func PossibleKnownDataCollectionRuleAssociationProvisioningStateValues() []KnownDataCollectionRuleAssociationProvisioningState { - return []KnownDataCollectionRuleAssociationProvisioningState{KnownDataCollectionRuleAssociationProvisioningStateCreating, KnownDataCollectionRuleAssociationProvisioningStateDeleting, KnownDataCollectionRuleAssociationProvisioningStateFailed, KnownDataCollectionRuleAssociationProvisioningStateSucceeded, KnownDataCollectionRuleAssociationProvisioningStateUpdating} -} - -// KnownDataCollectionRuleProvisioningState enumerates the values for known data collection rule provisioning -// state. -type KnownDataCollectionRuleProvisioningState string - -const ( - // KnownDataCollectionRuleProvisioningStateCreating ... - KnownDataCollectionRuleProvisioningStateCreating KnownDataCollectionRuleProvisioningState = "Creating" - // KnownDataCollectionRuleProvisioningStateDeleting ... - KnownDataCollectionRuleProvisioningStateDeleting KnownDataCollectionRuleProvisioningState = "Deleting" - // KnownDataCollectionRuleProvisioningStateFailed ... - KnownDataCollectionRuleProvisioningStateFailed KnownDataCollectionRuleProvisioningState = "Failed" - // KnownDataCollectionRuleProvisioningStateSucceeded ... - KnownDataCollectionRuleProvisioningStateSucceeded KnownDataCollectionRuleProvisioningState = "Succeeded" - // KnownDataCollectionRuleProvisioningStateUpdating ... - KnownDataCollectionRuleProvisioningStateUpdating KnownDataCollectionRuleProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionRuleProvisioningStateValues returns an array of possible values for the KnownDataCollectionRuleProvisioningState const type. -func PossibleKnownDataCollectionRuleProvisioningStateValues() []KnownDataCollectionRuleProvisioningState { - return []KnownDataCollectionRuleProvisioningState{KnownDataCollectionRuleProvisioningStateCreating, KnownDataCollectionRuleProvisioningStateDeleting, KnownDataCollectionRuleProvisioningStateFailed, KnownDataCollectionRuleProvisioningStateSucceeded, KnownDataCollectionRuleProvisioningStateUpdating} -} - -// KnownDataCollectionRuleResourceKind enumerates the values for known data collection rule resource kind. -type KnownDataCollectionRuleResourceKind string - -const ( - // KnownDataCollectionRuleResourceKindLinux ... - KnownDataCollectionRuleResourceKindLinux KnownDataCollectionRuleResourceKind = "Linux" - // KnownDataCollectionRuleResourceKindWindows ... - KnownDataCollectionRuleResourceKindWindows KnownDataCollectionRuleResourceKind = "Windows" -) - -// PossibleKnownDataCollectionRuleResourceKindValues returns an array of possible values for the KnownDataCollectionRuleResourceKind const type. -func PossibleKnownDataCollectionRuleResourceKindValues() []KnownDataCollectionRuleResourceKind { - return []KnownDataCollectionRuleResourceKind{KnownDataCollectionRuleResourceKindLinux, KnownDataCollectionRuleResourceKindWindows} -} - -// KnownDataFlowStreams enumerates the values for known data flow streams. -type KnownDataFlowStreams string - -const ( - // KnownDataFlowStreamsMicrosoftEvent ... - KnownDataFlowStreamsMicrosoftEvent KnownDataFlowStreams = "Microsoft-Event" - // KnownDataFlowStreamsMicrosoftInsightsMetrics ... - KnownDataFlowStreamsMicrosoftInsightsMetrics KnownDataFlowStreams = "Microsoft-InsightsMetrics" - // KnownDataFlowStreamsMicrosoftPerf ... - KnownDataFlowStreamsMicrosoftPerf KnownDataFlowStreams = "Microsoft-Perf" - // KnownDataFlowStreamsMicrosoftSyslog ... - KnownDataFlowStreamsMicrosoftSyslog KnownDataFlowStreams = "Microsoft-Syslog" - // KnownDataFlowStreamsMicrosoftWindowsEvent ... - KnownDataFlowStreamsMicrosoftWindowsEvent KnownDataFlowStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownDataFlowStreamsValues returns an array of possible values for the KnownDataFlowStreams const type. -func PossibleKnownDataFlowStreamsValues() []KnownDataFlowStreams { - return []KnownDataFlowStreams{KnownDataFlowStreamsMicrosoftEvent, KnownDataFlowStreamsMicrosoftInsightsMetrics, KnownDataFlowStreamsMicrosoftPerf, KnownDataFlowStreamsMicrosoftSyslog, KnownDataFlowStreamsMicrosoftWindowsEvent} -} - -// KnownExtensionDataSourceStreams enumerates the values for known extension data source streams. -type KnownExtensionDataSourceStreams string - -const ( - // KnownExtensionDataSourceStreamsMicrosoftEvent ... - KnownExtensionDataSourceStreamsMicrosoftEvent KnownExtensionDataSourceStreams = "Microsoft-Event" - // KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics ... - KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics KnownExtensionDataSourceStreams = "Microsoft-InsightsMetrics" - // KnownExtensionDataSourceStreamsMicrosoftPerf ... - KnownExtensionDataSourceStreamsMicrosoftPerf KnownExtensionDataSourceStreams = "Microsoft-Perf" - // KnownExtensionDataSourceStreamsMicrosoftSyslog ... - KnownExtensionDataSourceStreamsMicrosoftSyslog KnownExtensionDataSourceStreams = "Microsoft-Syslog" - // KnownExtensionDataSourceStreamsMicrosoftWindowsEvent ... - KnownExtensionDataSourceStreamsMicrosoftWindowsEvent KnownExtensionDataSourceStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownExtensionDataSourceStreamsValues returns an array of possible values for the KnownExtensionDataSourceStreams const type. -func PossibleKnownExtensionDataSourceStreamsValues() []KnownExtensionDataSourceStreams { - return []KnownExtensionDataSourceStreams{KnownExtensionDataSourceStreamsMicrosoftEvent, KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics, KnownExtensionDataSourceStreamsMicrosoftPerf, KnownExtensionDataSourceStreamsMicrosoftSyslog, KnownExtensionDataSourceStreamsMicrosoftWindowsEvent} -} - -// KnownPerfCounterDataSourceStreams enumerates the values for known perf counter data source streams. -type KnownPerfCounterDataSourceStreams string - -const ( - // KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics ... - KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics KnownPerfCounterDataSourceStreams = "Microsoft-InsightsMetrics" - // KnownPerfCounterDataSourceStreamsMicrosoftPerf ... - KnownPerfCounterDataSourceStreamsMicrosoftPerf KnownPerfCounterDataSourceStreams = "Microsoft-Perf" -) - -// PossibleKnownPerfCounterDataSourceStreamsValues returns an array of possible values for the KnownPerfCounterDataSourceStreams const type. -func PossibleKnownPerfCounterDataSourceStreamsValues() []KnownPerfCounterDataSourceStreams { - return []KnownPerfCounterDataSourceStreams{KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics, KnownPerfCounterDataSourceStreamsMicrosoftPerf} -} - -// KnownPublicNetworkAccessOptions enumerates the values for known public network access options. -type KnownPublicNetworkAccessOptions string - -const ( - // KnownPublicNetworkAccessOptionsDisabled ... - KnownPublicNetworkAccessOptionsDisabled KnownPublicNetworkAccessOptions = "Disabled" - // KnownPublicNetworkAccessOptionsEnabled ... - KnownPublicNetworkAccessOptionsEnabled KnownPublicNetworkAccessOptions = "Enabled" -) - -// PossibleKnownPublicNetworkAccessOptionsValues returns an array of possible values for the KnownPublicNetworkAccessOptions const type. -func PossibleKnownPublicNetworkAccessOptionsValues() []KnownPublicNetworkAccessOptions { - return []KnownPublicNetworkAccessOptions{KnownPublicNetworkAccessOptionsDisabled, KnownPublicNetworkAccessOptionsEnabled} -} - -// KnownSyslogDataSourceFacilityNames enumerates the values for known syslog data source facility names. -type KnownSyslogDataSourceFacilityNames string - -const ( - // KnownSyslogDataSourceFacilityNamesAsterisk ... - KnownSyslogDataSourceFacilityNamesAsterisk KnownSyslogDataSourceFacilityNames = "*" - // KnownSyslogDataSourceFacilityNamesAuth ... - KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" - // KnownSyslogDataSourceFacilityNamesAuthpriv ... - KnownSyslogDataSourceFacilityNamesAuthpriv KnownSyslogDataSourceFacilityNames = "authpriv" - // KnownSyslogDataSourceFacilityNamesCron ... - KnownSyslogDataSourceFacilityNamesCron KnownSyslogDataSourceFacilityNames = "cron" - // KnownSyslogDataSourceFacilityNamesDaemon ... - KnownSyslogDataSourceFacilityNamesDaemon KnownSyslogDataSourceFacilityNames = "daemon" - // KnownSyslogDataSourceFacilityNamesKern ... - KnownSyslogDataSourceFacilityNamesKern KnownSyslogDataSourceFacilityNames = "kern" - // KnownSyslogDataSourceFacilityNamesLocal0 ... - KnownSyslogDataSourceFacilityNamesLocal0 KnownSyslogDataSourceFacilityNames = "local0" - // KnownSyslogDataSourceFacilityNamesLocal1 ... - KnownSyslogDataSourceFacilityNamesLocal1 KnownSyslogDataSourceFacilityNames = "local1" - // KnownSyslogDataSourceFacilityNamesLocal2 ... - KnownSyslogDataSourceFacilityNamesLocal2 KnownSyslogDataSourceFacilityNames = "local2" - // KnownSyslogDataSourceFacilityNamesLocal3 ... - KnownSyslogDataSourceFacilityNamesLocal3 KnownSyslogDataSourceFacilityNames = "local3" - // KnownSyslogDataSourceFacilityNamesLocal4 ... - KnownSyslogDataSourceFacilityNamesLocal4 KnownSyslogDataSourceFacilityNames = "local4" - // KnownSyslogDataSourceFacilityNamesLocal5 ... - KnownSyslogDataSourceFacilityNamesLocal5 KnownSyslogDataSourceFacilityNames = "local5" - // KnownSyslogDataSourceFacilityNamesLocal6 ... - KnownSyslogDataSourceFacilityNamesLocal6 KnownSyslogDataSourceFacilityNames = "local6" - // KnownSyslogDataSourceFacilityNamesLocal7 ... - KnownSyslogDataSourceFacilityNamesLocal7 KnownSyslogDataSourceFacilityNames = "local7" - // KnownSyslogDataSourceFacilityNamesLpr ... - KnownSyslogDataSourceFacilityNamesLpr KnownSyslogDataSourceFacilityNames = "lpr" - // KnownSyslogDataSourceFacilityNamesMail ... - KnownSyslogDataSourceFacilityNamesMail KnownSyslogDataSourceFacilityNames = "mail" - // KnownSyslogDataSourceFacilityNamesMark ... - KnownSyslogDataSourceFacilityNamesMark KnownSyslogDataSourceFacilityNames = "mark" - // KnownSyslogDataSourceFacilityNamesNews ... - KnownSyslogDataSourceFacilityNamesNews KnownSyslogDataSourceFacilityNames = "news" - // KnownSyslogDataSourceFacilityNamesSyslog ... - KnownSyslogDataSourceFacilityNamesSyslog KnownSyslogDataSourceFacilityNames = "syslog" - // KnownSyslogDataSourceFacilityNamesUser ... - KnownSyslogDataSourceFacilityNamesUser KnownSyslogDataSourceFacilityNames = "user" - // KnownSyslogDataSourceFacilityNamesUucp ... - KnownSyslogDataSourceFacilityNamesUucp KnownSyslogDataSourceFacilityNames = "uucp" -) - -// PossibleKnownSyslogDataSourceFacilityNamesValues returns an array of possible values for the KnownSyslogDataSourceFacilityNames const type. -func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceFacilityNames { - return []KnownSyslogDataSourceFacilityNames{KnownSyslogDataSourceFacilityNamesAsterisk, KnownSyslogDataSourceFacilityNamesAuth, KnownSyslogDataSourceFacilityNamesAuthpriv, KnownSyslogDataSourceFacilityNamesCron, KnownSyslogDataSourceFacilityNamesDaemon, KnownSyslogDataSourceFacilityNamesKern, KnownSyslogDataSourceFacilityNamesLocal0, KnownSyslogDataSourceFacilityNamesLocal1, KnownSyslogDataSourceFacilityNamesLocal2, KnownSyslogDataSourceFacilityNamesLocal3, KnownSyslogDataSourceFacilityNamesLocal4, KnownSyslogDataSourceFacilityNamesLocal5, KnownSyslogDataSourceFacilityNamesLocal6, KnownSyslogDataSourceFacilityNamesLocal7, KnownSyslogDataSourceFacilityNamesLpr, KnownSyslogDataSourceFacilityNamesMail, KnownSyslogDataSourceFacilityNamesMark, KnownSyslogDataSourceFacilityNamesNews, KnownSyslogDataSourceFacilityNamesSyslog, KnownSyslogDataSourceFacilityNamesUser, KnownSyslogDataSourceFacilityNamesUucp} -} - -// KnownSyslogDataSourceLogLevels enumerates the values for known syslog data source log levels. -type KnownSyslogDataSourceLogLevels string - -const ( - // KnownSyslogDataSourceLogLevelsAlert ... - KnownSyslogDataSourceLogLevelsAlert KnownSyslogDataSourceLogLevels = "Alert" - // KnownSyslogDataSourceLogLevelsAsterisk ... - KnownSyslogDataSourceLogLevelsAsterisk KnownSyslogDataSourceLogLevels = "*" - // KnownSyslogDataSourceLogLevelsCritical ... - KnownSyslogDataSourceLogLevelsCritical KnownSyslogDataSourceLogLevels = "Critical" - // KnownSyslogDataSourceLogLevelsDebug ... - KnownSyslogDataSourceLogLevelsDebug KnownSyslogDataSourceLogLevels = "Debug" - // KnownSyslogDataSourceLogLevelsEmergency ... - KnownSyslogDataSourceLogLevelsEmergency KnownSyslogDataSourceLogLevels = "Emergency" - // KnownSyslogDataSourceLogLevelsError ... - KnownSyslogDataSourceLogLevelsError KnownSyslogDataSourceLogLevels = "Error" - // KnownSyslogDataSourceLogLevelsInfo ... - KnownSyslogDataSourceLogLevelsInfo KnownSyslogDataSourceLogLevels = "Info" - // KnownSyslogDataSourceLogLevelsNotice ... - KnownSyslogDataSourceLogLevelsNotice KnownSyslogDataSourceLogLevels = "Notice" - // KnownSyslogDataSourceLogLevelsWarning ... - KnownSyslogDataSourceLogLevelsWarning KnownSyslogDataSourceLogLevels = "Warning" -) - -// PossibleKnownSyslogDataSourceLogLevelsValues returns an array of possible values for the KnownSyslogDataSourceLogLevels const type. -func PossibleKnownSyslogDataSourceLogLevelsValues() []KnownSyslogDataSourceLogLevels { - return []KnownSyslogDataSourceLogLevels{KnownSyslogDataSourceLogLevelsAlert, KnownSyslogDataSourceLogLevelsAsterisk, KnownSyslogDataSourceLogLevelsCritical, KnownSyslogDataSourceLogLevelsDebug, KnownSyslogDataSourceLogLevelsEmergency, KnownSyslogDataSourceLogLevelsError, KnownSyslogDataSourceLogLevelsInfo, KnownSyslogDataSourceLogLevelsNotice, KnownSyslogDataSourceLogLevelsWarning} -} - -// KnownSyslogDataSourceStreams enumerates the values for known syslog data source streams. -type KnownSyslogDataSourceStreams string - -const ( - // KnownSyslogDataSourceStreamsMicrosoftSyslog ... - KnownSyslogDataSourceStreamsMicrosoftSyslog KnownSyslogDataSourceStreams = "Microsoft-Syslog" -) - -// PossibleKnownSyslogDataSourceStreamsValues returns an array of possible values for the KnownSyslogDataSourceStreams const type. -func PossibleKnownSyslogDataSourceStreamsValues() []KnownSyslogDataSourceStreams { - return []KnownSyslogDataSourceStreams{KnownSyslogDataSourceStreamsMicrosoftSyslog} -} - -// KnownWindowsEventLogDataSourceStreams enumerates the values for known windows event log data source streams. -type KnownWindowsEventLogDataSourceStreams string - -const ( - // KnownWindowsEventLogDataSourceStreamsMicrosoftEvent ... - KnownWindowsEventLogDataSourceStreamsMicrosoftEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-Event" - // KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent ... - KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownWindowsEventLogDataSourceStreamsValues returns an array of possible values for the KnownWindowsEventLogDataSourceStreams const type. -func PossibleKnownWindowsEventLogDataSourceStreamsValues() []KnownWindowsEventLogDataSourceStreams { - return []KnownWindowsEventLogDataSourceStreams{KnownWindowsEventLogDataSourceStreamsMicrosoftEvent, KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent} -} - -// MetricClass enumerates the values for metric class. -type MetricClass string - -const ( - // MetricClassAvailability ... - MetricClassAvailability MetricClass = "Availability" - // MetricClassErrors ... - MetricClassErrors MetricClass = "Errors" - // MetricClassLatency ... - MetricClassLatency MetricClass = "Latency" - // MetricClassSaturation ... - MetricClassSaturation MetricClass = "Saturation" - // MetricClassTransactions ... - MetricClassTransactions MetricClass = "Transactions" -) - -// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. -func PossibleMetricClassValues() []MetricClass { - return []MetricClass{MetricClassAvailability, MetricClassErrors, MetricClassLatency, MetricClassSaturation, MetricClassTransactions} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// MetricTriggerType enumerates the values for metric trigger type. -type MetricTriggerType string - -const ( - // MetricTriggerTypeConsecutive ... - MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" - // MetricTriggerTypeTotal ... - MetricTriggerTypeTotal MetricTriggerType = "Total" -) - -// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. -func PossibleMetricTriggerTypeValues() []MetricTriggerType { - return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} -} - -// MetricUnit enumerates the values for metric unit. -type MetricUnit string - -const ( - // MetricUnitBitsPerSecond ... - MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" - // MetricUnitBytes ... - MetricUnitBytes MetricUnit = "Bytes" - // MetricUnitByteSeconds ... - MetricUnitByteSeconds MetricUnit = "ByteSeconds" - // MetricUnitBytesPerSecond ... - MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" - // MetricUnitCores ... - MetricUnitCores MetricUnit = "Cores" - // MetricUnitCount ... - MetricUnitCount MetricUnit = "Count" - // MetricUnitCountPerSecond ... - MetricUnitCountPerSecond MetricUnit = "CountPerSecond" - // MetricUnitMilliCores ... - MetricUnitMilliCores MetricUnit = "MilliCores" - // MetricUnitMilliSeconds ... - MetricUnitMilliSeconds MetricUnit = "MilliSeconds" - // MetricUnitNanoCores ... - MetricUnitNanoCores MetricUnit = "NanoCores" - // MetricUnitPercent ... - MetricUnitPercent MetricUnit = "Percent" - // MetricUnitSeconds ... - MetricUnitSeconds MetricUnit = "Seconds" - // MetricUnitUnspecified ... - MetricUnitUnspecified MetricUnit = "Unspecified" -) - -// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. -func PossibleMetricUnitValues() []MetricUnit { - return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} -} - -// NamespaceClassification enumerates the values for namespace classification. -type NamespaceClassification string - -const ( - // NamespaceClassificationCustom ... - NamespaceClassificationCustom NamespaceClassification = "Custom" - // NamespaceClassificationPlatform ... - NamespaceClassificationPlatform NamespaceClassification = "Platform" - // NamespaceClassificationQos ... - NamespaceClassificationQos NamespaceClassification = "Qos" -) - -// PossibleNamespaceClassificationValues returns an array of possible values for the NamespaceClassification const type. -func PossibleNamespaceClassificationValues() []NamespaceClassification { - return []NamespaceClassification{NamespaceClassificationCustom, NamespaceClassificationPlatform, NamespaceClassificationQos} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... - OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - // OdataTypeRuleDataSource ... - OdataTypeRuleDataSource OdataType = "RuleDataSource" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} -} - -// OdataTypeBasicAction enumerates the values for odata type basic action. -type OdataTypeBasicAction string - -const ( - // OdataTypeBasicActionOdataTypeAction ... - OdataTypeBasicActionOdataTypeAction OdataTypeBasicAction = "Action" - // OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... - OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - // OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... - OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" -) - -// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. -func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeBasicActionOdataTypeAction, OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} -} - -// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. -type OdataTypeBasicMetricAlertCriteria string - -const ( - // OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria ... - OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" - // OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... - OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - // OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... - OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - // OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... - OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. -func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { - return []OdataTypeBasicMetricAlertCriteria{OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria, OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} -} - -// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. -type OdataTypeBasicRuleAction string - -const ( - // OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... - OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - // OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... - OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - // OdataTypeBasicRuleActionOdataTypeRuleAction ... - OdataTypeBasicRuleActionOdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" -) - -// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. -func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { - return []OdataTypeBasicRuleAction{OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeBasicRuleActionOdataTypeRuleAction} -} - -// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. -type OdataTypeBasicRuleCondition string - -const ( - // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - // OdataTypeBasicRuleConditionOdataTypeRuleCondition ... - OdataTypeBasicRuleConditionOdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" -) - -// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. -func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { - return []OdataTypeBasicRuleCondition{OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeBasicRuleConditionOdataTypeRuleCondition} -} - -// OnboardingStatus enumerates the values for onboarding status. -type OnboardingStatus string - -const ( - // OnboardingStatusNotOnboarded ... - OnboardingStatusNotOnboarded OnboardingStatus = "notOnboarded" - // OnboardingStatusOnboarded ... - OnboardingStatusOnboarded OnboardingStatus = "onboarded" - // OnboardingStatusUnknown ... - OnboardingStatusUnknown OnboardingStatus = "unknown" -) - -// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. -func PossibleOnboardingStatusValues() []OnboardingStatus { - return []OnboardingStatus{OnboardingStatusNotOnboarded, OnboardingStatusOnboarded, OnboardingStatusUnknown} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorEquals ... - OperatorEquals Operator = "Equals" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - // OperatorNotEquals ... - OperatorNotEquals Operator = "NotEquals" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual, OperatorNotEquals} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateDeploying ... - ProvisioningStateDeploying ProvisioningState = "Deploying" - // 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{ProvisioningStateCanceled, ProvisioningStateDeploying, ProvisioningStateFailed, ProvisioningStateSucceeded} -} - -// QueryType enumerates the values for query type. -type QueryType string - -const ( - // QueryTypeResultCount ... - QueryTypeResultCount QueryType = "ResultCount" -) - -// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. -func PossibleQueryTypeValues() []QueryType { - return []QueryType{QueryTypeResultCount} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // ReceiverStatusDisabled ... - ReceiverStatusDisabled ReceiverStatus = "Disabled" - // ReceiverStatusEnabled ... - ReceiverStatusEnabled ReceiverStatus = "Enabled" - // ReceiverStatusNotSpecified ... - ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // ResultTypeData ... - ResultTypeData ResultType = "Data" - // ResultTypeMetadata ... - ResultTypeMetadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{ResultTypeData, ResultTypeMetadata} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ScaleTypeChangeCount ... - ScaleTypeChangeCount ScaleType = "ChangeCount" - // ScaleTypeExactCount ... - ScaleTypeExactCount ScaleType = "ExactCount" - // ScaleTypePercentChangeCount ... - ScaleTypePercentChangeCount ScaleType = "PercentChangeCount" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ScaleTypeChangeCount, ScaleTypeExactCount, ScaleTypePercentChangeCount} -} - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage ... - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast ... - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum ... - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum ... - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal ... - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/eventcategories.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/eventcategories.go deleted file mode 100644 index 86e59b424363..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/eventcategories.go +++ /dev/null @@ -1,99 +0,0 @@ -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" -) - -// EventCategoriesClient is the monitor Management Client -type EventCategoriesClient struct { - BaseClient -} - -// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. -func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { - return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { - return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available event categories supported in the Activity Logs Service.
The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "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.EventCategoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventcategories"), - 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2021-04-01-preview/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/insightsapi/interfaces.go deleted file mode 100644 index 88f2dd9222b8..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,291 +0,0 @@ -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/monitor/mgmt/2021-04-01-preview/insights" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. -type AlertRuleIncidentsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) - ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) -} - -var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) - -// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. -type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) -} - -var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) - -// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. -type LogProfilesClientAPI interface { - CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) - Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) - Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) - List(ctx context.Context) (result insights.LogProfileCollection, err error) - Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) -} - -var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) - -// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. -type DiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) -} - -var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) - -// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) -} - -var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) - -// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. -type ActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) - -// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. -type EventCategoriesClientAPI interface { - List(ctx context.Context) (result insights.EventCategoryCollection, err error) -} - -var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) - -// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. -type TenantActivityLogsClientAPI interface { - List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) -} - -var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) - -// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. -type MetricDefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string, metricnamespace string) (result insights.MetricDefinitionCollection, err error) -} - -var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) - -// MetricsClientAPI contains the set of methods on the MetricsClient type. -type MetricsClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType insights.ResultType, metricnamespace string) (result insights.Response, err error) -} - -var _ MetricsClientAPI = (*insights.MetricsClient)(nil) - -// BaselinesClientAPI contains the set of methods on the BaselinesClient type. -type BaselinesClientAPI interface { - List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) -} - -var _ BaselinesClientAPI = (*insights.BaselinesClient)(nil) - -// MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. -type MetricAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.MetricAlertResourceCollection, err error) - ListBySubscription(ctx context.Context) (result insights.MetricAlertResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResourcePatch) (result insights.MetricAlertResource, err error) -} - -var _ MetricAlertsClientAPI = (*insights.MetricAlertsClient)(nil) - -// MetricAlertsStatusClientAPI contains the set of methods on the MetricAlertsStatusClient type. -type MetricAlertsStatusClientAPI interface { - List(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertStatusCollection, err error) - ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result insights.MetricAlertStatusCollection, err error) -} - -var _ MetricAlertsStatusClientAPI = (*insights.MetricAlertsStatusClient)(nil) - -// ScheduledQueryRulesClientAPI contains the set of methods on the ScheduledQueryRulesClient type. -type ScheduledQueryRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResource) (result insights.LogSearchRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.LogSearchRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result insights.LogSearchRuleResourceCollection, err error) - ListBySubscription(ctx context.Context, filter string) (result insights.LogSearchRuleResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResourcePatch) (result insights.LogSearchRuleResource, err error) -} - -var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) - -// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. -type MetricNamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) -} - -var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) - -// VMInsightsClientAPI contains the set of methods on the VMInsightsClient type. -type VMInsightsClientAPI interface { - GetOnboardingStatus(ctx context.Context, resourceURI string) (result insights.VMInsightsOnboardingStatus, err error) -} - -var _ VMInsightsClientAPI = (*insights.VMInsightsClient)(nil) - -// PrivateLinkScopesClientAPI contains the set of methods on the PrivateLinkScopesClient type. -type PrivateLinkScopesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload insights.AzureMonitorPrivateLinkScope) (result insights.AzureMonitorPrivateLinkScope, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkScopesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string) (result insights.AzureMonitorPrivateLinkScope, err error) - List(ctx context.Context) (result insights.AzureMonitorPrivateLinkScopeListResultPage, err error) - ListComplete(ctx context.Context) (result insights.AzureMonitorPrivateLinkScopeListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AzureMonitorPrivateLinkScopeListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AzureMonitorPrivateLinkScopeListResultIterator, err error) - UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags insights.TagsResource) (result insights.AzureMonitorPrivateLinkScope, err error) -} - -var _ PrivateLinkScopesClientAPI = (*insights.PrivateLinkScopesClient)(nil) - -// PrivateLinkScopeOperationStatusClientAPI contains the set of methods on the PrivateLinkScopeOperationStatusClient type. -type PrivateLinkScopeOperationStatusClientAPI interface { - Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result insights.OperationStatus, err error) -} - -var _ PrivateLinkScopeOperationStatusClientAPI = (*insights.PrivateLinkScopeOperationStatusClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result insights.PrivateLinkResource, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkResourceListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkResourceListResultIterator, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*insights.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters insights.PrivateEndpointConnection) (result insights.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result insights.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result insights.PrivateEndpointConnection, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateEndpointConnectionListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*insights.PrivateEndpointConnectionsClient)(nil) - -// PrivateLinkScopedResourcesClientAPI contains the set of methods on the PrivateLinkScopedResourcesClient type. -type PrivateLinkScopedResourcesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters insights.ScopedResource) (result insights.PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result insights.PrivateLinkScopedResourcesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result insights.ScopedResource, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.ScopedResourceListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.ScopedResourceListResultIterator, err error) -} - -var _ PrivateLinkScopedResourcesClientAPI = (*insights.PrivateLinkScopedResourcesClient)(nil) - -// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. -type ActivityLogAlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActivityLogAlertList, err error) - ListBySubscriptionID(ctx context.Context) (result insights.ActivityLogAlertList, err error) - Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch insights.ActivityLogAlertPatchBody) (result insights.ActivityLogAlertResource, err error) -} - -var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) - -// DataCollectionEndpointsClientAPI contains the set of methods on the DataCollectionEndpointsClient type. -type DataCollectionEndpointsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *insights.DataCollectionEndpointResource) (result insights.DataCollectionEndpointResource, err error) - Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result insights.DataCollectionEndpointResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.DataCollectionEndpointResourceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.DataCollectionEndpointResourceListResultIterator, err error) - ListBySubscription(ctx context.Context) (result insights.DataCollectionEndpointResourceListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.DataCollectionEndpointResourceListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *insights.ResourceForUpdate) (result insights.DataCollectionEndpointResource, err error) -} - -var _ DataCollectionEndpointsClientAPI = (*insights.DataCollectionEndpointsClient)(nil) - -// DataCollectionRuleAssociationsClientAPI contains the set of methods on the DataCollectionRuleAssociationsClient type. -type DataCollectionRuleAssociationsClientAPI interface { - Create(ctx context.Context, resourceURI string, associationName string, body *insights.DataCollectionRuleAssociationProxyOnlyResource) (result insights.DataCollectionRuleAssociationProxyOnlyResource, err error) - Delete(ctx context.Context, resourceURI string, associationName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, associationName string) (result insights.DataCollectionRuleAssociationProxyOnlyResource, err error) - ListByResource(ctx context.Context, resourceURI string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) - ListByResourceComplete(ctx context.Context, resourceURI string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) - ListByRule(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) - ListByRuleComplete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) -} - -var _ DataCollectionRuleAssociationsClientAPI = (*insights.DataCollectionRuleAssociationsClient)(nil) - -// DataCollectionRulesClientAPI contains the set of methods on the DataCollectionRulesClient type. -type DataCollectionRulesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *insights.DataCollectionRuleResource) (result insights.DataCollectionRuleResource, err error) - Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result insights.DataCollectionRuleResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.DataCollectionRuleResourceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.DataCollectionRuleResourceListResultIterator, err error) - ListBySubscription(ctx context.Context) (result insights.DataCollectionRuleResourceListResultPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result insights.DataCollectionRuleResourceListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *insights.ResourceForUpdate) (result insights.DataCollectionRuleResource, err error) -} - -var _ DataCollectionRulesClientAPI = (*insights.DataCollectionRulesClient)(nil) diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/logprofiles.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/logprofiles.go deleted file mode 100644 index 64fda18dde7c..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/logprofiles.go +++ /dev/null @@ -1,444 +0,0 @@ -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" -) - -// LogProfilesClient is the monitor Management Client -type LogProfilesClient struct { - BaseClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// Parameters: -// logProfileName - the name of the log profile. -// parameters - parameters supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), 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.LogProfilesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) 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 the log profile. -// Parameters: -// logProfileName - the name of the log profile. -func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 LogProfilesResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// logProfileName - the name of the log profile. -// logProfilesResource - parameters supplied to the operation. -func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { - return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "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.LogProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-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}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(logProfilesResource), - 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 LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2021-04-01-preview/insights/metricalerts.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalerts.go deleted file mode 100644 index f9706664d9be..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalerts.go +++ /dev/null @@ -1,545 +0,0 @@ -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" -) - -// MetricAlertsClient is the monitor Management Client -type MetricAlertsClient struct { - BaseClient -} - -// NewMetricAlertsClient creates an instance of the MetricAlertsClient client. -func NewMetricAlertsClient(subscriptionID string) MetricAlertsClient { - return NewMetricAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsClientWithBaseURI creates an instance of the MetricAlertsClient 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 NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsClient { - return MetricAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result MetricAlertResource, 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 alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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.MetricAlertsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) 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 an alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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.MetricAlertsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 MetricAlertsClient) 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 MetricAlertsClient) GetResponder(resp *http.Response) (result MetricAlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve alert rule definitions in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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.MetricAlertsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MetricAlertsClient) 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 = "2018-03-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/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieve alert rule definitions in a subscription. -func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result MetricAlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListBySubscription") - 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}}}}); err != nil { - return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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.MetricAlertsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "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.MetricAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) UpdateResponder(resp *http.Response) (result MetricAlertResource, 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/monitor/mgmt/2021-04-01-preview/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalertsstatus.go deleted file mode 100644 index 4709142160be..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricalertsstatus.go +++ /dev/null @@ -1,205 +0,0 @@ -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" -) - -// MetricAlertsStatusClient is the monitor Management Client -type MetricAlertsStatusClient struct { - BaseClient -} - -// NewMetricAlertsStatusClient creates an instance of the MetricAlertsStatusClient client. -func NewMetricAlertsStatusClient(subscriptionID string) MetricAlertsStatusClient { - return NewMetricAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricAlertsStatusClientWithBaseURI creates an instance of the MetricAlertsStatusClient 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 NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsStatusClient { - return MetricAlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.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.MetricAlertsStatusClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "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.MetricAlertsStatusClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status", 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 MetricAlertsStatusClient) 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 MetricAlertsStatusClient) ListResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByName retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// statusName - the name of the status. -func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.ListByName") - 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.MetricAlertsStatusClient", "ListByName", err.Error()) - } - - req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure sending request") - return - } - - result, err = client.ListByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure responding to request") - return - } - - return -} - -// ListByNamePreparer prepares the ListByName request. -func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "statusName": autorest.Encode("path", statusName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status/{statusName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNameSender sends the ListByName request. The method will close the -// http.Response Body if it receives an error. -func (client MetricAlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNameResponder handles the response to the ListByName request. The method always -// closes the http.Response Body. -func (client MetricAlertsStatusClient) ListByNameResponder(resp *http.Response) (result MetricAlertStatusCollection, 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/monitor/mgmt/2021-04-01-preview/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricdefinitions.go deleted file mode 100644 index 34383acfb3e7..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricdefinitions.go +++ /dev/null @@ -1,116 +0,0 @@ -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" -) - -// MetricDefinitionsClient is the monitor Management Client -type MetricDefinitionsClient struct { - BaseClient -} - -// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. -func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { - return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient 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 NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { - return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result MetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricDefinitionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "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.MetricDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", 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 MetricDefinitionsClient) 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 MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, 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/monitor/mgmt/2021-04-01-preview/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricnamespaces.go deleted file mode 100644 index a1a70c21f9d6..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metricnamespaces.go +++ /dev/null @@ -1,116 +0,0 @@ -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" -) - -// MetricNamespacesClient is the monitor Management Client -type MetricNamespacesClient struct { - BaseClient -} - -// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. -func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { - return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient 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 NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { - return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric namespaces for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricNamespacesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI, startTime) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "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.MetricNamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", 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 MetricNamespacesClient) 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 MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, 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/monitor/mgmt/2021-04-01-preview/insights/metrics.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/metrics.go deleted file mode 100644 index 297183565d38..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/metrics.go +++ /dev/null @@ -1,163 +0,0 @@ -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" -) - -// MetricsClient is the monitor Management Client -type MetricsClient struct { - BaseClient -} - -// NewMetricsClient creates an instance of the MetricsClient client. -func NewMetricsClient(subscriptionID string) MetricsClient { - return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricsClientWithBaseURI creates an instance of the MetricsClient 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 NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { - return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself -// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned. Example: Metric contains -// metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or b2 **$filter=A eq 'a1' and B -// eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' or B = -// 'b2'** This is invalid because the logical or operator cannot separate two different metadata names. - -// Return all time series where A = a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - -// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When -// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead -// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name -// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq -// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace to query metric definitions for. -func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (result Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.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: resourceURI, - Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.MetricsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "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.MetricsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/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 MetricsClient) 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 MetricsClient) ListResponder(resp *http.Response) (result Response, 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/monitor/mgmt/2021-04-01-preview/insights/models.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/models.go deleted file mode 100644 index d82b7cbdb8ef..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/models.go +++ /dev/null @@ -1,8744 +0,0 @@ -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/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/preview/monitor/mgmt/2021-04-01-preview/insights" - -// BasicAction action descriptor. -type BasicAction interface { - AsAlertingAction() (*AlertingAction, bool) - AsLogToMetricAction() (*LogToMetricAction, bool) - AsAction() (*Action, bool) -} - -// Action action descriptor. -type Action struct { - // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicAction(body []byte) (BasicAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): - var aa AlertingAction - err := json.Unmarshal(body, &aa) - return aa, err - case string(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): - var ltma LogToMetricAction - err := json.Unmarshal(body, <ma) - return ltma, err - default: - var a Action - err := json.Unmarshal(body, &a) - return a, err - } -} -func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - aArray := make([]BasicAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - a, err := unmarshalBasicAction(*rawMessage) - if err != nil { - return nil, err - } - aArray[index] = a - } - return aArray, nil -} - -// MarshalJSON is the custom marshaler for Action. -func (a Action) MarshalJSON() ([]byte, error) { - a.OdataType = OdataTypeBasicActionOdataTypeAction - objectMap := make(map[string]interface{}) - if a.OdataType != "" { - objectMap["odata.type"] = a.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for Action. -func (a Action) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for Action. -func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for Action. -func (a Action) AsAction() (*Action, bool) { - return &a, true -} - -// AsBasicAction is the BasicAction implementation for Action. -func (a Action) AsBasicAction() (BasicAction, bool) { - return &a, true -} - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) 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 - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `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"` - // Kind - READ-ONLY; Azure resource kind - Kind *string `json:"kind,omitempty"` - // Identity - READ-ONLY; Azure resource identity - Identity *string `json:"identity,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) 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 actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - agr.Kind = &kind - } - case "identity": - if v != nil { - var identity string - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - agr.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActivityLogAlert an Azure activity log alert. -type ActivityLogAlert struct { - // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. - Scopes *[]string `json:"scopes,omitempty"` - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` - // Condition - The condition that will cause this alert to activate. - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - // Actions - The actions that will activate when the condition is met. - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - // Description - A description of this activity log alert. - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - // ActionGroupID - The resourceId of the action group. This cannot be null or empty. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string `json:"webhookProperties"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. -func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alaag.ActionGroupID != nil { - objectMap["actionGroupId"] = alaag.ActionGroupID - } - if alaag.WebhookProperties != nil { - objectMap["webhookProperties"] = alaag.WebhookProperties - } - return json.Marshal(objectMap) -} - -// ActivityLogAlertActionList a list of activity log alert actions. -type ActivityLogAlertActionList struct { - // ActionGroups - The list of activity log alerts. - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member -// conditions are met. -type ActivityLogAlertAllOfCondition struct { - // AllOf - The list of activity log alert conditions. - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log -// field and value. -type ActivityLogAlertLeafCondition struct { - // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. - Field *string `json:"field,omitempty"` - // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - // Value - The list of activity log alerts. - Value *[]ActivityLogAlertResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityLogAlertPatch an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. -type ActivityLogAlertPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActivityLogAlertPatch - The activity log alert settings for an update operation. - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. -func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alapb.Tags != nil { - objectMap["tags"] = alapb.Tags - } - if alapb.ActivityLogAlertPatch != nil { - objectMap["properties"] = alapb.ActivityLogAlertPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. -func (alapb *ActivityLogAlertPatchBody) 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 - } - alapb.Tags = tags - } - case "properties": - if v != nil { - var activityLogAlertPatch ActivityLogAlertPatch - err = json.Unmarshal(*v, &activityLogAlertPatch) - if err != nil { - return err - } - alapb.ActivityLogAlertPatch = &activityLogAlertPatch - } - } - } - - return nil -} - -// ActivityLogAlertResource an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `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"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActivityLogAlertResource. -func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if alar.ActivityLogAlert != nil { - objectMap["properties"] = alar.ActivityLogAlert - } - if alar.Location != nil { - objectMap["location"] = alar.Location - } - if alar.Tags != nil { - objectMap["tags"] = alar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) 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 activityLogAlert ActivityLogAlert - err = json.Unmarshal(*v, &activityLogAlert) - if err != nil { - return err - } - alar.ActivityLogAlert = &activityLogAlert - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - alar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - alar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - alar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - alar.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - alar.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - alar.Etag = &etag - } - } - } - - return nil -} - -// AlertingAction specify action need to be taken when rule type is Alert -type AlertingAction struct { - // Severity - Severity of the alert. Possible values include: 'AlertSeverityZero', 'AlertSeverityOne', 'AlertSeverityTwo', 'AlertSeverityThree', 'AlertSeverityFour' - Severity AlertSeverity `json:"severity,omitempty"` - // AznsAction - Azure action group reference. - AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` - // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. - ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` - // Trigger - The trigger condition that results in the alert rule being. - Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertingAction. -func (aa AlertingAction) MarshalJSON() ([]byte, error) { - aa.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction - objectMap := make(map[string]interface{}) - if aa.Severity != "" { - objectMap["severity"] = aa.Severity - } - if aa.AznsAction != nil { - objectMap["aznsAction"] = aa.AznsAction - } - if aa.ThrottlingInMin != nil { - objectMap["throttlingInMin"] = aa.ThrottlingInMin - } - if aa.Trigger != nil { - objectMap["trigger"] = aa.Trigger - } - if aa.OdataType != "" { - objectMap["odata.type"] = aa.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { - return &aa, true -} - -// AsLogToMetricAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return nil, false -} - -// AsAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for AlertingAction. -func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { - return &aa, true -} - -// AlertRule an alert rule. -type AlertRule struct { - // Name - the name of the alert rule. - Name *string `json:"name,omitempty"` - // Description - the description of the alert rule that will be included in the alert email. - Description *string `json:"description,omitempty"` - // ProvisioningState - the provisioning state. - ProvisioningState *string `json:"provisioningState,omitempty"` - // IsEnabled - the flag that indicates whether the alert rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Condition - the condition that results in the alert rule being activated. - Condition BasicRuleCondition `json:"condition,omitempty"` - // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. - Action BasicRuleAction `json:"action,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]BasicRuleAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRule. -func (ar AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.ProvisioningState != nil { - objectMap["provisioningState"] = ar.ProvisioningState - } - if ar.IsEnabled != nil { - objectMap["isEnabled"] = ar.IsEnabled - } - objectMap["condition"] = ar.Condition - objectMap["action"] = ar.Action - if ar.Actions != nil { - objectMap["actions"] = ar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRule struct. -func (ar *AlertRule) 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 - } - ar.Name = &name - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ar.Description = &description - } - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - ar.ProvisioningState = &provisioningState - } - case "isEnabled": - if v != nil { - var isEnabled bool - err = json.Unmarshal(*v, &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - case "condition": - if v != nil { - condition, err := unmarshalBasicRuleCondition(*v) - if err != nil { - return err - } - ar.Condition = condition - } - case "action": - if v != nil { - action, err := unmarshalBasicRuleAction(*v) - if err != nil { - return err - } - ar.Action = action - } - case "actions": - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*v) - if err != nil { - return err - } - ar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ar.LastUpdatedTime = &lastUpdatedTime - } - } - } - - return nil -} - -// AlertRuleResource the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `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"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResource. -func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.AlertRule != nil { - objectMap["properties"] = arr.AlertRule - } - if arr.Location != nil { - objectMap["location"] = arr.Location - } - if arr.Tags != nil { - objectMap["tags"] = arr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) 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 alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arr.AlertRule = &alertRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - arr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - arr.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - arr.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - arr.Etag = &etag - } - } - } - - return nil -} - -// AlertRuleResourceCollection represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AlertRuleResourcePatch the alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertRule - The properties of an alert rule. - *AlertRule `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. -func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arrp.Tags != nil { - objectMap["tags"] = arrp.Tags - } - if arrp.AlertRule != nil { - objectMap["properties"] = arrp.AlertRule - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. -func (arrp *AlertRuleResourcePatch) 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 - } - arrp.Tags = tags - } - case "properties": - if v != nil { - var alertRule AlertRule - err = json.Unmarshal(*v, &alertRule) - if err != nil { - return err - } - arrp.AlertRule = &alertRule - } - } - } - - return nil -} - -// ArmRoleReceiver an arm role receiver. -type ArmRoleReceiver struct { - // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // RoleID - The arm role id. - RoleID *string `json:"roleId,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `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"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) 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 autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - asr.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - asr.Etag = &etag - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) - if err != nil { - return err - } - page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) 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 - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzNsActionGroup azure action group -type AzNsActionGroup struct { - // ActionGroup - Azure Action Group reference. - ActionGroup *[]string `json:"actionGroup,omitempty"` - // EmailSubject - Custom subject override for all email ids in Azure action group - EmailSubject *string `json:"emailSubject,omitempty"` - // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group - CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AzureMonitorMetricsDestination azure Monitor Metrics destination. -type AzureMonitorMetricsDestination struct { - // Name - A friendly name for the destination. - // This name should be unique across all destinations (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// AzureMonitorPrivateLinkScope an Azure Monitor PrivateLinkScope definition. -type AzureMonitorPrivateLinkScope struct { - autorest.Response `json:"-"` - // AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. - *AzureMonitorPrivateLinkScopeProperties `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 AzureMonitorPrivateLinkScope. -func (ampls AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ampls.AzureMonitorPrivateLinkScopeProperties != nil { - objectMap["properties"] = ampls.AzureMonitorPrivateLinkScopeProperties - } - if ampls.Location != nil { - objectMap["location"] = ampls.Location - } - if ampls.Tags != nil { - objectMap["tags"] = ampls.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureMonitorPrivateLinkScope struct. -func (ampls *AzureMonitorPrivateLinkScope) 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 azureMonitorPrivateLinkScopeProperties AzureMonitorPrivateLinkScopeProperties - err = json.Unmarshal(*v, &azureMonitorPrivateLinkScopeProperties) - if err != nil { - return err - } - ampls.AzureMonitorPrivateLinkScopeProperties = &azureMonitorPrivateLinkScopeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ampls.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ampls.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ampls.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ampls.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ampls.Tags = tags - } - } - } - - return nil -} - -// AzureMonitorPrivateLinkScopeListResult describes the list of Azure Monitor PrivateLinkScope resources. -type AzureMonitorPrivateLinkScopeListResult struct { - autorest.Response `json:"-"` - // Value - List of Azure Monitor PrivateLinkScope definitions. - Value *[]AzureMonitorPrivateLinkScope `json:"value,omitempty"` - // NextLink - The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned in the result set. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureMonitorPrivateLinkScopeListResultIterator provides access to a complete listing of -// AzureMonitorPrivateLinkScope values. -type AzureMonitorPrivateLinkScopeListResultIterator struct { - i int - page AzureMonitorPrivateLinkScopeListResultPage -} - -// 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 *AzureMonitorPrivateLinkScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultIterator.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 *AzureMonitorPrivateLinkScopeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureMonitorPrivateLinkScopeListResultIterator) 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 AzureMonitorPrivateLinkScopeListResultIterator) Response() AzureMonitorPrivateLinkScopeListResult { - 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 AzureMonitorPrivateLinkScopeListResultIterator) Value() AzureMonitorPrivateLinkScope { - if !iter.page.NotDone() { - return AzureMonitorPrivateLinkScope{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultIterator type. -func NewAzureMonitorPrivateLinkScopeListResultIterator(page AzureMonitorPrivateLinkScopeListResultPage) AzureMonitorPrivateLinkScopeListResultIterator { - return AzureMonitorPrivateLinkScopeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (amplslr AzureMonitorPrivateLinkScopeListResult) IsEmpty() bool { - return amplslr.Value == nil || len(*amplslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (amplslr AzureMonitorPrivateLinkScopeListResult) hasNextLink() bool { - return amplslr.NextLink != nil && len(*amplslr.NextLink) != 0 -} - -// azureMonitorPrivateLinkScopeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (amplslr AzureMonitorPrivateLinkScopeListResult) azureMonitorPrivateLinkScopeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !amplslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(amplslr.NextLink))) -} - -// AzureMonitorPrivateLinkScopeListResultPage contains a page of AzureMonitorPrivateLinkScope values. -type AzureMonitorPrivateLinkScopeListResultPage struct { - fn func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error) - amplslr AzureMonitorPrivateLinkScopeListResult -} - -// 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 *AzureMonitorPrivateLinkScopeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultPage.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.amplslr) - if err != nil { - return err - } - page.amplslr = 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 *AzureMonitorPrivateLinkScopeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureMonitorPrivateLinkScopeListResultPage) NotDone() bool { - return !page.amplslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureMonitorPrivateLinkScopeListResultPage) Response() AzureMonitorPrivateLinkScopeListResult { - return page.amplslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureMonitorPrivateLinkScopeListResultPage) Values() []AzureMonitorPrivateLinkScope { - if page.amplslr.IsEmpty() { - return nil - } - return *page.amplslr.Value -} - -// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultPage type. -func NewAzureMonitorPrivateLinkScopeListResultPage(cur AzureMonitorPrivateLinkScopeListResult, getNextPage func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)) AzureMonitorPrivateLinkScopeListResultPage { - return AzureMonitorPrivateLinkScopeListResultPage{ - fn: getNextPage, - amplslr: cur, - } -} - -// AzureMonitorPrivateLinkScopeProperties properties that define a Azure Monitor PrivateLinkScope resource. -type AzureMonitorPrivateLinkScopeProperties struct { - // ProvisioningState - READ-ONLY; Current state of this PrivateLinkScope: 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 Provisioning ,Succeeded, Canceled and Failed. - ProvisioningState *string `json:"provisioningState,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScopeProperties. -func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureResource an azure resource object -type AzureResource 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"` - // Kind - READ-ONLY; Azure resource kind - Kind *string `json:"kind,omitempty"` - // Identity - READ-ONLY; Azure resource identity - Identity *string `json:"identity,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AzureResource. -func (ar AzureResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Location != nil { - objectMap["location"] = ar.Location - } - if ar.Tags != nil { - objectMap["tags"] = ar.Tags - } - return json.Marshal(objectMap) -} - -// BaselineMetadata represents a baseline metadata value. -type BaselineMetadata struct { - // Name - Name of the baseline metadata. - Name *string `json:"name,omitempty"` - // Value - Value of the baseline metadata. - Value *string `json:"value,omitempty"` -} - -// ConfigurationAccessEndpointSpec definition of the endpoint used for accessing configuration. -type ConfigurationAccessEndpointSpec struct { - // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationAccessEndpointSpec. -func (caes ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Criteria specifies the criteria for converting log to metric. -type Criteria struct { - // MetricName - Name of the metric - MetricName *string `json:"metricName,omitempty"` - // Dimensions - List of Dimensions for creating metric - Dimensions *[]Dimension `json:"dimensions,omitempty"` -} - -// DataCollectionEndpoint definition of data collection endpoint. -type DataCollectionEndpoint struct { - // Description - Description of the data collection endpoint. - Description *string `json:"description,omitempty"` - // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. - ImmutableID *string `json:"immutableId,omitempty"` - // ConfigurationAccess - The endpoint used by agents to access their configuration. - ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"` - // LogsIngestion - The endpoint used by clients to ingest logs. - LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"` - // NetworkAcls - Network access control rules for the endpoints. - NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'KnownDataCollectionEndpointProvisioningStateCreating', 'KnownDataCollectionEndpointProvisioningStateUpdating', 'KnownDataCollectionEndpointProvisioningStateDeleting', 'KnownDataCollectionEndpointProvisioningStateSucceeded', 'KnownDataCollectionEndpointProvisioningStateFailed' - ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpoint. -func (dce DataCollectionEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dce.Description != nil { - objectMap["description"] = dce.Description - } - if dce.ImmutableID != nil { - objectMap["immutableId"] = dce.ImmutableID - } - if dce.ConfigurationAccess != nil { - objectMap["configurationAccess"] = dce.ConfigurationAccess - } - if dce.LogsIngestion != nil { - objectMap["logsIngestion"] = dce.LogsIngestion - } - if dce.NetworkAcls != nil { - objectMap["networkAcls"] = dce.NetworkAcls - } - return json.Marshal(objectMap) -} - -// DataCollectionEndpointConfigurationAccess the endpoint used by agents to access their configuration. -type DataCollectionEndpointConfigurationAccess struct { - // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpointConfigurationAccess. -func (dceA DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DataCollectionEndpointLogsIngestion the endpoint used by clients to ingest logs. -type DataCollectionEndpointLogsIngestion struct { - // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpointLogsIngestion. -func (dceI DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DataCollectionEndpointNetworkAcls network access control rules for the endpoints. -type DataCollectionEndpointNetworkAcls struct { - // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'KnownPublicNetworkAccessOptionsEnabled', 'KnownPublicNetworkAccessOptionsDisabled' - PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` -} - -// DataCollectionEndpointResource definition of ARM tracked top level resource. -type DataCollectionEndpointResource struct { - autorest.Response `json:"-"` - // DataCollectionEndpointResourceProperties - Resource properties. - *DataCollectionEndpointResourceProperties `json:"properties,omitempty"` - // Location - The geo-location where the resource lives. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Kind - The kind of the resource. Possible values include: 'KnownDataCollectionEndpointResourceKindLinux', 'KnownDataCollectionEndpointResourceKindWindows' - Kind KnownDataCollectionEndpointResourceKind `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified 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; Resource entity tag (ETag). - Etag *string `json:"etag,omitempty"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionEndpointResourceSystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpointResource. -func (dcer DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcer.DataCollectionEndpointResourceProperties != nil { - objectMap["properties"] = dcer.DataCollectionEndpointResourceProperties - } - if dcer.Location != nil { - objectMap["location"] = dcer.Location - } - if dcer.Tags != nil { - objectMap["tags"] = dcer.Tags - } - if dcer.Kind != "" { - objectMap["kind"] = dcer.Kind - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataCollectionEndpointResource struct. -func (dcer *DataCollectionEndpointResource) 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 dataCollectionEndpointResourceProperties DataCollectionEndpointResourceProperties - err = json.Unmarshal(*v, &dataCollectionEndpointResourceProperties) - if err != nil { - return err - } - dcer.DataCollectionEndpointResourceProperties = &dataCollectionEndpointResourceProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dcer.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcer.Tags = tags - } - case "kind": - if v != nil { - var kind KnownDataCollectionEndpointResourceKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dcer.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcer.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcer.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcer.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dcer.Etag = &etag - } - case "systemData": - if v != nil { - var systemData DataCollectionEndpointResourceSystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - dcer.SystemData = &systemData - } - } - } - - return nil -} - -// DataCollectionEndpointResourceListResult a pageable list of resources. -type DataCollectionEndpointResourceListResult struct { - autorest.Response `json:"-"` - // Value - A list of resources. - Value *[]DataCollectionEndpointResource `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DataCollectionEndpointResourceListResultIterator provides access to a complete listing of -// DataCollectionEndpointResource values. -type DataCollectionEndpointResourceListResultIterator struct { - i int - page DataCollectionEndpointResourceListResultPage -} - -// 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 *DataCollectionEndpointResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultIterator.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 *DataCollectionEndpointResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DataCollectionEndpointResourceListResultIterator) 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 DataCollectionEndpointResourceListResultIterator) Response() DataCollectionEndpointResourceListResult { - 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 DataCollectionEndpointResourceListResultIterator) Value() DataCollectionEndpointResource { - if !iter.page.NotDone() { - return DataCollectionEndpointResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DataCollectionEndpointResourceListResultIterator type. -func NewDataCollectionEndpointResourceListResultIterator(page DataCollectionEndpointResourceListResultPage) DataCollectionEndpointResourceListResultIterator { - return DataCollectionEndpointResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dcerlr DataCollectionEndpointResourceListResult) IsEmpty() bool { - return dcerlr.Value == nil || len(*dcerlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dcerlr DataCollectionEndpointResourceListResult) hasNextLink() bool { - return dcerlr.NextLink != nil && len(*dcerlr.NextLink) != 0 -} - -// dataCollectionEndpointResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dcerlr DataCollectionEndpointResourceListResult) dataCollectionEndpointResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dcerlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dcerlr.NextLink))) -} - -// DataCollectionEndpointResourceListResultPage contains a page of DataCollectionEndpointResource values. -type DataCollectionEndpointResourceListResultPage struct { - fn func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error) - dcerlr DataCollectionEndpointResourceListResult -} - -// 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 *DataCollectionEndpointResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultPage.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.dcerlr) - if err != nil { - return err - } - page.dcerlr = 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 *DataCollectionEndpointResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DataCollectionEndpointResourceListResultPage) NotDone() bool { - return !page.dcerlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DataCollectionEndpointResourceListResultPage) Response() DataCollectionEndpointResourceListResult { - return page.dcerlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DataCollectionEndpointResourceListResultPage) Values() []DataCollectionEndpointResource { - if page.dcerlr.IsEmpty() { - return nil - } - return *page.dcerlr.Value -} - -// Creates a new instance of the DataCollectionEndpointResourceListResultPage type. -func NewDataCollectionEndpointResourceListResultPage(cur DataCollectionEndpointResourceListResult, getNextPage func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error)) DataCollectionEndpointResourceListResultPage { - return DataCollectionEndpointResourceListResultPage{ - fn: getNextPage, - dcerlr: cur, - } -} - -// DataCollectionEndpointResourceProperties resource properties. -type DataCollectionEndpointResourceProperties struct { - // Description - Description of the data collection endpoint. - Description *string `json:"description,omitempty"` - // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. - ImmutableID *string `json:"immutableId,omitempty"` - // ConfigurationAccess - The endpoint used by agents to access their configuration. - ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"` - // LogsIngestion - The endpoint used by clients to ingest logs. - LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"` - // NetworkAcls - Network access control rules for the endpoints. - NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'KnownDataCollectionEndpointProvisioningStateCreating', 'KnownDataCollectionEndpointProvisioningStateUpdating', 'KnownDataCollectionEndpointProvisioningStateDeleting', 'KnownDataCollectionEndpointProvisioningStateSucceeded', 'KnownDataCollectionEndpointProvisioningStateFailed' - ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionEndpointResourceProperties. -func (dcer DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcer.Description != nil { - objectMap["description"] = dcer.Description - } - if dcer.ImmutableID != nil { - objectMap["immutableId"] = dcer.ImmutableID - } - if dcer.ConfigurationAccess != nil { - objectMap["configurationAccess"] = dcer.ConfigurationAccess - } - if dcer.LogsIngestion != nil { - objectMap["logsIngestion"] = dcer.LogsIngestion - } - if dcer.NetworkAcls != nil { - objectMap["networkAcls"] = dcer.NetworkAcls - } - return json.Marshal(objectMap) -} - -// DataCollectionEndpointResourceSystemData metadata pertaining to creation and last modification of the -// resource. -type DataCollectionEndpointResourceSystemData 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"` -} - -// DataCollectionRule definition of what monitoring data to collect and where that data should be sent. -type DataCollectionRule struct { - // Description - Description of the data collection rule. - Description *string `json:"description,omitempty"` - // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. - ImmutableID *string `json:"immutableId,omitempty"` - // DataSources - The specification of data sources. - // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"` - // Destinations - The specification of destinations. - Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"` - // DataFlows - The specification of data flows. - DataFlows *[]DataFlow `json:"dataFlows,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' - ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRule. -func (dcr DataCollectionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcr.Description != nil { - objectMap["description"] = dcr.Description - } - if dcr.DataSources != nil { - objectMap["dataSources"] = dcr.DataSources - } - if dcr.Destinations != nil { - objectMap["destinations"] = dcr.Destinations - } - if dcr.DataFlows != nil { - objectMap["dataFlows"] = dcr.DataFlows - } - return json.Marshal(objectMap) -} - -// DataCollectionRuleAssociation definition of association of a data collection rule with a monitored Azure -// resource. -type DataCollectionRuleAssociation struct { - // Description - Description of the association. - Description *string `json:"description,omitempty"` - // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. - DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` - // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. - DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' - ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleAssociation. -func (dcra DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcra.Description != nil { - objectMap["description"] = dcra.Description - } - if dcra.DataCollectionRuleID != nil { - objectMap["dataCollectionRuleId"] = dcra.DataCollectionRuleID - } - if dcra.DataCollectionEndpointID != nil { - objectMap["dataCollectionEndpointId"] = dcra.DataCollectionEndpointID - } - return json.Marshal(objectMap) -} - -// DataCollectionRuleAssociationProxyOnlyResource definition of generic ARM proxy resource. -type DataCollectionRuleAssociationProxyOnlyResource struct { - autorest.Response `json:"-"` - // DataCollectionRuleAssociationProxyOnlyResourceProperties - Resource properties. - *DataCollectionRuleAssociationProxyOnlyResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified 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; Resource entity tag (ETag). - Etag *string `json:"etag,omitempty"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionRuleAssociationProxyOnlyResourceSystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleAssociationProxyOnlyResource. -func (dcrapor DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties != nil { - objectMap["properties"] = dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataCollectionRuleAssociationProxyOnlyResource struct. -func (dcrapor *DataCollectionRuleAssociationProxyOnlyResource) 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 dataCollectionRuleAssociationProxyOnlyResourceProperties DataCollectionRuleAssociationProxyOnlyResourceProperties - err = json.Unmarshal(*v, &dataCollectionRuleAssociationProxyOnlyResourceProperties) - if err != nil { - return err - } - dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties = &dataCollectionRuleAssociationProxyOnlyResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcrapor.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcrapor.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcrapor.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dcrapor.Etag = &etag - } - case "systemData": - if v != nil { - var systemData DataCollectionRuleAssociationProxyOnlyResourceSystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - dcrapor.SystemData = &systemData - } - } - } - - return nil -} - -// DataCollectionRuleAssociationProxyOnlyResourceListResult a pageable list of resources. -type DataCollectionRuleAssociationProxyOnlyResourceListResult struct { - autorest.Response `json:"-"` - // Value - A list of resources. - Value *[]DataCollectionRuleAssociationProxyOnlyResource `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DataCollectionRuleAssociationProxyOnlyResourceListResultIterator provides access to a complete listing -// of DataCollectionRuleAssociationProxyOnlyResource values. -type DataCollectionRuleAssociationProxyOnlyResourceListResultIterator struct { - i int - page DataCollectionRuleAssociationProxyOnlyResourceListResultPage -} - -// 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 *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultIterator.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 *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) 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 DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult { - 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 DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Value() DataCollectionRuleAssociationProxyOnlyResource { - if !iter.page.NotDone() { - return DataCollectionRuleAssociationProxyOnlyResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DataCollectionRuleAssociationProxyOnlyResourceListResultIterator type. -func NewDataCollectionRuleAssociationProxyOnlyResourceListResultIterator(page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) DataCollectionRuleAssociationProxyOnlyResourceListResultIterator { - return DataCollectionRuleAssociationProxyOnlyResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) IsEmpty() bool { - return dcraporlr.Value == nil || len(*dcraporlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) hasNextLink() bool { - return dcraporlr.NextLink != nil && len(*dcraporlr.NextLink) != 0 -} - -// dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dcraporlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dcraporlr.NextLink))) -} - -// DataCollectionRuleAssociationProxyOnlyResourceListResultPage contains a page of -// DataCollectionRuleAssociationProxyOnlyResource values. -type DataCollectionRuleAssociationProxyOnlyResourceListResultPage struct { - fn func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error) - dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult -} - -// 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 *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultPage.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.dcraporlr) - if err != nil { - return err - } - page.dcraporlr = 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 *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NotDone() bool { - return !page.dcraporlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult { - return page.dcraporlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Values() []DataCollectionRuleAssociationProxyOnlyResource { - if page.dcraporlr.IsEmpty() { - return nil - } - return *page.dcraporlr.Value -} - -// Creates a new instance of the DataCollectionRuleAssociationProxyOnlyResourceListResultPage type. -func NewDataCollectionRuleAssociationProxyOnlyResourceListResultPage(cur DataCollectionRuleAssociationProxyOnlyResourceListResult, getNextPage func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error)) DataCollectionRuleAssociationProxyOnlyResourceListResultPage { - return DataCollectionRuleAssociationProxyOnlyResourceListResultPage{ - fn: getNextPage, - dcraporlr: cur, - } -} - -// DataCollectionRuleAssociationProxyOnlyResourceProperties resource properties. -type DataCollectionRuleAssociationProxyOnlyResourceProperties struct { - // Description - Description of the association. - Description *string `json:"description,omitempty"` - // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. - DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` - // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. - DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' - ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleAssociationProxyOnlyResourceProperties. -func (dcrapor DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcrapor.Description != nil { - objectMap["description"] = dcrapor.Description - } - if dcrapor.DataCollectionRuleID != nil { - objectMap["dataCollectionRuleId"] = dcrapor.DataCollectionRuleID - } - if dcrapor.DataCollectionEndpointID != nil { - objectMap["dataCollectionEndpointId"] = dcrapor.DataCollectionEndpointID - } - return json.Marshal(objectMap) -} - -// DataCollectionRuleAssociationProxyOnlyResourceSystemData metadata pertaining to creation and last -// modification of the resource. -type DataCollectionRuleAssociationProxyOnlyResourceSystemData 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"` -} - -// DataCollectionRuleDataSources the specification of data sources. -// This property is optional and can be omitted if the rule is meant to be used via direct calls to the -// provisioned endpoint. -type DataCollectionRuleDataSources struct { - // PerformanceCounters - The list of performance counter data source configurations. - PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` - // WindowsEventLogs - The list of Windows Event Log data source configurations. - WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` - // Syslog - The list of Syslog data source configurations. - Syslog *[]SyslogDataSource `json:"syslog,omitempty"` - // Extensions - The list of Azure VM extension data source configurations. - Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` -} - -// DataCollectionRuleDestinations the specification of destinations. -type DataCollectionRuleDestinations struct { - // LogAnalytics - List of Log Analytics destinations. - LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` - // AzureMonitorMetrics - Azure Monitor Metrics destination. - AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` -} - -// DataCollectionRuleResource definition of ARM tracked top level resource. -type DataCollectionRuleResource struct { - autorest.Response `json:"-"` - // DataCollectionRuleResourceProperties - Resource properties. - *DataCollectionRuleResourceProperties `json:"properties,omitempty"` - // Location - The geo-location where the resource lives. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Kind - The kind of the resource. Possible values include: 'KnownDataCollectionRuleResourceKindLinux', 'KnownDataCollectionRuleResourceKindWindows' - Kind KnownDataCollectionRuleResourceKind `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified 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; Resource entity tag (ETag). - Etag *string `json:"etag,omitempty"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionRuleResourceSystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleResource. -func (dcrr DataCollectionRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcrr.DataCollectionRuleResourceProperties != nil { - objectMap["properties"] = dcrr.DataCollectionRuleResourceProperties - } - if dcrr.Location != nil { - objectMap["location"] = dcrr.Location - } - if dcrr.Tags != nil { - objectMap["tags"] = dcrr.Tags - } - if dcrr.Kind != "" { - objectMap["kind"] = dcrr.Kind - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataCollectionRuleResource struct. -func (dcrr *DataCollectionRuleResource) 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 dataCollectionRuleResourceProperties DataCollectionRuleResourceProperties - err = json.Unmarshal(*v, &dataCollectionRuleResourceProperties) - if err != nil { - return err - } - dcrr.DataCollectionRuleResourceProperties = &dataCollectionRuleResourceProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dcrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcrr.Tags = tags - } - case "kind": - if v != nil { - var kind KnownDataCollectionRuleResourceKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dcrr.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcrr.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dcrr.Etag = &etag - } - case "systemData": - if v != nil { - var systemData DataCollectionRuleResourceSystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - dcrr.SystemData = &systemData - } - } - } - - return nil -} - -// DataCollectionRuleResourceListResult a pageable list of resources. -type DataCollectionRuleResourceListResult struct { - autorest.Response `json:"-"` - // Value - A list of resources. - Value *[]DataCollectionRuleResource `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DataCollectionRuleResourceListResultIterator provides access to a complete listing of -// DataCollectionRuleResource values. -type DataCollectionRuleResourceListResultIterator struct { - i int - page DataCollectionRuleResourceListResultPage -} - -// 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 *DataCollectionRuleResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultIterator.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 *DataCollectionRuleResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DataCollectionRuleResourceListResultIterator) 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 DataCollectionRuleResourceListResultIterator) Response() DataCollectionRuleResourceListResult { - 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 DataCollectionRuleResourceListResultIterator) Value() DataCollectionRuleResource { - if !iter.page.NotDone() { - return DataCollectionRuleResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DataCollectionRuleResourceListResultIterator type. -func NewDataCollectionRuleResourceListResultIterator(page DataCollectionRuleResourceListResultPage) DataCollectionRuleResourceListResultIterator { - return DataCollectionRuleResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dcrrlr DataCollectionRuleResourceListResult) IsEmpty() bool { - return dcrrlr.Value == nil || len(*dcrrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dcrrlr DataCollectionRuleResourceListResult) hasNextLink() bool { - return dcrrlr.NextLink != nil && len(*dcrrlr.NextLink) != 0 -} - -// dataCollectionRuleResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dcrrlr DataCollectionRuleResourceListResult) dataCollectionRuleResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dcrrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dcrrlr.NextLink))) -} - -// DataCollectionRuleResourceListResultPage contains a page of DataCollectionRuleResource values. -type DataCollectionRuleResourceListResultPage struct { - fn func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error) - dcrrlr DataCollectionRuleResourceListResult -} - -// 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 *DataCollectionRuleResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultPage.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.dcrrlr) - if err != nil { - return err - } - page.dcrrlr = 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 *DataCollectionRuleResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DataCollectionRuleResourceListResultPage) NotDone() bool { - return !page.dcrrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DataCollectionRuleResourceListResultPage) Response() DataCollectionRuleResourceListResult { - return page.dcrrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DataCollectionRuleResourceListResultPage) Values() []DataCollectionRuleResource { - if page.dcrrlr.IsEmpty() { - return nil - } - return *page.dcrrlr.Value -} - -// Creates a new instance of the DataCollectionRuleResourceListResultPage type. -func NewDataCollectionRuleResourceListResultPage(cur DataCollectionRuleResourceListResult, getNextPage func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error)) DataCollectionRuleResourceListResultPage { - return DataCollectionRuleResourceListResultPage{ - fn: getNextPage, - dcrrlr: cur, - } -} - -// DataCollectionRuleResourceProperties resource properties. -type DataCollectionRuleResourceProperties struct { - // Description - Description of the data collection rule. - Description *string `json:"description,omitempty"` - // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. - ImmutableID *string `json:"immutableId,omitempty"` - // DataSources - The specification of data sources. - // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. - DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"` - // Destinations - The specification of destinations. - Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"` - // DataFlows - The specification of data flows. - DataFlows *[]DataFlow `json:"dataFlows,omitempty"` - // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' - ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataCollectionRuleResourceProperties. -func (dcrr DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcrr.Description != nil { - objectMap["description"] = dcrr.Description - } - if dcrr.DataSources != nil { - objectMap["dataSources"] = dcrr.DataSources - } - if dcrr.Destinations != nil { - objectMap["destinations"] = dcrr.Destinations - } - if dcrr.DataFlows != nil { - objectMap["dataFlows"] = dcrr.DataFlows - } - return json.Marshal(objectMap) -} - -// DataCollectionRuleResourceSystemData metadata pertaining to creation and last modification of the -// resource. -type DataCollectionRuleResourceSystemData 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"` -} - -// DataContainer information about a container with data for a given resource. -type DataContainer struct { - // Workspace - Log Analytics workspace information. - Workspace *WorkspaceInfo `json:"workspace,omitempty"` -} - -// DataFlow definition of which streams are sent to which destinations. -type DataFlow struct { - // Streams - List of streams for this data flow. - Streams *[]KnownDataFlowStreams `json:"streams,omitempty"` - // Destinations - List of destinations for this data flow. - Destinations *[]string `json:"destinations,omitempty"` -} - -// DataSourcesSpec specification of data sources that will be collected. -type DataSourcesSpec struct { - // PerformanceCounters - The list of performance counter data source configurations. - PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` - // WindowsEventLogs - The list of Windows Event Log data source configurations. - WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` - // Syslog - The list of Syslog data source configurations. - Syslog *[]SyslogDataSource `json:"syslog,omitempty"` - // Extensions - The list of Azure VM extension data source configurations. - Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` -} - -// DestinationsSpec specification of destinations that can be used in data flows. -type DestinationsSpec struct { - // LogAnalytics - List of Log Analytics destinations. - LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` - // AzureMonitorMetrics - Azure Monitor Metrics destination. - AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` -} - -// DestinationsSpecAzureMonitorMetrics azure Monitor Metrics destination. -type DestinationsSpecAzureMonitorMetrics struct { - // Name - A friendly name for the destination. - // This name should be unique across all destinations (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// DiagnosticSettings the diagnostic settings. -type DiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// DiagnosticSettingsCategory the diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'CategoryTypeMetrics', 'CategoryTypeLogs' - CategoryType CategoryType `json:"categoryType,omitempty"` -} - -// DiagnosticSettingsCategoryResource the diagnostic settings category resource. -type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` - // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. - *DiagnosticSettingsCategory `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. -func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dscr.DiagnosticSettingsCategory != nil { - objectMap["properties"] = dscr.DiagnosticSettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. -func (dscr *DiagnosticSettingsCategoryResource) 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 diagnosticSettingsCategory DiagnosticSettingsCategory - err = json.Unmarshal(*v, &diagnosticSettingsCategory) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dscr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category -// resources. -type DiagnosticSettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` -} - -// DiagnosticSettingsResource the diagnostic setting resource. -type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // DiagnosticSettings - Properties of a Diagnostic Settings Resource. - *DiagnosticSettings `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"` -} - -// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. -func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DiagnosticSettings != nil { - objectMap["properties"] = dsr.DiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. -func (dsr *DiagnosticSettingsResource) 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 diagnosticSettings DiagnosticSettings - err = json.Unmarshal(*v, &diagnosticSettings) - if err != nil { - return err - } - dsr.DiagnosticSettings = &diagnosticSettings - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - } - } - - return nil -} - -// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]DiagnosticSettingsResource `json:"value,omitempty"` -} - -// Dimension specifies the criteria for converting log to metric. -type Dimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // Operator - Operator for dimension values - Operator *string `json:"operator,omitempty"` - // Values - List of dimension values - Values *[]string `json:"values,omitempty"` -} - -// DynamicMetricCriteria criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' - Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' - AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` - // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` - // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) - IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' - TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - dmc.CriterionType = CriterionTypeDynamicThresholdCriterion - objectMap := make(map[string]interface{}) - if dmc.Operator != "" { - objectMap["operator"] = dmc.Operator - } - if dmc.AlertSensitivity != "" { - objectMap["alertSensitivity"] = dmc.AlertSensitivity - } - if dmc.FailingPeriods != nil { - objectMap["failingPeriods"] = dmc.FailingPeriods - } - if dmc.IgnoreDataBefore != nil { - objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore - } - if dmc.Name != nil { - objectMap["name"] = dmc.Name - } - if dmc.MetricName != nil { - objectMap["metricName"] = dmc.MetricName - } - if dmc.MetricNamespace != nil { - objectMap["metricNamespace"] = dmc.MetricNamespace - } - if dmc.TimeAggregation != "" { - objectMap["timeAggregation"] = dmc.TimeAggregation - } - if dmc.Dimensions != nil { - objectMap["dimensions"] = dmc.Dimensions - } - if dmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = dmc.SkipMetricValidation - } - if dmc.CriterionType != "" { - objectMap["criterionType"] = dmc.CriterionType - } - for k, v := range dmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return &dmc, true -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &dmc, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. -func (dmc *DynamicMetricCriteria) 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 "operator": - if v != nil { - var operator DynamicThresholdOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - dmc.Operator = operator - } - case "alertSensitivity": - if v != nil { - var alertSensitivity DynamicThresholdSensitivity - err = json.Unmarshal(*v, &alertSensitivity) - if err != nil { - return err - } - dmc.AlertSensitivity = alertSensitivity - } - case "failingPeriods": - if v != nil { - var failingPeriods DynamicThresholdFailingPeriods - err = json.Unmarshal(*v, &failingPeriods) - if err != nil { - return err - } - dmc.FailingPeriods = &failingPeriods - } - case "ignoreDataBefore": - if v != nil { - var ignoreDataBefore date.Time - err = json.Unmarshal(*v, &ignoreDataBefore) - if err != nil { - return err - } - dmc.IgnoreDataBefore = &ignoreDataBefore - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if dmc.AdditionalProperties == nil { - dmc.AdditionalProperties = make(map[string]interface{}) - } - dmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - dmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - dmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation AggregationTypeEnum - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - dmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - dmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - dmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - dmc.CriterionType = criterionType - } - } - } - - return nil -} - -// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback -// time window required to raise an alert. -type DynamicThresholdFailingPeriods struct { - // NumberOfEvaluationPeriods - The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. - NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` - // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - if er.UseCommonAlertSchema != nil { - objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// Error error details. -type Error struct { - // Code - Error code identifying the specific error. - Code *string `json:"code,omitempty"` - // Message - Error message in the caller's locale. - Message *string `json:"message,omitempty"` -} - -// 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) -} - -// ErrorContract describes the format of Error response. -type ErrorContract struct { - // Error - The error details. - Error *ErrorResponse `json:"error,omitempty"` -} - -// 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 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"` -} - -// ErrorResponseCommon the resource management error response. -type ErrorResponseCommon struct { - // Details - READ-ONLY; The error details. - Details *[]ErrorResponseCommon `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponseCommon. -func (erc ErrorResponseCommon) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erc.Code != nil { - objectMap["code"] = erc.Code - } - if erc.Message != nil { - objectMap["message"] = erc.Message - } - return json.Marshal(objectMap) -} - -// ErrorResponseCommonV2 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 ErrorResponseCommonV2 struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, -// Security, ServiceHealth, Alert, Recommendation, Policy. -type EventCategoryCollection struct { - autorest.Response `json:"-"` - // Value - the list that includes the Azure event categories. - Value *[]LocalizableString `json:"value,omitempty"` -} - -// EventData the Azure event log entries are of type EventData -type EventData struct { - // Authorization - READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization `json:"authorization,omitempty"` - // Claims - READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string `json:"claims"` - // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string `json:"caller,omitempty"` - // Description - READ-ONLY; the description of the event. - Description *string `json:"description,omitempty"` - // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string `json:"id,omitempty"` - // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string `json:"eventDataId,omitempty"` - // CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. - CorrelationID *string `json:"correlationId,omitempty"` - // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. - EventName *LocalizableString `json:"eventName,omitempty"` - // Category - READ-ONLY; the event category. - Category *LocalizableString `json:"category,omitempty"` - // HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). - HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` - // Level - READ-ONLY; the event level. Possible values include: 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' - Level EventLevel `json:"level,omitempty"` - // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` - // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - READ-ONLY; the resource type - ResourceType *LocalizableString `json:"resourceType,omitempty"` - // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. - OperationID *string `json:"operationId,omitempty"` - // OperationName - READ-ONLY; the operation name. - OperationName *LocalizableString `json:"operationName,omitempty"` - // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string `json:"properties"` - // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - Status *LocalizableString `json:"status,omitempty"` - // SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) - SubStatus *LocalizableString `json:"subStatus,omitempty"` - // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. - EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` - // SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. - SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` - // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // TenantID - READ-ONLY; the Azure tenant Id - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventData. -func (ed EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EventDataCollection represents collection of events. -type EventDataCollection struct { - autorest.Response `json:"-"` - // Value - this list that includes the Azure audit logs. - Value *[]EventData `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of events. - NextLink *string `json:"nextLink,omitempty"` -} - -// EventDataCollectionIterator provides access to a complete listing of EventData values. -type EventDataCollectionIterator struct { - i int - page EventDataCollectionPage -} - -// 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 *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.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 *EventDataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EventDataCollectionIterator) 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 EventDataCollectionIterator) Response() EventDataCollection { - 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 EventDataCollectionIterator) Value() EventData { - if !iter.page.NotDone() { - return EventData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EventDataCollectionIterator type. -func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { - return EventDataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edc EventDataCollection) IsEmpty() bool { - return edc.Value == nil || len(*edc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edc EventDataCollection) hasNextLink() bool { - return edc.NextLink != nil && len(*edc.NextLink) != 0 -} - -// eventDataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !edc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edc.NextLink))) -} - -// EventDataCollectionPage contains a page of EventData values. -type EventDataCollectionPage struct { - fn func(context.Context, EventDataCollection) (EventDataCollection, error) - edc EventDataCollection -} - -// 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 *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.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.edc) - if err != nil { - return err - } - page.edc = 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 *EventDataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EventDataCollectionPage) NotDone() bool { - return !page.edc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EventDataCollectionPage) Response() EventDataCollection { - return page.edc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EventDataCollectionPage) Values() []EventData { - if page.edc.IsEmpty() { - return nil - } - return *page.edc.Value -} - -// Creates a new instance of the EventDataCollectionPage type. -func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { - return EventDataCollectionPage{ - fn: getNextPage, - edc: cur, - } -} - -// ExtensionDataSource definition of which data will be collected from a separate VM extension that -// integrates with the Azure Monitor Agent. -// Collected from either Windows and Linux machines, depending on which extension is defined. -type ExtensionDataSource struct { - // Streams - List of streams that this data source will be sent to. - // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - Streams *[]KnownExtensionDataSourceStreams `json:"streams,omitempty"` - // ExtensionName - The name of the VM extension. - ExtensionName *string `json:"extensionName,omitempty"` - // ExtensionSettings - The extension settings. The format is specific for particular extension. - ExtensionSettings interface{} `json:"extensionSettings,omitempty"` - // InputDataSources - The list of data sources this extension needs data from. - InputDataSources *[]string `json:"inputDataSources,omitempty"` - // Name - A friendly name for the data source. - // This name should be unique across all data sources (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// HTTPRequestInfo the Http request info. -type HTTPRequestInfo struct { - // ClientRequestID - the client request id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ClientIPAddress - the client Ip Address - ClientIPAddress *string `json:"clientIpAddress,omitempty"` - // Method - the Http request method. - Method *string `json:"method,omitempty"` - // URI - the Uri. - URI *string `json:"uri,omitempty"` -} - -// Incident an alert incident indicates the activation status of an alert rule. -type Incident struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Incident name. - Name *string `json:"name,omitempty"` - // RuleName - READ-ONLY; Rule name that is associated with the incident. - RuleName *string `json:"ruleName,omitempty"` - // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool `json:"isActive,omitempty"` - // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IncidentListResult the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - // Value - the incident collection. - Value *[]Incident `json:"value,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // FailedLocationCount - the number of locations that must fail to activate the alert. - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - ltrc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - objectMap := make(map[string]interface{}) - if ltrc.WindowSize != nil { - objectMap["windowSize"] = ltrc.WindowSize - } - if ltrc.FailedLocationCount != nil { - objectMap["failedLocationCount"] = ltrc.FailedLocationCount - } - objectMap["dataSource"] = ltrc.DataSource - if ltrc.OdataType != "" { - objectMap["odata.type"] = ltrc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return <rc, true -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. -func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return <rc, true -} - -// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. -func (ltrc *LocationThresholdRuleCondition) 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 "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - case "failedLocationCount": - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - ltrc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ltrc.OdataType = odataType - } - } - } - - return nil -} - -// LogAnalyticsDestination log Analytics destination. -type LogAnalyticsDestination struct { - // WorkspaceResourceID - The resource ID of the Log Analytics workspace. - WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` - // WorkspaceID - READ-ONLY; The Customer ID of the Log Analytics workspace. - WorkspaceID *string `json:"workspaceId,omitempty"` - // Name - A friendly name for the destination. - // This name should be unique across all destinations (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogAnalyticsDestination. -func (lad LogAnalyticsDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lad.WorkspaceResourceID != nil { - objectMap["workspaceResourceId"] = lad.WorkspaceResourceID - } - if lad.Name != nil { - objectMap["name"] = lad.Name - } - return json.Marshal(objectMap) -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// LogMetricTrigger a log metrics trigger descriptor. -type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - The threshold of the metric trigger. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' - MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` - // MetricColumn - Evaluation of metric on a particular column - MetricColumn *string `json:"metricColumn,omitempty"` -} - -// LogProfileCollection represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - // Value - the values of the log profiles. - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties the log profile properties. -type LogProfileProperties struct { - // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. - Locations *[]string `json:"locations,omitempty"` - // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' - Categories *[]string `json:"categories,omitempty"` - // RetentionPolicy - the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `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"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResource. -func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpr.LogProfileProperties != nil { - objectMap["properties"] = lpr.LogProfileProperties - } - if lpr.Location != nil { - objectMap["location"] = lpr.Location - } - if lpr.Tags != nil { - objectMap["tags"] = lpr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) 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 logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lpr.LogProfileProperties = &logProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lpr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lpr.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - lpr.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lpr.Etag = &etag - } - } - } - - return nil -} - -// LogProfileResourcePatch the log profile resource for patch operations. -type LogProfileResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogProfileProperties - The log profile properties for an update operation. - *LogProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogProfileResourcePatch. -func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lprp.Tags != nil { - objectMap["tags"] = lprp.Tags - } - if lprp.LogProfileProperties != nil { - objectMap["properties"] = lprp.LogProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. -func (lprp *LogProfileResourcePatch) 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 - } - lprp.Tags = tags - } - case "properties": - if v != nil { - var logProfileProperties LogProfileProperties - err = json.Unmarshal(*v, &logProfileProperties) - if err != nil { - return err - } - lprp.LogProfileProperties = &logProfileProperties - } - } - } - - return nil -} - -// LogSearchRule log Search Rule Definition -type LogSearchRule struct { - // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule - CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` - // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule - IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` - // Description - The description of the Log Search rule. - Description *string `json:"description,omitempty"` - // DisplayName - The display name of the alert rule - DisplayName *string `json:"displayName,omitempty"` - // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'EnabledTrue', 'EnabledFalse' - Enabled Enabled `json:"enabled,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateDeploying', 'ProvisioningStateCanceled', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Source - Data Source against which rule will Query Data - Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule *Schedule `json:"schedule,omitempty"` - // Action - Action needs to be taken on rule execution. - Action BasicAction `json:"action,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRule. -func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsr.Description != nil { - objectMap["description"] = lsr.Description - } - if lsr.DisplayName != nil { - objectMap["displayName"] = lsr.DisplayName - } - if lsr.AutoMitigate != nil { - objectMap["autoMitigate"] = lsr.AutoMitigate - } - if lsr.Enabled != "" { - objectMap["enabled"] = lsr.Enabled - } - if lsr.Source != nil { - objectMap["source"] = lsr.Source - } - if lsr.Schedule != nil { - objectMap["schedule"] = lsr.Schedule - } - objectMap["action"] = lsr.Action - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. -func (lsr *LogSearchRule) 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 "createdWithApiVersion": - if v != nil { - var createdWithAPIVersion string - err = json.Unmarshal(*v, &createdWithAPIVersion) - if err != nil { - return err - } - lsr.CreatedWithAPIVersion = &createdWithAPIVersion - } - case "isLegacyLogAnalyticsRule": - if v != nil { - var isLegacyLogAnalyticsRule bool - err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) - if err != nil { - return err - } - lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - lsr.Description = &description - } - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - lsr.DisplayName = &displayName - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - lsr.AutoMitigate = &autoMitigate - } - case "enabled": - if v != nil { - var enabled Enabled - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - lsr.Enabled = enabled - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - lsr.LastUpdatedTime = &lastUpdatedTime - } - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - lsr.ProvisioningState = provisioningState - } - case "source": - if v != nil { - var source Source - err = json.Unmarshal(*v, &source) - if err != nil { - return err - } - lsr.Source = &source - } - case "schedule": - if v != nil { - var schedule Schedule - err = json.Unmarshal(*v, &schedule) - if err != nil { - return err - } - lsr.Schedule = &schedule - } - case "action": - if v != nil { - action, err := unmarshalBasicAction(*v) - if err != nil { - return err - } - lsr.Action = action - } - } - } - - return nil -} - -// LogSearchRulePatch log Search Rule Definition for Patching -type LogSearchRulePatch struct { - // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'EnabledTrue', 'EnabledFalse' - Enabled Enabled `json:"enabled,omitempty"` -} - -// LogSearchRuleResource the Log Search Rule resource. -type LogSearchRuleResource struct { - autorest.Response `json:"-"` - // LogSearchRule - The rule properties of the resource. - *LogSearchRule `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"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResource. -func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrr.LogSearchRule != nil { - objectMap["properties"] = lsrr.LogSearchRule - } - if lsrr.Location != nil { - objectMap["location"] = lsrr.Location - } - if lsrr.Tags != nil { - objectMap["tags"] = lsrr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. -func (lsrr *LogSearchRuleResource) 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 logSearchRule LogSearchRule - err = json.Unmarshal(*v, &logSearchRule) - if err != nil { - return err - } - lsrr.LogSearchRule = &logSearchRule - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lsrr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lsrr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lsrr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lsrr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lsrr.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - lsrr.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lsrr.Etag = &etag - } - } - } - - return nil -} - -// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. -type LogSearchRuleResourceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the Log Search Rule resources. - Value *[]LogSearchRuleResource `json:"value,omitempty"` -} - -// LogSearchRuleResourcePatch the log search rule resource for patch operations. -type LogSearchRuleResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // LogSearchRulePatch - The log search rule properties of the resource. - *LogSearchRulePatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. -func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsrrp.Tags != nil { - objectMap["tags"] = lsrrp.Tags - } - if lsrrp.LogSearchRulePatch != nil { - objectMap["properties"] = lsrrp.LogSearchRulePatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. -func (lsrrp *LogSearchRuleResourcePatch) 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 - } - lsrrp.Tags = tags - } - case "properties": - if v != nil { - var logSearchRulePatch LogSearchRulePatch - err = json.Unmarshal(*v, &logSearchRulePatch) - if err != nil { - return err - } - lsrrp.LogSearchRulePatch = &logSearchRulePatch - } - } - } - - return nil -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogsIngestionEndpointSpec definition of the endpoint used for ingesting logs. -type LogsIngestionEndpointSpec struct { - // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string `json:"endpoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogsIngestionEndpointSpec. -func (lies LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LogToMetricAction specify action need to be taken when rule type is converting log to metric -type LogToMetricAction struct { - // Criteria - Criteria of Metric - Criteria *[]Criteria `json:"criteria,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' - OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogToMetricAction. -func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { - ltma.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction - objectMap := make(map[string]interface{}) - if ltma.Criteria != nil { - objectMap["criteria"] = ltma.Criteria - } - if ltma.OdataType != "" { - objectMap["odata.type"] = ltma.OdataType - } - return json.Marshal(objectMap) -} - -// AsAlertingAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { - return nil, false -} - -// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { - return <ma, true -} - -// AsAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsAction() (*Action, bool) { - return nil, false -} - -// AsBasicAction is the BasicAction implementation for LogToMetricAction. -func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { - return <ma, true -} - -// ManagementEventAggregationCondition how the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - The threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition a management event rule condition. -type ManagementEventRuleCondition struct { - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - merc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - objectMap := make(map[string]interface{}) - if merc.Aggregation != nil { - objectMap["aggregation"] = merc.Aggregation - } - objectMap["dataSource"] = merc.DataSource - if merc.OdataType != "" { - objectMap["odata.type"] = merc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return &merc, true -} - -// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. -func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &merc, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. -func (merc *ManagementEventRuleCondition) 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 "aggregation": - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*v, &aggregation) - if err != nil { - return err - } - merc.Aggregation = &aggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - merc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - merc.OdataType = odataType - } - } - } - - return nil -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // DisplayDescription - Detailed description of this metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // ErrorCode - 'Success' or the error details on query failures for this metric. - ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Error message encountered querying this specific metric. - ErrorMessage *string `json:"errorMessage,omitempty"` - // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' - Unit MetricUnit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// MetricAlertAction an alert action. -type MetricAlertAction struct { - // ActionGroupID - the id of the action group to use. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. - WebHookProperties map[string]*string `json:"webHookProperties"` -} - -// MarshalJSON is the custom marshaler for MetricAlertAction. -func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if maa.ActionGroupID != nil { - objectMap["actionGroupId"] = maa.ActionGroupID - } - if maa.WebHookProperties != nil { - objectMap["webHookProperties"] = maa.WebHookProperties - } - return json.Marshal(objectMap) -} - -// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type BasicMetricAlertCriteria interface { - AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) - AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) - AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) - AsMetricAlertCriteria() (*MetricAlertCriteria, bool) -} - -// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - var masrmmc MetricAlertSingleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &masrmmc) - return masrmmc, err - case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - var wlac WebtestLocationAvailabilityCriteria - err := json.Unmarshal(body, &wlac) - return wlac, err - case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &mamrmmc) - return mamrmmc, err - default: - var mac MetricAlertCriteria - err := json.Unmarshal(body, &mac) - return mac, err - } -} -func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) - if err != nil { - return nil, err - } - macArray[index] = mac - } - return macArray, nil -} - -// MarshalJSON is the custom marshaler for MetricAlertCriteria. -func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { - mac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria - objectMap := make(map[string]interface{}) - if mac.OdataType != "" { - objectMap["odata.type"] = mac.OdataType - } - for k, v := range mac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return &mac, true -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. -func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mac, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. -func (mac *MetricAlertCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mac.AdditionalProperties == nil { - mac.AdditionalProperties = make(map[string]interface{}) - } - mac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mac.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple -// resource that has multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // AllOf - the list of multiple metric criteria for this 'all of' operation. - AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - mamrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if mamrmmc.AllOf != nil { - objectMap["allOf"] = mamrmmc.AllOf - } - if mamrmmc.OdataType != "" { - objectMap["odata.type"] = mamrmmc.OdataType - } - for k, v := range mamrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return &mamrmmc, true -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. -func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &mamrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. -func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) - if err != nil { - return err - } - mamrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mamrmmc.AdditionalProperties == nil { - mamrmmc.AdditionalProperties = make(map[string]interface{}) - } - mamrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - mamrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertProperties an alert rule. -type MetricAlertProperties struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool `json:"isMigrated,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertProperties. -func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapVar.Description != nil { - objectMap["description"] = mapVar.Description - } - if mapVar.Severity != nil { - objectMap["severity"] = mapVar.Severity - } - if mapVar.Enabled != nil { - objectMap["enabled"] = mapVar.Enabled - } - if mapVar.Scopes != nil { - objectMap["scopes"] = mapVar.Scopes - } - if mapVar.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency - } - if mapVar.WindowSize != nil { - objectMap["windowSize"] = mapVar.WindowSize - } - if mapVar.TargetResourceType != nil { - objectMap["targetResourceType"] = mapVar.TargetResourceType - } - if mapVar.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion - } - objectMap["criteria"] = mapVar.Criteria - if mapVar.AutoMitigate != nil { - objectMap["autoMitigate"] = mapVar.AutoMitigate - } - if mapVar.Actions != nil { - objectMap["actions"] = mapVar.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. -func (mapVar *MetricAlertProperties) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapVar.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapVar.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapVar.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapVar.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapVar.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapVar.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapVar.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapVar.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapVar.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapVar.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapVar.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapVar.LastUpdatedTime = &lastUpdatedTime - } - case "isMigrated": - if v != nil { - var isMigrated bool - err = json.Unmarshal(*v, &isMigrated) - if err != nil { - return err - } - mapVar.IsMigrated = &isMigrated - } - } - } - - return nil -} - -// MetricAlertPropertiesPatch an alert rule properties for patch. -type MetricAlertPropertiesPatch struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]MetricAlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool `json:"isMigrated,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. -func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mapp.Description != nil { - objectMap["description"] = mapp.Description - } - if mapp.Severity != nil { - objectMap["severity"] = mapp.Severity - } - if mapp.Enabled != nil { - objectMap["enabled"] = mapp.Enabled - } - if mapp.Scopes != nil { - objectMap["scopes"] = mapp.Scopes - } - if mapp.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = mapp.EvaluationFrequency - } - if mapp.WindowSize != nil { - objectMap["windowSize"] = mapp.WindowSize - } - if mapp.TargetResourceType != nil { - objectMap["targetResourceType"] = mapp.TargetResourceType - } - if mapp.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = mapp.TargetResourceRegion - } - objectMap["criteria"] = mapp.Criteria - if mapp.AutoMitigate != nil { - objectMap["autoMitigate"] = mapp.AutoMitigate - } - if mapp.Actions != nil { - objectMap["actions"] = mapp.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. -func (mapp *MetricAlertPropertiesPatch) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mapp.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - mapp.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - mapp.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - mapp.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - mapp.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - mapp.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - mapp.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - mapp.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicMetricAlertCriteria(*v) - if err != nil { - return err - } - mapp.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - mapp.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []MetricAlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - mapp.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - mapp.LastUpdatedTime = &lastUpdatedTime - } - case "isMigrated": - if v != nil { - var isMigrated bool - err = json.Unmarshal(*v, &isMigrated) - if err != nil { - return err - } - mapp.IsMigrated = &isMigrated - } - } - } - - return nil -} - -// MetricAlertResource the metric alert resource. -type MetricAlertResource struct { - autorest.Response `json:"-"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `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"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResource. -func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mar.MetricAlertProperties != nil { - objectMap["properties"] = mar.MetricAlertProperties - } - if mar.Location != nil { - objectMap["location"] = mar.Location - } - if mar.Tags != nil { - objectMap["tags"] = mar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. -func (mar *MetricAlertResource) 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 metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) - if err != nil { - return err - } - mar.MetricAlertProperties = &metricAlertProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mar.Tags = tags - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - mar.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - mar.Etag = &etag - } - } - } - - return nil -} - -// MetricAlertResourceCollection represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertResource `json:"value,omitempty"` -} - -// MetricAlertResourcePatch the metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // MetricAlertPropertiesPatch - The alert rule properties of the resource. - *MetricAlertPropertiesPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. -func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if marp.Tags != nil { - objectMap["tags"] = marp.Tags - } - if marp.MetricAlertPropertiesPatch != nil { - objectMap["properties"] = marp.MetricAlertPropertiesPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. -func (marp *MetricAlertResourcePatch) 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 - } - marp.Tags = tags - } - case "properties": - if v != nil { - var metricAlertPropertiesPatch MetricAlertPropertiesPatch - err = json.Unmarshal(*v, &metricAlertPropertiesPatch) - if err != nil { - return err - } - marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch - } - } - } - - return nil -} - -// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single -// resource that has multiple metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // AllOf - The list of metric criteria for this 'all of' operation. - AllOf *[]MetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - masrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if masrmmc.AllOf != nil { - objectMap["allOf"] = masrmmc.AllOf - } - if masrmmc.OdataType != "" { - objectMap["odata.type"] = masrmmc.OdataType - } - for k, v := range masrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return &masrmmc, true -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. -func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &masrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. -func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - var allOf []MetricCriteria - err = json.Unmarshal(*v, &allOf) - if err != nil { - return err - } - masrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if masrmmc.AdditionalProperties == nil { - masrmmc.AdditionalProperties = make(map[string]interface{}) - } - masrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - masrmmc.OdataType = odataType - } - } - } - - return nil -} - -// MetricAlertStatus an alert status. -type MetricAlertStatus struct { - // Name - The status name. - Name *string `json:"name,omitempty"` - // ID - The alert rule arm id. - ID *string `json:"id,omitempty"` - // Type - The extended resource type name. - Type *string `json:"type,omitempty"` - // Properties - The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties `json:"properties,omitempty"` -} - -// MetricAlertStatusCollection represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]MetricAlertStatus `json:"value,omitempty"` -} - -// MetricAlertStatusProperties an alert status properties. -type MetricAlertStatusProperties struct { - // Dimensions - An object describing the type of the dimensions. - Dimensions map[string]*string `json:"dimensions"` - // Status - status value - Status *string `json:"status,omitempty"` - // Timestamp - UTC time when the status was checked. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. -func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if masp.Dimensions != nil { - objectMap["dimensions"] = masp.Dimensions - } - if masp.Status != nil { - objectMap["status"] = masp.Status - } - if masp.Timestamp != nil { - objectMap["timestamp"] = masp.Timestamp - } - return json.Marshal(objectMap) -} - -// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and -// the retention period for that time grain. -type MetricAvailability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// MetricBaselinesProperties the response to a metric baselines query. -type MetricBaselinesProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried. - Namespace *string `json:"namespace,omitempty"` - // Baselines - The baseline for each time series that was queried. - Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` -} - -// MetricBaselinesResponse a list of metric baselines. -type MetricBaselinesResponse struct { - autorest.Response `json:"-"` - // Value - The list of metric baselines. - Value *[]SingleMetricBaseline `json:"value,omitempty"` -} - -// MetricCriteria criterion to filter metrics. -type MetricCriteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' - Operator Operator `json:"operator,omitempty"` - // Threshold - the criteria threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' - TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricCriteria. -func (mc MetricCriteria) MarshalJSON() ([]byte, error) { - mc.CriterionType = CriterionTypeStaticThresholdCriterion - objectMap := make(map[string]interface{}) - if mc.Operator != "" { - objectMap["operator"] = mc.Operator - } - if mc.Threshold != nil { - objectMap["threshold"] = mc.Threshold - } - if mc.Name != nil { - objectMap["name"] = mc.Name - } - if mc.MetricName != nil { - objectMap["metricName"] = mc.MetricName - } - if mc.MetricNamespace != nil { - objectMap["metricNamespace"] = mc.MetricNamespace - } - if mc.TimeAggregation != "" { - objectMap["timeAggregation"] = mc.TimeAggregation - } - if mc.Dimensions != nil { - objectMap["dimensions"] = mc.Dimensions - } - if mc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mc.SkipMetricValidation - } - if mc.CriterionType != "" { - objectMap["criterionType"] = mc.CriterionType - } - for k, v := range mc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return &mc, true -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. -func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mc, true -} - -// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. -func (mc *MetricCriteria) 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 "operator": - if v != nil { - var operator Operator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - mc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - mc.Threshold = &threshold - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mc.AdditionalProperties == nil { - mc.AdditionalProperties = make(map[string]interface{}) - } - mc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation AggregationTypeEnum - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mc.CriterionType = criterionType - } - } - } - - return nil -} - -// MetricDefinition metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // DisplayDescription - Detailed description of this metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Category - Custom category name for this metric. - Category *string `json:"category,omitempty"` - // MetricClass - The class of the metric. Possible values include: 'MetricClassAvailability', 'MetricClassTransactions', 'MetricClassErrors', 'MetricClassLatency', 'MetricClassSaturation' - MetricClass MetricClass `json:"metricClass,omitempty"` - // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' - Unit MetricUnit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'AggregationTypeNone', 'AggregationTypeAverage', 'AggregationTypeCount', 'AggregationTypeMinimum', 'AggregationTypeMaximum', 'AggregationTypeTotal' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// MetricDefinitionCollection represents collection of metric definitions. -type MetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricDimension specifies a metric dimension. -type MetricDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string `json:"operator,omitempty"` - // Values - list of dimension values. - Values *[]string `json:"values,omitempty"` -} - -// MetricNamespace metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // ID - The ID of the metric namespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The escaped name of the namespace. - Name *string `json:"name,omitempty"` - // Classification - Kind of namespace. Possible values include: 'NamespaceClassificationPlatform', 'NamespaceClassificationCustom', 'NamespaceClassificationQos' - Classification NamespaceClassification `json:"classification,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName `json:"properties,omitempty"` -} - -// MetricNamespaceCollection represents collection of metric namespaces. -type MetricNamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]MetricNamespace `json:"value,omitempty"` -} - -// MetricNamespaceName the fully qualified metric namespace name. -type MetricNamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricSingleDimension the metric dimension name and value. -type MetricSingleDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Value - Value of the dimension. - Value *string `json:"value,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'ComparisonOperationTypeEquals', 'ComparisonOperationTypeNotEquals', 'ComparisonOperationTypeGreaterThan', 'ComparisonOperationTypeGreaterThanOrEqual', 'ComparisonOperationTypeLessThan', 'ComparisonOperationTypeLessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` - // DividePerInstance - a value indicating whether metric should divide per instance. - DividePerInstance *bool `json:"dividePerInstance,omitempty"` -} - -// MetricValue represents a metric value. -type MetricValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *float64 `json:"count,omitempty"` -} - -// BasicMultiMetricCriteria the types of conditions for a multi resource alert. -type BasicMultiMetricCriteria interface { - AsMetricCriteria() (*MetricCriteria, bool) - AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) - AsMultiMetricCriteria() (*MultiMetricCriteria, bool) -} - -// MultiMetricCriteria the types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' - TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["criterionType"] { - case string(CriterionTypeStaticThresholdCriterion): - var mc MetricCriteria - err := json.Unmarshal(body, &mc) - return mc, err - case string(CriterionTypeDynamicThresholdCriterion): - var dmc DynamicMetricCriteria - err := json.Unmarshal(body, &dmc) - return dmc, err - default: - var mmc MultiMetricCriteria - err := json.Unmarshal(body, &mmc) - return mmc, err - } -} -func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) - if err != nil { - return nil, err - } - mmcArray[index] = mmc - } - return mmcArray, nil -} - -// MarshalJSON is the custom marshaler for MultiMetricCriteria. -func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { - mmc.CriterionType = CriterionTypeMultiMetricCriteria - objectMap := make(map[string]interface{}) - if mmc.Name != nil { - objectMap["name"] = mmc.Name - } - if mmc.MetricName != nil { - objectMap["metricName"] = mmc.MetricName - } - if mmc.MetricNamespace != nil { - objectMap["metricNamespace"] = mmc.MetricNamespace - } - if mmc.TimeAggregation != "" { - objectMap["timeAggregation"] = mmc.TimeAggregation - } - if mmc.Dimensions != nil { - objectMap["dimensions"] = mmc.Dimensions - } - if mmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mmc.SkipMetricValidation - } - if mmc.CriterionType != "" { - objectMap["criterionType"] = mmc.CriterionType - } - for k, v := range mmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return &mmc, true -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. -func (mmc *MultiMetricCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mmc.AdditionalProperties == nil { - mmc.AdditionalProperties = make(map[string]interface{}) - } - mmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation AggregationTypeEnum - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []MetricDimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mmc.CriterionType = criterionType - } - } - } - - return nil -} - -// NetworkRuleSet definition of the network rules. -type NetworkRuleSet struct { - // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'KnownPublicNetworkAccessOptionsEnabled', 'KnownPublicNetworkAccessOptionsDisabled' - PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Insights 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 operations supported by the Microsoft.Insights 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"` -} - -// OperationStatus the status of operation. -type OperationStatus struct { - autorest.Response `json:"-"` - // ID - The operation Id. - ID *string `json:"id,omitempty"` - // Name - The operation name. - Name *string `json:"name,omitempty"` - // StartTime - Start time of the job in standard ISO8601 format. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - End time of the job in standard ISO8601 format. - EndTime *date.Time `json:"endTime,omitempty"` - // Status - The status of the operation. - Status *string `json:"status,omitempty"` - // Error - The error detail of the operation if any. - Error *ErrorResponseCommon `json:"error,omitempty"` -} - -// PerfCounterDataSource definition of which performance counters will be collected and how they will be -// collected by this data collection rule. -// Collected from both Windows and Linux machines where the counter is present. -type PerfCounterDataSource struct { - // Streams - List of streams that this data source will be sent to. - // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - Streams *[]KnownPerfCounterDataSourceStreams `json:"streams,omitempty"` - // SamplingFrequencyInSeconds - The number of seconds between consecutive counter measurements (samples). - SamplingFrequencyInSeconds *int32 `json:"samplingFrequencyInSeconds,omitempty"` - // CounterSpecifiers - A list of specifier names of the performance counters you want to collect. - // Use a wildcard (*) to collect a counter for all instances. - // To get a list of performance counters on Windows, run the command 'typeperf'. - CounterSpecifiers *[]string `json:"counterSpecifiers,omitempty"` - // Name - A friendly name for the data source. - // This name should be unique across all data sources (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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"` -} - -// 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. -func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) - if err != nil { - return err - } - page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,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) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `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"` -} - -// 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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkScopedResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateLinkScopedResourcesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopedResourcesClient) (ScopedResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) 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 PrivateLinkScopedResourcesCreateOrUpdateFuture.Result. -func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) result(client PrivateLinkScopedResourcesClient) (sr ScopedResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkScopedResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateLinkScopedResourcesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopedResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopedResourcesDeleteFuture) 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 PrivateLinkScopedResourcesDeleteFuture.Result. -func (future *PrivateLinkScopedResourcesDeleteFuture) result(client PrivateLinkScopedResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkScopesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PrivateLinkScopesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopesDeleteFuture) 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 PrivateLinkScopesDeleteFuture.Result. -func (future *PrivateLinkScopesDeleteFuture) result(client PrivateLinkScopesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkScopesResource an azure resource object -type PrivateLinkScopesResource 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 PrivateLinkScopesResource. -func (plsr PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plsr.Location != nil { - objectMap["location"] = plsr.Location - } - if plsr.Tags != nil { - objectMap["tags"] = plsr.Tags - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionStateProperty state of the private endpoint connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProxyOnlyResource a proxy only azure resource object -type ProxyOnlyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyOnlyResource. -func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProxyResource an azure resource object -type ProxyResource 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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource an azure resource object -type Resource 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"` - // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceForUpdate definition of ARM tracked top level resource properties for update operation. -type ResourceForUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ResourceForUpdate. -func (rfu ResourceForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rfu.Tags != nil { - objectMap["tags"] = rfu.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the relative cost of the query. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics being queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource being queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,omitempty"` -} - -// ResponseWithError an error response from the API. -type ResponseWithError struct { - // Error - Error information. - Error *Error `json:"error,omitempty"` -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type BasicRuleAction interface { - AsRuleEmailAction() (*RuleEmailAction, bool) - AsRuleWebhookAction() (*RuleWebhookAction, bool) - AsRuleAction() (*RuleAction, bool) -} - -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is -// resolved. -type RuleAction struct { - // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): - var rea RuleEmailAction - err := json.Unmarshal(body, &rea) - return rea, err - case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): - var rwa RuleWebhookAction - err := json.Unmarshal(body, &rwa) - return rwa, err - default: - var ra RuleAction - err := json.Unmarshal(body, &ra) - return ra, err - } -} -func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - raArray := make([]BasicRuleAction, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ra, err := unmarshalBasicRuleAction(*rawMessage) - if err != nil { - return nil, err - } - raArray[index] = ra - } - return raArray, nil -} - -// MarshalJSON is the custom marshaler for RuleAction. -func (ra RuleAction) MarshalJSON() ([]byte, error) { - ra.OdataType = OdataTypeBasicRuleActionOdataTypeRuleAction - objectMap := make(map[string]interface{}) - if ra.OdataType != "" { - objectMap["odata.type"] = ra.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { - return &ra, true -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. -func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &ra, true -} - -// BasicRuleCondition the condition that results in the alert rule being activated. -type BasicRuleCondition interface { - AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) - AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) - AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) - AsRuleCondition() (*RuleCondition, bool) -} - -// RuleCondition the condition that results in the alert rule being activated. -type RuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): - var trc ThresholdRuleCondition - err := json.Unmarshal(body, &trc) - return trc, err - case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): - var ltrc LocationThresholdRuleCondition - err := json.Unmarshal(body, <rc) - return ltrc, err - case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): - var merc ManagementEventRuleCondition - err := json.Unmarshal(body, &merc) - return merc, err - default: - var rc RuleCondition - err := json.Unmarshal(body, &rc) - return rc, err - } -} -func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcArray := make([]BasicRuleCondition, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rc, err := unmarshalBasicRuleCondition(*rawMessage) - if err != nil { - return nil, err - } - rcArray[index] = rc - } - return rcArray, nil -} - -// MarshalJSON is the custom marshaler for RuleCondition. -func (rc RuleCondition) MarshalJSON() ([]byte, error) { - rc.OdataType = OdataTypeBasicRuleConditionOdataTypeRuleCondition - objectMap := make(map[string]interface{}) - objectMap["dataSource"] = rc.DataSource - if rc.OdataType != "" { - objectMap["odata.type"] = rc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return nil, false -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return &rc, true -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. -func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &rc, true -} - -// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. -func (rc *RuleCondition) 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 "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - rc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - rc.OdataType = odataType - } - } - } - - return nil -} - -// BasicRuleDataSource the resource from which the rule collects its data. -type BasicRuleDataSource interface { - AsRuleMetricDataSource() (*RuleMetricDataSource, bool) - AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) - AsRuleDataSource() (*RuleDataSource, bool) -} - -// RuleDataSource the resource from which the rule collects its data. -type RuleDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - LegacyResourceID *string `json:"legacyResourceId,omitempty"` - // ResourceLocation - the location of the resource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // MetricNamespace - the namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): - var rmds RuleMetricDataSource - err := json.Unmarshal(body, &rmds) - return rmds, err - case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): - var rmeds RuleManagementEventDataSource - err := json.Unmarshal(body, &rmeds) - return rmeds, err - default: - var rds RuleDataSource - err := json.Unmarshal(body, &rds) - return rds, err - } -} -func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rdsArray := make([]BasicRuleDataSource, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rds, err := unmarshalBasicRuleDataSource(*rawMessage) - if err != nil { - return nil, err - } - rdsArray[index] = rds - } - return rdsArray, nil -} - -// MarshalJSON is the custom marshaler for RuleDataSource. -func (rds RuleDataSource) MarshalJSON() ([]byte, error) { - rds.OdataType = OdataTypeRuleDataSource - objectMap := make(map[string]interface{}) - if rds.ResourceURI != nil { - objectMap["resourceUri"] = rds.ResourceURI - } - if rds.LegacyResourceID != nil { - objectMap["legacyResourceId"] = rds.LegacyResourceID - } - if rds.ResourceLocation != nil { - objectMap["resourceLocation"] = rds.ResourceLocation - } - if rds.MetricNamespace != nil { - objectMap["metricNamespace"] = rds.MetricNamespace - } - if rds.OdataType != "" { - objectMap["odata.type"] = rds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return &rds, true -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. -func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rds, true -} - -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The -// discriminator is always RuleEmailAction in this case. -type RuleEmailAction struct { - // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails *[]string `json:"customEmails,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleEmailAction. -func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { - rea.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - objectMap := make(map[string]interface{}) - if rea.SendToServiceOwners != nil { - objectMap["sendToServiceOwners"] = rea.SendToServiceOwners - } - if rea.CustomEmails != nil { - objectMap["customEmails"] = rea.CustomEmails - } - if rea.OdataType != "" { - objectMap["odata.type"] = rea.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return &rea, true -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return nil, false -} - -// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. -func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rea, true -} - -// RuleManagementEventClaimsDataSource the claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // EmailAddress - the email address. - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always -// RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - // EventName - the event name. - EventName *string `json:"eventName,omitempty"` - // EventSource - the event source. - EventSource *string `json:"eventSource,omitempty"` - // Level - the level. - Level *string `json:"level,omitempty"` - // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string `json:"operationName,omitempty"` - // ResourceGroupName - the resource group name. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ResourceProviderName - the resource provider name. - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - // Status - The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string `json:"status,omitempty"` - // SubStatus - the substatus. - SubStatus *string `json:"subStatus,omitempty"` - // Claims - the claims. - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - LegacyResourceID *string `json:"legacyResourceId,omitempty"` - // ResourceLocation - the location of the resource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // MetricNamespace - the namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - objectMap := make(map[string]interface{}) - if rmeds.EventName != nil { - objectMap["eventName"] = rmeds.EventName - } - if rmeds.EventSource != nil { - objectMap["eventSource"] = rmeds.EventSource - } - if rmeds.Level != nil { - objectMap["level"] = rmeds.Level - } - if rmeds.OperationName != nil { - objectMap["operationName"] = rmeds.OperationName - } - if rmeds.ResourceGroupName != nil { - objectMap["resourceGroupName"] = rmeds.ResourceGroupName - } - if rmeds.ResourceProviderName != nil { - objectMap["resourceProviderName"] = rmeds.ResourceProviderName - } - if rmeds.Status != nil { - objectMap["status"] = rmeds.Status - } - if rmeds.SubStatus != nil { - objectMap["subStatus"] = rmeds.SubStatus - } - if rmeds.Claims != nil { - objectMap["claims"] = rmeds.Claims - } - if rmeds.ResourceURI != nil { - objectMap["resourceUri"] = rmeds.ResourceURI - } - if rmeds.LegacyResourceID != nil { - objectMap["legacyResourceId"] = rmeds.LegacyResourceID - } - if rmeds.ResourceLocation != nil { - objectMap["resourceLocation"] = rmeds.ResourceLocation - } - if rmeds.MetricNamespace != nil { - objectMap["metricNamespace"] = rmeds.MetricNamespace - } - if rmeds.OdataType != "" { - objectMap["odata.type"] = rmeds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return nil, false -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return &rmeds, true -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. -func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmeds, true -} - -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource -// in this case. -type RuleMetricDataSource struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - LegacyResourceID *string `json:"legacyResourceId,omitempty"` - // ResourceLocation - the location of the resource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // MetricNamespace - the namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleMetricDataSource. -func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { - rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - objectMap := make(map[string]interface{}) - if rmds.MetricName != nil { - objectMap["metricName"] = rmds.MetricName - } - if rmds.ResourceURI != nil { - objectMap["resourceUri"] = rmds.ResourceURI - } - if rmds.LegacyResourceID != nil { - objectMap["legacyResourceId"] = rmds.LegacyResourceID - } - if rmds.ResourceLocation != nil { - objectMap["resourceLocation"] = rmds.ResourceLocation - } - if rmds.MetricNamespace != nil { - objectMap["metricNamespace"] = rmds.MetricNamespace - } - if rmds.OdataType != "" { - objectMap["odata.type"] = rmds.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { - return &rmds, true -} - -// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { - return nil, false -} - -// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { - return nil, false -} - -// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. -func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { - return &rmds, true -} - -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The -// discriminator is always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // ServiceURI - the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string `json:"properties"` - // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RuleWebhookAction. -func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { - rwa.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - objectMap := make(map[string]interface{}) - if rwa.ServiceURI != nil { - objectMap["serviceUri"] = rwa.ServiceURI - } - if rwa.Properties != nil { - objectMap["properties"] = rwa.Properties - } - if rwa.OdataType != "" { - objectMap["odata.type"] = rwa.OdataType - } - return json.Marshal(objectMap) -} - -// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { - return nil, false -} - -// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { - return &rwa, true -} - -// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { - return nil, false -} - -// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. -func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { - return &rwa, true -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ScaleTypeChangeCount', 'ScaleTypePercentChangeCount', 'ScaleTypeExactCount' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. - Maximum *string `json:"maximum,omitempty"` - // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// Schedule defines how often to run the search and the time interval. -type Schedule struct { - // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. - FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` - // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` -} - -// ScopedResource a private link scoped resource -type ScopedResource struct { - autorest.Response `json:"-"` - // ScopedResourceProperties - Resource properties. - *ScopedResourceProperties `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"` -} - -// MarshalJSON is the custom marshaler for ScopedResource. -func (sr ScopedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.ScopedResourceProperties != nil { - objectMap["properties"] = sr.ScopedResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopedResource struct. -func (sr *ScopedResource) 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 scopedResourceProperties ScopedResourceProperties - err = json.Unmarshal(*v, &scopedResourceProperties) - if err != nil { - return err - } - sr.ScopedResourceProperties = &scopedResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - } - } - - return nil -} - -// ScopedResourceListResult a list of scoped resources in a private link scope. -type ScopedResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ScopedResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopedResourceListResult. -func (srlr ScopedResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ScopedResourceListResultIterator provides access to a complete listing of ScopedResource values. -type ScopedResourceListResultIterator struct { - i int - page ScopedResourceListResultPage -} - -// 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 *ScopedResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultIterator.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 *ScopedResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScopedResourceListResultIterator) 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 ScopedResourceListResultIterator) Response() ScopedResourceListResult { - 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 ScopedResourceListResultIterator) Value() ScopedResource { - if !iter.page.NotDone() { - return ScopedResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScopedResourceListResultIterator type. -func NewScopedResourceListResultIterator(page ScopedResourceListResultPage) ScopedResourceListResultIterator { - return ScopedResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (srlr ScopedResourceListResult) IsEmpty() bool { - return srlr.Value == nil || len(*srlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (srlr ScopedResourceListResult) hasNextLink() bool { - return srlr.NextLink != nil && len(*srlr.NextLink) != 0 -} - -// scopedResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (srlr ScopedResourceListResult) scopedResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !srlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(srlr.NextLink))) -} - -// ScopedResourceListResultPage contains a page of ScopedResource values. -type ScopedResourceListResultPage struct { - fn func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error) - srlr ScopedResourceListResult -} - -// 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 *ScopedResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultPage.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.srlr) - if err != nil { - return err - } - page.srlr = 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 *ScopedResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScopedResourceListResultPage) NotDone() bool { - return !page.srlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScopedResourceListResultPage) Response() ScopedResourceListResult { - return page.srlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScopedResourceListResultPage) Values() []ScopedResource { - if page.srlr.IsEmpty() { - return nil - } - return *page.srlr.Value -} - -// Creates a new instance of the ScopedResourceListResultPage type. -func NewScopedResourceListResultPage(cur ScopedResourceListResult, getNextPage func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)) ScopedResourceListResultPage { - return ScopedResourceListResultPage{ - fn: getNextPage, - srlr: cur, - } -} - -// ScopedResourceProperties properties of a private link scoped resource. -type ScopedResourceProperties struct { - // LinkedResourceID - The resource id of the scoped Azure monitor resource. - LinkedResourceID *string `json:"linkedResourceId,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopedResourceProperties. -func (srp ScopedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srp.LinkedResourceID != nil { - objectMap["linkedResourceId"] = srp.LinkedResourceID - } - return json.Marshal(objectMap) -} - -// SenderAuthorization the authorization used by the user who has performed the operation that led to this -// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and -// the 'scope' -type SenderAuthorization struct { - // Action - the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string `json:"action,omitempty"` - // Role - the role of the user. For instance: Subscription Admin - Role *string `json:"role,omitempty"` - // Scope - the scope. - Scope *string `json:"scope,omitempty"` -} - -// SingleBaseline the baseline values for a single sensitivity value. -type SingleBaseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'BaselineSensitivityLow', 'BaselineSensitivityMedium', 'BaselineSensitivityHigh' - Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// SingleMetricBaseline the baseline results of a single metric. -type SingleMetricBaseline struct { - // ID - The metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - The resource type of the metric baseline resource. - Type *string `json:"type,omitempty"` - // Name - The name of the metric for which the baselines were retrieved. - Name *string `json:"name,omitempty"` - // MetricBaselinesProperties - The metric baseline properties of the metric. - *MetricBaselinesProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingleMetricBaseline. -func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smb.ID != nil { - objectMap["id"] = smb.ID - } - if smb.Type != nil { - objectMap["type"] = smb.Type - } - if smb.Name != nil { - objectMap["name"] = smb.Name - } - if smb.MetricBaselinesProperties != nil { - objectMap["properties"] = smb.MetricBaselinesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. -func (smb *SingleMetricBaseline) 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 - } - smb.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - smb.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - smb.Name = &name - } - case "properties": - if v != nil { - var metricBaselinesProperties MetricBaselinesProperties - err = json.Unmarshal(*v, &metricBaselinesProperties) - if err != nil { - return err - } - smb.MetricBaselinesProperties = &metricBaselinesProperties - } - } - } - - return nil -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// Source specifies the log search query. -type Source struct { - // Query - Log search query. Required for action type - AlertingAction - Query *string `json:"query,omitempty"` - // AuthorizedResources - List of Resource referred into query - AuthorizedResources *[]string `json:"authorizedResources,omitempty"` - // DataSourceID - The resource uri over which log search query is to be run. - DataSourceID *string `json:"dataSourceId,omitempty"` - // QueryType - Set value to 'ResultCount'. Possible values include: 'QueryTypeResultCount' - QueryType QueryType `json:"queryType,omitempty"` -} - -// SyslogDataSource definition of which syslog data will be collected and how it will be collected. -// Only collected from Linux machines. -type SyslogDataSource struct { - // Streams - List of streams that this data source will be sent to. - // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - Streams *[]KnownSyslogDataSourceStreams `json:"streams,omitempty"` - // FacilityNames - The list of facility names. - FacilityNames *[]KnownSyslogDataSourceFacilityNames `json:"facilityNames,omitempty"` - // LogLevels - The log levels to collect. - LogLevels *[]KnownSyslogDataSourceLogLevels `json:"logLevels,omitempty"` - // Name - A friendly name for the data source. - // This name should be unique across all data sources (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// 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 -// PrivateLinkScope 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) -} - -// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' - Operator ConditionOperator `json:"operator,omitempty"` - // Threshold - the threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. - WindowSize *string `json:"windowSize,omitempty"` - // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - trc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - objectMap := make(map[string]interface{}) - if trc.Operator != "" { - objectMap["operator"] = trc.Operator - } - if trc.Threshold != nil { - objectMap["threshold"] = trc.Threshold - } - if trc.WindowSize != nil { - objectMap["windowSize"] = trc.WindowSize - } - if trc.TimeAggregation != "" { - objectMap["timeAggregation"] = trc.TimeAggregation - } - objectMap["dataSource"] = trc.DataSource - if trc.OdataType != "" { - objectMap["odata.type"] = trc.OdataType - } - return json.Marshal(objectMap) -} - -// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { - return &trc, true -} - -// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { - return nil, false -} - -// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { - return nil, false -} - -// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { - return nil, false -} - -// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. -func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { - return &trc, true -} - -// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. -func (trc *ThresholdRuleCondition) 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 "operator": - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - trc.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - trc.WindowSize = &windowSize - } - case "timeAggregation": - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - case "dataSource": - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*v) - if err != nil { - return err - } - trc.DataSource = dataSource - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicRuleCondition - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - trc.OdataType = odataType - } - } - } - - return nil -} - -// TimeSeriesBaseline the baseline values for a single time series. -type TimeSeriesBaseline struct { - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Dimensions - The dimensions of this time series. - Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` - // Timestamps - The list of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Data - The baseline values for each sensitivity. - Data *[]SingleBaseline `json:"data,omitempty"` - // MetadataValues - The baseline metadata values. - MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]MetricValue `json:"data,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,omitempty"` -} - -// TriggerCondition the condition that results in the Log Search rule. -type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' - ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` - // Threshold - Result or count threshold based on which rule should be triggered. - Threshold *float64 `json:"threshold,omitempty"` - // MetricTrigger - Trigger condition for metric query rule - MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` -} - -// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. -type VMInsightsOnboardingStatus struct { - autorest.Response `json:"-"` - // VMInsightsOnboardingStatusProperties - Resource properties. - *VMInsightsOnboardingStatusProperties `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"` -} - -// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. -func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vios.VMInsightsOnboardingStatusProperties != nil { - objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. -func (vios *VMInsightsOnboardingStatus) 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 VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties - err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) - if err != nil { - return err - } - vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vios.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vios.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vios.Type = &typeVar - } - } - } - - return nil -} - -// VMInsightsOnboardingStatusProperties resource properties. -type VMInsightsOnboardingStatusProperties struct { - // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. - ResourceID *string `json:"resourceId,omitempty"` - // OnboardingStatus - The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: 'OnboardingStatusOnboarded', 'OnboardingStatusNotOnboarded', 'OnboardingStatusUnknown' - OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` - // DataStatus - The status of VM Insights data from the resource. When reported as `present` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: 'DataStatusPresent', 'DataStatusNotPresent' - DataStatus DataStatus `json:"dataStatus,omitempty"` - // Data - Containers that currently store VM Insights data for the specified resource. - Data *[]DataContainer `json:"data,omitempty"` -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // UseAadAuth - Indicates whether or not use AAD authentication. - UseAadAuth *bool `json:"useAadAuth,omitempty"` - // ObjectID - Indicates the webhook app object Id for aad auth. - ObjectID *string `json:"objectId,omitempty"` - // IdentifierURI - Indicates the identifier uri for aad auth. - IdentifierURI *string `json:"identifierUri,omitempty"` - // TenantID - Indicates the tenant id for aad auth. - TenantID *string `json:"tenantId,omitempty"` -} - -// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // WebTestID - The Application Insights web test Id. - WebTestID *string `json:"webTestId,omitempty"` - // ComponentID - The Application Insights resource Id. - ComponentID *string `json:"componentId,omitempty"` - // FailedLocationCount - The number of failed locations. - FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - wlac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - objectMap := make(map[string]interface{}) - if wlac.WebTestID != nil { - objectMap["webTestId"] = wlac.WebTestID - } - if wlac.ComponentID != nil { - objectMap["componentId"] = wlac.ComponentID - } - if wlac.FailedLocationCount != nil { - objectMap["failedLocationCount"] = wlac.FailedLocationCount - } - if wlac.OdataType != "" { - objectMap["odata.type"] = wlac.OdataType - } - for k, v := range wlac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return &wlac, true -} - -// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { - return nil, false -} - -// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { - return &wlac, true -} - -// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. -func (wlac *WebtestLocationAvailabilityCriteria) 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 "webTestId": - if v != nil { - var webTestID string - err = json.Unmarshal(*v, &webTestID) - if err != nil { - return err - } - wlac.WebTestID = &webTestID - } - case "componentId": - if v != nil { - var componentID string - err = json.Unmarshal(*v, &componentID) - if err != nil { - return err - } - wlac.ComponentID = &componentID - } - case "failedLocationCount": - if v != nil { - var failedLocationCount float64 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - wlac.FailedLocationCount = &failedLocationCount - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if wlac.AdditionalProperties == nil { - wlac.AdditionalProperties = make(map[string]interface{}) - } - wlac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataTypeBasicMetricAlertCriteria - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - wlac.OdataType = odataType - } - } - } - - return nil -} - -// WindowsEventLogDataSource definition of which Windows Event Log events will be collected and how they -// will be collected. -// Only collected from Windows machines. -type WindowsEventLogDataSource struct { - // Streams - List of streams that this data source will be sent to. - // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. - Streams *[]KnownWindowsEventLogDataSourceStreams `json:"streams,omitempty"` - // XPathQueries - A list of Windows Event Log queries in XPATH format. - XPathQueries *[]string `json:"xPathQueries,omitempty"` - // Name - A friendly name for the data source. - // This name should be unique across all data sources (regardless of type) within the data collection rule. - Name *string `json:"name,omitempty"` -} - -// WorkspaceInfo information about a Log Analytics Workspace. -type WorkspaceInfo struct { - // ID - Azure Resource Manager identifier of the Log Analytics Workspace. - ID *string `json:"id,omitempty"` - // Location - Location of the Log Analytics workspace. - Location *string `json:"location,omitempty"` - // WorkspaceInfoProperties - Resource properties. - *WorkspaceInfoProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceInfo. -func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wi.ID != nil { - objectMap["id"] = wi.ID - } - if wi.Location != nil { - objectMap["location"] = wi.Location - } - if wi.WorkspaceInfoProperties != nil { - objectMap["properties"] = wi.WorkspaceInfoProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. -func (wi *WorkspaceInfo) 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 - } - wi.ID = &ID - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wi.Location = &location - } - case "properties": - if v != nil { - var workspaceInfoProperties WorkspaceInfoProperties - err = json.Unmarshal(*v, &workspaceInfoProperties) - if err != nil { - return err - } - wi.WorkspaceInfoProperties = &workspaceInfoProperties - } - } - } - - return nil -} - -// WorkspaceInfoProperties resource properties. -type WorkspaceInfoProperties struct { - // CustomerID - Log Analytics workspace identifier. - CustomerID *string `json:"customerId,omitempty"` -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/operations.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/operations.go deleted file mode 100644 index 3f82351c7f23..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -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 monitor 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 operations from Microsoft.Insights provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - 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.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-04-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 -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privateendpointconnections.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/privateendpointconnections.go deleted file mode 100644 index c8bc7078ed76..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privateendpointconnections.go +++ /dev/null @@ -1,435 +0,0 @@ -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" -) - -// PrivateEndpointConnectionsClient is the monitor Management Client -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Status", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Description", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "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.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByPrivateLinkScope gets all private endpoint connections on a private link scope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByPrivateLinkScope") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.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.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", err.Error()) - } - - result.fn = client.listByPrivateLinkScopeNextResults - req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByPrivateLinkScope") - 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkresources.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkresources.go deleted file mode 100644 index 02157f85d6c4..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkresources.go +++ /dev/null @@ -1,247 +0,0 @@ -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" -) - -// PrivateLinkResourcesClient is the monitor Management Client -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "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.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByPrivateLinkScope gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByPrivateLinkScope") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.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.PrivateLinkResourcesClient", "ListByPrivateLinkScope", err.Error()) - } - - result.fn = client.listByPrivateLinkScopeNextResults - req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByPrivateLinkScope") - 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopedresources.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopedresources.go deleted file mode 100644 index 87ad66e22a67..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopedresources.go +++ /dev/null @@ -1,428 +0,0 @@ -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" -) - -// PrivateLinkScopedResourcesClient is the monitor Management Client -type PrivateLinkScopedResourcesClient struct { - BaseClient -} - -// NewPrivateLinkScopedResourcesClient creates an instance of the PrivateLinkScopedResourcesClient client. -func NewPrivateLinkScopedResourcesClient(subscriptionID string) PrivateLinkScopedResourcesClient { - return NewPrivateLinkScopedResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkScopedResourcesClientWithBaseURI creates an instance of the PrivateLinkScopedResourcesClient 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 NewPrivateLinkScopedResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopedResourcesClient { - return PrivateLinkScopedResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// name - the name of the scoped resource object. -func (client PrivateLinkScopedResourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource) (result PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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: 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.PrivateLinkScopedResourcesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateLinkScopedResourcesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/scopedResources/{name}", 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 PrivateLinkScopedResourcesClient) CreateOrUpdateSender(req *http.Request) (future PrivateLinkScopedResourcesCreateOrUpdateFuture, 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 PrivateLinkScopedResourcesClient) CreateOrUpdateResponder(resp *http.Response) (result ScopedResource, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// name - the name of the scoped resource object. -func (client PrivateLinkScopedResourcesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result PrivateLinkScopedResourcesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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: 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.PrivateLinkScopedResourcesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateLinkScopedResourcesClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/scopedResources/{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 PrivateLinkScopedResourcesClient) DeleteSender(req *http.Request) (future PrivateLinkScopedResourcesDeleteFuture, 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 PrivateLinkScopedResourcesClient) 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 a scoped resource in a private link scope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// name - the name of the scoped resource object. -func (client PrivateLinkScopedResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result ScopedResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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.PrivateLinkScopedResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "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.PrivateLinkScopedResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkScopedResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/scopedResources/{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 PrivateLinkScopedResourcesClient) 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 PrivateLinkScopedResourcesClient) GetResponder(resp *http.Response) (result ScopedResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByPrivateLinkScope gets all private endpoint connections on a private link scope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result ScopedResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.ListByPrivateLinkScope") - defer func() { - sc := -1 - if result.srlr.Response.Response != nil { - sc = result.srlr.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.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", err.Error()) - } - - result.fn = client.listByPrivateLinkScopeNextResults - req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.srlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") - return - } - - result.srlr, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - if result.srlr.hasNextLink() && result.srlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}/scopedResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result ScopedResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. -func (client PrivateLinkScopedResourcesClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults ScopedResourceListResult) (result ScopedResourceListResult, err error) { - req, err := lastResults.scopedResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result ScopedResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.ListByPrivateLinkScope") - 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopeoperationstatus.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopeoperationstatus.go deleted file mode 100644 index a29fa9edf886..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopeoperationstatus.go +++ /dev/null @@ -1,118 +0,0 @@ -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" -) - -// PrivateLinkScopeOperationStatusClient is the monitor Management Client -type PrivateLinkScopeOperationStatusClient struct { - BaseClient -} - -// NewPrivateLinkScopeOperationStatusClient creates an instance of the PrivateLinkScopeOperationStatusClient client. -func NewPrivateLinkScopeOperationStatusClient(subscriptionID string) PrivateLinkScopeOperationStatusClient { - return NewPrivateLinkScopeOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkScopeOperationStatusClientWithBaseURI creates an instance of the PrivateLinkScopeOperationStatusClient -// 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 NewPrivateLinkScopeOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopeOperationStatusClient { - return PrivateLinkScopeOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the status of an azure asynchronous operation associated with a private link scope operation. -// Parameters: -// asyncOperationID - the operation Id. -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result OperationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopeOperationStatusClient.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.PrivateLinkScopeOperationStatusClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, asyncOperationID, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "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.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkScopeOperationStatusClient) GetPreparer(ctx context.Context, asyncOperationID string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "asyncOperationId": autorest.Encode("path", asyncOperationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopeOperationStatuses/{asyncOperationId}", 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 PrivateLinkScopeOperationStatusClient) 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 PrivateLinkScopeOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatus, 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/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopes.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopes.go deleted file mode 100644 index fc2796420366..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/privatelinkscopes.go +++ /dev/null @@ -1,629 +0,0 @@ -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" -) - -// PrivateLinkScopesClient is the monitor Management Client -type PrivateLinkScopesClient struct { - BaseClient -} - -// NewPrivateLinkScopesClient creates an instance of the PrivateLinkScopesClient client. -func NewPrivateLinkScopesClient(subscriptionID string) PrivateLinkScopesClient { - return NewPrivateLinkScopesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkScopesClientWithBaseURI creates an instance of the PrivateLinkScopesClient 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 NewPrivateLinkScopesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopesClient { - return PrivateLinkScopesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates (or updates) a Azure Monitor PrivateLinkScope. 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. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// azureMonitorPrivateLinkScopePayload - properties that need to be specified to create or update a Azure -// Monitor PrivateLinkScope. -func (client PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope) (result AzureMonitorPrivateLinkScope, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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: azureMonitorPrivateLinkScopePayload, - Constraints: []validation.Constraint{{Target: "azureMonitorPrivateLinkScopePayload.AzureMonitorPrivateLinkScopeProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateLinkScopesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}", pathParameters), - autorest.WithJSON(azureMonitorPrivateLinkScopePayload), - 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) CreateOrUpdateResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, 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 a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkScopesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkScopesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.PrivateLinkScopesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateLinkScopesClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}", 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 PrivateLinkScopesClient) DeleteSender(req *http.Request) (future PrivateLinkScopesDeleteFuture, 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 PrivateLinkScopesClient) 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 returns a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string) (result AzureMonitorPrivateLinkScope, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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.PrivateLinkScopesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkScopesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) GetResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, 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 Azure Monitor PrivateLinkScopes within a subscription. -func (client PrivateLinkScopesClient) List(ctx context.Context) (result AzureMonitorPrivateLinkScopeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.List") - defer func() { - sc := -1 - if result.amplslr.Response.Response != nil { - sc = result.amplslr.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.PrivateLinkScopesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.amplslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", resp, "Failure sending request") - return - } - - result.amplslr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", resp, "Failure responding to request") - return - } - if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkScopesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) ListResponder(resp *http.Response) (result AzureMonitorPrivateLinkScopeListResult, 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 PrivateLinkScopesClient) listNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { - req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkScopesClient) ListComplete(ctx context.Context) (result AzureMonitorPrivateLinkScopeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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 Azure Monitor PrivateLinkScopes within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client PrivateLinkScopesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AzureMonitorPrivateLinkScopeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.amplslr.Response.Response != nil { - sc = result.amplslr.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.PrivateLinkScopesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.amplslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.amplslr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PrivateLinkScopesClient) 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 = "2019-10-17-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/privateLinkScopes", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) ListByResourceGroupResponder(resp *http.Response) (result AzureMonitorPrivateLinkScopeListResult, 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 PrivateLinkScopesClient) listByResourceGroupNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { - req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkScopesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AzureMonitorPrivateLinkScopeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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 updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateLinkScopeTags - updated tag information to set into the PrivateLinkScope instance. -func (client PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource) (result AzureMonitorPrivateLinkScope, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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.PrivateLinkScopesClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, scopeName, privateLinkScopeTags) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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.PrivateLinkScopesClient", "UpdateTags", resp, "Failure sending request") - return - } - - result, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "UpdateTags", resp, "Failure responding to request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client PrivateLinkScopesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-10-17-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/privateLinkScopes/{scopeName}", pathParameters), - autorest.WithJSON(privateLinkScopeTags), - 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) UpdateTagsResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, 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/monitor/mgmt/2021-04-01-preview/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/scheduledqueryrules.go deleted file mode 100644 index d619338b4e0d..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/scheduledqueryrules.go +++ /dev/null @@ -1,558 +0,0 @@ -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" -) - -// ScheduledQueryRulesClient is the monitor Management Client -type ScheduledQueryRulesClient struct { - BaseClient -} - -// NewScheduledQueryRulesClient creates an instance of the ScheduledQueryRulesClient client. -func NewScheduledQueryRulesClient(subscriptionID string) ScheduledQueryRulesClient { - return NewScheduledQueryRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduledQueryRulesClientWithBaseURI creates an instance of the ScheduledQueryRulesClient 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 NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID string) ScheduledQueryRulesClient { - return ScheduledQueryRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an log search rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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 a Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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.ScheduledQueryRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) 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 Log Search rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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.ScheduledQueryRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) GetResponder(resp *http.Response) (result LogSearchRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the Log Search rules within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: 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.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription list the Log Search rules within a subscription group. -// Parameters: -// filter - the filter to apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, filter string) (result LogSearchRuleResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListBySubscription") - 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}}}}); err != nil { - return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update log search Rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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.ScheduledQueryRulesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "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.ScheduledQueryRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-16" - 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/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) UpdateResponder(resp *http.Response) (result LogSearchRuleResource, 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/monitor/mgmt/2021-04-01-preview/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/tenantactivitylogs.go deleted file mode 100644 index 7501f047bb38..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/tenantactivitylogs.go +++ /dev/null @@ -1,168 +0,0 @@ -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" -) - -// TenantActivityLogsClient is the monitor Management Client -type TenantActivityLogsClient struct { - BaseClient -} - -// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. -func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { - return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient 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 NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { - return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for -// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that -// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that -// were generated at the tenant level. -// Parameters: -// filter - reduces the set of data collected.
The **$filter** is very restricted and allows only the -// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq -// ''.
- List events for resource: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq -// ''.
- List events for a subscription: $filter=eventTimestamp ge '' and -// eventTimestamp le '' and eventChannels eq 'Admin, Operation'.
- List events for a resource -// provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq -// 'Admin, Operation' and resourceProvider eq ''.
- List events for a correlation Id: -// api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le -// '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq -// ''.
**NOTE**: No other syntax is allowed. -// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a -// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, -// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, -// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, -// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* -func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.List") - defer func() { - sc := -1 - if result.edc.Response.Response != nil { - sc = result.edc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.edc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") - return - } - - result.edc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") - return - } - if result.edc.hasNextLink() && result.edc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), - 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 TenantActivityLogsClient) 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 TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { - req, err := lastResults.eventDataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.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, filter, selectParameter) - return -} diff --git a/services/preview/monitor/mgmt/2021-04-01-preview/insights/version.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/version.go deleted file mode 100644 index 60957f79ddd4..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -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/2021-04-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/monitor/mgmt/2021-04-01-preview/insights/vminsights.go b/services/preview/monitor/mgmt/2021-04-01-preview/insights/vminsights.go deleted file mode 100644 index 3787cb6fc53e..000000000000 --- a/services/preview/monitor/mgmt/2021-04-01-preview/insights/vminsights.go +++ /dev/null @@ -1,105 +0,0 @@ -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" -) - -// VMInsightsClient is the monitor Management Client -type VMInsightsClient struct { - BaseClient -} - -// NewVMInsightsClient creates an instance of the VMInsightsClient client. -func NewVMInsightsClient(subscriptionID string) VMInsightsClient { - return NewVMInsightsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVMInsightsClientWithBaseURI creates an instance of the VMInsightsClient 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 NewVMInsightsClientWithBaseURI(baseURI string, subscriptionID string) VMInsightsClient { - return VMInsightsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetOnboardingStatus retrieves the VM Insights onboarding status for the specified resource or resource scope. -// Parameters: -// resourceURI - the fully qualified Azure Resource manager identifier of the resource, or scope, whose status -// to retrieve. -func (client VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string) (result VMInsightsOnboardingStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VMInsightsClient.GetOnboardingStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOnboardingStatusPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetOnboardingStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure sending request") - return - } - - result, err = client.GetOnboardingStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetOnboardingStatusPreparer prepares the GetOnboardingStatus request. -func (client VMInsightsClient) GetOnboardingStatusPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2018-11-27-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOnboardingStatusSender sends the GetOnboardingStatus request. The method will close the -// http.Response Body if it receives an error. -func (client VMInsightsClient) GetOnboardingStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetOnboardingStatusResponder handles the response to the GetOnboardingStatus request. The method always -// closes the http.Response Body. -func (client VMInsightsClient) GetOnboardingStatusResponder(resp *http.Response) (result VMInsightsOnboardingStatus, 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/monitor/mgmt/2021-05-01-preview/diagnostics/CHANGELOG.md b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/_meta.json b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/_meta.json deleted file mode 100644 index 3f33d16a052e..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "9d8640319ef481ae301b67b033d6ae0bd30422c3", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2021-05-preview-diagnostics", - "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-05-preview-diagnostics --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/monitor/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/monitor/mgmt/2021-05-01-preview/diagnostics/actiongroups.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/actiongroups.go deleted file mode 100644 index 2462889b553d..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/actiongroups.go +++ /dev/null @@ -1,800 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ActionGroupsClient is the monitor Management Client -type ActionGroupsClient struct { - BaseClient -} - -// NewActionGroupsClient creates an instance of the ActionGroupsClient client. -func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { - return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { - return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new action group or update an existing one. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -// actionGroup - the action group to create or use for the update. -func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: actionGroup, - Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, - {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("diagnostics.ActionGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroup), - 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 ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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("diagnostics.ActionGroupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) 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 -} - -// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. -// This operation is only supported for Email or SMS receivers. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -// enableRequest - the receiver to re-enable. -func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") - 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: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("diagnostics.ActionGroupsClient", "EnableReceiver", err.Error()) - } - - req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") - return - } - - resp, err := client.EnableReceiverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") - return - } - - result, err = client.EnableReceiverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") - return - } - - return -} - -// EnableReceiverPreparer prepares the EnableReceiver request. -func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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/actionGroups/{actionGroupName}/subscribe", pathParameters), - autorest.WithJSON(enableRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableReceiverSender sends the EnableReceiver request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableReceiverResponder handles the response to the EnableReceiver request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an action group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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("diagnostics.ActionGroupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTestNotifications get the test notifications by the notification id -// Parameters: -// notificationID - the notification id -func (client ActionGroupsClient) GetTestNotifications(ctx context.Context, notificationID string) (result TestNotificationDetailsResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.GetTestNotifications") - 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}}}}); err != nil { - return result, validation.NewError("diagnostics.ActionGroupsClient", "GetTestNotifications", err.Error()) - } - - req, err := client.GetTestNotificationsPreparer(ctx, notificationID) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "GetTestNotifications", nil, "Failure preparing request") - return - } - - resp, err := client.GetTestNotificationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "GetTestNotifications", resp, "Failure sending request") - return - } - - result, err = client.GetTestNotificationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "GetTestNotifications", resp, "Failure responding to request") - return - } - - return -} - -// GetTestNotificationsPreparer prepares the GetTestNotifications request. -func (client ActionGroupsClient) GetTestNotificationsPreparer(ctx context.Context, notificationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "notificationId": autorest.Encode("path", notificationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetTestNotificationsSender sends the GetTestNotifications request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) GetTestNotificationsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetTestNotificationsResponder handles the response to the GetTestNotifications request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) GetTestNotificationsResponder(resp *http.Response) (result TestNotificationDetailsResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all action groups in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: 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("diagnostics.ActionGroupsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActionGroupsClient) 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-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/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all action groups in a subscription. -func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") - 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}}}}); err != nil { - return result, validation.NewError("diagnostics.ActionGroupsClient", "ListBySubscriptionID", err.Error()) - } - - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// PostTestNotifications send test notifications to a set of provided receivers -// Parameters: -// notificationRequest - the notification request body which includes the contact details -func (client ActionGroupsClient) PostTestNotifications(ctx context.Context, notificationRequest NotificationRequestBody) (result ActionGroupsPostTestNotificationsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.PostTestNotifications") - 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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: notificationRequest, - Constraints: []validation.Constraint{{Target: "notificationRequest.AlertType", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "notificationRequest.AlertType", Name: validation.MaxLength, Rule: 30, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("diagnostics.ActionGroupsClient", "PostTestNotifications", err.Error()) - } - - req, err := client.PostTestNotificationsPreparer(ctx, notificationRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "PostTestNotifications", nil, "Failure preparing request") - return - } - - result, err = client.PostTestNotificationsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "PostTestNotifications", result.Response(), "Failure sending request") - return - } - - return -} - -// PostTestNotificationsPreparer prepares the PostTestNotifications request. -func (client ActionGroupsClient) PostTestNotificationsPreparer(ctx context.Context, notificationRequest NotificationRequestBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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.Insights/createNotifications", pathParameters), - autorest.WithJSON(notificationRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PostTestNotificationsSender sends the PostTestNotifications request. The method will close the -// http.Response Body if it receives an error. -func (client ActionGroupsClient) PostTestNotificationsSender(req *http.Request) (future ActionGroupsPostTestNotificationsFuture, 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 -} - -// PostTestNotificationsResponder handles the response to the PostTestNotifications request. The method always -// closes the http.Response Body. -func (client ActionGroupsClient) PostTestNotificationsResponder(resp *http.Response) (result TestNotificationResponse, 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 action group's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// actionGroupName - the name of the action group. -// actionGroupPatch - parameters supplied to the operation. -func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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("diagnostics.ActionGroupsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionGroupName": autorest.Encode("path", actionGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-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/actionGroups/{actionGroupName}", pathParameters), - autorest.WithJSON(actionGroupPatch), - 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 ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2021-05-01-preview/diagnostics/autoscalesettings.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/autoscalesettings.go deleted file mode 100644 index c3e87ca2a97a..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/autoscalesettings.go +++ /dev/null @@ -1,632 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AutoscaleSettingsClient is the monitor Management Client -type AutoscaleSettingsClient struct { - BaseClient -} - -// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// autoscaleSettingName - the autoscale setting name. -// parameters - parameters supplied to the operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("diagnostics.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Name = nil - parameters.Type = nil - parameters.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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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("diagnostics.AutoscaleSettingsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 autoscale setting -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// autoscaleSettingName - the autoscale setting name. -func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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("diagnostics.AutoscaleSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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("diagnostics.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) 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-05-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/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "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, "diagnostics.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 the autoscale settings for a subscription -func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") - defer func() { - sc := -1 - if result.asrc.Response.Response != nil { - sc = result.asrc.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("diagnostics.AutoscaleSettingsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.asrc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.asrc, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.asrc.hasNextLink() && result.asrc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "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, "diagnostics.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// autoscaleSettingName - the autoscale setting name. -// autoscaleSettingResource - parameters supplied to the operation. -func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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("diagnostics.AutoscaleSettingsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-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/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(autoscaleSettingResource), - 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2021-05-01-preview/diagnostics/client.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/client.go deleted file mode 100644 index 639583c55438..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package diagnostics implements the Azure ARM Diagnostics service API version . -// -// Monitor Management Client -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Diagnostics - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Diagnostics. -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/monitor/mgmt/2021-05-01-preview/diagnostics/diagnosticsapi/interfaces.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/diagnosticsapi/interfaces.go deleted file mode 100644 index c7e020bc5902..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/diagnosticsapi/interfaces.go +++ /dev/null @@ -1,137 +0,0 @@ -package diagnosticsapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/monitor/mgmt/2021-05-01-preview/diagnostics" - "github.com/Azure/go-autorest/autorest" -) - -// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. -type AutoscaleSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters diagnostics.AutoscaleSettingResource) (result diagnostics.AutoscaleSettingResource, err error) - Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result diagnostics.AutoscaleSettingResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result diagnostics.AutoscaleSettingResourceCollectionPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result diagnostics.AutoscaleSettingResourceCollectionIterator, err error) - ListBySubscription(ctx context.Context) (result diagnostics.AutoscaleSettingResourceCollectionPage, err error) - ListBySubscriptionComplete(ctx context.Context) (result diagnostics.AutoscaleSettingResourceCollectionIterator, err error) - Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource diagnostics.AutoscaleSettingResourcePatch) (result diagnostics.AutoscaleSettingResource, err error) -} - -var _ AutoscaleSettingsClientAPI = (*diagnostics.AutoscaleSettingsClient)(nil) - -// PredictiveMetricClientAPI contains the set of methods on the PredictiveMetricClient type. -type PredictiveMetricClientAPI interface { - Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string) (result diagnostics.PredictiveResponse, err error) -} - -var _ PredictiveMetricClientAPI = (*diagnostics.PredictiveMetricClient)(nil) - -// SettingsClientAPI contains the set of methods on the SettingsClient type. -type SettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceURI string, parameters diagnostics.SettingsResource, name string) (result diagnostics.SettingsResource, err error) - Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceURI string, name string) (result diagnostics.SettingsResource, err error) - List(ctx context.Context, resourceURI string) (result diagnostics.SettingsResourceCollection, err error) -} - -var _ SettingsClientAPI = (*diagnostics.SettingsClient)(nil) - -// SettingsCategoryClientAPI contains the set of methods on the SettingsCategoryClient type. -type SettingsCategoryClientAPI interface { - Get(ctx context.Context, resourceURI string, name string) (result diagnostics.SettingsCategoryResource, err error) - List(ctx context.Context, resourceURI string) (result diagnostics.SettingsCategoryResourceCollection, err error) -} - -var _ SettingsCategoryClientAPI = (*diagnostics.SettingsCategoryClient)(nil) - -// ManagementGroupDiagnosticSettingsClientAPI contains the set of methods on the ManagementGroupDiagnosticSettingsClient type. -type ManagementGroupDiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, managementGroupID string, parameters diagnostics.ManagementGroupDiagnosticSettingsResource, name string) (result diagnostics.ManagementGroupDiagnosticSettingsResource, err error) - Delete(ctx context.Context, managementGroupID string, name string) (result autorest.Response, err error) - Get(ctx context.Context, managementGroupID string, name string) (result diagnostics.ManagementGroupDiagnosticSettingsResource, err error) - List(ctx context.Context, managementGroupID string) (result diagnostics.ManagementGroupDiagnosticSettingsResourceCollection, err error) -} - -var _ ManagementGroupDiagnosticSettingsClientAPI = (*diagnostics.ManagementGroupDiagnosticSettingsClient)(nil) - -// SubscriptionDiagnosticSettingsClientAPI contains the set of methods on the SubscriptionDiagnosticSettingsClient type. -type SubscriptionDiagnosticSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, parameters diagnostics.SubscriptionDiagnosticSettingsResource, name string) (result diagnostics.SubscriptionDiagnosticSettingsResource, err error) - Delete(ctx context.Context, name string) (result autorest.Response, err error) - Get(ctx context.Context, name string) (result diagnostics.SubscriptionDiagnosticSettingsResource, err error) - List(ctx context.Context) (result diagnostics.SubscriptionDiagnosticSettingsResourceCollection, err error) -} - -var _ SubscriptionDiagnosticSettingsClientAPI = (*diagnostics.SubscriptionDiagnosticSettingsClient)(nil) - -// PrivateLinkScopesClientAPI contains the set of methods on the PrivateLinkScopesClient type. -type PrivateLinkScopesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload diagnostics.AzureMonitorPrivateLinkScope) (result diagnostics.AzureMonitorPrivateLinkScope, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.PrivateLinkScopesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.AzureMonitorPrivateLinkScope, err error) - List(ctx context.Context) (result diagnostics.AzureMonitorPrivateLinkScopeListResultPage, err error) - ListComplete(ctx context.Context) (result diagnostics.AzureMonitorPrivateLinkScopeListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result diagnostics.AzureMonitorPrivateLinkScopeListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result diagnostics.AzureMonitorPrivateLinkScopeListResultIterator, err error) - UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags diagnostics.TagsResource) (result diagnostics.AzureMonitorPrivateLinkScope, err error) -} - -var _ PrivateLinkScopesClientAPI = (*diagnostics.PrivateLinkScopesClient)(nil) - -// PrivateLinkScopeOperationStatusClientAPI contains the set of methods on the PrivateLinkScopeOperationStatusClient type. -type PrivateLinkScopeOperationStatusClientAPI interface { - Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result diagnostics.OperationStatus, err error) -} - -var _ PrivateLinkScopeOperationStatusClientAPI = (*diagnostics.PrivateLinkScopeOperationStatusClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result diagnostics.PrivateLinkResource, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.PrivateLinkResourceListResult, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*diagnostics.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters diagnostics.PrivateEndpointConnection) (result diagnostics.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result diagnostics.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result diagnostics.PrivateEndpointConnection, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.PrivateEndpointConnectionListResult, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*diagnostics.PrivateEndpointConnectionsClient)(nil) - -// PrivateLinkScopedResourcesClientAPI contains the set of methods on the PrivateLinkScopedResourcesClient type. -type PrivateLinkScopedResourcesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters diagnostics.ScopedResource) (result diagnostics.PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result diagnostics.PrivateLinkScopedResourcesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result diagnostics.ScopedResource, err error) - ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.ScopedResourceListResultPage, err error) - ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result diagnostics.ScopedResourceListResultIterator, err error) -} - -var _ PrivateLinkScopedResourcesClientAPI = (*diagnostics.PrivateLinkScopedResourcesClient)(nil) - -// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. -type ActionGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup diagnostics.ActionGroupResource) (result diagnostics.ActionGroupResource, err error) - Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) - EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest diagnostics.EnableRequest) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result diagnostics.ActionGroupResource, err error) - GetTestNotifications(ctx context.Context, notificationID string) (result diagnostics.TestNotificationDetailsResponse, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result diagnostics.ActionGroupList, err error) - ListBySubscriptionID(ctx context.Context) (result diagnostics.ActionGroupList, err error) - PostTestNotifications(ctx context.Context, notificationRequest diagnostics.NotificationRequestBody) (result diagnostics.ActionGroupsPostTestNotificationsFuture, err error) - Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch diagnostics.ActionGroupPatchBody) (result diagnostics.ActionGroupResource, err error) -} - -var _ ActionGroupsClientAPI = (*diagnostics.ActionGroupsClient)(nil) diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/enums.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/enums.go deleted file mode 100644 index c1aecd061944..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/enums.go +++ /dev/null @@ -1,272 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccessMode enumerates the values for access mode. -type AccessMode string - -const ( - // AccessModeOpen ... - AccessModeOpen AccessMode = "Open" - // AccessModePrivateOnly ... - AccessModePrivateOnly AccessMode = "PrivateOnly" -) - -// PossibleAccessModeValues returns an array of possible values for the AccessMode const type. -func PossibleAccessModeValues() []AccessMode { - return []AccessMode{AccessModeOpen, AccessModePrivateOnly} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // CategoryTypeLogs ... - CategoryTypeLogs CategoryType = "Logs" - // CategoryTypeMetrics ... - CategoryTypeMetrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{CategoryTypeLogs, CategoryTypeMetrics} -} - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // ComparisonOperationTypeEquals ... - ComparisonOperationTypeEquals ComparisonOperationType = "Equals" - // ComparisonOperationTypeGreaterThan ... - ComparisonOperationTypeGreaterThan ComparisonOperationType = "GreaterThan" - // ComparisonOperationTypeGreaterThanOrEqual ... - ComparisonOperationTypeGreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // ComparisonOperationTypeLessThan ... - ComparisonOperationTypeLessThan ComparisonOperationType = "LessThan" - // ComparisonOperationTypeLessThanOrEqual ... - ComparisonOperationTypeLessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // ComparisonOperationTypeNotEquals ... - ComparisonOperationTypeNotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{ComparisonOperationTypeEquals, ComparisonOperationTypeGreaterThan, ComparisonOperationTypeGreaterThanOrEqual, ComparisonOperationTypeLessThan, ComparisonOperationTypeLessThanOrEqual, ComparisonOperationTypeNotEquals} -} - -// 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} -} - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // MetricStatisticTypeAverage ... - MetricStatisticTypeAverage MetricStatisticType = "Average" - // MetricStatisticTypeCount ... - MetricStatisticTypeCount MetricStatisticType = "Count" - // MetricStatisticTypeMax ... - MetricStatisticTypeMax MetricStatisticType = "Max" - // MetricStatisticTypeMin ... - MetricStatisticTypeMin MetricStatisticType = "Min" - // MetricStatisticTypeSum ... - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeCount, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} -} - -// PredictiveAutoscalePolicyScaleMode enumerates the values for predictive autoscale policy scale mode. -type PredictiveAutoscalePolicyScaleMode string - -const ( - // PredictiveAutoscalePolicyScaleModeDisabled ... - PredictiveAutoscalePolicyScaleModeDisabled PredictiveAutoscalePolicyScaleMode = "Disabled" - // PredictiveAutoscalePolicyScaleModeEnabled ... - PredictiveAutoscalePolicyScaleModeEnabled PredictiveAutoscalePolicyScaleMode = "Enabled" - // PredictiveAutoscalePolicyScaleModeForecastOnly ... - PredictiveAutoscalePolicyScaleModeForecastOnly PredictiveAutoscalePolicyScaleMode = "ForecastOnly" -) - -// PossiblePredictiveAutoscalePolicyScaleModeValues returns an array of possible values for the PredictiveAutoscalePolicyScaleMode const type. -func PossiblePredictiveAutoscalePolicyScaleModeValues() []PredictiveAutoscalePolicyScaleMode { - return []PredictiveAutoscalePolicyScaleMode{PredictiveAutoscalePolicyScaleModeDisabled, PredictiveAutoscalePolicyScaleModeEnabled, PredictiveAutoscalePolicyScaleModeForecastOnly} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateCreating ... - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - // PrivateEndpointConnectionProvisioningStateDeleting ... - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - // PrivateEndpointConnectionProvisioningStateFailed ... - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded ... - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} -} - -// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - // PrivateEndpointServiceConnectionStatusApproved ... - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - // PrivateEndpointServiceConnectionStatusPending ... - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - // PrivateEndpointServiceConnectionStatusRejected ... - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} -} - -// ReceiverStatus enumerates the values for receiver status. -type ReceiverStatus string - -const ( - // ReceiverStatusDisabled ... - ReceiverStatusDisabled ReceiverStatus = "Disabled" - // ReceiverStatusEnabled ... - ReceiverStatusEnabled ReceiverStatus = "Enabled" - // ReceiverStatusNotSpecified ... - ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" -) - -// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. -func PossibleReceiverStatusValues() []ReceiverStatus { - return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNone ... - RecurrenceFrequencyNone RecurrenceFrequency = "None" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease ... - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease ... - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone ... - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} -} - -// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. -type ScaleRuleMetricDimensionOperationType string - -const ( - // ScaleRuleMetricDimensionOperationTypeEquals ... - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - // ScaleRuleMetricDimensionOperationTypeNotEquals ... - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ScaleTypeChangeCount ... - ScaleTypeChangeCount ScaleType = "ChangeCount" - // ScaleTypeExactCount ... - ScaleTypeExactCount ScaleType = "ExactCount" - // ScaleTypePercentChangeCount ... - ScaleTypePercentChangeCount ScaleType = "PercentChangeCount" - // ScaleTypeServiceAllowedNextValue ... - ScaleTypeServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ScaleTypeChangeCount, ScaleTypeExactCount, ScaleTypePercentChangeCount, ScaleTypeServiceAllowedNextValue} -} - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage ... - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount ... - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeLast ... - TimeAggregationTypeLast TimeAggregationType = "Last" - // TimeAggregationTypeMaximum ... - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum ... - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal ... - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} -} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/managementgroupdiagnosticsettings.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/managementgroupdiagnosticsettings.go deleted file mode 100644 index 41005a5bbd1c..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/managementgroupdiagnosticsettings.go +++ /dev/null @@ -1,334 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagementGroupDiagnosticSettingsClient is the monitor Management Client -type ManagementGroupDiagnosticSettingsClient struct { - BaseClient -} - -// NewManagementGroupDiagnosticSettingsClient creates an instance of the ManagementGroupDiagnosticSettingsClient -// client. -func NewManagementGroupDiagnosticSettingsClient(subscriptionID string) ManagementGroupDiagnosticSettingsClient { - return NewManagementGroupDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagementGroupDiagnosticSettingsClientWithBaseURI creates an instance of the -// ManagementGroupDiagnosticSettingsClient 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 NewManagementGroupDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) ManagementGroupDiagnosticSettingsClient { - return ManagementGroupDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates management group diagnostic settings for the specified resource. -// Parameters: -// managementGroupID - the management group id. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client ManagementGroupDiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, managementGroupID string, parameters ManagementGroupDiagnosticSettingsResource, name string) (result ManagementGroupDiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementGroupDiagnosticSettingsClient.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, managementGroupID, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagementGroupDiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, managementGroupID string, parameters ManagementGroupDiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": managementGroupID, - "name": autorest.Encode("path", name), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{name}", 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 ManagementGroupDiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ManagementGroupDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagementGroupDiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing management group diagnostic settings for the specified resource. -// Parameters: -// managementGroupID - the management group id. -// name - the name of the diagnostic setting. -func (client ManagementGroupDiagnosticSettingsClient) Delete(ctx context.Context, managementGroupID string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementGroupDiagnosticSettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, managementGroupID, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagementGroupDiagnosticSettingsClient) DeletePreparer(ctx context.Context, managementGroupID string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": managementGroupID, - "name": autorest.Encode("path", name), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{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 ManagementGroupDiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ManagementGroupDiagnosticSettingsClient) 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 active management group diagnostic settings for the specified resource. -// Parameters: -// managementGroupID - the management group id. -// name - the name of the diagnostic setting. -func (client ManagementGroupDiagnosticSettingsClient) Get(ctx context.Context, managementGroupID string, name string) (result ManagementGroupDiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementGroupDiagnosticSettingsClient.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, managementGroupID, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagementGroupDiagnosticSettingsClient) GetPreparer(ctx context.Context, managementGroupID string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": managementGroupID, - "name": autorest.Encode("path", name), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings/{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 ManagementGroupDiagnosticSettingsClient) 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 ManagementGroupDiagnosticSettingsClient) GetResponder(resp *http.Response) (result ManagementGroupDiagnosticSettingsResource, 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 active management group diagnostic settings list for the specified management group. -// Parameters: -// managementGroupID - the management group id. -func (client ManagementGroupDiagnosticSettingsClient) List(ctx context.Context, managementGroupID string) (result ManagementGroupDiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementGroupDiagnosticSettingsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, managementGroupID) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ManagementGroupDiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ManagementGroupDiagnosticSettingsClient) ListPreparer(ctx context.Context, managementGroupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": managementGroupID, - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/diagnosticSettings", 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 ManagementGroupDiagnosticSettingsClient) 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 ManagementGroupDiagnosticSettingsClient) ListResponder(resp *http.Response) (result ManagementGroupDiagnosticSettingsResourceCollection, 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/monitor/mgmt/2021-05-01-preview/diagnostics/models.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/models.go deleted file mode 100644 index fcc785c456fb..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/models.go +++ /dev/null @@ -1,2780 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/preview/monitor/mgmt/2021-05-01-preview/diagnostics" - -// AccessModeSettings properties that define the scope private link mode settings. -type AccessModeSettings struct { - // QueryAccessMode - Specifies the default access mode of queries through associated private endpoints in scope. If not specified default value is 'Open'. You can override this default setting for a specific private endpoint connection by adding an exclusion in the 'exclusions' array. Possible values include: 'AccessModeOpen', 'AccessModePrivateOnly' - QueryAccessMode AccessMode `json:"queryAccessMode,omitempty"` - // IngestionAccessMode - Specifies the default access mode of ingestion through associated private endpoints in scope. If not specified default value is 'Open'. You can override this default setting for a specific private endpoint connection by adding an exclusion in the 'exclusions' array. Possible values include: 'AccessModeOpen', 'AccessModePrivateOnly' - IngestionAccessMode AccessMode `json:"ingestionAccessMode,omitempty"` - // Exclusions - List of exclusions that override the default access mode settings for specific private endpoint connections. - Exclusions *[]AccessModeSettingsExclusion `json:"exclusions,omitempty"` -} - -// AccessModeSettingsExclusion properties that define the scope private link mode settings exclusion item. -// This setting applies to a specific private endpoint connection and overrides the default settings for -// that private endpoint connection. -type AccessModeSettingsExclusion struct { - // PrivateEndpointConnectionName - The private endpoint connection name associated to the private endpoint on which we want to apply the specific access mode settings. - PrivateEndpointConnectionName *string `json:"privateEndpointConnectionName,omitempty"` - // QueryAccessMode - Specifies the access mode of queries through the specified private endpoint connection in the exclusion. Possible values include: 'AccessModeOpen', 'AccessModePrivateOnly' - QueryAccessMode AccessMode `json:"queryAccessMode,omitempty"` - // IngestionAccessMode - Specifies the access mode of ingestion through the specified private endpoint connection in the exclusion. Possible values include: 'AccessModeOpen', 'AccessModePrivateOnly' - IngestionAccessMode AccessMode `json:"ingestionAccessMode,omitempty"` -} - -// ActionDetail the action detail -type ActionDetail struct { - // MechanismType - The mechanism type - MechanismType *string `json:"MechanismType,omitempty"` - // Name - The name of the action - Name *string `json:"Name,omitempty"` - // Status - The status of the action - Status *string `json:"Status,omitempty"` - // SubState - The substatus of the action - SubState *string `json:"SubState,omitempty"` - // SendTime - The send time - SendTime *string `json:"SendTime,omitempty"` - // Detail - The detail of the friendly error message - Detail *string `json:"Detail,omitempty"` -} - -// ActionGroup an Azure action group. -type ActionGroup struct { - // GroupShortName - The short name of the action group. This will be used in SMS messages. - GroupShortName *string `json:"groupShortName,omitempty"` - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. - Enabled *bool `json:"enabled,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` - // EventHubReceivers - The list of event hub receivers that are part of this action group. - EventHubReceivers *[]EventHubReceiver `json:"eventHubReceivers,omitempty"` -} - -// ActionGroupList a list of action groups. -type ActionGroupList struct { - autorest.Response `json:"-"` - // Value - The list of action groups. - Value *[]ActionGroupResource `json:"value,omitempty"` - // NextLink - Provides the link to retrieve the next set of elements. - NextLink *string `json:"nextLink,omitempty"` -} - -// ActionGroupPatch an Azure action group for patch operations. -type ActionGroupPatch struct { - // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. - Enabled *bool `json:"enabled,omitempty"` -} - -// ActionGroupPatchBody an action group object for the body of patch operations. -type ActionGroupPatchBody struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ActionGroupPatch - The action group settings for an update operation. - *ActionGroupPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActionGroupPatchBody. -func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpb.Tags != nil { - objectMap["tags"] = agpb.Tags - } - if agpb.ActionGroupPatch != nil { - objectMap["properties"] = agpb.ActionGroupPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. -func (agpb *ActionGroupPatchBody) 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 - } - agpb.Tags = tags - } - case "properties": - if v != nil { - var actionGroupPatch ActionGroupPatch - err = json.Unmarshal(*v, &actionGroupPatch) - if err != nil { - return err - } - agpb.ActionGroupPatch = &actionGroupPatch - } - } - } - - return nil -} - -// ActionGroupResource an action group resource. -type ActionGroupResource struct { - autorest.Response `json:"-"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `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"` - // Kind - READ-ONLY; Azure resource kind - Kind *string `json:"kind,omitempty"` - // Identity - READ-ONLY; Azure resource identity - Identity *string `json:"identity,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ActionGroupResource. -func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agr.ActionGroup != nil { - objectMap["properties"] = agr.ActionGroup - } - if agr.Location != nil { - objectMap["location"] = agr.Location - } - if agr.Tags != nil { - objectMap["tags"] = agr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) 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 actionGroup ActionGroup - err = json.Unmarshal(*v, &actionGroup) - if err != nil { - return err - } - agr.ActionGroup = &actionGroup - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - agr.Kind = &kind - } - case "identity": - if v != nil { - var identity string - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - agr.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agr.Tags = tags - } - } - } - - return nil -} - -// ActionGroupsPostTestNotificationsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ActionGroupsPostTestNotificationsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ActionGroupsClient) (TestNotificationResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ActionGroupsPostTestNotificationsFuture) 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 ActionGroupsPostTestNotificationsFuture.Result. -func (future *ActionGroupsPostTestNotificationsFuture) result(client ActionGroupsClient) (tnr TestNotificationResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsPostTestNotificationsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tnr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("diagnostics.ActionGroupsPostTestNotificationsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tnr.Response.Response, err = future.GetResult(sender); err == nil && tnr.Response.Response.StatusCode != http.StatusNoContent { - tnr, err = client.PostTestNotificationsResponder(tnr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.ActionGroupsPostTestNotificationsFuture", "Result", tnr.Response.Response, "Failure responding to request") - } - } - return -} - -// ArmRoleReceiver an arm role receiver. -type ArmRoleReceiver struct { - // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // RoleID - The arm role id. - RoleID *string `json:"roleId,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. -type AutomationRunbookReceiver struct { - // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. - AutomationAccountID *string `json:"automationAccountId,omitempty"` - // RunbookName - The name for this runbook. - RunbookName *string `json:"runbookName,omitempty"` - // WebhookResourceID - The resource id for webhook linked to this runbook. - WebhookResourceID *string `json:"webhookResourceId,omitempty"` - // IsGlobalRunbook - Indicates whether this instance is global runbook. - IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` - // Name - Indicates name of the webhook. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AutoscaleErrorResponse describes the format of Error response. -type AutoscaleErrorResponse struct { - // Error - The error object. - Error *AutoscaleErrorResponseError `json:"error,omitempty"` - // SystemData - READ-ONLY; The system metadata related to the response. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleErrorResponse. -func (aer AutoscaleErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aer.Error != nil { - objectMap["error"] = aer.Error - } - return json.Marshal(objectMap) -} - -// AutoscaleErrorResponseError the error object. -type AutoscaleErrorResponseError struct { - // Code - One of a server-defined set of error codes. - Code *string `json:"code,omitempty"` - // Message - A human-readable representation of the error. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. - Target *string `json:"target,omitempty"` - // Details - A human-readable representation of the error's details. - Details *string `json:"details,omitempty"` -} - -// AutoscaleNotification autoscale notification. -type AutoscaleNotification struct { - // Operation - the operation associated with the notification and its value must be "scale" - Operation *string `json:"operation,omitempty"` - // Email - the email notification. - Email *EmailNotification `json:"email,omitempty"` - // Webhooks - the collection of webhook notifications. - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile autoscale profile. -type AutoscaleProfile struct { - // Name - the name of the profile. - Name *string `json:"name,omitempty"` - // Capacity - the number of instances that can be used during this profile. - Capacity *ScaleCapacity `json:"capacity,omitempty"` - // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. - Rules *[]ScaleRule `json:"rules,omitempty"` - // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a -// resource. -type AutoscaleSetting struct { - // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - // Notifications - the collection of notifications. - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. - Enabled *bool `json:"enabled,omitempty"` - // PredictiveAutoscalePolicy - the predictive autoscale policy mode. - PredictiveAutoscalePolicy *PredictiveAutoscalePolicy `json:"predictiveAutoscalePolicy,omitempty"` - // Name - the name of the autoscale setting. - Name *string `json:"name,omitempty"` - // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string `json:"targetResourceUri,omitempty"` - // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. - TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` -} - -// AutoscaleSettingResource the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - // 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 - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to the response. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResource. -func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asr.Location != nil { - objectMap["location"] = asr.Location - } - if asr.Tags != nil { - objectMap["tags"] = asr.Tags - } - if asr.AutoscaleSetting != nil { - objectMap["properties"] = asr.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) 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 - } - asr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asr.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asr.AutoscaleSetting = &autoscaleSetting - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - asr.SystemData = &systemData - } - } - } - - return nil -} - -// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the autoscale setting resources. - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of -// AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionIterator struct { - i int - page AutoscaleSettingResourceCollectionPage -} - -// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { - 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { - if !iter.page.NotDone() { - return AutoscaleSettingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. -func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { - return AutoscaleSettingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { - return asrc.Value == nil || len(*asrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { - return asrc.NextLink != nil && len(*asrc.NextLink) != 0 -} - -// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !asrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asrc.NextLink))) -} - -// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. -type AutoscaleSettingResourceCollectionPage struct { - fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) - asrc AutoscaleSettingResourceCollection -} - -// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) - if err != nil { - return err - } - page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { - return !page.asrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { - return page.asrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { - if page.asrc.IsEmpty() { - return nil - } - return *page.asrc.Value -} - -// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. -func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { - return AutoscaleSettingResourceCollectionPage{ - fn: getNextPage, - asrc: cur, - } -} - -// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AutoscaleSetting - The autoscale setting properties of the update operation. - *AutoscaleSetting `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. -func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asrp.Tags != nil { - objectMap["tags"] = asrp.Tags - } - if asrp.AutoscaleSetting != nil { - objectMap["properties"] = asrp.AutoscaleSetting - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. -func (asrp *AutoscaleSettingResourcePatch) 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 - } - asrp.Tags = tags - } - case "properties": - if v != nil { - var autoscaleSetting AutoscaleSetting - err = json.Unmarshal(*v, &autoscaleSetting) - if err != nil { - return err - } - asrp.AutoscaleSetting = &autoscaleSetting - } - } - } - - return nil -} - -// AzureAppPushReceiver the Azure mobile App push notification receiver. -type AzureAppPushReceiver struct { - // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address registered for the Azure mobile app. - EmailAddress *string `json:"emailAddress,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) -} - -// AzureFunctionReceiver an azure function receiver. -type AzureFunctionReceiver struct { - // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // FunctionAppResourceID - The azure resource id of the function app. - FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` - // FunctionName - The function name in the function app. - FunctionName *string `json:"functionName,omitempty"` - // HTTPTriggerURL - The http trigger url where http request sent to. - HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// AzureMonitorPrivateLinkScope an Azure Monitor PrivateLinkScope definition. -type AzureMonitorPrivateLinkScope struct { - autorest.Response `json:"-"` - // AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. - *AzureMonitorPrivateLinkScopeProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; System data - SystemData *SystemData `json:"systemData,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 AzureMonitorPrivateLinkScope. -func (ampls AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ampls.AzureMonitorPrivateLinkScopeProperties != nil { - objectMap["properties"] = ampls.AzureMonitorPrivateLinkScopeProperties - } - if ampls.Tags != nil { - objectMap["tags"] = ampls.Tags - } - if ampls.Location != nil { - objectMap["location"] = ampls.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureMonitorPrivateLinkScope struct. -func (ampls *AzureMonitorPrivateLinkScope) 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 azureMonitorPrivateLinkScopeProperties AzureMonitorPrivateLinkScopeProperties - err = json.Unmarshal(*v, &azureMonitorPrivateLinkScopeProperties) - if err != nil { - return err - } - ampls.AzureMonitorPrivateLinkScopeProperties = &azureMonitorPrivateLinkScopeProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ampls.SystemData = &systemData - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ampls.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ampls.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ampls.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ampls.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ampls.Type = &typeVar - } - } - } - - return nil -} - -// AzureMonitorPrivateLinkScopeListResult describes the list of Azure Monitor PrivateLinkScope resources. -type AzureMonitorPrivateLinkScopeListResult struct { - autorest.Response `json:"-"` - // Value - List of Azure Monitor PrivateLinkScope definitions. - Value *[]AzureMonitorPrivateLinkScope `json:"value,omitempty"` - // NextLink - The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned in the result set. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureMonitorPrivateLinkScopeListResultIterator provides access to a complete listing of -// AzureMonitorPrivateLinkScope values. -type AzureMonitorPrivateLinkScopeListResultIterator struct { - i int - page AzureMonitorPrivateLinkScopeListResultPage -} - -// 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 *AzureMonitorPrivateLinkScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultIterator.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 *AzureMonitorPrivateLinkScopeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureMonitorPrivateLinkScopeListResultIterator) 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 AzureMonitorPrivateLinkScopeListResultIterator) Response() AzureMonitorPrivateLinkScopeListResult { - 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 AzureMonitorPrivateLinkScopeListResultIterator) Value() AzureMonitorPrivateLinkScope { - if !iter.page.NotDone() { - return AzureMonitorPrivateLinkScope{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultIterator type. -func NewAzureMonitorPrivateLinkScopeListResultIterator(page AzureMonitorPrivateLinkScopeListResultPage) AzureMonitorPrivateLinkScopeListResultIterator { - return AzureMonitorPrivateLinkScopeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (amplslr AzureMonitorPrivateLinkScopeListResult) IsEmpty() bool { - return amplslr.Value == nil || len(*amplslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (amplslr AzureMonitorPrivateLinkScopeListResult) hasNextLink() bool { - return amplslr.NextLink != nil && len(*amplslr.NextLink) != 0 -} - -// azureMonitorPrivateLinkScopeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (amplslr AzureMonitorPrivateLinkScopeListResult) azureMonitorPrivateLinkScopeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !amplslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(amplslr.NextLink))) -} - -// AzureMonitorPrivateLinkScopeListResultPage contains a page of AzureMonitorPrivateLinkScope values. -type AzureMonitorPrivateLinkScopeListResultPage struct { - fn func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error) - amplslr AzureMonitorPrivateLinkScopeListResult -} - -// 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 *AzureMonitorPrivateLinkScopeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultPage.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.amplslr) - if err != nil { - return err - } - page.amplslr = 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 *AzureMonitorPrivateLinkScopeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureMonitorPrivateLinkScopeListResultPage) NotDone() bool { - return !page.amplslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureMonitorPrivateLinkScopeListResultPage) Response() AzureMonitorPrivateLinkScopeListResult { - return page.amplslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureMonitorPrivateLinkScopeListResultPage) Values() []AzureMonitorPrivateLinkScope { - if page.amplslr.IsEmpty() { - return nil - } - return *page.amplslr.Value -} - -// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultPage type. -func NewAzureMonitorPrivateLinkScopeListResultPage(cur AzureMonitorPrivateLinkScopeListResult, getNextPage func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)) AzureMonitorPrivateLinkScopeListResultPage { - return AzureMonitorPrivateLinkScopeListResultPage{ - fn: getNextPage, - amplslr: cur, - } -} - -// AzureMonitorPrivateLinkScopeProperties properties that define a Azure Monitor PrivateLinkScope resource. -type AzureMonitorPrivateLinkScopeProperties struct { - // ProvisioningState - READ-ONLY; Current state of this PrivateLinkScope: 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 Provisioning ,Succeeded, Canceled and Failed. - ProvisioningState *string `json:"provisioningState,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // AccessModeSettings - Access mode settings - AccessModeSettings *AccessModeSettings `json:"accessModeSettings,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScopeProperties. -func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if amplsp.AccessModeSettings != nil { - objectMap["accessModeSettings"] = amplsp.AccessModeSettings - } - return json.Marshal(objectMap) -} - -// AzureResource an azure resource object -type AzureResource 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"` - // Kind - READ-ONLY; Azure resource kind - Kind *string `json:"kind,omitempty"` - // Identity - READ-ONLY; Azure resource identity - Identity *string `json:"identity,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AzureResource. -func (ar AzureResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Location != nil { - objectMap["location"] = ar.Location - } - if ar.Tags != nil { - objectMap["tags"] = ar.Tags - } - return json.Marshal(objectMap) -} - -// Context the context info -type Context struct { - // NotificationSource - The source of the notification request - NotificationSource *string `json:"NotificationSource,omitempty"` - // ContextType - The context id type - ContextType *string `json:"ContextType,omitempty"` -} - -// DefaultErrorResponse 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 DefaultErrorResponse struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// EmailNotification email notification of an autoscale event. -type EmailNotification struct { - // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// EmailReceiver an email receiver. -type EmailReceiver struct { - // Name - The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EmailAddress - The email address of this receiver. - EmailAddress *string `json:"emailAddress,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailReceiver. -func (er EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if er.Name != nil { - objectMap["name"] = er.Name - } - if er.EmailAddress != nil { - objectMap["emailAddress"] = er.EmailAddress - } - if er.UseCommonAlertSchema != nil { - objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema - } - return json.Marshal(objectMap) -} - -// EnableRequest describes a receiver that should be resubscribed. -type EnableRequest struct { - // ReceiverName - The name of the receiver to resubscribe. - ReceiverName *string `json:"receiverName,omitempty"` -} - -// 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 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"` -} - -// EventHubReceiver an Event hub receiver. -type EventHubReceiver struct { - // Name - The name of the Event hub receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // EventHubNameSpace - The Event Hub namespace - EventHubNameSpace *string `json:"eventHubNameSpace,omitempty"` - // EventHubName - The name of the specific Event Hub queue - EventHubName *string `json:"eventHubName,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // TenantID - The tenant Id for the subscription containing this event hub - TenantID *string `json:"tenantId,omitempty"` - // SubscriptionID - The Id for the subscription containing this event hub - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// ItsmReceiver an Itsm receiver. -type ItsmReceiver struct { - // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // WorkspaceID - OMS LA instance identifier. - WorkspaceID *string `json:"workspaceId,omitempty"` - // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string `json:"connectionId,omitempty"` - // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. - TicketConfiguration *string `json:"ticketConfiguration,omitempty"` - // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string `json:"region,omitempty"` -} - -// LogicAppReceiver a logic app receiver. -type LogicAppReceiver struct { - // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ResourceID - The azure resource id of the logic app receiver. - ResourceID *string `json:"resourceId,omitempty"` - // CallbackURL - The callback url where http request sent to. - CallbackURL *string `json:"callbackUrl,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` -} - -// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // CategoryGroup - Name of a Diagnostic Log category group for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. - CategoryGroup *string `json:"categoryGroup,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this log. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// ManagementGroupDiagnosticSettings the management group diagnostic settings. -type ManagementGroupDiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Logs - The list of logs settings. - Logs *[]ManagementGroupLogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // MarketplacePartnerID - The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. - MarketplacePartnerID *string `json:"marketplacePartnerId,omitempty"` -} - -// ManagementGroupDiagnosticSettingsResource the management group diagnostic setting resource. -type ManagementGroupDiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // ManagementGroupDiagnosticSettings - Properties of a Management Group Diagnostic Settings Resource. - *ManagementGroupDiagnosticSettings `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,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 ManagementGroupDiagnosticSettingsResource. -func (mgdsr ManagementGroupDiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mgdsr.ManagementGroupDiagnosticSettings != nil { - objectMap["properties"] = mgdsr.ManagementGroupDiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagementGroupDiagnosticSettingsResource struct. -func (mgdsr *ManagementGroupDiagnosticSettingsResource) 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 managementGroupDiagnosticSettings ManagementGroupDiagnosticSettings - err = json.Unmarshal(*v, &managementGroupDiagnosticSettings) - if err != nil { - return err - } - mgdsr.ManagementGroupDiagnosticSettings = &managementGroupDiagnosticSettings - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - mgdsr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mgdsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mgdsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mgdsr.Type = &typeVar - } - } - } - - return nil -} - -// ManagementGroupDiagnosticSettingsResourceCollection represents a collection of management group -// diagnostic settings resources. -type ManagementGroupDiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of management group diagnostic settings resources. - Value *[]ManagementGroupDiagnosticSettingsResource `json:"value,omitempty"` -} - -// ManagementGroupLogSettings part of Management Group diagnostic setting. Specifies the settings for a -// particular log. -type ManagementGroupLogSettings struct { - // Category - Name of a Management Group Diagnostic Log category for a resource type this setting is applied to. - Category *string `json:"category,omitempty"` - // CategoryGroup - Name of a Management Group Diagnostic Log category group for a resource type this setting is applied to. - CategoryGroup *string `json:"categoryGroup,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // TimeGrain - the timegrain of the metric in ISO8601 format. - TimeGrain *string `json:"timeGrain,omitempty"` - // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. - Category *string `json:"category,omitempty"` - // Enabled - a value indicating whether this category is enabled. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - the retention policy for this category. - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricTrigger the trigger that results in a scaling action. -type MetricTrigger struct { - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - the namespace of the metric that defines what the rule monitors. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // MetricResourceURI - the resource identifier of the resource the rule monitors. - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - // MetricResourceLocation - the location of the resource the rule monitors. - MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` - // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string `json:"timeGrain,omitempty"` - // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum', 'MetricStatisticTypeCount' - Statistic MetricStatisticType `json:"statistic,omitempty"` - // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string `json:"timeWindow,omitempty"` - // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'ComparisonOperationTypeEquals', 'ComparisonOperationTypeNotEquals', 'ComparisonOperationTypeGreaterThan', 'ComparisonOperationTypeGreaterThanOrEqual', 'ComparisonOperationTypeLessThan', 'ComparisonOperationTypeLessThanOrEqual' - Operator ComparisonOperationType `json:"operator,omitempty"` - // Threshold - the threshold of the metric that triggers the scale action. - Threshold *float64 `json:"threshold,omitempty"` - // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` - // DividePerInstance - a value indicating whether metric should divide per instance. - DividePerInstance *bool `json:"dividePerInstance,omitempty"` -} - -// NotificationRequestBody the request body which contain contact detail metadata -type NotificationRequestBody struct { - // AlertType - The name of the supported alert type. - AlertType *string `json:"alertType,omitempty"` - // EmailReceivers - The list of email receivers that are part of this action group. - EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` - // SmsReceivers - The list of SMS receivers that are part of this action group. - SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` - // WebhookReceivers - The list of webhook receivers that are part of this action group. - WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` - // ItsmReceivers - The list of ITSM receivers that are part of this action group. - ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` - // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` - // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` - // VoiceReceivers - The list of voice receivers that are part of this action group. - VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` - // LogicAppReceivers - The list of logic app receivers that are part of this action group. - LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` - // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. - AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` - // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. - ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` - // EventHubReceivers - The list of event hub receivers that are part of this action group. - EventHubReceivers *[]EventHubReceiver `json:"eventHubReceivers,omitempty"` -} - -// OperationStatus the status of operation. -type OperationStatus struct { - autorest.Response `json:"-"` - // ID - The operation Id. - ID *string `json:"id,omitempty"` - // Name - The operation name. - Name *string `json:"name,omitempty"` - // StartTime - Start time of the job in standard ISO8601 format. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - End time of the job in standard ISO8601 format. - EndTime *date.Time `json:"endTime,omitempty"` - // Status - The status of the operation. - Status *string `json:"status,omitempty"` - // Error - The error detail of the operation if any. - Error *ErrorDetail `json:"error,omitempty"` -} - -// PredictiveAutoscalePolicy the parameters for enabling predictive autoscale. -type PredictiveAutoscalePolicy struct { - // ScaleMode - the predictive autoscale mode. Possible values include: 'PredictiveAutoscalePolicyScaleModeDisabled', 'PredictiveAutoscalePolicyScaleModeForecastOnly', 'PredictiveAutoscalePolicyScaleModeEnabled' - ScaleMode PredictiveAutoscalePolicyScaleMode `json:"scaleMode,omitempty"` - // ScaleLookAheadTime - the amount of time to specify by which instances are launched in advance. It must be between 1 minute and 60 minutes in ISO 8601 format. - ScaleLookAheadTime *string `json:"scaleLookAheadTime,omitempty"` -} - -// PredictiveResponse the response to a metrics query. -type PredictiveResponse struct { - autorest.Response `json:"-"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // MetricName - The metrics being queried - MetricName *string `json:"metricName,omitempty"` - // TargetResourceID - resource of the predictive metric. - TargetResourceID *string `json:"targetResourceId,omitempty"` - // Data - the value of the collection. - Data *[]PredictiveValue `json:"data,omitempty"` -} - -// PredictiveValue represents a predictive metric value in the given bucket. -type PredictiveValue struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Value - Predictive value in this time bucket. - Value *float64 `json:"value,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - READ-ONLY; The ARM identifier for Private Endpoint - 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 the Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified -// storage account -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `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 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 - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrp.RequiredZoneNames != nil { - objectMap["requiredZoneNames"] = plrp.RequiredZoneNames - } - return json.Marshal(objectMap) -} - -// PrivateLinkScopedResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateLinkScopedResourcesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopedResourcesClient) (ScopedResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) 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 PrivateLinkScopedResourcesCreateOrUpdateFuture.Result. -func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) result(client PrivateLinkScopedResourcesClient) (sr ScopedResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateLinkScopedResourcesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkScopedResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateLinkScopedResourcesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopedResourcesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopedResourcesDeleteFuture) 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 PrivateLinkScopedResourcesDeleteFuture.Result. -func (future *PrivateLinkScopedResourcesDeleteFuture) result(client PrivateLinkScopedResourcesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateLinkScopedResourcesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkScopesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PrivateLinkScopesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkScopesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkScopesDeleteFuture) 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 PrivateLinkScopesDeleteFuture.Result. -func (future *PrivateLinkScopesDeleteFuture) result(client PrivateLinkScopesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("diagnostics.PrivateLinkScopesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkServiceConnectionState a collection of information about the state of the connection between -// service consumer and provider. -type PrivateLinkServiceConnectionState struct { - // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' - Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` - // Description - The reason for approval/rejection of the connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string `json:"actionsRequired,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) -} - -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate -// element is used. -type Recurrence struct { - // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Schedule - the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days *[]string `json:"days,omitempty"` - // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). - Hours *[]int32 `json:"hours,omitempty"` - // Minutes - A collection of minutes at which the profile takes effect at. - Minutes *[]int32 `json:"minutes,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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RetentionPolicy specifies the retention policy for the log. -type RetentionPolicy struct { - // Enabled - a value indicating whether the retention policy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 `json:"days,omitempty"` -} - -// ScaleAction the parameters for the scaling action. -type ScaleAction struct { - // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' - Direction ScaleDirection `json:"direction,omitempty"` - // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ScaleTypeChangeCount', 'ScaleTypePercentChangeCount', 'ScaleTypeExactCount', 'ScaleTypeServiceAllowedNextValue' - Type ScaleType `json:"type,omitempty"` - // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. - Value *string `json:"value,omitempty"` - // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity the number of instances that can be used during this profile. -type ScaleCapacity struct { - // Minimum - the minimum number of instances for the resource. - Minimum *string `json:"minimum,omitempty"` - // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. - Maximum *string `json:"maximum,omitempty"` - // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. - Default *string `json:"default,omitempty"` -} - -// ScaleRule a rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // MetricTrigger - the trigger that results in a scaling action. - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - // ScaleAction - the parameters for the scaling action. - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // DimensionName - Name of the dimension. - DimensionName *string `json:"DimensionName,omitempty"` - // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' - Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` - // Values - list of dimension values. For example: ["App1","App2"]. - Values *[]string `json:"Values,omitempty"` -} - -// ScopedResource a private link scoped resource -type ScopedResource struct { - autorest.Response `json:"-"` - // ScopedResourceProperties - Resource properties. - *ScopedResourceProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; System data - SystemData *SystemData `json:"systemData,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 ScopedResource. -func (sr ScopedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.ScopedResourceProperties != nil { - objectMap["properties"] = sr.ScopedResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopedResource struct. -func (sr *ScopedResource) 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 scopedResourceProperties ScopedResourceProperties - err = json.Unmarshal(*v, &scopedResourceProperties) - if err != nil { - return err - } - sr.ScopedResourceProperties = &scopedResourceProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - } - } - - return nil -} - -// ScopedResourceListResult a list of scoped resources in a private link scope. -type ScopedResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ScopedResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopedResourceListResult. -func (srlr ScopedResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ScopedResourceListResultIterator provides access to a complete listing of ScopedResource values. -type ScopedResourceListResultIterator struct { - i int - page ScopedResourceListResultPage -} - -// 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 *ScopedResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultIterator.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 *ScopedResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScopedResourceListResultIterator) 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 ScopedResourceListResultIterator) Response() ScopedResourceListResult { - 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 ScopedResourceListResultIterator) Value() ScopedResource { - if !iter.page.NotDone() { - return ScopedResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScopedResourceListResultIterator type. -func NewScopedResourceListResultIterator(page ScopedResourceListResultPage) ScopedResourceListResultIterator { - return ScopedResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (srlr ScopedResourceListResult) IsEmpty() bool { - return srlr.Value == nil || len(*srlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (srlr ScopedResourceListResult) hasNextLink() bool { - return srlr.NextLink != nil && len(*srlr.NextLink) != 0 -} - -// scopedResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (srlr ScopedResourceListResult) scopedResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !srlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(srlr.NextLink))) -} - -// ScopedResourceListResultPage contains a page of ScopedResource values. -type ScopedResourceListResultPage struct { - fn func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error) - srlr ScopedResourceListResult -} - -// 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 *ScopedResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultPage.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.srlr) - if err != nil { - return err - } - page.srlr = 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 *ScopedResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScopedResourceListResultPage) NotDone() bool { - return !page.srlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScopedResourceListResultPage) Response() ScopedResourceListResult { - return page.srlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScopedResourceListResultPage) Values() []ScopedResource { - if page.srlr.IsEmpty() { - return nil - } - return *page.srlr.Value -} - -// Creates a new instance of the ScopedResourceListResultPage type. -func NewScopedResourceListResultPage(cur ScopedResourceListResult, getNextPage func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)) ScopedResourceListResultPage { - return ScopedResourceListResultPage{ - fn: getNextPage, - srlr: cur, - } -} - -// ScopedResourceProperties properties of a private link scoped resource. -type ScopedResourceProperties struct { - // LinkedResourceID - The resource id of the scoped Azure monitor resource. - LinkedResourceID *string `json:"linkedResourceId,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopedResourceProperties. -func (srp ScopedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srp.LinkedResourceID != nil { - objectMap["linkedResourceId"] = srp.LinkedResourceID - } - return json.Marshal(objectMap) -} - -// Settings the diagnostic settings. -type Settings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Metrics - The list of metric settings. - Metrics *[]MetricSettings `json:"metrics,omitempty"` - // Logs - The list of logs settings. - Logs *[]LogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // MarketplacePartnerID - The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. - MarketplacePartnerID *string `json:"marketplacePartnerId,omitempty"` - // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) - LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` -} - -// SettingsCategory the diagnostic settings Category. -type SettingsCategory struct { - // CategoryType - The type of the diagnostic settings category. Possible values include: 'CategoryTypeMetrics', 'CategoryTypeLogs' - CategoryType CategoryType `json:"categoryType,omitempty"` - // CategoryGroups - the collection of what category groups are supported. - CategoryGroups *[]string `json:"categoryGroups,omitempty"` -} - -// SettingsCategoryResource the diagnostic settings category resource. -type SettingsCategoryResource struct { - autorest.Response `json:"-"` - // SettingsCategory - The properties of a Diagnostic Settings Category. - *SettingsCategory `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,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 SettingsCategoryResource. -func (scr SettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scr.SettingsCategory != nil { - objectMap["properties"] = scr.SettingsCategory - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SettingsCategoryResource struct. -func (scr *SettingsCategoryResource) 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 settingsCategory SettingsCategory - err = json.Unmarshal(*v, &settingsCategory) - if err != nil { - return err - } - scr.SettingsCategory = &settingsCategory - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - scr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scr.Type = &typeVar - } - } - } - - return nil -} - -// SettingsCategoryResourceCollection represents a collection of diagnostic setting category resources. -type SettingsCategoryResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings category resources. - Value *[]SettingsCategoryResource `json:"value,omitempty"` -} - -// SettingsResource the diagnostic setting resource. -type SettingsResource struct { - autorest.Response `json:"-"` - // Settings - Properties of a Diagnostic Settings Resource. - *Settings `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,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 SettingsResource. -func (sr SettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Settings != nil { - objectMap["properties"] = sr.Settings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SettingsResource struct. -func (sr *SettingsResource) 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 settings Settings - err = json.Unmarshal(*v, &settings) - if err != nil { - return err - } - sr.Settings = &settings - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - } - } - - return nil -} - -// SettingsResourceCollection represents a collection of alert rule resources. -type SettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of diagnostic settings resources;. - Value *[]SettingsResource `json:"value,omitempty"` -} - -// SmsReceiver an SMS receiver. -type SmsReceiver struct { - // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the SMS receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the SMS receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` - // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' - Status ReceiverStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsReceiver. -func (sr SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.CountryCode != nil { - objectMap["countryCode"] = sr.CountryCode - } - if sr.PhoneNumber != nil { - objectMap["phoneNumber"] = sr.PhoneNumber - } - return json.Marshal(objectMap) -} - -// SubscriptionDiagnosticSettings the subscription diagnostic settings. -type SubscriptionDiagnosticSettings struct { - // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string `json:"eventHubName,omitempty"` - // Logs - The list of logs settings. - Logs *[]SubscriptionLogSettings `json:"logs,omitempty"` - // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string `json:"workspaceId,omitempty"` - // MarketplacePartnerID - The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. - MarketplacePartnerID *string `json:"marketplacePartnerId,omitempty"` -} - -// SubscriptionDiagnosticSettingsResource the subscription diagnostic setting resource. -type SubscriptionDiagnosticSettingsResource struct { - autorest.Response `json:"-"` - // SubscriptionDiagnosticSettings - Properties of a Subscription Diagnostic Settings Resource. - *SubscriptionDiagnosticSettings `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,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 SubscriptionDiagnosticSettingsResource. -func (sdsr SubscriptionDiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdsr.SubscriptionDiagnosticSettings != nil { - objectMap["properties"] = sdsr.SubscriptionDiagnosticSettings - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionDiagnosticSettingsResource struct. -func (sdsr *SubscriptionDiagnosticSettingsResource) 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 subscriptionDiagnosticSettings SubscriptionDiagnosticSettings - err = json.Unmarshal(*v, &subscriptionDiagnosticSettings) - if err != nil { - return err - } - sdsr.SubscriptionDiagnosticSettings = &subscriptionDiagnosticSettings - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sdsr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdsr.Type = &typeVar - } - } - } - - return nil -} - -// SubscriptionDiagnosticSettingsResourceCollection represents a collection of subscription diagnostic -// settings resources. -type SubscriptionDiagnosticSettingsResourceCollection struct { - autorest.Response `json:"-"` - // Value - The collection of subscription diagnostic settings resources. - Value *[]SubscriptionDiagnosticSettingsResource `json:"value,omitempty"` -} - -// SubscriptionLogSettings part of Subscription diagnostic setting. Specifies the settings for a particular -// log. -type SubscriptionLogSettings struct { - // Category - Name of a Subscription Diagnostic Log category for a resource type this setting is applied to. - Category *string `json:"category,omitempty"` - // CategoryGroup - Name of a Subscription Diagnostic Log category group for a resource type this setting is applied to. - CategoryGroup *string `json:"categoryGroup,omitempty"` - // Enabled - a value indicating whether this log is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// 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 -// PrivateLinkScope 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) -} - -// TestNotificationDetailsResponse the details of the test notification results. -type TestNotificationDetailsResponse struct { - autorest.Response `json:"-"` - Context *Context `json:"Context,omitempty"` - // State - The overall state - State *string `json:"State,omitempty"` - // CompletedTime - The completed time - CompletedTime *string `json:"CompletedTime,omitempty"` - // CreatedTime - The created time - CreatedTime *string `json:"CreatedTime,omitempty"` - // ActionDetails - The list of action detail - ActionDetails *[]ActionDetail `json:"ActionDetails,omitempty"` -} - -// TestNotificationResponse the response when test notification succeeded -type TestNotificationResponse struct { - autorest.Response `json:"-"` - // NotificationID - The notification id - NotificationID *string `json:"notificationId,omitempty"` - // CorrelationID - The correlation id - CorrelationID *string `json:"correlationId,omitempty"` - // CreatedTime - The created time - CreatedTime *string `json:"createdTime,omitempty"` -} - -// TimeWindow a specific date-time for the profile. -type TimeWindow struct { - // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string `json:"timeZone,omitempty"` - // Start - the start time for the profile in ISO 8601 format. - Start *date.Time `json:"start,omitempty"` - // End - the end time for the profile in ISO 8601 format. - End *date.Time `json:"end,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"` -} - -// 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) -} - -// VoiceReceiver a voice receiver. -type VoiceReceiver struct { - // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // CountryCode - The country code of the voice receiver. - CountryCode *string `json:"countryCode,omitempty"` - // PhoneNumber - The phone number of the voice receiver. - PhoneNumber *string `json:"phoneNumber,omitempty"` -} - -// WebhookNotification webhook notification of an autoscale event. -type WebhookNotification struct { - // ServiceURI - the service address to receive the notification. - ServiceURI *string `json:"serviceUri,omitempty"` - // Properties - a property bag of settings. This value can be empty. - Properties map[string]*string `json:"properties"` -} - -// MarshalJSON is the custom marshaler for WebhookNotification. -func (wn WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wn.ServiceURI != nil { - objectMap["serviceUri"] = wn.ServiceURI - } - if wn.Properties != nil { - objectMap["properties"] = wn.Properties - } - return json.Marshal(objectMap) -} - -// WebhookReceiver a webhook receiver. -type WebhookReceiver struct { - // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. - Name *string `json:"name,omitempty"` - // ServiceURI - The URI where webhooks should be sent. - ServiceURI *string `json:"serviceUri,omitempty"` - // UseCommonAlertSchema - Indicates whether to use common alert schema. - UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` - // UseAadAuth - Indicates whether or not use AAD authentication. - UseAadAuth *bool `json:"useAadAuth,omitempty"` - // ObjectID - Indicates the webhook app object Id for aad auth. - ObjectID *string `json:"objectId,omitempty"` - // IdentifierURI - Indicates the identifier uri for aad auth. - IdentifierURI *string `json:"identifierUri,omitempty"` - // TenantID - Indicates the tenant id for aad auth. - TenantID *string `json:"tenantId,omitempty"` -} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/predictivemetric.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/predictivemetric.go deleted file mode 100644 index 1f26c4d58b3e..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/predictivemetric.go +++ /dev/null @@ -1,130 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PredictiveMetricClient is the monitor Management Client -type PredictiveMetricClient struct { - BaseClient -} - -// NewPredictiveMetricClient creates an instance of the PredictiveMetricClient client. -func NewPredictiveMetricClient(subscriptionID string) PredictiveMetricClient { - return NewPredictiveMetricClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPredictiveMetricClientWithBaseURI creates an instance of the PredictiveMetricClient 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 NewPredictiveMetricClientWithBaseURI(baseURI string, subscriptionID string) PredictiveMetricClient { - return PredictiveMetricClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get predictive autoscale metric future data -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// autoscaleSettingName - the autoscale setting name. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricNamespace - metric namespace to query metric definitions for. -// metricName - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself -// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** -// aggregation - the list of aggregation types (comma separated) to retrieve. -func (client PredictiveMetricClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string) (result PredictiveResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PredictiveMetricClient.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("diagnostics.PredictiveMetricClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName, timespan, interval, metricNamespace, metricName, aggregation) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PredictiveMetricClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PredictiveMetricClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PredictiveMetricClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PredictiveMetricClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "aggregation": autorest.Encode("query", aggregation), - "api-version": APIVersion, - "interval": autorest.Encode("query", interval), - "metricName": autorest.Encode("query", metricName), - "metricNamespace": autorest.Encode("query", metricNamespace), - "timespan": autorest.Encode("query", timespan), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics", 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 PredictiveMetricClient) 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 PredictiveMetricClient) GetResponder(resp *http.Response) (result PredictiveResponse, 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/monitor/mgmt/2021-05-01-preview/diagnostics/privateendpointconnections.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privateendpointconnections.go deleted file mode 100644 index f2c2e634ec75..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privateendpointconnections.go +++ /dev/null @@ -1,389 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the monitor Management Client -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("diagnostics.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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("diagnostics.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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("diagnostics.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByPrivateLinkScope gets all private endpoint connections on a private link scope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByPrivateLinkScope") - 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("diagnostics.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", err.Error()) - } - - req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure sending request") - return - } - - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - - return -} - -// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, 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/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkresources.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkresources.go deleted file mode 100644 index 7845fd559174..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkresources.go +++ /dev/null @@ -1,205 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the monitor Management Client -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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("diagnostics.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByPrivateLinkScope gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByPrivateLinkScope") - 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("diagnostics.PrivateLinkResourcesClient", "ListByPrivateLinkScope", err.Error()) - } - - req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") - return - } - - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - - return -} - -// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopedresources.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopedresources.go deleted file mode 100644 index 77d9020c8e0b..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopedresources.go +++ /dev/null @@ -1,429 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkScopedResourcesClient is the monitor Management Client -type PrivateLinkScopedResourcesClient struct { - BaseClient -} - -// NewPrivateLinkScopedResourcesClient creates an instance of the PrivateLinkScopedResourcesClient client. -func NewPrivateLinkScopedResourcesClient(subscriptionID string) PrivateLinkScopedResourcesClient { - return NewPrivateLinkScopedResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkScopedResourcesClientWithBaseURI creates an instance of the PrivateLinkScopedResourcesClient 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 NewPrivateLinkScopedResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopedResourcesClient { - return PrivateLinkScopedResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// name - the name of the scoped resource object. -func (client PrivateLinkScopedResourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource) (result PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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: 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("diagnostics.PrivateLinkScopedResourcesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateLinkScopedResourcesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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/privateLinkScopes/{scopeName}/scopedResources/{name}", 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 PrivateLinkScopedResourcesClient) CreateOrUpdateSender(req *http.Request) (future PrivateLinkScopedResourcesCreateOrUpdateFuture, 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 PrivateLinkScopedResourcesClient) CreateOrUpdateResponder(resp *http.Response) (result ScopedResource, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// name - the name of the scoped resource object. -func (client PrivateLinkScopedResourcesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result PrivateLinkScopedResourcesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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: 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("diagnostics.PrivateLinkScopedResourcesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateLinkScopedResourcesClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}/scopedResources/{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 PrivateLinkScopedResourcesClient) DeleteSender(req *http.Request) (future PrivateLinkScopedResourcesDeleteFuture, 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 PrivateLinkScopedResourcesClient) 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 a scoped resource in a private link scope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// name - the name of the scoped resource object. -func (client PrivateLinkScopedResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result ScopedResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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("diagnostics.PrivateLinkScopedResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkScopedResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}/scopedResources/{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 PrivateLinkScopedResourcesClient) 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 PrivateLinkScopedResourcesClient) GetResponder(resp *http.Response) (result ScopedResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByPrivateLinkScope gets all private endpoint connections on a private link scope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result ScopedResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.ListByPrivateLinkScope") - defer func() { - sc := -1 - if result.srlr.Response.Response != nil { - sc = result.srlr.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("diagnostics.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", err.Error()) - } - - result.fn = client.listByPrivateLinkScopeNextResults - req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.srlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") - return - } - - result.srlr, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") - return - } - if result.srlr.hasNextLink() && result.srlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}/scopedResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always -// closes the http.Response Body. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result ScopedResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. -func (client PrivateLinkScopedResourcesClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults ScopedResourceListResult) (result ScopedResourceListResult, err error) { - req, err := lastResults.scopedResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByPrivateLinkScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByPrivateLinkScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result ScopedResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.ListByPrivateLinkScope") - 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) - return -} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopeoperationstatus.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopeoperationstatus.go deleted file mode 100644 index 20c3d6dffb9e..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopeoperationstatus.go +++ /dev/null @@ -1,118 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkScopeOperationStatusClient is the monitor Management Client -type PrivateLinkScopeOperationStatusClient struct { - BaseClient -} - -// NewPrivateLinkScopeOperationStatusClient creates an instance of the PrivateLinkScopeOperationStatusClient client. -func NewPrivateLinkScopeOperationStatusClient(subscriptionID string) PrivateLinkScopeOperationStatusClient { - return NewPrivateLinkScopeOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkScopeOperationStatusClientWithBaseURI creates an instance of the PrivateLinkScopeOperationStatusClient -// 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 NewPrivateLinkScopeOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopeOperationStatusClient { - return PrivateLinkScopeOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the status of an azure asynchronous operation associated with a private link scope operation. -// Parameters: -// asyncOperationID - the operation Id. -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result OperationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopeOperationStatusClient.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("diagnostics.PrivateLinkScopeOperationStatusClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, asyncOperationID, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopeOperationStatusClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkScopeOperationStatusClient) GetPreparer(ctx context.Context, asyncOperationID string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "asyncOperationId": autorest.Encode("path", asyncOperationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopeOperationStatuses/{asyncOperationId}", 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 PrivateLinkScopeOperationStatusClient) 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 PrivateLinkScopeOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatus, 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/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopes.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopes.go deleted file mode 100644 index 9011ab1187a9..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/privatelinkscopes.go +++ /dev/null @@ -1,631 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkScopesClient is the monitor Management Client -type PrivateLinkScopesClient struct { - BaseClient -} - -// NewPrivateLinkScopesClient creates an instance of the PrivateLinkScopesClient client. -func NewPrivateLinkScopesClient(subscriptionID string) PrivateLinkScopesClient { - return NewPrivateLinkScopesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkScopesClientWithBaseURI creates an instance of the PrivateLinkScopesClient 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 NewPrivateLinkScopesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopesClient { - return PrivateLinkScopesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates (or updates) a Azure Monitor PrivateLinkScope. 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. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// azureMonitorPrivateLinkScopePayload - properties that need to be specified to create or update a Azure -// Monitor PrivateLinkScope. -func (client PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope) (result AzureMonitorPrivateLinkScope, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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: azureMonitorPrivateLinkScopePayload, - Constraints: []validation.Constraint{{Target: "azureMonitorPrivateLinkScopePayload.AzureMonitorPrivateLinkScopeProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "azureMonitorPrivateLinkScopePayload.AzureMonitorPrivateLinkScopeProperties.AccessModeSettings", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("diagnostics.PrivateLinkScopesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateLinkScopesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - azureMonitorPrivateLinkScopePayload.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/privateLinkScopes/{scopeName}", pathParameters), - autorest.WithJSON(azureMonitorPrivateLinkScopePayload), - 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) CreateOrUpdateResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, 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 a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkScopesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkScopesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("diagnostics.PrivateLinkScopesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateLinkScopesClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}", 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 PrivateLinkScopesClient) DeleteSender(req *http.Request) (future PrivateLinkScopesDeleteFuture, 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 PrivateLinkScopesClient) 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 returns a Azure Monitor PrivateLinkScope. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -func (client PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string) (result AzureMonitorPrivateLinkScope, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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("diagnostics.PrivateLinkScopesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scopeName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkScopesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) GetResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, 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 Azure Monitor PrivateLinkScopes within a subscription. -func (client PrivateLinkScopesClient) List(ctx context.Context) (result AzureMonitorPrivateLinkScopeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.List") - defer func() { - sc := -1 - if result.amplslr.Response.Response != nil { - sc = result.amplslr.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("diagnostics.PrivateLinkScopesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.amplslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "List", resp, "Failure sending request") - return - } - - result.amplslr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "List", resp, "Failure responding to request") - return - } - if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkScopesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) ListResponder(resp *http.Response) (result AzureMonitorPrivateLinkScopeListResult, 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 PrivateLinkScopesClient) listNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { - req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "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, "diagnostics.PrivateLinkScopesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkScopesClient) ListComplete(ctx context.Context) (result AzureMonitorPrivateLinkScopeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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 Azure Monitor PrivateLinkScopes within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client PrivateLinkScopesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AzureMonitorPrivateLinkScopeListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.amplslr.Response.Response != nil { - sc = result.amplslr.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("diagnostics.PrivateLinkScopesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.amplslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.amplslr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PrivateLinkScopesClient) 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-07-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/privateLinkScopes", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) ListByResourceGroupResponder(resp *http.Response) (result AzureMonitorPrivateLinkScopeListResult, 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 PrivateLinkScopesClient) listByResourceGroupNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { - req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "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, "diagnostics.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkScopesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AzureMonitorPrivateLinkScopeListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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 updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scopeName - the name of the Azure Monitor PrivateLinkScope resource. -// privateLinkScopeTags - updated tag information to set into the PrivateLinkScope instance. -func (client PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource) (result AzureMonitorPrivateLinkScope, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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("diagnostics.PrivateLinkScopesClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, scopeName, privateLinkScopeTags) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "UpdateTags", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "UpdateTags", resp, "Failure sending request") - return - } - - result, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.PrivateLinkScopesClient", "UpdateTags", resp, "Failure responding to request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client PrivateLinkScopesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scopeName": autorest.Encode("path", scopeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-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/privateLinkScopes/{scopeName}", pathParameters), - autorest.WithJSON(privateLinkScopeTags), - 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) UpdateTagsResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, 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/monitor/mgmt/2021-05-01-preview/diagnostics/settings.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settings.go deleted file mode 100644 index 73726518719e..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settings.go +++ /dev/null @@ -1,332 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SettingsClient is the monitor Management Client -type SettingsClient struct { - BaseClient -} - -// NewSettingsClient creates an instance of the SettingsClient client. -func NewSettingsClient(subscriptionID string) SettingsClient { - return NewSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSettingsClientWithBaseURI creates an instance of the SettingsClient 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 NewSettingsClientWithBaseURI(baseURI string, subscriptionID string) SettingsClient { - return SettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client SettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters SettingsResource, name string) (result SettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.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, resourceURI, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters SettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", 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 SettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SettingsClient) CreateOrUpdateResponder(resp *http.Response) (result SettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client SettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceURI, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{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 SettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SettingsClient) 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 active diagnostic settings for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client SettingsClient) Get(ctx context.Context, resourceURI string, name string) (result SettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{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 SettingsClient) 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 SettingsClient) GetResponder(resp *http.Response) (result SettingsResource, 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 active diagnostic settings list for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client SettingsClient) List(ctx context.Context, resourceURI string) (result SettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", 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 SettingsClient) 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 SettingsClient) ListResponder(resp *http.Response) (result SettingsResourceCollection, 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/monitor/mgmt/2021-05-01-preview/diagnostics/settingscategory.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settingscategory.go deleted file mode 100644 index 20823f2912cf..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/settingscategory.go +++ /dev/null @@ -1,180 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SettingsCategoryClient is the monitor Management Client -type SettingsCategoryClient struct { - BaseClient -} - -// NewSettingsCategoryClient creates an instance of the SettingsCategoryClient client. -func NewSettingsCategoryClient(subscriptionID string) SettingsCategoryClient { - return NewSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSettingsCategoryClientWithBaseURI creates an instance of the SettingsCategoryClient 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 NewSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) SettingsCategoryClient { - return SettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the diagnostic settings category for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -// name - the name of the diagnostic setting. -func (client SettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result SettingsCategoryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsCategoryClient.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, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceUri": resourceURI, - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{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 SettingsCategoryClient) 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 SettingsCategoryClient) GetResponder(resp *http.Response) (result SettingsCategoryResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the diagnostic settings categories for the specified resource. -// Parameters: -// resourceURI - the identifier of the resource. -func (client SettingsCategoryClient) List(ctx context.Context, resourceURI string) (result SettingsCategoryResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsCategoryClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SettingsCategoryClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", 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 SettingsCategoryClient) 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 SettingsCategoryClient) ListResponder(resp *http.Response) (result SettingsCategoryResourceCollection, 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/monitor/mgmt/2021-05-01-preview/diagnostics/subscriptiondiagnosticsettings.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/subscriptiondiagnosticsettings.go deleted file mode 100644 index 6cd0e6339d1d..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/subscriptiondiagnosticsettings.go +++ /dev/null @@ -1,353 +0,0 @@ -package diagnostics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SubscriptionDiagnosticSettingsClient is the monitor Management Client -type SubscriptionDiagnosticSettingsClient struct { - BaseClient -} - -// NewSubscriptionDiagnosticSettingsClient creates an instance of the SubscriptionDiagnosticSettingsClient client. -func NewSubscriptionDiagnosticSettingsClient(subscriptionID string) SubscriptionDiagnosticSettingsClient { - return NewSubscriptionDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionDiagnosticSettingsClientWithBaseURI creates an instance of the SubscriptionDiagnosticSettingsClient -// 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 NewSubscriptionDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionDiagnosticSettingsClient { - return SubscriptionDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates subscription diagnostic settings for the specified resource. -// Parameters: -// parameters - parameters supplied to the operation. -// name - the name of the diagnostic setting. -func (client SubscriptionDiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, parameters SubscriptionDiagnosticSettingsResource, name string) (result SubscriptionDiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.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}}}}); err != nil { - return result, validation.NewError("diagnostics.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, parameters, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SubscriptionDiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, parameters SubscriptionDiagnosticSettingsResource, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{name}", 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 SubscriptionDiagnosticSettingsClient) 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 SubscriptionDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result SubscriptionDiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes existing subscription diagnostic settings for the specified resource. -// Parameters: -// name - the name of the diagnostic setting. -func (client SubscriptionDiagnosticSettingsClient) Delete(ctx context.Context, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.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}}}}); err != nil { - return result, validation.NewError("diagnostics.SubscriptionDiagnosticSettingsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubscriptionDiagnosticSettingsClient) DeletePreparer(ctx context.Context, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{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 SubscriptionDiagnosticSettingsClient) 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 SubscriptionDiagnosticSettingsClient) 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 active subscription diagnostic settings for the specified resource. -// Parameters: -// name - the name of the diagnostic setting. -func (client SubscriptionDiagnosticSettingsClient) Get(ctx context.Context, name string) (result SubscriptionDiagnosticSettingsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.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}}}}); err != nil { - return result, validation.NewError("diagnostics.SubscriptionDiagnosticSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, name) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionDiagnosticSettingsClient) GetPreparer(ctx context.Context, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings/{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 SubscriptionDiagnosticSettingsClient) 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 SubscriptionDiagnosticSettingsClient) GetResponder(resp *http.Response) (result SubscriptionDiagnosticSettingsResource, 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 active subscription diagnostic settings list for the specified subscriptionId. -func (client SubscriptionDiagnosticSettingsClient) List(ctx context.Context) (result SubscriptionDiagnosticSettingsResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionDiagnosticSettingsClient.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}}}}); err != nil { - return result, validation.NewError("diagnostics.SubscriptionDiagnosticSettingsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "diagnostics.SubscriptionDiagnosticSettingsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SubscriptionDiagnosticSettingsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/diagnosticSettings", 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 SubscriptionDiagnosticSettingsClient) 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 SubscriptionDiagnosticSettingsClient) ListResponder(resp *http.Response) (result SubscriptionDiagnosticSettingsResourceCollection, 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/monitor/mgmt/2021-05-01-preview/diagnostics/version.go b/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/version.go deleted file mode 100644 index e87c4a7dad45..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/diagnostics/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package diagnostics - -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() + " diagnostics/2021-05-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/monitor/mgmt/2021-05-01-preview/metrics/CHANGELOG.md b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/_meta.json b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/_meta.json deleted file mode 100644 index 8deed43e2d5b..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "9d8640319ef481ae301b67b033d6ae0bd30422c3", - "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", - "tag": "package-2021-05-metrics", - "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-05-metrics --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/monitor/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/monitor/mgmt/2021-05-01-preview/metrics/alerts.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/alerts.go deleted file mode 100644 index 7666df96cdb2..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/alerts.go +++ /dev/null @@ -1,545 +0,0 @@ -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AlertsClient is the monitor Management Client -type AlertsClient struct { - BaseClient -} - -// NewAlertsClient creates an instance of the AlertsClient client. -func NewAlertsClient(subscriptionID string) AlertsClient { - return NewAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertsClientWithBaseURI creates an instance of the AlertsClient 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 NewAlertsClientWithBaseURI(baseURI string, subscriptionID string) AlertsClient { - return AlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to create or update. -func (client AlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertResource) (result AlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("metrics.AlertsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 AlertsClient) 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 AlertsClient) CreateOrUpdateResponder(resp *http.Response) (result AlertResource, 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 alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client AlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.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("metrics.AlertsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 AlertsClient) 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 AlertsClient) 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 an alert rule definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client AlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.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("metrics.AlertsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{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 AlertsClient) 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 AlertsClient) GetResponder(resp *http.Response) (result AlertResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve alert rule definitions in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client AlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.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("metrics.AlertsClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertsClient) 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 = "2018-03-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/metricAlerts", 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 AlertsClient) 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 AlertsClient) ListByResourceGroupResponder(resp *http.Response) (result AlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieve alert rule definitions in a subscription. -func (client AlertsClient) ListBySubscription(ctx context.Context) (result AlertResourceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListBySubscription") - 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}}}}); err != nil { - return result, validation.NewError("metrics.AlertsClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts", 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 AlertsClient) 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 AlertsClient) ListBySubscriptionResponder(resp *http.Response) (result AlertResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an metric alert definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// parameters - the parameters of the rule to update. -func (client AlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertResourcePatch) (result AlertResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.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("metrics.AlertsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}", 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 AlertsClient) 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 AlertsClient) UpdateResponder(resp *http.Response) (result AlertResource, 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/monitor/mgmt/2021-05-01-preview/metrics/alertsstatus.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/alertsstatus.go deleted file mode 100644 index b6af7a518498..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/alertsstatus.go +++ /dev/null @@ -1,204 +0,0 @@ -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AlertsStatusClient is the monitor Management Client -type AlertsStatusClient struct { - BaseClient -} - -// NewAlertsStatusClient creates an instance of the AlertsStatusClient client. -func NewAlertsStatusClient(subscriptionID string) AlertsStatusClient { - return NewAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertsStatusClientWithBaseURI creates an instance of the AlertsStatusClient 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 NewAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) AlertsStatusClient { - return AlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -func (client AlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result AlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsStatusClient.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("metrics.AlertsStatusClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status", 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 AlertsStatusClient) 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 AlertsStatusClient) ListResponder(resp *http.Response) (result AlertStatusCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByName retrieve an alert rule status. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// ruleName - the name of the rule. -// statusName - the name of the status. -func (client AlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result AlertStatusCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsStatusClient.ListByName") - 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("metrics.AlertsStatusClient", "ListByName", err.Error()) - } - - req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "ListByName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "ListByName", resp, "Failure sending request") - return - } - - result, err = client.ListByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.AlertsStatusClient", "ListByName", resp, "Failure responding to request") - return - } - - return -} - -// ListByNamePreparer prepares the ListByName request. -func (client AlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "statusName": autorest.Encode("path", statusName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-03-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/metricAlerts/{ruleName}/status/{statusName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNameSender sends the ListByName request. The method will close the -// http.Response Body if it receives an error. -func (client AlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNameResponder handles the response to the ListByName request. The method always -// closes the http.Response Body. -func (client AlertsStatusClient) ListByNameResponder(resp *http.Response) (result AlertStatusCollection, 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/monitor/mgmt/2021-05-01-preview/metrics/baselines.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/baselines.go deleted file mode 100644 index 9ad5c9e5238a..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/baselines.go +++ /dev/null @@ -1,146 +0,0 @@ -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BaselinesClient is the monitor Management Client -type BaselinesClient struct { - BaseClient -} - -// NewBaselinesClient creates an instance of the BaselinesClient client. -func NewBaselinesClient(subscriptionID string) BaselinesClient { - return NewBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBaselinesClientWithBaseURI creates an instance of the BaselinesClient 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 NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) BaselinesClient { - return BaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric baseline values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnames - the names of the metrics (comma separated) to retrieve. -// metricnamespace - metric namespace where the metrics you want reside. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// sensitivities - the list of sensitivities (comma separated) to retrieve. -// filter - the **$filter** is used to reduce the set of metric data returned. Example: Metric contains -// metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or b2 **$filter=A eq 'a1' and B -// eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' or B = -// 'b2'** This is invalid because the logical or operator cannot separate two different metadata names. - -// Return all time series where A = a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - -// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When -// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead -// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name -// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq -// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** -// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. -func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result BaselinesResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaselinesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.BaselinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.BaselinesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.BaselinesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2019-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if len(sensitivities) > 0 { - queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricBaselines", 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 BaselinesClient) 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 BaselinesClient) ListResponder(resp *http.Response) (result BaselinesResponse, 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/monitor/mgmt/2021-05-01-preview/metrics/client.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/client.go deleted file mode 100644 index 5a64fd55cbc9..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package metrics implements the Azure ARM Metrics service API version . -// -// Monitor Management Client -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Metrics - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Metrics. -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/monitor/mgmt/2021-05-01-preview/metrics/definitions.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/definitions.go deleted file mode 100644 index 9e98238293bc..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/definitions.go +++ /dev/null @@ -1,193 +0,0 @@ -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DefinitionsClient is the monitor Management Client -type DefinitionsClient struct { - BaseClient -} - -// NewDefinitionsClient creates an instance of the DefinitionsClient client. -func NewDefinitionsClient(subscriptionID string) DefinitionsClient { - return NewDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDefinitionsClientWithBaseURI creates an instance of the DefinitionsClient 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 NewDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) DefinitionsClient { - return DefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric definitions for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// metricnamespace - metric namespace where the metrics you want reside. -func (client DefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result DefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", 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 DefinitionsClient) 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 DefinitionsClient) ListResponder(resp *http.Response) (result DefinitionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtSubscriptionScope lists the metric definitions for the subscription. -// Parameters: -// region - the region where the metrics you want reside. -// metricnamespace - metric namespace where the metrics you want reside. -func (client DefinitionsClient) ListAtSubscriptionScope(ctx context.Context, region string, metricnamespace string) (result SubscriptionScopeMetricDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DefinitionsClient.ListAtSubscriptionScope") - 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}}}}); err != nil { - return result, validation.NewError("metrics.DefinitionsClient", "ListAtSubscriptionScope", err.Error()) - } - - req, err := client.ListAtSubscriptionScopePreparer(ctx, region, metricnamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "ListAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtSubscriptionScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "ListAtSubscriptionScope", resp, "Failure sending request") - return - } - - result, err = client.ListAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.DefinitionsClient", "ListAtSubscriptionScope", resp, "Failure responding to request") - return - } - - return -} - -// ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request. -func (client DefinitionsClient) ListAtSubscriptionScopePreparer(ctx context.Context, region string, metricnamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "region": autorest.Encode("query", region), - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client DefinitionsClient) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client DefinitionsClient) ListAtSubscriptionScopeResponder(resp *http.Response) (result SubscriptionScopeMetricDefinitionCollection, 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/monitor/mgmt/2021-05-01-preview/metrics/enums.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/enums.go deleted file mode 100644 index b0632c2bfbfa..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/enums.go +++ /dev/null @@ -1,324 +0,0 @@ -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AggregationType enumerates the values for aggregation type. -type AggregationType string - -const ( - // AggregationTypeAverage ... - AggregationTypeAverage AggregationType = "Average" - // AggregationTypeCount ... - AggregationTypeCount AggregationType = "Count" - // AggregationTypeMaximum ... - AggregationTypeMaximum AggregationType = "Maximum" - // AggregationTypeMinimum ... - AggregationTypeMinimum AggregationType = "Minimum" - // AggregationTypeNone ... - AggregationTypeNone AggregationType = "None" - // AggregationTypeTotal ... - AggregationTypeTotal AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{AggregationTypeAverage, AggregationTypeCount, AggregationTypeMaximum, AggregationTypeMinimum, AggregationTypeNone, AggregationTypeTotal} -} - -// AggregationTypeEnum enumerates the values for aggregation type enum. -type AggregationTypeEnum string - -const ( - // AggregationTypeEnumAverage ... - AggregationTypeEnumAverage AggregationTypeEnum = "Average" - // AggregationTypeEnumCount ... - AggregationTypeEnumCount AggregationTypeEnum = "Count" - // AggregationTypeEnumMaximum ... - AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" - // AggregationTypeEnumMinimum ... - AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" - // AggregationTypeEnumTotal ... - AggregationTypeEnumTotal AggregationTypeEnum = "Total" -) - -// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. -func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { - return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} -} - -// BaselineSensitivity enumerates the values for baseline sensitivity. -type BaselineSensitivity string - -const ( - // BaselineSensitivityHigh ... - BaselineSensitivityHigh BaselineSensitivity = "High" - // BaselineSensitivityLow ... - BaselineSensitivityLow BaselineSensitivity = "Low" - // BaselineSensitivityMedium ... - BaselineSensitivityMedium BaselineSensitivity = "Medium" -) - -// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. -func PossibleBaselineSensitivityValues() []BaselineSensitivity { - return []BaselineSensitivity{BaselineSensitivityHigh, BaselineSensitivityLow, BaselineSensitivityMedium} -} - -// CriterionType enumerates the values for criterion type. -type CriterionType string - -const ( - // CriterionTypeDynamicThresholdCriterion ... - CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" - // CriterionTypeMultiMetricCriteria ... - CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" - // CriterionTypeStaticThresholdCriterion ... - CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" -) - -// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. -func PossibleCriterionTypeValues() []CriterionType { - return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} -} - -// DynamicThresholdOperator enumerates the values for dynamic threshold operator. -type DynamicThresholdOperator string - -const ( - // DynamicThresholdOperatorGreaterOrLessThan ... - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - // DynamicThresholdOperatorGreaterThan ... - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - // DynamicThresholdOperatorLessThan ... - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} -} - -// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. -type DynamicThresholdSensitivity string - -const ( - // DynamicThresholdSensitivityHigh ... - DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" - // DynamicThresholdSensitivityLow ... - DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" - // DynamicThresholdSensitivityMedium ... - DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} -} - -// 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" - // 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, MetricAggregationTypeTotal} -} - -// MetricClass enumerates the values for metric class. -type MetricClass string - -const ( - // MetricClassAvailability ... - MetricClassAvailability MetricClass = "Availability" - // MetricClassErrors ... - MetricClassErrors MetricClass = "Errors" - // MetricClassLatency ... - MetricClassLatency MetricClass = "Latency" - // MetricClassSaturation ... - MetricClassSaturation MetricClass = "Saturation" - // MetricClassTransactions ... - MetricClassTransactions MetricClass = "Transactions" -) - -// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. -func PossibleMetricClassValues() []MetricClass { - return []MetricClass{MetricClassAvailability, MetricClassErrors, MetricClassLatency, MetricClassSaturation, MetricClassTransactions} -} - -// MetricResultType enumerates the values for metric result type. -type MetricResultType string - -const ( - // MetricResultTypeData ... - MetricResultTypeData MetricResultType = "Data" - // MetricResultTypeMetadata ... - MetricResultTypeMetadata MetricResultType = "Metadata" -) - -// PossibleMetricResultTypeValues returns an array of possible values for the MetricResultType const type. -func PossibleMetricResultTypeValues() []MetricResultType { - return []MetricResultType{MetricResultTypeData, MetricResultTypeMetadata} -} - -// MetricUnit enumerates the values for metric unit. -type MetricUnit string - -const ( - // MetricUnitBitsPerSecond ... - MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" - // MetricUnitBytes ... - MetricUnitBytes MetricUnit = "Bytes" - // MetricUnitByteSeconds ... - MetricUnitByteSeconds MetricUnit = "ByteSeconds" - // MetricUnitBytesPerSecond ... - MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" - // MetricUnitCores ... - MetricUnitCores MetricUnit = "Cores" - // MetricUnitCount ... - MetricUnitCount MetricUnit = "Count" - // MetricUnitCountPerSecond ... - MetricUnitCountPerSecond MetricUnit = "CountPerSecond" - // MetricUnitMilliCores ... - MetricUnitMilliCores MetricUnit = "MilliCores" - // MetricUnitMilliSeconds ... - MetricUnitMilliSeconds MetricUnit = "MilliSeconds" - // MetricUnitNanoCores ... - MetricUnitNanoCores MetricUnit = "NanoCores" - // MetricUnitPercent ... - MetricUnitPercent MetricUnit = "Percent" - // MetricUnitSeconds ... - MetricUnitSeconds MetricUnit = "Seconds" - // MetricUnitUnspecified ... - MetricUnitUnspecified MetricUnit = "Unspecified" -) - -// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. -func PossibleMetricUnitValues() []MetricUnit { - return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} -} - -// NamespaceClassification enumerates the values for namespace classification. -type NamespaceClassification string - -const ( - // NamespaceClassificationCustom ... - NamespaceClassificationCustom NamespaceClassification = "Custom" - // NamespaceClassificationPlatform ... - NamespaceClassificationPlatform NamespaceClassification = "Platform" - // NamespaceClassificationQos ... - NamespaceClassificationQos NamespaceClassification = "Qos" -) - -// PossibleNamespaceClassificationValues returns an array of possible values for the NamespaceClassification const type. -func PossibleNamespaceClassificationValues() []NamespaceClassification { - return []NamespaceClassification{NamespaceClassificationCustom, NamespaceClassificationPlatform, NamespaceClassificationQos} -} - -// OdataType enumerates the values for odata type. -type OdataType string - -const ( - // OdataTypeMetricAlertCriteria ... - OdataTypeMetricAlertCriteria OdataType = "MetricAlertCriteria" - // OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataType = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... - OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataType = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - // OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... - OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataType = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. -func PossibleOdataTypeValues() []OdataType { - return []OdataType{OdataTypeMetricAlertCriteria, OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} -} - -// Operator enumerates the values for operator. -type Operator string - -const ( - // OperatorEquals ... - OperatorEquals Operator = "Equals" - // OperatorGreaterThan ... - OperatorGreaterThan Operator = "GreaterThan" - // OperatorGreaterThanOrEqual ... - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - // OperatorLessThan ... - OperatorLessThan Operator = "LessThan" - // OperatorLessThanOrEqual ... - OperatorLessThanOrEqual Operator = "LessThanOrEqual" -) - -// PossibleOperatorValues returns an array of possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // ResultTypeData ... - ResultTypeData ResultType = "Data" - // ResultTypeMetadata ... - ResultTypeMetadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{ResultTypeData, ResultTypeMetadata} -} - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metrics.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metrics.go deleted file mode 100644 index f6839198ed00..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metrics.go +++ /dev/null @@ -1,449 +0,0 @@ -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// Client is the monitor Management Client -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client 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 NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List **Lists the metric values for a resource**. -// Parameters: -// resourceURI - the identifier of the resource. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace where the metrics you want reside. -// autoAdjustTimegrain - when set to true, if the timespan passed in is not supported by this metric, the API -// will return the result using the closest supported timespan. When set to false, an error is returned for -// invalid timespan parameters. Defaults to false. -// validateDimensions - when set to false, invalid filter parameter values will be ignored. When set to true, -// an error is returned for invalid filter parameters. Defaults to true. -func (client Client) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (result Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace, autoAdjustTimegrain, validateDimensions) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.Client", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.Client", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.Client", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client Client) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - if autoAdjustTimegrain != nil { - queryParameters["AutoAdjustTimegrain"] = autorest.Encode("query", *autoAdjustTimegrain) - } - if validateDimensions != nil { - queryParameters["ValidateDimensions"] = autorest.Encode("query", *validateDimensions) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/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 Client) 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 Client) ListResponder(resp *http.Response) (result Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtSubscriptionScope **Lists the metric data for a subscription**. -// Parameters: -// region - the region where the metrics you want reside. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace where the metrics you want reside. -// autoAdjustTimegrain - when set to true, if the timespan passed in is not supported by this metric, the API -// will return the result using the closest supported timespan. When set to false, an error is returned for -// invalid timespan parameters. Defaults to false. -// validateDimensions - when set to false, invalid filter parameter values will be ignored. When set to true, -// an error is returned for invalid filter parameters. Defaults to true. -func (client Client) ListAtSubscriptionScope(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (result SubscriptionScopeMetricResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAtSubscriptionScope") - 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}}}}); err != nil { - return result, validation.NewError("metrics.Client", "ListAtSubscriptionScope", err.Error()) - } - - req, err := client.ListAtSubscriptionScopePreparer(ctx, region, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace, autoAdjustTimegrain, validateDimensions) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtSubscriptionScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScope", resp, "Failure sending request") - return - } - - result, err = client.ListAtSubscriptionScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScope", resp, "Failure responding to request") - return - } - - return -} - -// ListAtSubscriptionScopePreparer prepares the ListAtSubscriptionScope request. -func (client Client) ListAtSubscriptionScopePreparer(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "region": autorest.Encode("query", region), - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - if autoAdjustTimegrain != nil { - queryParameters["AutoAdjustTimegrain"] = autorest.Encode("query", *autoAdjustTimegrain) - } - if validateDimensions != nil { - queryParameters["ValidateDimensions"] = autorest.Encode("query", *validateDimensions) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAtSubscriptionScopeSender sends the ListAtSubscriptionScope request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListAtSubscriptionScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAtSubscriptionScopeResponder handles the response to the ListAtSubscriptionScope request. The method always -// closes the http.Response Body. -func (client Client) ListAtSubscriptionScopeResponder(resp *http.Response) (result SubscriptionScopeMetricResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtSubscriptionScopePost **Lists the metric data for a subscription**. Parameters can be specified on either -// query params or the body. -// Parameters: -// region - the region where the metrics you want reside. -// timespan - the timespan of the query. It is a string with the following format -// 'startDateTime_ISO/endDateTime_ISO'. -// interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. -// aggregation - the list of aggregation types (comma separated) to retrieve. -// top - the maximum number of records to retrieve. -// Valid only if $filter is specified. -// Defaults to 10. -// orderby - the aggregation to use for sorting results and the direction of the sort. -// Only one order can be specified. -// Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. -// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the -// operation's description for details. -// metricnamespace - metric namespace where the metrics you want reside. -// autoAdjustTimegrain - when set to true, if the timespan passed in is not supported by this metric, the API -// will return the result using the closest supported timespan. When set to false, an error is returned for -// invalid timespan parameters. Defaults to false. -// validateDimensions - when set to false, invalid filter parameter values will be ignored. When set to true, -// an error is returned for invalid filter parameters. Defaults to true. -// body - parameters serialized in the body -func (client Client) ListAtSubscriptionScopePost(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool, body *SubscriptionScopeMetricsRequestBodyParameters) (result SubscriptionScopeMetricResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAtSubscriptionScopePost") - 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}}}}); err != nil { - return result, validation.NewError("metrics.Client", "ListAtSubscriptionScopePost", err.Error()) - } - - req, err := client.ListAtSubscriptionScopePostPreparer(ctx, region, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace, autoAdjustTimegrain, validateDimensions, body) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScopePost", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtSubscriptionScopePostSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScopePost", resp, "Failure sending request") - return - } - - result, err = client.ListAtSubscriptionScopePostResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.Client", "ListAtSubscriptionScopePost", resp, "Failure responding to request") - return - } - - return -} - -// ListAtSubscriptionScopePostPreparer prepares the ListAtSubscriptionScopePost request. -func (client Client) ListAtSubscriptionScopePostPreparer(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool, body *SubscriptionScopeMetricsRequestBodyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "region": autorest.Encode("query", region), - } - if len(timespan) > 0 { - queryParameters["timespan"] = autorest.Encode("query", timespan) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - if len(metricnames) > 0 { - queryParameters["metricnames"] = autorest.Encode("query", metricnames) - } - if len(aggregation) > 0 { - queryParameters["aggregation"] = autorest.Encode("query", aggregation) - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["orderby"] = autorest.Encode("query", orderby) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(string(resultType)) > 0 { - queryParameters["resultType"] = autorest.Encode("query", resultType) - } - if len(metricnamespace) > 0 { - queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) - } - if autoAdjustTimegrain != nil { - queryParameters["AutoAdjustTimegrain"] = autorest.Encode("query", *autoAdjustTimegrain) - } - if validateDimensions != nil { - queryParameters["ValidateDimensions"] = autorest.Encode("query", *validateDimensions) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAtSubscriptionScopePostSender sends the ListAtSubscriptionScopePost request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListAtSubscriptionScopePostSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAtSubscriptionScopePostResponder handles the response to the ListAtSubscriptionScopePost request. The method always -// closes the http.Response Body. -func (client Client) ListAtSubscriptionScopePostResponder(resp *http.Response) (result SubscriptionScopeMetricResponse, 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/monitor/mgmt/2021-05-01-preview/metrics/metricsapi/interfaces.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metricsapi/interfaces.go deleted file mode 100644 index 2c42fd2db71f..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/metricsapi/interfaces.go +++ /dev/null @@ -1,71 +0,0 @@ -package metricsapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/monitor/mgmt/2021-05-01-preview/metrics" - "github.com/Azure/go-autorest/autorest" -) - -// NamespacesClientAPI contains the set of methods on the NamespacesClient type. -type NamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result metrics.NamespaceCollection, err error) -} - -var _ NamespacesClientAPI = (*metrics.NamespacesClient)(nil) - -// AlertsClientAPI contains the set of methods on the AlertsClient type. -type AlertsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters metrics.AlertResource) (result metrics.AlertResource, err error) - Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, ruleName string) (result metrics.AlertResource, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result metrics.AlertResourceCollection, err error) - ListBySubscription(ctx context.Context) (result metrics.AlertResourceCollection, err error) - Update(ctx context.Context, resourceGroupName string, ruleName string, parameters metrics.AlertResourcePatch) (result metrics.AlertResource, err error) -} - -var _ AlertsClientAPI = (*metrics.AlertsClient)(nil) - -// AlertsStatusClientAPI contains the set of methods on the AlertsStatusClient type. -type AlertsStatusClientAPI interface { - List(ctx context.Context, resourceGroupName string, ruleName string) (result metrics.AlertStatusCollection, err error) - ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result metrics.AlertStatusCollection, err error) -} - -var _ AlertsStatusClientAPI = (*metrics.AlertsStatusClient)(nil) - -// BaselinesClientAPI contains the set of methods on the BaselinesClient type. -type BaselinesClientAPI interface { - List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType metrics.ResultType) (result metrics.BaselinesResponse, err error) -} - -var _ BaselinesClientAPI = (*metrics.BaselinesClient)(nil) - -// DefinitionsClientAPI contains the set of methods on the DefinitionsClient type. -type DefinitionsClientAPI interface { - List(ctx context.Context, resourceURI string, metricnamespace string) (result metrics.DefinitionCollection, err error) - ListAtSubscriptionScope(ctx context.Context, region string, metricnamespace string) (result metrics.SubscriptionScopeMetricDefinitionCollection, err error) -} - -var _ DefinitionsClientAPI = (*metrics.DefinitionsClient)(nil) - -// ClientAPI contains the set of methods on the Client type. -type ClientAPI interface { - List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType metrics.ResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (result metrics.Response, err error) - ListAtSubscriptionScope(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType metrics.MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool) (result metrics.SubscriptionScopeMetricResponse, err error) - ListAtSubscriptionScopePost(ctx context.Context, region string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType metrics.MetricResultType, metricnamespace string, autoAdjustTimegrain *bool, validateDimensions *bool, body *metrics.SubscriptionScopeMetricsRequestBodyParameters) (result metrics.SubscriptionScopeMetricResponse, err error) -} - -var _ ClientAPI = (*metrics.Client)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result metrics.OperationListResult, err error) -} - -var _ OperationsClientAPI = (*metrics.OperationsClient)(nil) diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/models.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/models.go deleted file mode 100644 index 236640cd4457..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/models.go +++ /dev/null @@ -1,2336 +0,0 @@ -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-05-01-preview/metrics" - -// AlertAction an alert action. -type AlertAction struct { - // ActionGroupID - the id of the action group to use. - ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. - WebHookProperties map[string]*string `json:"webHookProperties"` -} - -// MarshalJSON is the custom marshaler for AlertAction. -func (aa AlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aa.ActionGroupID != nil { - objectMap["actionGroupId"] = aa.ActionGroupID - } - if aa.WebHookProperties != nil { - objectMap["webHookProperties"] = aa.WebHookProperties - } - return json.Marshal(objectMap) -} - -// BasicAlertCriteria the rule criteria that defines the conditions of the alert rule. -type BasicAlertCriteria interface { - AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) - AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) - AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) - AsAlertCriteria() (*AlertCriteria, bool) -} - -// AlertCriteria the rule criteria that defines the conditions of the alert rule. -type AlertCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataType `json:"odata.type,omitempty"` -} - -func unmarshalBasicAlertCriteria(body []byte) (BasicAlertCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["odata.type"] { - case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - var asrmmc AlertSingleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &asrmmc) - return asrmmc, err - case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - var wlac WebtestLocationAvailabilityCriteria - err := json.Unmarshal(body, &wlac) - return wlac, err - case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - var amrmmc AlertMultipleResourceMultipleMetricCriteria - err := json.Unmarshal(body, &amrmmc) - return amrmmc, err - default: - var ac AlertCriteria - err := json.Unmarshal(body, &ac) - return ac, err - } -} -func unmarshalBasicAlertCriteriaArray(body []byte) ([]BasicAlertCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - acArray := make([]BasicAlertCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ac, err := unmarshalBasicAlertCriteria(*rawMessage) - if err != nil { - return nil, err - } - acArray[index] = ac - } - return acArray, nil -} - -// MarshalJSON is the custom marshaler for AlertCriteria. -func (ac AlertCriteria) MarshalJSON() ([]byte, error) { - ac.OdataType = OdataTypeMetricAlertCriteria - objectMap := make(map[string]interface{}) - if ac.OdataType != "" { - objectMap["odata.type"] = ac.OdataType - } - for k, v := range ac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsAlertSingleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertCriteria. -func (ac AlertCriteria) AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicAlertCriteria implementation for AlertCriteria. -func (ac AlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsAlertMultipleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertCriteria. -func (ac AlertCriteria) AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsAlertCriteria is the BasicAlertCriteria implementation for AlertCriteria. -func (ac AlertCriteria) AsAlertCriteria() (*AlertCriteria, bool) { - return &ac, true -} - -// AsBasicAlertCriteria is the BasicAlertCriteria implementation for AlertCriteria. -func (ac AlertCriteria) AsBasicAlertCriteria() (BasicAlertCriteria, bool) { - return &ac, true -} - -// UnmarshalJSON is the custom unmarshaler for AlertCriteria struct. -func (ac *AlertCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ac.AdditionalProperties == nil { - ac.AdditionalProperties = make(map[string]interface{}) - } - ac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataType - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - ac.OdataType = odataType - } - } - } - - return nil -} - -// AlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple resource -// that has multiple metric criteria. -type AlertMultipleResourceMultipleMetricCriteria struct { - // AllOf - the list of multiple metric criteria for this 'all of' operation. - AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertMultipleResourceMultipleMetricCriteria. -func (amrmmc AlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - amrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if amrmmc.AllOf != nil { - objectMap["allOf"] = amrmmc.AllOf - } - if amrmmc.OdataType != "" { - objectMap["odata.type"] = amrmmc.OdataType - } - for k, v := range amrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsAlertSingleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. -func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. -func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsAlertMultipleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. -func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) { - return &amrmmc, true -} - -// AsAlertCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. -func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsAlertCriteria() (*AlertCriteria, bool) { - return nil, false -} - -// AsBasicAlertCriteria is the BasicAlertCriteria implementation for AlertMultipleResourceMultipleMetricCriteria. -func (amrmmc AlertMultipleResourceMultipleMetricCriteria) AsBasicAlertCriteria() (BasicAlertCriteria, bool) { - return &amrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for AlertMultipleResourceMultipleMetricCriteria struct. -func (amrmmc *AlertMultipleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) - if err != nil { - return err - } - amrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if amrmmc.AdditionalProperties == nil { - amrmmc.AdditionalProperties = make(map[string]interface{}) - } - amrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataType - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - amrmmc.OdataType = odataType - } - } - } - - return nil -} - -// AlertProperties an alert rule. -type AlertProperties struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]AlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool `json:"isMigrated,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertProperties. -func (ap AlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Description != nil { - objectMap["description"] = ap.Description - } - if ap.Severity != nil { - objectMap["severity"] = ap.Severity - } - if ap.Enabled != nil { - objectMap["enabled"] = ap.Enabled - } - if ap.Scopes != nil { - objectMap["scopes"] = ap.Scopes - } - if ap.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = ap.EvaluationFrequency - } - if ap.WindowSize != nil { - objectMap["windowSize"] = ap.WindowSize - } - if ap.TargetResourceType != nil { - objectMap["targetResourceType"] = ap.TargetResourceType - } - if ap.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = ap.TargetResourceRegion - } - objectMap["criteria"] = ap.Criteria - if ap.AutoMitigate != nil { - objectMap["autoMitigate"] = ap.AutoMitigate - } - if ap.Actions != nil { - objectMap["actions"] = ap.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertProperties struct. -func (ap *AlertProperties) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ap.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - ap.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - ap.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - ap.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - ap.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - ap.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - ap.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - ap.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicAlertCriteria(*v) - if err != nil { - return err - } - ap.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - ap.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []AlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - ap.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - ap.LastUpdatedTime = &lastUpdatedTime - } - case "isMigrated": - if v != nil { - var isMigrated bool - err = json.Unmarshal(*v, &isMigrated) - if err != nil { - return err - } - ap.IsMigrated = &isMigrated - } - } - } - - return nil -} - -// AlertPropertiesPatch an alert rule properties for patch. -type AlertPropertiesPatch struct { - // Description - the description of the metric alert that will be included in the alert email. - Description *string `json:"description,omitempty"` - // Severity - Alert severity {0, 1, 2, 3, 4} - Severity *int32 `json:"severity,omitempty"` - // Enabled - the flag that indicates whether the metric alert is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Scopes - the list of resource id's that this metric alert is scoped to. - Scopes *[]string `json:"scopes,omitempty"` - // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` - // Criteria - defines the specific alert criteria information. - Criteria BasicAlertCriteria `json:"criteria,omitempty"` - // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions *[]AlertAction `json:"actions,omitempty"` - // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool `json:"isMigrated,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertPropertiesPatch. -func (app AlertPropertiesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if app.Description != nil { - objectMap["description"] = app.Description - } - if app.Severity != nil { - objectMap["severity"] = app.Severity - } - if app.Enabled != nil { - objectMap["enabled"] = app.Enabled - } - if app.Scopes != nil { - objectMap["scopes"] = app.Scopes - } - if app.EvaluationFrequency != nil { - objectMap["evaluationFrequency"] = app.EvaluationFrequency - } - if app.WindowSize != nil { - objectMap["windowSize"] = app.WindowSize - } - if app.TargetResourceType != nil { - objectMap["targetResourceType"] = app.TargetResourceType - } - if app.TargetResourceRegion != nil { - objectMap["targetResourceRegion"] = app.TargetResourceRegion - } - objectMap["criteria"] = app.Criteria - if app.AutoMitigate != nil { - objectMap["autoMitigate"] = app.AutoMitigate - } - if app.Actions != nil { - objectMap["actions"] = app.Actions - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertPropertiesPatch struct. -func (app *AlertPropertiesPatch) 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 "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - app.Description = &description - } - case "severity": - if v != nil { - var severity int32 - err = json.Unmarshal(*v, &severity) - if err != nil { - return err - } - app.Severity = &severity - } - case "enabled": - if v != nil { - var enabled bool - err = json.Unmarshal(*v, &enabled) - if err != nil { - return err - } - app.Enabled = &enabled - } - case "scopes": - if v != nil { - var scopes []string - err = json.Unmarshal(*v, &scopes) - if err != nil { - return err - } - app.Scopes = &scopes - } - case "evaluationFrequency": - if v != nil { - var evaluationFrequency string - err = json.Unmarshal(*v, &evaluationFrequency) - if err != nil { - return err - } - app.EvaluationFrequency = &evaluationFrequency - } - case "windowSize": - if v != nil { - var windowSize string - err = json.Unmarshal(*v, &windowSize) - if err != nil { - return err - } - app.WindowSize = &windowSize - } - case "targetResourceType": - if v != nil { - var targetResourceType string - err = json.Unmarshal(*v, &targetResourceType) - if err != nil { - return err - } - app.TargetResourceType = &targetResourceType - } - case "targetResourceRegion": - if v != nil { - var targetResourceRegion string - err = json.Unmarshal(*v, &targetResourceRegion) - if err != nil { - return err - } - app.TargetResourceRegion = &targetResourceRegion - } - case "criteria": - if v != nil { - criteria, err := unmarshalBasicAlertCriteria(*v) - if err != nil { - return err - } - app.Criteria = criteria - } - case "autoMitigate": - if v != nil { - var autoMitigate bool - err = json.Unmarshal(*v, &autoMitigate) - if err != nil { - return err - } - app.AutoMitigate = &autoMitigate - } - case "actions": - if v != nil { - var actions []AlertAction - err = json.Unmarshal(*v, &actions) - if err != nil { - return err - } - app.Actions = &actions - } - case "lastUpdatedTime": - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*v, &lastUpdatedTime) - if err != nil { - return err - } - app.LastUpdatedTime = &lastUpdatedTime - } - case "isMigrated": - if v != nil { - var isMigrated bool - err = json.Unmarshal(*v, &isMigrated) - if err != nil { - return err - } - app.IsMigrated = &isMigrated - } - } - } - - return nil -} - -// AlertResource the metric alert resource. -type AlertResource struct { - autorest.Response `json:"-"` - // AlertProperties - The alert rule properties of the resource. - *AlertProperties `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 AlertResource. -func (ar AlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.AlertProperties != nil { - objectMap["properties"] = ar.AlertProperties - } - if ar.Location != nil { - objectMap["location"] = ar.Location - } - if ar.Tags != nil { - objectMap["tags"] = ar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertResource struct. -func (ar *AlertResource) 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 alertProperties AlertProperties - err = json.Unmarshal(*v, &alertProperties) - if err != nil { - return err - } - ar.AlertProperties = &alertProperties - } - 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 "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ar.Tags = tags - } - } - } - - return nil -} - -// AlertResourceCollection represents a collection of alert rule resources. -type AlertResourceCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertResource `json:"value,omitempty"` -} - -// AlertResourcePatch the metric alert resource for patch operations. -type AlertResourcePatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AlertPropertiesPatch - The alert rule properties of the resource. - *AlertPropertiesPatch `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertResourcePatch. -func (arp AlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Tags != nil { - objectMap["tags"] = arp.Tags - } - if arp.AlertPropertiesPatch != nil { - objectMap["properties"] = arp.AlertPropertiesPatch - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AlertResourcePatch struct. -func (arp *AlertResourcePatch) 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 - } - arp.Tags = tags - } - case "properties": - if v != nil { - var alertPropertiesPatch AlertPropertiesPatch - err = json.Unmarshal(*v, &alertPropertiesPatch) - if err != nil { - return err - } - arp.AlertPropertiesPatch = &alertPropertiesPatch - } - } - } - - return nil -} - -// AlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single resource that -// has multiple metric criteria. -type AlertSingleResourceMultipleMetricCriteria struct { - // AllOf - The list of metric criteria for this 'all of' operation. - AllOf *[]Criteria `json:"allOf,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertSingleResourceMultipleMetricCriteria. -func (asrmmc AlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - asrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - objectMap := make(map[string]interface{}) - if asrmmc.AllOf != nil { - objectMap["allOf"] = asrmmc.AllOf - } - if asrmmc.OdataType != "" { - objectMap["odata.type"] = asrmmc.OdataType - } - for k, v := range asrmmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsAlertSingleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. -func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) { - return &asrmmc, true -} - -// AsWebtestLocationAvailabilityCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. -func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return nil, false -} - -// AsAlertMultipleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. -func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsAlertCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. -func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsAlertCriteria() (*AlertCriteria, bool) { - return nil, false -} - -// AsBasicAlertCriteria is the BasicAlertCriteria implementation for AlertSingleResourceMultipleMetricCriteria. -func (asrmmc AlertSingleResourceMultipleMetricCriteria) AsBasicAlertCriteria() (BasicAlertCriteria, bool) { - return &asrmmc, true -} - -// UnmarshalJSON is the custom unmarshaler for AlertSingleResourceMultipleMetricCriteria struct. -func (asrmmc *AlertSingleResourceMultipleMetricCriteria) 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 "allOf": - if v != nil { - var allOf []Criteria - err = json.Unmarshal(*v, &allOf) - if err != nil { - return err - } - asrmmc.AllOf = &allOf - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if asrmmc.AdditionalProperties == nil { - asrmmc.AdditionalProperties = make(map[string]interface{}) - } - asrmmc.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataType - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - asrmmc.OdataType = odataType - } - } - } - - return nil -} - -// AlertStatus an alert status. -type AlertStatus struct { - // Name - The status name. - Name *string `json:"name,omitempty"` - // ID - The alert rule arm id. - ID *string `json:"id,omitempty"` - // Type - The extended resource type name. - Type *string `json:"type,omitempty"` - // Properties - The alert status properties of the metric alert status. - Properties *AlertStatusProperties `json:"properties,omitempty"` -} - -// AlertStatusCollection represents a collection of alert rule resources. -type AlertStatusCollection struct { - autorest.Response `json:"-"` - // Value - the values for the alert rule resources. - Value *[]AlertStatus `json:"value,omitempty"` -} - -// AlertStatusProperties an alert status properties. -type AlertStatusProperties struct { - // Dimensions - An object describing the type of the dimensions. - Dimensions map[string]*string `json:"dimensions"` - // Status - status value - Status *string `json:"status,omitempty"` - // Timestamp - UTC time when the status was checked. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertStatusProperties. -func (asp AlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asp.Dimensions != nil { - objectMap["dimensions"] = asp.Dimensions - } - if asp.Status != nil { - objectMap["status"] = asp.Status - } - if asp.Timestamp != nil { - objectMap["timestamp"] = asp.Timestamp - } - return json.Marshal(objectMap) -} - -// Availability metric availability specifies the time grain (aggregation interval or frequency) and the -// retention period for that time grain. -type Availability struct { - // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string `json:"retention,omitempty"` -} - -// BaselineMetadata represents a baseline metadata value. -type BaselineMetadata struct { - // Name - Name of the baseline metadata. - Name *string `json:"name,omitempty"` - // Value - Value of the baseline metadata. - Value *string `json:"value,omitempty"` -} - -// BaselinesProperties the response to a metric baselines query. -type BaselinesProperties struct { - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried. - Namespace *string `json:"namespace,omitempty"` - // Baselines - The baseline for each time series that was queried. - Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` -} - -// BaselinesResponse a list of metric baselines. -type BaselinesResponse struct { - autorest.Response `json:"-"` - // Value - The list of metric baselines. - Value *[]SingleMetricBaseline `json:"value,omitempty"` -} - -// Criteria criterion to filter metrics. -type Criteria struct { - // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' - Operator Operator `json:"operator,omitempty"` - // Threshold - the criteria threshold value that activates the alert. - Threshold *float64 `json:"threshold,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' - TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]Dimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for Criteria. -func (c Criteria) MarshalJSON() ([]byte, error) { - c.CriterionType = CriterionTypeStaticThresholdCriterion - objectMap := make(map[string]interface{}) - if c.Operator != "" { - objectMap["operator"] = c.Operator - } - if c.Threshold != nil { - objectMap["threshold"] = c.Threshold - } - if c.Name != nil { - objectMap["name"] = c.Name - } - if c.MetricName != nil { - objectMap["metricName"] = c.MetricName - } - if c.MetricNamespace != nil { - objectMap["metricNamespace"] = c.MetricNamespace - } - if c.TimeAggregation != "" { - objectMap["timeAggregation"] = c.TimeAggregation - } - if c.Dimensions != nil { - objectMap["dimensions"] = c.Dimensions - } - if c.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = c.SkipMetricValidation - } - if c.CriterionType != "" { - objectMap["criterionType"] = c.CriterionType - } - for k, v := range c.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsCriteria is the BasicMultiMetricCriteria implementation for Criteria. -func (c Criteria) AsCriteria() (*Criteria, bool) { - return &c, true -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for Criteria. -func (c Criteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for Criteria. -func (c Criteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for Criteria. -func (c Criteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &c, true -} - -// UnmarshalJSON is the custom unmarshaler for Criteria struct. -func (c *Criteria) 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 "operator": - if v != nil { - var operator Operator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - c.Operator = operator - } - case "threshold": - if v != nil { - var threshold float64 - err = json.Unmarshal(*v, &threshold) - if err != nil { - return err - } - c.Threshold = &threshold - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if c.AdditionalProperties == nil { - c.AdditionalProperties = make(map[string]interface{}) - } - c.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - c.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - c.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation AggregationTypeEnum - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - c.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []Dimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - c.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - c.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - c.CriterionType = criterionType - } - } - } - - return nil -} - -// Definition metric definition class specifies the metadata for a metric. -type Definition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // DisplayDescription - Detailed description of this metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Category - Custom category name for this metric. - Category *string `json:"category,omitempty"` - // MetricClass - The class of the metric. Possible values include: 'MetricClassAvailability', 'MetricClassTransactions', 'MetricClassErrors', 'MetricClassLatency', 'MetricClassSaturation' - MetricClass MetricClass `json:"metricClass,omitempty"` - // Unit - the unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' - Unit MetricUnit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'AggregationTypeNone', 'AggregationTypeAverage', 'AggregationTypeCount', 'AggregationTypeMinimum', 'AggregationTypeMaximum', 'AggregationTypeTotal' - PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]Availability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// DefinitionCollection represents collection of metric definitions. -type DefinitionCollection struct { - autorest.Response `json:"-"` - // Value - the values for the metric definitions. - Value *[]Definition `json:"value,omitempty"` -} - -// Dimension specifies a metric dimension. -type Dimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string `json:"operator,omitempty"` - // Values - list of dimension values. - Values *[]string `json:"values,omitempty"` -} - -// 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"` - // ToBeExportedForShoebox - Legacy usage, should not set. - ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` - // IsHidden - When set, the dimension is hidden from the customer, used in conjunction with the defaultDimensionValues field below - IsHidden *bool `json:"isHidden,omitempty"` - // DefaultDimensionValues - Default dimension value to be sent down for the hidden dimension during query - DefaultDimensionValues interface{} `json:"defaultDimensionValues,omitempty"` -} - -// DynamicMetricCriteria criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' - Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' - AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` - // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` - // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) - IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' - TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]Dimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - dmc.CriterionType = CriterionTypeDynamicThresholdCriterion - objectMap := make(map[string]interface{}) - if dmc.Operator != "" { - objectMap["operator"] = dmc.Operator - } - if dmc.AlertSensitivity != "" { - objectMap["alertSensitivity"] = dmc.AlertSensitivity - } - if dmc.FailingPeriods != nil { - objectMap["failingPeriods"] = dmc.FailingPeriods - } - if dmc.IgnoreDataBefore != nil { - objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore - } - if dmc.Name != nil { - objectMap["name"] = dmc.Name - } - if dmc.MetricName != nil { - objectMap["metricName"] = dmc.MetricName - } - if dmc.MetricNamespace != nil { - objectMap["metricNamespace"] = dmc.MetricNamespace - } - if dmc.TimeAggregation != "" { - objectMap["timeAggregation"] = dmc.TimeAggregation - } - if dmc.Dimensions != nil { - objectMap["dimensions"] = dmc.Dimensions - } - if dmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = dmc.SkipMetricValidation - } - if dmc.CriterionType != "" { - objectMap["criterionType"] = dmc.CriterionType - } - for k, v := range dmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsCriteria() (*Criteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return &dmc, true -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return nil, false -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. -func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &dmc, true -} - -// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. -func (dmc *DynamicMetricCriteria) 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 "operator": - if v != nil { - var operator DynamicThresholdOperator - err = json.Unmarshal(*v, &operator) - if err != nil { - return err - } - dmc.Operator = operator - } - case "alertSensitivity": - if v != nil { - var alertSensitivity DynamicThresholdSensitivity - err = json.Unmarshal(*v, &alertSensitivity) - if err != nil { - return err - } - dmc.AlertSensitivity = alertSensitivity - } - case "failingPeriods": - if v != nil { - var failingPeriods DynamicThresholdFailingPeriods - err = json.Unmarshal(*v, &failingPeriods) - if err != nil { - return err - } - dmc.FailingPeriods = &failingPeriods - } - case "ignoreDataBefore": - if v != nil { - var ignoreDataBefore date.Time - err = json.Unmarshal(*v, &ignoreDataBefore) - if err != nil { - return err - } - dmc.IgnoreDataBefore = &ignoreDataBefore - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if dmc.AdditionalProperties == nil { - dmc.AdditionalProperties = make(map[string]interface{}) - } - dmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - dmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - dmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation AggregationTypeEnum - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - dmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []Dimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - dmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - dmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - dmc.CriterionType = criterionType - } - } - } - - return nil -} - -// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback -// time window required to raise an alert. -type DynamicThresholdFailingPeriods struct { - // NumberOfEvaluationPeriods - The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. - NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` - // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` -} - -// ErrorContract 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 ErrorContract struct { - // Error - The error object. - Error *ErrorResponse `json:"error,omitempty"` -} - -// 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"` -} - -// LocalizableString the localizable string class. -type LocalizableString struct { - // Value - the invariant value. - Value *string `json:"value,omitempty"` - // LocalizedValue - the locale specific value. - LocalizedValue *string `json:"localizedValue,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"` -} - -// MetadataValue represents a metric metadata value. -type MetadataValue struct { - // Name - the name of the metadata. - Name *LocalizableString `json:"name,omitempty"` - // Value - the value of the metadata. - Value *string `json:"value,omitempty"` -} - -// Metric the result data of a query. -type Metric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // DisplayDescription - Detailed description of this metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // ErrorCode - 'Success' or the error details on query failures for this metric. - ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Error message encountered querying this specific metric. - ErrorMessage *string `json:"errorMessage,omitempty"` - // Unit - The unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// BasicMultiMetricCriteria the types of conditions for a multi resource alert. -type BasicMultiMetricCriteria interface { - AsCriteria() (*Criteria, bool) - AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) - AsMultiMetricCriteria() (*MultiMetricCriteria, bool) -} - -// MultiMetricCriteria the types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Name - Name of the criteria. - Name *string `json:"name,omitempty"` - // MetricName - Name of the metric. - MetricName *string `json:"metricName,omitempty"` - // MetricNamespace - Namespace of the metric. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' - TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` - // Dimensions - List of dimension conditions. - Dimensions *[]Dimension `json:"dimensions,omitempty"` - // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` - // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' - CriterionType CriterionType `json:"criterionType,omitempty"` -} - -func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["criterionType"] { - case string(CriterionTypeStaticThresholdCriterion): - var c Criteria - err := json.Unmarshal(body, &c) - return c, err - case string(CriterionTypeDynamicThresholdCriterion): - var dmc DynamicMetricCriteria - err := json.Unmarshal(body, &dmc) - return dmc, err - default: - var mmc MultiMetricCriteria - err := json.Unmarshal(body, &mmc) - return mmc, err - } -} -func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) - if err != nil { - return nil, err - } - mmcArray[index] = mmc - } - return mmcArray, nil -} - -// MarshalJSON is the custom marshaler for MultiMetricCriteria. -func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { - mmc.CriterionType = CriterionTypeMultiMetricCriteria - objectMap := make(map[string]interface{}) - if mmc.Name != nil { - objectMap["name"] = mmc.Name - } - if mmc.MetricName != nil { - objectMap["metricName"] = mmc.MetricName - } - if mmc.MetricNamespace != nil { - objectMap["metricNamespace"] = mmc.MetricNamespace - } - if mmc.TimeAggregation != "" { - objectMap["timeAggregation"] = mmc.TimeAggregation - } - if mmc.Dimensions != nil { - objectMap["dimensions"] = mmc.Dimensions - } - if mmc.SkipMetricValidation != nil { - objectMap["skipMetricValidation"] = mmc.SkipMetricValidation - } - if mmc.CriterionType != "" { - objectMap["criterionType"] = mmc.CriterionType - } - for k, v := range mmc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsCriteria() (*Criteria, bool) { - return nil, false -} - -// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { - return nil, false -} - -// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { - return &mmc, true -} - -// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. -func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { - return &mmc, true -} - -// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. -func (mmc *MultiMetricCriteria) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mmc.AdditionalProperties == nil { - mmc.AdditionalProperties = make(map[string]interface{}) - } - mmc.AdditionalProperties[k] = additionalProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mmc.Name = &name - } - case "metricName": - if v != nil { - var metricName string - err = json.Unmarshal(*v, &metricName) - if err != nil { - return err - } - mmc.MetricName = &metricName - } - case "metricNamespace": - if v != nil { - var metricNamespace string - err = json.Unmarshal(*v, &metricNamespace) - if err != nil { - return err - } - mmc.MetricNamespace = &metricNamespace - } - case "timeAggregation": - if v != nil { - var timeAggregation AggregationTypeEnum - err = json.Unmarshal(*v, &timeAggregation) - if err != nil { - return err - } - mmc.TimeAggregation = timeAggregation - } - case "dimensions": - if v != nil { - var dimensions []Dimension - err = json.Unmarshal(*v, &dimensions) - if err != nil { - return err - } - mmc.Dimensions = &dimensions - } - case "skipMetricValidation": - if v != nil { - var skipMetricValidation bool - err = json.Unmarshal(*v, &skipMetricValidation) - if err != nil { - return err - } - mmc.SkipMetricValidation = &skipMetricValidation - } - case "criterionType": - if v != nil { - var criterionType CriterionType - err = json.Unmarshal(*v, &criterionType) - if err != nil { - return err - } - mmc.CriterionType = criterionType - } - } - } - - return nil -} - -// Namespace metric namespace class specifies the metadata for a metric namespace. -type Namespace struct { - // ID - The ID of the metric namespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The escaped name of the namespace. - Name *string `json:"name,omitempty"` - // Classification - Kind of namespace. Possible values include: 'NamespaceClassificationPlatform', 'NamespaceClassificationCustom', 'NamespaceClassificationQos' - Classification NamespaceClassification `json:"classification,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *NamespaceName `json:"properties,omitempty"` -} - -// NamespaceCollection represents collection of metric namespaces. -type NamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]Namespace `json:"value,omitempty"` -} - -// NamespaceName the fully qualified metric namespace name. -type NamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - -// Operation microsoft Insights API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // IsDataAction - Property to specify whether the action is a data action. - IsDataAction *bool `json:"isDataAction,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,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.Name != nil { - objectMap["name"] = o.Name - } - 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 "properties": - if v != nil { - var operationProperties OperationProperties - err = json.Unmarshal(*v, &operationProperties) - if err != nil { - return err - } - o.OperationProperties = &operationProperties - } - } - } - - return nil -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Publisher - The publisher of this operation. - Publisher *string `json:"publisher,omitempty"` - // Provider - Service provider: Microsoft.Insights - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - The description of the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Insights 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 operations supported by the Microsoft.Insights 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"` -} - -// OperationProperties properties of operation, include metric specifications. -type OperationProperties struct { - // ServiceSpecification - One property of operation, include metric specifications. - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// Resource an azure resource object -type Resource 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// Response the response to a metrics query. -type Response struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the relative cost of the query. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics being queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource being queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]Metric `json:"value,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 *[]Specification `json:"metricSpecifications,omitempty"` - // LegacyMetricSpecifications - Legacy Metric specifications for operation. Deprecated, do not use. - LegacyMetricSpecifications interface{} `json:"legacyMetricSpecifications,omitempty"` -} - -// SingleBaseline the baseline values for a single sensitivity value. -type SingleBaseline struct { - // Sensitivity - the sensitivity of the baseline. Possible values include: 'BaselineSensitivityLow', 'BaselineSensitivityMedium', 'BaselineSensitivityHigh' - Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` - // LowThresholds - The low thresholds of the baseline. - LowThresholds *[]float64 `json:"lowThresholds,omitempty"` - // HighThresholds - The high thresholds of the baseline. - HighThresholds *[]float64 `json:"highThresholds,omitempty"` -} - -// SingleDimension the metric dimension name and value. -type SingleDimension struct { - // Name - Name of the dimension. - Name *string `json:"name,omitempty"` - // Value - Value of the dimension. - Value *string `json:"value,omitempty"` -} - -// SingleMetricBaseline the baseline results of a single metric. -type SingleMetricBaseline struct { - // ID - The metric baseline Id. - ID *string `json:"id,omitempty"` - // Type - The resource type of the metric baseline resource. - Type *string `json:"type,omitempty"` - // Name - The name of the metric for which the baselines were retrieved. - Name *string `json:"name,omitempty"` - // BaselinesProperties - The metric baseline properties of the metric. - *BaselinesProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingleMetricBaseline. -func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smb.ID != nil { - objectMap["id"] = smb.ID - } - if smb.Type != nil { - objectMap["type"] = smb.Type - } - if smb.Name != nil { - objectMap["name"] = smb.Name - } - if smb.BaselinesProperties != nil { - objectMap["properties"] = smb.BaselinesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. -func (smb *SingleMetricBaseline) 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 - } - smb.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - smb.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - smb.Name = &name - } - case "properties": - if v != nil { - var baselinesProperties BaselinesProperties - err = json.Unmarshal(*v, &baselinesProperties) - if err != nil { - return err - } - smb.BaselinesProperties = &baselinesProperties - } - } - } - - return nil -} - -// Specification metric specification of operation. -type Specification struct { - // Name - The name of the metric. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of the metric. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Display description of the metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - The metric unit. Possible values include: Count,Bytes,Seconds,Percent,CountPerSecond,BytesPerSecond,MilliSeconds,ByteSeconds,Unspecified,BitsPerSecond,Cores,MilliCores,NanoCores - Unit *string `json:"unit,omitempty"` - // AggregationType - The default metric aggregation type. Possible values include: Total,Average,Maximum,Minimum,Count - AggregationType *string `json:"aggregationType,omitempty"` - // SupportedAggregationTypes - The supported aggregation types for the metrics. - SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` - // SupportedTimeGrainTypes - The supported time grain types for the metrics. - SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` - // Availabilities - The supported time grain types for the metrics. - Availabilities *[]string `json:"availabilities,omitempty"` - // LockAggregationType - The metric lock aggregation type. - LockAggregationType *string `json:"lockAggregationType,omitempty"` - // Category - Category or type of metric. - Category *string `json:"category,omitempty"` - // Dimensions - The dimensions of metric. - Dimensions *[]DimensionProperties `json:"dimensions,omitempty"` - // FillGapWithZero - Property to specify whether to fill empty gaps with zero. - FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` - // InternalMetricName - The internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` -} - -// SubscriptionScopeMetric the result data of a query. -type SubscriptionScopeMetric struct { - // ID - the metric Id. - ID *string `json:"id,omitempty"` - // Type - the resource type of the metric resource. - Type *string `json:"type,omitempty"` - // Name - the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString `json:"name,omitempty"` - // DisplayDescription - Detailed description of this metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // ErrorCode - 'Success' or the error details on query failures for this metric. - ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Error message encountered querying this specific metric. - ErrorMessage *string `json:"errorMessage,omitempty"` - // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' - Unit MetricUnit `json:"unit,omitempty"` - // Timeseries - the time series returned when a data query is performed. - Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` -} - -// SubscriptionScopeMetricDefinition metric definition class specifies the metadata for a metric. -type SubscriptionScopeMetricDefinition struct { - // IsDimensionRequired - Flag to indicate whether the dimension is required. - IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` - // ResourceID - the resource identifier of the resource that emitted the metric. - ResourceID *string `json:"resourceId,omitempty"` - // Namespace - the namespace the metric belongs to. - Namespace *string `json:"namespace,omitempty"` - // Name - the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString `json:"name,omitempty"` - // DisplayDescription - Detailed description of this metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Category - Custom category name for this metric. - Category *string `json:"category,omitempty"` - // MetricClass - The class of the metric. Possible values include: 'MetricClassAvailability', 'MetricClassTransactions', 'MetricClassErrors', 'MetricClassLatency', 'MetricClassSaturation' - MetricClass MetricClass `json:"metricClass,omitempty"` - // Unit - the unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' - Unit MetricUnit `json:"unit,omitempty"` - // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'MetricAggregationTypeNone', 'MetricAggregationTypeAverage', 'MetricAggregationTypeCount', 'MetricAggregationTypeMinimum', 'MetricAggregationTypeMaximum', 'MetricAggregationTypeTotal' - PrimaryAggregationType MetricAggregationType `json:"primaryAggregationType,omitempty"` - // SupportedAggregationTypes - the collection of what aggregation types are supported. - SupportedAggregationTypes *[]MetricAggregationType `json:"supportedAggregationTypes,omitempty"` - // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. - MetricAvailabilities *[]Availability `json:"metricAvailabilities,omitempty"` - // ID - the resource identifier of the metric definition. - ID *string `json:"id,omitempty"` - // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions *[]LocalizableString `json:"dimensions,omitempty"` -} - -// SubscriptionScopeMetricDefinitionCollection represents collection of metric definitions. -type SubscriptionScopeMetricDefinitionCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric definitions. - Value *[]SubscriptionScopeMetricDefinition `json:"value,omitempty"` -} - -// SubscriptionScopeMetricResponse the response to a subscription scope metrics query. -type SubscriptionScopeMetricResponse struct { - autorest.Response `json:"-"` - // Cost - The integer value representing the relative cost of the query. - Cost *float64 `json:"cost,omitempty"` - // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. - Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics being queried - Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource being queried for metrics. - Resourceregion *string `json:"resourceregion,omitempty"` - // Value - the value of the collection. - Value *[]SubscriptionScopeMetric `json:"value,omitempty"` -} - -// SubscriptionScopeMetricsRequestBodyParameters query parameters can also be specified in the body, -// specifying the same parameter in both the body and query parameters will result in an error. -type SubscriptionScopeMetricsRequestBodyParameters struct { - // Timespan - The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. - Timespan *string `json:"timespan,omitempty"` - // Interval - The interval (i.e. timegrain) of the query. - Interval *string `json:"interval,omitempty"` - // MetricNames - The names of the metrics (comma separated) to retrieve. - MetricNames *string `json:"metricNames,omitempty"` - // Aggregation - The list of aggregation types (comma separated) to retrieve. - Aggregation *string `json:"aggregation,omitempty"` - // Filter - The **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. - Filter *string `json:"filter,omitempty"` - // Top - The maximum number of records to retrieve. - // Valid only if $filter is specified. - // Defaults to 10. - Top *int32 `json:"top,omitempty"` - // OrderBy - The aggregation to use for sorting results and the direction of the sort. - // Only one order can be specified. - // Examples: sum asc. - OrderBy *string `json:"orderBy,omitempty"` - // RollUpBy - Dimension name(s) to rollup results by. For example if you only want to see metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't want to see separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries. - RollUpBy *string `json:"rollUpBy,omitempty"` - // ResultType - Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. Possible values include: 'MetricResultTypeData', 'MetricResultTypeMetadata' - ResultType MetricResultType `json:"resultType,omitempty"` - // MetricNamespace - Metric namespace where the metrics you want reside. - MetricNamespace *string `json:"metricNamespace,omitempty"` - // AutoAdjustTimegrain - When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest supported timespan. When set to false, an error is returned for invalid timespan parameters. Defaults to false. - AutoAdjustTimegrain *bool `json:"autoAdjustTimegrain,omitempty"` - // ValidateDimensions - When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid filter parameters. Defaults to true. - ValidateDimensions *bool `json:"validateDimensions,omitempty"` -} - -// TimeSeriesBaseline the baseline values for a single time series. -type TimeSeriesBaseline struct { - // Aggregation - The aggregation type of the metric. - Aggregation *string `json:"aggregation,omitempty"` - // Dimensions - The dimensions of this time series. - Dimensions *[]SingleDimension `json:"dimensions,omitempty"` - // Timestamps - The list of timestamps of the baselines. - Timestamps *[]date.Time `json:"timestamps,omitempty"` - // Data - The baseline values for each sensitivity. - Data *[]SingleBaseline `json:"data,omitempty"` - // MetadataValues - The baseline metadata values. - MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` -} - -// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // Metadatavalues - the metadata values returned if $filter was specified in the call. - Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` - // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data *[]Value `json:"data,omitempty"` -} - -// Value represents a metric value. -type Value struct { - // TimeStamp - the timestamp for the metric value in ISO 8601 format. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Average - the average value in the time range. - Average *float64 `json:"average,omitempty"` - // Minimum - the least value in the time range. - Minimum *float64 `json:"minimum,omitempty"` - // Maximum - the greatest value in the time range. - Maximum *float64 `json:"maximum,omitempty"` - // Total - the sum of all of the values in the time range. - Total *float64 `json:"total,omitempty"` - // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. - Count *float64 `json:"count,omitempty"` -} - -// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // WebTestID - The Application Insights web test Id. - WebTestID *string `json:"webTestId,omitempty"` - // ComponentID - The Application Insights resource Id. - ComponentID *string `json:"componentId,omitempty"` - // FailedLocationCount - The number of failed locations. - FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' - OdataType OdataType `json:"odata.type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - objectMap := make(map[string]interface{}) - if wlac.WebTestID != nil { - objectMap["webTestId"] = wlac.WebTestID - } - if wlac.ComponentID != nil { - objectMap["componentId"] = wlac.ComponentID - } - if wlac.FailedLocationCount != nil { - objectMap["failedLocationCount"] = wlac.FailedLocationCount - } - if wlac.OdataType != "" { - objectMap["odata.type"] = wlac.OdataType - } - for k, v := range wlac.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsAlertSingleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsAlertSingleResourceMultipleMetricCriteria() (*AlertSingleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsWebtestLocationAvailabilityCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { - return &wlac, true -} - -// AsAlertMultipleResourceMultipleMetricCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsAlertMultipleResourceMultipleMetricCriteria() (*AlertMultipleResourceMultipleMetricCriteria, bool) { - return nil, false -} - -// AsAlertCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsAlertCriteria() (*AlertCriteria, bool) { - return nil, false -} - -// AsBasicAlertCriteria is the BasicAlertCriteria implementation for WebtestLocationAvailabilityCriteria. -func (wlac WebtestLocationAvailabilityCriteria) AsBasicAlertCriteria() (BasicAlertCriteria, bool) { - return &wlac, true -} - -// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. -func (wlac *WebtestLocationAvailabilityCriteria) 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 "webTestId": - if v != nil { - var webTestID string - err = json.Unmarshal(*v, &webTestID) - if err != nil { - return err - } - wlac.WebTestID = &webTestID - } - case "componentId": - if v != nil { - var componentID string - err = json.Unmarshal(*v, &componentID) - if err != nil { - return err - } - wlac.ComponentID = &componentID - } - case "failedLocationCount": - if v != nil { - var failedLocationCount float64 - err = json.Unmarshal(*v, &failedLocationCount) - if err != nil { - return err - } - wlac.FailedLocationCount = &failedLocationCount - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if wlac.AdditionalProperties == nil { - wlac.AdditionalProperties = make(map[string]interface{}) - } - wlac.AdditionalProperties[k] = additionalProperties - } - case "odata.type": - if v != nil { - var odataType OdataType - err = json.Unmarshal(*v, &odataType) - if err != nil { - return err - } - wlac.OdataType = odataType - } - } - } - - return nil -} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/namespaces.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/namespaces.go deleted file mode 100644 index 9fb796b2a49a..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/namespaces.go +++ /dev/null @@ -1,108 +0,0 @@ -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// NamespacesClient is the monitor Management Client -type NamespacesClient struct { - BaseClient -} - -// NewNamespacesClient creates an instance of the NamespacesClient client. -func NewNamespacesClient(subscriptionID string) NamespacesClient { - return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient 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 NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { - return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric namespaces for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client NamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result NamespaceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, startTime) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.NamespacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.NamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.NamespacesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client NamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", 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 NamespacesClient) 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 NamespacesClient) ListResponder(resp *http.Response) (result NamespaceCollection, 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/monitor/mgmt/2021-05-01-preview/metrics/operations.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/operations.go deleted file mode 100644 index 5d2fa1380c84..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package metrics - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 monitor 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 operations from Microsoft.Insights provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "metrics.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "metrics.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-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 -} diff --git a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/version.go b/services/preview/monitor/mgmt/2021-05-01-preview/metrics/version.go deleted file mode 100644 index 446ac7a0345c..000000000000 --- a/services/preview/monitor/mgmt/2021-05-01-preview/metrics/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package metrics - -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() + " metrics/2021-05-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/sql/mgmt/2015-05-01-preview/sql/CHANGELOG.md b/services/preview/sql/mgmt/2015-05-01-preview/sql/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/_meta.json b/services/preview/sql/mgmt/2015-05-01-preview/sql/_meta.json deleted file mode 100644 index e8c2180420cf..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", - "tag": "package-2015-05-preview", - "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-2015-05-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/capabilities.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/capabilities.go deleted file mode 100644 index 6cd6f913706a..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/capabilities.go +++ /dev/null @@ -1,107 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CapabilitiesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type CapabilitiesClient struct { - BaseClient -} - -// NewCapabilitiesClient creates an instance of the CapabilitiesClient client. -func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { - return NewCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCapabilitiesClientWithBaseURI creates an instance of the CapabilitiesClient 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 NewCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) CapabilitiesClient { - return CapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByLocation gets the subscription capabilities available for the specified location. -// Parameters: -// locationName - the location name whose capabilities are retrieved. -func (client CapabilitiesClient) ListByLocation(ctx context.Context, locationName string) (result LocationCapabilities, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesClient.ListByLocation") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByLocationPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure sending request") - return - } - - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure responding to request") - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client CapabilitiesClient) ListByLocationPreparer(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 = "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.Sql/locations/{locationName}/capabilities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client CapabilitiesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client CapabilitiesClient) ListByLocationResponder(resp *http.Response) (result LocationCapabilities, 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/sql/mgmt/2015-05-01-preview/sql/client.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/client.go deleted file mode 100644 index 99340489081a..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/client.go +++ /dev/null @@ -1,42 +0,0 @@ -// Package sql implements the Azure ARM Sql service API version . -// -// The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database -// services to manage your databases. The API enables you to create, retrieve, update, and delete databases. -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Sql - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Sql. -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/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go deleted file mode 100644 index 5f1358cac081..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseblobauditingpolicies.go +++ /dev/null @@ -1,319 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseBlobAuditingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type DatabaseBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewDatabaseBlobAuditingPoliciesClient creates an instance of the DatabaseBlobAuditingPoliciesClient client. -func NewDatabaseBlobAuditingPoliciesClient(subscriptionID string) DatabaseBlobAuditingPoliciesClient { - return NewDatabaseBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseBlobAuditingPoliciesClientWithBaseURI creates an instance of the DatabaseBlobAuditingPoliciesClient -// 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 NewDatabaseBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseBlobAuditingPoliciesClient { - return DatabaseBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the database blob auditing policy. -func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (result DatabaseBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPoliciesClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}", 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 DatabaseBlobAuditingPoliciesClient) 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 DatabaseBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a database's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}", 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 DatabaseBlobAuditingPoliciesClient) 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 DatabaseBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists auditing settings of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.dbaplr.Response.Response != nil { - sc = result.dbaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.dbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.dbaplr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.dbaplr.hasNextLink() && result.dbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client DatabaseBlobAuditingPoliciesClient) listByDatabaseNextResults(ctx context.Context, lastResults DatabaseBlobAuditingPolicyListResult) (result DatabaseBlobAuditingPolicyListResult, err error) { - req, err := lastResults.databaseBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPoliciesClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/databases.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/databases.go deleted file mode 100644 index 5880e5d23b9d..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/databases.go +++ /dev/null @@ -1,1373 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient 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 NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateImportOperation creates an import operation that imports a bacpac into an existing database. The existing -// database must be empty. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to import into -// parameters - the required parameters for importing a Bacpac into a database. -func (client DatabasesClient) CreateImportOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest) (result DatabasesCreateImportOperationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateImportOperation") - 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ImportExtensionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ImportExtensionProperties.OperationMode", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "CreateImportOperation", err.Error()) - } - - req, err := client.CreateImportOperationPreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", nil, "Failure preparing request") - return - } - - result, err = client.CreateImportOperationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateImportOperationPreparer prepares the CreateImportOperation request. -func (client DatabasesClient) CreateImportOperationPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "extensionName": autorest.Encode("path", "import"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateImportOperationSender sends the CreateImportOperation request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateImportOperationSender(req *http.Request) (future DatabasesCreateImportOperationFuture, 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 -} - -// CreateImportOperationResponder handles the response to the CreateImportOperation request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateImportOperationResponder(resp *http.Response) (result ImportExportResponse, 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 -} - -// CreateOrUpdate creates a new database or updates an existing database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be operated on (updated or created). -// parameters - the required parameters for creating or updating a database. -func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, 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 DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, 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 a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be deleted. -func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) 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 DatabasesClient) 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 -} - -// Export exports a database to a bacpac. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be exported. -// parameters - the required parameters for exporting a database. -func (client DatabasesClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportRequest) (result DatabasesExportFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Export") - 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StorageURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLogin", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLoginPassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "Export", err.Error()) - } - - req, err := client.ExportPreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", nil, "Failure preparing request") - return - } - - result, err = client.ExportSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", result.Response(), "Failure sending request") - return - } - - return -} - -// ExportPreparer prepares the Export request. -func (client DatabasesClient) ExportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/export", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ExportSender(req *http.Request) (future DatabasesExportFuture, 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 -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ExportResponder(resp *http.Response) (result ImportExportResponse, 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 a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be retrieved. -// expand - a comma separated list of child objects to expand in the response. Possible properties: -// serviceTierAdvisors, transparentDataEncryption. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, expand string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.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, serverName, databaseName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) 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 DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByElasticPool gets a database inside of an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool to be retrieved. -// databaseName - the name of the database to be retrieved. -func (client DatabasesClient) GetByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.GetByElasticPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.GetByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetByElasticPool", resp, "Failure sending request") - return - } - - result, err = client.GetByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetByElasticPool", resp, "Failure responding to request") - return - } - - return -} - -// GetByElasticPoolPreparer prepares the GetByElasticPool request. -func (client DatabasesClient) GetByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByElasticPoolSender sends the GetByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByElasticPoolResponder handles the response to the GetByElasticPool request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetByElasticPoolResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByRecommendedElasticPool gets a database inside of a recommended elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// recommendedElasticPoolName - the name of the elastic pool to be retrieved. -// databaseName - the name of the database to be retrieved. -func (client DatabasesClient) GetByRecommendedElasticPool(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.GetByRecommendedElasticPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByRecommendedElasticPoolPreparer(ctx, resourceGroupName, serverName, recommendedElasticPoolName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetByRecommendedElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.GetByRecommendedElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetByRecommendedElasticPool", resp, "Failure sending request") - return - } - - result, err = client.GetByRecommendedElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetByRecommendedElasticPool", resp, "Failure responding to request") - return - } - - return -} - -// GetByRecommendedElasticPoolPreparer prepares the GetByRecommendedElasticPool request. -func (client DatabasesClient) GetByRecommendedElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByRecommendedElasticPoolSender sends the GetByRecommendedElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetByRecommendedElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByRecommendedElasticPoolResponder handles the response to the GetByRecommendedElasticPool request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetByRecommendedElasticPoolResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Import imports a bacpac into a new database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the required parameters for importing a Bacpac into a database. -func (client DatabasesClient) Import(ctx context.Context, resourceGroupName string, serverName string, parameters ImportRequest) (result DatabasesImportFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Import") - 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DatabaseName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MaxSizeBytes", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "Import", err.Error()) - } - - req, err := client.ImportPreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", nil, "Failure preparing request") - return - } - - result, err = client.ImportSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportPreparer prepares the Import request. -func (client DatabasesClient) ImportPreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ImportRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportSender sends the Import request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ImportSender(req *http.Request) (future DatabasesImportFuture, 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 -} - -// ImportResponder handles the response to the Import request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ImportResponder(resp *http.Response) (result ImportExportResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByElasticPool returns a list of databases in an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool to be retrieved. -func (client DatabasesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByElasticPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByElasticPool", resp, "Failure sending request") - return - } - - result, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByElasticPool", resp, "Failure responding to request") - return - } - - return -} - -// ListByElasticPoolPreparer prepares the ListByElasticPool request. -func (client DatabasesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByElasticPoolSender sends the ListByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByElasticPoolResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByRecommendedElasticPool returns a list of databases inside a recommended elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// recommendedElasticPoolName - the name of the recommended elastic pool to be retrieved. -func (client DatabasesClient) ListByRecommendedElasticPool(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result DatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByRecommendedElasticPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByRecommendedElasticPoolPreparer(ctx, resourceGroupName, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByRecommendedElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRecommendedElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByRecommendedElasticPool", resp, "Failure sending request") - return - } - - result, err = client.ListByRecommendedElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByRecommendedElasticPool", resp, "Failure responding to request") - return - } - - return -} - -// ListByRecommendedElasticPoolPreparer prepares the ListByRecommendedElasticPool request. -func (client DatabasesClient) ListByRecommendedElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByRecommendedElasticPoolSender sends the ListByRecommendedElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByRecommendedElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByRecommendedElasticPoolResponder handles the response to the ListByRecommendedElasticPool request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByRecommendedElasticPoolResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns a list of databases in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// expand - a comma separated list of child objects to expand in the response. Possible properties: -// serviceTierAdvisors, transparentDataEncryption. -// filter - an OData filter expression that describes a subset of databases to return. -func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, expand string, filter string) (result DatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, expand, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, expand string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - 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.Sql/servers/{serverName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions returns database metric definitions. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result MetricDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListMetricDefinitions") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabasesClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics returns database metrics. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// filter - an OData filter expression that describes a subset of metrics to return. -func (client DatabasesClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListMetrics") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, databaseName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabasesClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Pause pauses a data warehouse. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the data warehouse to pause. -func (client DatabasesClient) Pause(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesPauseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Pause") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PausePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", nil, "Failure preparing request") - return - } - - result, err = client.PauseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", result.Response(), "Failure sending request") - return - } - - return -} - -// PausePreparer prepares the Pause request. -func (client DatabasesClient) PausePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/pause", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PauseSender sends the Pause request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) PauseSender(req *http.Request) (future DatabasesPauseFuture, 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 -} - -// PauseResponder handles the response to the Pause request. The method always -// closes the http.Response Body. -func (client DatabasesClient) PauseResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Resume resumes a data warehouse. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the data warehouse to resume. -func (client DatabasesClient) Resume(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesResumeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Resume") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ResumePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", nil, "Failure preparing request") - return - } - - result, err = client.ResumeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", result.Response(), "Failure sending request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client DatabasesClient) ResumePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/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 DatabasesClient) ResumeSender(req *http.Request) (future DatabasesResumeFuture, 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 DatabasesClient) ResumeResponder(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 database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be updated. -// parameters - the required parameters for updating a database. -func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseUpdate) (result DatabasesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) UpdateSender(req *http.Request) (future DatabasesUpdateFuture, 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 DatabasesClient) UpdateResponder(resp *http.Response) (result Database, 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/preview/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go deleted file mode 100644 index 5034e53cfadb..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/databasethreatdetectionpolicies.go +++ /dev/null @@ -1,198 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseThreatDetectionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type DatabaseThreatDetectionPoliciesClient struct { - BaseClient -} - -// NewDatabaseThreatDetectionPoliciesClient creates an instance of the DatabaseThreatDetectionPoliciesClient client. -func NewDatabaseThreatDetectionPoliciesClient(subscriptionID string) DatabaseThreatDetectionPoliciesClient { - return NewDatabaseThreatDetectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseThreatDetectionPoliciesClientWithBaseURI creates an instance of the DatabaseThreatDetectionPoliciesClient -// 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 NewDatabaseThreatDetectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseThreatDetectionPoliciesClient { - return DatabaseThreatDetectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which database Threat Detection policy is defined. -// parameters - the database Threat Detection policy. -func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (result DatabaseSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseThreatDetectionPoliciesClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}", 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 DatabaseThreatDetectionPoliciesClient) 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 DatabaseThreatDetectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a database's threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which database Threat Detection policy is defined. -func (client DatabaseThreatDetectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseThreatDetectionPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseThreatDetectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}", 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 DatabaseThreatDetectionPoliciesClient) 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 DatabaseThreatDetectionPoliciesClient) GetResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, 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/sql/mgmt/2015-05-01-preview/sql/databaseusages.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseusages.go deleted file mode 100644 index 157fddb468b6..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/databaseusages.go +++ /dev/null @@ -1,112 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type DatabaseUsagesClient struct { - BaseClient -} - -// NewDatabaseUsagesClient creates an instance of the DatabaseUsagesClient client. -func NewDatabaseUsagesClient(subscriptionID string) DatabaseUsagesClient { - return NewDatabaseUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseUsagesClientWithBaseURI creates an instance of the DatabaseUsagesClient 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 NewDatabaseUsagesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseUsagesClient { - return DatabaseUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByDatabase returns database usages. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseUsagesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseUsagesClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseUsagesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseUsagesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseUsagesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DatabaseUsagesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseUsagesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DatabaseUsagesClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseUsageListResult, 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/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go deleted file mode 100644 index bd6726530f7e..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingpolicies.go +++ /dev/null @@ -1,199 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DataMaskingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type DataMaskingPoliciesClient struct { - BaseClient -} - -// NewDataMaskingPoliciesClient creates an instance of the DataMaskingPoliciesClient client. -func NewDataMaskingPoliciesClient(subscriptionID string) DataMaskingPoliciesClient { - return NewDataMaskingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataMaskingPoliciesClientWithBaseURI creates an instance of the DataMaskingPoliciesClient 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 NewDataMaskingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingPoliciesClient { - return DataMaskingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database data masking policy -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - parameters for creating or updating a data masking policy. -func (client DataMaskingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy) (result DataMaskingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataMaskingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.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.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}", 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 DataMaskingPoliciesClient) 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 DataMaskingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a database data masking policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DataMaskingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DataMaskingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataMaskingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}", 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 DataMaskingPoliciesClient) 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 DataMaskingPoliciesClient) GetResponder(resp *http.Response) (result DataMaskingPolicy, 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/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go deleted file mode 100644 index eae0c8e07f66..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/datamaskingrules.go +++ /dev/null @@ -1,212 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DataMaskingRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type DataMaskingRulesClient struct { - BaseClient -} - -// NewDataMaskingRulesClient creates an instance of the DataMaskingRulesClient client. -func NewDataMaskingRulesClient(subscriptionID string) DataMaskingRulesClient { - return NewDataMaskingRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataMaskingRulesClientWithBaseURI creates an instance of the DataMaskingRulesClient 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 NewDataMaskingRulesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingRulesClient { - return DataMaskingRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database data masking rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// dataMaskingRuleName - the name of the data masking rule. -// parameters - the required parameters for creating or updating a data masking rule. -func (client DataMaskingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule) (result DataMaskingRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties.SchemaName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataMaskingRuleProperties.TableName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataMaskingRuleProperties.ColumnName", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.DataMaskingRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataMaskingRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "dataMaskingRuleName": autorest.Encode("path", dataMaskingRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.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.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}", 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 DataMaskingRulesClient) 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 DataMaskingRulesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets a list of database data masking rules. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DataMaskingRulesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DataMaskingRuleListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DataMaskingRulesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DataMaskingRulesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DataMaskingRulesClient) ListByDatabaseResponder(resp *http.Response) (result DataMaskingRuleListResult, 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/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go deleted file mode 100644 index 441f57b95c41..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpoolactivities.go +++ /dev/null @@ -1,113 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ElasticPoolActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ElasticPoolActivitiesClient struct { - BaseClient -} - -// NewElasticPoolActivitiesClient creates an instance of the ElasticPoolActivitiesClient client. -func NewElasticPoolActivitiesClient(subscriptionID string) ElasticPoolActivitiesClient { - return NewElasticPoolActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolActivitiesClientWithBaseURI creates an instance of the ElasticPoolActivitiesClient 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 NewElasticPoolActivitiesClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolActivitiesClient { - return ElasticPoolActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByElasticPool returns elastic pool activities. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool for which to get the current activity. -func (client ElasticPoolActivitiesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolActivityListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolActivitiesClient.ListByElasticPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolActivitiesClient", "ListByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolActivitiesClient", "ListByElasticPool", resp, "Failure sending request") - return - } - - result, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolActivitiesClient", "ListByElasticPool", resp, "Failure responding to request") - return - } - - return -} - -// ListByElasticPoolPreparer prepares the ListByElasticPool request. -func (client ElasticPoolActivitiesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByElasticPoolSender sends the ListByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolActivitiesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always -// closes the http.Response Body. -func (client ElasticPoolActivitiesClient) ListByElasticPoolResponder(resp *http.Response) (result ElasticPoolActivityListResult, 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/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go deleted file mode 100644 index ea65995b62c9..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpooldatabaseactivities.go +++ /dev/null @@ -1,113 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ElasticPoolDatabaseActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ElasticPoolDatabaseActivitiesClient struct { - BaseClient -} - -// NewElasticPoolDatabaseActivitiesClient creates an instance of the ElasticPoolDatabaseActivitiesClient client. -func NewElasticPoolDatabaseActivitiesClient(subscriptionID string) ElasticPoolDatabaseActivitiesClient { - return NewElasticPoolDatabaseActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolDatabaseActivitiesClientWithBaseURI creates an instance of the ElasticPoolDatabaseActivitiesClient -// 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 NewElasticPoolDatabaseActivitiesClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolDatabaseActivitiesClient { - return ElasticPoolDatabaseActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByElasticPool returns activity on databases inside of an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolDatabaseActivityListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolDatabaseActivitiesClient.ListByElasticPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolDatabaseActivitiesClient", "ListByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolDatabaseActivitiesClient", "ListByElasticPool", resp, "Failure sending request") - return - } - - result, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolDatabaseActivitiesClient", "ListByElasticPool", resp, "Failure responding to request") - return - } - - return -} - -// ListByElasticPoolPreparer prepares the ListByElasticPool request. -func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByElasticPoolSender sends the ListByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always -// closes the http.Response Body. -func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolResponder(resp *http.Response) (result ElasticPoolDatabaseActivityListResult, 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/sql/mgmt/2015-05-01-preview/sql/elasticpools.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpools.go deleted file mode 100644 index 56d4227bd513..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/elasticpools.go +++ /dev/null @@ -1,598 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ElasticPoolsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type ElasticPoolsClient struct { - BaseClient -} - -// NewElasticPoolsClient creates an instance of the ElasticPoolsClient client. -func NewElasticPoolsClient(subscriptionID string) ElasticPoolsClient { - return NewElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolsClientWithBaseURI creates an instance of the ElasticPoolsClient 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 NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolsClient { - return ElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new elastic pool or updates an existing elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool to be operated on (updated or created). -// parameters - the required parameters for creating or updating an elastic pool. -func (client ElasticPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool) (result ElasticPoolsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, elasticPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ElasticPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) CreateOrUpdateSender(req *http.Request) (future ElasticPoolsCreateOrUpdateFuture, 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 ElasticPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result ElasticPool, 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 the elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool to be deleted. -func (client ElasticPoolsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ElasticPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) 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 ElasticPoolsClient) 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 elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool to be retrieved. -func (client ElasticPoolsClient) Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.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, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ElasticPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) 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 ElasticPoolsClient) GetResponder(resp *http.Response) (result ElasticPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns a list of elastic pools in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ElasticPoolsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ElasticPoolListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ElasticPoolsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (result ElasticPoolListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions returns elastic pool metric definitions. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client ElasticPoolsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result MetricDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListMetricDefinitions") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client ElasticPoolsClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics returns elastic pool metrics. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -// filter - an OData filter expression that describes a subset of metrics to return. -func (client ElasticPoolsClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListMetrics") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, elasticPoolName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client ElasticPoolsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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 elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool to be updated. -// parameters - the required parameters for updating an elastic pool. -func (client ElasticPoolsClient) Update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPoolUpdate) (result ElasticPoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, elasticPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ElasticPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPoolUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) UpdateSender(req *http.Request) (future ElasticPoolsUpdateFuture, 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 ElasticPoolsClient) UpdateResponder(resp *http.Response) (result ElasticPool, 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/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go deleted file mode 100644 index 14c45a85d0a3..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/encryptionprotectors.go +++ /dev/null @@ -1,397 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EncryptionProtectorsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type EncryptionProtectorsClient struct { - BaseClient -} - -// NewEncryptionProtectorsClient creates an instance of the EncryptionProtectorsClient client. -func NewEncryptionProtectorsClient(subscriptionID string) EncryptionProtectorsClient { - return NewEncryptionProtectorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEncryptionProtectorsClientWithBaseURI creates an instance of the EncryptionProtectorsClient 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 NewEncryptionProtectorsClientWithBaseURI(baseURI string, subscriptionID string) EncryptionProtectorsClient { - return EncryptionProtectorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates an existing encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested encryption protector resource state. -func (client EncryptionProtectorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters EncryptionProtector) (result EncryptionProtectorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters EncryptionProtector) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}", 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 EncryptionProtectorsClient) CreateOrUpdateSender(req *http.Request) (future EncryptionProtectorsCreateOrUpdateFuture, 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 EncryptionProtectorsClient) CreateOrUpdateResponder(resp *http.Response) (result EncryptionProtector, 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 a server encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client EncryptionProtectorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtector, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EncryptionProtectorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}", 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 EncryptionProtectorsClient) 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 EncryptionProtectorsClient) GetResponder(resp *http.Response) (result EncryptionProtector, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of server encryption protectors -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client EncryptionProtectorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.ListByServer") - defer func() { - sc := -1 - if result.eplr.Response.Response != nil { - sc = result.eplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.eplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.eplr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.eplr.hasNextLink() && result.eplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client EncryptionProtectorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/encryptionProtector", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client EncryptionProtectorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client EncryptionProtectorsClient) ListByServerResponder(resp *http.Response) (result EncryptionProtectorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client EncryptionProtectorsClient) listByServerNextResults(ctx context.Context, lastResults EncryptionProtectorListResult) (result EncryptionProtectorListResult, err error) { - req, err := lastResults.encryptionProtectorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client EncryptionProtectorsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// Revalidate revalidates an existing encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client EncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorsRevalidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.Revalidate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RevalidatePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") - return - } - - result, err = client.RevalidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") - return - } - - return -} - -// RevalidatePreparer prepares the Revalidate request. -func (client EncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevalidateSender sends the Revalidate request. The method will close the -// http.Response Body if it receives an error. -func (client EncryptionProtectorsClient) RevalidateSender(req *http.Request) (future EncryptionProtectorsRevalidateFuture, 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 -} - -// RevalidateResponder handles the response to the Revalidate request. The method always -// closes the http.Response Body. -func (client EncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/enums.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/enums.go deleted file mode 100644 index 29373105fbe6..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/enums.go +++ /dev/null @@ -1,1054 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AuthenticationType enumerates the values for authentication type. -type AuthenticationType string - -const ( - // ADPassword ... - ADPassword AuthenticationType = "ADPassword" - // SQL ... - SQL AuthenticationType = "SQL" -) - -// PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. -func PossibleAuthenticationTypeValues() []AuthenticationType { - return []AuthenticationType{ADPassword, SQL} -} - -// BlobAuditingPolicyState enumerates the values for blob auditing policy state. -type BlobAuditingPolicyState string - -const ( - // Disabled ... - Disabled BlobAuditingPolicyState = "Disabled" - // Enabled ... - Enabled BlobAuditingPolicyState = "Enabled" -) - -// PossibleBlobAuditingPolicyStateValues returns an array of possible values for the BlobAuditingPolicyState const type. -func PossibleBlobAuditingPolicyStateValues() []BlobAuditingPolicyState { - return []BlobAuditingPolicyState{Disabled, Enabled} -} - -// CapabilityStatus enumerates the values for capability status. -type CapabilityStatus string - -const ( - // CapabilityStatusAvailable ... - CapabilityStatusAvailable CapabilityStatus = "Available" - // CapabilityStatusDefault ... - CapabilityStatusDefault CapabilityStatus = "Default" - // CapabilityStatusDisabled ... - CapabilityStatusDisabled CapabilityStatus = "Disabled" - // CapabilityStatusVisible ... - CapabilityStatusVisible CapabilityStatus = "Visible" -) - -// PossibleCapabilityStatusValues returns an array of possible values for the CapabilityStatus const type. -func PossibleCapabilityStatusValues() []CapabilityStatus { - return []CapabilityStatus{CapabilityStatusAvailable, CapabilityStatusDefault, CapabilityStatusDisabled, CapabilityStatusVisible} -} - -// CheckNameAvailabilityReason enumerates the values for check name availability reason. -type CheckNameAvailabilityReason string - -const ( - // AlreadyExists ... - AlreadyExists CheckNameAvailabilityReason = "AlreadyExists" - // Invalid ... - Invalid CheckNameAvailabilityReason = "Invalid" -) - -// PossibleCheckNameAvailabilityReasonValues returns an array of possible values for the CheckNameAvailabilityReason const type. -func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { - return []CheckNameAvailabilityReason{AlreadyExists, Invalid} -} - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // Copy ... - Copy CreateMode = "Copy" - // Default ... - Default CreateMode = "Default" - // NonReadableSecondary ... - NonReadableSecondary CreateMode = "NonReadableSecondary" - // OnlineSecondary ... - OnlineSecondary CreateMode = "OnlineSecondary" - // PointInTimeRestore ... - PointInTimeRestore CreateMode = "PointInTimeRestore" - // Recovery ... - Recovery CreateMode = "Recovery" - // Restore ... - Restore CreateMode = "Restore" - // RestoreLongTermRetentionBackup ... - RestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{Copy, Default, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, Restore, RestoreLongTermRetentionBackup} -} - -// DatabaseEdition enumerates the values for database edition. -type DatabaseEdition string - -const ( - // Basic ... - Basic DatabaseEdition = "Basic" - // Business ... - Business DatabaseEdition = "Business" - // BusinessCritical ... - BusinessCritical DatabaseEdition = "BusinessCritical" - // DataWarehouse ... - DataWarehouse DatabaseEdition = "DataWarehouse" - // Free ... - Free DatabaseEdition = "Free" - // GeneralPurpose ... - GeneralPurpose DatabaseEdition = "GeneralPurpose" - // Hyperscale ... - Hyperscale DatabaseEdition = "Hyperscale" - // Premium ... - Premium DatabaseEdition = "Premium" - // PremiumRS ... - PremiumRS DatabaseEdition = "PremiumRS" - // Standard ... - Standard DatabaseEdition = "Standard" - // Stretch ... - Stretch DatabaseEdition = "Stretch" - // System ... - System DatabaseEdition = "System" - // System2 ... - System2 DatabaseEdition = "System2" - // Web ... - Web DatabaseEdition = "Web" -) - -// PossibleDatabaseEditionValues returns an array of possible values for the DatabaseEdition const type. -func PossibleDatabaseEditionValues() []DatabaseEdition { - return []DatabaseEdition{Basic, Business, BusinessCritical, DataWarehouse, Free, GeneralPurpose, Hyperscale, Premium, PremiumRS, Standard, Stretch, System, System2, Web} -} - -// DataMaskingFunction enumerates the values for data masking function. -type DataMaskingFunction string - -const ( - // DataMaskingFunctionCCN ... - DataMaskingFunctionCCN DataMaskingFunction = "CCN" - // DataMaskingFunctionDefault ... - DataMaskingFunctionDefault DataMaskingFunction = "Default" - // DataMaskingFunctionEmail ... - DataMaskingFunctionEmail DataMaskingFunction = "Email" - // DataMaskingFunctionNumber ... - DataMaskingFunctionNumber DataMaskingFunction = "Number" - // DataMaskingFunctionSSN ... - DataMaskingFunctionSSN DataMaskingFunction = "SSN" - // DataMaskingFunctionText ... - DataMaskingFunctionText DataMaskingFunction = "Text" -) - -// PossibleDataMaskingFunctionValues returns an array of possible values for the DataMaskingFunction const type. -func PossibleDataMaskingFunctionValues() []DataMaskingFunction { - return []DataMaskingFunction{DataMaskingFunctionCCN, DataMaskingFunctionDefault, DataMaskingFunctionEmail, DataMaskingFunctionNumber, DataMaskingFunctionSSN, DataMaskingFunctionText} -} - -// DataMaskingRuleState enumerates the values for data masking rule state. -type DataMaskingRuleState string - -const ( - // DataMaskingRuleStateDisabled ... - DataMaskingRuleStateDisabled DataMaskingRuleState = "Disabled" - // DataMaskingRuleStateEnabled ... - DataMaskingRuleStateEnabled DataMaskingRuleState = "Enabled" -) - -// PossibleDataMaskingRuleStateValues returns an array of possible values for the DataMaskingRuleState const type. -func PossibleDataMaskingRuleStateValues() []DataMaskingRuleState { - return []DataMaskingRuleState{DataMaskingRuleStateDisabled, DataMaskingRuleStateEnabled} -} - -// DataMaskingState enumerates the values for data masking state. -type DataMaskingState string - -const ( - // DataMaskingStateDisabled ... - DataMaskingStateDisabled DataMaskingState = "Disabled" - // DataMaskingStateEnabled ... - DataMaskingStateEnabled DataMaskingState = "Enabled" -) - -// PossibleDataMaskingStateValues returns an array of possible values for the DataMaskingState const type. -func PossibleDataMaskingStateValues() []DataMaskingState { - return []DataMaskingState{DataMaskingStateDisabled, DataMaskingStateEnabled} -} - -// ElasticPoolEdition enumerates the values for elastic pool edition. -type ElasticPoolEdition string - -const ( - // ElasticPoolEditionBasic ... - ElasticPoolEditionBasic ElasticPoolEdition = "Basic" - // ElasticPoolEditionBusinessCritical ... - ElasticPoolEditionBusinessCritical ElasticPoolEdition = "BusinessCritical" - // ElasticPoolEditionGeneralPurpose ... - ElasticPoolEditionGeneralPurpose ElasticPoolEdition = "GeneralPurpose" - // ElasticPoolEditionPremium ... - ElasticPoolEditionPremium ElasticPoolEdition = "Premium" - // ElasticPoolEditionStandard ... - ElasticPoolEditionStandard ElasticPoolEdition = "Standard" -) - -// PossibleElasticPoolEditionValues returns an array of possible values for the ElasticPoolEdition const type. -func PossibleElasticPoolEditionValues() []ElasticPoolEdition { - return []ElasticPoolEdition{ElasticPoolEditionBasic, ElasticPoolEditionBusinessCritical, ElasticPoolEditionGeneralPurpose, ElasticPoolEditionPremium, ElasticPoolEditionStandard} -} - -// ElasticPoolState enumerates the values for elastic pool state. -type ElasticPoolState string - -const ( - // ElasticPoolStateCreating ... - ElasticPoolStateCreating ElasticPoolState = "Creating" - // ElasticPoolStateDisabled ... - ElasticPoolStateDisabled ElasticPoolState = "Disabled" - // ElasticPoolStateReady ... - ElasticPoolStateReady ElasticPoolState = "Ready" -) - -// PossibleElasticPoolStateValues returns an array of possible values for the ElasticPoolState const type. -func PossibleElasticPoolStateValues() []ElasticPoolState { - return []ElasticPoolState{ElasticPoolStateCreating, ElasticPoolStateDisabled, ElasticPoolStateReady} -} - -// FailoverGroupReplicationRole enumerates the values for failover group replication role. -type FailoverGroupReplicationRole string - -const ( - // Primary ... - Primary FailoverGroupReplicationRole = "Primary" - // Secondary ... - Secondary FailoverGroupReplicationRole = "Secondary" -) - -// PossibleFailoverGroupReplicationRoleValues returns an array of possible values for the FailoverGroupReplicationRole const type. -func PossibleFailoverGroupReplicationRoleValues() []FailoverGroupReplicationRole { - return []FailoverGroupReplicationRole{Primary, Secondary} -} - -// GeoBackupPolicyState enumerates the values for geo backup policy state. -type GeoBackupPolicyState string - -const ( - // GeoBackupPolicyStateDisabled ... - GeoBackupPolicyStateDisabled GeoBackupPolicyState = "Disabled" - // GeoBackupPolicyStateEnabled ... - GeoBackupPolicyStateEnabled GeoBackupPolicyState = "Enabled" -) - -// PossibleGeoBackupPolicyStateValues returns an array of possible values for the GeoBackupPolicyState const type. -func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { - return []GeoBackupPolicyState{GeoBackupPolicyStateDisabled, GeoBackupPolicyStateEnabled} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // SystemAssigned ... - SystemAssigned IdentityType = "SystemAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{SystemAssigned} -} - -// ManagedInstanceLicenseType enumerates the values for managed instance license type. -type ManagedInstanceLicenseType string - -const ( - // BasePrice ... - BasePrice ManagedInstanceLicenseType = "BasePrice" - // LicenseIncluded ... - LicenseIncluded ManagedInstanceLicenseType = "LicenseIncluded" -) - -// PossibleManagedInstanceLicenseTypeValues returns an array of possible values for the ManagedInstanceLicenseType const type. -func PossibleManagedInstanceLicenseTypeValues() []ManagedInstanceLicenseType { - return []ManagedInstanceLicenseType{BasePrice, LicenseIncluded} -} - -// ManagedInstanceProxyOverride enumerates the values for managed instance proxy override. -type ManagedInstanceProxyOverride string - -const ( - // ManagedInstanceProxyOverrideDefault ... - ManagedInstanceProxyOverrideDefault ManagedInstanceProxyOverride = "Default" - // ManagedInstanceProxyOverrideProxy ... - ManagedInstanceProxyOverrideProxy ManagedInstanceProxyOverride = "Proxy" - // ManagedInstanceProxyOverrideRedirect ... - ManagedInstanceProxyOverrideRedirect ManagedInstanceProxyOverride = "Redirect" -) - -// PossibleManagedInstanceProxyOverrideValues returns an array of possible values for the ManagedInstanceProxyOverride const type. -func PossibleManagedInstanceProxyOverrideValues() []ManagedInstanceProxyOverride { - return []ManagedInstanceProxyOverride{ManagedInstanceProxyOverrideDefault, ManagedInstanceProxyOverrideProxy, ManagedInstanceProxyOverrideRedirect} -} - -// ManagedServerCreateMode enumerates the values for managed server create mode. -type ManagedServerCreateMode string - -const ( - // ManagedServerCreateModeDefault ... - ManagedServerCreateModeDefault ManagedServerCreateMode = "Default" - // ManagedServerCreateModePointInTimeRestore ... - ManagedServerCreateModePointInTimeRestore ManagedServerCreateMode = "PointInTimeRestore" -) - -// PossibleManagedServerCreateModeValues returns an array of possible values for the ManagedServerCreateMode const type. -func PossibleManagedServerCreateModeValues() []ManagedServerCreateMode { - return []ManagedServerCreateMode{ManagedServerCreateModeDefault, ManagedServerCreateModePointInTimeRestore} -} - -// MaxSizeUnits enumerates the values for max size units. -type MaxSizeUnits string - -const ( - // Gigabytes ... - Gigabytes MaxSizeUnits = "Gigabytes" - // Megabytes ... - Megabytes MaxSizeUnits = "Megabytes" - // Petabytes ... - Petabytes MaxSizeUnits = "Petabytes" - // Terabytes ... - Terabytes MaxSizeUnits = "Terabytes" -) - -// PossibleMaxSizeUnitsValues returns an array of possible values for the MaxSizeUnits const type. -func PossibleMaxSizeUnitsValues() []MaxSizeUnits { - return []MaxSizeUnits{Gigabytes, Megabytes, Petabytes, Terabytes} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // OperationOriginSystem ... - OperationOriginSystem OperationOrigin = "system" - // OperationOriginUser ... - OperationOriginUser OperationOrigin = "user" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{OperationOriginSystem, OperationOriginUser} -} - -// PerformanceLevelUnit enumerates the values for performance level unit. -type PerformanceLevelUnit string - -const ( - // DTU ... - DTU PerformanceLevelUnit = "DTU" -) - -// PossiblePerformanceLevelUnitValues returns an array of possible values for the PerformanceLevelUnit const type. -func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { - return []PerformanceLevelUnit{DTU} -} - -// PrimaryAggregationType enumerates the values for primary aggregation type. -type PrimaryAggregationType string - -const ( - // Average ... - Average PrimaryAggregationType = "Average" - // Count ... - Count PrimaryAggregationType = "Count" - // Maximum ... - Maximum PrimaryAggregationType = "Maximum" - // Minimum ... - Minimum PrimaryAggregationType = "Minimum" - // None ... - None PrimaryAggregationType = "None" - // Total ... - Total PrimaryAggregationType = "Total" -) - -// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{Average, Count, Maximum, Minimum, None, Total} -} - -// ReadOnlyEndpointFailoverPolicy enumerates the values for read only endpoint failover policy. -type ReadOnlyEndpointFailoverPolicy string - -const ( - // ReadOnlyEndpointFailoverPolicyDisabled ... - ReadOnlyEndpointFailoverPolicyDisabled ReadOnlyEndpointFailoverPolicy = "Disabled" - // ReadOnlyEndpointFailoverPolicyEnabled ... - ReadOnlyEndpointFailoverPolicyEnabled ReadOnlyEndpointFailoverPolicy = "Enabled" -) - -// PossibleReadOnlyEndpointFailoverPolicyValues returns an array of possible values for the ReadOnlyEndpointFailoverPolicy const type. -func PossibleReadOnlyEndpointFailoverPolicyValues() []ReadOnlyEndpointFailoverPolicy { - return []ReadOnlyEndpointFailoverPolicy{ReadOnlyEndpointFailoverPolicyDisabled, ReadOnlyEndpointFailoverPolicyEnabled} -} - -// ReadScale enumerates the values for read scale. -type ReadScale string - -const ( - // ReadScaleDisabled ... - ReadScaleDisabled ReadScale = "Disabled" - // ReadScaleEnabled ... - ReadScaleEnabled ReadScale = "Enabled" -) - -// PossibleReadScaleValues returns an array of possible values for the ReadScale const type. -func PossibleReadScaleValues() []ReadScale { - return []ReadScale{ReadScaleDisabled, ReadScaleEnabled} -} - -// ReadWriteEndpointFailoverPolicy enumerates the values for read write endpoint failover policy. -type ReadWriteEndpointFailoverPolicy string - -const ( - // Automatic ... - Automatic ReadWriteEndpointFailoverPolicy = "Automatic" - // Manual ... - Manual ReadWriteEndpointFailoverPolicy = "Manual" -) - -// PossibleReadWriteEndpointFailoverPolicyValues returns an array of possible values for the ReadWriteEndpointFailoverPolicy const type. -func PossibleReadWriteEndpointFailoverPolicyValues() []ReadWriteEndpointFailoverPolicy { - return []ReadWriteEndpointFailoverPolicy{Automatic, Manual} -} - -// RecommendedIndexAction enumerates the values for recommended index action. -type RecommendedIndexAction string - -const ( - // Create ... - Create RecommendedIndexAction = "Create" - // Drop ... - Drop RecommendedIndexAction = "Drop" - // Rebuild ... - Rebuild RecommendedIndexAction = "Rebuild" -) - -// PossibleRecommendedIndexActionValues returns an array of possible values for the RecommendedIndexAction const type. -func PossibleRecommendedIndexActionValues() []RecommendedIndexAction { - return []RecommendedIndexAction{Create, Drop, Rebuild} -} - -// RecommendedIndexState enumerates the values for recommended index state. -type RecommendedIndexState string - -const ( - // Active ... - Active RecommendedIndexState = "Active" - // Blocked ... - Blocked RecommendedIndexState = "Blocked" - // Executing ... - Executing RecommendedIndexState = "Executing" - // Expired ... - Expired RecommendedIndexState = "Expired" - // Ignored ... - Ignored RecommendedIndexState = "Ignored" - // Pending ... - Pending RecommendedIndexState = "Pending" - // PendingRevert ... - PendingRevert RecommendedIndexState = "Pending Revert" - // Reverted ... - Reverted RecommendedIndexState = "Reverted" - // Reverting ... - Reverting RecommendedIndexState = "Reverting" - // Success ... - Success RecommendedIndexState = "Success" - // Verifying ... - Verifying RecommendedIndexState = "Verifying" -) - -// PossibleRecommendedIndexStateValues returns an array of possible values for the RecommendedIndexState const type. -func PossibleRecommendedIndexStateValues() []RecommendedIndexState { - return []RecommendedIndexState{Active, Blocked, Executing, Expired, Ignored, Pending, PendingRevert, Reverted, Reverting, Success, Verifying} -} - -// RecommendedIndexType enumerates the values for recommended index type. -type RecommendedIndexType string - -const ( - // CLUSTERED ... - CLUSTERED RecommendedIndexType = "CLUSTERED" - // CLUSTEREDCOLUMNSTORE ... - CLUSTEREDCOLUMNSTORE RecommendedIndexType = "CLUSTERED COLUMNSTORE" - // COLUMNSTORE ... - COLUMNSTORE RecommendedIndexType = "COLUMNSTORE" - // NONCLUSTERED ... - NONCLUSTERED RecommendedIndexType = "NONCLUSTERED" -) - -// PossibleRecommendedIndexTypeValues returns an array of possible values for the RecommendedIndexType const type. -func PossibleRecommendedIndexTypeValues() []RecommendedIndexType { - return []RecommendedIndexType{CLUSTERED, CLUSTEREDCOLUMNSTORE, COLUMNSTORE, NONCLUSTERED} -} - -// ReplicationRole enumerates the values for replication role. -type ReplicationRole string - -const ( - // ReplicationRoleCopy ... - ReplicationRoleCopy ReplicationRole = "Copy" - // ReplicationRoleNonReadableSecondary ... - ReplicationRoleNonReadableSecondary ReplicationRole = "NonReadableSecondary" - // ReplicationRolePrimary ... - ReplicationRolePrimary ReplicationRole = "Primary" - // ReplicationRoleSecondary ... - ReplicationRoleSecondary ReplicationRole = "Secondary" - // ReplicationRoleSource ... - ReplicationRoleSource ReplicationRole = "Source" -) - -// PossibleReplicationRoleValues returns an array of possible values for the ReplicationRole const type. -func PossibleReplicationRoleValues() []ReplicationRole { - return []ReplicationRole{ReplicationRoleCopy, ReplicationRoleNonReadableSecondary, ReplicationRolePrimary, ReplicationRoleSecondary, ReplicationRoleSource} -} - -// ReplicationState enumerates the values for replication state. -type ReplicationState string - -const ( - // CATCHUP ... - CATCHUP ReplicationState = "CATCH_UP" - // PENDING ... - PENDING ReplicationState = "PENDING" - // SEEDING ... - SEEDING ReplicationState = "SEEDING" - // SUSPENDED ... - SUSPENDED ReplicationState = "SUSPENDED" -) - -// PossibleReplicationStateValues returns an array of possible values for the ReplicationState const type. -func PossibleReplicationStateValues() []ReplicationState { - return []ReplicationState{CATCHUP, PENDING, SEEDING, SUSPENDED} -} - -// RestorePointType enumerates the values for restore point type. -type RestorePointType string - -const ( - // CONTINUOUS ... - CONTINUOUS RestorePointType = "CONTINUOUS" - // DISCRETE ... - DISCRETE RestorePointType = "DISCRETE" -) - -// PossibleRestorePointTypeValues returns an array of possible values for the RestorePointType const type. -func PossibleRestorePointTypeValues() []RestorePointType { - return []RestorePointType{CONTINUOUS, DISCRETE} -} - -// SampleName enumerates the values for sample name. -type SampleName string - -const ( - // AdventureWorksLT ... - AdventureWorksLT SampleName = "AdventureWorksLT" -) - -// PossibleSampleNameValues returns an array of possible values for the SampleName const type. -func PossibleSampleNameValues() []SampleName { - return []SampleName{AdventureWorksLT} -} - -// SecurityAlertPolicyEmailAccountAdmins enumerates the values for security alert policy email account admins. -type SecurityAlertPolicyEmailAccountAdmins string - -const ( - // SecurityAlertPolicyEmailAccountAdminsDisabled ... - SecurityAlertPolicyEmailAccountAdminsDisabled SecurityAlertPolicyEmailAccountAdmins = "Disabled" - // SecurityAlertPolicyEmailAccountAdminsEnabled ... - SecurityAlertPolicyEmailAccountAdminsEnabled SecurityAlertPolicyEmailAccountAdmins = "Enabled" -) - -// PossibleSecurityAlertPolicyEmailAccountAdminsValues returns an array of possible values for the SecurityAlertPolicyEmailAccountAdmins const type. -func PossibleSecurityAlertPolicyEmailAccountAdminsValues() []SecurityAlertPolicyEmailAccountAdmins { - return []SecurityAlertPolicyEmailAccountAdmins{SecurityAlertPolicyEmailAccountAdminsDisabled, SecurityAlertPolicyEmailAccountAdminsEnabled} -} - -// SecurityAlertPolicyState enumerates the values for security alert policy state. -type SecurityAlertPolicyState string - -const ( - // SecurityAlertPolicyStateDisabled ... - SecurityAlertPolicyStateDisabled SecurityAlertPolicyState = "Disabled" - // SecurityAlertPolicyStateEnabled ... - SecurityAlertPolicyStateEnabled SecurityAlertPolicyState = "Enabled" - // SecurityAlertPolicyStateNew ... - SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New" -) - -// PossibleSecurityAlertPolicyStateValues returns an array of possible values for the SecurityAlertPolicyState const type. -func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { - return []SecurityAlertPolicyState{SecurityAlertPolicyStateDisabled, SecurityAlertPolicyStateEnabled, SecurityAlertPolicyStateNew} -} - -// SecurityAlertPolicyUseServerDefault enumerates the values for security alert policy use server default. -type SecurityAlertPolicyUseServerDefault string - -const ( - // SecurityAlertPolicyUseServerDefaultDisabled ... - SecurityAlertPolicyUseServerDefaultDisabled SecurityAlertPolicyUseServerDefault = "Disabled" - // SecurityAlertPolicyUseServerDefaultEnabled ... - SecurityAlertPolicyUseServerDefaultEnabled SecurityAlertPolicyUseServerDefault = "Enabled" -) - -// PossibleSecurityAlertPolicyUseServerDefaultValues returns an array of possible values for the SecurityAlertPolicyUseServerDefault const type. -func PossibleSecurityAlertPolicyUseServerDefaultValues() []SecurityAlertPolicyUseServerDefault { - return []SecurityAlertPolicyUseServerDefault{SecurityAlertPolicyUseServerDefaultDisabled, SecurityAlertPolicyUseServerDefaultEnabled} -} - -// ServerConnectionType enumerates the values for server connection type. -type ServerConnectionType string - -const ( - // ServerConnectionTypeDefault ... - ServerConnectionTypeDefault ServerConnectionType = "Default" - // ServerConnectionTypeProxy ... - ServerConnectionTypeProxy ServerConnectionType = "Proxy" - // ServerConnectionTypeRedirect ... - ServerConnectionTypeRedirect ServerConnectionType = "Redirect" -) - -// PossibleServerConnectionTypeValues returns an array of possible values for the ServerConnectionType const type. -func PossibleServerConnectionTypeValues() []ServerConnectionType { - return []ServerConnectionType{ServerConnectionTypeDefault, ServerConnectionTypeProxy, ServerConnectionTypeRedirect} -} - -// ServerKeyType enumerates the values for server key type. -type ServerKeyType string - -const ( - // AzureKeyVault ... - AzureKeyVault ServerKeyType = "AzureKeyVault" - // ServiceManaged ... - ServiceManaged ServerKeyType = "ServiceManaged" -) - -// PossibleServerKeyTypeValues returns an array of possible values for the ServerKeyType const type. -func PossibleServerKeyTypeValues() []ServerKeyType { - return []ServerKeyType{AzureKeyVault, ServiceManaged} -} - -// ServiceObjectiveName enumerates the values for service objective name. -type ServiceObjectiveName string - -const ( - // ServiceObjectiveNameBasic ... - ServiceObjectiveNameBasic ServiceObjectiveName = "Basic" - // ServiceObjectiveNameDS100 ... - ServiceObjectiveNameDS100 ServiceObjectiveName = "DS100" - // ServiceObjectiveNameDS1000 ... - ServiceObjectiveNameDS1000 ServiceObjectiveName = "DS1000" - // ServiceObjectiveNameDS1200 ... - ServiceObjectiveNameDS1200 ServiceObjectiveName = "DS1200" - // ServiceObjectiveNameDS1500 ... - ServiceObjectiveNameDS1500 ServiceObjectiveName = "DS1500" - // ServiceObjectiveNameDS200 ... - ServiceObjectiveNameDS200 ServiceObjectiveName = "DS200" - // ServiceObjectiveNameDS2000 ... - ServiceObjectiveNameDS2000 ServiceObjectiveName = "DS2000" - // ServiceObjectiveNameDS300 ... - ServiceObjectiveNameDS300 ServiceObjectiveName = "DS300" - // ServiceObjectiveNameDS400 ... - ServiceObjectiveNameDS400 ServiceObjectiveName = "DS400" - // ServiceObjectiveNameDS500 ... - ServiceObjectiveNameDS500 ServiceObjectiveName = "DS500" - // ServiceObjectiveNameDS600 ... - ServiceObjectiveNameDS600 ServiceObjectiveName = "DS600" - // ServiceObjectiveNameDW100 ... - ServiceObjectiveNameDW100 ServiceObjectiveName = "DW100" - // ServiceObjectiveNameDW1000 ... - ServiceObjectiveNameDW1000 ServiceObjectiveName = "DW1000" - // ServiceObjectiveNameDW10000c ... - ServiceObjectiveNameDW10000c ServiceObjectiveName = "DW10000c" - // ServiceObjectiveNameDW1000c ... - ServiceObjectiveNameDW1000c ServiceObjectiveName = "DW1000c" - // ServiceObjectiveNameDW1200 ... - ServiceObjectiveNameDW1200 ServiceObjectiveName = "DW1200" - // ServiceObjectiveNameDW1500 ... - ServiceObjectiveNameDW1500 ServiceObjectiveName = "DW1500" - // ServiceObjectiveNameDW15000c ... - ServiceObjectiveNameDW15000c ServiceObjectiveName = "DW15000c" - // ServiceObjectiveNameDW1500c ... - ServiceObjectiveNameDW1500c ServiceObjectiveName = "DW1500c" - // ServiceObjectiveNameDW200 ... - ServiceObjectiveNameDW200 ServiceObjectiveName = "DW200" - // ServiceObjectiveNameDW2000 ... - ServiceObjectiveNameDW2000 ServiceObjectiveName = "DW2000" - // ServiceObjectiveNameDW2000c ... - ServiceObjectiveNameDW2000c ServiceObjectiveName = "DW2000c" - // ServiceObjectiveNameDW2500c ... - ServiceObjectiveNameDW2500c ServiceObjectiveName = "DW2500c" - // ServiceObjectiveNameDW300 ... - ServiceObjectiveNameDW300 ServiceObjectiveName = "DW300" - // ServiceObjectiveNameDW3000 ... - ServiceObjectiveNameDW3000 ServiceObjectiveName = "DW3000" - // ServiceObjectiveNameDW30000c ... - ServiceObjectiveNameDW30000c ServiceObjectiveName = "DW30000c" - // ServiceObjectiveNameDW3000c ... - ServiceObjectiveNameDW3000c ServiceObjectiveName = "DW3000c" - // ServiceObjectiveNameDW400 ... - ServiceObjectiveNameDW400 ServiceObjectiveName = "DW400" - // ServiceObjectiveNameDW500 ... - ServiceObjectiveNameDW500 ServiceObjectiveName = "DW500" - // ServiceObjectiveNameDW5000c ... - ServiceObjectiveNameDW5000c ServiceObjectiveName = "DW5000c" - // ServiceObjectiveNameDW600 ... - ServiceObjectiveNameDW600 ServiceObjectiveName = "DW600" - // ServiceObjectiveNameDW6000 ... - ServiceObjectiveNameDW6000 ServiceObjectiveName = "DW6000" - // ServiceObjectiveNameDW6000c ... - ServiceObjectiveNameDW6000c ServiceObjectiveName = "DW6000c" - // ServiceObjectiveNameDW7500c ... - ServiceObjectiveNameDW7500c ServiceObjectiveName = "DW7500c" - // ServiceObjectiveNameElasticPool ... - ServiceObjectiveNameElasticPool ServiceObjectiveName = "ElasticPool" - // ServiceObjectiveNameFree ... - ServiceObjectiveNameFree ServiceObjectiveName = "Free" - // ServiceObjectiveNameP1 ... - ServiceObjectiveNameP1 ServiceObjectiveName = "P1" - // ServiceObjectiveNameP11 ... - ServiceObjectiveNameP11 ServiceObjectiveName = "P11" - // ServiceObjectiveNameP15 ... - ServiceObjectiveNameP15 ServiceObjectiveName = "P15" - // ServiceObjectiveNameP2 ... - ServiceObjectiveNameP2 ServiceObjectiveName = "P2" - // ServiceObjectiveNameP3 ... - ServiceObjectiveNameP3 ServiceObjectiveName = "P3" - // ServiceObjectiveNameP4 ... - ServiceObjectiveNameP4 ServiceObjectiveName = "P4" - // ServiceObjectiveNameP6 ... - ServiceObjectiveNameP6 ServiceObjectiveName = "P6" - // ServiceObjectiveNamePRS1 ... - ServiceObjectiveNamePRS1 ServiceObjectiveName = "PRS1" - // ServiceObjectiveNamePRS2 ... - ServiceObjectiveNamePRS2 ServiceObjectiveName = "PRS2" - // ServiceObjectiveNamePRS4 ... - ServiceObjectiveNamePRS4 ServiceObjectiveName = "PRS4" - // ServiceObjectiveNamePRS6 ... - ServiceObjectiveNamePRS6 ServiceObjectiveName = "PRS6" - // ServiceObjectiveNameS0 ... - ServiceObjectiveNameS0 ServiceObjectiveName = "S0" - // ServiceObjectiveNameS1 ... - ServiceObjectiveNameS1 ServiceObjectiveName = "S1" - // ServiceObjectiveNameS12 ... - ServiceObjectiveNameS12 ServiceObjectiveName = "S12" - // ServiceObjectiveNameS2 ... - ServiceObjectiveNameS2 ServiceObjectiveName = "S2" - // ServiceObjectiveNameS3 ... - ServiceObjectiveNameS3 ServiceObjectiveName = "S3" - // ServiceObjectiveNameS4 ... - ServiceObjectiveNameS4 ServiceObjectiveName = "S4" - // ServiceObjectiveNameS6 ... - ServiceObjectiveNameS6 ServiceObjectiveName = "S6" - // ServiceObjectiveNameS7 ... - ServiceObjectiveNameS7 ServiceObjectiveName = "S7" - // ServiceObjectiveNameS9 ... - ServiceObjectiveNameS9 ServiceObjectiveName = "S9" - // ServiceObjectiveNameSystem ... - ServiceObjectiveNameSystem ServiceObjectiveName = "System" - // ServiceObjectiveNameSystem0 ... - ServiceObjectiveNameSystem0 ServiceObjectiveName = "System0" - // ServiceObjectiveNameSystem1 ... - ServiceObjectiveNameSystem1 ServiceObjectiveName = "System1" - // ServiceObjectiveNameSystem2 ... - ServiceObjectiveNameSystem2 ServiceObjectiveName = "System2" - // ServiceObjectiveNameSystem2L ... - ServiceObjectiveNameSystem2L ServiceObjectiveName = "System2L" - // ServiceObjectiveNameSystem3 ... - ServiceObjectiveNameSystem3 ServiceObjectiveName = "System3" - // ServiceObjectiveNameSystem3L ... - ServiceObjectiveNameSystem3L ServiceObjectiveName = "System3L" - // ServiceObjectiveNameSystem4 ... - ServiceObjectiveNameSystem4 ServiceObjectiveName = "System4" - // ServiceObjectiveNameSystem4L ... - ServiceObjectiveNameSystem4L ServiceObjectiveName = "System4L" -) - -// PossibleServiceObjectiveNameValues returns an array of possible values for the ServiceObjectiveName const type. -func PossibleServiceObjectiveNameValues() []ServiceObjectiveName { - return []ServiceObjectiveName{ServiceObjectiveNameBasic, ServiceObjectiveNameDS100, ServiceObjectiveNameDS1000, ServiceObjectiveNameDS1200, ServiceObjectiveNameDS1500, ServiceObjectiveNameDS200, ServiceObjectiveNameDS2000, ServiceObjectiveNameDS300, ServiceObjectiveNameDS400, ServiceObjectiveNameDS500, ServiceObjectiveNameDS600, ServiceObjectiveNameDW100, ServiceObjectiveNameDW1000, ServiceObjectiveNameDW10000c, ServiceObjectiveNameDW1000c, ServiceObjectiveNameDW1200, ServiceObjectiveNameDW1500, ServiceObjectiveNameDW15000c, ServiceObjectiveNameDW1500c, ServiceObjectiveNameDW200, ServiceObjectiveNameDW2000, ServiceObjectiveNameDW2000c, ServiceObjectiveNameDW2500c, ServiceObjectiveNameDW300, ServiceObjectiveNameDW3000, ServiceObjectiveNameDW30000c, ServiceObjectiveNameDW3000c, ServiceObjectiveNameDW400, ServiceObjectiveNameDW500, ServiceObjectiveNameDW5000c, ServiceObjectiveNameDW600, ServiceObjectiveNameDW6000, ServiceObjectiveNameDW6000c, ServiceObjectiveNameDW7500c, ServiceObjectiveNameElasticPool, ServiceObjectiveNameFree, ServiceObjectiveNameP1, ServiceObjectiveNameP11, ServiceObjectiveNameP15, ServiceObjectiveNameP2, ServiceObjectiveNameP3, ServiceObjectiveNameP4, ServiceObjectiveNameP6, ServiceObjectiveNamePRS1, ServiceObjectiveNamePRS2, ServiceObjectiveNamePRS4, ServiceObjectiveNamePRS6, ServiceObjectiveNameS0, ServiceObjectiveNameS1, ServiceObjectiveNameS12, ServiceObjectiveNameS2, ServiceObjectiveNameS3, ServiceObjectiveNameS4, ServiceObjectiveNameS6, ServiceObjectiveNameS7, ServiceObjectiveNameS9, ServiceObjectiveNameSystem, ServiceObjectiveNameSystem0, ServiceObjectiveNameSystem1, ServiceObjectiveNameSystem2, ServiceObjectiveNameSystem2L, ServiceObjectiveNameSystem3, ServiceObjectiveNameSystem3L, ServiceObjectiveNameSystem4, ServiceObjectiveNameSystem4L} -} - -// StorageKeyType enumerates the values for storage key type. -type StorageKeyType string - -const ( - // SharedAccessKey ... - SharedAccessKey StorageKeyType = "SharedAccessKey" - // StorageAccessKey ... - StorageAccessKey StorageKeyType = "StorageAccessKey" -) - -// PossibleStorageKeyTypeValues returns an array of possible values for the StorageKeyType const type. -func PossibleStorageKeyTypeValues() []StorageKeyType { - return []StorageKeyType{SharedAccessKey, StorageAccessKey} -} - -// SyncAgentState enumerates the values for sync agent state. -type SyncAgentState string - -const ( - // NeverConnected ... - NeverConnected SyncAgentState = "NeverConnected" - // Offline ... - Offline SyncAgentState = "Offline" - // Online ... - Online SyncAgentState = "Online" -) - -// PossibleSyncAgentStateValues returns an array of possible values for the SyncAgentState const type. -func PossibleSyncAgentStateValues() []SyncAgentState { - return []SyncAgentState{NeverConnected, Offline, Online} -} - -// SyncConflictResolutionPolicy enumerates the values for sync conflict resolution policy. -type SyncConflictResolutionPolicy string - -const ( - // HubWin ... - HubWin SyncConflictResolutionPolicy = "HubWin" - // MemberWin ... - MemberWin SyncConflictResolutionPolicy = "MemberWin" -) - -// PossibleSyncConflictResolutionPolicyValues returns an array of possible values for the SyncConflictResolutionPolicy const type. -func PossibleSyncConflictResolutionPolicyValues() []SyncConflictResolutionPolicy { - return []SyncConflictResolutionPolicy{HubWin, MemberWin} -} - -// SyncDirection enumerates the values for sync direction. -type SyncDirection string - -const ( - // Bidirectional ... - Bidirectional SyncDirection = "Bidirectional" - // OneWayHubToMember ... - OneWayHubToMember SyncDirection = "OneWayHubToMember" - // OneWayMemberToHub ... - OneWayMemberToHub SyncDirection = "OneWayMemberToHub" -) - -// PossibleSyncDirectionValues returns an array of possible values for the SyncDirection const type. -func PossibleSyncDirectionValues() []SyncDirection { - return []SyncDirection{Bidirectional, OneWayHubToMember, OneWayMemberToHub} -} - -// SyncGroupLogType enumerates the values for sync group log type. -type SyncGroupLogType string - -const ( - // SyncGroupLogTypeAll ... - SyncGroupLogTypeAll SyncGroupLogType = "All" - // SyncGroupLogTypeError ... - SyncGroupLogTypeError SyncGroupLogType = "Error" - // SyncGroupLogTypeSuccess ... - SyncGroupLogTypeSuccess SyncGroupLogType = "Success" - // SyncGroupLogTypeWarning ... - SyncGroupLogTypeWarning SyncGroupLogType = "Warning" -) - -// PossibleSyncGroupLogTypeValues returns an array of possible values for the SyncGroupLogType const type. -func PossibleSyncGroupLogTypeValues() []SyncGroupLogType { - return []SyncGroupLogType{SyncGroupLogTypeAll, SyncGroupLogTypeError, SyncGroupLogTypeSuccess, SyncGroupLogTypeWarning} -} - -// SyncGroupState enumerates the values for sync group state. -type SyncGroupState string - -const ( - // Error ... - Error SyncGroupState = "Error" - // Good ... - Good SyncGroupState = "Good" - // NotReady ... - NotReady SyncGroupState = "NotReady" - // Progressing ... - Progressing SyncGroupState = "Progressing" - // Warning ... - Warning SyncGroupState = "Warning" -) - -// PossibleSyncGroupStateValues returns an array of possible values for the SyncGroupState const type. -func PossibleSyncGroupStateValues() []SyncGroupState { - return []SyncGroupState{Error, Good, NotReady, Progressing, Warning} -} - -// SyncMemberDbType enumerates the values for sync member db type. -type SyncMemberDbType string - -const ( - // AzureSQLDatabase ... - AzureSQLDatabase SyncMemberDbType = "AzureSqlDatabase" - // SQLServerDatabase ... - SQLServerDatabase SyncMemberDbType = "SqlServerDatabase" -) - -// PossibleSyncMemberDbTypeValues returns an array of possible values for the SyncMemberDbType const type. -func PossibleSyncMemberDbTypeValues() []SyncMemberDbType { - return []SyncMemberDbType{AzureSQLDatabase, SQLServerDatabase} -} - -// SyncMemberState enumerates the values for sync member state. -type SyncMemberState string - -const ( - // DeProvisioned ... - DeProvisioned SyncMemberState = "DeProvisioned" - // DeProvisionFailed ... - DeProvisionFailed SyncMemberState = "DeProvisionFailed" - // DeProvisioning ... - DeProvisioning SyncMemberState = "DeProvisioning" - // DisabledBackupRestore ... - DisabledBackupRestore SyncMemberState = "DisabledBackupRestore" - // DisabledTombstoneCleanup ... - DisabledTombstoneCleanup SyncMemberState = "DisabledTombstoneCleanup" - // Provisioned ... - Provisioned SyncMemberState = "Provisioned" - // ProvisionFailed ... - ProvisionFailed SyncMemberState = "ProvisionFailed" - // Provisioning ... - Provisioning SyncMemberState = "Provisioning" - // ReprovisionFailed ... - ReprovisionFailed SyncMemberState = "ReprovisionFailed" - // Reprovisioning ... - Reprovisioning SyncMemberState = "Reprovisioning" - // SyncCancelled ... - SyncCancelled SyncMemberState = "SyncCancelled" - // SyncCancelling ... - SyncCancelling SyncMemberState = "SyncCancelling" - // SyncFailed ... - SyncFailed SyncMemberState = "SyncFailed" - // SyncInProgress ... - SyncInProgress SyncMemberState = "SyncInProgress" - // SyncSucceeded ... - SyncSucceeded SyncMemberState = "SyncSucceeded" - // SyncSucceededWithWarnings ... - SyncSucceededWithWarnings SyncMemberState = "SyncSucceededWithWarnings" - // UnProvisioned ... - UnProvisioned SyncMemberState = "UnProvisioned" - // UnReprovisioned ... - UnReprovisioned SyncMemberState = "UnReprovisioned" -) - -// PossibleSyncMemberStateValues returns an array of possible values for the SyncMemberState const type. -func PossibleSyncMemberStateValues() []SyncMemberState { - return []SyncMemberState{DeProvisioned, DeProvisionFailed, DeProvisioning, DisabledBackupRestore, DisabledTombstoneCleanup, Provisioned, ProvisionFailed, Provisioning, ReprovisionFailed, Reprovisioning, SyncCancelled, SyncCancelling, SyncFailed, SyncInProgress, SyncSucceeded, SyncSucceededWithWarnings, UnProvisioned, UnReprovisioned} -} - -// TransparentDataEncryptionActivityStatus enumerates the values for transparent data encryption activity -// status. -type TransparentDataEncryptionActivityStatus string - -const ( - // Decrypting ... - Decrypting TransparentDataEncryptionActivityStatus = "Decrypting" - // Encrypting ... - Encrypting TransparentDataEncryptionActivityStatus = "Encrypting" -) - -// PossibleTransparentDataEncryptionActivityStatusValues returns an array of possible values for the TransparentDataEncryptionActivityStatus const type. -func PossibleTransparentDataEncryptionActivityStatusValues() []TransparentDataEncryptionActivityStatus { - return []TransparentDataEncryptionActivityStatus{Decrypting, Encrypting} -} - -// TransparentDataEncryptionStatus enumerates the values for transparent data encryption status. -type TransparentDataEncryptionStatus string - -const ( - // TransparentDataEncryptionStatusDisabled ... - TransparentDataEncryptionStatusDisabled TransparentDataEncryptionStatus = "Disabled" - // TransparentDataEncryptionStatusEnabled ... - TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = "Enabled" -) - -// PossibleTransparentDataEncryptionStatusValues returns an array of possible values for the TransparentDataEncryptionStatus const type. -func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryptionStatus { - return []TransparentDataEncryptionStatus{TransparentDataEncryptionStatusDisabled, TransparentDataEncryptionStatusEnabled} -} - -// UnitDefinitionType enumerates the values for unit definition type. -type UnitDefinitionType string - -const ( - // UnitDefinitionTypeBytes ... - UnitDefinitionTypeBytes UnitDefinitionType = "Bytes" - // UnitDefinitionTypeBytesPerSecond ... - UnitDefinitionTypeBytesPerSecond UnitDefinitionType = "BytesPerSecond" - // UnitDefinitionTypeCount ... - UnitDefinitionTypeCount UnitDefinitionType = "Count" - // UnitDefinitionTypeCountPerSecond ... - UnitDefinitionTypeCountPerSecond UnitDefinitionType = "CountPerSecond" - // UnitDefinitionTypePercent ... - UnitDefinitionTypePercent UnitDefinitionType = "Percent" - // UnitDefinitionTypeSeconds ... - UnitDefinitionTypeSeconds UnitDefinitionType = "Seconds" -) - -// PossibleUnitDefinitionTypeValues returns an array of possible values for the UnitDefinitionType const type. -func PossibleUnitDefinitionTypeValues() []UnitDefinitionType { - return []UnitDefinitionType{UnitDefinitionTypeBytes, UnitDefinitionTypeBytesPerSecond, UnitDefinitionTypeCount, UnitDefinitionTypeCountPerSecond, UnitDefinitionTypePercent, UnitDefinitionTypeSeconds} -} - -// UnitType enumerates the values for unit type. -type UnitType string - -const ( - // UnitTypeBytes ... - UnitTypeBytes UnitType = "bytes" - // UnitTypeBytesPerSecond ... - UnitTypeBytesPerSecond UnitType = "bytesPerSecond" - // UnitTypeCount ... - UnitTypeCount UnitType = "count" - // UnitTypeCountPerSecond ... - UnitTypeCountPerSecond UnitType = "countPerSecond" - // UnitTypePercent ... - UnitTypePercent UnitType = "percent" - // UnitTypeSeconds ... - UnitTypeSeconds UnitType = "seconds" -) - -// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{UnitTypeBytes, UnitTypeBytesPerSecond, UnitTypeCount, UnitTypeCountPerSecond, UnitTypePercent, UnitTypeSeconds} -} - -// VirtualNetworkRuleState enumerates the values for virtual network rule state. -type VirtualNetworkRuleState string - -const ( - // Deleting ... - Deleting VirtualNetworkRuleState = "Deleting" - // Initializing ... - Initializing VirtualNetworkRuleState = "Initializing" - // InProgress ... - InProgress VirtualNetworkRuleState = "InProgress" - // Ready ... - Ready VirtualNetworkRuleState = "Ready" - // Unknown ... - Unknown VirtualNetworkRuleState = "Unknown" -) - -// PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type. -func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { - return []VirtualNetworkRuleState{Deleting, Initializing, InProgress, Ready, Unknown} -} diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/failovergroups.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/failovergroups.go deleted file mode 100644 index bab986e12e9e..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/failovergroups.go +++ /dev/null @@ -1,658 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// FailoverGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type FailoverGroupsClient struct { - BaseClient -} - -// NewFailoverGroupsClient creates an instance of the FailoverGroupsClient client. -func NewFailoverGroupsClient(subscriptionID string) FailoverGroupsClient { - return NewFailoverGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFailoverGroupsClientWithBaseURI creates an instance of the FailoverGroupsClient 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 NewFailoverGroupsClientWithBaseURI(baseURI string, subscriptionID string) FailoverGroupsClient { - return FailoverGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -// parameters - the failover group parameters. -func (client FailoverGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroup) (result FailoverGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FailoverGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.FailoverGroupProperties.ReadWriteEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FailoverGroupProperties.PartnerServers", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.FailoverGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, failoverGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FailoverGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = 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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", 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 FailoverGroupsClient) CreateOrUpdateSender(req *http.Request) (future FailoverGroupsCreateOrUpdateFuture, 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 FailoverGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result FailoverGroup, 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 a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -func (client FailoverGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FailoverGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", 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 FailoverGroupsClient) DeleteSender(req *http.Request) (future FailoverGroupsDeleteFuture, 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 FailoverGroupsClient) 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 -} - -// Failover fails over from the current primary server to this server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -func (client FailoverGroupsClient) Failover(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.Failover") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client FailoverGroupsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client FailoverGroupsClient) FailoverSender(req *http.Request) (future FailoverGroupsFailoverFuture, 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 -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client FailoverGroupsClient) FailoverResponder(resp *http.Response) (result FailoverGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ForceFailoverAllowDataLoss fails over from the current primary server to this server. This operation might result in -// data loss. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -func (client FailoverGroupsClient) ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsForceFailoverAllowDataLossFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.ForceFailoverAllowDataLoss") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ForceFailoverAllowDataLossPreparer(ctx, resourceGroupName, serverName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ForceFailoverAllowDataLoss", nil, "Failure preparing request") - return - } - - result, err = client.ForceFailoverAllowDataLossSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ForceFailoverAllowDataLoss", result.Response(), "Failure sending request") - return - } - - return -} - -// ForceFailoverAllowDataLossPreparer prepares the ForceFailoverAllowDataLoss request. -func (client FailoverGroupsClient) ForceFailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ForceFailoverAllowDataLossSender sends the ForceFailoverAllowDataLoss request. The method will close the -// http.Response Body if it receives an error. -func (client FailoverGroupsClient) ForceFailoverAllowDataLossSender(req *http.Request) (future FailoverGroupsForceFailoverAllowDataLossFuture, 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 -} - -// ForceFailoverAllowDataLossResponder handles the response to the ForceFailoverAllowDataLoss request. The method always -// closes the http.Response Body. -func (client FailoverGroupsClient) ForceFailoverAllowDataLossResponder(resp *http.Response) (result FailoverGroup, 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 a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -func (client FailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.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, serverName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FailoverGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", 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 FailoverGroupsClient) 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 FailoverGroupsClient) GetResponder(resp *http.Response) (result FailoverGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer lists the failover groups in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -func (client FailoverGroupsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FailoverGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.ListByServer") - defer func() { - sc := -1 - if result.fglr.Response.Response != nil { - sc = result.fglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.fglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.fglr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.fglr.hasNextLink() && result.fglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client FailoverGroupsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client FailoverGroupsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client FailoverGroupsClient) ListByServerResponder(resp *http.Response) (result FailoverGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client FailoverGroupsClient) listByServerNextResults(ctx context.Context, lastResults FailoverGroupListResult) (result FailoverGroupListResult, err error) { - req, err := lastResults.failoverGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client FailoverGroupsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result FailoverGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// Update updates a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -// parameters - the failover group parameters. -func (client FailoverGroupsClient) Update(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroupUpdate) (result FailoverGroupsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, failoverGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client FailoverGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroupUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", 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 FailoverGroupsClient) UpdateSender(req *http.Request) (future FailoverGroupsUpdateFuture, 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 FailoverGroupsClient) UpdateResponder(resp *http.Response) (result FailoverGroup, 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/preview/sql/mgmt/2015-05-01-preview/sql/firewallrules.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/firewallrules.go deleted file mode 100644 index 3e79a6b3933c..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/firewallrules.go +++ /dev/null @@ -1,361 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// FirewallRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type FirewallRulesClient struct { - BaseClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the FirewallRulesClient 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 NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// firewallRuleName - the name of the firewall rule. -// parameters - the required parameters for creating or updating a firewall rule. -func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.FirewallRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, 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 a firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// firewallRuleName - the name of the firewall rule. -func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) 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 firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// firewallRuleName - the name of the firewall rule. -func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.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, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns a list of firewall rules. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListByServerResponder(resp *http.Response) (result FirewallRuleListResult, 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/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go deleted file mode 100644 index 605603cc5f04..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/geobackuppolicies.go +++ /dev/null @@ -1,285 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GeoBackupPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type GeoBackupPoliciesClient struct { - BaseClient -} - -// NewGeoBackupPoliciesClient creates an instance of the GeoBackupPoliciesClient client. -func NewGeoBackupPoliciesClient(subscriptionID string) GeoBackupPoliciesClient { - return NewGeoBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGeoBackupPoliciesClientWithBaseURI creates an instance of the GeoBackupPoliciesClient 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 NewGeoBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) GeoBackupPoliciesClient { - return GeoBackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates a database geo backup policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the required parameters for creating or updating the geo backup policy. -func (client GeoBackupPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters GeoBackupPolicy) (result GeoBackupPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GeoBackupPoliciesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GeoBackupPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.GeoBackupPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GeoBackupPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters GeoBackupPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "geoBackupPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}", 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 GeoBackupPoliciesClient) 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 GeoBackupPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result GeoBackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a geo backup policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client GeoBackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result GeoBackupPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GeoBackupPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GeoBackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "geoBackupPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}", 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 GeoBackupPoliciesClient) 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 GeoBackupPoliciesClient) GetResponder(resp *http.Response) (result GeoBackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase returns a list of geo backup policies. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client GeoBackupPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result GeoBackupPolicyListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GeoBackupPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client GeoBackupPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GeoBackupPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client GeoBackupPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result GeoBackupPolicyListResult, 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/sql/mgmt/2015-05-01-preview/sql/managedinstances.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go deleted file mode 100644 index 58b525bf1774..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/managedinstances.go +++ /dev/null @@ -1,594 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstancesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ManagedInstancesClient struct { - BaseClient -} - -// NewManagedInstancesClient creates an instance of the ManagedInstancesClient client. -func NewManagedInstancesClient(subscriptionID string) ManagedInstancesClient { - return NewManagedInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstancesClientWithBaseURI creates an instance of the ManagedInstancesClient 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 NewManagedInstancesClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstancesClient { - return ManagedInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the requested managed instance resource state. -func (client ManagedInstancesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstance) (result ManagedInstancesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ManagedInstancesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstancesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstance) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstancesCreateOrUpdateFuture, 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 ManagedInstancesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstance, 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 a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstancesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstancesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedInstancesClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) DeleteSender(req *http.Request) (future ManagedInstancesDeleteFuture, 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 ManagedInstancesClient) 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 a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstancesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstance, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.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, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstancesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) 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 ManagedInstancesClient) GetResponder(resp *http.Response) (result ManagedInstance, 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 managed instances in the subscription. -func (client ManagedInstancesClient) List(ctx context.Context) (result ManagedInstanceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.List") - defer func() { - sc := -1 - if result.milr.Response.Response != nil { - sc = result.milr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.milr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "List", resp, "Failure sending request") - return - } - - result.milr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "List", resp, "Failure responding to request") - return - } - if result.milr.hasNextLink() && result.milr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ManagedInstancesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances", 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 ManagedInstancesClient) 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 ManagedInstancesClient) ListResponder(resp *http.Response) (result ManagedInstanceListResult, 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 ManagedInstancesClient) listNextResults(ctx context.Context, lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { - req, err := lastResults.managedInstanceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "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, "sql.ManagedInstancesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstancesClient) ListComplete(ctx context.Context) (result ManagedInstanceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.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 managed instances in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -func (client ManagedInstancesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedInstanceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.milr.Response.Response != nil { - sc = result.milr.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, "sql.ManagedInstancesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.milr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.milr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.milr.hasNextLink() && result.milr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ManagedInstancesClient) 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-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.Sql/managedInstances", 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 ManagedInstancesClient) 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 ManagedInstancesClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedInstanceListResult, 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 ManagedInstancesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { - req, err := lastResults.managedInstanceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "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, "sql.ManagedInstancesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstancesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ManagedInstanceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.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 -} - -// Update updates a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the requested managed instance resource state. -func (client ManagedInstancesClient) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceUpdate) (result ManagedInstancesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ManagedInstancesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) UpdateSender(req *http.Request) (future ManagedInstancesUpdateFuture, 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 ManagedInstancesClient) UpdateResponder(resp *http.Response) (result ManagedInstance, 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/preview/sql/mgmt/2015-05-01-preview/sql/models.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go deleted file mode 100644 index ea49f3695935..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go +++ /dev/null @@ -1,10306 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2015-05-01-preview/sql" - -// CheckNameAvailabilityRequest a request to check whether the specified name for a resource is available. -type CheckNameAvailabilityRequest struct { - // Name - The name whose availability is to be checked. - Name *string `json:"name,omitempty"` - // Type - The type of resource that is used as the scope of the availability check. - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResponse a response indicating whether the specified name for a resource is -// available. -type CheckNameAvailabilityResponse struct { - autorest.Response `json:"-"` - // Available - READ-ONLY; True if the name is available, otherwise false. - Available *bool `json:"available,omitempty"` - // Message - READ-ONLY; A message explaining why the name is unavailable. Will be null if the name is available. - Message *string `json:"message,omitempty"` - // Name - READ-ONLY; The name whose availability was checked. - Name *string `json:"name,omitempty"` - // Reason - READ-ONLY; The reason code explaining why the name is unavailable. Will be null if the name is available. Possible values include: 'Invalid', 'AlreadyExists' - Reason CheckNameAvailabilityReason `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckNameAvailabilityResponse. -func (cnar CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Database represents a database. -type Database struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of database. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // DatabaseProperties - The properties representing the resource. - *DatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) 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 - } - d.Kind = &kind - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseBlobAuditingPolicy a database blob auditing policy. -type DatabaseBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty"` - // DatabaseBlobAuditingPolicyProperties - Resource properties. - *DatabaseBlobAuditingPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseBlobAuditingPolicy. -func (dbap DatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dbap.DatabaseBlobAuditingPolicyProperties != nil { - objectMap["properties"] = dbap.DatabaseBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseBlobAuditingPolicy struct. -func (dbap *DatabaseBlobAuditingPolicy) 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 - } - dbap.Kind = &kind - } - case "properties": - if v != nil { - var databaseBlobAuditingPolicyProperties DatabaseBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &databaseBlobAuditingPolicyProperties) - if err != nil { - return err - } - dbap.DatabaseBlobAuditingPolicyProperties = &databaseBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dbap.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseBlobAuditingPolicyListResult a list of database auditing settings. -type DatabaseBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]DatabaseBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseBlobAuditingPolicyListResult. -func (dbaplr DatabaseBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseBlobAuditingPolicyListResultIterator provides access to a complete listing of -// DatabaseBlobAuditingPolicy values. -type DatabaseBlobAuditingPolicyListResultIterator struct { - i int - page DatabaseBlobAuditingPolicyListResultPage -} - -// 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 *DatabaseBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPolicyListResultIterator.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 *DatabaseBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseBlobAuditingPolicyListResultIterator) 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 DatabaseBlobAuditingPolicyListResultIterator) Response() DatabaseBlobAuditingPolicyListResult { - 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 DatabaseBlobAuditingPolicyListResultIterator) Value() DatabaseBlobAuditingPolicy { - if !iter.page.NotDone() { - return DatabaseBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseBlobAuditingPolicyListResultIterator type. -func NewDatabaseBlobAuditingPolicyListResultIterator(page DatabaseBlobAuditingPolicyListResultPage) DatabaseBlobAuditingPolicyListResultIterator { - return DatabaseBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dbaplr DatabaseBlobAuditingPolicyListResult) IsEmpty() bool { - return dbaplr.Value == nil || len(*dbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dbaplr DatabaseBlobAuditingPolicyListResult) hasNextLink() bool { - return dbaplr.NextLink != nil && len(*dbaplr.NextLink) != 0 -} - -// databaseBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dbaplr DatabaseBlobAuditingPolicyListResult) databaseBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dbaplr.NextLink))) -} - -// DatabaseBlobAuditingPolicyListResultPage contains a page of DatabaseBlobAuditingPolicy values. -type DatabaseBlobAuditingPolicyListResultPage struct { - fn func(context.Context, DatabaseBlobAuditingPolicyListResult) (DatabaseBlobAuditingPolicyListResult, error) - dbaplr DatabaseBlobAuditingPolicyListResult -} - -// 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 *DatabaseBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPolicyListResultPage.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.dbaplr) - if err != nil { - return err - } - page.dbaplr = 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 *DatabaseBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.dbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseBlobAuditingPolicyListResultPage) Response() DatabaseBlobAuditingPolicyListResult { - return page.dbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseBlobAuditingPolicyListResultPage) Values() []DatabaseBlobAuditingPolicy { - if page.dbaplr.IsEmpty() { - return nil - } - return *page.dbaplr.Value -} - -// Creates a new instance of the DatabaseBlobAuditingPolicyListResultPage type. -func NewDatabaseBlobAuditingPolicyListResultPage(cur DatabaseBlobAuditingPolicyListResult, getNextPage func(context.Context, DatabaseBlobAuditingPolicyListResult) (DatabaseBlobAuditingPolicyListResult, error)) DatabaseBlobAuditingPolicyListResultPage { - return DatabaseBlobAuditingPolicyListResultPage{ - fn: getNextPage, - dbaplr: cur, - } -} - -// DatabaseBlobAuditingPolicyProperties properties of a database blob auditing policy. -type DatabaseBlobAuditingPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'Enabled', 'Disabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// DatabaseListResult represents the response to a list database request. -type DatabaseListResult struct { - autorest.Response `json:"-"` - // Value - The list of databases housed in the server. - Value *[]Database `json:"value,omitempty"` -} - -// DatabaseProperties represents the properties of a database. -type DatabaseProperties struct { - // Collation - The collation of the database. If createMode is not Default, this value is ignored. - Collation *string `json:"collation,omitempty"` - // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // ContainmentState - READ-ONLY; The containment state of the database. - ContainmentState *int64 `json:"containmentState,omitempty"` - // CurrentServiceObjectiveID - READ-ONLY; The current service level objective ID of the database. This is the ID of the service level objective that is currently active. - CurrentServiceObjectiveID *uuid.UUID `json:"currentServiceObjectiveId,omitempty"` - // DatabaseID - READ-ONLY; The ID of the database. - DatabaseID *uuid.UUID `json:"databaseId,omitempty"` - // EarliestRestoreDate - READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // CreateMode - Specifies the mode of database creation. - // Default: regular database creation. - // Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. - // OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. - // PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. - // Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. - // Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. - // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. - // Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup' - CreateMode CreateMode `json:"createMode,omitempty"` - // SourceDatabaseID - Conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // SourceDatabaseDeletionDate - Conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. - SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` - // RestorePointInTime - Conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // RecoveryServicesRecoveryPointResourceID - Conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. - RecoveryServicesRecoveryPointResourceID *string `json:"recoveryServicesRecoveryPointResourceId,omitempty"` - // Edition - The edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: - // - // ```azurecli - // az sql db list-editions -l -o table - // ```` - // - // ```powershell - // Get-AzSqlServerServiceObjective -Location - // ```` - // . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' - Edition DatabaseEdition `json:"edition,omitempty"` - // MaxSizeBytes - The max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // RequestedServiceObjectiveID - The configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. - // - // The list of SKUs may vary by region and support offer. To determine the service objective ids that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API. - RequestedServiceObjectiveID *uuid.UUID `json:"requestedServiceObjectiveId,omitempty"` - // RequestedServiceObjectiveName - The name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: - // - // ```azurecli - // az sql db list-editions -l -o table - // ```` - // - // ```powershell - // Get-AzSqlServerServiceObjective -Location - // ```` - // . Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' - RequestedServiceObjectiveName ServiceObjectiveName `json:"requestedServiceObjectiveName,omitempty"` - // ServiceLevelObjective - READ-ONLY; The current service level objective of the database. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' - ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` - // Status - READ-ONLY; The status of the database. - Status *string `json:"status,omitempty"` - // ElasticPoolName - The name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // DefaultSecondaryLocation - READ-ONLY; The default secondary region for this database. - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` - // ServiceTierAdvisors - READ-ONLY; The list of service tier advisors for this database. Expanded property - ServiceTierAdvisors *[]ServiceTierAdvisor `json:"serviceTierAdvisors,omitempty"` - // TransparentDataEncryption - READ-ONLY; The transparent data encryption info for this database. - TransparentDataEncryption *[]TransparentDataEncryption `json:"transparentDataEncryption,omitempty"` - // RecommendedIndex - READ-ONLY; The recommended indices for this database. - RecommendedIndex *[]RecommendedIndex `json:"recommendedIndex,omitempty"` - // FailoverGroupID - READ-ONLY; The resource identifier of the failover group containing this database. - FailoverGroupID *string `json:"failoverGroupId,omitempty"` - // ReadScale - Conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'ReadScaleEnabled', 'ReadScaleDisabled' - ReadScale ReadScale `json:"readScale,omitempty"` - // SampleName - Indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT' - SampleName SampleName `json:"sampleName,omitempty"` - // ZoneRedundant - Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseProperties. -func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Collation != nil { - objectMap["collation"] = dp.Collation - } - if dp.CreateMode != "" { - objectMap["createMode"] = dp.CreateMode - } - if dp.SourceDatabaseID != nil { - objectMap["sourceDatabaseId"] = dp.SourceDatabaseID - } - if dp.SourceDatabaseDeletionDate != nil { - objectMap["sourceDatabaseDeletionDate"] = dp.SourceDatabaseDeletionDate - } - if dp.RestorePointInTime != nil { - objectMap["restorePointInTime"] = dp.RestorePointInTime - } - if dp.RecoveryServicesRecoveryPointResourceID != nil { - objectMap["recoveryServicesRecoveryPointResourceId"] = dp.RecoveryServicesRecoveryPointResourceID - } - if dp.Edition != "" { - objectMap["edition"] = dp.Edition - } - if dp.MaxSizeBytes != nil { - objectMap["maxSizeBytes"] = dp.MaxSizeBytes - } - if dp.RequestedServiceObjectiveID != nil { - objectMap["requestedServiceObjectiveId"] = dp.RequestedServiceObjectiveID - } - if dp.RequestedServiceObjectiveName != "" { - objectMap["requestedServiceObjectiveName"] = dp.RequestedServiceObjectiveName - } - if dp.ElasticPoolName != nil { - objectMap["elasticPoolName"] = dp.ElasticPoolName - } - if dp.ReadScale != "" { - objectMap["readScale"] = dp.ReadScale - } - if dp.SampleName != "" { - objectMap["sampleName"] = dp.SampleName - } - if dp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = dp.ZoneRedundant - } - return json.Marshal(objectMap) -} - -// DatabasesCreateImportOperationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabasesCreateImportOperationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (ImportExportResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateImportOperationFuture) 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 DatabasesCreateImportOperationFuture.Result. -func (future *DatabasesCreateImportOperationFuture) result(client DatabasesClient) (ier ImportExportResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ier.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateImportOperationFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { - ier, err = client.CreateImportOperationResponder(ier.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", ier.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateOrUpdateFuture) 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 DatabasesCreateOrUpdateFuture.Result. -func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseSecurityAlertPolicy contains information about a database Threat Detection policy. -type DatabaseSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty"` - // DatabaseSecurityAlertPolicyProperties - Properties of the security alert policy. - *DatabaseSecurityAlertPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseSecurityAlertPolicy. -func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsap.Location != nil { - objectMap["location"] = dsap.Location - } - if dsap.DatabaseSecurityAlertPolicyProperties != nil { - objectMap["properties"] = dsap.DatabaseSecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseSecurityAlertPolicy struct. -func (dsap *DatabaseSecurityAlertPolicy) 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 - } - dsap.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dsap.Kind = &kind - } - case "properties": - if v != nil { - var databaseSecurityAlertPolicyProperties DatabaseSecurityAlertPolicyProperties - err = json.Unmarshal(*v, &databaseSecurityAlertPolicyProperties) - if err != nil { - return err - } - dsap.DatabaseSecurityAlertPolicyProperties = &databaseSecurityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsap.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseSecurityAlertPolicyProperties properties for a database Threat Detection policy. -type DatabaseSecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' - State SecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. - DisabledAlerts *string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies the semicolon-separated list of e-mail addresses to which the alert is sent. - EmailAddresses *string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. Possible values include: 'SecurityAlertPolicyEmailAccountAdminsEnabled', 'SecurityAlertPolicyEmailAccountAdminsDisabled' - EmailAccountAdmins SecurityAlertPolicyEmailAccountAdmins `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state is Enabled, storageEndpoint is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // UseServerDefault - Specifies whether to use the default server policy. Possible values include: 'SecurityAlertPolicyUseServerDefaultEnabled', 'SecurityAlertPolicyUseServerDefaultDisabled' - UseServerDefault SecurityAlertPolicyUseServerDefault `json:"useServerDefault,omitempty"` -} - -// DatabasesExportFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesExportFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (ImportExportResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesExportFuture) 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 DatabasesExportFuture.Result. -func (future *DatabasesExportFuture) result(client DatabasesClient) (ier ImportExportResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ier.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesExportFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { - ier, err = client.ExportResponder(ier.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", ier.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesImportFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesImportFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (ImportExportResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesImportFuture) 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 DatabasesImportFuture.Result. -func (future *DatabasesImportFuture) result(client DatabasesClient) (ier ImportExportResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ier.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesImportFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { - ier, err = client.ImportResponder(ier.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", ier.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesPauseFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesPauseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesPauseFuture) 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 DatabasesPauseFuture.Result. -func (future *DatabasesPauseFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesPauseFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabasesResumeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesResumeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesResumeFuture) 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 DatabasesResumeFuture.Result. -func (future *DatabasesResumeFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesResumeFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesUpdateFuture) 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 DatabasesUpdateFuture.Result. -func (future *DatabasesUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseUpdate represents a database update. -type DatabaseUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // DatabaseProperties - The properties representing the resource. - *DatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseUpdate. -func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if du.Tags != nil { - objectMap["tags"] = du.Tags - } - if du.DatabaseProperties != nil { - objectMap["properties"] = du.DatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. -func (du *DatabaseUpdate) 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 - } - du.Tags = tags - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - du.DatabaseProperties = &databaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - du.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - du.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - du.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseUsage the database usages. -type DatabaseUsage struct { - // Name - READ-ONLY; The name of the usage metric. - Name *string `json:"name,omitempty"` - // ResourceName - READ-ONLY; The name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // DisplayName - READ-ONLY; The usage metric display name. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; The current value of the usage metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The current limit of the usage metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units of the usage metric. - Unit *string `json:"unit,omitempty"` - // NextResetTime - READ-ONLY; The next reset time for the usage metric (ISO8601 format). - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseUsage. -func (du DatabaseUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseUsageListResult the response to a list database metrics request. -type DatabaseUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of database usages for the database. - Value *[]DatabaseUsage `json:"value,omitempty"` -} - -// DataMaskingPolicy represents a database data masking policy. -type DataMaskingPolicy struct { - autorest.Response `json:"-"` - // DataMaskingPolicyProperties - The properties of the data masking policy. - *DataMaskingPolicyProperties `json:"properties,omitempty"` - // Location - READ-ONLY; The location of the data masking policy. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; The kind of data masking policy. Metadata, used for Azure portal. - Kind *string `json:"kind,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"` -} - -// MarshalJSON is the custom marshaler for DataMaskingPolicy. -func (dmp DataMaskingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmp.DataMaskingPolicyProperties != nil { - objectMap["properties"] = dmp.DataMaskingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataMaskingPolicy struct. -func (dmp *DataMaskingPolicy) 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 dataMaskingPolicyProperties DataMaskingPolicyProperties - err = json.Unmarshal(*v, &dataMaskingPolicyProperties) - if err != nil { - return err - } - dmp.DataMaskingPolicyProperties = &dataMaskingPolicyProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dmp.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dmp.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dmp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dmp.Type = &typeVar - } - } - } - - return nil -} - -// DataMaskingPolicyProperties the properties of a database data masking policy. -type DataMaskingPolicyProperties struct { - // DataMaskingState - The state of the data masking policy. Possible values include: 'DataMaskingStateDisabled', 'DataMaskingStateEnabled' - DataMaskingState DataMaskingState `json:"dataMaskingState,omitempty"` - // ExemptPrincipals - The list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. - ExemptPrincipals *string `json:"exemptPrincipals,omitempty"` - // ApplicationPrincipals - READ-ONLY; The list of the application principals. This is a legacy parameter and is no longer used. - ApplicationPrincipals *string `json:"applicationPrincipals,omitempty"` - // MaskingLevel - READ-ONLY; The masking level. This is a legacy parameter and is no longer used. - MaskingLevel *string `json:"maskingLevel,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataMaskingPolicyProperties. -func (dmpp DataMaskingPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmpp.DataMaskingState != "" { - objectMap["dataMaskingState"] = dmpp.DataMaskingState - } - if dmpp.ExemptPrincipals != nil { - objectMap["exemptPrincipals"] = dmpp.ExemptPrincipals - } - return json.Marshal(objectMap) -} - -// DataMaskingRule represents a database data masking rule. -type DataMaskingRule struct { - autorest.Response `json:"-"` - // DataMaskingRuleProperties - The properties of the resource. - *DataMaskingRuleProperties `json:"properties,omitempty"` - // Location - READ-ONLY; The location of the data masking rule. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; The kind of Data Masking Rule. Metadata, used for Azure portal. - Kind *string `json:"kind,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"` -} - -// MarshalJSON is the custom marshaler for DataMaskingRule. -func (dmr DataMaskingRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmr.DataMaskingRuleProperties != nil { - objectMap["properties"] = dmr.DataMaskingRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataMaskingRule struct. -func (dmr *DataMaskingRule) 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 dataMaskingRuleProperties DataMaskingRuleProperties - err = json.Unmarshal(*v, &dataMaskingRuleProperties) - if err != nil { - return err - } - dmr.DataMaskingRuleProperties = &dataMaskingRuleProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dmr.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dmr.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dmr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dmr.Type = &typeVar - } - } - } - - return nil -} - -// DataMaskingRuleListResult the response to a list data masking rules request. -type DataMaskingRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of database data masking rules. - Value *[]DataMaskingRule `json:"value,omitempty"` -} - -// DataMaskingRuleProperties the properties of a database data masking rule. -type DataMaskingRuleProperties struct { - // ID - READ-ONLY; The rule Id. - ID *string `json:"id,omitempty"` - // AliasName - The alias name. This is a legacy parameter and is no longer used. - AliasName *string `json:"aliasName,omitempty"` - // RuleState - The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: 'DataMaskingRuleStateDisabled', 'DataMaskingRuleStateEnabled' - RuleState DataMaskingRuleState `json:"ruleState,omitempty"` - // SchemaName - The schema name on which the data masking rule is applied. - SchemaName *string `json:"schemaName,omitempty"` - // TableName - The table name on which the data masking rule is applied. - TableName *string `json:"tableName,omitempty"` - // ColumnName - The column name on which the data masking rule is applied. - ColumnName *string `json:"columnName,omitempty"` - // MaskingFunction - The masking function that is used for the data masking rule. Possible values include: 'DataMaskingFunctionDefault', 'DataMaskingFunctionCCN', 'DataMaskingFunctionEmail', 'DataMaskingFunctionNumber', 'DataMaskingFunctionSSN', 'DataMaskingFunctionText' - MaskingFunction DataMaskingFunction `json:"maskingFunction,omitempty"` - // NumberFrom - The numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. - NumberFrom *string `json:"numberFrom,omitempty"` - // NumberTo - The numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. - NumberTo *string `json:"numberTo,omitempty"` - // PrefixSize - If maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, this parameter will be ignored. - PrefixSize *string `json:"prefixSize,omitempty"` - // SuffixSize - If maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this parameter will be ignored. - SuffixSize *string `json:"suffixSize,omitempty"` - // ReplacementString - If maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. - ReplacementString *string `json:"replacementString,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataMaskingRuleProperties. -func (dmrp DataMaskingRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmrp.AliasName != nil { - objectMap["aliasName"] = dmrp.AliasName - } - if dmrp.RuleState != "" { - objectMap["ruleState"] = dmrp.RuleState - } - if dmrp.SchemaName != nil { - objectMap["schemaName"] = dmrp.SchemaName - } - if dmrp.TableName != nil { - objectMap["tableName"] = dmrp.TableName - } - if dmrp.ColumnName != nil { - objectMap["columnName"] = dmrp.ColumnName - } - if dmrp.MaskingFunction != "" { - objectMap["maskingFunction"] = dmrp.MaskingFunction - } - if dmrp.NumberFrom != nil { - objectMap["numberFrom"] = dmrp.NumberFrom - } - if dmrp.NumberTo != nil { - objectMap["numberTo"] = dmrp.NumberTo - } - if dmrp.PrefixSize != nil { - objectMap["prefixSize"] = dmrp.PrefixSize - } - if dmrp.SuffixSize != nil { - objectMap["suffixSize"] = dmrp.SuffixSize - } - if dmrp.ReplacementString != nil { - objectMap["replacementString"] = dmrp.ReplacementString - } - return json.Marshal(objectMap) -} - -// EditionCapability the edition capability. -type EditionCapability struct { - // Name - READ-ONLY; The database edition name. - Name *string `json:"name,omitempty"` - // SupportedServiceLevelObjectives - READ-ONLY; The list of supported service objectives for the edition. - SupportedServiceLevelObjectives *[]ServiceLevelObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for EditionCapability. -func (ec EditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ec.Reason != nil { - objectMap["reason"] = ec.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPool represents a database elastic pool. -type ElasticPool struct { - autorest.Response `json:"-"` - // ElasticPoolProperties - The properties representing the resource. - *ElasticPoolProperties `json:"properties,omitempty"` - // Kind - READ-ONLY; Kind of elastic pool. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,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"` -} - -// MarshalJSON is the custom marshaler for ElasticPool. -func (ep ElasticPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.ElasticPoolProperties != nil { - objectMap["properties"] = ep.ElasticPoolProperties - } - if ep.Location != nil { - objectMap["location"] = ep.Location - } - if ep.Tags != nil { - objectMap["tags"] = ep.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPool struct. -func (ep *ElasticPool) 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 elasticPoolProperties ElasticPoolProperties - err = json.Unmarshal(*v, &elasticPoolProperties) - if err != nil { - return err - } - ep.ElasticPoolProperties = &elasticPoolProperties - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ep.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ep.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ep.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolActivity represents the activity on an elastic pool. -type ElasticPoolActivity struct { - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ElasticPoolActivityProperties - The properties representing the resource. - *ElasticPoolActivityProperties `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"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolActivity. -func (epa ElasticPoolActivity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epa.Location != nil { - objectMap["location"] = epa.Location - } - if epa.ElasticPoolActivityProperties != nil { - objectMap["properties"] = epa.ElasticPoolActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolActivity struct. -func (epa *ElasticPoolActivity) 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 - } - epa.Location = &location - } - case "properties": - if v != nil { - var elasticPoolActivityProperties ElasticPoolActivityProperties - err = json.Unmarshal(*v, &elasticPoolActivityProperties) - if err != nil { - return err - } - epa.ElasticPoolActivityProperties = &elasticPoolActivityProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - epa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - epa.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolActivityListResult represents the response to a list elastic pool activity request. -type ElasticPoolActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of elastic pool activities. - Value *[]ElasticPoolActivity `json:"value,omitempty"` -} - -// ElasticPoolActivityProperties represents the properties of an elastic pool. -type ElasticPoolActivityProperties struct { - // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // ErrorCode - READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorMessage - READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty"` - // ErrorSeverity - READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // Operation - READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty"` - // OperationID - READ-ONLY; The unique operation ID. - OperationID *uuid.UUID `json:"operationId,omitempty"` - // PercentComplete - READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // RequestedDatabaseDtuMax - READ-ONLY; The requested max DTU per database if available. - RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` - // RequestedDatabaseDtuMin - READ-ONLY; The requested min DTU per database if available. - RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` - // RequestedDtu - READ-ONLY; The requested DTU for the pool if available. - RequestedDtu *int32 `json:"requestedDtu,omitempty"` - // RequestedElasticPoolName - READ-ONLY; The requested name for the elastic pool if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - // RequestedStorageLimitInGB - READ-ONLY; The requested storage limit for the pool in GB if available. - RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` - // ElasticPoolName - READ-ONLY; The name of the elastic pool. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // ServerName - READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The time the operation started (ISO8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty"` - // RequestedStorageLimitInMB - READ-ONLY; The requested storage limit in MB. - RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` - // RequestedDatabaseDtuGuarantee - READ-ONLY; The requested per database DTU guarantee. - RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` - // RequestedDatabaseDtuCap - READ-ONLY; The requested per database DTU cap. - RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` - // RequestedDtuGuarantee - READ-ONLY; The requested DTU guarantee. - RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolActivityProperties. -func (epap ElasticPoolActivityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolDatabaseActivity represents the activity on an elastic pool. -type ElasticPoolDatabaseActivity struct { - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ElasticPoolDatabaseActivityProperties - The properties representing the resource. - *ElasticPoolDatabaseActivityProperties `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"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivity. -func (epda ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epda.Location != nil { - objectMap["location"] = epda.Location - } - if epda.ElasticPoolDatabaseActivityProperties != nil { - objectMap["properties"] = epda.ElasticPoolDatabaseActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolDatabaseActivity struct. -func (epda *ElasticPoolDatabaseActivity) 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 - } - epda.Location = &location - } - case "properties": - if v != nil { - var elasticPoolDatabaseActivityProperties ElasticPoolDatabaseActivityProperties - err = json.Unmarshal(*v, &elasticPoolDatabaseActivityProperties) - if err != nil { - return err - } - epda.ElasticPoolDatabaseActivityProperties = &elasticPoolDatabaseActivityProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epda.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - epda.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - epda.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolDatabaseActivityListResult represents the response to a list elastic pool database activity -// request. -type ElasticPoolDatabaseActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of elastic pool database activities. - Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` -} - -// ElasticPoolDatabaseActivityProperties represents the properties of an elastic pool database activity. -type ElasticPoolDatabaseActivityProperties struct { - // DatabaseName - READ-ONLY; The database name. - DatabaseName *string `json:"databaseName,omitempty"` - // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // ErrorCode - READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorMessage - READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty"` - // ErrorSeverity - READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // Operation - READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty"` - // OperationID - READ-ONLY; The unique operation ID. - OperationID *uuid.UUID `json:"operationId,omitempty"` - // PercentComplete - READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // RequestedElasticPoolName - READ-ONLY; The name for the elastic pool the database is moving into if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - // CurrentElasticPoolName - READ-ONLY; The name of the current elastic pool the database is in if available. - CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` - // CurrentServiceObjective - READ-ONLY; The name of the current service objective if available. - CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"` - // RequestedServiceObjective - READ-ONLY; The name of the requested service objective if available. - RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"` - // ServerName - READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The time the operation started (ISO8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivityProperties. -func (epdap ElasticPoolDatabaseActivityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolDtuCapability the Elastic Pool DTU capability. -type ElasticPoolDtuCapability struct { - // Limit - READ-ONLY; The DTU limit for the pool. - Limit *int32 `json:"limit,omitempty"` - // MaxDatabaseCount - READ-ONLY; The maximum number of databases supported. - MaxDatabaseCount *int32 `json:"maxDatabaseCount,omitempty"` - // IncludedMaxSize - READ-ONLY; The included (free) max size for this DTU. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // SupportedMaxSizes - READ-ONLY; The list of supported max sizes. - SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` - // SupportedPerDatabaseMaxSizes - READ-ONLY; The list of supported per database max sizes. - SupportedPerDatabaseMaxSizes *[]MaxSizeCapability `json:"supportedPerDatabaseMaxSizes,omitempty"` - // SupportedPerDatabaseMaxDtus - READ-ONLY; The list of supported per database max DTUs. - SupportedPerDatabaseMaxDtus *[]ElasticPoolPerDatabaseMaxDtuCapability `json:"supportedPerDatabaseMaxDtus,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolDtuCapability. -func (epdc ElasticPoolDtuCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epdc.Reason != nil { - objectMap["reason"] = epdc.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolEditionCapability the elastic pool edition capability. -type ElasticPoolEditionCapability struct { - // Name - READ-ONLY; The elastic pool edition name. - Name *string `json:"name,omitempty"` - // SupportedElasticPoolDtus - READ-ONLY; The list of supported elastic pool DTU levels for the edition. - SupportedElasticPoolDtus *[]ElasticPoolDtuCapability `json:"supportedElasticPoolDtus,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolEditionCapability. -func (epec ElasticPoolEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epec.Reason != nil { - objectMap["reason"] = epec.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolListResult represents the response to a list elastic pool request. -type ElasticPoolListResult struct { - autorest.Response `json:"-"` - // Value - The list of elastic pools hosted in the server. - Value *[]ElasticPool `json:"value,omitempty"` -} - -// ElasticPoolPerDatabaseMaxDtuCapability the max per-database DTU capability. -type ElasticPoolPerDatabaseMaxDtuCapability struct { - // Limit - READ-ONLY; The maximum DTUs per database. - Limit *int32 `json:"limit,omitempty"` - // SupportedPerDatabaseMinDtus - READ-ONLY; The list of supported min database DTUs. - SupportedPerDatabaseMinDtus *[]ElasticPoolPerDatabaseMinDtuCapability `json:"supportedPerDatabaseMinDtus,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMaxDtuCapability. -func (eppdmdc ElasticPoolPerDatabaseMaxDtuCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eppdmdc.Reason != nil { - objectMap["reason"] = eppdmdc.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolPerDatabaseMinDtuCapability the minimum per-database DTU capability. -type ElasticPoolPerDatabaseMinDtuCapability struct { - // Limit - READ-ONLY; The minimum DTUs per database. - Limit *int32 `json:"limit,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMinDtuCapability. -func (eppdmdc ElasticPoolPerDatabaseMinDtuCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eppdmdc.Reason != nil { - objectMap["reason"] = eppdmdc.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolProperties represents the properties of an elastic pool. -type ElasticPoolProperties struct { - // CreationDate - READ-ONLY; The creation date of the elastic pool (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // State - READ-ONLY; The state of the elastic pool. Possible values include: 'ElasticPoolStateCreating', 'ElasticPoolStateReady', 'ElasticPoolStateDisabled' - State ElasticPoolState `json:"state,omitempty"` - // Edition - The edition of the elastic pool. Possible values include: 'ElasticPoolEditionBasic', 'ElasticPoolEditionStandard', 'ElasticPoolEditionPremium', 'ElasticPoolEditionGeneralPurpose', 'ElasticPoolEditionBusinessCritical' - Edition ElasticPoolEdition `json:"edition,omitempty"` - // Dtu - The total shared DTU for the database elastic pool. - Dtu *int32 `json:"dtu,omitempty"` - // DatabaseDtuMax - The maximum DTU any one database can consume. - DatabaseDtuMax *int32 `json:"databaseDtuMax,omitempty"` - // DatabaseDtuMin - The minimum DTU all databases are guaranteed. - DatabaseDtuMin *int32 `json:"databaseDtuMin,omitempty"` - // StorageMB - Gets storage limit for the database elastic pool in MB. - StorageMB *int32 `json:"storageMB,omitempty"` - // ZoneRedundant - Whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolProperties. -func (epp ElasticPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epp.Edition != "" { - objectMap["edition"] = epp.Edition - } - if epp.Dtu != nil { - objectMap["dtu"] = epp.Dtu - } - if epp.DatabaseDtuMax != nil { - objectMap["databaseDtuMax"] = epp.DatabaseDtuMax - } - if epp.DatabaseDtuMin != nil { - objectMap["databaseDtuMin"] = epp.DatabaseDtuMin - } - if epp.StorageMB != nil { - objectMap["storageMB"] = epp.StorageMB - } - if epp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = epp.ZoneRedundant - } - return json.Marshal(objectMap) -} - -// ElasticPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ElasticPoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (ElasticPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsCreateOrUpdateFuture) 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 ElasticPoolsCreateOrUpdateFuture.Result. -func (future *ElasticPoolsCreateOrUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateOrUpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ElasticPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (ElasticPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsUpdateFuture) 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 ElasticPoolsUpdateFuture.Result. -func (future *ElasticPoolsUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.UpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ElasticPoolUpdate represents an elastic pool update. -type ElasticPoolUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ElasticPoolProperties - The properties representing the resource. - *ElasticPoolProperties `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"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolUpdate. -func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epu.Tags != nil { - objectMap["tags"] = epu.Tags - } - if epu.ElasticPoolProperties != nil { - objectMap["properties"] = epu.ElasticPoolProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolUpdate struct. -func (epu *ElasticPoolUpdate) 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 - } - epu.Tags = tags - } - case "properties": - if v != nil { - var elasticPoolProperties ElasticPoolProperties - err = json.Unmarshal(*v, &elasticPoolProperties) - if err != nil { - return err - } - epu.ElasticPoolProperties = &elasticPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - epu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - epu.Type = &typeVar - } - } - } - - return nil -} - -// EncryptionProtector the server encryption protector. -type EncryptionProtector struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // EncryptionProtectorProperties - Resource properties. - *EncryptionProtectorProperties `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"` -} - -// MarshalJSON is the custom marshaler for EncryptionProtector. -func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.EncryptionProtectorProperties != nil { - objectMap["properties"] = ep.EncryptionProtectorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EncryptionProtector struct. -func (ep *EncryptionProtector) 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 - } - ep.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ep.Location = &location - } - case "properties": - if v != nil { - var encryptionProtectorProperties EncryptionProtectorProperties - err = json.Unmarshal(*v, &encryptionProtectorProperties) - if err != nil { - return err - } - ep.EncryptionProtectorProperties = &encryptionProtectorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - } - } - - return nil -} - -// EncryptionProtectorListResult a list of server encryption protectors. -type EncryptionProtectorListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]EncryptionProtector `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionProtectorListResult. -func (eplr EncryptionProtectorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EncryptionProtectorListResultIterator provides access to a complete listing of EncryptionProtector -// values. -type EncryptionProtectorListResultIterator struct { - i int - page EncryptionProtectorListResultPage -} - -// 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 *EncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultIterator.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 *EncryptionProtectorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EncryptionProtectorListResultIterator) 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 EncryptionProtectorListResultIterator) Response() EncryptionProtectorListResult { - 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 EncryptionProtectorListResultIterator) Value() EncryptionProtector { - if !iter.page.NotDone() { - return EncryptionProtector{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EncryptionProtectorListResultIterator type. -func NewEncryptionProtectorListResultIterator(page EncryptionProtectorListResultPage) EncryptionProtectorListResultIterator { - return EncryptionProtectorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eplr EncryptionProtectorListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eplr EncryptionProtectorListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 -} - -// encryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eplr EncryptionProtectorListResult) encryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) -} - -// EncryptionProtectorListResultPage contains a page of EncryptionProtector values. -type EncryptionProtectorListResultPage struct { - fn func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error) - eplr EncryptionProtectorListResult -} - -// 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 *EncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultPage.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.eplr) - if err != nil { - return err - } - page.eplr = 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 *EncryptionProtectorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EncryptionProtectorListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EncryptionProtectorListResultPage) Response() EncryptionProtectorListResult { - return page.eplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EncryptionProtectorListResultPage) Values() []EncryptionProtector { - if page.eplr.IsEmpty() { - return nil - } - return *page.eplr.Value -} - -// Creates a new instance of the EncryptionProtectorListResultPage type. -func NewEncryptionProtectorListResultPage(cur EncryptionProtectorListResult, getNextPage func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error)) EncryptionProtectorListResultPage { - return EncryptionProtectorListResultPage{ - fn: getNextPage, - eplr: cur, - } -} - -// EncryptionProtectorProperties properties for an encryption protector execution. -type EncryptionProtectorProperties struct { - // Subregion - READ-ONLY; Subregion of the encryption protector. - Subregion *string `json:"subregion,omitempty"` - // ServerKeyName - The name of the server key. - ServerKeyName *string `json:"serverKeyName,omitempty"` - // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - READ-ONLY; The URI of the server key. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionProtectorProperties. -func (epp EncryptionProtectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epp.ServerKeyName != nil { - objectMap["serverKeyName"] = epp.ServerKeyName - } - if epp.ServerKeyType != "" { - objectMap["serverKeyType"] = epp.ServerKeyType - } - return json.Marshal(objectMap) -} - -// EncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EncryptionProtectorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EncryptionProtectorsClient) (EncryptionProtector, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EncryptionProtectorsCreateOrUpdateFuture) 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 EncryptionProtectorsCreateOrUpdateFuture.Result. -func (future *EncryptionProtectorsCreateOrUpdateFuture) result(client EncryptionProtectorsClient) (ep EncryptionProtector, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateOrUpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// EncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EncryptionProtectorsRevalidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EncryptionProtectorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EncryptionProtectorsRevalidateFuture) 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 EncryptionProtectorsRevalidateFuture.Result. -func (future *EncryptionProtectorsRevalidateFuture) result(client EncryptionProtectorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsRevalidateFuture") - return - } - ar.Response = future.Response() - return -} - -// ExportRequest export database parameters. -type ExportRequest struct { - // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - The storage uri to use. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - The name of the SQL administrator. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the SQL administrator. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` -} - -// FailoverGroup a failover group. -type FailoverGroup struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // FailoverGroupProperties - Resource properties. - *FailoverGroupProperties `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"` -} - -// MarshalJSON is the custom marshaler for FailoverGroup. -func (fg FailoverGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fg.Tags != nil { - objectMap["tags"] = fg.Tags - } - if fg.FailoverGroupProperties != nil { - objectMap["properties"] = fg.FailoverGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FailoverGroup struct. -func (fg *FailoverGroup) 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 - } - fg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - fg.Tags = tags - } - case "properties": - if v != nil { - var failoverGroupProperties FailoverGroupProperties - err = json.Unmarshal(*v, &failoverGroupProperties) - if err != nil { - return err - } - fg.FailoverGroupProperties = &failoverGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fg.Type = &typeVar - } - } - } - - return nil -} - -// FailoverGroupListResult a list of failover groups. -type FailoverGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]FailoverGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverGroupListResult. -func (fglr FailoverGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverGroupListResultIterator provides access to a complete listing of FailoverGroup values. -type FailoverGroupListResultIterator struct { - i int - page FailoverGroupListResultPage -} - -// 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 *FailoverGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultIterator.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 *FailoverGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FailoverGroupListResultIterator) 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 FailoverGroupListResultIterator) Response() FailoverGroupListResult { - 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 FailoverGroupListResultIterator) Value() FailoverGroup { - if !iter.page.NotDone() { - return FailoverGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FailoverGroupListResultIterator type. -func NewFailoverGroupListResultIterator(page FailoverGroupListResultPage) FailoverGroupListResultIterator { - return FailoverGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (fglr FailoverGroupListResult) IsEmpty() bool { - return fglr.Value == nil || len(*fglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (fglr FailoverGroupListResult) hasNextLink() bool { - return fglr.NextLink != nil && len(*fglr.NextLink) != 0 -} - -// failoverGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (fglr FailoverGroupListResult) failoverGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !fglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(fglr.NextLink))) -} - -// FailoverGroupListResultPage contains a page of FailoverGroup values. -type FailoverGroupListResultPage struct { - fn func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error) - fglr FailoverGroupListResult -} - -// 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 *FailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultPage.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.fglr) - if err != nil { - return err - } - page.fglr = 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 *FailoverGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FailoverGroupListResultPage) NotDone() bool { - return !page.fglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FailoverGroupListResultPage) Response() FailoverGroupListResult { - return page.fglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FailoverGroupListResultPage) Values() []FailoverGroup { - if page.fglr.IsEmpty() { - return nil - } - return *page.fglr.Value -} - -// Creates a new instance of the FailoverGroupListResultPage type. -func NewFailoverGroupListResultPage(cur FailoverGroupListResult, getNextPage func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error)) FailoverGroupListResultPage { - return FailoverGroupListResultPage{ - fn: getNextPage, - fglr: cur, - } -} - -// FailoverGroupProperties properties of a failover group. -type FailoverGroupProperties struct { - // ReadWriteEndpoint - Read-write endpoint of the failover group instance. - ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` - // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` - // ReplicationRole - READ-ONLY; Local replication role of the failover group instance. Possible values include: 'Primary', 'Secondary' - ReplicationRole FailoverGroupReplicationRole `json:"replicationRole,omitempty"` - // ReplicationState - READ-ONLY; Replication state of the failover group instance. - ReplicationState *string `json:"replicationState,omitempty"` - // PartnerServers - List of partner server information for the failover group. - PartnerServers *[]PartnerInfo `json:"partnerServers,omitempty"` - // Databases - List of databases in the failover group. - Databases *[]string `json:"databases,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverGroupProperties. -func (fgp FailoverGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fgp.ReadWriteEndpoint != nil { - objectMap["readWriteEndpoint"] = fgp.ReadWriteEndpoint - } - if fgp.ReadOnlyEndpoint != nil { - objectMap["readOnlyEndpoint"] = fgp.ReadOnlyEndpoint - } - if fgp.PartnerServers != nil { - objectMap["partnerServers"] = fgp.PartnerServers - } - if fgp.Databases != nil { - objectMap["databases"] = fgp.Databases - } - return json.Marshal(objectMap) -} - -// FailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. -type FailoverGroupReadOnlyEndpoint struct { - // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' - FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` -} - -// FailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. -type FailoverGroupReadWriteEndpoint struct { - // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic' - FailoverPolicy ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` - // FailoverWithDataLossGracePeriodMinutes - Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. - FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` -} - -// FailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FailoverGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsCreateOrUpdateFuture) 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 FailoverGroupsCreateOrUpdateFuture.Result. -func (future *FailoverGroupsCreateOrUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.CreateOrUpdateResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FailoverGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsDeleteFuture) 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 FailoverGroupsDeleteFuture.Result. -func (future *FailoverGroupsDeleteFuture) result(client FailoverGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// FailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FailoverGroupsFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsFailoverFuture) 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 FailoverGroupsFailoverFuture.Result. -func (future *FailoverGroupsFailoverFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsFailoverFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.FailoverResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type FailoverGroupsForceFailoverAllowDataLossFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsForceFailoverAllowDataLossFuture) 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 FailoverGroupsForceFailoverAllowDataLossFuture.Result. -func (future *FailoverGroupsForceFailoverAllowDataLossFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsForceFailoverAllowDataLossFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.ForceFailoverAllowDataLossResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FailoverGroupsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsUpdateFuture) 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 FailoverGroupsUpdateFuture.Result. -func (future *FailoverGroupsUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.UpdateResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupUpdate a failover group update request. -type FailoverGroupUpdate struct { - // FailoverGroupUpdateProperties - Resource properties. - *FailoverGroupUpdateProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for FailoverGroupUpdate. -func (fgu FailoverGroupUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fgu.FailoverGroupUpdateProperties != nil { - objectMap["properties"] = fgu.FailoverGroupUpdateProperties - } - if fgu.Tags != nil { - objectMap["tags"] = fgu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FailoverGroupUpdate struct. -func (fgu *FailoverGroupUpdate) 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 failoverGroupUpdateProperties FailoverGroupUpdateProperties - err = json.Unmarshal(*v, &failoverGroupUpdateProperties) - if err != nil { - return err - } - fgu.FailoverGroupUpdateProperties = &failoverGroupUpdateProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - fgu.Tags = tags - } - } - } - - return nil -} - -// FailoverGroupUpdateProperties properties of a failover group update. -type FailoverGroupUpdateProperties struct { - // ReadWriteEndpoint - Read-write endpoint of the failover group instance. - ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` - // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` - // Databases - List of databases in the failover group. - Databases *[]string `json:"databases,omitempty"` -} - -// FirewallRule represents a server firewall rule. -type FirewallRule struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of server that contains this firewall rule. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Location of the server that contains this firewall rule. - Location *string `json:"location,omitempty"` - // FirewallRuleProperties - The properties representing the resource. - *FirewallRuleProperties `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"` -} - -// MarshalJSON is the custom marshaler for FirewallRule. -func (fr FirewallRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fr.FirewallRuleProperties != nil { - objectMap["properties"] = fr.FirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. -func (fr *FirewallRule) 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 - } - fr.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - fr.Location = &location - } - case "properties": - if v != nil { - var firewallRuleProperties FirewallRuleProperties - err = json.Unmarshal(*v, &firewallRuleProperties) - if err != nil { - return err - } - fr.FirewallRuleProperties = &firewallRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fr.Type = &typeVar - } - } - } - - return nil -} - -// FirewallRuleListResult represents the response to a List Firewall Rules request. -type FirewallRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of server firewall rules. - Value *[]FirewallRule `json:"value,omitempty"` -} - -// FirewallRuleProperties represents the properties of a server firewall rule. -type FirewallRuleProperties struct { - // StartIPAddress - The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. - StartIPAddress *string `json:"startIpAddress,omitempty"` - // EndIPAddress - The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// GeoBackupPolicy a database geo backup policy. -type GeoBackupPolicy struct { - autorest.Response `json:"-"` - // GeoBackupPolicyProperties - The properties of the geo backup policy. - *GeoBackupPolicyProperties `json:"properties,omitempty"` - // Kind - READ-ONLY; Kind of geo backup policy. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Backup policy location. - Location *string `json:"location,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"` -} - -// MarshalJSON is the custom marshaler for GeoBackupPolicy. -func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gbp.GeoBackupPolicyProperties != nil { - objectMap["properties"] = gbp.GeoBackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GeoBackupPolicy struct. -func (gbp *GeoBackupPolicy) 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 geoBackupPolicyProperties GeoBackupPolicyProperties - err = json.Unmarshal(*v, &geoBackupPolicyProperties) - if err != nil { - return err - } - gbp.GeoBackupPolicyProperties = &geoBackupPolicyProperties - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - gbp.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gbp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gbp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gbp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gbp.Type = &typeVar - } - } - } - - return nil -} - -// GeoBackupPolicyListResult the response to a list geo backup policies request. -type GeoBackupPolicyListResult struct { - autorest.Response `json:"-"` - // Value - The list of geo backup policies. - Value *[]GeoBackupPolicy `json:"value,omitempty"` -} - -// GeoBackupPolicyProperties the properties of the geo backup policy. -type GeoBackupPolicyProperties struct { - // State - The state of the geo backup policy. Possible values include: 'GeoBackupPolicyStateDisabled', 'GeoBackupPolicyStateEnabled' - State GeoBackupPolicyState `json:"state,omitempty"` - // StorageType - READ-ONLY; The storage type of the geo backup policy. - StorageType *string `json:"storageType,omitempty"` -} - -// MarshalJSON is the custom marshaler for GeoBackupPolicyProperties. -func (gbpp GeoBackupPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gbpp.State != "" { - objectMap["state"] = gbpp.State - } - return json.Marshal(objectMap) -} - -// ImportExportResponse response for Import/Export Get operation. -type ImportExportResponse struct { - autorest.Response `json:"-"` - // ImportExportResponseProperties - The import/export operation properties. - *ImportExportResponseProperties `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"` -} - -// MarshalJSON is the custom marshaler for ImportExportResponse. -func (ier ImportExportResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ier.ImportExportResponseProperties != nil { - objectMap["properties"] = ier.ImportExportResponseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ImportExportResponse struct. -func (ier *ImportExportResponse) 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 importExportResponseProperties ImportExportResponseProperties - err = json.Unmarshal(*v, &importExportResponseProperties) - if err != nil { - return err - } - ier.ImportExportResponseProperties = &importExportResponseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ier.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ier.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ier.Type = &typeVar - } - } - } - - return nil -} - -// ImportExportResponseProperties response for Import/Export Status operation. -type ImportExportResponseProperties struct { - // RequestType - READ-ONLY; The request type of the operation. - RequestType *string `json:"requestType,omitempty"` - // RequestID - READ-ONLY; The request type of the operation. - RequestID *uuid.UUID `json:"requestId,omitempty"` - // ServerName - READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; The name of the database. - DatabaseName *string `json:"databaseName,omitempty"` - // Status - READ-ONLY; The status message returned from the server. - Status *string `json:"status,omitempty"` - // LastModifiedTime - READ-ONLY; The operation status last modified time. - LastModifiedTime *string `json:"lastModifiedTime,omitempty"` - // QueuedTime - READ-ONLY; The operation queued time. - QueuedTime *string `json:"queuedTime,omitempty"` - // BlobURI - READ-ONLY; The blob uri. - BlobURI *string `json:"blobUri,omitempty"` - // ErrorMessage - READ-ONLY; The error message returned from the server. - ErrorMessage *string `json:"errorMessage,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImportExportResponseProperties. -func (ierp ImportExportResponseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ImportExtensionProperties represents the properties for an import operation -type ImportExtensionProperties struct { - // OperationMode - The type of import operation being performed. This is always Import. - OperationMode *string `json:"operationMode,omitempty"` - // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - The storage uri to use. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - The name of the SQL administrator. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the SQL administrator. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` -} - -// ImportExtensionRequest import database parameters. -type ImportExtensionRequest struct { - // Name - The name of the extension. - Name *string `json:"name,omitempty"` - // Type - The type of the extension. - Type *string `json:"type,omitempty"` - // ImportExtensionProperties - Represents the properties of the resource. - *ImportExtensionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImportExtensionRequest. -func (ier ImportExtensionRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ier.Name != nil { - objectMap["name"] = ier.Name - } - if ier.Type != nil { - objectMap["type"] = ier.Type - } - if ier.ImportExtensionProperties != nil { - objectMap["properties"] = ier.ImportExtensionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ImportExtensionRequest struct. -func (ier *ImportExtensionRequest) 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 - } - ier.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ier.Type = &typeVar - } - case "properties": - if v != nil { - var importExtensionProperties ImportExtensionProperties - err = json.Unmarshal(*v, &importExtensionProperties) - if err != nil { - return err - } - ier.ImportExtensionProperties = &importExtensionProperties - } - } - } - - return nil -} - -// ImportRequest import database parameters. -type ImportRequest struct { - // DatabaseName - The name of the database to import. - DatabaseName *string `json:"databaseName,omitempty"` - // Edition - The edition for the database being created. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: - // - // ```azurecli - // az sql db list-editions -l -o table - // ```` - // - // ```powershell - // Get-AzSqlServerServiceObjective -Location - // ```` - // . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' - Edition DatabaseEdition `json:"edition,omitempty"` - // ServiceObjectiveName - The name of the service objective to assign to the database. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' - ServiceObjectiveName ServiceObjectiveName `json:"serviceObjectiveName,omitempty"` - // MaxSizeBytes - The maximum size for the newly imported database. - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - The storage uri to use. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - The name of the SQL administrator. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the SQL administrator. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` -} - -// LocationCapabilities the location capability. -type LocationCapabilities struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; The location name. - Name *string `json:"name,omitempty"` - // SupportedServerVersions - READ-ONLY; The list of supported server versions. - SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationCapabilities. -func (lc LocationCapabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lc.Reason != nil { - objectMap["reason"] = lc.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstance an Azure SQL managed instance. -type ManagedInstance struct { - autorest.Response `json:"-"` - // Identity - The Azure Active Directory identity of the managed instance. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Sku - Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5 - Sku *Sku `json:"sku,omitempty"` - // ManagedInstanceProperties - Resource properties. - *ManagedInstanceProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstance. -func (mi ManagedInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mi.Identity != nil { - objectMap["identity"] = mi.Identity - } - if mi.Sku != nil { - objectMap["sku"] = mi.Sku - } - if mi.ManagedInstanceProperties != nil { - objectMap["properties"] = mi.ManagedInstanceProperties - } - if mi.Location != nil { - objectMap["location"] = mi.Location - } - if mi.Tags != nil { - objectMap["tags"] = mi.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstance struct. -func (mi *ManagedInstance) 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 "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mi.Identity = &identity - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - mi.Sku = &sku - } - case "properties": - if v != nil { - var managedInstanceProperties ManagedInstanceProperties - err = json.Unmarshal(*v, &managedInstanceProperties) - if err != nil { - return err - } - mi.ManagedInstanceProperties = &managedInstanceProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mi.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mi.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mi.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceListResult a list of managed instances. -type ManagedInstanceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstance `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceListResult. -func (milr ManagedInstanceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceListResultIterator provides access to a complete listing of ManagedInstance values. -type ManagedInstanceListResultIterator struct { - i int - page ManagedInstanceListResultPage -} - -// 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 *ManagedInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultIterator.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 *ManagedInstanceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceListResultIterator) 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 ManagedInstanceListResultIterator) Response() ManagedInstanceListResult { - 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 ManagedInstanceListResultIterator) Value() ManagedInstance { - if !iter.page.NotDone() { - return ManagedInstance{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceListResultIterator type. -func NewManagedInstanceListResultIterator(page ManagedInstanceListResultPage) ManagedInstanceListResultIterator { - return ManagedInstanceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (milr ManagedInstanceListResult) IsEmpty() bool { - return milr.Value == nil || len(*milr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (milr ManagedInstanceListResult) hasNextLink() bool { - return milr.NextLink != nil && len(*milr.NextLink) != 0 -} - -// managedInstanceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (milr ManagedInstanceListResult) managedInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !milr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(milr.NextLink))) -} - -// ManagedInstanceListResultPage contains a page of ManagedInstance values. -type ManagedInstanceListResultPage struct { - fn func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error) - milr ManagedInstanceListResult -} - -// 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 *ManagedInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultPage.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.milr) - if err != nil { - return err - } - page.milr = 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 *ManagedInstanceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceListResultPage) NotDone() bool { - return !page.milr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceListResultPage) Response() ManagedInstanceListResult { - return page.milr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceListResultPage) Values() []ManagedInstance { - if page.milr.IsEmpty() { - return nil - } - return *page.milr.Value -} - -// Creates a new instance of the ManagedInstanceListResultPage type. -func NewManagedInstanceListResultPage(cur ManagedInstanceListResult, getNextPage func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error)) ManagedInstanceListResultPage { - return ManagedInstanceListResultPage{ - fn: getNextPage, - milr: cur, - } -} - -// ManagedInstanceProperties the properties of a managed instance. -type ManagedInstanceProperties struct { - // ManagedInstanceCreateMode - Specifies the mode of database creation. - // - // Default: Regular instance creation. - // - // Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'ManagedServerCreateModeDefault', 'ManagedServerCreateModePointInTimeRestore' - ManagedInstanceCreateMode ManagedServerCreateMode `json:"managedInstanceCreateMode,omitempty"` - // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the managed instance. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - // AdministratorLogin - Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The administrator login password (required for managed instance creation). - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // SubnetID - Subnet resource ID for the managed instance. - SubnetID *string `json:"subnetId,omitempty"` - // State - READ-ONLY; The state of the managed instance. - State *string `json:"state,omitempty"` - // LicenseType - The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice' - LicenseType ManagedInstanceLicenseType `json:"licenseType,omitempty"` - // VCores - The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. - VCores *int32 `json:"vCores,omitempty"` - // StorageSizeInGB - Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. - StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"` - // Collation - Collation of the managed instance. - Collation *string `json:"collation,omitempty"` - // DNSZone - READ-ONLY; The Dns Zone that the managed instance is in. - DNSZone *string `json:"dnsZone,omitempty"` - // DNSZonePartner - The resource id of another managed instance whose DNS zone this managed instance will share after creation. - DNSZonePartner *string `json:"dnsZonePartner,omitempty"` - // PublicDataEndpointEnabled - Whether or not the public data endpoint is enabled. - PublicDataEndpointEnabled *bool `json:"publicDataEndpointEnabled,omitempty"` - // SourceManagedInstanceID - The resource identifier of the source managed instance associated with create operation of this instance. - SourceManagedInstanceID *string `json:"sourceManagedInstanceId,omitempty"` - // RestorePointInTime - Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // ProxyOverride - Connection type used for connecting to the instance. Possible values include: 'ManagedInstanceProxyOverrideProxy', 'ManagedInstanceProxyOverrideRedirect', 'ManagedInstanceProxyOverrideDefault' - ProxyOverride ManagedInstanceProxyOverride `json:"proxyOverride,omitempty"` - // TimezoneID - Id of the timezone. Allowed values are timezones supported by Windows. - // Windows keeps details on supported timezones, including the id, in registry under - // KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. - // You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. - // List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. - // An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". - TimezoneID *string `json:"timezoneId,omitempty"` - // InstancePoolID - The Id of the instance pool this managed server belongs to. - InstancePoolID *string `json:"instancePoolId,omitempty"` - // MaintenanceConfigurationID - Specifies maintenance configuration id to apply to this managed instance. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` - // MinimalTLSVersion - Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' - MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceProperties. -func (mip ManagedInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mip.ManagedInstanceCreateMode != "" { - objectMap["managedInstanceCreateMode"] = mip.ManagedInstanceCreateMode - } - if mip.AdministratorLogin != nil { - objectMap["administratorLogin"] = mip.AdministratorLogin - } - if mip.AdministratorLoginPassword != nil { - objectMap["administratorLoginPassword"] = mip.AdministratorLoginPassword - } - if mip.SubnetID != nil { - objectMap["subnetId"] = mip.SubnetID - } - if mip.LicenseType != "" { - objectMap["licenseType"] = mip.LicenseType - } - if mip.VCores != nil { - objectMap["vCores"] = mip.VCores - } - if mip.StorageSizeInGB != nil { - objectMap["storageSizeInGB"] = mip.StorageSizeInGB - } - if mip.Collation != nil { - objectMap["collation"] = mip.Collation - } - if mip.DNSZonePartner != nil { - objectMap["dnsZonePartner"] = mip.DNSZonePartner - } - if mip.PublicDataEndpointEnabled != nil { - objectMap["publicDataEndpointEnabled"] = mip.PublicDataEndpointEnabled - } - if mip.SourceManagedInstanceID != nil { - objectMap["sourceManagedInstanceId"] = mip.SourceManagedInstanceID - } - if mip.RestorePointInTime != nil { - objectMap["restorePointInTime"] = mip.RestorePointInTime - } - if mip.ProxyOverride != "" { - objectMap["proxyOverride"] = mip.ProxyOverride - } - if mip.TimezoneID != nil { - objectMap["timezoneId"] = mip.TimezoneID - } - if mip.InstancePoolID != nil { - objectMap["instancePoolId"] = mip.InstancePoolID - } - if mip.MaintenanceConfigurationID != nil { - objectMap["maintenanceConfigurationId"] = mip.MaintenanceConfigurationID - } - if mip.MinimalTLSVersion != nil { - objectMap["minimalTlsVersion"] = mip.MinimalTLSVersion - } - return json.Marshal(objectMap) -} - -// ManagedInstancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstancesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (ManagedInstance, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesCreateOrUpdateFuture) 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 ManagedInstancesCreateOrUpdateFuture.Result. -func (future *ManagedInstancesCreateOrUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mi.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { - mi, err = client.CreateOrUpdateResponder(mi.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedInstancesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesDeleteFuture) 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 ManagedInstancesDeleteFuture.Result. -func (future *ManagedInstancesDeleteFuture) result(client ManagedInstancesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstancesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedInstancesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (ManagedInstance, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesUpdateFuture) 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 ManagedInstancesUpdateFuture.Result. -func (future *ManagedInstancesUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mi.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { - mi, err = client.UpdateResponder(mi.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceUpdate an update request for an Azure SQL Database managed instance. -type ManagedInstanceUpdate struct { - // Sku - Managed instance sku - Sku *Sku `json:"sku,omitempty"` - // ManagedInstanceProperties - Resource properties. - *ManagedInstanceProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceUpdate. -func (miu ManagedInstanceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miu.Sku != nil { - objectMap["sku"] = miu.Sku - } - if miu.ManagedInstanceProperties != nil { - objectMap["properties"] = miu.ManagedInstanceProperties - } - if miu.Tags != nil { - objectMap["tags"] = miu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceUpdate struct. -func (miu *ManagedInstanceUpdate) 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 - } - miu.Sku = &sku - } - case "properties": - if v != nil { - var managedInstanceProperties ManagedInstanceProperties - err = json.Unmarshal(*v, &managedInstanceProperties) - if err != nil { - return err - } - miu.ManagedInstanceProperties = &managedInstanceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - miu.Tags = tags - } - } - } - - return nil -} - -// MaxSizeCapability the maximum size capability. -type MaxSizeCapability struct { - // Limit - READ-ONLY; The maximum size limit (see 'unit' for the units). - Limit *int32 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' - Unit MaxSizeUnits `json:"unit,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for MaxSizeCapability. -func (msc MaxSizeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msc.Reason != nil { - objectMap["reason"] = msc.Reason - } - return json.Marshal(objectMap) -} - -// Metric database metrics. -type Metric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time step to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - READ-ONLY; The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for Metric. -func (mVar Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricAvailability a metric availability value. -type MetricAvailability struct { - // Retention - READ-ONLY; The length of retention for the database metric. - Retention *string `json:"retention,omitempty"` - // TimeGrain - READ-ONLY; The granularity of the database metric. - TimeGrain *string `json:"timeGrain,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAvailability. -func (ma MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinition a database metric definition. -type MetricDefinition struct { - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` - // ResourceURI - READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty"` - // Unit - READ-ONLY; The unit of the metric. Possible values include: 'UnitDefinitionTypeCount', 'UnitDefinitionTypeBytes', 'UnitDefinitionTypeSeconds', 'UnitDefinitionTypePercent', 'UnitDefinitionTypeCountPerSecond', 'UnitDefinitionTypeBytesPerSecond' - Unit UnitDefinitionType `json:"unit,omitempty"` - // MetricAvailabilities - READ-ONLY; The list of database metric availabilities for the metric. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinition. -func (md MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinitionListResult the response to a list database metric definitions request. -type MetricDefinitionListResult struct { - autorest.Response `json:"-"` - // Value - The list of metric definitions for the database. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricListResult the response to a list database metrics request. -type MetricListResult struct { - autorest.Response `json:"-"` - // Value - The list of metrics for the database. - Value *[]Metric `json:"value,omitempty"` -} - -// MetricName a database metric name. -type MetricName struct { - // Value - READ-ONLY; The name of the database metric. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The friendly name of the database metric. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricName. -func (mn MetricName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricValue represents database metrics. -type MetricValue struct { - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricValue. -func (mv MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Operation SQL REST API operation definition. -type Operation struct { - // Name - READ-ONLY; The name of the operation being performed on this particular object. - Name *string `json:"name,omitempty"` - // Display - READ-ONLY; The localized display information for this particular operation / action. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'OperationOriginUser', 'OperationOriginSystem' - Origin OperationOrigin `json:"origin,omitempty"` - // Properties - READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; The localized friendly form of the resource provider name. - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; The localized friendly form of the resource type related to this action/operation. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; The localized friendly name for the operation. - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; The localized friendly description for the operation. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationImpact the impact of an operation, both in absolute and relative terms. -type OperationImpact struct { - // Name - READ-ONLY; The name of the impact dimension. - Name *string `json:"name,omitempty"` - // Unit - READ-ONLY; The unit in which estimated impact to dimension is measured. - Unit *string `json:"unit,omitempty"` - // ChangeValueAbsolute - READ-ONLY; The absolute impact to dimension. - ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"` - // ChangeValueRelative - READ-ONLY; The relative impact to dimension (null if not applicable) - ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationImpact. -func (oi OperationImpact) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult result of the request to list SQL operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// 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, - } -} - -// PartnerInfo partner server information for the failover group. -type PartnerInfo struct { - // ID - Resource identifier of the partner server. - ID *string `json:"id,omitempty"` - // Location - READ-ONLY; Geo location of the partner server. - Location *string `json:"location,omitempty"` - // ReplicationRole - READ-ONLY; Replication role of the partner server. Possible values include: 'Primary', 'Secondary' - ReplicationRole FailoverGroupReplicationRole `json:"replicationRole,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerInfo. -func (pi PartnerInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pi.ID != nil { - objectMap["id"] = pi.ID - } - return json.Marshal(objectMap) -} - -// PerformanceLevelCapability the performance level capability. -type PerformanceLevelCapability struct { - // Value - READ-ONLY; Performance level value. - Value *int32 `json:"value,omitempty"` - // Unit - READ-ONLY; Unit type used to measure service objective performance level. Possible values include: 'DTU' - Unit PerformanceLevelUnit `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for PerformanceLevelCapability. -func (plc PerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProxyResource ARM proxy resource. -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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecommendedIndex represents a database recommended index. -type RecommendedIndex struct { - // RecommendedIndexProperties - READ-ONLY; The properties representing the resource. - *RecommendedIndexProperties `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"` -} - -// MarshalJSON is the custom marshaler for RecommendedIndex. -func (ri RecommendedIndex) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecommendedIndex struct. -func (ri *RecommendedIndex) 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 recommendedIndexProperties RecommendedIndexProperties - err = json.Unmarshal(*v, &recommendedIndexProperties) - if err != nil { - return err - } - ri.RecommendedIndexProperties = &recommendedIndexProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ri.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ri.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ri.Type = &typeVar - } - } - } - - return nil -} - -// RecommendedIndexProperties represents the properties of a database recommended index. -type RecommendedIndexProperties struct { - // Action - READ-ONLY; The proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. Possible values include: 'Create', 'Drop', 'Rebuild' - Action RecommendedIndexAction `json:"action,omitempty"` - // State - READ-ONLY; The current recommendation state. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success' - State RecommendedIndexState `json:"state,omitempty"` - // Created - READ-ONLY; The UTC datetime showing when this resource was created (ISO8601 format). - Created *date.Time `json:"created,omitempty"` - // LastModified - READ-ONLY; The UTC datetime of when was this resource last changed (ISO8601 format). - LastModified *date.Time `json:"lastModified,omitempty"` - // IndexType - READ-ONLY; The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTEREDCOLUMNSTORE' - IndexType RecommendedIndexType `json:"indexType,omitempty"` - // Schema - READ-ONLY; The schema where table to build index over resides - Schema *string `json:"schema,omitempty"` - // Table - READ-ONLY; The table on which to build index. - Table *string `json:"table,omitempty"` - // Columns - READ-ONLY; Columns over which to build index - Columns *[]string `json:"columns,omitempty"` - // IncludedColumns - READ-ONLY; The list of column names to be included in the index - IncludedColumns *[]string `json:"includedColumns,omitempty"` - // IndexScript - READ-ONLY; The full build index script - IndexScript *string `json:"indexScript,omitempty"` - // EstimatedImpact - READ-ONLY; The estimated impact of doing recommended index action. - EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"` - // ReportedImpact - READ-ONLY; The values reported after index action is complete. - ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecommendedIndexProperties. -func (rip RecommendedIndexProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableDatabase a recoverable database -type RecoverableDatabase struct { - autorest.Response `json:"-"` - // RecoverableDatabaseProperties - The properties of a recoverable database - *RecoverableDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for RecoverableDatabase. -func (rd RecoverableDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rd.RecoverableDatabaseProperties != nil { - objectMap["properties"] = rd.RecoverableDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecoverableDatabase struct. -func (rd *RecoverableDatabase) 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 recoverableDatabaseProperties RecoverableDatabaseProperties - err = json.Unmarshal(*v, &recoverableDatabaseProperties) - if err != nil { - return err - } - rd.RecoverableDatabaseProperties = &recoverableDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rd.Type = &typeVar - } - } - } - - return nil -} - -// RecoverableDatabaseListResult the response to a list recoverable databases request -type RecoverableDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - A list of recoverable databases - Value *[]RecoverableDatabase `json:"value,omitempty"` -} - -// RecoverableDatabaseProperties the properties of a recoverable database -type RecoverableDatabaseProperties struct { - // Edition - READ-ONLY; The edition of the database - Edition *string `json:"edition,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective name of the database - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // ElasticPoolName - READ-ONLY; The elastic pool name of the database - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // LastAvailableBackupDate - READ-ONLY; The last available backup date of the database (ISO8601 format) - LastAvailableBackupDate *date.Time `json:"lastAvailableBackupDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableDatabaseProperties. -func (rdp RecoverableDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReplicationLink represents a database replication link. -type ReplicationLink struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Location of the server that contains this firewall rule. - Location *string `json:"location,omitempty"` - // ReplicationLinkProperties - The properties representing the resource. - *ReplicationLinkProperties `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"` -} - -// MarshalJSON is the custom marshaler for ReplicationLink. -func (rl ReplicationLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rl.ReplicationLinkProperties != nil { - objectMap["properties"] = rl.ReplicationLinkProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ReplicationLink struct. -func (rl *ReplicationLink) 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 - } - rl.Location = &location - } - case "properties": - if v != nil { - var replicationLinkProperties ReplicationLinkProperties - err = json.Unmarshal(*v, &replicationLinkProperties) - if err != nil { - return err - } - rl.ReplicationLinkProperties = &replicationLinkProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rl.Type = &typeVar - } - } - } - - return nil -} - -// ReplicationLinkListResult represents the response to a List database replication link request. -type ReplicationLinkListResult struct { - autorest.Response `json:"-"` - // Value - The list of database replication links housed in the database. - Value *[]ReplicationLink `json:"value,omitempty"` -} - -// ReplicationLinkProperties represents the properties of a database replication link. -type ReplicationLinkProperties struct { - // IsTerminationAllowed - READ-ONLY; Legacy value indicating whether termination is allowed. Currently always returns true. - IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty"` - // ReplicationMode - READ-ONLY; Replication mode of this replication link. - ReplicationMode *string `json:"replicationMode,omitempty"` - // PartnerServer - READ-ONLY; The name of the server hosting the partner database. - PartnerServer *string `json:"partnerServer,omitempty"` - // PartnerDatabase - READ-ONLY; The name of the partner database. - PartnerDatabase *string `json:"partnerDatabase,omitempty"` - // PartnerLocation - READ-ONLY; The Azure Region of the partner database. - PartnerLocation *string `json:"partnerLocation,omitempty"` - // Role - READ-ONLY; The role of the database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' - Role ReplicationRole `json:"role,omitempty"` - // PartnerRole - READ-ONLY; The role of the partner database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' - PartnerRole ReplicationRole `json:"partnerRole,omitempty"` - // StartTime - READ-ONLY; The start time for the replication link. - StartTime *date.Time `json:"startTime,omitempty"` - // PercentComplete - READ-ONLY; The percentage of seeding complete for the replication link. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ReplicationState - READ-ONLY; The replication state for the replication link. Possible values include: 'PENDING', 'SEEDING', 'CATCHUP', 'SUSPENDED' - ReplicationState ReplicationState `json:"replicationState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationLinkProperties. -func (rlp ReplicationLinkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReplicationLinksFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ReplicationLinksFailoverAllowDataLossFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationLinksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationLinksFailoverAllowDataLossFuture) 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 ReplicationLinksFailoverAllowDataLossFuture.Result. -func (future *ReplicationLinksFailoverAllowDataLossFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverAllowDataLossFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationLinksFailoverFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ReplicationLinksFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationLinksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationLinksFailoverFuture) 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 ReplicationLinksFailoverFuture.Result. -func (future *ReplicationLinksFailoverFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationLinksUnlinkFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationLinksUnlinkFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationLinksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationLinksUnlinkFuture) 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 ReplicationLinksUnlinkFuture.Result. -func (future *ReplicationLinksUnlinkFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksUnlinkFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksUnlinkFuture") - return - } - ar.Response = future.Response() - return -} - -// Resource ARM resource. -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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceIdentity azure Active Directory identity configuration for a resource. -type ResourceIdentity struct { - // PrincipalID - READ-ONLY; The Azure Active Directory principal id. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned' - Type IdentityType `json:"type,omitempty"` - // TenantID - READ-ONLY; The Azure Active Directory tenant id. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceIdentity. -func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ri.Type != "" { - objectMap["type"] = ri.Type - } - return json.Marshal(objectMap) -} - -// RestorableDroppedDatabase a restorable dropped database -type RestorableDroppedDatabase struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // RestorableDroppedDatabaseProperties - The properties of a restorable dropped database - *RestorableDroppedDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for RestorableDroppedDatabase. -func (rdd RestorableDroppedDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdd.RestorableDroppedDatabaseProperties != nil { - objectMap["properties"] = rdd.RestorableDroppedDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableDroppedDatabase struct. -func (rdd *RestorableDroppedDatabase) 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 - } - rdd.Location = &location - } - case "properties": - if v != nil { - var restorableDroppedDatabaseProperties RestorableDroppedDatabaseProperties - err = json.Unmarshal(*v, &restorableDroppedDatabaseProperties) - if err != nil { - return err - } - rdd.RestorableDroppedDatabaseProperties = &restorableDroppedDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rdd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rdd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rdd.Type = &typeVar - } - } - } - - return nil -} - -// RestorableDroppedDatabaseListResult the response to a list restorable dropped databases request -type RestorableDroppedDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - A list of restorable dropped databases - Value *[]RestorableDroppedDatabase `json:"value,omitempty"` -} - -// RestorableDroppedDatabaseProperties the properties of a restorable dropped database -type RestorableDroppedDatabaseProperties struct { - // DatabaseName - READ-ONLY; The name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // Edition - READ-ONLY; The edition of the database - Edition *string `json:"edition,omitempty"` - // MaxSizeBytes - READ-ONLY; The max size in bytes of the database - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective name of the database - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // ElasticPoolName - READ-ONLY; The elastic pool name of the database - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format) - CreationDate *date.Time `json:"creationDate,omitempty"` - // DeletionDate - READ-ONLY; The deletion date of the database (ISO8601 format) - DeletionDate *date.Time `json:"deletionDate,omitempty"` - // EarliestRestoreDate - READ-ONLY; The earliest restore date of the database (ISO8601 format) - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDroppedDatabaseProperties. -func (rddp RestorableDroppedDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorePoint a database restore point. -type RestorePoint struct { - // RestorePointProperties - The properties of the restore point. - *RestorePointProperties `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"` -} - -// MarshalJSON is the custom marshaler for RestorePoint. -func (rp RestorePoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RestorePointProperties != nil { - objectMap["properties"] = rp.RestorePointProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorePoint struct. -func (rp *RestorePoint) 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 restorePointProperties RestorePointProperties - err = json.Unmarshal(*v, &restorePointProperties) - if err != nil { - return err - } - rp.RestorePointProperties = &restorePointProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rp.Type = &typeVar - } - } - } - - return nil -} - -// RestorePointListResult the response to a list database restore points request. -type RestorePointListResult struct { - autorest.Response `json:"-"` - // Value - The list of database restore points. - Value *[]RestorePoint `json:"value,omitempty"` -} - -// RestorePointProperties represents the properties of a database restore point. -type RestorePointProperties struct { - // RestorePointType - READ-ONLY; The restore point type of the database restore point. Possible values include: 'DISCRETE', 'CONTINUOUS' - RestorePointType RestorePointType `json:"restorePointType,omitempty"` - // RestorePointCreationDate - READ-ONLY; Restore point creation time (ISO8601 format). Populated when restorePointType = CONTINUOUS. Null otherwise. - RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"` - // EarliestRestoreDate - READ-ONLY; Earliest restore time (ISO8601 format). Populated when restorePointType = DISCRETE. Null otherwise. - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorePointProperties. -func (rpp RestorePointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Server an Azure SQL Database server. -type Server struct { - autorest.Response `json:"-"` - // Identity - The Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Kind - READ-ONLY; Kind of sql server. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ServerProperties - Resource properties. - *ServerProperties `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"` -} - -// MarshalJSON is the custom marshaler for Server. -func (s Server) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Identity != nil { - objectMap["identity"] = s.Identity - } - if s.ServerProperties != nil { - objectMap["properties"] = s.ServerProperties - } - if s.Location != nil { - objectMap["location"] = s.Location - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Server struct. -func (s *Server) 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 "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - s.Identity = &identity - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - s.Kind = &kind - } - case "properties": - if v != nil { - var serverProperties ServerProperties - err = json.Unmarshal(*v, &serverProperties) - if err != nil { - return err - } - s.ServerProperties = &serverProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - 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 - } - } - } - - return nil -} - -// ServerAdministratorListResult the response to a list Active Directory Administrators request. -type ServerAdministratorListResult struct { - autorest.Response `json:"-"` - // Value - The list of server Active Directory Administrators for the server. - Value *[]ServerAzureADAdministrator `json:"value,omitempty"` -} - -// ServerAdministratorProperties the properties of an server Administrator. -type ServerAdministratorProperties struct { - // AdministratorType - The type of administrator. - AdministratorType *string `json:"administratorType,omitempty"` - // Login - The server administrator login value. - Login *string `json:"login,omitempty"` - // Sid - The server administrator Sid (Secure ID). - Sid *uuid.UUID `json:"sid,omitempty"` - // TenantID - The server Active Directory Administrator tenant id. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// ServerAzureADAdministrator an server Active Directory Administrator. -type ServerAzureADAdministrator struct { - autorest.Response `json:"-"` - // ServerAdministratorProperties - The properties of the resource. - *ServerAdministratorProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerAzureADAdministrator. -func (saaa ServerAzureADAdministrator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if saaa.ServerAdministratorProperties != nil { - objectMap["properties"] = saaa.ServerAdministratorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerAzureADAdministrator struct. -func (saaa *ServerAzureADAdministrator) 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 serverAdministratorProperties ServerAdministratorProperties - err = json.Unmarshal(*v, &serverAdministratorProperties) - if err != nil { - return err - } - saaa.ServerAdministratorProperties = &serverAdministratorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - saaa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - saaa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - saaa.Type = &typeVar - } - } - } - - return nil -} - -// ServerAzureADAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerAzureADAdministratorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAzureADAdministratorsClient) (ServerAzureADAdministrator, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) 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 ServerAzureADAdministratorsCreateOrUpdateFuture.Result. -func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - saaa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { - saaa, err = client.CreateOrUpdateResponder(saaa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", saaa.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerAzureADAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerAzureADAdministratorsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAzureADAdministratorsClient) (ServerAzureADAdministrator, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAzureADAdministratorsDeleteFuture) 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 ServerAzureADAdministratorsDeleteFuture.Result. -func (future *ServerAzureADAdministratorsDeleteFuture) result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - saaa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { - saaa, err = client.DeleteResponder(saaa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", saaa.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerCommunicationLink server communication link. -type ServerCommunicationLink struct { - autorest.Response `json:"-"` - // ServerCommunicationLinkProperties - The properties of resource. - *ServerCommunicationLinkProperties `json:"properties,omitempty"` - // Location - READ-ONLY; Communication link location. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; Communication link kind. This property is used for Azure Portal metadata. - Kind *string `json:"kind,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"` -} - -// MarshalJSON is the custom marshaler for ServerCommunicationLink. -func (scl ServerCommunicationLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scl.ServerCommunicationLinkProperties != nil { - objectMap["properties"] = scl.ServerCommunicationLinkProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerCommunicationLink struct. -func (scl *ServerCommunicationLink) 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 serverCommunicationLinkProperties ServerCommunicationLinkProperties - err = json.Unmarshal(*v, &serverCommunicationLinkProperties) - if err != nil { - return err - } - scl.ServerCommunicationLinkProperties = &serverCommunicationLinkProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scl.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - scl.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scl.Type = &typeVar - } - } - } - - return nil -} - -// ServerCommunicationLinkListResult a list of server communication links. -type ServerCommunicationLinkListResult struct { - autorest.Response `json:"-"` - // Value - The list of server communication links. - Value *[]ServerCommunicationLink `json:"value,omitempty"` -} - -// ServerCommunicationLinkProperties the properties of a server communication link. -type ServerCommunicationLinkProperties struct { - // State - READ-ONLY; The state. - State *string `json:"state,omitempty"` - // PartnerServer - The name of the partner server. - PartnerServer *string `json:"partnerServer,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerCommunicationLinkProperties. -func (sclp ServerCommunicationLinkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sclp.PartnerServer != nil { - objectMap["partnerServer"] = sclp.PartnerServer - } - return json.Marshal(objectMap) -} - -// ServerCommunicationLinksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ServerCommunicationLinksCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerCommunicationLinksClient) (ServerCommunicationLink, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerCommunicationLinksCreateOrUpdateFuture) 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 ServerCommunicationLinksCreateOrUpdateFuture.Result. -func (future *ServerCommunicationLinksCreateOrUpdateFuture) result(client ServerCommunicationLinksClient) (scl ServerCommunicationLink, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - scl.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerCommunicationLinksCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if scl.Response.Response, err = future.GetResult(sender); err == nil && scl.Response.Response.StatusCode != http.StatusNoContent { - scl, err = client.CreateOrUpdateResponder(scl.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", scl.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerConnectionPolicy a server secure connection policy. -type ServerConnectionPolicy struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // ServerConnectionPolicyProperties - The properties of the server secure connection policy. - *ServerConnectionPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerConnectionPolicy. -func (scp ServerConnectionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.ServerConnectionPolicyProperties != nil { - objectMap["properties"] = scp.ServerConnectionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerConnectionPolicy struct. -func (scp *ServerConnectionPolicy) 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 - } - scp.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scp.Location = &location - } - case "properties": - if v != nil { - var serverConnectionPolicyProperties ServerConnectionPolicyProperties - err = json.Unmarshal(*v, &serverConnectionPolicyProperties) - if err != nil { - return err - } - scp.ServerConnectionPolicyProperties = &serverConnectionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scp.Type = &typeVar - } - } - } - - return nil -} - -// ServerConnectionPolicyProperties the properties of a server secure connection policy. -type ServerConnectionPolicyProperties struct { - // ConnectionType - The server connection type. Possible values include: 'ServerConnectionTypeDefault', 'ServerConnectionTypeProxy', 'ServerConnectionTypeRedirect' - ConnectionType ServerConnectionType `json:"connectionType,omitempty"` -} - -// ServerKey a server key. -type ServerKey struct { - autorest.Response `json:"-"` - // Kind - Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // ServerKeyProperties - Resource properties. - *ServerKeyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerKey. -func (sk ServerKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sk.Kind != nil { - objectMap["kind"] = sk.Kind - } - if sk.ServerKeyProperties != nil { - objectMap["properties"] = sk.ServerKeyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerKey struct. -func (sk *ServerKey) 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 - } - sk.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sk.Location = &location - } - case "properties": - if v != nil { - var serverKeyProperties ServerKeyProperties - err = json.Unmarshal(*v, &serverKeyProperties) - if err != nil { - return err - } - sk.ServerKeyProperties = &serverKeyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sk.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sk.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sk.Type = &typeVar - } - } - } - - return nil -} - -// ServerKeyListResult a list of server keys. -type ServerKeyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerKey `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKeyListResult. -func (sklr ServerKeyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerKeyListResultIterator provides access to a complete listing of ServerKey values. -type ServerKeyListResultIterator struct { - i int - page ServerKeyListResultPage -} - -// 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 *ServerKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultIterator.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 *ServerKeyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerKeyListResultIterator) 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 ServerKeyListResultIterator) Response() ServerKeyListResult { - 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 ServerKeyListResultIterator) Value() ServerKey { - if !iter.page.NotDone() { - return ServerKey{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerKeyListResultIterator type. -func NewServerKeyListResultIterator(page ServerKeyListResultPage) ServerKeyListResultIterator { - return ServerKeyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sklr ServerKeyListResult) IsEmpty() bool { - return sklr.Value == nil || len(*sklr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sklr ServerKeyListResult) hasNextLink() bool { - return sklr.NextLink != nil && len(*sklr.NextLink) != 0 -} - -// serverKeyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sklr ServerKeyListResult) serverKeyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sklr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sklr.NextLink))) -} - -// ServerKeyListResultPage contains a page of ServerKey values. -type ServerKeyListResultPage struct { - fn func(context.Context, ServerKeyListResult) (ServerKeyListResult, error) - sklr ServerKeyListResult -} - -// 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 *ServerKeyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultPage.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.sklr) - if err != nil { - return err - } - page.sklr = 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 *ServerKeyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerKeyListResultPage) NotDone() bool { - return !page.sklr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerKeyListResultPage) Response() ServerKeyListResult { - return page.sklr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerKeyListResultPage) Values() []ServerKey { - if page.sklr.IsEmpty() { - return nil - } - return *page.sklr.Value -} - -// Creates a new instance of the ServerKeyListResultPage type. -func NewServerKeyListResultPage(cur ServerKeyListResult, getNextPage func(context.Context, ServerKeyListResult) (ServerKeyListResult, error)) ServerKeyListResultPage { - return ServerKeyListResultPage{ - fn: getNextPage, - sklr: cur, - } -} - -// ServerKeyProperties properties for a server key execution. -type ServerKeyProperties struct { - // Subregion - READ-ONLY; Subregion of the server key. - Subregion *string `json:"subregion,omitempty"` - // ServerKeyType - The server key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - The URI of the server key. - URI *string `json:"uri,omitempty"` - // Thumbprint - Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty"` - // CreationDate - The server key creation date. - CreationDate *date.Time `json:"creationDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKeyProperties. -func (skp ServerKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if skp.ServerKeyType != "" { - objectMap["serverKeyType"] = skp.ServerKeyType - } - if skp.URI != nil { - objectMap["uri"] = skp.URI - } - if skp.Thumbprint != nil { - objectMap["thumbprint"] = skp.Thumbprint - } - if skp.CreationDate != nil { - objectMap["creationDate"] = skp.CreationDate - } - return json.Marshal(objectMap) -} - -// ServerKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerKeysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerKeysClient) (ServerKey, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerKeysCreateOrUpdateFuture) 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 ServerKeysCreateOrUpdateFuture.Result. -func (future *ServerKeysCreateOrUpdateFuture) result(client ServerKeysClient) (sk ServerKey, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sk.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerKeysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sk.Response.Response, err = future.GetResult(sender); err == nil && sk.Response.Response.StatusCode != http.StatusNoContent { - sk, err = client.CreateOrUpdateResponder(sk.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", sk.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerKeysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServerKeysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerKeysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerKeysDeleteFuture) 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 ServerKeysDeleteFuture.Result. -func (future *ServerKeysDeleteFuture) result(client ServerKeysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerKeysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerListResult a list of servers. -type ServerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Server `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerListResult. -func (slr ServerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerListResultIterator provides access to a complete listing of Server values. -type ServerListResultIterator struct { - i int - page ServerListResultPage -} - -// 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 *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.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 *ServerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerListResultIterator) 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 ServerListResultIterator) Response() ServerListResult { - 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 ServerListResultIterator) Value() Server { - if !iter.page.NotDone() { - return Server{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerListResultIterator type. -func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator { - return ServerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr ServerListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr ServerListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// serverListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr ServerListResult) serverListResultPreparer(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))) -} - -// ServerListResultPage contains a page of Server values. -type ServerListResultPage struct { - fn func(context.Context, ServerListResult) (ServerListResult, error) - slr ServerListResult -} - -// 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 *ServerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.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 *ServerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerListResultPage) Response() ServerListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerListResultPage) Values() []Server { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the ServerListResultPage type. -func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage { - return ServerListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// ServerProperties the properties of a server. -type ServerProperties struct { - // AdministratorLogin - Administrator username for the server. Once created it cannot be changed. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The administrator login password (required for server creation). - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - The version of the server. - Version *string `json:"version,omitempty"` - // State - READ-ONLY; The state of the server. - State *string `json:"state,omitempty"` - // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerProperties. -func (sp ServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.AdministratorLogin != nil { - objectMap["administratorLogin"] = sp.AdministratorLogin - } - if sp.AdministratorLoginPassword != nil { - objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword - } - if sp.Version != nil { - objectMap["version"] = sp.Version - } - return json.Marshal(objectMap) -} - -// ServersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersCreateOrUpdateFuture) 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 ServersCreateOrUpdateFuture.Result. -func (future *ServersCreateOrUpdateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersDeleteFuture) 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 ServersDeleteFuture.Result. -func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersUpdateFuture) 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 ServersUpdateFuture.Result. -func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersUpdateFuture") - 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.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerUpdate an update request for an Azure SQL Database server. -type ServerUpdate struct { - // ServerProperties - Resource properties. - *ServerProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerUpdate. -func (su ServerUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if su.ServerProperties != nil { - objectMap["properties"] = su.ServerProperties - } - if su.Tags != nil { - objectMap["tags"] = su.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerUpdate struct. -func (su *ServerUpdate) 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 serverProperties ServerProperties - err = json.Unmarshal(*v, &serverProperties) - if err != nil { - return err - } - su.ServerProperties = &serverProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - su.Tags = tags - } - } - } - - return nil -} - -// ServerUsage represents server metrics. -type ServerUsage struct { - // Name - READ-ONLY; Name of the server usage metric. - Name *string `json:"name,omitempty"` - // ResourceName - READ-ONLY; The name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // DisplayName - READ-ONLY; The metric display name. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; The current value of the metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The current limit of the metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units of the metric. - Unit *string `json:"unit,omitempty"` - // NextResetTime - READ-ONLY; The next reset time for the metric (ISO8601 format). - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerUsage. -func (su ServerUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerUsageListResult represents the response to a list server metrics request. -type ServerUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of server metrics for the server. - Value *[]ServerUsage `json:"value,omitempty"` -} - -// ServerVersionCapability the server capability -type ServerVersionCapability struct { - // Name - READ-ONLY; The server version name. - Name *string `json:"name,omitempty"` - // SupportedEditions - READ-ONLY; The list of supported database editions. - SupportedEditions *[]EditionCapability `json:"supportedEditions,omitempty"` - // SupportedElasticPoolEditions - READ-ONLY; The list of supported elastic pool editions. - SupportedElasticPoolEditions *[]ElasticPoolEditionCapability `json:"supportedElasticPoolEditions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerVersionCapability. -func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if svc.Reason != nil { - objectMap["reason"] = svc.Reason - } - return json.Marshal(objectMap) -} - -// ServiceLevelObjectiveCapability the service objectives capability. -type ServiceLevelObjectiveCapability struct { - // ID - READ-ONLY; The unique ID of the service objective. - ID *uuid.UUID `json:"id,omitempty"` - // Name - READ-ONLY; The service objective name. - Name *string `json:"name,omitempty"` - // SupportedMaxSizes - READ-ONLY; The list of supported maximum database sizes for this service objective. - SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` - // PerformanceLevel - READ-ONLY; The performance level of the service objective capability. - PerformanceLevel *PerformanceLevelCapability `json:"performanceLevel,omitempty"` - // IncludedMaxSize - READ-ONLY; The included (free) max size for this service level objective. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceLevelObjectiveCapability. -func (sloc ServiceLevelObjectiveCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sloc.Reason != nil { - objectMap["reason"] = sloc.Reason - } - return json.Marshal(objectMap) -} - -// ServiceObjective represents a database service objective. -type ServiceObjective struct { - autorest.Response `json:"-"` - // ServiceObjectiveProperties - Represents the properties of the resource. - *ServiceObjectiveProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServiceObjective. -func (so ServiceObjective) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if so.ServiceObjectiveProperties != nil { - objectMap["properties"] = so.ServiceObjectiveProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceObjective struct. -func (so *ServiceObjective) 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 serviceObjectiveProperties ServiceObjectiveProperties - err = json.Unmarshal(*v, &serviceObjectiveProperties) - if err != nil { - return err - } - so.ServiceObjectiveProperties = &serviceObjectiveProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - so.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - so.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - so.Type = &typeVar - } - } - } - - return nil -} - -// ServiceObjectiveListResult represents the response to a get database service objectives request. -type ServiceObjectiveListResult struct { - autorest.Response `json:"-"` - // Value - The list of database service objectives. - Value *[]ServiceObjective `json:"value,omitempty"` -} - -// ServiceObjectiveProperties represents the properties of a database service objective. -type ServiceObjectiveProperties struct { - // ServiceObjectiveName - READ-ONLY; The name for the service objective. - ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` - // IsDefault - READ-ONLY; Gets whether the service level objective is the default service objective. - IsDefault *bool `json:"isDefault,omitempty"` - // IsSystem - READ-ONLY; Gets whether the service level objective is a system service objective. - IsSystem *bool `json:"isSystem,omitempty"` - // Description - READ-ONLY; The description for the service level objective. - Description *string `json:"description,omitempty"` - // Enabled - READ-ONLY; Gets whether the service level objective is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceObjectiveProperties. -func (sop ServiceObjectiveProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceTierAdvisor represents a Service Tier Advisor. -type ServiceTierAdvisor struct { - autorest.Response `json:"-"` - // ServiceTierAdvisorProperties - READ-ONLY; The properties representing the resource. - *ServiceTierAdvisorProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServiceTierAdvisor. -func (sta ServiceTierAdvisor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceTierAdvisor struct. -func (sta *ServiceTierAdvisor) 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 serviceTierAdvisorProperties ServiceTierAdvisorProperties - err = json.Unmarshal(*v, &serviceTierAdvisorProperties) - if err != nil { - return err - } - sta.ServiceTierAdvisorProperties = &serviceTierAdvisorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sta.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sta.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sta.Type = &typeVar - } - } - } - - return nil -} - -// ServiceTierAdvisorListResult represents the response to a list service tier advisor request. -type ServiceTierAdvisorListResult struct { - autorest.Response `json:"-"` - // Value - The list of service tier advisors for specified database. - Value *[]ServiceTierAdvisor `json:"value,omitempty"` -} - -// ServiceTierAdvisorProperties represents the properties of a Service Tier Advisor. -type ServiceTierAdvisorProperties struct { - // ObservationPeriodStart - READ-ONLY; The observation period start (ISO8601 format). - ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` - // ObservationPeriodEnd - READ-ONLY; The observation period start (ISO8601 format). - ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` - // ActiveTimeRatio - READ-ONLY; The activeTimeRatio for service tier advisor. - ActiveTimeRatio *float64 `json:"activeTimeRatio,omitempty"` - // MinDtu - READ-ONLY; Gets or sets minDtu for service tier advisor. - MinDtu *float64 `json:"minDtu,omitempty"` - // AvgDtu - READ-ONLY; Gets or sets avgDtu for service tier advisor. - AvgDtu *float64 `json:"avgDtu,omitempty"` - // MaxDtu - READ-ONLY; Gets or sets maxDtu for service tier advisor. - MaxDtu *float64 `json:"maxDtu,omitempty"` - // MaxSizeInGB - READ-ONLY; Gets or sets maxSizeInGB for service tier advisor. - MaxSizeInGB *float64 `json:"maxSizeInGB,omitempty"` - // ServiceLevelObjectiveUsageMetrics - READ-ONLY; Gets or sets serviceLevelObjectiveUsageMetrics for the service tier advisor. - ServiceLevelObjectiveUsageMetrics *[]SloUsageMetric `json:"serviceLevelObjectiveUsageMetrics,omitempty"` - // CurrentServiceLevelObjective - READ-ONLY; Gets or sets currentServiceLevelObjective for service tier advisor. - CurrentServiceLevelObjective *string `json:"currentServiceLevelObjective,omitempty"` - // CurrentServiceLevelObjectiveID - READ-ONLY; Gets or sets currentServiceLevelObjectiveId for service tier advisor. - CurrentServiceLevelObjectiveID *uuid.UUID `json:"currentServiceLevelObjectiveId,omitempty"` - // UsageBasedRecommendationServiceLevelObjective - READ-ONLY; Gets or sets usageBasedRecommendationServiceLevelObjective for service tier advisor. - UsageBasedRecommendationServiceLevelObjective *string `json:"usageBasedRecommendationServiceLevelObjective,omitempty"` - // UsageBasedRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. - UsageBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"usageBasedRecommendationServiceLevelObjectiveId,omitempty"` - // DatabaseSizeBasedRecommendationServiceLevelObjective - READ-ONLY; Gets or sets databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. - DatabaseSizeBasedRecommendationServiceLevelObjective *string `json:"databaseSizeBasedRecommendationServiceLevelObjective,omitempty"` - // DatabaseSizeBasedRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. - DatabaseSizeBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"databaseSizeBasedRecommendationServiceLevelObjectiveId,omitempty"` - // DisasterPlanBasedRecommendationServiceLevelObjective - READ-ONLY; Gets or sets disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. - DisasterPlanBasedRecommendationServiceLevelObjective *string `json:"disasterPlanBasedRecommendationServiceLevelObjective,omitempty"` - // DisasterPlanBasedRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. - DisasterPlanBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"disasterPlanBasedRecommendationServiceLevelObjectiveId,omitempty"` - // OverallRecommendationServiceLevelObjective - READ-ONLY; Gets or sets overallRecommendationServiceLevelObjective for service tier advisor. - OverallRecommendationServiceLevelObjective *string `json:"overallRecommendationServiceLevelObjective,omitempty"` - // OverallRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets overallRecommendationServiceLevelObjectiveId for service tier advisor. - OverallRecommendationServiceLevelObjectiveID *uuid.UUID `json:"overallRecommendationServiceLevelObjectiveId,omitempty"` - // Confidence - READ-ONLY; Gets or sets confidence for service tier advisor. - Confidence *float64 `json:"confidence,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceTierAdvisorProperties. -func (stap ServiceTierAdvisorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Sku an ARM Resource SKU. -type Sku struct { - // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. - Name *string `json:"name,omitempty"` - // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. - Tier *string `json:"tier,omitempty"` - // Size - Size of the particular SKU - Size *string `json:"size,omitempty"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // Capacity - Capacity of the particular SKU. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SloUsageMetric a Slo Usage Metric. -type SloUsageMetric struct { - // ServiceLevelObjective - READ-ONLY; The serviceLevelObjective for SLO usage metric. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' - ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` - // ServiceLevelObjectiveID - READ-ONLY; The serviceLevelObjectiveId for SLO usage metric. - ServiceLevelObjectiveID *uuid.UUID `json:"serviceLevelObjectiveId,omitempty"` - // InRangeTimeRatio - READ-ONLY; Gets or sets inRangeTimeRatio for SLO usage metric. - InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty"` -} - -// MarshalJSON is the custom marshaler for SloUsageMetric. -func (sum SloUsageMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SubscriptionUsage usage Metric of a Subscription in a Location. -type SubscriptionUsage struct { - autorest.Response `json:"-"` - // SubscriptionUsageProperties - Resource properties. - *SubscriptionUsageProperties `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"` -} - -// MarshalJSON is the custom marshaler for SubscriptionUsage. -func (su SubscriptionUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if su.SubscriptionUsageProperties != nil { - objectMap["properties"] = su.SubscriptionUsageProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionUsage struct. -func (su *SubscriptionUsage) 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 subscriptionUsageProperties SubscriptionUsageProperties - err = json.Unmarshal(*v, &subscriptionUsageProperties) - if err != nil { - return err - } - su.SubscriptionUsageProperties = &subscriptionUsageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - su.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - su.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - su.Type = &typeVar - } - } - } - - return nil -} - -// SubscriptionUsageListResult a list of subscription usage metrics in a location. -type SubscriptionUsageListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SubscriptionUsage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionUsageListResult. -func (sulr SubscriptionUsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SubscriptionUsageListResultIterator provides access to a complete listing of SubscriptionUsage values. -type SubscriptionUsageListResultIterator struct { - i int - page SubscriptionUsageListResultPage -} - -// 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 *SubscriptionUsageListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsageListResultIterator.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 *SubscriptionUsageListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SubscriptionUsageListResultIterator) 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 SubscriptionUsageListResultIterator) Response() SubscriptionUsageListResult { - 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 SubscriptionUsageListResultIterator) Value() SubscriptionUsage { - if !iter.page.NotDone() { - return SubscriptionUsage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SubscriptionUsageListResultIterator type. -func NewSubscriptionUsageListResultIterator(page SubscriptionUsageListResultPage) SubscriptionUsageListResultIterator { - return SubscriptionUsageListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sulr SubscriptionUsageListResult) IsEmpty() bool { - return sulr.Value == nil || len(*sulr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sulr SubscriptionUsageListResult) hasNextLink() bool { - return sulr.NextLink != nil && len(*sulr.NextLink) != 0 -} - -// subscriptionUsageListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sulr SubscriptionUsageListResult) subscriptionUsageListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sulr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sulr.NextLink))) -} - -// SubscriptionUsageListResultPage contains a page of SubscriptionUsage values. -type SubscriptionUsageListResultPage struct { - fn func(context.Context, SubscriptionUsageListResult) (SubscriptionUsageListResult, error) - sulr SubscriptionUsageListResult -} - -// 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 *SubscriptionUsageListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsageListResultPage.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.sulr) - if err != nil { - return err - } - page.sulr = 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 *SubscriptionUsageListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SubscriptionUsageListResultPage) NotDone() bool { - return !page.sulr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SubscriptionUsageListResultPage) Response() SubscriptionUsageListResult { - return page.sulr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SubscriptionUsageListResultPage) Values() []SubscriptionUsage { - if page.sulr.IsEmpty() { - return nil - } - return *page.sulr.Value -} - -// Creates a new instance of the SubscriptionUsageListResultPage type. -func NewSubscriptionUsageListResultPage(cur SubscriptionUsageListResult, getNextPage func(context.Context, SubscriptionUsageListResult) (SubscriptionUsageListResult, error)) SubscriptionUsageListResultPage { - return SubscriptionUsageListResultPage{ - fn: getNextPage, - sulr: cur, - } -} - -// SubscriptionUsageProperties properties of a subscription usage. -type SubscriptionUsageProperties struct { - // DisplayName - READ-ONLY; User-readable name of the metric. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; Current value of the metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; Boundary value of the metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; Unit of the metric. - Unit *string `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionUsageProperties. -func (sup SubscriptionUsageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgent an Azure SQL Database sync agent. -type SyncAgent struct { - autorest.Response `json:"-"` - // SyncAgentProperties - Resource properties. - *SyncAgentProperties `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"` -} - -// MarshalJSON is the custom marshaler for SyncAgent. -func (sa SyncAgent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sa.SyncAgentProperties != nil { - objectMap["properties"] = sa.SyncAgentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SyncAgent struct. -func (sa *SyncAgent) 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 syncAgentProperties SyncAgentProperties - err = json.Unmarshal(*v, &syncAgentProperties) - if err != nil { - return err - } - sa.SyncAgentProperties = &syncAgentProperties - } - 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 - } - } - } - - return nil -} - -// SyncAgentKeyProperties properties of an Azure SQL Database sync agent key. -type SyncAgentKeyProperties struct { - autorest.Response `json:"-"` - // SyncAgentKey - READ-ONLY; Key of sync agent. - SyncAgentKey *string `json:"syncAgentKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentKeyProperties. -func (sakp SyncAgentKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgentLinkedDatabase an Azure SQL Database sync agent linked database. -type SyncAgentLinkedDatabase struct { - // SyncAgentLinkedDatabaseProperties - Resource properties. - *SyncAgentLinkedDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for SyncAgentLinkedDatabase. -func (sald SyncAgentLinkedDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sald.SyncAgentLinkedDatabaseProperties != nil { - objectMap["properties"] = sald.SyncAgentLinkedDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SyncAgentLinkedDatabase struct. -func (sald *SyncAgentLinkedDatabase) 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 syncAgentLinkedDatabaseProperties SyncAgentLinkedDatabaseProperties - err = json.Unmarshal(*v, &syncAgentLinkedDatabaseProperties) - if err != nil { - return err - } - sald.SyncAgentLinkedDatabaseProperties = &syncAgentLinkedDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sald.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sald.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sald.Type = &typeVar - } - } - } - - return nil -} - -// SyncAgentLinkedDatabaseListResult a list of sync agent linked databases. -type SyncAgentLinkedDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncAgentLinkedDatabase `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentLinkedDatabaseListResult. -func (saldlr SyncAgentLinkedDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgentLinkedDatabaseListResultIterator provides access to a complete listing of -// SyncAgentLinkedDatabase values. -type SyncAgentLinkedDatabaseListResultIterator struct { - i int - page SyncAgentLinkedDatabaseListResultPage -} - -// 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 *SyncAgentLinkedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentLinkedDatabaseListResultIterator.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 *SyncAgentLinkedDatabaseListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncAgentLinkedDatabaseListResultIterator) 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 SyncAgentLinkedDatabaseListResultIterator) Response() SyncAgentLinkedDatabaseListResult { - 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 SyncAgentLinkedDatabaseListResultIterator) Value() SyncAgentLinkedDatabase { - if !iter.page.NotDone() { - return SyncAgentLinkedDatabase{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncAgentLinkedDatabaseListResultIterator type. -func NewSyncAgentLinkedDatabaseListResultIterator(page SyncAgentLinkedDatabaseListResultPage) SyncAgentLinkedDatabaseListResultIterator { - return SyncAgentLinkedDatabaseListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (saldlr SyncAgentLinkedDatabaseListResult) IsEmpty() bool { - return saldlr.Value == nil || len(*saldlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (saldlr SyncAgentLinkedDatabaseListResult) hasNextLink() bool { - return saldlr.NextLink != nil && len(*saldlr.NextLink) != 0 -} - -// syncAgentLinkedDatabaseListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (saldlr SyncAgentLinkedDatabaseListResult) syncAgentLinkedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { - if !saldlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(saldlr.NextLink))) -} - -// SyncAgentLinkedDatabaseListResultPage contains a page of SyncAgentLinkedDatabase values. -type SyncAgentLinkedDatabaseListResultPage struct { - fn func(context.Context, SyncAgentLinkedDatabaseListResult) (SyncAgentLinkedDatabaseListResult, error) - saldlr SyncAgentLinkedDatabaseListResult -} - -// 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 *SyncAgentLinkedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentLinkedDatabaseListResultPage.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.saldlr) - if err != nil { - return err - } - page.saldlr = 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 *SyncAgentLinkedDatabaseListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncAgentLinkedDatabaseListResultPage) NotDone() bool { - return !page.saldlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncAgentLinkedDatabaseListResultPage) Response() SyncAgentLinkedDatabaseListResult { - return page.saldlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncAgentLinkedDatabaseListResultPage) Values() []SyncAgentLinkedDatabase { - if page.saldlr.IsEmpty() { - return nil - } - return *page.saldlr.Value -} - -// Creates a new instance of the SyncAgentLinkedDatabaseListResultPage type. -func NewSyncAgentLinkedDatabaseListResultPage(cur SyncAgentLinkedDatabaseListResult, getNextPage func(context.Context, SyncAgentLinkedDatabaseListResult) (SyncAgentLinkedDatabaseListResult, error)) SyncAgentLinkedDatabaseListResultPage { - return SyncAgentLinkedDatabaseListResultPage{ - fn: getNextPage, - saldlr: cur, - } -} - -// SyncAgentLinkedDatabaseProperties properties of an Azure SQL Database sync agent linked database. -type SyncAgentLinkedDatabaseProperties struct { - // DatabaseType - READ-ONLY; Type of the sync agent linked database. Possible values include: 'AzureSQLDatabase', 'SQLServerDatabase' - DatabaseType SyncMemberDbType `json:"databaseType,omitempty"` - // DatabaseID - READ-ONLY; Id of the sync agent linked database. - DatabaseID *string `json:"databaseId,omitempty"` - // Description - READ-ONLY; Description of the sync agent linked database. - Description *string `json:"description,omitempty"` - // ServerName - READ-ONLY; Server name of the sync agent linked database. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; Database name of the sync agent linked database. - DatabaseName *string `json:"databaseName,omitempty"` - // UserName - READ-ONLY; User name of the sync agent linked database. - UserName *string `json:"userName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentLinkedDatabaseProperties. -func (saldp SyncAgentLinkedDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgentListResult a list of sync agents. -type SyncAgentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncAgent `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentListResult. -func (salr SyncAgentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgentListResultIterator provides access to a complete listing of SyncAgent values. -type SyncAgentListResultIterator struct { - i int - page SyncAgentListResultPage -} - -// 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 *SyncAgentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentListResultIterator.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 *SyncAgentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncAgentListResultIterator) 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 SyncAgentListResultIterator) Response() SyncAgentListResult { - 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 SyncAgentListResultIterator) Value() SyncAgent { - if !iter.page.NotDone() { - return SyncAgent{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncAgentListResultIterator type. -func NewSyncAgentListResultIterator(page SyncAgentListResultPage) SyncAgentListResultIterator { - return SyncAgentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (salr SyncAgentListResult) IsEmpty() bool { - return salr.Value == nil || len(*salr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (salr SyncAgentListResult) hasNextLink() bool { - return salr.NextLink != nil && len(*salr.NextLink) != 0 -} - -// syncAgentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (salr SyncAgentListResult) syncAgentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !salr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(salr.NextLink))) -} - -// SyncAgentListResultPage contains a page of SyncAgent values. -type SyncAgentListResultPage struct { - fn func(context.Context, SyncAgentListResult) (SyncAgentListResult, error) - salr SyncAgentListResult -} - -// 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 *SyncAgentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentListResultPage.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.salr) - if err != nil { - return err - } - page.salr = 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 *SyncAgentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncAgentListResultPage) NotDone() bool { - return !page.salr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncAgentListResultPage) Response() SyncAgentListResult { - return page.salr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncAgentListResultPage) Values() []SyncAgent { - if page.salr.IsEmpty() { - return nil - } - return *page.salr.Value -} - -// Creates a new instance of the SyncAgentListResultPage type. -func NewSyncAgentListResultPage(cur SyncAgentListResult, getNextPage func(context.Context, SyncAgentListResult) (SyncAgentListResult, error)) SyncAgentListResultPage { - return SyncAgentListResultPage{ - fn: getNextPage, - salr: cur, - } -} - -// SyncAgentProperties properties of an Azure SQL Database sync agent. -type SyncAgentProperties struct { - // Name - READ-ONLY; Name of the sync agent. - Name *string `json:"name,omitempty"` - // SyncDatabaseID - ARM resource id of the sync database in the sync agent. - SyncDatabaseID *string `json:"syncDatabaseId,omitempty"` - // LastAliveTime - READ-ONLY; Last alive time of the sync agent. - LastAliveTime *date.Time `json:"lastAliveTime,omitempty"` - // State - READ-ONLY; State of the sync agent. Possible values include: 'Online', 'Offline', 'NeverConnected' - State SyncAgentState `json:"state,omitempty"` - // IsUpToDate - READ-ONLY; If the sync agent version is up to date. - IsUpToDate *bool `json:"isUpToDate,omitempty"` - // ExpiryTime - READ-ONLY; Expiration time of the sync agent version. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // Version - READ-ONLY; Version of the sync agent. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentProperties. -func (sap SyncAgentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sap.SyncDatabaseID != nil { - objectMap["syncDatabaseId"] = sap.SyncDatabaseID - } - return json.Marshal(objectMap) -} - -// SyncAgentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncAgentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncAgentsClient) (SyncAgent, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncAgentsCreateOrUpdateFuture) 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 SyncAgentsCreateOrUpdateFuture.Result. -func (future *SyncAgentsCreateOrUpdateFuture) result(client SyncAgentsClient) (sa SyncAgent, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncAgentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sa.Response.Response, err = future.GetResult(sender); err == nil && sa.Response.Response.StatusCode != http.StatusNoContent { - sa, err = client.CreateOrUpdateResponder(sa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", sa.Response.Response, "Failure responding to request") - } - } - return -} - -// SyncAgentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncAgentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncAgentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncAgentsDeleteFuture) 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 SyncAgentsDeleteFuture.Result. -func (future *SyncAgentsDeleteFuture) result(client SyncAgentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncAgentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncDatabaseIDListResult a list of sync database ID properties. -type SyncDatabaseIDListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncDatabaseIDProperties `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncDatabaseIDListResult. -func (sdilr SyncDatabaseIDListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncDatabaseIDListResultIterator provides access to a complete listing of SyncDatabaseIDProperties -// values. -type SyncDatabaseIDListResultIterator struct { - i int - page SyncDatabaseIDListResultPage -} - -// 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 *SyncDatabaseIDListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncDatabaseIDListResultIterator.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 *SyncDatabaseIDListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncDatabaseIDListResultIterator) 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 SyncDatabaseIDListResultIterator) Response() SyncDatabaseIDListResult { - 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 SyncDatabaseIDListResultIterator) Value() SyncDatabaseIDProperties { - if !iter.page.NotDone() { - return SyncDatabaseIDProperties{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncDatabaseIDListResultIterator type. -func NewSyncDatabaseIDListResultIterator(page SyncDatabaseIDListResultPage) SyncDatabaseIDListResultIterator { - return SyncDatabaseIDListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sdilr SyncDatabaseIDListResult) IsEmpty() bool { - return sdilr.Value == nil || len(*sdilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sdilr SyncDatabaseIDListResult) hasNextLink() bool { - return sdilr.NextLink != nil && len(*sdilr.NextLink) != 0 -} - -// syncDatabaseIDListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sdilr SyncDatabaseIDListResult) syncDatabaseIDListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sdilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sdilr.NextLink))) -} - -// SyncDatabaseIDListResultPage contains a page of SyncDatabaseIDProperties values. -type SyncDatabaseIDListResultPage struct { - fn func(context.Context, SyncDatabaseIDListResult) (SyncDatabaseIDListResult, error) - sdilr SyncDatabaseIDListResult -} - -// 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 *SyncDatabaseIDListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncDatabaseIDListResultPage.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.sdilr) - if err != nil { - return err - } - page.sdilr = 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 *SyncDatabaseIDListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncDatabaseIDListResultPage) NotDone() bool { - return !page.sdilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncDatabaseIDListResultPage) Response() SyncDatabaseIDListResult { - return page.sdilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncDatabaseIDListResultPage) Values() []SyncDatabaseIDProperties { - if page.sdilr.IsEmpty() { - return nil - } - return *page.sdilr.Value -} - -// Creates a new instance of the SyncDatabaseIDListResultPage type. -func NewSyncDatabaseIDListResultPage(cur SyncDatabaseIDListResult, getNextPage func(context.Context, SyncDatabaseIDListResult) (SyncDatabaseIDListResult, error)) SyncDatabaseIDListResultPage { - return SyncDatabaseIDListResultPage{ - fn: getNextPage, - sdilr: cur, - } -} - -// SyncDatabaseIDProperties properties of the sync database id. -type SyncDatabaseIDProperties struct { - // ID - READ-ONLY; ARM resource id of sync database. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncDatabaseIDProperties. -func (sdip SyncDatabaseIDProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncFullSchemaProperties properties of the database full schema. -type SyncFullSchemaProperties struct { - // Tables - READ-ONLY; List of tables in the database full schema. - Tables *[]SyncFullSchemaTable `json:"tables,omitempty"` - // LastUpdateTime - READ-ONLY; Last update time of the database schema. - LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncFullSchemaProperties. -func (sfsp SyncFullSchemaProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncFullSchemaPropertiesListResult a list of sync schema properties. -type SyncFullSchemaPropertiesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncFullSchemaProperties `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncFullSchemaPropertiesListResult. -func (sfsplr SyncFullSchemaPropertiesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncFullSchemaPropertiesListResultIterator provides access to a complete listing of -// SyncFullSchemaProperties values. -type SyncFullSchemaPropertiesListResultIterator struct { - i int - page SyncFullSchemaPropertiesListResultPage -} - -// 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 *SyncFullSchemaPropertiesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncFullSchemaPropertiesListResultIterator.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 *SyncFullSchemaPropertiesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncFullSchemaPropertiesListResultIterator) 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 SyncFullSchemaPropertiesListResultIterator) Response() SyncFullSchemaPropertiesListResult { - 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 SyncFullSchemaPropertiesListResultIterator) Value() SyncFullSchemaProperties { - if !iter.page.NotDone() { - return SyncFullSchemaProperties{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncFullSchemaPropertiesListResultIterator type. -func NewSyncFullSchemaPropertiesListResultIterator(page SyncFullSchemaPropertiesListResultPage) SyncFullSchemaPropertiesListResultIterator { - return SyncFullSchemaPropertiesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sfsplr SyncFullSchemaPropertiesListResult) IsEmpty() bool { - return sfsplr.Value == nil || len(*sfsplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sfsplr SyncFullSchemaPropertiesListResult) hasNextLink() bool { - return sfsplr.NextLink != nil && len(*sfsplr.NextLink) != 0 -} - -// syncFullSchemaPropertiesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sfsplr SyncFullSchemaPropertiesListResult) syncFullSchemaPropertiesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sfsplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sfsplr.NextLink))) -} - -// SyncFullSchemaPropertiesListResultPage contains a page of SyncFullSchemaProperties values. -type SyncFullSchemaPropertiesListResultPage struct { - fn func(context.Context, SyncFullSchemaPropertiesListResult) (SyncFullSchemaPropertiesListResult, error) - sfsplr SyncFullSchemaPropertiesListResult -} - -// 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 *SyncFullSchemaPropertiesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncFullSchemaPropertiesListResultPage.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.sfsplr) - if err != nil { - return err - } - page.sfsplr = 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 *SyncFullSchemaPropertiesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncFullSchemaPropertiesListResultPage) NotDone() bool { - return !page.sfsplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncFullSchemaPropertiesListResultPage) Response() SyncFullSchemaPropertiesListResult { - return page.sfsplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncFullSchemaPropertiesListResultPage) Values() []SyncFullSchemaProperties { - if page.sfsplr.IsEmpty() { - return nil - } - return *page.sfsplr.Value -} - -// Creates a new instance of the SyncFullSchemaPropertiesListResultPage type. -func NewSyncFullSchemaPropertiesListResultPage(cur SyncFullSchemaPropertiesListResult, getNextPage func(context.Context, SyncFullSchemaPropertiesListResult) (SyncFullSchemaPropertiesListResult, error)) SyncFullSchemaPropertiesListResultPage { - return SyncFullSchemaPropertiesListResultPage{ - fn: getNextPage, - sfsplr: cur, - } -} - -// SyncFullSchemaTable properties of the table in the database full schema. -type SyncFullSchemaTable struct { - // Columns - READ-ONLY; List of columns in the table of database full schema. - Columns *[]SyncFullSchemaTableColumn `json:"columns,omitempty"` - // ErrorID - READ-ONLY; Error id of the table. - ErrorID *string `json:"errorId,omitempty"` - // HasError - READ-ONLY; If there is error in the table. - HasError *bool `json:"hasError,omitempty"` - // Name - READ-ONLY; Name of the table. - Name *string `json:"name,omitempty"` - // QuotedName - READ-ONLY; Quoted name of the table. - QuotedName *string `json:"quotedName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncFullSchemaTable. -func (sfst SyncFullSchemaTable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncFullSchemaTableColumn properties of the column in the table of database full schema. -type SyncFullSchemaTableColumn struct { - // DataSize - READ-ONLY; Data size of the column. - DataSize *string `json:"dataSize,omitempty"` - // DataType - READ-ONLY; Data type of the column. - DataType *string `json:"dataType,omitempty"` - // ErrorID - READ-ONLY; Error id of the column. - ErrorID *string `json:"errorId,omitempty"` - // HasError - READ-ONLY; If there is error in the table. - HasError *bool `json:"hasError,omitempty"` - // IsPrimaryKey - READ-ONLY; If it is the primary key of the table. - IsPrimaryKey *bool `json:"isPrimaryKey,omitempty"` - // Name - READ-ONLY; Name of the column. - Name *string `json:"name,omitempty"` - // QuotedName - READ-ONLY; Quoted name of the column. - QuotedName *string `json:"quotedName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncFullSchemaTableColumn. -func (sfstc SyncFullSchemaTableColumn) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncGroup an Azure SQL Database sync group. -type SyncGroup struct { - autorest.Response `json:"-"` - // SyncGroupProperties - Resource properties. - *SyncGroupProperties `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"` -} - -// MarshalJSON is the custom marshaler for SyncGroup. -func (sg SyncGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sg.SyncGroupProperties != nil { - objectMap["properties"] = sg.SyncGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SyncGroup struct. -func (sg *SyncGroup) 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 syncGroupProperties SyncGroupProperties - err = json.Unmarshal(*v, &syncGroupProperties) - if err != nil { - return err - } - sg.SyncGroupProperties = &syncGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sg.Type = &typeVar - } - } - } - - return nil -} - -// SyncGroupListResult a list of sync groups. -type SyncGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncGroupListResult. -func (sglr SyncGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncGroupListResultIterator provides access to a complete listing of SyncGroup values. -type SyncGroupListResultIterator struct { - i int - page SyncGroupListResultPage -} - -// 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 *SyncGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupListResultIterator.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 *SyncGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncGroupListResultIterator) 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 SyncGroupListResultIterator) Response() SyncGroupListResult { - 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 SyncGroupListResultIterator) Value() SyncGroup { - if !iter.page.NotDone() { - return SyncGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncGroupListResultIterator type. -func NewSyncGroupListResultIterator(page SyncGroupListResultPage) SyncGroupListResultIterator { - return SyncGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sglr SyncGroupListResult) IsEmpty() bool { - return sglr.Value == nil || len(*sglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sglr SyncGroupListResult) hasNextLink() bool { - return sglr.NextLink != nil && len(*sglr.NextLink) != 0 -} - -// syncGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sglr SyncGroupListResult) syncGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sglr.NextLink))) -} - -// SyncGroupListResultPage contains a page of SyncGroup values. -type SyncGroupListResultPage struct { - fn func(context.Context, SyncGroupListResult) (SyncGroupListResult, error) - sglr SyncGroupListResult -} - -// 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 *SyncGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupListResultPage.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.sglr) - if err != nil { - return err - } - page.sglr = 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 *SyncGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncGroupListResultPage) NotDone() bool { - return !page.sglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncGroupListResultPage) Response() SyncGroupListResult { - return page.sglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncGroupListResultPage) Values() []SyncGroup { - if page.sglr.IsEmpty() { - return nil - } - return *page.sglr.Value -} - -// Creates a new instance of the SyncGroupListResultPage type. -func NewSyncGroupListResultPage(cur SyncGroupListResult, getNextPage func(context.Context, SyncGroupListResult) (SyncGroupListResult, error)) SyncGroupListResultPage { - return SyncGroupListResultPage{ - fn: getNextPage, - sglr: cur, - } -} - -// SyncGroupLogListResult a list of sync group log properties. -type SyncGroupLogListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncGroupLogProperties `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncGroupLogListResult. -func (sgllr SyncGroupLogListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncGroupLogListResultIterator provides access to a complete listing of SyncGroupLogProperties values. -type SyncGroupLogListResultIterator struct { - i int - page SyncGroupLogListResultPage -} - -// 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 *SyncGroupLogListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupLogListResultIterator.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 *SyncGroupLogListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncGroupLogListResultIterator) 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 SyncGroupLogListResultIterator) Response() SyncGroupLogListResult { - 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 SyncGroupLogListResultIterator) Value() SyncGroupLogProperties { - if !iter.page.NotDone() { - return SyncGroupLogProperties{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncGroupLogListResultIterator type. -func NewSyncGroupLogListResultIterator(page SyncGroupLogListResultPage) SyncGroupLogListResultIterator { - return SyncGroupLogListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sgllr SyncGroupLogListResult) IsEmpty() bool { - return sgllr.Value == nil || len(*sgllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sgllr SyncGroupLogListResult) hasNextLink() bool { - return sgllr.NextLink != nil && len(*sgllr.NextLink) != 0 -} - -// syncGroupLogListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sgllr SyncGroupLogListResult) syncGroupLogListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sgllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sgllr.NextLink))) -} - -// SyncGroupLogListResultPage contains a page of SyncGroupLogProperties values. -type SyncGroupLogListResultPage struct { - fn func(context.Context, SyncGroupLogListResult) (SyncGroupLogListResult, error) - sgllr SyncGroupLogListResult -} - -// 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 *SyncGroupLogListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupLogListResultPage.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.sgllr) - if err != nil { - return err - } - page.sgllr = 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 *SyncGroupLogListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncGroupLogListResultPage) NotDone() bool { - return !page.sgllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncGroupLogListResultPage) Response() SyncGroupLogListResult { - return page.sgllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncGroupLogListResultPage) Values() []SyncGroupLogProperties { - if page.sgllr.IsEmpty() { - return nil - } - return *page.sgllr.Value -} - -// Creates a new instance of the SyncGroupLogListResultPage type. -func NewSyncGroupLogListResultPage(cur SyncGroupLogListResult, getNextPage func(context.Context, SyncGroupLogListResult) (SyncGroupLogListResult, error)) SyncGroupLogListResultPage { - return SyncGroupLogListResultPage{ - fn: getNextPage, - sgllr: cur, - } -} - -// SyncGroupLogProperties properties of an Azure SQL Database sync group log. -type SyncGroupLogProperties struct { - // Timestamp - READ-ONLY; Timestamp of the sync group log. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Type - READ-ONLY; Type of the sync group log. Possible values include: 'SyncGroupLogTypeAll', 'SyncGroupLogTypeError', 'SyncGroupLogTypeWarning', 'SyncGroupLogTypeSuccess' - Type SyncGroupLogType `json:"type,omitempty"` - // Source - READ-ONLY; Source of the sync group log. - Source *string `json:"source,omitempty"` - // Details - READ-ONLY; Details of the sync group log. - Details *string `json:"details,omitempty"` - // TracingID - READ-ONLY; TracingId of the sync group log. - TracingID *uuid.UUID `json:"tracingId,omitempty"` - // OperationStatus - READ-ONLY; OperationStatus of the sync group log. - OperationStatus *string `json:"operationStatus,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncGroupLogProperties. -func (sglp SyncGroupLogProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncGroupProperties properties of a sync group. -type SyncGroupProperties struct { - // Interval - Sync interval of the sync group. - Interval *int32 `json:"interval,omitempty"` - // LastSyncTime - READ-ONLY; Last sync time of the sync group. - LastSyncTime *date.Time `json:"lastSyncTime,omitempty"` - // ConflictResolutionPolicy - Conflict resolution policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - ConflictResolutionPolicy SyncConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // SyncDatabaseID - ARM resource id of the sync database in the sync group. - SyncDatabaseID *string `json:"syncDatabaseId,omitempty"` - // HubDatabaseUserName - User name for the sync group hub database credential. - HubDatabaseUserName *string `json:"hubDatabaseUserName,omitempty"` - // HubDatabasePassword - Password for the sync group hub database credential. - HubDatabasePassword *string `json:"hubDatabasePassword,omitempty"` - // SyncState - READ-ONLY; Sync state of the sync group. Possible values include: 'NotReady', 'Error', 'Warning', 'Progressing', 'Good' - SyncState SyncGroupState `json:"syncState,omitempty"` - // Schema - Sync schema of the sync group. - Schema *SyncGroupSchema `json:"schema,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncGroupProperties. -func (sgp SyncGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sgp.Interval != nil { - objectMap["interval"] = sgp.Interval - } - if sgp.ConflictResolutionPolicy != "" { - objectMap["conflictResolutionPolicy"] = sgp.ConflictResolutionPolicy - } - if sgp.SyncDatabaseID != nil { - objectMap["syncDatabaseId"] = sgp.SyncDatabaseID - } - if sgp.HubDatabaseUserName != nil { - objectMap["hubDatabaseUserName"] = sgp.HubDatabaseUserName - } - if sgp.HubDatabasePassword != nil { - objectMap["hubDatabasePassword"] = sgp.HubDatabasePassword - } - if sgp.Schema != nil { - objectMap["schema"] = sgp.Schema - } - return json.Marshal(objectMap) -} - -// SyncGroupSchema properties of sync group schema. -type SyncGroupSchema struct { - // Tables - List of tables in sync group schema. - Tables *[]SyncGroupSchemaTable `json:"tables,omitempty"` - // MasterSyncMemberName - Name of master sync member where the schema is from. - MasterSyncMemberName *string `json:"masterSyncMemberName,omitempty"` -} - -// SyncGroupSchemaTable properties of table in sync group schema. -type SyncGroupSchemaTable struct { - // Columns - List of columns in sync group schema. - Columns *[]SyncGroupSchemaTableColumn `json:"columns,omitempty"` - // QuotedName - Quoted name of sync group schema table. - QuotedName *string `json:"quotedName,omitempty"` -} - -// SyncGroupSchemaTableColumn properties of column in sync group table. -type SyncGroupSchemaTableColumn struct { - // QuotedName - Quoted name of sync group table column. - QuotedName *string `json:"quotedName,omitempty"` - // DataSize - Data size of the column. - DataSize *string `json:"dataSize,omitempty"` - // DataType - Data type of the column. - DataType *string `json:"dataType,omitempty"` -} - -// SyncGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncGroupsClient) (SyncGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncGroupsCreateOrUpdateFuture) 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 SyncGroupsCreateOrUpdateFuture.Result. -func (future *SyncGroupsCreateOrUpdateFuture) result(client SyncGroupsClient) (sg SyncGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { - sg, err = client.CreateOrUpdateResponder(sg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") - } - } - return -} - -// SyncGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncGroupsDeleteFuture) 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 SyncGroupsDeleteFuture.Result. -func (future *SyncGroupsDeleteFuture) result(client SyncGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncGroupsRefreshHubSchemaFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncGroupsRefreshHubSchemaFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncGroupsRefreshHubSchemaFuture) 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 SyncGroupsRefreshHubSchemaFuture.Result. -func (future *SyncGroupsRefreshHubSchemaFuture) result(client SyncGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsRefreshHubSchemaFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsRefreshHubSchemaFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncGroupsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncGroupsClient) (SyncGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncGroupsUpdateFuture) 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 SyncGroupsUpdateFuture.Result. -func (future *SyncGroupsUpdateFuture) result(client SyncGroupsClient) (sg SyncGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { - sg, err = client.UpdateResponder(sg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") - } - } - return -} - -// SyncMember an Azure SQL Database sync member. -type SyncMember struct { - autorest.Response `json:"-"` - // SyncMemberProperties - Resource properties. - *SyncMemberProperties `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"` -} - -// MarshalJSON is the custom marshaler for SyncMember. -func (sm SyncMember) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sm.SyncMemberProperties != nil { - objectMap["properties"] = sm.SyncMemberProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SyncMember struct. -func (sm *SyncMember) 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 syncMemberProperties SyncMemberProperties - err = json.Unmarshal(*v, &syncMemberProperties) - if err != nil { - return err - } - sm.SyncMemberProperties = &syncMemberProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sm.Type = &typeVar - } - } - } - - return nil -} - -// SyncMemberListResult a list of Azure SQL Database sync members. -type SyncMemberListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncMember `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncMemberListResult. -func (smlr SyncMemberListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncMemberListResultIterator provides access to a complete listing of SyncMember values. -type SyncMemberListResultIterator struct { - i int - page SyncMemberListResultPage -} - -// 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 *SyncMemberListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMemberListResultIterator.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 *SyncMemberListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncMemberListResultIterator) 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 SyncMemberListResultIterator) Response() SyncMemberListResult { - 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 SyncMemberListResultIterator) Value() SyncMember { - if !iter.page.NotDone() { - return SyncMember{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncMemberListResultIterator type. -func NewSyncMemberListResultIterator(page SyncMemberListResultPage) SyncMemberListResultIterator { - return SyncMemberListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (smlr SyncMemberListResult) IsEmpty() bool { - return smlr.Value == nil || len(*smlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (smlr SyncMemberListResult) hasNextLink() bool { - return smlr.NextLink != nil && len(*smlr.NextLink) != 0 -} - -// syncMemberListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (smlr SyncMemberListResult) syncMemberListResultPreparer(ctx context.Context) (*http.Request, error) { - if !smlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(smlr.NextLink))) -} - -// SyncMemberListResultPage contains a page of SyncMember values. -type SyncMemberListResultPage struct { - fn func(context.Context, SyncMemberListResult) (SyncMemberListResult, error) - smlr SyncMemberListResult -} - -// 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 *SyncMemberListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMemberListResultPage.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.smlr) - if err != nil { - return err - } - page.smlr = 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 *SyncMemberListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncMemberListResultPage) NotDone() bool { - return !page.smlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncMemberListResultPage) Response() SyncMemberListResult { - return page.smlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncMemberListResultPage) Values() []SyncMember { - if page.smlr.IsEmpty() { - return nil - } - return *page.smlr.Value -} - -// Creates a new instance of the SyncMemberListResultPage type. -func NewSyncMemberListResultPage(cur SyncMemberListResult, getNextPage func(context.Context, SyncMemberListResult) (SyncMemberListResult, error)) SyncMemberListResultPage { - return SyncMemberListResultPage{ - fn: getNextPage, - smlr: cur, - } -} - -// SyncMemberProperties properties of a sync member. -type SyncMemberProperties struct { - // DatabaseType - Database type of the sync member. Possible values include: 'AzureSQLDatabase', 'SQLServerDatabase' - DatabaseType SyncMemberDbType `json:"databaseType,omitempty"` - // SyncAgentID - ARM resource id of the sync agent in the sync member. - SyncAgentID *string `json:"syncAgentId,omitempty"` - // SQLServerDatabaseID - SQL Server database id of the sync member. - SQLServerDatabaseID *uuid.UUID `json:"sqlServerDatabaseId,omitempty"` - // ServerName - Server name of the member database in the sync member - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - Database name of the member database in the sync member. - DatabaseName *string `json:"databaseName,omitempty"` - // UserName - User name of the member database in the sync member. - UserName *string `json:"userName,omitempty"` - // Password - Password of the member database in the sync member. - Password *string `json:"password,omitempty"` - // SyncDirection - Sync direction of the sync member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember' - SyncDirection SyncDirection `json:"syncDirection,omitempty"` - // SyncState - READ-ONLY; Sync state of the sync member. Possible values include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', 'DisabledTombstoneCleanup', 'DisabledBackupRestore', 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned' - SyncState SyncMemberState `json:"syncState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncMemberProperties. -func (smp SyncMemberProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smp.DatabaseType != "" { - objectMap["databaseType"] = smp.DatabaseType - } - if smp.SyncAgentID != nil { - objectMap["syncAgentId"] = smp.SyncAgentID - } - if smp.SQLServerDatabaseID != nil { - objectMap["sqlServerDatabaseId"] = smp.SQLServerDatabaseID - } - if smp.ServerName != nil { - objectMap["serverName"] = smp.ServerName - } - if smp.DatabaseName != nil { - objectMap["databaseName"] = smp.DatabaseName - } - if smp.UserName != nil { - objectMap["userName"] = smp.UserName - } - if smp.Password != nil { - objectMap["password"] = smp.Password - } - if smp.SyncDirection != "" { - objectMap["syncDirection"] = smp.SyncDirection - } - return json.Marshal(objectMap) -} - -// SyncMembersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncMembersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncMembersClient) (SyncMember, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncMembersCreateOrUpdateFuture) 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 SyncMembersCreateOrUpdateFuture.Result. -func (future *SyncMembersCreateOrUpdateFuture) result(client SyncMembersClient) (sm SyncMember, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncMembersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.CreateOrUpdateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// SyncMembersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncMembersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncMembersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncMembersDeleteFuture) 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 SyncMembersDeleteFuture.Result. -func (future *SyncMembersDeleteFuture) result(client SyncMembersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncMembersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncMembersRefreshMemberSchemaFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncMembersRefreshMemberSchemaFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncMembersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncMembersRefreshMemberSchemaFuture) 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 SyncMembersRefreshMemberSchemaFuture.Result. -func (future *SyncMembersRefreshMemberSchemaFuture) result(client SyncMembersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersRefreshMemberSchemaFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncMembersRefreshMemberSchemaFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncMembersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncMembersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncMembersClient) (SyncMember, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncMembersUpdateFuture) 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 SyncMembersUpdateFuture.Result. -func (future *SyncMembersUpdateFuture) result(client SyncMembersClient) (sm SyncMember, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncMembersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.UpdateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// TrackedResource 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"` -} - -// 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) -} - -// TransparentDataEncryption represents a database transparent data encryption configuration. -type TransparentDataEncryption struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // TransparentDataEncryptionProperties - Represents the properties of the resource. - *TransparentDataEncryptionProperties `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"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryption. -func (tde TransparentDataEncryption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tde.TransparentDataEncryptionProperties != nil { - objectMap["properties"] = tde.TransparentDataEncryptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryption struct. -func (tde *TransparentDataEncryption) 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 - } - tde.Location = &location - } - case "properties": - if v != nil { - var transparentDataEncryptionProperties TransparentDataEncryptionProperties - err = json.Unmarshal(*v, &transparentDataEncryptionProperties) - if err != nil { - return err - } - tde.TransparentDataEncryptionProperties = &transparentDataEncryptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tde.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tde.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tde.Type = &typeVar - } - } - } - - return nil -} - -// TransparentDataEncryptionActivity represents a database transparent data encryption Scan. -type TransparentDataEncryptionActivity struct { - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // TransparentDataEncryptionActivityProperties - Represents the properties of the resource. - *TransparentDataEncryptionActivityProperties `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"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryptionActivity. -func (tdea TransparentDataEncryptionActivity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tdea.TransparentDataEncryptionActivityProperties != nil { - objectMap["properties"] = tdea.TransparentDataEncryptionActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryptionActivity struct. -func (tdea *TransparentDataEncryptionActivity) 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 - } - tdea.Location = &location - } - case "properties": - if v != nil { - var transparentDataEncryptionActivityProperties TransparentDataEncryptionActivityProperties - err = json.Unmarshal(*v, &transparentDataEncryptionActivityProperties) - if err != nil { - return err - } - tdea.TransparentDataEncryptionActivityProperties = &transparentDataEncryptionActivityProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tdea.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tdea.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tdea.Type = &typeVar - } - } - } - - return nil -} - -// TransparentDataEncryptionActivityListResult represents the response to a list database transparent data -// encryption activity request. -type TransparentDataEncryptionActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of database transparent data encryption activities. - Value *[]TransparentDataEncryptionActivity `json:"value,omitempty"` -} - -// TransparentDataEncryptionActivityProperties represents the properties of a database transparent data -// encryption Scan. -type TransparentDataEncryptionActivityProperties struct { - // Status - READ-ONLY; The status of the database. Possible values include: 'Encrypting', 'Decrypting' - Status TransparentDataEncryptionActivityStatus `json:"status,omitempty"` - // PercentComplete - READ-ONLY; The percent complete of the transparent data encryption scan for a database. - PercentComplete *float64 `json:"percentComplete,omitempty"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryptionActivityProperties. -func (tdeap TransparentDataEncryptionActivityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TransparentDataEncryptionProperties represents the properties of a database transparent data encryption. -type TransparentDataEncryptionProperties struct { - // Status - The status of the database transparent data encryption. Possible values include: 'TransparentDataEncryptionStatusEnabled', 'TransparentDataEncryptionStatusDisabled' - Status TransparentDataEncryptionStatus `json:"status,omitempty"` -} - -// UnlinkParameters represents the parameters for Unlink Replication Link request. -type UnlinkParameters struct { - // ForcedTermination - Determines whether link will be terminated in a forced or a friendly way. - ForcedTermination *bool `json:"forcedTermination,omitempty"` -} - -// VirtualCluster an Azure SQL virtual cluster. -type VirtualCluster struct { - autorest.Response `json:"-"` - // VirtualClusterProperties - Resource properties. - *VirtualClusterProperties `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"` -} - -// MarshalJSON is the custom marshaler for VirtualCluster. -func (vc VirtualCluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vc.VirtualClusterProperties != nil { - objectMap["properties"] = vc.VirtualClusterProperties - } - if vc.Location != nil { - objectMap["location"] = vc.Location - } - if vc.Tags != nil { - objectMap["tags"] = vc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualCluster struct. -func (vc *VirtualCluster) 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 virtualClusterProperties VirtualClusterProperties - err = json.Unmarshal(*v, &virtualClusterProperties) - if err != nil { - return err - } - vc.VirtualClusterProperties = &virtualClusterProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vc.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vc.Type = &typeVar - } - } - } - - return nil -} - -// VirtualClusterListResult a list of virtual clusters. -type VirtualClusterListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VirtualCluster `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualClusterListResult. -func (vclr VirtualClusterListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualClusterListResultIterator provides access to a complete listing of VirtualCluster values. -type VirtualClusterListResultIterator struct { - i int - page VirtualClusterListResultPage -} - -// 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 *VirtualClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClusterListResultIterator.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 *VirtualClusterListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualClusterListResultIterator) 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 VirtualClusterListResultIterator) Response() VirtualClusterListResult { - 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 VirtualClusterListResultIterator) Value() VirtualCluster { - if !iter.page.NotDone() { - return VirtualCluster{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualClusterListResultIterator type. -func NewVirtualClusterListResultIterator(page VirtualClusterListResultPage) VirtualClusterListResultIterator { - return VirtualClusterListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vclr VirtualClusterListResult) IsEmpty() bool { - return vclr.Value == nil || len(*vclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vclr VirtualClusterListResult) hasNextLink() bool { - return vclr.NextLink != nil && len(*vclr.NextLink) != 0 -} - -// virtualClusterListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vclr VirtualClusterListResult) virtualClusterListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vclr.NextLink))) -} - -// VirtualClusterListResultPage contains a page of VirtualCluster values. -type VirtualClusterListResultPage struct { - fn func(context.Context, VirtualClusterListResult) (VirtualClusterListResult, error) - vclr VirtualClusterListResult -} - -// 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 *VirtualClusterListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClusterListResultPage.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.vclr) - if err != nil { - return err - } - page.vclr = 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 *VirtualClusterListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualClusterListResultPage) NotDone() bool { - return !page.vclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualClusterListResultPage) Response() VirtualClusterListResult { - return page.vclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualClusterListResultPage) Values() []VirtualCluster { - if page.vclr.IsEmpty() { - return nil - } - return *page.vclr.Value -} - -// Creates a new instance of the VirtualClusterListResultPage type. -func NewVirtualClusterListResultPage(cur VirtualClusterListResult, getNextPage func(context.Context, VirtualClusterListResult) (VirtualClusterListResult, error)) VirtualClusterListResultPage { - return VirtualClusterListResultPage{ - fn: getNextPage, - vclr: cur, - } -} - -// VirtualClusterProperties the properties of a virtual cluster. -type VirtualClusterProperties struct { - // SubnetID - READ-ONLY; Subnet resource ID for the virtual cluster. - SubnetID *string `json:"subnetId,omitempty"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // ChildResources - READ-ONLY; List of resources in this virtual cluster. - ChildResources *[]string `json:"childResources,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualClusterProperties. -func (vcp VirtualClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcp.Family != nil { - objectMap["family"] = vcp.Family - } - return json.Marshal(objectMap) -} - -// VirtualClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualClustersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualClustersDeleteFuture) 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 VirtualClustersDeleteFuture.Result. -func (future *VirtualClustersDeleteFuture) result(client VirtualClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.VirtualClustersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualClustersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualClustersClient) (VirtualCluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualClustersUpdateFuture) 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 VirtualClustersUpdateFuture.Result. -func (future *VirtualClustersUpdateFuture) result(client VirtualClustersClient) (vc VirtualCluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.VirtualClustersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vc.Response.Response, err = future.GetResult(sender); err == nil && vc.Response.Response.StatusCode != http.StatusNoContent { - vc, err = client.UpdateResponder(vc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersUpdateFuture", "Result", vc.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualClusterUpdate an update request for an Azure SQL Database virtual cluster. -type VirtualClusterUpdate struct { - // VirtualClusterProperties - Resource properties. - *VirtualClusterProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualClusterUpdate. -func (vcu VirtualClusterUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcu.VirtualClusterProperties != nil { - objectMap["properties"] = vcu.VirtualClusterProperties - } - if vcu.Tags != nil { - objectMap["tags"] = vcu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualClusterUpdate struct. -func (vcu *VirtualClusterUpdate) 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 virtualClusterProperties VirtualClusterProperties - err = json.Unmarshal(*v, &virtualClusterProperties) - if err != nil { - return err - } - vcu.VirtualClusterProperties = &virtualClusterProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vcu.Tags = tags - } - } - } - - return nil -} - -// VirtualNetworkRule a virtual network rule. -type VirtualNetworkRule struct { - autorest.Response `json:"-"` - // VirtualNetworkRuleProperties - Resource properties. - *VirtualNetworkRuleProperties `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"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRule. -func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnr.VirtualNetworkRuleProperties != nil { - objectMap["properties"] = vnr.VirtualNetworkRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. -func (vnr *VirtualNetworkRule) 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 virtualNetworkRuleProperties VirtualNetworkRuleProperties - err = json.Unmarshal(*v, &virtualNetworkRuleProperties) - if err != nil { - return err - } - vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vnr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vnr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vnr.Type = &typeVar - } - } - } - - return nil -} - -// VirtualNetworkRuleListResult a list of virtual network rules. -type VirtualNetworkRuleListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VirtualNetworkRule `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleListResult. -func (vnrlr VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. -type VirtualNetworkRuleListResultIterator struct { - i int - page VirtualNetworkRuleListResultPage -} - -// 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 *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.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 *VirtualNetworkRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkRuleListResultIterator) 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 VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { - 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 VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { - if !iter.page.NotDone() { - return VirtualNetworkRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkRuleListResultIterator type. -func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator { - return VirtualNetworkRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { - return vnrlr.Value == nil || len(*vnrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnrlr VirtualNetworkRuleListResult) hasNextLink() bool { - return vnrlr.NextLink != nil && len(*vnrlr.NextLink) != 0 -} - -// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnrlr.NextLink))) -} - -// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. -type VirtualNetworkRuleListResultPage struct { - fn func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) - vnrlr VirtualNetworkRuleListResult -} - -// 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 *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.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.vnrlr) - if err != nil { - return err - } - page.vnrlr = 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 *VirtualNetworkRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkRuleListResultPage) NotDone() bool { - return !page.vnrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { - return page.vnrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { - if page.vnrlr.IsEmpty() { - return nil - } - return *page.vnrlr.Value -} - -// Creates a new instance of the VirtualNetworkRuleListResultPage type. -func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage { - return VirtualNetworkRuleListResultPage{ - fn: getNextPage, - vnrlr: cur, - } -} - -// VirtualNetworkRuleProperties properties of a virtual network rule. -type VirtualNetworkRuleProperties struct { - // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. - VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` - // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` - // State - READ-ONLY; Virtual Network Rule State. Possible values include: 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' - State VirtualNetworkRuleState `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleProperties. -func (vnrp VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnrp.VirtualNetworkSubnetID != nil { - objectMap["virtualNetworkSubnetId"] = vnrp.VirtualNetworkSubnetID - } - if vnrp.IgnoreMissingVnetServiceEndpoint != nil { - objectMap["ignoreMissingVnetServiceEndpoint"] = vnrp.IgnoreMissingVnetServiceEndpoint - } - return json.Marshal(objectMap) -} - -// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (VirtualNetworkRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) 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 VirtualNetworkRulesCreateOrUpdateFuture.Result. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vnr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { - vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesDeleteFuture) 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 VirtualNetworkRulesDeleteFuture.Result. -func (future *VirtualNetworkRulesDeleteFuture) result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/operations.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/operations.go deleted file mode 100644 index 8d4ac613b1ce..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/operations.go +++ /dev/null @@ -1,142 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -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 SQL 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, "sql.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, "sql.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.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-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Sql/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, "sql.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, "sql.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.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/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go deleted file mode 100644 index ef56a498903f..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/recoverabledatabases.go +++ /dev/null @@ -1,190 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RecoverableDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type RecoverableDatabasesClient struct { - BaseClient -} - -// NewRecoverableDatabasesClient creates an instance of the RecoverableDatabasesClient client. -func NewRecoverableDatabasesClient(subscriptionID string) RecoverableDatabasesClient { - return NewRecoverableDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecoverableDatabasesClientWithBaseURI creates an instance of the RecoverableDatabasesClient 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 NewRecoverableDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RecoverableDatabasesClient { - return RecoverableDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a recoverable database, which is a resource representing a database's geo backup -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database -func (client RecoverableDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result RecoverableDatabase, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableDatabasesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecoverableDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/recoverableDatabases/{databaseName}", 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 RecoverableDatabasesClient) 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 RecoverableDatabasesClient) GetResponder(resp *http.Response) (result RecoverableDatabase, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of recoverable databases -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client RecoverableDatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RecoverableDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableDatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RecoverableDatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/recoverableDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RecoverableDatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RecoverableDatabasesClient) ListByServerResponder(resp *http.Response) (result RecoverableDatabaseListResult, 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/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go deleted file mode 100644 index 861e0db43427..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/replicationlinks.go +++ /dev/null @@ -1,527 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReplicationLinksClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ReplicationLinksClient struct { - BaseClient -} - -// NewReplicationLinksClient creates an instance of the ReplicationLinksClient client. -func NewReplicationLinksClient(subscriptionID string) ReplicationLinksClient { - return NewReplicationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationLinksClientWithBaseURI creates an instance of the ReplicationLinksClient 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 NewReplicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ReplicationLinksClient { - return ReplicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes a database replication link. Cannot be done during failover. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be dropped. -// linkID - the ID of the replication link to be deleted. -func (client ReplicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ReplicationLinksClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", 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 ReplicationLinksClient) 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 ReplicationLinksClient) 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 -} - -// Failover sets which replica database is primary by failing over from the current primary replica database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be failed over. -// linkID - the ID of the replication link to be failed over. -func (client ReplicationLinksClient) Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLinksFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.Failover") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client ReplicationLinksClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationLinksClient) FailoverSender(req *http.Request) (future ReplicationLinksFailoverFuture, 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 -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client ReplicationLinksClient) FailoverResponder(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 -} - -// FailoverAllowDataLoss sets which replica database is primary by failing over from the current primary replica -// database. This operation might result in data loss. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be failed over. -// linkID - the ID of the replication link to be failed over. -func (client ReplicationLinksClient) FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLinksFailoverAllowDataLossFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.FailoverAllowDataLoss") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverAllowDataLossPreparer(ctx, resourceGroupName, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "FailoverAllowDataLoss", nil, "Failure preparing request") - return - } - - result, err = client.FailoverAllowDataLossSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "FailoverAllowDataLoss", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverAllowDataLossPreparer prepares the FailoverAllowDataLoss request. -func (client ReplicationLinksClient) FailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverAllowDataLossSender sends the FailoverAllowDataLoss request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationLinksClient) FailoverAllowDataLossSender(req *http.Request) (future ReplicationLinksFailoverAllowDataLossFuture, 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 -} - -// FailoverAllowDataLossResponder handles the response to the FailoverAllowDataLoss request. The method always -// closes the http.Response Body. -func (client ReplicationLinksClient) FailoverAllowDataLossResponder(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 a database replication link. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to get the link for. -// linkID - the replication link ID to be retrieved. -func (client ReplicationLinksClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLink, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.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, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicationLinksClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", 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 ReplicationLinksClient) 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 ReplicationLinksClient) GetResponder(resp *http.Response) (result ReplicationLink, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists a database's replication links. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to retrieve links for. -func (client ReplicationLinksClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ReplicationLinkListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ReplicationLinksClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationLinksClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ReplicationLinksClient) ListByDatabaseResponder(resp *http.Response) (result ReplicationLinkListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Unlink deletes a database replication link in forced or friendly way. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be failed over. -// linkID - the ID of the replication link to be failed over. -// parameters - the required parameters for unlinking replication link. -func (client ReplicationLinksClient) Unlink(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, parameters UnlinkParameters) (result ReplicationLinksUnlinkFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.Unlink") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UnlinkPreparer(ctx, resourceGroupName, serverName, databaseName, linkID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Unlink", nil, "Failure preparing request") - return - } - - result, err = client.UnlinkSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Unlink", result.Response(), "Failure sending request") - return - } - - return -} - -// UnlinkPreparer prepares the Unlink request. -func (client ReplicationLinksClient) UnlinkPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, parameters UnlinkParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UnlinkSender sends the Unlink request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationLinksClient) UnlinkSender(req *http.Request) (future ReplicationLinksUnlinkFuture, 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 -} - -// UnlinkResponder handles the response to the Unlink request. The method always -// closes the http.Response Body. -func (client ReplicationLinksClient) UnlinkResponder(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/preview/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go deleted file mode 100644 index 7298ef0b736f..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/restorabledroppeddatabases.go +++ /dev/null @@ -1,191 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableDroppedDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type RestorableDroppedDatabasesClient struct { - BaseClient -} - -// NewRestorableDroppedDatabasesClient creates an instance of the RestorableDroppedDatabasesClient client. -func NewRestorableDroppedDatabasesClient(subscriptionID string) RestorableDroppedDatabasesClient { - return NewRestorableDroppedDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableDroppedDatabasesClientWithBaseURI creates an instance of the RestorableDroppedDatabasesClient 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 NewRestorableDroppedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableDroppedDatabasesClient { - return RestorableDroppedDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a deleted database that can be restored -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// restorableDroppededDatabaseID - the id of the deleted database in the form of -// databaseName,deletionTimeInFileTimeFormat -func (client RestorableDroppedDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (result RestorableDroppedDatabase, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedDatabasesClient.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, serverName, restorableDroppededDatabaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RestorableDroppedDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorableDroppededDatabaseId": autorest.Encode("path", restorableDroppededDatabaseID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}", 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 RestorableDroppedDatabasesClient) 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 RestorableDroppedDatabasesClient) GetResponder(resp *http.Response) (result RestorableDroppedDatabase, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of deleted databases that can be restored -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client RestorableDroppedDatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RestorableDroppedDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedDatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RestorableDroppedDatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/restorableDroppedDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableDroppedDatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RestorableDroppedDatabasesClient) ListByServerResponder(resp *http.Response) (result RestorableDroppedDatabaseListResult, 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/sql/mgmt/2015-05-01-preview/sql/restorepoints.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/restorepoints.go deleted file mode 100644 index 38a54b5ca621..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/restorepoints.go +++ /dev/null @@ -1,112 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorePointsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type RestorePointsClient struct { - BaseClient -} - -// NewRestorePointsClient creates an instance of the RestorePointsClient client. -func NewRestorePointsClient(subscriptionID string) RestorePointsClient { - return NewRestorePointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorePointsClientWithBaseURI creates an instance of the RestorePointsClient 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 NewRestorePointsClientWithBaseURI(baseURI string, subscriptionID string) RestorePointsClient { - return RestorePointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByDatabase gets a list of database restore points. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to get available restore points. -func (client RestorePointsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result RestorePointListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointsClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client RestorePointsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/restorePoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client RestorePointsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client RestorePointsClient) ListByDatabaseResponder(resp *http.Response) (result RestorePointListResult, 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/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go deleted file mode 100644 index 0be847c6534e..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/serverazureadadministrators.go +++ /dev/null @@ -1,367 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerAzureADAdministratorsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ServerAzureADAdministratorsClient struct { - BaseClient -} - -// NewServerAzureADAdministratorsClient creates an instance of the ServerAzureADAdministratorsClient client. -func NewServerAzureADAdministratorsClient(subscriptionID string) ServerAzureADAdministratorsClient { - return NewServerAzureADAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerAzureADAdministratorsClientWithBaseURI creates an instance of the ServerAzureADAdministratorsClient 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 NewServerAzureADAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAzureADAdministratorsClient { - return ServerAzureADAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new Server Active Directory Administrator or updates an existing server Active Directory -// Administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// properties - the required parameters for creating or updating an Active Directory Administrator. -func (client ServerAzureADAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties ServerAzureADAdministrator) (result ServerAzureADAdministratorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.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: properties, - Constraints: []validation.Constraint{{Target: "properties.ServerAdministratorProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "properties.ServerAdministratorProperties.AdministratorType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "properties.ServerAdministratorProperties.Login", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "properties.ServerAdministratorProperties.Sid", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "properties.ServerAdministratorProperties.TenantID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.ServerAzureADAdministratorsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, properties) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerAzureADAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, properties ServerAzureADAdministrator) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", "activeDirectory"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/administrators/{administratorName}", pathParameters), - autorest.WithJSON(properties), - 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 ServerAzureADAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ServerAzureADAdministratorsCreateOrUpdateFuture, 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 ServerAzureADAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerAzureADAdministrator, 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 server Active Directory Administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAzureADAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADAdministratorsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerAzureADAdministratorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", "activeDirectory"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/administrators/{administratorName}", 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 ServerAzureADAdministratorsClient) DeleteSender(req *http.Request) (future ServerAzureADAdministratorsDeleteFuture, 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 ServerAzureADAdministratorsClient) DeleteResponder(resp *http.Response) (result ServerAzureADAdministrator, 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 -} - -// Get returns an server Administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAzureADAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADAdministrator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerAzureADAdministratorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", "activeDirectory"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/administrators/{administratorName}", 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 ServerAzureADAdministratorsClient) 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 ServerAzureADAdministratorsClient) GetResponder(resp *http.Response) (result ServerAzureADAdministrator, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns a list of server Administrators. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAzureADAdministratorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerAzureADAdministratorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/administrators", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAzureADAdministratorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerAzureADAdministratorsClient) ListByServerResponder(resp *http.Response) (result ServerAdministratorListResult, 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/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go deleted file mode 100644 index cb24bd7204fc..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/servercommunicationlinks.go +++ /dev/null @@ -1,363 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerCommunicationLinksClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type ServerCommunicationLinksClient struct { - BaseClient -} - -// NewServerCommunicationLinksClient creates an instance of the ServerCommunicationLinksClient client. -func NewServerCommunicationLinksClient(subscriptionID string) ServerCommunicationLinksClient { - return NewServerCommunicationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerCommunicationLinksClientWithBaseURI creates an instance of the ServerCommunicationLinksClient 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 NewServerCommunicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ServerCommunicationLinksClient { - return ServerCommunicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a server communication link. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// communicationLinkName - the name of the server communication link. -// parameters - the required parameters for creating a server communication link. -func (client ServerCommunicationLinksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink) (result ServerCommunicationLinksCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServerCommunicationLinkProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServerCommunicationLinkProperties.PartnerServer", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ServerCommunicationLinksClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, communicationLinkName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerCommunicationLinksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationLinkName": autorest.Encode("path", communicationLinkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.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.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", 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 ServerCommunicationLinksClient) CreateOrUpdateSender(req *http.Request) (future ServerCommunicationLinksCreateOrUpdateFuture, 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 ServerCommunicationLinksClient) CreateOrUpdateResponder(resp *http.Response) (result ServerCommunicationLink, 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 a server communication link. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// communicationLinkName - the name of the server communication link. -func (client ServerCommunicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, communicationLinkName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerCommunicationLinksClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationLinkName": autorest.Encode("path", communicationLinkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", 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 ServerCommunicationLinksClient) 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 ServerCommunicationLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a server communication link. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// communicationLinkName - the name of the server communication link. -func (client ServerCommunicationLinksClient) Get(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result ServerCommunicationLink, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.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, serverName, communicationLinkName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerCommunicationLinksClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationLinkName": autorest.Encode("path", communicationLinkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", 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 ServerCommunicationLinksClient) 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 ServerCommunicationLinksClient) GetResponder(resp *http.Response) (result ServerCommunicationLink, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of server communication links. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerCommunicationLinksClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerCommunicationLinkListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerCommunicationLinksClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/communicationLinks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerCommunicationLinksClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerCommunicationLinksClient) ListByServerResponder(resp *http.Response) (result ServerCommunicationLinkListResult, 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/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go deleted file mode 100644 index fd714db39b75..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/serverconnectionpolicies.go +++ /dev/null @@ -1,195 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerConnectionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type ServerConnectionPoliciesClient struct { - BaseClient -} - -// NewServerConnectionPoliciesClient creates an instance of the ServerConnectionPoliciesClient client. -func NewServerConnectionPoliciesClient(subscriptionID string) ServerConnectionPoliciesClient { - return NewServerConnectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerConnectionPoliciesClientWithBaseURI creates an instance of the ServerConnectionPoliciesClient 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 NewServerConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerConnectionPoliciesClient { - return ServerConnectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the server's connection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the required parameters for updating a secure connection policy. -func (client ServerConnectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (result ServerConnectionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPoliciesClient.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, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerConnectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectionPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}", 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 ServerConnectionPoliciesClient) 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 ServerConnectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerConnectionPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the server's secure connection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerConnectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerConnectionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPoliciesClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerConnectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectionPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}", 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 ServerConnectionPoliciesClient) 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 ServerConnectionPoliciesClient) GetResponder(resp *http.Response) (result ServerConnectionPolicy, 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/sql/mgmt/2015-05-01-preview/sql/serverkeys.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/serverkeys.go deleted file mode 100644 index 54c560060bb9..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/serverkeys.go +++ /dev/null @@ -1,401 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerKeysClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type ServerKeysClient struct { - BaseClient -} - -// NewServerKeysClient creates an instance of the ServerKeysClient client. -func NewServerKeysClient(subscriptionID string) ServerKeysClient { - return NewServerKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerKeysClientWithBaseURI creates an instance of the ServerKeysClient 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 NewServerKeysClientWithBaseURI(baseURI string, subscriptionID string) ServerKeysClient { - return ServerKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a server key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// keyName - the name of the server key to be operated on (updated or created). The key name is required to be -// in the format of 'vault_key_version'. For example, if the keyId is -// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key -// name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 -// parameters - the requested server key resource state. -func (client ServerKeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, keyName string, parameters ServerKey) (result ServerKeysCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, keyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerKeysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string, parameters ServerKey) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = 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.Sql/servers/{serverName}/keys/{keyName}", 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 ServerKeysClient) CreateOrUpdateSender(req *http.Request) (future ServerKeysCreateOrUpdateFuture, 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 ServerKeysClient) CreateOrUpdateResponder(resp *http.Response) (result ServerKey, 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 the server key with the given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// keyName - the name of the server key to be deleted. -func (client ServerKeysClient) Delete(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result ServerKeysDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerKeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/keys/{keyName}", 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 ServerKeysClient) DeleteSender(req *http.Request) (future ServerKeysDeleteFuture, 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 ServerKeysClient) 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 a server key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// keyName - the name of the server key to be retrieved. -func (client ServerKeysClient) Get(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result ServerKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.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, serverName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/keys/{keyName}", 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 ServerKeysClient) 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 ServerKeysClient) GetResponder(resp *http.Response) (result ServerKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of server keys. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerKeysClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.ListByServer") - defer func() { - sc := -1 - if result.sklr.Response.Response != nil { - sc = result.sklr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.sklr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "ListByServer", resp, "Failure sending request") - return - } - - result.sklr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.sklr.hasNextLink() && result.sklr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerKeysClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/keys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) ListByServerResponder(resp *http.Response) (result ServerKeyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerKeysClient) listByServerNextResults(ctx context.Context, lastResults ServerKeyListResult) (result ServerKeyListResult, err error) { - req, err := lastResults.serverKeyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerKeysClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerKeysClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerKeysClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/servers.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/servers.go deleted file mode 100644 index 84bd7821606a..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/servers.go +++ /dev/null @@ -1,669 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServersClient is the the Azure SQL Database management API provides a RESTful set of web services that interact with -// Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete -// databases. -type ServersClient struct { - BaseClient -} - -// NewServersClient creates an instance of the ServersClient client. -func NewServersClient(subscriptionID string) ServersClient { - return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServersClientWithBaseURI creates an instance of the ServersClient 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 NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { - return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability determines whether a resource can be created with the specified name. -// Parameters: -// parameters - the parameters to request for name availability. -func (client ServersClient) CheckNameAvailability(ctx context.Context, parameters CheckNameAvailabilityRequest) (result CheckNameAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.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("sql.ServersClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ServersClient) CheckNameAvailabilityPreparer(ctx context.Context, parameters CheckNameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/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 ServersClient) 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 ServersClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested server resource state. -func (client ServersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (result ServersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}", 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 ServersClient) CreateOrUpdateSender(req *http.Request) (future ServersCreateOrUpdateFuture, 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 ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, 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 a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}", 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 ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, 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 ServersClient) 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 a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}", 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 ServersClient) 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 ServersClient) GetResponder(resp *http.Response) (result Server, 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 servers in the subscription. -func (client ServersClient) List(ctx context.Context) (result ServerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.List") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure sending request") - return - } - - result.slr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers", 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 ServersClient) 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 ServersClient) ListResponder(resp *http.Response) (result ServerListResult, 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 ServersClient) listNextResults(ctx context.Context, lastResults ServerListResult) (result ServerListResult, err error) { - req, err := lastResults.serverListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServersClient", "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, "sql.ServersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServersClient) ListComplete(ctx context.Context) (result ServerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.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 servers in a resource groups. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.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, "sql.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServersClient) 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-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.Sql/servers", 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 ServersClient) 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 ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, 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 ServersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServerListResult) (result ServerListResult, err error) { - req, err := lastResults.serverListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServersClient", "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, "sql.ServersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.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 -} - -// Update updates a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested server resource state. -func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (result ServersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}", 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 ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, 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 ServersClient) UpdateResponder(resp *http.Response) (result Server, 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/preview/sql/mgmt/2015-05-01-preview/sql/serverusages.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/serverusages.go deleted file mode 100644 index 662861e4c6cf..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/serverusages.go +++ /dev/null @@ -1,110 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type ServerUsagesClient struct { - BaseClient -} - -// NewServerUsagesClient creates an instance of the ServerUsagesClient client. -func NewServerUsagesClient(subscriptionID string) ServerUsagesClient { - return NewServerUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerUsagesClientWithBaseURI creates an instance of the ServerUsagesClient 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 NewServerUsagesClientWithBaseURI(baseURI string, subscriptionID string) ServerUsagesClient { - return ServerUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByServer returns server usages. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerUsagesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerUsagesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerUsagesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerUsagesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerUsagesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerUsagesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerUsagesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerUsagesClient) ListByServerResponder(resp *http.Response) (result ServerUsageListResult, 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/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go deleted file mode 100644 index 0b21dd5344f9..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/serviceobjectives.go +++ /dev/null @@ -1,190 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServiceObjectivesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ServiceObjectivesClient struct { - BaseClient -} - -// NewServiceObjectivesClient creates an instance of the ServiceObjectivesClient client. -func NewServiceObjectivesClient(subscriptionID string) ServiceObjectivesClient { - return NewServiceObjectivesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceObjectivesClientWithBaseURI creates an instance of the ServiceObjectivesClient 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 NewServiceObjectivesClientWithBaseURI(baseURI string, subscriptionID string) ServiceObjectivesClient { - return ServiceObjectivesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a database service objective. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// serviceObjectiveName - the name of the service objective to retrieve. -func (client ServiceObjectivesClient) Get(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (result ServiceObjective, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceObjectivesClient.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, serverName, serviceObjectiveName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceObjectivesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "serviceObjectiveName": autorest.Encode("path", serviceObjectiveName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}", 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 ServiceObjectivesClient) 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 ServiceObjectivesClient) GetResponder(resp *http.Response) (result ServiceObjective, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns database service objectives. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServiceObjectivesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServiceObjectiveListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceObjectivesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServiceObjectivesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/serviceObjectives", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceObjectivesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServiceObjectivesClient) ListByServerResponder(resp *http.Response) (result ServiceObjectiveListResult, 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/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go deleted file mode 100644 index 7886aa585995..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/servicetieradvisors.go +++ /dev/null @@ -1,194 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServiceTierAdvisorsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ServiceTierAdvisorsClient struct { - BaseClient -} - -// NewServiceTierAdvisorsClient creates an instance of the ServiceTierAdvisorsClient client. -func NewServiceTierAdvisorsClient(subscriptionID string) ServiceTierAdvisorsClient { - return NewServiceTierAdvisorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceTierAdvisorsClientWithBaseURI creates an instance of the ServiceTierAdvisorsClient 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 NewServiceTierAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) ServiceTierAdvisorsClient { - return ServiceTierAdvisorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a service tier advisor. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of database. -// serviceTierAdvisorName - the name of service tier advisor. -func (client ServiceTierAdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (result ServiceTierAdvisor, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTierAdvisorsClient.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, serverName, databaseName, serviceTierAdvisorName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceTierAdvisorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "serviceTierAdvisorName": autorest.Encode("path", serviceTierAdvisorName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}", 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 ServiceTierAdvisorsClient) 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 ServiceTierAdvisorsClient) GetResponder(resp *http.Response) (result ServiceTierAdvisor, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase returns service tier advisors for specified database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of database. -func (client ServiceTierAdvisorsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ServiceTierAdvisorListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTierAdvisorsClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ServiceTierAdvisorsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceTierAdvisorsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ServiceTierAdvisorsClient) ListByDatabaseResponder(resp *http.Response) (result ServiceTierAdvisorListResult, 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/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go deleted file mode 100644 index 4b93a0531a0f..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/sqlapi/interfaces.go +++ /dev/null @@ -1,386 +0,0 @@ -package sqlapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/sql/mgmt/2015-05-01-preview/sql" - "github.com/Azure/go-autorest/autorest" -) - -// RecoverableDatabasesClientAPI contains the set of methods on the RecoverableDatabasesClient type. -type RecoverableDatabasesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.RecoverableDatabase, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.RecoverableDatabaseListResult, err error) -} - -var _ RecoverableDatabasesClientAPI = (*sql.RecoverableDatabasesClient)(nil) - -// RestorableDroppedDatabasesClientAPI contains the set of methods on the RestorableDroppedDatabasesClient type. -type RestorableDroppedDatabasesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (result sql.RestorableDroppedDatabase, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.RestorableDroppedDatabaseListResult, err error) -} - -var _ RestorableDroppedDatabasesClientAPI = (*sql.RestorableDroppedDatabasesClient)(nil) - -// RestorePointsClientAPI contains the set of methods on the RestorePointsClient type. -type RestorePointsClientAPI interface { - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.RestorePointListResult, err error) -} - -var _ RestorePointsClientAPI = (*sql.RestorePointsClient)(nil) - -// ServersClientAPI contains the set of methods on the ServersClient type. -type ServersClientAPI interface { - CheckNameAvailability(ctx context.Context, parameters sql.CheckNameAvailabilityRequest) (result sql.CheckNameAvailabilityResponse, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.Server) (result sql.ServersCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServersDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.Server, err error) - List(ctx context.Context) (result sql.ServerListResultPage, err error) - ListComplete(ctx context.Context) (result sql.ServerListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ServerListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.ServerListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerUpdate) (result sql.ServersUpdateFuture, err error) -} - -var _ ServersClientAPI = (*sql.ServersClient)(nil) - -// ServerConnectionPoliciesClientAPI contains the set of methods on the ServerConnectionPoliciesClient type. -type ServerConnectionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerConnectionPolicy) (result sql.ServerConnectionPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerConnectionPolicy, err error) -} - -var _ ServerConnectionPoliciesClientAPI = (*sql.ServerConnectionPoliciesClient)(nil) - -// DatabasesClientAPI contains the set of methods on the DatabasesClient type. -type DatabasesClientAPI interface { - CreateImportOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ImportExtensionRequest) (result sql.DatabasesCreateImportOperationFuture, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.Database) (result sql.DatabasesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) - Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ExportRequest) (result sql.DatabasesExportFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, expand string) (result sql.Database, err error) - GetByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (result sql.Database, err error) - GetByRecommendedElasticPool(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (result sql.Database, err error) - Import(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ImportRequest) (result sql.DatabasesImportFuture, err error) - ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.DatabaseListResult, err error) - ListByRecommendedElasticPool(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result sql.DatabaseListResult, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string, expand string, filter string) (result sql.DatabaseListResult, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.MetricDefinitionListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result sql.MetricListResult, err error) - Pause(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesPauseFuture, err error) - Resume(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesResumeFuture, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseUpdate) (result sql.DatabasesUpdateFuture, err error) -} - -var _ DatabasesClientAPI = (*sql.DatabasesClient)(nil) - -// DatabaseThreatDetectionPoliciesClientAPI contains the set of methods on the DatabaseThreatDetectionPoliciesClient type. -type DatabaseThreatDetectionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseSecurityAlertPolicy) (result sql.DatabaseSecurityAlertPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseSecurityAlertPolicy, err error) -} - -var _ DatabaseThreatDetectionPoliciesClientAPI = (*sql.DatabaseThreatDetectionPoliciesClient)(nil) - -// DataMaskingPoliciesClientAPI contains the set of methods on the DataMaskingPoliciesClient type. -type DataMaskingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DataMaskingPolicy) (result sql.DataMaskingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DataMaskingPolicy, err error) -} - -var _ DataMaskingPoliciesClientAPI = (*sql.DataMaskingPoliciesClient)(nil) - -// DataMaskingRulesClientAPI contains the set of methods on the DataMaskingRulesClient type. -type DataMaskingRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters sql.DataMaskingRule) (result sql.DataMaskingRule, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DataMaskingRuleListResult, err error) -} - -var _ DataMaskingRulesClientAPI = (*sql.DataMaskingRulesClient)(nil) - -// ElasticPoolsClientAPI contains the set of methods on the ElasticPoolsClient type. -type ElasticPoolsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters sql.ElasticPool) (result sql.ElasticPoolsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPool, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ElasticPoolListResult, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.MetricDefinitionListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (result sql.MetricListResult, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters sql.ElasticPoolUpdate) (result sql.ElasticPoolsUpdateFuture, err error) -} - -var _ ElasticPoolsClientAPI = (*sql.ElasticPoolsClient)(nil) - -// FirewallRulesClientAPI contains the set of methods on the FirewallRulesClient type. -type FirewallRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters sql.FirewallRule) (result sql.FirewallRule, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result sql.FirewallRule, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.FirewallRuleListResult, err error) -} - -var _ FirewallRulesClientAPI = (*sql.FirewallRulesClient)(nil) - -// GeoBackupPoliciesClientAPI contains the set of methods on the GeoBackupPoliciesClient type. -type GeoBackupPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.GeoBackupPolicy) (result sql.GeoBackupPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.GeoBackupPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.GeoBackupPolicyListResult, err error) -} - -var _ GeoBackupPoliciesClientAPI = (*sql.GeoBackupPoliciesClient)(nil) - -// ReplicationLinksClientAPI contains the set of methods on the ReplicationLinksClient type. -type ReplicationLinksClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) - Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLinksFailoverFuture, err error) - FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLinksFailoverAllowDataLossFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLink, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ReplicationLinkListResult, err error) - Unlink(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, parameters sql.UnlinkParameters) (result sql.ReplicationLinksUnlinkFuture, err error) -} - -var _ ReplicationLinksClientAPI = (*sql.ReplicationLinksClient)(nil) - -// ServerAzureADAdministratorsClientAPI contains the set of methods on the ServerAzureADAdministratorsClient type. -type ServerAzureADAdministratorsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties sql.ServerAzureADAdministrator) (result sql.ServerAzureADAdministratorsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAzureADAdministratorsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAzureADAdministrator, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAdministratorListResult, err error) -} - -var _ ServerAzureADAdministratorsClientAPI = (*sql.ServerAzureADAdministratorsClient)(nil) - -// ServerCommunicationLinksClientAPI contains the set of methods on the ServerCommunicationLinksClient type. -type ServerCommunicationLinksClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters sql.ServerCommunicationLink) (result sql.ServerCommunicationLinksCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result sql.ServerCommunicationLink, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerCommunicationLinkListResult, err error) -} - -var _ ServerCommunicationLinksClientAPI = (*sql.ServerCommunicationLinksClient)(nil) - -// ServiceObjectivesClientAPI contains the set of methods on the ServiceObjectivesClient type. -type ServiceObjectivesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (result sql.ServiceObjective, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServiceObjectiveListResult, err error) -} - -var _ ServiceObjectivesClientAPI = (*sql.ServiceObjectivesClient)(nil) - -// ElasticPoolActivitiesClientAPI contains the set of methods on the ElasticPoolActivitiesClient type. -type ElasticPoolActivitiesClientAPI interface { - ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolActivityListResult, err error) -} - -var _ ElasticPoolActivitiesClientAPI = (*sql.ElasticPoolActivitiesClient)(nil) - -// ElasticPoolDatabaseActivitiesClientAPI contains the set of methods on the ElasticPoolDatabaseActivitiesClient type. -type ElasticPoolDatabaseActivitiesClientAPI interface { - ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolDatabaseActivityListResult, err error) -} - -var _ ElasticPoolDatabaseActivitiesClientAPI = (*sql.ElasticPoolDatabaseActivitiesClient)(nil) - -// ServiceTierAdvisorsClientAPI contains the set of methods on the ServiceTierAdvisorsClient type. -type ServiceTierAdvisorsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (result sql.ServiceTierAdvisor, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ServiceTierAdvisorListResult, err error) -} - -var _ ServiceTierAdvisorsClientAPI = (*sql.ServiceTierAdvisorsClient)(nil) - -// TransparentDataEncryptionsClientAPI contains the set of methods on the TransparentDataEncryptionsClient type. -type TransparentDataEncryptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.TransparentDataEncryption) (result sql.TransparentDataEncryption, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.TransparentDataEncryption, err error) -} - -var _ TransparentDataEncryptionsClientAPI = (*sql.TransparentDataEncryptionsClient)(nil) - -// TransparentDataEncryptionActivitiesClientAPI contains the set of methods on the TransparentDataEncryptionActivitiesClient type. -type TransparentDataEncryptionActivitiesClientAPI interface { - ListByConfiguration(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.TransparentDataEncryptionActivityListResult, err error) -} - -var _ TransparentDataEncryptionActivitiesClientAPI = (*sql.TransparentDataEncryptionActivitiesClient)(nil) - -// ServerUsagesClientAPI contains the set of methods on the ServerUsagesClient type. -type ServerUsagesClientAPI interface { - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerUsageListResult, err error) -} - -var _ ServerUsagesClientAPI = (*sql.ServerUsagesClient)(nil) - -// DatabaseUsagesClientAPI contains the set of methods on the DatabaseUsagesClient type. -type DatabaseUsagesClientAPI interface { - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseUsageListResult, err error) -} - -var _ DatabaseUsagesClientAPI = (*sql.DatabaseUsagesClient)(nil) - -// CapabilitiesClientAPI contains the set of methods on the CapabilitiesClient type. -type CapabilitiesClientAPI interface { - ListByLocation(ctx context.Context, locationName string) (result sql.LocationCapabilities, err error) -} - -var _ CapabilitiesClientAPI = (*sql.CapabilitiesClient)(nil) - -// DatabaseBlobAuditingPoliciesClientAPI contains the set of methods on the DatabaseBlobAuditingPoliciesClient type. -type DatabaseBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseBlobAuditingPolicy) (result sql.DatabaseBlobAuditingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseBlobAuditingPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseBlobAuditingPolicyListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseBlobAuditingPolicyListResultIterator, err error) -} - -var _ DatabaseBlobAuditingPoliciesClientAPI = (*sql.DatabaseBlobAuditingPoliciesClient)(nil) - -// EncryptionProtectorsClientAPI contains the set of methods on the EncryptionProtectorsClient type. -type EncryptionProtectorsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.EncryptionProtector) (result sql.EncryptionProtectorsCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtector, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorListResultIterator, err error) - Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorsRevalidateFuture, err error) -} - -var _ EncryptionProtectorsClientAPI = (*sql.EncryptionProtectorsClient)(nil) - -// FailoverGroupsClientAPI contains the set of methods on the FailoverGroupsClient type. -type FailoverGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters sql.FailoverGroup) (result sql.FailoverGroupsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result sql.FailoverGroupsDeleteFuture, err error) - Failover(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result sql.FailoverGroupsFailoverFuture, err error) - ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result sql.FailoverGroupsForceFailoverAllowDataLossFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result sql.FailoverGroup, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.FailoverGroupListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.FailoverGroupListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters sql.FailoverGroupUpdate) (result sql.FailoverGroupsUpdateFuture, err error) -} - -var _ FailoverGroupsClientAPI = (*sql.FailoverGroupsClient)(nil) - -// ManagedInstancesClientAPI contains the set of methods on the ManagedInstancesClient type. -type ManagedInstancesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstance) (result sql.ManagedInstancesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) - List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) - ListComplete(ctx context.Context) (result sql.ManagedInstanceListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) -} - -var _ ManagedInstancesClientAPI = (*sql.ManagedInstancesClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result sql.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result sql.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*sql.OperationsClient)(nil) - -// ServerKeysClientAPI contains the set of methods on the ServerKeysClient type. -type ServerKeysClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, keyName string, parameters sql.ServerKey) (result sql.ServerKeysCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result sql.ServerKeysDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result sql.ServerKey, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerKeyListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerKeyListResultIterator, err error) -} - -var _ ServerKeysClientAPI = (*sql.ServerKeysClient)(nil) - -// SyncAgentsClientAPI contains the set of methods on the SyncAgentsClient type. -type SyncAgentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, parameters sql.SyncAgent) (result sql.SyncAgentsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgentsDeleteFuture, err error) - GenerateKey(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgentKeyProperties, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgent, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.SyncAgentListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.SyncAgentListResultIterator, err error) - ListLinkedDatabases(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgentLinkedDatabaseListResultPage, err error) - ListLinkedDatabasesComplete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgentLinkedDatabaseListResultIterator, err error) -} - -var _ SyncAgentsClientAPI = (*sql.SyncAgentsClient)(nil) - -// SyncGroupsClientAPI contains the set of methods on the SyncGroupsClient type. -type SyncGroupsClientAPI interface { - CancelSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters sql.SyncGroup) (result sql.SyncGroupsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncGroupsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncGroup, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.SyncGroupListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.SyncGroupListResultIterator, err error) - ListHubSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncFullSchemaPropertiesListResultPage, err error) - ListHubSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncFullSchemaPropertiesListResultIterator, err error) - ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result sql.SyncGroupLogListResultPage, err error) - ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result sql.SyncGroupLogListResultIterator, err error) - ListSyncDatabaseIds(ctx context.Context, locationName string) (result sql.SyncDatabaseIDListResultPage, err error) - ListSyncDatabaseIdsComplete(ctx context.Context, locationName string) (result sql.SyncDatabaseIDListResultIterator, err error) - RefreshHubSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncGroupsRefreshHubSchemaFuture, err error) - TriggerSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters sql.SyncGroup) (result sql.SyncGroupsUpdateFuture, err error) -} - -var _ SyncGroupsClientAPI = (*sql.SyncGroupsClient)(nil) - -// SyncMembersClientAPI contains the set of methods on the SyncMembersClient type. -type SyncMembersClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters sql.SyncMember) (result sql.SyncMembersCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncMembersDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncMember, err error) - ListBySyncGroup(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncMemberListResultPage, err error) - ListBySyncGroupComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncMemberListResultIterator, err error) - ListMemberSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncFullSchemaPropertiesListResultPage, err error) - ListMemberSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncFullSchemaPropertiesListResultIterator, err error) - RefreshMemberSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncMembersRefreshMemberSchemaFuture, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters sql.SyncMember) (result sql.SyncMembersUpdateFuture, err error) -} - -var _ SyncMembersClientAPI = (*sql.SyncMembersClient)(nil) - -// SubscriptionUsagesClientAPI contains the set of methods on the SubscriptionUsagesClient type. -type SubscriptionUsagesClientAPI interface { - Get(ctx context.Context, locationName string, usageName string) (result sql.SubscriptionUsage, err error) - ListByLocation(ctx context.Context, locationName string) (result sql.SubscriptionUsageListResultPage, err error) - ListByLocationComplete(ctx context.Context, locationName string) (result sql.SubscriptionUsageListResultIterator, err error) -} - -var _ SubscriptionUsagesClientAPI = (*sql.SubscriptionUsagesClient)(nil) - -// VirtualClustersClientAPI contains the set of methods on the VirtualClustersClient type. -type VirtualClustersClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, virtualClusterName string) (result sql.VirtualClustersDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, virtualClusterName string) (result sql.VirtualCluster, err error) - List(ctx context.Context) (result sql.VirtualClusterListResultPage, err error) - ListComplete(ctx context.Context) (result sql.VirtualClusterListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.VirtualClusterListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.VirtualClusterListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, virtualClusterName string, parameters sql.VirtualClusterUpdate) (result sql.VirtualClustersUpdateFuture, err error) -} - -var _ VirtualClustersClientAPI = (*sql.VirtualClustersClient)(nil) - -// VirtualNetworkRulesClientAPI contains the set of methods on the VirtualNetworkRulesClient type. -type VirtualNetworkRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters sql.VirtualNetworkRule) (result sql.VirtualNetworkRulesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result sql.VirtualNetworkRulesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result sql.VirtualNetworkRule, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.VirtualNetworkRuleListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.VirtualNetworkRuleListResultIterator, err error) -} - -var _ VirtualNetworkRulesClientAPI = (*sql.VirtualNetworkRulesClient)(nil) diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go deleted file mode 100644 index 2362a090b572..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/subscriptionusages.go +++ /dev/null @@ -1,226 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SubscriptionUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type SubscriptionUsagesClient struct { - BaseClient -} - -// NewSubscriptionUsagesClient creates an instance of the SubscriptionUsagesClient client. -func NewSubscriptionUsagesClient(subscriptionID string) SubscriptionUsagesClient { - return NewSubscriptionUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionUsagesClientWithBaseURI creates an instance of the SubscriptionUsagesClient 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 NewSubscriptionUsagesClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionUsagesClient { - return SubscriptionUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a subscription usage metric. -// Parameters: -// locationName - the name of the region where the resource is located. -// usageName - name of usage metric to return. -func (client SubscriptionUsagesClient) Get(ctx context.Context, locationName string, usageName string) (result SubscriptionUsage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsagesClient.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, locationName, usageName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionUsagesClient) GetPreparer(ctx context.Context, locationName string, usageName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "usageName": autorest.Encode("path", usageName), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}", 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 SubscriptionUsagesClient) 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 SubscriptionUsagesClient) GetResponder(resp *http.Response) (result SubscriptionUsage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByLocation gets all subscription usage metrics in a given location. -// Parameters: -// locationName - the name of the region where the resource is located. -func (client SubscriptionUsagesClient) ListByLocation(ctx context.Context, locationName string) (result SubscriptionUsageListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsagesClient.ListByLocation") - defer func() { - sc := -1 - if result.sulr.Response.Response != nil { - sc = result.sulr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByLocationNextResults - req, err := client.ListByLocationPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.sulr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "ListByLocation", resp, "Failure sending request") - return - } - - result.sulr, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "ListByLocation", resp, "Failure responding to request") - return - } - if result.sulr.hasNextLink() && result.sulr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client SubscriptionUsagesClient) ListByLocationPreparer(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 = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionUsagesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client SubscriptionUsagesClient) ListByLocationResponder(resp *http.Response) (result SubscriptionUsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByLocationNextResults retrieves the next set of results, if any. -func (client SubscriptionUsagesClient) listByLocationNextResults(ctx context.Context, lastResults SubscriptionUsageListResult) (result SubscriptionUsageListResult, err error) { - req, err := lastResults.subscriptionUsageListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "listByLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "listByLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "listByLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client SubscriptionUsagesClient) ListByLocationComplete(ctx context.Context, locationName string) (result SubscriptionUsageListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsagesClient.ListByLocation") - 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.ListByLocation(ctx, locationName) - return -} diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/syncagents.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/syncagents.go deleted file mode 100644 index 9ad3b1b33350..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/syncagents.go +++ /dev/null @@ -1,597 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SyncAgentsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type SyncAgentsClient struct { - BaseClient -} - -// NewSyncAgentsClient creates an instance of the SyncAgentsClient client. -func NewSyncAgentsClient(subscriptionID string) SyncAgentsClient { - return NewSyncAgentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSyncAgentsClientWithBaseURI creates an instance of the SyncAgentsClient 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 NewSyncAgentsClientWithBaseURI(baseURI string, subscriptionID string) SyncAgentsClient { - return SyncAgentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a sync agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -// parameters - the requested sync agent resource state. -func (client SyncAgentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, parameters SyncAgent) (result SyncAgentsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, syncAgentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SyncAgentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, parameters SyncAgent) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}", 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 SyncAgentsClient) CreateOrUpdateSender(req *http.Request) (future SyncAgentsCreateOrUpdateFuture, 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 SyncAgentsClient) CreateOrUpdateResponder(resp *http.Response) (result SyncAgent, 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 a sync agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -func (client SyncAgentsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, syncAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SyncAgentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}", 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 SyncAgentsClient) DeleteSender(req *http.Request) (future SyncAgentsDeleteFuture, 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 SyncAgentsClient) 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 -} - -// GenerateKey generates a sync agent key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -func (client SyncAgentsClient) GenerateKey(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentKeyProperties, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.GenerateKey") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GenerateKeyPreparer(ctx, resourceGroupName, serverName, syncAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "GenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "GenerateKey", resp, "Failure sending request") - return - } - - result, err = client.GenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "GenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// GenerateKeyPreparer prepares the GenerateKey request. -func (client SyncAgentsClient) GenerateKeyPreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}/generateKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateKeySender sends the GenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client SyncAgentsClient) GenerateKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateKeyResponder handles the response to the GenerateKey request. The method always -// closes the http.Response Body. -func (client SyncAgentsClient) GenerateKeyResponder(resp *http.Response) (result SyncAgentKeyProperties, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a sync agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -func (client SyncAgentsClient) Get(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgent, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.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, serverName, syncAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SyncAgentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}", 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 SyncAgentsClient) 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 SyncAgentsClient) GetResponder(resp *http.Response) (result SyncAgent, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer lists sync agents in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -func (client SyncAgentsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result SyncAgentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.ListByServer") - defer func() { - sc := -1 - if result.salr.Response.Response != nil { - sc = result.salr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.salr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.salr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.salr.hasNextLink() && result.salr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client SyncAgentsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client SyncAgentsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client SyncAgentsClient) ListByServerResponder(resp *http.Response) (result SyncAgentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client SyncAgentsClient) listByServerNextResults(ctx context.Context, lastResults SyncAgentListResult) (result SyncAgentListResult, err error) { - req, err := lastResults.syncAgentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncAgentsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result SyncAgentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// ListLinkedDatabases lists databases linked to a sync agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -func (client SyncAgentsClient) ListLinkedDatabases(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentLinkedDatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.ListLinkedDatabases") - defer func() { - sc := -1 - if result.saldlr.Response.Response != nil { - sc = result.saldlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listLinkedDatabasesNextResults - req, err := client.ListLinkedDatabasesPreparer(ctx, resourceGroupName, serverName, syncAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListLinkedDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListLinkedDatabasesSender(req) - if err != nil { - result.saldlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListLinkedDatabases", resp, "Failure sending request") - return - } - - result.saldlr, err = client.ListLinkedDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListLinkedDatabases", resp, "Failure responding to request") - return - } - if result.saldlr.hasNextLink() && result.saldlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListLinkedDatabasesPreparer prepares the ListLinkedDatabases request. -func (client SyncAgentsClient) ListLinkedDatabasesPreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}/linkedDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListLinkedDatabasesSender sends the ListLinkedDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client SyncAgentsClient) ListLinkedDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListLinkedDatabasesResponder handles the response to the ListLinkedDatabases request. The method always -// closes the http.Response Body. -func (client SyncAgentsClient) ListLinkedDatabasesResponder(resp *http.Response) (result SyncAgentLinkedDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listLinkedDatabasesNextResults retrieves the next set of results, if any. -func (client SyncAgentsClient) listLinkedDatabasesNextResults(ctx context.Context, lastResults SyncAgentLinkedDatabaseListResult) (result SyncAgentLinkedDatabaseListResult, err error) { - req, err := lastResults.syncAgentLinkedDatabaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listLinkedDatabasesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListLinkedDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listLinkedDatabasesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListLinkedDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listLinkedDatabasesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListLinkedDatabasesComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncAgentsClient) ListLinkedDatabasesComplete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentLinkedDatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.ListLinkedDatabases") - 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.ListLinkedDatabases(ctx, resourceGroupName, serverName, syncAgentName) - return -} diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/syncgroups.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/syncgroups.go deleted file mode 100644 index 6d7db3c8d547..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/syncgroups.go +++ /dev/null @@ -1,1107 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SyncGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type SyncGroupsClient struct { - BaseClient -} - -// NewSyncGroupsClient creates an instance of the SyncGroupsClient client. -func NewSyncGroupsClient(subscriptionID string) SyncGroupsClient { - return NewSyncGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSyncGroupsClientWithBaseURI creates an instance of the SyncGroupsClient 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 NewSyncGroupsClientWithBaseURI(baseURI string, subscriptionID string) SyncGroupsClient { - return SyncGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CancelSync cancels a sync group synchronization. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) CancelSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.CancelSync") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelSyncPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CancelSync", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSyncSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CancelSync", resp, "Failure sending request") - return - } - - result, err = client.CancelSyncResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CancelSync", resp, "Failure responding to request") - return - } - - return -} - -// CancelSyncPreparer prepares the CancelSync request. -func (client SyncGroupsClient) CancelSyncPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSyncSender sends the CancelSync request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) CancelSyncSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelSyncResponder handles the response to the CancelSync request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) CancelSyncResponder(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 a sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -// parameters - the requested sync group resource state. -func (client SyncGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (result SyncGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SyncGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", 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 SyncGroupsClient) CreateOrUpdateSender(req *http.Request) (future SyncGroupsCreateOrUpdateFuture, 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 SyncGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result SyncGroup, 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 a sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SyncGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", 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 SyncGroupsClient) DeleteSender(req *http.Request) (future SyncGroupsDeleteFuture, 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 SyncGroupsClient) 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 a sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.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, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SyncGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", 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 SyncGroupsClient) 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 SyncGroupsClient) GetResponder(resp *http.Response) (result SyncGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists sync groups under a hub database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -func (client SyncGroupsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result SyncGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListByDatabase") - defer func() { - sc := -1 - if result.sglr.Response.Response != nil { - sc = result.sglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.sglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.sglr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.sglr.hasNextLink() && result.sglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client SyncGroupsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) ListByDatabaseResponder(resp *http.Response) (result SyncGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client SyncGroupsClient) listByDatabaseNextResults(ctx context.Context, lastResults SyncGroupListResult) (result SyncGroupListResult, err error) { - req, err := lastResults.syncGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncGroupsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result SyncGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} - -// ListHubSchemas gets a collection of hub database schemas. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) ListHubSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncFullSchemaPropertiesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListHubSchemas") - defer func() { - sc := -1 - if result.sfsplr.Response.Response != nil { - sc = result.sfsplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listHubSchemasNextResults - req, err := client.ListHubSchemasPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListHubSchemas", nil, "Failure preparing request") - return - } - - resp, err := client.ListHubSchemasSender(req) - if err != nil { - result.sfsplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListHubSchemas", resp, "Failure sending request") - return - } - - result.sfsplr, err = client.ListHubSchemasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListHubSchemas", resp, "Failure responding to request") - return - } - if result.sfsplr.hasNextLink() && result.sfsplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListHubSchemasPreparer prepares the ListHubSchemas request. -func (client SyncGroupsClient) ListHubSchemasPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListHubSchemasSender sends the ListHubSchemas request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) ListHubSchemasSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListHubSchemasResponder handles the response to the ListHubSchemas request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) ListHubSchemasResponder(resp *http.Response) (result SyncFullSchemaPropertiesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listHubSchemasNextResults retrieves the next set of results, if any. -func (client SyncGroupsClient) listHubSchemasNextResults(ctx context.Context, lastResults SyncFullSchemaPropertiesListResult) (result SyncFullSchemaPropertiesListResult, err error) { - req, err := lastResults.syncFullSchemaPropertiesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listHubSchemasNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListHubSchemasSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listHubSchemasNextResults", resp, "Failure sending next results request") - } - result, err = client.ListHubSchemasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listHubSchemasNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListHubSchemasComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncGroupsClient) ListHubSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncFullSchemaPropertiesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListHubSchemas") - 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.ListHubSchemas(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - return -} - -// ListLogs gets a collection of sync group logs. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -// startTime - get logs generated after this time. -// endTime - get logs generated before this time. -// typeParameter - the types of logs to retrieve. -// continuationToken - the continuation token for this operation. -func (client SyncGroupsClient) ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListLogs") - defer func() { - sc := -1 - if result.sgllr.Response.Response != nil { - sc = result.sgllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listLogsNextResults - req, err := client.ListLogsPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, typeParameter, continuationToken) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListLogs", nil, "Failure preparing request") - return - } - - resp, err := client.ListLogsSender(req) - if err != nil { - result.sgllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListLogs", resp, "Failure sending request") - return - } - - result.sgllr, err = client.ListLogsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListLogs", resp, "Failure responding to request") - return - } - if result.sgllr.hasNextLink() && result.sgllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListLogsPreparer prepares the ListLogs request. -func (client SyncGroupsClient) ListLogsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "endTime": autorest.Encode("query", endTime), - "startTime": autorest.Encode("query", startTime), - "type": autorest.Encode("query", typeParameter), - } - if len(continuationToken) > 0 { - queryParameters["continuationToken"] = autorest.Encode("query", continuationToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListLogsSender sends the ListLogs request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) ListLogsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListLogsResponder handles the response to the ListLogs request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) ListLogsResponder(resp *http.Response) (result SyncGroupLogListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listLogsNextResults retrieves the next set of results, if any. -func (client SyncGroupsClient) listLogsNextResults(ctx context.Context, lastResults SyncGroupLogListResult) (result SyncGroupLogListResult, err error) { - req, err := lastResults.syncGroupLogListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listLogsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListLogsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listLogsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListLogsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listLogsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListLogsComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncGroupsClient) ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListLogs") - 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.ListLogs(ctx, resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, typeParameter, continuationToken) - return -} - -// ListSyncDatabaseIds gets a collection of sync database ids. -// Parameters: -// locationName - the name of the region where the resource is located. -func (client SyncGroupsClient) ListSyncDatabaseIds(ctx context.Context, locationName string) (result SyncDatabaseIDListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListSyncDatabaseIds") - defer func() { - sc := -1 - if result.sdilr.Response.Response != nil { - sc = result.sdilr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSyncDatabaseIdsNextResults - req, err := client.ListSyncDatabaseIdsPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListSyncDatabaseIds", nil, "Failure preparing request") - return - } - - resp, err := client.ListSyncDatabaseIdsSender(req) - if err != nil { - result.sdilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListSyncDatabaseIds", resp, "Failure sending request") - return - } - - result.sdilr, err = client.ListSyncDatabaseIdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListSyncDatabaseIds", resp, "Failure responding to request") - return - } - if result.sdilr.hasNextLink() && result.sdilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSyncDatabaseIdsPreparer prepares the ListSyncDatabaseIds request. -func (client SyncGroupsClient) ListSyncDatabaseIdsPreparer(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 = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSyncDatabaseIdsSender sends the ListSyncDatabaseIds request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) ListSyncDatabaseIdsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSyncDatabaseIdsResponder handles the response to the ListSyncDatabaseIds request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) ListSyncDatabaseIdsResponder(resp *http.Response) (result SyncDatabaseIDListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSyncDatabaseIdsNextResults retrieves the next set of results, if any. -func (client SyncGroupsClient) listSyncDatabaseIdsNextResults(ctx context.Context, lastResults SyncDatabaseIDListResult) (result SyncDatabaseIDListResult, err error) { - req, err := lastResults.syncDatabaseIDListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listSyncDatabaseIdsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSyncDatabaseIdsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listSyncDatabaseIdsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSyncDatabaseIdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listSyncDatabaseIdsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSyncDatabaseIdsComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncGroupsClient) ListSyncDatabaseIdsComplete(ctx context.Context, locationName string) (result SyncDatabaseIDListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListSyncDatabaseIds") - 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.ListSyncDatabaseIds(ctx, locationName) - return -} - -// RefreshHubSchema refreshes a hub database schema. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) RefreshHubSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroupsRefreshHubSchemaFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.RefreshHubSchema") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RefreshHubSchemaPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "RefreshHubSchema", nil, "Failure preparing request") - return - } - - result, err = client.RefreshHubSchemaSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "RefreshHubSchema", result.Response(), "Failure sending request") - return - } - - return -} - -// RefreshHubSchemaPreparer prepares the RefreshHubSchema request. -func (client SyncGroupsClient) RefreshHubSchemaPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshHubSchemaSender sends the RefreshHubSchema request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) RefreshHubSchemaSender(req *http.Request) (future SyncGroupsRefreshHubSchemaFuture, 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 -} - -// RefreshHubSchemaResponder handles the response to the RefreshHubSchema request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) RefreshHubSchemaResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// TriggerSync triggers a sync group synchronization. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) TriggerSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.TriggerSync") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TriggerSyncPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "TriggerSync", nil, "Failure preparing request") - return - } - - resp, err := client.TriggerSyncSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "TriggerSync", resp, "Failure sending request") - return - } - - result, err = client.TriggerSyncResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "TriggerSync", resp, "Failure responding to request") - return - } - - return -} - -// TriggerSyncPreparer prepares the TriggerSync request. -func (client SyncGroupsClient) TriggerSyncPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TriggerSyncSender sends the TriggerSync request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) TriggerSyncSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// TriggerSyncResponder handles the response to the TriggerSync request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) TriggerSyncResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates a sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -// parameters - the requested sync group resource state. -func (client SyncGroupsClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (result SyncGroupsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SyncGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", 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 SyncGroupsClient) UpdateSender(req *http.Request) (future SyncGroupsUpdateFuture, 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 SyncGroupsClient) UpdateResponder(resp *http.Response) (result SyncGroup, 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/preview/sql/mgmt/2015-05-01-preview/sql/syncmembers.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/syncmembers.go deleted file mode 100644 index 65bbe6fa921d..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/syncmembers.go +++ /dev/null @@ -1,712 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SyncMembersClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type SyncMembersClient struct { - BaseClient -} - -// NewSyncMembersClient creates an instance of the SyncMembersClient client. -func NewSyncMembersClient(subscriptionID string) SyncMembersClient { - return NewSyncMembersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSyncMembersClientWithBaseURI creates an instance of the SyncMembersClient 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 NewSyncMembersClientWithBaseURI(baseURI string, subscriptionID string) SyncMembersClient { - return SyncMembersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a sync member. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -// parameters - the requested sync member resource state. -func (client SyncMembersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (result SyncMembersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SyncMembersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", 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 SyncMembersClient) CreateOrUpdateSender(req *http.Request) (future SyncMembersCreateOrUpdateFuture, 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 SyncMembersClient) CreateOrUpdateResponder(resp *http.Response) (result SyncMember, 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 a sync member. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -func (client SyncMembersClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncMembersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SyncMembersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", 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 SyncMembersClient) DeleteSender(req *http.Request) (future SyncMembersDeleteFuture, 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 SyncMembersClient) 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 a sync member. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -func (client SyncMembersClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncMember, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.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, serverName, databaseName, syncGroupName, syncMemberName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SyncMembersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", 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 SyncMembersClient) 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 SyncMembersClient) GetResponder(resp *http.Response) (result SyncMember, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySyncGroup lists sync members in the given sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncMembersClient) ListBySyncGroup(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncMemberListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.ListBySyncGroup") - defer func() { - sc := -1 - if result.smlr.Response.Response != nil { - sc = result.smlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySyncGroupNextResults - req, err := client.ListBySyncGroupPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListBySyncGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySyncGroupSender(req) - if err != nil { - result.smlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListBySyncGroup", resp, "Failure sending request") - return - } - - result.smlr, err = client.ListBySyncGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListBySyncGroup", resp, "Failure responding to request") - return - } - if result.smlr.hasNextLink() && result.smlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySyncGroupPreparer prepares the ListBySyncGroup request. -func (client SyncMembersClient) ListBySyncGroupPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySyncGroupSender sends the ListBySyncGroup request. The method will close the -// http.Response Body if it receives an error. -func (client SyncMembersClient) ListBySyncGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySyncGroupResponder handles the response to the ListBySyncGroup request. The method always -// closes the http.Response Body. -func (client SyncMembersClient) ListBySyncGroupResponder(resp *http.Response) (result SyncMemberListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySyncGroupNextResults retrieves the next set of results, if any. -func (client SyncMembersClient) listBySyncGroupNextResults(ctx context.Context, lastResults SyncMemberListResult) (result SyncMemberListResult, err error) { - req, err := lastResults.syncMemberListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listBySyncGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySyncGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listBySyncGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySyncGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listBySyncGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySyncGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncMembersClient) ListBySyncGroupComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncMemberListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.ListBySyncGroup") - 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.ListBySyncGroup(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - return -} - -// ListMemberSchemas gets a sync member database schema. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -func (client SyncMembersClient) ListMemberSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncFullSchemaPropertiesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.ListMemberSchemas") - defer func() { - sc := -1 - if result.sfsplr.Response.Response != nil { - sc = result.sfsplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listMemberSchemasNextResults - req, err := client.ListMemberSchemasPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListMemberSchemas", nil, "Failure preparing request") - return - } - - resp, err := client.ListMemberSchemasSender(req) - if err != nil { - result.sfsplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListMemberSchemas", resp, "Failure sending request") - return - } - - result.sfsplr, err = client.ListMemberSchemasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListMemberSchemas", resp, "Failure responding to request") - return - } - if result.sfsplr.hasNextLink() && result.sfsplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListMemberSchemasPreparer prepares the ListMemberSchemas request. -func (client SyncMembersClient) ListMemberSchemasPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/schemas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMemberSchemasSender sends the ListMemberSchemas request. The method will close the -// http.Response Body if it receives an error. -func (client SyncMembersClient) ListMemberSchemasSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMemberSchemasResponder handles the response to the ListMemberSchemas request. The method always -// closes the http.Response Body. -func (client SyncMembersClient) ListMemberSchemasResponder(resp *http.Response) (result SyncFullSchemaPropertiesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listMemberSchemasNextResults retrieves the next set of results, if any. -func (client SyncMembersClient) listMemberSchemasNextResults(ctx context.Context, lastResults SyncFullSchemaPropertiesListResult) (result SyncFullSchemaPropertiesListResult, err error) { - req, err := lastResults.syncFullSchemaPropertiesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listMemberSchemasNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListMemberSchemasSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listMemberSchemasNextResults", resp, "Failure sending next results request") - } - result, err = client.ListMemberSchemasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listMemberSchemasNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListMemberSchemasComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncMembersClient) ListMemberSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncFullSchemaPropertiesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.ListMemberSchemas") - 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.ListMemberSchemas(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) - return -} - -// RefreshMemberSchema refreshes a sync member database schema. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -func (client SyncMembersClient) RefreshMemberSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncMembersRefreshMemberSchemaFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.RefreshMemberSchema") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RefreshMemberSchemaPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "RefreshMemberSchema", nil, "Failure preparing request") - return - } - - result, err = client.RefreshMemberSchemaSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "RefreshMemberSchema", result.Response(), "Failure sending request") - return - } - - return -} - -// RefreshMemberSchemaPreparer prepares the RefreshMemberSchema request. -func (client SyncMembersClient) RefreshMemberSchemaPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshMemberSchemaSender sends the RefreshMemberSchema request. The method will close the -// http.Response Body if it receives an error. -func (client SyncMembersClient) RefreshMemberSchemaSender(req *http.Request) (future SyncMembersRefreshMemberSchemaFuture, 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 -} - -// RefreshMemberSchemaResponder handles the response to the RefreshMemberSchema request. The method always -// closes the http.Response Body. -func (client SyncMembersClient) RefreshMemberSchemaResponder(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 sync member. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -// parameters - the requested sync member resource state. -func (client SyncMembersClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (result SyncMembersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SyncMembersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", 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 SyncMembersClient) UpdateSender(req *http.Request) (future SyncMembersUpdateFuture, 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 SyncMembersClient) UpdateResponder(resp *http.Response) (result SyncMember, 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/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go deleted file mode 100644 index 309e0d47eb0d..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptionactivities.go +++ /dev/null @@ -1,115 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TransparentDataEncryptionActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type TransparentDataEncryptionActivitiesClient struct { - BaseClient -} - -// NewTransparentDataEncryptionActivitiesClient creates an instance of the TransparentDataEncryptionActivitiesClient -// client. -func NewTransparentDataEncryptionActivitiesClient(subscriptionID string) TransparentDataEncryptionActivitiesClient { - return NewTransparentDataEncryptionActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTransparentDataEncryptionActivitiesClientWithBaseURI creates an instance of the -// TransparentDataEncryptionActivitiesClient 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 NewTransparentDataEncryptionActivitiesClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionActivitiesClient { - return TransparentDataEncryptionActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByConfiguration returns a database's transparent data encryption operation result. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the transparent data encryption applies. -func (client TransparentDataEncryptionActivitiesClient) ListByConfiguration(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryptionActivityListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionActivitiesClient.ListByConfiguration") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByConfigurationPreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionActivitiesClient", "ListByConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.ListByConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionActivitiesClient", "ListByConfiguration", resp, "Failure sending request") - return - } - - result, err = client.ListByConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionActivitiesClient", "ListByConfiguration", resp, "Failure responding to request") - return - } - - return -} - -// ListByConfigurationPreparer prepares the ListByConfiguration request. -func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByConfigurationSender sends the ListByConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByConfigurationResponder handles the response to the ListByConfiguration request. The method always -// closes the http.Response Body. -func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationResponder(resp *http.Response) (result TransparentDataEncryptionActivityListResult, 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/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go deleted file mode 100644 index 691b41cd1464..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/transparentdataencryptions.go +++ /dev/null @@ -1,198 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TransparentDataEncryptionsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type TransparentDataEncryptionsClient struct { - BaseClient -} - -// NewTransparentDataEncryptionsClient creates an instance of the TransparentDataEncryptionsClient client. -func NewTransparentDataEncryptionsClient(subscriptionID string) TransparentDataEncryptionsClient { - return NewTransparentDataEncryptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTransparentDataEncryptionsClientWithBaseURI creates an instance of the TransparentDataEncryptionsClient 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 NewTransparentDataEncryptionsClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionsClient { - return TransparentDataEncryptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's transparent data encryption configuration. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which setting the transparent data encryption applies. -// parameters - the required parameters for creating or updating transparent data encryption. -func (client TransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionsClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TransparentDataEncryptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = 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.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}", 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 TransparentDataEncryptionsClient) 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 TransparentDataEncryptionsClient) CreateOrUpdateResponder(resp *http.Response) (result TransparentDataEncryption, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a database's transparent data encryption configuration. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the transparent data encryption applies. -func (client TransparentDataEncryptionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryption, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionsClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TransparentDataEncryptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}", 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 TransparentDataEncryptionsClient) 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 TransparentDataEncryptionsClient) GetResponder(resp *http.Response) (result TransparentDataEncryption, 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/sql/mgmt/2015-05-01-preview/sql/version.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/version.go deleted file mode 100644 index abb874756dee..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package sql - -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() + " sql/2015-05-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/sql/mgmt/2015-05-01-preview/sql/virtualclusters.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/virtualclusters.go deleted file mode 100644 index a5f661baaf7b..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/virtualclusters.go +++ /dev/null @@ -1,502 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// VirtualClustersClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type VirtualClustersClient struct { - BaseClient -} - -// NewVirtualClustersClient creates an instance of the VirtualClustersClient client. -func NewVirtualClustersClient(subscriptionID string) VirtualClustersClient { - return NewVirtualClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualClustersClientWithBaseURI creates an instance of the VirtualClustersClient 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 NewVirtualClustersClientWithBaseURI(baseURI string, subscriptionID string) VirtualClustersClient { - return VirtualClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes a virtual cluster. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// virtualClusterName - the name of the virtual cluster. -func (client VirtualClustersClient) Delete(ctx context.Context, resourceGroupName string, virtualClusterName string) (result VirtualClustersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, virtualClusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualClusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualClusterName": autorest.Encode("path", virtualClusterName), - } - - const APIVersion = "2015-05-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.Sql/virtualClusters/{virtualClusterName}", 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 VirtualClustersClient) DeleteSender(req *http.Request) (future VirtualClustersDeleteFuture, 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 VirtualClustersClient) 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 a virtual cluster. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// virtualClusterName - the name of the virtual cluster. -func (client VirtualClustersClient) Get(ctx context.Context, resourceGroupName string, virtualClusterName string) (result VirtualCluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.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, virtualClusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualClusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualClusterName": autorest.Encode("path", virtualClusterName), - } - - const APIVersion = "2015-05-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.Sql/virtualClusters/{virtualClusterName}", 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 VirtualClustersClient) 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 VirtualClustersClient) GetResponder(resp *http.Response) (result VirtualCluster, 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 virtualClusters in the subscription. -func (client VirtualClustersClient) List(ctx context.Context) (result VirtualClusterListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.List") - defer func() { - sc := -1 - if result.vclr.Response.Response != nil { - sc = result.vclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.vclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "List", resp, "Failure sending request") - return - } - - result.vclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "List", resp, "Failure responding to request") - return - } - if result.vclr.hasNextLink() && result.vclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters", 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 VirtualClustersClient) 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 VirtualClustersClient) ListResponder(resp *http.Response) (result VirtualClusterListResult, 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 VirtualClustersClient) listNextResults(ctx context.Context, lastResults VirtualClusterListResult) (result VirtualClusterListResult, err error) { - req, err := lastResults.virtualClusterListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "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, "sql.VirtualClustersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualClustersClient) ListComplete(ctx context.Context) (result VirtualClusterListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.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 virtual clusters in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -func (client VirtualClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VirtualClusterListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.vclr.Response.Response != nil { - sc = result.vclr.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, "sql.VirtualClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.vclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.vclr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.vclr.hasNextLink() && result.vclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client VirtualClustersClient) 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-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.Sql/virtualClusters", 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 VirtualClustersClient) 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 VirtualClustersClient) ListByResourceGroupResponder(resp *http.Response) (result VirtualClusterListResult, 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 VirtualClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults VirtualClusterListResult) (result VirtualClusterListResult, err error) { - req, err := lastResults.virtualClusterListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "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, "sql.VirtualClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VirtualClusterListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.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 -} - -// Update updates a virtual cluster. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// virtualClusterName - the name of the virtual cluster. -// parameters - the requested managed instance resource state. -func (client VirtualClustersClient) Update(ctx context.Context, resourceGroupName string, virtualClusterName string, parameters VirtualClusterUpdate) (result VirtualClustersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, virtualClusterName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VirtualClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, virtualClusterName string, parameters VirtualClusterUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualClusterName": autorest.Encode("path", virtualClusterName), - } - - const APIVersion = "2015-05-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.Sql/virtualClusters/{virtualClusterName}", 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 VirtualClustersClient) UpdateSender(req *http.Request) (future VirtualClustersUpdateFuture, 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 VirtualClustersClient) UpdateResponder(resp *http.Response) (result VirtualCluster, 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/preview/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go deleted file mode 100644 index 91880b34fb82..000000000000 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/virtualnetworkrules.go +++ /dev/null @@ -1,406 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// VirtualNetworkRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type VirtualNetworkRulesClient struct { - BaseClient -} - -// NewVirtualNetworkRulesClient creates an instance of the VirtualNetworkRulesClient client. -func NewVirtualNetworkRulesClient(subscriptionID string) VirtualNetworkRulesClient { - return NewVirtualNetworkRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworkRulesClientWithBaseURI creates an instance of the VirtualNetworkRulesClient 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 NewVirtualNetworkRulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkRulesClient { - return VirtualNetworkRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an existing virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -// parameters - the requested virtual Network Rule Resource state. -func (client VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (result VirtualNetworkRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties.VirtualNetworkSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.VirtualNetworkRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworkRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkRulesCreateOrUpdateFuture, 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 VirtualNetworkRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkRule, 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 the virtual network rule with the given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworkRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) DeleteSender(req *http.Request) (future VirtualNetworkRulesDeleteFuture, 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 VirtualNetworkRulesClient) 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 a virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.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, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworkRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) 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 VirtualNetworkRulesClient) GetResponder(resp *http.Response) (result VirtualNetworkRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of virtual network rules in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client VirtualNetworkRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - defer func() { - sc := -1 - if result.vnrlr.Response.Response != nil { - sc = result.vnrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.vnrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.vnrlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.vnrlr.hasNextLink() && result.vnrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client VirtualNetworkRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/virtualNetworkRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) ListByServerResponder(resp *http.Response) (result VirtualNetworkRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client VirtualNetworkRulesClient) listByServerNextResults(ctx context.Context, lastResults VirtualNetworkRuleListResult) (result VirtualNetworkRuleListResult, err error) { - req, err := lastResults.virtualNetworkRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/CHANGELOG.md b/services/preview/sql/mgmt/2017-10-01-preview/sql/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/_meta.json b/services/preview/sql/mgmt/2017-10-01-preview/sql/_meta.json deleted file mode 100644 index 4df1e8fcb670..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", - "tag": "package-pure-2017-10-preview", - "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-pure-2017-10-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/backupshorttermretentionpolicies.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/backupshorttermretentionpolicies.go deleted file mode 100644 index c9bf2b72f18f..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/backupshorttermretentionpolicies.go +++ /dev/null @@ -1,407 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BackupShortTermRetentionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type BackupShortTermRetentionPoliciesClient struct { - BaseClient -} - -// NewBackupShortTermRetentionPoliciesClient creates an instance of the BackupShortTermRetentionPoliciesClient client. -func NewBackupShortTermRetentionPoliciesClient(subscriptionID string) BackupShortTermRetentionPoliciesClient { - return NewBackupShortTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupShortTermRetentionPoliciesClientWithBaseURI creates an instance of the -// BackupShortTermRetentionPoliciesClient 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 NewBackupShortTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupShortTermRetentionPoliciesClient { - return BackupShortTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates a database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the short term retention policy info. -func (client BackupShortTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (result BackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackupShortTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}", 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 BackupShortTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future BackupShortTermRetentionPoliciesCreateOrUpdateFuture, 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 BackupShortTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupShortTermRetentionPolicy, 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 a database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client BackupShortTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupShortTermRetentionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupShortTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{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 BackupShortTermRetentionPoliciesClient) 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 BackupShortTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result BackupShortTermRetentionPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets a database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupShortTermRetentionPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.bstrplr.Response.Response != nil { - sc = result.bstrplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.bstrplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.bstrplr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.bstrplr.hasNextLink() && result.bstrplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result BackupShortTermRetentionPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client BackupShortTermRetentionPoliciesClient) listByDatabaseNextResults(ctx context.Context, lastResults BackupShortTermRetentionPolicyListResult) (result BackupShortTermRetentionPolicyListResult, err error) { - req, err := lastResults.backupShortTermRetentionPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupShortTermRetentionPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} - -// Update updates a database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the short term retention policy info. -func (client BackupShortTermRetentionPoliciesClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (result BackupShortTermRetentionPoliciesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackupShortTermRetentionPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}", 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 BackupShortTermRetentionPoliciesClient) UpdateSender(req *http.Request) (future BackupShortTermRetentionPoliciesUpdateFuture, 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 BackupShortTermRetentionPoliciesClient) UpdateResponder(resp *http.Response) (result BackupShortTermRetentionPolicy, 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/preview/sql/mgmt/2017-10-01-preview/sql/capabilities.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/capabilities.go deleted file mode 100644 index c7042373e494..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/capabilities.go +++ /dev/null @@ -1,111 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CapabilitiesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type CapabilitiesClient struct { - BaseClient -} - -// NewCapabilitiesClient creates an instance of the CapabilitiesClient client. -func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { - return NewCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCapabilitiesClientWithBaseURI creates an instance of the CapabilitiesClient 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 NewCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) CapabilitiesClient { - return CapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByLocation gets the subscription capabilities available for the specified location. -// Parameters: -// locationName - the location name whose capabilities are retrieved. -// include - if specified, restricts the response to only include the selected item. -func (client CapabilitiesClient) ListByLocation(ctx context.Context, locationName string, include CapabilityGroup) (result LocationCapabilities, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesClient.ListByLocation") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByLocationPreparer(ctx, locationName, include) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure sending request") - return - } - - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure responding to request") - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client CapabilitiesClient) ListByLocationPreparer(ctx context.Context, locationName string, include CapabilityGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(include)) > 0 { - queryParameters["include"] = autorest.Encode("query", include) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client CapabilitiesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client CapabilitiesClient) ListByLocationResponder(resp *http.Response) (result LocationCapabilities, 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/sql/mgmt/2017-10-01-preview/sql/client.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/client.go deleted file mode 100644 index 2a09dc10b32d..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/client.go +++ /dev/null @@ -1,42 +0,0 @@ -// Package sql implements the Azure ARM Sql service API version 2017-10-01-preview. -// -// The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database -// services to manage your databases. The API enables you to create, retrieve, update, and delete databases. -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Sql - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Sql. -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/sql/mgmt/2017-10-01-preview/sql/databaseoperations.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/databaseoperations.go deleted file mode 100644 index 48ced4d98663..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/databaseoperations.go +++ /dev/null @@ -1,236 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// DatabaseOperationsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type DatabaseOperationsClient struct { - BaseClient -} - -// NewDatabaseOperationsClient creates an instance of the DatabaseOperationsClient client. -func NewDatabaseOperationsClient(subscriptionID string) DatabaseOperationsClient { - return NewDatabaseOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseOperationsClientWithBaseURI creates an instance of the DatabaseOperationsClient 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 NewDatabaseOperationsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseOperationsClient { - return DatabaseOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancels the asynchronous operation on the database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// operationID - the operation identifier. -func (client DatabaseOperationsClient) Cancel(ctx context.Context, resourceGroupName string, serverName string, databaseName string, operationID uuid.UUID) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationsClient.Cancel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelPreparer(ctx, resourceGroupName, serverName, databaseName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "Cancel", resp, "Failure responding to request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client DatabaseOperationsClient) CancelPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, operationID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseOperationsClient) CancelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client DatabaseOperationsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByDatabase gets a list of operations performed on the database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseOperationsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseOperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationsClient.ListByDatabase") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.dolr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DatabaseOperationsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseOperationsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DatabaseOperationsClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseOperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client DatabaseOperationsClient) listByDatabaseNextResults(ctx context.Context, lastResults DatabaseOperationListResult) (result DatabaseOperationListResult, err error) { - req, err := lastResults.databaseOperationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabaseOperationsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseOperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationsClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/databases.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/databases.go deleted file mode 100644 index 2ed92b70f267..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/databases.go +++ /dev/null @@ -1,949 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient 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 NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new database or updates an existing database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the requested database resource state. -func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.DatabaseProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DatabaseProperties.CurrentSku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DatabaseProperties.CurrentSku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.ManagedBy = 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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, 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 DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, 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 the database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, 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 DatabasesClient) 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 a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) 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 DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByElasticPool gets a list of databases in an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client DatabasesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByElasticPool") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByElasticPoolNextResults - req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByElasticPool", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByElasticPool", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByElasticPoolPreparer prepares the ListByElasticPool request. -func (client DatabasesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByElasticPoolSender sends the ListByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByElasticPoolResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByElasticPoolNextResults retrieves the next set of results, if any. -func (client DatabasesClient) listByElasticPoolNextResults(ctx context.Context, lastResults DatabaseListResult) (result DatabaseListResult, err error) { - req, err := lastResults.databaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByElasticPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByElasticPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByElasticPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByElasticPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabasesClient) ListByElasticPoolComplete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByElasticPool") - 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.ListByElasticPool(ctx, resourceGroupName, serverName, elasticPoolName) - return -} - -// ListByServer gets a list of databases. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client DatabasesClient) listByServerNextResults(ctx context.Context, lastResults DatabaseListResult) (result DatabaseListResult, err error) { - req, err := lastResults.databaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabasesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// Pause pauses a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be paused. -func (client DatabasesClient) Pause(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesPauseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Pause") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PausePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", nil, "Failure preparing request") - return - } - - result, err = client.PauseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", result.Response(), "Failure sending request") - return - } - - return -} - -// PausePreparer prepares the Pause request. -func (client DatabasesClient) PausePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/pause", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PauseSender sends the Pause request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) PauseSender(req *http.Request) (future DatabasesPauseFuture, 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 -} - -// PauseResponder handles the response to the Pause request. The method always -// closes the http.Response Body. -func (client DatabasesClient) PauseResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Rename renames a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to rename. -// parameters - the resource move definition for renaming this database. -func (client DatabasesClient) Rename(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ResourceMoveDefinition) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Rename") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "Rename", err.Error()) - } - - req, err := client.RenamePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Rename", nil, "Failure preparing request") - return - } - - resp, err := client.RenameSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Rename", resp, "Failure sending request") - return - } - - result, err = client.RenameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Rename", resp, "Failure responding to request") - return - } - - return -} - -// RenamePreparer prepares the Rename request. -func (client DatabasesClient) RenamePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ResourceMoveDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/move", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RenameSender sends the Rename request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) RenameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RenameResponder handles the response to the Rename request. The method always -// closes the http.Response Body. -func (client DatabasesClient) RenameResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Resume resumes a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be resumed. -func (client DatabasesClient) Resume(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesResumeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Resume") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ResumePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", nil, "Failure preparing request") - return - } - - result, err = client.ResumeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", result.Response(), "Failure sending request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client DatabasesClient) ResumePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/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 DatabasesClient) ResumeSender(req *http.Request) (future DatabasesResumeFuture, 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 DatabasesClient) ResumeResponder(resp *http.Response) (result Database, 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 database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the requested database resource state. -func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseUpdate) (result DatabasesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) UpdateSender(req *http.Request) (future DatabasesUpdateFuture, 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 DatabasesClient) UpdateResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpgradeDataWarehouse upgrades a data warehouse. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be upgraded. -func (client DatabasesClient) UpgradeDataWarehouse(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesUpgradeDataWarehouseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.UpgradeDataWarehouse") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpgradeDataWarehousePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "UpgradeDataWarehouse", nil, "Failure preparing request") - return - } - - result, err = client.UpgradeDataWarehouseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "UpgradeDataWarehouse", result.Response(), "Failure sending request") - return - } - - return -} - -// UpgradeDataWarehousePreparer prepares the UpgradeDataWarehouse request. -func (client DatabasesClient) UpgradeDataWarehousePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpgradeDataWarehouseSender sends the UpgradeDataWarehouse request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) UpgradeDataWarehouseSender(req *http.Request) (future DatabasesUpgradeDataWarehouseFuture, 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 -} - -// UpgradeDataWarehouseResponder handles the response to the UpgradeDataWarehouse request. The method always -// closes the http.Response Body. -func (client DatabasesClient) UpgradeDataWarehouseResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/databasevulnerabilityassessmentscans.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/databasevulnerabilityassessmentscans.go deleted file mode 100644 index b9e0362af212..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/databasevulnerabilityassessmentscans.go +++ /dev/null @@ -1,405 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseVulnerabilityAssessmentScansClient is the the Azure SQL Database management API provides a RESTful set of -// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type DatabaseVulnerabilityAssessmentScansClient struct { - BaseClient -} - -// NewDatabaseVulnerabilityAssessmentScansClient creates an instance of the DatabaseVulnerabilityAssessmentScansClient -// client. -func NewDatabaseVulnerabilityAssessmentScansClient(subscriptionID string) DatabaseVulnerabilityAssessmentScansClient { - return NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI creates an instance of the -// DatabaseVulnerabilityAssessmentScansClient 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 NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(baseURI string, subscriptionID string) DatabaseVulnerabilityAssessmentScansClient { - return DatabaseVulnerabilityAssessmentScansClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Export convert an existing scan result to a human readable format. If already exists nothing happens -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the scanned database. -// scanID - the vulnerability assessment scan Id. -func (client DatabaseVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansExport, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.Export") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExportPreparer(ctx, resourceGroupName, serverName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", nil, "Failure preparing request") - return - } - - resp, err := client.ExportSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure sending request") - return - } - - result, err = client.ExportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure responding to request") - return - } - - return -} - -// ExportPreparer prepares the Export request. -func (client DatabaseVulnerabilityAssessmentScansClient) ExportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentScansClient) ExportSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentScansClient) ExportResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentScansExport, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a vulnerability assessment scan record of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client DatabaseVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result VulnerabilityAssessmentScanRecord, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.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, serverName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseVulnerabilityAssessmentScansClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}", 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 DatabaseVulnerabilityAssessmentScansClient) 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 DatabaseVulnerabilityAssessmentScansClient) GetResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecord, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// InitiateScan executes a Vulnerability Assessment database scan. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScan(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.InitiateScan") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.InitiateScanPreparer(ctx, resourceGroupName, serverName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "InitiateScan", nil, "Failure preparing request") - return - } - - result, err = client.InitiateScanSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "InitiateScan", result.Response(), "Failure sending request") - return - } - - return -} - -// InitiateScanPreparer prepares the InitiateScan request. -func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScanPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// InitiateScanSender sends the InitiateScan request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScanSender(req *http.Request) (future DatabaseVulnerabilityAssessmentScansInitiateScanFuture, 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 -} - -// InitiateScanResponder handles the response to the InitiateScan request. The method always -// closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScanResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByDatabase lists the vulnerability assessment scans of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result VulnerabilityAssessmentScanRecordListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.ListByDatabase") - defer func() { - sc := -1 - if result.vasrlr.Response.Response != nil { - sc = result.vasrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.vasrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.vasrlr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.vasrlr.hasNextLink() && result.vasrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabaseResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecordListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client DatabaseVulnerabilityAssessmentScansClient) listByDatabaseNextResults(ctx context.Context, lastResults VulnerabilityAssessmentScanRecordListResult) (result VulnerabilityAssessmentScanRecordListResult, err error) { - req, err := lastResults.vulnerabilityAssessmentScanRecordListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result VulnerabilityAssessmentScanRecordListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/elasticpooloperations.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/elasticpooloperations.go deleted file mode 100644 index d8bd4555a2cc..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/elasticpooloperations.go +++ /dev/null @@ -1,234 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// ElasticPoolOperationsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ElasticPoolOperationsClient struct { - BaseClient -} - -// NewElasticPoolOperationsClient creates an instance of the ElasticPoolOperationsClient client. -func NewElasticPoolOperationsClient(subscriptionID string) ElasticPoolOperationsClient { - return NewElasticPoolOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolOperationsClientWithBaseURI creates an instance of the ElasticPoolOperationsClient 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 NewElasticPoolOperationsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolOperationsClient { - return ElasticPoolOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancels the asynchronous operation on the elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// operationID - the operation identifier. -func (client ElasticPoolOperationsClient) Cancel(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, operationID uuid.UUID) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationsClient.Cancel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelPreparer(ctx, resourceGroupName, serverName, elasticPoolName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "Cancel", resp, "Failure responding to request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client ElasticPoolOperationsClient) CancelPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, operationID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolOperationsClient) CancelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client ElasticPoolOperationsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByElasticPool gets a list of operations performed on the elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ElasticPoolOperationsClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolOperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationsClient.ListByElasticPool") - defer func() { - sc := -1 - if result.epolr.Response.Response != nil { - sc = result.epolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByElasticPoolNextResults - req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "ListByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.epolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "ListByElasticPool", resp, "Failure sending request") - return - } - - result.epolr, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "ListByElasticPool", resp, "Failure responding to request") - return - } - if result.epolr.hasNextLink() && result.epolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByElasticPoolPreparer prepares the ListByElasticPool request. -func (client ElasticPoolOperationsClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByElasticPoolSender sends the ListByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolOperationsClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always -// closes the http.Response Body. -func (client ElasticPoolOperationsClient) ListByElasticPoolResponder(resp *http.Response) (result ElasticPoolOperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByElasticPoolNextResults retrieves the next set of results, if any. -func (client ElasticPoolOperationsClient) listByElasticPoolNextResults(ctx context.Context, lastResults ElasticPoolOperationListResult) (result ElasticPoolOperationListResult, err error) { - req, err := lastResults.elasticPoolOperationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "listByElasticPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "listByElasticPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "listByElasticPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByElasticPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client ElasticPoolOperationsClient) ListByElasticPoolComplete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolOperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationsClient.ListByElasticPool") - 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.ListByElasticPool(ctx, resourceGroupName, serverName, elasticPoolName) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/elasticpools.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/elasticpools.go deleted file mode 100644 index fbb54bf4cb1d..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/elasticpools.go +++ /dev/null @@ -1,495 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ElasticPoolsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type ElasticPoolsClient struct { - BaseClient -} - -// NewElasticPoolsClient creates an instance of the ElasticPoolsClient client. -func NewElasticPoolsClient(subscriptionID string) ElasticPoolsClient { - return NewElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolsClientWithBaseURI creates an instance of the ElasticPoolsClient 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 NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolsClient { - return ElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -// parameters - the elastic pool parameters. -func (client ElasticPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool) (result ElasticPoolsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ElasticPoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, elasticPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ElasticPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) CreateOrUpdateSender(req *http.Request) (future ElasticPoolsCreateOrUpdateFuture, 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 ElasticPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result ElasticPool, 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 elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client ElasticPoolsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ElasticPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) DeleteSender(req *http.Request) (future ElasticPoolsDeleteFuture, 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 ElasticPoolsClient) 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 elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client ElasticPoolsClient) Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.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, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ElasticPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) 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 ElasticPoolsClient) GetResponder(resp *http.Response) (result ElasticPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets all elastic pools in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// skip - the number of elements in the collection to skip. -func (client ElasticPoolsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result ElasticPoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListByServer") - defer func() { - sc := -1 - if result.eplr.Response.Response != nil { - sc = result.eplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.eplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.eplr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.eplr.hasNextLink() && result.eplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ElasticPoolsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Sql/servers/{serverName}/elasticPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (result ElasticPoolListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ElasticPoolsClient) listByServerNextResults(ctx context.Context, lastResults ElasticPoolListResult) (result ElasticPoolListResult, err error) { - req, err := lastResults.elasticPoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ElasticPoolsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result ElasticPoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName, skip) - return -} - -// Update updates an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -// parameters - the elastic pool update parameters. -func (client ElasticPoolsClient) Update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPoolUpdate) (result ElasticPoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, elasticPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ElasticPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPoolUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) UpdateSender(req *http.Request) (future ElasticPoolsUpdateFuture, 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 ElasticPoolsClient) UpdateResponder(resp *http.Response) (result ElasticPool, 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/preview/sql/mgmt/2017-10-01-preview/sql/enums.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/enums.go deleted file mode 100644 index a7ed4ce7220d..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/enums.go +++ /dev/null @@ -1,409 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CapabilityGroup enumerates the values for capability group. -type CapabilityGroup string - -const ( - // SupportedEditions ... - SupportedEditions CapabilityGroup = "supportedEditions" - // SupportedElasticPoolEditions ... - SupportedElasticPoolEditions CapabilityGroup = "supportedElasticPoolEditions" - // SupportedManagedInstanceVersions ... - SupportedManagedInstanceVersions CapabilityGroup = "supportedManagedInstanceVersions" -) - -// PossibleCapabilityGroupValues returns an array of possible values for the CapabilityGroup const type. -func PossibleCapabilityGroupValues() []CapabilityGroup { - return []CapabilityGroup{SupportedEditions, SupportedElasticPoolEditions, SupportedManagedInstanceVersions} -} - -// CapabilityStatus enumerates the values for capability status. -type CapabilityStatus string - -const ( - // Available ... - Available CapabilityStatus = "Available" - // Default ... - Default CapabilityStatus = "Default" - // Disabled ... - Disabled CapabilityStatus = "Disabled" - // Visible ... - Visible CapabilityStatus = "Visible" -) - -// PossibleCapabilityStatusValues returns an array of possible values for the CapabilityStatus const type. -func PossibleCapabilityStatusValues() []CapabilityStatus { - return []CapabilityStatus{Available, Default, Disabled, Visible} -} - -// CatalogCollationType enumerates the values for catalog collation type. -type CatalogCollationType string - -const ( - // DATABASEDEFAULT ... - DATABASEDEFAULT CatalogCollationType = "DATABASE_DEFAULT" - // SQLLatin1GeneralCP1CIAS ... - SQLLatin1GeneralCP1CIAS CatalogCollationType = "SQL_Latin1_General_CP1_CI_AS" -) - -// PossibleCatalogCollationTypeValues returns an array of possible values for the CatalogCollationType const type. -func PossibleCatalogCollationTypeValues() []CatalogCollationType { - return []CatalogCollationType{DATABASEDEFAULT, SQLLatin1GeneralCP1CIAS} -} - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // CreateModeCopy ... - CreateModeCopy CreateMode = "Copy" - // CreateModeDefault ... - CreateModeDefault CreateMode = "Default" - // CreateModeOnlineSecondary ... - CreateModeOnlineSecondary CreateMode = "OnlineSecondary" - // CreateModePointInTimeRestore ... - CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" - // CreateModeRecovery ... - CreateModeRecovery CreateMode = "Recovery" - // CreateModeRestore ... - CreateModeRestore CreateMode = "Restore" - // CreateModeRestoreExternalBackup ... - CreateModeRestoreExternalBackup CreateMode = "RestoreExternalBackup" - // CreateModeRestoreExternalBackupSecondary ... - CreateModeRestoreExternalBackupSecondary CreateMode = "RestoreExternalBackupSecondary" - // CreateModeRestoreLongTermRetentionBackup ... - CreateModeRestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup" - // CreateModeSecondary ... - CreateModeSecondary CreateMode = "Secondary" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{CreateModeCopy, CreateModeDefault, CreateModeOnlineSecondary, CreateModePointInTimeRestore, CreateModeRecovery, CreateModeRestore, CreateModeRestoreExternalBackup, CreateModeRestoreExternalBackupSecondary, CreateModeRestoreLongTermRetentionBackup, CreateModeSecondary} -} - -// DatabaseLicenseType enumerates the values for database license type. -type DatabaseLicenseType string - -const ( - // BasePrice ... - BasePrice DatabaseLicenseType = "BasePrice" - // LicenseIncluded ... - LicenseIncluded DatabaseLicenseType = "LicenseIncluded" -) - -// PossibleDatabaseLicenseTypeValues returns an array of possible values for the DatabaseLicenseType const type. -func PossibleDatabaseLicenseTypeValues() []DatabaseLicenseType { - return []DatabaseLicenseType{BasePrice, LicenseIncluded} -} - -// DatabaseReadScale enumerates the values for database read scale. -type DatabaseReadScale string - -const ( - // DatabaseReadScaleDisabled ... - DatabaseReadScaleDisabled DatabaseReadScale = "Disabled" - // DatabaseReadScaleEnabled ... - DatabaseReadScaleEnabled DatabaseReadScale = "Enabled" -) - -// PossibleDatabaseReadScaleValues returns an array of possible values for the DatabaseReadScale const type. -func PossibleDatabaseReadScaleValues() []DatabaseReadScale { - return []DatabaseReadScale{DatabaseReadScaleDisabled, DatabaseReadScaleEnabled} -} - -// DatabaseStatus enumerates the values for database status. -type DatabaseStatus string - -const ( - // DatabaseStatusAutoClosed ... - DatabaseStatusAutoClosed DatabaseStatus = "AutoClosed" - // DatabaseStatusCopying ... - DatabaseStatusCopying DatabaseStatus = "Copying" - // DatabaseStatusCreating ... - DatabaseStatusCreating DatabaseStatus = "Creating" - // DatabaseStatusDisabled ... - DatabaseStatusDisabled DatabaseStatus = "Disabled" - // DatabaseStatusEmergencyMode ... - DatabaseStatusEmergencyMode DatabaseStatus = "EmergencyMode" - // DatabaseStatusInaccessible ... - DatabaseStatusInaccessible DatabaseStatus = "Inaccessible" - // DatabaseStatusOffline ... - DatabaseStatusOffline DatabaseStatus = "Offline" - // DatabaseStatusOfflineChangingDwPerformanceTiers ... - DatabaseStatusOfflineChangingDwPerformanceTiers DatabaseStatus = "OfflineChangingDwPerformanceTiers" - // DatabaseStatusOfflineSecondary ... - DatabaseStatusOfflineSecondary DatabaseStatus = "OfflineSecondary" - // DatabaseStatusOnline ... - DatabaseStatusOnline DatabaseStatus = "Online" - // DatabaseStatusOnlineChangingDwPerformanceTiers ... - DatabaseStatusOnlineChangingDwPerformanceTiers DatabaseStatus = "OnlineChangingDwPerformanceTiers" - // DatabaseStatusPaused ... - DatabaseStatusPaused DatabaseStatus = "Paused" - // DatabaseStatusPausing ... - DatabaseStatusPausing DatabaseStatus = "Pausing" - // DatabaseStatusRecovering ... - DatabaseStatusRecovering DatabaseStatus = "Recovering" - // DatabaseStatusRecoveryPending ... - DatabaseStatusRecoveryPending DatabaseStatus = "RecoveryPending" - // DatabaseStatusRestoring ... - DatabaseStatusRestoring DatabaseStatus = "Restoring" - // DatabaseStatusResuming ... - DatabaseStatusResuming DatabaseStatus = "Resuming" - // DatabaseStatusScaling ... - DatabaseStatusScaling DatabaseStatus = "Scaling" - // DatabaseStatusShutdown ... - DatabaseStatusShutdown DatabaseStatus = "Shutdown" - // DatabaseStatusStandby ... - DatabaseStatusStandby DatabaseStatus = "Standby" - // DatabaseStatusSuspect ... - DatabaseStatusSuspect DatabaseStatus = "Suspect" -) - -// PossibleDatabaseStatusValues returns an array of possible values for the DatabaseStatus const type. -func PossibleDatabaseStatusValues() []DatabaseStatus { - return []DatabaseStatus{DatabaseStatusAutoClosed, DatabaseStatusCopying, DatabaseStatusCreating, DatabaseStatusDisabled, DatabaseStatusEmergencyMode, DatabaseStatusInaccessible, DatabaseStatusOffline, DatabaseStatusOfflineChangingDwPerformanceTiers, DatabaseStatusOfflineSecondary, DatabaseStatusOnline, DatabaseStatusOnlineChangingDwPerformanceTiers, DatabaseStatusPaused, DatabaseStatusPausing, DatabaseStatusRecovering, DatabaseStatusRecoveryPending, DatabaseStatusRestoring, DatabaseStatusResuming, DatabaseStatusScaling, DatabaseStatusShutdown, DatabaseStatusStandby, DatabaseStatusSuspect} -} - -// ElasticPoolLicenseType enumerates the values for elastic pool license type. -type ElasticPoolLicenseType string - -const ( - // ElasticPoolLicenseTypeBasePrice ... - ElasticPoolLicenseTypeBasePrice ElasticPoolLicenseType = "BasePrice" - // ElasticPoolLicenseTypeLicenseIncluded ... - ElasticPoolLicenseTypeLicenseIncluded ElasticPoolLicenseType = "LicenseIncluded" -) - -// PossibleElasticPoolLicenseTypeValues returns an array of possible values for the ElasticPoolLicenseType const type. -func PossibleElasticPoolLicenseTypeValues() []ElasticPoolLicenseType { - return []ElasticPoolLicenseType{ElasticPoolLicenseTypeBasePrice, ElasticPoolLicenseTypeLicenseIncluded} -} - -// ElasticPoolState enumerates the values for elastic pool state. -type ElasticPoolState string - -const ( - // ElasticPoolStateCreating ... - ElasticPoolStateCreating ElasticPoolState = "Creating" - // ElasticPoolStateDisabled ... - ElasticPoolStateDisabled ElasticPoolState = "Disabled" - // ElasticPoolStateReady ... - ElasticPoolStateReady ElasticPoolState = "Ready" -) - -// PossibleElasticPoolStateValues returns an array of possible values for the ElasticPoolState const type. -func PossibleElasticPoolStateValues() []ElasticPoolState { - return []ElasticPoolState{ElasticPoolStateCreating, ElasticPoolStateDisabled, ElasticPoolStateReady} -} - -// InstanceFailoverGroupReplicationRole enumerates the values for instance failover group replication role. -type InstanceFailoverGroupReplicationRole string - -const ( - // Primary ... - Primary InstanceFailoverGroupReplicationRole = "Primary" - // Secondary ... - Secondary InstanceFailoverGroupReplicationRole = "Secondary" -) - -// PossibleInstanceFailoverGroupReplicationRoleValues returns an array of possible values for the InstanceFailoverGroupReplicationRole const type. -func PossibleInstanceFailoverGroupReplicationRoleValues() []InstanceFailoverGroupReplicationRole { - return []InstanceFailoverGroupReplicationRole{Primary, Secondary} -} - -// LogSizeUnit enumerates the values for log size unit. -type LogSizeUnit string - -const ( - // Gigabytes ... - Gigabytes LogSizeUnit = "Gigabytes" - // Megabytes ... - Megabytes LogSizeUnit = "Megabytes" - // Percent ... - Percent LogSizeUnit = "Percent" - // Petabytes ... - Petabytes LogSizeUnit = "Petabytes" - // Terabytes ... - Terabytes LogSizeUnit = "Terabytes" -) - -// PossibleLogSizeUnitValues returns an array of possible values for the LogSizeUnit const type. -func PossibleLogSizeUnitValues() []LogSizeUnit { - return []LogSizeUnit{Gigabytes, Megabytes, Percent, Petabytes, Terabytes} -} - -// ManagementOperationState enumerates the values for management operation state. -type ManagementOperationState string - -const ( - // CancelInProgress ... - CancelInProgress ManagementOperationState = "CancelInProgress" - // Cancelled ... - Cancelled ManagementOperationState = "Cancelled" - // Failed ... - Failed ManagementOperationState = "Failed" - // InProgress ... - InProgress ManagementOperationState = "InProgress" - // Pending ... - Pending ManagementOperationState = "Pending" - // Succeeded ... - Succeeded ManagementOperationState = "Succeeded" -) - -// PossibleManagementOperationStateValues returns an array of possible values for the ManagementOperationState const type. -func PossibleManagementOperationStateValues() []ManagementOperationState { - return []ManagementOperationState{CancelInProgress, Cancelled, Failed, InProgress, Pending, Succeeded} -} - -// MaxSizeUnit enumerates the values for max size unit. -type MaxSizeUnit string - -const ( - // MaxSizeUnitGigabytes ... - MaxSizeUnitGigabytes MaxSizeUnit = "Gigabytes" - // MaxSizeUnitMegabytes ... - MaxSizeUnitMegabytes MaxSizeUnit = "Megabytes" - // MaxSizeUnitPetabytes ... - MaxSizeUnitPetabytes MaxSizeUnit = "Petabytes" - // MaxSizeUnitTerabytes ... - MaxSizeUnitTerabytes MaxSizeUnit = "Terabytes" -) - -// PossibleMaxSizeUnitValues returns an array of possible values for the MaxSizeUnit const type. -func PossibleMaxSizeUnitValues() []MaxSizeUnit { - return []MaxSizeUnit{MaxSizeUnitGigabytes, MaxSizeUnitMegabytes, MaxSizeUnitPetabytes, MaxSizeUnitTerabytes} -} - -// PerformanceLevelUnit enumerates the values for performance level unit. -type PerformanceLevelUnit string - -const ( - // DTU ... - DTU PerformanceLevelUnit = "DTU" - // VCores ... - VCores PerformanceLevelUnit = "VCores" -) - -// PossiblePerformanceLevelUnitValues returns an array of possible values for the PerformanceLevelUnit const type. -func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { - return []PerformanceLevelUnit{DTU, VCores} -} - -// ReadOnlyEndpointFailoverPolicy enumerates the values for read only endpoint failover policy. -type ReadOnlyEndpointFailoverPolicy string - -const ( - // ReadOnlyEndpointFailoverPolicyDisabled ... - ReadOnlyEndpointFailoverPolicyDisabled ReadOnlyEndpointFailoverPolicy = "Disabled" - // ReadOnlyEndpointFailoverPolicyEnabled ... - ReadOnlyEndpointFailoverPolicyEnabled ReadOnlyEndpointFailoverPolicy = "Enabled" -) - -// PossibleReadOnlyEndpointFailoverPolicyValues returns an array of possible values for the ReadOnlyEndpointFailoverPolicy const type. -func PossibleReadOnlyEndpointFailoverPolicyValues() []ReadOnlyEndpointFailoverPolicy { - return []ReadOnlyEndpointFailoverPolicy{ReadOnlyEndpointFailoverPolicyDisabled, ReadOnlyEndpointFailoverPolicyEnabled} -} - -// ReadWriteEndpointFailoverPolicy enumerates the values for read write endpoint failover policy. -type ReadWriteEndpointFailoverPolicy string - -const ( - // Automatic ... - Automatic ReadWriteEndpointFailoverPolicy = "Automatic" - // Manual ... - Manual ReadWriteEndpointFailoverPolicy = "Manual" -) - -// PossibleReadWriteEndpointFailoverPolicyValues returns an array of possible values for the ReadWriteEndpointFailoverPolicy const type. -func PossibleReadWriteEndpointFailoverPolicyValues() []ReadWriteEndpointFailoverPolicy { - return []ReadWriteEndpointFailoverPolicy{Automatic, Manual} -} - -// SampleName enumerates the values for sample name. -type SampleName string - -const ( - // AdventureWorksLT ... - AdventureWorksLT SampleName = "AdventureWorksLT" - // WideWorldImportersFull ... - WideWorldImportersFull SampleName = "WideWorldImportersFull" - // WideWorldImportersStd ... - WideWorldImportersStd SampleName = "WideWorldImportersStd" -) - -// PossibleSampleNameValues returns an array of possible values for the SampleName const type. -func PossibleSampleNameValues() []SampleName { - return []SampleName{AdventureWorksLT, WideWorldImportersFull, WideWorldImportersStd} -} - -// ServerKeyType enumerates the values for server key type. -type ServerKeyType string - -const ( - // AzureKeyVault ... - AzureKeyVault ServerKeyType = "AzureKeyVault" - // ServiceManaged ... - ServiceManaged ServerKeyType = "ServiceManaged" -) - -// PossibleServerKeyTypeValues returns an array of possible values for the ServerKeyType const type. -func PossibleServerKeyTypeValues() []ServerKeyType { - return []ServerKeyType{AzureKeyVault, ServiceManaged} -} - -// VulnerabilityAssessmentPolicyBaselineName enumerates the values for vulnerability assessment policy baseline -// name. -type VulnerabilityAssessmentPolicyBaselineName string - -const ( - // VulnerabilityAssessmentPolicyBaselineNameDefault ... - VulnerabilityAssessmentPolicyBaselineNameDefault VulnerabilityAssessmentPolicyBaselineName = "default" - // VulnerabilityAssessmentPolicyBaselineNameMaster ... - VulnerabilityAssessmentPolicyBaselineNameMaster VulnerabilityAssessmentPolicyBaselineName = "master" -) - -// PossibleVulnerabilityAssessmentPolicyBaselineNameValues returns an array of possible values for the VulnerabilityAssessmentPolicyBaselineName const type. -func PossibleVulnerabilityAssessmentPolicyBaselineNameValues() []VulnerabilityAssessmentPolicyBaselineName { - return []VulnerabilityAssessmentPolicyBaselineName{VulnerabilityAssessmentPolicyBaselineNameDefault, VulnerabilityAssessmentPolicyBaselineNameMaster} -} - -// VulnerabilityAssessmentScanState enumerates the values for vulnerability assessment scan state. -type VulnerabilityAssessmentScanState string - -const ( - // VulnerabilityAssessmentScanStateFailed ... - VulnerabilityAssessmentScanStateFailed VulnerabilityAssessmentScanState = "Failed" - // VulnerabilityAssessmentScanStateFailedToRun ... - VulnerabilityAssessmentScanStateFailedToRun VulnerabilityAssessmentScanState = "FailedToRun" - // VulnerabilityAssessmentScanStateInProgress ... - VulnerabilityAssessmentScanStateInProgress VulnerabilityAssessmentScanState = "InProgress" - // VulnerabilityAssessmentScanStatePassed ... - VulnerabilityAssessmentScanStatePassed VulnerabilityAssessmentScanState = "Passed" -) - -// PossibleVulnerabilityAssessmentScanStateValues returns an array of possible values for the VulnerabilityAssessmentScanState const type. -func PossibleVulnerabilityAssessmentScanStateValues() []VulnerabilityAssessmentScanState { - return []VulnerabilityAssessmentScanState{VulnerabilityAssessmentScanStateFailed, VulnerabilityAssessmentScanStateFailedToRun, VulnerabilityAssessmentScanStateInProgress, VulnerabilityAssessmentScanStatePassed} -} - -// VulnerabilityAssessmentScanTriggerType enumerates the values for vulnerability assessment scan trigger type. -type VulnerabilityAssessmentScanTriggerType string - -const ( - // OnDemand ... - OnDemand VulnerabilityAssessmentScanTriggerType = "OnDemand" - // Recurring ... - Recurring VulnerabilityAssessmentScanTriggerType = "Recurring" -) - -// PossibleVulnerabilityAssessmentScanTriggerTypeValues returns an array of possible values for the VulnerabilityAssessmentScanTriggerType const type. -func PossibleVulnerabilityAssessmentScanTriggerTypeValues() []VulnerabilityAssessmentScanTriggerType { - return []VulnerabilityAssessmentScanTriggerType{OnDemand, Recurring} -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/instancefailovergroups.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/instancefailovergroups.go deleted file mode 100644 index fc2759bfaa00..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/instancefailovergroups.go +++ /dev/null @@ -1,574 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// InstanceFailoverGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type InstanceFailoverGroupsClient struct { - BaseClient -} - -// NewInstanceFailoverGroupsClient creates an instance of the InstanceFailoverGroupsClient client. -func NewInstanceFailoverGroupsClient(subscriptionID string) InstanceFailoverGroupsClient { - return NewInstanceFailoverGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInstanceFailoverGroupsClientWithBaseURI creates an instance of the InstanceFailoverGroupsClient 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 NewInstanceFailoverGroupsClientWithBaseURI(baseURI string, subscriptionID string) InstanceFailoverGroupsClient { - return InstanceFailoverGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -// parameters - the failover group parameters. -func (client InstanceFailoverGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, parameters InstanceFailoverGroup) (result InstanceFailoverGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.InstanceFailoverGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.InstanceFailoverGroupProperties.ReadWriteEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.InstanceFailoverGroupProperties.PartnerRegions", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.InstanceFailoverGroupProperties.ManagedInstancePairs", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.InstanceFailoverGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, locationName, failoverGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client InstanceFailoverGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, parameters InstanceFailoverGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", 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 InstanceFailoverGroupsClient) CreateOrUpdateSender(req *http.Request) (future InstanceFailoverGroupsCreateOrUpdateFuture, 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 InstanceFailoverGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result InstanceFailoverGroup, 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 a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -func (client InstanceFailoverGroupsClient) Delete(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result InstanceFailoverGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, locationName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client InstanceFailoverGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", 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 InstanceFailoverGroupsClient) DeleteSender(req *http.Request) (future InstanceFailoverGroupsDeleteFuture, 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 InstanceFailoverGroupsClient) 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 -} - -// Failover fails over from the current primary managed instance to this managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -func (client InstanceFailoverGroupsClient) Failover(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result InstanceFailoverGroupsFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.Failover") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverPreparer(ctx, resourceGroupName, locationName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client InstanceFailoverGroupsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client InstanceFailoverGroupsClient) FailoverSender(req *http.Request) (future InstanceFailoverGroupsFailoverFuture, 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 -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client InstanceFailoverGroupsClient) FailoverResponder(resp *http.Response) (result InstanceFailoverGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ForceFailoverAllowDataLoss fails over from the current primary managed instance to this managed instance. This -// operation might result in data loss. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -func (client InstanceFailoverGroupsClient) ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result InstanceFailoverGroupsForceFailoverAllowDataLossFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.ForceFailoverAllowDataLoss") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ForceFailoverAllowDataLossPreparer(ctx, resourceGroupName, locationName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ForceFailoverAllowDataLoss", nil, "Failure preparing request") - return - } - - result, err = client.ForceFailoverAllowDataLossSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ForceFailoverAllowDataLoss", result.Response(), "Failure sending request") - return - } - - return -} - -// ForceFailoverAllowDataLossPreparer prepares the ForceFailoverAllowDataLoss request. -func (client InstanceFailoverGroupsClient) ForceFailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ForceFailoverAllowDataLossSender sends the ForceFailoverAllowDataLoss request. The method will close the -// http.Response Body if it receives an error. -func (client InstanceFailoverGroupsClient) ForceFailoverAllowDataLossSender(req *http.Request) (future InstanceFailoverGroupsForceFailoverAllowDataLossFuture, 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 -} - -// ForceFailoverAllowDataLossResponder handles the response to the ForceFailoverAllowDataLoss request. The method always -// closes the http.Response Body. -func (client InstanceFailoverGroupsClient) ForceFailoverAllowDataLossResponder(resp *http.Response) (result InstanceFailoverGroup, 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 a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -func (client InstanceFailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result InstanceFailoverGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.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, locationName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client InstanceFailoverGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", 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 InstanceFailoverGroupsClient) 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 InstanceFailoverGroupsClient) GetResponder(resp *http.Response) (result InstanceFailoverGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByLocation lists the failover groups in a location. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -func (client InstanceFailoverGroupsClient) ListByLocation(ctx context.Context, resourceGroupName string, locationName string) (result InstanceFailoverGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.ListByLocation") - defer func() { - sc := -1 - if result.ifglr.Response.Response != nil { - sc = result.ifglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByLocationNextResults - req, err := client.ListByLocationPreparer(ctx, resourceGroupName, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.ifglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ListByLocation", resp, "Failure sending request") - return - } - - result.ifglr, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ListByLocation", resp, "Failure responding to request") - return - } - if result.ifglr.hasNextLink() && result.ifglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client InstanceFailoverGroupsClient) ListByLocationPreparer(ctx context.Context, resourceGroupName string, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client InstanceFailoverGroupsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client InstanceFailoverGroupsClient) ListByLocationResponder(resp *http.Response) (result InstanceFailoverGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByLocationNextResults retrieves the next set of results, if any. -func (client InstanceFailoverGroupsClient) listByLocationNextResults(ctx context.Context, lastResults InstanceFailoverGroupListResult) (result InstanceFailoverGroupListResult, err error) { - req, err := lastResults.instanceFailoverGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "listByLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "listByLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "listByLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client InstanceFailoverGroupsClient) ListByLocationComplete(ctx context.Context, resourceGroupName string, locationName string) (result InstanceFailoverGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.ListByLocation") - 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.ListByLocation(ctx, resourceGroupName, locationName) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessmentrulebaselines.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessmentrulebaselines.go deleted file mode 100644 index 7c9fb47a1e5f..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessmentrulebaselines.go +++ /dev/null @@ -1,300 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient is the the Azure SQL Database management API provides a -// RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables -// you to create, retrieve, update, and delete databases. -type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient struct { - BaseClient -} - -// NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient client. -func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string) ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { - return NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient 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 NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { - return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a -// database level rule and master for server level rule). -// parameters - the requested rule baseline resource. -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DatabaseVulnerabilityAssessmentRuleBaselineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DatabaseVulnerabilityAssessmentRuleBaselineProperties.BaselineResults", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, ruleID, baselineName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete removes the database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a -// database level rule and master for server level rule). -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a -// database level rule and master for server level rule). -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.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, managedInstanceName, databaseName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) GetResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentRuleBaseline, 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/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessments.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessments.go deleted file mode 100644 index 888234d2681c..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessments.go +++ /dev/null @@ -1,398 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabaseVulnerabilityAssessmentsClient is the the Azure SQL Database management API provides a RESTful set of -// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedDatabaseVulnerabilityAssessmentsClient struct { - BaseClient -} - -// NewManagedDatabaseVulnerabilityAssessmentsClient creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentsClient client. -func NewManagedDatabaseVulnerabilityAssessmentsClient(subscriptionID string) ManagedDatabaseVulnerabilityAssessmentsClient { - return NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentsClient 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 NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseVulnerabilityAssessmentsClient { - return ManagedDatabaseVulnerabilityAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment is defined. -// parameters - the requested resource. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters DatabaseVulnerabilityAssessment) (result DatabaseVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.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, managedInstanceName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters DatabaseVulnerabilityAssessment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ManagedDatabaseVulnerabilityAssessmentsClient) 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 ManagedDatabaseVulnerabilityAssessmentsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseVulnerabilityAssessment, 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 removes the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment is defined. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ManagedDatabaseVulnerabilityAssessmentsClient) 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 ManagedDatabaseVulnerabilityAssessmentsClient) 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 the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment is defined. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result DatabaseVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.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, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ManagedDatabaseVulnerabilityAssessmentsClient) 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 ManagedDatabaseVulnerabilityAssessmentsClient) GetResponder(resp *http.Response) (result DatabaseVulnerabilityAssessment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists the vulnerability assessments of a managed database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment is defined. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result DatabaseVulnerabilityAssessmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.ListByDatabase") - defer func() { - sc := -1 - if result.dvalr.Response.Response != nil { - sc = result.dvalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.dvalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.dvalr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.dvalr.hasNextLink() && result.dvalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) listByDatabaseNextResults(ctx context.Context, lastResults DatabaseVulnerabilityAssessmentListResult) (result DatabaseVulnerabilityAssessmentListResult, err error) { - req, err := lastResults.databaseVulnerabilityAssessmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result DatabaseVulnerabilityAssessmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessmentscans.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessmentscans.go deleted file mode 100644 index d5bea2ebbb00..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/manageddatabasevulnerabilityassessmentscans.go +++ /dev/null @@ -1,405 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabaseVulnerabilityAssessmentScansClient is the the Azure SQL Database management API provides a RESTful -// set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to -// create, retrieve, update, and delete databases. -type ManagedDatabaseVulnerabilityAssessmentScansClient struct { - BaseClient -} - -// NewManagedDatabaseVulnerabilityAssessmentScansClient creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentScansClient client. -func NewManagedDatabaseVulnerabilityAssessmentScansClient(subscriptionID string) ManagedDatabaseVulnerabilityAssessmentScansClient { - return NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentScansClient 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 NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseVulnerabilityAssessmentScansClient { - return ManagedDatabaseVulnerabilityAssessmentScansClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Export convert an existing scan result to a human readable format. If already exists nothing happens -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the scanned database. -// scanID - the vulnerability assessment scan Id. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansExport, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.Export") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExportPreparer(ctx, resourceGroupName, managedInstanceName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Export", nil, "Failure preparing request") - return - } - - resp, err := client.ExportSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure sending request") - return - } - - result, err = client.ExportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure responding to request") - return - } - - return -} - -// ExportPreparer prepares the Export request. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ExportPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ExportSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ExportResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentScansExport, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a vulnerability assessment scan record of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result VulnerabilityAssessmentScanRecord, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.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, managedInstanceName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}", 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 ManagedDatabaseVulnerabilityAssessmentScansClient) 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 ManagedDatabaseVulnerabilityAssessmentScansClient) GetResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecord, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// InitiateScan executes a Vulnerability Assessment database scan. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) InitiateScan(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.InitiateScan") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.InitiateScanPreparer(ctx, resourceGroupName, managedInstanceName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "InitiateScan", nil, "Failure preparing request") - return - } - - result, err = client.InitiateScanSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "InitiateScan", result.Response(), "Failure sending request") - return - } - - return -} - -// InitiateScanPreparer prepares the InitiateScan request. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) InitiateScanPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// InitiateScanSender sends the InitiateScan request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) InitiateScanSender(req *http.Request) (future ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture, 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 -} - -// InitiateScanResponder handles the response to the InitiateScan request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) InitiateScanResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByDatabase lists the vulnerability assessment scans of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result VulnerabilityAssessmentScanRecordListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.ListByDatabase") - defer func() { - sc := -1 - if result.vasrlr.Response.Response != nil { - sc = result.vasrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.vasrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.vasrlr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.vasrlr.hasNextLink() && result.vasrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabaseResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecordListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) listByDatabaseNextResults(ctx context.Context, lastResults VulnerabilityAssessmentScanRecordListResult) (result VulnerabilityAssessmentScanRecordListResult, err error) { - req, err := lastResults.vulnerabilityAssessmentScanRecordListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result VulnerabilityAssessmentScanRecordListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go deleted file mode 100644 index d1e8429e5263..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstanceencryptionprotectors.go +++ /dev/null @@ -1,397 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceEncryptionProtectorsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedInstanceEncryptionProtectorsClient struct { - BaseClient -} - -// NewManagedInstanceEncryptionProtectorsClient creates an instance of the ManagedInstanceEncryptionProtectorsClient -// client. -func NewManagedInstanceEncryptionProtectorsClient(subscriptionID string) ManagedInstanceEncryptionProtectorsClient { - return NewManagedInstanceEncryptionProtectorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceEncryptionProtectorsClientWithBaseURI creates an instance of the -// ManagedInstanceEncryptionProtectorsClient 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 NewManagedInstanceEncryptionProtectorsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceEncryptionProtectorsClient { - return ManagedInstanceEncryptionProtectorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates an existing encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the requested encryption protector resource state. -func (client ManagedInstanceEncryptionProtectorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceEncryptionProtector) (result ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstanceEncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceEncryptionProtector) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}", 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 ManagedInstanceEncryptionProtectorsClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture, 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 ManagedInstanceEncryptionProtectorsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceEncryptionProtector, 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 a managed instance encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceEncryptionProtectorsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtector, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.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, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceEncryptionProtectorsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}", 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 ManagedInstanceEncryptionProtectorsClient) 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 ManagedInstanceEncryptionProtectorsClient) GetResponder(resp *http.Response) (result ManagedInstanceEncryptionProtector, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of managed instance encryption protectors -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtectorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.ListByInstance") - defer func() { - sc := -1 - if result.mieplr.Response.Response != nil { - sc = result.mieplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.mieplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.mieplr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.mieplr.hasNextLink() && result.mieplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/encryptionProtector", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceEncryptionProtectorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedInstanceEncryptionProtectorsClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceEncryptionProtectorListResult) (result ManagedInstanceEncryptionProtectorListResult, err error) { - req, err := lastResults.managedInstanceEncryptionProtectorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtectorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} - -// Revalidate revalidates an existing encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceEncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.Revalidate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RevalidatePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") - return - } - - result, err = client.RevalidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") - return - } - - return -} - -// RevalidatePreparer prepares the Revalidate request. -func (client ManagedInstanceEncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevalidateSender sends the Revalidate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceEncryptionProtectorsClient) RevalidateSender(req *http.Request) (future ManagedInstanceEncryptionProtectorsRevalidateFuture, 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 -} - -// RevalidateResponder handles the response to the Revalidate request. The method always -// closes the http.Response Body. -func (client ManagedInstanceEncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstancekeys.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstancekeys.go deleted file mode 100644 index a4f4e479a482..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstancekeys.go +++ /dev/null @@ -1,403 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceKeysClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ManagedInstanceKeysClient struct { - BaseClient -} - -// NewManagedInstanceKeysClient creates an instance of the ManagedInstanceKeysClient client. -func NewManagedInstanceKeysClient(subscriptionID string) ManagedInstanceKeysClient { - return NewManagedInstanceKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceKeysClientWithBaseURI creates an instance of the ManagedInstanceKeysClient 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 NewManagedInstanceKeysClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceKeysClient { - return ManagedInstanceKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a managed instance key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// keyName - the name of the managed instance key to be operated on (updated or created). -// parameters - the requested managed instance key resource state. -func (client ManagedInstanceKeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string, parameters ManagedInstanceKey) (result ManagedInstanceKeysCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, keyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstanceKeysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string, parameters ManagedInstanceKey) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", 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 ManagedInstanceKeysClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceKeysCreateOrUpdateFuture, 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 ManagedInstanceKeysClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceKey, 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 the managed instance key with the given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// keyName - the name of the managed instance key to be deleted. -func (client ManagedInstanceKeysClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (result ManagedInstanceKeysDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedInstanceKeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", 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 ManagedInstanceKeysClient) DeleteSender(req *http.Request) (future ManagedInstanceKeysDeleteFuture, 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 ManagedInstanceKeysClient) 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 a managed instance key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// keyName - the name of the managed instance key to be retrieved. -func (client ManagedInstanceKeysClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (result ManagedInstanceKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.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, managedInstanceName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", 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 ManagedInstanceKeysClient) 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 ManagedInstanceKeysClient) GetResponder(resp *http.Response) (result ManagedInstanceKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of managed instance keys. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// filter - an OData filter expression that filters elements in the collection. -func (client ManagedInstanceKeysClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (result ManagedInstanceKeyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.ListByInstance") - defer func() { - sc := -1 - if result.miklr.Response.Response != nil { - sc = result.miklr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.miklr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.miklr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.miklr.hasNextLink() && result.miklr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedInstanceKeysClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Sql/managedInstances/{managedInstanceName}/keys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceKeysClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedInstanceKeysClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceKeyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedInstanceKeysClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceKeyListResult) (result ManagedInstanceKeyListResult, err error) { - req, err := lastResults.managedInstanceKeyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceKeysClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (result ManagedInstanceKeyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName, filter) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstancetdecertificates.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstancetdecertificates.go deleted file mode 100644 index 3b0f0fd7c404..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/managedinstancetdecertificates.go +++ /dev/null @@ -1,124 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceTdeCertificatesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedInstanceTdeCertificatesClient struct { - BaseClient -} - -// NewManagedInstanceTdeCertificatesClient creates an instance of the ManagedInstanceTdeCertificatesClient client. -func NewManagedInstanceTdeCertificatesClient(subscriptionID string) ManagedInstanceTdeCertificatesClient { - return NewManagedInstanceTdeCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceTdeCertificatesClientWithBaseURI creates an instance of the ManagedInstanceTdeCertificatesClient -// 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 NewManagedInstanceTdeCertificatesClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceTdeCertificatesClient { - return ManagedInstanceTdeCertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a TDE certificate for a given server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the requested TDE certificate to be created or updated. -func (client ManagedInstanceTdeCertificatesClient) Create(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters TdeCertificate) (result ManagedInstanceTdeCertificatesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceTdeCertificatesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TdeCertificateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TdeCertificateProperties.PrivateBlob", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ManagedInstanceTdeCertificatesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceTdeCertificatesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceTdeCertificatesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ManagedInstanceTdeCertificatesClient) CreatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters TdeCertificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/tdeCertificates", 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 ManagedInstanceTdeCertificatesClient) CreateSender(req *http.Request) (future ManagedInstanceTdeCertificatesCreateFuture, 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 ManagedInstanceTdeCertificatesClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go deleted file mode 100644 index b1bcb9c4ba03..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/models.go +++ /dev/null @@ -1,5051 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-10-01-preview/sql" - -// BackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type BackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupShortTermRetentionPoliciesClient) (BackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupShortTermRetentionPoliciesCreateOrUpdateFuture) 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 BackupShortTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *BackupShortTermRetentionPoliciesCreateOrUpdateFuture) result(client BackupShortTermRetentionPoliciesClient) (bstrp BackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bstrp.Response.Response, err = future.GetResult(sender); err == nil && bstrp.Response.Response.StatusCode != http.StatusNoContent { - bstrp, err = client.CreateOrUpdateResponder(bstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", bstrp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupShortTermRetentionPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type BackupShortTermRetentionPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupShortTermRetentionPoliciesClient) (BackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupShortTermRetentionPoliciesUpdateFuture) 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 BackupShortTermRetentionPoliciesUpdateFuture.Result. -func (future *BackupShortTermRetentionPoliciesUpdateFuture) result(client BackupShortTermRetentionPoliciesClient) (bstrp BackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.BackupShortTermRetentionPoliciesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bstrp.Response.Response, err = future.GetResult(sender); err == nil && bstrp.Response.Response.StatusCode != http.StatusNoContent { - bstrp, err = client.UpdateResponder(bstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesUpdateFuture", "Result", bstrp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupShortTermRetentionPolicy a short term retention policy. -type BackupShortTermRetentionPolicy struct { - autorest.Response `json:"-"` - // BackupShortTermRetentionPolicyProperties - Resource properties. - *BackupShortTermRetentionPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for BackupShortTermRetentionPolicy. -func (bstrp BackupShortTermRetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bstrp.BackupShortTermRetentionPolicyProperties != nil { - objectMap["properties"] = bstrp.BackupShortTermRetentionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupShortTermRetentionPolicy struct. -func (bstrp *BackupShortTermRetentionPolicy) 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 backupShortTermRetentionPolicyProperties BackupShortTermRetentionPolicyProperties - err = json.Unmarshal(*v, &backupShortTermRetentionPolicyProperties) - if err != nil { - return err - } - bstrp.BackupShortTermRetentionPolicyProperties = &backupShortTermRetentionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bstrp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bstrp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bstrp.Type = &typeVar - } - } - } - - return nil -} - -// BackupShortTermRetentionPolicyListResult a list of short term retention policies. -type BackupShortTermRetentionPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]BackupShortTermRetentionPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupShortTermRetentionPolicyListResult. -func (bstrplr BackupShortTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BackupShortTermRetentionPolicyListResultIterator provides access to a complete listing of -// BackupShortTermRetentionPolicy values. -type BackupShortTermRetentionPolicyListResultIterator struct { - i int - page BackupShortTermRetentionPolicyListResultPage -} - -// 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 *BackupShortTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPolicyListResultIterator.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 *BackupShortTermRetentionPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BackupShortTermRetentionPolicyListResultIterator) 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 BackupShortTermRetentionPolicyListResultIterator) Response() BackupShortTermRetentionPolicyListResult { - 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 BackupShortTermRetentionPolicyListResultIterator) Value() BackupShortTermRetentionPolicy { - if !iter.page.NotDone() { - return BackupShortTermRetentionPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BackupShortTermRetentionPolicyListResultIterator type. -func NewBackupShortTermRetentionPolicyListResultIterator(page BackupShortTermRetentionPolicyListResultPage) BackupShortTermRetentionPolicyListResultIterator { - return BackupShortTermRetentionPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bstrplr BackupShortTermRetentionPolicyListResult) IsEmpty() bool { - return bstrplr.Value == nil || len(*bstrplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bstrplr BackupShortTermRetentionPolicyListResult) hasNextLink() bool { - return bstrplr.NextLink != nil && len(*bstrplr.NextLink) != 0 -} - -// backupShortTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bstrplr BackupShortTermRetentionPolicyListResult) backupShortTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !bstrplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bstrplr.NextLink))) -} - -// BackupShortTermRetentionPolicyListResultPage contains a page of BackupShortTermRetentionPolicy values. -type BackupShortTermRetentionPolicyListResultPage struct { - fn func(context.Context, BackupShortTermRetentionPolicyListResult) (BackupShortTermRetentionPolicyListResult, error) - bstrplr BackupShortTermRetentionPolicyListResult -} - -// 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 *BackupShortTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPolicyListResultPage.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.bstrplr) - if err != nil { - return err - } - page.bstrplr = 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 *BackupShortTermRetentionPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BackupShortTermRetentionPolicyListResultPage) NotDone() bool { - return !page.bstrplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BackupShortTermRetentionPolicyListResultPage) Response() BackupShortTermRetentionPolicyListResult { - return page.bstrplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BackupShortTermRetentionPolicyListResultPage) Values() []BackupShortTermRetentionPolicy { - if page.bstrplr.IsEmpty() { - return nil - } - return *page.bstrplr.Value -} - -// Creates a new instance of the BackupShortTermRetentionPolicyListResultPage type. -func NewBackupShortTermRetentionPolicyListResultPage(cur BackupShortTermRetentionPolicyListResult, getNextPage func(context.Context, BackupShortTermRetentionPolicyListResult) (BackupShortTermRetentionPolicyListResult, error)) BackupShortTermRetentionPolicyListResultPage { - return BackupShortTermRetentionPolicyListResultPage{ - fn: getNextPage, - bstrplr: cur, - } -} - -// BackupShortTermRetentionPolicyProperties properties of a short term retention policy -type BackupShortTermRetentionPolicyProperties struct { - // RetentionDays - The backup retention period in days. This is how many days Point-in-Time Restore will be supported. - RetentionDays *int32 `json:"retentionDays,omitempty"` -} - -// Database a database resource. -type Database struct { - autorest.Response `json:"-"` - // Sku - The database SKU. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: - // - // ```azurecli - // az sql db list-editions -l -o table - // ```` - // - // ```powershell - // Get-AzSqlServerServiceObjective -Location - // ```` - Sku *Sku `json:"sku,omitempty"` - // Kind - READ-ONLY; Kind of database. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ManagedBy - READ-ONLY; Resource that manages the database. - ManagedBy *string `json:"managedBy,omitempty"` - // DatabaseProperties - Resource properties. - *DatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.Sku != nil { - objectMap["sku"] = d.Sku - } - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) 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 - } - d.Sku = &sku - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - d.Kind = &kind - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - d.ManagedBy = &managedBy - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseListResult a list of databases. -type DatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Database `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseListResult. -func (dlr DatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseListResultIterator provides access to a complete listing of Database values. -type DatabaseListResultIterator struct { - i int - page DatabaseListResultPage -} - -// 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 *DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultIterator.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 *DatabaseListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseListResultIterator) 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 DatabaseListResultIterator) Response() DatabaseListResult { - 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 DatabaseListResultIterator) Value() Database { - if !iter.page.NotDone() { - return Database{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseListResultIterator type. -func NewDatabaseListResultIterator(page DatabaseListResultPage) DatabaseListResultIterator { - return DatabaseListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DatabaseListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DatabaseListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// databaseListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DatabaseListResult) databaseListResultPreparer(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))) -} - -// DatabaseListResultPage contains a page of Database values. -type DatabaseListResultPage struct { - fn func(context.Context, DatabaseListResult) (DatabaseListResult, error) - dlr DatabaseListResult -} - -// 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 *DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultPage.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 *DatabaseListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseListResultPage) Response() DatabaseListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseListResultPage) Values() []Database { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DatabaseListResultPage type. -func NewDatabaseListResultPage(cur DatabaseListResult, getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage { - return DatabaseListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DatabaseOperation a database operation. -type DatabaseOperation struct { - // DatabaseOperationProperties - Resource properties. - *DatabaseOperationProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseOperation. -func (do DatabaseOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if do.DatabaseOperationProperties != nil { - objectMap["properties"] = do.DatabaseOperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseOperation struct. -func (do *DatabaseOperation) 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 databaseOperationProperties DatabaseOperationProperties - err = json.Unmarshal(*v, &databaseOperationProperties) - if err != nil { - return err - } - do.DatabaseOperationProperties = &databaseOperationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - do.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - do.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - do.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseOperationListResult the response to a list database operations request -type DatabaseOperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]DatabaseOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseOperationListResult. -func (dolr DatabaseOperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseOperationListResultIterator provides access to a complete listing of DatabaseOperation values. -type DatabaseOperationListResultIterator struct { - i int - page DatabaseOperationListResultPage -} - -// 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 *DatabaseOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationListResultIterator.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 *DatabaseOperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseOperationListResultIterator) 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 DatabaseOperationListResultIterator) Response() DatabaseOperationListResult { - 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 DatabaseOperationListResultIterator) Value() DatabaseOperation { - if !iter.page.NotDone() { - return DatabaseOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseOperationListResultIterator type. -func NewDatabaseOperationListResultIterator(page DatabaseOperationListResultPage) DatabaseOperationListResultIterator { - return DatabaseOperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dolr DatabaseOperationListResult) IsEmpty() bool { - return dolr.Value == nil || len(*dolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dolr DatabaseOperationListResult) hasNextLink() bool { - return dolr.NextLink != nil && len(*dolr.NextLink) != 0 -} - -// databaseOperationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dolr DatabaseOperationListResult) databaseOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dolr.NextLink))) -} - -// DatabaseOperationListResultPage contains a page of DatabaseOperation values. -type DatabaseOperationListResultPage struct { - fn func(context.Context, DatabaseOperationListResult) (DatabaseOperationListResult, error) - dolr DatabaseOperationListResult -} - -// 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 *DatabaseOperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationListResultPage.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.dolr) - if err != nil { - return err - } - page.dolr = 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 *DatabaseOperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseOperationListResultPage) NotDone() bool { - return !page.dolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseOperationListResultPage) Response() DatabaseOperationListResult { - return page.dolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseOperationListResultPage) Values() []DatabaseOperation { - if page.dolr.IsEmpty() { - return nil - } - return *page.dolr.Value -} - -// Creates a new instance of the DatabaseOperationListResultPage type. -func NewDatabaseOperationListResultPage(cur DatabaseOperationListResult, getNextPage func(context.Context, DatabaseOperationListResult) (DatabaseOperationListResult, error)) DatabaseOperationListResultPage { - return DatabaseOperationListResultPage{ - fn: getNextPage, - dolr: cur, - } -} - -// DatabaseOperationProperties the properties of a database operation. -type DatabaseOperationProperties struct { - // DatabaseName - READ-ONLY; The name of the database the operation is being performed on. - DatabaseName *string `json:"databaseName,omitempty"` - // Operation - READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty"` - // OperationFriendlyName - READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` - // PercentComplete - READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ServerName - READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The operation state. Possible values include: 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled' - State ManagementOperationState `json:"state,omitempty"` - // ErrorCode - READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorDescription - READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty"` - // ErrorSeverity - READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // IsUserError - READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty"` - // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` - // Description - READ-ONLY; The operation description. - Description *string `json:"description,omitempty"` - // IsCancellable - READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseOperationProperties. -func (dop DatabaseOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseProperties the database's properties. -type DatabaseProperties struct { - // CreateMode - Specifies the mode of database creation. - // - // Default: regular database creation. - // - // Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. - // - // Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. - // - // PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. - // - // Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. - // - // Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. - // - // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. - // - // Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'CreateModeDefault', 'CreateModeCopy', 'CreateModeSecondary', 'CreateModePointInTimeRestore', 'CreateModeRestore', 'CreateModeRecovery', 'CreateModeRestoreExternalBackup', 'CreateModeRestoreExternalBackupSecondary', 'CreateModeRestoreLongTermRetentionBackup', 'CreateModeOnlineSecondary' - CreateMode CreateMode `json:"createMode,omitempty"` - // Collation - The collation of the database. - Collation *string `json:"collation,omitempty"` - // MaxSizeBytes - The max size of the database expressed in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // SampleName - The name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' - SampleName SampleName `json:"sampleName,omitempty"` - // ElasticPoolID - The resource identifier of the elastic pool containing this database. - ElasticPoolID *string `json:"elasticPoolId,omitempty"` - // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // Status - READ-ONLY; The status of the database. Possible values include: 'DatabaseStatusOnline', 'DatabaseStatusRestoring', 'DatabaseStatusRecoveryPending', 'DatabaseStatusRecovering', 'DatabaseStatusSuspect', 'DatabaseStatusOffline', 'DatabaseStatusStandby', 'DatabaseStatusShutdown', 'DatabaseStatusEmergencyMode', 'DatabaseStatusAutoClosed', 'DatabaseStatusCopying', 'DatabaseStatusCreating', 'DatabaseStatusInaccessible', 'DatabaseStatusOfflineSecondary', 'DatabaseStatusPausing', 'DatabaseStatusPaused', 'DatabaseStatusResuming', 'DatabaseStatusScaling', 'DatabaseStatusOfflineChangingDwPerformanceTiers', 'DatabaseStatusOnlineChangingDwPerformanceTiers', 'DatabaseStatusDisabled' - Status DatabaseStatus `json:"status,omitempty"` - // DatabaseID - READ-ONLY; The ID of the database. - DatabaseID *uuid.UUID `json:"databaseId,omitempty"` - // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // CurrentServiceObjectiveName - READ-ONLY; The current service level objective name of the database. - CurrentServiceObjectiveName *string `json:"currentServiceObjectiveName,omitempty"` - // RequestedServiceObjectiveName - READ-ONLY; The requested service level objective name of the database. - RequestedServiceObjectiveName *string `json:"requestedServiceObjectiveName,omitempty"` - // DefaultSecondaryLocation - READ-ONLY; The default secondary region for this database. - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` - // FailoverGroupID - READ-ONLY; Failover Group resource identifier that this database belongs to. - FailoverGroupID *string `json:"failoverGroupId,omitempty"` - // RestorePointInTime - Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // SourceDatabaseDeletionDate - Specifies the time that the database was deleted. - SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` - // RecoveryServicesRecoveryPointID - The resource identifier of the recovery point associated with create operation of this database. - RecoveryServicesRecoveryPointID *string `json:"recoveryServicesRecoveryPointId,omitempty"` - // LongTermRetentionBackupResourceID - The resource identifier of the long term retention backup associated with create operation of this database. - LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` - // RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database. - RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` - // RestorableDroppedDatabaseID - The resource identifier of the restorable dropped database associated with create operation of this database. - RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` - // CatalogCollation - Collation of the metadata catalog. Possible values include: 'DATABASEDEFAULT', 'SQLLatin1GeneralCP1CIAS' - CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"` - // ZoneRedundant - Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // LicenseType - The license type to apply for this database. `LicenseIncluded` if you need a license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. Possible values include: 'LicenseIncluded', 'BasePrice' - LicenseType DatabaseLicenseType `json:"licenseType,omitempty"` - // MaxLogSizeBytes - READ-ONLY; The max log size for this database. - MaxLogSizeBytes *int64 `json:"maxLogSizeBytes,omitempty"` - // EarliestRestoreDate - READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // ReadScale - If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. Possible values include: 'DatabaseReadScaleEnabled', 'DatabaseReadScaleDisabled' - ReadScale DatabaseReadScale `json:"readScale,omitempty"` - // ReadReplicaCount - The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases. - ReadReplicaCount *int32 `json:"readReplicaCount,omitempty"` - // CurrentSku - READ-ONLY; The name and tier of the SKU. - CurrentSku *Sku `json:"currentSku,omitempty"` - // AutoPauseDelay - Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled - AutoPauseDelay *int32 `json:"autoPauseDelay,omitempty"` - // MinCapacity - Minimal capacity that database will always have allocated, if not paused - MinCapacity *float64 `json:"minCapacity,omitempty"` - // PausedDate - READ-ONLY; The date when database was paused by user configuration or action (ISO8601 format). Null if the database is ready. - PausedDate *date.Time `json:"pausedDate,omitempty"` - // ResumedDate - READ-ONLY; The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. - ResumedDate *date.Time `json:"resumedDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseProperties. -func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.CreateMode != "" { - objectMap["createMode"] = dp.CreateMode - } - if dp.Collation != nil { - objectMap["collation"] = dp.Collation - } - if dp.MaxSizeBytes != nil { - objectMap["maxSizeBytes"] = dp.MaxSizeBytes - } - if dp.SampleName != "" { - objectMap["sampleName"] = dp.SampleName - } - if dp.ElasticPoolID != nil { - objectMap["elasticPoolId"] = dp.ElasticPoolID - } - if dp.SourceDatabaseID != nil { - objectMap["sourceDatabaseId"] = dp.SourceDatabaseID - } - if dp.RestorePointInTime != nil { - objectMap["restorePointInTime"] = dp.RestorePointInTime - } - if dp.SourceDatabaseDeletionDate != nil { - objectMap["sourceDatabaseDeletionDate"] = dp.SourceDatabaseDeletionDate - } - if dp.RecoveryServicesRecoveryPointID != nil { - objectMap["recoveryServicesRecoveryPointId"] = dp.RecoveryServicesRecoveryPointID - } - if dp.LongTermRetentionBackupResourceID != nil { - objectMap["longTermRetentionBackupResourceId"] = dp.LongTermRetentionBackupResourceID - } - if dp.RecoverableDatabaseID != nil { - objectMap["recoverableDatabaseId"] = dp.RecoverableDatabaseID - } - if dp.RestorableDroppedDatabaseID != nil { - objectMap["restorableDroppedDatabaseId"] = dp.RestorableDroppedDatabaseID - } - if dp.CatalogCollation != "" { - objectMap["catalogCollation"] = dp.CatalogCollation - } - if dp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = dp.ZoneRedundant - } - if dp.LicenseType != "" { - objectMap["licenseType"] = dp.LicenseType - } - if dp.ReadScale != "" { - objectMap["readScale"] = dp.ReadScale - } - if dp.ReadReplicaCount != nil { - objectMap["readReplicaCount"] = dp.ReadReplicaCount - } - if dp.AutoPauseDelay != nil { - objectMap["autoPauseDelay"] = dp.AutoPauseDelay - } - if dp.MinCapacity != nil { - objectMap["minCapacity"] = dp.MinCapacity - } - return json.Marshal(objectMap) -} - -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateOrUpdateFuture) 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 DatabasesCreateOrUpdateFuture.Result. -func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesDeleteFuture) 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 DatabasesDeleteFuture.Result. -func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabasesPauseFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesPauseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesPauseFuture) 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 DatabasesPauseFuture.Result. -func (future *DatabasesPauseFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesPauseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.PauseResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesResumeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesResumeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesResumeFuture) 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 DatabasesResumeFuture.Result. -func (future *DatabasesResumeFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesResumeFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.ResumeResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesUpdateFuture) 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 DatabasesUpdateFuture.Result. -func (future *DatabasesUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesUpgradeDataWarehouseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabasesUpgradeDataWarehouseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesUpgradeDataWarehouseFuture) 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 DatabasesUpgradeDataWarehouseFuture.Result. -func (future *DatabasesUpgradeDataWarehouseFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpgradeDataWarehouseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesUpgradeDataWarehouseFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseUpdate a database resource. -type DatabaseUpdate struct { - // Sku - The name and tier of the SKU. - Sku *Sku `json:"sku,omitempty"` - // DatabaseProperties - Resource properties. - *DatabaseProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseUpdate. -func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if du.Sku != nil { - objectMap["sku"] = du.Sku - } - if du.DatabaseProperties != nil { - objectMap["properties"] = du.DatabaseProperties - } - if du.Tags != nil { - objectMap["tags"] = du.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. -func (du *DatabaseUpdate) 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 - } - du.Sku = &sku - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - du.DatabaseProperties = &databaseProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - du.Tags = tags - } - } - } - - return nil -} - -// DatabaseVulnerabilityAssessment a database vulnerability assessment. -type DatabaseVulnerabilityAssessment struct { - autorest.Response `json:"-"` - // DatabaseVulnerabilityAssessmentProperties - Resource properties. - *DatabaseVulnerabilityAssessmentProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessment. -func (dva DatabaseVulnerabilityAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dva.DatabaseVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = dva.DatabaseVulnerabilityAssessmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseVulnerabilityAssessment struct. -func (dva *DatabaseVulnerabilityAssessment) 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 databaseVulnerabilityAssessmentProperties DatabaseVulnerabilityAssessmentProperties - err = json.Unmarshal(*v, &databaseVulnerabilityAssessmentProperties) - if err != nil { - return err - } - dva.DatabaseVulnerabilityAssessmentProperties = &databaseVulnerabilityAssessmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dva.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dva.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dva.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseVulnerabilityAssessmentListResult a list of the database's vulnerability assessments. -type DatabaseVulnerabilityAssessmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]DatabaseVulnerabilityAssessment `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentListResult. -func (dvalr DatabaseVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseVulnerabilityAssessmentListResultIterator provides access to a complete listing of -// DatabaseVulnerabilityAssessment values. -type DatabaseVulnerabilityAssessmentListResultIterator struct { - i int - page DatabaseVulnerabilityAssessmentListResultPage -} - -// 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 *DatabaseVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentListResultIterator.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 *DatabaseVulnerabilityAssessmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseVulnerabilityAssessmentListResultIterator) 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 DatabaseVulnerabilityAssessmentListResultIterator) Response() DatabaseVulnerabilityAssessmentListResult { - 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 DatabaseVulnerabilityAssessmentListResultIterator) Value() DatabaseVulnerabilityAssessment { - if !iter.page.NotDone() { - return DatabaseVulnerabilityAssessment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseVulnerabilityAssessmentListResultIterator type. -func NewDatabaseVulnerabilityAssessmentListResultIterator(page DatabaseVulnerabilityAssessmentListResultPage) DatabaseVulnerabilityAssessmentListResultIterator { - return DatabaseVulnerabilityAssessmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dvalr DatabaseVulnerabilityAssessmentListResult) IsEmpty() bool { - return dvalr.Value == nil || len(*dvalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dvalr DatabaseVulnerabilityAssessmentListResult) hasNextLink() bool { - return dvalr.NextLink != nil && len(*dvalr.NextLink) != 0 -} - -// databaseVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dvalr DatabaseVulnerabilityAssessmentListResult) databaseVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dvalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dvalr.NextLink))) -} - -// DatabaseVulnerabilityAssessmentListResultPage contains a page of DatabaseVulnerabilityAssessment values. -type DatabaseVulnerabilityAssessmentListResultPage struct { - fn func(context.Context, DatabaseVulnerabilityAssessmentListResult) (DatabaseVulnerabilityAssessmentListResult, error) - dvalr DatabaseVulnerabilityAssessmentListResult -} - -// 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 *DatabaseVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentListResultPage.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.dvalr) - if err != nil { - return err - } - page.dvalr = 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 *DatabaseVulnerabilityAssessmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseVulnerabilityAssessmentListResultPage) NotDone() bool { - return !page.dvalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseVulnerabilityAssessmentListResultPage) Response() DatabaseVulnerabilityAssessmentListResult { - return page.dvalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseVulnerabilityAssessmentListResultPage) Values() []DatabaseVulnerabilityAssessment { - if page.dvalr.IsEmpty() { - return nil - } - return *page.dvalr.Value -} - -// Creates a new instance of the DatabaseVulnerabilityAssessmentListResultPage type. -func NewDatabaseVulnerabilityAssessmentListResultPage(cur DatabaseVulnerabilityAssessmentListResult, getNextPage func(context.Context, DatabaseVulnerabilityAssessmentListResult) (DatabaseVulnerabilityAssessmentListResult, error)) DatabaseVulnerabilityAssessmentListResultPage { - return DatabaseVulnerabilityAssessmentListResultPage{ - fn: getNextPage, - dvalr: cur, - } -} - -// DatabaseVulnerabilityAssessmentProperties properties of a database Vulnerability Assessment. -type DatabaseVulnerabilityAssessmentProperties struct { - // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RecurringScans - The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` -} - -// DatabaseVulnerabilityAssessmentRuleBaseline a database vulnerability assessment rule baseline. -type DatabaseVulnerabilityAssessmentRuleBaseline struct { - autorest.Response `json:"-"` - // DatabaseVulnerabilityAssessmentRuleBaselineProperties - Resource properties. - *DatabaseVulnerabilityAssessmentRuleBaselineProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentRuleBaseline. -func (dvarb DatabaseVulnerabilityAssessmentRuleBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dvarb.DatabaseVulnerabilityAssessmentRuleBaselineProperties != nil { - objectMap["properties"] = dvarb.DatabaseVulnerabilityAssessmentRuleBaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseVulnerabilityAssessmentRuleBaseline struct. -func (dvarb *DatabaseVulnerabilityAssessmentRuleBaseline) 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 databaseVulnerabilityAssessmentRuleBaselineProperties DatabaseVulnerabilityAssessmentRuleBaselineProperties - err = json.Unmarshal(*v, &databaseVulnerabilityAssessmentRuleBaselineProperties) - if err != nil { - return err - } - dvarb.DatabaseVulnerabilityAssessmentRuleBaselineProperties = &databaseVulnerabilityAssessmentRuleBaselineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dvarb.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dvarb.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dvarb.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseVulnerabilityAssessmentRuleBaselineItem properties for an Azure SQL Database Vulnerability -// Assessment rule baseline's result. -type DatabaseVulnerabilityAssessmentRuleBaselineItem struct { - // Result - The rule baseline result - Result *[]string `json:"result,omitempty"` -} - -// DatabaseVulnerabilityAssessmentRuleBaselineProperties properties of a database Vulnerability Assessment -// rule baseline. -type DatabaseVulnerabilityAssessmentRuleBaselineProperties struct { - // BaselineResults - The rule baseline result - BaselineResults *[]DatabaseVulnerabilityAssessmentRuleBaselineItem `json:"baselineResults,omitempty"` -} - -// DatabaseVulnerabilityAssessmentScanExportProperties properties of the export operation's result. -type DatabaseVulnerabilityAssessmentScanExportProperties struct { - // ExportedReportLocation - READ-ONLY; Location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). - ExportedReportLocation *string `json:"exportedReportLocation,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentScanExportProperties. -func (dvasep DatabaseVulnerabilityAssessmentScanExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseVulnerabilityAssessmentScansExport a database Vulnerability Assessment scan export resource. -type DatabaseVulnerabilityAssessmentScansExport struct { - autorest.Response `json:"-"` - // DatabaseVulnerabilityAssessmentScanExportProperties - Resource properties. - *DatabaseVulnerabilityAssessmentScanExportProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentScansExport. -func (dvase DatabaseVulnerabilityAssessmentScansExport) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dvase.DatabaseVulnerabilityAssessmentScanExportProperties != nil { - objectMap["properties"] = dvase.DatabaseVulnerabilityAssessmentScanExportProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseVulnerabilityAssessmentScansExport struct. -func (dvase *DatabaseVulnerabilityAssessmentScansExport) 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 databaseVulnerabilityAssessmentScanExportProperties DatabaseVulnerabilityAssessmentScanExportProperties - err = json.Unmarshal(*v, &databaseVulnerabilityAssessmentScanExportProperties) - if err != nil { - return err - } - dvase.DatabaseVulnerabilityAssessmentScanExportProperties = &databaseVulnerabilityAssessmentScanExportProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dvase.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dvase.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dvase.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseVulnerabilityAssessmentScansInitiateScanFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type DatabaseVulnerabilityAssessmentScansInitiateScanFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseVulnerabilityAssessmentScansClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseVulnerabilityAssessmentScansInitiateScanFuture) 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 DatabaseVulnerabilityAssessmentScansInitiateScanFuture.Result. -func (future *DatabaseVulnerabilityAssessmentScansInitiateScanFuture) result(client DatabaseVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture") - return - } - ar.Response = future.Response() - return -} - -// EditionCapability the edition capability. -type EditionCapability struct { - // Name - READ-ONLY; The database edition name. - Name *string `json:"name,omitempty"` - // SupportedServiceLevelObjectives - READ-ONLY; The list of supported service objectives for the edition. - SupportedServiceLevelObjectives *[]ServiceObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for EditionCapability. -func (ec EditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ec.Reason != nil { - objectMap["reason"] = ec.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPool an elastic pool. -type ElasticPool struct { - autorest.Response `json:"-"` - // Sku - The elastic pool SKU. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or the following command: - // - // ```azurecli - // az sql elastic-pool list-editions -l -o table - // ```` - Sku *Sku `json:"sku,omitempty"` - // Kind - READ-ONLY; Kind of elastic pool. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ElasticPoolProperties - Resource properties. - *ElasticPoolProperties `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"` -} - -// MarshalJSON is the custom marshaler for ElasticPool. -func (ep ElasticPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.Sku != nil { - objectMap["sku"] = ep.Sku - } - if ep.ElasticPoolProperties != nil { - objectMap["properties"] = ep.ElasticPoolProperties - } - if ep.Location != nil { - objectMap["location"] = ep.Location - } - if ep.Tags != nil { - objectMap["tags"] = ep.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPool struct. -func (ep *ElasticPool) 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 - } - ep.Sku = &sku - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ep.Kind = &kind - } - case "properties": - if v != nil { - var elasticPoolProperties ElasticPoolProperties - err = json.Unmarshal(*v, &elasticPoolProperties) - if err != nil { - return err - } - ep.ElasticPoolProperties = &elasticPoolProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ep.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ep.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolEditionCapability the elastic pool edition capability. -type ElasticPoolEditionCapability struct { - // Name - READ-ONLY; The elastic pool edition name. - Name *string `json:"name,omitempty"` - // SupportedElasticPoolPerformanceLevels - READ-ONLY; The list of supported elastic pool DTU levels for the edition. - SupportedElasticPoolPerformanceLevels *[]ElasticPoolPerformanceLevelCapability `json:"supportedElasticPoolPerformanceLevels,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolEditionCapability. -func (epec ElasticPoolEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epec.Reason != nil { - objectMap["reason"] = epec.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolListResult the result of an elastic pool list request. -type ElasticPoolListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ElasticPool `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolListResult. -func (eplr ElasticPoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolListResultIterator provides access to a complete listing of ElasticPool values. -type ElasticPoolListResultIterator struct { - i int - page ElasticPoolListResultPage -} - -// 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 *ElasticPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolListResultIterator.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 *ElasticPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ElasticPoolListResultIterator) 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 ElasticPoolListResultIterator) Response() ElasticPoolListResult { - 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 ElasticPoolListResultIterator) Value() ElasticPool { - if !iter.page.NotDone() { - return ElasticPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ElasticPoolListResultIterator type. -func NewElasticPoolListResultIterator(page ElasticPoolListResultPage) ElasticPoolListResultIterator { - return ElasticPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eplr ElasticPoolListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eplr ElasticPoolListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 -} - -// elasticPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eplr ElasticPoolListResult) elasticPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) -} - -// ElasticPoolListResultPage contains a page of ElasticPool values. -type ElasticPoolListResultPage struct { - fn func(context.Context, ElasticPoolListResult) (ElasticPoolListResult, error) - eplr ElasticPoolListResult -} - -// 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 *ElasticPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolListResultPage.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.eplr) - if err != nil { - return err - } - page.eplr = 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 *ElasticPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ElasticPoolListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ElasticPoolListResultPage) Response() ElasticPoolListResult { - return page.eplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ElasticPoolListResultPage) Values() []ElasticPool { - if page.eplr.IsEmpty() { - return nil - } - return *page.eplr.Value -} - -// Creates a new instance of the ElasticPoolListResultPage type. -func NewElasticPoolListResultPage(cur ElasticPoolListResult, getNextPage func(context.Context, ElasticPoolListResult) (ElasticPoolListResult, error)) ElasticPoolListResultPage { - return ElasticPoolListResultPage{ - fn: getNextPage, - eplr: cur, - } -} - -// ElasticPoolOperation a elastic pool operation. -type ElasticPoolOperation struct { - // ElasticPoolOperationProperties - Resource properties. - *ElasticPoolOperationProperties `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"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolOperation. -func (epo ElasticPoolOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epo.ElasticPoolOperationProperties != nil { - objectMap["properties"] = epo.ElasticPoolOperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolOperation struct. -func (epo *ElasticPoolOperation) 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 elasticPoolOperationProperties ElasticPoolOperationProperties - err = json.Unmarshal(*v, &elasticPoolOperationProperties) - if err != nil { - return err - } - epo.ElasticPoolOperationProperties = &elasticPoolOperationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epo.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - epo.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - epo.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolOperationListResult the response to a list elastic pool operations request -type ElasticPoolOperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ElasticPoolOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolOperationListResult. -func (epolr ElasticPoolOperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolOperationListResultIterator provides access to a complete listing of ElasticPoolOperation -// values. -type ElasticPoolOperationListResultIterator struct { - i int - page ElasticPoolOperationListResultPage -} - -// 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 *ElasticPoolOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationListResultIterator.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 *ElasticPoolOperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ElasticPoolOperationListResultIterator) 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 ElasticPoolOperationListResultIterator) Response() ElasticPoolOperationListResult { - 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 ElasticPoolOperationListResultIterator) Value() ElasticPoolOperation { - if !iter.page.NotDone() { - return ElasticPoolOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ElasticPoolOperationListResultIterator type. -func NewElasticPoolOperationListResultIterator(page ElasticPoolOperationListResultPage) ElasticPoolOperationListResultIterator { - return ElasticPoolOperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (epolr ElasticPoolOperationListResult) IsEmpty() bool { - return epolr.Value == nil || len(*epolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (epolr ElasticPoolOperationListResult) hasNextLink() bool { - return epolr.NextLink != nil && len(*epolr.NextLink) != 0 -} - -// elasticPoolOperationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (epolr ElasticPoolOperationListResult) elasticPoolOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !epolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(epolr.NextLink))) -} - -// ElasticPoolOperationListResultPage contains a page of ElasticPoolOperation values. -type ElasticPoolOperationListResultPage struct { - fn func(context.Context, ElasticPoolOperationListResult) (ElasticPoolOperationListResult, error) - epolr ElasticPoolOperationListResult -} - -// 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 *ElasticPoolOperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationListResultPage.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.epolr) - if err != nil { - return err - } - page.epolr = 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 *ElasticPoolOperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ElasticPoolOperationListResultPage) NotDone() bool { - return !page.epolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ElasticPoolOperationListResultPage) Response() ElasticPoolOperationListResult { - return page.epolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ElasticPoolOperationListResultPage) Values() []ElasticPoolOperation { - if page.epolr.IsEmpty() { - return nil - } - return *page.epolr.Value -} - -// Creates a new instance of the ElasticPoolOperationListResultPage type. -func NewElasticPoolOperationListResultPage(cur ElasticPoolOperationListResult, getNextPage func(context.Context, ElasticPoolOperationListResult) (ElasticPoolOperationListResult, error)) ElasticPoolOperationListResultPage { - return ElasticPoolOperationListResultPage{ - fn: getNextPage, - epolr: cur, - } -} - -// ElasticPoolOperationProperties the properties of a elastic pool operation. -type ElasticPoolOperationProperties struct { - // ElasticPoolName - READ-ONLY; The name of the elastic pool the operation is being performed on. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // Operation - READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty"` - // OperationFriendlyName - READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` - // PercentComplete - READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ServerName - READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The operation state. - State *string `json:"state,omitempty"` - // ErrorCode - READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorDescription - READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty"` - // ErrorSeverity - READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // IsUserError - READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty"` - // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` - // Description - READ-ONLY; The operation description. - Description *string `json:"description,omitempty"` - // IsCancellable - READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolOperationProperties. -func (epop ElasticPoolOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolPerDatabaseMaxPerformanceLevelCapability the max per-database performance level capability. -type ElasticPoolPerDatabaseMaxPerformanceLevelCapability struct { - // Limit - READ-ONLY; The maximum performance level per database. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'DTU', 'VCores' - Unit PerformanceLevelUnit `json:"unit,omitempty"` - // SupportedPerDatabaseMinPerformanceLevels - READ-ONLY; The list of supported min database performance levels. - SupportedPerDatabaseMinPerformanceLevels *[]ElasticPoolPerDatabaseMinPerformanceLevelCapability `json:"supportedPerDatabaseMinPerformanceLevels,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMaxPerformanceLevelCapability. -func (eppdmplc ElasticPoolPerDatabaseMaxPerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eppdmplc.Reason != nil { - objectMap["reason"] = eppdmplc.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolPerDatabaseMinPerformanceLevelCapability the minimum per-database performance level -// capability. -type ElasticPoolPerDatabaseMinPerformanceLevelCapability struct { - // Limit - READ-ONLY; The minimum performance level per database. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'DTU', 'VCores' - Unit PerformanceLevelUnit `json:"unit,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMinPerformanceLevelCapability. -func (eppdmplc ElasticPoolPerDatabaseMinPerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eppdmplc.Reason != nil { - objectMap["reason"] = eppdmplc.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolPerDatabaseSettings per database settings of an elastic pool. -type ElasticPoolPerDatabaseSettings struct { - // MinCapacity - The minimum capacity all databases are guaranteed. - MinCapacity *float64 `json:"minCapacity,omitempty"` - // MaxCapacity - The maximum capacity any one database can consume. - MaxCapacity *float64 `json:"maxCapacity,omitempty"` -} - -// ElasticPoolPerformanceLevelCapability the Elastic Pool performance level capability. -type ElasticPoolPerformanceLevelCapability struct { - // PerformanceLevel - READ-ONLY; The performance level for the pool. - PerformanceLevel *PerformanceLevelCapability `json:"performanceLevel,omitempty"` - // Sku - READ-ONLY; The sku. - Sku *Sku `json:"sku,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // MaxDatabaseCount - READ-ONLY; The maximum number of databases supported. - MaxDatabaseCount *int32 `json:"maxDatabaseCount,omitempty"` - // IncludedMaxSize - READ-ONLY; The included (free) max size for this performance level. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // SupportedMaxSizes - READ-ONLY; The list of supported max sizes. - SupportedMaxSizes *[]MaxSizeRangeCapability `json:"supportedMaxSizes,omitempty"` - // SupportedPerDatabaseMaxSizes - READ-ONLY; The list of supported per database max sizes. - SupportedPerDatabaseMaxSizes *[]MaxSizeRangeCapability `json:"supportedPerDatabaseMaxSizes,omitempty"` - // SupportedPerDatabaseMaxPerformanceLevels - READ-ONLY; The list of supported per database max performance levels. - SupportedPerDatabaseMaxPerformanceLevels *[]ElasticPoolPerDatabaseMaxPerformanceLevelCapability `json:"supportedPerDatabaseMaxPerformanceLevels,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolPerformanceLevelCapability. -func (epplc ElasticPoolPerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epplc.Reason != nil { - objectMap["reason"] = epplc.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolProperties properties of an elastic pool -type ElasticPoolProperties struct { - // State - READ-ONLY; The state of the elastic pool. Possible values include: 'ElasticPoolStateCreating', 'ElasticPoolStateReady', 'ElasticPoolStateDisabled' - State ElasticPoolState `json:"state,omitempty"` - // CreationDate - READ-ONLY; The creation date of the elastic pool (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // MaxSizeBytes - The storage limit for the database elastic pool in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // PerDatabaseSettings - The per database settings for the elastic pool. - PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` - // ZoneRedundant - Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // LicenseType - The license type to apply for this elastic pool. Possible values include: 'ElasticPoolLicenseTypeLicenseIncluded', 'ElasticPoolLicenseTypeBasePrice' - LicenseType ElasticPoolLicenseType `json:"licenseType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolProperties. -func (epp ElasticPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epp.MaxSizeBytes != nil { - objectMap["maxSizeBytes"] = epp.MaxSizeBytes - } - if epp.PerDatabaseSettings != nil { - objectMap["perDatabaseSettings"] = epp.PerDatabaseSettings - } - if epp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = epp.ZoneRedundant - } - if epp.LicenseType != "" { - objectMap["licenseType"] = epp.LicenseType - } - return json.Marshal(objectMap) -} - -// ElasticPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ElasticPoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (ElasticPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsCreateOrUpdateFuture) 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 ElasticPoolsCreateOrUpdateFuture.Result. -func (future *ElasticPoolsCreateOrUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateOrUpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ElasticPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsDeleteFuture) 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 ElasticPoolsDeleteFuture.Result. -func (future *ElasticPoolsDeleteFuture) result(client ElasticPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ElasticPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (ElasticPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsUpdateFuture) 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 ElasticPoolsUpdateFuture.Result. -func (future *ElasticPoolsUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.UpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ElasticPoolUpdate an elastic pool update. -type ElasticPoolUpdate struct { - Sku *Sku `json:"sku,omitempty"` - // ElasticPoolUpdateProperties - Resource properties. - *ElasticPoolUpdateProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolUpdate. -func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epu.Sku != nil { - objectMap["sku"] = epu.Sku - } - if epu.ElasticPoolUpdateProperties != nil { - objectMap["properties"] = epu.ElasticPoolUpdateProperties - } - if epu.Tags != nil { - objectMap["tags"] = epu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolUpdate struct. -func (epu *ElasticPoolUpdate) 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 - } - epu.Sku = &sku - } - case "properties": - if v != nil { - var elasticPoolUpdateProperties ElasticPoolUpdateProperties - err = json.Unmarshal(*v, &elasticPoolUpdateProperties) - if err != nil { - return err - } - epu.ElasticPoolUpdateProperties = &elasticPoolUpdateProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - epu.Tags = tags - } - } - } - - return nil -} - -// ElasticPoolUpdateProperties properties of an elastic pool -type ElasticPoolUpdateProperties struct { - // MaxSizeBytes - The storage limit for the database elastic pool in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // PerDatabaseSettings - The per database settings for the elastic pool. - PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` - // ZoneRedundant - Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // LicenseType - The license type to apply for this elastic pool. Possible values include: 'ElasticPoolLicenseTypeLicenseIncluded', 'ElasticPoolLicenseTypeBasePrice' - LicenseType ElasticPoolLicenseType `json:"licenseType,omitempty"` -} - -// InstanceFailoverGroup an instance failover group. -type InstanceFailoverGroup struct { - autorest.Response `json:"-"` - // InstanceFailoverGroupProperties - Resource properties. - *InstanceFailoverGroupProperties `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"` -} - -// MarshalJSON is the custom marshaler for InstanceFailoverGroup. -func (ifg InstanceFailoverGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ifg.InstanceFailoverGroupProperties != nil { - objectMap["properties"] = ifg.InstanceFailoverGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InstanceFailoverGroup struct. -func (ifg *InstanceFailoverGroup) 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 instanceFailoverGroupProperties InstanceFailoverGroupProperties - err = json.Unmarshal(*v, &instanceFailoverGroupProperties) - if err != nil { - return err - } - ifg.InstanceFailoverGroupProperties = &instanceFailoverGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ifg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ifg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ifg.Type = &typeVar - } - } - } - - return nil -} - -// InstanceFailoverGroupListResult a list of instance failover groups. -type InstanceFailoverGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]InstanceFailoverGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstanceFailoverGroupListResult. -func (ifglr InstanceFailoverGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// InstanceFailoverGroupListResultIterator provides access to a complete listing of InstanceFailoverGroup -// values. -type InstanceFailoverGroupListResultIterator struct { - i int - page InstanceFailoverGroupListResultPage -} - -// 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 *InstanceFailoverGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupListResultIterator.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 *InstanceFailoverGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InstanceFailoverGroupListResultIterator) 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 InstanceFailoverGroupListResultIterator) Response() InstanceFailoverGroupListResult { - 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 InstanceFailoverGroupListResultIterator) Value() InstanceFailoverGroup { - if !iter.page.NotDone() { - return InstanceFailoverGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the InstanceFailoverGroupListResultIterator type. -func NewInstanceFailoverGroupListResultIterator(page InstanceFailoverGroupListResultPage) InstanceFailoverGroupListResultIterator { - return InstanceFailoverGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ifglr InstanceFailoverGroupListResult) IsEmpty() bool { - return ifglr.Value == nil || len(*ifglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ifglr InstanceFailoverGroupListResult) hasNextLink() bool { - return ifglr.NextLink != nil && len(*ifglr.NextLink) != 0 -} - -// instanceFailoverGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ifglr InstanceFailoverGroupListResult) instanceFailoverGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ifglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ifglr.NextLink))) -} - -// InstanceFailoverGroupListResultPage contains a page of InstanceFailoverGroup values. -type InstanceFailoverGroupListResultPage struct { - fn func(context.Context, InstanceFailoverGroupListResult) (InstanceFailoverGroupListResult, error) - ifglr InstanceFailoverGroupListResult -} - -// 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 *InstanceFailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupListResultPage.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.ifglr) - if err != nil { - return err - } - page.ifglr = 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 *InstanceFailoverGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InstanceFailoverGroupListResultPage) NotDone() bool { - return !page.ifglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page InstanceFailoverGroupListResultPage) Response() InstanceFailoverGroupListResult { - return page.ifglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page InstanceFailoverGroupListResultPage) Values() []InstanceFailoverGroup { - if page.ifglr.IsEmpty() { - return nil - } - return *page.ifglr.Value -} - -// Creates a new instance of the InstanceFailoverGroupListResultPage type. -func NewInstanceFailoverGroupListResultPage(cur InstanceFailoverGroupListResult, getNextPage func(context.Context, InstanceFailoverGroupListResult) (InstanceFailoverGroupListResult, error)) InstanceFailoverGroupListResultPage { - return InstanceFailoverGroupListResultPage{ - fn: getNextPage, - ifglr: cur, - } -} - -// InstanceFailoverGroupProperties properties of a instance failover group. -type InstanceFailoverGroupProperties struct { - // ReadWriteEndpoint - Read-write endpoint of the failover group instance. - ReadWriteEndpoint *InstanceFailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` - // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *InstanceFailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` - // ReplicationRole - READ-ONLY; Local replication role of the failover group instance. Possible values include: 'Primary', 'Secondary' - ReplicationRole InstanceFailoverGroupReplicationRole `json:"replicationRole,omitempty"` - // ReplicationState - READ-ONLY; Replication state of the failover group instance. - ReplicationState *string `json:"replicationState,omitempty"` - // PartnerRegions - Partner region information for the failover group. - PartnerRegions *[]PartnerRegionInfo `json:"partnerRegions,omitempty"` - // ManagedInstancePairs - List of managed instance pairs in the failover group. - ManagedInstancePairs *[]ManagedInstancePairInfo `json:"managedInstancePairs,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstanceFailoverGroupProperties. -func (ifgp InstanceFailoverGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ifgp.ReadWriteEndpoint != nil { - objectMap["readWriteEndpoint"] = ifgp.ReadWriteEndpoint - } - if ifgp.ReadOnlyEndpoint != nil { - objectMap["readOnlyEndpoint"] = ifgp.ReadOnlyEndpoint - } - if ifgp.PartnerRegions != nil { - objectMap["partnerRegions"] = ifgp.PartnerRegions - } - if ifgp.ManagedInstancePairs != nil { - objectMap["managedInstancePairs"] = ifgp.ManagedInstancePairs - } - return json.Marshal(objectMap) -} - -// InstanceFailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. -type InstanceFailoverGroupReadOnlyEndpoint struct { - // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' - FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` -} - -// InstanceFailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. -type InstanceFailoverGroupReadWriteEndpoint struct { - // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic' - FailoverPolicy ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` - // FailoverWithDataLossGracePeriodMinutes - Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. - FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` -} - -// InstanceFailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstanceFailoverGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsCreateOrUpdateFuture) 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 InstanceFailoverGroupsCreateOrUpdateFuture.Result. -func (future *InstanceFailoverGroupsCreateOrUpdateFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { - ifg, err = client.CreateOrUpdateResponder(ifg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsCreateOrUpdateFuture", "Result", ifg.Response.Response, "Failure responding to request") - } - } - return -} - -// InstanceFailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstanceFailoverGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsDeleteFuture) 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 InstanceFailoverGroupsDeleteFuture.Result. -func (future *InstanceFailoverGroupsDeleteFuture) result(client InstanceFailoverGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// InstanceFailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstanceFailoverGroupsFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsFailoverFuture) 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 InstanceFailoverGroupsFailoverFuture.Result. -func (future *InstanceFailoverGroupsFailoverFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsFailoverFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { - ifg, err = client.FailoverResponder(ifg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsFailoverFuture", "Result", ifg.Response.Response, "Failure responding to request") - } - } - return -} - -// InstanceFailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type InstanceFailoverGroupsForceFailoverAllowDataLossFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsForceFailoverAllowDataLossFuture) 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 InstanceFailoverGroupsForceFailoverAllowDataLossFuture.Result. -func (future *InstanceFailoverGroupsForceFailoverAllowDataLossFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { - ifg, err = client.ForceFailoverAllowDataLossResponder(ifg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture", "Result", ifg.Response.Response, "Failure responding to request") - } - } - return -} - -// LicenseTypeCapability the license type capability -type LicenseTypeCapability struct { - // Name - READ-ONLY; License type identifier. - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for LicenseTypeCapability. -func (ltc LicenseTypeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ltc.Reason != nil { - objectMap["reason"] = ltc.Reason - } - return json.Marshal(objectMap) -} - -// LocationCapabilities the location capability. -type LocationCapabilities struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; The location name. - Name *string `json:"name,omitempty"` - // SupportedServerVersions - READ-ONLY; The list of supported server versions. - SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` - // SupportedManagedInstanceVersions - READ-ONLY; The list of supported managed instance versions. - SupportedManagedInstanceVersions *[]ManagedInstanceVersionCapability `json:"supportedManagedInstanceVersions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationCapabilities. -func (lc LocationCapabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lc.Reason != nil { - objectMap["reason"] = lc.Reason - } - return json.Marshal(objectMap) -} - -// LogSizeCapability the log size capability. -type LogSizeCapability struct { - // Limit - READ-ONLY; The log size limit (see 'unit' for the units). - Limit *int32 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', 'Percent' - Unit LogSizeUnit `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSizeCapability. -func (lsc LogSizeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedDatabaseVulnerabilityAssessmentScansClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture) 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 ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture.Result. -func (future *ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture) result(client ManagedDatabaseVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstanceEditionCapability the managed server capability -type ManagedInstanceEditionCapability struct { - // Name - READ-ONLY; The managed server version name. - Name *string `json:"name,omitempty"` - // SupportedFamilies - READ-ONLY; The supported families. - SupportedFamilies *[]ManagedInstanceFamilyCapability `json:"supportedFamilies,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEditionCapability. -func (miec ManagedInstanceEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miec.Reason != nil { - objectMap["reason"] = miec.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceEncryptionProtector the managed instance encryption protector. -type ManagedInstanceEncryptionProtector struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ManagedInstanceEncryptionProtectorProperties - Resource properties. - *ManagedInstanceEncryptionProtectorProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtector. -func (miep ManagedInstanceEncryptionProtector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miep.ManagedInstanceEncryptionProtectorProperties != nil { - objectMap["properties"] = miep.ManagedInstanceEncryptionProtectorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceEncryptionProtector struct. -func (miep *ManagedInstanceEncryptionProtector) 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 - } - miep.Kind = &kind - } - case "properties": - if v != nil { - var managedInstanceEncryptionProtectorProperties ManagedInstanceEncryptionProtectorProperties - err = json.Unmarshal(*v, &managedInstanceEncryptionProtectorProperties) - if err != nil { - return err - } - miep.ManagedInstanceEncryptionProtectorProperties = &managedInstanceEncryptionProtectorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - miep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - miep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - miep.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceEncryptionProtectorListResult a list of managed instance encryption protectors. -type ManagedInstanceEncryptionProtectorListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceEncryptionProtector `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtectorListResult. -func (mieplr ManagedInstanceEncryptionProtectorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceEncryptionProtectorListResultIterator provides access to a complete listing of -// ManagedInstanceEncryptionProtector values. -type ManagedInstanceEncryptionProtectorListResultIterator struct { - i int - page ManagedInstanceEncryptionProtectorListResultPage -} - -// 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 *ManagedInstanceEncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultIterator.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 *ManagedInstanceEncryptionProtectorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceEncryptionProtectorListResultIterator) 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 ManagedInstanceEncryptionProtectorListResultIterator) Response() ManagedInstanceEncryptionProtectorListResult { - 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 ManagedInstanceEncryptionProtectorListResultIterator) Value() ManagedInstanceEncryptionProtector { - if !iter.page.NotDone() { - return ManagedInstanceEncryptionProtector{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultIterator type. -func NewManagedInstanceEncryptionProtectorListResultIterator(page ManagedInstanceEncryptionProtectorListResultPage) ManagedInstanceEncryptionProtectorListResultIterator { - return ManagedInstanceEncryptionProtectorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mieplr ManagedInstanceEncryptionProtectorListResult) IsEmpty() bool { - return mieplr.Value == nil || len(*mieplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mieplr ManagedInstanceEncryptionProtectorListResult) hasNextLink() bool { - return mieplr.NextLink != nil && len(*mieplr.NextLink) != 0 -} - -// managedInstanceEncryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mieplr ManagedInstanceEncryptionProtectorListResult) managedInstanceEncryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mieplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mieplr.NextLink))) -} - -// ManagedInstanceEncryptionProtectorListResultPage contains a page of ManagedInstanceEncryptionProtector -// values. -type ManagedInstanceEncryptionProtectorListResultPage struct { - fn func(context.Context, ManagedInstanceEncryptionProtectorListResult) (ManagedInstanceEncryptionProtectorListResult, error) - mieplr ManagedInstanceEncryptionProtectorListResult -} - -// 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 *ManagedInstanceEncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultPage.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.mieplr) - if err != nil { - return err - } - page.mieplr = 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 *ManagedInstanceEncryptionProtectorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceEncryptionProtectorListResultPage) NotDone() bool { - return !page.mieplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceEncryptionProtectorListResultPage) Response() ManagedInstanceEncryptionProtectorListResult { - return page.mieplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceEncryptionProtectorListResultPage) Values() []ManagedInstanceEncryptionProtector { - if page.mieplr.IsEmpty() { - return nil - } - return *page.mieplr.Value -} - -// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultPage type. -func NewManagedInstanceEncryptionProtectorListResultPage(cur ManagedInstanceEncryptionProtectorListResult, getNextPage func(context.Context, ManagedInstanceEncryptionProtectorListResult) (ManagedInstanceEncryptionProtectorListResult, error)) ManagedInstanceEncryptionProtectorListResultPage { - return ManagedInstanceEncryptionProtectorListResultPage{ - fn: getNextPage, - mieplr: cur, - } -} - -// ManagedInstanceEncryptionProtectorProperties properties for an encryption protector execution. -type ManagedInstanceEncryptionProtectorProperties struct { - // ServerKeyName - The name of the managed instance key. - ServerKeyName *string `json:"serverKeyName,omitempty"` - // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - READ-ONLY; The URI of the server key. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtectorProperties. -func (miepp ManagedInstanceEncryptionProtectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miepp.ServerKeyName != nil { - objectMap["serverKeyName"] = miepp.ServerKeyName - } - if miepp.ServerKeyType != "" { - objectMap["serverKeyType"] = miepp.ServerKeyType - } - return json.Marshal(objectMap) -} - -// ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceEncryptionProtectorsClient) (ManagedInstanceEncryptionProtector, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) 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 ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture.Result. -func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) result(client ManagedInstanceEncryptionProtectorsClient) (miep ManagedInstanceEncryptionProtector, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - miep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if miep.Response.Response, err = future.GetResult(sender); err == nil && miep.Response.Response.StatusCode != http.StatusNoContent { - miep, err = client.CreateOrUpdateResponder(miep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture", "Result", miep.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceEncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceEncryptionProtectorsRevalidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceEncryptionProtectorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) 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 ManagedInstanceEncryptionProtectorsRevalidateFuture.Result. -func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) result(client ManagedInstanceEncryptionProtectorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsRevalidateFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstanceFamilyCapability the managed server family capability. -type ManagedInstanceFamilyCapability struct { - // Name - READ-ONLY; Family name. - Name *string `json:"name,omitempty"` - // Sku - READ-ONLY; SKU name. - Sku *string `json:"sku,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // SupportedVcoresValues - READ-ONLY; List of supported virtual cores values. - SupportedVcoresValues *[]ManagedInstanceVcoresCapability `json:"supportedVcoresValues,omitempty"` - // IncludedMaxSize - READ-ONLY; Included size. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // SupportedStorageSizes - READ-ONLY; Storage size ranges. - SupportedStorageSizes *[]MaxSizeRangeCapability `json:"supportedStorageSizes,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceFamilyCapability. -func (mifc ManagedInstanceFamilyCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mifc.Reason != nil { - objectMap["reason"] = mifc.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceKey a managed instance key. -type ManagedInstanceKey struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ManagedInstanceKeyProperties - Resource properties. - *ManagedInstanceKeyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceKey. -func (mik ManagedInstanceKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mik.ManagedInstanceKeyProperties != nil { - objectMap["properties"] = mik.ManagedInstanceKeyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceKey struct. -func (mik *ManagedInstanceKey) 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 - } - mik.Kind = &kind - } - case "properties": - if v != nil { - var managedInstanceKeyProperties ManagedInstanceKeyProperties - err = json.Unmarshal(*v, &managedInstanceKeyProperties) - if err != nil { - return err - } - mik.ManagedInstanceKeyProperties = &managedInstanceKeyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mik.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mik.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mik.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceKeyListResult a list of managed instance keys. -type ManagedInstanceKeyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceKey `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceKeyListResult. -func (miklr ManagedInstanceKeyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceKeyListResultIterator provides access to a complete listing of ManagedInstanceKey values. -type ManagedInstanceKeyListResultIterator struct { - i int - page ManagedInstanceKeyListResultPage -} - -// 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 *ManagedInstanceKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeyListResultIterator.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 *ManagedInstanceKeyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceKeyListResultIterator) 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 ManagedInstanceKeyListResultIterator) Response() ManagedInstanceKeyListResult { - 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 ManagedInstanceKeyListResultIterator) Value() ManagedInstanceKey { - if !iter.page.NotDone() { - return ManagedInstanceKey{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceKeyListResultIterator type. -func NewManagedInstanceKeyListResultIterator(page ManagedInstanceKeyListResultPage) ManagedInstanceKeyListResultIterator { - return ManagedInstanceKeyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (miklr ManagedInstanceKeyListResult) IsEmpty() bool { - return miklr.Value == nil || len(*miklr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (miklr ManagedInstanceKeyListResult) hasNextLink() bool { - return miklr.NextLink != nil && len(*miklr.NextLink) != 0 -} - -// managedInstanceKeyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (miklr ManagedInstanceKeyListResult) managedInstanceKeyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miklr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(miklr.NextLink))) -} - -// ManagedInstanceKeyListResultPage contains a page of ManagedInstanceKey values. -type ManagedInstanceKeyListResultPage struct { - fn func(context.Context, ManagedInstanceKeyListResult) (ManagedInstanceKeyListResult, error) - miklr ManagedInstanceKeyListResult -} - -// 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 *ManagedInstanceKeyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeyListResultPage.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.miklr) - if err != nil { - return err - } - page.miklr = 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 *ManagedInstanceKeyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceKeyListResultPage) NotDone() bool { - return !page.miklr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceKeyListResultPage) Response() ManagedInstanceKeyListResult { - return page.miklr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceKeyListResultPage) Values() []ManagedInstanceKey { - if page.miklr.IsEmpty() { - return nil - } - return *page.miklr.Value -} - -// Creates a new instance of the ManagedInstanceKeyListResultPage type. -func NewManagedInstanceKeyListResultPage(cur ManagedInstanceKeyListResult, getNextPage func(context.Context, ManagedInstanceKeyListResult) (ManagedInstanceKeyListResult, error)) ManagedInstanceKeyListResultPage { - return ManagedInstanceKeyListResultPage{ - fn: getNextPage, - miklr: cur, - } -} - -// ManagedInstanceKeyProperties properties for a key execution. -type ManagedInstanceKeyProperties struct { - // ServerKeyType - The key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the key. - Thumbprint *string `json:"thumbprint,omitempty"` - // CreationDate - READ-ONLY; The key creation date. - CreationDate *date.Time `json:"creationDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceKeyProperties. -func (mikp ManagedInstanceKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mikp.ServerKeyType != "" { - objectMap["serverKeyType"] = mikp.ServerKeyType - } - if mikp.URI != nil { - objectMap["uri"] = mikp.URI - } - return json.Marshal(objectMap) -} - -// ManagedInstanceKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceKeysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceKeysClient) (ManagedInstanceKey, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceKeysCreateOrUpdateFuture) 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 ManagedInstanceKeysCreateOrUpdateFuture.Result. -func (future *ManagedInstanceKeysCreateOrUpdateFuture) result(client ManagedInstanceKeysClient) (mik ManagedInstanceKey, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mik.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceKeysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mik.Response.Response, err = future.GetResult(sender); err == nil && mik.Response.Response.StatusCode != http.StatusNoContent { - mik, err = client.CreateOrUpdateResponder(mik.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysCreateOrUpdateFuture", "Result", mik.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceKeysDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceKeysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceKeysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceKeysDeleteFuture) 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 ManagedInstanceKeysDeleteFuture.Result. -func (future *ManagedInstanceKeysDeleteFuture) result(client ManagedInstanceKeysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceKeysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstancePairInfo pairs of Managed Instances in the failover group. -type ManagedInstancePairInfo struct { - // PrimaryManagedInstanceID - Id of Primary Managed Instance in pair. - PrimaryManagedInstanceID *string `json:"primaryManagedInstanceId,omitempty"` - // PartnerManagedInstanceID - Id of Partner Managed Instance in pair. - PartnerManagedInstanceID *string `json:"partnerManagedInstanceId,omitempty"` -} - -// ManagedInstanceTdeCertificatesCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceTdeCertificatesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceTdeCertificatesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceTdeCertificatesCreateFuture) 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 ManagedInstanceTdeCertificatesCreateFuture.Result. -func (future *ManagedInstanceTdeCertificatesCreateFuture) result(client ManagedInstanceTdeCertificatesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceTdeCertificatesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceTdeCertificatesCreateFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstanceVcoresCapability the managed instance virtual cores capability. -type ManagedInstanceVcoresCapability struct { - // Name - READ-ONLY; The virtual cores identifier. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; The virtual cores value. - Value *int32 `json:"value,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceVcoresCapability. -func (mivc ManagedInstanceVcoresCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mivc.Reason != nil { - objectMap["reason"] = mivc.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceVersionCapability the managed instance capability -type ManagedInstanceVersionCapability struct { - // Name - READ-ONLY; The server version name. - Name *string `json:"name,omitempty"` - // SupportedEditions - READ-ONLY; The list of supported managed instance editions. - SupportedEditions *[]ManagedInstanceEditionCapability `json:"supportedEditions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceVersionCapability. -func (mivc ManagedInstanceVersionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mivc.Reason != nil { - objectMap["reason"] = mivc.Reason - } - return json.Marshal(objectMap) -} - -// MaxSizeCapability the maximum size capability. -type MaxSizeCapability struct { - // Limit - READ-ONLY; The maximum size limit (see 'unit' for the units). - Limit *int32 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units that the limit is expressed in. Possible values include: 'MaxSizeUnitMegabytes', 'MaxSizeUnitGigabytes', 'MaxSizeUnitTerabytes', 'MaxSizeUnitPetabytes' - Unit MaxSizeUnit `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for MaxSizeCapability. -func (msc MaxSizeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MaxSizeRangeCapability the maximum size range capability. -type MaxSizeRangeCapability struct { - // MinValue - READ-ONLY; Minimum value. - MinValue *MaxSizeCapability `json:"minValue,omitempty"` - // MaxValue - READ-ONLY; Maximum value. - MaxValue *MaxSizeCapability `json:"maxValue,omitempty"` - // ScaleSize - READ-ONLY; Scale/step size for discrete values between the minimum value and the maximum value. - ScaleSize *MaxSizeCapability `json:"scaleSize,omitempty"` - // LogSize - READ-ONLY; Size of transaction log. - LogSize *LogSizeCapability `json:"logSize,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for MaxSizeRangeCapability. -func (msrc MaxSizeRangeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msrc.Reason != nil { - objectMap["reason"] = msrc.Reason - } - return json.Marshal(objectMap) -} - -// PartnerRegionInfo partner region information for the failover group. -type PartnerRegionInfo struct { - // Location - Geo location of the partner managed instances. - Location *string `json:"location,omitempty"` - // ReplicationRole - READ-ONLY; Replication role of the partner managed instances. Possible values include: 'Primary', 'Secondary' - ReplicationRole InstanceFailoverGroupReplicationRole `json:"replicationRole,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerRegionInfo. -func (pri PartnerRegionInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pri.Location != nil { - objectMap["location"] = pri.Location - } - return json.Marshal(objectMap) -} - -// PerformanceLevelCapability the performance level capability. -type PerformanceLevelCapability struct { - // Value - READ-ONLY; Performance level value. - Value *float64 `json:"value,omitempty"` - // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'DTU', 'VCores' - Unit PerformanceLevelUnit `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for PerformanceLevelCapability. -func (plc PerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProxyResource ARM proxy resource. -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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableManagedDatabase a recoverable managed database resource. -type RecoverableManagedDatabase struct { - autorest.Response `json:"-"` - // RecoverableManagedDatabaseProperties - Resource properties. - *RecoverableManagedDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for RecoverableManagedDatabase. -func (rmd RecoverableManagedDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmd.RecoverableManagedDatabaseProperties != nil { - objectMap["properties"] = rmd.RecoverableManagedDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecoverableManagedDatabase struct. -func (rmd *RecoverableManagedDatabase) 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 recoverableManagedDatabaseProperties RecoverableManagedDatabaseProperties - err = json.Unmarshal(*v, &recoverableManagedDatabaseProperties) - if err != nil { - return err - } - rmd.RecoverableManagedDatabaseProperties = &recoverableManagedDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rmd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rmd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rmd.Type = &typeVar - } - } - } - - return nil -} - -// RecoverableManagedDatabaseListResult a list of recoverable managed databases. -type RecoverableManagedDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]RecoverableManagedDatabase `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableManagedDatabaseListResult. -func (rmdlr RecoverableManagedDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableManagedDatabaseListResultIterator provides access to a complete listing of -// RecoverableManagedDatabase values. -type RecoverableManagedDatabaseListResultIterator struct { - i int - page RecoverableManagedDatabaseListResultPage -} - -// 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 *RecoverableManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabaseListResultIterator.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 *RecoverableManagedDatabaseListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RecoverableManagedDatabaseListResultIterator) 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 RecoverableManagedDatabaseListResultIterator) Response() RecoverableManagedDatabaseListResult { - 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 RecoverableManagedDatabaseListResultIterator) Value() RecoverableManagedDatabase { - if !iter.page.NotDone() { - return RecoverableManagedDatabase{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RecoverableManagedDatabaseListResultIterator type. -func NewRecoverableManagedDatabaseListResultIterator(page RecoverableManagedDatabaseListResultPage) RecoverableManagedDatabaseListResultIterator { - return RecoverableManagedDatabaseListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rmdlr RecoverableManagedDatabaseListResult) IsEmpty() bool { - return rmdlr.Value == nil || len(*rmdlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rmdlr RecoverableManagedDatabaseListResult) hasNextLink() bool { - return rmdlr.NextLink != nil && len(*rmdlr.NextLink) != 0 -} - -// recoverableManagedDatabaseListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rmdlr RecoverableManagedDatabaseListResult) recoverableManagedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rmdlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rmdlr.NextLink))) -} - -// RecoverableManagedDatabaseListResultPage contains a page of RecoverableManagedDatabase values. -type RecoverableManagedDatabaseListResultPage struct { - fn func(context.Context, RecoverableManagedDatabaseListResult) (RecoverableManagedDatabaseListResult, error) - rmdlr RecoverableManagedDatabaseListResult -} - -// 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 *RecoverableManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabaseListResultPage.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.rmdlr) - if err != nil { - return err - } - page.rmdlr = 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 *RecoverableManagedDatabaseListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RecoverableManagedDatabaseListResultPage) NotDone() bool { - return !page.rmdlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RecoverableManagedDatabaseListResultPage) Response() RecoverableManagedDatabaseListResult { - return page.rmdlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RecoverableManagedDatabaseListResultPage) Values() []RecoverableManagedDatabase { - if page.rmdlr.IsEmpty() { - return nil - } - return *page.rmdlr.Value -} - -// Creates a new instance of the RecoverableManagedDatabaseListResultPage type. -func NewRecoverableManagedDatabaseListResultPage(cur RecoverableManagedDatabaseListResult, getNextPage func(context.Context, RecoverableManagedDatabaseListResult) (RecoverableManagedDatabaseListResult, error)) RecoverableManagedDatabaseListResultPage { - return RecoverableManagedDatabaseListResultPage{ - fn: getNextPage, - rmdlr: cur, - } -} - -// RecoverableManagedDatabaseProperties the recoverable managed database's properties. -type RecoverableManagedDatabaseProperties struct { - // LastAvailableBackupDate - READ-ONLY; The last available backup date. - LastAvailableBackupDate *string `json:"lastAvailableBackupDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableManagedDatabaseProperties. -func (rmdp RecoverableManagedDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource ARM resource. -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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceMoveDefinition contains the information necessary to perform a resource move (rename). -type ResourceMoveDefinition struct { - // ID - The target ID for the resource - ID *string `json:"id,omitempty"` -} - -// ServerVersionCapability the server capability -type ServerVersionCapability struct { - // Name - READ-ONLY; The server version name. - Name *string `json:"name,omitempty"` - // SupportedEditions - READ-ONLY; The list of supported database editions. - SupportedEditions *[]EditionCapability `json:"supportedEditions,omitempty"` - // SupportedElasticPoolEditions - READ-ONLY; The list of supported elastic pool editions. - SupportedElasticPoolEditions *[]ElasticPoolEditionCapability `json:"supportedElasticPoolEditions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerVersionCapability. -func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if svc.Reason != nil { - objectMap["reason"] = svc.Reason - } - return json.Marshal(objectMap) -} - -// ServiceObjectiveCapability the service objectives capability. -type ServiceObjectiveCapability struct { - // ID - READ-ONLY; The unique ID of the service objective. - ID *uuid.UUID `json:"id,omitempty"` - // Name - READ-ONLY; The service objective name. - Name *string `json:"name,omitempty"` - // SupportedMaxSizes - READ-ONLY; The list of supported maximum database sizes. - SupportedMaxSizes *[]MaxSizeRangeCapability `json:"supportedMaxSizes,omitempty"` - // PerformanceLevel - READ-ONLY; The performance level. - PerformanceLevel *PerformanceLevelCapability `json:"performanceLevel,omitempty"` - // Sku - READ-ONLY; The sku. - Sku *Sku `json:"sku,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // IncludedMaxSize - READ-ONLY; The included (free) max size. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceObjectiveCapability. -func (soc ServiceObjectiveCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if soc.Reason != nil { - objectMap["reason"] = soc.Reason - } - return json.Marshal(objectMap) -} - -// Sku an ARM Resource SKU. -type Sku struct { - // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. - Name *string `json:"name,omitempty"` - // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. - Tier *string `json:"tier,omitempty"` - // Size - Size of the particular SKU - Size *string `json:"size,omitempty"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // Capacity - Capacity of the particular SKU. - Capacity *int32 `json:"capacity,omitempty"` -} - -// TdeCertificate a TDE certificate that can be uploaded into a server. -type TdeCertificate struct { - // TdeCertificateProperties - Resource properties. - *TdeCertificateProperties `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"` -} - -// MarshalJSON is the custom marshaler for TdeCertificate. -func (tc TdeCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tc.TdeCertificateProperties != nil { - objectMap["properties"] = tc.TdeCertificateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TdeCertificate struct. -func (tc *TdeCertificate) 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 tdeCertificateProperties TdeCertificateProperties - err = json.Unmarshal(*v, &tdeCertificateProperties) - if err != nil { - return err - } - tc.TdeCertificateProperties = &tdeCertificateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tc.Type = &typeVar - } - } - } - - return nil -} - -// TdeCertificateProperties properties of a TDE certificate. -type TdeCertificateProperties struct { - // PrivateBlob - The base64 encoded certificate private blob. - PrivateBlob *string `json:"privateBlob,omitempty"` - // CertPassword - The certificate password. - CertPassword *string `json:"certPassword,omitempty"` -} - -// TdeCertificatesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TdeCertificatesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TdeCertificatesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TdeCertificatesCreateFuture) 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 TdeCertificatesCreateFuture.Result. -func (future *TdeCertificatesCreateFuture) result(client TdeCertificatesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TdeCertificatesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.TdeCertificatesCreateFuture") - return - } - ar.Response = future.Response() - return -} - -// TrackedResource 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"` -} - -// 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) -} - -// VulnerabilityAssessmentRecurringScansProperties properties of a Vulnerability Assessment recurring -// scans. -type VulnerabilityAssessmentRecurringScansProperties struct { - // IsEnabled - Recurring scans state. - IsEnabled *bool `json:"isEnabled,omitempty"` - // EmailSubscriptionAdmins - Specifies that the schedule scan notification will be is sent to the subscription administrators. - EmailSubscriptionAdmins *bool `json:"emailSubscriptionAdmins,omitempty"` - // Emails - Specifies an array of e-mail addresses to which the scan notification is sent. - Emails *[]string `json:"emails,omitempty"` -} - -// VulnerabilityAssessmentScanError properties of a vulnerability assessment scan error. -type VulnerabilityAssessmentScanError struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanError. -func (vase VulnerabilityAssessmentScanError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VulnerabilityAssessmentScanRecord a vulnerability assessment scan record. -type VulnerabilityAssessmentScanRecord struct { - autorest.Response `json:"-"` - // VulnerabilityAssessmentScanRecordProperties - Resource properties. - *VulnerabilityAssessmentScanRecordProperties `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"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecord. -func (vasr VulnerabilityAssessmentScanRecord) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vasr.VulnerabilityAssessmentScanRecordProperties != nil { - objectMap["properties"] = vasr.VulnerabilityAssessmentScanRecordProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VulnerabilityAssessmentScanRecord struct. -func (vasr *VulnerabilityAssessmentScanRecord) 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 vulnerabilityAssessmentScanRecordProperties VulnerabilityAssessmentScanRecordProperties - err = json.Unmarshal(*v, &vulnerabilityAssessmentScanRecordProperties) - if err != nil { - return err - } - vasr.VulnerabilityAssessmentScanRecordProperties = &vulnerabilityAssessmentScanRecordProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vasr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vasr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vasr.Type = &typeVar - } - } - } - - return nil -} - -// VulnerabilityAssessmentScanRecordListResult a list of vulnerability assessment scan records. -type VulnerabilityAssessmentScanRecordListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VulnerabilityAssessmentScanRecord `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecordListResult. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VulnerabilityAssessmentScanRecordListResultIterator provides access to a complete listing of -// VulnerabilityAssessmentScanRecord values. -type VulnerabilityAssessmentScanRecordListResultIterator struct { - i int - page VulnerabilityAssessmentScanRecordListResultPage -} - -// 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 *VulnerabilityAssessmentScanRecordListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VulnerabilityAssessmentScanRecordListResultIterator.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 *VulnerabilityAssessmentScanRecordListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VulnerabilityAssessmentScanRecordListResultIterator) 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 VulnerabilityAssessmentScanRecordListResultIterator) Response() VulnerabilityAssessmentScanRecordListResult { - 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 VulnerabilityAssessmentScanRecordListResultIterator) Value() VulnerabilityAssessmentScanRecord { - if !iter.page.NotDone() { - return VulnerabilityAssessmentScanRecord{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VulnerabilityAssessmentScanRecordListResultIterator type. -func NewVulnerabilityAssessmentScanRecordListResultIterator(page VulnerabilityAssessmentScanRecordListResultPage) VulnerabilityAssessmentScanRecordListResultIterator { - return VulnerabilityAssessmentScanRecordListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) IsEmpty() bool { - return vasrlr.Value == nil || len(*vasrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) hasNextLink() bool { - return vasrlr.NextLink != nil && len(*vasrlr.NextLink) != 0 -} - -// vulnerabilityAssessmentScanRecordListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) vulnerabilityAssessmentScanRecordListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vasrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vasrlr.NextLink))) -} - -// VulnerabilityAssessmentScanRecordListResultPage contains a page of VulnerabilityAssessmentScanRecord -// values. -type VulnerabilityAssessmentScanRecordListResultPage struct { - fn func(context.Context, VulnerabilityAssessmentScanRecordListResult) (VulnerabilityAssessmentScanRecordListResult, error) - vasrlr VulnerabilityAssessmentScanRecordListResult -} - -// 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 *VulnerabilityAssessmentScanRecordListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VulnerabilityAssessmentScanRecordListResultPage.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.vasrlr) - if err != nil { - return err - } - page.vasrlr = 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 *VulnerabilityAssessmentScanRecordListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VulnerabilityAssessmentScanRecordListResultPage) NotDone() bool { - return !page.vasrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VulnerabilityAssessmentScanRecordListResultPage) Response() VulnerabilityAssessmentScanRecordListResult { - return page.vasrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VulnerabilityAssessmentScanRecordListResultPage) Values() []VulnerabilityAssessmentScanRecord { - if page.vasrlr.IsEmpty() { - return nil - } - return *page.vasrlr.Value -} - -// Creates a new instance of the VulnerabilityAssessmentScanRecordListResultPage type. -func NewVulnerabilityAssessmentScanRecordListResultPage(cur VulnerabilityAssessmentScanRecordListResult, getNextPage func(context.Context, VulnerabilityAssessmentScanRecordListResult) (VulnerabilityAssessmentScanRecordListResult, error)) VulnerabilityAssessmentScanRecordListResultPage { - return VulnerabilityAssessmentScanRecordListResultPage{ - fn: getNextPage, - vasrlr: cur, - } -} - -// VulnerabilityAssessmentScanRecordProperties properties of a vulnerability assessment scan record. -type VulnerabilityAssessmentScanRecordProperties struct { - // ScanID - READ-ONLY; The scan ID. - ScanID *string `json:"scanId,omitempty"` - // TriggerType - READ-ONLY; The scan trigger type. Possible values include: 'OnDemand', 'Recurring' - TriggerType VulnerabilityAssessmentScanTriggerType `json:"triggerType,omitempty"` - // State - READ-ONLY; The scan status. Possible values include: 'VulnerabilityAssessmentScanStatePassed', 'VulnerabilityAssessmentScanStateFailed', 'VulnerabilityAssessmentScanStateFailedToRun', 'VulnerabilityAssessmentScanStateInProgress' - State VulnerabilityAssessmentScanState `json:"state,omitempty"` - // StartTime - READ-ONLY; The scan start time (UTC). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The scan end time (UTC). - EndTime *date.Time `json:"endTime,omitempty"` - // Errors - READ-ONLY; The scan errors. - Errors *[]VulnerabilityAssessmentScanError `json:"errors,omitempty"` - // StorageContainerPath - READ-ONLY; The scan results storage container path. - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // NumberOfFailedSecurityChecks - READ-ONLY; The number of failed security checks. - NumberOfFailedSecurityChecks *int32 `json:"numberOfFailedSecurityChecks,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecordProperties. -func (vasrp VulnerabilityAssessmentScanRecordProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/recoverablemanageddatabases.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/recoverablemanageddatabases.go deleted file mode 100644 index e6519d2d5a1d..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/recoverablemanageddatabases.go +++ /dev/null @@ -1,231 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RecoverableManagedDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type RecoverableManagedDatabasesClient struct { - BaseClient -} - -// NewRecoverableManagedDatabasesClient creates an instance of the RecoverableManagedDatabasesClient client. -func NewRecoverableManagedDatabasesClient(subscriptionID string) RecoverableManagedDatabasesClient { - return NewRecoverableManagedDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecoverableManagedDatabasesClientWithBaseURI creates an instance of the RecoverableManagedDatabasesClient 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 NewRecoverableManagedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RecoverableManagedDatabasesClient { - return RecoverableManagedDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a recoverable managed database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client RecoverableManagedDatabasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, recoverableDatabaseName string) (result RecoverableManagedDatabase, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabasesClient.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, managedInstanceName, recoverableDatabaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecoverableManagedDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, recoverableDatabaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "recoverableDatabaseName": autorest.Encode("path", recoverableDatabaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/recoverableDatabases/{recoverableDatabaseName}", 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 RecoverableManagedDatabasesClient) 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 RecoverableManagedDatabasesClient) GetResponder(resp *http.Response) (result RecoverableManagedDatabase, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of recoverable managed databases. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client RecoverableManagedDatabasesClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result RecoverableManagedDatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabasesClient.ListByInstance") - defer func() { - sc := -1 - if result.rmdlr.Response.Response != nil { - sc = result.rmdlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.rmdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.rmdlr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.rmdlr.hasNextLink() && result.rmdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client RecoverableManagedDatabasesClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/recoverableDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client RecoverableManagedDatabasesClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client RecoverableManagedDatabasesClient) ListByInstanceResponder(resp *http.Response) (result RecoverableManagedDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client RecoverableManagedDatabasesClient) listByInstanceNextResults(ctx context.Context, lastResults RecoverableManagedDatabaseListResult) (result RecoverableManagedDatabaseListResult, err error) { - req, err := lastResults.recoverableManagedDatabaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client RecoverableManagedDatabasesClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result RecoverableManagedDatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabasesClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go deleted file mode 100644 index 66060f84d656..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/sqlapi/interfaces.go +++ /dev/null @@ -1,180 +0,0 @@ -package sqlapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/sql/mgmt/2017-10-01-preview/sql" - "github.com/Azure/go-autorest/autorest" - "github.com/gofrs/uuid" -) - -// DatabaseOperationsClientAPI contains the set of methods on the DatabaseOperationsClient type. -type DatabaseOperationsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, serverName string, databaseName string, operationID uuid.UUID) (result autorest.Response, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseOperationListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseOperationListResultIterator, err error) -} - -var _ DatabaseOperationsClientAPI = (*sql.DatabaseOperationsClient)(nil) - -// ElasticPoolOperationsClientAPI contains the set of methods on the ElasticPoolOperationsClient type. -type ElasticPoolOperationsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, operationID uuid.UUID) (result autorest.Response, err error) - ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolOperationListResultPage, err error) - ListByElasticPoolComplete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolOperationListResultIterator, err error) -} - -var _ ElasticPoolOperationsClientAPI = (*sql.ElasticPoolOperationsClient)(nil) - -// DatabaseVulnerabilityAssessmentScansClientAPI contains the set of methods on the DatabaseVulnerabilityAssessmentScansClient type. -type DatabaseVulnerabilityAssessmentScansClientAPI interface { - Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result sql.DatabaseVulnerabilityAssessmentScansExport, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result sql.VulnerabilityAssessmentScanRecord, err error) - InitiateScan(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.VulnerabilityAssessmentScanRecordListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.VulnerabilityAssessmentScanRecordListResultIterator, err error) -} - -var _ DatabaseVulnerabilityAssessmentScansClientAPI = (*sql.DatabaseVulnerabilityAssessmentScansClient)(nil) - -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientAPI contains the set of methods on the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient type. -type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName sql.VulnerabilityAssessmentPolicyBaselineName, parameters sql.DatabaseVulnerabilityAssessmentRuleBaseline) (result sql.DatabaseVulnerabilityAssessmentRuleBaseline, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName sql.VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName sql.VulnerabilityAssessmentPolicyBaselineName) (result sql.DatabaseVulnerabilityAssessmentRuleBaseline, err error) -} - -var _ ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientAPI = (*sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient)(nil) - -// ManagedDatabaseVulnerabilityAssessmentScansClientAPI contains the set of methods on the ManagedDatabaseVulnerabilityAssessmentScansClient type. -type ManagedDatabaseVulnerabilityAssessmentScansClientAPI interface { - Export(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result sql.DatabaseVulnerabilityAssessmentScansExport, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result sql.VulnerabilityAssessmentScanRecord, err error) - InitiateScan(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.VulnerabilityAssessmentScanRecordListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.VulnerabilityAssessmentScanRecordListResultIterator, err error) -} - -var _ ManagedDatabaseVulnerabilityAssessmentScansClientAPI = (*sql.ManagedDatabaseVulnerabilityAssessmentScansClient)(nil) - -// ManagedDatabaseVulnerabilityAssessmentsClientAPI contains the set of methods on the ManagedDatabaseVulnerabilityAssessmentsClient type. -type ManagedDatabaseVulnerabilityAssessmentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.DatabaseVulnerabilityAssessment) (result sql.DatabaseVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.DatabaseVulnerabilityAssessment, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.DatabaseVulnerabilityAssessmentListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.DatabaseVulnerabilityAssessmentListResultIterator, err error) -} - -var _ ManagedDatabaseVulnerabilityAssessmentsClientAPI = (*sql.ManagedDatabaseVulnerabilityAssessmentsClient)(nil) - -// CapabilitiesClientAPI contains the set of methods on the CapabilitiesClient type. -type CapabilitiesClientAPI interface { - ListByLocation(ctx context.Context, locationName string, include sql.CapabilityGroup) (result sql.LocationCapabilities, err error) -} - -var _ CapabilitiesClientAPI = (*sql.CapabilitiesClient)(nil) - -// DatabasesClientAPI contains the set of methods on the DatabasesClient type. -type DatabasesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.Database) (result sql.DatabasesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.Database, err error) - ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.DatabaseListResultPage, err error) - ListByElasticPoolComplete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.DatabaseListResultIterator, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultIterator, err error) - Pause(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesPauseFuture, err error) - Rename(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ResourceMoveDefinition) (result autorest.Response, err error) - Resume(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesResumeFuture, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseUpdate) (result sql.DatabasesUpdateFuture, err error) - UpgradeDataWarehouse(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesUpgradeDataWarehouseFuture, err error) -} - -var _ DatabasesClientAPI = (*sql.DatabasesClient)(nil) - -// ElasticPoolsClientAPI contains the set of methods on the ElasticPoolsClient type. -type ElasticPoolsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters sql.ElasticPool) (result sql.ElasticPoolsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPool, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result sql.ElasticPoolListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result sql.ElasticPoolListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters sql.ElasticPoolUpdate) (result sql.ElasticPoolsUpdateFuture, err error) -} - -var _ ElasticPoolsClientAPI = (*sql.ElasticPoolsClient)(nil) - -// InstanceFailoverGroupsClientAPI contains the set of methods on the InstanceFailoverGroupsClient type. -type InstanceFailoverGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, parameters sql.InstanceFailoverGroup) (result sql.InstanceFailoverGroupsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result sql.InstanceFailoverGroupsDeleteFuture, err error) - Failover(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result sql.InstanceFailoverGroupsFailoverFuture, err error) - ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture, err error) - Get(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result sql.InstanceFailoverGroup, err error) - ListByLocation(ctx context.Context, resourceGroupName string, locationName string) (result sql.InstanceFailoverGroupListResultPage, err error) - ListByLocationComplete(ctx context.Context, resourceGroupName string, locationName string) (result sql.InstanceFailoverGroupListResultIterator, err error) -} - -var _ InstanceFailoverGroupsClientAPI = (*sql.InstanceFailoverGroupsClient)(nil) - -// BackupShortTermRetentionPoliciesClientAPI contains the set of methods on the BackupShortTermRetentionPoliciesClient type. -type BackupShortTermRetentionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupShortTermRetentionPolicy) (result sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicyListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicyListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupShortTermRetentionPolicy) (result sql.BackupShortTermRetentionPoliciesUpdateFuture, err error) -} - -var _ BackupShortTermRetentionPoliciesClientAPI = (*sql.BackupShortTermRetentionPoliciesClient)(nil) - -// TdeCertificatesClientAPI contains the set of methods on the TdeCertificatesClient type. -type TdeCertificatesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, serverName string, parameters sql.TdeCertificate) (result sql.TdeCertificatesCreateFuture, err error) -} - -var _ TdeCertificatesClientAPI = (*sql.TdeCertificatesClient)(nil) - -// ManagedInstanceTdeCertificatesClientAPI contains the set of methods on the ManagedInstanceTdeCertificatesClient type. -type ManagedInstanceTdeCertificatesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.TdeCertificate) (result sql.ManagedInstanceTdeCertificatesCreateFuture, err error) -} - -var _ ManagedInstanceTdeCertificatesClientAPI = (*sql.ManagedInstanceTdeCertificatesClient)(nil) - -// ManagedInstanceKeysClientAPI contains the set of methods on the ManagedInstanceKeysClient type. -type ManagedInstanceKeysClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string, parameters sql.ManagedInstanceKey) (result sql.ManagedInstanceKeysCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (result sql.ManagedInstanceKeysDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (result sql.ManagedInstanceKey, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (result sql.ManagedInstanceKeyListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (result sql.ManagedInstanceKeyListResultIterator, err error) -} - -var _ ManagedInstanceKeysClientAPI = (*sql.ManagedInstanceKeysClient)(nil) - -// ManagedInstanceEncryptionProtectorsClientAPI contains the set of methods on the ManagedInstanceEncryptionProtectorsClient type. -type ManagedInstanceEncryptionProtectorsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceEncryptionProtector) (result sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtector, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorListResultIterator, err error) - Revalidate(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) -} - -var _ ManagedInstanceEncryptionProtectorsClientAPI = (*sql.ManagedInstanceEncryptionProtectorsClient)(nil) - -// RecoverableManagedDatabasesClientAPI contains the set of methods on the RecoverableManagedDatabasesClient type. -type RecoverableManagedDatabasesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, recoverableDatabaseName string) (result sql.RecoverableManagedDatabase, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RecoverableManagedDatabaseListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RecoverableManagedDatabaseListResultIterator, err error) -} - -var _ RecoverableManagedDatabasesClientAPI = (*sql.RecoverableManagedDatabasesClient)(nil) diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/tdecertificates.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/tdecertificates.go deleted file mode 100644 index ab35584ea1b0..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/tdecertificates.go +++ /dev/null @@ -1,123 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TdeCertificatesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type TdeCertificatesClient struct { - BaseClient -} - -// NewTdeCertificatesClient creates an instance of the TdeCertificatesClient client. -func NewTdeCertificatesClient(subscriptionID string) TdeCertificatesClient { - return NewTdeCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTdeCertificatesClientWithBaseURI creates an instance of the TdeCertificatesClient 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 NewTdeCertificatesClientWithBaseURI(baseURI string, subscriptionID string) TdeCertificatesClient { - return TdeCertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a TDE certificate for a given server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested TDE certificate to be created or updated. -func (client TdeCertificatesClient) Create(ctx context.Context, resourceGroupName string, serverName string, parameters TdeCertificate) (result TdeCertificatesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TdeCertificatesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TdeCertificateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TdeCertificateProperties.PrivateBlob", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.TdeCertificatesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TdeCertificatesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TdeCertificatesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TdeCertificatesClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters TdeCertificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/tdeCertificates", 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 TdeCertificatesClient) CreateSender(req *http.Request) (future TdeCertificatesCreateFuture, 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 TdeCertificatesClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/version.go b/services/preview/sql/mgmt/2017-10-01-preview/sql/version.go deleted file mode 100644 index d0005d2aa511..000000000000 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package sql - -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() + " sql/2017-10-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/sql/mgmt/v3.0/sql/CHANGELOG.md b/services/preview/sql/mgmt/v3.0/sql/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/sql/mgmt/v3.0/sql/_meta.json b/services/preview/sql/mgmt/v3.0/sql/_meta.json deleted file mode 100644 index 9a952e027cb6..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", - "tag": "package-composite-v3", - "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-composite-v3 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/sql/mgmt/v3.0/sql/backuplongtermretentionpolicies.go b/services/preview/sql/mgmt/v3.0/sql/backuplongtermretentionpolicies.go deleted file mode 100644 index 49886703a379..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/backuplongtermretentionpolicies.go +++ /dev/null @@ -1,279 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BackupLongTermRetentionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type BackupLongTermRetentionPoliciesClient struct { - BaseClient -} - -// NewBackupLongTermRetentionPoliciesClient creates an instance of the BackupLongTermRetentionPoliciesClient client. -func NewBackupLongTermRetentionPoliciesClient(subscriptionID string) BackupLongTermRetentionPoliciesClient { - return NewBackupLongTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupLongTermRetentionPoliciesClientWithBaseURI creates an instance of the BackupLongTermRetentionPoliciesClient -// 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 NewBackupLongTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionPoliciesClient { - return BackupLongTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sets a database's long term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the long term retention policy info. -func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupLongTermRetentionPolicy) (result BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupLongTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}", 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 BackupLongTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future BackupLongTermRetentionPoliciesCreateOrUpdateFuture, 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 BackupLongTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, 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 a database's long term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client BackupLongTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupLongTermRetentionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupLongTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{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 BackupLongTermRetentionPoliciesClient) 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 BackupLongTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets a database's long term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client BackupLongTermRetentionPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupLongTermRetentionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client BackupLongTermRetentionPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, 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/sql/mgmt/v3.0/sql/backupshorttermretentionpolicies.go b/services/preview/sql/mgmt/v3.0/sql/backupshorttermretentionpolicies.go deleted file mode 100644 index c9bf2b72f18f..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/backupshorttermretentionpolicies.go +++ /dev/null @@ -1,407 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BackupShortTermRetentionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type BackupShortTermRetentionPoliciesClient struct { - BaseClient -} - -// NewBackupShortTermRetentionPoliciesClient creates an instance of the BackupShortTermRetentionPoliciesClient client. -func NewBackupShortTermRetentionPoliciesClient(subscriptionID string) BackupShortTermRetentionPoliciesClient { - return NewBackupShortTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupShortTermRetentionPoliciesClientWithBaseURI creates an instance of the -// BackupShortTermRetentionPoliciesClient 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 NewBackupShortTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupShortTermRetentionPoliciesClient { - return BackupShortTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates a database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the short term retention policy info. -func (client BackupShortTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (result BackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackupShortTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}", 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 BackupShortTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future BackupShortTermRetentionPoliciesCreateOrUpdateFuture, 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 BackupShortTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupShortTermRetentionPolicy, 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 a database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client BackupShortTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupShortTermRetentionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupShortTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{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 BackupShortTermRetentionPoliciesClient) 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 BackupShortTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result BackupShortTermRetentionPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets a database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupShortTermRetentionPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.bstrplr.Response.Response != nil { - sc = result.bstrplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.bstrplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.bstrplr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.bstrplr.hasNextLink() && result.bstrplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result BackupShortTermRetentionPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client BackupShortTermRetentionPoliciesClient) listByDatabaseNextResults(ctx context.Context, lastResults BackupShortTermRetentionPolicyListResult) (result BackupShortTermRetentionPolicyListResult, err error) { - req, err := lastResults.backupShortTermRetentionPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client BackupShortTermRetentionPoliciesClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupShortTermRetentionPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} - -// Update updates a database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the short term retention policy info. -func (client BackupShortTermRetentionPoliciesClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (result BackupShortTermRetentionPoliciesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPoliciesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackupShortTermRetentionPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupShortTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}", 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 BackupShortTermRetentionPoliciesClient) UpdateSender(req *http.Request) (future BackupShortTermRetentionPoliciesUpdateFuture, 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 BackupShortTermRetentionPoliciesClient) UpdateResponder(resp *http.Response) (result BackupShortTermRetentionPolicy, 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/preview/sql/mgmt/v3.0/sql/capabilities.go b/services/preview/sql/mgmt/v3.0/sql/capabilities.go deleted file mode 100644 index c8bc3fe4b21b..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/capabilities.go +++ /dev/null @@ -1,111 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// CapabilitiesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type CapabilitiesClient struct { - BaseClient -} - -// NewCapabilitiesClient creates an instance of the CapabilitiesClient client. -func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { - return NewCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCapabilitiesClientWithBaseURI creates an instance of the CapabilitiesClient 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 NewCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) CapabilitiesClient { - return CapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByLocation gets the subscription capabilities available for the specified location. -// Parameters: -// locationName - the location name whose capabilities are retrieved. -// include - if specified, restricts the response to only include the selected item. -func (client CapabilitiesClient) ListByLocation(ctx context.Context, locationName string, include CapabilityGroup) (result LocationCapabilities, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesClient.ListByLocation") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByLocationPreparer(ctx, locationName, include) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure sending request") - return - } - - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure responding to request") - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client CapabilitiesClient) ListByLocationPreparer(ctx context.Context, locationName string, include CapabilityGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(include)) > 0 { - queryParameters["include"] = autorest.Encode("query", include) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client CapabilitiesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client CapabilitiesClient) ListByLocationResponder(resp *http.Response) (result LocationCapabilities, 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/sql/mgmt/v3.0/sql/client.go b/services/preview/sql/mgmt/v3.0/sql/client.go deleted file mode 100644 index 99340489081a..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/client.go +++ /dev/null @@ -1,42 +0,0 @@ -// Package sql implements the Azure ARM Sql service API version . -// -// The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database -// services to manage your databases. The API enables you to create, retrieve, update, and delete databases. -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Sql - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Sql. -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/sql/mgmt/v3.0/sql/databaseautomatictuning.go b/services/preview/sql/mgmt/v3.0/sql/databaseautomatictuning.go deleted file mode 100644 index b75b6e41f640..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/databaseautomatictuning.go +++ /dev/null @@ -1,195 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseAutomaticTuningClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type DatabaseAutomaticTuningClient struct { - BaseClient -} - -// NewDatabaseAutomaticTuningClient creates an instance of the DatabaseAutomaticTuningClient client. -func NewDatabaseAutomaticTuningClient(subscriptionID string) DatabaseAutomaticTuningClient { - return NewDatabaseAutomaticTuningClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAutomaticTuningClientWithBaseURI creates an instance of the DatabaseAutomaticTuningClient 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 NewDatabaseAutomaticTuningClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAutomaticTuningClient { - return DatabaseAutomaticTuningClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a database's automatic tuning. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseAutomaticTuningClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseAutomaticTuning, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAutomaticTuningClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseAutomaticTuningClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseAutomaticTuningClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseAutomaticTuningClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseAutomaticTuningClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current", 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 DatabaseAutomaticTuningClient) 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 DatabaseAutomaticTuningClient) GetResponder(resp *http.Response) (result DatabaseAutomaticTuning, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update automatic tuning properties for target database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the requested automatic tuning resource state. -func (client DatabaseAutomaticTuningClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseAutomaticTuning) (result DatabaseAutomaticTuning, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseAutomaticTuningClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseAutomaticTuningClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseAutomaticTuningClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseAutomaticTuningClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabaseAutomaticTuningClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseAutomaticTuning) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current", 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 DatabaseAutomaticTuningClient) 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 DatabaseAutomaticTuningClient) UpdateResponder(resp *http.Response) (result DatabaseAutomaticTuning, 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/sql/mgmt/v3.0/sql/databaseblobauditingpolicies.go b/services/preview/sql/mgmt/v3.0/sql/databaseblobauditingpolicies.go deleted file mode 100644 index aa58f533fcd2..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/databaseblobauditingpolicies.go +++ /dev/null @@ -1,319 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseBlobAuditingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type DatabaseBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewDatabaseBlobAuditingPoliciesClient creates an instance of the DatabaseBlobAuditingPoliciesClient client. -func NewDatabaseBlobAuditingPoliciesClient(subscriptionID string) DatabaseBlobAuditingPoliciesClient { - return NewDatabaseBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseBlobAuditingPoliciesClientWithBaseURI creates an instance of the DatabaseBlobAuditingPoliciesClient -// 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 NewDatabaseBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseBlobAuditingPoliciesClient { - return DatabaseBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the database blob auditing policy. -func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (result DatabaseBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPoliciesClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}", 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 DatabaseBlobAuditingPoliciesClient) 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 DatabaseBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a database's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}", 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 DatabaseBlobAuditingPoliciesClient) 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 DatabaseBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists auditing settings of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.dbaplr.Response.Response != nil { - sc = result.dbaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.dbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.dbaplr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.dbaplr.hasNextLink() && result.dbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client DatabaseBlobAuditingPoliciesClient) listByDatabaseNextResults(ctx context.Context, lastResults DatabaseBlobAuditingPolicyListResult) (result DatabaseBlobAuditingPolicyListResult, err error) { - req, err := lastResults.databaseBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseBlobAuditingPoliciesClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabaseBlobAuditingPoliciesClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPoliciesClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/databaseoperations.go b/services/preview/sql/mgmt/v3.0/sql/databaseoperations.go deleted file mode 100644 index 48ced4d98663..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/databaseoperations.go +++ /dev/null @@ -1,236 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// DatabaseOperationsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type DatabaseOperationsClient struct { - BaseClient -} - -// NewDatabaseOperationsClient creates an instance of the DatabaseOperationsClient client. -func NewDatabaseOperationsClient(subscriptionID string) DatabaseOperationsClient { - return NewDatabaseOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseOperationsClientWithBaseURI creates an instance of the DatabaseOperationsClient 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 NewDatabaseOperationsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseOperationsClient { - return DatabaseOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancels the asynchronous operation on the database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// operationID - the operation identifier. -func (client DatabaseOperationsClient) Cancel(ctx context.Context, resourceGroupName string, serverName string, databaseName string, operationID uuid.UUID) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationsClient.Cancel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelPreparer(ctx, resourceGroupName, serverName, databaseName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "Cancel", resp, "Failure responding to request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client DatabaseOperationsClient) CancelPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, operationID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseOperationsClient) CancelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client DatabaseOperationsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByDatabase gets a list of operations performed on the database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseOperationsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseOperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationsClient.ListByDatabase") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.dolr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DatabaseOperationsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseOperationsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DatabaseOperationsClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseOperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client DatabaseOperationsClient) listByDatabaseNextResults(ctx context.Context, lastResults DatabaseOperationListResult) (result DatabaseOperationListResult, err error) { - req, err := lastResults.databaseOperationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseOperationsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabaseOperationsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseOperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationsClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/databases.go b/services/preview/sql/mgmt/v3.0/sql/databases.go deleted file mode 100644 index 7befcba34197..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/databases.go +++ /dev/null @@ -1,1407 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient 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 NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new database or updates an existing database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the requested database resource state. -func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.DatabaseProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DatabaseProperties.CurrentSku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DatabaseProperties.CurrentSku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.ManagedBy = 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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, 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 DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, 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 the database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, 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 DatabasesClient) 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 -} - -// Export exports a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the database export request parameters. -func (client DatabasesClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportDatabaseDefinition) (result DatabasesExportFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Export") - 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StorageURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLogin", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLoginPassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "Export", err.Error()) - } - - req, err := client.ExportPreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", nil, "Failure preparing request") - return - } - - result, err = client.ExportSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", result.Response(), "Failure sending request") - return - } - - return -} - -// ExportPreparer prepares the Export request. -func (client DatabasesClient) ExportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportDatabaseDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/servers/{serverName}/databases/{databaseName}/export", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ExportSender(req *http.Request) (future DatabasesExportFuture, 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 -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ExportResponder(resp *http.Response) (result ImportExportOperationResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Failover failovers a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to failover. -// replicaType - the type of replica to be failed over. -func (client DatabasesClient) Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, replicaType ReplicaType) (result DatabasesFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Failover") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, databaseName, replicaType) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client DatabasesClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, replicaType ReplicaType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(replicaType)) > 0 { - queryParameters["replicaType"] = autorest.Encode("query", replicaType) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) FailoverSender(req *http.Request) (future DatabasesFailoverFuture, 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 -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client DatabasesClient) FailoverResponder(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 gets a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) 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 DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByElasticPool gets a list of databases in an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client DatabasesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByElasticPool") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByElasticPoolNextResults - req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByElasticPool", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByElasticPool", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByElasticPoolPreparer prepares the ListByElasticPool request. -func (client DatabasesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByElasticPoolSender sends the ListByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByElasticPoolResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByElasticPoolNextResults retrieves the next set of results, if any. -func (client DatabasesClient) listByElasticPoolNextResults(ctx context.Context, lastResults DatabaseListResult) (result DatabaseListResult, err error) { - req, err := lastResults.databaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByElasticPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByElasticPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByElasticPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByElasticPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabasesClient) ListByElasticPoolComplete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByElasticPool") - 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.ListByElasticPool(ctx, resourceGroupName, serverName, elasticPoolName) - return -} - -// ListByServer gets a list of databases. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client DatabasesClient) listByServerNextResults(ctx context.Context, lastResults DatabaseListResult) (result DatabaseListResult, err error) { - req, err := lastResults.databaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabasesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// ListInaccessibleByServer gets a list of inaccessible databases in a logical server -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client DatabasesClient) ListInaccessibleByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListInaccessibleByServer") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listInaccessibleByServerNextResults - req, err := client.ListInaccessibleByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListInaccessibleByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListInaccessibleByServerSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListInaccessibleByServer", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListInaccessibleByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListInaccessibleByServer", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListInaccessibleByServerPreparer prepares the ListInaccessibleByServer request. -func (client DatabasesClient) ListInaccessibleByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/inaccessibleDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListInaccessibleByServerSender sends the ListInaccessibleByServer request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListInaccessibleByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListInaccessibleByServerResponder handles the response to the ListInaccessibleByServer request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListInaccessibleByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listInaccessibleByServerNextResults retrieves the next set of results, if any. -func (client DatabasesClient) listInaccessibleByServerNextResults(ctx context.Context, lastResults DatabaseListResult) (result DatabaseListResult, err error) { - req, err := lastResults.databaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listInaccessibleByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListInaccessibleByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabasesClient", "listInaccessibleByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListInaccessibleByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "listInaccessibleByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListInaccessibleByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabasesClient) ListInaccessibleByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListInaccessibleByServer") - 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.ListInaccessibleByServer(ctx, resourceGroupName, serverName) - return -} - -// ListMetricDefinitions returns database metric definitions. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result MetricDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListMetricDefinitions") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client DatabasesClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics returns database metrics. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// filter - an OData filter expression that describes a subset of metrics to return. -func (client DatabasesClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListMetrics") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, databaseName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client DatabasesClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Pause pauses a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be paused. -func (client DatabasesClient) Pause(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesPauseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Pause") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PausePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", nil, "Failure preparing request") - return - } - - result, err = client.PauseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", result.Response(), "Failure sending request") - return - } - - return -} - -// PausePreparer prepares the Pause request. -func (client DatabasesClient) PausePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/pause", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PauseSender sends the Pause request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) PauseSender(req *http.Request) (future DatabasesPauseFuture, 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 -} - -// PauseResponder handles the response to the Pause request. The method always -// closes the http.Response Body. -func (client DatabasesClient) PauseResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Rename renames a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to rename. -// parameters - the resource move definition for renaming this database. -func (client DatabasesClient) Rename(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ResourceMoveDefinition) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Rename") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.DatabasesClient", "Rename", err.Error()) - } - - req, err := client.RenamePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Rename", nil, "Failure preparing request") - return - } - - resp, err := client.RenameSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Rename", resp, "Failure sending request") - return - } - - result, err = client.RenameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Rename", resp, "Failure responding to request") - return - } - - return -} - -// RenamePreparer prepares the Rename request. -func (client DatabasesClient) RenamePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ResourceMoveDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/move", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RenameSender sends the Rename request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) RenameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RenameResponder handles the response to the Rename request. The method always -// closes the http.Response Body. -func (client DatabasesClient) RenameResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Resume resumes a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be resumed. -func (client DatabasesClient) Resume(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesResumeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Resume") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ResumePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", nil, "Failure preparing request") - return - } - - result, err = client.ResumeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", result.Response(), "Failure sending request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client DatabasesClient) ResumePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/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 DatabasesClient) ResumeSender(req *http.Request) (future DatabasesResumeFuture, 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 DatabasesClient) ResumeResponder(resp *http.Response) (result Database, 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 database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the requested database resource state. -func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseUpdate) (result DatabasesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}", 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 DatabasesClient) UpdateSender(req *http.Request) (future DatabasesUpdateFuture, 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 DatabasesClient) UpdateResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpgradeDataWarehouse upgrades a data warehouse. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to be upgraded. -func (client DatabasesClient) UpgradeDataWarehouse(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesUpgradeDataWarehouseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.UpgradeDataWarehouse") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpgradeDataWarehousePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "UpgradeDataWarehouse", nil, "Failure preparing request") - return - } - - result, err = client.UpgradeDataWarehouseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "UpgradeDataWarehouse", result.Response(), "Failure sending request") - return - } - - return -} - -// UpgradeDataWarehousePreparer prepares the UpgradeDataWarehouse request. -func (client DatabasesClient) UpgradeDataWarehousePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpgradeDataWarehouseSender sends the UpgradeDataWarehouse request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) UpgradeDataWarehouseSender(req *http.Request) (future DatabasesUpgradeDataWarehouseFuture, 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 -} - -// UpgradeDataWarehouseResponder handles the response to the UpgradeDataWarehouse request. The method always -// closes the http.Response Body. -func (client DatabasesClient) UpgradeDataWarehouseResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/databasethreatdetectionpolicies.go b/services/preview/sql/mgmt/v3.0/sql/databasethreatdetectionpolicies.go deleted file mode 100644 index 5034e53cfadb..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/databasethreatdetectionpolicies.go +++ /dev/null @@ -1,198 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseThreatDetectionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type DatabaseThreatDetectionPoliciesClient struct { - BaseClient -} - -// NewDatabaseThreatDetectionPoliciesClient creates an instance of the DatabaseThreatDetectionPoliciesClient client. -func NewDatabaseThreatDetectionPoliciesClient(subscriptionID string) DatabaseThreatDetectionPoliciesClient { - return NewDatabaseThreatDetectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseThreatDetectionPoliciesClientWithBaseURI creates an instance of the DatabaseThreatDetectionPoliciesClient -// 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 NewDatabaseThreatDetectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseThreatDetectionPoliciesClient { - return DatabaseThreatDetectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which database Threat Detection policy is defined. -// parameters - the database Threat Detection policy. -func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (result DatabaseSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseThreatDetectionPoliciesClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseThreatDetectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}", 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 DatabaseThreatDetectionPoliciesClient) 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 DatabaseThreatDetectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a database's threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which database Threat Detection policy is defined. -func (client DatabaseThreatDetectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseThreatDetectionPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseThreatDetectionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseThreatDetectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}", 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 DatabaseThreatDetectionPoliciesClient) 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 DatabaseThreatDetectionPoliciesClient) GetResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, 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/sql/mgmt/v3.0/sql/databaseusages.go b/services/preview/sql/mgmt/v3.0/sql/databaseusages.go deleted file mode 100644 index 157fddb468b6..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/databaseusages.go +++ /dev/null @@ -1,112 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type DatabaseUsagesClient struct { - BaseClient -} - -// NewDatabaseUsagesClient creates an instance of the DatabaseUsagesClient client. -func NewDatabaseUsagesClient(subscriptionID string) DatabaseUsagesClient { - return NewDatabaseUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseUsagesClientWithBaseURI creates an instance of the DatabaseUsagesClient 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 NewDatabaseUsagesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseUsagesClient { - return DatabaseUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByDatabase returns database usages. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseUsagesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseUsagesClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseUsagesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseUsagesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseUsagesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DatabaseUsagesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseUsagesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DatabaseUsagesClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseUsageListResult, 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/sql/mgmt/v3.0/sql/databasevulnerabilityassessmentrulebaselines.go b/services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessmentrulebaselines.go deleted file mode 100644 index 39a429dfabff..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessmentrulebaselines.go +++ /dev/null @@ -1,300 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseVulnerabilityAssessmentRuleBaselinesClient is the the Azure SQL Database management API provides a RESTful -// set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to -// create, retrieve, update, and delete databases. -type DatabaseVulnerabilityAssessmentRuleBaselinesClient struct { - BaseClient -} - -// NewDatabaseVulnerabilityAssessmentRuleBaselinesClient creates an instance of the -// DatabaseVulnerabilityAssessmentRuleBaselinesClient client. -func NewDatabaseVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string) DatabaseVulnerabilityAssessmentRuleBaselinesClient { - return NewDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI creates an instance of the -// DatabaseVulnerabilityAssessmentRuleBaselinesClient 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 NewDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(baseURI string, subscriptionID string) DatabaseVulnerabilityAssessmentRuleBaselinesClient { - return DatabaseVulnerabilityAssessmentRuleBaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a -// database level rule and master for server level rule). -// parameters - the requested rule baseline resource. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentRuleBaselinesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DatabaseVulnerabilityAssessmentRuleBaselineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DatabaseVulnerabilityAssessmentRuleBaselineProperties.BaselineResults", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, ruleID, baselineName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 DatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete removes the database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a -// database level rule and master for server level rule). -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 DatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 DatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a -// database level rule and master for server level rule). -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentRuleBaselinesClient.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, serverName, databaseName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseVulnerabilityAssessmentRuleBaselinesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 DatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 DatabaseVulnerabilityAssessmentRuleBaselinesClient) GetResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentRuleBaseline, 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/sql/mgmt/v3.0/sql/databasevulnerabilityassessments.go b/services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessments.go deleted file mode 100644 index 7e8a7e55ce2c..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessments.go +++ /dev/null @@ -1,397 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseVulnerabilityAssessmentsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type DatabaseVulnerabilityAssessmentsClient struct { - BaseClient -} - -// NewDatabaseVulnerabilityAssessmentsClient creates an instance of the DatabaseVulnerabilityAssessmentsClient client. -func NewDatabaseVulnerabilityAssessmentsClient(subscriptionID string) DatabaseVulnerabilityAssessmentsClient { - return NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseVulnerabilityAssessmentsClientWithBaseURI creates an instance of the -// DatabaseVulnerabilityAssessmentsClient 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 NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseVulnerabilityAssessmentsClient { - return DatabaseVulnerabilityAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the vulnerability assessment is defined. -// parameters - the requested resource. -func (client DatabaseVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseVulnerabilityAssessment) (result DatabaseVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentsClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseVulnerabilityAssessmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseVulnerabilityAssessment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 DatabaseVulnerabilityAssessmentsClient) 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 DatabaseVulnerabilityAssessmentsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseVulnerabilityAssessment, 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 removes the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the vulnerability assessment is defined. -func (client DatabaseVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseVulnerabilityAssessmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 DatabaseVulnerabilityAssessmentsClient) 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 DatabaseVulnerabilityAssessmentsClient) 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 the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the vulnerability assessment is defined. -func (client DatabaseVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentsClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseVulnerabilityAssessmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 DatabaseVulnerabilityAssessmentsClient) 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 DatabaseVulnerabilityAssessmentsClient) GetResponder(resp *http.Response) (result DatabaseVulnerabilityAssessment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists the vulnerability assessment policies associated with a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the vulnerability assessment policies are defined. -func (client DatabaseVulnerabilityAssessmentsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseVulnerabilityAssessmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentsClient.ListByDatabase") - defer func() { - sc := -1 - if result.dvalr.Response.Response != nil { - sc = result.dvalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.dvalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.dvalr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.dvalr.hasNextLink() && result.dvalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DatabaseVulnerabilityAssessmentsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentsClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client DatabaseVulnerabilityAssessmentsClient) listByDatabaseNextResults(ctx context.Context, lastResults DatabaseVulnerabilityAssessmentListResult) (result DatabaseVulnerabilityAssessmentListResult, err error) { - req, err := lastResults.databaseVulnerabilityAssessmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabaseVulnerabilityAssessmentsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabaseVulnerabilityAssessmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentsClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessmentscans.go b/services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessmentscans.go deleted file mode 100644 index b9e0362af212..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/databasevulnerabilityassessmentscans.go +++ /dev/null @@ -1,405 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DatabaseVulnerabilityAssessmentScansClient is the the Azure SQL Database management API provides a RESTful set of -// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type DatabaseVulnerabilityAssessmentScansClient struct { - BaseClient -} - -// NewDatabaseVulnerabilityAssessmentScansClient creates an instance of the DatabaseVulnerabilityAssessmentScansClient -// client. -func NewDatabaseVulnerabilityAssessmentScansClient(subscriptionID string) DatabaseVulnerabilityAssessmentScansClient { - return NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI creates an instance of the -// DatabaseVulnerabilityAssessmentScansClient 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 NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(baseURI string, subscriptionID string) DatabaseVulnerabilityAssessmentScansClient { - return DatabaseVulnerabilityAssessmentScansClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Export convert an existing scan result to a human readable format. If already exists nothing happens -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the scanned database. -// scanID - the vulnerability assessment scan Id. -func (client DatabaseVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansExport, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.Export") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExportPreparer(ctx, resourceGroupName, serverName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", nil, "Failure preparing request") - return - } - - resp, err := client.ExportSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure sending request") - return - } - - result, err = client.ExportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure responding to request") - return - } - - return -} - -// ExportPreparer prepares the Export request. -func (client DatabaseVulnerabilityAssessmentScansClient) ExportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentScansClient) ExportSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentScansClient) ExportResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentScansExport, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a vulnerability assessment scan record of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client DatabaseVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result VulnerabilityAssessmentScanRecord, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.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, serverName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseVulnerabilityAssessmentScansClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}", 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 DatabaseVulnerabilityAssessmentScansClient) 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 DatabaseVulnerabilityAssessmentScansClient) GetResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecord, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// InitiateScan executes a Vulnerability Assessment database scan. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScan(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.InitiateScan") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.InitiateScanPreparer(ctx, resourceGroupName, serverName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "InitiateScan", nil, "Failure preparing request") - return - } - - result, err = client.InitiateScanSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "InitiateScan", result.Response(), "Failure sending request") - return - } - - return -} - -// InitiateScanPreparer prepares the InitiateScan request. -func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScanPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// InitiateScanSender sends the InitiateScan request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScanSender(req *http.Request) (future DatabaseVulnerabilityAssessmentScansInitiateScanFuture, 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 -} - -// InitiateScanResponder handles the response to the InitiateScan request. The method always -// closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentScansClient) InitiateScanResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByDatabase lists the vulnerability assessment scans of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result VulnerabilityAssessmentScanRecordListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.ListByDatabase") - defer func() { - sc := -1 - if result.vasrlr.Response.Response != nil { - sc = result.vasrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.vasrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.vasrlr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.vasrlr.hasNextLink() && result.vasrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabaseResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecordListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client DatabaseVulnerabilityAssessmentScansClient) listByDatabaseNextResults(ctx context.Context, lastResults VulnerabilityAssessmentScanRecordListResult) (result VulnerabilityAssessmentScanRecordListResult, err error) { - req, err := lastResults.vulnerabilityAssessmentScanRecordListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabaseVulnerabilityAssessmentScansClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result VulnerabilityAssessmentScanRecordListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentScansClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/datamaskingpolicies.go b/services/preview/sql/mgmt/v3.0/sql/datamaskingpolicies.go deleted file mode 100644 index bd6726530f7e..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/datamaskingpolicies.go +++ /dev/null @@ -1,199 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DataMaskingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type DataMaskingPoliciesClient struct { - BaseClient -} - -// NewDataMaskingPoliciesClient creates an instance of the DataMaskingPoliciesClient client. -func NewDataMaskingPoliciesClient(subscriptionID string) DataMaskingPoliciesClient { - return NewDataMaskingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataMaskingPoliciesClientWithBaseURI creates an instance of the DataMaskingPoliciesClient 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 NewDataMaskingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingPoliciesClient { - return DataMaskingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database data masking policy -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - parameters for creating or updating a data masking policy. -func (client DataMaskingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy) (result DataMaskingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataMaskingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.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.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}", 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 DataMaskingPoliciesClient) 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 DataMaskingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a database data masking policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DataMaskingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DataMaskingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataMaskingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}", 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 DataMaskingPoliciesClient) 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 DataMaskingPoliciesClient) GetResponder(resp *http.Response) (result DataMaskingPolicy, 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/sql/mgmt/v3.0/sql/datamaskingrules.go b/services/preview/sql/mgmt/v3.0/sql/datamaskingrules.go deleted file mode 100644 index eae0c8e07f66..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/datamaskingrules.go +++ /dev/null @@ -1,212 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DataMaskingRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type DataMaskingRulesClient struct { - BaseClient -} - -// NewDataMaskingRulesClient creates an instance of the DataMaskingRulesClient client. -func NewDataMaskingRulesClient(subscriptionID string) DataMaskingRulesClient { - return NewDataMaskingRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataMaskingRulesClientWithBaseURI creates an instance of the DataMaskingRulesClient 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 NewDataMaskingRulesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingRulesClient { - return DataMaskingRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database data masking rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// dataMaskingRuleName - the name of the data masking rule. -// parameters - the required parameters for creating or updating a data masking rule. -func (client DataMaskingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule) (result DataMaskingRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties.SchemaName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataMaskingRuleProperties.TableName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataMaskingRuleProperties.ColumnName", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.DataMaskingRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataMaskingRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "dataMaskingRuleName": autorest.Encode("path", dataMaskingRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.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.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}", 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 DataMaskingRulesClient) 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 DataMaskingRulesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets a list of database data masking rules. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DataMaskingRulesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DataMaskingRuleListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DataMaskingRulesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DataMaskingRulesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DataMaskingRulesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DataMaskingRulesClient) ListByDatabaseResponder(resp *http.Response) (result DataMaskingRuleListResult, 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/sql/mgmt/v3.0/sql/elasticpoolactivities.go b/services/preview/sql/mgmt/v3.0/sql/elasticpoolactivities.go deleted file mode 100644 index 441f57b95c41..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/elasticpoolactivities.go +++ /dev/null @@ -1,113 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ElasticPoolActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ElasticPoolActivitiesClient struct { - BaseClient -} - -// NewElasticPoolActivitiesClient creates an instance of the ElasticPoolActivitiesClient client. -func NewElasticPoolActivitiesClient(subscriptionID string) ElasticPoolActivitiesClient { - return NewElasticPoolActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolActivitiesClientWithBaseURI creates an instance of the ElasticPoolActivitiesClient 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 NewElasticPoolActivitiesClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolActivitiesClient { - return ElasticPoolActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByElasticPool returns elastic pool activities. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool for which to get the current activity. -func (client ElasticPoolActivitiesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolActivityListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolActivitiesClient.ListByElasticPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolActivitiesClient", "ListByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolActivitiesClient", "ListByElasticPool", resp, "Failure sending request") - return - } - - result, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolActivitiesClient", "ListByElasticPool", resp, "Failure responding to request") - return - } - - return -} - -// ListByElasticPoolPreparer prepares the ListByElasticPool request. -func (client ElasticPoolActivitiesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByElasticPoolSender sends the ListByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolActivitiesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always -// closes the http.Response Body. -func (client ElasticPoolActivitiesClient) ListByElasticPoolResponder(resp *http.Response) (result ElasticPoolActivityListResult, 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/sql/mgmt/v3.0/sql/elasticpooldatabaseactivities.go b/services/preview/sql/mgmt/v3.0/sql/elasticpooldatabaseactivities.go deleted file mode 100644 index ea65995b62c9..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/elasticpooldatabaseactivities.go +++ /dev/null @@ -1,113 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ElasticPoolDatabaseActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ElasticPoolDatabaseActivitiesClient struct { - BaseClient -} - -// NewElasticPoolDatabaseActivitiesClient creates an instance of the ElasticPoolDatabaseActivitiesClient client. -func NewElasticPoolDatabaseActivitiesClient(subscriptionID string) ElasticPoolDatabaseActivitiesClient { - return NewElasticPoolDatabaseActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolDatabaseActivitiesClientWithBaseURI creates an instance of the ElasticPoolDatabaseActivitiesClient -// 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 NewElasticPoolDatabaseActivitiesClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolDatabaseActivitiesClient { - return ElasticPoolDatabaseActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByElasticPool returns activity on databases inside of an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolDatabaseActivityListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolDatabaseActivitiesClient.ListByElasticPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolDatabaseActivitiesClient", "ListByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolDatabaseActivitiesClient", "ListByElasticPool", resp, "Failure sending request") - return - } - - result, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolDatabaseActivitiesClient", "ListByElasticPool", resp, "Failure responding to request") - return - } - - return -} - -// ListByElasticPoolPreparer prepares the ListByElasticPool request. -func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByElasticPoolSender sends the ListByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always -// closes the http.Response Body. -func (client ElasticPoolDatabaseActivitiesClient) ListByElasticPoolResponder(resp *http.Response) (result ElasticPoolDatabaseActivityListResult, 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/sql/mgmt/v3.0/sql/elasticpooloperations.go b/services/preview/sql/mgmt/v3.0/sql/elasticpooloperations.go deleted file mode 100644 index d8bd4555a2cc..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/elasticpooloperations.go +++ /dev/null @@ -1,234 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// ElasticPoolOperationsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ElasticPoolOperationsClient struct { - BaseClient -} - -// NewElasticPoolOperationsClient creates an instance of the ElasticPoolOperationsClient client. -func NewElasticPoolOperationsClient(subscriptionID string) ElasticPoolOperationsClient { - return NewElasticPoolOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolOperationsClientWithBaseURI creates an instance of the ElasticPoolOperationsClient 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 NewElasticPoolOperationsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolOperationsClient { - return ElasticPoolOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancels the asynchronous operation on the elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// operationID - the operation identifier. -func (client ElasticPoolOperationsClient) Cancel(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, operationID uuid.UUID) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationsClient.Cancel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelPreparer(ctx, resourceGroupName, serverName, elasticPoolName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "Cancel", resp, "Failure responding to request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client ElasticPoolOperationsClient) CancelPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, operationID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolOperationsClient) CancelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client ElasticPoolOperationsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByElasticPool gets a list of operations performed on the elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ElasticPoolOperationsClient) ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolOperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationsClient.ListByElasticPool") - defer func() { - sc := -1 - if result.epolr.Response.Response != nil { - sc = result.epolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByElasticPoolNextResults - req, err := client.ListByElasticPoolPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "ListByElasticPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.epolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "ListByElasticPool", resp, "Failure sending request") - return - } - - result.epolr, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "ListByElasticPool", resp, "Failure responding to request") - return - } - if result.epolr.hasNextLink() && result.epolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByElasticPoolPreparer prepares the ListByElasticPool request. -func (client ElasticPoolOperationsClient) ListByElasticPoolPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByElasticPoolSender sends the ListByElasticPool request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolOperationsClient) ListByElasticPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByElasticPoolResponder handles the response to the ListByElasticPool request. The method always -// closes the http.Response Body. -func (client ElasticPoolOperationsClient) ListByElasticPoolResponder(resp *http.Response) (result ElasticPoolOperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByElasticPoolNextResults retrieves the next set of results, if any. -func (client ElasticPoolOperationsClient) listByElasticPoolNextResults(ctx context.Context, lastResults ElasticPoolOperationListResult) (result ElasticPoolOperationListResult, err error) { - req, err := lastResults.elasticPoolOperationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "listByElasticPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByElasticPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "listByElasticPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByElasticPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolOperationsClient", "listByElasticPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByElasticPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client ElasticPoolOperationsClient) ListByElasticPoolComplete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolOperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationsClient.ListByElasticPool") - 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.ListByElasticPool(ctx, resourceGroupName, serverName, elasticPoolName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/elasticpools.go b/services/preview/sql/mgmt/v3.0/sql/elasticpools.go deleted file mode 100644 index 0ba04c8fe619..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/elasticpools.go +++ /dev/null @@ -1,736 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ElasticPoolsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type ElasticPoolsClient struct { - BaseClient -} - -// NewElasticPoolsClient creates an instance of the ElasticPoolsClient client. -func NewElasticPoolsClient(subscriptionID string) ElasticPoolsClient { - return NewElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolsClientWithBaseURI creates an instance of the ElasticPoolsClient 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 NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolsClient { - return ElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -// parameters - the elastic pool parameters. -func (client ElasticPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool) (result ElasticPoolsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ElasticPoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, elasticPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ElasticPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) CreateOrUpdateSender(req *http.Request) (future ElasticPoolsCreateOrUpdateFuture, 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 ElasticPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result ElasticPool, 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 elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client ElasticPoolsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ElasticPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) DeleteSender(req *http.Request) (future ElasticPoolsDeleteFuture, 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 ElasticPoolsClient) 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 -} - -// Failover failovers an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool to failover. -func (client ElasticPoolsClient) Failover(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolsFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.Failover") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client ElasticPoolsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) FailoverSender(req *http.Request) (future ElasticPoolsFailoverFuture, 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 -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) FailoverResponder(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 gets an elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client ElasticPoolsClient) Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.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, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ElasticPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) 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 ElasticPoolsClient) GetResponder(resp *http.Response) (result ElasticPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets all elastic pools in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// skip - the number of elements in the collection to skip. -func (client ElasticPoolsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result ElasticPoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListByServer") - defer func() { - sc := -1 - if result.eplr.Response.Response != nil { - sc = result.eplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.eplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.eplr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.eplr.hasNextLink() && result.eplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ElasticPoolsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Sql/servers/{serverName}/elasticPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (result ElasticPoolListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ElasticPoolsClient) listByServerNextResults(ctx context.Context, lastResults ElasticPoolListResult) (result ElasticPoolListResult, err error) { - req, err := lastResults.elasticPoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ElasticPoolsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result ElasticPoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName, skip) - return -} - -// ListMetricDefinitions returns elastic pool metric definitions. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -func (client ElasticPoolsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result MetricDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListMetricDefinitions") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListMetricDefinitionsPreparer(ctx, resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetricDefinitions", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client ElasticPoolsClient) ListMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinitionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics returns elastic pool metrics. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -// filter - an OData filter expression that describes a subset of metrics to return. -func (client ElasticPoolsClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (result MetricListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListMetrics") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, elasticPoolName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client ElasticPoolsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListMetricsResponder(resp *http.Response) (result MetricListResult, 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 elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// elasticPoolName - the name of the elastic pool. -// parameters - the elastic pool update parameters. -func (client ElasticPoolsClient) Update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPoolUpdate) (result ElasticPoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, elasticPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ElasticPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPoolUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", 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 ElasticPoolsClient) UpdateSender(req *http.Request) (future ElasticPoolsUpdateFuture, 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 ElasticPoolsClient) UpdateResponder(resp *http.Response) (result ElasticPool, 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/preview/sql/mgmt/v3.0/sql/encryptionprotectors.go b/services/preview/sql/mgmt/v3.0/sql/encryptionprotectors.go deleted file mode 100644 index 14c45a85d0a3..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/encryptionprotectors.go +++ /dev/null @@ -1,397 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// EncryptionProtectorsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type EncryptionProtectorsClient struct { - BaseClient -} - -// NewEncryptionProtectorsClient creates an instance of the EncryptionProtectorsClient client. -func NewEncryptionProtectorsClient(subscriptionID string) EncryptionProtectorsClient { - return NewEncryptionProtectorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEncryptionProtectorsClientWithBaseURI creates an instance of the EncryptionProtectorsClient 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 NewEncryptionProtectorsClientWithBaseURI(baseURI string, subscriptionID string) EncryptionProtectorsClient { - return EncryptionProtectorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates an existing encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested encryption protector resource state. -func (client EncryptionProtectorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters EncryptionProtector) (result EncryptionProtectorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters EncryptionProtector) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}", 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 EncryptionProtectorsClient) CreateOrUpdateSender(req *http.Request) (future EncryptionProtectorsCreateOrUpdateFuture, 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 EncryptionProtectorsClient) CreateOrUpdateResponder(resp *http.Response) (result EncryptionProtector, 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 a server encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client EncryptionProtectorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtector, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EncryptionProtectorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}", 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 EncryptionProtectorsClient) 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 EncryptionProtectorsClient) GetResponder(resp *http.Response) (result EncryptionProtector, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of server encryption protectors -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client EncryptionProtectorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.ListByServer") - defer func() { - sc := -1 - if result.eplr.Response.Response != nil { - sc = result.eplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.eplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.eplr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.eplr.hasNextLink() && result.eplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client EncryptionProtectorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/encryptionProtector", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client EncryptionProtectorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client EncryptionProtectorsClient) ListByServerResponder(resp *http.Response) (result EncryptionProtectorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client EncryptionProtectorsClient) listByServerNextResults(ctx context.Context, lastResults EncryptionProtectorListResult) (result EncryptionProtectorListResult, err error) { - req, err := lastResults.encryptionProtectorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client EncryptionProtectorsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// Revalidate revalidates an existing encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client EncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result EncryptionProtectorsRevalidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorsClient.Revalidate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RevalidatePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") - return - } - - result, err = client.RevalidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") - return - } - - return -} - -// RevalidatePreparer prepares the Revalidate request. -func (client EncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevalidateSender sends the Revalidate request. The method will close the -// http.Response Body if it receives an error. -func (client EncryptionProtectorsClient) RevalidateSender(req *http.Request) (future EncryptionProtectorsRevalidateFuture, 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 -} - -// RevalidateResponder handles the response to the Revalidate request. The method always -// closes the http.Response Body. -func (client EncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/enums.go b/services/preview/sql/mgmt/v3.0/sql/enums.go deleted file mode 100644 index fce7ec38a37f..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/enums.go +++ /dev/null @@ -1,1905 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AutomaticTuningDisabledReason enumerates the values for automatic tuning disabled reason. -type AutomaticTuningDisabledReason string - -const ( - // AutoConfigured ... - AutoConfigured AutomaticTuningDisabledReason = "AutoConfigured" - // Default ... - Default AutomaticTuningDisabledReason = "Default" - // Disabled ... - Disabled AutomaticTuningDisabledReason = "Disabled" - // InheritedFromServer ... - InheritedFromServer AutomaticTuningDisabledReason = "InheritedFromServer" - // NotSupported ... - NotSupported AutomaticTuningDisabledReason = "NotSupported" - // QueryStoreOff ... - QueryStoreOff AutomaticTuningDisabledReason = "QueryStoreOff" - // QueryStoreReadOnly ... - QueryStoreReadOnly AutomaticTuningDisabledReason = "QueryStoreReadOnly" -) - -// PossibleAutomaticTuningDisabledReasonValues returns an array of possible values for the AutomaticTuningDisabledReason const type. -func PossibleAutomaticTuningDisabledReasonValues() []AutomaticTuningDisabledReason { - return []AutomaticTuningDisabledReason{AutoConfigured, Default, Disabled, InheritedFromServer, NotSupported, QueryStoreOff, QueryStoreReadOnly} -} - -// AutomaticTuningMode enumerates the values for automatic tuning mode. -type AutomaticTuningMode string - -const ( - // Auto ... - Auto AutomaticTuningMode = "Auto" - // Custom ... - Custom AutomaticTuningMode = "Custom" - // Inherit ... - Inherit AutomaticTuningMode = "Inherit" - // Unspecified ... - Unspecified AutomaticTuningMode = "Unspecified" -) - -// PossibleAutomaticTuningModeValues returns an array of possible values for the AutomaticTuningMode const type. -func PossibleAutomaticTuningModeValues() []AutomaticTuningMode { - return []AutomaticTuningMode{Auto, Custom, Inherit, Unspecified} -} - -// AutomaticTuningOptionModeActual enumerates the values for automatic tuning option mode actual. -type AutomaticTuningOptionModeActual string - -const ( - // Off ... - Off AutomaticTuningOptionModeActual = "Off" - // On ... - On AutomaticTuningOptionModeActual = "On" -) - -// PossibleAutomaticTuningOptionModeActualValues returns an array of possible values for the AutomaticTuningOptionModeActual const type. -func PossibleAutomaticTuningOptionModeActualValues() []AutomaticTuningOptionModeActual { - return []AutomaticTuningOptionModeActual{Off, On} -} - -// AutomaticTuningOptionModeDesired enumerates the values for automatic tuning option mode desired. -type AutomaticTuningOptionModeDesired string - -const ( - // AutomaticTuningOptionModeDesiredDefault ... - AutomaticTuningOptionModeDesiredDefault AutomaticTuningOptionModeDesired = "Default" - // AutomaticTuningOptionModeDesiredOff ... - AutomaticTuningOptionModeDesiredOff AutomaticTuningOptionModeDesired = "Off" - // AutomaticTuningOptionModeDesiredOn ... - AutomaticTuningOptionModeDesiredOn AutomaticTuningOptionModeDesired = "On" -) - -// PossibleAutomaticTuningOptionModeDesiredValues returns an array of possible values for the AutomaticTuningOptionModeDesired const type. -func PossibleAutomaticTuningOptionModeDesiredValues() []AutomaticTuningOptionModeDesired { - return []AutomaticTuningOptionModeDesired{AutomaticTuningOptionModeDesiredDefault, AutomaticTuningOptionModeDesiredOff, AutomaticTuningOptionModeDesiredOn} -} - -// AutomaticTuningServerMode enumerates the values for automatic tuning server mode. -type AutomaticTuningServerMode string - -const ( - // AutomaticTuningServerModeAuto ... - AutomaticTuningServerModeAuto AutomaticTuningServerMode = "Auto" - // AutomaticTuningServerModeCustom ... - AutomaticTuningServerModeCustom AutomaticTuningServerMode = "Custom" - // AutomaticTuningServerModeUnspecified ... - AutomaticTuningServerModeUnspecified AutomaticTuningServerMode = "Unspecified" -) - -// PossibleAutomaticTuningServerModeValues returns an array of possible values for the AutomaticTuningServerMode const type. -func PossibleAutomaticTuningServerModeValues() []AutomaticTuningServerMode { - return []AutomaticTuningServerMode{AutomaticTuningServerModeAuto, AutomaticTuningServerModeCustom, AutomaticTuningServerModeUnspecified} -} - -// AutomaticTuningServerReason enumerates the values for automatic tuning server reason. -type AutomaticTuningServerReason string - -const ( - // AutomaticTuningServerReasonAutoConfigured ... - AutomaticTuningServerReasonAutoConfigured AutomaticTuningServerReason = "AutoConfigured" - // AutomaticTuningServerReasonDefault ... - AutomaticTuningServerReasonDefault AutomaticTuningServerReason = "Default" - // AutomaticTuningServerReasonDisabled ... - AutomaticTuningServerReasonDisabled AutomaticTuningServerReason = "Disabled" -) - -// PossibleAutomaticTuningServerReasonValues returns an array of possible values for the AutomaticTuningServerReason const type. -func PossibleAutomaticTuningServerReasonValues() []AutomaticTuningServerReason { - return []AutomaticTuningServerReason{AutomaticTuningServerReasonAutoConfigured, AutomaticTuningServerReasonDefault, AutomaticTuningServerReasonDisabled} -} - -// BlobAuditingPolicyState enumerates the values for blob auditing policy state. -type BlobAuditingPolicyState string - -const ( - // BlobAuditingPolicyStateDisabled ... - BlobAuditingPolicyStateDisabled BlobAuditingPolicyState = "Disabled" - // BlobAuditingPolicyStateEnabled ... - BlobAuditingPolicyStateEnabled BlobAuditingPolicyState = "Enabled" -) - -// PossibleBlobAuditingPolicyStateValues returns an array of possible values for the BlobAuditingPolicyState const type. -func PossibleBlobAuditingPolicyStateValues() []BlobAuditingPolicyState { - return []BlobAuditingPolicyState{BlobAuditingPolicyStateDisabled, BlobAuditingPolicyStateEnabled} -} - -// CapabilityGroup enumerates the values for capability group. -type CapabilityGroup string - -const ( - // SupportedEditions ... - SupportedEditions CapabilityGroup = "supportedEditions" - // SupportedElasticPoolEditions ... - SupportedElasticPoolEditions CapabilityGroup = "supportedElasticPoolEditions" - // SupportedInstancePoolEditions ... - SupportedInstancePoolEditions CapabilityGroup = "supportedInstancePoolEditions" - // SupportedManagedInstanceEditions ... - SupportedManagedInstanceEditions CapabilityGroup = "supportedManagedInstanceEditions" - // SupportedManagedInstanceVersions ... - SupportedManagedInstanceVersions CapabilityGroup = "supportedManagedInstanceVersions" -) - -// PossibleCapabilityGroupValues returns an array of possible values for the CapabilityGroup const type. -func PossibleCapabilityGroupValues() []CapabilityGroup { - return []CapabilityGroup{SupportedEditions, SupportedElasticPoolEditions, SupportedInstancePoolEditions, SupportedManagedInstanceEditions, SupportedManagedInstanceVersions} -} - -// CapabilityStatus enumerates the values for capability status. -type CapabilityStatus string - -const ( - // CapabilityStatusAvailable ... - CapabilityStatusAvailable CapabilityStatus = "Available" - // CapabilityStatusDefault ... - CapabilityStatusDefault CapabilityStatus = "Default" - // CapabilityStatusDisabled ... - CapabilityStatusDisabled CapabilityStatus = "Disabled" - // CapabilityStatusVisible ... - CapabilityStatusVisible CapabilityStatus = "Visible" -) - -// PossibleCapabilityStatusValues returns an array of possible values for the CapabilityStatus const type. -func PossibleCapabilityStatusValues() []CapabilityStatus { - return []CapabilityStatus{CapabilityStatusAvailable, CapabilityStatusDefault, CapabilityStatusDisabled, CapabilityStatusVisible} -} - -// CatalogCollationType enumerates the values for catalog collation type. -type CatalogCollationType string - -const ( - // DATABASEDEFAULT ... - DATABASEDEFAULT CatalogCollationType = "DATABASE_DEFAULT" - // SQLLatin1GeneralCP1CIAS ... - SQLLatin1GeneralCP1CIAS CatalogCollationType = "SQL_Latin1_General_CP1_CI_AS" -) - -// PossibleCatalogCollationTypeValues returns an array of possible values for the CatalogCollationType const type. -func PossibleCatalogCollationTypeValues() []CatalogCollationType { - return []CatalogCollationType{DATABASEDEFAULT, SQLLatin1GeneralCP1CIAS} -} - -// CheckNameAvailabilityReason enumerates the values for check name availability reason. -type CheckNameAvailabilityReason string - -const ( - // AlreadyExists ... - AlreadyExists CheckNameAvailabilityReason = "AlreadyExists" - // Invalid ... - Invalid CheckNameAvailabilityReason = "Invalid" -) - -// PossibleCheckNameAvailabilityReasonValues returns an array of possible values for the CheckNameAvailabilityReason const type. -func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { - return []CheckNameAvailabilityReason{AlreadyExists, Invalid} -} - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // CreateModeCopy ... - CreateModeCopy CreateMode = "Copy" - // CreateModeDefault ... - CreateModeDefault CreateMode = "Default" - // CreateModeOnlineSecondary ... - CreateModeOnlineSecondary CreateMode = "OnlineSecondary" - // CreateModePointInTimeRestore ... - CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" - // CreateModeRecovery ... - CreateModeRecovery CreateMode = "Recovery" - // CreateModeRestore ... - CreateModeRestore CreateMode = "Restore" - // CreateModeRestoreExternalBackup ... - CreateModeRestoreExternalBackup CreateMode = "RestoreExternalBackup" - // CreateModeRestoreExternalBackupSecondary ... - CreateModeRestoreExternalBackupSecondary CreateMode = "RestoreExternalBackupSecondary" - // CreateModeRestoreLongTermRetentionBackup ... - CreateModeRestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup" - // CreateModeSecondary ... - CreateModeSecondary CreateMode = "Secondary" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{CreateModeCopy, CreateModeDefault, CreateModeOnlineSecondary, CreateModePointInTimeRestore, CreateModeRecovery, CreateModeRestore, CreateModeRestoreExternalBackup, CreateModeRestoreExternalBackupSecondary, CreateModeRestoreLongTermRetentionBackup, CreateModeSecondary} -} - -// DatabaseLicenseType enumerates the values for database license type. -type DatabaseLicenseType string - -const ( - // BasePrice ... - BasePrice DatabaseLicenseType = "BasePrice" - // LicenseIncluded ... - LicenseIncluded DatabaseLicenseType = "LicenseIncluded" -) - -// PossibleDatabaseLicenseTypeValues returns an array of possible values for the DatabaseLicenseType const type. -func PossibleDatabaseLicenseTypeValues() []DatabaseLicenseType { - return []DatabaseLicenseType{BasePrice, LicenseIncluded} -} - -// DatabaseReadScale enumerates the values for database read scale. -type DatabaseReadScale string - -const ( - // DatabaseReadScaleDisabled ... - DatabaseReadScaleDisabled DatabaseReadScale = "Disabled" - // DatabaseReadScaleEnabled ... - DatabaseReadScaleEnabled DatabaseReadScale = "Enabled" -) - -// PossibleDatabaseReadScaleValues returns an array of possible values for the DatabaseReadScale const type. -func PossibleDatabaseReadScaleValues() []DatabaseReadScale { - return []DatabaseReadScale{DatabaseReadScaleDisabled, DatabaseReadScaleEnabled} -} - -// DatabaseState1 enumerates the values for database state 1. -type DatabaseState1 string - -const ( - // All ... - All DatabaseState1 = "All" - // Deleted ... - Deleted DatabaseState1 = "Deleted" - // Live ... - Live DatabaseState1 = "Live" -) - -// PossibleDatabaseState1Values returns an array of possible values for the DatabaseState1 const type. -func PossibleDatabaseState1Values() []DatabaseState1 { - return []DatabaseState1{All, Deleted, Live} -} - -// DatabaseState2 enumerates the values for database state 2. -type DatabaseState2 string - -const ( - // DatabaseState2All ... - DatabaseState2All DatabaseState2 = "All" - // DatabaseState2Deleted ... - DatabaseState2Deleted DatabaseState2 = "Deleted" - // DatabaseState2Live ... - DatabaseState2Live DatabaseState2 = "Live" -) - -// PossibleDatabaseState2Values returns an array of possible values for the DatabaseState2 const type. -func PossibleDatabaseState2Values() []DatabaseState2 { - return []DatabaseState2{DatabaseState2All, DatabaseState2Deleted, DatabaseState2Live} -} - -// DatabaseState3 enumerates the values for database state 3. -type DatabaseState3 string - -const ( - // DatabaseState3All ... - DatabaseState3All DatabaseState3 = "All" - // DatabaseState3Deleted ... - DatabaseState3Deleted DatabaseState3 = "Deleted" - // DatabaseState3Live ... - DatabaseState3Live DatabaseState3 = "Live" -) - -// PossibleDatabaseState3Values returns an array of possible values for the DatabaseState3 const type. -func PossibleDatabaseState3Values() []DatabaseState3 { - return []DatabaseState3{DatabaseState3All, DatabaseState3Deleted, DatabaseState3Live} -} - -// DatabaseState4 enumerates the values for database state 4. -type DatabaseState4 string - -const ( - // DatabaseState4All ... - DatabaseState4All DatabaseState4 = "All" - // DatabaseState4Deleted ... - DatabaseState4Deleted DatabaseState4 = "Deleted" - // DatabaseState4Live ... - DatabaseState4Live DatabaseState4 = "Live" -) - -// PossibleDatabaseState4Values returns an array of possible values for the DatabaseState4 const type. -func PossibleDatabaseState4Values() []DatabaseState4 { - return []DatabaseState4{DatabaseState4All, DatabaseState4Deleted, DatabaseState4Live} -} - -// DatabaseState5 enumerates the values for database state 5. -type DatabaseState5 string - -const ( - // DatabaseState5All ... - DatabaseState5All DatabaseState5 = "All" - // DatabaseState5Deleted ... - DatabaseState5Deleted DatabaseState5 = "Deleted" - // DatabaseState5Live ... - DatabaseState5Live DatabaseState5 = "Live" -) - -// PossibleDatabaseState5Values returns an array of possible values for the DatabaseState5 const type. -func PossibleDatabaseState5Values() []DatabaseState5 { - return []DatabaseState5{DatabaseState5All, DatabaseState5Deleted, DatabaseState5Live} -} - -// DatabaseState6 enumerates the values for database state 6. -type DatabaseState6 string - -const ( - // DatabaseState6All ... - DatabaseState6All DatabaseState6 = "All" - // DatabaseState6Deleted ... - DatabaseState6Deleted DatabaseState6 = "Deleted" - // DatabaseState6Live ... - DatabaseState6Live DatabaseState6 = "Live" -) - -// PossibleDatabaseState6Values returns an array of possible values for the DatabaseState6 const type. -func PossibleDatabaseState6Values() []DatabaseState6 { - return []DatabaseState6{DatabaseState6All, DatabaseState6Deleted, DatabaseState6Live} -} - -// DatabaseStatus enumerates the values for database status. -type DatabaseStatus string - -const ( - // DatabaseStatusAutoClosed ... - DatabaseStatusAutoClosed DatabaseStatus = "AutoClosed" - // DatabaseStatusCopying ... - DatabaseStatusCopying DatabaseStatus = "Copying" - // DatabaseStatusCreating ... - DatabaseStatusCreating DatabaseStatus = "Creating" - // DatabaseStatusDisabled ... - DatabaseStatusDisabled DatabaseStatus = "Disabled" - // DatabaseStatusEmergencyMode ... - DatabaseStatusEmergencyMode DatabaseStatus = "EmergencyMode" - // DatabaseStatusInaccessible ... - DatabaseStatusInaccessible DatabaseStatus = "Inaccessible" - // DatabaseStatusOffline ... - DatabaseStatusOffline DatabaseStatus = "Offline" - // DatabaseStatusOfflineChangingDwPerformanceTiers ... - DatabaseStatusOfflineChangingDwPerformanceTiers DatabaseStatus = "OfflineChangingDwPerformanceTiers" - // DatabaseStatusOfflineSecondary ... - DatabaseStatusOfflineSecondary DatabaseStatus = "OfflineSecondary" - // DatabaseStatusOnline ... - DatabaseStatusOnline DatabaseStatus = "Online" - // DatabaseStatusOnlineChangingDwPerformanceTiers ... - DatabaseStatusOnlineChangingDwPerformanceTiers DatabaseStatus = "OnlineChangingDwPerformanceTiers" - // DatabaseStatusPaused ... - DatabaseStatusPaused DatabaseStatus = "Paused" - // DatabaseStatusPausing ... - DatabaseStatusPausing DatabaseStatus = "Pausing" - // DatabaseStatusRecovering ... - DatabaseStatusRecovering DatabaseStatus = "Recovering" - // DatabaseStatusRecoveryPending ... - DatabaseStatusRecoveryPending DatabaseStatus = "RecoveryPending" - // DatabaseStatusRestoring ... - DatabaseStatusRestoring DatabaseStatus = "Restoring" - // DatabaseStatusResuming ... - DatabaseStatusResuming DatabaseStatus = "Resuming" - // DatabaseStatusScaling ... - DatabaseStatusScaling DatabaseStatus = "Scaling" - // DatabaseStatusShutdown ... - DatabaseStatusShutdown DatabaseStatus = "Shutdown" - // DatabaseStatusStandby ... - DatabaseStatusStandby DatabaseStatus = "Standby" - // DatabaseStatusSuspect ... - DatabaseStatusSuspect DatabaseStatus = "Suspect" -) - -// PossibleDatabaseStatusValues returns an array of possible values for the DatabaseStatus const type. -func PossibleDatabaseStatusValues() []DatabaseStatus { - return []DatabaseStatus{DatabaseStatusAutoClosed, DatabaseStatusCopying, DatabaseStatusCreating, DatabaseStatusDisabled, DatabaseStatusEmergencyMode, DatabaseStatusInaccessible, DatabaseStatusOffline, DatabaseStatusOfflineChangingDwPerformanceTiers, DatabaseStatusOfflineSecondary, DatabaseStatusOnline, DatabaseStatusOnlineChangingDwPerformanceTiers, DatabaseStatusPaused, DatabaseStatusPausing, DatabaseStatusRecovering, DatabaseStatusRecoveryPending, DatabaseStatusRestoring, DatabaseStatusResuming, DatabaseStatusScaling, DatabaseStatusShutdown, DatabaseStatusStandby, DatabaseStatusSuspect} -} - -// DataMaskingFunction enumerates the values for data masking function. -type DataMaskingFunction string - -const ( - // DataMaskingFunctionCCN ... - DataMaskingFunctionCCN DataMaskingFunction = "CCN" - // DataMaskingFunctionDefault ... - DataMaskingFunctionDefault DataMaskingFunction = "Default" - // DataMaskingFunctionEmail ... - DataMaskingFunctionEmail DataMaskingFunction = "Email" - // DataMaskingFunctionNumber ... - DataMaskingFunctionNumber DataMaskingFunction = "Number" - // DataMaskingFunctionSSN ... - DataMaskingFunctionSSN DataMaskingFunction = "SSN" - // DataMaskingFunctionText ... - DataMaskingFunctionText DataMaskingFunction = "Text" -) - -// PossibleDataMaskingFunctionValues returns an array of possible values for the DataMaskingFunction const type. -func PossibleDataMaskingFunctionValues() []DataMaskingFunction { - return []DataMaskingFunction{DataMaskingFunctionCCN, DataMaskingFunctionDefault, DataMaskingFunctionEmail, DataMaskingFunctionNumber, DataMaskingFunctionSSN, DataMaskingFunctionText} -} - -// DataMaskingRuleState enumerates the values for data masking rule state. -type DataMaskingRuleState string - -const ( - // DataMaskingRuleStateDisabled ... - DataMaskingRuleStateDisabled DataMaskingRuleState = "Disabled" - // DataMaskingRuleStateEnabled ... - DataMaskingRuleStateEnabled DataMaskingRuleState = "Enabled" -) - -// PossibleDataMaskingRuleStateValues returns an array of possible values for the DataMaskingRuleState const type. -func PossibleDataMaskingRuleStateValues() []DataMaskingRuleState { - return []DataMaskingRuleState{DataMaskingRuleStateDisabled, DataMaskingRuleStateEnabled} -} - -// DataMaskingState enumerates the values for data masking state. -type DataMaskingState string - -const ( - // DataMaskingStateDisabled ... - DataMaskingStateDisabled DataMaskingState = "Disabled" - // DataMaskingStateEnabled ... - DataMaskingStateEnabled DataMaskingState = "Enabled" -) - -// PossibleDataMaskingStateValues returns an array of possible values for the DataMaskingState const type. -func PossibleDataMaskingStateValues() []DataMaskingState { - return []DataMaskingState{DataMaskingStateDisabled, DataMaskingStateEnabled} -} - -// ElasticPoolEdition enumerates the values for elastic pool edition. -type ElasticPoolEdition string - -const ( - // Basic ... - Basic ElasticPoolEdition = "Basic" - // BusinessCritical ... - BusinessCritical ElasticPoolEdition = "BusinessCritical" - // GeneralPurpose ... - GeneralPurpose ElasticPoolEdition = "GeneralPurpose" - // Premium ... - Premium ElasticPoolEdition = "Premium" - // Standard ... - Standard ElasticPoolEdition = "Standard" -) - -// PossibleElasticPoolEditionValues returns an array of possible values for the ElasticPoolEdition const type. -func PossibleElasticPoolEditionValues() []ElasticPoolEdition { - return []ElasticPoolEdition{Basic, BusinessCritical, GeneralPurpose, Premium, Standard} -} - -// ElasticPoolLicenseType enumerates the values for elastic pool license type. -type ElasticPoolLicenseType string - -const ( - // ElasticPoolLicenseTypeBasePrice ... - ElasticPoolLicenseTypeBasePrice ElasticPoolLicenseType = "BasePrice" - // ElasticPoolLicenseTypeLicenseIncluded ... - ElasticPoolLicenseTypeLicenseIncluded ElasticPoolLicenseType = "LicenseIncluded" -) - -// PossibleElasticPoolLicenseTypeValues returns an array of possible values for the ElasticPoolLicenseType const type. -func PossibleElasticPoolLicenseTypeValues() []ElasticPoolLicenseType { - return []ElasticPoolLicenseType{ElasticPoolLicenseTypeBasePrice, ElasticPoolLicenseTypeLicenseIncluded} -} - -// ElasticPoolState enumerates the values for elastic pool state. -type ElasticPoolState string - -const ( - // ElasticPoolStateCreating ... - ElasticPoolStateCreating ElasticPoolState = "Creating" - // ElasticPoolStateDisabled ... - ElasticPoolStateDisabled ElasticPoolState = "Disabled" - // ElasticPoolStateReady ... - ElasticPoolStateReady ElasticPoolState = "Ready" -) - -// PossibleElasticPoolStateValues returns an array of possible values for the ElasticPoolState const type. -func PossibleElasticPoolStateValues() []ElasticPoolState { - return []ElasticPoolState{ElasticPoolStateCreating, ElasticPoolStateDisabled, ElasticPoolStateReady} -} - -// FailoverGroupReplicationRole enumerates the values for failover group replication role. -type FailoverGroupReplicationRole string - -const ( - // Primary ... - Primary FailoverGroupReplicationRole = "Primary" - // Secondary ... - Secondary FailoverGroupReplicationRole = "Secondary" -) - -// PossibleFailoverGroupReplicationRoleValues returns an array of possible values for the FailoverGroupReplicationRole const type. -func PossibleFailoverGroupReplicationRoleValues() []FailoverGroupReplicationRole { - return []FailoverGroupReplicationRole{Primary, Secondary} -} - -// GeoBackupPolicyState enumerates the values for geo backup policy state. -type GeoBackupPolicyState string - -const ( - // GeoBackupPolicyStateDisabled ... - GeoBackupPolicyStateDisabled GeoBackupPolicyState = "Disabled" - // GeoBackupPolicyStateEnabled ... - GeoBackupPolicyStateEnabled GeoBackupPolicyState = "Enabled" -) - -// PossibleGeoBackupPolicyStateValues returns an array of possible values for the GeoBackupPolicyState const type. -func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { - return []GeoBackupPolicyState{GeoBackupPolicyStateDisabled, GeoBackupPolicyStateEnabled} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // SystemAssigned ... - SystemAssigned IdentityType = "SystemAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{SystemAssigned} -} - -// InstanceFailoverGroupReplicationRole enumerates the values for instance failover group replication role. -type InstanceFailoverGroupReplicationRole string - -const ( - // InstanceFailoverGroupReplicationRolePrimary ... - InstanceFailoverGroupReplicationRolePrimary InstanceFailoverGroupReplicationRole = "Primary" - // InstanceFailoverGroupReplicationRoleSecondary ... - InstanceFailoverGroupReplicationRoleSecondary InstanceFailoverGroupReplicationRole = "Secondary" -) - -// PossibleInstanceFailoverGroupReplicationRoleValues returns an array of possible values for the InstanceFailoverGroupReplicationRole const type. -func PossibleInstanceFailoverGroupReplicationRoleValues() []InstanceFailoverGroupReplicationRole { - return []InstanceFailoverGroupReplicationRole{InstanceFailoverGroupReplicationRolePrimary, InstanceFailoverGroupReplicationRoleSecondary} -} - -// InstancePoolLicenseType enumerates the values for instance pool license type. -type InstancePoolLicenseType string - -const ( - // InstancePoolLicenseTypeBasePrice ... - InstancePoolLicenseTypeBasePrice InstancePoolLicenseType = "BasePrice" - // InstancePoolLicenseTypeLicenseIncluded ... - InstancePoolLicenseTypeLicenseIncluded InstancePoolLicenseType = "LicenseIncluded" -) - -// PossibleInstancePoolLicenseTypeValues returns an array of possible values for the InstancePoolLicenseType const type. -func PossibleInstancePoolLicenseTypeValues() []InstancePoolLicenseType { - return []InstancePoolLicenseType{InstancePoolLicenseTypeBasePrice, InstancePoolLicenseTypeLicenseIncluded} -} - -// JobAgentState enumerates the values for job agent state. -type JobAgentState string - -const ( - // JobAgentStateCreating ... - JobAgentStateCreating JobAgentState = "Creating" - // JobAgentStateDeleting ... - JobAgentStateDeleting JobAgentState = "Deleting" - // JobAgentStateDisabled ... - JobAgentStateDisabled JobAgentState = "Disabled" - // JobAgentStateReady ... - JobAgentStateReady JobAgentState = "Ready" - // JobAgentStateUpdating ... - JobAgentStateUpdating JobAgentState = "Updating" -) - -// PossibleJobAgentStateValues returns an array of possible values for the JobAgentState const type. -func PossibleJobAgentStateValues() []JobAgentState { - return []JobAgentState{JobAgentStateCreating, JobAgentStateDeleting, JobAgentStateDisabled, JobAgentStateReady, JobAgentStateUpdating} -} - -// JobExecutionLifecycle enumerates the values for job execution lifecycle. -type JobExecutionLifecycle string - -const ( - // Canceled ... - Canceled JobExecutionLifecycle = "Canceled" - // Created ... - Created JobExecutionLifecycle = "Created" - // Failed ... - Failed JobExecutionLifecycle = "Failed" - // InProgress ... - InProgress JobExecutionLifecycle = "InProgress" - // Skipped ... - Skipped JobExecutionLifecycle = "Skipped" - // Succeeded ... - Succeeded JobExecutionLifecycle = "Succeeded" - // SucceededWithSkipped ... - SucceededWithSkipped JobExecutionLifecycle = "SucceededWithSkipped" - // TimedOut ... - TimedOut JobExecutionLifecycle = "TimedOut" - // WaitingForChildJobExecutions ... - WaitingForChildJobExecutions JobExecutionLifecycle = "WaitingForChildJobExecutions" - // WaitingForRetry ... - WaitingForRetry JobExecutionLifecycle = "WaitingForRetry" -) - -// PossibleJobExecutionLifecycleValues returns an array of possible values for the JobExecutionLifecycle const type. -func PossibleJobExecutionLifecycleValues() []JobExecutionLifecycle { - return []JobExecutionLifecycle{Canceled, Created, Failed, InProgress, Skipped, Succeeded, SucceededWithSkipped, TimedOut, WaitingForChildJobExecutions, WaitingForRetry} -} - -// JobScheduleType enumerates the values for job schedule type. -type JobScheduleType string - -const ( - // Once ... - Once JobScheduleType = "Once" - // Recurring ... - Recurring JobScheduleType = "Recurring" -) - -// PossibleJobScheduleTypeValues returns an array of possible values for the JobScheduleType const type. -func PossibleJobScheduleTypeValues() []JobScheduleType { - return []JobScheduleType{Once, Recurring} -} - -// JobStepActionSource enumerates the values for job step action source. -type JobStepActionSource string - -const ( - // Inline ... - Inline JobStepActionSource = "Inline" -) - -// PossibleJobStepActionSourceValues returns an array of possible values for the JobStepActionSource const type. -func PossibleJobStepActionSourceValues() []JobStepActionSource { - return []JobStepActionSource{Inline} -} - -// JobStepActionType enumerates the values for job step action type. -type JobStepActionType string - -const ( - // TSQL ... - TSQL JobStepActionType = "TSql" -) - -// PossibleJobStepActionTypeValues returns an array of possible values for the JobStepActionType const type. -func PossibleJobStepActionTypeValues() []JobStepActionType { - return []JobStepActionType{TSQL} -} - -// JobStepOutputType enumerates the values for job step output type. -type JobStepOutputType string - -const ( - // SQLDatabase ... - SQLDatabase JobStepOutputType = "SqlDatabase" -) - -// PossibleJobStepOutputTypeValues returns an array of possible values for the JobStepOutputType const type. -func PossibleJobStepOutputTypeValues() []JobStepOutputType { - return []JobStepOutputType{SQLDatabase} -} - -// JobTargetGroupMembershipType enumerates the values for job target group membership type. -type JobTargetGroupMembershipType string - -const ( - // Exclude ... - Exclude JobTargetGroupMembershipType = "Exclude" - // Include ... - Include JobTargetGroupMembershipType = "Include" -) - -// PossibleJobTargetGroupMembershipTypeValues returns an array of possible values for the JobTargetGroupMembershipType const type. -func PossibleJobTargetGroupMembershipTypeValues() []JobTargetGroupMembershipType { - return []JobTargetGroupMembershipType{Exclude, Include} -} - -// JobTargetType enumerates the values for job target type. -type JobTargetType string - -const ( - // JobTargetTypeSQLDatabase ... - JobTargetTypeSQLDatabase JobTargetType = "SqlDatabase" - // JobTargetTypeSQLElasticPool ... - JobTargetTypeSQLElasticPool JobTargetType = "SqlElasticPool" - // JobTargetTypeSQLServer ... - JobTargetTypeSQLServer JobTargetType = "SqlServer" - // JobTargetTypeSQLShardMap ... - JobTargetTypeSQLShardMap JobTargetType = "SqlShardMap" - // JobTargetTypeTargetGroup ... - JobTargetTypeTargetGroup JobTargetType = "TargetGroup" -) - -// PossibleJobTargetTypeValues returns an array of possible values for the JobTargetType const type. -func PossibleJobTargetTypeValues() []JobTargetType { - return []JobTargetType{JobTargetTypeSQLDatabase, JobTargetTypeSQLElasticPool, JobTargetTypeSQLServer, JobTargetTypeSQLShardMap, JobTargetTypeTargetGroup} -} - -// LogSizeUnit enumerates the values for log size unit. -type LogSizeUnit string - -const ( - // Gigabytes ... - Gigabytes LogSizeUnit = "Gigabytes" - // Megabytes ... - Megabytes LogSizeUnit = "Megabytes" - // Percent ... - Percent LogSizeUnit = "Percent" - // Petabytes ... - Petabytes LogSizeUnit = "Petabytes" - // Terabytes ... - Terabytes LogSizeUnit = "Terabytes" -) - -// PossibleLogSizeUnitValues returns an array of possible values for the LogSizeUnit const type. -func PossibleLogSizeUnitValues() []LogSizeUnit { - return []LogSizeUnit{Gigabytes, Megabytes, Percent, Petabytes, Terabytes} -} - -// LongTermRetentionDatabaseState enumerates the values for long term retention database state. -type LongTermRetentionDatabaseState string - -const ( - // LongTermRetentionDatabaseStateAll ... - LongTermRetentionDatabaseStateAll LongTermRetentionDatabaseState = "All" - // LongTermRetentionDatabaseStateDeleted ... - LongTermRetentionDatabaseStateDeleted LongTermRetentionDatabaseState = "Deleted" - // LongTermRetentionDatabaseStateLive ... - LongTermRetentionDatabaseStateLive LongTermRetentionDatabaseState = "Live" -) - -// PossibleLongTermRetentionDatabaseStateValues returns an array of possible values for the LongTermRetentionDatabaseState const type. -func PossibleLongTermRetentionDatabaseStateValues() []LongTermRetentionDatabaseState { - return []LongTermRetentionDatabaseState{LongTermRetentionDatabaseStateAll, LongTermRetentionDatabaseStateDeleted, LongTermRetentionDatabaseStateLive} -} - -// ManagedDatabaseCreateMode enumerates the values for managed database create mode. -type ManagedDatabaseCreateMode string - -const ( - // ManagedDatabaseCreateModeDefault ... - ManagedDatabaseCreateModeDefault ManagedDatabaseCreateMode = "Default" - // ManagedDatabaseCreateModePointInTimeRestore ... - ManagedDatabaseCreateModePointInTimeRestore ManagedDatabaseCreateMode = "PointInTimeRestore" - // ManagedDatabaseCreateModeRecovery ... - ManagedDatabaseCreateModeRecovery ManagedDatabaseCreateMode = "Recovery" - // ManagedDatabaseCreateModeRestoreExternalBackup ... - ManagedDatabaseCreateModeRestoreExternalBackup ManagedDatabaseCreateMode = "RestoreExternalBackup" - // ManagedDatabaseCreateModeRestoreLongTermRetentionBackup ... - ManagedDatabaseCreateModeRestoreLongTermRetentionBackup ManagedDatabaseCreateMode = "RestoreLongTermRetentionBackup" -) - -// PossibleManagedDatabaseCreateModeValues returns an array of possible values for the ManagedDatabaseCreateMode const type. -func PossibleManagedDatabaseCreateModeValues() []ManagedDatabaseCreateMode { - return []ManagedDatabaseCreateMode{ManagedDatabaseCreateModeDefault, ManagedDatabaseCreateModePointInTimeRestore, ManagedDatabaseCreateModeRecovery, ManagedDatabaseCreateModeRestoreExternalBackup, ManagedDatabaseCreateModeRestoreLongTermRetentionBackup} -} - -// ManagedDatabaseStatus enumerates the values for managed database status. -type ManagedDatabaseStatus string - -const ( - // Creating ... - Creating ManagedDatabaseStatus = "Creating" - // Inaccessible ... - Inaccessible ManagedDatabaseStatus = "Inaccessible" - // Offline ... - Offline ManagedDatabaseStatus = "Offline" - // Online ... - Online ManagedDatabaseStatus = "Online" - // Restoring ... - Restoring ManagedDatabaseStatus = "Restoring" - // Shutdown ... - Shutdown ManagedDatabaseStatus = "Shutdown" - // Updating ... - Updating ManagedDatabaseStatus = "Updating" -) - -// PossibleManagedDatabaseStatusValues returns an array of possible values for the ManagedDatabaseStatus const type. -func PossibleManagedDatabaseStatusValues() []ManagedDatabaseStatus { - return []ManagedDatabaseStatus{Creating, Inaccessible, Offline, Online, Restoring, Shutdown, Updating} -} - -// ManagedInstanceLicenseType enumerates the values for managed instance license type. -type ManagedInstanceLicenseType string - -const ( - // ManagedInstanceLicenseTypeBasePrice ... - ManagedInstanceLicenseTypeBasePrice ManagedInstanceLicenseType = "BasePrice" - // ManagedInstanceLicenseTypeLicenseIncluded ... - ManagedInstanceLicenseTypeLicenseIncluded ManagedInstanceLicenseType = "LicenseIncluded" -) - -// PossibleManagedInstanceLicenseTypeValues returns an array of possible values for the ManagedInstanceLicenseType const type. -func PossibleManagedInstanceLicenseTypeValues() []ManagedInstanceLicenseType { - return []ManagedInstanceLicenseType{ManagedInstanceLicenseTypeBasePrice, ManagedInstanceLicenseTypeLicenseIncluded} -} - -// ManagedInstanceProxyOverride enumerates the values for managed instance proxy override. -type ManagedInstanceProxyOverride string - -const ( - // ManagedInstanceProxyOverrideDefault ... - ManagedInstanceProxyOverrideDefault ManagedInstanceProxyOverride = "Default" - // ManagedInstanceProxyOverrideProxy ... - ManagedInstanceProxyOverrideProxy ManagedInstanceProxyOverride = "Proxy" - // ManagedInstanceProxyOverrideRedirect ... - ManagedInstanceProxyOverrideRedirect ManagedInstanceProxyOverride = "Redirect" -) - -// PossibleManagedInstanceProxyOverrideValues returns an array of possible values for the ManagedInstanceProxyOverride const type. -func PossibleManagedInstanceProxyOverrideValues() []ManagedInstanceProxyOverride { - return []ManagedInstanceProxyOverride{ManagedInstanceProxyOverrideDefault, ManagedInstanceProxyOverrideProxy, ManagedInstanceProxyOverrideRedirect} -} - -// ManagedServerCreateMode enumerates the values for managed server create mode. -type ManagedServerCreateMode string - -const ( - // ManagedServerCreateModeDefault ... - ManagedServerCreateModeDefault ManagedServerCreateMode = "Default" - // ManagedServerCreateModePointInTimeRestore ... - ManagedServerCreateModePointInTimeRestore ManagedServerCreateMode = "PointInTimeRestore" -) - -// PossibleManagedServerCreateModeValues returns an array of possible values for the ManagedServerCreateMode const type. -func PossibleManagedServerCreateModeValues() []ManagedServerCreateMode { - return []ManagedServerCreateMode{ManagedServerCreateModeDefault, ManagedServerCreateModePointInTimeRestore} -} - -// ManagementOperationState enumerates the values for management operation state. -type ManagementOperationState string - -const ( - // ManagementOperationStateCancelInProgress ... - ManagementOperationStateCancelInProgress ManagementOperationState = "CancelInProgress" - // ManagementOperationStateCancelled ... - ManagementOperationStateCancelled ManagementOperationState = "Cancelled" - // ManagementOperationStateFailed ... - ManagementOperationStateFailed ManagementOperationState = "Failed" - // ManagementOperationStateInProgress ... - ManagementOperationStateInProgress ManagementOperationState = "InProgress" - // ManagementOperationStatePending ... - ManagementOperationStatePending ManagementOperationState = "Pending" - // ManagementOperationStateSucceeded ... - ManagementOperationStateSucceeded ManagementOperationState = "Succeeded" -) - -// PossibleManagementOperationStateValues returns an array of possible values for the ManagementOperationState const type. -func PossibleManagementOperationStateValues() []ManagementOperationState { - return []ManagementOperationState{ManagementOperationStateCancelInProgress, ManagementOperationStateCancelled, ManagementOperationStateFailed, ManagementOperationStateInProgress, ManagementOperationStatePending, ManagementOperationStateSucceeded} -} - -// MaxSizeUnit enumerates the values for max size unit. -type MaxSizeUnit string - -const ( - // MaxSizeUnitGigabytes ... - MaxSizeUnitGigabytes MaxSizeUnit = "Gigabytes" - // MaxSizeUnitMegabytes ... - MaxSizeUnitMegabytes MaxSizeUnit = "Megabytes" - // MaxSizeUnitPetabytes ... - MaxSizeUnitPetabytes MaxSizeUnit = "Petabytes" - // MaxSizeUnitTerabytes ... - MaxSizeUnitTerabytes MaxSizeUnit = "Terabytes" -) - -// PossibleMaxSizeUnitValues returns an array of possible values for the MaxSizeUnit const type. -func PossibleMaxSizeUnitValues() []MaxSizeUnit { - return []MaxSizeUnit{MaxSizeUnitGigabytes, MaxSizeUnitMegabytes, MaxSizeUnitPetabytes, MaxSizeUnitTerabytes} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // System ... - System OperationOrigin = "system" - // User ... - User OperationOrigin = "user" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{System, User} -} - -// PauseDelayTimeUnit enumerates the values for pause delay time unit. -type PauseDelayTimeUnit string - -const ( - // Minutes ... - Minutes PauseDelayTimeUnit = "Minutes" -) - -// PossiblePauseDelayTimeUnitValues returns an array of possible values for the PauseDelayTimeUnit const type. -func PossiblePauseDelayTimeUnitValues() []PauseDelayTimeUnit { - return []PauseDelayTimeUnit{Minutes} -} - -// PerformanceLevelUnit enumerates the values for performance level unit. -type PerformanceLevelUnit string - -const ( - // DTU ... - DTU PerformanceLevelUnit = "DTU" - // VCores ... - VCores PerformanceLevelUnit = "VCores" -) - -// PossiblePerformanceLevelUnitValues returns an array of possible values for the PerformanceLevelUnit const type. -func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { - return []PerformanceLevelUnit{DTU, VCores} -} - -// PrimaryAggregationType enumerates the values for primary aggregation type. -type PrimaryAggregationType string - -const ( - // Average ... - Average PrimaryAggregationType = "Average" - // Count ... - Count PrimaryAggregationType = "Count" - // Maximum ... - Maximum PrimaryAggregationType = "Maximum" - // Minimum ... - Minimum PrimaryAggregationType = "Minimum" - // None ... - None PrimaryAggregationType = "None" - // Total ... - Total PrimaryAggregationType = "Total" -) - -// PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{Average, Count, Maximum, Minimum, None, Total} -} - -// PrivateEndpointProvisioningState enumerates the values for private endpoint provisioning state. -type PrivateEndpointProvisioningState string - -const ( - // PrivateEndpointProvisioningStateApproving ... - PrivateEndpointProvisioningStateApproving PrivateEndpointProvisioningState = "Approving" - // PrivateEndpointProvisioningStateDropping ... - PrivateEndpointProvisioningStateDropping PrivateEndpointProvisioningState = "Dropping" - // PrivateEndpointProvisioningStateFailed ... - PrivateEndpointProvisioningStateFailed PrivateEndpointProvisioningState = "Failed" - // PrivateEndpointProvisioningStateReady ... - PrivateEndpointProvisioningStateReady PrivateEndpointProvisioningState = "Ready" - // PrivateEndpointProvisioningStateRejecting ... - PrivateEndpointProvisioningStateRejecting PrivateEndpointProvisioningState = "Rejecting" -) - -// PossiblePrivateEndpointProvisioningStateValues returns an array of possible values for the PrivateEndpointProvisioningState const type. -func PossiblePrivateEndpointProvisioningStateValues() []PrivateEndpointProvisioningState { - return []PrivateEndpointProvisioningState{PrivateEndpointProvisioningStateApproving, PrivateEndpointProvisioningStateDropping, PrivateEndpointProvisioningStateFailed, PrivateEndpointProvisioningStateReady, PrivateEndpointProvisioningStateRejecting} -} - -// PrivateLinkServiceConnectionStateActionsRequire enumerates the values for private link service connection -// state actions require. -type PrivateLinkServiceConnectionStateActionsRequire string - -const ( - // PrivateLinkServiceConnectionStateActionsRequireNone ... - PrivateLinkServiceConnectionStateActionsRequireNone PrivateLinkServiceConnectionStateActionsRequire = "None" -) - -// PossiblePrivateLinkServiceConnectionStateActionsRequireValues returns an array of possible values for the PrivateLinkServiceConnectionStateActionsRequire const type. -func PossiblePrivateLinkServiceConnectionStateActionsRequireValues() []PrivateLinkServiceConnectionStateActionsRequire { - return []PrivateLinkServiceConnectionStateActionsRequire{PrivateLinkServiceConnectionStateActionsRequireNone} -} - -// PrivateLinkServiceConnectionStateStatus enumerates the values for private link service connection state -// status. -type PrivateLinkServiceConnectionStateStatus string - -const ( - // Approved ... - Approved PrivateLinkServiceConnectionStateStatus = "Approved" - // Disconnected ... - Disconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" - // Pending ... - Pending PrivateLinkServiceConnectionStateStatus = "Pending" - // Rejected ... - Rejected PrivateLinkServiceConnectionStateStatus = "Rejected" -) - -// PossiblePrivateLinkServiceConnectionStateStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStateStatus const type. -func PossiblePrivateLinkServiceConnectionStateStatusValues() []PrivateLinkServiceConnectionStateStatus { - return []PrivateLinkServiceConnectionStateStatus{Approved, Disconnected, Pending, Rejected} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreated ... - ProvisioningStateCreated ProvisioningState = "Created" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateInProgress ... - ProvisioningStateInProgress ProvisioningState = "InProgress" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreated, ProvisioningStateFailed, ProvisioningStateInProgress, ProvisioningStateSucceeded} -} - -// ProvisioningState1 enumerates the values for provisioning state 1. -type ProvisioningState1 string - -const ( - // ProvisioningState1Creating ... - ProvisioningState1Creating ProvisioningState1 = "Creating" - // ProvisioningState1Deleting ... - ProvisioningState1Deleting ProvisioningState1 = "Deleting" - // ProvisioningState1Failed ... - ProvisioningState1Failed ProvisioningState1 = "Failed" - // ProvisioningState1Succeeded ... - ProvisioningState1Succeeded ProvisioningState1 = "Succeeded" - // ProvisioningState1Unknown ... - ProvisioningState1Unknown ProvisioningState1 = "Unknown" - // ProvisioningState1Updating ... - ProvisioningState1Updating ProvisioningState1 = "Updating" -) - -// PossibleProvisioningState1Values returns an array of possible values for the ProvisioningState1 const type. -func PossibleProvisioningState1Values() []ProvisioningState1 { - return []ProvisioningState1{ProvisioningState1Creating, ProvisioningState1Deleting, ProvisioningState1Failed, ProvisioningState1Succeeded, ProvisioningState1Unknown, ProvisioningState1Updating} -} - -// ReadOnlyEndpointFailoverPolicy enumerates the values for read only endpoint failover policy. -type ReadOnlyEndpointFailoverPolicy string - -const ( - // ReadOnlyEndpointFailoverPolicyDisabled ... - ReadOnlyEndpointFailoverPolicyDisabled ReadOnlyEndpointFailoverPolicy = "Disabled" - // ReadOnlyEndpointFailoverPolicyEnabled ... - ReadOnlyEndpointFailoverPolicyEnabled ReadOnlyEndpointFailoverPolicy = "Enabled" -) - -// PossibleReadOnlyEndpointFailoverPolicyValues returns an array of possible values for the ReadOnlyEndpointFailoverPolicy const type. -func PossibleReadOnlyEndpointFailoverPolicyValues() []ReadOnlyEndpointFailoverPolicy { - return []ReadOnlyEndpointFailoverPolicy{ReadOnlyEndpointFailoverPolicyDisabled, ReadOnlyEndpointFailoverPolicyEnabled} -} - -// ReadWriteEndpointFailoverPolicy enumerates the values for read write endpoint failover policy. -type ReadWriteEndpointFailoverPolicy string - -const ( - // Automatic ... - Automatic ReadWriteEndpointFailoverPolicy = "Automatic" - // Manual ... - Manual ReadWriteEndpointFailoverPolicy = "Manual" -) - -// PossibleReadWriteEndpointFailoverPolicyValues returns an array of possible values for the ReadWriteEndpointFailoverPolicy const type. -func PossibleReadWriteEndpointFailoverPolicyValues() []ReadWriteEndpointFailoverPolicy { - return []ReadWriteEndpointFailoverPolicy{Automatic, Manual} -} - -// RecommendedIndexAction enumerates the values for recommended index action. -type RecommendedIndexAction string - -const ( - // Create ... - Create RecommendedIndexAction = "Create" - // Drop ... - Drop RecommendedIndexAction = "Drop" - // Rebuild ... - Rebuild RecommendedIndexAction = "Rebuild" -) - -// PossibleRecommendedIndexActionValues returns an array of possible values for the RecommendedIndexAction const type. -func PossibleRecommendedIndexActionValues() []RecommendedIndexAction { - return []RecommendedIndexAction{Create, Drop, Rebuild} -} - -// RecommendedIndexState enumerates the values for recommended index state. -type RecommendedIndexState string - -const ( - // RecommendedIndexStateActive ... - RecommendedIndexStateActive RecommendedIndexState = "Active" - // RecommendedIndexStateBlocked ... - RecommendedIndexStateBlocked RecommendedIndexState = "Blocked" - // RecommendedIndexStateExecuting ... - RecommendedIndexStateExecuting RecommendedIndexState = "Executing" - // RecommendedIndexStateExpired ... - RecommendedIndexStateExpired RecommendedIndexState = "Expired" - // RecommendedIndexStateIgnored ... - RecommendedIndexStateIgnored RecommendedIndexState = "Ignored" - // RecommendedIndexStatePending ... - RecommendedIndexStatePending RecommendedIndexState = "Pending" - // RecommendedIndexStatePendingRevert ... - RecommendedIndexStatePendingRevert RecommendedIndexState = "Pending Revert" - // RecommendedIndexStateReverted ... - RecommendedIndexStateReverted RecommendedIndexState = "Reverted" - // RecommendedIndexStateReverting ... - RecommendedIndexStateReverting RecommendedIndexState = "Reverting" - // RecommendedIndexStateSuccess ... - RecommendedIndexStateSuccess RecommendedIndexState = "Success" - // RecommendedIndexStateVerifying ... - RecommendedIndexStateVerifying RecommendedIndexState = "Verifying" -) - -// PossibleRecommendedIndexStateValues returns an array of possible values for the RecommendedIndexState const type. -func PossibleRecommendedIndexStateValues() []RecommendedIndexState { - return []RecommendedIndexState{RecommendedIndexStateActive, RecommendedIndexStateBlocked, RecommendedIndexStateExecuting, RecommendedIndexStateExpired, RecommendedIndexStateIgnored, RecommendedIndexStatePending, RecommendedIndexStatePendingRevert, RecommendedIndexStateReverted, RecommendedIndexStateReverting, RecommendedIndexStateSuccess, RecommendedIndexStateVerifying} -} - -// RecommendedIndexType enumerates the values for recommended index type. -type RecommendedIndexType string - -const ( - // CLUSTERED ... - CLUSTERED RecommendedIndexType = "CLUSTERED" - // CLUSTEREDCOLUMNSTORE ... - CLUSTEREDCOLUMNSTORE RecommendedIndexType = "CLUSTERED COLUMNSTORE" - // COLUMNSTORE ... - COLUMNSTORE RecommendedIndexType = "COLUMNSTORE" - // NONCLUSTERED ... - NONCLUSTERED RecommendedIndexType = "NONCLUSTERED" -) - -// PossibleRecommendedIndexTypeValues returns an array of possible values for the RecommendedIndexType const type. -func PossibleRecommendedIndexTypeValues() []RecommendedIndexType { - return []RecommendedIndexType{CLUSTERED, CLUSTEREDCOLUMNSTORE, COLUMNSTORE, NONCLUSTERED} -} - -// ReplicationRole enumerates the values for replication role. -type ReplicationRole string - -const ( - // ReplicationRoleCopy ... - ReplicationRoleCopy ReplicationRole = "Copy" - // ReplicationRoleNonReadableSecondary ... - ReplicationRoleNonReadableSecondary ReplicationRole = "NonReadableSecondary" - // ReplicationRolePrimary ... - ReplicationRolePrimary ReplicationRole = "Primary" - // ReplicationRoleSecondary ... - ReplicationRoleSecondary ReplicationRole = "Secondary" - // ReplicationRoleSource ... - ReplicationRoleSource ReplicationRole = "Source" -) - -// PossibleReplicationRoleValues returns an array of possible values for the ReplicationRole const type. -func PossibleReplicationRoleValues() []ReplicationRole { - return []ReplicationRole{ReplicationRoleCopy, ReplicationRoleNonReadableSecondary, ReplicationRolePrimary, ReplicationRoleSecondary, ReplicationRoleSource} -} - -// ReplicationState enumerates the values for replication state. -type ReplicationState string - -const ( - // CATCHUP ... - CATCHUP ReplicationState = "CATCH_UP" - // PENDING ... - PENDING ReplicationState = "PENDING" - // SEEDING ... - SEEDING ReplicationState = "SEEDING" - // SUSPENDED ... - SUSPENDED ReplicationState = "SUSPENDED" -) - -// PossibleReplicationStateValues returns an array of possible values for the ReplicationState const type. -func PossibleReplicationStateValues() []ReplicationState { - return []ReplicationState{CATCHUP, PENDING, SEEDING, SUSPENDED} -} - -// ReplicaType enumerates the values for replica type. -type ReplicaType string - -const ( - // ReplicaTypePrimary ... - ReplicaTypePrimary ReplicaType = "Primary" - // ReplicaTypeReadableSecondary ... - ReplicaTypeReadableSecondary ReplicaType = "ReadableSecondary" -) - -// PossibleReplicaTypeValues returns an array of possible values for the ReplicaType const type. -func PossibleReplicaTypeValues() []ReplicaType { - return []ReplicaType{ReplicaTypePrimary, ReplicaTypeReadableSecondary} -} - -// RestorePointType enumerates the values for restore point type. -type RestorePointType string - -const ( - // CONTINUOUS ... - CONTINUOUS RestorePointType = "CONTINUOUS" - // DISCRETE ... - DISCRETE RestorePointType = "DISCRETE" -) - -// PossibleRestorePointTypeValues returns an array of possible values for the RestorePointType const type. -func PossibleRestorePointTypeValues() []RestorePointType { - return []RestorePointType{CONTINUOUS, DISCRETE} -} - -// SampleName enumerates the values for sample name. -type SampleName string - -const ( - // AdventureWorksLT ... - AdventureWorksLT SampleName = "AdventureWorksLT" - // WideWorldImportersFull ... - WideWorldImportersFull SampleName = "WideWorldImportersFull" - // WideWorldImportersStd ... - WideWorldImportersStd SampleName = "WideWorldImportersStd" -) - -// PossibleSampleNameValues returns an array of possible values for the SampleName const type. -func PossibleSampleNameValues() []SampleName { - return []SampleName{AdventureWorksLT, WideWorldImportersFull, WideWorldImportersStd} -} - -// SecurityAlertPolicyEmailAccountAdmins enumerates the values for security alert policy email account admins. -type SecurityAlertPolicyEmailAccountAdmins string - -const ( - // SecurityAlertPolicyEmailAccountAdminsDisabled ... - SecurityAlertPolicyEmailAccountAdminsDisabled SecurityAlertPolicyEmailAccountAdmins = "Disabled" - // SecurityAlertPolicyEmailAccountAdminsEnabled ... - SecurityAlertPolicyEmailAccountAdminsEnabled SecurityAlertPolicyEmailAccountAdmins = "Enabled" -) - -// PossibleSecurityAlertPolicyEmailAccountAdminsValues returns an array of possible values for the SecurityAlertPolicyEmailAccountAdmins const type. -func PossibleSecurityAlertPolicyEmailAccountAdminsValues() []SecurityAlertPolicyEmailAccountAdmins { - return []SecurityAlertPolicyEmailAccountAdmins{SecurityAlertPolicyEmailAccountAdminsDisabled, SecurityAlertPolicyEmailAccountAdminsEnabled} -} - -// SecurityAlertPolicyState enumerates the values for security alert policy state. -type SecurityAlertPolicyState string - -const ( - // SecurityAlertPolicyStateDisabled ... - SecurityAlertPolicyStateDisabled SecurityAlertPolicyState = "Disabled" - // SecurityAlertPolicyStateEnabled ... - SecurityAlertPolicyStateEnabled SecurityAlertPolicyState = "Enabled" - // SecurityAlertPolicyStateNew ... - SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New" -) - -// PossibleSecurityAlertPolicyStateValues returns an array of possible values for the SecurityAlertPolicyState const type. -func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { - return []SecurityAlertPolicyState{SecurityAlertPolicyStateDisabled, SecurityAlertPolicyStateEnabled, SecurityAlertPolicyStateNew} -} - -// SecurityAlertPolicyUseServerDefault enumerates the values for security alert policy use server default. -type SecurityAlertPolicyUseServerDefault string - -const ( - // SecurityAlertPolicyUseServerDefaultDisabled ... - SecurityAlertPolicyUseServerDefaultDisabled SecurityAlertPolicyUseServerDefault = "Disabled" - // SecurityAlertPolicyUseServerDefaultEnabled ... - SecurityAlertPolicyUseServerDefaultEnabled SecurityAlertPolicyUseServerDefault = "Enabled" -) - -// PossibleSecurityAlertPolicyUseServerDefaultValues returns an array of possible values for the SecurityAlertPolicyUseServerDefault const type. -func PossibleSecurityAlertPolicyUseServerDefaultValues() []SecurityAlertPolicyUseServerDefault { - return []SecurityAlertPolicyUseServerDefault{SecurityAlertPolicyUseServerDefaultDisabled, SecurityAlertPolicyUseServerDefaultEnabled} -} - -// SensitivityLabelRank enumerates the values for sensitivity label rank. -type SensitivityLabelRank string - -const ( - // SensitivityLabelRankCritical ... - SensitivityLabelRankCritical SensitivityLabelRank = "Critical" - // SensitivityLabelRankHigh ... - SensitivityLabelRankHigh SensitivityLabelRank = "High" - // SensitivityLabelRankLow ... - SensitivityLabelRankLow SensitivityLabelRank = "Low" - // SensitivityLabelRankMedium ... - SensitivityLabelRankMedium SensitivityLabelRank = "Medium" - // SensitivityLabelRankNone ... - SensitivityLabelRankNone SensitivityLabelRank = "None" -) - -// PossibleSensitivityLabelRankValues returns an array of possible values for the SensitivityLabelRank const type. -func PossibleSensitivityLabelRankValues() []SensitivityLabelRank { - return []SensitivityLabelRank{SensitivityLabelRankCritical, SensitivityLabelRankHigh, SensitivityLabelRankLow, SensitivityLabelRankMedium, SensitivityLabelRankNone} -} - -// SensitivityLabelSource enumerates the values for sensitivity label source. -type SensitivityLabelSource string - -const ( - // Current ... - Current SensitivityLabelSource = "current" - // Recommended ... - Recommended SensitivityLabelSource = "recommended" -) - -// PossibleSensitivityLabelSourceValues returns an array of possible values for the SensitivityLabelSource const type. -func PossibleSensitivityLabelSourceValues() []SensitivityLabelSource { - return []SensitivityLabelSource{Current, Recommended} -} - -// ServerConnectionType enumerates the values for server connection type. -type ServerConnectionType string - -const ( - // ServerConnectionTypeDefault ... - ServerConnectionTypeDefault ServerConnectionType = "Default" - // ServerConnectionTypeProxy ... - ServerConnectionTypeProxy ServerConnectionType = "Proxy" - // ServerConnectionTypeRedirect ... - ServerConnectionTypeRedirect ServerConnectionType = "Redirect" -) - -// PossibleServerConnectionTypeValues returns an array of possible values for the ServerConnectionType const type. -func PossibleServerConnectionTypeValues() []ServerConnectionType { - return []ServerConnectionType{ServerConnectionTypeDefault, ServerConnectionTypeProxy, ServerConnectionTypeRedirect} -} - -// ServerKeyType enumerates the values for server key type. -type ServerKeyType string - -const ( - // AzureKeyVault ... - AzureKeyVault ServerKeyType = "AzureKeyVault" - // ServiceManaged ... - ServiceManaged ServerKeyType = "ServiceManaged" -) - -// PossibleServerKeyTypeValues returns an array of possible values for the ServerKeyType const type. -func PossibleServerKeyTypeValues() []ServerKeyType { - return []ServerKeyType{AzureKeyVault, ServiceManaged} -} - -// ServerPublicNetworkAccess enumerates the values for server public network access. -type ServerPublicNetworkAccess string - -const ( - // ServerPublicNetworkAccessDisabled ... - ServerPublicNetworkAccessDisabled ServerPublicNetworkAccess = "Disabled" - // ServerPublicNetworkAccessEnabled ... - ServerPublicNetworkAccessEnabled ServerPublicNetworkAccess = "Enabled" -) - -// PossibleServerPublicNetworkAccessValues returns an array of possible values for the ServerPublicNetworkAccess const type. -func PossibleServerPublicNetworkAccessValues() []ServerPublicNetworkAccess { - return []ServerPublicNetworkAccess{ServerPublicNetworkAccessDisabled, ServerPublicNetworkAccessEnabled} -} - -// ServiceObjectiveName enumerates the values for service objective name. -type ServiceObjectiveName string - -const ( - // ServiceObjectiveNameBasic ... - ServiceObjectiveNameBasic ServiceObjectiveName = "Basic" - // ServiceObjectiveNameDS100 ... - ServiceObjectiveNameDS100 ServiceObjectiveName = "DS100" - // ServiceObjectiveNameDS1000 ... - ServiceObjectiveNameDS1000 ServiceObjectiveName = "DS1000" - // ServiceObjectiveNameDS1200 ... - ServiceObjectiveNameDS1200 ServiceObjectiveName = "DS1200" - // ServiceObjectiveNameDS1500 ... - ServiceObjectiveNameDS1500 ServiceObjectiveName = "DS1500" - // ServiceObjectiveNameDS200 ... - ServiceObjectiveNameDS200 ServiceObjectiveName = "DS200" - // ServiceObjectiveNameDS2000 ... - ServiceObjectiveNameDS2000 ServiceObjectiveName = "DS2000" - // ServiceObjectiveNameDS300 ... - ServiceObjectiveNameDS300 ServiceObjectiveName = "DS300" - // ServiceObjectiveNameDS400 ... - ServiceObjectiveNameDS400 ServiceObjectiveName = "DS400" - // ServiceObjectiveNameDS500 ... - ServiceObjectiveNameDS500 ServiceObjectiveName = "DS500" - // ServiceObjectiveNameDS600 ... - ServiceObjectiveNameDS600 ServiceObjectiveName = "DS600" - // ServiceObjectiveNameDW100 ... - ServiceObjectiveNameDW100 ServiceObjectiveName = "DW100" - // ServiceObjectiveNameDW1000 ... - ServiceObjectiveNameDW1000 ServiceObjectiveName = "DW1000" - // ServiceObjectiveNameDW10000c ... - ServiceObjectiveNameDW10000c ServiceObjectiveName = "DW10000c" - // ServiceObjectiveNameDW1000c ... - ServiceObjectiveNameDW1000c ServiceObjectiveName = "DW1000c" - // ServiceObjectiveNameDW1200 ... - ServiceObjectiveNameDW1200 ServiceObjectiveName = "DW1200" - // ServiceObjectiveNameDW1500 ... - ServiceObjectiveNameDW1500 ServiceObjectiveName = "DW1500" - // ServiceObjectiveNameDW15000c ... - ServiceObjectiveNameDW15000c ServiceObjectiveName = "DW15000c" - // ServiceObjectiveNameDW1500c ... - ServiceObjectiveNameDW1500c ServiceObjectiveName = "DW1500c" - // ServiceObjectiveNameDW200 ... - ServiceObjectiveNameDW200 ServiceObjectiveName = "DW200" - // ServiceObjectiveNameDW2000 ... - ServiceObjectiveNameDW2000 ServiceObjectiveName = "DW2000" - // ServiceObjectiveNameDW2000c ... - ServiceObjectiveNameDW2000c ServiceObjectiveName = "DW2000c" - // ServiceObjectiveNameDW2500c ... - ServiceObjectiveNameDW2500c ServiceObjectiveName = "DW2500c" - // ServiceObjectiveNameDW300 ... - ServiceObjectiveNameDW300 ServiceObjectiveName = "DW300" - // ServiceObjectiveNameDW3000 ... - ServiceObjectiveNameDW3000 ServiceObjectiveName = "DW3000" - // ServiceObjectiveNameDW30000c ... - ServiceObjectiveNameDW30000c ServiceObjectiveName = "DW30000c" - // ServiceObjectiveNameDW3000c ... - ServiceObjectiveNameDW3000c ServiceObjectiveName = "DW3000c" - // ServiceObjectiveNameDW400 ... - ServiceObjectiveNameDW400 ServiceObjectiveName = "DW400" - // ServiceObjectiveNameDW500 ... - ServiceObjectiveNameDW500 ServiceObjectiveName = "DW500" - // ServiceObjectiveNameDW5000c ... - ServiceObjectiveNameDW5000c ServiceObjectiveName = "DW5000c" - // ServiceObjectiveNameDW600 ... - ServiceObjectiveNameDW600 ServiceObjectiveName = "DW600" - // ServiceObjectiveNameDW6000 ... - ServiceObjectiveNameDW6000 ServiceObjectiveName = "DW6000" - // ServiceObjectiveNameDW6000c ... - ServiceObjectiveNameDW6000c ServiceObjectiveName = "DW6000c" - // ServiceObjectiveNameDW7500c ... - ServiceObjectiveNameDW7500c ServiceObjectiveName = "DW7500c" - // ServiceObjectiveNameElasticPool ... - ServiceObjectiveNameElasticPool ServiceObjectiveName = "ElasticPool" - // ServiceObjectiveNameFree ... - ServiceObjectiveNameFree ServiceObjectiveName = "Free" - // ServiceObjectiveNameP1 ... - ServiceObjectiveNameP1 ServiceObjectiveName = "P1" - // ServiceObjectiveNameP11 ... - ServiceObjectiveNameP11 ServiceObjectiveName = "P11" - // ServiceObjectiveNameP15 ... - ServiceObjectiveNameP15 ServiceObjectiveName = "P15" - // ServiceObjectiveNameP2 ... - ServiceObjectiveNameP2 ServiceObjectiveName = "P2" - // ServiceObjectiveNameP3 ... - ServiceObjectiveNameP3 ServiceObjectiveName = "P3" - // ServiceObjectiveNameP4 ... - ServiceObjectiveNameP4 ServiceObjectiveName = "P4" - // ServiceObjectiveNameP6 ... - ServiceObjectiveNameP6 ServiceObjectiveName = "P6" - // ServiceObjectiveNamePRS1 ... - ServiceObjectiveNamePRS1 ServiceObjectiveName = "PRS1" - // ServiceObjectiveNamePRS2 ... - ServiceObjectiveNamePRS2 ServiceObjectiveName = "PRS2" - // ServiceObjectiveNamePRS4 ... - ServiceObjectiveNamePRS4 ServiceObjectiveName = "PRS4" - // ServiceObjectiveNamePRS6 ... - ServiceObjectiveNamePRS6 ServiceObjectiveName = "PRS6" - // ServiceObjectiveNameS0 ... - ServiceObjectiveNameS0 ServiceObjectiveName = "S0" - // ServiceObjectiveNameS1 ... - ServiceObjectiveNameS1 ServiceObjectiveName = "S1" - // ServiceObjectiveNameS12 ... - ServiceObjectiveNameS12 ServiceObjectiveName = "S12" - // ServiceObjectiveNameS2 ... - ServiceObjectiveNameS2 ServiceObjectiveName = "S2" - // ServiceObjectiveNameS3 ... - ServiceObjectiveNameS3 ServiceObjectiveName = "S3" - // ServiceObjectiveNameS4 ... - ServiceObjectiveNameS4 ServiceObjectiveName = "S4" - // ServiceObjectiveNameS6 ... - ServiceObjectiveNameS6 ServiceObjectiveName = "S6" - // ServiceObjectiveNameS7 ... - ServiceObjectiveNameS7 ServiceObjectiveName = "S7" - // ServiceObjectiveNameS9 ... - ServiceObjectiveNameS9 ServiceObjectiveName = "S9" - // ServiceObjectiveNameSystem ... - ServiceObjectiveNameSystem ServiceObjectiveName = "System" - // ServiceObjectiveNameSystem0 ... - ServiceObjectiveNameSystem0 ServiceObjectiveName = "System0" - // ServiceObjectiveNameSystem1 ... - ServiceObjectiveNameSystem1 ServiceObjectiveName = "System1" - // ServiceObjectiveNameSystem2 ... - ServiceObjectiveNameSystem2 ServiceObjectiveName = "System2" - // ServiceObjectiveNameSystem2L ... - ServiceObjectiveNameSystem2L ServiceObjectiveName = "System2L" - // ServiceObjectiveNameSystem3 ... - ServiceObjectiveNameSystem3 ServiceObjectiveName = "System3" - // ServiceObjectiveNameSystem3L ... - ServiceObjectiveNameSystem3L ServiceObjectiveName = "System3L" - // ServiceObjectiveNameSystem4 ... - ServiceObjectiveNameSystem4 ServiceObjectiveName = "System4" - // ServiceObjectiveNameSystem4L ... - ServiceObjectiveNameSystem4L ServiceObjectiveName = "System4L" -) - -// PossibleServiceObjectiveNameValues returns an array of possible values for the ServiceObjectiveName const type. -func PossibleServiceObjectiveNameValues() []ServiceObjectiveName { - return []ServiceObjectiveName{ServiceObjectiveNameBasic, ServiceObjectiveNameDS100, ServiceObjectiveNameDS1000, ServiceObjectiveNameDS1200, ServiceObjectiveNameDS1500, ServiceObjectiveNameDS200, ServiceObjectiveNameDS2000, ServiceObjectiveNameDS300, ServiceObjectiveNameDS400, ServiceObjectiveNameDS500, ServiceObjectiveNameDS600, ServiceObjectiveNameDW100, ServiceObjectiveNameDW1000, ServiceObjectiveNameDW10000c, ServiceObjectiveNameDW1000c, ServiceObjectiveNameDW1200, ServiceObjectiveNameDW1500, ServiceObjectiveNameDW15000c, ServiceObjectiveNameDW1500c, ServiceObjectiveNameDW200, ServiceObjectiveNameDW2000, ServiceObjectiveNameDW2000c, ServiceObjectiveNameDW2500c, ServiceObjectiveNameDW300, ServiceObjectiveNameDW3000, ServiceObjectiveNameDW30000c, ServiceObjectiveNameDW3000c, ServiceObjectiveNameDW400, ServiceObjectiveNameDW500, ServiceObjectiveNameDW5000c, ServiceObjectiveNameDW600, ServiceObjectiveNameDW6000, ServiceObjectiveNameDW6000c, ServiceObjectiveNameDW7500c, ServiceObjectiveNameElasticPool, ServiceObjectiveNameFree, ServiceObjectiveNameP1, ServiceObjectiveNameP11, ServiceObjectiveNameP15, ServiceObjectiveNameP2, ServiceObjectiveNameP3, ServiceObjectiveNameP4, ServiceObjectiveNameP6, ServiceObjectiveNamePRS1, ServiceObjectiveNamePRS2, ServiceObjectiveNamePRS4, ServiceObjectiveNamePRS6, ServiceObjectiveNameS0, ServiceObjectiveNameS1, ServiceObjectiveNameS12, ServiceObjectiveNameS2, ServiceObjectiveNameS3, ServiceObjectiveNameS4, ServiceObjectiveNameS6, ServiceObjectiveNameS7, ServiceObjectiveNameS9, ServiceObjectiveNameSystem, ServiceObjectiveNameSystem0, ServiceObjectiveNameSystem1, ServiceObjectiveNameSystem2, ServiceObjectiveNameSystem2L, ServiceObjectiveNameSystem3, ServiceObjectiveNameSystem3L, ServiceObjectiveNameSystem4, ServiceObjectiveNameSystem4L} -} - -// Status enumerates the values for status. -type Status string - -const ( - // StatusCanceled ... - StatusCanceled Status = "Canceled" - // StatusCompleted ... - StatusCompleted Status = "Completed" - // StatusFailed ... - StatusFailed Status = "Failed" - // StatusInProgress ... - StatusInProgress Status = "InProgress" - // StatusNotStarted ... - StatusNotStarted Status = "NotStarted" - // StatusSlowedDown ... - StatusSlowedDown Status = "SlowedDown" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{StatusCanceled, StatusCompleted, StatusFailed, StatusInProgress, StatusNotStarted, StatusSlowedDown} -} - -// StorageAccountType enumerates the values for storage account type. -type StorageAccountType string - -const ( - // GRS ... - GRS StorageAccountType = "GRS" - // LRS ... - LRS StorageAccountType = "LRS" - // ZRS ... - ZRS StorageAccountType = "ZRS" -) - -// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. -func PossibleStorageAccountTypeValues() []StorageAccountType { - return []StorageAccountType{GRS, LRS, ZRS} -} - -// StorageAccountType1 enumerates the values for storage account type 1. -type StorageAccountType1 string - -const ( - // StorageAccountType1GRS ... - StorageAccountType1GRS StorageAccountType1 = "GRS" - // StorageAccountType1LRS ... - StorageAccountType1LRS StorageAccountType1 = "LRS" - // StorageAccountType1ZRS ... - StorageAccountType1ZRS StorageAccountType1 = "ZRS" -) - -// PossibleStorageAccountType1Values returns an array of possible values for the StorageAccountType1 const type. -func PossibleStorageAccountType1Values() []StorageAccountType1 { - return []StorageAccountType1{StorageAccountType1GRS, StorageAccountType1LRS, StorageAccountType1ZRS} -} - -// StorageKeyType enumerates the values for storage key type. -type StorageKeyType string - -const ( - // SharedAccessKey ... - SharedAccessKey StorageKeyType = "SharedAccessKey" - // StorageAccessKey ... - StorageAccessKey StorageKeyType = "StorageAccessKey" -) - -// PossibleStorageKeyTypeValues returns an array of possible values for the StorageKeyType const type. -func PossibleStorageKeyTypeValues() []StorageKeyType { - return []StorageKeyType{SharedAccessKey, StorageAccessKey} -} - -// SyncAgentState enumerates the values for sync agent state. -type SyncAgentState string - -const ( - // SyncAgentStateNeverConnected ... - SyncAgentStateNeverConnected SyncAgentState = "NeverConnected" - // SyncAgentStateOffline ... - SyncAgentStateOffline SyncAgentState = "Offline" - // SyncAgentStateOnline ... - SyncAgentStateOnline SyncAgentState = "Online" -) - -// PossibleSyncAgentStateValues returns an array of possible values for the SyncAgentState const type. -func PossibleSyncAgentStateValues() []SyncAgentState { - return []SyncAgentState{SyncAgentStateNeverConnected, SyncAgentStateOffline, SyncAgentStateOnline} -} - -// SyncConflictResolutionPolicy enumerates the values for sync conflict resolution policy. -type SyncConflictResolutionPolicy string - -const ( - // HubWin ... - HubWin SyncConflictResolutionPolicy = "HubWin" - // MemberWin ... - MemberWin SyncConflictResolutionPolicy = "MemberWin" -) - -// PossibleSyncConflictResolutionPolicyValues returns an array of possible values for the SyncConflictResolutionPolicy const type. -func PossibleSyncConflictResolutionPolicyValues() []SyncConflictResolutionPolicy { - return []SyncConflictResolutionPolicy{HubWin, MemberWin} -} - -// SyncDirection enumerates the values for sync direction. -type SyncDirection string - -const ( - // Bidirectional ... - Bidirectional SyncDirection = "Bidirectional" - // OneWayHubToMember ... - OneWayHubToMember SyncDirection = "OneWayHubToMember" - // OneWayMemberToHub ... - OneWayMemberToHub SyncDirection = "OneWayMemberToHub" -) - -// PossibleSyncDirectionValues returns an array of possible values for the SyncDirection const type. -func PossibleSyncDirectionValues() []SyncDirection { - return []SyncDirection{Bidirectional, OneWayHubToMember, OneWayMemberToHub} -} - -// SyncGroupLogType enumerates the values for sync group log type. -type SyncGroupLogType string - -const ( - // SyncGroupLogTypeAll ... - SyncGroupLogTypeAll SyncGroupLogType = "All" - // SyncGroupLogTypeError ... - SyncGroupLogTypeError SyncGroupLogType = "Error" - // SyncGroupLogTypeSuccess ... - SyncGroupLogTypeSuccess SyncGroupLogType = "Success" - // SyncGroupLogTypeWarning ... - SyncGroupLogTypeWarning SyncGroupLogType = "Warning" -) - -// PossibleSyncGroupLogTypeValues returns an array of possible values for the SyncGroupLogType const type. -func PossibleSyncGroupLogTypeValues() []SyncGroupLogType { - return []SyncGroupLogType{SyncGroupLogTypeAll, SyncGroupLogTypeError, SyncGroupLogTypeSuccess, SyncGroupLogTypeWarning} -} - -// SyncGroupState enumerates the values for sync group state. -type SyncGroupState string - -const ( - // Error ... - Error SyncGroupState = "Error" - // Good ... - Good SyncGroupState = "Good" - // NotReady ... - NotReady SyncGroupState = "NotReady" - // Progressing ... - Progressing SyncGroupState = "Progressing" - // Warning ... - Warning SyncGroupState = "Warning" -) - -// PossibleSyncGroupStateValues returns an array of possible values for the SyncGroupState const type. -func PossibleSyncGroupStateValues() []SyncGroupState { - return []SyncGroupState{Error, Good, NotReady, Progressing, Warning} -} - -// SyncMemberDbType enumerates the values for sync member db type. -type SyncMemberDbType string - -const ( - // AzureSQLDatabase ... - AzureSQLDatabase SyncMemberDbType = "AzureSqlDatabase" - // SQLServerDatabase ... - SQLServerDatabase SyncMemberDbType = "SqlServerDatabase" -) - -// PossibleSyncMemberDbTypeValues returns an array of possible values for the SyncMemberDbType const type. -func PossibleSyncMemberDbTypeValues() []SyncMemberDbType { - return []SyncMemberDbType{AzureSQLDatabase, SQLServerDatabase} -} - -// SyncMemberState enumerates the values for sync member state. -type SyncMemberState string - -const ( - // DeProvisioned ... - DeProvisioned SyncMemberState = "DeProvisioned" - // DeProvisionFailed ... - DeProvisionFailed SyncMemberState = "DeProvisionFailed" - // DeProvisioning ... - DeProvisioning SyncMemberState = "DeProvisioning" - // DisabledBackupRestore ... - DisabledBackupRestore SyncMemberState = "DisabledBackupRestore" - // DisabledTombstoneCleanup ... - DisabledTombstoneCleanup SyncMemberState = "DisabledTombstoneCleanup" - // Provisioned ... - Provisioned SyncMemberState = "Provisioned" - // ProvisionFailed ... - ProvisionFailed SyncMemberState = "ProvisionFailed" - // Provisioning ... - Provisioning SyncMemberState = "Provisioning" - // ReprovisionFailed ... - ReprovisionFailed SyncMemberState = "ReprovisionFailed" - // Reprovisioning ... - Reprovisioning SyncMemberState = "Reprovisioning" - // SyncCancelled ... - SyncCancelled SyncMemberState = "SyncCancelled" - // SyncCancelling ... - SyncCancelling SyncMemberState = "SyncCancelling" - // SyncFailed ... - SyncFailed SyncMemberState = "SyncFailed" - // SyncInProgress ... - SyncInProgress SyncMemberState = "SyncInProgress" - // SyncSucceeded ... - SyncSucceeded SyncMemberState = "SyncSucceeded" - // SyncSucceededWithWarnings ... - SyncSucceededWithWarnings SyncMemberState = "SyncSucceededWithWarnings" - // UnProvisioned ... - UnProvisioned SyncMemberState = "UnProvisioned" - // UnReprovisioned ... - UnReprovisioned SyncMemberState = "UnReprovisioned" -) - -// PossibleSyncMemberStateValues returns an array of possible values for the SyncMemberState const type. -func PossibleSyncMemberStateValues() []SyncMemberState { - return []SyncMemberState{DeProvisioned, DeProvisionFailed, DeProvisioning, DisabledBackupRestore, DisabledTombstoneCleanup, Provisioned, ProvisionFailed, Provisioning, ReprovisionFailed, Reprovisioning, SyncCancelled, SyncCancelling, SyncFailed, SyncInProgress, SyncSucceeded, SyncSucceededWithWarnings, UnProvisioned, UnReprovisioned} -} - -// TransparentDataEncryptionActivityStatus enumerates the values for transparent data encryption activity -// status. -type TransparentDataEncryptionActivityStatus string - -const ( - // Decrypting ... - Decrypting TransparentDataEncryptionActivityStatus = "Decrypting" - // Encrypting ... - Encrypting TransparentDataEncryptionActivityStatus = "Encrypting" -) - -// PossibleTransparentDataEncryptionActivityStatusValues returns an array of possible values for the TransparentDataEncryptionActivityStatus const type. -func PossibleTransparentDataEncryptionActivityStatusValues() []TransparentDataEncryptionActivityStatus { - return []TransparentDataEncryptionActivityStatus{Decrypting, Encrypting} -} - -// TransparentDataEncryptionStatus enumerates the values for transparent data encryption status. -type TransparentDataEncryptionStatus string - -const ( - // TransparentDataEncryptionStatusDisabled ... - TransparentDataEncryptionStatusDisabled TransparentDataEncryptionStatus = "Disabled" - // TransparentDataEncryptionStatusEnabled ... - TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = "Enabled" -) - -// PossibleTransparentDataEncryptionStatusValues returns an array of possible values for the TransparentDataEncryptionStatus const type. -func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryptionStatus { - return []TransparentDataEncryptionStatus{TransparentDataEncryptionStatusDisabled, TransparentDataEncryptionStatusEnabled} -} - -// UnitDefinitionType enumerates the values for unit definition type. -type UnitDefinitionType string - -const ( - // UnitDefinitionTypeBytes ... - UnitDefinitionTypeBytes UnitDefinitionType = "Bytes" - // UnitDefinitionTypeBytesPerSecond ... - UnitDefinitionTypeBytesPerSecond UnitDefinitionType = "BytesPerSecond" - // UnitDefinitionTypeCount ... - UnitDefinitionTypeCount UnitDefinitionType = "Count" - // UnitDefinitionTypeCountPerSecond ... - UnitDefinitionTypeCountPerSecond UnitDefinitionType = "CountPerSecond" - // UnitDefinitionTypePercent ... - UnitDefinitionTypePercent UnitDefinitionType = "Percent" - // UnitDefinitionTypeSeconds ... - UnitDefinitionTypeSeconds UnitDefinitionType = "Seconds" -) - -// PossibleUnitDefinitionTypeValues returns an array of possible values for the UnitDefinitionType const type. -func PossibleUnitDefinitionTypeValues() []UnitDefinitionType { - return []UnitDefinitionType{UnitDefinitionTypeBytes, UnitDefinitionTypeBytesPerSecond, UnitDefinitionTypeCount, UnitDefinitionTypeCountPerSecond, UnitDefinitionTypePercent, UnitDefinitionTypeSeconds} -} - -// UnitType enumerates the values for unit type. -type UnitType string - -const ( - // UnitTypeBytes ... - UnitTypeBytes UnitType = "bytes" - // UnitTypeBytesPerSecond ... - UnitTypeBytesPerSecond UnitType = "bytesPerSecond" - // UnitTypeCount ... - UnitTypeCount UnitType = "count" - // UnitTypeCountPerSecond ... - UnitTypeCountPerSecond UnitType = "countPerSecond" - // UnitTypePercent ... - UnitTypePercent UnitType = "percent" - // UnitTypeSeconds ... - UnitTypeSeconds UnitType = "seconds" -) - -// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{UnitTypeBytes, UnitTypeBytesPerSecond, UnitTypeCount, UnitTypeCountPerSecond, UnitTypePercent, UnitTypeSeconds} -} - -// VirtualNetworkRuleState enumerates the values for virtual network rule state. -type VirtualNetworkRuleState string - -const ( - // VirtualNetworkRuleStateDeleting ... - VirtualNetworkRuleStateDeleting VirtualNetworkRuleState = "Deleting" - // VirtualNetworkRuleStateInitializing ... - VirtualNetworkRuleStateInitializing VirtualNetworkRuleState = "Initializing" - // VirtualNetworkRuleStateInProgress ... - VirtualNetworkRuleStateInProgress VirtualNetworkRuleState = "InProgress" - // VirtualNetworkRuleStateReady ... - VirtualNetworkRuleStateReady VirtualNetworkRuleState = "Ready" - // VirtualNetworkRuleStateUnknown ... - VirtualNetworkRuleStateUnknown VirtualNetworkRuleState = "Unknown" -) - -// PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type. -func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { - return []VirtualNetworkRuleState{VirtualNetworkRuleStateDeleting, VirtualNetworkRuleStateInitializing, VirtualNetworkRuleStateInProgress, VirtualNetworkRuleStateReady, VirtualNetworkRuleStateUnknown} -} - -// VulnerabilityAssessmentPolicyBaselineName enumerates the values for vulnerability assessment policy baseline -// name. -type VulnerabilityAssessmentPolicyBaselineName string - -const ( - // VulnerabilityAssessmentPolicyBaselineNameDefault ... - VulnerabilityAssessmentPolicyBaselineNameDefault VulnerabilityAssessmentPolicyBaselineName = "default" - // VulnerabilityAssessmentPolicyBaselineNameMaster ... - VulnerabilityAssessmentPolicyBaselineNameMaster VulnerabilityAssessmentPolicyBaselineName = "master" -) - -// PossibleVulnerabilityAssessmentPolicyBaselineNameValues returns an array of possible values for the VulnerabilityAssessmentPolicyBaselineName const type. -func PossibleVulnerabilityAssessmentPolicyBaselineNameValues() []VulnerabilityAssessmentPolicyBaselineName { - return []VulnerabilityAssessmentPolicyBaselineName{VulnerabilityAssessmentPolicyBaselineNameDefault, VulnerabilityAssessmentPolicyBaselineNameMaster} -} - -// VulnerabilityAssessmentScanState enumerates the values for vulnerability assessment scan state. -type VulnerabilityAssessmentScanState string - -const ( - // VulnerabilityAssessmentScanStateFailed ... - VulnerabilityAssessmentScanStateFailed VulnerabilityAssessmentScanState = "Failed" - // VulnerabilityAssessmentScanStateFailedToRun ... - VulnerabilityAssessmentScanStateFailedToRun VulnerabilityAssessmentScanState = "FailedToRun" - // VulnerabilityAssessmentScanStateInProgress ... - VulnerabilityAssessmentScanStateInProgress VulnerabilityAssessmentScanState = "InProgress" - // VulnerabilityAssessmentScanStatePassed ... - VulnerabilityAssessmentScanStatePassed VulnerabilityAssessmentScanState = "Passed" -) - -// PossibleVulnerabilityAssessmentScanStateValues returns an array of possible values for the VulnerabilityAssessmentScanState const type. -func PossibleVulnerabilityAssessmentScanStateValues() []VulnerabilityAssessmentScanState { - return []VulnerabilityAssessmentScanState{VulnerabilityAssessmentScanStateFailed, VulnerabilityAssessmentScanStateFailedToRun, VulnerabilityAssessmentScanStateInProgress, VulnerabilityAssessmentScanStatePassed} -} - -// VulnerabilityAssessmentScanTriggerType enumerates the values for vulnerability assessment scan trigger type. -type VulnerabilityAssessmentScanTriggerType string - -const ( - // VulnerabilityAssessmentScanTriggerTypeOnDemand ... - VulnerabilityAssessmentScanTriggerTypeOnDemand VulnerabilityAssessmentScanTriggerType = "OnDemand" - // VulnerabilityAssessmentScanTriggerTypeRecurring ... - VulnerabilityAssessmentScanTriggerTypeRecurring VulnerabilityAssessmentScanTriggerType = "Recurring" -) - -// PossibleVulnerabilityAssessmentScanTriggerTypeValues returns an array of possible values for the VulnerabilityAssessmentScanTriggerType const type. -func PossibleVulnerabilityAssessmentScanTriggerTypeValues() []VulnerabilityAssessmentScanTriggerType { - return []VulnerabilityAssessmentScanTriggerType{VulnerabilityAssessmentScanTriggerTypeOnDemand, VulnerabilityAssessmentScanTriggerTypeRecurring} -} diff --git a/services/preview/sql/mgmt/v3.0/sql/extendeddatabaseblobauditingpolicies.go b/services/preview/sql/mgmt/v3.0/sql/extendeddatabaseblobauditingpolicies.go deleted file mode 100644 index 690f3cf08d06..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/extendeddatabaseblobauditingpolicies.go +++ /dev/null @@ -1,319 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ExtendedDatabaseBlobAuditingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of -// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ExtendedDatabaseBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewExtendedDatabaseBlobAuditingPoliciesClient creates an instance of the ExtendedDatabaseBlobAuditingPoliciesClient -// client. -func NewExtendedDatabaseBlobAuditingPoliciesClient(subscriptionID string) ExtendedDatabaseBlobAuditingPoliciesClient { - return NewExtendedDatabaseBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExtendedDatabaseBlobAuditingPoliciesClientWithBaseURI creates an instance of the -// ExtendedDatabaseBlobAuditingPoliciesClient 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 NewExtendedDatabaseBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ExtendedDatabaseBlobAuditingPoliciesClient { - return ExtendedDatabaseBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an extended database's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the extended database blob auditing policy. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExtendedDatabaseBlobAuditingPolicy) (result ExtendedDatabaseBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPoliciesClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExtendedDatabaseBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 ExtendedDatabaseBlobAuditingPoliciesClient) 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 ExtendedDatabaseBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ExtendedDatabaseBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets an extended database's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ExtendedDatabaseBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 ExtendedDatabaseBlobAuditingPoliciesClient) 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 ExtendedDatabaseBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result ExtendedDatabaseBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists extended auditing settings of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ExtendedDatabaseBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.edbaplr.Response.Response != nil { - sc = result.edbaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.edbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.edbaplr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.edbaplr.hasNextLink() && result.edbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result ExtendedDatabaseBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) listByDatabaseNextResults(ctx context.Context, lastResults ExtendedDatabaseBlobAuditingPolicyListResult) (result ExtendedDatabaseBlobAuditingPolicyListResult, err error) { - req, err := lastResults.extendedDatabaseBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedDatabaseBlobAuditingPoliciesClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExtendedDatabaseBlobAuditingPoliciesClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ExtendedDatabaseBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPoliciesClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/extendedserverblobauditingpolicies.go b/services/preview/sql/mgmt/v3.0/sql/extendedserverblobauditingpolicies.go deleted file mode 100644 index a906dae47a88..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/extendedserverblobauditingpolicies.go +++ /dev/null @@ -1,316 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ExtendedServerBlobAuditingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ExtendedServerBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewExtendedServerBlobAuditingPoliciesClient creates an instance of the ExtendedServerBlobAuditingPoliciesClient -// client. -func NewExtendedServerBlobAuditingPoliciesClient(subscriptionID string) ExtendedServerBlobAuditingPoliciesClient { - return NewExtendedServerBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExtendedServerBlobAuditingPoliciesClientWithBaseURI creates an instance of the -// ExtendedServerBlobAuditingPoliciesClient 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 NewExtendedServerBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ExtendedServerBlobAuditingPoliciesClient { - return ExtendedServerBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an extended server's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - properties of extended blob auditing policy -func (client ExtendedServerBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ExtendedServerBlobAuditingPolicy) (result ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExtendedServerBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ExtendedServerBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 ExtendedServerBlobAuditingPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture, 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 ExtendedServerBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ExtendedServerBlobAuditingPolicy, 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 extended server's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ExtendedServerBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ExtendedServerBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPoliciesClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExtendedServerBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 ExtendedServerBlobAuditingPoliciesClient) 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 ExtendedServerBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result ExtendedServerBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer lists extended auditing settings of a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ExtendedServerBlobAuditingPoliciesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ExtendedServerBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPoliciesClient.ListByServer") - defer func() { - sc := -1 - if result.esbaplr.Response.Response != nil { - sc = result.esbaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.esbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.esbaplr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.esbaplr.hasNextLink() && result.esbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ExtendedServerBlobAuditingPoliciesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/extendedAuditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ExtendedServerBlobAuditingPoliciesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ExtendedServerBlobAuditingPoliciesClient) ListByServerResponder(resp *http.Response) (result ExtendedServerBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ExtendedServerBlobAuditingPoliciesClient) listByServerNextResults(ctx context.Context, lastResults ExtendedServerBlobAuditingPolicyListResult) (result ExtendedServerBlobAuditingPolicyListResult, err error) { - req, err := lastResults.extendedServerBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExtendedServerBlobAuditingPoliciesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ExtendedServerBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPoliciesClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/failovergroups.go b/services/preview/sql/mgmt/v3.0/sql/failovergroups.go deleted file mode 100644 index bab986e12e9e..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/failovergroups.go +++ /dev/null @@ -1,658 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// FailoverGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type FailoverGroupsClient struct { - BaseClient -} - -// NewFailoverGroupsClient creates an instance of the FailoverGroupsClient client. -func NewFailoverGroupsClient(subscriptionID string) FailoverGroupsClient { - return NewFailoverGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFailoverGroupsClientWithBaseURI creates an instance of the FailoverGroupsClient 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 NewFailoverGroupsClientWithBaseURI(baseURI string, subscriptionID string) FailoverGroupsClient { - return FailoverGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -// parameters - the failover group parameters. -func (client FailoverGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroup) (result FailoverGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FailoverGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.FailoverGroupProperties.ReadWriteEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FailoverGroupProperties.PartnerServers", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.FailoverGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, failoverGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FailoverGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = 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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", 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 FailoverGroupsClient) CreateOrUpdateSender(req *http.Request) (future FailoverGroupsCreateOrUpdateFuture, 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 FailoverGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result FailoverGroup, 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 a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -func (client FailoverGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FailoverGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", 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 FailoverGroupsClient) DeleteSender(req *http.Request) (future FailoverGroupsDeleteFuture, 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 FailoverGroupsClient) 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 -} - -// Failover fails over from the current primary server to this server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -func (client FailoverGroupsClient) Failover(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.Failover") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client FailoverGroupsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client FailoverGroupsClient) FailoverSender(req *http.Request) (future FailoverGroupsFailoverFuture, 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 -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client FailoverGroupsClient) FailoverResponder(resp *http.Response) (result FailoverGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ForceFailoverAllowDataLoss fails over from the current primary server to this server. This operation might result in -// data loss. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -func (client FailoverGroupsClient) ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroupsForceFailoverAllowDataLossFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.ForceFailoverAllowDataLoss") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ForceFailoverAllowDataLossPreparer(ctx, resourceGroupName, serverName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ForceFailoverAllowDataLoss", nil, "Failure preparing request") - return - } - - result, err = client.ForceFailoverAllowDataLossSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ForceFailoverAllowDataLoss", result.Response(), "Failure sending request") - return - } - - return -} - -// ForceFailoverAllowDataLossPreparer prepares the ForceFailoverAllowDataLoss request. -func (client FailoverGroupsClient) ForceFailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ForceFailoverAllowDataLossSender sends the ForceFailoverAllowDataLoss request. The method will close the -// http.Response Body if it receives an error. -func (client FailoverGroupsClient) ForceFailoverAllowDataLossSender(req *http.Request) (future FailoverGroupsForceFailoverAllowDataLossFuture, 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 -} - -// ForceFailoverAllowDataLossResponder handles the response to the ForceFailoverAllowDataLoss request. The method always -// closes the http.Response Body. -func (client FailoverGroupsClient) ForceFailoverAllowDataLossResponder(resp *http.Response) (result FailoverGroup, 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 a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -func (client FailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result FailoverGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.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, serverName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FailoverGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", 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 FailoverGroupsClient) 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 FailoverGroupsClient) GetResponder(resp *http.Response) (result FailoverGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer lists the failover groups in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -func (client FailoverGroupsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FailoverGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.ListByServer") - defer func() { - sc := -1 - if result.fglr.Response.Response != nil { - sc = result.fglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.fglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.fglr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.fglr.hasNextLink() && result.fglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client FailoverGroupsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client FailoverGroupsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client FailoverGroupsClient) ListByServerResponder(resp *http.Response) (result FailoverGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client FailoverGroupsClient) listByServerNextResults(ctx context.Context, lastResults FailoverGroupListResult) (result FailoverGroupListResult, err error) { - req, err := lastResults.failoverGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client FailoverGroupsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result FailoverGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// Update updates a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server containing the failover group. -// failoverGroupName - the name of the failover group. -// parameters - the failover group parameters. -func (client FailoverGroupsClient) Update(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroupUpdate) (result FailoverGroupsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, failoverGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client FailoverGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroupUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}", 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 FailoverGroupsClient) UpdateSender(req *http.Request) (future FailoverGroupsUpdateFuture, 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 FailoverGroupsClient) UpdateResponder(resp *http.Response) (result FailoverGroup, 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/preview/sql/mgmt/v3.0/sql/firewallrules.go b/services/preview/sql/mgmt/v3.0/sql/firewallrules.go deleted file mode 100644 index 3e79a6b3933c..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/firewallrules.go +++ /dev/null @@ -1,361 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// FirewallRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type FirewallRulesClient struct { - BaseClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the FirewallRulesClient 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 NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// firewallRuleName - the name of the firewall rule. -// parameters - the required parameters for creating or updating a firewall rule. -func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.FirewallRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, 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 a firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// firewallRuleName - the name of the firewall rule. -func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) 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 firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// firewallRuleName - the name of the firewall rule. -func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.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, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", 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 FirewallRulesClient) 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 FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns a list of firewall rules. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListByServerResponder(resp *http.Response) (result FirewallRuleListResult, 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/sql/mgmt/v3.0/sql/geobackuppolicies.go b/services/preview/sql/mgmt/v3.0/sql/geobackuppolicies.go deleted file mode 100644 index 605603cc5f04..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/geobackuppolicies.go +++ /dev/null @@ -1,285 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// GeoBackupPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type GeoBackupPoliciesClient struct { - BaseClient -} - -// NewGeoBackupPoliciesClient creates an instance of the GeoBackupPoliciesClient client. -func NewGeoBackupPoliciesClient(subscriptionID string) GeoBackupPoliciesClient { - return NewGeoBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGeoBackupPoliciesClientWithBaseURI creates an instance of the GeoBackupPoliciesClient 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 NewGeoBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) GeoBackupPoliciesClient { - return GeoBackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates a database geo backup policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the required parameters for creating or updating the geo backup policy. -func (client GeoBackupPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters GeoBackupPolicy) (result GeoBackupPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GeoBackupPoliciesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GeoBackupPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.GeoBackupPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GeoBackupPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters GeoBackupPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "geoBackupPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}", 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 GeoBackupPoliciesClient) 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 GeoBackupPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result GeoBackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a geo backup policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client GeoBackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result GeoBackupPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GeoBackupPoliciesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GeoBackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "geoBackupPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}", 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 GeoBackupPoliciesClient) 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 GeoBackupPoliciesClient) GetResponder(resp *http.Response) (result GeoBackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase returns a list of geo backup policies. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client GeoBackupPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result GeoBackupPolicyListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GeoBackupPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.GeoBackupPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client GeoBackupPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client GeoBackupPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client GeoBackupPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result GeoBackupPolicyListResult, 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/sql/mgmt/v3.0/sql/importexport.go b/services/preview/sql/mgmt/v3.0/sql/importexport.go deleted file mode 100644 index ba2dbfa8bead..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/importexport.go +++ /dev/null @@ -1,128 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ImportExportClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type ImportExportClient struct { - BaseClient -} - -// NewImportExportClient creates an instance of the ImportExportClient client. -func NewImportExportClient(subscriptionID string) ImportExportClient { - return NewImportExportClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewImportExportClientWithBaseURI creates an instance of the ImportExportClient 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 NewImportExportClientWithBaseURI(baseURI string, subscriptionID string) ImportExportClient { - return ImportExportClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Import imports a bacpac into a new database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the database import request parameters. -func (client ImportExportClient) Import(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExistingDatabaseDefinition) (result ImportExportImportFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportExportClient.Import") - 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StorageURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLogin", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLoginPassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ImportExportClient", "Import", err.Error()) - } - - req, err := client.ImportPreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ImportExportClient", "Import", nil, "Failure preparing request") - return - } - - result, err = client.ImportSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ImportExportClient", "Import", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportPreparer prepares the Import request. -func (client ImportExportClient) ImportPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExistingDatabaseDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/servers/{serverName}/databases/{databaseName}/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportSender sends the Import request. The method will close the -// http.Response Body if it receives an error. -func (client ImportExportClient) ImportSender(req *http.Request) (future ImportExportImportFuture, 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 -} - -// ImportResponder handles the response to the Import request. The method always -// closes the http.Response Body. -func (client ImportExportClient) ImportResponder(resp *http.Response) (result ImportExportOperationResult, 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/preview/sql/mgmt/v3.0/sql/instancefailovergroups.go b/services/preview/sql/mgmt/v3.0/sql/instancefailovergroups.go deleted file mode 100644 index fc2759bfaa00..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/instancefailovergroups.go +++ /dev/null @@ -1,574 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// InstanceFailoverGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type InstanceFailoverGroupsClient struct { - BaseClient -} - -// NewInstanceFailoverGroupsClient creates an instance of the InstanceFailoverGroupsClient client. -func NewInstanceFailoverGroupsClient(subscriptionID string) InstanceFailoverGroupsClient { - return NewInstanceFailoverGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInstanceFailoverGroupsClientWithBaseURI creates an instance of the InstanceFailoverGroupsClient 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 NewInstanceFailoverGroupsClientWithBaseURI(baseURI string, subscriptionID string) InstanceFailoverGroupsClient { - return InstanceFailoverGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -// parameters - the failover group parameters. -func (client InstanceFailoverGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, parameters InstanceFailoverGroup) (result InstanceFailoverGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.InstanceFailoverGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.InstanceFailoverGroupProperties.ReadWriteEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.InstanceFailoverGroupProperties.PartnerRegions", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.InstanceFailoverGroupProperties.ManagedInstancePairs", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.InstanceFailoverGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, locationName, failoverGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client InstanceFailoverGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, parameters InstanceFailoverGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", 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 InstanceFailoverGroupsClient) CreateOrUpdateSender(req *http.Request) (future InstanceFailoverGroupsCreateOrUpdateFuture, 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 InstanceFailoverGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result InstanceFailoverGroup, 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 a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -func (client InstanceFailoverGroupsClient) Delete(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result InstanceFailoverGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, locationName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client InstanceFailoverGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", 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 InstanceFailoverGroupsClient) DeleteSender(req *http.Request) (future InstanceFailoverGroupsDeleteFuture, 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 InstanceFailoverGroupsClient) 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 -} - -// Failover fails over from the current primary managed instance to this managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -func (client InstanceFailoverGroupsClient) Failover(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result InstanceFailoverGroupsFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.Failover") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverPreparer(ctx, resourceGroupName, locationName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client InstanceFailoverGroupsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client InstanceFailoverGroupsClient) FailoverSender(req *http.Request) (future InstanceFailoverGroupsFailoverFuture, 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 -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client InstanceFailoverGroupsClient) FailoverResponder(resp *http.Response) (result InstanceFailoverGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ForceFailoverAllowDataLoss fails over from the current primary managed instance to this managed instance. This -// operation might result in data loss. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -func (client InstanceFailoverGroupsClient) ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result InstanceFailoverGroupsForceFailoverAllowDataLossFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.ForceFailoverAllowDataLoss") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ForceFailoverAllowDataLossPreparer(ctx, resourceGroupName, locationName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ForceFailoverAllowDataLoss", nil, "Failure preparing request") - return - } - - result, err = client.ForceFailoverAllowDataLossSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ForceFailoverAllowDataLoss", result.Response(), "Failure sending request") - return - } - - return -} - -// ForceFailoverAllowDataLossPreparer prepares the ForceFailoverAllowDataLoss request. -func (client InstanceFailoverGroupsClient) ForceFailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ForceFailoverAllowDataLossSender sends the ForceFailoverAllowDataLoss request. The method will close the -// http.Response Body if it receives an error. -func (client InstanceFailoverGroupsClient) ForceFailoverAllowDataLossSender(req *http.Request) (future InstanceFailoverGroupsForceFailoverAllowDataLossFuture, 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 -} - -// ForceFailoverAllowDataLossResponder handles the response to the ForceFailoverAllowDataLoss request. The method always -// closes the http.Response Body. -func (client InstanceFailoverGroupsClient) ForceFailoverAllowDataLossResponder(resp *http.Response) (result InstanceFailoverGroup, 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 a failover group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// failoverGroupName - the name of the failover group. -func (client InstanceFailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result InstanceFailoverGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.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, locationName, failoverGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client InstanceFailoverGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "failoverGroupName": autorest.Encode("path", failoverGroupName), - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", 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 InstanceFailoverGroupsClient) 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 InstanceFailoverGroupsClient) GetResponder(resp *http.Response) (result InstanceFailoverGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByLocation lists the failover groups in a location. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -func (client InstanceFailoverGroupsClient) ListByLocation(ctx context.Context, resourceGroupName string, locationName string) (result InstanceFailoverGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.ListByLocation") - defer func() { - sc := -1 - if result.ifglr.Response.Response != nil { - sc = result.ifglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByLocationNextResults - req, err := client.ListByLocationPreparer(ctx, resourceGroupName, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.ifglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ListByLocation", resp, "Failure sending request") - return - } - - result.ifglr, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "ListByLocation", resp, "Failure responding to request") - return - } - if result.ifglr.hasNextLink() && result.ifglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client InstanceFailoverGroupsClient) ListByLocationPreparer(ctx context.Context, resourceGroupName string, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/locations/{locationName}/instanceFailoverGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client InstanceFailoverGroupsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client InstanceFailoverGroupsClient) ListByLocationResponder(resp *http.Response) (result InstanceFailoverGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByLocationNextResults retrieves the next set of results, if any. -func (client InstanceFailoverGroupsClient) listByLocationNextResults(ctx context.Context, lastResults InstanceFailoverGroupListResult) (result InstanceFailoverGroupListResult, err error) { - req, err := lastResults.instanceFailoverGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "listByLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "listByLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsClient", "listByLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client InstanceFailoverGroupsClient) ListByLocationComplete(ctx context.Context, resourceGroupName string, locationName string) (result InstanceFailoverGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupsClient.ListByLocation") - 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.ListByLocation(ctx, resourceGroupName, locationName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/instancepools.go b/services/preview/sql/mgmt/v3.0/sql/instancepools.go deleted file mode 100644 index 6fe338f25f40..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/instancepools.go +++ /dev/null @@ -1,597 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// InstancePoolsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type InstancePoolsClient struct { - BaseClient -} - -// NewInstancePoolsClient creates an instance of the InstancePoolsClient client. -func NewInstancePoolsClient(subscriptionID string) InstancePoolsClient { - return NewInstancePoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInstancePoolsClientWithBaseURI creates an instance of the InstancePoolsClient 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 NewInstancePoolsClientWithBaseURI(baseURI string, subscriptionID string) InstancePoolsClient { - return InstancePoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an instance pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// instancePoolName - the name of the instance pool to be created or updated. -// parameters - the requested instance pool resource state. -func (client InstancePoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, instancePoolName string, parameters InstancePool) (result InstancePoolsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.InstancePoolProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.InstancePoolProperties.SubnetID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.InstancePoolProperties.VCores", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.InstancePoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, instancePoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client InstancePoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, instancePoolName string, parameters InstancePool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instancePoolName": autorest.Encode("path", instancePoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/instancePools/{instancePoolName}", 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 InstancePoolsClient) CreateOrUpdateSender(req *http.Request) (future InstancePoolsCreateOrUpdateFuture, 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 InstancePoolsClient) CreateOrUpdateResponder(resp *http.Response) (result InstancePool, 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 instance pool -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// instancePoolName - the name of the instance pool to be deleted -func (client InstancePoolsClient) Delete(ctx context.Context, resourceGroupName string, instancePoolName string) (result InstancePoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, instancePoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client InstancePoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, instancePoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instancePoolName": autorest.Encode("path", instancePoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/instancePools/{instancePoolName}", 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 InstancePoolsClient) DeleteSender(req *http.Request) (future InstancePoolsDeleteFuture, 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 InstancePoolsClient) 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 instance pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// instancePoolName - the name of the instance pool to be retrieved. -func (client InstancePoolsClient) Get(ctx context.Context, resourceGroupName string, instancePoolName string) (result InstancePool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolsClient.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, instancePoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client InstancePoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, instancePoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instancePoolName": autorest.Encode("path", instancePoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/instancePools/{instancePoolName}", 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 InstancePoolsClient) 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 InstancePoolsClient) GetResponder(resp *http.Response) (result InstancePool, 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 instance pools in the subscription. -func (client InstancePoolsClient) List(ctx context.Context) (result InstancePoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolsClient.List") - defer func() { - sc := -1 - if result.iplr.Response.Response != nil { - sc = result.iplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "List", resp, "Failure sending request") - return - } - - result.iplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "List", resp, "Failure responding to request") - return - } - if result.iplr.hasNextLink() && result.iplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client InstancePoolsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools", 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 InstancePoolsClient) 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 InstancePoolsClient) ListResponder(resp *http.Response) (result InstancePoolListResult, 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 InstancePoolsClient) listNextResults(ctx context.Context, lastResults InstancePoolListResult) (result InstancePoolListResult, err error) { - req, err := lastResults.instancePoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "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, "sql.InstancePoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client InstancePoolsClient) ListComplete(ctx context.Context) (result InstancePoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolsClient.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 instance pools in the resource group -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -func (client InstancePoolsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result InstancePoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.iplr.Response.Response != nil { - sc = result.iplr.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, "sql.InstancePoolsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.iplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.iplr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.iplr.hasNextLink() && result.iplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client InstancePoolsClient) 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 = "2018-06-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.Sql/instancePools", 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 InstancePoolsClient) 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 InstancePoolsClient) ListByResourceGroupResponder(resp *http.Response) (result InstancePoolListResult, 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 InstancePoolsClient) listByResourceGroupNextResults(ctx context.Context, lastResults InstancePoolListResult) (result InstancePoolListResult, err error) { - req, err := lastResults.instancePoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "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, "sql.InstancePoolsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client InstancePoolsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result InstancePoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolsClient.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 -} - -// Update updates an instance pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// instancePoolName - the name of the instance pool to be updated. -// parameters - the requested instance pool resource state. -func (client InstancePoolsClient) Update(ctx context.Context, resourceGroupName string, instancePoolName string, parameters InstancePoolUpdate) (result InstancePoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, instancePoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client InstancePoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, instancePoolName string, parameters InstancePoolUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instancePoolName": autorest.Encode("path", instancePoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/instancePools/{instancePoolName}", 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 InstancePoolsClient) UpdateSender(req *http.Request) (future InstancePoolsUpdateFuture, 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 InstancePoolsClient) UpdateResponder(resp *http.Response) (result InstancePool, 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/preview/sql/mgmt/v3.0/sql/jobagents.go b/services/preview/sql/mgmt/v3.0/sql/jobagents.go deleted file mode 100644 index ac60892a9387..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/jobagents.go +++ /dev/null @@ -1,492 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobAgentsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type JobAgentsClient struct { - BaseClient -} - -// NewJobAgentsClient creates an instance of the JobAgentsClient client. -func NewJobAgentsClient(subscriptionID string) JobAgentsClient { - return NewJobAgentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobAgentsClientWithBaseURI creates an instance of the JobAgentsClient 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 NewJobAgentsClientWithBaseURI(baseURI string, subscriptionID string) JobAgentsClient { - return JobAgentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a job agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent to be created or updated. -// parameters - the requested job agent resource state. -func (client JobAgentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, parameters JobAgent) (result JobAgentsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.JobAgentProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.JobAgentProperties.DatabaseID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.JobAgentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, jobAgentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JobAgentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, parameters JobAgent) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}", 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 JobAgentsClient) CreateOrUpdateSender(req *http.Request) (future JobAgentsCreateOrUpdateFuture, 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 JobAgentsClient) CreateOrUpdateResponder(resp *http.Response) (result JobAgent, 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 a job agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent to be deleted. -func (client JobAgentsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result JobAgentsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, jobAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobAgentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}", 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 JobAgentsClient) DeleteSender(req *http.Request) (future JobAgentsDeleteFuture, 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 JobAgentsClient) 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 a job agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent to be retrieved. -func (client JobAgentsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result JobAgent, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentsClient.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, serverName, jobAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobAgentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}", 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 JobAgentsClient) 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 JobAgentsClient) GetResponder(resp *http.Response) (result JobAgent, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of job agents in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client JobAgentsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result JobAgentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentsClient.ListByServer") - defer func() { - sc := -1 - if result.jalr.Response.Response != nil { - sc = result.jalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.jalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.jalr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.jalr.hasNextLink() && result.jalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client JobAgentsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client JobAgentsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client JobAgentsClient) ListByServerResponder(resp *http.Response) (result JobAgentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client JobAgentsClient) listByServerNextResults(ctx context.Context, lastResults JobAgentListResult) (result JobAgentListResult, err error) { - req, err := lastResults.jobAgentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobAgentsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobAgentsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobAgentsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result JobAgentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// Update updates a job agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent to be updated. -// parameters - the update to the job agent. -func (client JobAgentsClient) Update(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, parameters JobAgentUpdate) (result JobAgentsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, jobAgentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client JobAgentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, parameters JobAgentUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}", 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 JobAgentsClient) UpdateSender(req *http.Request) (future JobAgentsUpdateFuture, 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 JobAgentsClient) UpdateResponder(resp *http.Response) (result JobAgent, 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/preview/sql/mgmt/v3.0/sql/jobcredentials.go b/services/preview/sql/mgmt/v3.0/sql/jobcredentials.go deleted file mode 100644 index 883242aa6845..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/jobcredentials.go +++ /dev/null @@ -1,409 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobCredentialsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type JobCredentialsClient struct { - BaseClient -} - -// NewJobCredentialsClient creates an instance of the JobCredentialsClient client. -func NewJobCredentialsClient(subscriptionID string) JobCredentialsClient { - return NewJobCredentialsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobCredentialsClientWithBaseURI creates an instance of the JobCredentialsClient 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 NewJobCredentialsClientWithBaseURI(baseURI string, subscriptionID string) JobCredentialsClient { - return JobCredentialsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a job credential. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// credentialName - the name of the credential. -// parameters - the requested job credential state. -func (client JobCredentialsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string, parameters JobCredential) (result JobCredential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobCredentialProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.JobCredentialProperties.Username", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobCredentialProperties.Password", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.JobCredentialsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, jobAgentName, credentialName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JobCredentialsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string, parameters JobCredential) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "credentialName": autorest.Encode("path", credentialName), - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}", 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 JobCredentialsClient) 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 JobCredentialsClient) CreateOrUpdateResponder(resp *http.Response) (result JobCredential, 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 a job credential. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// credentialName - the name of the credential. -func (client JobCredentialsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, jobAgentName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobCredentialsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "credentialName": autorest.Encode("path", credentialName), - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}", 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 JobCredentialsClient) 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 JobCredentialsClient) 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 jobs credential. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// credentialName - the name of the credential. -func (client JobCredentialsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string) (result JobCredential, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialsClient.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, serverName, jobAgentName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobCredentialsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "credentialName": autorest.Encode("path", credentialName), - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}", 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 JobCredentialsClient) 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 JobCredentialsClient) GetResponder(resp *http.Response) (result JobCredential, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAgent gets a list of jobs credentials. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -func (client JobCredentialsClient) ListByAgent(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result JobCredentialListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialsClient.ListByAgent") - defer func() { - sc := -1 - if result.jclr.Response.Response != nil { - sc = result.jclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByAgentNextResults - req, err := client.ListByAgentPreparer(ctx, resourceGroupName, serverName, jobAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "ListByAgent", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAgentSender(req) - if err != nil { - result.jclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "ListByAgent", resp, "Failure sending request") - return - } - - result.jclr, err = client.ListByAgentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "ListByAgent", resp, "Failure responding to request") - return - } - if result.jclr.hasNextLink() && result.jclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAgentPreparer prepares the ListByAgent request. -func (client JobCredentialsClient) ListByAgentPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAgentSender sends the ListByAgent request. The method will close the -// http.Response Body if it receives an error. -func (client JobCredentialsClient) ListByAgentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAgentResponder handles the response to the ListByAgent request. The method always -// closes the http.Response Body. -func (client JobCredentialsClient) ListByAgentResponder(resp *http.Response) (result JobCredentialListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAgentNextResults retrieves the next set of results, if any. -func (client JobCredentialsClient) listByAgentNextResults(ctx context.Context, lastResults JobCredentialListResult) (result JobCredentialListResult, err error) { - req, err := lastResults.jobCredentialListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "listByAgentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAgentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "listByAgentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAgentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobCredentialsClient", "listByAgentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAgentComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobCredentialsClient) ListByAgentComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result JobCredentialListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialsClient.ListByAgent") - 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.ListByAgent(ctx, resourceGroupName, serverName, jobAgentName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/jobexecutions.go b/services/preview/sql/mgmt/v3.0/sql/jobexecutions.go deleted file mode 100644 index c4bb7d6af6c9..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/jobexecutions.go +++ /dev/null @@ -1,670 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// JobExecutionsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type JobExecutionsClient struct { - BaseClient -} - -// NewJobExecutionsClient creates an instance of the JobExecutionsClient client. -func NewJobExecutionsClient(subscriptionID string) JobExecutionsClient { - return NewJobExecutionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobExecutionsClientWithBaseURI creates an instance of the JobExecutionsClient 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 NewJobExecutionsClientWithBaseURI(baseURI string, subscriptionID string) JobExecutionsClient { - return JobExecutionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel requests cancellation of a job execution. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job. -// jobExecutionID - the id of the job execution to cancel. -func (client JobExecutionsClient) Cancel(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionsClient.Cancel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "Cancel", resp, "Failure responding to request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client JobExecutionsClient) CancelPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobExecutionId": autorest.Encode("path", jobExecutionID), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client JobExecutionsClient) CancelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client JobExecutionsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create starts an elastic job execution. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -func (client JobExecutionsClient) Create(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result JobExecutionsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client JobExecutionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start", 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 JobExecutionsClient) CreateSender(req *http.Request) (future JobExecutionsCreateFuture, 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 JobExecutionsClient) CreateResponder(resp *http.Response) (result JobExecution, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a job execution. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -// jobExecutionID - the job execution id to create the job execution under. -func (client JobExecutionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (result JobExecutionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JobExecutionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobExecutionId": autorest.Encode("path", jobExecutionID), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}", pathParameters), - 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 JobExecutionsClient) CreateOrUpdateSender(req *http.Request) (future JobExecutionsCreateOrUpdateFuture, 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 JobExecutionsClient) CreateOrUpdateResponder(resp *http.Response) (result JobExecution, 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 -} - -// Get gets a job execution. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job. -// jobExecutionID - the id of the job execution -func (client JobExecutionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (result JobExecution, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionsClient.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, serverName, jobAgentName, jobName, jobExecutionID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobExecutionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobExecutionId": autorest.Encode("path", jobExecutionID), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}", 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 JobExecutionsClient) 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 JobExecutionsClient) GetResponder(resp *http.Response) (result JobExecution, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAgent lists all executions in a job agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// createTimeMin - if specified, only job executions created at or after the specified time are included. -// createTimeMax - if specified, only job executions created before the specified time are included. -// endTimeMin - if specified, only job executions completed at or after the specified time are included. -// endTimeMax - if specified, only job executions completed before the specified time are included. -// isActive - if specified, only active or only completed job executions are included. -// skip - the number of elements in the collection to skip. -// top - the number of elements to return from the collection. -func (client JobExecutionsClient) ListByAgent(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionsClient.ListByAgent") - defer func() { - sc := -1 - if result.jelr.Response.Response != nil { - sc = result.jelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByAgentNextResults - req, err := client.ListByAgentPreparer(ctx, resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "ListByAgent", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAgentSender(req) - if err != nil { - result.jelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "ListByAgent", resp, "Failure sending request") - return - } - - result.jelr, err = client.ListByAgentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "ListByAgent", resp, "Failure responding to request") - return - } - if result.jelr.hasNextLink() && result.jelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAgentPreparer prepares the ListByAgent request. -func (client JobExecutionsClient) ListByAgentPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if createTimeMin != nil { - queryParameters["createTimeMin"] = autorest.Encode("query", *createTimeMin) - } - if createTimeMax != nil { - queryParameters["createTimeMax"] = autorest.Encode("query", *createTimeMax) - } - if endTimeMin != nil { - queryParameters["endTimeMin"] = autorest.Encode("query", *endTimeMin) - } - if endTimeMax != nil { - queryParameters["endTimeMax"] = autorest.Encode("query", *endTimeMax) - } - if isActive != nil { - queryParameters["isActive"] = autorest.Encode("query", *isActive) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/executions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAgentSender sends the ListByAgent request. The method will close the -// http.Response Body if it receives an error. -func (client JobExecutionsClient) ListByAgentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAgentResponder handles the response to the ListByAgent request. The method always -// closes the http.Response Body. -func (client JobExecutionsClient) ListByAgentResponder(resp *http.Response) (result JobExecutionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAgentNextResults retrieves the next set of results, if any. -func (client JobExecutionsClient) listByAgentNextResults(ctx context.Context, lastResults JobExecutionListResult) (result JobExecutionListResult, err error) { - req, err := lastResults.jobExecutionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "listByAgentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAgentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "listByAgentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAgentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "listByAgentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAgentComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobExecutionsClient) ListByAgentComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionsClient.ListByAgent") - 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.ListByAgent(ctx, resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - return -} - -// ListByJob lists a job's executions. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -// createTimeMin - if specified, only job executions created at or after the specified time are included. -// createTimeMax - if specified, only job executions created before the specified time are included. -// endTimeMin - if specified, only job executions completed at or after the specified time are included. -// endTimeMax - if specified, only job executions completed before the specified time are included. -// isActive - if specified, only active or only completed job executions are included. -// skip - the number of elements in the collection to skip. -// top - the number of elements to return from the collection. -func (client JobExecutionsClient) ListByJob(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionsClient.ListByJob") - defer func() { - sc := -1 - if result.jelr.Response.Response != nil { - sc = result.jelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByJobNextResults - req, err := client.ListByJobPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.jelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "ListByJob", resp, "Failure sending request") - return - } - - result.jelr, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "ListByJob", resp, "Failure responding to request") - return - } - if result.jelr.hasNextLink() && result.jelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client JobExecutionsClient) ListByJobPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if createTimeMin != nil { - queryParameters["createTimeMin"] = autorest.Encode("query", *createTimeMin) - } - if createTimeMax != nil { - queryParameters["createTimeMax"] = autorest.Encode("query", *createTimeMax) - } - if endTimeMin != nil { - queryParameters["endTimeMin"] = autorest.Encode("query", *endTimeMin) - } - if endTimeMax != nil { - queryParameters["endTimeMax"] = autorest.Encode("query", *endTimeMax) - } - if isActive != nil { - queryParameters["isActive"] = autorest.Encode("query", *isActive) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client JobExecutionsClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client JobExecutionsClient) ListByJobResponder(resp *http.Response) (result JobExecutionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByJobNextResults retrieves the next set of results, if any. -func (client JobExecutionsClient) listByJobNextResults(ctx context.Context, lastResults JobExecutionListResult) (result JobExecutionListResult, err error) { - req, err := lastResults.jobExecutionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "listByJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "listByJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsClient", "listByJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobExecutionsClient) ListByJobComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionsClient.ListByJob") - 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.ListByJob(ctx, resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/jobs.go b/services/preview/sql/mgmt/v3.0/sql/jobs.go deleted file mode 100644 index 457236877e18..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/jobs.go +++ /dev/null @@ -1,399 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact with -// Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete -// databases. -type JobsClient struct { - BaseClient -} - -// NewJobsClient creates an instance of the JobsClient client. -func NewJobsClient(subscriptionID string) JobsClient { - return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobsClientWithBaseURI creates an instance of the JobsClient 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 NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { - return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a job. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -// parameters - the requested job state. -func (client JobsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, parameters Job) (result Job, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.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, serverName, jobAgentName, jobName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JobsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, parameters Job) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}", 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 JobsClient) 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 JobsClient) CreateOrUpdateResponder(resp *http.Response) (result Job, 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 a job. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to delete. -func (client JobsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.JobsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}", 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 JobsClient) 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 JobsClient) 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 job. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -func (client JobsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result Job, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.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, serverName, jobAgentName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}", 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 JobsClient) 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 JobsClient) GetResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAgent gets a list of jobs. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -func (client JobsClient) ListByAgent(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result JobListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.ListByAgent") - defer func() { - sc := -1 - if result.jlr.Response.Response != nil { - sc = result.jlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByAgentNextResults - req, err := client.ListByAgentPreparer(ctx, resourceGroupName, serverName, jobAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobsClient", "ListByAgent", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAgentSender(req) - if err != nil { - result.jlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobsClient", "ListByAgent", resp, "Failure sending request") - return - } - - result.jlr, err = client.ListByAgentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobsClient", "ListByAgent", resp, "Failure responding to request") - return - } - if result.jlr.hasNextLink() && result.jlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAgentPreparer prepares the ListByAgent request. -func (client JobsClient) ListByAgentPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAgentSender sends the ListByAgent request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) ListByAgentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAgentResponder handles the response to the ListByAgent request. The method always -// closes the http.Response Body. -func (client JobsClient) ListByAgentResponder(resp *http.Response) (result JobListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAgentNextResults retrieves the next set of results, if any. -func (client JobsClient) listByAgentNextResults(ctx context.Context, lastResults JobListResult) (result JobListResult, err error) { - req, err := lastResults.jobListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobsClient", "listByAgentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAgentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobsClient", "listByAgentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAgentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobsClient", "listByAgentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAgentComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobsClient) ListByAgentComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result JobListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.ListByAgent") - 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.ListByAgent(ctx, resourceGroupName, serverName, jobAgentName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/jobstepexecutions.go b/services/preview/sql/mgmt/v3.0/sql/jobstepexecutions.go deleted file mode 100644 index d01dc77a65ee..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/jobstepexecutions.go +++ /dev/null @@ -1,274 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// JobStepExecutionsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type JobStepExecutionsClient struct { - BaseClient -} - -// NewJobStepExecutionsClient creates an instance of the JobStepExecutionsClient client. -func NewJobStepExecutionsClient(subscriptionID string) JobStepExecutionsClient { - return NewJobStepExecutionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobStepExecutionsClientWithBaseURI creates an instance of the JobStepExecutionsClient 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 NewJobStepExecutionsClientWithBaseURI(baseURI string, subscriptionID string) JobStepExecutionsClient { - return JobStepExecutionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a step execution of a job execution. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -// jobExecutionID - the unique id of the job execution -// stepName - the name of the step. -func (client JobStepExecutionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string) (result JobExecution, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepExecutionsClient.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, serverName, jobAgentName, jobName, jobExecutionID, stepName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepExecutionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobStepExecutionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepExecutionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobStepExecutionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobExecutionId": autorest.Encode("path", jobExecutionID), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}", 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 JobStepExecutionsClient) 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 JobStepExecutionsClient) GetResponder(resp *http.Response) (result JobExecution, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByJobExecution lists the step executions of a job execution. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -// jobExecutionID - the id of the job execution -// createTimeMin - if specified, only job executions created at or after the specified time are included. -// createTimeMax - if specified, only job executions created before the specified time are included. -// endTimeMin - if specified, only job executions completed at or after the specified time are included. -// endTimeMax - if specified, only job executions completed before the specified time are included. -// isActive - if specified, only active or only completed job executions are included. -// skip - the number of elements in the collection to skip. -// top - the number of elements to return from the collection. -func (client JobStepExecutionsClient) ListByJobExecution(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepExecutionsClient.ListByJobExecution") - defer func() { - sc := -1 - if result.jelr.Response.Response != nil { - sc = result.jelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByJobExecutionNextResults - req, err := client.ListByJobExecutionPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepExecutionsClient", "ListByJobExecution", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobExecutionSender(req) - if err != nil { - result.jelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobStepExecutionsClient", "ListByJobExecution", resp, "Failure sending request") - return - } - - result.jelr, err = client.ListByJobExecutionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepExecutionsClient", "ListByJobExecution", resp, "Failure responding to request") - return - } - if result.jelr.hasNextLink() && result.jelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByJobExecutionPreparer prepares the ListByJobExecution request. -func (client JobStepExecutionsClient) ListByJobExecutionPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobExecutionId": autorest.Encode("path", jobExecutionID), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if createTimeMin != nil { - queryParameters["createTimeMin"] = autorest.Encode("query", *createTimeMin) - } - if createTimeMax != nil { - queryParameters["createTimeMax"] = autorest.Encode("query", *createTimeMax) - } - if endTimeMin != nil { - queryParameters["endTimeMin"] = autorest.Encode("query", *endTimeMin) - } - if endTimeMax != nil { - queryParameters["endTimeMax"] = autorest.Encode("query", *endTimeMax) - } - if isActive != nil { - queryParameters["isActive"] = autorest.Encode("query", *isActive) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobExecutionSender sends the ListByJobExecution request. The method will close the -// http.Response Body if it receives an error. -func (client JobStepExecutionsClient) ListByJobExecutionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobExecutionResponder handles the response to the ListByJobExecution request. The method always -// closes the http.Response Body. -func (client JobStepExecutionsClient) ListByJobExecutionResponder(resp *http.Response) (result JobExecutionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByJobExecutionNextResults retrieves the next set of results, if any. -func (client JobStepExecutionsClient) listByJobExecutionNextResults(ctx context.Context, lastResults JobExecutionListResult) (result JobExecutionListResult, err error) { - req, err := lastResults.jobExecutionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobStepExecutionsClient", "listByJobExecutionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByJobExecutionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobStepExecutionsClient", "listByJobExecutionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByJobExecutionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepExecutionsClient", "listByJobExecutionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByJobExecutionComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobStepExecutionsClient) ListByJobExecutionComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepExecutionsClient.ListByJobExecution") - 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.ListByJobExecution(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/jobsteps.go b/services/preview/sql/mgmt/v3.0/sql/jobsteps.go deleted file mode 100644 index 3011a7a25d02..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/jobsteps.go +++ /dev/null @@ -1,635 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobStepsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type JobStepsClient struct { - BaseClient -} - -// NewJobStepsClient creates an instance of the JobStepsClient client. -func NewJobStepsClient(subscriptionID string) JobStepsClient { - return NewJobStepsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobStepsClientWithBaseURI creates an instance of the JobStepsClient 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 NewJobStepsClientWithBaseURI(baseURI string, subscriptionID string) JobStepsClient { - return JobStepsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a job step. This will implicitly create a new job version. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job. -// stepName - the name of the job step. -// parameters - the requested state of the job step. -func (client JobStepsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string, parameters JobStep) (result JobStep, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobStepProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.JobStepProperties.TargetGroup", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobStepProperties.Credential", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobStepProperties.Action", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.JobStepProperties.Action.Value", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.JobStepProperties.Output", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.JobStepProperties.Output.ServerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobStepProperties.Output.DatabaseName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobStepProperties.Output.TableName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobStepProperties.Output.Credential", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("sql.JobStepsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JobStepsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string, parameters JobStep) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}", 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 JobStepsClient) 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 JobStepsClient) CreateOrUpdateResponder(resp *http.Response) (result JobStep, 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 a job step. This will implicitly create a new job version. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job. -// stepName - the name of the job step to delete. -func (client JobStepsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, stepName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobStepsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}", 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 JobStepsClient) 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 JobStepsClient) 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 job step in a job's current version. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job. -// stepName - the name of the job step. -func (client JobStepsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string) (result JobStep, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepsClient.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, serverName, jobAgentName, jobName, stepName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobStepsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}", 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 JobStepsClient) 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 JobStepsClient) GetResponder(resp *http.Response) (result JobStep, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByVersion gets the specified version of a job step. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job. -// jobVersion - the version of the job to get. -// stepName - the name of the job step. -func (client JobStepsClient) GetByVersion(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32, stepName string) (result JobStep, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepsClient.GetByVersion") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByVersionPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "GetByVersion", nil, "Failure preparing request") - return - } - - resp, err := client.GetByVersionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "GetByVersion", resp, "Failure sending request") - return - } - - result, err = client.GetByVersionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "GetByVersion", resp, "Failure responding to request") - return - } - - return -} - -// GetByVersionPreparer prepares the GetByVersion request. -func (client JobStepsClient) GetByVersionPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32, stepName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "jobVersion": autorest.Encode("path", jobVersion), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps/{stepName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByVersionSender sends the GetByVersion request. The method will close the -// http.Response Body if it receives an error. -func (client JobStepsClient) GetByVersionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByVersionResponder handles the response to the GetByVersion request. The method always -// closes the http.Response Body. -func (client JobStepsClient) GetByVersionResponder(resp *http.Response) (result JobStep, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByJob gets all job steps for a job's current version. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -func (client JobStepsClient) ListByJob(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result JobStepListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepsClient.ListByJob") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByJobNextResults - req, err := client.ListByJobPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "ListByJob", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "ListByJob", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client JobStepsClient) ListByJobPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client JobStepsClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client JobStepsClient) ListByJobResponder(resp *http.Response) (result JobStepListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByJobNextResults retrieves the next set of results, if any. -func (client JobStepsClient) listByJobNextResults(ctx context.Context, lastResults JobStepListResult) (result JobStepListResult, err error) { - req, err := lastResults.jobStepListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobStepsClient", "listByJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobStepsClient", "listByJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "listByJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobStepsClient) ListByJobComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result JobStepListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepsClient.ListByJob") - 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.ListByJob(ctx, resourceGroupName, serverName, jobAgentName, jobName) - return -} - -// ListByVersion gets all job steps in the specified job version. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -// jobVersion - the version of the job to get. -func (client JobStepsClient) ListByVersion(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32) (result JobStepListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepsClient.ListByVersion") - defer func() { - sc := -1 - if result.jslr.Response.Response != nil { - sc = result.jslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByVersionNextResults - req, err := client.ListByVersionPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "ListByVersion", nil, "Failure preparing request") - return - } - - resp, err := client.ListByVersionSender(req) - if err != nil { - result.jslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "ListByVersion", resp, "Failure sending request") - return - } - - result.jslr, err = client.ListByVersionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "ListByVersion", resp, "Failure responding to request") - return - } - if result.jslr.hasNextLink() && result.jslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByVersionPreparer prepares the ListByVersion request. -func (client JobStepsClient) ListByVersionPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "jobVersion": autorest.Encode("path", jobVersion), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByVersionSender sends the ListByVersion request. The method will close the -// http.Response Body if it receives an error. -func (client JobStepsClient) ListByVersionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByVersionResponder handles the response to the ListByVersion request. The method always -// closes the http.Response Body. -func (client JobStepsClient) ListByVersionResponder(resp *http.Response) (result JobStepListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByVersionNextResults retrieves the next set of results, if any. -func (client JobStepsClient) listByVersionNextResults(ctx context.Context, lastResults JobStepListResult) (result JobStepListResult, err error) { - req, err := lastResults.jobStepListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobStepsClient", "listByVersionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByVersionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobStepsClient", "listByVersionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByVersionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobStepsClient", "listByVersionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByVersionComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobStepsClient) ListByVersionComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32) (result JobStepListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepsClient.ListByVersion") - 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.ListByVersion(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobVersion) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/jobtargetexecutions.go b/services/preview/sql/mgmt/v3.0/sql/jobtargetexecutions.go deleted file mode 100644 index 2e72ab31c1b7..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/jobtargetexecutions.go +++ /dev/null @@ -1,431 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// JobTargetExecutionsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type JobTargetExecutionsClient struct { - BaseClient -} - -// NewJobTargetExecutionsClient creates an instance of the JobTargetExecutionsClient client. -func NewJobTargetExecutionsClient(subscriptionID string) JobTargetExecutionsClient { - return NewJobTargetExecutionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobTargetExecutionsClientWithBaseURI creates an instance of the JobTargetExecutionsClient 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 NewJobTargetExecutionsClientWithBaseURI(baseURI string, subscriptionID string) JobTargetExecutionsClient { - return JobTargetExecutionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a target execution. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -// jobExecutionID - the unique id of the job execution -// stepName - the name of the step. -// targetID - the target id. -func (client JobTargetExecutionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string, targetID uuid.UUID) (result JobExecution, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetExecutionsClient.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, serverName, jobAgentName, jobName, jobExecutionID, stepName, targetID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobTargetExecutionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string, targetID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobExecutionId": autorest.Encode("path", jobExecutionID), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetId": autorest.Encode("path", targetID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets/{targetId}", 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 JobTargetExecutionsClient) 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 JobTargetExecutionsClient) GetResponder(resp *http.Response) (result JobExecution, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByJobExecution lists target executions for all steps of a job execution. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -// jobExecutionID - the id of the job execution -// createTimeMin - if specified, only job executions created at or after the specified time are included. -// createTimeMax - if specified, only job executions created before the specified time are included. -// endTimeMin - if specified, only job executions completed at or after the specified time are included. -// endTimeMax - if specified, only job executions completed before the specified time are included. -// isActive - if specified, only active or only completed job executions are included. -// skip - the number of elements in the collection to skip. -// top - the number of elements to return from the collection. -func (client JobTargetExecutionsClient) ListByJobExecution(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetExecutionsClient.ListByJobExecution") - defer func() { - sc := -1 - if result.jelr.Response.Response != nil { - sc = result.jelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByJobExecutionNextResults - req, err := client.ListByJobExecutionPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "ListByJobExecution", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobExecutionSender(req) - if err != nil { - result.jelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "ListByJobExecution", resp, "Failure sending request") - return - } - - result.jelr, err = client.ListByJobExecutionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "ListByJobExecution", resp, "Failure responding to request") - return - } - if result.jelr.hasNextLink() && result.jelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByJobExecutionPreparer prepares the ListByJobExecution request. -func (client JobTargetExecutionsClient) ListByJobExecutionPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobExecutionId": autorest.Encode("path", jobExecutionID), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if createTimeMin != nil { - queryParameters["createTimeMin"] = autorest.Encode("query", *createTimeMin) - } - if createTimeMax != nil { - queryParameters["createTimeMax"] = autorest.Encode("query", *createTimeMax) - } - if endTimeMin != nil { - queryParameters["endTimeMin"] = autorest.Encode("query", *endTimeMin) - } - if endTimeMax != nil { - queryParameters["endTimeMax"] = autorest.Encode("query", *endTimeMax) - } - if isActive != nil { - queryParameters["isActive"] = autorest.Encode("query", *isActive) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/targets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobExecutionSender sends the ListByJobExecution request. The method will close the -// http.Response Body if it receives an error. -func (client JobTargetExecutionsClient) ListByJobExecutionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobExecutionResponder handles the response to the ListByJobExecution request. The method always -// closes the http.Response Body. -func (client JobTargetExecutionsClient) ListByJobExecutionResponder(resp *http.Response) (result JobExecutionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByJobExecutionNextResults retrieves the next set of results, if any. -func (client JobTargetExecutionsClient) listByJobExecutionNextResults(ctx context.Context, lastResults JobExecutionListResult) (result JobExecutionListResult, err error) { - req, err := lastResults.jobExecutionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "listByJobExecutionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByJobExecutionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "listByJobExecutionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByJobExecutionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "listByJobExecutionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByJobExecutionComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobTargetExecutionsClient) ListByJobExecutionComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetExecutionsClient.ListByJobExecution") - 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.ListByJobExecution(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - return -} - -// ListByStep lists the target executions of a job step execution. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -// jobExecutionID - the id of the job execution -// stepName - the name of the step. -// createTimeMin - if specified, only job executions created at or after the specified time are included. -// createTimeMax - if specified, only job executions created before the specified time are included. -// endTimeMin - if specified, only job executions completed at or after the specified time are included. -// endTimeMax - if specified, only job executions completed before the specified time are included. -// isActive - if specified, only active or only completed job executions are included. -// skip - the number of elements in the collection to skip. -// top - the number of elements to return from the collection. -func (client JobTargetExecutionsClient) ListByStep(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetExecutionsClient.ListByStep") - defer func() { - sc := -1 - if result.jelr.Response.Response != nil { - sc = result.jelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByStepNextResults - req, err := client.ListByStepPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "ListByStep", nil, "Failure preparing request") - return - } - - resp, err := client.ListByStepSender(req) - if err != nil { - result.jelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "ListByStep", resp, "Failure sending request") - return - } - - result.jelr, err = client.ListByStepResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "ListByStep", resp, "Failure responding to request") - return - } - if result.jelr.hasNextLink() && result.jelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByStepPreparer prepares the ListByStep request. -func (client JobTargetExecutionsClient) ListByStepPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobExecutionId": autorest.Encode("path", jobExecutionID), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "stepName": autorest.Encode("path", stepName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if createTimeMin != nil { - queryParameters["createTimeMin"] = autorest.Encode("query", *createTimeMin) - } - if createTimeMax != nil { - queryParameters["createTimeMax"] = autorest.Encode("query", *createTimeMax) - } - if endTimeMin != nil { - queryParameters["endTimeMin"] = autorest.Encode("query", *endTimeMin) - } - if endTimeMax != nil { - queryParameters["endTimeMax"] = autorest.Encode("query", *endTimeMax) - } - if isActive != nil { - queryParameters["isActive"] = autorest.Encode("query", *isActive) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByStepSender sends the ListByStep request. The method will close the -// http.Response Body if it receives an error. -func (client JobTargetExecutionsClient) ListByStepSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByStepResponder handles the response to the ListByStep request. The method always -// closes the http.Response Body. -func (client JobTargetExecutionsClient) ListByStepResponder(resp *http.Response) (result JobExecutionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByStepNextResults retrieves the next set of results, if any. -func (client JobTargetExecutionsClient) listByStepNextResults(ctx context.Context, lastResults JobExecutionListResult) (result JobExecutionListResult, err error) { - req, err := lastResults.jobExecutionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "listByStepNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByStepSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "listByStepNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByStepResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetExecutionsClient", "listByStepNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByStepComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobTargetExecutionsClient) ListByStepComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result JobExecutionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetExecutionsClient.ListByStep") - 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.ListByStep(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/jobtargetgroups.go b/services/preview/sql/mgmt/v3.0/sql/jobtargetgroups.go deleted file mode 100644 index 74b54d3e1226..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/jobtargetgroups.go +++ /dev/null @@ -1,407 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobTargetGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type JobTargetGroupsClient struct { - BaseClient -} - -// NewJobTargetGroupsClient creates an instance of the JobTargetGroupsClient client. -func NewJobTargetGroupsClient(subscriptionID string) JobTargetGroupsClient { - return NewJobTargetGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobTargetGroupsClientWithBaseURI creates an instance of the JobTargetGroupsClient 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 NewJobTargetGroupsClientWithBaseURI(baseURI string, subscriptionID string) JobTargetGroupsClient { - return JobTargetGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a target group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// targetGroupName - the name of the target group. -// parameters - the requested state of the target group. -func (client JobTargetGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string, parameters JobTargetGroup) (result JobTargetGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobTargetGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.JobTargetGroupProperties.Members", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.JobTargetGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, jobAgentName, targetGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JobTargetGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string, parameters JobTargetGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetGroupName": autorest.Encode("path", targetGroupName), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}", 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 JobTargetGroupsClient) 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 JobTargetGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result JobTargetGroup, 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 a target group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// targetGroupName - the name of the target group. -func (client JobTargetGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, jobAgentName, targetGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobTargetGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetGroupName": autorest.Encode("path", targetGroupName), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}", 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 JobTargetGroupsClient) 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 JobTargetGroupsClient) 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 target group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// targetGroupName - the name of the target group. -func (client JobTargetGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string) (result JobTargetGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupsClient.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, serverName, jobAgentName, targetGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobTargetGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "targetGroupName": autorest.Encode("path", targetGroupName), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}", 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 JobTargetGroupsClient) 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 JobTargetGroupsClient) GetResponder(resp *http.Response) (result JobTargetGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAgent gets all target groups in an agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -func (client JobTargetGroupsClient) ListByAgent(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result JobTargetGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupsClient.ListByAgent") - defer func() { - sc := -1 - if result.jtglr.Response.Response != nil { - sc = result.jtglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByAgentNextResults - req, err := client.ListByAgentPreparer(ctx, resourceGroupName, serverName, jobAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "ListByAgent", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAgentSender(req) - if err != nil { - result.jtglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "ListByAgent", resp, "Failure sending request") - return - } - - result.jtglr, err = client.ListByAgentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "ListByAgent", resp, "Failure responding to request") - return - } - if result.jtglr.hasNextLink() && result.jtglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAgentPreparer prepares the ListByAgent request. -func (client JobTargetGroupsClient) ListByAgentPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAgentSender sends the ListByAgent request. The method will close the -// http.Response Body if it receives an error. -func (client JobTargetGroupsClient) ListByAgentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAgentResponder handles the response to the ListByAgent request. The method always -// closes the http.Response Body. -func (client JobTargetGroupsClient) ListByAgentResponder(resp *http.Response) (result JobTargetGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAgentNextResults retrieves the next set of results, if any. -func (client JobTargetGroupsClient) listByAgentNextResults(ctx context.Context, lastResults JobTargetGroupListResult) (result JobTargetGroupListResult, err error) { - req, err := lastResults.jobTargetGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "listByAgentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAgentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "listByAgentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAgentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobTargetGroupsClient", "listByAgentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAgentComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobTargetGroupsClient) ListByAgentComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result JobTargetGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupsClient.ListByAgent") - 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.ListByAgent(ctx, resourceGroupName, serverName, jobAgentName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/jobversions.go b/services/preview/sql/mgmt/v3.0/sql/jobversions.go deleted file mode 100644 index 8911c3fa38ca..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/jobversions.go +++ /dev/null @@ -1,239 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// JobVersionsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type JobVersionsClient struct { - BaseClient -} - -// NewJobVersionsClient creates an instance of the JobVersionsClient client. -func NewJobVersionsClient(subscriptionID string) JobVersionsClient { - return NewJobVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobVersionsClientWithBaseURI creates an instance of the JobVersionsClient 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 NewJobVersionsClientWithBaseURI(baseURI string, subscriptionID string) JobVersionsClient { - return JobVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a job version. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job. -// jobVersion - the version of the job to get. -func (client JobVersionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32) (result JobVersion, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionsClient.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, serverName, jobAgentName, jobName, jobVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobVersionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobVersionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobVersionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "jobVersion": autorest.Encode("path", jobVersion), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}", 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 JobVersionsClient) 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 JobVersionsClient) GetResponder(resp *http.Response) (result JobVersion, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByJob gets all versions of a job. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// jobAgentName - the name of the job agent. -// jobName - the name of the job to get. -func (client JobVersionsClient) ListByJob(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result JobVersionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionsClient.ListByJob") - defer func() { - sc := -1 - if result.jvlr.Response.Response != nil { - sc = result.jvlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByJobNextResults - req, err := client.ListByJobPreparer(ctx, resourceGroupName, serverName, jobAgentName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobVersionsClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.jvlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.JobVersionsClient", "ListByJob", resp, "Failure sending request") - return - } - - result.jvlr, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobVersionsClient", "ListByJob", resp, "Failure responding to request") - return - } - if result.jvlr.hasNextLink() && result.jvlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client JobVersionsClient) ListByJobPreparer(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobAgentName": autorest.Encode("path", jobAgentName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client JobVersionsClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client JobVersionsClient) ListByJobResponder(resp *http.Response) (result JobVersionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByJobNextResults retrieves the next set of results, if any. -func (client JobVersionsClient) listByJobNextResults(ctx context.Context, lastResults JobVersionListResult) (result JobVersionListResult, err error) { - req, err := lastResults.jobVersionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.JobVersionsClient", "listByJobNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.JobVersionsClient", "listByJobNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobVersionsClient", "listByJobNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByJobComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobVersionsClient) ListByJobComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result JobVersionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionsClient.ListByJob") - 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.ListByJob(ctx, resourceGroupName, serverName, jobAgentName, jobName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/longtermretentionbackups.go b/services/preview/sql/mgmt/v3.0/sql/longtermretentionbackups.go deleted file mode 100644 index c2b40d332dd1..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/longtermretentionbackups.go +++ /dev/null @@ -1,1129 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LongTermRetentionBackupsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type LongTermRetentionBackupsClient struct { - BaseClient -} - -// NewLongTermRetentionBackupsClient creates an instance of the LongTermRetentionBackupsClient client. -func NewLongTermRetentionBackupsClient(subscriptionID string) LongTermRetentionBackupsClient { - return NewLongTermRetentionBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLongTermRetentionBackupsClientWithBaseURI creates an instance of the LongTermRetentionBackupsClient 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 NewLongTermRetentionBackupsClientWithBaseURI(baseURI string, subscriptionID string) LongTermRetentionBackupsClient { - return LongTermRetentionBackupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes a long term retention backup. -// Parameters: -// locationName - the location of the database -// longTermRetentionServerName - the name of the server -// longTermRetentionDatabaseName - the name of the database -// backupName - the backup name. -func (client LongTermRetentionBackupsClient) Delete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result LongTermRetentionBackupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LongTermRetentionBackupsClient) DeletePreparer(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupName": autorest.Encode("path", backupName), - "locationName": autorest.Encode("path", locationName), - "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), - "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", 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 LongTermRetentionBackupsClient) DeleteSender(req *http.Request) (future LongTermRetentionBackupsDeleteFuture, 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 LongTermRetentionBackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByResourceGroup deletes a long term retention backup. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database -// longTermRetentionServerName - the name of the server -// longTermRetentionDatabaseName - the name of the database -// backupName - the backup name. -func (client LongTermRetentionBackupsClient) DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result LongTermRetentionBackupsDeleteByResourceGroupFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.DeleteByResourceGroup") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteByResourceGroupPreparer(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "DeleteByResourceGroup", nil, "Failure preparing request") - return - } - - result, err = client.DeleteByResourceGroupSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "DeleteByResourceGroup", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteByResourceGroupPreparer prepares the DeleteByResourceGroup request. -func (client LongTermRetentionBackupsClient) DeleteByResourceGroupPreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupName": autorest.Encode("path", backupName), - "locationName": autorest.Encode("path", locationName), - "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), - "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByResourceGroupSender sends the DeleteByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionBackupsClient) DeleteByResourceGroupSender(req *http.Request) (future LongTermRetentionBackupsDeleteByResourceGroupFuture, 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 -} - -// DeleteByResourceGroupResponder handles the response to the DeleteByResourceGroup request. The method always -// closes the http.Response Body. -func (client LongTermRetentionBackupsClient) DeleteByResourceGroupResponder(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 gets a long term retention backup. -// Parameters: -// locationName - the location of the database. -// longTermRetentionServerName - the name of the server -// longTermRetentionDatabaseName - the name of the database -// backupName - the backup name. -func (client LongTermRetentionBackupsClient) Get(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result LongTermRetentionBackup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.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, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LongTermRetentionBackupsClient) GetPreparer(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupName": autorest.Encode("path", backupName), - "locationName": autorest.Encode("path", locationName), - "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), - "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", 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 LongTermRetentionBackupsClient) 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 LongTermRetentionBackupsClient) GetResponder(resp *http.Response) (result LongTermRetentionBackup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByResourceGroup gets a long term retention backup. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database. -// longTermRetentionServerName - the name of the server -// longTermRetentionDatabaseName - the name of the database -// backupName - the backup name. -func (client LongTermRetentionBackupsClient) GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result LongTermRetentionBackup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.GetByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByResourceGroupPreparer(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "GetByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.GetByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "GetByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.GetByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "GetByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// GetByResourceGroupPreparer prepares the GetByResourceGroup request. -func (client LongTermRetentionBackupsClient) GetByResourceGroupPreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupName": autorest.Encode("path", backupName), - "locationName": autorest.Encode("path", locationName), - "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), - "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByResourceGroupSender sends the GetByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionBackupsClient) GetByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByResourceGroupResponder handles the response to the GetByResourceGroup request. The method always -// closes the http.Response Body. -func (client LongTermRetentionBackupsClient) GetByResourceGroupResponder(resp *http.Response) (result LongTermRetentionBackup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists all long term retention backups for a database. -// Parameters: -// locationName - the location of the database -// longTermRetentionServerName - the name of the server -// longTermRetentionDatabaseName - the name of the database -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByDatabase(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByDatabase") - defer func() { - sc := -1 - if result.ltrblr.Response.Response != nil { - sc = result.ltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.ltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.ltrblr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.ltrblr.hasNextLink() && result.ltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client LongTermRetentionBackupsClient) ListByDatabasePreparer(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), - "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionBackupsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client LongTermRetentionBackupsClient) ListByDatabaseResponder(resp *http.Response) (result LongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client LongTermRetentionBackupsClient) listByDatabaseNextResults(ctx context.Context, lastResults LongTermRetentionBackupListResult) (result LongTermRetentionBackupListResult, err error) { - req, err := lastResults.longTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByDatabaseComplete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByDatabase") - 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.ListByDatabase(ctx, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByLocation lists the long term retention backups for a given location. -// Parameters: -// locationName - the location of the database -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByLocation") - defer func() { - sc := -1 - if result.ltrblr.Response.Response != nil { - sc = result.ltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByLocationNextResults - req, err := client.ListByLocationPreparer(ctx, locationName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.ltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByLocation", resp, "Failure sending request") - return - } - - result.ltrblr, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByLocation", resp, "Failure responding to request") - return - } - if result.ltrblr.hasNextLink() && result.ltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client LongTermRetentionBackupsClient) ListByLocationPreparer(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionBackupsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client LongTermRetentionBackupsClient) ListByLocationResponder(resp *http.Response) (result LongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByLocationNextResults retrieves the next set of results, if any. -func (client LongTermRetentionBackupsClient) listByLocationNextResults(ctx context.Context, lastResults LongTermRetentionBackupListResult) (result LongTermRetentionBackupListResult, err error) { - req, err := lastResults.longTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByLocation") - 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.ListByLocation(ctx, locationName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByResourceGroupDatabase lists all long term retention backups for a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database -// longTermRetentionServerName - the name of the server -// longTermRetentionDatabaseName - the name of the database -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupDatabase") - defer func() { - sc := -1 - if result.ltrblr.Response.Response != nil { - sc = result.ltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupDatabaseNextResults - req, err := client.ListByResourceGroupDatabasePreparer(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByResourceGroupDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupDatabaseSender(req) - if err != nil { - result.ltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByResourceGroupDatabase", resp, "Failure sending request") - return - } - - result.ltrblr, err = client.ListByResourceGroupDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByResourceGroupDatabase", resp, "Failure responding to request") - return - } - if result.ltrblr.hasNextLink() && result.ltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupDatabasePreparer prepares the ListByResourceGroupDatabase request. -func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabasePreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), - "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupDatabaseSender sends the ListByResourceGroupDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupDatabaseResponder handles the response to the ListByResourceGroupDatabase request. The method always -// closes the http.Response Body. -func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabaseResponder(resp *http.Response) (result LongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupDatabaseNextResults retrieves the next set of results, if any. -func (client LongTermRetentionBackupsClient) listByResourceGroupDatabaseNextResults(ctx context.Context, lastResults LongTermRetentionBackupListResult) (result LongTermRetentionBackupListResult, err error) { - req, err := lastResults.longTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByResourceGroupDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByResourceGroupDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByResourceGroupDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupDatabase") - 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.ListByResourceGroupDatabase(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByResourceGroupLocation lists the long term retention backups for a given location. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupLocation") - defer func() { - sc := -1 - if result.ltrblr.Response.Response != nil { - sc = result.ltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupLocationNextResults - req, err := client.ListByResourceGroupLocationPreparer(ctx, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByResourceGroupLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupLocationSender(req) - if err != nil { - result.ltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByResourceGroupLocation", resp, "Failure sending request") - return - } - - result.ltrblr, err = client.ListByResourceGroupLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByResourceGroupLocation", resp, "Failure responding to request") - return - } - if result.ltrblr.hasNextLink() && result.ltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupLocationPreparer prepares the ListByResourceGroupLocation request. -func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationPreparer(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupLocationSender sends the ListByResourceGroupLocation request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupLocationResponder handles the response to the ListByResourceGroupLocation request. The method always -// closes the http.Response Body. -func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationResponder(resp *http.Response) (result LongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupLocationNextResults retrieves the next set of results, if any. -func (client LongTermRetentionBackupsClient) listByResourceGroupLocationNextResults(ctx context.Context, lastResults LongTermRetentionBackupListResult) (result LongTermRetentionBackupListResult, err error) { - req, err := lastResults.longTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByResourceGroupLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByResourceGroupLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByResourceGroupLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupLocation") - 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.ListByResourceGroupLocation(ctx, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByResourceGroupServer lists the long term retention backups for a given server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database -// longTermRetentionServerName - the name of the server -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByResourceGroupServer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupServer") - defer func() { - sc := -1 - if result.ltrblr.Response.Response != nil { - sc = result.ltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupServerNextResults - req, err := client.ListByResourceGroupServerPreparer(ctx, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByResourceGroupServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupServerSender(req) - if err != nil { - result.ltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByResourceGroupServer", resp, "Failure sending request") - return - } - - result.ltrblr, err = client.ListByResourceGroupServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByResourceGroupServer", resp, "Failure responding to request") - return - } - if result.ltrblr.hasNextLink() && result.ltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupServerPreparer prepares the ListByResourceGroupServer request. -func (client LongTermRetentionBackupsClient) ListByResourceGroupServerPreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupServerSender sends the ListByResourceGroupServer request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionBackupsClient) ListByResourceGroupServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupServerResponder handles the response to the ListByResourceGroupServer request. The method always -// closes the http.Response Body. -func (client LongTermRetentionBackupsClient) ListByResourceGroupServerResponder(resp *http.Response) (result LongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupServerNextResults retrieves the next set of results, if any. -func (client LongTermRetentionBackupsClient) listByResourceGroupServerNextResults(ctx context.Context, lastResults LongTermRetentionBackupListResult) (result LongTermRetentionBackupListResult, err error) { - req, err := lastResults.longTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByResourceGroupServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByResourceGroupServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByResourceGroupServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByResourceGroupServerComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupServer") - 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.ListByResourceGroupServer(ctx, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByServer lists the long term retention backups for a given server. -// Parameters: -// locationName - the location of the database -// longTermRetentionServerName - the name of the server -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByServer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByServer") - defer func() { - sc := -1 - if result.ltrblr.Response.Response != nil { - sc = result.ltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.ltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.ltrblr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.ltrblr.hasNextLink() && result.ltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client LongTermRetentionBackupsClient) ListByServerPreparer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionBackupsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client LongTermRetentionBackupsClient) ListByServerResponder(resp *http.Response) (result LongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client LongTermRetentionBackupsClient) listByServerNextResults(ctx context.Context, lastResults LongTermRetentionBackupListResult) (result LongTermRetentionBackupListResult, err error) { - req, err := lastResults.longTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByServerComplete(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByServer") - 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.ListByServer(ctx, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/longtermretentionmanagedinstancebackups.go b/services/preview/sql/mgmt/v3.0/sql/longtermretentionmanagedinstancebackups.go deleted file mode 100644 index a0b0712c782d..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/longtermretentionmanagedinstancebackups.go +++ /dev/null @@ -1,1130 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LongTermRetentionManagedInstanceBackupsClient is the the Azure SQL Database management API provides a RESTful set of -// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type LongTermRetentionManagedInstanceBackupsClient struct { - BaseClient -} - -// NewLongTermRetentionManagedInstanceBackupsClient creates an instance of the -// LongTermRetentionManagedInstanceBackupsClient client. -func NewLongTermRetentionManagedInstanceBackupsClient(subscriptionID string) LongTermRetentionManagedInstanceBackupsClient { - return NewLongTermRetentionManagedInstanceBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLongTermRetentionManagedInstanceBackupsClientWithBaseURI creates an instance of the -// LongTermRetentionManagedInstanceBackupsClient 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 NewLongTermRetentionManagedInstanceBackupsClientWithBaseURI(baseURI string, subscriptionID string) LongTermRetentionManagedInstanceBackupsClient { - return LongTermRetentionManagedInstanceBackupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes a long term retention backup. -// Parameters: -// locationName - the location of the database. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the managed database. -// backupName - the backup name. -func (client LongTermRetentionManagedInstanceBackupsClient) Delete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (result LongTermRetentionManagedInstanceBackupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, locationName, managedInstanceName, databaseName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LongTermRetentionManagedInstanceBackupsClient) DeletePreparer(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupName": autorest.Encode("path", backupName), - "databaseName": autorest.Encode("path", databaseName), - "locationName": autorest.Encode("path", locationName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}", 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 LongTermRetentionManagedInstanceBackupsClient) DeleteSender(req *http.Request) (future LongTermRetentionManagedInstanceBackupsDeleteFuture, 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 LongTermRetentionManagedInstanceBackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByResourceGroup deletes a long term retention backup. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the managed database. -// backupName - the backup name. -func (client LongTermRetentionManagedInstanceBackupsClient) DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.DeleteByResourceGroup") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteByResourceGroupPreparer(ctx, resourceGroupName, locationName, managedInstanceName, databaseName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "DeleteByResourceGroup", nil, "Failure preparing request") - return - } - - result, err = client.DeleteByResourceGroupSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "DeleteByResourceGroup", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteByResourceGroupPreparer prepares the DeleteByResourceGroup request. -func (client LongTermRetentionManagedInstanceBackupsClient) DeleteByResourceGroupPreparer(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupName": autorest.Encode("path", backupName), - "databaseName": autorest.Encode("path", databaseName), - "locationName": autorest.Encode("path", locationName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByResourceGroupSender sends the DeleteByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionManagedInstanceBackupsClient) DeleteByResourceGroupSender(req *http.Request) (future LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture, 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 -} - -// DeleteByResourceGroupResponder handles the response to the DeleteByResourceGroup request. The method always -// closes the http.Response Body. -func (client LongTermRetentionManagedInstanceBackupsClient) DeleteByResourceGroupResponder(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 gets a long term retention backup for a managed database. -// Parameters: -// locationName - the location of the database. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the managed database. -// backupName - the backup name. -func (client LongTermRetentionManagedInstanceBackupsClient) Get(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (result ManagedInstanceLongTermRetentionBackup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.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, locationName, managedInstanceName, databaseName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LongTermRetentionManagedInstanceBackupsClient) GetPreparer(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupName": autorest.Encode("path", backupName), - "databaseName": autorest.Encode("path", databaseName), - "locationName": autorest.Encode("path", locationName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}", 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 LongTermRetentionManagedInstanceBackupsClient) 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 LongTermRetentionManagedInstanceBackupsClient) GetResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionBackup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByResourceGroup gets a long term retention backup for a managed database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the managed database. -// backupName - the backup name. -func (client LongTermRetentionManagedInstanceBackupsClient) GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result ManagedInstanceLongTermRetentionBackup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.GetByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByResourceGroupPreparer(ctx, resourceGroupName, locationName, managedInstanceName, databaseName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "GetByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.GetByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "GetByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.GetByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "GetByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// GetByResourceGroupPreparer prepares the GetByResourceGroup request. -func (client LongTermRetentionManagedInstanceBackupsClient) GetByResourceGroupPreparer(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupName": autorest.Encode("path", backupName), - "databaseName": autorest.Encode("path", databaseName), - "locationName": autorest.Encode("path", locationName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByResourceGroupSender sends the GetByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionManagedInstanceBackupsClient) GetByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByResourceGroupResponder handles the response to the GetByResourceGroup request. The method always -// closes the http.Response Body. -func (client LongTermRetentionManagedInstanceBackupsClient) GetByResourceGroupResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionBackup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists all long term retention backups for a managed database. -// Parameters: -// locationName - the location of the database. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the managed database. -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabase(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState1) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByDatabase") - defer func() { - sc := -1 - if result.miltrblr.Response.Response != nil { - sc = result.miltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.miltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.miltrblr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.miltrblr.hasNextLink() && result.miltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabasePreparer(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState1) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "locationName": autorest.Encode("path", locationName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabaseResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client LongTermRetentionManagedInstanceBackupsClient) listByDatabaseNextResults(ctx context.Context, lastResults ManagedInstanceLongTermRetentionBackupListResult) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - req, err := lastResults.managedInstanceLongTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabaseComplete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState1) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByDatabase") - 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.ListByDatabase(ctx, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByInstance lists the long term retention backups for a given managed instance. -// Parameters: -// locationName - the location of the database -// managedInstanceName - the name of the managed instance. -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstance(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState2) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByInstance") - defer func() { - sc := -1 - if result.miltrblr.Response.Response != nil { - sc = result.miltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.miltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.miltrblr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.miltrblr.hasNextLink() && result.miltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstancePreparer(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState2) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client LongTermRetentionManagedInstanceBackupsClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceLongTermRetentionBackupListResult) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - req, err := lastResults.managedInstanceLongTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstanceComplete(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState2) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByInstance") - 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.ListByInstance(ctx, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByLocation lists the long term retention backups for managed databases in a given location. -// Parameters: -// locationName - the location of the database. -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState3) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByLocation") - defer func() { - sc := -1 - if result.miltrblr.Response.Response != nil { - sc = result.miltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByLocationNextResults - req, err := client.ListByLocationPreparer(ctx, locationName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.miltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByLocation", resp, "Failure sending request") - return - } - - result.miltrblr, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByLocation", resp, "Failure responding to request") - return - } - if result.miltrblr.hasNextLink() && result.miltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationPreparer(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState3) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByLocationNextResults retrieves the next set of results, if any. -func (client LongTermRetentionManagedInstanceBackupsClient) listByLocationNextResults(ctx context.Context, lastResults ManagedInstanceLongTermRetentionBackupListResult) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - req, err := lastResults.managedInstanceLongTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState3) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByLocation") - 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.ListByLocation(ctx, locationName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByResourceGroupDatabase lists all long term retention backups for a managed database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the managed database. -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState4) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupDatabase") - defer func() { - sc := -1 - if result.miltrblr.Response.Response != nil { - sc = result.miltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupDatabaseNextResults - req, err := client.ListByResourceGroupDatabasePreparer(ctx, resourceGroupName, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByResourceGroupDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupDatabaseSender(req) - if err != nil { - result.miltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByResourceGroupDatabase", resp, "Failure sending request") - return - } - - result.miltrblr, err = client.ListByResourceGroupDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByResourceGroupDatabase", resp, "Failure responding to request") - return - } - if result.miltrblr.hasNextLink() && result.miltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupDatabasePreparer prepares the ListByResourceGroupDatabase request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabasePreparer(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState4) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "locationName": autorest.Encode("path", locationName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupDatabaseSender sends the ListByResourceGroupDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupDatabaseResponder handles the response to the ListByResourceGroupDatabase request. The method always -// closes the http.Response Body. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabaseResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupDatabaseNextResults retrieves the next set of results, if any. -func (client LongTermRetentionManagedInstanceBackupsClient) listByResourceGroupDatabaseNextResults(ctx context.Context, lastResults ManagedInstanceLongTermRetentionBackupListResult) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - req, err := lastResults.managedInstanceLongTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByResourceGroupDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByResourceGroupDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByResourceGroupDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState4) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupDatabase") - 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.ListByResourceGroupDatabase(ctx, resourceGroupName, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByResourceGroupInstance lists the long term retention backups for a given managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database. -// managedInstanceName - the name of the managed instance. -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstance(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState5) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupInstance") - defer func() { - sc := -1 - if result.miltrblr.Response.Response != nil { - sc = result.miltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupInstanceNextResults - req, err := client.ListByResourceGroupInstancePreparer(ctx, resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByResourceGroupInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupInstanceSender(req) - if err != nil { - result.miltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByResourceGroupInstance", resp, "Failure sending request") - return - } - - result.miltrblr, err = client.ListByResourceGroupInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByResourceGroupInstance", resp, "Failure responding to request") - return - } - if result.miltrblr.hasNextLink() && result.miltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupInstancePreparer prepares the ListByResourceGroupInstance request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstancePreparer(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState5) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupInstanceSender sends the ListByResourceGroupInstance request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupInstanceResponder handles the response to the ListByResourceGroupInstance request. The method always -// closes the http.Response Body. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstanceResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupInstanceNextResults retrieves the next set of results, if any. -func (client LongTermRetentionManagedInstanceBackupsClient) listByResourceGroupInstanceNextResults(ctx context.Context, lastResults ManagedInstanceLongTermRetentionBackupListResult) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - req, err := lastResults.managedInstanceLongTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByResourceGroupInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByResourceGroupInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByResourceGroupInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstanceComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState5) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupInstance") - 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.ListByResourceGroupInstance(ctx, resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState) - return -} - -// ListByResourceGroupLocation lists the long term retention backups for managed databases in a given location. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the location of the database. -// onlyLatestPerDatabase - whether or not to only get the latest backup for each database. -// databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState6) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupLocation") - defer func() { - sc := -1 - if result.miltrblr.Response.Response != nil { - sc = result.miltrblr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupLocationNextResults - req, err := client.ListByResourceGroupLocationPreparer(ctx, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByResourceGroupLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupLocationSender(req) - if err != nil { - result.miltrblr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByResourceGroupLocation", resp, "Failure sending request") - return - } - - result.miltrblr, err = client.ListByResourceGroupLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "ListByResourceGroupLocation", resp, "Failure responding to request") - return - } - if result.miltrblr.hasNextLink() && result.miltrblr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupLocationPreparer prepares the ListByResourceGroupLocation request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocationPreparer(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState6) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if onlyLatestPerDatabase != nil { - queryParameters["onlyLatestPerDatabase"] = autorest.Encode("query", *onlyLatestPerDatabase) - } - if len(string(databaseState)) > 0 { - queryParameters["databaseState"] = autorest.Encode("query", databaseState) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupLocationSender sends the ListByResourceGroupLocation request. The method will close the -// http.Response Body if it receives an error. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupLocationResponder handles the response to the ListByResourceGroupLocation request. The method always -// closes the http.Response Body. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocationResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupLocationNextResults retrieves the next set of results, if any. -func (client LongTermRetentionManagedInstanceBackupsClient) listByResourceGroupLocationNextResults(ctx context.Context, lastResults ManagedInstanceLongTermRetentionBackupListResult) (result ManagedInstanceLongTermRetentionBackupListResult, err error) { - req, err := lastResults.managedInstanceLongTermRetentionBackupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByResourceGroupLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByResourceGroupLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsClient", "listByResourceGroupLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState6) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupLocation") - 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.ListByResourceGroupLocation(ctx, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedbackupshorttermretentionpolicies.go b/services/preview/sql/mgmt/v3.0/sql/managedbackupshorttermretentionpolicies.go deleted file mode 100644 index 91e75e1aa6c1..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedbackupshorttermretentionpolicies.go +++ /dev/null @@ -1,408 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedBackupShortTermRetentionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of -// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedBackupShortTermRetentionPoliciesClient struct { - BaseClient -} - -// NewManagedBackupShortTermRetentionPoliciesClient creates an instance of the -// ManagedBackupShortTermRetentionPoliciesClient client. -func NewManagedBackupShortTermRetentionPoliciesClient(subscriptionID string) ManagedBackupShortTermRetentionPoliciesClient { - return NewManagedBackupShortTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedBackupShortTermRetentionPoliciesClientWithBaseURI creates an instance of the -// ManagedBackupShortTermRetentionPoliciesClient 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 NewManagedBackupShortTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ManagedBackupShortTermRetentionPoliciesClient { - return ManagedBackupShortTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates a managed database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// parameters - the short term retention policy info. -func (client ManagedBackupShortTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedBackupShortTermRetentionPolicy) (result ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedBackupShortTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedBackupShortTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}", 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 ManagedBackupShortTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture, 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 ManagedBackupShortTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedBackupShortTermRetentionPolicy, 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 a managed database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedBackupShortTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedBackupShortTermRetentionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPoliciesClient.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, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedBackupShortTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{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 ManagedBackupShortTermRetentionPoliciesClient) 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 ManagedBackupShortTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result ManagedBackupShortTermRetentionPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets a managed database's short term retention policy list. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedBackupShortTermRetentionPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedBackupShortTermRetentionPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.mbstrplr.Response.Response != nil { - sc = result.mbstrplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.mbstrplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.mbstrplr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.mbstrplr.hasNextLink() && result.mbstrplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ManagedBackupShortTermRetentionPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedBackupShortTermRetentionPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ManagedBackupShortTermRetentionPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result ManagedBackupShortTermRetentionPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedBackupShortTermRetentionPoliciesClient) listByDatabaseNextResults(ctx context.Context, lastResults ManagedBackupShortTermRetentionPolicyListResult) (result ManagedBackupShortTermRetentionPolicyListResult, err error) { - req, err := lastResults.managedBackupShortTermRetentionPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedBackupShortTermRetentionPoliciesClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedBackupShortTermRetentionPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPoliciesClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName) - return -} - -// Update updates a managed database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// parameters - the short term retention policy info. -func (client ManagedBackupShortTermRetentionPoliciesClient) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedBackupShortTermRetentionPolicy) (result ManagedBackupShortTermRetentionPoliciesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPoliciesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ManagedBackupShortTermRetentionPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedBackupShortTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}", 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 ManagedBackupShortTermRetentionPoliciesClient) UpdateSender(req *http.Request) (future ManagedBackupShortTermRetentionPoliciesUpdateFuture, 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 ManagedBackupShortTermRetentionPoliciesClient) UpdateResponder(resp *http.Response) (result ManagedBackupShortTermRetentionPolicy, 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/preview/sql/mgmt/v3.0/sql/manageddatabaserestoredetails.go b/services/preview/sql/mgmt/v3.0/sql/manageddatabaserestoredetails.go deleted file mode 100644 index 5c4455e7451c..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/manageddatabaserestoredetails.go +++ /dev/null @@ -1,122 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabaseRestoreDetailsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedDatabaseRestoreDetailsClient struct { - BaseClient -} - -// NewManagedDatabaseRestoreDetailsClient creates an instance of the ManagedDatabaseRestoreDetailsClient client. -func NewManagedDatabaseRestoreDetailsClient(subscriptionID string) ManagedDatabaseRestoreDetailsClient { - return NewManagedDatabaseRestoreDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseRestoreDetailsClientWithBaseURI creates an instance of the ManagedDatabaseRestoreDetailsClient -// 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 NewManagedDatabaseRestoreDetailsClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseRestoreDetailsClient { - return ManagedDatabaseRestoreDetailsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets managed database restore details. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedDatabaseRestoreDetailsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedDatabaseRestoreDetailsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseRestoreDetailsClient.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("sql.ManagedDatabaseRestoreDetailsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseRestoreDetailsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseRestoreDetailsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseRestoreDetailsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseRestoreDetailsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restoreDetailsName": autorest.Encode("path", "Default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/restoreDetails/{restoreDetailsName}", 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 ManagedDatabaseRestoreDetailsClient) 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 ManagedDatabaseRestoreDetailsClient) GetResponder(resp *http.Response) (result ManagedDatabaseRestoreDetailsResult, 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/sql/mgmt/v3.0/sql/manageddatabases.go b/services/preview/sql/mgmt/v3.0/sql/manageddatabases.go deleted file mode 100644 index c9a950271bb9..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/manageddatabases.go +++ /dev/null @@ -1,738 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ManagedDatabasesClient struct { - BaseClient -} - -// NewManagedDatabasesClient creates an instance of the ManagedDatabasesClient client. -func NewManagedDatabasesClient(subscriptionID string) ManagedDatabasesClient { - return NewManagedDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabasesClientWithBaseURI creates an instance of the ManagedDatabasesClient 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 NewManagedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabasesClient { - return ManagedDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CompleteRestore completes the restore operation on a managed database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// parameters - the definition for completing the restore of this managed database. -func (client ManagedDatabasesClient) CompleteRestore(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters CompleteDatabaseRestoreDefinition) (result ManagedDatabasesCompleteRestoreFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabasesClient.CompleteRestore") - 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LastBackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabasesClient", "CompleteRestore", err.Error()) - } - - req, err := client.CompleteRestorePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "CompleteRestore", nil, "Failure preparing request") - return - } - - result, err = client.CompleteRestoreSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "CompleteRestore", result.Response(), "Failure sending request") - return - } - - return -} - -// CompleteRestorePreparer prepares the CompleteRestore request. -func (client ManagedDatabasesClient) CompleteRestorePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters CompleteDatabaseRestoreDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/completeRestore", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CompleteRestoreSender sends the CompleteRestore request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabasesClient) CompleteRestoreSender(req *http.Request) (future ManagedDatabasesCompleteRestoreFuture, 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 -} - -// CompleteRestoreResponder handles the response to the CompleteRestore request. The method always -// closes the http.Response Body. -func (client ManagedDatabasesClient) CompleteRestoreResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates a new database or updates an existing database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// parameters - the requested database resource state. -func (client ManagedDatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabase) (result ManagedDatabasesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabasesClient.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: 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("sql.ManagedDatabasesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedDatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabase) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}", 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 ManagedDatabasesClient) CreateOrUpdateSender(req *http.Request) (future ManagedDatabasesCreateOrUpdateFuture, 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 ManagedDatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedDatabase, 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 a managed database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedDatabasesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedDatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabasesClient.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("sql.ManagedDatabasesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedDatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}", 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 ManagedDatabasesClient) DeleteSender(req *http.Request) (future ManagedDatabasesDeleteFuture, 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 ManagedDatabasesClient) 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 a managed database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedDatabasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedDatabase, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabasesClient.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("sql.ManagedDatabasesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}", 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 ManagedDatabasesClient) 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 ManagedDatabasesClient) GetResponder(resp *http.Response) (result ManagedDatabase, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of managed databases. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -func (client ManagedDatabasesClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedDatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabasesClient.ListByInstance") - defer func() { - sc := -1 - if result.mdlr.Response.Response != nil { - sc = result.mdlr.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("sql.ManagedDatabasesClient", "ListByInstance", err.Error()) - } - - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.mdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.mdlr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.mdlr.hasNextLink() && result.mdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedDatabasesClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabasesClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedDatabasesClient) ListByInstanceResponder(resp *http.Response) (result ManagedDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedDatabasesClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedDatabaseListResult) (result ManagedDatabaseListResult, err error) { - req, err := lastResults.managedDatabaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedDatabasesClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedDatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabasesClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} - -// ListInaccessibleByInstance gets a list of inaccessible managed databases in a managed instance -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -func (client ManagedDatabasesClient) ListInaccessibleByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedDatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabasesClient.ListInaccessibleByInstance") - defer func() { - sc := -1 - if result.mdlr.Response.Response != nil { - sc = result.mdlr.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("sql.ManagedDatabasesClient", "ListInaccessibleByInstance", err.Error()) - } - - result.fn = client.listInaccessibleByInstanceNextResults - req, err := client.ListInaccessibleByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "ListInaccessibleByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListInaccessibleByInstanceSender(req) - if err != nil { - result.mdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "ListInaccessibleByInstance", resp, "Failure sending request") - return - } - - result.mdlr, err = client.ListInaccessibleByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "ListInaccessibleByInstance", resp, "Failure responding to request") - return - } - if result.mdlr.hasNextLink() && result.mdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListInaccessibleByInstancePreparer prepares the ListInaccessibleByInstance request. -func (client ManagedDatabasesClient) ListInaccessibleByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/inaccessibleManagedDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListInaccessibleByInstanceSender sends the ListInaccessibleByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabasesClient) ListInaccessibleByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListInaccessibleByInstanceResponder handles the response to the ListInaccessibleByInstance request. The method always -// closes the http.Response Body. -func (client ManagedDatabasesClient) ListInaccessibleByInstanceResponder(resp *http.Response) (result ManagedDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listInaccessibleByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedDatabasesClient) listInaccessibleByInstanceNextResults(ctx context.Context, lastResults ManagedDatabaseListResult) (result ManagedDatabaseListResult, err error) { - req, err := lastResults.managedDatabaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "listInaccessibleByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListInaccessibleByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "listInaccessibleByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListInaccessibleByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "listInaccessibleByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListInaccessibleByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedDatabasesClient) ListInaccessibleByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedDatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabasesClient.ListInaccessibleByInstance") - 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.ListInaccessibleByInstance(ctx, resourceGroupName, managedInstanceName) - return -} - -// Update updates an existing database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// parameters - the requested database resource state. -func (client ManagedDatabasesClient) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseUpdate) (result ManagedDatabasesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabasesClient.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("sql.ManagedDatabasesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ManagedDatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}", 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 ManagedDatabasesClient) UpdateSender(req *http.Request) (future ManagedDatabasesUpdateFuture, 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 ManagedDatabasesClient) UpdateResponder(resp *http.Response) (result ManagedDatabase, 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/preview/sql/mgmt/v3.0/sql/manageddatabasesecurityalertpolicies.go b/services/preview/sql/mgmt/v3.0/sql/manageddatabasesecurityalertpolicies.go deleted file mode 100644 index 58b443e4fb93..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/manageddatabasesecurityalertpolicies.go +++ /dev/null @@ -1,319 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabaseSecurityAlertPoliciesClient is the the Azure SQL Database management API provides a RESTful set of -// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedDatabaseSecurityAlertPoliciesClient struct { - BaseClient -} - -// NewManagedDatabaseSecurityAlertPoliciesClient creates an instance of the ManagedDatabaseSecurityAlertPoliciesClient -// client. -func NewManagedDatabaseSecurityAlertPoliciesClient(subscriptionID string) ManagedDatabaseSecurityAlertPoliciesClient { - return NewManagedDatabaseSecurityAlertPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseSecurityAlertPoliciesClientWithBaseURI creates an instance of the -// ManagedDatabaseSecurityAlertPoliciesClient 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 NewManagedDatabaseSecurityAlertPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseSecurityAlertPoliciesClient { - return ManagedDatabaseSecurityAlertPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the managed database for which the security alert policy is defined. -// parameters - the database security alert policy. -func (client ManagedDatabaseSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseSecurityAlertPolicy) (result ManagedDatabaseSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPoliciesClient.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, managedInstanceName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedDatabaseSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}", 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 ManagedDatabaseSecurityAlertPoliciesClient) 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 ManagedDatabaseSecurityAlertPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedDatabaseSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a managed database's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the managed database for which the security alert policy is defined. -func (client ManagedDatabaseSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedDatabaseSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPoliciesClient.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, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseSecurityAlertPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}", 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 ManagedDatabaseSecurityAlertPoliciesClient) 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 ManagedDatabaseSecurityAlertPoliciesClient) GetResponder(resp *http.Response) (result ManagedDatabaseSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets a list of managed database's security alert policies. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the managed database for which the security alert policies are defined. -func (client ManagedDatabaseSecurityAlertPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedDatabaseSecurityAlertPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.mdsaplr.Response.Response != nil { - sc = result.mdsaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.mdsaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.mdsaplr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.mdsaplr.hasNextLink() && result.mdsaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ManagedDatabaseSecurityAlertPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseSecurityAlertPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseSecurityAlertPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result ManagedDatabaseSecurityAlertPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedDatabaseSecurityAlertPoliciesClient) listByDatabaseNextResults(ctx context.Context, lastResults ManagedDatabaseSecurityAlertPolicyListResult) (result ManagedDatabaseSecurityAlertPolicyListResult, err error) { - req, err := lastResults.managedDatabaseSecurityAlertPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSecurityAlertPoliciesClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedDatabaseSecurityAlertPoliciesClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedDatabaseSecurityAlertPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPoliciesClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/manageddatabasesensitivitylabels.go b/services/preview/sql/mgmt/v3.0/sql/manageddatabasesensitivitylabels.go deleted file mode 100644 index 2a4000e00e5e..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/manageddatabasesensitivitylabels.go +++ /dev/null @@ -1,723 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabaseSensitivityLabelsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedDatabaseSensitivityLabelsClient struct { - BaseClient -} - -// NewManagedDatabaseSensitivityLabelsClient creates an instance of the ManagedDatabaseSensitivityLabelsClient client. -func NewManagedDatabaseSensitivityLabelsClient(subscriptionID string) ManagedDatabaseSensitivityLabelsClient { - return NewManagedDatabaseSensitivityLabelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseSensitivityLabelsClientWithBaseURI creates an instance of the -// ManagedDatabaseSensitivityLabelsClient 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 NewManagedDatabaseSensitivityLabelsClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseSensitivityLabelsClient { - return ManagedDatabaseSensitivityLabelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// parameters - the column sensitivity label resource. -func (client ManagedDatabaseSensitivityLabelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (result SensitivityLabel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.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, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedDatabaseSensitivityLabelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 ManagedDatabaseSensitivityLabelsClient) 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 ManagedDatabaseSensitivityLabelsClient) CreateOrUpdateResponder(resp *http.Response) (result SensitivityLabel, 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 sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client ManagedDatabaseSensitivityLabelsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedDatabaseSensitivityLabelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 ManagedDatabaseSensitivityLabelsClient) 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 ManagedDatabaseSensitivityLabelsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DisableRecommendation disables sensitivity recommendations on a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client ManagedDatabaseSensitivityLabelsClient) DisableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.DisableRecommendation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DisableRecommendationPreparer(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "DisableRecommendation", nil, "Failure preparing request") - return - } - - resp, err := client.DisableRecommendationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "DisableRecommendation", resp, "Failure sending request") - return - } - - result, err = client.DisableRecommendationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "DisableRecommendation", resp, "Failure responding to request") - return - } - - return -} - -// DisableRecommendationPreparer prepares the DisableRecommendation request. -func (client ManagedDatabaseSensitivityLabelsClient) DisableRecommendationPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "recommended"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableRecommendationSender sends the DisableRecommendation request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseSensitivityLabelsClient) DisableRecommendationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisableRecommendationResponder handles the response to the DisableRecommendation request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseSensitivityLabelsClient) DisableRecommendationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// EnableRecommendation enables sensitivity recommendations on a given column (recommendations are enabled by default -// on all columns) -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client ManagedDatabaseSensitivityLabelsClient) EnableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.EnableRecommendation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.EnableRecommendationPreparer(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "EnableRecommendation", nil, "Failure preparing request") - return - } - - resp, err := client.EnableRecommendationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "EnableRecommendation", resp, "Failure sending request") - return - } - - result, err = client.EnableRecommendationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "EnableRecommendation", resp, "Failure responding to request") - return - } - - return -} - -// EnableRecommendationPreparer prepares the EnableRecommendation request. -func (client ManagedDatabaseSensitivityLabelsClient) EnableRecommendationPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "recommended"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableRecommendationSender sends the EnableRecommendation request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseSensitivityLabelsClient) EnableRecommendationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableRecommendationResponder handles the response to the EnableRecommendation request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseSensitivityLabelsClient) EnableRecommendationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// sensitivityLabelSource - the source of the sensitivity label. -func (client ManagedDatabaseSensitivityLabelsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (result SensitivityLabel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.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, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseSensitivityLabelsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", sensitivityLabelSource), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 ManagedDatabaseSensitivityLabelsClient) 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 ManagedDatabaseSensitivityLabelsClient) GetResponder(resp *http.Response) (result SensitivityLabel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCurrentByDatabase gets the sensitivity labels of a given database -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// filter - an OData filter expression that filters elements in the collection. -func (client ManagedDatabaseSensitivityLabelsClient) ListCurrentByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (result SensitivityLabelListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.ListCurrentByDatabase") - defer func() { - sc := -1 - if result.sllr.Response.Response != nil { - sc = result.sllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listCurrentByDatabaseNextResults - req, err := client.ListCurrentByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "ListCurrentByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListCurrentByDatabaseSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "ListCurrentByDatabase", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListCurrentByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "ListCurrentByDatabase", resp, "Failure responding to request") - return - } - if result.sllr.hasNextLink() && result.sllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListCurrentByDatabasePreparer prepares the ListCurrentByDatabase request. -func (client ManagedDatabaseSensitivityLabelsClient) ListCurrentByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCurrentByDatabaseSender sends the ListCurrentByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseSensitivityLabelsClient) ListCurrentByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCurrentByDatabaseResponder handles the response to the ListCurrentByDatabase request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseSensitivityLabelsClient) ListCurrentByDatabaseResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listCurrentByDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedDatabaseSensitivityLabelsClient) listCurrentByDatabaseNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "listCurrentByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListCurrentByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "listCurrentByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListCurrentByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "listCurrentByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListCurrentByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedDatabaseSensitivityLabelsClient) ListCurrentByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (result SensitivityLabelListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.ListCurrentByDatabase") - 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.ListCurrentByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName, filter) - return -} - -// ListRecommendedByDatabase gets the sensitivity labels of a given database -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// includeDisabledRecommendations - specifies whether to include disabled recommendations or not. -// filter - an OData filter expression that filters elements in the collection. -func (client ManagedDatabaseSensitivityLabelsClient) ListRecommendedByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result SensitivityLabelListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.ListRecommendedByDatabase") - defer func() { - sc := -1 - if result.sllr.Response.Response != nil { - sc = result.sllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRecommendedByDatabaseNextResults - req, err := client.ListRecommendedByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "ListRecommendedByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListRecommendedByDatabaseSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "ListRecommendedByDatabase", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListRecommendedByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "ListRecommendedByDatabase", resp, "Failure responding to request") - return - } - if result.sllr.hasNextLink() && result.sllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRecommendedByDatabasePreparer prepares the ListRecommendedByDatabase request. -func (client ManagedDatabaseSensitivityLabelsClient) ListRecommendedByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if includeDisabledRecommendations != nil { - queryParameters["includeDisabledRecommendations"] = autorest.Encode("query", *includeDisabledRecommendations) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - 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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRecommendedByDatabaseSender sends the ListRecommendedByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseSensitivityLabelsClient) ListRecommendedByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRecommendedByDatabaseResponder handles the response to the ListRecommendedByDatabase request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseSensitivityLabelsClient) ListRecommendedByDatabaseResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRecommendedByDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedDatabaseSensitivityLabelsClient) listRecommendedByDatabaseNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "listRecommendedByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRecommendedByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "listRecommendedByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRecommendedByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "listRecommendedByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRecommendedByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedDatabaseSensitivityLabelsClient) ListRecommendedByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result SensitivityLabelListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.ListRecommendedByDatabase") - 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.ListRecommendedByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessmentrulebaselines.go b/services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessmentrulebaselines.go deleted file mode 100644 index 7c9fb47a1e5f..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessmentrulebaselines.go +++ /dev/null @@ -1,300 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient is the the Azure SQL Database management API provides a -// RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables -// you to create, retrieve, update, and delete databases. -type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient struct { - BaseClient -} - -// NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient client. -func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string) ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { - return NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient 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 NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { - return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a -// database level rule and master for server level rule). -// parameters - the requested rule baseline resource. -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DatabaseVulnerabilityAssessmentRuleBaselineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DatabaseVulnerabilityAssessmentRuleBaselineProperties.BaselineResults", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, ruleID, baselineName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete removes the database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a -// database level rule and master for server level rule). -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment rule baseline is defined. -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a -// database level rule and master for server level rule). -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result DatabaseVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.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, managedInstanceName, databaseName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) 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 ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) GetResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentRuleBaseline, 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/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessments.go b/services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessments.go deleted file mode 100644 index 888234d2681c..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessments.go +++ /dev/null @@ -1,398 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabaseVulnerabilityAssessmentsClient is the the Azure SQL Database management API provides a RESTful set of -// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedDatabaseVulnerabilityAssessmentsClient struct { - BaseClient -} - -// NewManagedDatabaseVulnerabilityAssessmentsClient creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentsClient client. -func NewManagedDatabaseVulnerabilityAssessmentsClient(subscriptionID string) ManagedDatabaseVulnerabilityAssessmentsClient { - return NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentsClient 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 NewManagedDatabaseVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseVulnerabilityAssessmentsClient { - return ManagedDatabaseVulnerabilityAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment is defined. -// parameters - the requested resource. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters DatabaseVulnerabilityAssessment) (result DatabaseVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.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, managedInstanceName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters DatabaseVulnerabilityAssessment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ManagedDatabaseVulnerabilityAssessmentsClient) 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 ManagedDatabaseVulnerabilityAssessmentsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseVulnerabilityAssessment, 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 removes the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment is defined. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ManagedDatabaseVulnerabilityAssessmentsClient) 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 ManagedDatabaseVulnerabilityAssessmentsClient) 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 the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment is defined. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result DatabaseVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.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, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ManagedDatabaseVulnerabilityAssessmentsClient) 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 ManagedDatabaseVulnerabilityAssessmentsClient) GetResponder(resp *http.Response) (result DatabaseVulnerabilityAssessment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists the vulnerability assessments of a managed database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database for which the vulnerability assessment is defined. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result DatabaseVulnerabilityAssessmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.ListByDatabase") - defer func() { - sc := -1 - if result.dvalr.Response.Response != nil { - sc = result.dvalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.dvalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.dvalr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.dvalr.hasNextLink() && result.dvalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabaseResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) listByDatabaseNextResults(ctx context.Context, lastResults DatabaseVulnerabilityAssessmentListResult) (result DatabaseVulnerabilityAssessmentListResult, err error) { - req, err := lastResults.databaseVulnerabilityAssessmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedDatabaseVulnerabilityAssessmentsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result DatabaseVulnerabilityAssessmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentsClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessmentscans.go b/services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessmentscans.go deleted file mode 100644 index d5bea2ebbb00..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/manageddatabasevulnerabilityassessmentscans.go +++ /dev/null @@ -1,405 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedDatabaseVulnerabilityAssessmentScansClient is the the Azure SQL Database management API provides a RESTful -// set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to -// create, retrieve, update, and delete databases. -type ManagedDatabaseVulnerabilityAssessmentScansClient struct { - BaseClient -} - -// NewManagedDatabaseVulnerabilityAssessmentScansClient creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentScansClient client. -func NewManagedDatabaseVulnerabilityAssessmentScansClient(subscriptionID string) ManagedDatabaseVulnerabilityAssessmentScansClient { - return NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI creates an instance of the -// ManagedDatabaseVulnerabilityAssessmentScansClient 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 NewManagedDatabaseVulnerabilityAssessmentScansClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseVulnerabilityAssessmentScansClient { - return ManagedDatabaseVulnerabilityAssessmentScansClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Export convert an existing scan result to a human readable format. If already exists nothing happens -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the scanned database. -// scanID - the vulnerability assessment scan Id. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result DatabaseVulnerabilityAssessmentScansExport, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.Export") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExportPreparer(ctx, resourceGroupName, managedInstanceName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Export", nil, "Failure preparing request") - return - } - - resp, err := client.ExportSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure sending request") - return - } - - result, err = client.ExportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Export", resp, "Failure responding to request") - return - } - - return -} - -// ExportPreparer prepares the Export request. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ExportPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ExportSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ExportResponder(resp *http.Response) (result DatabaseVulnerabilityAssessmentScansExport, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a vulnerability assessment scan record of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result VulnerabilityAssessmentScanRecord, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.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, managedInstanceName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}", 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 ManagedDatabaseVulnerabilityAssessmentScansClient) 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 ManagedDatabaseVulnerabilityAssessmentScansClient) GetResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecord, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// InitiateScan executes a Vulnerability Assessment database scan. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) InitiateScan(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.InitiateScan") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.InitiateScanPreparer(ctx, resourceGroupName, managedInstanceName, databaseName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "InitiateScan", nil, "Failure preparing request") - return - } - - result, err = client.InitiateScanSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "InitiateScan", result.Response(), "Failure sending request") - return - } - - return -} - -// InitiateScanPreparer prepares the InitiateScan request. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) InitiateScanPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// InitiateScanSender sends the InitiateScan request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) InitiateScanSender(req *http.Request) (future ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture, 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 -} - -// InitiateScanResponder handles the response to the InitiateScan request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) InitiateScanResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByDatabase lists the vulnerability assessment scans of a database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result VulnerabilityAssessmentScanRecordListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.ListByDatabase") - defer func() { - sc := -1 - if result.vasrlr.Response.Response != nil { - sc = result.vasrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.vasrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.vasrlr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.vasrlr.hasNextLink() && result.vasrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabaseResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecordListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) listByDatabaseNextResults(ctx context.Context, lastResults VulnerabilityAssessmentScanRecordListResult) (result VulnerabilityAssessmentScanRecordListResult, err error) { - req, err := lastResults.vulnerabilityAssessmentScanRecordListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedDatabaseVulnerabilityAssessmentScansClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result VulnerabilityAssessmentScanRecordListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseVulnerabilityAssessmentScansClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstanceadministrators.go b/services/preview/sql/mgmt/v3.0/sql/managedinstanceadministrators.go deleted file mode 100644 index e4e9e04bda5e..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstanceadministrators.go +++ /dev/null @@ -1,406 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceAdministratorsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedInstanceAdministratorsClient struct { - BaseClient -} - -// NewManagedInstanceAdministratorsClient creates an instance of the ManagedInstanceAdministratorsClient client. -func NewManagedInstanceAdministratorsClient(subscriptionID string) ManagedInstanceAdministratorsClient { - return NewManagedInstanceAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceAdministratorsClientWithBaseURI creates an instance of the ManagedInstanceAdministratorsClient -// 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 NewManagedInstanceAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceAdministratorsClient { - return ManagedInstanceAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a managed instance administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the requested administrator parameters. -func (client ManagedInstanceAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceAdministrator) (result ManagedInstanceAdministratorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagedInstanceAdministratorProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedInstanceAdministratorProperties.AdministratorType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ManagedInstanceAdministratorProperties.Login", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ManagedInstanceAdministratorProperties.Sid", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.ManagedInstanceAdministratorsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstanceAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceAdministrator) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", "ActiveDirectory"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName}", 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 ManagedInstanceAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceAdministratorsCreateOrUpdateFuture, 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 ManagedInstanceAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceAdministrator, 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 a managed instance administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAdministratorsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedInstanceAdministratorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", "ActiveDirectory"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName}", 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 ManagedInstanceAdministratorsClient) DeleteSender(req *http.Request) (future ManagedInstanceAdministratorsDeleteFuture, 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 ManagedInstanceAdministratorsClient) DeleteResponder(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 gets a managed instance administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceAdministratorsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAdministrator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.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, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceAdministratorsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", "ActiveDirectory"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName}", 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 ManagedInstanceAdministratorsClient) 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 ManagedInstanceAdministratorsClient) GetResponder(resp *http.Response) (result ManagedInstanceAdministrator, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of managed instance administrators. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceAdministratorsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAdministratorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.ListByInstance") - defer func() { - sc := -1 - if result.mialr.Response.Response != nil { - sc = result.mialr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.mialr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.mialr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.mialr.hasNextLink() && result.mialr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedInstanceAdministratorsClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/administrators", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceAdministratorsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedInstanceAdministratorsClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceAdministratorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedInstanceAdministratorsClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceAdministratorListResult) (result ManagedInstanceAdministratorListResult, err error) { - req, err := lastResults.managedInstanceAdministratorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceAdministratorsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAdministratorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorsClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstanceazureadonlyauthentications.go b/services/preview/sql/mgmt/v3.0/sql/managedinstanceazureadonlyauthentications.go deleted file mode 100644 index 011bc1f2b7c6..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstanceazureadonlyauthentications.go +++ /dev/null @@ -1,406 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceAzureADOnlyAuthenticationsClient is the the Azure SQL Database management API provides a RESTful set -// of web services that interact with Azure SQL Database services to manage your databases. The API enables you to -// create, retrieve, update, and delete databases. -type ManagedInstanceAzureADOnlyAuthenticationsClient struct { - BaseClient -} - -// NewManagedInstanceAzureADOnlyAuthenticationsClient creates an instance of the -// ManagedInstanceAzureADOnlyAuthenticationsClient client. -func NewManagedInstanceAzureADOnlyAuthenticationsClient(subscriptionID string) ManagedInstanceAzureADOnlyAuthenticationsClient { - return NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI creates an instance of the -// ManagedInstanceAzureADOnlyAuthenticationsClient 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 NewManagedInstanceAzureADOnlyAuthenticationsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceAzureADOnlyAuthenticationsClient { - return ManagedInstanceAzureADOnlyAuthenticationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sets Server Active Directory only authentication property or updates an existing server Active -// Directory only authentication property. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the required parameters for creating or updating an Active Directory only authentication -// property. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceAzureADOnlyAuthentication) (result ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagedInstanceAzureADOnlyAuthProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedInstanceAzureADOnlyAuthProperties.AzureADOnlyAuthentication", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceAzureADOnlyAuthentication) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authenticationName": autorest.Encode("path", "Default"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}", 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 ManagedInstanceAzureADOnlyAuthenticationsClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture, 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 ManagedInstanceAzureADOnlyAuthenticationsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceAzureADOnlyAuthentication, 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 server Active Directory only authentication property. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authenticationName": autorest.Encode("path", "Default"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}", 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 ManagedInstanceAzureADOnlyAuthenticationsClient) DeleteSender(req *http.Request) (future ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture, 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 ManagedInstanceAzureADOnlyAuthenticationsClient) 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 a specific Azure Active Directory only authentication property. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAzureADOnlyAuthentication, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.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, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authenticationName": autorest.Encode("path", "Default"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}", 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 ManagedInstanceAzureADOnlyAuthenticationsClient) 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 ManagedInstanceAzureADOnlyAuthenticationsClient) GetResponder(resp *http.Response) (result ManagedInstanceAzureADOnlyAuthentication, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of server Azure Active Directory only authentications. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAzureADOnlyAuthListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.ListByInstance") - defer func() { - sc := -1 - if result.miaaoalr.Response.Response != nil { - sc = result.miaaoalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.miaaoalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.miaaoalr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.miaaoalr.hasNextLink() && result.miaaoalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/azureADOnlyAuthentications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceAzureADOnlyAuthListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceAzureADOnlyAuthListResult) (result ManagedInstanceAzureADOnlyAuthListResult, err error) { - req, err := lastResults.managedInstanceAzureADOnlyAuthListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceAzureADOnlyAuthenticationsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceAzureADOnlyAuthListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthenticationsClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstanceencryptionprotectors.go b/services/preview/sql/mgmt/v3.0/sql/managedinstanceencryptionprotectors.go deleted file mode 100644 index d1e8429e5263..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstanceencryptionprotectors.go +++ /dev/null @@ -1,397 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceEncryptionProtectorsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedInstanceEncryptionProtectorsClient struct { - BaseClient -} - -// NewManagedInstanceEncryptionProtectorsClient creates an instance of the ManagedInstanceEncryptionProtectorsClient -// client. -func NewManagedInstanceEncryptionProtectorsClient(subscriptionID string) ManagedInstanceEncryptionProtectorsClient { - return NewManagedInstanceEncryptionProtectorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceEncryptionProtectorsClientWithBaseURI creates an instance of the -// ManagedInstanceEncryptionProtectorsClient 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 NewManagedInstanceEncryptionProtectorsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceEncryptionProtectorsClient { - return ManagedInstanceEncryptionProtectorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates an existing encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the requested encryption protector resource state. -func (client ManagedInstanceEncryptionProtectorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceEncryptionProtector) (result ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstanceEncryptionProtectorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceEncryptionProtector) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}", 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 ManagedInstanceEncryptionProtectorsClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture, 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 ManagedInstanceEncryptionProtectorsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceEncryptionProtector, 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 a managed instance encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceEncryptionProtectorsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtector, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.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, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceEncryptionProtectorsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}", 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 ManagedInstanceEncryptionProtectorsClient) 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 ManagedInstanceEncryptionProtectorsClient) GetResponder(resp *http.Response) (result ManagedInstanceEncryptionProtector, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of managed instance encryption protectors -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtectorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.ListByInstance") - defer func() { - sc := -1 - if result.mieplr.Response.Response != nil { - sc = result.mieplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.mieplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.mieplr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.mieplr.hasNextLink() && result.mieplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/encryptionProtector", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceEncryptionProtectorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedInstanceEncryptionProtectorsClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceEncryptionProtectorListResult) (result ManagedInstanceEncryptionProtectorListResult, err error) { - req, err := lastResults.managedInstanceEncryptionProtectorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceEncryptionProtectorsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtectorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} - -// Revalidate revalidates an existing encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceEncryptionProtectorsClient) Revalidate(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorsClient.Revalidate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RevalidatePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Revalidate", nil, "Failure preparing request") - return - } - - result, err = client.RevalidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsClient", "Revalidate", result.Response(), "Failure sending request") - return - } - - return -} - -// RevalidatePreparer prepares the Revalidate request. -func (client ManagedInstanceEncryptionProtectorsClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevalidateSender sends the Revalidate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceEncryptionProtectorsClient) RevalidateSender(req *http.Request) (future ManagedInstanceEncryptionProtectorsRevalidateFuture, 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 -} - -// RevalidateResponder handles the response to the Revalidate request. The method always -// closes the http.Response Body. -func (client ManagedInstanceEncryptionProtectorsClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstancekeys.go b/services/preview/sql/mgmt/v3.0/sql/managedinstancekeys.go deleted file mode 100644 index a4f4e479a482..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstancekeys.go +++ /dev/null @@ -1,403 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceKeysClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ManagedInstanceKeysClient struct { - BaseClient -} - -// NewManagedInstanceKeysClient creates an instance of the ManagedInstanceKeysClient client. -func NewManagedInstanceKeysClient(subscriptionID string) ManagedInstanceKeysClient { - return NewManagedInstanceKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceKeysClientWithBaseURI creates an instance of the ManagedInstanceKeysClient 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 NewManagedInstanceKeysClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceKeysClient { - return ManagedInstanceKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a managed instance key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// keyName - the name of the managed instance key to be operated on (updated or created). -// parameters - the requested managed instance key resource state. -func (client ManagedInstanceKeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string, parameters ManagedInstanceKey) (result ManagedInstanceKeysCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, keyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstanceKeysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string, parameters ManagedInstanceKey) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", 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 ManagedInstanceKeysClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceKeysCreateOrUpdateFuture, 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 ManagedInstanceKeysClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceKey, 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 the managed instance key with the given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// keyName - the name of the managed instance key to be deleted. -func (client ManagedInstanceKeysClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (result ManagedInstanceKeysDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedInstanceKeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", 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 ManagedInstanceKeysClient) DeleteSender(req *http.Request) (future ManagedInstanceKeysDeleteFuture, 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 ManagedInstanceKeysClient) 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 a managed instance key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// keyName - the name of the managed instance key to be retrieved. -func (client ManagedInstanceKeysClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (result ManagedInstanceKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.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, managedInstanceName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/keys/{keyName}", 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 ManagedInstanceKeysClient) 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 ManagedInstanceKeysClient) GetResponder(resp *http.Response) (result ManagedInstanceKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of managed instance keys. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// filter - an OData filter expression that filters elements in the collection. -func (client ManagedInstanceKeysClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (result ManagedInstanceKeyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.ListByInstance") - defer func() { - sc := -1 - if result.miklr.Response.Response != nil { - sc = result.miklr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.miklr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.miklr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.miklr.hasNextLink() && result.miklr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedInstanceKeysClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Sql/managedInstances/{managedInstanceName}/keys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceKeysClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedInstanceKeysClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceKeyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedInstanceKeysClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceKeyListResult) (result ManagedInstanceKeyListResult, err error) { - req, err := lastResults.managedInstanceKeyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceKeysClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (result ManagedInstanceKeyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeysClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName, filter) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstancelongtermretentionpolicies.go b/services/preview/sql/mgmt/v3.0/sql/managedinstancelongtermretentionpolicies.go deleted file mode 100644 index d0e380b54953..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstancelongtermretentionpolicies.go +++ /dev/null @@ -1,322 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceLongTermRetentionPoliciesClient is the the Azure SQL Database management API provides a RESTful set -// of web services that interact with Azure SQL Database services to manage your databases. The API enables you to -// create, retrieve, update, and delete databases. -type ManagedInstanceLongTermRetentionPoliciesClient struct { - BaseClient -} - -// NewManagedInstanceLongTermRetentionPoliciesClient creates an instance of the -// ManagedInstanceLongTermRetentionPoliciesClient client. -func NewManagedInstanceLongTermRetentionPoliciesClient(subscriptionID string) ManagedInstanceLongTermRetentionPoliciesClient { - return NewManagedInstanceLongTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceLongTermRetentionPoliciesClientWithBaseURI creates an instance of the -// ManagedInstanceLongTermRetentionPoliciesClient 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 NewManagedInstanceLongTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceLongTermRetentionPoliciesClient { - return ManagedInstanceLongTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sets a managed database's long term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -// parameters - the long term retention policy info. -func (client ManagedInstanceLongTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedInstanceLongTermRetentionPolicy) (result ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstanceLongTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedInstanceLongTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}", 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 ManagedInstanceLongTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture, 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 ManagedInstanceLongTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionPolicy, 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 a managed database's long term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedInstanceLongTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedInstanceLongTermRetentionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPoliciesClient.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, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceLongTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{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 ManagedInstanceLongTermRetentionPoliciesClient) 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 ManagedInstanceLongTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets a database's long term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedInstanceLongTermRetentionPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedInstanceLongTermRetentionPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPoliciesClient.ListByDatabase") - defer func() { - sc := -1 - if result.miltrplr.Response.Response != nil { - sc = result.miltrplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.miltrplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.miltrplr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.miltrplr.hasNextLink() && result.miltrplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ManagedInstanceLongTermRetentionPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceLongTermRetentionPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ManagedInstanceLongTermRetentionPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result ManagedInstanceLongTermRetentionPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedInstanceLongTermRetentionPoliciesClient) listByDatabaseNextResults(ctx context.Context, lastResults ManagedInstanceLongTermRetentionPolicyListResult) (result ManagedInstanceLongTermRetentionPolicyListResult, err error) { - req, err := lastResults.managedInstanceLongTermRetentionPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceLongTermRetentionPoliciesClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedInstanceLongTermRetentionPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPoliciesClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstanceoperations.go b/services/preview/sql/mgmt/v3.0/sql/managedinstanceoperations.go deleted file mode 100644 index 66646cac5c47..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstanceoperations.go +++ /dev/null @@ -1,309 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// ManagedInstanceOperationsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type ManagedInstanceOperationsClient struct { - BaseClient -} - -// NewManagedInstanceOperationsClient creates an instance of the ManagedInstanceOperationsClient client. -func NewManagedInstanceOperationsClient(subscriptionID string) ManagedInstanceOperationsClient { - return NewManagedInstanceOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceOperationsClientWithBaseURI creates an instance of the ManagedInstanceOperationsClient 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 NewManagedInstanceOperationsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceOperationsClient { - return ManagedInstanceOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancels the asynchronous operation on the managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceOperationsClient) Cancel(ctx context.Context, resourceGroupName string, managedInstanceName string, operationID uuid.UUID) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationsClient.Cancel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelPreparer(ctx, resourceGroupName, managedInstanceName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "Cancel", resp, "Failure responding to request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client ManagedInstanceOperationsClient) CancelPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, operationID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/managedInstances/{managedInstanceName}/operations/{operationId}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceOperationsClient) CancelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client ManagedInstanceOperationsClient) CancelResponder(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 management operation on a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceOperationsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, operationID uuid.UUID) (result ManagedInstanceOperation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationsClient.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, managedInstanceName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceOperationsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, operationID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/managedInstances/{managedInstanceName}/operations/{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 ManagedInstanceOperationsClient) 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 ManagedInstanceOperationsClient) GetResponder(resp *http.Response) (result ManagedInstanceOperation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByManagedInstance gets a list of operations performed on the managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstanceOperationsClient) ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceOperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationsClient.ListByManagedInstance") - defer func() { - sc := -1 - if result.miolr.Response.Response != nil { - sc = result.miolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByManagedInstanceNextResults - req, err := client.ListByManagedInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "ListByManagedInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByManagedInstanceSender(req) - if err != nil { - result.miolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "ListByManagedInstance", resp, "Failure sending request") - return - } - - result.miolr, err = client.ListByManagedInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "ListByManagedInstance", resp, "Failure responding to request") - return - } - if result.miolr.hasNextLink() && result.miolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByManagedInstancePreparer prepares the ListByManagedInstance request. -func (client ManagedInstanceOperationsClient) ListByManagedInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/managedInstances/{managedInstanceName}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByManagedInstanceSender sends the ListByManagedInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceOperationsClient) ListByManagedInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByManagedInstanceResponder handles the response to the ListByManagedInstance request. The method always -// closes the http.Response Body. -func (client ManagedInstanceOperationsClient) ListByManagedInstanceResponder(resp *http.Response) (result ManagedInstanceOperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByManagedInstanceNextResults retrieves the next set of results, if any. -func (client ManagedInstanceOperationsClient) listByManagedInstanceNextResults(ctx context.Context, lastResults ManagedInstanceOperationListResult) (result ManagedInstanceOperationListResult, err error) { - req, err := lastResults.managedInstanceOperationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "listByManagedInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByManagedInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "listByManagedInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByManagedInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceOperationsClient", "listByManagedInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByManagedInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceOperationsClient) ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceOperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationsClient.ListByManagedInstance") - 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.ListByManagedInstance(ctx, resourceGroupName, managedInstanceName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstances.go b/services/preview/sql/mgmt/v3.0/sql/managedinstances.go deleted file mode 100644 index 652a8d675c0e..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstances.go +++ /dev/null @@ -1,803 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstancesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ManagedInstancesClient struct { - BaseClient -} - -// NewManagedInstancesClient creates an instance of the ManagedInstancesClient client. -func NewManagedInstancesClient(subscriptionID string) ManagedInstancesClient { - return NewManagedInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstancesClientWithBaseURI creates an instance of the ManagedInstancesClient 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 NewManagedInstancesClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstancesClient { - return ManagedInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the requested managed instance resource state. -func (client ManagedInstancesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstance) (result ManagedInstancesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ManagedInstancesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstancesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstance) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstancesCreateOrUpdateFuture, 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 ManagedInstancesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstance, 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 a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstancesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstancesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedInstancesClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) DeleteSender(req *http.Request) (future ManagedInstancesDeleteFuture, 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 ManagedInstancesClient) 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 -} - -// Failover failovers a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -// replicaType - the type of replica to be failed over. -func (client ManagedInstancesClient) Failover(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType ReplicaType) (result ManagedInstancesFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.Failover") - 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("sql.ManagedInstancesClient", "Failover", err.Error()) - } - - req, err := client.FailoverPreparer(ctx, resourceGroupName, managedInstanceName, replicaType) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client ManagedInstancesClient) FailoverPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType ReplicaType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(replicaType)) > 0 { - queryParameters["replicaType"] = autorest.Encode("query", replicaType) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstancesClient) FailoverSender(req *http.Request) (future ManagedInstancesFailoverFuture, 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 -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client ManagedInstancesClient) FailoverResponder(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 gets a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedInstancesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstance, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.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, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstancesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) 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 ManagedInstancesClient) GetResponder(resp *http.Response) (result ManagedInstance, 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 managed instances in the subscription. -func (client ManagedInstancesClient) List(ctx context.Context) (result ManagedInstanceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.List") - defer func() { - sc := -1 - if result.milr.Response.Response != nil { - sc = result.milr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.milr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "List", resp, "Failure sending request") - return - } - - result.milr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "List", resp, "Failure responding to request") - return - } - if result.milr.hasNextLink() && result.milr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ManagedInstancesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances", 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 ManagedInstancesClient) 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 ManagedInstancesClient) ListResponder(resp *http.Response) (result ManagedInstanceListResult, 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 ManagedInstancesClient) listNextResults(ctx context.Context, lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { - req, err := lastResults.managedInstanceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "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, "sql.ManagedInstancesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstancesClient) ListComplete(ctx context.Context) (result ManagedInstanceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.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 -} - -// ListByInstancePool gets a list of all managed instances in an instance pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// instancePoolName - the instance pool name. -func (client ManagedInstancesClient) ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") - defer func() { - sc := -1 - if result.milr.Response.Response != nil { - sc = result.milr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstancePoolNextResults - req, err := client.ListByInstancePoolPreparer(ctx, resourceGroupName, instancePoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstancePoolSender(req) - if err != nil { - result.milr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure sending request") - return - } - - result.milr, err = client.ListByInstancePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByInstancePool", resp, "Failure responding to request") - return - } - if result.milr.hasNextLink() && result.milr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePoolPreparer prepares the ListByInstancePool request. -func (client ManagedInstancesClient) ListByInstancePoolPreparer(ctx context.Context, resourceGroupName string, instancePoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instancePoolName": autorest.Encode("path", instancePoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/instancePools/{instancePoolName}/managedInstances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstancePoolSender sends the ListByInstancePool request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstancesClient) ListByInstancePoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstancePoolResponder handles the response to the ListByInstancePool request. The method always -// closes the http.Response Body. -func (client ManagedInstancesClient) ListByInstancePoolResponder(resp *http.Response) (result ManagedInstanceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstancePoolNextResults retrieves the next set of results, if any. -func (client ManagedInstancesClient) listByInstancePoolNextResults(ctx context.Context, lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { - req, err := lastResults.managedInstanceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstancePoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstancePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByInstancePoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstancePoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstancesClient) ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result ManagedInstanceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByInstancePool") - 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.ListByInstancePool(ctx, resourceGroupName, instancePoolName) - return -} - -// ListByResourceGroup gets a list of managed instances in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -func (client ManagedInstancesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedInstanceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.milr.Response.Response != nil { - sc = result.milr.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, "sql.ManagedInstancesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.milr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.milr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.milr.hasNextLink() && result.milr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ManagedInstancesClient) 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-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.Sql/managedInstances", 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 ManagedInstancesClient) 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 ManagedInstancesClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedInstanceListResult, 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 ManagedInstancesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ManagedInstanceListResult) (result ManagedInstanceListResult, err error) { - req, err := lastResults.managedInstanceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "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, "sql.ManagedInstancesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstancesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ManagedInstanceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.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 -} - -// Update updates a managed instance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the requested managed instance resource state. -func (client ManagedInstancesClient) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceUpdate) (result ManagedInstancesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ManagedInstancesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}", 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 ManagedInstancesClient) UpdateSender(req *http.Request) (future ManagedInstancesUpdateFuture, 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 ManagedInstancesClient) UpdateResponder(resp *http.Response) (result ManagedInstance, 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/preview/sql/mgmt/v3.0/sql/managedinstancetdecertificates.go b/services/preview/sql/mgmt/v3.0/sql/managedinstancetdecertificates.go deleted file mode 100644 index 3b0f0fd7c404..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstancetdecertificates.go +++ /dev/null @@ -1,124 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceTdeCertificatesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedInstanceTdeCertificatesClient struct { - BaseClient -} - -// NewManagedInstanceTdeCertificatesClient creates an instance of the ManagedInstanceTdeCertificatesClient client. -func NewManagedInstanceTdeCertificatesClient(subscriptionID string) ManagedInstanceTdeCertificatesClient { - return NewManagedInstanceTdeCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceTdeCertificatesClientWithBaseURI creates an instance of the ManagedInstanceTdeCertificatesClient -// 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 NewManagedInstanceTdeCertificatesClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceTdeCertificatesClient { - return ManagedInstanceTdeCertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a TDE certificate for a given server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the requested TDE certificate to be created or updated. -func (client ManagedInstanceTdeCertificatesClient) Create(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters TdeCertificate) (result ManagedInstanceTdeCertificatesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceTdeCertificatesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TdeCertificateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TdeCertificateProperties.PrivateBlob", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ManagedInstanceTdeCertificatesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceTdeCertificatesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceTdeCertificatesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ManagedInstanceTdeCertificatesClient) CreatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters TdeCertificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/tdeCertificates", 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 ManagedInstanceTdeCertificatesClient) CreateSender(req *http.Request) (future ManagedInstanceTdeCertificatesCreateFuture, 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 ManagedInstanceTdeCertificatesClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstancevulnerabilityassessments.go b/services/preview/sql/mgmt/v3.0/sql/managedinstancevulnerabilityassessments.go deleted file mode 100644 index f253dcc02c87..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstancevulnerabilityassessments.go +++ /dev/null @@ -1,398 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedInstanceVulnerabilityAssessmentsClient is the the Azure SQL Database management API provides a RESTful set of -// web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedInstanceVulnerabilityAssessmentsClient struct { - BaseClient -} - -// NewManagedInstanceVulnerabilityAssessmentsClient creates an instance of the -// ManagedInstanceVulnerabilityAssessmentsClient client. -func NewManagedInstanceVulnerabilityAssessmentsClient(subscriptionID string) ManagedInstanceVulnerabilityAssessmentsClient { - return NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI creates an instance of the -// ManagedInstanceVulnerabilityAssessmentsClient 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 NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceVulnerabilityAssessmentsClient { - return ManagedInstanceVulnerabilityAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the managed instance's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance for which the vulnerability assessment is defined. -// parameters - the requested resource. -func (client ManagedInstanceVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceVulnerabilityAssessment) (result ManagedInstanceVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagedInstanceVulnerabilityAssessmentProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedInstanceVulnerabilityAssessmentProperties.StorageContainerPath", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ManagedInstanceVulnerabilityAssessmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedInstanceVulnerabilityAssessmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceVulnerabilityAssessment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ManagedInstanceVulnerabilityAssessmentsClient) 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 ManagedInstanceVulnerabilityAssessmentsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceVulnerabilityAssessment, 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 removes the managed instance's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance for which the vulnerability assessment is defined. -func (client ManagedInstanceVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedInstanceVulnerabilityAssessmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ManagedInstanceVulnerabilityAssessmentsClient) 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 ManagedInstanceVulnerabilityAssessmentsClient) 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 the managed instance's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance for which the vulnerability assessment is defined. -func (client ManagedInstanceVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentsClient.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, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedInstanceVulnerabilityAssessmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ManagedInstanceVulnerabilityAssessmentsClient) 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 ManagedInstanceVulnerabilityAssessmentsClient) GetResponder(resp *http.Response) (result ManagedInstanceVulnerabilityAssessment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets the managed instance's vulnerability assessment policies. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance for which the vulnerability assessments is defined. -func (client ManagedInstanceVulnerabilityAssessmentsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceVulnerabilityAssessmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentsClient.ListByInstance") - defer func() { - sc := -1 - if result.mivalr.Response.Response != nil { - sc = result.mivalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.mivalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.mivalr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.mivalr.hasNextLink() && result.mivalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedInstanceVulnerabilityAssessmentsClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedInstanceVulnerabilityAssessmentsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedInstanceVulnerabilityAssessmentsClient) ListByInstanceResponder(resp *http.Response) (result ManagedInstanceVulnerabilityAssessmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedInstanceVulnerabilityAssessmentsClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedInstanceVulnerabilityAssessmentListResult) (result ManagedInstanceVulnerabilityAssessmentListResult, err error) { - req, err := lastResults.managedInstanceVulnerabilityAssessmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceVulnerabilityAssessmentsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedInstanceVulnerabilityAssessmentsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceVulnerabilityAssessmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentsClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies.go b/services/preview/sql/mgmt/v3.0/sql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies.go deleted file mode 100644 index ee0dd38ca42c..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies.go +++ /dev/null @@ -1,404 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient is the the Azure SQL Database management API -// provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The -// API enables you to create, retrieve, update, and delete databases. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient struct { - BaseClient -} - -// NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient creates an instance of the -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient client. -func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient(subscriptionID string) ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { - return NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientWithBaseURI creates an instance of the -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient 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 NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { - return ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sets a database's long term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the long term retention policy info. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, parameters ManagedBackupShortTermRetentionPolicy) (result ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, restorableDroppedDatabaseID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, parameters ManagedBackupShortTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorableDroppedDatabaseId": autorest.Encode("path", restorableDroppedDatabaseID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}", 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 ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture, 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 ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedBackupShortTermRetentionPolicy, 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 a dropped database's short term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result ManagedBackupShortTermRetentionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.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, managedInstanceName, restorableDroppedDatabaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorableDroppedDatabaseId": autorest.Encode("path", restorableDroppedDatabaseID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{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 ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) 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 ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result ManagedBackupShortTermRetentionPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByRestorableDroppedDatabase gets a dropped database's short term retention policy list. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) ListByRestorableDroppedDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result ManagedBackupShortTermRetentionPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.ListByRestorableDroppedDatabase") - defer func() { - sc := -1 - if result.mbstrplr.Response.Response != nil { - sc = result.mbstrplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByRestorableDroppedDatabaseNextResults - req, err := client.ListByRestorableDroppedDatabasePreparer(ctx, resourceGroupName, managedInstanceName, restorableDroppedDatabaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "ListByRestorableDroppedDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRestorableDroppedDatabaseSender(req) - if err != nil { - result.mbstrplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "ListByRestorableDroppedDatabase", resp, "Failure sending request") - return - } - - result.mbstrplr, err = client.ListByRestorableDroppedDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "ListByRestorableDroppedDatabase", resp, "Failure responding to request") - return - } - if result.mbstrplr.hasNextLink() && result.mbstrplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByRestorableDroppedDatabasePreparer prepares the ListByRestorableDroppedDatabase request. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) ListByRestorableDroppedDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorableDroppedDatabaseId": autorest.Encode("path", restorableDroppedDatabaseID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByRestorableDroppedDatabaseSender sends the ListByRestorableDroppedDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) ListByRestorableDroppedDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByRestorableDroppedDatabaseResponder handles the response to the ListByRestorableDroppedDatabase request. The method always -// closes the http.Response Body. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) ListByRestorableDroppedDatabaseResponder(resp *http.Response) (result ManagedBackupShortTermRetentionPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByRestorableDroppedDatabaseNextResults retrieves the next set of results, if any. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) listByRestorableDroppedDatabaseNextResults(ctx context.Context, lastResults ManagedBackupShortTermRetentionPolicyListResult) (result ManagedBackupShortTermRetentionPolicyListResult, err error) { - req, err := lastResults.managedBackupShortTermRetentionPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "listByRestorableDroppedDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByRestorableDroppedDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "listByRestorableDroppedDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByRestorableDroppedDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "listByRestorableDroppedDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByRestorableDroppedDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) ListByRestorableDroppedDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result ManagedBackupShortTermRetentionPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.ListByRestorableDroppedDatabase") - 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.ListByRestorableDroppedDatabase(ctx, resourceGroupName, managedInstanceName, restorableDroppedDatabaseID) - return -} - -// Update sets a database's long term retention policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the long term retention policy info. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, parameters ManagedBackupShortTermRetentionPolicy) (result ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, managedInstanceName, restorableDroppedDatabaseID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, parameters ManagedBackupShortTermRetentionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "policyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorableDroppedDatabaseId": autorest.Encode("path", restorableDroppedDatabaseID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}", 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 ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) UpdateSender(req *http.Request) (future ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture, 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 ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) UpdateResponder(resp *http.Response) (result ManagedBackupShortTermRetentionPolicy, 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/preview/sql/mgmt/v3.0/sql/managedserversecurityalertpolicies.go b/services/preview/sql/mgmt/v3.0/sql/managedserversecurityalertpolicies.go deleted file mode 100644 index cda2bb6319b3..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/managedserversecurityalertpolicies.go +++ /dev/null @@ -1,316 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ManagedServerSecurityAlertPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedServerSecurityAlertPoliciesClient struct { - BaseClient -} - -// NewManagedServerSecurityAlertPoliciesClient creates an instance of the ManagedServerSecurityAlertPoliciesClient -// client. -func NewManagedServerSecurityAlertPoliciesClient(subscriptionID string) ManagedServerSecurityAlertPoliciesClient { - return NewManagedServerSecurityAlertPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedServerSecurityAlertPoliciesClientWithBaseURI creates an instance of the -// ManagedServerSecurityAlertPoliciesClient 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 NewManagedServerSecurityAlertPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ManagedServerSecurityAlertPoliciesClient { - return ManagedServerSecurityAlertPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -// parameters - the managed server security alert policy. -func (client ManagedServerSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedServerSecurityAlertPolicy) (result ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerSecurityAlertPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedServerSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedServerSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}", 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 ManagedServerSecurityAlertPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture, 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 ManagedServerSecurityAlertPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedServerSecurityAlertPolicy, 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 get a managed server's threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedServerSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerSecurityAlertPoliciesClient.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, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedServerSecurityAlertPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}", 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 ManagedServerSecurityAlertPoliciesClient) 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 ManagedServerSecurityAlertPoliciesClient) GetResponder(resp *http.Response) (result ManagedServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance get the managed server's threat detection policies. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ManagedServerSecurityAlertPoliciesClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedServerSecurityAlertPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerSecurityAlertPoliciesClient.ListByInstance") - defer func() { - sc := -1 - if result.mssaplr.Response.Response != nil { - sc = result.mssaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.mssaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.mssaplr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.mssaplr.hasNextLink() && result.mssaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ManagedServerSecurityAlertPoliciesClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedServerSecurityAlertPoliciesClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ManagedServerSecurityAlertPoliciesClient) ListByInstanceResponder(resp *http.Response) (result ManagedServerSecurityAlertPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ManagedServerSecurityAlertPoliciesClient) listByInstanceNextResults(ctx context.Context, lastResults ManagedServerSecurityAlertPolicyListResult) (result ManagedServerSecurityAlertPolicyListResult, err error) { - req, err := lastResults.managedServerSecurityAlertPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedServerSecurityAlertPoliciesClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedServerSecurityAlertPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerSecurityAlertPoliciesClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/models.go b/services/preview/sql/mgmt/v3.0/sql/models.go deleted file mode 100644 index d1fabad574b4..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/models.go +++ /dev/null @@ -1,26280 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v3.0/sql" - -// AdministratorListResult a list of active directory administrators. -type AdministratorListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerAzureADAdministrator `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdministratorListResult. -func (alr AdministratorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AdministratorListResultIterator provides access to a complete listing of ServerAzureADAdministrator -// values. -type AdministratorListResultIterator struct { - i int - page AdministratorListResultPage -} - -// 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 *AdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdministratorListResultIterator.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 *AdministratorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AdministratorListResultIterator) 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 AdministratorListResultIterator) Response() AdministratorListResult { - 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 AdministratorListResultIterator) Value() ServerAzureADAdministrator { - if !iter.page.NotDone() { - return ServerAzureADAdministrator{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AdministratorListResultIterator type. -func NewAdministratorListResultIterator(page AdministratorListResultPage) AdministratorListResultIterator { - return AdministratorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr AdministratorListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr AdministratorListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// administratorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr AdministratorListResult) administratorListResultPreparer(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))) -} - -// AdministratorListResultPage contains a page of ServerAzureADAdministrator values. -type AdministratorListResultPage struct { - fn func(context.Context, AdministratorListResult) (AdministratorListResult, error) - alr AdministratorListResult -} - -// 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 *AdministratorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdministratorListResultPage.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 *AdministratorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AdministratorListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AdministratorListResultPage) Response() AdministratorListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AdministratorListResultPage) Values() []ServerAzureADAdministrator { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the AdministratorListResultPage type. -func NewAdministratorListResultPage(cur AdministratorListResult, getNextPage func(context.Context, AdministratorListResult) (AdministratorListResult, error)) AdministratorListResultPage { - return AdministratorListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// AdministratorProperties properties of a active directory administrator. -type AdministratorProperties struct { - // AdministratorType - Type of the sever administrator. - AdministratorType *string `json:"administratorType,omitempty"` - // Login - Login name of the server administrator. - Login *string `json:"login,omitempty"` - // Sid - SID (object ID) of the server administrator. - Sid *uuid.UUID `json:"sid,omitempty"` - // TenantID - Tenant ID of the administrator. - TenantID *uuid.UUID `json:"tenantId,omitempty"` - // AzureADOnlyAuthentication - READ-ONLY; Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdministratorProperties. -func (ap AdministratorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.AdministratorType != nil { - objectMap["administratorType"] = ap.AdministratorType - } - if ap.Login != nil { - objectMap["login"] = ap.Login - } - if ap.Sid != nil { - objectMap["sid"] = ap.Sid - } - if ap.TenantID != nil { - objectMap["tenantId"] = ap.TenantID - } - return json.Marshal(objectMap) -} - -// AutomaticTuningOptions automatic tuning properties for individual advisors. -type AutomaticTuningOptions struct { - // DesiredState - Automatic tuning option desired state. Possible values include: 'AutomaticTuningOptionModeDesiredOff', 'AutomaticTuningOptionModeDesiredOn', 'AutomaticTuningOptionModeDesiredDefault' - DesiredState AutomaticTuningOptionModeDesired `json:"desiredState,omitempty"` - // ActualState - READ-ONLY; Automatic tuning option actual state. Possible values include: 'Off', 'On' - ActualState AutomaticTuningOptionModeActual `json:"actualState,omitempty"` - // ReasonCode - READ-ONLY; Reason code if desired and actual state are different. - ReasonCode *int32 `json:"reasonCode,omitempty"` - // ReasonDesc - READ-ONLY; Reason description if desired and actual state are different. Possible values include: 'Default', 'Disabled', 'AutoConfigured', 'InheritedFromServer', 'QueryStoreOff', 'QueryStoreReadOnly', 'NotSupported' - ReasonDesc AutomaticTuningDisabledReason `json:"reasonDesc,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutomaticTuningOptions. -func (ato AutomaticTuningOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ato.DesiredState != "" { - objectMap["desiredState"] = ato.DesiredState - } - return json.Marshal(objectMap) -} - -// AutomaticTuningServerOptions automatic tuning properties for individual advisors. -type AutomaticTuningServerOptions struct { - // DesiredState - Automatic tuning option desired state. Possible values include: 'AutomaticTuningOptionModeDesiredOff', 'AutomaticTuningOptionModeDesiredOn', 'AutomaticTuningOptionModeDesiredDefault' - DesiredState AutomaticTuningOptionModeDesired `json:"desiredState,omitempty"` - // ActualState - READ-ONLY; Automatic tuning option actual state. Possible values include: 'Off', 'On' - ActualState AutomaticTuningOptionModeActual `json:"actualState,omitempty"` - // ReasonCode - READ-ONLY; Reason code if desired and actual state are different. - ReasonCode *int32 `json:"reasonCode,omitempty"` - // ReasonDesc - READ-ONLY; Reason description if desired and actual state are different. Possible values include: 'AutomaticTuningServerReasonDefault', 'AutomaticTuningServerReasonDisabled', 'AutomaticTuningServerReasonAutoConfigured' - ReasonDesc AutomaticTuningServerReason `json:"reasonDesc,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutomaticTuningServerOptions. -func (atso AutomaticTuningServerOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atso.DesiredState != "" { - objectMap["desiredState"] = atso.DesiredState - } - return json.Marshal(objectMap) -} - -// AutomaticTuningServerProperties server-level Automatic Tuning properties. -type AutomaticTuningServerProperties struct { - // DesiredState - Automatic tuning desired state. Possible values include: 'AutomaticTuningServerModeCustom', 'AutomaticTuningServerModeAuto', 'AutomaticTuningServerModeUnspecified' - DesiredState AutomaticTuningServerMode `json:"desiredState,omitempty"` - // ActualState - READ-ONLY; Automatic tuning actual state. Possible values include: 'AutomaticTuningServerModeCustom', 'AutomaticTuningServerModeAuto', 'AutomaticTuningServerModeUnspecified' - ActualState AutomaticTuningServerMode `json:"actualState,omitempty"` - // Options - Automatic tuning options definition. - Options map[string]*AutomaticTuningServerOptions `json:"options"` -} - -// MarshalJSON is the custom marshaler for AutomaticTuningServerProperties. -func (atsp AutomaticTuningServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atsp.DesiredState != "" { - objectMap["desiredState"] = atsp.DesiredState - } - if atsp.Options != nil { - objectMap["options"] = atsp.Options - } - return json.Marshal(objectMap) -} - -// AutoPauseDelayTimeRange supported auto pause delay time range -type AutoPauseDelayTimeRange struct { - // MinValue - READ-ONLY; Minimum value - MinValue *int32 `json:"minValue,omitempty"` - // MaxValue - READ-ONLY; Maximum value - MaxValue *int32 `json:"maxValue,omitempty"` - // StepSize - READ-ONLY; Step value for discrete values between the minimum value and the maximum value. - StepSize *int32 `json:"stepSize,omitempty"` - // Default - READ-ONLY; Default value is no value is provided - Default *int32 `json:"default,omitempty"` - // Unit - READ-ONLY; Unit of time that delay is expressed in. Possible values include: 'Minutes' - Unit PauseDelayTimeUnit `json:"unit,omitempty"` - // DoNotPauseValue - READ-ONLY; Value that is used to not pause (infinite delay before pause) - DoNotPauseValue *int32 `json:"doNotPauseValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoPauseDelayTimeRange. -func (apdtr AutoPauseDelayTimeRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureADOnlyAuthListResult a list of active directory only authentications. -type AzureADOnlyAuthListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerAzureADOnlyAuthentication `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureADOnlyAuthListResult. -func (aaoalr AzureADOnlyAuthListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureADOnlyAuthListResultIterator provides access to a complete listing of -// ServerAzureADOnlyAuthentication values. -type AzureADOnlyAuthListResultIterator struct { - i int - page AzureADOnlyAuthListResultPage -} - -// 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 *AzureADOnlyAuthListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureADOnlyAuthListResultIterator.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 *AzureADOnlyAuthListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureADOnlyAuthListResultIterator) 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 AzureADOnlyAuthListResultIterator) Response() AzureADOnlyAuthListResult { - 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 AzureADOnlyAuthListResultIterator) Value() ServerAzureADOnlyAuthentication { - if !iter.page.NotDone() { - return ServerAzureADOnlyAuthentication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureADOnlyAuthListResultIterator type. -func NewAzureADOnlyAuthListResultIterator(page AzureADOnlyAuthListResultPage) AzureADOnlyAuthListResultIterator { - return AzureADOnlyAuthListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aaoalr AzureADOnlyAuthListResult) IsEmpty() bool { - return aaoalr.Value == nil || len(*aaoalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aaoalr AzureADOnlyAuthListResult) hasNextLink() bool { - return aaoalr.NextLink != nil && len(*aaoalr.NextLink) != 0 -} - -// azureADOnlyAuthListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aaoalr AzureADOnlyAuthListResult) azureADOnlyAuthListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aaoalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aaoalr.NextLink))) -} - -// AzureADOnlyAuthListResultPage contains a page of ServerAzureADOnlyAuthentication values. -type AzureADOnlyAuthListResultPage struct { - fn func(context.Context, AzureADOnlyAuthListResult) (AzureADOnlyAuthListResult, error) - aaoalr AzureADOnlyAuthListResult -} - -// 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 *AzureADOnlyAuthListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureADOnlyAuthListResultPage.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.aaoalr) - if err != nil { - return err - } - page.aaoalr = 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 *AzureADOnlyAuthListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureADOnlyAuthListResultPage) NotDone() bool { - return !page.aaoalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureADOnlyAuthListResultPage) Response() AzureADOnlyAuthListResult { - return page.aaoalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureADOnlyAuthListResultPage) Values() []ServerAzureADOnlyAuthentication { - if page.aaoalr.IsEmpty() { - return nil - } - return *page.aaoalr.Value -} - -// Creates a new instance of the AzureADOnlyAuthListResultPage type. -func NewAzureADOnlyAuthListResultPage(cur AzureADOnlyAuthListResult, getNextPage func(context.Context, AzureADOnlyAuthListResult) (AzureADOnlyAuthListResult, error)) AzureADOnlyAuthListResultPage { - return AzureADOnlyAuthListResultPage{ - fn: getNextPage, - aaoalr: cur, - } -} - -// AzureADOnlyAuthProperties properties of a active directory only authentication. -type AzureADOnlyAuthProperties struct { - // AzureADOnlyAuthentication - Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` -} - -// BackupLongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type BackupLongTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupLongTermRetentionPoliciesClient) (BackupLongTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupLongTermRetentionPoliciesCreateOrUpdateFuture) 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 BackupLongTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *BackupLongTermRetentionPoliciesCreateOrUpdateFuture) result(client BackupLongTermRetentionPoliciesClient) (bltrp BackupLongTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bltrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bltrp.Response.Response, err = future.GetResult(sender); err == nil && bltrp.Response.Response.StatusCode != http.StatusNoContent { - bltrp, err = client.CreateOrUpdateResponder(bltrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", bltrp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupLongTermRetentionPolicy a long term retention policy. -type BackupLongTermRetentionPolicy struct { - autorest.Response `json:"-"` - // LongTermRetentionPolicyProperties - Resource properties. - *LongTermRetentionPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for BackupLongTermRetentionPolicy. -func (bltrp BackupLongTermRetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bltrp.LongTermRetentionPolicyProperties != nil { - objectMap["properties"] = bltrp.LongTermRetentionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupLongTermRetentionPolicy struct. -func (bltrp *BackupLongTermRetentionPolicy) 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 longTermRetentionPolicyProperties LongTermRetentionPolicyProperties - err = json.Unmarshal(*v, &longTermRetentionPolicyProperties) - if err != nil { - return err - } - bltrp.LongTermRetentionPolicyProperties = &longTermRetentionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bltrp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bltrp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bltrp.Type = &typeVar - } - } - } - - return nil -} - -// BackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type BackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupShortTermRetentionPoliciesClient) (BackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupShortTermRetentionPoliciesCreateOrUpdateFuture) 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 BackupShortTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *BackupShortTermRetentionPoliciesCreateOrUpdateFuture) result(client BackupShortTermRetentionPoliciesClient) (bstrp BackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bstrp.Response.Response, err = future.GetResult(sender); err == nil && bstrp.Response.Response.StatusCode != http.StatusNoContent { - bstrp, err = client.CreateOrUpdateResponder(bstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", bstrp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupShortTermRetentionPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type BackupShortTermRetentionPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupShortTermRetentionPoliciesClient) (BackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupShortTermRetentionPoliciesUpdateFuture) 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 BackupShortTermRetentionPoliciesUpdateFuture.Result. -func (future *BackupShortTermRetentionPoliciesUpdateFuture) result(client BackupShortTermRetentionPoliciesClient) (bstrp BackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.BackupShortTermRetentionPoliciesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bstrp.Response.Response, err = future.GetResult(sender); err == nil && bstrp.Response.Response.StatusCode != http.StatusNoContent { - bstrp, err = client.UpdateResponder(bstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupShortTermRetentionPoliciesUpdateFuture", "Result", bstrp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupShortTermRetentionPolicy a short term retention policy. -type BackupShortTermRetentionPolicy struct { - autorest.Response `json:"-"` - // BackupShortTermRetentionPolicyProperties - Resource properties. - *BackupShortTermRetentionPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for BackupShortTermRetentionPolicy. -func (bstrp BackupShortTermRetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bstrp.BackupShortTermRetentionPolicyProperties != nil { - objectMap["properties"] = bstrp.BackupShortTermRetentionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupShortTermRetentionPolicy struct. -func (bstrp *BackupShortTermRetentionPolicy) 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 backupShortTermRetentionPolicyProperties BackupShortTermRetentionPolicyProperties - err = json.Unmarshal(*v, &backupShortTermRetentionPolicyProperties) - if err != nil { - return err - } - bstrp.BackupShortTermRetentionPolicyProperties = &backupShortTermRetentionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bstrp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bstrp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bstrp.Type = &typeVar - } - } - } - - return nil -} - -// BackupShortTermRetentionPolicyListResult a list of short term retention policies. -type BackupShortTermRetentionPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]BackupShortTermRetentionPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupShortTermRetentionPolicyListResult. -func (bstrplr BackupShortTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BackupShortTermRetentionPolicyListResultIterator provides access to a complete listing of -// BackupShortTermRetentionPolicy values. -type BackupShortTermRetentionPolicyListResultIterator struct { - i int - page BackupShortTermRetentionPolicyListResultPage -} - -// 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 *BackupShortTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPolicyListResultIterator.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 *BackupShortTermRetentionPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BackupShortTermRetentionPolicyListResultIterator) 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 BackupShortTermRetentionPolicyListResultIterator) Response() BackupShortTermRetentionPolicyListResult { - 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 BackupShortTermRetentionPolicyListResultIterator) Value() BackupShortTermRetentionPolicy { - if !iter.page.NotDone() { - return BackupShortTermRetentionPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BackupShortTermRetentionPolicyListResultIterator type. -func NewBackupShortTermRetentionPolicyListResultIterator(page BackupShortTermRetentionPolicyListResultPage) BackupShortTermRetentionPolicyListResultIterator { - return BackupShortTermRetentionPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bstrplr BackupShortTermRetentionPolicyListResult) IsEmpty() bool { - return bstrplr.Value == nil || len(*bstrplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bstrplr BackupShortTermRetentionPolicyListResult) hasNextLink() bool { - return bstrplr.NextLink != nil && len(*bstrplr.NextLink) != 0 -} - -// backupShortTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bstrplr BackupShortTermRetentionPolicyListResult) backupShortTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !bstrplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bstrplr.NextLink))) -} - -// BackupShortTermRetentionPolicyListResultPage contains a page of BackupShortTermRetentionPolicy values. -type BackupShortTermRetentionPolicyListResultPage struct { - fn func(context.Context, BackupShortTermRetentionPolicyListResult) (BackupShortTermRetentionPolicyListResult, error) - bstrplr BackupShortTermRetentionPolicyListResult -} - -// 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 *BackupShortTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupShortTermRetentionPolicyListResultPage.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.bstrplr) - if err != nil { - return err - } - page.bstrplr = 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 *BackupShortTermRetentionPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BackupShortTermRetentionPolicyListResultPage) NotDone() bool { - return !page.bstrplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BackupShortTermRetentionPolicyListResultPage) Response() BackupShortTermRetentionPolicyListResult { - return page.bstrplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BackupShortTermRetentionPolicyListResultPage) Values() []BackupShortTermRetentionPolicy { - if page.bstrplr.IsEmpty() { - return nil - } - return *page.bstrplr.Value -} - -// Creates a new instance of the BackupShortTermRetentionPolicyListResultPage type. -func NewBackupShortTermRetentionPolicyListResultPage(cur BackupShortTermRetentionPolicyListResult, getNextPage func(context.Context, BackupShortTermRetentionPolicyListResult) (BackupShortTermRetentionPolicyListResult, error)) BackupShortTermRetentionPolicyListResultPage { - return BackupShortTermRetentionPolicyListResultPage{ - fn: getNextPage, - bstrplr: cur, - } -} - -// BackupShortTermRetentionPolicyProperties properties of a short term retention policy -type BackupShortTermRetentionPolicyProperties struct { - // RetentionDays - The backup retention period in days. This is how many days Point-in-Time Restore will be supported. - RetentionDays *int32 `json:"retentionDays,omitempty"` -} - -// BaseLongTermRetentionPolicyProperties properties of a long term retention policy -type BaseLongTermRetentionPolicyProperties struct { - // WeeklyRetention - The weekly retention policy for an LTR backup in an ISO 8601 format. - WeeklyRetention *string `json:"weeklyRetention,omitempty"` - // MonthlyRetention - The monthly retention policy for an LTR backup in an ISO 8601 format. - MonthlyRetention *string `json:"monthlyRetention,omitempty"` - // YearlyRetention - The yearly retention policy for an LTR backup in an ISO 8601 format. - YearlyRetention *string `json:"yearlyRetention,omitempty"` - // WeekOfYear - The week of year to take the yearly backup in an ISO 8601 format. - WeekOfYear *int32 `json:"weekOfYear,omitempty"` -} - -// CheckNameAvailabilityRequest a request to check whether the specified name for a resource is available. -type CheckNameAvailabilityRequest struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResponse the result of a name availability check. -type CheckNameAvailabilityResponse struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; The name whose availability was checked. - Name *string `json:"name,omitempty"` - // Available - READ-ONLY; True if the name is available, otherwise false. - Available *bool `json:"available,omitempty"` - // Reason - READ-ONLY; The reason code explaining why the name is unavailable. Will be undefined if the name is available. Possible values include: 'Invalid', 'AlreadyExists' - Reason CheckNameAvailabilityReason `json:"reason,omitempty"` - // Message - READ-ONLY; A message explaining why the name is unavailable. Will be undefined if the name is available. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckNameAvailabilityResponse. -func (cnar CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CompleteDatabaseRestoreDefinition contains the information necessary to perform a complete database -// restore operation. -type CompleteDatabaseRestoreDefinition struct { - // LastBackupName - The last backup name to apply - LastBackupName *string `json:"lastBackupName,omitempty"` -} - -// CreateDatabaseRestorePointDefinition contains the information necessary to perform a create database -// restore point operation. -type CreateDatabaseRestorePointDefinition struct { - // RestorePointLabel - The restore point label to apply - RestorePointLabel *string `json:"restorePointLabel,omitempty"` -} - -// Database a database resource. -type Database struct { - autorest.Response `json:"-"` - // Sku - The database SKU. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: - // - // ```azurecli - // az sql db list-editions -l -o table - // ```` - // - // ```powershell - // Get-AzSqlServerServiceObjective -Location - // ```` - Sku *Sku `json:"sku,omitempty"` - // Kind - READ-ONLY; Kind of database. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ManagedBy - READ-ONLY; Resource that manages the database. - ManagedBy *string `json:"managedBy,omitempty"` - // DatabaseProperties - Resource properties. - *DatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.Sku != nil { - objectMap["sku"] = d.Sku - } - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) 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 - } - d.Sku = &sku - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - d.Kind = &kind - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - d.ManagedBy = &managedBy - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseAutomaticTuning database-level Automatic Tuning. -type DatabaseAutomaticTuning struct { - autorest.Response `json:"-"` - // DatabaseAutomaticTuningProperties - Resource properties. - *DatabaseAutomaticTuningProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseAutomaticTuning. -func (dat DatabaseAutomaticTuning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dat.DatabaseAutomaticTuningProperties != nil { - objectMap["properties"] = dat.DatabaseAutomaticTuningProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseAutomaticTuning struct. -func (dat *DatabaseAutomaticTuning) 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 databaseAutomaticTuningProperties DatabaseAutomaticTuningProperties - err = json.Unmarshal(*v, &databaseAutomaticTuningProperties) - if err != nil { - return err - } - dat.DatabaseAutomaticTuningProperties = &databaseAutomaticTuningProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dat.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dat.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dat.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseAutomaticTuningProperties database-level Automatic Tuning properties. -type DatabaseAutomaticTuningProperties struct { - // DesiredState - Automatic tuning desired state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' - DesiredState AutomaticTuningMode `json:"desiredState,omitempty"` - // ActualState - READ-ONLY; Automatic tuning actual state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' - ActualState AutomaticTuningMode `json:"actualState,omitempty"` - // Options - Automatic tuning options definition. - Options map[string]*AutomaticTuningOptions `json:"options"` -} - -// MarshalJSON is the custom marshaler for DatabaseAutomaticTuningProperties. -func (datp DatabaseAutomaticTuningProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if datp.DesiredState != "" { - objectMap["desiredState"] = datp.DesiredState - } - if datp.Options != nil { - objectMap["options"] = datp.Options - } - return json.Marshal(objectMap) -} - -// DatabaseBlobAuditingPolicy a database blob auditing policy. -type DatabaseBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty"` - // DatabaseBlobAuditingPolicyProperties - Resource properties. - *DatabaseBlobAuditingPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseBlobAuditingPolicy. -func (dbap DatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dbap.DatabaseBlobAuditingPolicyProperties != nil { - objectMap["properties"] = dbap.DatabaseBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseBlobAuditingPolicy struct. -func (dbap *DatabaseBlobAuditingPolicy) 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 - } - dbap.Kind = &kind - } - case "properties": - if v != nil { - var databaseBlobAuditingPolicyProperties DatabaseBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &databaseBlobAuditingPolicyProperties) - if err != nil { - return err - } - dbap.DatabaseBlobAuditingPolicyProperties = &databaseBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dbap.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseBlobAuditingPolicyListResult a list of database auditing settings. -type DatabaseBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]DatabaseBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseBlobAuditingPolicyListResult. -func (dbaplr DatabaseBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseBlobAuditingPolicyListResultIterator provides access to a complete listing of -// DatabaseBlobAuditingPolicy values. -type DatabaseBlobAuditingPolicyListResultIterator struct { - i int - page DatabaseBlobAuditingPolicyListResultPage -} - -// 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 *DatabaseBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPolicyListResultIterator.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 *DatabaseBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseBlobAuditingPolicyListResultIterator) 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 DatabaseBlobAuditingPolicyListResultIterator) Response() DatabaseBlobAuditingPolicyListResult { - 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 DatabaseBlobAuditingPolicyListResultIterator) Value() DatabaseBlobAuditingPolicy { - if !iter.page.NotDone() { - return DatabaseBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseBlobAuditingPolicyListResultIterator type. -func NewDatabaseBlobAuditingPolicyListResultIterator(page DatabaseBlobAuditingPolicyListResultPage) DatabaseBlobAuditingPolicyListResultIterator { - return DatabaseBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dbaplr DatabaseBlobAuditingPolicyListResult) IsEmpty() bool { - return dbaplr.Value == nil || len(*dbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dbaplr DatabaseBlobAuditingPolicyListResult) hasNextLink() bool { - return dbaplr.NextLink != nil && len(*dbaplr.NextLink) != 0 -} - -// databaseBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dbaplr DatabaseBlobAuditingPolicyListResult) databaseBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dbaplr.NextLink))) -} - -// DatabaseBlobAuditingPolicyListResultPage contains a page of DatabaseBlobAuditingPolicy values. -type DatabaseBlobAuditingPolicyListResultPage struct { - fn func(context.Context, DatabaseBlobAuditingPolicyListResult) (DatabaseBlobAuditingPolicyListResult, error) - dbaplr DatabaseBlobAuditingPolicyListResult -} - -// 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 *DatabaseBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPolicyListResultPage.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.dbaplr) - if err != nil { - return err - } - page.dbaplr = 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 *DatabaseBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.dbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseBlobAuditingPolicyListResultPage) Response() DatabaseBlobAuditingPolicyListResult { - return page.dbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseBlobAuditingPolicyListResultPage) Values() []DatabaseBlobAuditingPolicy { - if page.dbaplr.IsEmpty() { - return nil - } - return *page.dbaplr.Value -} - -// Creates a new instance of the DatabaseBlobAuditingPolicyListResultPage type. -func NewDatabaseBlobAuditingPolicyListResultPage(cur DatabaseBlobAuditingPolicyListResult, getNextPage func(context.Context, DatabaseBlobAuditingPolicyListResult) (DatabaseBlobAuditingPolicyListResult, error)) DatabaseBlobAuditingPolicyListResultPage { - return DatabaseBlobAuditingPolicyListResultPage{ - fn: getNextPage, - dbaplr: cur, - } -} - -// DatabaseBlobAuditingPolicyProperties properties of a database blob auditing policy. -type DatabaseBlobAuditingPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// DatabaseListResult a list of databases. -type DatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Database `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseListResult. -func (dlr DatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseListResultIterator provides access to a complete listing of Database values. -type DatabaseListResultIterator struct { - i int - page DatabaseListResultPage -} - -// 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 *DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultIterator.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 *DatabaseListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseListResultIterator) 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 DatabaseListResultIterator) Response() DatabaseListResult { - 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 DatabaseListResultIterator) Value() Database { - if !iter.page.NotDone() { - return Database{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseListResultIterator type. -func NewDatabaseListResultIterator(page DatabaseListResultPage) DatabaseListResultIterator { - return DatabaseListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DatabaseListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DatabaseListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// databaseListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DatabaseListResult) databaseListResultPreparer(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))) -} - -// DatabaseListResultPage contains a page of Database values. -type DatabaseListResultPage struct { - fn func(context.Context, DatabaseListResult) (DatabaseListResult, error) - dlr DatabaseListResult -} - -// 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 *DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultPage.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 *DatabaseListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseListResultPage) Response() DatabaseListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseListResultPage) Values() []Database { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DatabaseListResultPage type. -func NewDatabaseListResultPage(cur DatabaseListResult, getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage { - return DatabaseListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DatabaseOperation a database operation. -type DatabaseOperation struct { - // DatabaseOperationProperties - Resource properties. - *DatabaseOperationProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseOperation. -func (do DatabaseOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if do.DatabaseOperationProperties != nil { - objectMap["properties"] = do.DatabaseOperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseOperation struct. -func (do *DatabaseOperation) 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 databaseOperationProperties DatabaseOperationProperties - err = json.Unmarshal(*v, &databaseOperationProperties) - if err != nil { - return err - } - do.DatabaseOperationProperties = &databaseOperationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - do.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - do.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - do.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseOperationListResult the response to a list database operations request -type DatabaseOperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]DatabaseOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseOperationListResult. -func (dolr DatabaseOperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseOperationListResultIterator provides access to a complete listing of DatabaseOperation values. -type DatabaseOperationListResultIterator struct { - i int - page DatabaseOperationListResultPage -} - -// 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 *DatabaseOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationListResultIterator.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 *DatabaseOperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseOperationListResultIterator) 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 DatabaseOperationListResultIterator) Response() DatabaseOperationListResult { - 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 DatabaseOperationListResultIterator) Value() DatabaseOperation { - if !iter.page.NotDone() { - return DatabaseOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseOperationListResultIterator type. -func NewDatabaseOperationListResultIterator(page DatabaseOperationListResultPage) DatabaseOperationListResultIterator { - return DatabaseOperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dolr DatabaseOperationListResult) IsEmpty() bool { - return dolr.Value == nil || len(*dolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dolr DatabaseOperationListResult) hasNextLink() bool { - return dolr.NextLink != nil && len(*dolr.NextLink) != 0 -} - -// databaseOperationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dolr DatabaseOperationListResult) databaseOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dolr.NextLink))) -} - -// DatabaseOperationListResultPage contains a page of DatabaseOperation values. -type DatabaseOperationListResultPage struct { - fn func(context.Context, DatabaseOperationListResult) (DatabaseOperationListResult, error) - dolr DatabaseOperationListResult -} - -// 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 *DatabaseOperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationListResultPage.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.dolr) - if err != nil { - return err - } - page.dolr = 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 *DatabaseOperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseOperationListResultPage) NotDone() bool { - return !page.dolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseOperationListResultPage) Response() DatabaseOperationListResult { - return page.dolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseOperationListResultPage) Values() []DatabaseOperation { - if page.dolr.IsEmpty() { - return nil - } - return *page.dolr.Value -} - -// Creates a new instance of the DatabaseOperationListResultPage type. -func NewDatabaseOperationListResultPage(cur DatabaseOperationListResult, getNextPage func(context.Context, DatabaseOperationListResult) (DatabaseOperationListResult, error)) DatabaseOperationListResultPage { - return DatabaseOperationListResultPage{ - fn: getNextPage, - dolr: cur, - } -} - -// DatabaseOperationProperties the properties of a database operation. -type DatabaseOperationProperties struct { - // DatabaseName - READ-ONLY; The name of the database the operation is being performed on. - DatabaseName *string `json:"databaseName,omitempty"` - // Operation - READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty"` - // OperationFriendlyName - READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` - // PercentComplete - READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ServerName - READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The operation state. Possible values include: 'ManagementOperationStatePending', 'ManagementOperationStateInProgress', 'ManagementOperationStateSucceeded', 'ManagementOperationStateFailed', 'ManagementOperationStateCancelInProgress', 'ManagementOperationStateCancelled' - State ManagementOperationState `json:"state,omitempty"` - // ErrorCode - READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorDescription - READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty"` - // ErrorSeverity - READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // IsUserError - READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty"` - // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` - // Description - READ-ONLY; The operation description. - Description *string `json:"description,omitempty"` - // IsCancellable - READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseOperationProperties. -func (dop DatabaseOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseProperties the database's properties. -type DatabaseProperties struct { - // CreateMode - Specifies the mode of database creation. - // - // Default: regular database creation. - // - // Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. - // - // Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. - // - // PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. - // - // Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. - // - // Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. - // - // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. - // - // Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'CreateModeDefault', 'CreateModeCopy', 'CreateModeSecondary', 'CreateModePointInTimeRestore', 'CreateModeRestore', 'CreateModeRecovery', 'CreateModeRestoreExternalBackup', 'CreateModeRestoreExternalBackupSecondary', 'CreateModeRestoreLongTermRetentionBackup', 'CreateModeOnlineSecondary' - CreateMode CreateMode `json:"createMode,omitempty"` - // Collation - The collation of the database. - Collation *string `json:"collation,omitempty"` - // MaxSizeBytes - The max size of the database expressed in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // SampleName - The name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' - SampleName SampleName `json:"sampleName,omitempty"` - // ElasticPoolID - The resource identifier of the elastic pool containing this database. - ElasticPoolID *string `json:"elasticPoolId,omitempty"` - // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // Status - READ-ONLY; The status of the database. Possible values include: 'DatabaseStatusOnline', 'DatabaseStatusRestoring', 'DatabaseStatusRecoveryPending', 'DatabaseStatusRecovering', 'DatabaseStatusSuspect', 'DatabaseStatusOffline', 'DatabaseStatusStandby', 'DatabaseStatusShutdown', 'DatabaseStatusEmergencyMode', 'DatabaseStatusAutoClosed', 'DatabaseStatusCopying', 'DatabaseStatusCreating', 'DatabaseStatusInaccessible', 'DatabaseStatusOfflineSecondary', 'DatabaseStatusPausing', 'DatabaseStatusPaused', 'DatabaseStatusResuming', 'DatabaseStatusScaling', 'DatabaseStatusOfflineChangingDwPerformanceTiers', 'DatabaseStatusOnlineChangingDwPerformanceTiers', 'DatabaseStatusDisabled' - Status DatabaseStatus `json:"status,omitempty"` - // DatabaseID - READ-ONLY; The ID of the database. - DatabaseID *uuid.UUID `json:"databaseId,omitempty"` - // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // CurrentServiceObjectiveName - READ-ONLY; The current service level objective name of the database. - CurrentServiceObjectiveName *string `json:"currentServiceObjectiveName,omitempty"` - // RequestedServiceObjectiveName - READ-ONLY; The requested service level objective name of the database. - RequestedServiceObjectiveName *string `json:"requestedServiceObjectiveName,omitempty"` - // DefaultSecondaryLocation - READ-ONLY; The default secondary region for this database. - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` - // FailoverGroupID - READ-ONLY; Failover Group resource identifier that this database belongs to. - FailoverGroupID *string `json:"failoverGroupId,omitempty"` - // RestorePointInTime - Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // SourceDatabaseDeletionDate - Specifies the time that the database was deleted. - SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` - // RecoveryServicesRecoveryPointID - The resource identifier of the recovery point associated with create operation of this database. - RecoveryServicesRecoveryPointID *string `json:"recoveryServicesRecoveryPointId,omitempty"` - // LongTermRetentionBackupResourceID - The resource identifier of the long term retention backup associated with create operation of this database. - LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` - // RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database. - RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` - // RestorableDroppedDatabaseID - The resource identifier of the restorable dropped database associated with create operation of this database. - RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` - // CatalogCollation - Collation of the metadata catalog. Possible values include: 'DATABASEDEFAULT', 'SQLLatin1GeneralCP1CIAS' - CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"` - // ZoneRedundant - Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // LicenseType - The license type to apply for this database. `LicenseIncluded` if you need a license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. Possible values include: 'LicenseIncluded', 'BasePrice' - LicenseType DatabaseLicenseType `json:"licenseType,omitempty"` - // MaxLogSizeBytes - READ-ONLY; The max log size for this database. - MaxLogSizeBytes *int64 `json:"maxLogSizeBytes,omitempty"` - // EarliestRestoreDate - READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // ReadScale - The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'DatabaseReadScaleEnabled', 'DatabaseReadScaleDisabled' - ReadScale DatabaseReadScale `json:"readScale,omitempty"` - // ReadReplicaCount - The number of readonly secondary replicas associated with the database. - ReadReplicaCount *int32 `json:"readReplicaCount,omitempty"` - // CurrentSku - READ-ONLY; The name and tier of the SKU. - CurrentSku *Sku `json:"currentSku,omitempty"` - // AutoPauseDelay - Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled - AutoPauseDelay *int32 `json:"autoPauseDelay,omitempty"` - // StorageAccountType - The storage account type used to store backups for this database. Possible values include: 'GRS', 'LRS', 'ZRS' - StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` - // MinCapacity - Minimal capacity that database will always have allocated, if not paused - MinCapacity *float64 `json:"minCapacity,omitempty"` - // PausedDate - READ-ONLY; The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. - PausedDate *date.Time `json:"pausedDate,omitempty"` - // ResumedDate - READ-ONLY; The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. - ResumedDate *date.Time `json:"resumedDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseProperties. -func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.CreateMode != "" { - objectMap["createMode"] = dp.CreateMode - } - if dp.Collation != nil { - objectMap["collation"] = dp.Collation - } - if dp.MaxSizeBytes != nil { - objectMap["maxSizeBytes"] = dp.MaxSizeBytes - } - if dp.SampleName != "" { - objectMap["sampleName"] = dp.SampleName - } - if dp.ElasticPoolID != nil { - objectMap["elasticPoolId"] = dp.ElasticPoolID - } - if dp.SourceDatabaseID != nil { - objectMap["sourceDatabaseId"] = dp.SourceDatabaseID - } - if dp.RestorePointInTime != nil { - objectMap["restorePointInTime"] = dp.RestorePointInTime - } - if dp.SourceDatabaseDeletionDate != nil { - objectMap["sourceDatabaseDeletionDate"] = dp.SourceDatabaseDeletionDate - } - if dp.RecoveryServicesRecoveryPointID != nil { - objectMap["recoveryServicesRecoveryPointId"] = dp.RecoveryServicesRecoveryPointID - } - if dp.LongTermRetentionBackupResourceID != nil { - objectMap["longTermRetentionBackupResourceId"] = dp.LongTermRetentionBackupResourceID - } - if dp.RecoverableDatabaseID != nil { - objectMap["recoverableDatabaseId"] = dp.RecoverableDatabaseID - } - if dp.RestorableDroppedDatabaseID != nil { - objectMap["restorableDroppedDatabaseId"] = dp.RestorableDroppedDatabaseID - } - if dp.CatalogCollation != "" { - objectMap["catalogCollation"] = dp.CatalogCollation - } - if dp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = dp.ZoneRedundant - } - if dp.LicenseType != "" { - objectMap["licenseType"] = dp.LicenseType - } - if dp.ReadScale != "" { - objectMap["readScale"] = dp.ReadScale - } - if dp.ReadReplicaCount != nil { - objectMap["readReplicaCount"] = dp.ReadReplicaCount - } - if dp.AutoPauseDelay != nil { - objectMap["autoPauseDelay"] = dp.AutoPauseDelay - } - if dp.StorageAccountType != "" { - objectMap["storageAccountType"] = dp.StorageAccountType - } - if dp.MinCapacity != nil { - objectMap["minCapacity"] = dp.MinCapacity - } - return json.Marshal(objectMap) -} - -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateOrUpdateFuture) 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 DatabasesCreateOrUpdateFuture.Result. -func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesDeleteFuture) 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 DatabasesDeleteFuture.Result. -func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseSecurityAlertPolicy contains information about a database Threat Detection policy. -type DatabaseSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty"` - // DatabaseSecurityAlertPolicyProperties - Properties of the security alert policy. - *DatabaseSecurityAlertPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseSecurityAlertPolicy. -func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsap.Location != nil { - objectMap["location"] = dsap.Location - } - if dsap.DatabaseSecurityAlertPolicyProperties != nil { - objectMap["properties"] = dsap.DatabaseSecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseSecurityAlertPolicy struct. -func (dsap *DatabaseSecurityAlertPolicy) 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 - } - dsap.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dsap.Kind = &kind - } - case "properties": - if v != nil { - var databaseSecurityAlertPolicyProperties DatabaseSecurityAlertPolicyProperties - err = json.Unmarshal(*v, &databaseSecurityAlertPolicyProperties) - if err != nil { - return err - } - dsap.DatabaseSecurityAlertPolicyProperties = &databaseSecurityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsap.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseSecurityAlertPolicyProperties properties for a database Threat Detection policy. -type DatabaseSecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' - State SecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. - DisabledAlerts *string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies the semicolon-separated list of e-mail addresses to which the alert is sent. - EmailAddresses *string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. Possible values include: 'SecurityAlertPolicyEmailAccountAdminsEnabled', 'SecurityAlertPolicyEmailAccountAdminsDisabled' - EmailAccountAdmins SecurityAlertPolicyEmailAccountAdmins `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state is Enabled, storageEndpoint is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // UseServerDefault - Specifies whether to use the default server policy. Possible values include: 'SecurityAlertPolicyUseServerDefaultEnabled', 'SecurityAlertPolicyUseServerDefaultDisabled' - UseServerDefault SecurityAlertPolicyUseServerDefault `json:"useServerDefault,omitempty"` -} - -// DatabasesExportFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesExportFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (ImportExportOperationResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesExportFuture) 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 DatabasesExportFuture.Result. -func (future *DatabasesExportFuture) result(client DatabasesClient) (ieor ImportExportOperationResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ieor.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesExportFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent { - ieor, err = client.ExportResponder(ieor.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", ieor.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesFailoverFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesFailoverFuture) 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 DatabasesFailoverFuture.Result. -func (future *DatabasesFailoverFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesFailoverFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabasesPauseFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesPauseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesPauseFuture) 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 DatabasesPauseFuture.Result. -func (future *DatabasesPauseFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesPauseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.PauseResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesResumeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesResumeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesResumeFuture) 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 DatabasesResumeFuture.Result. -func (future *DatabasesResumeFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesResumeFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.ResumeResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesUpdateFuture) 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 DatabasesUpdateFuture.Result. -func (future *DatabasesUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesUpgradeDataWarehouseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabasesUpgradeDataWarehouseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesUpgradeDataWarehouseFuture) 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 DatabasesUpgradeDataWarehouseFuture.Result. -func (future *DatabasesUpgradeDataWarehouseFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesUpgradeDataWarehouseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabasesUpgradeDataWarehouseFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseUpdate a database resource. -type DatabaseUpdate struct { - // Sku - The name and tier of the SKU. - Sku *Sku `json:"sku,omitempty"` - // DatabaseProperties - Resource properties. - *DatabaseProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DatabaseUpdate. -func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if du.Sku != nil { - objectMap["sku"] = du.Sku - } - if du.DatabaseProperties != nil { - objectMap["properties"] = du.DatabaseProperties - } - if du.Tags != nil { - objectMap["tags"] = du.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. -func (du *DatabaseUpdate) 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 - } - du.Sku = &sku - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - du.DatabaseProperties = &databaseProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - du.Tags = tags - } - } - } - - return nil -} - -// DatabaseUsage the database usages. -type DatabaseUsage struct { - // Name - READ-ONLY; The name of the usage metric. - Name *string `json:"name,omitempty"` - // ResourceName - READ-ONLY; The name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // DisplayName - READ-ONLY; The usage metric display name. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; The current value of the usage metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The current limit of the usage metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units of the usage metric. - Unit *string `json:"unit,omitempty"` - // NextResetTime - READ-ONLY; The next reset time for the usage metric (ISO8601 format). - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseUsage. -func (du DatabaseUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseUsageListResult the response to a list database metrics request. -type DatabaseUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of database usages for the database. - Value *[]DatabaseUsage `json:"value,omitempty"` -} - -// DatabaseVulnerabilityAssessment a database vulnerability assessment. -type DatabaseVulnerabilityAssessment struct { - autorest.Response `json:"-"` - // DatabaseVulnerabilityAssessmentProperties - Resource properties. - *DatabaseVulnerabilityAssessmentProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessment. -func (dva DatabaseVulnerabilityAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dva.DatabaseVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = dva.DatabaseVulnerabilityAssessmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseVulnerabilityAssessment struct. -func (dva *DatabaseVulnerabilityAssessment) 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 databaseVulnerabilityAssessmentProperties DatabaseVulnerabilityAssessmentProperties - err = json.Unmarshal(*v, &databaseVulnerabilityAssessmentProperties) - if err != nil { - return err - } - dva.DatabaseVulnerabilityAssessmentProperties = &databaseVulnerabilityAssessmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dva.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dva.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dva.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseVulnerabilityAssessmentListResult a list of the database's vulnerability assessments. -type DatabaseVulnerabilityAssessmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]DatabaseVulnerabilityAssessment `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentListResult. -func (dvalr DatabaseVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseVulnerabilityAssessmentListResultIterator provides access to a complete listing of -// DatabaseVulnerabilityAssessment values. -type DatabaseVulnerabilityAssessmentListResultIterator struct { - i int - page DatabaseVulnerabilityAssessmentListResultPage -} - -// 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 *DatabaseVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentListResultIterator.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 *DatabaseVulnerabilityAssessmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseVulnerabilityAssessmentListResultIterator) 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 DatabaseVulnerabilityAssessmentListResultIterator) Response() DatabaseVulnerabilityAssessmentListResult { - 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 DatabaseVulnerabilityAssessmentListResultIterator) Value() DatabaseVulnerabilityAssessment { - if !iter.page.NotDone() { - return DatabaseVulnerabilityAssessment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseVulnerabilityAssessmentListResultIterator type. -func NewDatabaseVulnerabilityAssessmentListResultIterator(page DatabaseVulnerabilityAssessmentListResultPage) DatabaseVulnerabilityAssessmentListResultIterator { - return DatabaseVulnerabilityAssessmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dvalr DatabaseVulnerabilityAssessmentListResult) IsEmpty() bool { - return dvalr.Value == nil || len(*dvalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dvalr DatabaseVulnerabilityAssessmentListResult) hasNextLink() bool { - return dvalr.NextLink != nil && len(*dvalr.NextLink) != 0 -} - -// databaseVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dvalr DatabaseVulnerabilityAssessmentListResult) databaseVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dvalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dvalr.NextLink))) -} - -// DatabaseVulnerabilityAssessmentListResultPage contains a page of DatabaseVulnerabilityAssessment values. -type DatabaseVulnerabilityAssessmentListResultPage struct { - fn func(context.Context, DatabaseVulnerabilityAssessmentListResult) (DatabaseVulnerabilityAssessmentListResult, error) - dvalr DatabaseVulnerabilityAssessmentListResult -} - -// 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 *DatabaseVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentListResultPage.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.dvalr) - if err != nil { - return err - } - page.dvalr = 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 *DatabaseVulnerabilityAssessmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseVulnerabilityAssessmentListResultPage) NotDone() bool { - return !page.dvalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseVulnerabilityAssessmentListResultPage) Response() DatabaseVulnerabilityAssessmentListResult { - return page.dvalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseVulnerabilityAssessmentListResultPage) Values() []DatabaseVulnerabilityAssessment { - if page.dvalr.IsEmpty() { - return nil - } - return *page.dvalr.Value -} - -// Creates a new instance of the DatabaseVulnerabilityAssessmentListResultPage type. -func NewDatabaseVulnerabilityAssessmentListResultPage(cur DatabaseVulnerabilityAssessmentListResult, getNextPage func(context.Context, DatabaseVulnerabilityAssessmentListResult) (DatabaseVulnerabilityAssessmentListResult, error)) DatabaseVulnerabilityAssessmentListResultPage { - return DatabaseVulnerabilityAssessmentListResultPage{ - fn: getNextPage, - dvalr: cur, - } -} - -// DatabaseVulnerabilityAssessmentProperties properties of a database Vulnerability Assessment. -type DatabaseVulnerabilityAssessmentProperties struct { - // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RecurringScans - The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` -} - -// DatabaseVulnerabilityAssessmentRuleBaseline a database vulnerability assessment rule baseline. -type DatabaseVulnerabilityAssessmentRuleBaseline struct { - autorest.Response `json:"-"` - // DatabaseVulnerabilityAssessmentRuleBaselineProperties - Resource properties. - *DatabaseVulnerabilityAssessmentRuleBaselineProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentRuleBaseline. -func (dvarb DatabaseVulnerabilityAssessmentRuleBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dvarb.DatabaseVulnerabilityAssessmentRuleBaselineProperties != nil { - objectMap["properties"] = dvarb.DatabaseVulnerabilityAssessmentRuleBaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseVulnerabilityAssessmentRuleBaseline struct. -func (dvarb *DatabaseVulnerabilityAssessmentRuleBaseline) 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 databaseVulnerabilityAssessmentRuleBaselineProperties DatabaseVulnerabilityAssessmentRuleBaselineProperties - err = json.Unmarshal(*v, &databaseVulnerabilityAssessmentRuleBaselineProperties) - if err != nil { - return err - } - dvarb.DatabaseVulnerabilityAssessmentRuleBaselineProperties = &databaseVulnerabilityAssessmentRuleBaselineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dvarb.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dvarb.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dvarb.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseVulnerabilityAssessmentRuleBaselineItem properties for an Azure SQL Database Vulnerability -// Assessment rule baseline's result. -type DatabaseVulnerabilityAssessmentRuleBaselineItem struct { - // Result - The rule baseline result - Result *[]string `json:"result,omitempty"` -} - -// DatabaseVulnerabilityAssessmentRuleBaselineProperties properties of a database Vulnerability Assessment -// rule baseline. -type DatabaseVulnerabilityAssessmentRuleBaselineProperties struct { - // BaselineResults - The rule baseline result - BaselineResults *[]DatabaseVulnerabilityAssessmentRuleBaselineItem `json:"baselineResults,omitempty"` -} - -// DatabaseVulnerabilityAssessmentScanExportProperties properties of the export operation's result. -type DatabaseVulnerabilityAssessmentScanExportProperties struct { - // ExportedReportLocation - READ-ONLY; Location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). - ExportedReportLocation *string `json:"exportedReportLocation,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentScanExportProperties. -func (dvasep DatabaseVulnerabilityAssessmentScanExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseVulnerabilityAssessmentScansExport a database Vulnerability Assessment scan export resource. -type DatabaseVulnerabilityAssessmentScansExport struct { - autorest.Response `json:"-"` - // DatabaseVulnerabilityAssessmentScanExportProperties - Resource properties. - *DatabaseVulnerabilityAssessmentScanExportProperties `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"` -} - -// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentScansExport. -func (dvase DatabaseVulnerabilityAssessmentScansExport) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dvase.DatabaseVulnerabilityAssessmentScanExportProperties != nil { - objectMap["properties"] = dvase.DatabaseVulnerabilityAssessmentScanExportProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseVulnerabilityAssessmentScansExport struct. -func (dvase *DatabaseVulnerabilityAssessmentScansExport) 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 databaseVulnerabilityAssessmentScanExportProperties DatabaseVulnerabilityAssessmentScanExportProperties - err = json.Unmarshal(*v, &databaseVulnerabilityAssessmentScanExportProperties) - if err != nil { - return err - } - dvase.DatabaseVulnerabilityAssessmentScanExportProperties = &databaseVulnerabilityAssessmentScanExportProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dvase.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dvase.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dvase.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseVulnerabilityAssessmentScansInitiateScanFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type DatabaseVulnerabilityAssessmentScansInitiateScanFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabaseVulnerabilityAssessmentScansClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabaseVulnerabilityAssessmentScansInitiateScanFuture) 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 DatabaseVulnerabilityAssessmentScansInitiateScanFuture.Result. -func (future *DatabaseVulnerabilityAssessmentScansInitiateScanFuture) result(client DatabaseVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture") - return - } - ar.Response = future.Response() - return -} - -// DataMaskingPolicy represents a database data masking policy. -type DataMaskingPolicy struct { - autorest.Response `json:"-"` - // DataMaskingPolicyProperties - The properties of the data masking policy. - *DataMaskingPolicyProperties `json:"properties,omitempty"` - // Location - READ-ONLY; The location of the data masking policy. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; The kind of data masking policy. Metadata, used for Azure portal. - Kind *string `json:"kind,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"` -} - -// MarshalJSON is the custom marshaler for DataMaskingPolicy. -func (dmp DataMaskingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmp.DataMaskingPolicyProperties != nil { - objectMap["properties"] = dmp.DataMaskingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataMaskingPolicy struct. -func (dmp *DataMaskingPolicy) 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 dataMaskingPolicyProperties DataMaskingPolicyProperties - err = json.Unmarshal(*v, &dataMaskingPolicyProperties) - if err != nil { - return err - } - dmp.DataMaskingPolicyProperties = &dataMaskingPolicyProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dmp.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dmp.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dmp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dmp.Type = &typeVar - } - } - } - - return nil -} - -// DataMaskingPolicyProperties the properties of a database data masking policy. -type DataMaskingPolicyProperties struct { - // DataMaskingState - The state of the data masking policy. Possible values include: 'DataMaskingStateDisabled', 'DataMaskingStateEnabled' - DataMaskingState DataMaskingState `json:"dataMaskingState,omitempty"` - // ExemptPrincipals - The list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. - ExemptPrincipals *string `json:"exemptPrincipals,omitempty"` - // ApplicationPrincipals - READ-ONLY; The list of the application principals. This is a legacy parameter and is no longer used. - ApplicationPrincipals *string `json:"applicationPrincipals,omitempty"` - // MaskingLevel - READ-ONLY; The masking level. This is a legacy parameter and is no longer used. - MaskingLevel *string `json:"maskingLevel,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataMaskingPolicyProperties. -func (dmpp DataMaskingPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmpp.DataMaskingState != "" { - objectMap["dataMaskingState"] = dmpp.DataMaskingState - } - if dmpp.ExemptPrincipals != nil { - objectMap["exemptPrincipals"] = dmpp.ExemptPrincipals - } - return json.Marshal(objectMap) -} - -// DataMaskingRule represents a database data masking rule. -type DataMaskingRule struct { - autorest.Response `json:"-"` - // DataMaskingRuleProperties - The properties of the resource. - *DataMaskingRuleProperties `json:"properties,omitempty"` - // Location - READ-ONLY; The location of the data masking rule. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; The kind of Data Masking Rule. Metadata, used for Azure portal. - Kind *string `json:"kind,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"` -} - -// MarshalJSON is the custom marshaler for DataMaskingRule. -func (dmr DataMaskingRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmr.DataMaskingRuleProperties != nil { - objectMap["properties"] = dmr.DataMaskingRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataMaskingRule struct. -func (dmr *DataMaskingRule) 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 dataMaskingRuleProperties DataMaskingRuleProperties - err = json.Unmarshal(*v, &dataMaskingRuleProperties) - if err != nil { - return err - } - dmr.DataMaskingRuleProperties = &dataMaskingRuleProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dmr.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dmr.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dmr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dmr.Type = &typeVar - } - } - } - - return nil -} - -// DataMaskingRuleListResult the response to a list data masking rules request. -type DataMaskingRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of database data masking rules. - Value *[]DataMaskingRule `json:"value,omitempty"` -} - -// DataMaskingRuleProperties the properties of a database data masking rule. -type DataMaskingRuleProperties struct { - // ID - READ-ONLY; The rule Id. - ID *string `json:"id,omitempty"` - // AliasName - The alias name. This is a legacy parameter and is no longer used. - AliasName *string `json:"aliasName,omitempty"` - // RuleState - The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: 'DataMaskingRuleStateDisabled', 'DataMaskingRuleStateEnabled' - RuleState DataMaskingRuleState `json:"ruleState,omitempty"` - // SchemaName - The schema name on which the data masking rule is applied. - SchemaName *string `json:"schemaName,omitempty"` - // TableName - The table name on which the data masking rule is applied. - TableName *string `json:"tableName,omitempty"` - // ColumnName - The column name on which the data masking rule is applied. - ColumnName *string `json:"columnName,omitempty"` - // MaskingFunction - The masking function that is used for the data masking rule. Possible values include: 'DataMaskingFunctionDefault', 'DataMaskingFunctionCCN', 'DataMaskingFunctionEmail', 'DataMaskingFunctionNumber', 'DataMaskingFunctionSSN', 'DataMaskingFunctionText' - MaskingFunction DataMaskingFunction `json:"maskingFunction,omitempty"` - // NumberFrom - The numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. - NumberFrom *string `json:"numberFrom,omitempty"` - // NumberTo - The numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. - NumberTo *string `json:"numberTo,omitempty"` - // PrefixSize - If maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, this parameter will be ignored. - PrefixSize *string `json:"prefixSize,omitempty"` - // SuffixSize - If maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this parameter will be ignored. - SuffixSize *string `json:"suffixSize,omitempty"` - // ReplacementString - If maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. - ReplacementString *string `json:"replacementString,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataMaskingRuleProperties. -func (dmrp DataMaskingRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmrp.AliasName != nil { - objectMap["aliasName"] = dmrp.AliasName - } - if dmrp.RuleState != "" { - objectMap["ruleState"] = dmrp.RuleState - } - if dmrp.SchemaName != nil { - objectMap["schemaName"] = dmrp.SchemaName - } - if dmrp.TableName != nil { - objectMap["tableName"] = dmrp.TableName - } - if dmrp.ColumnName != nil { - objectMap["columnName"] = dmrp.ColumnName - } - if dmrp.MaskingFunction != "" { - objectMap["maskingFunction"] = dmrp.MaskingFunction - } - if dmrp.NumberFrom != nil { - objectMap["numberFrom"] = dmrp.NumberFrom - } - if dmrp.NumberTo != nil { - objectMap["numberTo"] = dmrp.NumberTo - } - if dmrp.PrefixSize != nil { - objectMap["prefixSize"] = dmrp.PrefixSize - } - if dmrp.SuffixSize != nil { - objectMap["suffixSize"] = dmrp.SuffixSize - } - if dmrp.ReplacementString != nil { - objectMap["replacementString"] = dmrp.ReplacementString - } - return json.Marshal(objectMap) -} - -// EditionCapability the edition capability. -type EditionCapability struct { - // Name - READ-ONLY; The database edition name. - Name *string `json:"name,omitempty"` - // SupportedServiceLevelObjectives - READ-ONLY; The list of supported service objectives for the edition. - SupportedServiceLevelObjectives *[]ServiceObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // ReadScale - READ-ONLY; The read scale capability for the edition. - ReadScale *ReadScaleCapability `json:"readScale,omitempty"` - // SupportedStorageCapabilities - READ-ONLY; The list of supported storage capabilities for this edition - SupportedStorageCapabilities *[]StorageCapability `json:"supportedStorageCapabilities,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for EditionCapability. -func (ec EditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ec.Reason != nil { - objectMap["reason"] = ec.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPool an elastic pool. -type ElasticPool struct { - autorest.Response `json:"-"` - // Sku - The elastic pool SKU. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or the following command: - // - // ```azurecli - // az sql elastic-pool list-editions -l -o table - // ```` - Sku *Sku `json:"sku,omitempty"` - // Kind - READ-ONLY; Kind of elastic pool. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ElasticPoolProperties - Resource properties. - *ElasticPoolProperties `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"` -} - -// MarshalJSON is the custom marshaler for ElasticPool. -func (ep ElasticPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.Sku != nil { - objectMap["sku"] = ep.Sku - } - if ep.ElasticPoolProperties != nil { - objectMap["properties"] = ep.ElasticPoolProperties - } - if ep.Location != nil { - objectMap["location"] = ep.Location - } - if ep.Tags != nil { - objectMap["tags"] = ep.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPool struct. -func (ep *ElasticPool) 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 - } - ep.Sku = &sku - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ep.Kind = &kind - } - case "properties": - if v != nil { - var elasticPoolProperties ElasticPoolProperties - err = json.Unmarshal(*v, &elasticPoolProperties) - if err != nil { - return err - } - ep.ElasticPoolProperties = &elasticPoolProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ep.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ep.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolActivity represents the activity on an elastic pool. -type ElasticPoolActivity struct { - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ElasticPoolActivityProperties - The properties representing the resource. - *ElasticPoolActivityProperties `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"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolActivity. -func (epa ElasticPoolActivity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epa.Location != nil { - objectMap["location"] = epa.Location - } - if epa.ElasticPoolActivityProperties != nil { - objectMap["properties"] = epa.ElasticPoolActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolActivity struct. -func (epa *ElasticPoolActivity) 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 - } - epa.Location = &location - } - case "properties": - if v != nil { - var elasticPoolActivityProperties ElasticPoolActivityProperties - err = json.Unmarshal(*v, &elasticPoolActivityProperties) - if err != nil { - return err - } - epa.ElasticPoolActivityProperties = &elasticPoolActivityProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - epa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - epa.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolActivityListResult represents the response to a list elastic pool activity request. -type ElasticPoolActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of elastic pool activities. - Value *[]ElasticPoolActivity `json:"value,omitempty"` -} - -// ElasticPoolActivityProperties represents the properties of an elastic pool. -type ElasticPoolActivityProperties struct { - // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // ErrorCode - READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorMessage - READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty"` - // ErrorSeverity - READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // Operation - READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty"` - // OperationID - READ-ONLY; The unique operation ID. - OperationID *uuid.UUID `json:"operationId,omitempty"` - // PercentComplete - READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // RequestedDatabaseDtuMax - READ-ONLY; The requested max DTU per database if available. - RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` - // RequestedDatabaseDtuMin - READ-ONLY; The requested min DTU per database if available. - RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` - // RequestedDtu - READ-ONLY; The requested DTU for the pool if available. - RequestedDtu *int32 `json:"requestedDtu,omitempty"` - // RequestedElasticPoolName - READ-ONLY; The requested name for the elastic pool if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - // RequestedStorageLimitInGB - READ-ONLY; The requested storage limit for the pool in GB if available. - RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` - // ElasticPoolName - READ-ONLY; The name of the elastic pool. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // ServerName - READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The time the operation started (ISO8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty"` - // RequestedStorageLimitInMB - READ-ONLY; The requested storage limit in MB. - RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` - // RequestedDatabaseDtuGuarantee - READ-ONLY; The requested per database DTU guarantee. - RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` - // RequestedDatabaseDtuCap - READ-ONLY; The requested per database DTU cap. - RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` - // RequestedDtuGuarantee - READ-ONLY; The requested DTU guarantee. - RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolActivityProperties. -func (epap ElasticPoolActivityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolDatabaseActivity represents the activity on an elastic pool. -type ElasticPoolDatabaseActivity struct { - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ElasticPoolDatabaseActivityProperties - The properties representing the resource. - *ElasticPoolDatabaseActivityProperties `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"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivity. -func (epda ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epda.Location != nil { - objectMap["location"] = epda.Location - } - if epda.ElasticPoolDatabaseActivityProperties != nil { - objectMap["properties"] = epda.ElasticPoolDatabaseActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolDatabaseActivity struct. -func (epda *ElasticPoolDatabaseActivity) 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 - } - epda.Location = &location - } - case "properties": - if v != nil { - var elasticPoolDatabaseActivityProperties ElasticPoolDatabaseActivityProperties - err = json.Unmarshal(*v, &elasticPoolDatabaseActivityProperties) - if err != nil { - return err - } - epda.ElasticPoolDatabaseActivityProperties = &elasticPoolDatabaseActivityProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epda.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - epda.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - epda.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolDatabaseActivityListResult represents the response to a list elastic pool database activity -// request. -type ElasticPoolDatabaseActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of elastic pool database activities. - Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` -} - -// ElasticPoolDatabaseActivityProperties represents the properties of an elastic pool database activity. -type ElasticPoolDatabaseActivityProperties struct { - // DatabaseName - READ-ONLY; The database name. - DatabaseName *string `json:"databaseName,omitempty"` - // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // ErrorCode - READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorMessage - READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty"` - // ErrorSeverity - READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // Operation - READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty"` - // OperationID - READ-ONLY; The unique operation ID. - OperationID *uuid.UUID `json:"operationId,omitempty"` - // PercentComplete - READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // RequestedElasticPoolName - READ-ONLY; The name for the elastic pool the database is moving into if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - // CurrentElasticPoolName - READ-ONLY; The name of the current elastic pool the database is in if available. - CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` - // CurrentServiceObjective - READ-ONLY; The name of the current service objective if available. - CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"` - // RequestedServiceObjective - READ-ONLY; The name of the requested service objective if available. - RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"` - // ServerName - READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The time the operation started (ISO8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivityProperties. -func (epdap ElasticPoolDatabaseActivityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolEditionCapability the elastic pool edition capability. -type ElasticPoolEditionCapability struct { - // Name - READ-ONLY; The elastic pool edition name. - Name *string `json:"name,omitempty"` - // SupportedElasticPoolPerformanceLevels - READ-ONLY; The list of supported elastic pool DTU levels for the edition. - SupportedElasticPoolPerformanceLevels *[]ElasticPoolPerformanceLevelCapability `json:"supportedElasticPoolPerformanceLevels,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolEditionCapability. -func (epec ElasticPoolEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epec.Reason != nil { - objectMap["reason"] = epec.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolListResult the result of an elastic pool list request. -type ElasticPoolListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ElasticPool `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolListResult. -func (eplr ElasticPoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolListResultIterator provides access to a complete listing of ElasticPool values. -type ElasticPoolListResultIterator struct { - i int - page ElasticPoolListResultPage -} - -// 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 *ElasticPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolListResultIterator.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 *ElasticPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ElasticPoolListResultIterator) 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 ElasticPoolListResultIterator) Response() ElasticPoolListResult { - 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 ElasticPoolListResultIterator) Value() ElasticPool { - if !iter.page.NotDone() { - return ElasticPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ElasticPoolListResultIterator type. -func NewElasticPoolListResultIterator(page ElasticPoolListResultPage) ElasticPoolListResultIterator { - return ElasticPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eplr ElasticPoolListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eplr ElasticPoolListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 -} - -// elasticPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eplr ElasticPoolListResult) elasticPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) -} - -// ElasticPoolListResultPage contains a page of ElasticPool values. -type ElasticPoolListResultPage struct { - fn func(context.Context, ElasticPoolListResult) (ElasticPoolListResult, error) - eplr ElasticPoolListResult -} - -// 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 *ElasticPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolListResultPage.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.eplr) - if err != nil { - return err - } - page.eplr = 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 *ElasticPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ElasticPoolListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ElasticPoolListResultPage) Response() ElasticPoolListResult { - return page.eplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ElasticPoolListResultPage) Values() []ElasticPool { - if page.eplr.IsEmpty() { - return nil - } - return *page.eplr.Value -} - -// Creates a new instance of the ElasticPoolListResultPage type. -func NewElasticPoolListResultPage(cur ElasticPoolListResult, getNextPage func(context.Context, ElasticPoolListResult) (ElasticPoolListResult, error)) ElasticPoolListResultPage { - return ElasticPoolListResultPage{ - fn: getNextPage, - eplr: cur, - } -} - -// ElasticPoolOperation a elastic pool operation. -type ElasticPoolOperation struct { - // ElasticPoolOperationProperties - Resource properties. - *ElasticPoolOperationProperties `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"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolOperation. -func (epo ElasticPoolOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epo.ElasticPoolOperationProperties != nil { - objectMap["properties"] = epo.ElasticPoolOperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolOperation struct. -func (epo *ElasticPoolOperation) 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 elasticPoolOperationProperties ElasticPoolOperationProperties - err = json.Unmarshal(*v, &elasticPoolOperationProperties) - if err != nil { - return err - } - epo.ElasticPoolOperationProperties = &elasticPoolOperationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epo.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - epo.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - epo.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolOperationListResult the response to a list elastic pool operations request -type ElasticPoolOperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ElasticPoolOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolOperationListResult. -func (epolr ElasticPoolOperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolOperationListResultIterator provides access to a complete listing of ElasticPoolOperation -// values. -type ElasticPoolOperationListResultIterator struct { - i int - page ElasticPoolOperationListResultPage -} - -// 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 *ElasticPoolOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationListResultIterator.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 *ElasticPoolOperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ElasticPoolOperationListResultIterator) 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 ElasticPoolOperationListResultIterator) Response() ElasticPoolOperationListResult { - 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 ElasticPoolOperationListResultIterator) Value() ElasticPoolOperation { - if !iter.page.NotDone() { - return ElasticPoolOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ElasticPoolOperationListResultIterator type. -func NewElasticPoolOperationListResultIterator(page ElasticPoolOperationListResultPage) ElasticPoolOperationListResultIterator { - return ElasticPoolOperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (epolr ElasticPoolOperationListResult) IsEmpty() bool { - return epolr.Value == nil || len(*epolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (epolr ElasticPoolOperationListResult) hasNextLink() bool { - return epolr.NextLink != nil && len(*epolr.NextLink) != 0 -} - -// elasticPoolOperationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (epolr ElasticPoolOperationListResult) elasticPoolOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !epolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(epolr.NextLink))) -} - -// ElasticPoolOperationListResultPage contains a page of ElasticPoolOperation values. -type ElasticPoolOperationListResultPage struct { - fn func(context.Context, ElasticPoolOperationListResult) (ElasticPoolOperationListResult, error) - epolr ElasticPoolOperationListResult -} - -// 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 *ElasticPoolOperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationListResultPage.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.epolr) - if err != nil { - return err - } - page.epolr = 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 *ElasticPoolOperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ElasticPoolOperationListResultPage) NotDone() bool { - return !page.epolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ElasticPoolOperationListResultPage) Response() ElasticPoolOperationListResult { - return page.epolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ElasticPoolOperationListResultPage) Values() []ElasticPoolOperation { - if page.epolr.IsEmpty() { - return nil - } - return *page.epolr.Value -} - -// Creates a new instance of the ElasticPoolOperationListResultPage type. -func NewElasticPoolOperationListResultPage(cur ElasticPoolOperationListResult, getNextPage func(context.Context, ElasticPoolOperationListResult) (ElasticPoolOperationListResult, error)) ElasticPoolOperationListResultPage { - return ElasticPoolOperationListResultPage{ - fn: getNextPage, - epolr: cur, - } -} - -// ElasticPoolOperationProperties the properties of a elastic pool operation. -type ElasticPoolOperationProperties struct { - // ElasticPoolName - READ-ONLY; The name of the elastic pool the operation is being performed on. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // Operation - READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty"` - // OperationFriendlyName - READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` - // PercentComplete - READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ServerName - READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The operation state. - State *string `json:"state,omitempty"` - // ErrorCode - READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorDescription - READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty"` - // ErrorSeverity - READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // IsUserError - READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty"` - // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` - // Description - READ-ONLY; The operation description. - Description *string `json:"description,omitempty"` - // IsCancellable - READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolOperationProperties. -func (epop ElasticPoolOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolPerDatabaseMaxPerformanceLevelCapability the max per-database performance level capability. -type ElasticPoolPerDatabaseMaxPerformanceLevelCapability struct { - // Limit - READ-ONLY; The maximum performance level per database. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'DTU', 'VCores' - Unit PerformanceLevelUnit `json:"unit,omitempty"` - // SupportedPerDatabaseMinPerformanceLevels - READ-ONLY; The list of supported min database performance levels. - SupportedPerDatabaseMinPerformanceLevels *[]ElasticPoolPerDatabaseMinPerformanceLevelCapability `json:"supportedPerDatabaseMinPerformanceLevels,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMaxPerformanceLevelCapability. -func (eppdmplc ElasticPoolPerDatabaseMaxPerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eppdmplc.Reason != nil { - objectMap["reason"] = eppdmplc.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolPerDatabaseMinPerformanceLevelCapability the minimum per-database performance level -// capability. -type ElasticPoolPerDatabaseMinPerformanceLevelCapability struct { - // Limit - READ-ONLY; The minimum performance level per database. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'DTU', 'VCores' - Unit PerformanceLevelUnit `json:"unit,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMinPerformanceLevelCapability. -func (eppdmplc ElasticPoolPerDatabaseMinPerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eppdmplc.Reason != nil { - objectMap["reason"] = eppdmplc.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolPerDatabaseSettings per database settings of an elastic pool. -type ElasticPoolPerDatabaseSettings struct { - // MinCapacity - The minimum capacity all databases are guaranteed. - MinCapacity *float64 `json:"minCapacity,omitempty"` - // MaxCapacity - The maximum capacity any one database can consume. - MaxCapacity *float64 `json:"maxCapacity,omitempty"` -} - -// ElasticPoolPerformanceLevelCapability the Elastic Pool performance level capability. -type ElasticPoolPerformanceLevelCapability struct { - // PerformanceLevel - READ-ONLY; The performance level for the pool. - PerformanceLevel *PerformanceLevelCapability `json:"performanceLevel,omitempty"` - // Sku - READ-ONLY; The sku. - Sku *Sku `json:"sku,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // MaxDatabaseCount - READ-ONLY; The maximum number of databases supported. - MaxDatabaseCount *int32 `json:"maxDatabaseCount,omitempty"` - // IncludedMaxSize - READ-ONLY; The included (free) max size for this performance level. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // SupportedMaxSizes - READ-ONLY; The list of supported max sizes. - SupportedMaxSizes *[]MaxSizeRangeCapability `json:"supportedMaxSizes,omitempty"` - // SupportedPerDatabaseMaxSizes - READ-ONLY; The list of supported per database max sizes. - SupportedPerDatabaseMaxSizes *[]MaxSizeRangeCapability `json:"supportedPerDatabaseMaxSizes,omitempty"` - // SupportedPerDatabaseMaxPerformanceLevels - READ-ONLY; The list of supported per database max performance levels. - SupportedPerDatabaseMaxPerformanceLevels *[]ElasticPoolPerDatabaseMaxPerformanceLevelCapability `json:"supportedPerDatabaseMaxPerformanceLevels,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the performance level. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolPerformanceLevelCapability. -func (epplc ElasticPoolPerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epplc.Reason != nil { - objectMap["reason"] = epplc.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolProperties properties of an elastic pool -type ElasticPoolProperties struct { - // State - READ-ONLY; The state of the elastic pool. Possible values include: 'ElasticPoolStateCreating', 'ElasticPoolStateReady', 'ElasticPoolStateDisabled' - State ElasticPoolState `json:"state,omitempty"` - // CreationDate - READ-ONLY; The creation date of the elastic pool (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // MaxSizeBytes - The storage limit for the database elastic pool in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // PerDatabaseSettings - The per database settings for the elastic pool. - PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` - // ZoneRedundant - Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // LicenseType - The license type to apply for this elastic pool. Possible values include: 'ElasticPoolLicenseTypeLicenseIncluded', 'ElasticPoolLicenseTypeBasePrice' - LicenseType ElasticPoolLicenseType `json:"licenseType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolProperties. -func (epp ElasticPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epp.MaxSizeBytes != nil { - objectMap["maxSizeBytes"] = epp.MaxSizeBytes - } - if epp.PerDatabaseSettings != nil { - objectMap["perDatabaseSettings"] = epp.PerDatabaseSettings - } - if epp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = epp.ZoneRedundant - } - if epp.LicenseType != "" { - objectMap["licenseType"] = epp.LicenseType - } - return json.Marshal(objectMap) -} - -// ElasticPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ElasticPoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (ElasticPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsCreateOrUpdateFuture) 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 ElasticPoolsCreateOrUpdateFuture.Result. -func (future *ElasticPoolsCreateOrUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateOrUpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ElasticPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsDeleteFuture) 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 ElasticPoolsDeleteFuture.Result. -func (future *ElasticPoolsDeleteFuture) result(client ElasticPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ElasticPoolsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsFailoverFuture) 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 ElasticPoolsFailoverFuture.Result. -func (future *ElasticPoolsFailoverFuture) result(client ElasticPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsFailoverFuture") - return - } - ar.Response = future.Response() - return -} - -// ElasticPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (ElasticPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsUpdateFuture) 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 ElasticPoolsUpdateFuture.Result. -func (future *ElasticPoolsUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.UpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// ElasticPoolUpdate an elastic pool update. -type ElasticPoolUpdate struct { - Sku *Sku `json:"sku,omitempty"` - // ElasticPoolUpdateProperties - Resource properties. - *ElasticPoolUpdateProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolUpdate. -func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epu.Sku != nil { - objectMap["sku"] = epu.Sku - } - if epu.ElasticPoolUpdateProperties != nil { - objectMap["properties"] = epu.ElasticPoolUpdateProperties - } - if epu.Tags != nil { - objectMap["tags"] = epu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolUpdate struct. -func (epu *ElasticPoolUpdate) 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 - } - epu.Sku = &sku - } - case "properties": - if v != nil { - var elasticPoolUpdateProperties ElasticPoolUpdateProperties - err = json.Unmarshal(*v, &elasticPoolUpdateProperties) - if err != nil { - return err - } - epu.ElasticPoolUpdateProperties = &elasticPoolUpdateProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - epu.Tags = tags - } - } - } - - return nil -} - -// ElasticPoolUpdateProperties properties of an elastic pool -type ElasticPoolUpdateProperties struct { - // MaxSizeBytes - The storage limit for the database elastic pool in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // PerDatabaseSettings - The per database settings for the elastic pool. - PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` - // ZoneRedundant - Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // LicenseType - The license type to apply for this elastic pool. Possible values include: 'ElasticPoolLicenseTypeLicenseIncluded', 'ElasticPoolLicenseTypeBasePrice' - LicenseType ElasticPoolLicenseType `json:"licenseType,omitempty"` -} - -// EncryptionProtector the server encryption protector. -type EncryptionProtector struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // EncryptionProtectorProperties - Resource properties. - *EncryptionProtectorProperties `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"` -} - -// MarshalJSON is the custom marshaler for EncryptionProtector. -func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.EncryptionProtectorProperties != nil { - objectMap["properties"] = ep.EncryptionProtectorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EncryptionProtector struct. -func (ep *EncryptionProtector) 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 - } - ep.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ep.Location = &location - } - case "properties": - if v != nil { - var encryptionProtectorProperties EncryptionProtectorProperties - err = json.Unmarshal(*v, &encryptionProtectorProperties) - if err != nil { - return err - } - ep.EncryptionProtectorProperties = &encryptionProtectorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - } - } - - return nil -} - -// EncryptionProtectorListResult a list of server encryption protectors. -type EncryptionProtectorListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]EncryptionProtector `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionProtectorListResult. -func (eplr EncryptionProtectorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EncryptionProtectorListResultIterator provides access to a complete listing of EncryptionProtector -// values. -type EncryptionProtectorListResultIterator struct { - i int - page EncryptionProtectorListResultPage -} - -// 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 *EncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultIterator.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 *EncryptionProtectorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EncryptionProtectorListResultIterator) 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 EncryptionProtectorListResultIterator) Response() EncryptionProtectorListResult { - 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 EncryptionProtectorListResultIterator) Value() EncryptionProtector { - if !iter.page.NotDone() { - return EncryptionProtector{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EncryptionProtectorListResultIterator type. -func NewEncryptionProtectorListResultIterator(page EncryptionProtectorListResultPage) EncryptionProtectorListResultIterator { - return EncryptionProtectorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eplr EncryptionProtectorListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eplr EncryptionProtectorListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 -} - -// encryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eplr EncryptionProtectorListResult) encryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) -} - -// EncryptionProtectorListResultPage contains a page of EncryptionProtector values. -type EncryptionProtectorListResultPage struct { - fn func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error) - eplr EncryptionProtectorListResult -} - -// 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 *EncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultPage.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.eplr) - if err != nil { - return err - } - page.eplr = 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 *EncryptionProtectorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EncryptionProtectorListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EncryptionProtectorListResultPage) Response() EncryptionProtectorListResult { - return page.eplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EncryptionProtectorListResultPage) Values() []EncryptionProtector { - if page.eplr.IsEmpty() { - return nil - } - return *page.eplr.Value -} - -// Creates a new instance of the EncryptionProtectorListResultPage type. -func NewEncryptionProtectorListResultPage(cur EncryptionProtectorListResult, getNextPage func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error)) EncryptionProtectorListResultPage { - return EncryptionProtectorListResultPage{ - fn: getNextPage, - eplr: cur, - } -} - -// EncryptionProtectorProperties properties for an encryption protector execution. -type EncryptionProtectorProperties struct { - // Subregion - READ-ONLY; Subregion of the encryption protector. - Subregion *string `json:"subregion,omitempty"` - // ServerKeyName - The name of the server key. - ServerKeyName *string `json:"serverKeyName,omitempty"` - // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - READ-ONLY; The URI of the server key. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionProtectorProperties. -func (epp EncryptionProtectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epp.ServerKeyName != nil { - objectMap["serverKeyName"] = epp.ServerKeyName - } - if epp.ServerKeyType != "" { - objectMap["serverKeyType"] = epp.ServerKeyType - } - return json.Marshal(objectMap) -} - -// EncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EncryptionProtectorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EncryptionProtectorsClient) (EncryptionProtector, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EncryptionProtectorsCreateOrUpdateFuture) 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 EncryptionProtectorsCreateOrUpdateFuture.Result. -func (future *EncryptionProtectorsCreateOrUpdateFuture) result(client EncryptionProtectorsClient) (ep EncryptionProtector, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateOrUpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// EncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EncryptionProtectorsRevalidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EncryptionProtectorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EncryptionProtectorsRevalidateFuture) 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 EncryptionProtectorsRevalidateFuture.Result. -func (future *EncryptionProtectorsRevalidateFuture) result(client EncryptionProtectorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsRevalidateFuture") - return - } - ar.Response = future.Response() - return -} - -// ExportDatabaseDefinition contains the information necessary to perform export database operation. -type ExportDatabaseDefinition struct { - // StorageKeyType - Storage key type. Possible values include: 'SharedAccessKey', 'StorageAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - Storage key. - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - Administrator login name. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - Administrator login password. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - Authentication type. - AuthenticationType *string `json:"authenticationType,omitempty"` - // NetworkIsolation - Optional resource information to enable network isolation for request. - NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` -} - -// ExtendedDatabaseBlobAuditingPolicy an extended database blob auditing policy. -type ExtendedDatabaseBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ExtendedDatabaseBlobAuditingPolicyProperties - Resource properties. - *ExtendedDatabaseBlobAuditingPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ExtendedDatabaseBlobAuditingPolicy. -func (edbap ExtendedDatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if edbap.ExtendedDatabaseBlobAuditingPolicyProperties != nil { - objectMap["properties"] = edbap.ExtendedDatabaseBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExtendedDatabaseBlobAuditingPolicy struct. -func (edbap *ExtendedDatabaseBlobAuditingPolicy) 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 extendedDatabaseBlobAuditingPolicyProperties ExtendedDatabaseBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &extendedDatabaseBlobAuditingPolicyProperties) - if err != nil { - return err - } - edbap.ExtendedDatabaseBlobAuditingPolicyProperties = &extendedDatabaseBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - edbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - edbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - edbap.Type = &typeVar - } - } - } - - return nil -} - -// ExtendedDatabaseBlobAuditingPolicyListResult a list of database extended auditing settings. -type ExtendedDatabaseBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ExtendedDatabaseBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedDatabaseBlobAuditingPolicyListResult. -func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExtendedDatabaseBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ExtendedDatabaseBlobAuditingPolicy values. -type ExtendedDatabaseBlobAuditingPolicyListResultIterator struct { - i int - page ExtendedDatabaseBlobAuditingPolicyListResultPage -} - -// 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 *ExtendedDatabaseBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPolicyListResultIterator.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 *ExtendedDatabaseBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) 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 ExtendedDatabaseBlobAuditingPolicyListResultIterator) Response() ExtendedDatabaseBlobAuditingPolicyListResult { - 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 ExtendedDatabaseBlobAuditingPolicyListResultIterator) Value() ExtendedDatabaseBlobAuditingPolicy { - if !iter.page.NotDone() { - return ExtendedDatabaseBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExtendedDatabaseBlobAuditingPolicyListResultIterator type. -func NewExtendedDatabaseBlobAuditingPolicyListResultIterator(page ExtendedDatabaseBlobAuditingPolicyListResultPage) ExtendedDatabaseBlobAuditingPolicyListResultIterator { - return ExtendedDatabaseBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) IsEmpty() bool { - return edbaplr.Value == nil || len(*edbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) hasNextLink() bool { - return edbaplr.NextLink != nil && len(*edbaplr.NextLink) != 0 -} - -// extendedDatabaseBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) extendedDatabaseBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !edbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(edbaplr.NextLink))) -} - -// ExtendedDatabaseBlobAuditingPolicyListResultPage contains a page of ExtendedDatabaseBlobAuditingPolicy -// values. -type ExtendedDatabaseBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ExtendedDatabaseBlobAuditingPolicyListResult) (ExtendedDatabaseBlobAuditingPolicyListResult, error) - edbaplr ExtendedDatabaseBlobAuditingPolicyListResult -} - -// 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 *ExtendedDatabaseBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPolicyListResultPage.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.edbaplr) - if err != nil { - return err - } - page.edbaplr = 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 *ExtendedDatabaseBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.edbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) Response() ExtendedDatabaseBlobAuditingPolicyListResult { - return page.edbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) Values() []ExtendedDatabaseBlobAuditingPolicy { - if page.edbaplr.IsEmpty() { - return nil - } - return *page.edbaplr.Value -} - -// Creates a new instance of the ExtendedDatabaseBlobAuditingPolicyListResultPage type. -func NewExtendedDatabaseBlobAuditingPolicyListResultPage(cur ExtendedDatabaseBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedDatabaseBlobAuditingPolicyListResult) (ExtendedDatabaseBlobAuditingPolicyListResult, error)) ExtendedDatabaseBlobAuditingPolicyListResultPage { - return ExtendedDatabaseBlobAuditingPolicyListResultPage{ - fn: getNextPage, - edbaplr: cur, - } -} - -// ExtendedDatabaseBlobAuditingPolicyProperties properties of an extended database blob auditing policy. -type ExtendedDatabaseBlobAuditingPolicyProperties struct { - // PredicateExpression - Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExtendedServerBlobAuditingPoliciesClient) (ExtendedServerBlobAuditingPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture) 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 ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture.Result. -func (future *ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture) result(client ExtendedServerBlobAuditingPoliciesClient) (esbap ExtendedServerBlobAuditingPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - esbap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if esbap.Response.Response, err = future.GetResult(sender); err == nil && esbap.Response.Response.StatusCode != http.StatusNoContent { - esbap, err = client.CreateOrUpdateResponder(esbap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", esbap.Response.Response, "Failure responding to request") - } - } - return -} - -// ExtendedServerBlobAuditingPolicy an extended server blob auditing policy. -type ExtendedServerBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ExtendedServerBlobAuditingPolicyProperties - Resource properties. - *ExtendedServerBlobAuditingPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicy. -func (esbap ExtendedServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if esbap.ExtendedServerBlobAuditingPolicyProperties != nil { - objectMap["properties"] = esbap.ExtendedServerBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExtendedServerBlobAuditingPolicy struct. -func (esbap *ExtendedServerBlobAuditingPolicy) 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 extendedServerBlobAuditingPolicyProperties ExtendedServerBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &extendedServerBlobAuditingPolicyProperties) - if err != nil { - return err - } - esbap.ExtendedServerBlobAuditingPolicyProperties = &extendedServerBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - esbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - esbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - esbap.Type = &typeVar - } - } - } - - return nil -} - -// ExtendedServerBlobAuditingPolicyListResult a list of server extended auditing settings. -type ExtendedServerBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ExtendedServerBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicyListResult. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExtendedServerBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ExtendedServerBlobAuditingPolicy values. -type ExtendedServerBlobAuditingPolicyListResultIterator struct { - i int - page ExtendedServerBlobAuditingPolicyListResultPage -} - -// 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 *ExtendedServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultIterator.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 *ExtendedServerBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExtendedServerBlobAuditingPolicyListResultIterator) 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 ExtendedServerBlobAuditingPolicyListResultIterator) Response() ExtendedServerBlobAuditingPolicyListResult { - 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 ExtendedServerBlobAuditingPolicyListResultIterator) Value() ExtendedServerBlobAuditingPolicy { - if !iter.page.NotDone() { - return ExtendedServerBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultIterator type. -func NewExtendedServerBlobAuditingPolicyListResultIterator(page ExtendedServerBlobAuditingPolicyListResultPage) ExtendedServerBlobAuditingPolicyListResultIterator { - return ExtendedServerBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) IsEmpty() bool { - return esbaplr.Value == nil || len(*esbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) hasNextLink() bool { - return esbaplr.NextLink != nil && len(*esbaplr.NextLink) != 0 -} - -// extendedServerBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) extendedServerBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !esbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(esbaplr.NextLink))) -} - -// ExtendedServerBlobAuditingPolicyListResultPage contains a page of ExtendedServerBlobAuditingPolicy -// values. -type ExtendedServerBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error) - esbaplr ExtendedServerBlobAuditingPolicyListResult -} - -// 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 *ExtendedServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultPage.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.esbaplr) - if err != nil { - return err - } - page.esbaplr = 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 *ExtendedServerBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExtendedServerBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.esbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExtendedServerBlobAuditingPolicyListResultPage) Response() ExtendedServerBlobAuditingPolicyListResult { - return page.esbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExtendedServerBlobAuditingPolicyListResultPage) Values() []ExtendedServerBlobAuditingPolicy { - if page.esbaplr.IsEmpty() { - return nil - } - return *page.esbaplr.Value -} - -// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultPage type. -func NewExtendedServerBlobAuditingPolicyListResultPage(cur ExtendedServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error)) ExtendedServerBlobAuditingPolicyListResultPage { - return ExtendedServerBlobAuditingPolicyListResultPage{ - fn: getNextPage, - esbaplr: cur, - } -} - -// ExtendedServerBlobAuditingPolicyProperties properties of an extended server blob auditing policy. -type ExtendedServerBlobAuditingPolicyProperties struct { - // PredicateExpression - Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// FailoverGroup a failover group. -type FailoverGroup struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // FailoverGroupProperties - Resource properties. - *FailoverGroupProperties `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"` -} - -// MarshalJSON is the custom marshaler for FailoverGroup. -func (fg FailoverGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fg.Tags != nil { - objectMap["tags"] = fg.Tags - } - if fg.FailoverGroupProperties != nil { - objectMap["properties"] = fg.FailoverGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FailoverGroup struct. -func (fg *FailoverGroup) 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 - } - fg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - fg.Tags = tags - } - case "properties": - if v != nil { - var failoverGroupProperties FailoverGroupProperties - err = json.Unmarshal(*v, &failoverGroupProperties) - if err != nil { - return err - } - fg.FailoverGroupProperties = &failoverGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fg.Type = &typeVar - } - } - } - - return nil -} - -// FailoverGroupListResult a list of failover groups. -type FailoverGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]FailoverGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverGroupListResult. -func (fglr FailoverGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverGroupListResultIterator provides access to a complete listing of FailoverGroup values. -type FailoverGroupListResultIterator struct { - i int - page FailoverGroupListResultPage -} - -// 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 *FailoverGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultIterator.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 *FailoverGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FailoverGroupListResultIterator) 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 FailoverGroupListResultIterator) Response() FailoverGroupListResult { - 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 FailoverGroupListResultIterator) Value() FailoverGroup { - if !iter.page.NotDone() { - return FailoverGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FailoverGroupListResultIterator type. -func NewFailoverGroupListResultIterator(page FailoverGroupListResultPage) FailoverGroupListResultIterator { - return FailoverGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (fglr FailoverGroupListResult) IsEmpty() bool { - return fglr.Value == nil || len(*fglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (fglr FailoverGroupListResult) hasNextLink() bool { - return fglr.NextLink != nil && len(*fglr.NextLink) != 0 -} - -// failoverGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (fglr FailoverGroupListResult) failoverGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !fglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(fglr.NextLink))) -} - -// FailoverGroupListResultPage contains a page of FailoverGroup values. -type FailoverGroupListResultPage struct { - fn func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error) - fglr FailoverGroupListResult -} - -// 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 *FailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultPage.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.fglr) - if err != nil { - return err - } - page.fglr = 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 *FailoverGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FailoverGroupListResultPage) NotDone() bool { - return !page.fglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FailoverGroupListResultPage) Response() FailoverGroupListResult { - return page.fglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FailoverGroupListResultPage) Values() []FailoverGroup { - if page.fglr.IsEmpty() { - return nil - } - return *page.fglr.Value -} - -// Creates a new instance of the FailoverGroupListResultPage type. -func NewFailoverGroupListResultPage(cur FailoverGroupListResult, getNextPage func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error)) FailoverGroupListResultPage { - return FailoverGroupListResultPage{ - fn: getNextPage, - fglr: cur, - } -} - -// FailoverGroupProperties properties of a failover group. -type FailoverGroupProperties struct { - // ReadWriteEndpoint - Read-write endpoint of the failover group instance. - ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` - // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` - // ReplicationRole - READ-ONLY; Local replication role of the failover group instance. Possible values include: 'Primary', 'Secondary' - ReplicationRole FailoverGroupReplicationRole `json:"replicationRole,omitempty"` - // ReplicationState - READ-ONLY; Replication state of the failover group instance. - ReplicationState *string `json:"replicationState,omitempty"` - // PartnerServers - List of partner server information for the failover group. - PartnerServers *[]PartnerInfo `json:"partnerServers,omitempty"` - // Databases - List of databases in the failover group. - Databases *[]string `json:"databases,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverGroupProperties. -func (fgp FailoverGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fgp.ReadWriteEndpoint != nil { - objectMap["readWriteEndpoint"] = fgp.ReadWriteEndpoint - } - if fgp.ReadOnlyEndpoint != nil { - objectMap["readOnlyEndpoint"] = fgp.ReadOnlyEndpoint - } - if fgp.PartnerServers != nil { - objectMap["partnerServers"] = fgp.PartnerServers - } - if fgp.Databases != nil { - objectMap["databases"] = fgp.Databases - } - return json.Marshal(objectMap) -} - -// FailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. -type FailoverGroupReadOnlyEndpoint struct { - // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' - FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` -} - -// FailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. -type FailoverGroupReadWriteEndpoint struct { - // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic' - FailoverPolicy ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` - // FailoverWithDataLossGracePeriodMinutes - Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. - FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` -} - -// FailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FailoverGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsCreateOrUpdateFuture) 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 FailoverGroupsCreateOrUpdateFuture.Result. -func (future *FailoverGroupsCreateOrUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.CreateOrUpdateResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FailoverGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsDeleteFuture) 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 FailoverGroupsDeleteFuture.Result. -func (future *FailoverGroupsDeleteFuture) result(client FailoverGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// FailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FailoverGroupsFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsFailoverFuture) 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 FailoverGroupsFailoverFuture.Result. -func (future *FailoverGroupsFailoverFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsFailoverFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.FailoverResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type FailoverGroupsForceFailoverAllowDataLossFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsForceFailoverAllowDataLossFuture) 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 FailoverGroupsForceFailoverAllowDataLossFuture.Result. -func (future *FailoverGroupsForceFailoverAllowDataLossFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsForceFailoverAllowDataLossFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.ForceFailoverAllowDataLossResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FailoverGroupsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsUpdateFuture) 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 FailoverGroupsUpdateFuture.Result. -func (future *FailoverGroupsUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.UpdateResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupUpdate a failover group update request. -type FailoverGroupUpdate struct { - // FailoverGroupUpdateProperties - Resource properties. - *FailoverGroupUpdateProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for FailoverGroupUpdate. -func (fgu FailoverGroupUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fgu.FailoverGroupUpdateProperties != nil { - objectMap["properties"] = fgu.FailoverGroupUpdateProperties - } - if fgu.Tags != nil { - objectMap["tags"] = fgu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FailoverGroupUpdate struct. -func (fgu *FailoverGroupUpdate) 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 failoverGroupUpdateProperties FailoverGroupUpdateProperties - err = json.Unmarshal(*v, &failoverGroupUpdateProperties) - if err != nil { - return err - } - fgu.FailoverGroupUpdateProperties = &failoverGroupUpdateProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - fgu.Tags = tags - } - } - } - - return nil -} - -// FailoverGroupUpdateProperties properties of a failover group update. -type FailoverGroupUpdateProperties struct { - // ReadWriteEndpoint - Read-write endpoint of the failover group instance. - ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` - // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` - // Databases - List of databases in the failover group. - Databases *[]string `json:"databases,omitempty"` -} - -// FirewallRule represents a server firewall rule. -type FirewallRule struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of server that contains this firewall rule. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Location of the server that contains this firewall rule. - Location *string `json:"location,omitempty"` - // FirewallRuleProperties - The properties representing the resource. - *FirewallRuleProperties `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"` -} - -// MarshalJSON is the custom marshaler for FirewallRule. -func (fr FirewallRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fr.FirewallRuleProperties != nil { - objectMap["properties"] = fr.FirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. -func (fr *FirewallRule) 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 - } - fr.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - fr.Location = &location - } - case "properties": - if v != nil { - var firewallRuleProperties FirewallRuleProperties - err = json.Unmarshal(*v, &firewallRuleProperties) - if err != nil { - return err - } - fr.FirewallRuleProperties = &firewallRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fr.Type = &typeVar - } - } - } - - return nil -} - -// FirewallRuleListResult represents the response to a List Firewall Rules request. -type FirewallRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of server firewall rules. - Value *[]FirewallRule `json:"value,omitempty"` -} - -// FirewallRuleProperties represents the properties of a server firewall rule. -type FirewallRuleProperties struct { - // StartIPAddress - The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. - StartIPAddress *string `json:"startIpAddress,omitempty"` - // EndIPAddress - The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// GeoBackupPolicy a database geo backup policy. -type GeoBackupPolicy struct { - autorest.Response `json:"-"` - // GeoBackupPolicyProperties - The properties of the geo backup policy. - *GeoBackupPolicyProperties `json:"properties,omitempty"` - // Kind - READ-ONLY; Kind of geo backup policy. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Backup policy location. - Location *string `json:"location,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"` -} - -// MarshalJSON is the custom marshaler for GeoBackupPolicy. -func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gbp.GeoBackupPolicyProperties != nil { - objectMap["properties"] = gbp.GeoBackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GeoBackupPolicy struct. -func (gbp *GeoBackupPolicy) 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 geoBackupPolicyProperties GeoBackupPolicyProperties - err = json.Unmarshal(*v, &geoBackupPolicyProperties) - if err != nil { - return err - } - gbp.GeoBackupPolicyProperties = &geoBackupPolicyProperties - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - gbp.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gbp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gbp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gbp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gbp.Type = &typeVar - } - } - } - - return nil -} - -// GeoBackupPolicyListResult the response to a list geo backup policies request. -type GeoBackupPolicyListResult struct { - autorest.Response `json:"-"` - // Value - The list of geo backup policies. - Value *[]GeoBackupPolicy `json:"value,omitempty"` -} - -// GeoBackupPolicyProperties the properties of the geo backup policy. -type GeoBackupPolicyProperties struct { - // State - The state of the geo backup policy. Possible values include: 'GeoBackupPolicyStateDisabled', 'GeoBackupPolicyStateEnabled' - State GeoBackupPolicyState `json:"state,omitempty"` - // StorageType - READ-ONLY; The storage type of the geo backup policy. - StorageType *string `json:"storageType,omitempty"` -} - -// MarshalJSON is the custom marshaler for GeoBackupPolicyProperties. -func (gbpp GeoBackupPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gbpp.State != "" { - objectMap["state"] = gbpp.State - } - return json.Marshal(objectMap) -} - -// ImportExistingDatabaseDefinition contains the information necessary to perform import operation for -// existing database. -type ImportExistingDatabaseDefinition struct { - // StorageKeyType - Storage key type. Possible values include: 'SharedAccessKey', 'StorageAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - Storage key. - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - Administrator login name. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - Administrator login password. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - Authentication type. - AuthenticationType *string `json:"authenticationType,omitempty"` - // NetworkIsolation - Optional resource information to enable network isolation for request. - NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` -} - -// ImportExportImportFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ImportExportImportFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ImportExportClient) (ImportExportOperationResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ImportExportImportFuture) 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 ImportExportImportFuture.Result. -func (future *ImportExportImportFuture) result(client ImportExportClient) (ieor ImportExportOperationResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ImportExportImportFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ieor.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ImportExportImportFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent { - ieor, err = client.ImportResponder(ieor.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ImportExportImportFuture", "Result", ieor.Response.Response, "Failure responding to request") - } - } - return -} - -// ImportExportOperationResult an ImportExport operation result resource. -type ImportExportOperationResult struct { - autorest.Response `json:"-"` - // ImportExportOperationResultProperties - Resource properties. - *ImportExportOperationResultProperties `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"` -} - -// MarshalJSON is the custom marshaler for ImportExportOperationResult. -func (ieor ImportExportOperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ieor.ImportExportOperationResultProperties != nil { - objectMap["properties"] = ieor.ImportExportOperationResultProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ImportExportOperationResult struct. -func (ieor *ImportExportOperationResult) 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 importExportOperationResultProperties ImportExportOperationResultProperties - err = json.Unmarshal(*v, &importExportOperationResultProperties) - if err != nil { - return err - } - ieor.ImportExportOperationResultProperties = &importExportOperationResultProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ieor.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ieor.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ieor.Type = &typeVar - } - } - } - - return nil -} - -// ImportExportOperationResultProperties contains the operation result properties for import/export -// operation. -type ImportExportOperationResultProperties struct { - // RequestID - READ-ONLY; Request Id. - RequestID *uuid.UUID `json:"requestId,omitempty"` - // RequestType - READ-ONLY; Request type. - RequestType *string `json:"requestType,omitempty"` - // QueuedTime - READ-ONLY; Queued time. - QueuedTime *string `json:"queuedTime,omitempty"` - // LastModifiedTime - READ-ONLY; Last modified time. - LastModifiedTime *string `json:"lastModifiedTime,omitempty"` - // BlobURI - READ-ONLY; Blob Uri. - BlobURI *string `json:"blobUri,omitempty"` - // ServerName - READ-ONLY; Server name. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; Database name. - DatabaseName *string `json:"databaseName,omitempty"` - // Status - READ-ONLY; Operation status. - Status *string `json:"status,omitempty"` - // ErrorMessage - READ-ONLY; Error message. - ErrorMessage *string `json:"errorMessage,omitempty"` - // PrivateEndpointConnections - READ-ONLY; Gets the status of private endpoints associated with this request. - PrivateEndpointConnections *[]PrivateEndpointConnectionRequestStatus `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImportExportOperationResultProperties. -func (ieorp ImportExportOperationResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ImportNewDatabaseDefinition contains the information necessary to perform import operation for new -// database. -type ImportNewDatabaseDefinition struct { - // DatabaseName - Name of the import database. - DatabaseName *string `json:"databaseName,omitempty"` - // Edition - Edition of the import database. - Edition *string `json:"edition,omitempty"` - // ServiceObjectiveName - Service level objective name of the import database. - ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` - // MaxSizeBytes - Max size in bytes for the import database. - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // StorageKeyType - Storage key type. Possible values include: 'SharedAccessKey', 'StorageAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - Storage key. - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - Administrator login name. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - Administrator login password. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - Authentication type. - AuthenticationType *string `json:"authenticationType,omitempty"` - // NetworkIsolation - Optional resource information to enable network isolation for request. - NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` -} - -// InstanceFailoverGroup an instance failover group. -type InstanceFailoverGroup struct { - autorest.Response `json:"-"` - // InstanceFailoverGroupProperties - Resource properties. - *InstanceFailoverGroupProperties `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"` -} - -// MarshalJSON is the custom marshaler for InstanceFailoverGroup. -func (ifg InstanceFailoverGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ifg.InstanceFailoverGroupProperties != nil { - objectMap["properties"] = ifg.InstanceFailoverGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InstanceFailoverGroup struct. -func (ifg *InstanceFailoverGroup) 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 instanceFailoverGroupProperties InstanceFailoverGroupProperties - err = json.Unmarshal(*v, &instanceFailoverGroupProperties) - if err != nil { - return err - } - ifg.InstanceFailoverGroupProperties = &instanceFailoverGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ifg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ifg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ifg.Type = &typeVar - } - } - } - - return nil -} - -// InstanceFailoverGroupListResult a list of instance failover groups. -type InstanceFailoverGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]InstanceFailoverGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstanceFailoverGroupListResult. -func (ifglr InstanceFailoverGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// InstanceFailoverGroupListResultIterator provides access to a complete listing of InstanceFailoverGroup -// values. -type InstanceFailoverGroupListResultIterator struct { - i int - page InstanceFailoverGroupListResultPage -} - -// 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 *InstanceFailoverGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupListResultIterator.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 *InstanceFailoverGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InstanceFailoverGroupListResultIterator) 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 InstanceFailoverGroupListResultIterator) Response() InstanceFailoverGroupListResult { - 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 InstanceFailoverGroupListResultIterator) Value() InstanceFailoverGroup { - if !iter.page.NotDone() { - return InstanceFailoverGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the InstanceFailoverGroupListResultIterator type. -func NewInstanceFailoverGroupListResultIterator(page InstanceFailoverGroupListResultPage) InstanceFailoverGroupListResultIterator { - return InstanceFailoverGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ifglr InstanceFailoverGroupListResult) IsEmpty() bool { - return ifglr.Value == nil || len(*ifglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ifglr InstanceFailoverGroupListResult) hasNextLink() bool { - return ifglr.NextLink != nil && len(*ifglr.NextLink) != 0 -} - -// instanceFailoverGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ifglr InstanceFailoverGroupListResult) instanceFailoverGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ifglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ifglr.NextLink))) -} - -// InstanceFailoverGroupListResultPage contains a page of InstanceFailoverGroup values. -type InstanceFailoverGroupListResultPage struct { - fn func(context.Context, InstanceFailoverGroupListResult) (InstanceFailoverGroupListResult, error) - ifglr InstanceFailoverGroupListResult -} - -// 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 *InstanceFailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupListResultPage.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.ifglr) - if err != nil { - return err - } - page.ifglr = 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 *InstanceFailoverGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InstanceFailoverGroupListResultPage) NotDone() bool { - return !page.ifglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page InstanceFailoverGroupListResultPage) Response() InstanceFailoverGroupListResult { - return page.ifglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page InstanceFailoverGroupListResultPage) Values() []InstanceFailoverGroup { - if page.ifglr.IsEmpty() { - return nil - } - return *page.ifglr.Value -} - -// Creates a new instance of the InstanceFailoverGroupListResultPage type. -func NewInstanceFailoverGroupListResultPage(cur InstanceFailoverGroupListResult, getNextPage func(context.Context, InstanceFailoverGroupListResult) (InstanceFailoverGroupListResult, error)) InstanceFailoverGroupListResultPage { - return InstanceFailoverGroupListResultPage{ - fn: getNextPage, - ifglr: cur, - } -} - -// InstanceFailoverGroupProperties properties of a instance failover group. -type InstanceFailoverGroupProperties struct { - // ReadWriteEndpoint - Read-write endpoint of the failover group instance. - ReadWriteEndpoint *InstanceFailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` - // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *InstanceFailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` - // ReplicationRole - READ-ONLY; Local replication role of the failover group instance. Possible values include: 'InstanceFailoverGroupReplicationRolePrimary', 'InstanceFailoverGroupReplicationRoleSecondary' - ReplicationRole InstanceFailoverGroupReplicationRole `json:"replicationRole,omitempty"` - // ReplicationState - READ-ONLY; Replication state of the failover group instance. - ReplicationState *string `json:"replicationState,omitempty"` - // PartnerRegions - Partner region information for the failover group. - PartnerRegions *[]PartnerRegionInfo `json:"partnerRegions,omitempty"` - // ManagedInstancePairs - List of managed instance pairs in the failover group. - ManagedInstancePairs *[]ManagedInstancePairInfo `json:"managedInstancePairs,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstanceFailoverGroupProperties. -func (ifgp InstanceFailoverGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ifgp.ReadWriteEndpoint != nil { - objectMap["readWriteEndpoint"] = ifgp.ReadWriteEndpoint - } - if ifgp.ReadOnlyEndpoint != nil { - objectMap["readOnlyEndpoint"] = ifgp.ReadOnlyEndpoint - } - if ifgp.PartnerRegions != nil { - objectMap["partnerRegions"] = ifgp.PartnerRegions - } - if ifgp.ManagedInstancePairs != nil { - objectMap["managedInstancePairs"] = ifgp.ManagedInstancePairs - } - return json.Marshal(objectMap) -} - -// InstanceFailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. -type InstanceFailoverGroupReadOnlyEndpoint struct { - // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' - FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` -} - -// InstanceFailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. -type InstanceFailoverGroupReadWriteEndpoint struct { - // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic' - FailoverPolicy ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` - // FailoverWithDataLossGracePeriodMinutes - Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. - FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` -} - -// InstanceFailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstanceFailoverGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsCreateOrUpdateFuture) 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 InstanceFailoverGroupsCreateOrUpdateFuture.Result. -func (future *InstanceFailoverGroupsCreateOrUpdateFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { - ifg, err = client.CreateOrUpdateResponder(ifg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsCreateOrUpdateFuture", "Result", ifg.Response.Response, "Failure responding to request") - } - } - return -} - -// InstanceFailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstanceFailoverGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsDeleteFuture) 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 InstanceFailoverGroupsDeleteFuture.Result. -func (future *InstanceFailoverGroupsDeleteFuture) result(client InstanceFailoverGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// InstanceFailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstanceFailoverGroupsFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsFailoverFuture) 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 InstanceFailoverGroupsFailoverFuture.Result. -func (future *InstanceFailoverGroupsFailoverFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsFailoverFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { - ifg, err = client.FailoverResponder(ifg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsFailoverFuture", "Result", ifg.Response.Response, "Failure responding to request") - } - } - return -} - -// InstanceFailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type InstanceFailoverGroupsForceFailoverAllowDataLossFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsForceFailoverAllowDataLossFuture) 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 InstanceFailoverGroupsForceFailoverAllowDataLossFuture.Result. -func (future *InstanceFailoverGroupsForceFailoverAllowDataLossFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { - ifg, err = client.ForceFailoverAllowDataLossResponder(ifg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture", "Result", ifg.Response.Response, "Failure responding to request") - } - } - return -} - -// InstancePool an Azure SQL instance pool. -type InstancePool struct { - autorest.Response `json:"-"` - // Sku - The name and tier of the SKU. - Sku *Sku `json:"sku,omitempty"` - // InstancePoolProperties - Resource properties. - *InstancePoolProperties `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"` -} - -// MarshalJSON is the custom marshaler for InstancePool. -func (IP InstancePool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.Sku != nil { - objectMap["sku"] = IP.Sku - } - if IP.InstancePoolProperties != nil { - objectMap["properties"] = IP.InstancePoolProperties - } - if IP.Location != nil { - objectMap["location"] = IP.Location - } - if IP.Tags != nil { - objectMap["tags"] = IP.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InstancePool struct. -func (IP *InstancePool) 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 - } - IP.Sku = &sku - } - case "properties": - if v != nil { - var instancePoolProperties InstancePoolProperties - err = json.Unmarshal(*v, &instancePoolProperties) - if err != nil { - return err - } - IP.InstancePoolProperties = &instancePoolProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - IP.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - IP.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - IP.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - IP.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - IP.Type = &typeVar - } - } - } - - return nil -} - -// InstancePoolEditionCapability the instance pool capability -type InstancePoolEditionCapability struct { - // Name - READ-ONLY; The instance pool version name. - Name *string `json:"name,omitempty"` - // SupportedFamilies - READ-ONLY; The supported families. - SupportedFamilies *[]InstancePoolFamilyCapability `json:"supportedFamilies,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstancePoolEditionCapability. -func (ipec InstancePoolEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipec.Reason != nil { - objectMap["reason"] = ipec.Reason - } - return json.Marshal(objectMap) -} - -// InstancePoolFamilyCapability the instance pool family capability. -type InstancePoolFamilyCapability struct { - // Name - READ-ONLY; Family name. - Name *string `json:"name,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // SupportedVcoresValues - READ-ONLY; List of supported virtual cores values. - SupportedVcoresValues *[]InstancePoolVcoresCapability `json:"supportedVcoresValues,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstancePoolFamilyCapability. -func (ipfc InstancePoolFamilyCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipfc.Reason != nil { - objectMap["reason"] = ipfc.Reason - } - return json.Marshal(objectMap) -} - -// InstancePoolListResult a list of Azure SQL instance pools. -type InstancePoolListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]InstancePool `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstancePoolListResult. -func (iplr InstancePoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// InstancePoolListResultIterator provides access to a complete listing of InstancePool values. -type InstancePoolListResultIterator struct { - i int - page InstancePoolListResultPage -} - -// 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 *InstancePoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultIterator.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 *InstancePoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InstancePoolListResultIterator) 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 InstancePoolListResultIterator) Response() InstancePoolListResult { - 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 InstancePoolListResultIterator) Value() InstancePool { - if !iter.page.NotDone() { - return InstancePool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the InstancePoolListResultIterator type. -func NewInstancePoolListResultIterator(page InstancePoolListResultPage) InstancePoolListResultIterator { - return InstancePoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iplr InstancePoolListResult) IsEmpty() bool { - return iplr.Value == nil || len(*iplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iplr InstancePoolListResult) hasNextLink() bool { - return iplr.NextLink != nil && len(*iplr.NextLink) != 0 -} - -// instancePoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iplr InstancePoolListResult) instancePoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iplr.NextLink))) -} - -// InstancePoolListResultPage contains a page of InstancePool values. -type InstancePoolListResultPage struct { - fn func(context.Context, InstancePoolListResult) (InstancePoolListResult, error) - iplr InstancePoolListResult -} - -// 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 *InstancePoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultPage.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.iplr) - if err != nil { - return err - } - page.iplr = 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 *InstancePoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InstancePoolListResultPage) NotDone() bool { - return !page.iplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page InstancePoolListResultPage) Response() InstancePoolListResult { - return page.iplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page InstancePoolListResultPage) Values() []InstancePool { - if page.iplr.IsEmpty() { - return nil - } - return *page.iplr.Value -} - -// Creates a new instance of the InstancePoolListResultPage type. -func NewInstancePoolListResultPage(cur InstancePoolListResult, getNextPage func(context.Context, InstancePoolListResult) (InstancePoolListResult, error)) InstancePoolListResultPage { - return InstancePoolListResultPage{ - fn: getNextPage, - iplr: cur, - } -} - -// InstancePoolProperties properties of an instance pool. -type InstancePoolProperties struct { - // SubnetID - Resource ID of the subnet to place this instance pool in. - SubnetID *string `json:"subnetId,omitempty"` - // VCores - Count of vCores belonging to this instance pool. - VCores *int32 `json:"vCores,omitempty"` - // LicenseType - The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'InstancePoolLicenseTypeLicenseIncluded', 'InstancePoolLicenseTypeBasePrice' - LicenseType InstancePoolLicenseType `json:"licenseType,omitempty"` -} - -// InstancePoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstancePoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstancePoolsClient) (InstancePool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstancePoolsCreateOrUpdateFuture) 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 InstancePoolsCreateOrUpdateFuture.Result. -func (future *InstancePoolsCreateOrUpdateFuture) result(client InstancePoolsClient) (IP InstancePool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - IP.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { - IP, err = client.CreateOrUpdateResponder(IP.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", IP.Response.Response, "Failure responding to request") - } - } - return -} - -// InstancePoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type InstancePoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstancePoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstancePoolsDeleteFuture) 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 InstancePoolsDeleteFuture.Result. -func (future *InstancePoolsDeleteFuture) result(client InstancePoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// InstancePoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type InstancePoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstancePoolsClient) (InstancePool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstancePoolsUpdateFuture) 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 InstancePoolsUpdateFuture.Result. -func (future *InstancePoolsUpdateFuture) result(client InstancePoolsClient) (IP InstancePool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - IP.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { - IP, err = client.UpdateResponder(IP.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", IP.Response.Response, "Failure responding to request") - } - } - return -} - -// InstancePoolUpdate an update to an Instance pool. -type InstancePoolUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for InstancePoolUpdate. -func (ipu InstancePoolUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipu.Tags != nil { - objectMap["tags"] = ipu.Tags - } - return json.Marshal(objectMap) -} - -// InstancePoolVcoresCapability the managed instance virtual cores capability. -type InstancePoolVcoresCapability struct { - // Name - READ-ONLY; The virtual cores identifier. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; The virtual cores value. - Value *int32 `json:"value,omitempty"` - // StorageLimit - READ-ONLY; Storage limit. - StorageLimit *MaxSizeCapability `json:"storageLimit,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstancePoolVcoresCapability. -func (ipvc InstancePoolVcoresCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipvc.Reason != nil { - objectMap["reason"] = ipvc.Reason - } - return json.Marshal(objectMap) -} - -// Job a job. -type Job struct { - autorest.Response `json:"-"` - // JobProperties - Resource properties. - *JobProperties `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"` -} - -// MarshalJSON is the custom marshaler for Job. -func (j Job) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if j.JobProperties != nil { - objectMap["properties"] = j.JobProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Job struct. -func (j *Job) 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 jobProperties JobProperties - err = json.Unmarshal(*v, &jobProperties) - if err != nil { - return err - } - j.JobProperties = &jobProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - j.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - j.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - j.Type = &typeVar - } - } - } - - return nil -} - -// JobAgent an Azure SQL job agent. -type JobAgent struct { - autorest.Response `json:"-"` - // Sku - The name and tier of the SKU. - Sku *Sku `json:"sku,omitempty"` - // JobAgentProperties - Resource properties. - *JobAgentProperties `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"` -} - -// MarshalJSON is the custom marshaler for JobAgent. -func (ja JobAgent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ja.Sku != nil { - objectMap["sku"] = ja.Sku - } - if ja.JobAgentProperties != nil { - objectMap["properties"] = ja.JobAgentProperties - } - if ja.Location != nil { - objectMap["location"] = ja.Location - } - if ja.Tags != nil { - objectMap["tags"] = ja.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobAgent struct. -func (ja *JobAgent) 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 - } - ja.Sku = &sku - } - case "properties": - if v != nil { - var jobAgentProperties JobAgentProperties - err = json.Unmarshal(*v, &jobAgentProperties) - if err != nil { - return err - } - ja.JobAgentProperties = &jobAgentProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ja.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ja.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ja.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ja.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ja.Type = &typeVar - } - } - } - - return nil -} - -// JobAgentListResult a list of Azure SQL job agents. -type JobAgentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]JobAgent `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobAgentListResult. -func (jalr JobAgentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobAgentListResultIterator provides access to a complete listing of JobAgent values. -type JobAgentListResultIterator struct { - i int - page JobAgentListResultPage -} - -// 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 *JobAgentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentListResultIterator.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 *JobAgentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobAgentListResultIterator) 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 JobAgentListResultIterator) Response() JobAgentListResult { - 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 JobAgentListResultIterator) Value() JobAgent { - if !iter.page.NotDone() { - return JobAgent{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobAgentListResultIterator type. -func NewJobAgentListResultIterator(page JobAgentListResultPage) JobAgentListResultIterator { - return JobAgentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jalr JobAgentListResult) IsEmpty() bool { - return jalr.Value == nil || len(*jalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jalr JobAgentListResult) hasNextLink() bool { - return jalr.NextLink != nil && len(*jalr.NextLink) != 0 -} - -// jobAgentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jalr JobAgentListResult) jobAgentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jalr.NextLink))) -} - -// JobAgentListResultPage contains a page of JobAgent values. -type JobAgentListResultPage struct { - fn func(context.Context, JobAgentListResult) (JobAgentListResult, error) - jalr JobAgentListResult -} - -// 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 *JobAgentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentListResultPage.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.jalr) - if err != nil { - return err - } - page.jalr = 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 *JobAgentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobAgentListResultPage) NotDone() bool { - return !page.jalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobAgentListResultPage) Response() JobAgentListResult { - return page.jalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobAgentListResultPage) Values() []JobAgent { - if page.jalr.IsEmpty() { - return nil - } - return *page.jalr.Value -} - -// Creates a new instance of the JobAgentListResultPage type. -func NewJobAgentListResultPage(cur JobAgentListResult, getNextPage func(context.Context, JobAgentListResult) (JobAgentListResult, error)) JobAgentListResultPage { - return JobAgentListResultPage{ - fn: getNextPage, - jalr: cur, - } -} - -// JobAgentProperties properties of a job agent. -type JobAgentProperties struct { - // DatabaseID - Resource ID of the database to store job metadata in. - DatabaseID *string `json:"databaseId,omitempty"` - // State - READ-ONLY; The state of the job agent. Possible values include: 'JobAgentStateCreating', 'JobAgentStateReady', 'JobAgentStateUpdating', 'JobAgentStateDeleting', 'JobAgentStateDisabled' - State JobAgentState `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobAgentProperties. -func (jap JobAgentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jap.DatabaseID != nil { - objectMap["databaseId"] = jap.DatabaseID - } - return json.Marshal(objectMap) -} - -// JobAgentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type JobAgentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(JobAgentsClient) (JobAgent, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobAgentsCreateOrUpdateFuture) 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 JobAgentsCreateOrUpdateFuture.Result. -func (future *JobAgentsCreateOrUpdateFuture) result(client JobAgentsClient) (ja JobAgent, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ja.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobAgentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ja.Response.Response, err = future.GetResult(sender); err == nil && ja.Response.Response.StatusCode != http.StatusNoContent { - ja, err = client.CreateOrUpdateResponder(ja.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsCreateOrUpdateFuture", "Result", ja.Response.Response, "Failure responding to request") - } - } - return -} - -// JobAgentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type JobAgentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(JobAgentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobAgentsDeleteFuture) 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 JobAgentsDeleteFuture.Result. -func (future *JobAgentsDeleteFuture) result(client JobAgentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobAgentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// JobAgentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type JobAgentsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(JobAgentsClient) (JobAgent, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobAgentsUpdateFuture) 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 JobAgentsUpdateFuture.Result. -func (future *JobAgentsUpdateFuture) result(client JobAgentsClient) (ja JobAgent, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ja.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobAgentsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ja.Response.Response, err = future.GetResult(sender); err == nil && ja.Response.Response.StatusCode != http.StatusNoContent { - ja, err = client.UpdateResponder(ja.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsUpdateFuture", "Result", ja.Response.Response, "Failure responding to request") - } - } - return -} - -// JobAgentUpdate an update to an Azure SQL job agent. -type JobAgentUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for JobAgentUpdate. -func (jau JobAgentUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jau.Tags != nil { - objectMap["tags"] = jau.Tags - } - return json.Marshal(objectMap) -} - -// JobCredential a stored credential that can be used by a job to connect to target databases. -type JobCredential struct { - autorest.Response `json:"-"` - // JobCredentialProperties - Resource properties. - *JobCredentialProperties `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"` -} - -// MarshalJSON is the custom marshaler for JobCredential. -func (jc JobCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jc.JobCredentialProperties != nil { - objectMap["properties"] = jc.JobCredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobCredential struct. -func (jc *JobCredential) 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 jobCredentialProperties JobCredentialProperties - err = json.Unmarshal(*v, &jobCredentialProperties) - if err != nil { - return err - } - jc.JobCredentialProperties = &jobCredentialProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - jc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - jc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - jc.Type = &typeVar - } - } - } - - return nil -} - -// JobCredentialListResult a list of job credentials. -type JobCredentialListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]JobCredential `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobCredentialListResult. -func (jclr JobCredentialListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobCredentialListResultIterator provides access to a complete listing of JobCredential values. -type JobCredentialListResultIterator struct { - i int - page JobCredentialListResultPage -} - -// 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 *JobCredentialListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialListResultIterator.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 *JobCredentialListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobCredentialListResultIterator) 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 JobCredentialListResultIterator) Response() JobCredentialListResult { - 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 JobCredentialListResultIterator) Value() JobCredential { - if !iter.page.NotDone() { - return JobCredential{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobCredentialListResultIterator type. -func NewJobCredentialListResultIterator(page JobCredentialListResultPage) JobCredentialListResultIterator { - return JobCredentialListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jclr JobCredentialListResult) IsEmpty() bool { - return jclr.Value == nil || len(*jclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jclr JobCredentialListResult) hasNextLink() bool { - return jclr.NextLink != nil && len(*jclr.NextLink) != 0 -} - -// jobCredentialListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jclr JobCredentialListResult) jobCredentialListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jclr.NextLink))) -} - -// JobCredentialListResultPage contains a page of JobCredential values. -type JobCredentialListResultPage struct { - fn func(context.Context, JobCredentialListResult) (JobCredentialListResult, error) - jclr JobCredentialListResult -} - -// 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 *JobCredentialListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialListResultPage.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.jclr) - if err != nil { - return err - } - page.jclr = 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 *JobCredentialListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobCredentialListResultPage) NotDone() bool { - return !page.jclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobCredentialListResultPage) Response() JobCredentialListResult { - return page.jclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobCredentialListResultPage) Values() []JobCredential { - if page.jclr.IsEmpty() { - return nil - } - return *page.jclr.Value -} - -// Creates a new instance of the JobCredentialListResultPage type. -func NewJobCredentialListResultPage(cur JobCredentialListResult, getNextPage func(context.Context, JobCredentialListResult) (JobCredentialListResult, error)) JobCredentialListResultPage { - return JobCredentialListResultPage{ - fn: getNextPage, - jclr: cur, - } -} - -// JobCredentialProperties properties of a job credential. -type JobCredentialProperties struct { - // Username - The credential user name. - Username *string `json:"username,omitempty"` - // Password - The credential password. - Password *string `json:"password,omitempty"` -} - -// JobExecution an execution of a job -type JobExecution struct { - autorest.Response `json:"-"` - // JobExecutionProperties - Resource properties. - *JobExecutionProperties `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"` -} - -// MarshalJSON is the custom marshaler for JobExecution. -func (je JobExecution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if je.JobExecutionProperties != nil { - objectMap["properties"] = je.JobExecutionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobExecution struct. -func (je *JobExecution) 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 jobExecutionProperties JobExecutionProperties - err = json.Unmarshal(*v, &jobExecutionProperties) - if err != nil { - return err - } - je.JobExecutionProperties = &jobExecutionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - je.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - je.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - je.Type = &typeVar - } - } - } - - return nil -} - -// JobExecutionListResult a list of job executions. -type JobExecutionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]JobExecution `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobExecutionListResult. -func (jelr JobExecutionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobExecutionListResultIterator provides access to a complete listing of JobExecution values. -type JobExecutionListResultIterator struct { - i int - page JobExecutionListResultPage -} - -// 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 *JobExecutionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionListResultIterator.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 *JobExecutionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobExecutionListResultIterator) 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 JobExecutionListResultIterator) Response() JobExecutionListResult { - 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 JobExecutionListResultIterator) Value() JobExecution { - if !iter.page.NotDone() { - return JobExecution{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobExecutionListResultIterator type. -func NewJobExecutionListResultIterator(page JobExecutionListResultPage) JobExecutionListResultIterator { - return JobExecutionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jelr JobExecutionListResult) IsEmpty() bool { - return jelr.Value == nil || len(*jelr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jelr JobExecutionListResult) hasNextLink() bool { - return jelr.NextLink != nil && len(*jelr.NextLink) != 0 -} - -// jobExecutionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jelr JobExecutionListResult) jobExecutionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jelr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jelr.NextLink))) -} - -// JobExecutionListResultPage contains a page of JobExecution values. -type JobExecutionListResultPage struct { - fn func(context.Context, JobExecutionListResult) (JobExecutionListResult, error) - jelr JobExecutionListResult -} - -// 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 *JobExecutionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionListResultPage.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.jelr) - if err != nil { - return err - } - page.jelr = 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 *JobExecutionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobExecutionListResultPage) NotDone() bool { - return !page.jelr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobExecutionListResultPage) Response() JobExecutionListResult { - return page.jelr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobExecutionListResultPage) Values() []JobExecution { - if page.jelr.IsEmpty() { - return nil - } - return *page.jelr.Value -} - -// Creates a new instance of the JobExecutionListResultPage type. -func NewJobExecutionListResultPage(cur JobExecutionListResult, getNextPage func(context.Context, JobExecutionListResult) (JobExecutionListResult, error)) JobExecutionListResultPage { - return JobExecutionListResultPage{ - fn: getNextPage, - jelr: cur, - } -} - -// JobExecutionProperties properties for an Azure SQL Database Elastic job execution. -type JobExecutionProperties struct { - // JobVersion - READ-ONLY; The job version number. - JobVersion *int32 `json:"jobVersion,omitempty"` - // StepName - READ-ONLY; The job step name. - StepName *string `json:"stepName,omitempty"` - // StepID - READ-ONLY; The job step id. - StepID *int32 `json:"stepId,omitempty"` - // JobExecutionID - READ-ONLY; The unique identifier of the job execution. - JobExecutionID *uuid.UUID `json:"jobExecutionId,omitempty"` - // Lifecycle - READ-ONLY; The detailed state of the job execution. Possible values include: 'Created', 'InProgress', 'WaitingForChildJobExecutions', 'WaitingForRetry', 'Succeeded', 'SucceededWithSkipped', 'Failed', 'TimedOut', 'Canceled', 'Skipped' - Lifecycle JobExecutionLifecycle `json:"lifecycle,omitempty"` - // ProvisioningState - READ-ONLY; The ARM provisioning state of the job execution. Possible values include: 'ProvisioningStateCreated', 'ProvisioningStateInProgress', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CreateTime - READ-ONLY; The time that the job execution was created. - CreateTime *date.Time `json:"createTime,omitempty"` - // StartTime - READ-ONLY; The time that the job execution started. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The time that the job execution completed. - EndTime *date.Time `json:"endTime,omitempty"` - // CurrentAttempts - Number of times the job execution has been attempted. - CurrentAttempts *int32 `json:"currentAttempts,omitempty"` - // CurrentAttemptStartTime - READ-ONLY; Start time of the current attempt. - CurrentAttemptStartTime *date.Time `json:"currentAttemptStartTime,omitempty"` - // LastMessage - READ-ONLY; The last status or error message. - LastMessage *string `json:"lastMessage,omitempty"` - // Target - READ-ONLY; The target that this execution is executed on. - Target *JobExecutionTarget `json:"target,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobExecutionProperties. -func (jep JobExecutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jep.CurrentAttempts != nil { - objectMap["currentAttempts"] = jep.CurrentAttempts - } - return json.Marshal(objectMap) -} - -// JobExecutionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type JobExecutionsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(JobExecutionsClient) (JobExecution, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobExecutionsCreateFuture) 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 JobExecutionsCreateFuture.Result. -func (future *JobExecutionsCreateFuture) result(client JobExecutionsClient) (je JobExecution, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - je.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobExecutionsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if je.Response.Response, err = future.GetResult(sender); err == nil && je.Response.Response.StatusCode != http.StatusNoContent { - je, err = client.CreateResponder(je.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateFuture", "Result", je.Response.Response, "Failure responding to request") - } - } - return -} - -// JobExecutionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type JobExecutionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(JobExecutionsClient) (JobExecution, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobExecutionsCreateOrUpdateFuture) 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 JobExecutionsCreateOrUpdateFuture.Result. -func (future *JobExecutionsCreateOrUpdateFuture) result(client JobExecutionsClient) (je JobExecution, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - je.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobExecutionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if je.Response.Response, err = future.GetResult(sender); err == nil && je.Response.Response.StatusCode != http.StatusNoContent { - je, err = client.CreateOrUpdateResponder(je.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateOrUpdateFuture", "Result", je.Response.Response, "Failure responding to request") - } - } - return -} - -// JobExecutionTarget the target that a job execution is executed on. -type JobExecutionTarget struct { - // Type - READ-ONLY; The type of the target. Possible values include: 'JobTargetTypeTargetGroup', 'JobTargetTypeSQLDatabase', 'JobTargetTypeSQLElasticPool', 'JobTargetTypeSQLShardMap', 'JobTargetTypeSQLServer' - Type JobTargetType `json:"type,omitempty"` - // ServerName - READ-ONLY; The server name. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; The database name. - DatabaseName *string `json:"databaseName,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobExecutionTarget. -func (jet JobExecutionTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobListResult a list of jobs. -type JobListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Job `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobListResult. -func (jlr JobListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobListResultIterator provides access to a complete listing of Job values. -type JobListResultIterator struct { - i int - page JobListResultPage -} - -// 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 *JobListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultIterator.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 *JobListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobListResultIterator) 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 JobListResultIterator) Response() JobListResult { - 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 JobListResultIterator) Value() Job { - if !iter.page.NotDone() { - return Job{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobListResultIterator type. -func NewJobListResultIterator(page JobListResultPage) JobListResultIterator { - return JobListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jlr JobListResult) IsEmpty() bool { - return jlr.Value == nil || len(*jlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jlr JobListResult) hasNextLink() bool { - return jlr.NextLink != nil && len(*jlr.NextLink) != 0 -} - -// jobListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jlr JobListResult) jobListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jlr.NextLink))) -} - -// JobListResultPage contains a page of Job values. -type JobListResultPage struct { - fn func(context.Context, JobListResult) (JobListResult, error) - jlr JobListResult -} - -// 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 *JobListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultPage.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.jlr) - if err != nil { - return err - } - page.jlr = 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 *JobListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobListResultPage) NotDone() bool { - return !page.jlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobListResultPage) Response() JobListResult { - return page.jlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobListResultPage) Values() []Job { - if page.jlr.IsEmpty() { - return nil - } - return *page.jlr.Value -} - -// Creates a new instance of the JobListResultPage type. -func NewJobListResultPage(cur JobListResult, getNextPage func(context.Context, JobListResult) (JobListResult, error)) JobListResultPage { - return JobListResultPage{ - fn: getNextPage, - jlr: cur, - } -} - -// JobProperties properties of a job. -type JobProperties struct { - // Description - User-defined description of the job. - Description *string `json:"description,omitempty"` - // Version - READ-ONLY; The job version number. - Version *int32 `json:"version,omitempty"` - // Schedule - Schedule properties of the job. - Schedule *JobSchedule `json:"schedule,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobProperties. -func (jp JobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jp.Description != nil { - objectMap["description"] = jp.Description - } - if jp.Schedule != nil { - objectMap["schedule"] = jp.Schedule - } - return json.Marshal(objectMap) -} - -// JobSchedule scheduling properties of a job. -type JobSchedule struct { - // StartTime - Schedule start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Schedule end time. - EndTime *date.Time `json:"endTime,omitempty"` - // Type - Schedule interval type. Possible values include: 'Once', 'Recurring' - Type JobScheduleType `json:"type,omitempty"` - // Enabled - Whether or not the schedule is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Interval - Value of the schedule's recurring interval, if the schedule type is recurring. ISO8601 duration format. - Interval *string `json:"interval,omitempty"` -} - -// JobStep a job step. -type JobStep struct { - autorest.Response `json:"-"` - // JobStepProperties - Resource properties. - *JobStepProperties `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"` -} - -// MarshalJSON is the custom marshaler for JobStep. -func (js JobStep) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if js.JobStepProperties != nil { - objectMap["properties"] = js.JobStepProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobStep struct. -func (js *JobStep) 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 jobStepProperties JobStepProperties - err = json.Unmarshal(*v, &jobStepProperties) - if err != nil { - return err - } - js.JobStepProperties = &jobStepProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - js.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - js.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - js.Type = &typeVar - } - } - } - - return nil -} - -// JobStepAction the action to be executed by a job step. -type JobStepAction struct { - // Type - Type of action being executed by the job step. Possible values include: 'TSQL' - Type JobStepActionType `json:"type,omitempty"` - // Source - The source of the action to execute. Possible values include: 'Inline' - Source JobStepActionSource `json:"source,omitempty"` - // Value - The action value, for example the text of the T-SQL script to execute. - Value *string `json:"value,omitempty"` -} - -// JobStepExecutionOptions the execution options of a job step. -type JobStepExecutionOptions struct { - // TimeoutSeconds - Execution timeout for the job step. - TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` - // RetryAttempts - Maximum number of times the job step will be reattempted if the first attempt fails. - RetryAttempts *int32 `json:"retryAttempts,omitempty"` - // InitialRetryIntervalSeconds - Initial delay between retries for job step execution. - InitialRetryIntervalSeconds *int32 `json:"initialRetryIntervalSeconds,omitempty"` - // MaximumRetryIntervalSeconds - The maximum amount of time to wait between retries for job step execution. - MaximumRetryIntervalSeconds *int32 `json:"maximumRetryIntervalSeconds,omitempty"` - // RetryIntervalBackoffMultiplier - The backoff multiplier for the time between retries. - RetryIntervalBackoffMultiplier *float64 `json:"retryIntervalBackoffMultiplier,omitempty"` -} - -// JobStepListResult a list of job steps. -type JobStepListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]JobStep `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobStepListResult. -func (jslr JobStepListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobStepListResultIterator provides access to a complete listing of JobStep values. -type JobStepListResultIterator struct { - i int - page JobStepListResultPage -} - -// 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 *JobStepListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepListResultIterator.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 *JobStepListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobStepListResultIterator) 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 JobStepListResultIterator) Response() JobStepListResult { - 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 JobStepListResultIterator) Value() JobStep { - if !iter.page.NotDone() { - return JobStep{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobStepListResultIterator type. -func NewJobStepListResultIterator(page JobStepListResultPage) JobStepListResultIterator { - return JobStepListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jslr JobStepListResult) IsEmpty() bool { - return jslr.Value == nil || len(*jslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jslr JobStepListResult) hasNextLink() bool { - return jslr.NextLink != nil && len(*jslr.NextLink) != 0 -} - -// jobStepListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jslr JobStepListResult) jobStepListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jslr.NextLink))) -} - -// JobStepListResultPage contains a page of JobStep values. -type JobStepListResultPage struct { - fn func(context.Context, JobStepListResult) (JobStepListResult, error) - jslr JobStepListResult -} - -// 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 *JobStepListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepListResultPage.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.jslr) - if err != nil { - return err - } - page.jslr = 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 *JobStepListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobStepListResultPage) NotDone() bool { - return !page.jslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobStepListResultPage) Response() JobStepListResult { - return page.jslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobStepListResultPage) Values() []JobStep { - if page.jslr.IsEmpty() { - return nil - } - return *page.jslr.Value -} - -// Creates a new instance of the JobStepListResultPage type. -func NewJobStepListResultPage(cur JobStepListResult, getNextPage func(context.Context, JobStepListResult) (JobStepListResult, error)) JobStepListResultPage { - return JobStepListResultPage{ - fn: getNextPage, - jslr: cur, - } -} - -// JobStepOutput the output configuration of a job step. -type JobStepOutput struct { - // Type - The output destination type. Possible values include: 'SQLDatabase' - Type JobStepOutputType `json:"type,omitempty"` - // SubscriptionID - The output destination subscription id. - SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"` - // ResourceGroupName - The output destination resource group. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ServerName - The output destination server name. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - The output destination database. - DatabaseName *string `json:"databaseName,omitempty"` - // SchemaName - The output destination schema. - SchemaName *string `json:"schemaName,omitempty"` - // TableName - The output destination table. - TableName *string `json:"tableName,omitempty"` - // Credential - The resource ID of the credential to use to connect to the output destination. - Credential *string `json:"credential,omitempty"` -} - -// JobStepProperties properties of a job step. -type JobStepProperties struct { - // StepID - The job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified. - StepID *int32 `json:"stepId,omitempty"` - // TargetGroup - The resource ID of the target group that the job step will be executed on. - TargetGroup *string `json:"targetGroup,omitempty"` - // Credential - The resource ID of the job credential that will be used to connect to the targets. - Credential *string `json:"credential,omitempty"` - // Action - The action payload of the job step. - Action *JobStepAction `json:"action,omitempty"` - // Output - Output destination properties of the job step. - Output *JobStepOutput `json:"output,omitempty"` - // ExecutionOptions - Execution options for the job step. - ExecutionOptions *JobStepExecutionOptions `json:"executionOptions,omitempty"` -} - -// JobTarget a job target, for example a specific database or a container of databases that is evaluated -// during job execution. -type JobTarget struct { - // MembershipType - Whether the target is included or excluded from the group. Possible values include: 'Include', 'Exclude' - MembershipType JobTargetGroupMembershipType `json:"membershipType,omitempty"` - // Type - The target type. Possible values include: 'JobTargetTypeTargetGroup', 'JobTargetTypeSQLDatabase', 'JobTargetTypeSQLElasticPool', 'JobTargetTypeSQLShardMap', 'JobTargetTypeSQLServer' - Type JobTargetType `json:"type,omitempty"` - // ServerName - The target server name. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - The target database name. - DatabaseName *string `json:"databaseName,omitempty"` - // ElasticPoolName - The target elastic pool name. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // ShardMapName - The target shard map. - ShardMapName *string `json:"shardMapName,omitempty"` - // RefreshCredential - The resource ID of the credential that is used during job execution to connect to the target and determine the list of databases inside the target. - RefreshCredential *string `json:"refreshCredential,omitempty"` -} - -// JobTargetGroup a group of job targets. -type JobTargetGroup struct { - autorest.Response `json:"-"` - // JobTargetGroupProperties - Resource properties. - *JobTargetGroupProperties `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"` -} - -// MarshalJSON is the custom marshaler for JobTargetGroup. -func (jtg JobTargetGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jtg.JobTargetGroupProperties != nil { - objectMap["properties"] = jtg.JobTargetGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for JobTargetGroup struct. -func (jtg *JobTargetGroup) 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 jobTargetGroupProperties JobTargetGroupProperties - err = json.Unmarshal(*v, &jobTargetGroupProperties) - if err != nil { - return err - } - jtg.JobTargetGroupProperties = &jobTargetGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - jtg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - jtg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - jtg.Type = &typeVar - } - } - } - - return nil -} - -// JobTargetGroupListResult a list of target groups. -type JobTargetGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]JobTargetGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobTargetGroupListResult. -func (jtglr JobTargetGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobTargetGroupListResultIterator provides access to a complete listing of JobTargetGroup values. -type JobTargetGroupListResultIterator struct { - i int - page JobTargetGroupListResultPage -} - -// 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 *JobTargetGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupListResultIterator.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 *JobTargetGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobTargetGroupListResultIterator) 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 JobTargetGroupListResultIterator) Response() JobTargetGroupListResult { - 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 JobTargetGroupListResultIterator) Value() JobTargetGroup { - if !iter.page.NotDone() { - return JobTargetGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobTargetGroupListResultIterator type. -func NewJobTargetGroupListResultIterator(page JobTargetGroupListResultPage) JobTargetGroupListResultIterator { - return JobTargetGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jtglr JobTargetGroupListResult) IsEmpty() bool { - return jtglr.Value == nil || len(*jtglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jtglr JobTargetGroupListResult) hasNextLink() bool { - return jtglr.NextLink != nil && len(*jtglr.NextLink) != 0 -} - -// jobTargetGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jtglr JobTargetGroupListResult) jobTargetGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jtglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jtglr.NextLink))) -} - -// JobTargetGroupListResultPage contains a page of JobTargetGroup values. -type JobTargetGroupListResultPage struct { - fn func(context.Context, JobTargetGroupListResult) (JobTargetGroupListResult, error) - jtglr JobTargetGroupListResult -} - -// 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 *JobTargetGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupListResultPage.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.jtglr) - if err != nil { - return err - } - page.jtglr = 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 *JobTargetGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobTargetGroupListResultPage) NotDone() bool { - return !page.jtglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobTargetGroupListResultPage) Response() JobTargetGroupListResult { - return page.jtglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobTargetGroupListResultPage) Values() []JobTargetGroup { - if page.jtglr.IsEmpty() { - return nil - } - return *page.jtglr.Value -} - -// Creates a new instance of the JobTargetGroupListResultPage type. -func NewJobTargetGroupListResultPage(cur JobTargetGroupListResult, getNextPage func(context.Context, JobTargetGroupListResult) (JobTargetGroupListResult, error)) JobTargetGroupListResultPage { - return JobTargetGroupListResultPage{ - fn: getNextPage, - jtglr: cur, - } -} - -// JobTargetGroupProperties properties of job target group. -type JobTargetGroupProperties struct { - // Members - Members of the target group. - Members *[]JobTarget `json:"members,omitempty"` -} - -// JobVersion a job version. -type JobVersion struct { - autorest.Response `json:"-"` - // 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"` -} - -// MarshalJSON is the custom marshaler for JobVersion. -func (jv JobVersion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobVersionListResult a list of job versions. -type JobVersionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]JobVersion `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobVersionListResult. -func (jvlr JobVersionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// JobVersionListResultIterator provides access to a complete listing of JobVersion values. -type JobVersionListResultIterator struct { - i int - page JobVersionListResultPage -} - -// 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 *JobVersionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionListResultIterator.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 *JobVersionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobVersionListResultIterator) 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 JobVersionListResultIterator) Response() JobVersionListResult { - 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 JobVersionListResultIterator) Value() JobVersion { - if !iter.page.NotDone() { - return JobVersion{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the JobVersionListResultIterator type. -func NewJobVersionListResultIterator(page JobVersionListResultPage) JobVersionListResultIterator { - return JobVersionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (jvlr JobVersionListResult) IsEmpty() bool { - return jvlr.Value == nil || len(*jvlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (jvlr JobVersionListResult) hasNextLink() bool { - return jvlr.NextLink != nil && len(*jvlr.NextLink) != 0 -} - -// jobVersionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (jvlr JobVersionListResult) jobVersionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jvlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(jvlr.NextLink))) -} - -// JobVersionListResultPage contains a page of JobVersion values. -type JobVersionListResultPage struct { - fn func(context.Context, JobVersionListResult) (JobVersionListResult, error) - jvlr JobVersionListResult -} - -// 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 *JobVersionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionListResultPage.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.jvlr) - if err != nil { - return err - } - page.jvlr = 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 *JobVersionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobVersionListResultPage) NotDone() bool { - return !page.jvlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page JobVersionListResultPage) Response() JobVersionListResult { - return page.jvlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page JobVersionListResultPage) Values() []JobVersion { - if page.jvlr.IsEmpty() { - return nil - } - return *page.jvlr.Value -} - -// Creates a new instance of the JobVersionListResultPage type. -func NewJobVersionListResultPage(cur JobVersionListResult, getNextPage func(context.Context, JobVersionListResult) (JobVersionListResult, error)) JobVersionListResultPage { - return JobVersionListResultPage{ - fn: getNextPage, - jvlr: cur, - } -} - -// LicenseTypeCapability the license type capability -type LicenseTypeCapability struct { - // Name - READ-ONLY; License type identifier. - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for LicenseTypeCapability. -func (ltc LicenseTypeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ltc.Reason != nil { - objectMap["reason"] = ltc.Reason - } - return json.Marshal(objectMap) -} - -// LocationCapabilities the location capability. -type LocationCapabilities struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; The location name. - Name *string `json:"name,omitempty"` - // SupportedServerVersions - READ-ONLY; The list of supported server versions. - SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` - // SupportedManagedInstanceVersions - READ-ONLY; The list of supported managed instance versions. - SupportedManagedInstanceVersions *[]ManagedInstanceVersionCapability `json:"supportedManagedInstanceVersions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationCapabilities. -func (lc LocationCapabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lc.Reason != nil { - objectMap["reason"] = lc.Reason - } - return json.Marshal(objectMap) -} - -// LogicalServerSecurityAlertPolicyListResult a list of the server's security alert policies. -type LogicalServerSecurityAlertPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogicalServerSecurityAlertPolicyListResult. -func (lssaplr LogicalServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LogicalServerSecurityAlertPolicyListResultIterator provides access to a complete listing of -// ServerSecurityAlertPolicy values. -type LogicalServerSecurityAlertPolicyListResultIterator struct { - i int - page LogicalServerSecurityAlertPolicyListResultPage -} - -// 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 *LogicalServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogicalServerSecurityAlertPolicyListResultIterator.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 *LogicalServerSecurityAlertPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LogicalServerSecurityAlertPolicyListResultIterator) 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 LogicalServerSecurityAlertPolicyListResultIterator) Response() LogicalServerSecurityAlertPolicyListResult { - 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 LogicalServerSecurityAlertPolicyListResultIterator) Value() ServerSecurityAlertPolicy { - if !iter.page.NotDone() { - return ServerSecurityAlertPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LogicalServerSecurityAlertPolicyListResultIterator type. -func NewLogicalServerSecurityAlertPolicyListResultIterator(page LogicalServerSecurityAlertPolicyListResultPage) LogicalServerSecurityAlertPolicyListResultIterator { - return LogicalServerSecurityAlertPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lssaplr LogicalServerSecurityAlertPolicyListResult) IsEmpty() bool { - return lssaplr.Value == nil || len(*lssaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lssaplr LogicalServerSecurityAlertPolicyListResult) hasNextLink() bool { - return lssaplr.NextLink != nil && len(*lssaplr.NextLink) != 0 -} - -// logicalServerSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lssaplr LogicalServerSecurityAlertPolicyListResult) logicalServerSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !lssaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lssaplr.NextLink))) -} - -// LogicalServerSecurityAlertPolicyListResultPage contains a page of ServerSecurityAlertPolicy values. -type LogicalServerSecurityAlertPolicyListResultPage struct { - fn func(context.Context, LogicalServerSecurityAlertPolicyListResult) (LogicalServerSecurityAlertPolicyListResult, error) - lssaplr LogicalServerSecurityAlertPolicyListResult -} - -// 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 *LogicalServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogicalServerSecurityAlertPolicyListResultPage.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.lssaplr) - if err != nil { - return err - } - page.lssaplr = 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 *LogicalServerSecurityAlertPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LogicalServerSecurityAlertPolicyListResultPage) NotDone() bool { - return !page.lssaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LogicalServerSecurityAlertPolicyListResultPage) Response() LogicalServerSecurityAlertPolicyListResult { - return page.lssaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LogicalServerSecurityAlertPolicyListResultPage) Values() []ServerSecurityAlertPolicy { - if page.lssaplr.IsEmpty() { - return nil - } - return *page.lssaplr.Value -} - -// Creates a new instance of the LogicalServerSecurityAlertPolicyListResultPage type. -func NewLogicalServerSecurityAlertPolicyListResultPage(cur LogicalServerSecurityAlertPolicyListResult, getNextPage func(context.Context, LogicalServerSecurityAlertPolicyListResult) (LogicalServerSecurityAlertPolicyListResult, error)) LogicalServerSecurityAlertPolicyListResultPage { - return LogicalServerSecurityAlertPolicyListResultPage{ - fn: getNextPage, - lssaplr: cur, - } -} - -// LogSizeCapability the log size capability. -type LogSizeCapability struct { - // Limit - READ-ONLY; The log size limit (see 'unit' for the units). - Limit *int32 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', 'Percent' - Unit LogSizeUnit `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSizeCapability. -func (lsc LogSizeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LongTermRetentionBackup a long term retention backup. -type LongTermRetentionBackup struct { - autorest.Response `json:"-"` - // LongTermRetentionBackupProperties - Resource properties. - *LongTermRetentionBackupProperties `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"` -} - -// MarshalJSON is the custom marshaler for LongTermRetentionBackup. -func (ltrb LongTermRetentionBackup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ltrb.LongTermRetentionBackupProperties != nil { - objectMap["properties"] = ltrb.LongTermRetentionBackupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LongTermRetentionBackup struct. -func (ltrb *LongTermRetentionBackup) 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 longTermRetentionBackupProperties LongTermRetentionBackupProperties - err = json.Unmarshal(*v, &longTermRetentionBackupProperties) - if err != nil { - return err - } - ltrb.LongTermRetentionBackupProperties = &longTermRetentionBackupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ltrb.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ltrb.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ltrb.Type = &typeVar - } - } - } - - return nil -} - -// LongTermRetentionBackupListResult a list of long term retention backups. -type LongTermRetentionBackupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]LongTermRetentionBackup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LongTermRetentionBackupListResult. -func (ltrblr LongTermRetentionBackupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LongTermRetentionBackupListResultIterator provides access to a complete listing of -// LongTermRetentionBackup values. -type LongTermRetentionBackupListResultIterator struct { - i int - page LongTermRetentionBackupListResultPage -} - -// 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 *LongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultIterator.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 *LongTermRetentionBackupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LongTermRetentionBackupListResultIterator) 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 LongTermRetentionBackupListResultIterator) Response() LongTermRetentionBackupListResult { - 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 LongTermRetentionBackupListResultIterator) Value() LongTermRetentionBackup { - if !iter.page.NotDone() { - return LongTermRetentionBackup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LongTermRetentionBackupListResultIterator type. -func NewLongTermRetentionBackupListResultIterator(page LongTermRetentionBackupListResultPage) LongTermRetentionBackupListResultIterator { - return LongTermRetentionBackupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ltrblr LongTermRetentionBackupListResult) IsEmpty() bool { - return ltrblr.Value == nil || len(*ltrblr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ltrblr LongTermRetentionBackupListResult) hasNextLink() bool { - return ltrblr.NextLink != nil && len(*ltrblr.NextLink) != 0 -} - -// longTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ltrblr LongTermRetentionBackupListResult) longTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ltrblr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ltrblr.NextLink))) -} - -// LongTermRetentionBackupListResultPage contains a page of LongTermRetentionBackup values. -type LongTermRetentionBackupListResultPage struct { - fn func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error) - ltrblr LongTermRetentionBackupListResult -} - -// 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 *LongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultPage.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.ltrblr) - if err != nil { - return err - } - page.ltrblr = 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 *LongTermRetentionBackupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LongTermRetentionBackupListResultPage) NotDone() bool { - return !page.ltrblr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LongTermRetentionBackupListResultPage) Response() LongTermRetentionBackupListResult { - return page.ltrblr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LongTermRetentionBackupListResultPage) Values() []LongTermRetentionBackup { - if page.ltrblr.IsEmpty() { - return nil - } - return *page.ltrblr.Value -} - -// Creates a new instance of the LongTermRetentionBackupListResultPage type. -func NewLongTermRetentionBackupListResultPage(cur LongTermRetentionBackupListResult, getNextPage func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error)) LongTermRetentionBackupListResultPage { - return LongTermRetentionBackupListResultPage{ - fn: getNextPage, - ltrblr: cur, - } -} - -// LongTermRetentionBackupProperties properties of a long term retention backup -type LongTermRetentionBackupProperties struct { - // ServerName - READ-ONLY; The server name that the backup database belong to. - ServerName *string `json:"serverName,omitempty"` - // ServerCreateTime - READ-ONLY; The create time of the server. - ServerCreateTime *date.Time `json:"serverCreateTime,omitempty"` - // DatabaseName - READ-ONLY; The name of the database the backup belong to - DatabaseName *string `json:"databaseName,omitempty"` - // DatabaseDeletionTime - READ-ONLY; The delete time of the database - DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"` - // BackupTime - READ-ONLY; The time the backup was taken - BackupTime *date.Time `json:"backupTime,omitempty"` - // BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire. - BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for LongTermRetentionBackupProperties. -func (ltrbp LongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LongTermRetentionBackupsDeleteByResourceGroupFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LongTermRetentionBackupsDeleteByResourceGroupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) 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 LongTermRetentionBackupsDeleteByResourceGroupFuture.Result. -func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteByResourceGroupFuture") - return - } - ar.Response = future.Response() - return -} - -// LongTermRetentionBackupsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type LongTermRetentionBackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsDeleteFuture) 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 LongTermRetentionBackupsDeleteFuture.Result. -func (future *LongTermRetentionBackupsDeleteFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) 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 LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture.Result. -func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture") - return - } - ar.Response = future.Response() - return -} - -// LongTermRetentionManagedInstanceBackupsDeleteFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LongTermRetentionManagedInstanceBackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) 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 LongTermRetentionManagedInstanceBackupsDeleteFuture.Result. -func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LongTermRetentionPolicyProperties properties of a long term retention policy -type LongTermRetentionPolicyProperties struct { - // WeeklyRetention - The weekly retention policy for an LTR backup in an ISO 8601 format. - WeeklyRetention *string `json:"weeklyRetention,omitempty"` - // MonthlyRetention - The monthly retention policy for an LTR backup in an ISO 8601 format. - MonthlyRetention *string `json:"monthlyRetention,omitempty"` - // YearlyRetention - The yearly retention policy for an LTR backup in an ISO 8601 format. - YearlyRetention *string `json:"yearlyRetention,omitempty"` - // WeekOfYear - The week of year to take the yearly backup in an ISO 8601 format. - WeekOfYear *int32 `json:"weekOfYear,omitempty"` -} - -// ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture) 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 ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mbstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { - mbstrp, err = client.CreateOrUpdateResponder(mbstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedBackupShortTermRetentionPoliciesUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedBackupShortTermRetentionPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedBackupShortTermRetentionPoliciesUpdateFuture) 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 ManagedBackupShortTermRetentionPoliciesUpdateFuture.Result. -func (future *ManagedBackupShortTermRetentionPoliciesUpdateFuture) result(client ManagedBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mbstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { - mbstrp, err = client.UpdateResponder(mbstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedBackupShortTermRetentionPolicy a short term retention policy. -type ManagedBackupShortTermRetentionPolicy struct { - autorest.Response `json:"-"` - // ManagedBackupShortTermRetentionPolicyProperties - Resource properties. - *ManagedBackupShortTermRetentionPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedBackupShortTermRetentionPolicy. -func (mbstrp ManagedBackupShortTermRetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mbstrp.ManagedBackupShortTermRetentionPolicyProperties != nil { - objectMap["properties"] = mbstrp.ManagedBackupShortTermRetentionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedBackupShortTermRetentionPolicy struct. -func (mbstrp *ManagedBackupShortTermRetentionPolicy) 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 managedBackupShortTermRetentionPolicyProperties ManagedBackupShortTermRetentionPolicyProperties - err = json.Unmarshal(*v, &managedBackupShortTermRetentionPolicyProperties) - if err != nil { - return err - } - mbstrp.ManagedBackupShortTermRetentionPolicyProperties = &managedBackupShortTermRetentionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mbstrp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mbstrp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mbstrp.Type = &typeVar - } - } - } - - return nil -} - -// ManagedBackupShortTermRetentionPolicyListResult a list of short term retention policies. -type ManagedBackupShortTermRetentionPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedBackupShortTermRetentionPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedBackupShortTermRetentionPolicyListResult. -func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedBackupShortTermRetentionPolicyListResultIterator provides access to a complete listing of -// ManagedBackupShortTermRetentionPolicy values. -type ManagedBackupShortTermRetentionPolicyListResultIterator struct { - i int - page ManagedBackupShortTermRetentionPolicyListResultPage -} - -// 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 *ManagedBackupShortTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPolicyListResultIterator.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 *ManagedBackupShortTermRetentionPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) 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 ManagedBackupShortTermRetentionPolicyListResultIterator) Response() ManagedBackupShortTermRetentionPolicyListResult { - 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 ManagedBackupShortTermRetentionPolicyListResultIterator) Value() ManagedBackupShortTermRetentionPolicy { - if !iter.page.NotDone() { - return ManagedBackupShortTermRetentionPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedBackupShortTermRetentionPolicyListResultIterator type. -func NewManagedBackupShortTermRetentionPolicyListResultIterator(page ManagedBackupShortTermRetentionPolicyListResultPage) ManagedBackupShortTermRetentionPolicyListResultIterator { - return ManagedBackupShortTermRetentionPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) IsEmpty() bool { - return mbstrplr.Value == nil || len(*mbstrplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) hasNextLink() bool { - return mbstrplr.NextLink != nil && len(*mbstrplr.NextLink) != 0 -} - -// managedBackupShortTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) managedBackupShortTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mbstrplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mbstrplr.NextLink))) -} - -// ManagedBackupShortTermRetentionPolicyListResultPage contains a page of -// ManagedBackupShortTermRetentionPolicy values. -type ManagedBackupShortTermRetentionPolicyListResultPage struct { - fn func(context.Context, ManagedBackupShortTermRetentionPolicyListResult) (ManagedBackupShortTermRetentionPolicyListResult, error) - mbstrplr ManagedBackupShortTermRetentionPolicyListResult -} - -// 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 *ManagedBackupShortTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPolicyListResultPage.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.mbstrplr) - if err != nil { - return err - } - page.mbstrplr = 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 *ManagedBackupShortTermRetentionPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedBackupShortTermRetentionPolicyListResultPage) NotDone() bool { - return !page.mbstrplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedBackupShortTermRetentionPolicyListResultPage) Response() ManagedBackupShortTermRetentionPolicyListResult { - return page.mbstrplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedBackupShortTermRetentionPolicyListResultPage) Values() []ManagedBackupShortTermRetentionPolicy { - if page.mbstrplr.IsEmpty() { - return nil - } - return *page.mbstrplr.Value -} - -// Creates a new instance of the ManagedBackupShortTermRetentionPolicyListResultPage type. -func NewManagedBackupShortTermRetentionPolicyListResultPage(cur ManagedBackupShortTermRetentionPolicyListResult, getNextPage func(context.Context, ManagedBackupShortTermRetentionPolicyListResult) (ManagedBackupShortTermRetentionPolicyListResult, error)) ManagedBackupShortTermRetentionPolicyListResultPage { - return ManagedBackupShortTermRetentionPolicyListResultPage{ - fn: getNextPage, - mbstrplr: cur, - } -} - -// ManagedBackupShortTermRetentionPolicyProperties properties of a short term retention policy -type ManagedBackupShortTermRetentionPolicyProperties struct { - // RetentionDays - The backup retention period in days. This is how many days Point-in-Time Restore will be supported. - RetentionDays *int32 `json:"retentionDays,omitempty"` -} - -// ManagedDatabase a managed database resource. -type ManagedDatabase struct { - autorest.Response `json:"-"` - // ManagedDatabaseProperties - Resource properties. - *ManagedDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabase. -func (md ManagedDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if md.ManagedDatabaseProperties != nil { - objectMap["properties"] = md.ManagedDatabaseProperties - } - if md.Location != nil { - objectMap["location"] = md.Location - } - if md.Tags != nil { - objectMap["tags"] = md.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedDatabase struct. -func (md *ManagedDatabase) 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 managedDatabaseProperties ManagedDatabaseProperties - err = json.Unmarshal(*v, &managedDatabaseProperties) - if err != nil { - return err - } - md.ManagedDatabaseProperties = &managedDatabaseProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - md.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - md.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - md.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - md.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - md.Type = &typeVar - } - } - } - - return nil -} - -// ManagedDatabaseListResult a list of managed databases. -type ManagedDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedDatabase `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseListResult. -func (mdlr ManagedDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedDatabaseListResultIterator provides access to a complete listing of ManagedDatabase values. -type ManagedDatabaseListResultIterator struct { - i int - page ManagedDatabaseListResultPage -} - -// 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 *ManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultIterator.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 *ManagedDatabaseListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedDatabaseListResultIterator) 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 ManagedDatabaseListResultIterator) Response() ManagedDatabaseListResult { - 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 ManagedDatabaseListResultIterator) Value() ManagedDatabase { - if !iter.page.NotDone() { - return ManagedDatabase{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedDatabaseListResultIterator type. -func NewManagedDatabaseListResultIterator(page ManagedDatabaseListResultPage) ManagedDatabaseListResultIterator { - return ManagedDatabaseListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mdlr ManagedDatabaseListResult) IsEmpty() bool { - return mdlr.Value == nil || len(*mdlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mdlr ManagedDatabaseListResult) hasNextLink() bool { - return mdlr.NextLink != nil && len(*mdlr.NextLink) != 0 -} - -// managedDatabaseListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mdlr ManagedDatabaseListResult) managedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mdlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mdlr.NextLink))) -} - -// ManagedDatabaseListResultPage contains a page of ManagedDatabase values. -type ManagedDatabaseListResultPage struct { - fn func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error) - mdlr ManagedDatabaseListResult -} - -// 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 *ManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultPage.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.mdlr) - if err != nil { - return err - } - page.mdlr = 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 *ManagedDatabaseListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedDatabaseListResultPage) NotDone() bool { - return !page.mdlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedDatabaseListResultPage) Response() ManagedDatabaseListResult { - return page.mdlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedDatabaseListResultPage) Values() []ManagedDatabase { - if page.mdlr.IsEmpty() { - return nil - } - return *page.mdlr.Value -} - -// Creates a new instance of the ManagedDatabaseListResultPage type. -func NewManagedDatabaseListResultPage(cur ManagedDatabaseListResult, getNextPage func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error)) ManagedDatabaseListResultPage { - return ManagedDatabaseListResultPage{ - fn: getNextPage, - mdlr: cur, - } -} - -// ManagedDatabaseProperties the managed database's properties. -type ManagedDatabaseProperties struct { - // Collation - Collation of the managed database. - Collation *string `json:"collation,omitempty"` - // Status - READ-ONLY; Status of the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating' - Status ManagedDatabaseStatus `json:"status,omitempty"` - // CreationDate - READ-ONLY; Creation date of the database. - CreationDate *date.Time `json:"creationDate,omitempty"` - // EarliestRestorePoint - READ-ONLY; Earliest restore point in time for point in time restore. - EarliestRestorePoint *date.Time `json:"earliestRestorePoint,omitempty"` - // RestorePointInTime - Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // DefaultSecondaryLocation - READ-ONLY; Geo paired region. - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` - // CatalogCollation - Collation of the metadata catalog. Possible values include: 'DATABASEDEFAULT', 'SQLLatin1GeneralCP1CIAS' - CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"` - // CreateMode - Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required). Possible values include: 'ManagedDatabaseCreateModeDefault', 'ManagedDatabaseCreateModeRestoreExternalBackup', 'ManagedDatabaseCreateModePointInTimeRestore', 'ManagedDatabaseCreateModeRecovery', 'ManagedDatabaseCreateModeRestoreLongTermRetentionBackup' - CreateMode ManagedDatabaseCreateMode `json:"createMode,omitempty"` - // StorageContainerURI - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored. - StorageContainerURI *string `json:"storageContainerUri,omitempty"` - // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // RestorableDroppedDatabaseID - The restorable dropped database resource id to restore when creating this database. - RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` - // StorageContainerSasToken - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. - StorageContainerSasToken *string `json:"storageContainerSasToken,omitempty"` - // FailoverGroupID - READ-ONLY; Instance Failover Group resource identifier that this managed database belongs to. - FailoverGroupID *string `json:"failoverGroupId,omitempty"` - // RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database. - RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` - // LongTermRetentionBackupResourceID - The name of the Long Term Retention backup to be used for restore of this managed database. - LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` - // AutoCompleteRestore - Whether to auto complete restore of this managed database. - AutoCompleteRestore *bool `json:"autoCompleteRestore,omitempty"` - // LastBackupName - Last backup file name for restore of this managed database. - LastBackupName *string `json:"lastBackupName,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseProperties. -func (mdp ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdp.Collation != nil { - objectMap["collation"] = mdp.Collation - } - if mdp.RestorePointInTime != nil { - objectMap["restorePointInTime"] = mdp.RestorePointInTime - } - if mdp.CatalogCollation != "" { - objectMap["catalogCollation"] = mdp.CatalogCollation - } - if mdp.CreateMode != "" { - objectMap["createMode"] = mdp.CreateMode - } - if mdp.StorageContainerURI != nil { - objectMap["storageContainerUri"] = mdp.StorageContainerURI - } - if mdp.SourceDatabaseID != nil { - objectMap["sourceDatabaseId"] = mdp.SourceDatabaseID - } - if mdp.RestorableDroppedDatabaseID != nil { - objectMap["restorableDroppedDatabaseId"] = mdp.RestorableDroppedDatabaseID - } - if mdp.StorageContainerSasToken != nil { - objectMap["storageContainerSasToken"] = mdp.StorageContainerSasToken - } - if mdp.RecoverableDatabaseID != nil { - objectMap["recoverableDatabaseId"] = mdp.RecoverableDatabaseID - } - if mdp.LongTermRetentionBackupResourceID != nil { - objectMap["longTermRetentionBackupResourceId"] = mdp.LongTermRetentionBackupResourceID - } - if mdp.AutoCompleteRestore != nil { - objectMap["autoCompleteRestore"] = mdp.AutoCompleteRestore - } - if mdp.LastBackupName != nil { - objectMap["lastBackupName"] = mdp.LastBackupName - } - return json.Marshal(objectMap) -} - -// ManagedDatabaseRestoreDetailsProperties the managed database's restore details properties. -type ManagedDatabaseRestoreDetailsProperties struct { - // Status - READ-ONLY; Restore status. - Status *string `json:"status,omitempty"` - // CurrentRestoringFileName - READ-ONLY; Current restoring file name. - CurrentRestoringFileName *string `json:"currentRestoringFileName,omitempty"` - // LastRestoredFileName - READ-ONLY; Last restored file name. - LastRestoredFileName *string `json:"lastRestoredFileName,omitempty"` - // LastRestoredFileTime - READ-ONLY; Last restored file time. - LastRestoredFileTime *date.Time `json:"lastRestoredFileTime,omitempty"` - // PercentCompleted - READ-ONLY; Percent completed. - PercentCompleted *float64 `json:"percentCompleted,omitempty"` - // UnrestorableFiles - READ-ONLY; List of unrestorable files. - UnrestorableFiles *[]string `json:"unrestorableFiles,omitempty"` - // NumberOfFilesDetected - READ-ONLY; Number of files detected. - NumberOfFilesDetected *int64 `json:"numberOfFilesDetected,omitempty"` - // LastUploadedFileName - READ-ONLY; Last uploaded file name. - LastUploadedFileName *string `json:"lastUploadedFileName,omitempty"` - // LastUploadedFileTime - READ-ONLY; Last uploaded file time. - LastUploadedFileTime *date.Time `json:"lastUploadedFileTime,omitempty"` - // BlockReason - READ-ONLY; The reason why restore is in Blocked state. - BlockReason *string `json:"blockReason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsProperties. -func (mdrdp ManagedDatabaseRestoreDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedDatabaseRestoreDetailsResult a managed database restore details. -type ManagedDatabaseRestoreDetailsResult struct { - autorest.Response `json:"-"` - // ManagedDatabaseRestoreDetailsProperties - Resource properties. - *ManagedDatabaseRestoreDetailsProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsResult. -func (mdrdr ManagedDatabaseRestoreDetailsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdrdr.ManagedDatabaseRestoreDetailsProperties != nil { - objectMap["properties"] = mdrdr.ManagedDatabaseRestoreDetailsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseRestoreDetailsResult struct. -func (mdrdr *ManagedDatabaseRestoreDetailsResult) 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 managedDatabaseRestoreDetailsProperties ManagedDatabaseRestoreDetailsProperties - err = json.Unmarshal(*v, &managedDatabaseRestoreDetailsProperties) - if err != nil { - return err - } - mdrdr.ManagedDatabaseRestoreDetailsProperties = &managedDatabaseRestoreDetailsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdrdr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdrdr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdrdr.Type = &typeVar - } - } - } - - return nil -} - -// ManagedDatabasesCompleteRestoreFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedDatabasesCompleteRestoreFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedDatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabasesCompleteRestoreFuture) 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 ManagedDatabasesCompleteRestoreFuture.Result. -func (future *ManagedDatabasesCompleteRestoreFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCompleteRestoreFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCompleteRestoreFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedDatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedDatabasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedDatabasesClient) (ManagedDatabase, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabasesCreateOrUpdateFuture) 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 ManagedDatabasesCreateOrUpdateFuture.Result. -func (future *ManagedDatabasesCreateOrUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - md.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { - md, err = client.CreateOrUpdateResponder(md.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", md.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedDatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedDatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedDatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabasesDeleteFuture) 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 ManagedDatabasesDeleteFuture.Result. -func (future *ManagedDatabasesDeleteFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedDatabaseSecurityAlertPolicy a managed database security alert policy. -type ManagedDatabaseSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // SecurityAlertPolicyProperties - Resource properties. - *SecurityAlertPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseSecurityAlertPolicy. -func (mdsap ManagedDatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdsap.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = mdsap.SecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseSecurityAlertPolicy struct. -func (mdsap *ManagedDatabaseSecurityAlertPolicy) 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 securityAlertPolicyProperties SecurityAlertPolicyProperties - err = json.Unmarshal(*v, &securityAlertPolicyProperties) - if err != nil { - return err - } - mdsap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdsap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdsap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdsap.Type = &typeVar - } - } - } - - return nil -} - -// ManagedDatabaseSecurityAlertPolicyListResult a list of the managed database's security alert policies. -type ManagedDatabaseSecurityAlertPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedDatabaseSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseSecurityAlertPolicyListResult. -func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedDatabaseSecurityAlertPolicyListResultIterator provides access to a complete listing of -// ManagedDatabaseSecurityAlertPolicy values. -type ManagedDatabaseSecurityAlertPolicyListResultIterator struct { - i int - page ManagedDatabaseSecurityAlertPolicyListResultPage -} - -// 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 *ManagedDatabaseSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPolicyListResultIterator.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 *ManagedDatabaseSecurityAlertPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedDatabaseSecurityAlertPolicyListResultIterator) 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 ManagedDatabaseSecurityAlertPolicyListResultIterator) Response() ManagedDatabaseSecurityAlertPolicyListResult { - 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 ManagedDatabaseSecurityAlertPolicyListResultIterator) Value() ManagedDatabaseSecurityAlertPolicy { - if !iter.page.NotDone() { - return ManagedDatabaseSecurityAlertPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedDatabaseSecurityAlertPolicyListResultIterator type. -func NewManagedDatabaseSecurityAlertPolicyListResultIterator(page ManagedDatabaseSecurityAlertPolicyListResultPage) ManagedDatabaseSecurityAlertPolicyListResultIterator { - return ManagedDatabaseSecurityAlertPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) IsEmpty() bool { - return mdsaplr.Value == nil || len(*mdsaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) hasNextLink() bool { - return mdsaplr.NextLink != nil && len(*mdsaplr.NextLink) != 0 -} - -// managedDatabaseSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) managedDatabaseSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mdsaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mdsaplr.NextLink))) -} - -// ManagedDatabaseSecurityAlertPolicyListResultPage contains a page of ManagedDatabaseSecurityAlertPolicy -// values. -type ManagedDatabaseSecurityAlertPolicyListResultPage struct { - fn func(context.Context, ManagedDatabaseSecurityAlertPolicyListResult) (ManagedDatabaseSecurityAlertPolicyListResult, error) - mdsaplr ManagedDatabaseSecurityAlertPolicyListResult -} - -// 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 *ManagedDatabaseSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPolicyListResultPage.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.mdsaplr) - if err != nil { - return err - } - page.mdsaplr = 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 *ManagedDatabaseSecurityAlertPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedDatabaseSecurityAlertPolicyListResultPage) NotDone() bool { - return !page.mdsaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedDatabaseSecurityAlertPolicyListResultPage) Response() ManagedDatabaseSecurityAlertPolicyListResult { - return page.mdsaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedDatabaseSecurityAlertPolicyListResultPage) Values() []ManagedDatabaseSecurityAlertPolicy { - if page.mdsaplr.IsEmpty() { - return nil - } - return *page.mdsaplr.Value -} - -// Creates a new instance of the ManagedDatabaseSecurityAlertPolicyListResultPage type. -func NewManagedDatabaseSecurityAlertPolicyListResultPage(cur ManagedDatabaseSecurityAlertPolicyListResult, getNextPage func(context.Context, ManagedDatabaseSecurityAlertPolicyListResult) (ManagedDatabaseSecurityAlertPolicyListResult, error)) ManagedDatabaseSecurityAlertPolicyListResultPage { - return ManagedDatabaseSecurityAlertPolicyListResultPage{ - fn: getNextPage, - mdsaplr: cur, - } -} - -// ManagedDatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedDatabasesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedDatabasesClient) (ManagedDatabase, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabasesUpdateFuture) 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 ManagedDatabasesUpdateFuture.Result. -func (future *ManagedDatabasesUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - md.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { - md, err = client.UpdateResponder(md.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", md.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedDatabaseUpdate an managed database update. -type ManagedDatabaseUpdate struct { - // ManagedDatabaseProperties - Resource properties. - *ManagedDatabaseProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseUpdate. -func (mdu ManagedDatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdu.ManagedDatabaseProperties != nil { - objectMap["properties"] = mdu.ManagedDatabaseProperties - } - if mdu.Tags != nil { - objectMap["tags"] = mdu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseUpdate struct. -func (mdu *ManagedDatabaseUpdate) 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 managedDatabaseProperties ManagedDatabaseProperties - err = json.Unmarshal(*v, &managedDatabaseProperties) - if err != nil { - return err - } - mdu.ManagedDatabaseProperties = &managedDatabaseProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdu.Tags = tags - } - } - } - - return nil -} - -// ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedDatabaseVulnerabilityAssessmentScansClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture) 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 ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture.Result. -func (future *ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture) result(client ManagedDatabaseVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstance an Azure SQL managed instance. -type ManagedInstance struct { - autorest.Response `json:"-"` - // Identity - The Azure Active Directory identity of the managed instance. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Sku - Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5 - Sku *Sku `json:"sku,omitempty"` - // ManagedInstanceProperties - Resource properties. - *ManagedInstanceProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstance. -func (mi ManagedInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mi.Identity != nil { - objectMap["identity"] = mi.Identity - } - if mi.Sku != nil { - objectMap["sku"] = mi.Sku - } - if mi.ManagedInstanceProperties != nil { - objectMap["properties"] = mi.ManagedInstanceProperties - } - if mi.Location != nil { - objectMap["location"] = mi.Location - } - if mi.Tags != nil { - objectMap["tags"] = mi.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstance struct. -func (mi *ManagedInstance) 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 "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mi.Identity = &identity - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - mi.Sku = &sku - } - case "properties": - if v != nil { - var managedInstanceProperties ManagedInstanceProperties - err = json.Unmarshal(*v, &managedInstanceProperties) - if err != nil { - return err - } - mi.ManagedInstanceProperties = &managedInstanceProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mi.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mi.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mi.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceAdministrator an Azure SQL managed instance administrator. -type ManagedInstanceAdministrator struct { - autorest.Response `json:"-"` - // ManagedInstanceAdministratorProperties - Resource properties. - *ManagedInstanceAdministratorProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceAdministrator. -func (mia ManagedInstanceAdministrator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mia.ManagedInstanceAdministratorProperties != nil { - objectMap["properties"] = mia.ManagedInstanceAdministratorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAdministrator struct. -func (mia *ManagedInstanceAdministrator) 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 managedInstanceAdministratorProperties ManagedInstanceAdministratorProperties - err = json.Unmarshal(*v, &managedInstanceAdministratorProperties) - if err != nil { - return err - } - mia.ManagedInstanceAdministratorProperties = &managedInstanceAdministratorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mia.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mia.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mia.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceAdministratorListResult a list of managed instance administrators. -type ManagedInstanceAdministratorListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceAdministrator `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceAdministratorListResult. -func (mialr ManagedInstanceAdministratorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceAdministratorListResultIterator provides access to a complete listing of -// ManagedInstanceAdministrator values. -type ManagedInstanceAdministratorListResultIterator struct { - i int - page ManagedInstanceAdministratorListResultPage -} - -// 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 *ManagedInstanceAdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultIterator.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 *ManagedInstanceAdministratorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceAdministratorListResultIterator) 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 ManagedInstanceAdministratorListResultIterator) Response() ManagedInstanceAdministratorListResult { - 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 ManagedInstanceAdministratorListResultIterator) Value() ManagedInstanceAdministrator { - if !iter.page.NotDone() { - return ManagedInstanceAdministrator{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceAdministratorListResultIterator type. -func NewManagedInstanceAdministratorListResultIterator(page ManagedInstanceAdministratorListResultPage) ManagedInstanceAdministratorListResultIterator { - return ManagedInstanceAdministratorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mialr ManagedInstanceAdministratorListResult) IsEmpty() bool { - return mialr.Value == nil || len(*mialr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mialr ManagedInstanceAdministratorListResult) hasNextLink() bool { - return mialr.NextLink != nil && len(*mialr.NextLink) != 0 -} - -// managedInstanceAdministratorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mialr ManagedInstanceAdministratorListResult) managedInstanceAdministratorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mialr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mialr.NextLink))) -} - -// ManagedInstanceAdministratorListResultPage contains a page of ManagedInstanceAdministrator values. -type ManagedInstanceAdministratorListResultPage struct { - fn func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error) - mialr ManagedInstanceAdministratorListResult -} - -// 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 *ManagedInstanceAdministratorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultPage.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.mialr) - if err != nil { - return err - } - page.mialr = 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 *ManagedInstanceAdministratorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceAdministratorListResultPage) NotDone() bool { - return !page.mialr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceAdministratorListResultPage) Response() ManagedInstanceAdministratorListResult { - return page.mialr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceAdministratorListResultPage) Values() []ManagedInstanceAdministrator { - if page.mialr.IsEmpty() { - return nil - } - return *page.mialr.Value -} - -// Creates a new instance of the ManagedInstanceAdministratorListResultPage type. -func NewManagedInstanceAdministratorListResultPage(cur ManagedInstanceAdministratorListResult, getNextPage func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error)) ManagedInstanceAdministratorListResultPage { - return ManagedInstanceAdministratorListResultPage{ - fn: getNextPage, - mialr: cur, - } -} - -// ManagedInstanceAdministratorProperties the properties of a managed instance administrator. -type ManagedInstanceAdministratorProperties struct { - // AdministratorType - Type of the managed instance administrator. - AdministratorType *string `json:"administratorType,omitempty"` - // Login - Login name of the managed instance administrator. - Login *string `json:"login,omitempty"` - // Sid - SID (object ID) of the managed instance administrator. - Sid *uuid.UUID `json:"sid,omitempty"` - // TenantID - Tenant ID of the managed instance administrator. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// ManagedInstanceAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceAdministratorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceAdministratorsClient) (ManagedInstanceAdministrator, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) 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 ManagedInstanceAdministratorsCreateOrUpdateFuture.Result. -func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) result(client ManagedInstanceAdministratorsClient) (mia ManagedInstanceAdministrator, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mia.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mia.Response.Response, err = future.GetResult(sender); err == nil && mia.Response.Response.StatusCode != http.StatusNoContent { - mia, err = client.CreateOrUpdateResponder(mia.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", mia.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceAdministratorsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceAdministratorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceAdministratorsDeleteFuture) 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 ManagedInstanceAdministratorsDeleteFuture.Result. -func (future *ManagedInstanceAdministratorsDeleteFuture) result(client ManagedInstanceAdministratorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstanceAzureADOnlyAuthentication azure Active Directory only authentication. -type ManagedInstanceAzureADOnlyAuthentication struct { - autorest.Response `json:"-"` - // ManagedInstanceAzureADOnlyAuthProperties - Resource properties. - *ManagedInstanceAzureADOnlyAuthProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceAzureADOnlyAuthentication. -func (miaaoa ManagedInstanceAzureADOnlyAuthentication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miaaoa.ManagedInstanceAzureADOnlyAuthProperties != nil { - objectMap["properties"] = miaaoa.ManagedInstanceAzureADOnlyAuthProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAzureADOnlyAuthentication struct. -func (miaaoa *ManagedInstanceAzureADOnlyAuthentication) 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 managedInstanceAzureADOnlyAuthProperties ManagedInstanceAzureADOnlyAuthProperties - err = json.Unmarshal(*v, &managedInstanceAzureADOnlyAuthProperties) - if err != nil { - return err - } - miaaoa.ManagedInstanceAzureADOnlyAuthProperties = &managedInstanceAzureADOnlyAuthProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - miaaoa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - miaaoa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - miaaoa.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceAzureADOnlyAuthenticationsClient) (ManagedInstanceAzureADOnlyAuthentication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture) 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 ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture.Result. -func (future *ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture) result(client ManagedInstanceAzureADOnlyAuthenticationsClient) (miaaoa ManagedInstanceAzureADOnlyAuthentication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - miaaoa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if miaaoa.Response.Response, err = future.GetResult(sender); err == nil && miaaoa.Response.Response.StatusCode != http.StatusNoContent { - miaaoa, err = client.CreateOrUpdateResponder(miaaoa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", miaaoa.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceAzureADOnlyAuthenticationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture) 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 ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture.Result. -func (future *ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture) result(client ManagedInstanceAzureADOnlyAuthenticationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstanceAzureADOnlyAuthListResult a list of active directory only authentications. -type ManagedInstanceAzureADOnlyAuthListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceAzureADOnlyAuthentication `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceAzureADOnlyAuthListResult. -func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceAzureADOnlyAuthListResultIterator provides access to a complete listing of -// ManagedInstanceAzureADOnlyAuthentication values. -type ManagedInstanceAzureADOnlyAuthListResultIterator struct { - i int - page ManagedInstanceAzureADOnlyAuthListResultPage -} - -// 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 *ManagedInstanceAzureADOnlyAuthListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthListResultIterator.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 *ManagedInstanceAzureADOnlyAuthListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) 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 ManagedInstanceAzureADOnlyAuthListResultIterator) Response() ManagedInstanceAzureADOnlyAuthListResult { - 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 ManagedInstanceAzureADOnlyAuthListResultIterator) Value() ManagedInstanceAzureADOnlyAuthentication { - if !iter.page.NotDone() { - return ManagedInstanceAzureADOnlyAuthentication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceAzureADOnlyAuthListResultIterator type. -func NewManagedInstanceAzureADOnlyAuthListResultIterator(page ManagedInstanceAzureADOnlyAuthListResultPage) ManagedInstanceAzureADOnlyAuthListResultIterator { - return ManagedInstanceAzureADOnlyAuthListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) IsEmpty() bool { - return miaaoalr.Value == nil || len(*miaaoalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) hasNextLink() bool { - return miaaoalr.NextLink != nil && len(*miaaoalr.NextLink) != 0 -} - -// managedInstanceAzureADOnlyAuthListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) managedInstanceAzureADOnlyAuthListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miaaoalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(miaaoalr.NextLink))) -} - -// ManagedInstanceAzureADOnlyAuthListResultPage contains a page of ManagedInstanceAzureADOnlyAuthentication -// values. -type ManagedInstanceAzureADOnlyAuthListResultPage struct { - fn func(context.Context, ManagedInstanceAzureADOnlyAuthListResult) (ManagedInstanceAzureADOnlyAuthListResult, error) - miaaoalr ManagedInstanceAzureADOnlyAuthListResult -} - -// 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 *ManagedInstanceAzureADOnlyAuthListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthListResultPage.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.miaaoalr) - if err != nil { - return err - } - page.miaaoalr = 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 *ManagedInstanceAzureADOnlyAuthListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceAzureADOnlyAuthListResultPage) NotDone() bool { - return !page.miaaoalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceAzureADOnlyAuthListResultPage) Response() ManagedInstanceAzureADOnlyAuthListResult { - return page.miaaoalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceAzureADOnlyAuthListResultPage) Values() []ManagedInstanceAzureADOnlyAuthentication { - if page.miaaoalr.IsEmpty() { - return nil - } - return *page.miaaoalr.Value -} - -// Creates a new instance of the ManagedInstanceAzureADOnlyAuthListResultPage type. -func NewManagedInstanceAzureADOnlyAuthListResultPage(cur ManagedInstanceAzureADOnlyAuthListResult, getNextPage func(context.Context, ManagedInstanceAzureADOnlyAuthListResult) (ManagedInstanceAzureADOnlyAuthListResult, error)) ManagedInstanceAzureADOnlyAuthListResultPage { - return ManagedInstanceAzureADOnlyAuthListResultPage{ - fn: getNextPage, - miaaoalr: cur, - } -} - -// ManagedInstanceAzureADOnlyAuthProperties properties of a active directory only authentication for -// Managed Instance. -type ManagedInstanceAzureADOnlyAuthProperties struct { - // AzureADOnlyAuthentication - Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` -} - -// ManagedInstanceEditionCapability the managed server capability -type ManagedInstanceEditionCapability struct { - // Name - READ-ONLY; The managed server version name. - Name *string `json:"name,omitempty"` - // SupportedFamilies - READ-ONLY; The supported families. - SupportedFamilies *[]ManagedInstanceFamilyCapability `json:"supportedFamilies,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEditionCapability. -func (miec ManagedInstanceEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miec.Reason != nil { - objectMap["reason"] = miec.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceEncryptionProtector the managed instance encryption protector. -type ManagedInstanceEncryptionProtector struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ManagedInstanceEncryptionProtectorProperties - Resource properties. - *ManagedInstanceEncryptionProtectorProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtector. -func (miep ManagedInstanceEncryptionProtector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miep.ManagedInstanceEncryptionProtectorProperties != nil { - objectMap["properties"] = miep.ManagedInstanceEncryptionProtectorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceEncryptionProtector struct. -func (miep *ManagedInstanceEncryptionProtector) 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 - } - miep.Kind = &kind - } - case "properties": - if v != nil { - var managedInstanceEncryptionProtectorProperties ManagedInstanceEncryptionProtectorProperties - err = json.Unmarshal(*v, &managedInstanceEncryptionProtectorProperties) - if err != nil { - return err - } - miep.ManagedInstanceEncryptionProtectorProperties = &managedInstanceEncryptionProtectorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - miep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - miep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - miep.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceEncryptionProtectorListResult a list of managed instance encryption protectors. -type ManagedInstanceEncryptionProtectorListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceEncryptionProtector `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtectorListResult. -func (mieplr ManagedInstanceEncryptionProtectorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceEncryptionProtectorListResultIterator provides access to a complete listing of -// ManagedInstanceEncryptionProtector values. -type ManagedInstanceEncryptionProtectorListResultIterator struct { - i int - page ManagedInstanceEncryptionProtectorListResultPage -} - -// 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 *ManagedInstanceEncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultIterator.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 *ManagedInstanceEncryptionProtectorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceEncryptionProtectorListResultIterator) 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 ManagedInstanceEncryptionProtectorListResultIterator) Response() ManagedInstanceEncryptionProtectorListResult { - 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 ManagedInstanceEncryptionProtectorListResultIterator) Value() ManagedInstanceEncryptionProtector { - if !iter.page.NotDone() { - return ManagedInstanceEncryptionProtector{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultIterator type. -func NewManagedInstanceEncryptionProtectorListResultIterator(page ManagedInstanceEncryptionProtectorListResultPage) ManagedInstanceEncryptionProtectorListResultIterator { - return ManagedInstanceEncryptionProtectorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mieplr ManagedInstanceEncryptionProtectorListResult) IsEmpty() bool { - return mieplr.Value == nil || len(*mieplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mieplr ManagedInstanceEncryptionProtectorListResult) hasNextLink() bool { - return mieplr.NextLink != nil && len(*mieplr.NextLink) != 0 -} - -// managedInstanceEncryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mieplr ManagedInstanceEncryptionProtectorListResult) managedInstanceEncryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mieplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mieplr.NextLink))) -} - -// ManagedInstanceEncryptionProtectorListResultPage contains a page of ManagedInstanceEncryptionProtector -// values. -type ManagedInstanceEncryptionProtectorListResultPage struct { - fn func(context.Context, ManagedInstanceEncryptionProtectorListResult) (ManagedInstanceEncryptionProtectorListResult, error) - mieplr ManagedInstanceEncryptionProtectorListResult -} - -// 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 *ManagedInstanceEncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultPage.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.mieplr) - if err != nil { - return err - } - page.mieplr = 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 *ManagedInstanceEncryptionProtectorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceEncryptionProtectorListResultPage) NotDone() bool { - return !page.mieplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceEncryptionProtectorListResultPage) Response() ManagedInstanceEncryptionProtectorListResult { - return page.mieplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceEncryptionProtectorListResultPage) Values() []ManagedInstanceEncryptionProtector { - if page.mieplr.IsEmpty() { - return nil - } - return *page.mieplr.Value -} - -// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultPage type. -func NewManagedInstanceEncryptionProtectorListResultPage(cur ManagedInstanceEncryptionProtectorListResult, getNextPage func(context.Context, ManagedInstanceEncryptionProtectorListResult) (ManagedInstanceEncryptionProtectorListResult, error)) ManagedInstanceEncryptionProtectorListResultPage { - return ManagedInstanceEncryptionProtectorListResultPage{ - fn: getNextPage, - mieplr: cur, - } -} - -// ManagedInstanceEncryptionProtectorProperties properties for an encryption protector execution. -type ManagedInstanceEncryptionProtectorProperties struct { - // ServerKeyName - The name of the managed instance key. - ServerKeyName *string `json:"serverKeyName,omitempty"` - // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - READ-ONLY; The URI of the server key. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtectorProperties. -func (miepp ManagedInstanceEncryptionProtectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miepp.ServerKeyName != nil { - objectMap["serverKeyName"] = miepp.ServerKeyName - } - if miepp.ServerKeyType != "" { - objectMap["serverKeyType"] = miepp.ServerKeyType - } - return json.Marshal(objectMap) -} - -// ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceEncryptionProtectorsClient) (ManagedInstanceEncryptionProtector, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) 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 ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture.Result. -func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) result(client ManagedInstanceEncryptionProtectorsClient) (miep ManagedInstanceEncryptionProtector, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - miep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if miep.Response.Response, err = future.GetResult(sender); err == nil && miep.Response.Response.StatusCode != http.StatusNoContent { - miep, err = client.CreateOrUpdateResponder(miep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture", "Result", miep.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceEncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceEncryptionProtectorsRevalidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceEncryptionProtectorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) 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 ManagedInstanceEncryptionProtectorsRevalidateFuture.Result. -func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) result(client ManagedInstanceEncryptionProtectorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsRevalidateFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstanceFamilyCapability the managed server family capability. -type ManagedInstanceFamilyCapability struct { - // Name - READ-ONLY; Family name. - Name *string `json:"name,omitempty"` - // Sku - READ-ONLY; SKU name. - Sku *string `json:"sku,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // SupportedVcoresValues - READ-ONLY; List of supported virtual cores values. - SupportedVcoresValues *[]ManagedInstanceVcoresCapability `json:"supportedVcoresValues,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceFamilyCapability. -func (mifc ManagedInstanceFamilyCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mifc.Reason != nil { - objectMap["reason"] = mifc.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceKey a managed instance key. -type ManagedInstanceKey struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ManagedInstanceKeyProperties - Resource properties. - *ManagedInstanceKeyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceKey. -func (mik ManagedInstanceKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mik.ManagedInstanceKeyProperties != nil { - objectMap["properties"] = mik.ManagedInstanceKeyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceKey struct. -func (mik *ManagedInstanceKey) 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 - } - mik.Kind = &kind - } - case "properties": - if v != nil { - var managedInstanceKeyProperties ManagedInstanceKeyProperties - err = json.Unmarshal(*v, &managedInstanceKeyProperties) - if err != nil { - return err - } - mik.ManagedInstanceKeyProperties = &managedInstanceKeyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mik.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mik.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mik.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceKeyListResult a list of managed instance keys. -type ManagedInstanceKeyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceKey `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceKeyListResult. -func (miklr ManagedInstanceKeyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceKeyListResultIterator provides access to a complete listing of ManagedInstanceKey values. -type ManagedInstanceKeyListResultIterator struct { - i int - page ManagedInstanceKeyListResultPage -} - -// 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 *ManagedInstanceKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeyListResultIterator.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 *ManagedInstanceKeyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceKeyListResultIterator) 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 ManagedInstanceKeyListResultIterator) Response() ManagedInstanceKeyListResult { - 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 ManagedInstanceKeyListResultIterator) Value() ManagedInstanceKey { - if !iter.page.NotDone() { - return ManagedInstanceKey{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceKeyListResultIterator type. -func NewManagedInstanceKeyListResultIterator(page ManagedInstanceKeyListResultPage) ManagedInstanceKeyListResultIterator { - return ManagedInstanceKeyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (miklr ManagedInstanceKeyListResult) IsEmpty() bool { - return miklr.Value == nil || len(*miklr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (miklr ManagedInstanceKeyListResult) hasNextLink() bool { - return miklr.NextLink != nil && len(*miklr.NextLink) != 0 -} - -// managedInstanceKeyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (miklr ManagedInstanceKeyListResult) managedInstanceKeyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miklr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(miklr.NextLink))) -} - -// ManagedInstanceKeyListResultPage contains a page of ManagedInstanceKey values. -type ManagedInstanceKeyListResultPage struct { - fn func(context.Context, ManagedInstanceKeyListResult) (ManagedInstanceKeyListResult, error) - miklr ManagedInstanceKeyListResult -} - -// 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 *ManagedInstanceKeyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeyListResultPage.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.miklr) - if err != nil { - return err - } - page.miklr = 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 *ManagedInstanceKeyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceKeyListResultPage) NotDone() bool { - return !page.miklr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceKeyListResultPage) Response() ManagedInstanceKeyListResult { - return page.miklr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceKeyListResultPage) Values() []ManagedInstanceKey { - if page.miklr.IsEmpty() { - return nil - } - return *page.miklr.Value -} - -// Creates a new instance of the ManagedInstanceKeyListResultPage type. -func NewManagedInstanceKeyListResultPage(cur ManagedInstanceKeyListResult, getNextPage func(context.Context, ManagedInstanceKeyListResult) (ManagedInstanceKeyListResult, error)) ManagedInstanceKeyListResultPage { - return ManagedInstanceKeyListResultPage{ - fn: getNextPage, - miklr: cur, - } -} - -// ManagedInstanceKeyProperties properties for a key execution. -type ManagedInstanceKeyProperties struct { - // ServerKeyType - The key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the key. - Thumbprint *string `json:"thumbprint,omitempty"` - // CreationDate - READ-ONLY; The key creation date. - CreationDate *date.Time `json:"creationDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceKeyProperties. -func (mikp ManagedInstanceKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mikp.ServerKeyType != "" { - objectMap["serverKeyType"] = mikp.ServerKeyType - } - if mikp.URI != nil { - objectMap["uri"] = mikp.URI - } - return json.Marshal(objectMap) -} - -// ManagedInstanceKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceKeysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceKeysClient) (ManagedInstanceKey, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceKeysCreateOrUpdateFuture) 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 ManagedInstanceKeysCreateOrUpdateFuture.Result. -func (future *ManagedInstanceKeysCreateOrUpdateFuture) result(client ManagedInstanceKeysClient) (mik ManagedInstanceKey, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mik.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceKeysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mik.Response.Response, err = future.GetResult(sender); err == nil && mik.Response.Response.StatusCode != http.StatusNoContent { - mik, err = client.CreateOrUpdateResponder(mik.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysCreateOrUpdateFuture", "Result", mik.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceKeysDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceKeysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceKeysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceKeysDeleteFuture) 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 ManagedInstanceKeysDeleteFuture.Result. -func (future *ManagedInstanceKeysDeleteFuture) result(client ManagedInstanceKeysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceKeysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstanceListResult a list of managed instances. -type ManagedInstanceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstance `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceListResult. -func (milr ManagedInstanceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceListResultIterator provides access to a complete listing of ManagedInstance values. -type ManagedInstanceListResultIterator struct { - i int - page ManagedInstanceListResultPage -} - -// 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 *ManagedInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultIterator.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 *ManagedInstanceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceListResultIterator) 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 ManagedInstanceListResultIterator) Response() ManagedInstanceListResult { - 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 ManagedInstanceListResultIterator) Value() ManagedInstance { - if !iter.page.NotDone() { - return ManagedInstance{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceListResultIterator type. -func NewManagedInstanceListResultIterator(page ManagedInstanceListResultPage) ManagedInstanceListResultIterator { - return ManagedInstanceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (milr ManagedInstanceListResult) IsEmpty() bool { - return milr.Value == nil || len(*milr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (milr ManagedInstanceListResult) hasNextLink() bool { - return milr.NextLink != nil && len(*milr.NextLink) != 0 -} - -// managedInstanceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (milr ManagedInstanceListResult) managedInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !milr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(milr.NextLink))) -} - -// ManagedInstanceListResultPage contains a page of ManagedInstance values. -type ManagedInstanceListResultPage struct { - fn func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error) - milr ManagedInstanceListResult -} - -// 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 *ManagedInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultPage.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.milr) - if err != nil { - return err - } - page.milr = 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 *ManagedInstanceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceListResultPage) NotDone() bool { - return !page.milr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceListResultPage) Response() ManagedInstanceListResult { - return page.milr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceListResultPage) Values() []ManagedInstance { - if page.milr.IsEmpty() { - return nil - } - return *page.milr.Value -} - -// Creates a new instance of the ManagedInstanceListResultPage type. -func NewManagedInstanceListResultPage(cur ManagedInstanceListResult, getNextPage func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error)) ManagedInstanceListResultPage { - return ManagedInstanceListResultPage{ - fn: getNextPage, - milr: cur, - } -} - -// ManagedInstanceLongTermRetentionBackup a long term retention backup for a managed database. -type ManagedInstanceLongTermRetentionBackup struct { - autorest.Response `json:"-"` - // ManagedInstanceLongTermRetentionBackupProperties - Resource properties. - *ManagedInstanceLongTermRetentionBackupProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackup. -func (miltrb ManagedInstanceLongTermRetentionBackup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miltrb.ManagedInstanceLongTermRetentionBackupProperties != nil { - objectMap["properties"] = miltrb.ManagedInstanceLongTermRetentionBackupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionBackup struct. -func (miltrb *ManagedInstanceLongTermRetentionBackup) 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 managedInstanceLongTermRetentionBackupProperties ManagedInstanceLongTermRetentionBackupProperties - err = json.Unmarshal(*v, &managedInstanceLongTermRetentionBackupProperties) - if err != nil { - return err - } - miltrb.ManagedInstanceLongTermRetentionBackupProperties = &managedInstanceLongTermRetentionBackupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - miltrb.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - miltrb.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - miltrb.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceLongTermRetentionBackupListResult a list of long term retention backups for managed -// database(s). -type ManagedInstanceLongTermRetentionBackupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceLongTermRetentionBackup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackupListResult. -func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceLongTermRetentionBackupListResultIterator provides access to a complete listing of -// ManagedInstanceLongTermRetentionBackup values. -type ManagedInstanceLongTermRetentionBackupListResultIterator struct { - i int - page ManagedInstanceLongTermRetentionBackupListResultPage -} - -// 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 *ManagedInstanceLongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultIterator.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 *ManagedInstanceLongTermRetentionBackupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) 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 ManagedInstanceLongTermRetentionBackupListResultIterator) Response() ManagedInstanceLongTermRetentionBackupListResult { - 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 ManagedInstanceLongTermRetentionBackupListResultIterator) Value() ManagedInstanceLongTermRetentionBackup { - if !iter.page.NotDone() { - return ManagedInstanceLongTermRetentionBackup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultIterator type. -func NewManagedInstanceLongTermRetentionBackupListResultIterator(page ManagedInstanceLongTermRetentionBackupListResultPage) ManagedInstanceLongTermRetentionBackupListResultIterator { - return ManagedInstanceLongTermRetentionBackupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) IsEmpty() bool { - return miltrblr.Value == nil || len(*miltrblr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) hasNextLink() bool { - return miltrblr.NextLink != nil && len(*miltrblr.NextLink) != 0 -} - -// managedInstanceLongTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) managedInstanceLongTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miltrblr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(miltrblr.NextLink))) -} - -// ManagedInstanceLongTermRetentionBackupListResultPage contains a page of -// ManagedInstanceLongTermRetentionBackup values. -type ManagedInstanceLongTermRetentionBackupListResultPage struct { - fn func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error) - miltrblr ManagedInstanceLongTermRetentionBackupListResult -} - -// 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 *ManagedInstanceLongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultPage.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.miltrblr) - if err != nil { - return err - } - page.miltrblr = 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 *ManagedInstanceLongTermRetentionBackupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceLongTermRetentionBackupListResultPage) NotDone() bool { - return !page.miltrblr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceLongTermRetentionBackupListResultPage) Response() ManagedInstanceLongTermRetentionBackupListResult { - return page.miltrblr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceLongTermRetentionBackupListResultPage) Values() []ManagedInstanceLongTermRetentionBackup { - if page.miltrblr.IsEmpty() { - return nil - } - return *page.miltrblr.Value -} - -// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultPage type. -func NewManagedInstanceLongTermRetentionBackupListResultPage(cur ManagedInstanceLongTermRetentionBackupListResult, getNextPage func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error)) ManagedInstanceLongTermRetentionBackupListResultPage { - return ManagedInstanceLongTermRetentionBackupListResultPage{ - fn: getNextPage, - miltrblr: cur, - } -} - -// ManagedInstanceLongTermRetentionBackupProperties properties of a long term retention backup -type ManagedInstanceLongTermRetentionBackupProperties struct { - // ManagedInstanceName - READ-ONLY; The managed instance that the backup database belongs to. - ManagedInstanceName *string `json:"managedInstanceName,omitempty"` - // ManagedInstanceCreateTime - READ-ONLY; The create time of the instance. - ManagedInstanceCreateTime *date.Time `json:"managedInstanceCreateTime,omitempty"` - // DatabaseName - READ-ONLY; The name of the database the backup belong to - DatabaseName *string `json:"databaseName,omitempty"` - // DatabaseDeletionTime - READ-ONLY; The delete time of the database - DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"` - // BackupTime - READ-ONLY; The time the backup was taken - BackupTime *date.Time `json:"backupTime,omitempty"` - // BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire. - BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackupProperties. -func (miltrbp ManagedInstanceLongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceLongTermRetentionPoliciesClient) (ManagedInstanceLongTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) 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 ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedInstanceLongTermRetentionPoliciesClient) (miltrp ManagedInstanceLongTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - miltrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if miltrp.Response.Response, err = future.GetResult(sender); err == nil && miltrp.Response.Response.StatusCode != http.StatusNoContent { - miltrp, err = client.CreateOrUpdateResponder(miltrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", miltrp.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceLongTermRetentionPolicy a long term retention policy. -type ManagedInstanceLongTermRetentionPolicy struct { - autorest.Response `json:"-"` - // BaseLongTermRetentionPolicyProperties - Resource properties. - *BaseLongTermRetentionPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionPolicy. -func (miltrp ManagedInstanceLongTermRetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miltrp.BaseLongTermRetentionPolicyProperties != nil { - objectMap["properties"] = miltrp.BaseLongTermRetentionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionPolicy struct. -func (miltrp *ManagedInstanceLongTermRetentionPolicy) 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 baseLongTermRetentionPolicyProperties BaseLongTermRetentionPolicyProperties - err = json.Unmarshal(*v, &baseLongTermRetentionPolicyProperties) - if err != nil { - return err - } - miltrp.BaseLongTermRetentionPolicyProperties = &baseLongTermRetentionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - miltrp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - miltrp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - miltrp.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceLongTermRetentionPolicyListResult a list of long term retention policies. -type ManagedInstanceLongTermRetentionPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceLongTermRetentionPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionPolicyListResult. -func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceLongTermRetentionPolicyListResultIterator provides access to a complete listing of -// ManagedInstanceLongTermRetentionPolicy values. -type ManagedInstanceLongTermRetentionPolicyListResultIterator struct { - i int - page ManagedInstanceLongTermRetentionPolicyListResultPage -} - -// 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 *ManagedInstanceLongTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultIterator.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 *ManagedInstanceLongTermRetentionPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) 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 ManagedInstanceLongTermRetentionPolicyListResultIterator) Response() ManagedInstanceLongTermRetentionPolicyListResult { - 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 ManagedInstanceLongTermRetentionPolicyListResultIterator) Value() ManagedInstanceLongTermRetentionPolicy { - if !iter.page.NotDone() { - return ManagedInstanceLongTermRetentionPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultIterator type. -func NewManagedInstanceLongTermRetentionPolicyListResultIterator(page ManagedInstanceLongTermRetentionPolicyListResultPage) ManagedInstanceLongTermRetentionPolicyListResultIterator { - return ManagedInstanceLongTermRetentionPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) IsEmpty() bool { - return miltrplr.Value == nil || len(*miltrplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) hasNextLink() bool { - return miltrplr.NextLink != nil && len(*miltrplr.NextLink) != 0 -} - -// managedInstanceLongTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) managedInstanceLongTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miltrplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(miltrplr.NextLink))) -} - -// ManagedInstanceLongTermRetentionPolicyListResultPage contains a page of -// ManagedInstanceLongTermRetentionPolicy values. -type ManagedInstanceLongTermRetentionPolicyListResultPage struct { - fn func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error) - miltrplr ManagedInstanceLongTermRetentionPolicyListResult -} - -// 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 *ManagedInstanceLongTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultPage.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.miltrplr) - if err != nil { - return err - } - page.miltrplr = 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 *ManagedInstanceLongTermRetentionPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceLongTermRetentionPolicyListResultPage) NotDone() bool { - return !page.miltrplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Response() ManagedInstanceLongTermRetentionPolicyListResult { - return page.miltrplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Values() []ManagedInstanceLongTermRetentionPolicy { - if page.miltrplr.IsEmpty() { - return nil - } - return *page.miltrplr.Value -} - -// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultPage type. -func NewManagedInstanceLongTermRetentionPolicyListResultPage(cur ManagedInstanceLongTermRetentionPolicyListResult, getNextPage func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error)) ManagedInstanceLongTermRetentionPolicyListResultPage { - return ManagedInstanceLongTermRetentionPolicyListResultPage{ - fn: getNextPage, - miltrplr: cur, - } -} - -// ManagedInstanceOperation a managed instance operation. -type ManagedInstanceOperation struct { - autorest.Response `json:"-"` - // ManagedInstanceOperationProperties - Resource properties. - *ManagedInstanceOperationProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceOperation. -func (mio ManagedInstanceOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mio.ManagedInstanceOperationProperties != nil { - objectMap["properties"] = mio.ManagedInstanceOperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceOperation struct. -func (mio *ManagedInstanceOperation) 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 managedInstanceOperationProperties ManagedInstanceOperationProperties - err = json.Unmarshal(*v, &managedInstanceOperationProperties) - if err != nil { - return err - } - mio.ManagedInstanceOperationProperties = &managedInstanceOperationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mio.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mio.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mio.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceOperationListResult the response to a list managed instance operations request -type ManagedInstanceOperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceOperationListResult. -func (miolr ManagedInstanceOperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceOperationListResultIterator provides access to a complete listing of -// ManagedInstanceOperation values. -type ManagedInstanceOperationListResultIterator struct { - i int - page ManagedInstanceOperationListResultPage -} - -// 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 *ManagedInstanceOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultIterator.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 *ManagedInstanceOperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceOperationListResultIterator) 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 ManagedInstanceOperationListResultIterator) Response() ManagedInstanceOperationListResult { - 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 ManagedInstanceOperationListResultIterator) Value() ManagedInstanceOperation { - if !iter.page.NotDone() { - return ManagedInstanceOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceOperationListResultIterator type. -func NewManagedInstanceOperationListResultIterator(page ManagedInstanceOperationListResultPage) ManagedInstanceOperationListResultIterator { - return ManagedInstanceOperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (miolr ManagedInstanceOperationListResult) IsEmpty() bool { - return miolr.Value == nil || len(*miolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (miolr ManagedInstanceOperationListResult) hasNextLink() bool { - return miolr.NextLink != nil && len(*miolr.NextLink) != 0 -} - -// managedInstanceOperationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (miolr ManagedInstanceOperationListResult) managedInstanceOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(miolr.NextLink))) -} - -// ManagedInstanceOperationListResultPage contains a page of ManagedInstanceOperation values. -type ManagedInstanceOperationListResultPage struct { - fn func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error) - miolr ManagedInstanceOperationListResult -} - -// 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 *ManagedInstanceOperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultPage.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.miolr) - if err != nil { - return err - } - page.miolr = 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 *ManagedInstanceOperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceOperationListResultPage) NotDone() bool { - return !page.miolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceOperationListResultPage) Response() ManagedInstanceOperationListResult { - return page.miolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceOperationListResultPage) Values() []ManagedInstanceOperation { - if page.miolr.IsEmpty() { - return nil - } - return *page.miolr.Value -} - -// Creates a new instance of the ManagedInstanceOperationListResultPage type. -func NewManagedInstanceOperationListResultPage(cur ManagedInstanceOperationListResult, getNextPage func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error)) ManagedInstanceOperationListResultPage { - return ManagedInstanceOperationListResultPage{ - fn: getNextPage, - miolr: cur, - } -} - -// ManagedInstanceOperationParametersPair the parameters of a managed instance operation. -type ManagedInstanceOperationParametersPair struct { - // CurrentParameters - READ-ONLY; The current parameters. - CurrentParameters *UpsertManagedServerOperationParameters `json:"currentParameters,omitempty"` - // RequestedParameters - READ-ONLY; The requested parameters. - RequestedParameters *UpsertManagedServerOperationParameters `json:"requestedParameters,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceOperationParametersPair. -func (miopp ManagedInstanceOperationParametersPair) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceOperationProperties the properties of a managed instance operation. -type ManagedInstanceOperationProperties struct { - // ManagedInstanceName - READ-ONLY; The name of the managed instance the operation is being performed on. - ManagedInstanceName *string `json:"managedInstanceName,omitempty"` - // Operation - READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty"` - // OperationFriendlyName - READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` - // PercentComplete - READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // StartTime - READ-ONLY; The operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The operation state. Possible values include: 'ManagementOperationStatePending', 'ManagementOperationStateInProgress', 'ManagementOperationStateSucceeded', 'ManagementOperationStateFailed', 'ManagementOperationStateCancelInProgress', 'ManagementOperationStateCancelled' - State ManagementOperationState `json:"state,omitempty"` - // ErrorCode - READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorDescription - READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty"` - // ErrorSeverity - READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // IsUserError - READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty"` - // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` - // Description - READ-ONLY; The operation description. - Description *string `json:"description,omitempty"` - // IsCancellable - READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty"` - // OperationParameters - READ-ONLY; The operation parameters. - OperationParameters *ManagedInstanceOperationParametersPair `json:"operationParameters,omitempty"` - // OperationSteps - READ-ONLY; The operation steps. - OperationSteps *ManagedInstanceOperationSteps `json:"operationSteps,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceOperationProperties. -func (miop ManagedInstanceOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceOperationSteps the steps of a managed instance operation. -type ManagedInstanceOperationSteps struct { - // TotalSteps - READ-ONLY; The total number of operation steps. - TotalSteps *string `json:"totalSteps,omitempty"` - // CurrentStep - READ-ONLY; The number of current operation steps. - CurrentStep *int32 `json:"currentStep,omitempty"` - // StepsList - READ-ONLY; The operation steps list. - StepsList *[]UpsertManagedServerOperationStep `json:"stepsList,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceOperationSteps. -func (mios ManagedInstanceOperationSteps) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstancePairInfo pairs of Managed Instances in the failover group. -type ManagedInstancePairInfo struct { - // PrimaryManagedInstanceID - Id of Primary Managed Instance in pair. - PrimaryManagedInstanceID *string `json:"primaryManagedInstanceId,omitempty"` - // PartnerManagedInstanceID - Id of Partner Managed Instance in pair. - PartnerManagedInstanceID *string `json:"partnerManagedInstanceId,omitempty"` -} - -// ManagedInstancePrivateLinkServiceConnectionStateProperty ... -type ManagedInstancePrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The private link service connection description. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstancePrivateLinkServiceConnectionStateProperty. -func (miplscsp ManagedInstancePrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miplscsp.Status != nil { - objectMap["status"] = miplscsp.Status - } - if miplscsp.Description != nil { - objectMap["description"] = miplscsp.Description - } - return json.Marshal(objectMap) -} - -// ManagedInstanceProperties the properties of a managed instance. -type ManagedInstanceProperties struct { - // ProvisioningState - READ-ONLY; Possible values include: 'ProvisioningState1Creating', 'ProvisioningState1Deleting', 'ProvisioningState1Updating', 'ProvisioningState1Unknown', 'ProvisioningState1Succeeded', 'ProvisioningState1Failed' - ProvisioningState ProvisioningState1 `json:"provisioningState,omitempty"` - // ManagedInstanceCreateMode - Specifies the mode of database creation. - // - // Default: Regular instance creation. - // - // Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'ManagedServerCreateModeDefault', 'ManagedServerCreateModePointInTimeRestore' - ManagedInstanceCreateMode ManagedServerCreateMode `json:"managedInstanceCreateMode,omitempty"` - // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the managed instance. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - // AdministratorLogin - Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The administrator login password (required for managed instance creation). - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // SubnetID - Subnet resource ID for the managed instance. - SubnetID *string `json:"subnetId,omitempty"` - // State - READ-ONLY; The state of the managed instance. - State *string `json:"state,omitempty"` - // LicenseType - The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'ManagedInstanceLicenseTypeLicenseIncluded', 'ManagedInstanceLicenseTypeBasePrice' - LicenseType ManagedInstanceLicenseType `json:"licenseType,omitempty"` - // VCores - The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. - VCores *int32 `json:"vCores,omitempty"` - // StorageSizeInGB - Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. - StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"` - // Collation - Collation of the managed instance. - Collation *string `json:"collation,omitempty"` - // DNSZone - READ-ONLY; The Dns Zone that the managed instance is in. - DNSZone *string `json:"dnsZone,omitempty"` - // DNSZonePartner - The resource id of another managed instance whose DNS zone this managed instance will share after creation. - DNSZonePartner *string `json:"dnsZonePartner,omitempty"` - // PublicDataEndpointEnabled - Whether or not the public data endpoint is enabled. - PublicDataEndpointEnabled *bool `json:"publicDataEndpointEnabled,omitempty"` - // SourceManagedInstanceID - The resource identifier of the source managed instance associated with create operation of this instance. - SourceManagedInstanceID *string `json:"sourceManagedInstanceId,omitempty"` - // RestorePointInTime - Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // ProxyOverride - Connection type used for connecting to the instance. Possible values include: 'ManagedInstanceProxyOverrideProxy', 'ManagedInstanceProxyOverrideRedirect', 'ManagedInstanceProxyOverrideDefault' - ProxyOverride ManagedInstanceProxyOverride `json:"proxyOverride,omitempty"` - // TimezoneID - Id of the timezone. Allowed values are timezones supported by Windows. - // Windows keeps details on supported timezones, including the id, in registry under - // KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. - // You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. - // List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. - // An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". - TimezoneID *string `json:"timezoneId,omitempty"` - // InstancePoolID - The Id of the instance pool this managed server belongs to. - InstancePoolID *string `json:"instancePoolId,omitempty"` - // MaintenanceConfigurationID - Specifies maintenance configuration id to apply to this managed instance. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` - // MinimalTLSVersion - Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' - MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` - // StorageAccountType - The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). Possible values include: 'GRS', 'LRS', 'ZRS' - StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceProperties. -func (mip ManagedInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mip.ManagedInstanceCreateMode != "" { - objectMap["managedInstanceCreateMode"] = mip.ManagedInstanceCreateMode - } - if mip.AdministratorLogin != nil { - objectMap["administratorLogin"] = mip.AdministratorLogin - } - if mip.AdministratorLoginPassword != nil { - objectMap["administratorLoginPassword"] = mip.AdministratorLoginPassword - } - if mip.SubnetID != nil { - objectMap["subnetId"] = mip.SubnetID - } - if mip.LicenseType != "" { - objectMap["licenseType"] = mip.LicenseType - } - if mip.VCores != nil { - objectMap["vCores"] = mip.VCores - } - if mip.StorageSizeInGB != nil { - objectMap["storageSizeInGB"] = mip.StorageSizeInGB - } - if mip.Collation != nil { - objectMap["collation"] = mip.Collation - } - if mip.DNSZonePartner != nil { - objectMap["dnsZonePartner"] = mip.DNSZonePartner - } - if mip.PublicDataEndpointEnabled != nil { - objectMap["publicDataEndpointEnabled"] = mip.PublicDataEndpointEnabled - } - if mip.SourceManagedInstanceID != nil { - objectMap["sourceManagedInstanceId"] = mip.SourceManagedInstanceID - } - if mip.RestorePointInTime != nil { - objectMap["restorePointInTime"] = mip.RestorePointInTime - } - if mip.ProxyOverride != "" { - objectMap["proxyOverride"] = mip.ProxyOverride - } - if mip.TimezoneID != nil { - objectMap["timezoneId"] = mip.TimezoneID - } - if mip.InstancePoolID != nil { - objectMap["instancePoolId"] = mip.InstancePoolID - } - if mip.MaintenanceConfigurationID != nil { - objectMap["maintenanceConfigurationId"] = mip.MaintenanceConfigurationID - } - if mip.MinimalTLSVersion != nil { - objectMap["minimalTlsVersion"] = mip.MinimalTLSVersion - } - if mip.StorageAccountType != "" { - objectMap["storageAccountType"] = mip.StorageAccountType - } - return json.Marshal(objectMap) -} - -// ManagedInstancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstancesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (ManagedInstance, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesCreateOrUpdateFuture) 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 ManagedInstancesCreateOrUpdateFuture.Result. -func (future *ManagedInstancesCreateOrUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mi.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { - mi, err = client.CreateOrUpdateResponder(mi.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedInstancesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesDeleteFuture) 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 ManagedInstancesDeleteFuture.Result. -func (future *ManagedInstancesDeleteFuture) result(client ManagedInstancesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstancesFailoverFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstancesFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesFailoverFuture) 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 ManagedInstancesFailoverFuture.Result. -func (future *ManagedInstancesFailoverFuture) result(client ManagedInstancesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesFailoverFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstancesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedInstancesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (ManagedInstance, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesUpdateFuture) 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 ManagedInstancesUpdateFuture.Result. -func (future *ManagedInstancesUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mi.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { - mi, err = client.UpdateResponder(mi.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstanceTdeCertificatesCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceTdeCertificatesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceTdeCertificatesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceTdeCertificatesCreateFuture) 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 ManagedInstanceTdeCertificatesCreateFuture.Result. -func (future *ManagedInstanceTdeCertificatesCreateFuture) result(client ManagedInstanceTdeCertificatesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceTdeCertificatesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceTdeCertificatesCreateFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstanceUpdate an update request for an Azure SQL Database managed instance. -type ManagedInstanceUpdate struct { - // Sku - Managed instance sku - Sku *Sku `json:"sku,omitempty"` - // ManagedInstanceProperties - Resource properties. - *ManagedInstanceProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceUpdate. -func (miu ManagedInstanceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miu.Sku != nil { - objectMap["sku"] = miu.Sku - } - if miu.ManagedInstanceProperties != nil { - objectMap["properties"] = miu.ManagedInstanceProperties - } - if miu.Tags != nil { - objectMap["tags"] = miu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceUpdate struct. -func (miu *ManagedInstanceUpdate) 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 - } - miu.Sku = &sku - } - case "properties": - if v != nil { - var managedInstanceProperties ManagedInstanceProperties - err = json.Unmarshal(*v, &managedInstanceProperties) - if err != nil { - return err - } - miu.ManagedInstanceProperties = &managedInstanceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - miu.Tags = tags - } - } - } - - return nil -} - -// ManagedInstanceVcoresCapability the managed instance virtual cores capability. -type ManagedInstanceVcoresCapability struct { - // Name - READ-ONLY; The virtual cores identifier. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; The virtual cores value. - Value *int32 `json:"value,omitempty"` - // IncludedMaxSize - READ-ONLY; Included size. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // SupportedStorageSizes - READ-ONLY; Storage size ranges. - SupportedStorageSizes *[]MaxSizeRangeCapability `json:"supportedStorageSizes,omitempty"` - // InstancePoolSupported - READ-ONLY; True if this service objective is supported for managed instances in an instance pool. - InstancePoolSupported *bool `json:"instancePoolSupported,omitempty"` - // StandaloneSupported - READ-ONLY; True if this service objective is supported for standalone managed instances. - StandaloneSupported *bool `json:"standaloneSupported,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceVcoresCapability. -func (mivc ManagedInstanceVcoresCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mivc.Reason != nil { - objectMap["reason"] = mivc.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceVersionCapability the managed instance capability -type ManagedInstanceVersionCapability struct { - // Name - READ-ONLY; The server version name. - Name *string `json:"name,omitempty"` - // SupportedEditions - READ-ONLY; The list of supported managed instance editions. - SupportedEditions *[]ManagedInstanceEditionCapability `json:"supportedEditions,omitempty"` - // SupportedInstancePoolEditions - READ-ONLY; The list of supported instance pool editions. - SupportedInstancePoolEditions *[]InstancePoolEditionCapability `json:"supportedInstancePoolEditions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceVersionCapability. -func (mivc ManagedInstanceVersionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mivc.Reason != nil { - objectMap["reason"] = mivc.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceVulnerabilityAssessment a managed instance vulnerability assessment. -type ManagedInstanceVulnerabilityAssessment struct { - autorest.Response `json:"-"` - // ManagedInstanceVulnerabilityAssessmentProperties - Resource properties. - *ManagedInstanceVulnerabilityAssessmentProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceVulnerabilityAssessment. -func (miva ManagedInstanceVulnerabilityAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miva.ManagedInstanceVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = miva.ManagedInstanceVulnerabilityAssessmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceVulnerabilityAssessment struct. -func (miva *ManagedInstanceVulnerabilityAssessment) 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 managedInstanceVulnerabilityAssessmentProperties ManagedInstanceVulnerabilityAssessmentProperties - err = json.Unmarshal(*v, &managedInstanceVulnerabilityAssessmentProperties) - if err != nil { - return err - } - miva.ManagedInstanceVulnerabilityAssessmentProperties = &managedInstanceVulnerabilityAssessmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - miva.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - miva.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - miva.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceVulnerabilityAssessmentListResult a list of the ManagedInstance's vulnerability -// assessments. -type ManagedInstanceVulnerabilityAssessmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceVulnerabilityAssessment `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceVulnerabilityAssessmentListResult. -func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceVulnerabilityAssessmentListResultIterator provides access to a complete listing of -// ManagedInstanceVulnerabilityAssessment values. -type ManagedInstanceVulnerabilityAssessmentListResultIterator struct { - i int - page ManagedInstanceVulnerabilityAssessmentListResultPage -} - -// 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 *ManagedInstanceVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultIterator.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 *ManagedInstanceVulnerabilityAssessmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) 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 ManagedInstanceVulnerabilityAssessmentListResultIterator) Response() ManagedInstanceVulnerabilityAssessmentListResult { - 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 ManagedInstanceVulnerabilityAssessmentListResultIterator) Value() ManagedInstanceVulnerabilityAssessment { - if !iter.page.NotDone() { - return ManagedInstanceVulnerabilityAssessment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultIterator type. -func NewManagedInstanceVulnerabilityAssessmentListResultIterator(page ManagedInstanceVulnerabilityAssessmentListResultPage) ManagedInstanceVulnerabilityAssessmentListResultIterator { - return ManagedInstanceVulnerabilityAssessmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) IsEmpty() bool { - return mivalr.Value == nil || len(*mivalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) hasNextLink() bool { - return mivalr.NextLink != nil && len(*mivalr.NextLink) != 0 -} - -// managedInstanceVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) managedInstanceVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mivalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mivalr.NextLink))) -} - -// ManagedInstanceVulnerabilityAssessmentListResultPage contains a page of -// ManagedInstanceVulnerabilityAssessment values. -type ManagedInstanceVulnerabilityAssessmentListResultPage struct { - fn func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error) - mivalr ManagedInstanceVulnerabilityAssessmentListResult -} - -// 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 *ManagedInstanceVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultPage.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.mivalr) - if err != nil { - return err - } - page.mivalr = 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 *ManagedInstanceVulnerabilityAssessmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceVulnerabilityAssessmentListResultPage) NotDone() bool { - return !page.mivalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Response() ManagedInstanceVulnerabilityAssessmentListResult { - return page.mivalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Values() []ManagedInstanceVulnerabilityAssessment { - if page.mivalr.IsEmpty() { - return nil - } - return *page.mivalr.Value -} - -// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultPage type. -func NewManagedInstanceVulnerabilityAssessmentListResultPage(cur ManagedInstanceVulnerabilityAssessmentListResult, getNextPage func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error)) ManagedInstanceVulnerabilityAssessmentListResultPage { - return ManagedInstanceVulnerabilityAssessmentListResultPage{ - fn: getNextPage, - mivalr: cur, - } -} - -// ManagedInstanceVulnerabilityAssessmentProperties properties of a managed instance vulnerability -// assessment. -type ManagedInstanceVulnerabilityAssessmentProperties struct { - // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RecurringScans - The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` -} - -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for -// monitoring and retrieving the results of a long-running operation. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture) 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 ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mbstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { - mbstrp, err = client.CreateOrUpdateResponder(mbstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture an abstraction for -// monitoring and retrieving the results of a long-running operation. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture) 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 ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture.Result. -func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture) result(client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mbstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { - mbstrp, err = client.UpdateResponder(mbstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedServerSecurityAlertPoliciesClient) (ManagedServerSecurityAlertPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture) 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 ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture.Result. -func (future *ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ManagedServerSecurityAlertPoliciesClient) (mssap ManagedServerSecurityAlertPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mssap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mssap.Response.Response, err = future.GetResult(sender); err == nil && mssap.Response.Response.StatusCode != http.StatusNoContent { - mssap, err = client.CreateOrUpdateResponder(mssap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", mssap.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedServerSecurityAlertPolicy a managed server security alert policy. -type ManagedServerSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // SecurityAlertPolicyProperties - Resource properties. - *SecurityAlertPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ManagedServerSecurityAlertPolicy. -func (mssap ManagedServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mssap.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = mssap.SecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedServerSecurityAlertPolicy struct. -func (mssap *ManagedServerSecurityAlertPolicy) 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 securityAlertPolicyProperties SecurityAlertPolicyProperties - err = json.Unmarshal(*v, &securityAlertPolicyProperties) - if err != nil { - return err - } - mssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mssap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mssap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mssap.Type = &typeVar - } - } - } - - return nil -} - -// ManagedServerSecurityAlertPolicyListResult a list of the managed Server's security alert policies. -type ManagedServerSecurityAlertPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedServerSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedServerSecurityAlertPolicyListResult. -func (mssaplr ManagedServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedServerSecurityAlertPolicyListResultIterator provides access to a complete listing of -// ManagedServerSecurityAlertPolicy values. -type ManagedServerSecurityAlertPolicyListResultIterator struct { - i int - page ManagedServerSecurityAlertPolicyListResultPage -} - -// 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 *ManagedServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerSecurityAlertPolicyListResultIterator.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 *ManagedServerSecurityAlertPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedServerSecurityAlertPolicyListResultIterator) 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 ManagedServerSecurityAlertPolicyListResultIterator) Response() ManagedServerSecurityAlertPolicyListResult { - 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 ManagedServerSecurityAlertPolicyListResultIterator) Value() ManagedServerSecurityAlertPolicy { - if !iter.page.NotDone() { - return ManagedServerSecurityAlertPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedServerSecurityAlertPolicyListResultIterator type. -func NewManagedServerSecurityAlertPolicyListResultIterator(page ManagedServerSecurityAlertPolicyListResultPage) ManagedServerSecurityAlertPolicyListResultIterator { - return ManagedServerSecurityAlertPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mssaplr ManagedServerSecurityAlertPolicyListResult) IsEmpty() bool { - return mssaplr.Value == nil || len(*mssaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mssaplr ManagedServerSecurityAlertPolicyListResult) hasNextLink() bool { - return mssaplr.NextLink != nil && len(*mssaplr.NextLink) != 0 -} - -// managedServerSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mssaplr ManagedServerSecurityAlertPolicyListResult) managedServerSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mssaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mssaplr.NextLink))) -} - -// ManagedServerSecurityAlertPolicyListResultPage contains a page of ManagedServerSecurityAlertPolicy -// values. -type ManagedServerSecurityAlertPolicyListResultPage struct { - fn func(context.Context, ManagedServerSecurityAlertPolicyListResult) (ManagedServerSecurityAlertPolicyListResult, error) - mssaplr ManagedServerSecurityAlertPolicyListResult -} - -// 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 *ManagedServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerSecurityAlertPolicyListResultPage.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.mssaplr) - if err != nil { - return err - } - page.mssaplr = 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 *ManagedServerSecurityAlertPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedServerSecurityAlertPolicyListResultPage) NotDone() bool { - return !page.mssaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedServerSecurityAlertPolicyListResultPage) Response() ManagedServerSecurityAlertPolicyListResult { - return page.mssaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedServerSecurityAlertPolicyListResultPage) Values() []ManagedServerSecurityAlertPolicy { - if page.mssaplr.IsEmpty() { - return nil - } - return *page.mssaplr.Value -} - -// Creates a new instance of the ManagedServerSecurityAlertPolicyListResultPage type. -func NewManagedServerSecurityAlertPolicyListResultPage(cur ManagedServerSecurityAlertPolicyListResult, getNextPage func(context.Context, ManagedServerSecurityAlertPolicyListResult) (ManagedServerSecurityAlertPolicyListResult, error)) ManagedServerSecurityAlertPolicyListResultPage { - return ManagedServerSecurityAlertPolicyListResultPage{ - fn: getNextPage, - mssaplr: cur, - } -} - -// MaxSizeCapability the maximum size capability. -type MaxSizeCapability struct { - // Limit - READ-ONLY; The maximum size limit (see 'unit' for the units). - Limit *int32 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units that the limit is expressed in. Possible values include: 'MaxSizeUnitMegabytes', 'MaxSizeUnitGigabytes', 'MaxSizeUnitTerabytes', 'MaxSizeUnitPetabytes' - Unit MaxSizeUnit `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for MaxSizeCapability. -func (msc MaxSizeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MaxSizeRangeCapability the maximum size range capability. -type MaxSizeRangeCapability struct { - // MinValue - READ-ONLY; Minimum value. - MinValue *MaxSizeCapability `json:"minValue,omitempty"` - // MaxValue - READ-ONLY; Maximum value. - MaxValue *MaxSizeCapability `json:"maxValue,omitempty"` - // ScaleSize - READ-ONLY; Scale/step size for discrete values between the minimum value and the maximum value. - ScaleSize *MaxSizeCapability `json:"scaleSize,omitempty"` - // LogSize - READ-ONLY; Size of transaction log. - LogSize *LogSizeCapability `json:"logSize,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for MaxSizeRangeCapability. -func (msrc MaxSizeRangeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msrc.Reason != nil { - objectMap["reason"] = msrc.Reason - } - return json.Marshal(objectMap) -} - -// Metric database metrics. -type Metric struct { - // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // TimeGrain - READ-ONLY; The time step to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty"` - // Unit - READ-ONLY; The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond' - Unit UnitType `json:"unit,omitempty"` - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. - MetricValues *[]MetricValue `json:"metricValues,omitempty"` -} - -// MarshalJSON is the custom marshaler for Metric. -func (mVar Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricAvailability a metric availability value. -type MetricAvailability struct { - // Retention - READ-ONLY; The length of retention for the database metric. - Retention *string `json:"retention,omitempty"` - // TimeGrain - READ-ONLY; The granularity of the database metric. - TimeGrain *string `json:"timeGrain,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricAvailability. -func (ma MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinition a database metric definition. -type MetricDefinition struct { - // Name - READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` - // ResourceURI - READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty"` - // Unit - READ-ONLY; The unit of the metric. Possible values include: 'UnitDefinitionTypeCount', 'UnitDefinitionTypeBytes', 'UnitDefinitionTypeSeconds', 'UnitDefinitionTypePercent', 'UnitDefinitionTypeCountPerSecond', 'UnitDefinitionTypeBytesPerSecond' - Unit UnitDefinitionType `json:"unit,omitempty"` - // MetricAvailabilities - READ-ONLY; The list of database metric availabilities for the metric. - MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricDefinition. -func (md MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricDefinitionListResult the response to a list database metric definitions request. -type MetricDefinitionListResult struct { - autorest.Response `json:"-"` - // Value - The list of metric definitions for the database. - Value *[]MetricDefinition `json:"value,omitempty"` -} - -// MetricListResult the response to a list database metrics request. -type MetricListResult struct { - autorest.Response `json:"-"` - // Value - The list of metrics for the database. - Value *[]Metric `json:"value,omitempty"` -} - -// MetricName a database metric name. -type MetricName struct { - // Value - READ-ONLY; The name of the database metric. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The friendly name of the database metric. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricName. -func (mn MetricName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetricValue represents database metrics. -type MetricValue struct { - // Count - READ-ONLY; The number of values for the metric. - Count *float64 `json:"count,omitempty"` - // Average - READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty"` - // Maximum - READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty"` - // Minimum - READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty"` - // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *date.Time `json:"timestamp,omitempty"` - // Total - READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty"` -} - -// MarshalJSON is the custom marshaler for MetricValue. -func (mv MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MinCapacityCapability the min capacity capability -type MinCapacityCapability struct { - // Value - READ-ONLY; Min capacity value - Value *float64 `json:"value,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for MinCapacityCapability. -func (mcc MinCapacityCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcc.Reason != nil { - objectMap["reason"] = mcc.Reason - } - return json.Marshal(objectMap) -} - -// Name ARM Usage Name -type Name struct { - // Value - Usage name value - Value *string `json:"value,omitempty"` - // LocalizedValue - Usage name localized value. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// NetworkIsolationSettings contains the ARM resources for which to create private endpoint connection. -type NetworkIsolationSettings struct { - // StorageAccountResourceID - The resource id for the storage account used to store BACPAC file. If set, private endpoint connection will be created for the storage account. Must match storage account used for StorageUri parameter. - StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` - // SQLServerResourceID - The resource id for the SQL server which is the target of this request. If set, private endpoint connection will be created for the SQL server. Must match server which is target of the operation. - SQLServerResourceID *string `json:"sqlServerResourceId,omitempty"` -} - -// Operation SQL REST API operation definition. -type Operation struct { - // Name - READ-ONLY; The name of the operation being performed on this particular object. - Name *string `json:"name,omitempty"` - // Display - READ-ONLY; The localized display information for this particular operation / action. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'User', 'System' - Origin OperationOrigin `json:"origin,omitempty"` - // Properties - READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; The localized friendly form of the resource provider name. - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; The localized friendly form of the resource type related to this action/operation. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; The localized friendly name for the operation. - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; The localized friendly description for the operation. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationImpact the impact of an operation, both in absolute and relative terms. -type OperationImpact struct { - // Name - READ-ONLY; The name of the impact dimension. - Name *string `json:"name,omitempty"` - // Unit - READ-ONLY; The unit in which estimated impact to dimension is measured. - Unit *string `json:"unit,omitempty"` - // ChangeValueAbsolute - READ-ONLY; The absolute impact to dimension. - ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"` - // ChangeValueRelative - READ-ONLY; The relative impact to dimension (null if not applicable) - ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationImpact. -func (oi OperationImpact) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult result of the request to list SQL operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// 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, - } -} - -// PartnerInfo partner server information for the failover group. -type PartnerInfo struct { - // ID - Resource identifier of the partner server. - ID *string `json:"id,omitempty"` - // Location - READ-ONLY; Geo location of the partner server. - Location *string `json:"location,omitempty"` - // ReplicationRole - READ-ONLY; Replication role of the partner server. Possible values include: 'Primary', 'Secondary' - ReplicationRole FailoverGroupReplicationRole `json:"replicationRole,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerInfo. -func (pi PartnerInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pi.ID != nil { - objectMap["id"] = pi.ID - } - return json.Marshal(objectMap) -} - -// PartnerRegionInfo partner region information for the failover group. -type PartnerRegionInfo struct { - // Location - Geo location of the partner managed instances. - Location *string `json:"location,omitempty"` - // ReplicationRole - READ-ONLY; Replication role of the partner managed instances. Possible values include: 'InstanceFailoverGroupReplicationRolePrimary', 'InstanceFailoverGroupReplicationRoleSecondary' - ReplicationRole InstanceFailoverGroupReplicationRole `json:"replicationRole,omitempty"` -} - -// MarshalJSON is the custom marshaler for PartnerRegionInfo. -func (pri PartnerRegionInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pri.Location != nil { - objectMap["location"] = pri.Location - } - return json.Marshal(objectMap) -} - -// PerformanceLevelCapability the performance level capability. -type PerformanceLevelCapability struct { - // Value - READ-ONLY; Performance level value. - Value *float64 `json:"value,omitempty"` - // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'DTU', 'VCores' - Unit PerformanceLevelUnit `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for PerformanceLevelCapability. -func (plc PerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `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"` -} - -// 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. -func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) - if err != nil { - return err - } - page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. Possible values include: 'PrivateEndpointProvisioningStateApproving', 'PrivateEndpointProvisioningStateReady', 'PrivateEndpointProvisioningStateDropping', 'PrivateEndpointProvisioningStateFailed', 'PrivateEndpointProvisioningStateRejecting' - ProvisioningState PrivateEndpointProvisioningState `json:"provisioningState,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) -} - -// PrivateEndpointConnectionRequestStatus contains the private endpoint connection requests status. -type PrivateEndpointConnectionRequestStatus struct { - // PrivateLinkServiceID - READ-ONLY; Resource id for which the private endpoint is created. - PrivateLinkServiceID *string `json:"privateLinkServiceId,omitempty"` - // PrivateEndpointConnectionName - READ-ONLY; The connection name for the private endpoint. - PrivateEndpointConnectionName *string `json:"privateEndpointConnectionName,omitempty"` - // Status - READ-ONLY; Status of this private endpoint connection. - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionRequestStatus. -func (pecrs PrivateEndpointConnectionRequestStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.PrivateEndpointConnectionsCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty ... -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // Properties - READ-ONLY; The private link resource group id. - Properties *PrivateLinkResourceProperties `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"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionStateProperty ... -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' - Status PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. Possible values include: 'PrivateLinkServiceConnectionStateActionsRequireNone' - ActionsRequired PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != "" { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProxyResource ARM proxy resource. -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"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReadScaleCapability the read scale capability. -type ReadScaleCapability struct { - // MaxNumberOfReplicas - READ-ONLY; The maximum number of read scale replicas. - MaxNumberOfReplicas *int32 `json:"maxNumberOfReplicas,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReadScaleCapability. -func (rsc ReadScaleCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsc.Reason != nil { - objectMap["reason"] = rsc.Reason - } - return json.Marshal(objectMap) -} - -// RecommendedElasticPool represents a recommended elastic pool. -type RecommendedElasticPool struct { - autorest.Response `json:"-"` - // RecommendedElasticPoolProperties - The properties representing the resource. - *RecommendedElasticPoolProperties `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"` -} - -// MarshalJSON is the custom marshaler for RecommendedElasticPool. -func (rep RecommendedElasticPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rep.RecommendedElasticPoolProperties != nil { - objectMap["properties"] = rep.RecommendedElasticPoolProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecommendedElasticPool struct. -func (rep *RecommendedElasticPool) 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 recommendedElasticPoolProperties RecommendedElasticPoolProperties - err = json.Unmarshal(*v, &recommendedElasticPoolProperties) - if err != nil { - return err - } - rep.RecommendedElasticPoolProperties = &recommendedElasticPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rep.Type = &typeVar - } - } - } - - return nil -} - -// RecommendedElasticPoolListMetricsResult represents the response to a list recommended elastic pool -// metrics request. -type RecommendedElasticPoolListMetricsResult struct { - autorest.Response `json:"-"` - // Value - The list of recommended elastic pools metrics. - Value *[]RecommendedElasticPoolMetric `json:"value,omitempty"` -} - -// RecommendedElasticPoolListResult represents the response to a list recommended elastic pool request. -type RecommendedElasticPoolListResult struct { - autorest.Response `json:"-"` - // Value - The list of recommended elastic pools hosted in the server. - Value *[]RecommendedElasticPool `json:"value,omitempty"` -} - -// RecommendedElasticPoolMetric represents recommended elastic pool metric. -type RecommendedElasticPoolMetric struct { - // DateTime - The time of metric (ISO8601 format). - DateTime *date.Time `json:"dateTime,omitempty"` - // Dtu - Gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ - Dtu *float64 `json:"dtu,omitempty"` - // SizeGB - Gets or sets size in gigabytes. - SizeGB *float64 `json:"sizeGB,omitempty"` -} - -// RecommendedElasticPoolProperties represents the properties of a recommended elastic pool. -type RecommendedElasticPoolProperties struct { - // DatabaseEdition - READ-ONLY; The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'Basic', 'Standard', 'Premium', 'GeneralPurpose', 'BusinessCritical' - DatabaseEdition ElasticPoolEdition `json:"databaseEdition,omitempty"` - // Dtu - The DTU for the recommended elastic pool. - Dtu *float64 `json:"dtu,omitempty"` - // DatabaseDtuMin - The minimum DTU for the database. - DatabaseDtuMin *float64 `json:"databaseDtuMin,omitempty"` - // DatabaseDtuMax - The maximum DTU for the database. - DatabaseDtuMax *float64 `json:"databaseDtuMax,omitempty"` - // StorageMB - Gets storage size in megabytes. - StorageMB *float64 `json:"storageMB,omitempty"` - // ObservationPeriodStart - READ-ONLY; The observation period start (ISO8601 format). - ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` - // ObservationPeriodEnd - READ-ONLY; The observation period start (ISO8601 format). - ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` - // MaxObservedDtu - READ-ONLY; Gets maximum observed DTU. - MaxObservedDtu *float64 `json:"maxObservedDtu,omitempty"` - // MaxObservedStorageMB - READ-ONLY; Gets maximum observed storage in megabytes. - MaxObservedStorageMB *float64 `json:"maxObservedStorageMB,omitempty"` - // Databases - READ-ONLY; The list of databases in this pool. Expanded property - Databases *[]TrackedResource `json:"databases,omitempty"` - // Metrics - READ-ONLY; The list of databases housed in the server. Expanded property - Metrics *[]RecommendedElasticPoolMetric `json:"metrics,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecommendedElasticPoolProperties. -func (repp RecommendedElasticPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if repp.Dtu != nil { - objectMap["dtu"] = repp.Dtu - } - if repp.DatabaseDtuMin != nil { - objectMap["databaseDtuMin"] = repp.DatabaseDtuMin - } - if repp.DatabaseDtuMax != nil { - objectMap["databaseDtuMax"] = repp.DatabaseDtuMax - } - if repp.StorageMB != nil { - objectMap["storageMB"] = repp.StorageMB - } - return json.Marshal(objectMap) -} - -// RecommendedIndex represents a database recommended index. -type RecommendedIndex struct { - // RecommendedIndexProperties - READ-ONLY; The properties representing the resource. - *RecommendedIndexProperties `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"` -} - -// MarshalJSON is the custom marshaler for RecommendedIndex. -func (ri RecommendedIndex) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecommendedIndex struct. -func (ri *RecommendedIndex) 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 recommendedIndexProperties RecommendedIndexProperties - err = json.Unmarshal(*v, &recommendedIndexProperties) - if err != nil { - return err - } - ri.RecommendedIndexProperties = &recommendedIndexProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ri.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ri.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ri.Type = &typeVar - } - } - } - - return nil -} - -// RecommendedIndexProperties represents the properties of a database recommended index. -type RecommendedIndexProperties struct { - // Action - READ-ONLY; The proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. Possible values include: 'Create', 'Drop', 'Rebuild' - Action RecommendedIndexAction `json:"action,omitempty"` - // State - READ-ONLY; The current recommendation state. Possible values include: 'RecommendedIndexStateActive', 'RecommendedIndexStatePending', 'RecommendedIndexStateExecuting', 'RecommendedIndexStateVerifying', 'RecommendedIndexStatePendingRevert', 'RecommendedIndexStateReverting', 'RecommendedIndexStateReverted', 'RecommendedIndexStateIgnored', 'RecommendedIndexStateExpired', 'RecommendedIndexStateBlocked', 'RecommendedIndexStateSuccess' - State RecommendedIndexState `json:"state,omitempty"` - // Created - READ-ONLY; The UTC datetime showing when this resource was created (ISO8601 format). - Created *date.Time `json:"created,omitempty"` - // LastModified - READ-ONLY; The UTC datetime of when was this resource last changed (ISO8601 format). - LastModified *date.Time `json:"lastModified,omitempty"` - // IndexType - READ-ONLY; The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTEREDCOLUMNSTORE' - IndexType RecommendedIndexType `json:"indexType,omitempty"` - // Schema - READ-ONLY; The schema where table to build index over resides - Schema *string `json:"schema,omitempty"` - // Table - READ-ONLY; The table on which to build index. - Table *string `json:"table,omitempty"` - // Columns - READ-ONLY; Columns over which to build index - Columns *[]string `json:"columns,omitempty"` - // IncludedColumns - READ-ONLY; The list of column names to be included in the index - IncludedColumns *[]string `json:"includedColumns,omitempty"` - // IndexScript - READ-ONLY; The full build index script - IndexScript *string `json:"indexScript,omitempty"` - // EstimatedImpact - READ-ONLY; The estimated impact of doing recommended index action. - EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"` - // ReportedImpact - READ-ONLY; The values reported after index action is complete. - ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecommendedIndexProperties. -func (rip RecommendedIndexProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableDatabase a recoverable database -type RecoverableDatabase struct { - autorest.Response `json:"-"` - // RecoverableDatabaseProperties - The properties of a recoverable database - *RecoverableDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for RecoverableDatabase. -func (rd RecoverableDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rd.RecoverableDatabaseProperties != nil { - objectMap["properties"] = rd.RecoverableDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecoverableDatabase struct. -func (rd *RecoverableDatabase) 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 recoverableDatabaseProperties RecoverableDatabaseProperties - err = json.Unmarshal(*v, &recoverableDatabaseProperties) - if err != nil { - return err - } - rd.RecoverableDatabaseProperties = &recoverableDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rd.Type = &typeVar - } - } - } - - return nil -} - -// RecoverableDatabaseListResult the response to a list recoverable databases request -type RecoverableDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - A list of recoverable databases - Value *[]RecoverableDatabase `json:"value,omitempty"` -} - -// RecoverableDatabaseProperties the properties of a recoverable database -type RecoverableDatabaseProperties struct { - // Edition - READ-ONLY; The edition of the database - Edition *string `json:"edition,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective name of the database - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // ElasticPoolName - READ-ONLY; The elastic pool name of the database - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // LastAvailableBackupDate - READ-ONLY; The last available backup date of the database (ISO8601 format) - LastAvailableBackupDate *date.Time `json:"lastAvailableBackupDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableDatabaseProperties. -func (rdp RecoverableDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableManagedDatabase a recoverable managed database resource. -type RecoverableManagedDatabase struct { - autorest.Response `json:"-"` - // RecoverableManagedDatabaseProperties - Resource properties. - *RecoverableManagedDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for RecoverableManagedDatabase. -func (rmd RecoverableManagedDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmd.RecoverableManagedDatabaseProperties != nil { - objectMap["properties"] = rmd.RecoverableManagedDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecoverableManagedDatabase struct. -func (rmd *RecoverableManagedDatabase) 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 recoverableManagedDatabaseProperties RecoverableManagedDatabaseProperties - err = json.Unmarshal(*v, &recoverableManagedDatabaseProperties) - if err != nil { - return err - } - rmd.RecoverableManagedDatabaseProperties = &recoverableManagedDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rmd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rmd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rmd.Type = &typeVar - } - } - } - - return nil -} - -// RecoverableManagedDatabaseListResult a list of recoverable managed databases. -type RecoverableManagedDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]RecoverableManagedDatabase `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableManagedDatabaseListResult. -func (rmdlr RecoverableManagedDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableManagedDatabaseListResultIterator provides access to a complete listing of -// RecoverableManagedDatabase values. -type RecoverableManagedDatabaseListResultIterator struct { - i int - page RecoverableManagedDatabaseListResultPage -} - -// 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 *RecoverableManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabaseListResultIterator.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 *RecoverableManagedDatabaseListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RecoverableManagedDatabaseListResultIterator) 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 RecoverableManagedDatabaseListResultIterator) Response() RecoverableManagedDatabaseListResult { - 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 RecoverableManagedDatabaseListResultIterator) Value() RecoverableManagedDatabase { - if !iter.page.NotDone() { - return RecoverableManagedDatabase{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RecoverableManagedDatabaseListResultIterator type. -func NewRecoverableManagedDatabaseListResultIterator(page RecoverableManagedDatabaseListResultPage) RecoverableManagedDatabaseListResultIterator { - return RecoverableManagedDatabaseListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rmdlr RecoverableManagedDatabaseListResult) IsEmpty() bool { - return rmdlr.Value == nil || len(*rmdlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rmdlr RecoverableManagedDatabaseListResult) hasNextLink() bool { - return rmdlr.NextLink != nil && len(*rmdlr.NextLink) != 0 -} - -// recoverableManagedDatabaseListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rmdlr RecoverableManagedDatabaseListResult) recoverableManagedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rmdlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rmdlr.NextLink))) -} - -// RecoverableManagedDatabaseListResultPage contains a page of RecoverableManagedDatabase values. -type RecoverableManagedDatabaseListResultPage struct { - fn func(context.Context, RecoverableManagedDatabaseListResult) (RecoverableManagedDatabaseListResult, error) - rmdlr RecoverableManagedDatabaseListResult -} - -// 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 *RecoverableManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabaseListResultPage.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.rmdlr) - if err != nil { - return err - } - page.rmdlr = 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 *RecoverableManagedDatabaseListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RecoverableManagedDatabaseListResultPage) NotDone() bool { - return !page.rmdlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RecoverableManagedDatabaseListResultPage) Response() RecoverableManagedDatabaseListResult { - return page.rmdlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RecoverableManagedDatabaseListResultPage) Values() []RecoverableManagedDatabase { - if page.rmdlr.IsEmpty() { - return nil - } - return *page.rmdlr.Value -} - -// Creates a new instance of the RecoverableManagedDatabaseListResultPage type. -func NewRecoverableManagedDatabaseListResultPage(cur RecoverableManagedDatabaseListResult, getNextPage func(context.Context, RecoverableManagedDatabaseListResult) (RecoverableManagedDatabaseListResult, error)) RecoverableManagedDatabaseListResultPage { - return RecoverableManagedDatabaseListResultPage{ - fn: getNextPage, - rmdlr: cur, - } -} - -// RecoverableManagedDatabaseProperties the recoverable managed database's properties. -type RecoverableManagedDatabaseProperties struct { - // LastAvailableBackupDate - READ-ONLY; The last available backup date. - LastAvailableBackupDate *string `json:"lastAvailableBackupDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableManagedDatabaseProperties. -func (rmdp RecoverableManagedDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReplicationLink represents a database replication link. -type ReplicationLink struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Location of the server that contains this firewall rule. - Location *string `json:"location,omitempty"` - // ReplicationLinkProperties - The properties representing the resource. - *ReplicationLinkProperties `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"` -} - -// MarshalJSON is the custom marshaler for ReplicationLink. -func (rl ReplicationLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rl.ReplicationLinkProperties != nil { - objectMap["properties"] = rl.ReplicationLinkProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ReplicationLink struct. -func (rl *ReplicationLink) 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 - } - rl.Location = &location - } - case "properties": - if v != nil { - var replicationLinkProperties ReplicationLinkProperties - err = json.Unmarshal(*v, &replicationLinkProperties) - if err != nil { - return err - } - rl.ReplicationLinkProperties = &replicationLinkProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rl.Type = &typeVar - } - } - } - - return nil -} - -// ReplicationLinkListResult represents the response to a List database replication link request. -type ReplicationLinkListResult struct { - autorest.Response `json:"-"` - // Value - The list of database replication links housed in the database. - Value *[]ReplicationLink `json:"value,omitempty"` -} - -// ReplicationLinkProperties represents the properties of a database replication link. -type ReplicationLinkProperties struct { - // IsTerminationAllowed - READ-ONLY; Legacy value indicating whether termination is allowed. Currently always returns true. - IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty"` - // ReplicationMode - READ-ONLY; Replication mode of this replication link. - ReplicationMode *string `json:"replicationMode,omitempty"` - // PartnerServer - READ-ONLY; The name of the server hosting the partner database. - PartnerServer *string `json:"partnerServer,omitempty"` - // PartnerDatabase - READ-ONLY; The name of the partner database. - PartnerDatabase *string `json:"partnerDatabase,omitempty"` - // PartnerLocation - READ-ONLY; The Azure Region of the partner database. - PartnerLocation *string `json:"partnerLocation,omitempty"` - // Role - READ-ONLY; The role of the database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' - Role ReplicationRole `json:"role,omitempty"` - // PartnerRole - READ-ONLY; The role of the partner database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' - PartnerRole ReplicationRole `json:"partnerRole,omitempty"` - // StartTime - READ-ONLY; The start time for the replication link. - StartTime *date.Time `json:"startTime,omitempty"` - // PercentComplete - READ-ONLY; The percentage of seeding complete for the replication link. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ReplicationState - READ-ONLY; The replication state for the replication link. Possible values include: 'PENDING', 'SEEDING', 'CATCHUP', 'SUSPENDED' - ReplicationState ReplicationState `json:"replicationState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationLinkProperties. -func (rlp ReplicationLinkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReplicationLinksFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ReplicationLinksFailoverAllowDataLossFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationLinksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationLinksFailoverAllowDataLossFuture) 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 ReplicationLinksFailoverAllowDataLossFuture.Result. -func (future *ReplicationLinksFailoverAllowDataLossFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverAllowDataLossFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationLinksFailoverFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ReplicationLinksFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationLinksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationLinksFailoverFuture) 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 ReplicationLinksFailoverFuture.Result. -func (future *ReplicationLinksFailoverFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverFuture") - return - } - ar.Response = future.Response() - return -} - -// ReplicationLinksUnlinkFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationLinksUnlinkFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationLinksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationLinksUnlinkFuture) 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 ReplicationLinksUnlinkFuture.Result. -func (future *ReplicationLinksUnlinkFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksUnlinkFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksUnlinkFuture") - return - } - ar.Response = future.Response() - return -} - -// Resource ARM resource. -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"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceIdentity azure Active Directory identity configuration for a resource. -type ResourceIdentity struct { - // PrincipalID - READ-ONLY; The Azure Active Directory principal id. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned' - Type IdentityType `json:"type,omitempty"` - // TenantID - READ-ONLY; The Azure Active Directory tenant id. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceIdentity. -func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ri.Type != "" { - objectMap["type"] = ri.Type - } - return json.Marshal(objectMap) -} - -// ResourceMoveDefinition contains the information necessary to perform a resource move (rename). -type ResourceMoveDefinition struct { - // ID - The target ID for the resource - ID *string `json:"id,omitempty"` -} - -// RestorableDroppedDatabase a restorable dropped database -type RestorableDroppedDatabase struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // RestorableDroppedDatabaseProperties - The properties of a restorable dropped database - *RestorableDroppedDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for RestorableDroppedDatabase. -func (rdd RestorableDroppedDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdd.RestorableDroppedDatabaseProperties != nil { - objectMap["properties"] = rdd.RestorableDroppedDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableDroppedDatabase struct. -func (rdd *RestorableDroppedDatabase) 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 - } - rdd.Location = &location - } - case "properties": - if v != nil { - var restorableDroppedDatabaseProperties RestorableDroppedDatabaseProperties - err = json.Unmarshal(*v, &restorableDroppedDatabaseProperties) - if err != nil { - return err - } - rdd.RestorableDroppedDatabaseProperties = &restorableDroppedDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rdd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rdd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rdd.Type = &typeVar - } - } - } - - return nil -} - -// RestorableDroppedDatabaseListResult the response to a list restorable dropped databases request -type RestorableDroppedDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - A list of restorable dropped databases - Value *[]RestorableDroppedDatabase `json:"value,omitempty"` -} - -// RestorableDroppedDatabaseProperties the properties of a restorable dropped database -type RestorableDroppedDatabaseProperties struct { - // DatabaseName - READ-ONLY; The name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // Edition - READ-ONLY; The edition of the database - Edition *string `json:"edition,omitempty"` - // MaxSizeBytes - READ-ONLY; The max size in bytes of the database - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective name of the database - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // ElasticPoolName - READ-ONLY; The elastic pool name of the database - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format) - CreationDate *date.Time `json:"creationDate,omitempty"` - // DeletionDate - READ-ONLY; The deletion date of the database (ISO8601 format) - DeletionDate *date.Time `json:"deletionDate,omitempty"` - // EarliestRestoreDate - READ-ONLY; The earliest restore date of the database (ISO8601 format) - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDroppedDatabaseProperties. -func (rddp RestorableDroppedDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableDroppedManagedDatabase a restorable dropped managed database resource. -type RestorableDroppedManagedDatabase struct { - autorest.Response `json:"-"` - // RestorableDroppedManagedDatabaseProperties - Resource properties. - *RestorableDroppedManagedDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for RestorableDroppedManagedDatabase. -func (rdmd RestorableDroppedManagedDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdmd.RestorableDroppedManagedDatabaseProperties != nil { - objectMap["properties"] = rdmd.RestorableDroppedManagedDatabaseProperties - } - if rdmd.Location != nil { - objectMap["location"] = rdmd.Location - } - if rdmd.Tags != nil { - objectMap["tags"] = rdmd.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableDroppedManagedDatabase struct. -func (rdmd *RestorableDroppedManagedDatabase) 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 restorableDroppedManagedDatabaseProperties RestorableDroppedManagedDatabaseProperties - err = json.Unmarshal(*v, &restorableDroppedManagedDatabaseProperties) - if err != nil { - return err - } - rdmd.RestorableDroppedManagedDatabaseProperties = &restorableDroppedManagedDatabaseProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rdmd.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rdmd.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rdmd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rdmd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rdmd.Type = &typeVar - } - } - } - - return nil -} - -// RestorableDroppedManagedDatabaseListResult a list of restorable dropped managed databases. -type RestorableDroppedManagedDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]RestorableDroppedManagedDatabase `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDroppedManagedDatabaseListResult. -func (rdmdlr RestorableDroppedManagedDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorableDroppedManagedDatabaseListResultIterator provides access to a complete listing of -// RestorableDroppedManagedDatabase values. -type RestorableDroppedManagedDatabaseListResultIterator struct { - i int - page RestorableDroppedManagedDatabaseListResultPage -} - -// 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 *RestorableDroppedManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedManagedDatabaseListResultIterator.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 *RestorableDroppedManagedDatabaseListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RestorableDroppedManagedDatabaseListResultIterator) 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 RestorableDroppedManagedDatabaseListResultIterator) Response() RestorableDroppedManagedDatabaseListResult { - 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 RestorableDroppedManagedDatabaseListResultIterator) Value() RestorableDroppedManagedDatabase { - if !iter.page.NotDone() { - return RestorableDroppedManagedDatabase{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RestorableDroppedManagedDatabaseListResultIterator type. -func NewRestorableDroppedManagedDatabaseListResultIterator(page RestorableDroppedManagedDatabaseListResultPage) RestorableDroppedManagedDatabaseListResultIterator { - return RestorableDroppedManagedDatabaseListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rdmdlr RestorableDroppedManagedDatabaseListResult) IsEmpty() bool { - return rdmdlr.Value == nil || len(*rdmdlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rdmdlr RestorableDroppedManagedDatabaseListResult) hasNextLink() bool { - return rdmdlr.NextLink != nil && len(*rdmdlr.NextLink) != 0 -} - -// restorableDroppedManagedDatabaseListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rdmdlr RestorableDroppedManagedDatabaseListResult) restorableDroppedManagedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rdmdlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rdmdlr.NextLink))) -} - -// RestorableDroppedManagedDatabaseListResultPage contains a page of RestorableDroppedManagedDatabase -// values. -type RestorableDroppedManagedDatabaseListResultPage struct { - fn func(context.Context, RestorableDroppedManagedDatabaseListResult) (RestorableDroppedManagedDatabaseListResult, error) - rdmdlr RestorableDroppedManagedDatabaseListResult -} - -// 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 *RestorableDroppedManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedManagedDatabaseListResultPage.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.rdmdlr) - if err != nil { - return err - } - page.rdmdlr = 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 *RestorableDroppedManagedDatabaseListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RestorableDroppedManagedDatabaseListResultPage) NotDone() bool { - return !page.rdmdlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RestorableDroppedManagedDatabaseListResultPage) Response() RestorableDroppedManagedDatabaseListResult { - return page.rdmdlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RestorableDroppedManagedDatabaseListResultPage) Values() []RestorableDroppedManagedDatabase { - if page.rdmdlr.IsEmpty() { - return nil - } - return *page.rdmdlr.Value -} - -// Creates a new instance of the RestorableDroppedManagedDatabaseListResultPage type. -func NewRestorableDroppedManagedDatabaseListResultPage(cur RestorableDroppedManagedDatabaseListResult, getNextPage func(context.Context, RestorableDroppedManagedDatabaseListResult) (RestorableDroppedManagedDatabaseListResult, error)) RestorableDroppedManagedDatabaseListResultPage { - return RestorableDroppedManagedDatabaseListResultPage{ - fn: getNextPage, - rdmdlr: cur, - } -} - -// RestorableDroppedManagedDatabaseProperties the restorable dropped managed database's properties. -type RestorableDroppedManagedDatabaseProperties struct { - // DatabaseName - READ-ONLY; The name of the database. - DatabaseName *string `json:"databaseName,omitempty"` - // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // DeletionDate - READ-ONLY; The deletion date of the database (ISO8601 format). - DeletionDate *date.Time `json:"deletionDate,omitempty"` - // EarliestRestoreDate - READ-ONLY; The earliest restore date of the database (ISO8601 format). - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDroppedManagedDatabaseProperties. -func (rdmdp RestorableDroppedManagedDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorePoint database restore points. -type RestorePoint struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // RestorePointProperties - Resource properties. - *RestorePointProperties `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"` -} - -// MarshalJSON is the custom marshaler for RestorePoint. -func (rp RestorePoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RestorePointProperties != nil { - objectMap["properties"] = rp.RestorePointProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorePoint struct. -func (rp *RestorePoint) 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 - } - rp.Location = &location - } - case "properties": - if v != nil { - var restorePointProperties RestorePointProperties - err = json.Unmarshal(*v, &restorePointProperties) - if err != nil { - return err - } - rp.RestorePointProperties = &restorePointProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rp.Type = &typeVar - } - } - } - - return nil -} - -// RestorePointListResult a list of long term retention backups. -type RestorePointListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]RestorePoint `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorePointListResult. -func (rplr RestorePointListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorePointProperties properties of a database restore point -type RestorePointProperties struct { - // RestorePointType - READ-ONLY; The type of restore point. Possible values include: 'CONTINUOUS', 'DISCRETE' - RestorePointType RestorePointType `json:"restorePointType,omitempty"` - // EarliestRestoreDate - READ-ONLY; The earliest time to which this database can be restored - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // RestorePointCreationDate - READ-ONLY; The time the backup was taken - RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"` - // RestorePointLabel - READ-ONLY; The label of restore point for backup request by user - RestorePointLabel *string `json:"restorePointLabel,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorePointProperties. -func (rpp RestorePointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorePointsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RestorePointsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RestorePointsClient) (RestorePoint, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RestorePointsCreateFuture) 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 RestorePointsCreateFuture.Result. -func (future *RestorePointsCreateFuture) result(client RestorePointsClient) (rp RestorePoint, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.RestorePointsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rp.Response.Response, err = future.GetResult(sender); err == nil && rp.Response.Response.StatusCode != http.StatusNoContent { - rp, err = client.CreateResponder(rp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsCreateFuture", "Result", rp.Response.Response, "Failure responding to request") - } - } - return -} - -// SecurityAlertPolicyProperties properties of a security alert policy. -type SecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' - State SecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action - DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses *[]string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // CreationTime - READ-ONLY; Specifies the UTC creation time of the policy. - CreationTime *date.Time `json:"creationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityAlertPolicyProperties. -func (sapp SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sapp.State != "" { - objectMap["state"] = sapp.State - } - if sapp.DisabledAlerts != nil { - objectMap["disabledAlerts"] = sapp.DisabledAlerts - } - if sapp.EmailAddresses != nil { - objectMap["emailAddresses"] = sapp.EmailAddresses - } - if sapp.EmailAccountAdmins != nil { - objectMap["emailAccountAdmins"] = sapp.EmailAccountAdmins - } - if sapp.StorageEndpoint != nil { - objectMap["storageEndpoint"] = sapp.StorageEndpoint - } - if sapp.StorageAccountAccessKey != nil { - objectMap["storageAccountAccessKey"] = sapp.StorageAccountAccessKey - } - if sapp.RetentionDays != nil { - objectMap["retentionDays"] = sapp.RetentionDays - } - return json.Marshal(objectMap) -} - -// SensitivityLabel a sensitivity label. -type SensitivityLabel struct { - autorest.Response `json:"-"` - // SensitivityLabelProperties - Resource properties. - *SensitivityLabelProperties `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"` -} - -// MarshalJSON is the custom marshaler for SensitivityLabel. -func (sl SensitivityLabel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sl.SensitivityLabelProperties != nil { - objectMap["properties"] = sl.SensitivityLabelProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SensitivityLabel struct. -func (sl *SensitivityLabel) 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 sensitivityLabelProperties SensitivityLabelProperties - err = json.Unmarshal(*v, &sensitivityLabelProperties) - if err != nil { - return err - } - sl.SensitivityLabelProperties = &sensitivityLabelProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sl.Type = &typeVar - } - } - } - - return nil -} - -// SensitivityLabelListResult a list of sensitivity labels. -type SensitivityLabelListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SensitivityLabel `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SensitivityLabelListResult. -func (sllr SensitivityLabelListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SensitivityLabelListResultIterator provides access to a complete listing of SensitivityLabel values. -type SensitivityLabelListResultIterator struct { - i int - page SensitivityLabelListResultPage -} - -// 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 *SensitivityLabelListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultIterator.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 *SensitivityLabelListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SensitivityLabelListResultIterator) 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 SensitivityLabelListResultIterator) Response() SensitivityLabelListResult { - 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 SensitivityLabelListResultIterator) Value() SensitivityLabel { - if !iter.page.NotDone() { - return SensitivityLabel{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SensitivityLabelListResultIterator type. -func NewSensitivityLabelListResultIterator(page SensitivityLabelListResultPage) SensitivityLabelListResultIterator { - return SensitivityLabelListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sllr SensitivityLabelListResult) IsEmpty() bool { - return sllr.Value == nil || len(*sllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sllr SensitivityLabelListResult) hasNextLink() bool { - return sllr.NextLink != nil && len(*sllr.NextLink) != 0 -} - -// sensitivityLabelListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sllr SensitivityLabelListResult) sensitivityLabelListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sllr.NextLink))) -} - -// SensitivityLabelListResultPage contains a page of SensitivityLabel values. -type SensitivityLabelListResultPage struct { - fn func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error) - sllr SensitivityLabelListResult -} - -// 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 *SensitivityLabelListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultPage.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.sllr) - if err != nil { - return err - } - page.sllr = 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 *SensitivityLabelListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SensitivityLabelListResultPage) NotDone() bool { - return !page.sllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SensitivityLabelListResultPage) Response() SensitivityLabelListResult { - return page.sllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SensitivityLabelListResultPage) Values() []SensitivityLabel { - if page.sllr.IsEmpty() { - return nil - } - return *page.sllr.Value -} - -// Creates a new instance of the SensitivityLabelListResultPage type. -func NewSensitivityLabelListResultPage(cur SensitivityLabelListResult, getNextPage func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error)) SensitivityLabelListResultPage { - return SensitivityLabelListResultPage{ - fn: getNextPage, - sllr: cur, - } -} - -// SensitivityLabelProperties properties of a sensitivity label. -type SensitivityLabelProperties struct { - // LabelName - The label name. - LabelName *string `json:"labelName,omitempty"` - // LabelID - The label ID. - LabelID *string `json:"labelId,omitempty"` - // InformationType - The information type. - InformationType *string `json:"informationType,omitempty"` - // InformationTypeID - The information type ID. - InformationTypeID *string `json:"informationTypeId,omitempty"` - // IsDisabled - READ-ONLY; Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. - IsDisabled *bool `json:"isDisabled,omitempty"` - // Rank - Possible values include: 'SensitivityLabelRankNone', 'SensitivityLabelRankLow', 'SensitivityLabelRankMedium', 'SensitivityLabelRankHigh', 'SensitivityLabelRankCritical' - Rank SensitivityLabelRank `json:"rank,omitempty"` -} - -// MarshalJSON is the custom marshaler for SensitivityLabelProperties. -func (slp SensitivityLabelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if slp.LabelName != nil { - objectMap["labelName"] = slp.LabelName - } - if slp.LabelID != nil { - objectMap["labelId"] = slp.LabelID - } - if slp.InformationType != nil { - objectMap["informationType"] = slp.InformationType - } - if slp.InformationTypeID != nil { - objectMap["informationTypeId"] = slp.InformationTypeID - } - if slp.Rank != "" { - objectMap["rank"] = slp.Rank - } - return json.Marshal(objectMap) -} - -// Server an Azure SQL Database server. -type Server struct { - autorest.Response `json:"-"` - // Identity - The Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Kind - READ-ONLY; Kind of sql server. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ServerProperties - Resource properties. - *ServerProperties `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"` -} - -// MarshalJSON is the custom marshaler for Server. -func (s Server) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Identity != nil { - objectMap["identity"] = s.Identity - } - if s.ServerProperties != nil { - objectMap["properties"] = s.ServerProperties - } - if s.Location != nil { - objectMap["location"] = s.Location - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Server struct. -func (s *Server) 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 "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - s.Identity = &identity - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - s.Kind = &kind - } - case "properties": - if v != nil { - var serverProperties ServerProperties - err = json.Unmarshal(*v, &serverProperties) - if err != nil { - return err - } - s.ServerProperties = &serverProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - 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 - } - } - } - - return nil -} - -// ServerAutomaticTuning server-level Automatic Tuning. -type ServerAutomaticTuning struct { - autorest.Response `json:"-"` - // AutomaticTuningServerProperties - Resource properties. - *AutomaticTuningServerProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerAutomaticTuning. -func (sat ServerAutomaticTuning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sat.AutomaticTuningServerProperties != nil { - objectMap["properties"] = sat.AutomaticTuningServerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerAutomaticTuning struct. -func (sat *ServerAutomaticTuning) 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 automaticTuningServerProperties AutomaticTuningServerProperties - err = json.Unmarshal(*v, &automaticTuningServerProperties) - if err != nil { - return err - } - sat.AutomaticTuningServerProperties = &automaticTuningServerProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sat.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sat.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sat.Type = &typeVar - } - } - } - - return nil -} - -// ServerAzureADAdministrator azure Active Directory administrator. -type ServerAzureADAdministrator struct { - autorest.Response `json:"-"` - // AdministratorProperties - Resource properties. - *AdministratorProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerAzureADAdministrator. -func (saaa ServerAzureADAdministrator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if saaa.AdministratorProperties != nil { - objectMap["properties"] = saaa.AdministratorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerAzureADAdministrator struct. -func (saaa *ServerAzureADAdministrator) 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 administratorProperties AdministratorProperties - err = json.Unmarshal(*v, &administratorProperties) - if err != nil { - return err - } - saaa.AdministratorProperties = &administratorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - saaa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - saaa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - saaa.Type = &typeVar - } - } - } - - return nil -} - -// ServerAzureADAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerAzureADAdministratorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAzureADAdministratorsClient) (ServerAzureADAdministrator, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) 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 ServerAzureADAdministratorsCreateOrUpdateFuture.Result. -func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - saaa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { - saaa, err = client.CreateOrUpdateResponder(saaa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", saaa.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerAzureADAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerAzureADAdministratorsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAzureADAdministratorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAzureADAdministratorsDeleteFuture) 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 ServerAzureADAdministratorsDeleteFuture.Result. -func (future *ServerAzureADAdministratorsDeleteFuture) result(client ServerAzureADAdministratorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerAzureADOnlyAuthentication azure Active Directory only authentication. -type ServerAzureADOnlyAuthentication struct { - autorest.Response `json:"-"` - // AzureADOnlyAuthProperties - Resource properties. - *AzureADOnlyAuthProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerAzureADOnlyAuthentication. -func (saaoa ServerAzureADOnlyAuthentication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if saaoa.AzureADOnlyAuthProperties != nil { - objectMap["properties"] = saaoa.AzureADOnlyAuthProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerAzureADOnlyAuthentication struct. -func (saaoa *ServerAzureADOnlyAuthentication) 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 azureADOnlyAuthProperties AzureADOnlyAuthProperties - err = json.Unmarshal(*v, &azureADOnlyAuthProperties) - if err != nil { - return err - } - saaoa.AzureADOnlyAuthProperties = &azureADOnlyAuthProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - saaoa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - saaoa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - saaoa.Type = &typeVar - } - } - } - - return nil -} - -// ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAzureADOnlyAuthenticationsClient) (ServerAzureADOnlyAuthentication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture) 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 ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture.Result. -func (future *ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture) result(client ServerAzureADOnlyAuthenticationsClient) (saaoa ServerAzureADOnlyAuthentication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - saaoa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if saaoa.Response.Response, err = future.GetResult(sender); err == nil && saaoa.Response.Response.StatusCode != http.StatusNoContent { - saaoa, err = client.CreateOrUpdateResponder(saaoa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", saaoa.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerAzureADOnlyAuthenticationsDeleteFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ServerAzureADOnlyAuthenticationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAzureADOnlyAuthenticationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAzureADOnlyAuthenticationsDeleteFuture) 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 ServerAzureADOnlyAuthenticationsDeleteFuture.Result. -func (future *ServerAzureADOnlyAuthenticationsDeleteFuture) result(client ServerAzureADOnlyAuthenticationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADOnlyAuthenticationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerBlobAuditingPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerBlobAuditingPoliciesClient) (ServerBlobAuditingPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerBlobAuditingPoliciesCreateOrUpdateFuture) 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 ServerBlobAuditingPoliciesCreateOrUpdateFuture.Result. -func (future *ServerBlobAuditingPoliciesCreateOrUpdateFuture) result(client ServerBlobAuditingPoliciesClient) (sbap ServerBlobAuditingPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sbap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerBlobAuditingPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sbap.Response.Response, err = future.GetResult(sender); err == nil && sbap.Response.Response.StatusCode != http.StatusNoContent { - sbap, err = client.CreateOrUpdateResponder(sbap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", sbap.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerBlobAuditingPolicy a server blob auditing policy. -type ServerBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ServerBlobAuditingPolicyProperties - Resource properties. - *ServerBlobAuditingPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerBlobAuditingPolicy. -func (sbap ServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sbap.ServerBlobAuditingPolicyProperties != nil { - objectMap["properties"] = sbap.ServerBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerBlobAuditingPolicy struct. -func (sbap *ServerBlobAuditingPolicy) 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 serverBlobAuditingPolicyProperties ServerBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &serverBlobAuditingPolicyProperties) - if err != nil { - return err - } - sbap.ServerBlobAuditingPolicyProperties = &serverBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sbap.Type = &typeVar - } - } - } - - return nil -} - -// ServerBlobAuditingPolicyListResult a list of server auditing settings. -type ServerBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerBlobAuditingPolicyListResult. -func (sbaplr ServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ServerBlobAuditingPolicy values. -type ServerBlobAuditingPolicyListResultIterator struct { - i int - page ServerBlobAuditingPolicyListResultPage -} - -// 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 *ServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPolicyListResultIterator.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 *ServerBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerBlobAuditingPolicyListResultIterator) 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 ServerBlobAuditingPolicyListResultIterator) Response() ServerBlobAuditingPolicyListResult { - 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 ServerBlobAuditingPolicyListResultIterator) Value() ServerBlobAuditingPolicy { - if !iter.page.NotDone() { - return ServerBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerBlobAuditingPolicyListResultIterator type. -func NewServerBlobAuditingPolicyListResultIterator(page ServerBlobAuditingPolicyListResultPage) ServerBlobAuditingPolicyListResultIterator { - return ServerBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sbaplr ServerBlobAuditingPolicyListResult) IsEmpty() bool { - return sbaplr.Value == nil || len(*sbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sbaplr ServerBlobAuditingPolicyListResult) hasNextLink() bool { - return sbaplr.NextLink != nil && len(*sbaplr.NextLink) != 0 -} - -// serverBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sbaplr ServerBlobAuditingPolicyListResult) serverBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sbaplr.NextLink))) -} - -// ServerBlobAuditingPolicyListResultPage contains a page of ServerBlobAuditingPolicy values. -type ServerBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ServerBlobAuditingPolicyListResult) (ServerBlobAuditingPolicyListResult, error) - sbaplr ServerBlobAuditingPolicyListResult -} - -// 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 *ServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPolicyListResultPage.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.sbaplr) - if err != nil { - return err - } - page.sbaplr = 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 *ServerBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.sbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerBlobAuditingPolicyListResultPage) Response() ServerBlobAuditingPolicyListResult { - return page.sbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerBlobAuditingPolicyListResultPage) Values() []ServerBlobAuditingPolicy { - if page.sbaplr.IsEmpty() { - return nil - } - return *page.sbaplr.Value -} - -// Creates a new instance of the ServerBlobAuditingPolicyListResultPage type. -func NewServerBlobAuditingPolicyListResultPage(cur ServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ServerBlobAuditingPolicyListResult) (ServerBlobAuditingPolicyListResult, error)) ServerBlobAuditingPolicyListResultPage { - return ServerBlobAuditingPolicyListResultPage{ - fn: getNextPage, - sbaplr: cur, - } -} - -// ServerBlobAuditingPolicyProperties properties of a server blob auditing policy. -type ServerBlobAuditingPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// ServerCommunicationLink server communication link. -type ServerCommunicationLink struct { - autorest.Response `json:"-"` - // ServerCommunicationLinkProperties - The properties of resource. - *ServerCommunicationLinkProperties `json:"properties,omitempty"` - // Location - READ-ONLY; Communication link location. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; Communication link kind. This property is used for Azure Portal metadata. - Kind *string `json:"kind,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"` -} - -// MarshalJSON is the custom marshaler for ServerCommunicationLink. -func (scl ServerCommunicationLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scl.ServerCommunicationLinkProperties != nil { - objectMap["properties"] = scl.ServerCommunicationLinkProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerCommunicationLink struct. -func (scl *ServerCommunicationLink) 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 serverCommunicationLinkProperties ServerCommunicationLinkProperties - err = json.Unmarshal(*v, &serverCommunicationLinkProperties) - if err != nil { - return err - } - scl.ServerCommunicationLinkProperties = &serverCommunicationLinkProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scl.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - scl.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scl.Type = &typeVar - } - } - } - - return nil -} - -// ServerCommunicationLinkListResult a list of server communication links. -type ServerCommunicationLinkListResult struct { - autorest.Response `json:"-"` - // Value - The list of server communication links. - Value *[]ServerCommunicationLink `json:"value,omitempty"` -} - -// ServerCommunicationLinkProperties the properties of a server communication link. -type ServerCommunicationLinkProperties struct { - // State - READ-ONLY; The state. - State *string `json:"state,omitempty"` - // PartnerServer - The name of the partner server. - PartnerServer *string `json:"partnerServer,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerCommunicationLinkProperties. -func (sclp ServerCommunicationLinkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sclp.PartnerServer != nil { - objectMap["partnerServer"] = sclp.PartnerServer - } - return json.Marshal(objectMap) -} - -// ServerCommunicationLinksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ServerCommunicationLinksCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerCommunicationLinksClient) (ServerCommunicationLink, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerCommunicationLinksCreateOrUpdateFuture) 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 ServerCommunicationLinksCreateOrUpdateFuture.Result. -func (future *ServerCommunicationLinksCreateOrUpdateFuture) result(client ServerCommunicationLinksClient) (scl ServerCommunicationLink, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - scl.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerCommunicationLinksCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if scl.Response.Response, err = future.GetResult(sender); err == nil && scl.Response.Response.StatusCode != http.StatusNoContent { - scl, err = client.CreateOrUpdateResponder(scl.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", scl.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerConnectionPolicy a server secure connection policy. -type ServerConnectionPolicy struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // ServerConnectionPolicyProperties - The properties of the server secure connection policy. - *ServerConnectionPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerConnectionPolicy. -func (scp ServerConnectionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.ServerConnectionPolicyProperties != nil { - objectMap["properties"] = scp.ServerConnectionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerConnectionPolicy struct. -func (scp *ServerConnectionPolicy) 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 - } - scp.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scp.Location = &location - } - case "properties": - if v != nil { - var serverConnectionPolicyProperties ServerConnectionPolicyProperties - err = json.Unmarshal(*v, &serverConnectionPolicyProperties) - if err != nil { - return err - } - scp.ServerConnectionPolicyProperties = &serverConnectionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scp.Type = &typeVar - } - } - } - - return nil -} - -// ServerConnectionPolicyProperties the properties of a server secure connection policy. -type ServerConnectionPolicyProperties struct { - // ConnectionType - The server connection type. Possible values include: 'ServerConnectionTypeDefault', 'ServerConnectionTypeProxy', 'ServerConnectionTypeRedirect' - ConnectionType ServerConnectionType `json:"connectionType,omitempty"` -} - -// ServerDNSAlias a server DNS alias. -type ServerDNSAlias struct { - autorest.Response `json:"-"` - // ServerDNSAliasProperties - Resource properties. - *ServerDNSAliasProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerDNSAlias. -func (sda ServerDNSAlias) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sda.ServerDNSAliasProperties != nil { - objectMap["properties"] = sda.ServerDNSAliasProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerDNSAlias struct. -func (sda *ServerDNSAlias) 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 serverDNSAliasProperties ServerDNSAliasProperties - err = json.Unmarshal(*v, &serverDNSAliasProperties) - if err != nil { - return err - } - sda.ServerDNSAliasProperties = &serverDNSAliasProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sda.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sda.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sda.Type = &typeVar - } - } - } - - return nil -} - -// ServerDNSAliasAcquisition a server DNS alias acquisition request. -type ServerDNSAliasAcquisition struct { - // OldServerDNSAliasID - The id of the server alias that will be acquired to point to this server instead. - OldServerDNSAliasID *string `json:"oldServerDnsAliasId,omitempty"` -} - -// ServerDNSAliasesAcquireFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServerDNSAliasesAcquireFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerDNSAliasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerDNSAliasesAcquireFuture) 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 ServerDNSAliasesAcquireFuture.Result. -func (future *ServerDNSAliasesAcquireFuture) result(client ServerDNSAliasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesAcquireFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerDNSAliasesAcquireFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerDNSAliasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerDNSAliasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerDNSAliasesClient) (ServerDNSAlias, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerDNSAliasesCreateOrUpdateFuture) 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 ServerDNSAliasesCreateOrUpdateFuture.Result. -func (future *ServerDNSAliasesCreateOrUpdateFuture) result(client ServerDNSAliasesClient) (sda ServerDNSAlias, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sda.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerDNSAliasesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sda.Response.Response, err = future.GetResult(sender); err == nil && sda.Response.Response.StatusCode != http.StatusNoContent { - sda, err = client.CreateOrUpdateResponder(sda.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesCreateOrUpdateFuture", "Result", sda.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerDNSAliasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServerDNSAliasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerDNSAliasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerDNSAliasesDeleteFuture) 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 ServerDNSAliasesDeleteFuture.Result. -func (future *ServerDNSAliasesDeleteFuture) result(client ServerDNSAliasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerDNSAliasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerDNSAliasListResult a list of server DNS aliases. -type ServerDNSAliasListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerDNSAlias `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerDNSAliasListResult. -func (sdalr ServerDNSAliasListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerDNSAliasListResultIterator provides access to a complete listing of ServerDNSAlias values. -type ServerDNSAliasListResultIterator struct { - i int - page ServerDNSAliasListResultPage -} - -// 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 *ServerDNSAliasListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasListResultIterator.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 *ServerDNSAliasListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerDNSAliasListResultIterator) 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 ServerDNSAliasListResultIterator) Response() ServerDNSAliasListResult { - 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 ServerDNSAliasListResultIterator) Value() ServerDNSAlias { - if !iter.page.NotDone() { - return ServerDNSAlias{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerDNSAliasListResultIterator type. -func NewServerDNSAliasListResultIterator(page ServerDNSAliasListResultPage) ServerDNSAliasListResultIterator { - return ServerDNSAliasListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sdalr ServerDNSAliasListResult) IsEmpty() bool { - return sdalr.Value == nil || len(*sdalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sdalr ServerDNSAliasListResult) hasNextLink() bool { - return sdalr.NextLink != nil && len(*sdalr.NextLink) != 0 -} - -// serverDNSAliasListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sdalr ServerDNSAliasListResult) serverDNSAliasListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sdalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sdalr.NextLink))) -} - -// ServerDNSAliasListResultPage contains a page of ServerDNSAlias values. -type ServerDNSAliasListResultPage struct { - fn func(context.Context, ServerDNSAliasListResult) (ServerDNSAliasListResult, error) - sdalr ServerDNSAliasListResult -} - -// 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 *ServerDNSAliasListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasListResultPage.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.sdalr) - if err != nil { - return err - } - page.sdalr = 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 *ServerDNSAliasListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerDNSAliasListResultPage) NotDone() bool { - return !page.sdalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerDNSAliasListResultPage) Response() ServerDNSAliasListResult { - return page.sdalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerDNSAliasListResultPage) Values() []ServerDNSAlias { - if page.sdalr.IsEmpty() { - return nil - } - return *page.sdalr.Value -} - -// Creates a new instance of the ServerDNSAliasListResultPage type. -func NewServerDNSAliasListResultPage(cur ServerDNSAliasListResult, getNextPage func(context.Context, ServerDNSAliasListResult) (ServerDNSAliasListResult, error)) ServerDNSAliasListResultPage { - return ServerDNSAliasListResultPage{ - fn: getNextPage, - sdalr: cur, - } -} - -// ServerDNSAliasProperties properties of a server DNS alias. -type ServerDNSAliasProperties struct { - // AzureDNSRecord - READ-ONLY; The fully qualified DNS record for alias - AzureDNSRecord *string `json:"azureDnsRecord,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerDNSAliasProperties. -func (sdap ServerDNSAliasProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerInfo server info for the server trust group. -type ServerInfo struct { - // ServerID - Server Id. - ServerID *string `json:"serverId,omitempty"` -} - -// ServerKey a server key. -type ServerKey struct { - autorest.Response `json:"-"` - // Kind - Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // ServerKeyProperties - Resource properties. - *ServerKeyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerKey. -func (sk ServerKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sk.Kind != nil { - objectMap["kind"] = sk.Kind - } - if sk.ServerKeyProperties != nil { - objectMap["properties"] = sk.ServerKeyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerKey struct. -func (sk *ServerKey) 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 - } - sk.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sk.Location = &location - } - case "properties": - if v != nil { - var serverKeyProperties ServerKeyProperties - err = json.Unmarshal(*v, &serverKeyProperties) - if err != nil { - return err - } - sk.ServerKeyProperties = &serverKeyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sk.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sk.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sk.Type = &typeVar - } - } - } - - return nil -} - -// ServerKeyListResult a list of server keys. -type ServerKeyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerKey `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKeyListResult. -func (sklr ServerKeyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerKeyListResultIterator provides access to a complete listing of ServerKey values. -type ServerKeyListResultIterator struct { - i int - page ServerKeyListResultPage -} - -// 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 *ServerKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultIterator.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 *ServerKeyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerKeyListResultIterator) 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 ServerKeyListResultIterator) Response() ServerKeyListResult { - 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 ServerKeyListResultIterator) Value() ServerKey { - if !iter.page.NotDone() { - return ServerKey{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerKeyListResultIterator type. -func NewServerKeyListResultIterator(page ServerKeyListResultPage) ServerKeyListResultIterator { - return ServerKeyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sklr ServerKeyListResult) IsEmpty() bool { - return sklr.Value == nil || len(*sklr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sklr ServerKeyListResult) hasNextLink() bool { - return sklr.NextLink != nil && len(*sklr.NextLink) != 0 -} - -// serverKeyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sklr ServerKeyListResult) serverKeyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sklr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sklr.NextLink))) -} - -// ServerKeyListResultPage contains a page of ServerKey values. -type ServerKeyListResultPage struct { - fn func(context.Context, ServerKeyListResult) (ServerKeyListResult, error) - sklr ServerKeyListResult -} - -// 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 *ServerKeyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultPage.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.sklr) - if err != nil { - return err - } - page.sklr = 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 *ServerKeyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerKeyListResultPage) NotDone() bool { - return !page.sklr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerKeyListResultPage) Response() ServerKeyListResult { - return page.sklr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerKeyListResultPage) Values() []ServerKey { - if page.sklr.IsEmpty() { - return nil - } - return *page.sklr.Value -} - -// Creates a new instance of the ServerKeyListResultPage type. -func NewServerKeyListResultPage(cur ServerKeyListResult, getNextPage func(context.Context, ServerKeyListResult) (ServerKeyListResult, error)) ServerKeyListResultPage { - return ServerKeyListResultPage{ - fn: getNextPage, - sklr: cur, - } -} - -// ServerKeyProperties properties for a server key execution. -type ServerKeyProperties struct { - // Subregion - READ-ONLY; Subregion of the server key. - Subregion *string `json:"subregion,omitempty"` - // ServerKeyType - The server key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - The URI of the server key. - URI *string `json:"uri,omitempty"` - // Thumbprint - Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty"` - // CreationDate - The server key creation date. - CreationDate *date.Time `json:"creationDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKeyProperties. -func (skp ServerKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if skp.ServerKeyType != "" { - objectMap["serverKeyType"] = skp.ServerKeyType - } - if skp.URI != nil { - objectMap["uri"] = skp.URI - } - if skp.Thumbprint != nil { - objectMap["thumbprint"] = skp.Thumbprint - } - if skp.CreationDate != nil { - objectMap["creationDate"] = skp.CreationDate - } - return json.Marshal(objectMap) -} - -// ServerKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerKeysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerKeysClient) (ServerKey, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerKeysCreateOrUpdateFuture) 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 ServerKeysCreateOrUpdateFuture.Result. -func (future *ServerKeysCreateOrUpdateFuture) result(client ServerKeysClient) (sk ServerKey, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sk.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerKeysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sk.Response.Response, err = future.GetResult(sender); err == nil && sk.Response.Response.StatusCode != http.StatusNoContent { - sk, err = client.CreateOrUpdateResponder(sk.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", sk.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerKeysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServerKeysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerKeysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerKeysDeleteFuture) 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 ServerKeysDeleteFuture.Result. -func (future *ServerKeysDeleteFuture) result(client ServerKeysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerKeysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerListResult a list of servers. -type ServerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Server `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerListResult. -func (slr ServerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerListResultIterator provides access to a complete listing of Server values. -type ServerListResultIterator struct { - i int - page ServerListResultPage -} - -// 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 *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.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 *ServerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerListResultIterator) 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 ServerListResultIterator) Response() ServerListResult { - 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 ServerListResultIterator) Value() Server { - if !iter.page.NotDone() { - return Server{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerListResultIterator type. -func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator { - return ServerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr ServerListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr ServerListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// serverListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr ServerListResult) serverListResultPreparer(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))) -} - -// ServerListResultPage contains a page of Server values. -type ServerListResultPage struct { - fn func(context.Context, ServerListResult) (ServerListResult, error) - slr ServerListResult -} - -// 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 *ServerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.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 *ServerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerListResultPage) Response() ServerListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerListResultPage) Values() []Server { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the ServerListResultPage type. -func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage { - return ServerListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// ServerPrivateEndpointConnection a private endpoint connection under a server -type ServerPrivateEndpointConnection struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Properties - READ-ONLY; Private endpoint connection properties - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnection. -func (spec ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerProperties the properties of a server. -type ServerProperties struct { - // AdministratorLogin - Administrator username for the server. Once created it cannot be changed. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The administrator login password (required for server creation). - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - The version of the server. - Version *string `json:"version,omitempty"` - // State - READ-ONLY; The state of the server. - State *string `json:"state,omitempty"` - // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections on a server - PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // MinimalTLSVersion - Minimal TLS version. Allowed values: '1.0', '1.1', '1.2' - MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` - // PublicNetworkAccess - Whether or not public endpoint access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'ServerPublicNetworkAccessEnabled', 'ServerPublicNetworkAccessDisabled' - PublicNetworkAccess ServerPublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerProperties. -func (sp ServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.AdministratorLogin != nil { - objectMap["administratorLogin"] = sp.AdministratorLogin - } - if sp.AdministratorLoginPassword != nil { - objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword - } - if sp.Version != nil { - objectMap["version"] = sp.Version - } - if sp.MinimalTLSVersion != nil { - objectMap["minimalTlsVersion"] = sp.MinimalTLSVersion - } - if sp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// ServersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersCreateOrUpdateFuture) 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 ServersCreateOrUpdateFuture.Result. -func (future *ServersCreateOrUpdateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersDeleteFuture) 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 ServersDeleteFuture.Result. -func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) 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 ServerSecurityAlertPoliciesCreateOrUpdateFuture.Result. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ssap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { - ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerSecurityAlertPolicy a server security alert policy. -type ServerSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // SecurityAlertPolicyProperties - Resource properties. - *SecurityAlertPolicyProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy. -func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssap.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = ssap.SecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. -func (ssap *ServerSecurityAlertPolicy) 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 securityAlertPolicyProperties SecurityAlertPolicyProperties - err = json.Unmarshal(*v, &securityAlertPolicyProperties) - if err != nil { - return err - } - ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ssap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ssap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ssap.Type = &typeVar - } - } - } - - return nil -} - -// ServersImportDatabaseFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersImportDatabaseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (ImportExportOperationResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersImportDatabaseFuture) 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 ServersImportDatabaseFuture.Result. -func (future *ServersImportDatabaseFuture) result(client ServersClient) (ieor ImportExportOperationResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersImportDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ieor.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersImportDatabaseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent { - ieor, err = client.ImportDatabaseResponder(ieor.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersImportDatabaseFuture", "Result", ieor.Response.Response, "Failure responding to request") - } - } - return -} - -// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersUpdateFuture) 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 ServersUpdateFuture.Result. -func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersUpdateFuture") - 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.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerTrustGroup a server trust group. -type ServerTrustGroup struct { - autorest.Response `json:"-"` - // ServerTrustGroupProperties - Resource properties. - *ServerTrustGroupProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerTrustGroup. -func (stg ServerTrustGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stg.ServerTrustGroupProperties != nil { - objectMap["properties"] = stg.ServerTrustGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerTrustGroup struct. -func (stg *ServerTrustGroup) 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 serverTrustGroupProperties ServerTrustGroupProperties - err = json.Unmarshal(*v, &serverTrustGroupProperties) - if err != nil { - return err - } - stg.ServerTrustGroupProperties = &serverTrustGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - stg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - stg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - stg.Type = &typeVar - } - } - } - - return nil -} - -// ServerTrustGroupListResult a list of server trust groups. -type ServerTrustGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerTrustGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerTrustGroupListResult. -func (stglr ServerTrustGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerTrustGroupListResultIterator provides access to a complete listing of ServerTrustGroup values. -type ServerTrustGroupListResultIterator struct { - i int - page ServerTrustGroupListResultPage -} - -// 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 *ServerTrustGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupListResultIterator.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 *ServerTrustGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerTrustGroupListResultIterator) 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 ServerTrustGroupListResultIterator) Response() ServerTrustGroupListResult { - 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 ServerTrustGroupListResultIterator) Value() ServerTrustGroup { - if !iter.page.NotDone() { - return ServerTrustGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerTrustGroupListResultIterator type. -func NewServerTrustGroupListResultIterator(page ServerTrustGroupListResultPage) ServerTrustGroupListResultIterator { - return ServerTrustGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (stglr ServerTrustGroupListResult) IsEmpty() bool { - return stglr.Value == nil || len(*stglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (stglr ServerTrustGroupListResult) hasNextLink() bool { - return stglr.NextLink != nil && len(*stglr.NextLink) != 0 -} - -// serverTrustGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (stglr ServerTrustGroupListResult) serverTrustGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !stglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(stglr.NextLink))) -} - -// ServerTrustGroupListResultPage contains a page of ServerTrustGroup values. -type ServerTrustGroupListResultPage struct { - fn func(context.Context, ServerTrustGroupListResult) (ServerTrustGroupListResult, error) - stglr ServerTrustGroupListResult -} - -// 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 *ServerTrustGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupListResultPage.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.stglr) - if err != nil { - return err - } - page.stglr = 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 *ServerTrustGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerTrustGroupListResultPage) NotDone() bool { - return !page.stglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerTrustGroupListResultPage) Response() ServerTrustGroupListResult { - return page.stglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerTrustGroupListResultPage) Values() []ServerTrustGroup { - if page.stglr.IsEmpty() { - return nil - } - return *page.stglr.Value -} - -// Creates a new instance of the ServerTrustGroupListResultPage type. -func NewServerTrustGroupListResultPage(cur ServerTrustGroupListResult, getNextPage func(context.Context, ServerTrustGroupListResult) (ServerTrustGroupListResult, error)) ServerTrustGroupListResultPage { - return ServerTrustGroupListResultPage{ - fn: getNextPage, - stglr: cur, - } -} - -// ServerTrustGroupProperties properties of a server trust group. -type ServerTrustGroupProperties struct { - // GroupMembers - Group members information for the server trust group. - GroupMembers *[]ServerInfo `json:"groupMembers,omitempty"` - // TrustScopes - Trust scope of the server trust group. - TrustScopes *[]string `json:"trustScopes,omitempty"` -} - -// ServerTrustGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerTrustGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerTrustGroupsClient) (ServerTrustGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerTrustGroupsCreateOrUpdateFuture) 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 ServerTrustGroupsCreateOrUpdateFuture.Result. -func (future *ServerTrustGroupsCreateOrUpdateFuture) result(client ServerTrustGroupsClient) (stg ServerTrustGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - stg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerTrustGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if stg.Response.Response, err = future.GetResult(sender); err == nil && stg.Response.Response.StatusCode != http.StatusNoContent { - stg, err = client.CreateOrUpdateResponder(stg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsCreateOrUpdateFuture", "Result", stg.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerTrustGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServerTrustGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerTrustGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerTrustGroupsDeleteFuture) 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 ServerTrustGroupsDeleteFuture.Result. -func (future *ServerTrustGroupsDeleteFuture) result(client ServerTrustGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerTrustGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerUpdate an update request for an Azure SQL Database server. -type ServerUpdate struct { - // ServerProperties - Resource properties. - *ServerProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerUpdate. -func (su ServerUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if su.ServerProperties != nil { - objectMap["properties"] = su.ServerProperties - } - if su.Tags != nil { - objectMap["tags"] = su.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerUpdate struct. -func (su *ServerUpdate) 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 serverProperties ServerProperties - err = json.Unmarshal(*v, &serverProperties) - if err != nil { - return err - } - su.ServerProperties = &serverProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - su.Tags = tags - } - } - } - - return nil -} - -// ServerUsage represents server metrics. -type ServerUsage struct { - // Name - READ-ONLY; Name of the server usage metric. - Name *string `json:"name,omitempty"` - // ResourceName - READ-ONLY; The name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // DisplayName - READ-ONLY; The metric display name. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; The current value of the metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The current limit of the metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units of the metric. - Unit *string `json:"unit,omitempty"` - // NextResetTime - READ-ONLY; The next reset time for the metric (ISO8601 format). - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerUsage. -func (su ServerUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerUsageListResult represents the response to a list server metrics request. -type ServerUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of server metrics for the server. - Value *[]ServerUsage `json:"value,omitempty"` -} - -// ServerVersionCapability the server capability -type ServerVersionCapability struct { - // Name - READ-ONLY; The server version name. - Name *string `json:"name,omitempty"` - // SupportedEditions - READ-ONLY; The list of supported database editions. - SupportedEditions *[]EditionCapability `json:"supportedEditions,omitempty"` - // SupportedElasticPoolEditions - READ-ONLY; The list of supported elastic pool editions. - SupportedElasticPoolEditions *[]ElasticPoolEditionCapability `json:"supportedElasticPoolEditions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerVersionCapability. -func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if svc.Reason != nil { - objectMap["reason"] = svc.Reason - } - return json.Marshal(objectMap) -} - -// ServerVulnerabilityAssessment a server vulnerability assessment. -type ServerVulnerabilityAssessment struct { - autorest.Response `json:"-"` - // ServerVulnerabilityAssessmentProperties - Resource properties. - *ServerVulnerabilityAssessmentProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServerVulnerabilityAssessment. -func (sva ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sva.ServerVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = sva.ServerVulnerabilityAssessmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerVulnerabilityAssessment struct. -func (sva *ServerVulnerabilityAssessment) 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 serverVulnerabilityAssessmentProperties ServerVulnerabilityAssessmentProperties - err = json.Unmarshal(*v, &serverVulnerabilityAssessmentProperties) - if err != nil { - return err - } - sva.ServerVulnerabilityAssessmentProperties = &serverVulnerabilityAssessmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sva.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sva.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sva.Type = &typeVar - } - } - } - - return nil -} - -// ServerVulnerabilityAssessmentListResult a list of the server's vulnerability assessments. -type ServerVulnerabilityAssessmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerVulnerabilityAssessment `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerVulnerabilityAssessmentListResult. -func (svalr ServerVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerVulnerabilityAssessmentListResultIterator provides access to a complete listing of -// ServerVulnerabilityAssessment values. -type ServerVulnerabilityAssessmentListResultIterator struct { - i int - page ServerVulnerabilityAssessmentListResultPage -} - -// 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 *ServerVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultIterator.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 *ServerVulnerabilityAssessmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerVulnerabilityAssessmentListResultIterator) 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 ServerVulnerabilityAssessmentListResultIterator) Response() ServerVulnerabilityAssessmentListResult { - 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 ServerVulnerabilityAssessmentListResultIterator) Value() ServerVulnerabilityAssessment { - if !iter.page.NotDone() { - return ServerVulnerabilityAssessment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerVulnerabilityAssessmentListResultIterator type. -func NewServerVulnerabilityAssessmentListResultIterator(page ServerVulnerabilityAssessmentListResultPage) ServerVulnerabilityAssessmentListResultIterator { - return ServerVulnerabilityAssessmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (svalr ServerVulnerabilityAssessmentListResult) IsEmpty() bool { - return svalr.Value == nil || len(*svalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (svalr ServerVulnerabilityAssessmentListResult) hasNextLink() bool { - return svalr.NextLink != nil && len(*svalr.NextLink) != 0 -} - -// serverVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (svalr ServerVulnerabilityAssessmentListResult) serverVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !svalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(svalr.NextLink))) -} - -// ServerVulnerabilityAssessmentListResultPage contains a page of ServerVulnerabilityAssessment values. -type ServerVulnerabilityAssessmentListResultPage struct { - fn func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error) - svalr ServerVulnerabilityAssessmentListResult -} - -// 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 *ServerVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultPage.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.svalr) - if err != nil { - return err - } - page.svalr = 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 *ServerVulnerabilityAssessmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerVulnerabilityAssessmentListResultPage) NotDone() bool { - return !page.svalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerVulnerabilityAssessmentListResultPage) Response() ServerVulnerabilityAssessmentListResult { - return page.svalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerVulnerabilityAssessmentListResultPage) Values() []ServerVulnerabilityAssessment { - if page.svalr.IsEmpty() { - return nil - } - return *page.svalr.Value -} - -// Creates a new instance of the ServerVulnerabilityAssessmentListResultPage type. -func NewServerVulnerabilityAssessmentListResultPage(cur ServerVulnerabilityAssessmentListResult, getNextPage func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error)) ServerVulnerabilityAssessmentListResultPage { - return ServerVulnerabilityAssessmentListResultPage{ - fn: getNextPage, - svalr: cur, - } -} - -// ServerVulnerabilityAssessmentProperties properties of a server Vulnerability Assessment. -type ServerVulnerabilityAssessmentProperties struct { - // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RecurringScans - The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` -} - -// ServiceObjective represents a database service objective. -type ServiceObjective struct { - autorest.Response `json:"-"` - // ServiceObjectiveProperties - Represents the properties of the resource. - *ServiceObjectiveProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServiceObjective. -func (so ServiceObjective) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if so.ServiceObjectiveProperties != nil { - objectMap["properties"] = so.ServiceObjectiveProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceObjective struct. -func (so *ServiceObjective) 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 serviceObjectiveProperties ServiceObjectiveProperties - err = json.Unmarshal(*v, &serviceObjectiveProperties) - if err != nil { - return err - } - so.ServiceObjectiveProperties = &serviceObjectiveProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - so.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - so.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - so.Type = &typeVar - } - } - } - - return nil -} - -// ServiceObjectiveCapability the service objectives capability. -type ServiceObjectiveCapability struct { - // ID - READ-ONLY; The unique ID of the service objective. - ID *uuid.UUID `json:"id,omitempty"` - // Name - READ-ONLY; The service objective name. - Name *string `json:"name,omitempty"` - // SupportedMaxSizes - READ-ONLY; The list of supported maximum database sizes. - SupportedMaxSizes *[]MaxSizeRangeCapability `json:"supportedMaxSizes,omitempty"` - // PerformanceLevel - READ-ONLY; The performance level. - PerformanceLevel *PerformanceLevelCapability `json:"performanceLevel,omitempty"` - // Sku - READ-ONLY; The sku. - Sku *Sku `json:"sku,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // IncludedMaxSize - READ-ONLY; The included (free) max size. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the service objective. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // SupportedAutoPauseDelay - READ-ONLY; Supported time range for auto pause delay - SupportedAutoPauseDelay *AutoPauseDelayTimeRange `json:"supportedAutoPauseDelay,omitempty"` - // SupportedMinCapacities - READ-ONLY; List of supported min capacities - SupportedMinCapacities *[]MinCapacityCapability `json:"supportedMinCapacities,omitempty"` - // ComputeModel - READ-ONLY; The compute model - ComputeModel *string `json:"computeModel,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceObjectiveCapability. -func (soc ServiceObjectiveCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if soc.Reason != nil { - objectMap["reason"] = soc.Reason - } - return json.Marshal(objectMap) -} - -// ServiceObjectiveListResult represents the response to a get database service objectives request. -type ServiceObjectiveListResult struct { - autorest.Response `json:"-"` - // Value - The list of database service objectives. - Value *[]ServiceObjective `json:"value,omitempty"` -} - -// ServiceObjectiveProperties represents the properties of a database service objective. -type ServiceObjectiveProperties struct { - // ServiceObjectiveName - READ-ONLY; The name for the service objective. - ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` - // IsDefault - READ-ONLY; Gets whether the service level objective is the default service objective. - IsDefault *bool `json:"isDefault,omitempty"` - // IsSystem - READ-ONLY; Gets whether the service level objective is a system service objective. - IsSystem *bool `json:"isSystem,omitempty"` - // Description - READ-ONLY; The description for the service level objective. - Description *string `json:"description,omitempty"` - // Enabled - READ-ONLY; Gets whether the service level objective is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceObjectiveProperties. -func (sop ServiceObjectiveProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceTierAdvisor represents a Service Tier Advisor. -type ServiceTierAdvisor struct { - autorest.Response `json:"-"` - // ServiceTierAdvisorProperties - READ-ONLY; The properties representing the resource. - *ServiceTierAdvisorProperties `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"` -} - -// MarshalJSON is the custom marshaler for ServiceTierAdvisor. -func (sta ServiceTierAdvisor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceTierAdvisor struct. -func (sta *ServiceTierAdvisor) 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 serviceTierAdvisorProperties ServiceTierAdvisorProperties - err = json.Unmarshal(*v, &serviceTierAdvisorProperties) - if err != nil { - return err - } - sta.ServiceTierAdvisorProperties = &serviceTierAdvisorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sta.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sta.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sta.Type = &typeVar - } - } - } - - return nil -} - -// ServiceTierAdvisorListResult represents the response to a list service tier advisor request. -type ServiceTierAdvisorListResult struct { - autorest.Response `json:"-"` - // Value - The list of service tier advisors for specified database. - Value *[]ServiceTierAdvisor `json:"value,omitempty"` -} - -// ServiceTierAdvisorProperties represents the properties of a Service Tier Advisor. -type ServiceTierAdvisorProperties struct { - // ObservationPeriodStart - READ-ONLY; The observation period start (ISO8601 format). - ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` - // ObservationPeriodEnd - READ-ONLY; The observation period start (ISO8601 format). - ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` - // ActiveTimeRatio - READ-ONLY; The activeTimeRatio for service tier advisor. - ActiveTimeRatio *float64 `json:"activeTimeRatio,omitempty"` - // MinDtu - READ-ONLY; Gets or sets minDtu for service tier advisor. - MinDtu *float64 `json:"minDtu,omitempty"` - // AvgDtu - READ-ONLY; Gets or sets avgDtu for service tier advisor. - AvgDtu *float64 `json:"avgDtu,omitempty"` - // MaxDtu - READ-ONLY; Gets or sets maxDtu for service tier advisor. - MaxDtu *float64 `json:"maxDtu,omitempty"` - // MaxSizeInGB - READ-ONLY; Gets or sets maxSizeInGB for service tier advisor. - MaxSizeInGB *float64 `json:"maxSizeInGB,omitempty"` - // ServiceLevelObjectiveUsageMetrics - READ-ONLY; Gets or sets serviceLevelObjectiveUsageMetrics for the service tier advisor. - ServiceLevelObjectiveUsageMetrics *[]SloUsageMetric `json:"serviceLevelObjectiveUsageMetrics,omitempty"` - // CurrentServiceLevelObjective - READ-ONLY; Gets or sets currentServiceLevelObjective for service tier advisor. - CurrentServiceLevelObjective *string `json:"currentServiceLevelObjective,omitempty"` - // CurrentServiceLevelObjectiveID - READ-ONLY; Gets or sets currentServiceLevelObjectiveId for service tier advisor. - CurrentServiceLevelObjectiveID *uuid.UUID `json:"currentServiceLevelObjectiveId,omitempty"` - // UsageBasedRecommendationServiceLevelObjective - READ-ONLY; Gets or sets usageBasedRecommendationServiceLevelObjective for service tier advisor. - UsageBasedRecommendationServiceLevelObjective *string `json:"usageBasedRecommendationServiceLevelObjective,omitempty"` - // UsageBasedRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. - UsageBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"usageBasedRecommendationServiceLevelObjectiveId,omitempty"` - // DatabaseSizeBasedRecommendationServiceLevelObjective - READ-ONLY; Gets or sets databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. - DatabaseSizeBasedRecommendationServiceLevelObjective *string `json:"databaseSizeBasedRecommendationServiceLevelObjective,omitempty"` - // DatabaseSizeBasedRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. - DatabaseSizeBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"databaseSizeBasedRecommendationServiceLevelObjectiveId,omitempty"` - // DisasterPlanBasedRecommendationServiceLevelObjective - READ-ONLY; Gets or sets disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. - DisasterPlanBasedRecommendationServiceLevelObjective *string `json:"disasterPlanBasedRecommendationServiceLevelObjective,omitempty"` - // DisasterPlanBasedRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. - DisasterPlanBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"disasterPlanBasedRecommendationServiceLevelObjectiveId,omitempty"` - // OverallRecommendationServiceLevelObjective - READ-ONLY; Gets or sets overallRecommendationServiceLevelObjective for service tier advisor. - OverallRecommendationServiceLevelObjective *string `json:"overallRecommendationServiceLevelObjective,omitempty"` - // OverallRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets overallRecommendationServiceLevelObjectiveId for service tier advisor. - OverallRecommendationServiceLevelObjectiveID *uuid.UUID `json:"overallRecommendationServiceLevelObjectiveId,omitempty"` - // Confidence - READ-ONLY; Gets or sets confidence for service tier advisor. - Confidence *float64 `json:"confidence,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceTierAdvisorProperties. -func (stap ServiceTierAdvisorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Sku an ARM Resource SKU. -type Sku struct { - // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. - Name *string `json:"name,omitempty"` - // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. - Tier *string `json:"tier,omitempty"` - // Size - Size of the particular SKU - Size *string `json:"size,omitempty"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // Capacity - Capacity of the particular SKU. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SloUsageMetric a Slo Usage Metric. -type SloUsageMetric struct { - // ServiceLevelObjective - READ-ONLY; The serviceLevelObjective for SLO usage metric. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' - ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` - // ServiceLevelObjectiveID - READ-ONLY; The serviceLevelObjectiveId for SLO usage metric. - ServiceLevelObjectiveID *uuid.UUID `json:"serviceLevelObjectiveId,omitempty"` - // InRangeTimeRatio - READ-ONLY; Gets or sets inRangeTimeRatio for SLO usage metric. - InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty"` -} - -// MarshalJSON is the custom marshaler for SloUsageMetric. -func (sum SloUsageMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StorageCapability the storage account type capability. -type StorageCapability struct { - // StorageAccountType - READ-ONLY; The storage account type for the database's backups. Possible values include: 'StorageAccountType1GRS', 'StorageAccountType1LRS', 'StorageAccountType1ZRS' - StorageAccountType StorageAccountType1 `json:"storageAccountType,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageCapability. -func (sc StorageCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sc.Reason != nil { - objectMap["reason"] = sc.Reason - } - return json.Marshal(objectMap) -} - -// SubscriptionUsage usage Metric of a Subscription in a Location. -type SubscriptionUsage struct { - autorest.Response `json:"-"` - // SubscriptionUsageProperties - Resource properties. - *SubscriptionUsageProperties `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"` -} - -// MarshalJSON is the custom marshaler for SubscriptionUsage. -func (su SubscriptionUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if su.SubscriptionUsageProperties != nil { - objectMap["properties"] = su.SubscriptionUsageProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionUsage struct. -func (su *SubscriptionUsage) 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 subscriptionUsageProperties SubscriptionUsageProperties - err = json.Unmarshal(*v, &subscriptionUsageProperties) - if err != nil { - return err - } - su.SubscriptionUsageProperties = &subscriptionUsageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - su.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - su.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - su.Type = &typeVar - } - } - } - - return nil -} - -// SubscriptionUsageListResult a list of subscription usage metrics in a location. -type SubscriptionUsageListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SubscriptionUsage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionUsageListResult. -func (sulr SubscriptionUsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SubscriptionUsageListResultIterator provides access to a complete listing of SubscriptionUsage values. -type SubscriptionUsageListResultIterator struct { - i int - page SubscriptionUsageListResultPage -} - -// 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 *SubscriptionUsageListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsageListResultIterator.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 *SubscriptionUsageListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SubscriptionUsageListResultIterator) 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 SubscriptionUsageListResultIterator) Response() SubscriptionUsageListResult { - 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 SubscriptionUsageListResultIterator) Value() SubscriptionUsage { - if !iter.page.NotDone() { - return SubscriptionUsage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SubscriptionUsageListResultIterator type. -func NewSubscriptionUsageListResultIterator(page SubscriptionUsageListResultPage) SubscriptionUsageListResultIterator { - return SubscriptionUsageListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sulr SubscriptionUsageListResult) IsEmpty() bool { - return sulr.Value == nil || len(*sulr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sulr SubscriptionUsageListResult) hasNextLink() bool { - return sulr.NextLink != nil && len(*sulr.NextLink) != 0 -} - -// subscriptionUsageListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sulr SubscriptionUsageListResult) subscriptionUsageListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sulr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sulr.NextLink))) -} - -// SubscriptionUsageListResultPage contains a page of SubscriptionUsage values. -type SubscriptionUsageListResultPage struct { - fn func(context.Context, SubscriptionUsageListResult) (SubscriptionUsageListResult, error) - sulr SubscriptionUsageListResult -} - -// 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 *SubscriptionUsageListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsageListResultPage.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.sulr) - if err != nil { - return err - } - page.sulr = 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 *SubscriptionUsageListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SubscriptionUsageListResultPage) NotDone() bool { - return !page.sulr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SubscriptionUsageListResultPage) Response() SubscriptionUsageListResult { - return page.sulr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SubscriptionUsageListResultPage) Values() []SubscriptionUsage { - if page.sulr.IsEmpty() { - return nil - } - return *page.sulr.Value -} - -// Creates a new instance of the SubscriptionUsageListResultPage type. -func NewSubscriptionUsageListResultPage(cur SubscriptionUsageListResult, getNextPage func(context.Context, SubscriptionUsageListResult) (SubscriptionUsageListResult, error)) SubscriptionUsageListResultPage { - return SubscriptionUsageListResultPage{ - fn: getNextPage, - sulr: cur, - } -} - -// SubscriptionUsageProperties properties of a subscription usage. -type SubscriptionUsageProperties struct { - // DisplayName - READ-ONLY; User-readable name of the metric. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; Current value of the metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; Boundary value of the metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; Unit of the metric. - Unit *string `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionUsageProperties. -func (sup SubscriptionUsageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgent an Azure SQL Database sync agent. -type SyncAgent struct { - autorest.Response `json:"-"` - // SyncAgentProperties - Resource properties. - *SyncAgentProperties `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"` -} - -// MarshalJSON is the custom marshaler for SyncAgent. -func (sa SyncAgent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sa.SyncAgentProperties != nil { - objectMap["properties"] = sa.SyncAgentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SyncAgent struct. -func (sa *SyncAgent) 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 syncAgentProperties SyncAgentProperties - err = json.Unmarshal(*v, &syncAgentProperties) - if err != nil { - return err - } - sa.SyncAgentProperties = &syncAgentProperties - } - 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 - } - } - } - - return nil -} - -// SyncAgentKeyProperties properties of an Azure SQL Database sync agent key. -type SyncAgentKeyProperties struct { - autorest.Response `json:"-"` - // SyncAgentKey - READ-ONLY; Key of sync agent. - SyncAgentKey *string `json:"syncAgentKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentKeyProperties. -func (sakp SyncAgentKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgentLinkedDatabase an Azure SQL Database sync agent linked database. -type SyncAgentLinkedDatabase struct { - // SyncAgentLinkedDatabaseProperties - Resource properties. - *SyncAgentLinkedDatabaseProperties `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"` -} - -// MarshalJSON is the custom marshaler for SyncAgentLinkedDatabase. -func (sald SyncAgentLinkedDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sald.SyncAgentLinkedDatabaseProperties != nil { - objectMap["properties"] = sald.SyncAgentLinkedDatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SyncAgentLinkedDatabase struct. -func (sald *SyncAgentLinkedDatabase) 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 syncAgentLinkedDatabaseProperties SyncAgentLinkedDatabaseProperties - err = json.Unmarshal(*v, &syncAgentLinkedDatabaseProperties) - if err != nil { - return err - } - sald.SyncAgentLinkedDatabaseProperties = &syncAgentLinkedDatabaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sald.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sald.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sald.Type = &typeVar - } - } - } - - return nil -} - -// SyncAgentLinkedDatabaseListResult a list of sync agent linked databases. -type SyncAgentLinkedDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncAgentLinkedDatabase `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentLinkedDatabaseListResult. -func (saldlr SyncAgentLinkedDatabaseListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgentLinkedDatabaseListResultIterator provides access to a complete listing of -// SyncAgentLinkedDatabase values. -type SyncAgentLinkedDatabaseListResultIterator struct { - i int - page SyncAgentLinkedDatabaseListResultPage -} - -// 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 *SyncAgentLinkedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentLinkedDatabaseListResultIterator.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 *SyncAgentLinkedDatabaseListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncAgentLinkedDatabaseListResultIterator) 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 SyncAgentLinkedDatabaseListResultIterator) Response() SyncAgentLinkedDatabaseListResult { - 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 SyncAgentLinkedDatabaseListResultIterator) Value() SyncAgentLinkedDatabase { - if !iter.page.NotDone() { - return SyncAgentLinkedDatabase{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncAgentLinkedDatabaseListResultIterator type. -func NewSyncAgentLinkedDatabaseListResultIterator(page SyncAgentLinkedDatabaseListResultPage) SyncAgentLinkedDatabaseListResultIterator { - return SyncAgentLinkedDatabaseListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (saldlr SyncAgentLinkedDatabaseListResult) IsEmpty() bool { - return saldlr.Value == nil || len(*saldlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (saldlr SyncAgentLinkedDatabaseListResult) hasNextLink() bool { - return saldlr.NextLink != nil && len(*saldlr.NextLink) != 0 -} - -// syncAgentLinkedDatabaseListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (saldlr SyncAgentLinkedDatabaseListResult) syncAgentLinkedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { - if !saldlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(saldlr.NextLink))) -} - -// SyncAgentLinkedDatabaseListResultPage contains a page of SyncAgentLinkedDatabase values. -type SyncAgentLinkedDatabaseListResultPage struct { - fn func(context.Context, SyncAgentLinkedDatabaseListResult) (SyncAgentLinkedDatabaseListResult, error) - saldlr SyncAgentLinkedDatabaseListResult -} - -// 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 *SyncAgentLinkedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentLinkedDatabaseListResultPage.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.saldlr) - if err != nil { - return err - } - page.saldlr = 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 *SyncAgentLinkedDatabaseListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncAgentLinkedDatabaseListResultPage) NotDone() bool { - return !page.saldlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncAgentLinkedDatabaseListResultPage) Response() SyncAgentLinkedDatabaseListResult { - return page.saldlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncAgentLinkedDatabaseListResultPage) Values() []SyncAgentLinkedDatabase { - if page.saldlr.IsEmpty() { - return nil - } - return *page.saldlr.Value -} - -// Creates a new instance of the SyncAgentLinkedDatabaseListResultPage type. -func NewSyncAgentLinkedDatabaseListResultPage(cur SyncAgentLinkedDatabaseListResult, getNextPage func(context.Context, SyncAgentLinkedDatabaseListResult) (SyncAgentLinkedDatabaseListResult, error)) SyncAgentLinkedDatabaseListResultPage { - return SyncAgentLinkedDatabaseListResultPage{ - fn: getNextPage, - saldlr: cur, - } -} - -// SyncAgentLinkedDatabaseProperties properties of an Azure SQL Database sync agent linked database. -type SyncAgentLinkedDatabaseProperties struct { - // DatabaseType - READ-ONLY; Type of the sync agent linked database. Possible values include: 'AzureSQLDatabase', 'SQLServerDatabase' - DatabaseType SyncMemberDbType `json:"databaseType,omitempty"` - // DatabaseID - READ-ONLY; Id of the sync agent linked database. - DatabaseID *string `json:"databaseId,omitempty"` - // Description - READ-ONLY; Description of the sync agent linked database. - Description *string `json:"description,omitempty"` - // ServerName - READ-ONLY; Server name of the sync agent linked database. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; Database name of the sync agent linked database. - DatabaseName *string `json:"databaseName,omitempty"` - // UserName - READ-ONLY; User name of the sync agent linked database. - UserName *string `json:"userName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentLinkedDatabaseProperties. -func (saldp SyncAgentLinkedDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgentListResult a list of sync agents. -type SyncAgentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncAgent `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentListResult. -func (salr SyncAgentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncAgentListResultIterator provides access to a complete listing of SyncAgent values. -type SyncAgentListResultIterator struct { - i int - page SyncAgentListResultPage -} - -// 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 *SyncAgentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentListResultIterator.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 *SyncAgentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncAgentListResultIterator) 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 SyncAgentListResultIterator) Response() SyncAgentListResult { - 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 SyncAgentListResultIterator) Value() SyncAgent { - if !iter.page.NotDone() { - return SyncAgent{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncAgentListResultIterator type. -func NewSyncAgentListResultIterator(page SyncAgentListResultPage) SyncAgentListResultIterator { - return SyncAgentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (salr SyncAgentListResult) IsEmpty() bool { - return salr.Value == nil || len(*salr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (salr SyncAgentListResult) hasNextLink() bool { - return salr.NextLink != nil && len(*salr.NextLink) != 0 -} - -// syncAgentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (salr SyncAgentListResult) syncAgentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !salr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(salr.NextLink))) -} - -// SyncAgentListResultPage contains a page of SyncAgent values. -type SyncAgentListResultPage struct { - fn func(context.Context, SyncAgentListResult) (SyncAgentListResult, error) - salr SyncAgentListResult -} - -// 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 *SyncAgentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentListResultPage.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.salr) - if err != nil { - return err - } - page.salr = 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 *SyncAgentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncAgentListResultPage) NotDone() bool { - return !page.salr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncAgentListResultPage) Response() SyncAgentListResult { - return page.salr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncAgentListResultPage) Values() []SyncAgent { - if page.salr.IsEmpty() { - return nil - } - return *page.salr.Value -} - -// Creates a new instance of the SyncAgentListResultPage type. -func NewSyncAgentListResultPage(cur SyncAgentListResult, getNextPage func(context.Context, SyncAgentListResult) (SyncAgentListResult, error)) SyncAgentListResultPage { - return SyncAgentListResultPage{ - fn: getNextPage, - salr: cur, - } -} - -// SyncAgentProperties properties of an Azure SQL Database sync agent. -type SyncAgentProperties struct { - // Name - READ-ONLY; Name of the sync agent. - Name *string `json:"name,omitempty"` - // SyncDatabaseID - ARM resource id of the sync database in the sync agent. - SyncDatabaseID *string `json:"syncDatabaseId,omitempty"` - // LastAliveTime - READ-ONLY; Last alive time of the sync agent. - LastAliveTime *date.Time `json:"lastAliveTime,omitempty"` - // State - READ-ONLY; State of the sync agent. Possible values include: 'SyncAgentStateOnline', 'SyncAgentStateOffline', 'SyncAgentStateNeverConnected' - State SyncAgentState `json:"state,omitempty"` - // IsUpToDate - READ-ONLY; If the sync agent version is up to date. - IsUpToDate *bool `json:"isUpToDate,omitempty"` - // ExpiryTime - READ-ONLY; Expiration time of the sync agent version. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // Version - READ-ONLY; Version of the sync agent. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncAgentProperties. -func (sap SyncAgentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sap.SyncDatabaseID != nil { - objectMap["syncDatabaseId"] = sap.SyncDatabaseID - } - return json.Marshal(objectMap) -} - -// SyncAgentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncAgentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncAgentsClient) (SyncAgent, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncAgentsCreateOrUpdateFuture) 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 SyncAgentsCreateOrUpdateFuture.Result. -func (future *SyncAgentsCreateOrUpdateFuture) result(client SyncAgentsClient) (sa SyncAgent, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncAgentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sa.Response.Response, err = future.GetResult(sender); err == nil && sa.Response.Response.StatusCode != http.StatusNoContent { - sa, err = client.CreateOrUpdateResponder(sa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", sa.Response.Response, "Failure responding to request") - } - } - return -} - -// SyncAgentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncAgentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncAgentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncAgentsDeleteFuture) 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 SyncAgentsDeleteFuture.Result. -func (future *SyncAgentsDeleteFuture) result(client SyncAgentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncAgentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncDatabaseIDListResult a list of sync database ID properties. -type SyncDatabaseIDListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncDatabaseIDProperties `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncDatabaseIDListResult. -func (sdilr SyncDatabaseIDListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncDatabaseIDListResultIterator provides access to a complete listing of SyncDatabaseIDProperties -// values. -type SyncDatabaseIDListResultIterator struct { - i int - page SyncDatabaseIDListResultPage -} - -// 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 *SyncDatabaseIDListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncDatabaseIDListResultIterator.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 *SyncDatabaseIDListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncDatabaseIDListResultIterator) 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 SyncDatabaseIDListResultIterator) Response() SyncDatabaseIDListResult { - 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 SyncDatabaseIDListResultIterator) Value() SyncDatabaseIDProperties { - if !iter.page.NotDone() { - return SyncDatabaseIDProperties{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncDatabaseIDListResultIterator type. -func NewSyncDatabaseIDListResultIterator(page SyncDatabaseIDListResultPage) SyncDatabaseIDListResultIterator { - return SyncDatabaseIDListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sdilr SyncDatabaseIDListResult) IsEmpty() bool { - return sdilr.Value == nil || len(*sdilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sdilr SyncDatabaseIDListResult) hasNextLink() bool { - return sdilr.NextLink != nil && len(*sdilr.NextLink) != 0 -} - -// syncDatabaseIDListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sdilr SyncDatabaseIDListResult) syncDatabaseIDListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sdilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sdilr.NextLink))) -} - -// SyncDatabaseIDListResultPage contains a page of SyncDatabaseIDProperties values. -type SyncDatabaseIDListResultPage struct { - fn func(context.Context, SyncDatabaseIDListResult) (SyncDatabaseIDListResult, error) - sdilr SyncDatabaseIDListResult -} - -// 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 *SyncDatabaseIDListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncDatabaseIDListResultPage.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.sdilr) - if err != nil { - return err - } - page.sdilr = 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 *SyncDatabaseIDListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncDatabaseIDListResultPage) NotDone() bool { - return !page.sdilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncDatabaseIDListResultPage) Response() SyncDatabaseIDListResult { - return page.sdilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncDatabaseIDListResultPage) Values() []SyncDatabaseIDProperties { - if page.sdilr.IsEmpty() { - return nil - } - return *page.sdilr.Value -} - -// Creates a new instance of the SyncDatabaseIDListResultPage type. -func NewSyncDatabaseIDListResultPage(cur SyncDatabaseIDListResult, getNextPage func(context.Context, SyncDatabaseIDListResult) (SyncDatabaseIDListResult, error)) SyncDatabaseIDListResultPage { - return SyncDatabaseIDListResultPage{ - fn: getNextPage, - sdilr: cur, - } -} - -// SyncDatabaseIDProperties properties of the sync database id. -type SyncDatabaseIDProperties struct { - // ID - READ-ONLY; ARM resource id of sync database. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncDatabaseIDProperties. -func (sdip SyncDatabaseIDProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncFullSchemaProperties properties of the database full schema. -type SyncFullSchemaProperties struct { - // Tables - READ-ONLY; List of tables in the database full schema. - Tables *[]SyncFullSchemaTable `json:"tables,omitempty"` - // LastUpdateTime - READ-ONLY; Last update time of the database schema. - LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncFullSchemaProperties. -func (sfsp SyncFullSchemaProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncFullSchemaPropertiesListResult a list of sync schema properties. -type SyncFullSchemaPropertiesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncFullSchemaProperties `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncFullSchemaPropertiesListResult. -func (sfsplr SyncFullSchemaPropertiesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncFullSchemaPropertiesListResultIterator provides access to a complete listing of -// SyncFullSchemaProperties values. -type SyncFullSchemaPropertiesListResultIterator struct { - i int - page SyncFullSchemaPropertiesListResultPage -} - -// 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 *SyncFullSchemaPropertiesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncFullSchemaPropertiesListResultIterator.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 *SyncFullSchemaPropertiesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncFullSchemaPropertiesListResultIterator) 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 SyncFullSchemaPropertiesListResultIterator) Response() SyncFullSchemaPropertiesListResult { - 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 SyncFullSchemaPropertiesListResultIterator) Value() SyncFullSchemaProperties { - if !iter.page.NotDone() { - return SyncFullSchemaProperties{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncFullSchemaPropertiesListResultIterator type. -func NewSyncFullSchemaPropertiesListResultIterator(page SyncFullSchemaPropertiesListResultPage) SyncFullSchemaPropertiesListResultIterator { - return SyncFullSchemaPropertiesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sfsplr SyncFullSchemaPropertiesListResult) IsEmpty() bool { - return sfsplr.Value == nil || len(*sfsplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sfsplr SyncFullSchemaPropertiesListResult) hasNextLink() bool { - return sfsplr.NextLink != nil && len(*sfsplr.NextLink) != 0 -} - -// syncFullSchemaPropertiesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sfsplr SyncFullSchemaPropertiesListResult) syncFullSchemaPropertiesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sfsplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sfsplr.NextLink))) -} - -// SyncFullSchemaPropertiesListResultPage contains a page of SyncFullSchemaProperties values. -type SyncFullSchemaPropertiesListResultPage struct { - fn func(context.Context, SyncFullSchemaPropertiesListResult) (SyncFullSchemaPropertiesListResult, error) - sfsplr SyncFullSchemaPropertiesListResult -} - -// 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 *SyncFullSchemaPropertiesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncFullSchemaPropertiesListResultPage.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.sfsplr) - if err != nil { - return err - } - page.sfsplr = 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 *SyncFullSchemaPropertiesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncFullSchemaPropertiesListResultPage) NotDone() bool { - return !page.sfsplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncFullSchemaPropertiesListResultPage) Response() SyncFullSchemaPropertiesListResult { - return page.sfsplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncFullSchemaPropertiesListResultPage) Values() []SyncFullSchemaProperties { - if page.sfsplr.IsEmpty() { - return nil - } - return *page.sfsplr.Value -} - -// Creates a new instance of the SyncFullSchemaPropertiesListResultPage type. -func NewSyncFullSchemaPropertiesListResultPage(cur SyncFullSchemaPropertiesListResult, getNextPage func(context.Context, SyncFullSchemaPropertiesListResult) (SyncFullSchemaPropertiesListResult, error)) SyncFullSchemaPropertiesListResultPage { - return SyncFullSchemaPropertiesListResultPage{ - fn: getNextPage, - sfsplr: cur, - } -} - -// SyncFullSchemaTable properties of the table in the database full schema. -type SyncFullSchemaTable struct { - // Columns - READ-ONLY; List of columns in the table of database full schema. - Columns *[]SyncFullSchemaTableColumn `json:"columns,omitempty"` - // ErrorID - READ-ONLY; Error id of the table. - ErrorID *string `json:"errorId,omitempty"` - // HasError - READ-ONLY; If there is error in the table. - HasError *bool `json:"hasError,omitempty"` - // Name - READ-ONLY; Name of the table. - Name *string `json:"name,omitempty"` - // QuotedName - READ-ONLY; Quoted name of the table. - QuotedName *string `json:"quotedName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncFullSchemaTable. -func (sfst SyncFullSchemaTable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncFullSchemaTableColumn properties of the column in the table of database full schema. -type SyncFullSchemaTableColumn struct { - // DataSize - READ-ONLY; Data size of the column. - DataSize *string `json:"dataSize,omitempty"` - // DataType - READ-ONLY; Data type of the column. - DataType *string `json:"dataType,omitempty"` - // ErrorID - READ-ONLY; Error id of the column. - ErrorID *string `json:"errorId,omitempty"` - // HasError - READ-ONLY; If there is error in the table. - HasError *bool `json:"hasError,omitempty"` - // IsPrimaryKey - READ-ONLY; If it is the primary key of the table. - IsPrimaryKey *bool `json:"isPrimaryKey,omitempty"` - // Name - READ-ONLY; Name of the column. - Name *string `json:"name,omitempty"` - // QuotedName - READ-ONLY; Quoted name of the column. - QuotedName *string `json:"quotedName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncFullSchemaTableColumn. -func (sfstc SyncFullSchemaTableColumn) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncGroup an Azure SQL Database sync group. -type SyncGroup struct { - autorest.Response `json:"-"` - // SyncGroupProperties - Resource properties. - *SyncGroupProperties `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"` -} - -// MarshalJSON is the custom marshaler for SyncGroup. -func (sg SyncGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sg.SyncGroupProperties != nil { - objectMap["properties"] = sg.SyncGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SyncGroup struct. -func (sg *SyncGroup) 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 syncGroupProperties SyncGroupProperties - err = json.Unmarshal(*v, &syncGroupProperties) - if err != nil { - return err - } - sg.SyncGroupProperties = &syncGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sg.Type = &typeVar - } - } - } - - return nil -} - -// SyncGroupListResult a list of sync groups. -type SyncGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncGroupListResult. -func (sglr SyncGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncGroupListResultIterator provides access to a complete listing of SyncGroup values. -type SyncGroupListResultIterator struct { - i int - page SyncGroupListResultPage -} - -// 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 *SyncGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupListResultIterator.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 *SyncGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncGroupListResultIterator) 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 SyncGroupListResultIterator) Response() SyncGroupListResult { - 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 SyncGroupListResultIterator) Value() SyncGroup { - if !iter.page.NotDone() { - return SyncGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncGroupListResultIterator type. -func NewSyncGroupListResultIterator(page SyncGroupListResultPage) SyncGroupListResultIterator { - return SyncGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sglr SyncGroupListResult) IsEmpty() bool { - return sglr.Value == nil || len(*sglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sglr SyncGroupListResult) hasNextLink() bool { - return sglr.NextLink != nil && len(*sglr.NextLink) != 0 -} - -// syncGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sglr SyncGroupListResult) syncGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sglr.NextLink))) -} - -// SyncGroupListResultPage contains a page of SyncGroup values. -type SyncGroupListResultPage struct { - fn func(context.Context, SyncGroupListResult) (SyncGroupListResult, error) - sglr SyncGroupListResult -} - -// 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 *SyncGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupListResultPage.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.sglr) - if err != nil { - return err - } - page.sglr = 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 *SyncGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncGroupListResultPage) NotDone() bool { - return !page.sglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncGroupListResultPage) Response() SyncGroupListResult { - return page.sglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncGroupListResultPage) Values() []SyncGroup { - if page.sglr.IsEmpty() { - return nil - } - return *page.sglr.Value -} - -// Creates a new instance of the SyncGroupListResultPage type. -func NewSyncGroupListResultPage(cur SyncGroupListResult, getNextPage func(context.Context, SyncGroupListResult) (SyncGroupListResult, error)) SyncGroupListResultPage { - return SyncGroupListResultPage{ - fn: getNextPage, - sglr: cur, - } -} - -// SyncGroupLogListResult a list of sync group log properties. -type SyncGroupLogListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncGroupLogProperties `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncGroupLogListResult. -func (sgllr SyncGroupLogListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncGroupLogListResultIterator provides access to a complete listing of SyncGroupLogProperties values. -type SyncGroupLogListResultIterator struct { - i int - page SyncGroupLogListResultPage -} - -// 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 *SyncGroupLogListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupLogListResultIterator.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 *SyncGroupLogListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncGroupLogListResultIterator) 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 SyncGroupLogListResultIterator) Response() SyncGroupLogListResult { - 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 SyncGroupLogListResultIterator) Value() SyncGroupLogProperties { - if !iter.page.NotDone() { - return SyncGroupLogProperties{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncGroupLogListResultIterator type. -func NewSyncGroupLogListResultIterator(page SyncGroupLogListResultPage) SyncGroupLogListResultIterator { - return SyncGroupLogListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sgllr SyncGroupLogListResult) IsEmpty() bool { - return sgllr.Value == nil || len(*sgllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sgllr SyncGroupLogListResult) hasNextLink() bool { - return sgllr.NextLink != nil && len(*sgllr.NextLink) != 0 -} - -// syncGroupLogListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sgllr SyncGroupLogListResult) syncGroupLogListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sgllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sgllr.NextLink))) -} - -// SyncGroupLogListResultPage contains a page of SyncGroupLogProperties values. -type SyncGroupLogListResultPage struct { - fn func(context.Context, SyncGroupLogListResult) (SyncGroupLogListResult, error) - sgllr SyncGroupLogListResult -} - -// 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 *SyncGroupLogListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupLogListResultPage.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.sgllr) - if err != nil { - return err - } - page.sgllr = 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 *SyncGroupLogListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncGroupLogListResultPage) NotDone() bool { - return !page.sgllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncGroupLogListResultPage) Response() SyncGroupLogListResult { - return page.sgllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncGroupLogListResultPage) Values() []SyncGroupLogProperties { - if page.sgllr.IsEmpty() { - return nil - } - return *page.sgllr.Value -} - -// Creates a new instance of the SyncGroupLogListResultPage type. -func NewSyncGroupLogListResultPage(cur SyncGroupLogListResult, getNextPage func(context.Context, SyncGroupLogListResult) (SyncGroupLogListResult, error)) SyncGroupLogListResultPage { - return SyncGroupLogListResultPage{ - fn: getNextPage, - sgllr: cur, - } -} - -// SyncGroupLogProperties properties of an Azure SQL Database sync group log. -type SyncGroupLogProperties struct { - // Timestamp - READ-ONLY; Timestamp of the sync group log. - Timestamp *date.Time `json:"timestamp,omitempty"` - // Type - READ-ONLY; Type of the sync group log. Possible values include: 'SyncGroupLogTypeAll', 'SyncGroupLogTypeError', 'SyncGroupLogTypeWarning', 'SyncGroupLogTypeSuccess' - Type SyncGroupLogType `json:"type,omitempty"` - // Source - READ-ONLY; Source of the sync group log. - Source *string `json:"source,omitempty"` - // Details - READ-ONLY; Details of the sync group log. - Details *string `json:"details,omitempty"` - // TracingID - READ-ONLY; TracingId of the sync group log. - TracingID *uuid.UUID `json:"tracingId,omitempty"` - // OperationStatus - READ-ONLY; OperationStatus of the sync group log. - OperationStatus *string `json:"operationStatus,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncGroupLogProperties. -func (sglp SyncGroupLogProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncGroupProperties properties of a sync group. -type SyncGroupProperties struct { - // Interval - Sync interval of the sync group. - Interval *int32 `json:"interval,omitempty"` - // LastSyncTime - READ-ONLY; Last sync time of the sync group. - LastSyncTime *date.Time `json:"lastSyncTime,omitempty"` - // ConflictResolutionPolicy - Conflict resolution policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - ConflictResolutionPolicy SyncConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` - // SyncDatabaseID - ARM resource id of the sync database in the sync group. - SyncDatabaseID *string `json:"syncDatabaseId,omitempty"` - // HubDatabaseUserName - User name for the sync group hub database credential. - HubDatabaseUserName *string `json:"hubDatabaseUserName,omitempty"` - // HubDatabasePassword - Password for the sync group hub database credential. - HubDatabasePassword *string `json:"hubDatabasePassword,omitempty"` - // SyncState - READ-ONLY; Sync state of the sync group. Possible values include: 'NotReady', 'Error', 'Warning', 'Progressing', 'Good' - SyncState SyncGroupState `json:"syncState,omitempty"` - // Schema - Sync schema of the sync group. - Schema *SyncGroupSchema `json:"schema,omitempty"` - // UsePrivateLinkConnection - If use private link connection is enabled. - UsePrivateLinkConnection *bool `json:"usePrivateLinkConnection,omitempty"` - // PrivateEndpointName - READ-ONLY; Private endpoint name of the sync group if use private link connection is enabled. - PrivateEndpointName *string `json:"privateEndpointName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncGroupProperties. -func (sgp SyncGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sgp.Interval != nil { - objectMap["interval"] = sgp.Interval - } - if sgp.ConflictResolutionPolicy != "" { - objectMap["conflictResolutionPolicy"] = sgp.ConflictResolutionPolicy - } - if sgp.SyncDatabaseID != nil { - objectMap["syncDatabaseId"] = sgp.SyncDatabaseID - } - if sgp.HubDatabaseUserName != nil { - objectMap["hubDatabaseUserName"] = sgp.HubDatabaseUserName - } - if sgp.HubDatabasePassword != nil { - objectMap["hubDatabasePassword"] = sgp.HubDatabasePassword - } - if sgp.Schema != nil { - objectMap["schema"] = sgp.Schema - } - if sgp.UsePrivateLinkConnection != nil { - objectMap["usePrivateLinkConnection"] = sgp.UsePrivateLinkConnection - } - return json.Marshal(objectMap) -} - -// SyncGroupSchema properties of sync group schema. -type SyncGroupSchema struct { - // Tables - List of tables in sync group schema. - Tables *[]SyncGroupSchemaTable `json:"tables,omitempty"` - // MasterSyncMemberName - Name of master sync member where the schema is from. - MasterSyncMemberName *string `json:"masterSyncMemberName,omitempty"` -} - -// SyncGroupSchemaTable properties of table in sync group schema. -type SyncGroupSchemaTable struct { - // Columns - List of columns in sync group schema. - Columns *[]SyncGroupSchemaTableColumn `json:"columns,omitempty"` - // QuotedName - Quoted name of sync group schema table. - QuotedName *string `json:"quotedName,omitempty"` -} - -// SyncGroupSchemaTableColumn properties of column in sync group table. -type SyncGroupSchemaTableColumn struct { - // QuotedName - Quoted name of sync group table column. - QuotedName *string `json:"quotedName,omitempty"` - // DataSize - Data size of the column. - DataSize *string `json:"dataSize,omitempty"` - // DataType - Data type of the column. - DataType *string `json:"dataType,omitempty"` -} - -// SyncGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncGroupsClient) (SyncGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncGroupsCreateOrUpdateFuture) 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 SyncGroupsCreateOrUpdateFuture.Result. -func (future *SyncGroupsCreateOrUpdateFuture) result(client SyncGroupsClient) (sg SyncGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { - sg, err = client.CreateOrUpdateResponder(sg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") - } - } - return -} - -// SyncGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncGroupsDeleteFuture) 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 SyncGroupsDeleteFuture.Result. -func (future *SyncGroupsDeleteFuture) result(client SyncGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncGroupsRefreshHubSchemaFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncGroupsRefreshHubSchemaFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncGroupsRefreshHubSchemaFuture) 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 SyncGroupsRefreshHubSchemaFuture.Result. -func (future *SyncGroupsRefreshHubSchemaFuture) result(client SyncGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsRefreshHubSchemaFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsRefreshHubSchemaFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncGroupsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncGroupsClient) (SyncGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncGroupsUpdateFuture) 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 SyncGroupsUpdateFuture.Result. -func (future *SyncGroupsUpdateFuture) result(client SyncGroupsClient) (sg SyncGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { - sg, err = client.UpdateResponder(sg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") - } - } - return -} - -// SyncMember an Azure SQL Database sync member. -type SyncMember struct { - autorest.Response `json:"-"` - // SyncMemberProperties - Resource properties. - *SyncMemberProperties `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"` -} - -// MarshalJSON is the custom marshaler for SyncMember. -func (sm SyncMember) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sm.SyncMemberProperties != nil { - objectMap["properties"] = sm.SyncMemberProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SyncMember struct. -func (sm *SyncMember) 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 syncMemberProperties SyncMemberProperties - err = json.Unmarshal(*v, &syncMemberProperties) - if err != nil { - return err - } - sm.SyncMemberProperties = &syncMemberProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sm.Type = &typeVar - } - } - } - - return nil -} - -// SyncMemberListResult a list of Azure SQL Database sync members. -type SyncMemberListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SyncMember `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncMemberListResult. -func (smlr SyncMemberListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncMemberListResultIterator provides access to a complete listing of SyncMember values. -type SyncMemberListResultIterator struct { - i int - page SyncMemberListResultPage -} - -// 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 *SyncMemberListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMemberListResultIterator.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 *SyncMemberListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SyncMemberListResultIterator) 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 SyncMemberListResultIterator) Response() SyncMemberListResult { - 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 SyncMemberListResultIterator) Value() SyncMember { - if !iter.page.NotDone() { - return SyncMember{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SyncMemberListResultIterator type. -func NewSyncMemberListResultIterator(page SyncMemberListResultPage) SyncMemberListResultIterator { - return SyncMemberListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (smlr SyncMemberListResult) IsEmpty() bool { - return smlr.Value == nil || len(*smlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (smlr SyncMemberListResult) hasNextLink() bool { - return smlr.NextLink != nil && len(*smlr.NextLink) != 0 -} - -// syncMemberListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (smlr SyncMemberListResult) syncMemberListResultPreparer(ctx context.Context) (*http.Request, error) { - if !smlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(smlr.NextLink))) -} - -// SyncMemberListResultPage contains a page of SyncMember values. -type SyncMemberListResultPage struct { - fn func(context.Context, SyncMemberListResult) (SyncMemberListResult, error) - smlr SyncMemberListResult -} - -// 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 *SyncMemberListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMemberListResultPage.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.smlr) - if err != nil { - return err - } - page.smlr = 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 *SyncMemberListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SyncMemberListResultPage) NotDone() bool { - return !page.smlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SyncMemberListResultPage) Response() SyncMemberListResult { - return page.smlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SyncMemberListResultPage) Values() []SyncMember { - if page.smlr.IsEmpty() { - return nil - } - return *page.smlr.Value -} - -// Creates a new instance of the SyncMemberListResultPage type. -func NewSyncMemberListResultPage(cur SyncMemberListResult, getNextPage func(context.Context, SyncMemberListResult) (SyncMemberListResult, error)) SyncMemberListResultPage { - return SyncMemberListResultPage{ - fn: getNextPage, - smlr: cur, - } -} - -// SyncMemberProperties properties of a sync member. -type SyncMemberProperties struct { - // DatabaseType - Database type of the sync member. Possible values include: 'AzureSQLDatabase', 'SQLServerDatabase' - DatabaseType SyncMemberDbType `json:"databaseType,omitempty"` - // SyncAgentID - ARM resource id of the sync agent in the sync member. - SyncAgentID *string `json:"syncAgentId,omitempty"` - // SQLServerDatabaseID - SQL Server database id of the sync member. - SQLServerDatabaseID *uuid.UUID `json:"sqlServerDatabaseId,omitempty"` - // SyncMemberAzureDatabaseResourceID - ARM resource id of the sync member logical database, for sync members in Azure. - SyncMemberAzureDatabaseResourceID *string `json:"syncMemberAzureDatabaseResourceId,omitempty"` - // UsePrivateLinkConnection - Whether to use private link connection. - UsePrivateLinkConnection *bool `json:"usePrivateLinkConnection,omitempty"` - // PrivateEndpointName - READ-ONLY; Private endpoint name of the sync member if use private link connection is enabled, for sync members in Azure. - PrivateEndpointName *string `json:"privateEndpointName,omitempty"` - // ServerName - Server name of the member database in the sync member - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - Database name of the member database in the sync member. - DatabaseName *string `json:"databaseName,omitempty"` - // UserName - User name of the member database in the sync member. - UserName *string `json:"userName,omitempty"` - // Password - Password of the member database in the sync member. - Password *string `json:"password,omitempty"` - // SyncDirection - Sync direction of the sync member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember' - SyncDirection SyncDirection `json:"syncDirection,omitempty"` - // SyncState - READ-ONLY; Sync state of the sync member. Possible values include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', 'DisabledTombstoneCleanup', 'DisabledBackupRestore', 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned' - SyncState SyncMemberState `json:"syncState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncMemberProperties. -func (smp SyncMemberProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smp.DatabaseType != "" { - objectMap["databaseType"] = smp.DatabaseType - } - if smp.SyncAgentID != nil { - objectMap["syncAgentId"] = smp.SyncAgentID - } - if smp.SQLServerDatabaseID != nil { - objectMap["sqlServerDatabaseId"] = smp.SQLServerDatabaseID - } - if smp.SyncMemberAzureDatabaseResourceID != nil { - objectMap["syncMemberAzureDatabaseResourceId"] = smp.SyncMemberAzureDatabaseResourceID - } - if smp.UsePrivateLinkConnection != nil { - objectMap["usePrivateLinkConnection"] = smp.UsePrivateLinkConnection - } - if smp.ServerName != nil { - objectMap["serverName"] = smp.ServerName - } - if smp.DatabaseName != nil { - objectMap["databaseName"] = smp.DatabaseName - } - if smp.UserName != nil { - objectMap["userName"] = smp.UserName - } - if smp.Password != nil { - objectMap["password"] = smp.Password - } - if smp.SyncDirection != "" { - objectMap["syncDirection"] = smp.SyncDirection - } - return json.Marshal(objectMap) -} - -// SyncMembersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncMembersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncMembersClient) (SyncMember, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncMembersCreateOrUpdateFuture) 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 SyncMembersCreateOrUpdateFuture.Result. -func (future *SyncMembersCreateOrUpdateFuture) result(client SyncMembersClient) (sm SyncMember, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncMembersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.CreateOrUpdateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// SyncMembersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncMembersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncMembersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncMembersDeleteFuture) 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 SyncMembersDeleteFuture.Result. -func (future *SyncMembersDeleteFuture) result(client SyncMembersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncMembersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncMembersRefreshMemberSchemaFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SyncMembersRefreshMemberSchemaFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncMembersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncMembersRefreshMemberSchemaFuture) 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 SyncMembersRefreshMemberSchemaFuture.Result. -func (future *SyncMembersRefreshMemberSchemaFuture) result(client SyncMembersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersRefreshMemberSchemaFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncMembersRefreshMemberSchemaFuture") - return - } - ar.Response = future.Response() - return -} - -// SyncMembersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SyncMembersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SyncMembersClient) (SyncMember, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SyncMembersUpdateFuture) 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 SyncMembersUpdateFuture.Result. -func (future *SyncMembersUpdateFuture) result(client SyncMembersClient) (sm SyncMember, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.SyncMembersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.UpdateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// TdeCertificate a TDE certificate that can be uploaded into a server. -type TdeCertificate struct { - // TdeCertificateProperties - Resource properties. - *TdeCertificateProperties `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"` -} - -// MarshalJSON is the custom marshaler for TdeCertificate. -func (tc TdeCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tc.TdeCertificateProperties != nil { - objectMap["properties"] = tc.TdeCertificateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TdeCertificate struct. -func (tc *TdeCertificate) 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 tdeCertificateProperties TdeCertificateProperties - err = json.Unmarshal(*v, &tdeCertificateProperties) - if err != nil { - return err - } - tc.TdeCertificateProperties = &tdeCertificateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tc.Type = &typeVar - } - } - } - - return nil -} - -// TdeCertificateProperties properties of a TDE certificate. -type TdeCertificateProperties struct { - // PrivateBlob - The base64 encoded certificate private blob. - PrivateBlob *string `json:"privateBlob,omitempty"` - // CertPassword - The certificate password. - CertPassword *string `json:"certPassword,omitempty"` -} - -// TdeCertificatesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TdeCertificatesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TdeCertificatesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TdeCertificatesCreateFuture) 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 TdeCertificatesCreateFuture.Result. -func (future *TdeCertificatesCreateFuture) result(client TdeCertificatesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TdeCertificatesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.TdeCertificatesCreateFuture") - return - } - ar.Response = future.Response() - return -} - -// TrackedResource 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"` -} - -// 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) -} - -// TransparentDataEncryption represents a database transparent data encryption configuration. -type TransparentDataEncryption struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // TransparentDataEncryptionProperties - Represents the properties of the resource. - *TransparentDataEncryptionProperties `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"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryption. -func (tde TransparentDataEncryption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tde.TransparentDataEncryptionProperties != nil { - objectMap["properties"] = tde.TransparentDataEncryptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryption struct. -func (tde *TransparentDataEncryption) 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 - } - tde.Location = &location - } - case "properties": - if v != nil { - var transparentDataEncryptionProperties TransparentDataEncryptionProperties - err = json.Unmarshal(*v, &transparentDataEncryptionProperties) - if err != nil { - return err - } - tde.TransparentDataEncryptionProperties = &transparentDataEncryptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tde.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tde.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tde.Type = &typeVar - } - } - } - - return nil -} - -// TransparentDataEncryptionActivity represents a database transparent data encryption Scan. -type TransparentDataEncryptionActivity struct { - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // TransparentDataEncryptionActivityProperties - Represents the properties of the resource. - *TransparentDataEncryptionActivityProperties `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"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryptionActivity. -func (tdea TransparentDataEncryptionActivity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tdea.TransparentDataEncryptionActivityProperties != nil { - objectMap["properties"] = tdea.TransparentDataEncryptionActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryptionActivity struct. -func (tdea *TransparentDataEncryptionActivity) 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 - } - tdea.Location = &location - } - case "properties": - if v != nil { - var transparentDataEncryptionActivityProperties TransparentDataEncryptionActivityProperties - err = json.Unmarshal(*v, &transparentDataEncryptionActivityProperties) - if err != nil { - return err - } - tdea.TransparentDataEncryptionActivityProperties = &transparentDataEncryptionActivityProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tdea.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tdea.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tdea.Type = &typeVar - } - } - } - - return nil -} - -// TransparentDataEncryptionActivityListResult represents the response to a list database transparent data -// encryption activity request. -type TransparentDataEncryptionActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of database transparent data encryption activities. - Value *[]TransparentDataEncryptionActivity `json:"value,omitempty"` -} - -// TransparentDataEncryptionActivityProperties represents the properties of a database transparent data -// encryption Scan. -type TransparentDataEncryptionActivityProperties struct { - // Status - READ-ONLY; The status of the database. Possible values include: 'Encrypting', 'Decrypting' - Status TransparentDataEncryptionActivityStatus `json:"status,omitempty"` - // PercentComplete - READ-ONLY; The percent complete of the transparent data encryption scan for a database. - PercentComplete *float64 `json:"percentComplete,omitempty"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryptionActivityProperties. -func (tdeap TransparentDataEncryptionActivityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TransparentDataEncryptionProperties represents the properties of a database transparent data encryption. -type TransparentDataEncryptionProperties struct { - // Status - The status of the database transparent data encryption. Possible values include: 'TransparentDataEncryptionStatusEnabled', 'TransparentDataEncryptionStatusDisabled' - Status TransparentDataEncryptionStatus `json:"status,omitempty"` -} - -// UnlinkParameters represents the parameters for Unlink Replication Link request. -type UnlinkParameters struct { - // ForcedTermination - Determines whether link will be terminated in a forced or a friendly way. - ForcedTermination *bool `json:"forcedTermination,omitempty"` -} - -// UpsertManagedServerOperationParameters ... -type UpsertManagedServerOperationParameters struct { - Family *string `json:"family,omitempty"` - Tier *string `json:"tier,omitempty"` - VCores *int32 `json:"vCores,omitempty"` - StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"` -} - -// UpsertManagedServerOperationStep ... -type UpsertManagedServerOperationStep struct { - Order *int32 `json:"order,omitempty"` - Name *string `json:"name,omitempty"` - // Status - Possible values include: 'StatusNotStarted', 'StatusInProgress', 'StatusSlowedDown', 'StatusCompleted', 'StatusFailed', 'StatusCanceled' - Status Status `json:"status,omitempty"` -} - -// Usage ARM usage. -type Usage struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *Name `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Unit - READ-ONLY; Usage unit. - Unit *string `json:"unit,omitempty"` - // CurrentValue - READ-ONLY; Usage current value. - CurrentValue *int32 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; Usage limit. - Limit *int32 `json:"limit,omitempty"` - // RequestedLimit - READ-ONLY; Usage requested limit. - RequestedLimit *int32 `json:"requestedLimit,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UsageListResult a list of usages. -type UsageListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Usage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsageListResult. -func (ulr UsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UsageListResultIterator provides access to a complete listing of Usage values. -type UsageListResultIterator struct { - i int - page UsageListResultPage -} - -// 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 *UsageListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResultIterator.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 *UsageListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UsageListResultIterator) 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 UsageListResultIterator) Response() UsageListResult { - 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 UsageListResultIterator) Value() Usage { - if !iter.page.NotDone() { - return Usage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UsageListResultIterator type. -func NewUsageListResultIterator(page UsageListResultPage) UsageListResultIterator { - return UsageListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ulr UsageListResult) IsEmpty() bool { - return ulr.Value == nil || len(*ulr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ulr UsageListResult) hasNextLink() bool { - return ulr.NextLink != nil && len(*ulr.NextLink) != 0 -} - -// usageListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ulr UsageListResult) usageListResultPreparer(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))) -} - -// UsageListResultPage contains a page of Usage values. -type UsageListResultPage struct { - fn func(context.Context, UsageListResult) (UsageListResult, error) - ulr UsageListResult -} - -// 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 *UsageListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResultPage.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 *UsageListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UsageListResultPage) NotDone() bool { - return !page.ulr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UsageListResultPage) Response() UsageListResult { - return page.ulr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UsageListResultPage) Values() []Usage { - if page.ulr.IsEmpty() { - return nil - } - return *page.ulr.Value -} - -// Creates a new instance of the UsageListResultPage type. -func NewUsageListResultPage(cur UsageListResult, getNextPage func(context.Context, UsageListResult) (UsageListResult, error)) UsageListResultPage { - return UsageListResultPage{ - fn: getNextPage, - ulr: cur, - } -} - -// VirtualCluster an Azure SQL virtual cluster. -type VirtualCluster struct { - autorest.Response `json:"-"` - // VirtualClusterProperties - Resource properties. - *VirtualClusterProperties `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"` -} - -// MarshalJSON is the custom marshaler for VirtualCluster. -func (vc VirtualCluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vc.VirtualClusterProperties != nil { - objectMap["properties"] = vc.VirtualClusterProperties - } - if vc.Location != nil { - objectMap["location"] = vc.Location - } - if vc.Tags != nil { - objectMap["tags"] = vc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualCluster struct. -func (vc *VirtualCluster) 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 virtualClusterProperties VirtualClusterProperties - err = json.Unmarshal(*v, &virtualClusterProperties) - if err != nil { - return err - } - vc.VirtualClusterProperties = &virtualClusterProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vc.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vc.Type = &typeVar - } - } - } - - return nil -} - -// VirtualClusterListResult a list of virtual clusters. -type VirtualClusterListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VirtualCluster `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualClusterListResult. -func (vclr VirtualClusterListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualClusterListResultIterator provides access to a complete listing of VirtualCluster values. -type VirtualClusterListResultIterator struct { - i int - page VirtualClusterListResultPage -} - -// 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 *VirtualClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClusterListResultIterator.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 *VirtualClusterListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualClusterListResultIterator) 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 VirtualClusterListResultIterator) Response() VirtualClusterListResult { - 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 VirtualClusterListResultIterator) Value() VirtualCluster { - if !iter.page.NotDone() { - return VirtualCluster{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualClusterListResultIterator type. -func NewVirtualClusterListResultIterator(page VirtualClusterListResultPage) VirtualClusterListResultIterator { - return VirtualClusterListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vclr VirtualClusterListResult) IsEmpty() bool { - return vclr.Value == nil || len(*vclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vclr VirtualClusterListResult) hasNextLink() bool { - return vclr.NextLink != nil && len(*vclr.NextLink) != 0 -} - -// virtualClusterListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vclr VirtualClusterListResult) virtualClusterListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vclr.NextLink))) -} - -// VirtualClusterListResultPage contains a page of VirtualCluster values. -type VirtualClusterListResultPage struct { - fn func(context.Context, VirtualClusterListResult) (VirtualClusterListResult, error) - vclr VirtualClusterListResult -} - -// 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 *VirtualClusterListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClusterListResultPage.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.vclr) - if err != nil { - return err - } - page.vclr = 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 *VirtualClusterListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualClusterListResultPage) NotDone() bool { - return !page.vclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualClusterListResultPage) Response() VirtualClusterListResult { - return page.vclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualClusterListResultPage) Values() []VirtualCluster { - if page.vclr.IsEmpty() { - return nil - } - return *page.vclr.Value -} - -// Creates a new instance of the VirtualClusterListResultPage type. -func NewVirtualClusterListResultPage(cur VirtualClusterListResult, getNextPage func(context.Context, VirtualClusterListResult) (VirtualClusterListResult, error)) VirtualClusterListResultPage { - return VirtualClusterListResultPage{ - fn: getNextPage, - vclr: cur, - } -} - -// VirtualClusterProperties the properties of a virtual cluster. -type VirtualClusterProperties struct { - // SubnetID - READ-ONLY; Subnet resource ID for the virtual cluster. - SubnetID *string `json:"subnetId,omitempty"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // ChildResources - READ-ONLY; List of resources in this virtual cluster. - ChildResources *[]string `json:"childResources,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualClusterProperties. -func (vcp VirtualClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcp.Family != nil { - objectMap["family"] = vcp.Family - } - return json.Marshal(objectMap) -} - -// VirtualClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualClustersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualClustersDeleteFuture) 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 VirtualClustersDeleteFuture.Result. -func (future *VirtualClustersDeleteFuture) result(client VirtualClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.VirtualClustersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualClustersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualClustersClient) (VirtualCluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualClustersUpdateFuture) 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 VirtualClustersUpdateFuture.Result. -func (future *VirtualClustersUpdateFuture) result(client VirtualClustersClient) (vc VirtualCluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.VirtualClustersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vc.Response.Response, err = future.GetResult(sender); err == nil && vc.Response.Response.StatusCode != http.StatusNoContent { - vc, err = client.UpdateResponder(vc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersUpdateFuture", "Result", vc.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualClusterUpdate an update request for an Azure SQL Database virtual cluster. -type VirtualClusterUpdate struct { - // VirtualClusterProperties - Resource properties. - *VirtualClusterProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualClusterUpdate. -func (vcu VirtualClusterUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcu.VirtualClusterProperties != nil { - objectMap["properties"] = vcu.VirtualClusterProperties - } - if vcu.Tags != nil { - objectMap["tags"] = vcu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualClusterUpdate struct. -func (vcu *VirtualClusterUpdate) 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 virtualClusterProperties VirtualClusterProperties - err = json.Unmarshal(*v, &virtualClusterProperties) - if err != nil { - return err - } - vcu.VirtualClusterProperties = &virtualClusterProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vcu.Tags = tags - } - } - } - - return nil -} - -// VirtualNetworkRule a virtual network rule. -type VirtualNetworkRule struct { - autorest.Response `json:"-"` - // VirtualNetworkRuleProperties - Resource properties. - *VirtualNetworkRuleProperties `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"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRule. -func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnr.VirtualNetworkRuleProperties != nil { - objectMap["properties"] = vnr.VirtualNetworkRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. -func (vnr *VirtualNetworkRule) 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 virtualNetworkRuleProperties VirtualNetworkRuleProperties - err = json.Unmarshal(*v, &virtualNetworkRuleProperties) - if err != nil { - return err - } - vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vnr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vnr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vnr.Type = &typeVar - } - } - } - - return nil -} - -// VirtualNetworkRuleListResult a list of virtual network rules. -type VirtualNetworkRuleListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VirtualNetworkRule `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleListResult. -func (vnrlr VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. -type VirtualNetworkRuleListResultIterator struct { - i int - page VirtualNetworkRuleListResultPage -} - -// 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 *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.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 *VirtualNetworkRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkRuleListResultIterator) 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 VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { - 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 VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { - if !iter.page.NotDone() { - return VirtualNetworkRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkRuleListResultIterator type. -func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator { - return VirtualNetworkRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { - return vnrlr.Value == nil || len(*vnrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnrlr VirtualNetworkRuleListResult) hasNextLink() bool { - return vnrlr.NextLink != nil && len(*vnrlr.NextLink) != 0 -} - -// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnrlr.NextLink))) -} - -// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. -type VirtualNetworkRuleListResultPage struct { - fn func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) - vnrlr VirtualNetworkRuleListResult -} - -// 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 *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.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.vnrlr) - if err != nil { - return err - } - page.vnrlr = 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 *VirtualNetworkRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkRuleListResultPage) NotDone() bool { - return !page.vnrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { - return page.vnrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { - if page.vnrlr.IsEmpty() { - return nil - } - return *page.vnrlr.Value -} - -// Creates a new instance of the VirtualNetworkRuleListResultPage type. -func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage { - return VirtualNetworkRuleListResultPage{ - fn: getNextPage, - vnrlr: cur, - } -} - -// VirtualNetworkRuleProperties properties of a virtual network rule. -type VirtualNetworkRuleProperties struct { - // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. - VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` - // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` - // State - READ-ONLY; Virtual Network Rule State. Possible values include: 'VirtualNetworkRuleStateInitializing', 'VirtualNetworkRuleStateInProgress', 'VirtualNetworkRuleStateReady', 'VirtualNetworkRuleStateDeleting', 'VirtualNetworkRuleStateUnknown' - State VirtualNetworkRuleState `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleProperties. -func (vnrp VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnrp.VirtualNetworkSubnetID != nil { - objectMap["virtualNetworkSubnetId"] = vnrp.VirtualNetworkSubnetID - } - if vnrp.IgnoreMissingVnetServiceEndpoint != nil { - objectMap["ignoreMissingVnetServiceEndpoint"] = vnrp.IgnoreMissingVnetServiceEndpoint - } - return json.Marshal(objectMap) -} - -// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (VirtualNetworkRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) 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 VirtualNetworkRulesCreateOrUpdateFuture.Result. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vnr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { - vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesDeleteFuture) 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 VirtualNetworkRulesDeleteFuture.Result. -func (future *VirtualNetworkRulesDeleteFuture) result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VulnerabilityAssessmentRecurringScansProperties properties of a Vulnerability Assessment recurring -// scans. -type VulnerabilityAssessmentRecurringScansProperties struct { - // IsEnabled - Recurring scans state. - IsEnabled *bool `json:"isEnabled,omitempty"` - // EmailSubscriptionAdmins - Specifies that the schedule scan notification will be is sent to the subscription administrators. - EmailSubscriptionAdmins *bool `json:"emailSubscriptionAdmins,omitempty"` - // Emails - Specifies an array of e-mail addresses to which the scan notification is sent. - Emails *[]string `json:"emails,omitempty"` -} - -// VulnerabilityAssessmentScanError properties of a vulnerability assessment scan error. -type VulnerabilityAssessmentScanError struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanError. -func (vase VulnerabilityAssessmentScanError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VulnerabilityAssessmentScanRecord a vulnerability assessment scan record. -type VulnerabilityAssessmentScanRecord struct { - autorest.Response `json:"-"` - // VulnerabilityAssessmentScanRecordProperties - Resource properties. - *VulnerabilityAssessmentScanRecordProperties `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"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecord. -func (vasr VulnerabilityAssessmentScanRecord) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vasr.VulnerabilityAssessmentScanRecordProperties != nil { - objectMap["properties"] = vasr.VulnerabilityAssessmentScanRecordProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VulnerabilityAssessmentScanRecord struct. -func (vasr *VulnerabilityAssessmentScanRecord) 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 vulnerabilityAssessmentScanRecordProperties VulnerabilityAssessmentScanRecordProperties - err = json.Unmarshal(*v, &vulnerabilityAssessmentScanRecordProperties) - if err != nil { - return err - } - vasr.VulnerabilityAssessmentScanRecordProperties = &vulnerabilityAssessmentScanRecordProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vasr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vasr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vasr.Type = &typeVar - } - } - } - - return nil -} - -// VulnerabilityAssessmentScanRecordListResult a list of vulnerability assessment scan records. -type VulnerabilityAssessmentScanRecordListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VulnerabilityAssessmentScanRecord `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecordListResult. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VulnerabilityAssessmentScanRecordListResultIterator provides access to a complete listing of -// VulnerabilityAssessmentScanRecord values. -type VulnerabilityAssessmentScanRecordListResultIterator struct { - i int - page VulnerabilityAssessmentScanRecordListResultPage -} - -// 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 *VulnerabilityAssessmentScanRecordListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VulnerabilityAssessmentScanRecordListResultIterator.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 *VulnerabilityAssessmentScanRecordListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VulnerabilityAssessmentScanRecordListResultIterator) 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 VulnerabilityAssessmentScanRecordListResultIterator) Response() VulnerabilityAssessmentScanRecordListResult { - 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 VulnerabilityAssessmentScanRecordListResultIterator) Value() VulnerabilityAssessmentScanRecord { - if !iter.page.NotDone() { - return VulnerabilityAssessmentScanRecord{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VulnerabilityAssessmentScanRecordListResultIterator type. -func NewVulnerabilityAssessmentScanRecordListResultIterator(page VulnerabilityAssessmentScanRecordListResultPage) VulnerabilityAssessmentScanRecordListResultIterator { - return VulnerabilityAssessmentScanRecordListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) IsEmpty() bool { - return vasrlr.Value == nil || len(*vasrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) hasNextLink() bool { - return vasrlr.NextLink != nil && len(*vasrlr.NextLink) != 0 -} - -// vulnerabilityAssessmentScanRecordListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) vulnerabilityAssessmentScanRecordListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vasrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vasrlr.NextLink))) -} - -// VulnerabilityAssessmentScanRecordListResultPage contains a page of VulnerabilityAssessmentScanRecord -// values. -type VulnerabilityAssessmentScanRecordListResultPage struct { - fn func(context.Context, VulnerabilityAssessmentScanRecordListResult) (VulnerabilityAssessmentScanRecordListResult, error) - vasrlr VulnerabilityAssessmentScanRecordListResult -} - -// 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 *VulnerabilityAssessmentScanRecordListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VulnerabilityAssessmentScanRecordListResultPage.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.vasrlr) - if err != nil { - return err - } - page.vasrlr = 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 *VulnerabilityAssessmentScanRecordListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VulnerabilityAssessmentScanRecordListResultPage) NotDone() bool { - return !page.vasrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VulnerabilityAssessmentScanRecordListResultPage) Response() VulnerabilityAssessmentScanRecordListResult { - return page.vasrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VulnerabilityAssessmentScanRecordListResultPage) Values() []VulnerabilityAssessmentScanRecord { - if page.vasrlr.IsEmpty() { - return nil - } - return *page.vasrlr.Value -} - -// Creates a new instance of the VulnerabilityAssessmentScanRecordListResultPage type. -func NewVulnerabilityAssessmentScanRecordListResultPage(cur VulnerabilityAssessmentScanRecordListResult, getNextPage func(context.Context, VulnerabilityAssessmentScanRecordListResult) (VulnerabilityAssessmentScanRecordListResult, error)) VulnerabilityAssessmentScanRecordListResultPage { - return VulnerabilityAssessmentScanRecordListResultPage{ - fn: getNextPage, - vasrlr: cur, - } -} - -// VulnerabilityAssessmentScanRecordProperties properties of a vulnerability assessment scan record. -type VulnerabilityAssessmentScanRecordProperties struct { - // ScanID - READ-ONLY; The scan ID. - ScanID *string `json:"scanId,omitempty"` - // TriggerType - READ-ONLY; The scan trigger type. Possible values include: 'VulnerabilityAssessmentScanTriggerTypeOnDemand', 'VulnerabilityAssessmentScanTriggerTypeRecurring' - TriggerType VulnerabilityAssessmentScanTriggerType `json:"triggerType,omitempty"` - // State - READ-ONLY; The scan status. Possible values include: 'VulnerabilityAssessmentScanStatePassed', 'VulnerabilityAssessmentScanStateFailed', 'VulnerabilityAssessmentScanStateFailedToRun', 'VulnerabilityAssessmentScanStateInProgress' - State VulnerabilityAssessmentScanState `json:"state,omitempty"` - // StartTime - READ-ONLY; The scan start time (UTC). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The scan end time (UTC). - EndTime *date.Time `json:"endTime,omitempty"` - // Errors - READ-ONLY; The scan errors. - Errors *[]VulnerabilityAssessmentScanError `json:"errors,omitempty"` - // StorageContainerPath - READ-ONLY; The scan results storage container path. - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // NumberOfFailedSecurityChecks - READ-ONLY; The number of failed security checks. - NumberOfFailedSecurityChecks *int32 `json:"numberOfFailedSecurityChecks,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecordProperties. -func (vasrp VulnerabilityAssessmentScanRecordProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkloadClassifier workload classifier operations for a data warehouse -type WorkloadClassifier struct { - autorest.Response `json:"-"` - // WorkloadClassifierProperties - Resource properties. - *WorkloadClassifierProperties `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"` -} - -// MarshalJSON is the custom marshaler for WorkloadClassifier. -func (wc WorkloadClassifier) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wc.WorkloadClassifierProperties != nil { - objectMap["properties"] = wc.WorkloadClassifierProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkloadClassifier struct. -func (wc *WorkloadClassifier) 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 workloadClassifierProperties WorkloadClassifierProperties - err = json.Unmarshal(*v, &workloadClassifierProperties) - if err != nil { - return err - } - wc.WorkloadClassifierProperties = &workloadClassifierProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wc.Type = &typeVar - } - } - } - - return nil -} - -// WorkloadClassifierListResult a list of workload classifiers for a workload group. -type WorkloadClassifierListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]WorkloadClassifier `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkloadClassifierListResult. -func (wclr WorkloadClassifierListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkloadClassifierListResultIterator provides access to a complete listing of WorkloadClassifier values. -type WorkloadClassifierListResultIterator struct { - i int - page WorkloadClassifierListResultPage -} - -// 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 *WorkloadClassifierListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifierListResultIterator.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 *WorkloadClassifierListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkloadClassifierListResultIterator) 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 WorkloadClassifierListResultIterator) Response() WorkloadClassifierListResult { - 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 WorkloadClassifierListResultIterator) Value() WorkloadClassifier { - if !iter.page.NotDone() { - return WorkloadClassifier{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkloadClassifierListResultIterator type. -func NewWorkloadClassifierListResultIterator(page WorkloadClassifierListResultPage) WorkloadClassifierListResultIterator { - return WorkloadClassifierListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wclr WorkloadClassifierListResult) IsEmpty() bool { - return wclr.Value == nil || len(*wclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wclr WorkloadClassifierListResult) hasNextLink() bool { - return wclr.NextLink != nil && len(*wclr.NextLink) != 0 -} - -// workloadClassifierListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wclr WorkloadClassifierListResult) workloadClassifierListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wclr.NextLink))) -} - -// WorkloadClassifierListResultPage contains a page of WorkloadClassifier values. -type WorkloadClassifierListResultPage struct { - fn func(context.Context, WorkloadClassifierListResult) (WorkloadClassifierListResult, error) - wclr WorkloadClassifierListResult -} - -// 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 *WorkloadClassifierListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifierListResultPage.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.wclr) - if err != nil { - return err - } - page.wclr = 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 *WorkloadClassifierListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkloadClassifierListResultPage) NotDone() bool { - return !page.wclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkloadClassifierListResultPage) Response() WorkloadClassifierListResult { - return page.wclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkloadClassifierListResultPage) Values() []WorkloadClassifier { - if page.wclr.IsEmpty() { - return nil - } - return *page.wclr.Value -} - -// Creates a new instance of the WorkloadClassifierListResultPage type. -func NewWorkloadClassifierListResultPage(cur WorkloadClassifierListResult, getNextPage func(context.Context, WorkloadClassifierListResult) (WorkloadClassifierListResult, error)) WorkloadClassifierListResultPage { - return WorkloadClassifierListResultPage{ - fn: getNextPage, - wclr: cur, - } -} - -// WorkloadClassifierProperties workload classifier definition. For more information look at -// sys.workload_management_workload_classifiers (DMV). -type WorkloadClassifierProperties struct { - // MemberName - The workload classifier member name. - MemberName *string `json:"memberName,omitempty"` - // Label - The workload classifier label. - Label *string `json:"label,omitempty"` - // Context - The workload classifier context. - Context *string `json:"context,omitempty"` - // StartTime - The workload classifier start time for classification. - StartTime *string `json:"startTime,omitempty"` - // EndTime - The workload classifier end time for classification. - EndTime *string `json:"endTime,omitempty"` - // Importance - The workload classifier importance. - Importance *string `json:"importance,omitempty"` -} - -// WorkloadClassifiersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkloadClassifiersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkloadClassifiersClient) (WorkloadClassifier, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkloadClassifiersCreateOrUpdateFuture) 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 WorkloadClassifiersCreateOrUpdateFuture.Result. -func (future *WorkloadClassifiersCreateOrUpdateFuture) result(client WorkloadClassifiersClient) (wc WorkloadClassifier, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - wc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.WorkloadClassifiersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if wc.Response.Response, err = future.GetResult(sender); err == nil && wc.Response.Response.StatusCode != http.StatusNoContent { - wc, err = client.CreateOrUpdateResponder(wc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersCreateOrUpdateFuture", "Result", wc.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkloadClassifiersDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkloadClassifiersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkloadClassifiersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkloadClassifiersDeleteFuture) 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 WorkloadClassifiersDeleteFuture.Result. -func (future *WorkloadClassifiersDeleteFuture) result(client WorkloadClassifiersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.WorkloadClassifiersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WorkloadGroup workload group operations for a data warehouse -type WorkloadGroup struct { - autorest.Response `json:"-"` - // WorkloadGroupProperties - Resource properties. - *WorkloadGroupProperties `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"` -} - -// MarshalJSON is the custom marshaler for WorkloadGroup. -func (wg WorkloadGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wg.WorkloadGroupProperties != nil { - objectMap["properties"] = wg.WorkloadGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkloadGroup struct. -func (wg *WorkloadGroup) 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 workloadGroupProperties WorkloadGroupProperties - err = json.Unmarshal(*v, &workloadGroupProperties) - if err != nil { - return err - } - wg.WorkloadGroupProperties = &workloadGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wg.Type = &typeVar - } - } - } - - return nil -} - -// WorkloadGroupListResult a list of workload groups. -type WorkloadGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]WorkloadGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkloadGroupListResult. -func (wglr WorkloadGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkloadGroupListResultIterator provides access to a complete listing of WorkloadGroup values. -type WorkloadGroupListResultIterator struct { - i int - page WorkloadGroupListResultPage -} - -// 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 *WorkloadGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupListResultIterator.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 *WorkloadGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkloadGroupListResultIterator) 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 WorkloadGroupListResultIterator) Response() WorkloadGroupListResult { - 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 WorkloadGroupListResultIterator) Value() WorkloadGroup { - if !iter.page.NotDone() { - return WorkloadGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkloadGroupListResultIterator type. -func NewWorkloadGroupListResultIterator(page WorkloadGroupListResultPage) WorkloadGroupListResultIterator { - return WorkloadGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wglr WorkloadGroupListResult) IsEmpty() bool { - return wglr.Value == nil || len(*wglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wglr WorkloadGroupListResult) hasNextLink() bool { - return wglr.NextLink != nil && len(*wglr.NextLink) != 0 -} - -// workloadGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wglr WorkloadGroupListResult) workloadGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wglr.NextLink))) -} - -// WorkloadGroupListResultPage contains a page of WorkloadGroup values. -type WorkloadGroupListResultPage struct { - fn func(context.Context, WorkloadGroupListResult) (WorkloadGroupListResult, error) - wglr WorkloadGroupListResult -} - -// 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 *WorkloadGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupListResultPage.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.wglr) - if err != nil { - return err - } - page.wglr = 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 *WorkloadGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkloadGroupListResultPage) NotDone() bool { - return !page.wglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkloadGroupListResultPage) Response() WorkloadGroupListResult { - return page.wglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkloadGroupListResultPage) Values() []WorkloadGroup { - if page.wglr.IsEmpty() { - return nil - } - return *page.wglr.Value -} - -// Creates a new instance of the WorkloadGroupListResultPage type. -func NewWorkloadGroupListResultPage(cur WorkloadGroupListResult, getNextPage func(context.Context, WorkloadGroupListResult) (WorkloadGroupListResult, error)) WorkloadGroupListResultPage { - return WorkloadGroupListResultPage{ - fn: getNextPage, - wglr: cur, - } -} - -// WorkloadGroupProperties workload group definition. For more information look at -// sys.workload_management_workload_groups (DMV). -type WorkloadGroupProperties struct { - // MinResourcePercent - The workload group minimum percentage resource. - MinResourcePercent *int32 `json:"minResourcePercent,omitempty"` - // MaxResourcePercent - The workload group cap percentage resource. - MaxResourcePercent *int32 `json:"maxResourcePercent,omitempty"` - // MinResourcePercentPerRequest - The workload group request minimum grant percentage. - MinResourcePercentPerRequest *float64 `json:"minResourcePercentPerRequest,omitempty"` - // MaxResourcePercentPerRequest - The workload group request maximum grant percentage. - MaxResourcePercentPerRequest *float64 `json:"maxResourcePercentPerRequest,omitempty"` - // Importance - The workload group importance level. - Importance *string `json:"importance,omitempty"` - // QueryExecutionTimeout - The workload group query execution timeout. - QueryExecutionTimeout *int32 `json:"queryExecutionTimeout,omitempty"` -} - -// WorkloadGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkloadGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkloadGroupsClient) (WorkloadGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkloadGroupsCreateOrUpdateFuture) 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 WorkloadGroupsCreateOrUpdateFuture.Result. -func (future *WorkloadGroupsCreateOrUpdateFuture) result(client WorkloadGroupsClient) (wg WorkloadGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - wg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.WorkloadGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if wg.Response.Response, err = future.GetResult(sender); err == nil && wg.Response.Response.StatusCode != http.StatusNoContent { - wg, err = client.CreateOrUpdateResponder(wg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsCreateOrUpdateFuture", "Result", wg.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkloadGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WorkloadGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkloadGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkloadGroupsDeleteFuture) 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 WorkloadGroupsDeleteFuture.Result. -func (future *WorkloadGroupsDeleteFuture) result(client WorkloadGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.WorkloadGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/operations.go b/services/preview/sql/mgmt/v3.0/sql/operations.go deleted file mode 100644 index 8d4ac613b1ce..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/operations.go +++ /dev/null @@ -1,142 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -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 SQL 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, "sql.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, "sql.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.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-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Sql/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, "sql.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, "sql.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.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/sql/mgmt/v3.0/sql/privateendpointconnections.go b/services/preview/sql/mgmt/v3.0/sql/privateendpointconnections.go deleted file mode 100644 index d66b3e5f3f61..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/privateendpointconnections.go +++ /dev/null @@ -1,405 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Description", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("sql.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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, serverName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// ListByServer gets all private endpoint connections on a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByServer") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client PrivateEndpointConnectionsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByServerResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByServerNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/privatelinkresources.go b/services/preview/sql/mgmt/v3.0/sql/privatelinkresources.go deleted file mode 100644 index 3bc307c1f05a..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/privatelinkresources.go +++ /dev/null @@ -1,232 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a private link resource for SQL server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, serverName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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, serverName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// ListByServer gets the private link resources for SQL server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client PrivateLinkResourcesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByServer") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateLinkResourcesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.PrivateLinkResourcesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateLinkResourcesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client PrivateLinkResourcesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByServerResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByServerNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.PrivateLinkResourcesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.PrivateLinkResourcesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.PrivateLinkResourcesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/recommendedelasticpools.go b/services/preview/sql/mgmt/v3.0/sql/recommendedelasticpools.go deleted file mode 100644 index 8e0f5d7c5f24..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/recommendedelasticpools.go +++ /dev/null @@ -1,269 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RecommendedElasticPoolsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type RecommendedElasticPoolsClient struct { - BaseClient -} - -// NewRecommendedElasticPoolsClient creates an instance of the RecommendedElasticPoolsClient client. -func NewRecommendedElasticPoolsClient(subscriptionID string) RecommendedElasticPoolsClient { - return NewRecommendedElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecommendedElasticPoolsClientWithBaseURI creates an instance of the RecommendedElasticPoolsClient 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 NewRecommendedElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) RecommendedElasticPoolsClient { - return RecommendedElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a recommended elastic pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// recommendedElasticPoolName - the name of the recommended elastic pool to be retrieved. -func (client RecommendedElasticPoolsClient) Get(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendedElasticPoolsClient.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, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecommendedElasticPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}", 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 RecommendedElasticPoolsClient) 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 RecommendedElasticPoolsClient) GetResponder(resp *http.Response) (result RecommendedElasticPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns recommended elastic pools. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client RecommendedElasticPoolsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RecommendedElasticPoolListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendedElasticPoolsClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RecommendedElasticPoolsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/recommendedElasticPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RecommendedElasticPoolsClient) ListByServerResponder(resp *http.Response) (result RecommendedElasticPoolListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics returns recommended elastic pool metrics. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// recommendedElasticPoolName - the name of the recommended elastic pool to be retrieved. -func (client RecommendedElasticPoolsClient) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPoolListMetricsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendedElasticPoolsClient.ListMetrics") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListMetricsPreparer(ctx, resourceGroupName, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure responding to request") - return - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client RecommendedElasticPoolsClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client RecommendedElasticPoolsClient) ListMetricsResponder(resp *http.Response) (result RecommendedElasticPoolListMetricsResult, 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/sql/mgmt/v3.0/sql/recoverabledatabases.go b/services/preview/sql/mgmt/v3.0/sql/recoverabledatabases.go deleted file mode 100644 index ef56a498903f..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/recoverabledatabases.go +++ /dev/null @@ -1,190 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RecoverableDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type RecoverableDatabasesClient struct { - BaseClient -} - -// NewRecoverableDatabasesClient creates an instance of the RecoverableDatabasesClient client. -func NewRecoverableDatabasesClient(subscriptionID string) RecoverableDatabasesClient { - return NewRecoverableDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecoverableDatabasesClientWithBaseURI creates an instance of the RecoverableDatabasesClient 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 NewRecoverableDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RecoverableDatabasesClient { - return RecoverableDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a recoverable database, which is a resource representing a database's geo backup -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database -func (client RecoverableDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result RecoverableDatabase, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableDatabasesClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecoverableDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/recoverableDatabases/{databaseName}", 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 RecoverableDatabasesClient) 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 RecoverableDatabasesClient) GetResponder(resp *http.Response) (result RecoverableDatabase, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of recoverable databases -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client RecoverableDatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RecoverableDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableDatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableDatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RecoverableDatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/recoverableDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RecoverableDatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RecoverableDatabasesClient) ListByServerResponder(resp *http.Response) (result RecoverableDatabaseListResult, 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/sql/mgmt/v3.0/sql/recoverablemanageddatabases.go b/services/preview/sql/mgmt/v3.0/sql/recoverablemanageddatabases.go deleted file mode 100644 index e6519d2d5a1d..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/recoverablemanageddatabases.go +++ /dev/null @@ -1,231 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RecoverableManagedDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type RecoverableManagedDatabasesClient struct { - BaseClient -} - -// NewRecoverableManagedDatabasesClient creates an instance of the RecoverableManagedDatabasesClient client. -func NewRecoverableManagedDatabasesClient(subscriptionID string) RecoverableManagedDatabasesClient { - return NewRecoverableManagedDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecoverableManagedDatabasesClientWithBaseURI creates an instance of the RecoverableManagedDatabasesClient 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 NewRecoverableManagedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RecoverableManagedDatabasesClient { - return RecoverableManagedDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a recoverable managed database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client RecoverableManagedDatabasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, recoverableDatabaseName string) (result RecoverableManagedDatabase, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabasesClient.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, managedInstanceName, recoverableDatabaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecoverableManagedDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, recoverableDatabaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "recoverableDatabaseName": autorest.Encode("path", recoverableDatabaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/recoverableDatabases/{recoverableDatabaseName}", 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 RecoverableManagedDatabasesClient) 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 RecoverableManagedDatabasesClient) GetResponder(resp *http.Response) (result RecoverableManagedDatabase, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of recoverable managed databases. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client RecoverableManagedDatabasesClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result RecoverableManagedDatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabasesClient.ListByInstance") - defer func() { - sc := -1 - if result.rmdlr.Response.Response != nil { - sc = result.rmdlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.rmdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.rmdlr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.rmdlr.hasNextLink() && result.rmdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client RecoverableManagedDatabasesClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/managedInstances/{managedInstanceName}/recoverableDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client RecoverableManagedDatabasesClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client RecoverableManagedDatabasesClient) ListByInstanceResponder(resp *http.Response) (result RecoverableManagedDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client RecoverableManagedDatabasesClient) listByInstanceNextResults(ctx context.Context, lastResults RecoverableManagedDatabaseListResult) (result RecoverableManagedDatabaseListResult, err error) { - req, err := lastResults.recoverableManagedDatabaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecoverableManagedDatabasesClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client RecoverableManagedDatabasesClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result RecoverableManagedDatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableManagedDatabasesClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/replicationlinks.go b/services/preview/sql/mgmt/v3.0/sql/replicationlinks.go deleted file mode 100644 index 861e0db43427..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/replicationlinks.go +++ /dev/null @@ -1,527 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ReplicationLinksClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ReplicationLinksClient struct { - BaseClient -} - -// NewReplicationLinksClient creates an instance of the ReplicationLinksClient client. -func NewReplicationLinksClient(subscriptionID string) ReplicationLinksClient { - return NewReplicationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationLinksClientWithBaseURI creates an instance of the ReplicationLinksClient 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 NewReplicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ReplicationLinksClient { - return ReplicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes a database replication link. Cannot be done during failover. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be dropped. -// linkID - the ID of the replication link to be deleted. -func (client ReplicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ReplicationLinksClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", 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 ReplicationLinksClient) 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 ReplicationLinksClient) 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 -} - -// Failover sets which replica database is primary by failing over from the current primary replica database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be failed over. -// linkID - the ID of the replication link to be failed over. -func (client ReplicationLinksClient) Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLinksFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.Failover") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverPreparer(ctx, resourceGroupName, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client ReplicationLinksClient) FailoverPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationLinksClient) FailoverSender(req *http.Request) (future ReplicationLinksFailoverFuture, 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 -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client ReplicationLinksClient) FailoverResponder(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 -} - -// FailoverAllowDataLoss sets which replica database is primary by failing over from the current primary replica -// database. This operation might result in data loss. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be failed over. -// linkID - the ID of the replication link to be failed over. -func (client ReplicationLinksClient) FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLinksFailoverAllowDataLossFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.FailoverAllowDataLoss") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FailoverAllowDataLossPreparer(ctx, resourceGroupName, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "FailoverAllowDataLoss", nil, "Failure preparing request") - return - } - - result, err = client.FailoverAllowDataLossSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "FailoverAllowDataLoss", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverAllowDataLossPreparer prepares the FailoverAllowDataLoss request. -func (client ReplicationLinksClient) FailoverAllowDataLossPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverAllowDataLossSender sends the FailoverAllowDataLoss request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationLinksClient) FailoverAllowDataLossSender(req *http.Request) (future ReplicationLinksFailoverAllowDataLossFuture, 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 -} - -// FailoverAllowDataLossResponder handles the response to the FailoverAllowDataLoss request. The method always -// closes the http.Response Body. -func (client ReplicationLinksClient) FailoverAllowDataLossResponder(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 a database replication link. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to get the link for. -// linkID - the replication link ID to be retrieved. -func (client ReplicationLinksClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLink, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.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, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicationLinksClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", 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 ReplicationLinksClient) 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 ReplicationLinksClient) GetResponder(resp *http.Response) (result ReplicationLink, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists a database's replication links. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database to retrieve links for. -func (client ReplicationLinksClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ReplicationLinkListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ReplicationLinksClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationLinksClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ReplicationLinksClient) ListByDatabaseResponder(resp *http.Response) (result ReplicationLinkListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Unlink deletes a database replication link in forced or friendly way. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be failed over. -// linkID - the ID of the replication link to be failed over. -// parameters - the required parameters for unlinking replication link. -func (client ReplicationLinksClient) Unlink(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, parameters UnlinkParameters) (result ReplicationLinksUnlinkFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.Unlink") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UnlinkPreparer(ctx, resourceGroupName, serverName, databaseName, linkID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Unlink", nil, "Failure preparing request") - return - } - - result, err = client.UnlinkSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Unlink", result.Response(), "Failure sending request") - return - } - - return -} - -// UnlinkPreparer prepares the Unlink request. -func (client ReplicationLinksClient) UnlinkPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, parameters UnlinkParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UnlinkSender sends the Unlink request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationLinksClient) UnlinkSender(req *http.Request) (future ReplicationLinksUnlinkFuture, 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 -} - -// UnlinkResponder handles the response to the Unlink request. The method always -// closes the http.Response Body. -func (client ReplicationLinksClient) UnlinkResponder(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/preview/sql/mgmt/v3.0/sql/restorabledroppeddatabases.go b/services/preview/sql/mgmt/v3.0/sql/restorabledroppeddatabases.go deleted file mode 100644 index 7298ef0b736f..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/restorabledroppeddatabases.go +++ /dev/null @@ -1,191 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableDroppedDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type RestorableDroppedDatabasesClient struct { - BaseClient -} - -// NewRestorableDroppedDatabasesClient creates an instance of the RestorableDroppedDatabasesClient client. -func NewRestorableDroppedDatabasesClient(subscriptionID string) RestorableDroppedDatabasesClient { - return NewRestorableDroppedDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableDroppedDatabasesClientWithBaseURI creates an instance of the RestorableDroppedDatabasesClient 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 NewRestorableDroppedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableDroppedDatabasesClient { - return RestorableDroppedDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a deleted database that can be restored -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// restorableDroppededDatabaseID - the id of the deleted database in the form of -// databaseName,deletionTimeInFileTimeFormat -func (client RestorableDroppedDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (result RestorableDroppedDatabase, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedDatabasesClient.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, serverName, restorableDroppededDatabaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RestorableDroppedDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorableDroppededDatabaseId": autorest.Encode("path", restorableDroppededDatabaseID), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}", 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 RestorableDroppedDatabasesClient) 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 RestorableDroppedDatabasesClient) GetResponder(resp *http.Response) (result RestorableDroppedDatabase, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of deleted databases that can be restored -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client RestorableDroppedDatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result RestorableDroppedDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedDatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedDatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RestorableDroppedDatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/restorableDroppedDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableDroppedDatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RestorableDroppedDatabasesClient) ListByServerResponder(resp *http.Response) (result RestorableDroppedDatabaseListResult, 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/sql/mgmt/v3.0/sql/restorabledroppedmanageddatabases.go b/services/preview/sql/mgmt/v3.0/sql/restorabledroppedmanageddatabases.go deleted file mode 100644 index 38d174e46d1e..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/restorabledroppedmanageddatabases.go +++ /dev/null @@ -1,232 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableDroppedManagedDatabasesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type RestorableDroppedManagedDatabasesClient struct { - BaseClient -} - -// NewRestorableDroppedManagedDatabasesClient creates an instance of the RestorableDroppedManagedDatabasesClient -// client. -func NewRestorableDroppedManagedDatabasesClient(subscriptionID string) RestorableDroppedManagedDatabasesClient { - return NewRestorableDroppedManagedDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableDroppedManagedDatabasesClientWithBaseURI creates an instance of the -// RestorableDroppedManagedDatabasesClient 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 NewRestorableDroppedManagedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) RestorableDroppedManagedDatabasesClient { - return RestorableDroppedManagedDatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a restorable dropped managed database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client RestorableDroppedManagedDatabasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result RestorableDroppedManagedDatabase, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedManagedDatabasesClient.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, managedInstanceName, restorableDroppedDatabaseID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedManagedDatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedManagedDatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedManagedDatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RestorableDroppedManagedDatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorableDroppedDatabaseId": autorest.Encode("path", restorableDroppedDatabaseID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}", 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 RestorableDroppedManagedDatabasesClient) 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 RestorableDroppedManagedDatabasesClient) GetResponder(resp *http.Response) (result RestorableDroppedManagedDatabase, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a list of restorable dropped managed databases. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client RestorableDroppedManagedDatabasesClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result RestorableDroppedManagedDatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedManagedDatabasesClient.ListByInstance") - defer func() { - sc := -1 - if result.rdmdlr.Response.Response != nil { - sc = result.rdmdlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedManagedDatabasesClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.rdmdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedManagedDatabasesClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.rdmdlr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedManagedDatabasesClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.rdmdlr.hasNextLink() && result.rdmdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client RestorableDroppedManagedDatabasesClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableDroppedManagedDatabasesClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client RestorableDroppedManagedDatabasesClient) ListByInstanceResponder(resp *http.Response) (result RestorableDroppedManagedDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client RestorableDroppedManagedDatabasesClient) listByInstanceNextResults(ctx context.Context, lastResults RestorableDroppedManagedDatabaseListResult) (result RestorableDroppedManagedDatabaseListResult, err error) { - req, err := lastResults.restorableDroppedManagedDatabaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.RestorableDroppedManagedDatabasesClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.RestorableDroppedManagedDatabasesClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorableDroppedManagedDatabasesClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client RestorableDroppedManagedDatabasesClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result RestorableDroppedManagedDatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedManagedDatabasesClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/restorepoints.go b/services/preview/sql/mgmt/v3.0/sql/restorepoints.go deleted file mode 100644 index 6637ed2cccfb..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/restorepoints.go +++ /dev/null @@ -1,365 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorePointsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type RestorePointsClient struct { - BaseClient -} - -// NewRestorePointsClient creates an instance of the RestorePointsClient client. -func NewRestorePointsClient(subscriptionID string) RestorePointsClient { - return NewRestorePointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorePointsClientWithBaseURI creates an instance of the RestorePointsClient 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 NewRestorePointsClientWithBaseURI(baseURI string, subscriptionID string) RestorePointsClient { - return RestorePointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a restore point for a data warehouse. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the definition for creating the restore point of this database. -func (client RestorePointsClient) Create(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters CreateDatabaseRestorePointDefinition) (result RestorePointsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RestorePointLabel", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.RestorePointsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RestorePointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters CreateDatabaseRestorePointDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-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.Sql/servers/{serverName}/databases/{databaseName}/restorePoints", 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 RestorePointsClient) CreateSender(req *http.Request) (future RestorePointsCreateFuture, 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 RestorePointsClient) CreateResponder(resp *http.Response) (result RestorePoint, 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 a restore point. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// restorePointName - the name of the restore point. -func (client RestorePointsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, restorePointName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, restorePointName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RestorePointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, restorePointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorePointName": autorest.Encode("path", restorePointName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}", 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 RestorePointsClient) 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 RestorePointsClient) 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 restore point. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// restorePointName - the name of the restore point. -func (client RestorePointsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, restorePointName string) (result RestorePoint, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointsClient.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, serverName, databaseName, restorePointName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RestorePointsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, restorePointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorePointName": autorest.Encode("path", restorePointName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}", 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 RestorePointsClient) 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 RestorePointsClient) GetResponder(resp *http.Response) (result RestorePoint, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets a list of database restore points. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client RestorePointsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result RestorePointListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointsClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RestorePointsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client RestorePointsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/restorePoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client RestorePointsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client RestorePointsClient) ListByDatabaseResponder(resp *http.Response) (result RestorePointListResult, 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/sql/mgmt/v3.0/sql/sensitivitylabels.go b/services/preview/sql/mgmt/v3.0/sql/sensitivitylabels.go deleted file mode 100644 index 71a896aaaa88..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/sensitivitylabels.go +++ /dev/null @@ -1,723 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SensitivityLabelsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type SensitivityLabelsClient struct { - BaseClient -} - -// NewSensitivityLabelsClient creates an instance of the SensitivityLabelsClient client. -func NewSensitivityLabelsClient(subscriptionID string) SensitivityLabelsClient { - return NewSensitivityLabelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSensitivityLabelsClientWithBaseURI creates an instance of the SensitivityLabelsClient 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 NewSensitivityLabelsClientWithBaseURI(baseURI string, subscriptionID string) SensitivityLabelsClient { - return SensitivityLabelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// parameters - the column sensitivity label resource. -func (client SensitivityLabelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (result SensitivityLabel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.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, serverName, databaseName, schemaName, tableName, columnName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SensitivityLabelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SensitivityLabelsClient) 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 SensitivityLabelsClient) CreateOrUpdateResponder(resp *http.Response) (result SensitivityLabel, 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 sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SensitivityLabelsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SensitivityLabelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SensitivityLabelsClient) 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 SensitivityLabelsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DisableRecommendation disables sensitivity recommendations on a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SensitivityLabelsClient) DisableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.DisableRecommendation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DisableRecommendationPreparer(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "DisableRecommendation", nil, "Failure preparing request") - return - } - - resp, err := client.DisableRecommendationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "DisableRecommendation", resp, "Failure sending request") - return - } - - result, err = client.DisableRecommendationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "DisableRecommendation", resp, "Failure responding to request") - return - } - - return -} - -// DisableRecommendationPreparer prepares the DisableRecommendation request. -func (client SensitivityLabelsClient) DisableRecommendationPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "recommended"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2017-03-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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableRecommendationSender sends the DisableRecommendation request. The method will close the -// http.Response Body if it receives an error. -func (client SensitivityLabelsClient) DisableRecommendationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisableRecommendationResponder handles the response to the DisableRecommendation request. The method always -// closes the http.Response Body. -func (client SensitivityLabelsClient) DisableRecommendationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// EnableRecommendation enables sensitivity recommendations on a given column (recommendations are enabled by default -// on all columns) -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SensitivityLabelsClient) EnableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.EnableRecommendation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.EnableRecommendationPreparer(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "EnableRecommendation", nil, "Failure preparing request") - return - } - - resp, err := client.EnableRecommendationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "EnableRecommendation", resp, "Failure sending request") - return - } - - result, err = client.EnableRecommendationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "EnableRecommendation", resp, "Failure responding to request") - return - } - - return -} - -// EnableRecommendationPreparer prepares the EnableRecommendation request. -func (client SensitivityLabelsClient) EnableRecommendationPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "recommended"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2017-03-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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableRecommendationSender sends the EnableRecommendation request. The method will close the -// http.Response Body if it receives an error. -func (client SensitivityLabelsClient) EnableRecommendationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableRecommendationResponder handles the response to the EnableRecommendation request. The method always -// closes the http.Response Body. -func (client SensitivityLabelsClient) EnableRecommendationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// sensitivityLabelSource - the source of the sensitivity label. -func (client SensitivityLabelsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (result SensitivityLabel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.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, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SensitivityLabelsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", sensitivityLabelSource), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SensitivityLabelsClient) 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 SensitivityLabelsClient) GetResponder(resp *http.Response) (result SensitivityLabel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCurrentByDatabase gets the sensitivity labels of a given database -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// filter - an OData filter expression that filters elements in the collection. -func (client SensitivityLabelsClient) ListCurrentByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result SensitivityLabelListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.ListCurrentByDatabase") - defer func() { - sc := -1 - if result.sllr.Response.Response != nil { - sc = result.sllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listCurrentByDatabaseNextResults - req, err := client.ListCurrentByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListCurrentByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListCurrentByDatabaseSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListCurrentByDatabase", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListCurrentByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListCurrentByDatabase", resp, "Failure responding to request") - return - } - if result.sllr.hasNextLink() && result.sllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListCurrentByDatabasePreparer prepares the ListCurrentByDatabase request. -func (client SensitivityLabelsClient) ListCurrentByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCurrentByDatabaseSender sends the ListCurrentByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SensitivityLabelsClient) ListCurrentByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCurrentByDatabaseResponder handles the response to the ListCurrentByDatabase request. The method always -// closes the http.Response Body. -func (client SensitivityLabelsClient) ListCurrentByDatabaseResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listCurrentByDatabaseNextResults retrieves the next set of results, if any. -func (client SensitivityLabelsClient) listCurrentByDatabaseNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listCurrentByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListCurrentByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listCurrentByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListCurrentByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listCurrentByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListCurrentByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client SensitivityLabelsClient) ListCurrentByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result SensitivityLabelListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.ListCurrentByDatabase") - 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.ListCurrentByDatabase(ctx, resourceGroupName, serverName, databaseName, filter) - return -} - -// ListRecommendedByDatabase gets the sensitivity labels of a given database -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// includeDisabledRecommendations - specifies whether to include disabled recommendations or not. -// filter - an OData filter expression that filters elements in the collection. -func (client SensitivityLabelsClient) ListRecommendedByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result SensitivityLabelListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.ListRecommendedByDatabase") - defer func() { - sc := -1 - if result.sllr.Response.Response != nil { - sc = result.sllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listRecommendedByDatabaseNextResults - req, err := client.ListRecommendedByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListRecommendedByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListRecommendedByDatabaseSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListRecommendedByDatabase", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListRecommendedByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListRecommendedByDatabase", resp, "Failure responding to request") - return - } - if result.sllr.hasNextLink() && result.sllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRecommendedByDatabasePreparer prepares the ListRecommendedByDatabase request. -func (client SensitivityLabelsClient) ListRecommendedByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if includeDisabledRecommendations != nil { - queryParameters["includeDisabledRecommendations"] = autorest.Encode("query", *includeDisabledRecommendations) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - 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.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRecommendedByDatabaseSender sends the ListRecommendedByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SensitivityLabelsClient) ListRecommendedByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRecommendedByDatabaseResponder handles the response to the ListRecommendedByDatabase request. The method always -// closes the http.Response Body. -func (client SensitivityLabelsClient) ListRecommendedByDatabaseResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRecommendedByDatabaseNextResults retrieves the next set of results, if any. -func (client SensitivityLabelsClient) listRecommendedByDatabaseNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listRecommendedByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRecommendedByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listRecommendedByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRecommendedByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listRecommendedByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRecommendedByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client SensitivityLabelsClient) ListRecommendedByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result SensitivityLabelListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.ListRecommendedByDatabase") - 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.ListRecommendedByDatabase(ctx, resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/serverautomatictuning.go b/services/preview/sql/mgmt/v3.0/sql/serverautomatictuning.go deleted file mode 100644 index 6d0fd7679702..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serverautomatictuning.go +++ /dev/null @@ -1,191 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerAutomaticTuningClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ServerAutomaticTuningClient struct { - BaseClient -} - -// NewServerAutomaticTuningClient creates an instance of the ServerAutomaticTuningClient client. -func NewServerAutomaticTuningClient(subscriptionID string) ServerAutomaticTuningClient { - return NewServerAutomaticTuningClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerAutomaticTuningClientWithBaseURI creates an instance of the ServerAutomaticTuningClient 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 NewServerAutomaticTuningClientWithBaseURI(baseURI string, subscriptionID string) ServerAutomaticTuningClient { - return ServerAutomaticTuningClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieves server automatic tuning options. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAutomaticTuningClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerAutomaticTuning, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAutomaticTuningClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAutomaticTuningClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerAutomaticTuningClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAutomaticTuningClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerAutomaticTuningClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/automaticTuning/current", 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 ServerAutomaticTuningClient) 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 ServerAutomaticTuningClient) GetResponder(resp *http.Response) (result ServerAutomaticTuning, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update automatic tuning options on server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested automatic tuning resource state. -func (client ServerAutomaticTuningClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerAutomaticTuning) (result ServerAutomaticTuning, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAutomaticTuningClient.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, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAutomaticTuningClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerAutomaticTuningClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAutomaticTuningClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServerAutomaticTuningClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerAutomaticTuning) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/automaticTuning/current", 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 ServerAutomaticTuningClient) 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 ServerAutomaticTuningClient) UpdateResponder(resp *http.Response) (result ServerAutomaticTuning, 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/sql/mgmt/v3.0/sql/serverazureadadministrators.go b/services/preview/sql/mgmt/v3.0/sql/serverazureadadministrators.go deleted file mode 100644 index 8db20d8beb28..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serverazureadadministrators.go +++ /dev/null @@ -1,406 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerAzureADAdministratorsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ServerAzureADAdministratorsClient struct { - BaseClient -} - -// NewServerAzureADAdministratorsClient creates an instance of the ServerAzureADAdministratorsClient client. -func NewServerAzureADAdministratorsClient(subscriptionID string) ServerAzureADAdministratorsClient { - return NewServerAzureADAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerAzureADAdministratorsClientWithBaseURI creates an instance of the ServerAzureADAdministratorsClient 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 NewServerAzureADAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAzureADAdministratorsClient { - return ServerAzureADAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an existing Azure Active Directory administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested Azure Active Directory administrator Resource state. -func (client ServerAzureADAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerAzureADAdministrator) (result ServerAzureADAdministratorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AdministratorProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AdministratorProperties.AdministratorType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorProperties.Login", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorProperties.Sid", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.ServerAzureADAdministratorsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerAzureADAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerAzureADAdministrator) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", "ActiveDirectory"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/administrators/{administratorName}", 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 ServerAzureADAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ServerAzureADAdministratorsCreateOrUpdateFuture, 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 ServerAzureADAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerAzureADAdministrator, 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 the Azure Active Directory administrator with the given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAzureADAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADAdministratorsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerAzureADAdministratorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", "ActiveDirectory"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/administrators/{administratorName}", 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 ServerAzureADAdministratorsClient) DeleteSender(req *http.Request) (future ServerAzureADAdministratorsDeleteFuture, 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 ServerAzureADAdministratorsClient) 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 a Azure Active Directory administrator. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAzureADAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADAdministrator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerAzureADAdministratorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "administratorName": autorest.Encode("path", "ActiveDirectory"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/administrators/{administratorName}", 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 ServerAzureADAdministratorsClient) 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 ServerAzureADAdministratorsClient) GetResponder(resp *http.Response) (result ServerAzureADAdministrator, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of Azure Active Directory administrators in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAzureADAdministratorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result AdministratorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.ListByServer") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerAzureADAdministratorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/administrators", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAzureADAdministratorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerAzureADAdministratorsClient) ListByServerResponder(resp *http.Response) (result AdministratorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerAzureADAdministratorsClient) listByServerNextResults(ctx context.Context, lastResults AdministratorListResult) (result AdministratorListResult, err error) { - req, err := lastResults.administratorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerAzureADAdministratorsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result AdministratorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADAdministratorsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/serverazureadonlyauthentications.go b/services/preview/sql/mgmt/v3.0/sql/serverazureadonlyauthentications.go deleted file mode 100644 index 693e7671b543..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serverazureadonlyauthentications.go +++ /dev/null @@ -1,405 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerAzureADOnlyAuthenticationsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ServerAzureADOnlyAuthenticationsClient struct { - BaseClient -} - -// NewServerAzureADOnlyAuthenticationsClient creates an instance of the ServerAzureADOnlyAuthenticationsClient client. -func NewServerAzureADOnlyAuthenticationsClient(subscriptionID string) ServerAzureADOnlyAuthenticationsClient { - return NewServerAzureADOnlyAuthenticationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerAzureADOnlyAuthenticationsClientWithBaseURI creates an instance of the -// ServerAzureADOnlyAuthenticationsClient 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 NewServerAzureADOnlyAuthenticationsClientWithBaseURI(baseURI string, subscriptionID string) ServerAzureADOnlyAuthenticationsClient { - return ServerAzureADOnlyAuthenticationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sets Server Active Directory only authentication property or updates an existing server Active -// Directory only authentication property. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the required parameters for creating or updating an Active Directory only authentication -// property. -func (client ServerAzureADOnlyAuthenticationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerAzureADOnlyAuthentication) (result ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADOnlyAuthenticationsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AzureADOnlyAuthProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AzureADOnlyAuthProperties.AzureADOnlyAuthentication", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ServerAzureADOnlyAuthenticationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerAzureADOnlyAuthenticationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerAzureADOnlyAuthentication) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authenticationName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/servers/{serverName}/azureADOnlyAuthentications/{authenticationName}", 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 ServerAzureADOnlyAuthenticationsClient) CreateOrUpdateSender(req *http.Request) (future ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture, 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 ServerAzureADOnlyAuthenticationsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerAzureADOnlyAuthentication, 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 server Active Directory only authentication property. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAzureADOnlyAuthenticationsClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADOnlyAuthenticationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADOnlyAuthenticationsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerAzureADOnlyAuthenticationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authenticationName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/servers/{serverName}/azureADOnlyAuthentications/{authenticationName}", 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 ServerAzureADOnlyAuthenticationsClient) DeleteSender(req *http.Request) (future ServerAzureADOnlyAuthenticationsDeleteFuture, 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 ServerAzureADOnlyAuthenticationsClient) 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 a specific Azure Active Directory only authentication property. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAzureADOnlyAuthenticationsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerAzureADOnlyAuthentication, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADOnlyAuthenticationsClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerAzureADOnlyAuthenticationsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authenticationName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/servers/{serverName}/azureADOnlyAuthentications/{authenticationName}", 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 ServerAzureADOnlyAuthenticationsClient) 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 ServerAzureADOnlyAuthenticationsClient) GetResponder(resp *http.Response) (result ServerAzureADOnlyAuthentication, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of server Azure Active Directory only authentications. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerAzureADOnlyAuthenticationsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result AzureADOnlyAuthListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADOnlyAuthenticationsClient.ListByServer") - defer func() { - sc := -1 - if result.aaoalr.Response.Response != nil { - sc = result.aaoalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.aaoalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.aaoalr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.aaoalr.hasNextLink() && result.aaoalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerAzureADOnlyAuthenticationsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/servers/{serverName}/azureADOnlyAuthentications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAzureADOnlyAuthenticationsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerAzureADOnlyAuthenticationsClient) ListByServerResponder(resp *http.Response) (result AzureADOnlyAuthListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerAzureADOnlyAuthenticationsClient) listByServerNextResults(ctx context.Context, lastResults AzureADOnlyAuthListResult) (result AzureADOnlyAuthListResult, err error) { - req, err := lastResults.azureADOnlyAuthListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerAzureADOnlyAuthenticationsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerAzureADOnlyAuthenticationsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result AzureADOnlyAuthListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAzureADOnlyAuthenticationsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/serverblobauditingpolicies.go b/services/preview/sql/mgmt/v3.0/sql/serverblobauditingpolicies.go deleted file mode 100644 index 3983f9e6a879..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serverblobauditingpolicies.go +++ /dev/null @@ -1,315 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerBlobAuditingPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type ServerBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewServerBlobAuditingPoliciesClient creates an instance of the ServerBlobAuditingPoliciesClient client. -func NewServerBlobAuditingPoliciesClient(subscriptionID string) ServerBlobAuditingPoliciesClient { - return NewServerBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerBlobAuditingPoliciesClientWithBaseURI creates an instance of the ServerBlobAuditingPoliciesClient 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 NewServerBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerBlobAuditingPoliciesClient { - return ServerBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a server's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - properties of blob auditing policy -func (client ServerBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerBlobAuditingPolicy) (result ServerBlobAuditingPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName}", 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 ServerBlobAuditingPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ServerBlobAuditingPoliciesCreateOrUpdateFuture, 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 ServerBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerBlobAuditingPolicy, 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 a server's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPoliciesClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName}", 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 ServerBlobAuditingPoliciesClient) 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 ServerBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result ServerBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer lists auditing settings of a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerBlobAuditingPoliciesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPoliciesClient.ListByServer") - defer func() { - sc := -1 - if result.sbaplr.Response.Response != nil { - sc = result.sbaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.sbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.sbaplr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.sbaplr.hasNextLink() && result.sbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerBlobAuditingPoliciesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/auditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerBlobAuditingPoliciesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerBlobAuditingPoliciesClient) ListByServerResponder(resp *http.Response) (result ServerBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerBlobAuditingPoliciesClient) listByServerNextResults(ctx context.Context, lastResults ServerBlobAuditingPolicyListResult) (result ServerBlobAuditingPolicyListResult, err error) { - req, err := lastResults.serverBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerBlobAuditingPoliciesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPoliciesClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/servercommunicationlinks.go b/services/preview/sql/mgmt/v3.0/sql/servercommunicationlinks.go deleted file mode 100644 index cb24bd7204fc..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/servercommunicationlinks.go +++ /dev/null @@ -1,363 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerCommunicationLinksClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type ServerCommunicationLinksClient struct { - BaseClient -} - -// NewServerCommunicationLinksClient creates an instance of the ServerCommunicationLinksClient client. -func NewServerCommunicationLinksClient(subscriptionID string) ServerCommunicationLinksClient { - return NewServerCommunicationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerCommunicationLinksClientWithBaseURI creates an instance of the ServerCommunicationLinksClient 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 NewServerCommunicationLinksClientWithBaseURI(baseURI string, subscriptionID string) ServerCommunicationLinksClient { - return ServerCommunicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a server communication link. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// communicationLinkName - the name of the server communication link. -// parameters - the required parameters for creating a server communication link. -func (client ServerCommunicationLinksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink) (result ServerCommunicationLinksCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServerCommunicationLinkProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServerCommunicationLinkProperties.PartnerServer", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ServerCommunicationLinksClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, communicationLinkName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerCommunicationLinksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationLinkName": autorest.Encode("path", communicationLinkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.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.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", 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 ServerCommunicationLinksClient) CreateOrUpdateSender(req *http.Request) (future ServerCommunicationLinksCreateOrUpdateFuture, 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 ServerCommunicationLinksClient) CreateOrUpdateResponder(resp *http.Response) (result ServerCommunicationLink, 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 a server communication link. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// communicationLinkName - the name of the server communication link. -func (client ServerCommunicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, communicationLinkName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerCommunicationLinksClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationLinkName": autorest.Encode("path", communicationLinkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", 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 ServerCommunicationLinksClient) 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 ServerCommunicationLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a server communication link. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// communicationLinkName - the name of the server communication link. -func (client ServerCommunicationLinksClient) Get(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result ServerCommunicationLink, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.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, serverName, communicationLinkName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerCommunicationLinksClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationLinkName": autorest.Encode("path", communicationLinkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}", 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 ServerCommunicationLinksClient) 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 ServerCommunicationLinksClient) GetResponder(resp *http.Response) (result ServerCommunicationLink, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of server communication links. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerCommunicationLinksClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerCommunicationLinkListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerCommunicationLinksClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerCommunicationLinksClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/communicationLinks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerCommunicationLinksClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerCommunicationLinksClient) ListByServerResponder(resp *http.Response) (result ServerCommunicationLinkListResult, 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/sql/mgmt/v3.0/sql/serverconnectionpolicies.go b/services/preview/sql/mgmt/v3.0/sql/serverconnectionpolicies.go deleted file mode 100644 index fd714db39b75..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serverconnectionpolicies.go +++ /dev/null @@ -1,195 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerConnectionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type ServerConnectionPoliciesClient struct { - BaseClient -} - -// NewServerConnectionPoliciesClient creates an instance of the ServerConnectionPoliciesClient client. -func NewServerConnectionPoliciesClient(subscriptionID string) ServerConnectionPoliciesClient { - return NewServerConnectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerConnectionPoliciesClientWithBaseURI creates an instance of the ServerConnectionPoliciesClient 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 NewServerConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerConnectionPoliciesClient { - return ServerConnectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the server's connection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the required parameters for updating a secure connection policy. -func (client ServerConnectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (result ServerConnectionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPoliciesClient.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, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerConnectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectionPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}", 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 ServerConnectionPoliciesClient) 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 ServerConnectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerConnectionPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the server's secure connection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerConnectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerConnectionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPoliciesClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerConnectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectionPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}", 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 ServerConnectionPoliciesClient) 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 ServerConnectionPoliciesClient) GetResponder(resp *http.Response) (result ServerConnectionPolicy, 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/sql/mgmt/v3.0/sql/serverdnsaliases.go b/services/preview/sql/mgmt/v3.0/sql/serverdnsaliases.go deleted file mode 100644 index 8304dd7bfbbe..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serverdnsaliases.go +++ /dev/null @@ -1,478 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerDNSAliasesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ServerDNSAliasesClient struct { - BaseClient -} - -// NewServerDNSAliasesClient creates an instance of the ServerDNSAliasesClient client. -func NewServerDNSAliasesClient(subscriptionID string) ServerDNSAliasesClient { - return NewServerDNSAliasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerDNSAliasesClientWithBaseURI creates an instance of the ServerDNSAliasesClient 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 NewServerDNSAliasesClientWithBaseURI(baseURI string, subscriptionID string) ServerDNSAliasesClient { - return ServerDNSAliasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Acquire acquires server DNS alias from another server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server that the alias is pointing to. -// DNSAliasName - the name of the server dns alias. -func (client ServerDNSAliasesClient) Acquire(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string, parameters ServerDNSAliasAcquisition) (result ServerDNSAliasesAcquireFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasesClient.Acquire") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AcquirePreparer(ctx, resourceGroupName, serverName, DNSAliasName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "Acquire", nil, "Failure preparing request") - return - } - - result, err = client.AcquireSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "Acquire", result.Response(), "Failure sending request") - return - } - - return -} - -// AcquirePreparer prepares the Acquire request. -func (client ServerDNSAliasesClient) AcquirePreparer(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string, parameters ServerDNSAliasAcquisition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dnsAliasName": autorest.Encode("path", DNSAliasName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-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.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}/acquire", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AcquireSender sends the Acquire request. The method will close the -// http.Response Body if it receives an error. -func (client ServerDNSAliasesClient) AcquireSender(req *http.Request) (future ServerDNSAliasesAcquireFuture, 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 -} - -// AcquireResponder handles the response to the Acquire request. The method always -// closes the http.Response Body. -func (client ServerDNSAliasesClient) AcquireResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates a server dns alias. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server that the alias is pointing to. -// DNSAliasName - the name of the server DNS alias. -func (client ServerDNSAliasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string) (result ServerDNSAliasesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, DNSAliasName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerDNSAliasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dnsAliasName": autorest.Encode("path", DNSAliasName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}", pathParameters), - 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 ServerDNSAliasesClient) CreateOrUpdateSender(req *http.Request) (future ServerDNSAliasesCreateOrUpdateFuture, 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 ServerDNSAliasesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerDNSAlias, 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 the server DNS alias with the given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server that the alias is pointing to. -// DNSAliasName - the name of the server DNS alias. -func (client ServerDNSAliasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string) (result ServerDNSAliasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, DNSAliasName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerDNSAliasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dnsAliasName": autorest.Encode("path", DNSAliasName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}", 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 ServerDNSAliasesClient) DeleteSender(req *http.Request) (future ServerDNSAliasesDeleteFuture, 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 ServerDNSAliasesClient) 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 a server DNS alias. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server that the alias is pointing to. -// DNSAliasName - the name of the server DNS alias. -func (client ServerDNSAliasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string) (result ServerDNSAlias, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasesClient.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, serverName, DNSAliasName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerDNSAliasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dnsAliasName": autorest.Encode("path", DNSAliasName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}", 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 ServerDNSAliasesClient) 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 ServerDNSAliasesClient) GetResponder(resp *http.Response) (result ServerDNSAlias, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of server DNS aliases for a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server that the alias is pointing to. -func (client ServerDNSAliasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerDNSAliasListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasesClient.ListByServer") - defer func() { - sc := -1 - if result.sdalr.Response.Response != nil { - sc = result.sdalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.sdalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.sdalr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.sdalr.hasNextLink() && result.sdalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerDNSAliasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/dnsAliases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerDNSAliasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerDNSAliasesClient) ListByServerResponder(resp *http.Response) (result ServerDNSAliasListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerDNSAliasesClient) listByServerNextResults(ctx context.Context, lastResults ServerDNSAliasListResult) (result ServerDNSAliasListResult, err error) { - req, err := lastResults.serverDNSAliasListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerDNSAliasesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerDNSAliasListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasesClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/serverkeys.go b/services/preview/sql/mgmt/v3.0/sql/serverkeys.go deleted file mode 100644 index 54c560060bb9..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serverkeys.go +++ /dev/null @@ -1,401 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerKeysClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type ServerKeysClient struct { - BaseClient -} - -// NewServerKeysClient creates an instance of the ServerKeysClient client. -func NewServerKeysClient(subscriptionID string) ServerKeysClient { - return NewServerKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerKeysClientWithBaseURI creates an instance of the ServerKeysClient 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 NewServerKeysClientWithBaseURI(baseURI string, subscriptionID string) ServerKeysClient { - return ServerKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a server key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// keyName - the name of the server key to be operated on (updated or created). The key name is required to be -// in the format of 'vault_key_version'. For example, if the keyId is -// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key -// name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 -// parameters - the requested server key resource state. -func (client ServerKeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, keyName string, parameters ServerKey) (result ServerKeysCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, keyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerKeysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string, parameters ServerKey) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = 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.Sql/servers/{serverName}/keys/{keyName}", 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 ServerKeysClient) CreateOrUpdateSender(req *http.Request) (future ServerKeysCreateOrUpdateFuture, 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 ServerKeysClient) CreateOrUpdateResponder(resp *http.Response) (result ServerKey, 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 the server key with the given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// keyName - the name of the server key to be deleted. -func (client ServerKeysClient) Delete(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result ServerKeysDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerKeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/keys/{keyName}", 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 ServerKeysClient) DeleteSender(req *http.Request) (future ServerKeysDeleteFuture, 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 ServerKeysClient) 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 a server key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// keyName - the name of the server key to be retrieved. -func (client ServerKeysClient) Get(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result ServerKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.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, serverName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/keys/{keyName}", 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 ServerKeysClient) 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 ServerKeysClient) GetResponder(resp *http.Response) (result ServerKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of server keys. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerKeysClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.ListByServer") - defer func() { - sc := -1 - if result.sklr.Response.Response != nil { - sc = result.sklr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.sklr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "ListByServer", resp, "Failure sending request") - return - } - - result.sklr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.sklr.hasNextLink() && result.sklr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerKeysClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/keys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) ListByServerResponder(resp *http.Response) (result ServerKeyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerKeysClient) listByServerNextResults(ctx context.Context, lastResults ServerKeyListResult) (result ServerKeyListResult, err error) { - req, err := lastResults.serverKeyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerKeysClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerKeysClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerKeysClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerKeysClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/servers.go b/services/preview/sql/mgmt/v3.0/sql/servers.go deleted file mode 100644 index 021195c9ab5e..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/servers.go +++ /dev/null @@ -1,761 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServersClient is the the Azure SQL Database management API provides a RESTful set of web services that interact with -// Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete -// databases. -type ServersClient struct { - BaseClient -} - -// NewServersClient creates an instance of the ServersClient client. -func NewServersClient(subscriptionID string) ServersClient { - return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServersClientWithBaseURI creates an instance of the ServersClient 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 NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { - return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability determines whether a resource can be created with the specified name. -// Parameters: -// parameters - the name availability request parameters. -func (client ServersClient) CheckNameAvailability(ctx context.Context, parameters CheckNameAvailabilityRequest) (result CheckNameAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.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("sql.ServersClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ServersClient) CheckNameAvailabilityPreparer(ctx context.Context, parameters CheckNameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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}/providers/Microsoft.Sql/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 ServersClient) 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 ServersClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested server resource state. -func (client ServersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (result ServersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Sql/servers/{serverName}", 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 ServersClient) CreateOrUpdateSender(req *http.Request) (future ServersCreateOrUpdateFuture, 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 ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, 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 a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}", 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 ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, 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 ServersClient) 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 a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}", 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 ServersClient) 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 ServersClient) GetResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ImportDatabase imports a bacpac into a new database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the database import request parameters. -func (client ServersClient) ImportDatabase(ctx context.Context, resourceGroupName string, serverName string, parameters ImportNewDatabaseDefinition) (result ServersImportDatabaseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ImportDatabase") - 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StorageURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLogin", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLoginPassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ServersClient", "ImportDatabase", err.Error()) - } - - req, err := client.ImportDatabasePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ImportDatabase", nil, "Failure preparing request") - return - } - - result, err = client.ImportDatabaseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ImportDatabase", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportDatabasePreparer prepares the ImportDatabase request. -func (client ServersClient) ImportDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ImportNewDatabaseDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/servers/{serverName}/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportDatabaseSender sends the ImportDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ImportDatabaseSender(req *http.Request) (future ServersImportDatabaseFuture, 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 -} - -// ImportDatabaseResponder handles the response to the ImportDatabase request. The method always -// closes the http.Response Body. -func (client ServersClient) ImportDatabaseResponder(resp *http.Response) (result ImportExportOperationResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of all servers in the subscription. -func (client ServersClient) List(ctx context.Context) (result ServerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.List") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure sending request") - return - } - - result.slr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers", 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 ServersClient) 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 ServersClient) ListResponder(resp *http.Response) (result ServerListResult, 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 ServersClient) listNextResults(ctx context.Context, lastResults ServerListResult) (result ServerListResult, err error) { - req, err := lastResults.serverListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServersClient", "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, "sql.ServersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServersClient) ListComplete(ctx context.Context) (result ServerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.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 servers in a resource groups. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.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, "sql.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServersClient) 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 = "2019-06-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.Sql/servers", 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 ServersClient) 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 ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, 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 ServersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServerListResult) (result ServerListResult, err error) { - req, err := lastResults.serverListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServersClient", "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, "sql.ServersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.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 -} - -// Update updates a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested server resource state. -func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (result ServersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}", 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 ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, 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 ServersClient) UpdateResponder(resp *http.Response) (result Server, 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/preview/sql/mgmt/v3.0/sql/serversecurityalertpolicies.go b/services/preview/sql/mgmt/v3.0/sql/serversecurityalertpolicies.go deleted file mode 100644 index e024cf49175a..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serversecurityalertpolicies.go +++ /dev/null @@ -1,315 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerSecurityAlertPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ServerSecurityAlertPoliciesClient struct { - BaseClient -} - -// NewServerSecurityAlertPoliciesClient creates an instance of the ServerSecurityAlertPoliciesClient client. -func NewServerSecurityAlertPoliciesClient(subscriptionID string) ServerSecurityAlertPoliciesClient { - return NewServerSecurityAlertPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerSecurityAlertPoliciesClientWithBaseURI creates an instance of the ServerSecurityAlertPoliciesClient 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 NewServerSecurityAlertPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerSecurityAlertPoliciesClient { - return ServerSecurityAlertPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the server security alert policy. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (result ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", 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 ServerSecurityAlertPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ServerSecurityAlertPoliciesCreateOrUpdateFuture, 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 ServerSecurityAlertPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerSecurityAlertPolicy, 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 get a server's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerSecurityAlertPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", 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 ServerSecurityAlertPoliciesClient) 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 ServerSecurityAlertPoliciesClient) GetResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer get the server's threat detection policies. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerSecurityAlertPoliciesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result LogicalServerSecurityAlertPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.ListByServer") - defer func() { - sc := -1 - if result.lssaplr.Response.Response != nil { - sc = result.lssaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.lssaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.lssaplr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.lssaplr.hasNextLink() && result.lssaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerSecurityAlertPoliciesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-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.Sql/servers/{serverName}/securityAlertPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerSecurityAlertPoliciesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerSecurityAlertPoliciesClient) ListByServerResponder(resp *http.Response) (result LogicalServerSecurityAlertPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerSecurityAlertPoliciesClient) listByServerNextResults(ctx context.Context, lastResults LogicalServerSecurityAlertPolicyListResult) (result LogicalServerSecurityAlertPolicyListResult, err error) { - req, err := lastResults.logicalServerSecurityAlertPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerSecurityAlertPoliciesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result LogicalServerSecurityAlertPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/servertrustgroups.go b/services/preview/sql/mgmt/v3.0/sql/servertrustgroups.go deleted file mode 100644 index ecb15a55b705..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/servertrustgroups.go +++ /dev/null @@ -1,527 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerTrustGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ServerTrustGroupsClient struct { - BaseClient -} - -// NewServerTrustGroupsClient creates an instance of the ServerTrustGroupsClient client. -func NewServerTrustGroupsClient(subscriptionID string) ServerTrustGroupsClient { - return NewServerTrustGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerTrustGroupsClientWithBaseURI creates an instance of the ServerTrustGroupsClient 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 NewServerTrustGroupsClientWithBaseURI(baseURI string, subscriptionID string) ServerTrustGroupsClient { - return ServerTrustGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a server trust group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// serverTrustGroupName - the name of the server trust group. -// parameters - the server trust group parameters. -func (client ServerTrustGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string, parameters ServerTrustGroup) (result ServerTrustGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServerTrustGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServerTrustGroupProperties.GroupMembers", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ServerTrustGroupProperties.TrustScopes", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.ServerTrustGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, locationName, serverTrustGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerTrustGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string, parameters ServerTrustGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverTrustGroupName": autorest.Encode("path", serverTrustGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName}", 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 ServerTrustGroupsClient) CreateOrUpdateSender(req *http.Request) (future ServerTrustGroupsCreateOrUpdateFuture, 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 ServerTrustGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerTrustGroup, 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 a server trust group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// serverTrustGroupName - the name of the server trust group. -func (client ServerTrustGroupsClient) Delete(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (result ServerTrustGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, locationName, serverTrustGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerTrustGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverTrustGroupName": autorest.Encode("path", serverTrustGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName}", 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 ServerTrustGroupsClient) DeleteSender(req *http.Request) (future ServerTrustGroupsDeleteFuture, 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 ServerTrustGroupsClient) 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 a server trust group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -// serverTrustGroupName - the name of the server trust group. -func (client ServerTrustGroupsClient) Get(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (result ServerTrustGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.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, locationName, serverTrustGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerTrustGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverTrustGroupName": autorest.Encode("path", serverTrustGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName}", 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 ServerTrustGroupsClient) 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 ServerTrustGroupsClient) GetResponder(resp *http.Response) (result ServerTrustGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByInstance gets a server trust groups by instance name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// managedInstanceName - the name of the managed instance. -func (client ServerTrustGroupsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ServerTrustGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.ListByInstance") - defer func() { - sc := -1 - if result.stglr.Response.Response != nil { - sc = result.stglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstanceNextResults - req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByInstance", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.stglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByInstance", resp, "Failure sending request") - return - } - - result.stglr, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByInstance", resp, "Failure responding to request") - return - } - if result.stglr.hasNextLink() && result.stglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePreparer prepares the ListByInstance request. -func (client ServerTrustGroupsClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/managedInstances/{managedInstanceName}/serverTrustGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstanceSender sends the ListByInstance request. The method will close the -// http.Response Body if it receives an error. -func (client ServerTrustGroupsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstanceResponder handles the response to the ListByInstance request. The method always -// closes the http.Response Body. -func (client ServerTrustGroupsClient) ListByInstanceResponder(resp *http.Response) (result ServerTrustGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstanceNextResults retrieves the next set of results, if any. -func (client ServerTrustGroupsClient) listByInstanceNextResults(ctx context.Context, lastResults ServerTrustGroupListResult) (result ServerTrustGroupListResult, err error) { - req, err := lastResults.serverTrustGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstanceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByInstanceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerTrustGroupsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ServerTrustGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.ListByInstance") - 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.ListByInstance(ctx, resourceGroupName, managedInstanceName) - return -} - -// ListByLocation lists a server trust group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// locationName - the name of the region where the resource is located. -func (client ServerTrustGroupsClient) ListByLocation(ctx context.Context, resourceGroupName string, locationName string) (result ServerTrustGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.ListByLocation") - defer func() { - sc := -1 - if result.stglr.Response.Response != nil { - sc = result.stglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByLocationNextResults - req, err := client.ListByLocationPreparer(ctx, resourceGroupName, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.stglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByLocation", resp, "Failure sending request") - return - } - - result.stglr, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "ListByLocation", resp, "Failure responding to request") - return - } - if result.stglr.hasNextLink() && result.stglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client ServerTrustGroupsClient) ListByLocationPreparer(ctx context.Context, resourceGroupName string, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-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.Sql/locations/{locationName}/serverTrustGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client ServerTrustGroupsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client ServerTrustGroupsClient) ListByLocationResponder(resp *http.Response) (result ServerTrustGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByLocationNextResults retrieves the next set of results, if any. -func (client ServerTrustGroupsClient) listByLocationNextResults(ctx context.Context, lastResults ServerTrustGroupListResult) (result ServerTrustGroupListResult, err error) { - req, err := lastResults.serverTrustGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerTrustGroupsClient", "listByLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerTrustGroupsClient) ListByLocationComplete(ctx context.Context, resourceGroupName string, locationName string) (result ServerTrustGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustGroupsClient.ListByLocation") - 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.ListByLocation(ctx, resourceGroupName, locationName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/serverusages.go b/services/preview/sql/mgmt/v3.0/sql/serverusages.go deleted file mode 100644 index 662861e4c6cf..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serverusages.go +++ /dev/null @@ -1,110 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type ServerUsagesClient struct { - BaseClient -} - -// NewServerUsagesClient creates an instance of the ServerUsagesClient client. -func NewServerUsagesClient(subscriptionID string) ServerUsagesClient { - return NewServerUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerUsagesClientWithBaseURI creates an instance of the ServerUsagesClient 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 NewServerUsagesClientWithBaseURI(baseURI string, subscriptionID string) ServerUsagesClient { - return ServerUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByServer returns server usages. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerUsagesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerUsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerUsagesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerUsagesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerUsagesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerUsagesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerUsagesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerUsagesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerUsagesClient) ListByServerResponder(resp *http.Response) (result ServerUsageListResult, 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/sql/mgmt/v3.0/sql/servervulnerabilityassessments.go b/services/preview/sql/mgmt/v3.0/sql/servervulnerabilityassessments.go deleted file mode 100644 index 485a788ebf2e..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/servervulnerabilityassessments.go +++ /dev/null @@ -1,397 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServerVulnerabilityAssessmentsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ServerVulnerabilityAssessmentsClient struct { - BaseClient -} - -// NewServerVulnerabilityAssessmentsClient creates an instance of the ServerVulnerabilityAssessmentsClient client. -func NewServerVulnerabilityAssessmentsClient(subscriptionID string) ServerVulnerabilityAssessmentsClient { - return NewServerVulnerabilityAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerVulnerabilityAssessmentsClientWithBaseURI creates an instance of the ServerVulnerabilityAssessmentsClient -// 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 NewServerVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscriptionID string) ServerVulnerabilityAssessmentsClient { - return ServerVulnerabilityAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the server's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server for which the vulnerability assessment is defined. -// parameters - the requested resource. -func (client ServerVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerVulnerabilityAssessment) (result ServerVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServerVulnerabilityAssessmentProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServerVulnerabilityAssessmentProperties.StorageContainerPath", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.ServerVulnerabilityAssessmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerVulnerabilityAssessmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerVulnerabilityAssessment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ServerVulnerabilityAssessmentsClient) 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 ServerVulnerabilityAssessmentsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerVulnerabilityAssessment, 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 removes the server's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server for which the vulnerability assessment is defined. -func (client ServerVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerVulnerabilityAssessmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ServerVulnerabilityAssessmentsClient) 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 ServerVulnerabilityAssessmentsClient) 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 the server's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server for which the vulnerability assessment is defined. -func (client ServerVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentsClient.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, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerVulnerabilityAssessmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 ServerVulnerabilityAssessmentsClient) 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 ServerVulnerabilityAssessmentsClient) GetResponder(resp *http.Response) (result ServerVulnerabilityAssessment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer lists the vulnerability assessment policies associated with a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServerVulnerabilityAssessmentsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerVulnerabilityAssessmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentsClient.ListByServer") - defer func() { - sc := -1 - if result.svalr.Response.Response != nil { - sc = result.svalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.svalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.svalr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.svalr.hasNextLink() && result.svalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerVulnerabilityAssessmentsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-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.Sql/servers/{serverName}/vulnerabilityAssessments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerVulnerabilityAssessmentsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerVulnerabilityAssessmentsClient) ListByServerResponder(resp *http.Response) (result ServerVulnerabilityAssessmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerVulnerabilityAssessmentsClient) listByServerNextResults(ctx context.Context, lastResults ServerVulnerabilityAssessmentListResult) (result ServerVulnerabilityAssessmentListResult, err error) { - req, err := lastResults.serverVulnerabilityAssessmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerVulnerabilityAssessmentsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerVulnerabilityAssessmentsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerVulnerabilityAssessmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/serviceobjectives.go b/services/preview/sql/mgmt/v3.0/sql/serviceobjectives.go deleted file mode 100644 index 0b21dd5344f9..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/serviceobjectives.go +++ /dev/null @@ -1,190 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServiceObjectivesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ServiceObjectivesClient struct { - BaseClient -} - -// NewServiceObjectivesClient creates an instance of the ServiceObjectivesClient client. -func NewServiceObjectivesClient(subscriptionID string) ServiceObjectivesClient { - return NewServiceObjectivesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceObjectivesClientWithBaseURI creates an instance of the ServiceObjectivesClient 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 NewServiceObjectivesClientWithBaseURI(baseURI string, subscriptionID string) ServiceObjectivesClient { - return ServiceObjectivesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a database service objective. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// serviceObjectiveName - the name of the service objective to retrieve. -func (client ServiceObjectivesClient) Get(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (result ServiceObjective, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceObjectivesClient.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, serverName, serviceObjectiveName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceObjectivesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "serviceObjectiveName": autorest.Encode("path", serviceObjectiveName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}", 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 ServiceObjectivesClient) 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 ServiceObjectivesClient) GetResponder(resp *http.Response) (result ServiceObjective, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns database service objectives. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client ServiceObjectivesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServiceObjectiveListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceObjectivesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceObjectivesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServiceObjectivesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/serviceObjectives", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceObjectivesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServiceObjectivesClient) ListByServerResponder(resp *http.Response) (result ServiceObjectiveListResult, 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/sql/mgmt/v3.0/sql/servicetieradvisors.go b/services/preview/sql/mgmt/v3.0/sql/servicetieradvisors.go deleted file mode 100644 index 7886aa585995..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/servicetieradvisors.go +++ /dev/null @@ -1,194 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ServiceTierAdvisorsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ServiceTierAdvisorsClient struct { - BaseClient -} - -// NewServiceTierAdvisorsClient creates an instance of the ServiceTierAdvisorsClient client. -func NewServiceTierAdvisorsClient(subscriptionID string) ServiceTierAdvisorsClient { - return NewServiceTierAdvisorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceTierAdvisorsClientWithBaseURI creates an instance of the ServiceTierAdvisorsClient 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 NewServiceTierAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) ServiceTierAdvisorsClient { - return ServiceTierAdvisorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a service tier advisor. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of database. -// serviceTierAdvisorName - the name of service tier advisor. -func (client ServiceTierAdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (result ServiceTierAdvisor, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTierAdvisorsClient.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, serverName, databaseName, serviceTierAdvisorName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceTierAdvisorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "serviceTierAdvisorName": autorest.Encode("path", serviceTierAdvisorName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}", 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 ServiceTierAdvisorsClient) 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 ServiceTierAdvisorsClient) GetResponder(resp *http.Response) (result ServiceTierAdvisor, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase returns service tier advisors for specified database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of database. -func (client ServiceTierAdvisorsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result ServiceTierAdvisorListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTierAdvisorsClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServiceTierAdvisorsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ServiceTierAdvisorsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceTierAdvisorsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ServiceTierAdvisorsClient) ListByDatabaseResponder(resp *http.Response) (result ServiceTierAdvisorListResult, 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/sql/mgmt/v3.0/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go deleted file mode 100644 index 4fb675257b85..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go +++ /dev/null @@ -1,1043 +0,0 @@ -package sqlapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/sql/mgmt/v3.0/sql" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/gofrs/uuid" -) - -// RecoverableDatabasesClientAPI contains the set of methods on the RecoverableDatabasesClient type. -type RecoverableDatabasesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.RecoverableDatabase, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.RecoverableDatabaseListResult, err error) -} - -var _ RecoverableDatabasesClientAPI = (*sql.RecoverableDatabasesClient)(nil) - -// RestorableDroppedDatabasesClientAPI contains the set of methods on the RestorableDroppedDatabasesClient type. -type RestorableDroppedDatabasesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppededDatabaseID string) (result sql.RestorableDroppedDatabase, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.RestorableDroppedDatabaseListResult, err error) -} - -var _ RestorableDroppedDatabasesClientAPI = (*sql.RestorableDroppedDatabasesClient)(nil) - -// ServerConnectionPoliciesClientAPI contains the set of methods on the ServerConnectionPoliciesClient type. -type ServerConnectionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerConnectionPolicy) (result sql.ServerConnectionPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerConnectionPolicy, err error) -} - -var _ ServerConnectionPoliciesClientAPI = (*sql.ServerConnectionPoliciesClient)(nil) - -// DatabaseThreatDetectionPoliciesClientAPI contains the set of methods on the DatabaseThreatDetectionPoliciesClient type. -type DatabaseThreatDetectionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseSecurityAlertPolicy) (result sql.DatabaseSecurityAlertPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseSecurityAlertPolicy, err error) -} - -var _ DatabaseThreatDetectionPoliciesClientAPI = (*sql.DatabaseThreatDetectionPoliciesClient)(nil) - -// DataMaskingPoliciesClientAPI contains the set of methods on the DataMaskingPoliciesClient type. -type DataMaskingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DataMaskingPolicy) (result sql.DataMaskingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DataMaskingPolicy, err error) -} - -var _ DataMaskingPoliciesClientAPI = (*sql.DataMaskingPoliciesClient)(nil) - -// DataMaskingRulesClientAPI contains the set of methods on the DataMaskingRulesClient type. -type DataMaskingRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters sql.DataMaskingRule) (result sql.DataMaskingRule, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DataMaskingRuleListResult, err error) -} - -var _ DataMaskingRulesClientAPI = (*sql.DataMaskingRulesClient)(nil) - -// FirewallRulesClientAPI contains the set of methods on the FirewallRulesClient type. -type FirewallRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters sql.FirewallRule) (result sql.FirewallRule, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result sql.FirewallRule, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.FirewallRuleListResult, err error) -} - -var _ FirewallRulesClientAPI = (*sql.FirewallRulesClient)(nil) - -// GeoBackupPoliciesClientAPI contains the set of methods on the GeoBackupPoliciesClient type. -type GeoBackupPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.GeoBackupPolicy) (result sql.GeoBackupPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.GeoBackupPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.GeoBackupPolicyListResult, err error) -} - -var _ GeoBackupPoliciesClientAPI = (*sql.GeoBackupPoliciesClient)(nil) - -// DatabasesClientAPI contains the set of methods on the DatabasesClient type. -type DatabasesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.Database) (result sql.DatabasesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesDeleteFuture, err error) - Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ExportDatabaseDefinition) (result sql.DatabasesExportFuture, err error) - Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, replicaType sql.ReplicaType) (result sql.DatabasesFailoverFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.Database, err error) - ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.DatabaseListResultPage, err error) - ListByElasticPoolComplete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.DatabaseListResultIterator, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultIterator, err error) - ListInaccessibleByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultPage, err error) - ListInaccessibleByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.DatabaseListResultIterator, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.MetricDefinitionListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result sql.MetricListResult, err error) - Pause(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesPauseFuture, err error) - Rename(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ResourceMoveDefinition) (result autorest.Response, err error) - Resume(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesResumeFuture, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseUpdate) (result sql.DatabasesUpdateFuture, err error) - UpgradeDataWarehouse(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabasesUpgradeDataWarehouseFuture, err error) -} - -var _ DatabasesClientAPI = (*sql.DatabasesClient)(nil) - -// ElasticPoolsClientAPI contains the set of methods on the ElasticPoolsClient type. -type ElasticPoolsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters sql.ElasticPool) (result sql.ElasticPoolsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolsDeleteFuture, err error) - Failover(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolsFailoverFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPool, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result sql.ElasticPoolListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result sql.ElasticPoolListResultIterator, err error) - ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.MetricDefinitionListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (result sql.MetricListResult, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters sql.ElasticPoolUpdate) (result sql.ElasticPoolsUpdateFuture, err error) -} - -var _ ElasticPoolsClientAPI = (*sql.ElasticPoolsClient)(nil) - -// RecommendedElasticPoolsClientAPI contains the set of methods on the RecommendedElasticPoolsClient type. -type RecommendedElasticPoolsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result sql.RecommendedElasticPool, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.RecommendedElasticPoolListResult, err error) - ListMetrics(ctx context.Context, resourceGroupName string, serverName string, recommendedElasticPoolName string) (result sql.RecommendedElasticPoolListMetricsResult, err error) -} - -var _ RecommendedElasticPoolsClientAPI = (*sql.RecommendedElasticPoolsClient)(nil) - -// ReplicationLinksClientAPI contains the set of methods on the ReplicationLinksClient type. -type ReplicationLinksClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) - Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLinksFailoverFuture, err error) - FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLinksFailoverAllowDataLossFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLink, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ReplicationLinkListResult, err error) - Unlink(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, parameters sql.UnlinkParameters) (result sql.ReplicationLinksUnlinkFuture, err error) -} - -var _ ReplicationLinksClientAPI = (*sql.ReplicationLinksClient)(nil) - -// ServerCommunicationLinksClientAPI contains the set of methods on the ServerCommunicationLinksClient type. -type ServerCommunicationLinksClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters sql.ServerCommunicationLink) (result sql.ServerCommunicationLinksCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string) (result sql.ServerCommunicationLink, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerCommunicationLinkListResult, err error) -} - -var _ ServerCommunicationLinksClientAPI = (*sql.ServerCommunicationLinksClient)(nil) - -// ServiceObjectivesClientAPI contains the set of methods on the ServiceObjectivesClient type. -type ServiceObjectivesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string) (result sql.ServiceObjective, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServiceObjectiveListResult, err error) -} - -var _ ServiceObjectivesClientAPI = (*sql.ServiceObjectivesClient)(nil) - -// ElasticPoolActivitiesClientAPI contains the set of methods on the ElasticPoolActivitiesClient type. -type ElasticPoolActivitiesClientAPI interface { - ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolActivityListResult, err error) -} - -var _ ElasticPoolActivitiesClientAPI = (*sql.ElasticPoolActivitiesClient)(nil) - -// ElasticPoolDatabaseActivitiesClientAPI contains the set of methods on the ElasticPoolDatabaseActivitiesClient type. -type ElasticPoolDatabaseActivitiesClientAPI interface { - ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolDatabaseActivityListResult, err error) -} - -var _ ElasticPoolDatabaseActivitiesClientAPI = (*sql.ElasticPoolDatabaseActivitiesClient)(nil) - -// ServiceTierAdvisorsClientAPI contains the set of methods on the ServiceTierAdvisorsClient type. -type ServiceTierAdvisorsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (result sql.ServiceTierAdvisor, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ServiceTierAdvisorListResult, err error) -} - -var _ ServiceTierAdvisorsClientAPI = (*sql.ServiceTierAdvisorsClient)(nil) - -// TransparentDataEncryptionsClientAPI contains the set of methods on the TransparentDataEncryptionsClient type. -type TransparentDataEncryptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.TransparentDataEncryption) (result sql.TransparentDataEncryption, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.TransparentDataEncryption, err error) -} - -var _ TransparentDataEncryptionsClientAPI = (*sql.TransparentDataEncryptionsClient)(nil) - -// TransparentDataEncryptionActivitiesClientAPI contains the set of methods on the TransparentDataEncryptionActivitiesClient type. -type TransparentDataEncryptionActivitiesClientAPI interface { - ListByConfiguration(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.TransparentDataEncryptionActivityListResult, err error) -} - -var _ TransparentDataEncryptionActivitiesClientAPI = (*sql.TransparentDataEncryptionActivitiesClient)(nil) - -// ServerUsagesClientAPI contains the set of methods on the ServerUsagesClient type. -type ServerUsagesClientAPI interface { - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerUsageListResult, err error) -} - -var _ ServerUsagesClientAPI = (*sql.ServerUsagesClient)(nil) - -// DatabaseUsagesClientAPI contains the set of methods on the DatabaseUsagesClient type. -type DatabaseUsagesClientAPI interface { - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseUsageListResult, err error) -} - -var _ DatabaseUsagesClientAPI = (*sql.DatabaseUsagesClient)(nil) - -// DatabaseAutomaticTuningClientAPI contains the set of methods on the DatabaseAutomaticTuningClient type. -type DatabaseAutomaticTuningClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseAutomaticTuning, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseAutomaticTuning) (result sql.DatabaseAutomaticTuning, err error) -} - -var _ DatabaseAutomaticTuningClientAPI = (*sql.DatabaseAutomaticTuningClient)(nil) - -// EncryptionProtectorsClientAPI contains the set of methods on the EncryptionProtectorsClient type. -type EncryptionProtectorsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.EncryptionProtector) (result sql.EncryptionProtectorsCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtector, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorListResultIterator, err error) - Revalidate(ctx context.Context, resourceGroupName string, serverName string) (result sql.EncryptionProtectorsRevalidateFuture, err error) -} - -var _ EncryptionProtectorsClientAPI = (*sql.EncryptionProtectorsClient)(nil) - -// FailoverGroupsClientAPI contains the set of methods on the FailoverGroupsClient type. -type FailoverGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters sql.FailoverGroup) (result sql.FailoverGroupsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result sql.FailoverGroupsDeleteFuture, err error) - Failover(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result sql.FailoverGroupsFailoverFuture, err error) - ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result sql.FailoverGroupsForceFailoverAllowDataLossFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string) (result sql.FailoverGroup, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.FailoverGroupListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.FailoverGroupListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters sql.FailoverGroupUpdate) (result sql.FailoverGroupsUpdateFuture, err error) -} - -var _ FailoverGroupsClientAPI = (*sql.FailoverGroupsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result sql.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result sql.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*sql.OperationsClient)(nil) - -// ServerKeysClientAPI contains the set of methods on the ServerKeysClient type. -type ServerKeysClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, keyName string, parameters sql.ServerKey) (result sql.ServerKeysCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result sql.ServerKeysDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result sql.ServerKey, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerKeyListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerKeyListResultIterator, err error) -} - -var _ ServerKeysClientAPI = (*sql.ServerKeysClient)(nil) - -// SyncAgentsClientAPI contains the set of methods on the SyncAgentsClient type. -type SyncAgentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, parameters sql.SyncAgent) (result sql.SyncAgentsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgentsDeleteFuture, err error) - GenerateKey(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgentKeyProperties, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgent, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.SyncAgentListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.SyncAgentListResultIterator, err error) - ListLinkedDatabases(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgentLinkedDatabaseListResultPage, err error) - ListLinkedDatabasesComplete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result sql.SyncAgentLinkedDatabaseListResultIterator, err error) -} - -var _ SyncAgentsClientAPI = (*sql.SyncAgentsClient)(nil) - -// SubscriptionUsagesClientAPI contains the set of methods on the SubscriptionUsagesClient type. -type SubscriptionUsagesClientAPI interface { - Get(ctx context.Context, locationName string, usageName string) (result sql.SubscriptionUsage, err error) - ListByLocation(ctx context.Context, locationName string) (result sql.SubscriptionUsageListResultPage, err error) - ListByLocationComplete(ctx context.Context, locationName string) (result sql.SubscriptionUsageListResultIterator, err error) -} - -var _ SubscriptionUsagesClientAPI = (*sql.SubscriptionUsagesClient)(nil) - -// VirtualClustersClientAPI contains the set of methods on the VirtualClustersClient type. -type VirtualClustersClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, virtualClusterName string) (result sql.VirtualClustersDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, virtualClusterName string) (result sql.VirtualCluster, err error) - List(ctx context.Context) (result sql.VirtualClusterListResultPage, err error) - ListComplete(ctx context.Context) (result sql.VirtualClusterListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.VirtualClusterListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.VirtualClusterListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, virtualClusterName string, parameters sql.VirtualClusterUpdate) (result sql.VirtualClustersUpdateFuture, err error) -} - -var _ VirtualClustersClientAPI = (*sql.VirtualClustersClient)(nil) - -// VirtualNetworkRulesClientAPI contains the set of methods on the VirtualNetworkRulesClient type. -type VirtualNetworkRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters sql.VirtualNetworkRule) (result sql.VirtualNetworkRulesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result sql.VirtualNetworkRulesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result sql.VirtualNetworkRule, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.VirtualNetworkRuleListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.VirtualNetworkRuleListResultIterator, err error) -} - -var _ VirtualNetworkRulesClientAPI = (*sql.VirtualNetworkRulesClient)(nil) - -// ExtendedDatabaseBlobAuditingPoliciesClientAPI contains the set of methods on the ExtendedDatabaseBlobAuditingPoliciesClient type. -type ExtendedDatabaseBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ExtendedDatabaseBlobAuditingPolicy) (result sql.ExtendedDatabaseBlobAuditingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ExtendedDatabaseBlobAuditingPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ExtendedDatabaseBlobAuditingPolicyListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ExtendedDatabaseBlobAuditingPolicyListResultIterator, err error) -} - -var _ ExtendedDatabaseBlobAuditingPoliciesClientAPI = (*sql.ExtendedDatabaseBlobAuditingPoliciesClient)(nil) - -// ExtendedServerBlobAuditingPoliciesClientAPI contains the set of methods on the ExtendedServerBlobAuditingPoliciesClient type. -type ExtendedServerBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ExtendedServerBlobAuditingPolicy) (result sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ExtendedServerBlobAuditingPolicy, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ExtendedServerBlobAuditingPolicyListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ExtendedServerBlobAuditingPolicyListResultIterator, err error) -} - -var _ ExtendedServerBlobAuditingPoliciesClientAPI = (*sql.ExtendedServerBlobAuditingPoliciesClient)(nil) - -// ServerBlobAuditingPoliciesClientAPI contains the set of methods on the ServerBlobAuditingPoliciesClient type. -type ServerBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerBlobAuditingPolicy) (result sql.ServerBlobAuditingPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerBlobAuditingPolicy, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerBlobAuditingPolicyListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerBlobAuditingPolicyListResultIterator, err error) -} - -var _ ServerBlobAuditingPoliciesClientAPI = (*sql.ServerBlobAuditingPoliciesClient)(nil) - -// DatabaseBlobAuditingPoliciesClientAPI contains the set of methods on the DatabaseBlobAuditingPoliciesClient type. -type DatabaseBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseBlobAuditingPolicy) (result sql.DatabaseBlobAuditingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseBlobAuditingPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseBlobAuditingPolicyListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseBlobAuditingPolicyListResultIterator, err error) -} - -var _ DatabaseBlobAuditingPoliciesClientAPI = (*sql.DatabaseBlobAuditingPoliciesClient)(nil) - -// DatabaseVulnerabilityAssessmentRuleBaselinesClientAPI contains the set of methods on the DatabaseVulnerabilityAssessmentRuleBaselinesClient type. -type DatabaseVulnerabilityAssessmentRuleBaselinesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName sql.VulnerabilityAssessmentPolicyBaselineName, parameters sql.DatabaseVulnerabilityAssessmentRuleBaseline) (result sql.DatabaseVulnerabilityAssessmentRuleBaseline, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName sql.VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ruleID string, baselineName sql.VulnerabilityAssessmentPolicyBaselineName) (result sql.DatabaseVulnerabilityAssessmentRuleBaseline, err error) -} - -var _ DatabaseVulnerabilityAssessmentRuleBaselinesClientAPI = (*sql.DatabaseVulnerabilityAssessmentRuleBaselinesClient)(nil) - -// DatabaseVulnerabilityAssessmentsClientAPI contains the set of methods on the DatabaseVulnerabilityAssessmentsClient type. -type DatabaseVulnerabilityAssessmentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DatabaseVulnerabilityAssessment) (result sql.DatabaseVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseVulnerabilityAssessment, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseVulnerabilityAssessmentListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseVulnerabilityAssessmentListResultIterator, err error) -} - -var _ DatabaseVulnerabilityAssessmentsClientAPI = (*sql.DatabaseVulnerabilityAssessmentsClient)(nil) - -// JobAgentsClientAPI contains the set of methods on the JobAgentsClient type. -type JobAgentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, parameters sql.JobAgent) (result sql.JobAgentsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result sql.JobAgentsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result sql.JobAgent, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.JobAgentListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.JobAgentListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, parameters sql.JobAgentUpdate) (result sql.JobAgentsUpdateFuture, err error) -} - -var _ JobAgentsClientAPI = (*sql.JobAgentsClient)(nil) - -// JobCredentialsClientAPI contains the set of methods on the JobCredentialsClient type. -type JobCredentialsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string, parameters sql.JobCredential) (result sql.JobCredential, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string) (result sql.JobCredential, err error) - ListByAgent(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result sql.JobCredentialListResultPage, err error) - ListByAgentComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result sql.JobCredentialListResultIterator, err error) -} - -var _ JobCredentialsClientAPI = (*sql.JobCredentialsClient)(nil) - -// JobExecutionsClientAPI contains the set of methods on the JobExecutionsClient type. -type JobExecutionsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (result autorest.Response, err error) - Create(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result sql.JobExecutionsCreateFuture, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (result sql.JobExecutionsCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID) (result sql.JobExecution, err error) - ListByAgent(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultPage, err error) - ListByAgentComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultIterator, err error) - ListByJob(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultPage, err error) - ListByJobComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultIterator, err error) -} - -var _ JobExecutionsClientAPI = (*sql.JobExecutionsClient)(nil) - -// JobsClientAPI contains the set of methods on the JobsClient type. -type JobsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, parameters sql.Job) (result sql.Job, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result sql.Job, err error) - ListByAgent(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result sql.JobListResultPage, err error) - ListByAgentComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result sql.JobListResultIterator, err error) -} - -var _ JobsClientAPI = (*sql.JobsClient)(nil) - -// JobStepExecutionsClientAPI contains the set of methods on the JobStepExecutionsClient type. -type JobStepExecutionsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string) (result sql.JobExecution, err error) - ListByJobExecution(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultPage, err error) - ListByJobExecutionComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultIterator, err error) -} - -var _ JobStepExecutionsClientAPI = (*sql.JobStepExecutionsClient)(nil) - -// JobStepsClientAPI contains the set of methods on the JobStepsClient type. -type JobStepsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string, parameters sql.JobStep) (result sql.JobStep, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string) (result sql.JobStep, err error) - GetByVersion(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32, stepName string) (result sql.JobStep, err error) - ListByJob(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result sql.JobStepListResultPage, err error) - ListByJobComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result sql.JobStepListResultIterator, err error) - ListByVersion(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32) (result sql.JobStepListResultPage, err error) - ListByVersionComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32) (result sql.JobStepListResultIterator, err error) -} - -var _ JobStepsClientAPI = (*sql.JobStepsClient)(nil) - -// JobTargetExecutionsClientAPI contains the set of methods on the JobTargetExecutionsClient type. -type JobTargetExecutionsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string, targetID uuid.UUID) (result sql.JobExecution, err error) - ListByJobExecution(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultPage, err error) - ListByJobExecutionComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultIterator, err error) - ListByStep(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultPage, err error) - ListByStepComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID uuid.UUID, stepName string, createTimeMin *date.Time, createTimeMax *date.Time, endTimeMin *date.Time, endTimeMax *date.Time, isActive *bool, skip *int32, top *int32) (result sql.JobExecutionListResultIterator, err error) -} - -var _ JobTargetExecutionsClientAPI = (*sql.JobTargetExecutionsClient)(nil) - -// JobTargetGroupsClientAPI contains the set of methods on the JobTargetGroupsClient type. -type JobTargetGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string, parameters sql.JobTargetGroup) (result sql.JobTargetGroup, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string) (result sql.JobTargetGroup, err error) - ListByAgent(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result sql.JobTargetGroupListResultPage, err error) - ListByAgentComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string) (result sql.JobTargetGroupListResultIterator, err error) -} - -var _ JobTargetGroupsClientAPI = (*sql.JobTargetGroupsClient)(nil) - -// JobVersionsClientAPI contains the set of methods on the JobVersionsClient type. -type JobVersionsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32) (result sql.JobVersion, err error) - ListByJob(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result sql.JobVersionListResultPage, err error) - ListByJobComplete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string) (result sql.JobVersionListResultIterator, err error) -} - -var _ JobVersionsClientAPI = (*sql.JobVersionsClient)(nil) - -// LongTermRetentionBackupsClientAPI contains the set of methods on the LongTermRetentionBackupsClient type. -type LongTermRetentionBackupsClientAPI interface { - Delete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteFuture, err error) - DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteByResourceGroupFuture, err error) - Get(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) - GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) - ListByDatabase(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupServer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByResourceGroupServerComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByServer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByServerComplete(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) -} - -var _ LongTermRetentionBackupsClientAPI = (*sql.LongTermRetentionBackupsClient)(nil) - -// BackupLongTermRetentionPoliciesClientAPI contains the set of methods on the BackupLongTermRetentionPoliciesClient type. -type BackupLongTermRetentionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupLongTermRetentionPolicy) (result sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupLongTermRetentionPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupLongTermRetentionPolicy, err error) -} - -var _ BackupLongTermRetentionPoliciesClientAPI = (*sql.BackupLongTermRetentionPoliciesClient)(nil) - -// ManagedBackupShortTermRetentionPoliciesClientAPI contains the set of methods on the ManagedBackupShortTermRetentionPoliciesClient type. -type ManagedBackupShortTermRetentionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.ManagedBackupShortTermRetentionPolicy) (result sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedBackupShortTermRetentionPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedBackupShortTermRetentionPolicyListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedBackupShortTermRetentionPolicyListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.ManagedBackupShortTermRetentionPolicy) (result sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture, err error) -} - -var _ ManagedBackupShortTermRetentionPoliciesClientAPI = (*sql.ManagedBackupShortTermRetentionPoliciesClient)(nil) - -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientAPI contains the set of methods on the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient type. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, parameters sql.ManagedBackupShortTermRetentionPolicy) (result sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result sql.ManagedBackupShortTermRetentionPolicy, err error) - ListByRestorableDroppedDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result sql.ManagedBackupShortTermRetentionPolicyListResultPage, err error) - ListByRestorableDroppedDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result sql.ManagedBackupShortTermRetentionPolicyListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, parameters sql.ManagedBackupShortTermRetentionPolicy) (result sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture, err error) -} - -var _ ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientAPI = (*sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient)(nil) - -// ServerAutomaticTuningClientAPI contains the set of methods on the ServerAutomaticTuningClient type. -type ServerAutomaticTuningClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAutomaticTuning, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerAutomaticTuning) (result sql.ServerAutomaticTuning, err error) -} - -var _ ServerAutomaticTuningClientAPI = (*sql.ServerAutomaticTuningClient)(nil) - -// ServerDNSAliasesClientAPI contains the set of methods on the ServerDNSAliasesClient type. -type ServerDNSAliasesClientAPI interface { - Acquire(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string, parameters sql.ServerDNSAliasAcquisition) (result sql.ServerDNSAliasesAcquireFuture, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string) (result sql.ServerDNSAliasesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string) (result sql.ServerDNSAliasesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, DNSAliasName string) (result sql.ServerDNSAlias, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerDNSAliasListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerDNSAliasListResultIterator, err error) -} - -var _ ServerDNSAliasesClientAPI = (*sql.ServerDNSAliasesClient)(nil) - -// ServerSecurityAlertPoliciesClientAPI contains the set of methods on the ServerSecurityAlertPoliciesClient type. -type ServerSecurityAlertPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerSecurityAlertPolicy) (result sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerSecurityAlertPolicy, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.LogicalServerSecurityAlertPolicyListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.LogicalServerSecurityAlertPolicyListResultIterator, err error) -} - -var _ ServerSecurityAlertPoliciesClientAPI = (*sql.ServerSecurityAlertPoliciesClient)(nil) - -// RestorableDroppedManagedDatabasesClientAPI contains the set of methods on the RestorableDroppedManagedDatabasesClient type. -type RestorableDroppedManagedDatabasesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result sql.RestorableDroppedManagedDatabase, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RestorableDroppedManagedDatabaseListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RestorableDroppedManagedDatabaseListResultIterator, err error) -} - -var _ RestorableDroppedManagedDatabasesClientAPI = (*sql.RestorableDroppedManagedDatabasesClient)(nil) - -// RestorePointsClientAPI contains the set of methods on the RestorePointsClient type. -type RestorePointsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.CreateDatabaseRestorePointDefinition) (result sql.RestorePointsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, restorePointName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, restorePointName string) (result sql.RestorePoint, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.RestorePointListResult, err error) -} - -var _ RestorePointsClientAPI = (*sql.RestorePointsClient)(nil) - -// ManagedDatabaseSecurityAlertPoliciesClientAPI contains the set of methods on the ManagedDatabaseSecurityAlertPoliciesClient type. -type ManagedDatabaseSecurityAlertPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.ManagedDatabaseSecurityAlertPolicy) (result sql.ManagedDatabaseSecurityAlertPolicy, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedDatabaseSecurityAlertPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedDatabaseSecurityAlertPolicyListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedDatabaseSecurityAlertPolicyListResultIterator, err error) -} - -var _ ManagedDatabaseSecurityAlertPoliciesClientAPI = (*sql.ManagedDatabaseSecurityAlertPoliciesClient)(nil) - -// ManagedServerSecurityAlertPoliciesClientAPI contains the set of methods on the ManagedServerSecurityAlertPoliciesClient type. -type ManagedServerSecurityAlertPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedServerSecurityAlertPolicy) (result sql.ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedServerSecurityAlertPolicy, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedServerSecurityAlertPolicyListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedServerSecurityAlertPolicyListResultIterator, err error) -} - -var _ ManagedServerSecurityAlertPoliciesClientAPI = (*sql.ManagedServerSecurityAlertPoliciesClient)(nil) - -// SensitivityLabelsClientAPI contains the set of methods on the SensitivityLabelsClient type. -type SensitivityLabelsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, parameters sql.SensitivityLabel) (result sql.SensitivityLabel, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - DisableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - EnableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource sql.SensitivityLabelSource) (result sql.SensitivityLabel, err error) - ListCurrentByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result sql.SensitivityLabelListResultPage, err error) - ListCurrentByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result sql.SensitivityLabelListResultIterator, err error) - ListRecommendedByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result sql.SensitivityLabelListResultPage, err error) - ListRecommendedByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result sql.SensitivityLabelListResultIterator, err error) -} - -var _ SensitivityLabelsClientAPI = (*sql.SensitivityLabelsClient)(nil) - -// ManagedInstanceAdministratorsClientAPI contains the set of methods on the ManagedInstanceAdministratorsClient type. -type ManagedInstanceAdministratorsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceAdministrator) (result sql.ManagedInstanceAdministratorsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAdministratorsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAdministrator, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAdministratorListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAdministratorListResultIterator, err error) -} - -var _ ManagedInstanceAdministratorsClientAPI = (*sql.ManagedInstanceAdministratorsClient)(nil) - -// DatabaseOperationsClientAPI contains the set of methods on the DatabaseOperationsClient type. -type DatabaseOperationsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, serverName string, databaseName string, operationID uuid.UUID) (result autorest.Response, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseOperationListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.DatabaseOperationListResultIterator, err error) -} - -var _ DatabaseOperationsClientAPI = (*sql.DatabaseOperationsClient)(nil) - -// ElasticPoolOperationsClientAPI contains the set of methods on the ElasticPoolOperationsClient type. -type ElasticPoolOperationsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, operationID uuid.UUID) (result autorest.Response, err error) - ListByElasticPool(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolOperationListResultPage, err error) - ListByElasticPoolComplete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolOperationListResultIterator, err error) -} - -var _ ElasticPoolOperationsClientAPI = (*sql.ElasticPoolOperationsClient)(nil) - -// DatabaseVulnerabilityAssessmentScansClientAPI contains the set of methods on the DatabaseVulnerabilityAssessmentScansClient type. -type DatabaseVulnerabilityAssessmentScansClientAPI interface { - Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result sql.DatabaseVulnerabilityAssessmentScansExport, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result sql.VulnerabilityAssessmentScanRecord, err error) - InitiateScan(ctx context.Context, resourceGroupName string, serverName string, databaseName string, scanID string) (result sql.DatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.VulnerabilityAssessmentScanRecordListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.VulnerabilityAssessmentScanRecordListResultIterator, err error) -} - -var _ DatabaseVulnerabilityAssessmentScansClientAPI = (*sql.DatabaseVulnerabilityAssessmentScansClient)(nil) - -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientAPI contains the set of methods on the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient type. -type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName sql.VulnerabilityAssessmentPolicyBaselineName, parameters sql.DatabaseVulnerabilityAssessmentRuleBaseline) (result sql.DatabaseVulnerabilityAssessmentRuleBaseline, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName sql.VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ruleID string, baselineName sql.VulnerabilityAssessmentPolicyBaselineName) (result sql.DatabaseVulnerabilityAssessmentRuleBaseline, err error) -} - -var _ ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientAPI = (*sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient)(nil) - -// ManagedDatabaseVulnerabilityAssessmentScansClientAPI contains the set of methods on the ManagedDatabaseVulnerabilityAssessmentScansClient type. -type ManagedDatabaseVulnerabilityAssessmentScansClientAPI interface { - Export(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result sql.DatabaseVulnerabilityAssessmentScansExport, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result sql.VulnerabilityAssessmentScanRecord, err error) - InitiateScan(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, scanID string) (result sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.VulnerabilityAssessmentScanRecordListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.VulnerabilityAssessmentScanRecordListResultIterator, err error) -} - -var _ ManagedDatabaseVulnerabilityAssessmentScansClientAPI = (*sql.ManagedDatabaseVulnerabilityAssessmentScansClient)(nil) - -// ManagedDatabaseVulnerabilityAssessmentsClientAPI contains the set of methods on the ManagedDatabaseVulnerabilityAssessmentsClient type. -type ManagedDatabaseVulnerabilityAssessmentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.DatabaseVulnerabilityAssessment) (result sql.DatabaseVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.DatabaseVulnerabilityAssessment, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.DatabaseVulnerabilityAssessmentListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.DatabaseVulnerabilityAssessmentListResultIterator, err error) -} - -var _ ManagedDatabaseVulnerabilityAssessmentsClientAPI = (*sql.ManagedDatabaseVulnerabilityAssessmentsClient)(nil) - -// InstanceFailoverGroupsClientAPI contains the set of methods on the InstanceFailoverGroupsClient type. -type InstanceFailoverGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, parameters sql.InstanceFailoverGroup) (result sql.InstanceFailoverGroupsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result sql.InstanceFailoverGroupsDeleteFuture, err error) - Failover(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result sql.InstanceFailoverGroupsFailoverFuture, err error) - ForceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture, err error) - Get(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string) (result sql.InstanceFailoverGroup, err error) - ListByLocation(ctx context.Context, resourceGroupName string, locationName string) (result sql.InstanceFailoverGroupListResultPage, err error) - ListByLocationComplete(ctx context.Context, resourceGroupName string, locationName string) (result sql.InstanceFailoverGroupListResultIterator, err error) -} - -var _ InstanceFailoverGroupsClientAPI = (*sql.InstanceFailoverGroupsClient)(nil) - -// TdeCertificatesClientAPI contains the set of methods on the TdeCertificatesClient type. -type TdeCertificatesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, serverName string, parameters sql.TdeCertificate) (result sql.TdeCertificatesCreateFuture, err error) -} - -var _ TdeCertificatesClientAPI = (*sql.TdeCertificatesClient)(nil) - -// ManagedInstanceTdeCertificatesClientAPI contains the set of methods on the ManagedInstanceTdeCertificatesClient type. -type ManagedInstanceTdeCertificatesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.TdeCertificate) (result sql.ManagedInstanceTdeCertificatesCreateFuture, err error) -} - -var _ ManagedInstanceTdeCertificatesClientAPI = (*sql.ManagedInstanceTdeCertificatesClient)(nil) - -// ManagedInstanceKeysClientAPI contains the set of methods on the ManagedInstanceKeysClient type. -type ManagedInstanceKeysClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string, parameters sql.ManagedInstanceKey) (result sql.ManagedInstanceKeysCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (result sql.ManagedInstanceKeysDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string) (result sql.ManagedInstanceKey, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (result sql.ManagedInstanceKeyListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, filter string) (result sql.ManagedInstanceKeyListResultIterator, err error) -} - -var _ ManagedInstanceKeysClientAPI = (*sql.ManagedInstanceKeysClient)(nil) - -// ManagedInstanceEncryptionProtectorsClientAPI contains the set of methods on the ManagedInstanceEncryptionProtectorsClient type. -type ManagedInstanceEncryptionProtectorsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceEncryptionProtector) (result sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtector, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorListResultIterator, err error) - Revalidate(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceEncryptionProtectorsRevalidateFuture, err error) -} - -var _ ManagedInstanceEncryptionProtectorsClientAPI = (*sql.ManagedInstanceEncryptionProtectorsClient)(nil) - -// RecoverableManagedDatabasesClientAPI contains the set of methods on the RecoverableManagedDatabasesClient type. -type RecoverableManagedDatabasesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, recoverableDatabaseName string) (result sql.RecoverableManagedDatabase, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RecoverableManagedDatabaseListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RecoverableManagedDatabaseListResultIterator, err error) -} - -var _ RecoverableManagedDatabasesClientAPI = (*sql.RecoverableManagedDatabasesClient)(nil) - -// BackupShortTermRetentionPoliciesClientAPI contains the set of methods on the BackupShortTermRetentionPoliciesClient type. -type BackupShortTermRetentionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupShortTermRetentionPolicy) (result sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicyListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupShortTermRetentionPolicyListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupShortTermRetentionPolicy) (result sql.BackupShortTermRetentionPoliciesUpdateFuture, err error) -} - -var _ BackupShortTermRetentionPoliciesClientAPI = (*sql.BackupShortTermRetentionPoliciesClient)(nil) - -// ManagedInstanceVulnerabilityAssessmentsClientAPI contains the set of methods on the ManagedInstanceVulnerabilityAssessmentsClient type. -type ManagedInstanceVulnerabilityAssessmentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceVulnerabilityAssessment) (result sql.ManagedInstanceVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceVulnerabilityAssessment, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceVulnerabilityAssessmentListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceVulnerabilityAssessmentListResultIterator, err error) -} - -var _ ManagedInstanceVulnerabilityAssessmentsClientAPI = (*sql.ManagedInstanceVulnerabilityAssessmentsClient)(nil) - -// ServerVulnerabilityAssessmentsClientAPI contains the set of methods on the ServerVulnerabilityAssessmentsClient type. -type ServerVulnerabilityAssessmentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerVulnerabilityAssessment) (result sql.ServerVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerVulnerabilityAssessment, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerVulnerabilityAssessmentListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerVulnerabilityAssessmentListResultIterator, err error) -} - -var _ ServerVulnerabilityAssessmentsClientAPI = (*sql.ServerVulnerabilityAssessmentsClient)(nil) - -// ManagedDatabaseSensitivityLabelsClientAPI contains the set of methods on the ManagedDatabaseSensitivityLabelsClient type. -type ManagedDatabaseSensitivityLabelsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, parameters sql.SensitivityLabel) (result sql.SensitivityLabel, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - DisableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - EnableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource sql.SensitivityLabelSource) (result sql.SensitivityLabel, err error) - ListCurrentByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (result sql.SensitivityLabelListResultPage, err error) - ListCurrentByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (result sql.SensitivityLabelListResultIterator, err error) - ListRecommendedByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result sql.SensitivityLabelListResultPage, err error) - ListRecommendedByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result sql.SensitivityLabelListResultIterator, err error) -} - -var _ ManagedDatabaseSensitivityLabelsClientAPI = (*sql.ManagedDatabaseSensitivityLabelsClient)(nil) - -// InstancePoolsClientAPI contains the set of methods on the InstancePoolsClient type. -type InstancePoolsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, instancePoolName string, parameters sql.InstancePool) (result sql.InstancePoolsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.InstancePoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.InstancePool, err error) - List(ctx context.Context) (result sql.InstancePoolListResultPage, err error) - ListComplete(ctx context.Context) (result sql.InstancePoolListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.InstancePoolListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.InstancePoolListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, instancePoolName string, parameters sql.InstancePoolUpdate) (result sql.InstancePoolsUpdateFuture, err error) -} - -var _ InstancePoolsClientAPI = (*sql.InstancePoolsClient)(nil) - -// UsagesClientAPI contains the set of methods on the UsagesClient type. -type UsagesClientAPI interface { - ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string, expandChildren *bool) (result sql.UsageListResultPage, err error) - ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string, expandChildren *bool) (result sql.UsageListResultIterator, err error) -} - -var _ UsagesClientAPI = (*sql.UsagesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters sql.PrivateEndpointConnection) (result sql.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnection, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*sql.PrivateEndpointConnectionsClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, groupName string) (result sql.PrivateLinkResource, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateLinkResourceListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateLinkResourceListResultIterator, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*sql.PrivateLinkResourcesClient)(nil) - -// ServersClientAPI contains the set of methods on the ServersClient type. -type ServersClientAPI interface { - CheckNameAvailability(ctx context.Context, parameters sql.CheckNameAvailabilityRequest) (result sql.CheckNameAvailabilityResponse, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.Server) (result sql.ServersCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServersDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.Server, err error) - ImportDatabase(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ImportNewDatabaseDefinition) (result sql.ServersImportDatabaseFuture, err error) - List(ctx context.Context) (result sql.ServerListResultPage, err error) - ListComplete(ctx context.Context) (result sql.ServerListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ServerListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.ServerListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerUpdate) (result sql.ServersUpdateFuture, err error) -} - -var _ ServersClientAPI = (*sql.ServersClient)(nil) - -// CapabilitiesClientAPI contains the set of methods on the CapabilitiesClient type. -type CapabilitiesClientAPI interface { - ListByLocation(ctx context.Context, locationName string, include sql.CapabilityGroup) (result sql.LocationCapabilities, err error) -} - -var _ CapabilitiesClientAPI = (*sql.CapabilitiesClient)(nil) - -// LongTermRetentionManagedInstanceBackupsClientAPI contains the set of methods on the LongTermRetentionManagedInstanceBackupsClient type. -type LongTermRetentionManagedInstanceBackupsClientAPI interface { - Delete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.LongTermRetentionManagedInstanceBackupsDeleteFuture, err error) - DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture, err error) - Get(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.ManagedInstanceLongTermRetentionBackup, err error) - GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.ManagedInstanceLongTermRetentionBackup, err error) - ListByDatabase(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState1) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState1) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByInstance(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState2) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByInstanceComplete(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState2) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState3) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState3) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState4) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState4) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupInstance(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState5) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByResourceGroupInstanceComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState5) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState6) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState6) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) -} - -var _ LongTermRetentionManagedInstanceBackupsClientAPI = (*sql.LongTermRetentionManagedInstanceBackupsClient)(nil) - -// ManagedInstanceLongTermRetentionPoliciesClientAPI contains the set of methods on the ManagedInstanceLongTermRetentionPoliciesClient type. -type ManagedInstanceLongTermRetentionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.ManagedInstanceLongTermRetentionPolicy) (result sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedInstanceLongTermRetentionPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedInstanceLongTermRetentionPolicyListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedInstanceLongTermRetentionPolicyListResultIterator, err error) -} - -var _ ManagedInstanceLongTermRetentionPoliciesClientAPI = (*sql.ManagedInstanceLongTermRetentionPoliciesClient)(nil) - -// WorkloadGroupsClientAPI contains the set of methods on the WorkloadGroupsClient type. -type WorkloadGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, parameters sql.WorkloadGroup) (result sql.WorkloadGroupsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (result sql.WorkloadGroupsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (result sql.WorkloadGroup, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.WorkloadGroupListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.WorkloadGroupListResultIterator, err error) -} - -var _ WorkloadGroupsClientAPI = (*sql.WorkloadGroupsClient)(nil) - -// WorkloadClassifiersClientAPI contains the set of methods on the WorkloadClassifiersClient type. -type WorkloadClassifiersClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string, parameters sql.WorkloadClassifier) (result sql.WorkloadClassifiersCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string) (result sql.WorkloadClassifiersDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string) (result sql.WorkloadClassifier, err error) - ListByWorkloadGroup(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (result sql.WorkloadClassifierListResultPage, err error) - ListByWorkloadGroupComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (result sql.WorkloadClassifierListResultIterator, err error) -} - -var _ WorkloadClassifiersClientAPI = (*sql.WorkloadClassifiersClient)(nil) - -// ManagedInstanceOperationsClientAPI contains the set of methods on the ManagedInstanceOperationsClient type. -type ManagedInstanceOperationsClientAPI interface { - Cancel(ctx context.Context, resourceGroupName string, managedInstanceName string, operationID uuid.UUID) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, operationID uuid.UUID) (result sql.ManagedInstanceOperation, err error) - ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceOperationListResultPage, err error) - ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceOperationListResultIterator, err error) -} - -var _ ManagedInstanceOperationsClientAPI = (*sql.ManagedInstanceOperationsClient)(nil) - -// ServerAzureADAdministratorsClientAPI contains the set of methods on the ServerAzureADAdministratorsClient type. -type ServerAzureADAdministratorsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerAzureADAdministrator) (result sql.ServerAzureADAdministratorsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAzureADAdministratorsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAzureADAdministrator, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.AdministratorListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.AdministratorListResultIterator, err error) -} - -var _ ServerAzureADAdministratorsClientAPI = (*sql.ServerAzureADAdministratorsClient)(nil) - -// SyncGroupsClientAPI contains the set of methods on the SyncGroupsClient type. -type SyncGroupsClientAPI interface { - CancelSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters sql.SyncGroup) (result sql.SyncGroupsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncGroupsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncGroup, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.SyncGroupListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.SyncGroupListResultIterator, err error) - ListHubSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncFullSchemaPropertiesListResultPage, err error) - ListHubSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncFullSchemaPropertiesListResultIterator, err error) - ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result sql.SyncGroupLogListResultPage, err error) - ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result sql.SyncGroupLogListResultIterator, err error) - ListSyncDatabaseIds(ctx context.Context, locationName string) (result sql.SyncDatabaseIDListResultPage, err error) - ListSyncDatabaseIdsComplete(ctx context.Context, locationName string) (result sql.SyncDatabaseIDListResultIterator, err error) - RefreshHubSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncGroupsRefreshHubSchemaFuture, err error) - TriggerSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters sql.SyncGroup) (result sql.SyncGroupsUpdateFuture, err error) -} - -var _ SyncGroupsClientAPI = (*sql.SyncGroupsClient)(nil) - -// SyncMembersClientAPI contains the set of methods on the SyncMembersClient type. -type SyncMembersClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters sql.SyncMember) (result sql.SyncMembersCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncMembersDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncMember, err error) - ListBySyncGroup(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncMemberListResultPage, err error) - ListBySyncGroupComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncMemberListResultIterator, err error) - ListMemberSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncFullSchemaPropertiesListResultPage, err error) - ListMemberSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncFullSchemaPropertiesListResultIterator, err error) - RefreshMemberSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result sql.SyncMembersRefreshMemberSchemaFuture, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters sql.SyncMember) (result sql.SyncMembersUpdateFuture, err error) -} - -var _ SyncMembersClientAPI = (*sql.SyncMembersClient)(nil) - -// ManagedInstancesClientAPI contains the set of methods on the ManagedInstancesClient type. -type ManagedInstancesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstance) (result sql.ManagedInstancesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) - Failover(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType sql.ReplicaType) (result sql.ManagedInstancesFailoverFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) - List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) - ListComplete(ctx context.Context) (result sql.ManagedInstanceListResultIterator, err error) - ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultPage, err error) - ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) -} - -var _ ManagedInstancesClientAPI = (*sql.ManagedInstancesClient)(nil) - -// ManagedDatabaseRestoreDetailsClientAPI contains the set of methods on the ManagedDatabaseRestoreDetailsClient type. -type ManagedDatabaseRestoreDetailsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedDatabaseRestoreDetailsResult, err error) -} - -var _ ManagedDatabaseRestoreDetailsClientAPI = (*sql.ManagedDatabaseRestoreDetailsClient)(nil) - -// ManagedDatabasesClientAPI contains the set of methods on the ManagedDatabasesClient type. -type ManagedDatabasesClientAPI interface { - CompleteRestore(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.CompleteDatabaseRestoreDefinition) (result sql.ManagedDatabasesCompleteRestoreFuture, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.ManagedDatabase) (result sql.ManagedDatabasesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedDatabasesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedDatabase, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedDatabaseListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedDatabaseListResultIterator, err error) - ListInaccessibleByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedDatabaseListResultPage, err error) - ListInaccessibleByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedDatabaseListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.ManagedDatabaseUpdate) (result sql.ManagedDatabasesUpdateFuture, err error) -} - -var _ ManagedDatabasesClientAPI = (*sql.ManagedDatabasesClient)(nil) - -// ServerAzureADOnlyAuthenticationsClientAPI contains the set of methods on the ServerAzureADOnlyAuthenticationsClient type. -type ServerAzureADOnlyAuthenticationsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerAzureADOnlyAuthentication) (result sql.ServerAzureADOnlyAuthenticationsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAzureADOnlyAuthenticationsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerAzureADOnlyAuthentication, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.AzureADOnlyAuthListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.AzureADOnlyAuthListResultIterator, err error) -} - -var _ ServerAzureADOnlyAuthenticationsClientAPI = (*sql.ServerAzureADOnlyAuthenticationsClient)(nil) - -// ImportExportClientAPI contains the set of methods on the ImportExportClient type. -type ImportExportClientAPI interface { - Import(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ImportExistingDatabaseDefinition) (result sql.ImportExportImportFuture, err error) -} - -var _ ImportExportClientAPI = (*sql.ImportExportClient)(nil) - -// ManagedInstanceAzureADOnlyAuthenticationsClientAPI contains the set of methods on the ManagedInstanceAzureADOnlyAuthenticationsClient type. -type ManagedInstanceAzureADOnlyAuthenticationsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceAzureADOnlyAuthentication) (result sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAzureADOnlyAuthentication, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAzureADOnlyAuthListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceAzureADOnlyAuthListResultIterator, err error) -} - -var _ ManagedInstanceAzureADOnlyAuthenticationsClientAPI = (*sql.ManagedInstanceAzureADOnlyAuthenticationsClient)(nil) - -// ServerTrustGroupsClientAPI contains the set of methods on the ServerTrustGroupsClient type. -type ServerTrustGroupsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string, parameters sql.ServerTrustGroup) (result sql.ServerTrustGroupsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (result sql.ServerTrustGroupsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string) (result sql.ServerTrustGroup, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ServerTrustGroupListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ServerTrustGroupListResultIterator, err error) - ListByLocation(ctx context.Context, resourceGroupName string, locationName string) (result sql.ServerTrustGroupListResultPage, err error) - ListByLocationComplete(ctx context.Context, resourceGroupName string, locationName string) (result sql.ServerTrustGroupListResultIterator, err error) -} - -var _ ServerTrustGroupsClientAPI = (*sql.ServerTrustGroupsClient)(nil) diff --git a/services/preview/sql/mgmt/v3.0/sql/subscriptionusages.go b/services/preview/sql/mgmt/v3.0/sql/subscriptionusages.go deleted file mode 100644 index 2362a090b572..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/subscriptionusages.go +++ /dev/null @@ -1,226 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SubscriptionUsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type SubscriptionUsagesClient struct { - BaseClient -} - -// NewSubscriptionUsagesClient creates an instance of the SubscriptionUsagesClient client. -func NewSubscriptionUsagesClient(subscriptionID string) SubscriptionUsagesClient { - return NewSubscriptionUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionUsagesClientWithBaseURI creates an instance of the SubscriptionUsagesClient 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 NewSubscriptionUsagesClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionUsagesClient { - return SubscriptionUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a subscription usage metric. -// Parameters: -// locationName - the name of the region where the resource is located. -// usageName - name of usage metric to return. -func (client SubscriptionUsagesClient) Get(ctx context.Context, locationName string, usageName string) (result SubscriptionUsage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsagesClient.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, locationName, usageName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionUsagesClient) GetPreparer(ctx context.Context, locationName string, usageName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "usageName": autorest.Encode("path", usageName), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}", 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 SubscriptionUsagesClient) 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 SubscriptionUsagesClient) GetResponder(resp *http.Response) (result SubscriptionUsage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByLocation gets all subscription usage metrics in a given location. -// Parameters: -// locationName - the name of the region where the resource is located. -func (client SubscriptionUsagesClient) ListByLocation(ctx context.Context, locationName string) (result SubscriptionUsageListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsagesClient.ListByLocation") - defer func() { - sc := -1 - if result.sulr.Response.Response != nil { - sc = result.sulr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByLocationNextResults - req, err := client.ListByLocationPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.sulr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "ListByLocation", resp, "Failure sending request") - return - } - - result.sulr, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "ListByLocation", resp, "Failure responding to request") - return - } - if result.sulr.hasNextLink() && result.sulr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client SubscriptionUsagesClient) ListByLocationPreparer(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 = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionUsagesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client SubscriptionUsagesClient) ListByLocationResponder(resp *http.Response) (result SubscriptionUsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByLocationNextResults retrieves the next set of results, if any. -func (client SubscriptionUsagesClient) listByLocationNextResults(ctx context.Context, lastResults SubscriptionUsageListResult) (result SubscriptionUsageListResult, err error) { - req, err := lastResults.subscriptionUsageListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "listByLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "listByLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SubscriptionUsagesClient", "listByLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client SubscriptionUsagesClient) ListByLocationComplete(ctx context.Context, locationName string) (result SubscriptionUsageListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsagesClient.ListByLocation") - 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.ListByLocation(ctx, locationName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/syncagents.go b/services/preview/sql/mgmt/v3.0/sql/syncagents.go deleted file mode 100644 index 9ad3b1b33350..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/syncagents.go +++ /dev/null @@ -1,597 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SyncAgentsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type SyncAgentsClient struct { - BaseClient -} - -// NewSyncAgentsClient creates an instance of the SyncAgentsClient client. -func NewSyncAgentsClient(subscriptionID string) SyncAgentsClient { - return NewSyncAgentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSyncAgentsClientWithBaseURI creates an instance of the SyncAgentsClient 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 NewSyncAgentsClientWithBaseURI(baseURI string, subscriptionID string) SyncAgentsClient { - return SyncAgentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a sync agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -// parameters - the requested sync agent resource state. -func (client SyncAgentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, parameters SyncAgent) (result SyncAgentsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, syncAgentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SyncAgentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, parameters SyncAgent) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}", 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 SyncAgentsClient) CreateOrUpdateSender(req *http.Request) (future SyncAgentsCreateOrUpdateFuture, 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 SyncAgentsClient) CreateOrUpdateResponder(resp *http.Response) (result SyncAgent, 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 a sync agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -func (client SyncAgentsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, syncAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SyncAgentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}", 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 SyncAgentsClient) DeleteSender(req *http.Request) (future SyncAgentsDeleteFuture, 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 SyncAgentsClient) 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 -} - -// GenerateKey generates a sync agent key. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -func (client SyncAgentsClient) GenerateKey(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentKeyProperties, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.GenerateKey") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GenerateKeyPreparer(ctx, resourceGroupName, serverName, syncAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "GenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "GenerateKey", resp, "Failure sending request") - return - } - - result, err = client.GenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "GenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// GenerateKeyPreparer prepares the GenerateKey request. -func (client SyncAgentsClient) GenerateKeyPreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}/generateKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateKeySender sends the GenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client SyncAgentsClient) GenerateKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateKeyResponder handles the response to the GenerateKey request. The method always -// closes the http.Response Body. -func (client SyncAgentsClient) GenerateKeyResponder(resp *http.Response) (result SyncAgentKeyProperties, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a sync agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -func (client SyncAgentsClient) Get(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgent, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.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, serverName, syncAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SyncAgentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}", 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 SyncAgentsClient) 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 SyncAgentsClient) GetResponder(resp *http.Response) (result SyncAgent, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer lists sync agents in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -func (client SyncAgentsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result SyncAgentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.ListByServer") - defer func() { - sc := -1 - if result.salr.Response.Response != nil { - sc = result.salr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.salr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.salr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.salr.hasNextLink() && result.salr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client SyncAgentsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client SyncAgentsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client SyncAgentsClient) ListByServerResponder(resp *http.Response) (result SyncAgentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client SyncAgentsClient) listByServerNextResults(ctx context.Context, lastResults SyncAgentListResult) (result SyncAgentListResult, err error) { - req, err := lastResults.syncAgentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncAgentsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result SyncAgentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// ListLinkedDatabases lists databases linked to a sync agent. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server on which the sync agent is hosted. -// syncAgentName - the name of the sync agent. -func (client SyncAgentsClient) ListLinkedDatabases(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentLinkedDatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.ListLinkedDatabases") - defer func() { - sc := -1 - if result.saldlr.Response.Response != nil { - sc = result.saldlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listLinkedDatabasesNextResults - req, err := client.ListLinkedDatabasesPreparer(ctx, resourceGroupName, serverName, syncAgentName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListLinkedDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListLinkedDatabasesSender(req) - if err != nil { - result.saldlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListLinkedDatabases", resp, "Failure sending request") - return - } - - result.saldlr, err = client.ListLinkedDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "ListLinkedDatabases", resp, "Failure responding to request") - return - } - if result.saldlr.hasNextLink() && result.saldlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListLinkedDatabasesPreparer prepares the ListLinkedDatabases request. -func (client SyncAgentsClient) ListLinkedDatabasesPreparer(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncAgentName": autorest.Encode("path", syncAgentName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/syncAgents/{syncAgentName}/linkedDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListLinkedDatabasesSender sends the ListLinkedDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client SyncAgentsClient) ListLinkedDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListLinkedDatabasesResponder handles the response to the ListLinkedDatabases request. The method always -// closes the http.Response Body. -func (client SyncAgentsClient) ListLinkedDatabasesResponder(resp *http.Response) (result SyncAgentLinkedDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listLinkedDatabasesNextResults retrieves the next set of results, if any. -func (client SyncAgentsClient) listLinkedDatabasesNextResults(ctx context.Context, lastResults SyncAgentLinkedDatabaseListResult) (result SyncAgentLinkedDatabaseListResult, err error) { - req, err := lastResults.syncAgentLinkedDatabaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listLinkedDatabasesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListLinkedDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listLinkedDatabasesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListLinkedDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncAgentsClient", "listLinkedDatabasesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListLinkedDatabasesComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncAgentsClient) ListLinkedDatabasesComplete(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string) (result SyncAgentLinkedDatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentsClient.ListLinkedDatabases") - 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.ListLinkedDatabases(ctx, resourceGroupName, serverName, syncAgentName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/syncgroups.go b/services/preview/sql/mgmt/v3.0/sql/syncgroups.go deleted file mode 100644 index 06cfc2c9a827..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/syncgroups.go +++ /dev/null @@ -1,1107 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SyncGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type SyncGroupsClient struct { - BaseClient -} - -// NewSyncGroupsClient creates an instance of the SyncGroupsClient client. -func NewSyncGroupsClient(subscriptionID string) SyncGroupsClient { - return NewSyncGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSyncGroupsClientWithBaseURI creates an instance of the SyncGroupsClient 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 NewSyncGroupsClientWithBaseURI(baseURI string, subscriptionID string) SyncGroupsClient { - return SyncGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CancelSync cancels a sync group synchronization. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) CancelSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.CancelSync") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelSyncPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CancelSync", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSyncSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CancelSync", resp, "Failure sending request") - return - } - - result, err = client.CancelSyncResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CancelSync", resp, "Failure responding to request") - return - } - - return -} - -// CancelSyncPreparer prepares the CancelSync request. -func (client SyncGroupsClient) CancelSyncPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSyncSender sends the CancelSync request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) CancelSyncSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelSyncResponder handles the response to the CancelSync request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) CancelSyncResponder(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 a sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -// parameters - the requested sync group resource state. -func (client SyncGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (result SyncGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SyncGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", 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 SyncGroupsClient) CreateOrUpdateSender(req *http.Request) (future SyncGroupsCreateOrUpdateFuture, 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 SyncGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result SyncGroup, 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 a sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SyncGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", 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 SyncGroupsClient) DeleteSender(req *http.Request) (future SyncGroupsDeleteFuture, 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 SyncGroupsClient) 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 a sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.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, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SyncGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", 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 SyncGroupsClient) 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 SyncGroupsClient) GetResponder(resp *http.Response) (result SyncGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase lists sync groups under a hub database. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -func (client SyncGroupsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result SyncGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListByDatabase") - defer func() { - sc := -1 - if result.sglr.Response.Response != nil { - sc = result.sglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.sglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.sglr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.sglr.hasNextLink() && result.sglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client SyncGroupsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) ListByDatabaseResponder(resp *http.Response) (result SyncGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client SyncGroupsClient) listByDatabaseNextResults(ctx context.Context, lastResults SyncGroupListResult) (result SyncGroupListResult, err error) { - req, err := lastResults.syncGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncGroupsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result SyncGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} - -// ListHubSchemas gets a collection of hub database schemas. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) ListHubSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncFullSchemaPropertiesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListHubSchemas") - defer func() { - sc := -1 - if result.sfsplr.Response.Response != nil { - sc = result.sfsplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listHubSchemasNextResults - req, err := client.ListHubSchemasPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListHubSchemas", nil, "Failure preparing request") - return - } - - resp, err := client.ListHubSchemasSender(req) - if err != nil { - result.sfsplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListHubSchemas", resp, "Failure sending request") - return - } - - result.sfsplr, err = client.ListHubSchemasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListHubSchemas", resp, "Failure responding to request") - return - } - if result.sfsplr.hasNextLink() && result.sfsplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListHubSchemasPreparer prepares the ListHubSchemas request. -func (client SyncGroupsClient) ListHubSchemasPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListHubSchemasSender sends the ListHubSchemas request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) ListHubSchemasSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListHubSchemasResponder handles the response to the ListHubSchemas request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) ListHubSchemasResponder(resp *http.Response) (result SyncFullSchemaPropertiesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listHubSchemasNextResults retrieves the next set of results, if any. -func (client SyncGroupsClient) listHubSchemasNextResults(ctx context.Context, lastResults SyncFullSchemaPropertiesListResult) (result SyncFullSchemaPropertiesListResult, err error) { - req, err := lastResults.syncFullSchemaPropertiesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listHubSchemasNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListHubSchemasSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listHubSchemasNextResults", resp, "Failure sending next results request") - } - result, err = client.ListHubSchemasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listHubSchemasNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListHubSchemasComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncGroupsClient) ListHubSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncFullSchemaPropertiesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListHubSchemas") - 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.ListHubSchemas(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - return -} - -// ListLogs gets a collection of sync group logs. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -// startTime - get logs generated after this time. -// endTime - get logs generated before this time. -// typeParameter - the types of logs to retrieve. -// continuationToken - the continuation token for this operation. -func (client SyncGroupsClient) ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListLogs") - defer func() { - sc := -1 - if result.sgllr.Response.Response != nil { - sc = result.sgllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listLogsNextResults - req, err := client.ListLogsPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, typeParameter, continuationToken) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListLogs", nil, "Failure preparing request") - return - } - - resp, err := client.ListLogsSender(req) - if err != nil { - result.sgllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListLogs", resp, "Failure sending request") - return - } - - result.sgllr, err = client.ListLogsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListLogs", resp, "Failure responding to request") - return - } - if result.sgllr.hasNextLink() && result.sgllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListLogsPreparer prepares the ListLogs request. -func (client SyncGroupsClient) ListLogsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "endTime": autorest.Encode("query", endTime), - "startTime": autorest.Encode("query", startTime), - "type": autorest.Encode("query", typeParameter), - } - if len(continuationToken) > 0 { - queryParameters["continuationToken"] = autorest.Encode("query", continuationToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListLogsSender sends the ListLogs request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) ListLogsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListLogsResponder handles the response to the ListLogs request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) ListLogsResponder(resp *http.Response) (result SyncGroupLogListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listLogsNextResults retrieves the next set of results, if any. -func (client SyncGroupsClient) listLogsNextResults(ctx context.Context, lastResults SyncGroupLogListResult) (result SyncGroupLogListResult, err error) { - req, err := lastResults.syncGroupLogListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listLogsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListLogsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listLogsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListLogsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listLogsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListLogsComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncGroupsClient) ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListLogs") - 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.ListLogs(ctx, resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, typeParameter, continuationToken) - return -} - -// ListSyncDatabaseIds gets a collection of sync database ids. -// Parameters: -// locationName - the name of the region where the resource is located. -func (client SyncGroupsClient) ListSyncDatabaseIds(ctx context.Context, locationName string) (result SyncDatabaseIDListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListSyncDatabaseIds") - defer func() { - sc := -1 - if result.sdilr.Response.Response != nil { - sc = result.sdilr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSyncDatabaseIdsNextResults - req, err := client.ListSyncDatabaseIdsPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListSyncDatabaseIds", nil, "Failure preparing request") - return - } - - resp, err := client.ListSyncDatabaseIdsSender(req) - if err != nil { - result.sdilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListSyncDatabaseIds", resp, "Failure sending request") - return - } - - result.sdilr, err = client.ListSyncDatabaseIdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "ListSyncDatabaseIds", resp, "Failure responding to request") - return - } - if result.sdilr.hasNextLink() && result.sdilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSyncDatabaseIdsPreparer prepares the ListSyncDatabaseIds request. -func (client SyncGroupsClient) ListSyncDatabaseIdsPreparer(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 = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSyncDatabaseIdsSender sends the ListSyncDatabaseIds request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) ListSyncDatabaseIdsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSyncDatabaseIdsResponder handles the response to the ListSyncDatabaseIds request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) ListSyncDatabaseIdsResponder(resp *http.Response) (result SyncDatabaseIDListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSyncDatabaseIdsNextResults retrieves the next set of results, if any. -func (client SyncGroupsClient) listSyncDatabaseIdsNextResults(ctx context.Context, lastResults SyncDatabaseIDListResult) (result SyncDatabaseIDListResult, err error) { - req, err := lastResults.syncDatabaseIDListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listSyncDatabaseIdsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSyncDatabaseIdsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listSyncDatabaseIdsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSyncDatabaseIdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "listSyncDatabaseIdsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSyncDatabaseIdsComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncGroupsClient) ListSyncDatabaseIdsComplete(ctx context.Context, locationName string) (result SyncDatabaseIDListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListSyncDatabaseIds") - 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.ListSyncDatabaseIds(ctx, locationName) - return -} - -// RefreshHubSchema refreshes a hub database schema. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) RefreshHubSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncGroupsRefreshHubSchemaFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.RefreshHubSchema") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RefreshHubSchemaPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "RefreshHubSchema", nil, "Failure preparing request") - return - } - - result, err = client.RefreshHubSchemaSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "RefreshHubSchema", result.Response(), "Failure sending request") - return - } - - return -} - -// RefreshHubSchemaPreparer prepares the RefreshHubSchema request. -func (client SyncGroupsClient) RefreshHubSchemaPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshHubSchemaSender sends the RefreshHubSchema request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) RefreshHubSchemaSender(req *http.Request) (future SyncGroupsRefreshHubSchemaFuture, 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 -} - -// RefreshHubSchemaResponder handles the response to the RefreshHubSchema request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) RefreshHubSchemaResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// TriggerSync triggers a sync group synchronization. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncGroupsClient) TriggerSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.TriggerSync") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TriggerSyncPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "TriggerSync", nil, "Failure preparing request") - return - } - - resp, err := client.TriggerSyncSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "TriggerSync", resp, "Failure sending request") - return - } - - result, err = client.TriggerSyncResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "TriggerSync", resp, "Failure responding to request") - return - } - - return -} - -// TriggerSyncPreparer prepares the TriggerSync request. -func (client SyncGroupsClient) TriggerSyncPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TriggerSyncSender sends the TriggerSync request. The method will close the -// http.Response Body if it receives an error. -func (client SyncGroupsClient) TriggerSyncSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// TriggerSyncResponder handles the response to the TriggerSync request. The method always -// closes the http.Response Body. -func (client SyncGroupsClient) TriggerSyncResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates a sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -// parameters - the requested sync group resource state. -func (client SyncGroupsClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (result SyncGroupsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncGroupsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SyncGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}", 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 SyncGroupsClient) UpdateSender(req *http.Request) (future SyncGroupsUpdateFuture, 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 SyncGroupsClient) UpdateResponder(resp *http.Response) (result SyncGroup, 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/preview/sql/mgmt/v3.0/sql/syncmembers.go b/services/preview/sql/mgmt/v3.0/sql/syncmembers.go deleted file mode 100644 index bd0f57c649be..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/syncmembers.go +++ /dev/null @@ -1,712 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SyncMembersClient is the the Azure SQL Database management API provides a RESTful set of web services that interact -// with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and -// delete databases. -type SyncMembersClient struct { - BaseClient -} - -// NewSyncMembersClient creates an instance of the SyncMembersClient client. -func NewSyncMembersClient(subscriptionID string) SyncMembersClient { - return NewSyncMembersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSyncMembersClientWithBaseURI creates an instance of the SyncMembersClient 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 NewSyncMembersClientWithBaseURI(baseURI string, subscriptionID string) SyncMembersClient { - return SyncMembersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a sync member. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -// parameters - the requested sync member resource state. -func (client SyncMembersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (result SyncMembersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SyncMembersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", 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 SyncMembersClient) CreateOrUpdateSender(req *http.Request) (future SyncMembersCreateOrUpdateFuture, 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 SyncMembersClient) CreateOrUpdateResponder(resp *http.Response) (result SyncMember, 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 a sync member. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -func (client SyncMembersClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncMembersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SyncMembersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", 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 SyncMembersClient) DeleteSender(req *http.Request) (future SyncMembersDeleteFuture, 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 SyncMembersClient) 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 a sync member. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -func (client SyncMembersClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncMember, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.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, serverName, databaseName, syncGroupName, syncMemberName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SyncMembersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", 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 SyncMembersClient) 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 SyncMembersClient) GetResponder(resp *http.Response) (result SyncMember, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySyncGroup lists sync members in the given sync group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group. -func (client SyncMembersClient) ListBySyncGroup(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncMemberListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.ListBySyncGroup") - defer func() { - sc := -1 - if result.smlr.Response.Response != nil { - sc = result.smlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySyncGroupNextResults - req, err := client.ListBySyncGroupPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListBySyncGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySyncGroupSender(req) - if err != nil { - result.smlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListBySyncGroup", resp, "Failure sending request") - return - } - - result.smlr, err = client.ListBySyncGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListBySyncGroup", resp, "Failure responding to request") - return - } - if result.smlr.hasNextLink() && result.smlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySyncGroupPreparer prepares the ListBySyncGroup request. -func (client SyncMembersClient) ListBySyncGroupPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySyncGroupSender sends the ListBySyncGroup request. The method will close the -// http.Response Body if it receives an error. -func (client SyncMembersClient) ListBySyncGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySyncGroupResponder handles the response to the ListBySyncGroup request. The method always -// closes the http.Response Body. -func (client SyncMembersClient) ListBySyncGroupResponder(resp *http.Response) (result SyncMemberListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySyncGroupNextResults retrieves the next set of results, if any. -func (client SyncMembersClient) listBySyncGroupNextResults(ctx context.Context, lastResults SyncMemberListResult) (result SyncMemberListResult, err error) { - req, err := lastResults.syncMemberListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listBySyncGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySyncGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listBySyncGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySyncGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listBySyncGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySyncGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncMembersClient) ListBySyncGroupComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result SyncMemberListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.ListBySyncGroup") - 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.ListBySyncGroup(ctx, resourceGroupName, serverName, databaseName, syncGroupName) - return -} - -// ListMemberSchemas gets a sync member database schema. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -func (client SyncMembersClient) ListMemberSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncFullSchemaPropertiesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.ListMemberSchemas") - defer func() { - sc := -1 - if result.sfsplr.Response.Response != nil { - sc = result.sfsplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listMemberSchemasNextResults - req, err := client.ListMemberSchemasPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListMemberSchemas", nil, "Failure preparing request") - return - } - - resp, err := client.ListMemberSchemasSender(req) - if err != nil { - result.sfsplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListMemberSchemas", resp, "Failure sending request") - return - } - - result.sfsplr, err = client.ListMemberSchemasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "ListMemberSchemas", resp, "Failure responding to request") - return - } - if result.sfsplr.hasNextLink() && result.sfsplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListMemberSchemasPreparer prepares the ListMemberSchemas request. -func (client SyncMembersClient) ListMemberSchemasPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/schemas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMemberSchemasSender sends the ListMemberSchemas request. The method will close the -// http.Response Body if it receives an error. -func (client SyncMembersClient) ListMemberSchemasSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMemberSchemasResponder handles the response to the ListMemberSchemas request. The method always -// closes the http.Response Body. -func (client SyncMembersClient) ListMemberSchemasResponder(resp *http.Response) (result SyncFullSchemaPropertiesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listMemberSchemasNextResults retrieves the next set of results, if any. -func (client SyncMembersClient) listMemberSchemasNextResults(ctx context.Context, lastResults SyncFullSchemaPropertiesListResult) (result SyncFullSchemaPropertiesListResult, err error) { - req, err := lastResults.syncFullSchemaPropertiesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listMemberSchemasNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListMemberSchemasSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listMemberSchemasNextResults", resp, "Failure sending next results request") - } - result, err = client.ListMemberSchemasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "listMemberSchemasNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListMemberSchemasComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncMembersClient) ListMemberSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncFullSchemaPropertiesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.ListMemberSchemas") - 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.ListMemberSchemas(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) - return -} - -// RefreshMemberSchema refreshes a sync member database schema. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -func (client SyncMembersClient) RefreshMemberSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (result SyncMembersRefreshMemberSchemaFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.RefreshMemberSchema") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RefreshMemberSchemaPreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "RefreshMemberSchema", nil, "Failure preparing request") - return - } - - result, err = client.RefreshMemberSchemaSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "RefreshMemberSchema", result.Response(), "Failure sending request") - return - } - - return -} - -// RefreshMemberSchemaPreparer prepares the RefreshMemberSchema request. -func (client SyncMembersClient) RefreshMemberSchemaPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshMemberSchemaSender sends the RefreshMemberSchema request. The method will close the -// http.Response Body if it receives an error. -func (client SyncMembersClient) RefreshMemberSchemaSender(req *http.Request) (future SyncMembersRefreshMemberSchemaFuture, 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 -} - -// RefreshMemberSchemaResponder handles the response to the RefreshMemberSchema request. The method always -// closes the http.Response Body. -func (client SyncMembersClient) RefreshMemberSchemaResponder(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 sync member. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database on which the sync group is hosted. -// syncGroupName - the name of the sync group on which the sync member is hosted. -// syncMemberName - the name of the sync member. -// parameters - the requested sync member resource state. -func (client SyncMembersClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (result SyncMembersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SyncMembersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.SyncMembersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SyncMembersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "syncGroupName": autorest.Encode("path", syncGroupName), - "syncMemberName": autorest.Encode("path", syncMemberName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}", 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 SyncMembersClient) UpdateSender(req *http.Request) (future SyncMembersUpdateFuture, 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 SyncMembersClient) UpdateResponder(resp *http.Response) (result SyncMember, 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/preview/sql/mgmt/v3.0/sql/tdecertificates.go b/services/preview/sql/mgmt/v3.0/sql/tdecertificates.go deleted file mode 100644 index ab35584ea1b0..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/tdecertificates.go +++ /dev/null @@ -1,123 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TdeCertificatesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type TdeCertificatesClient struct { - BaseClient -} - -// NewTdeCertificatesClient creates an instance of the TdeCertificatesClient client. -func NewTdeCertificatesClient(subscriptionID string) TdeCertificatesClient { - return NewTdeCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTdeCertificatesClientWithBaseURI creates an instance of the TdeCertificatesClient 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 NewTdeCertificatesClientWithBaseURI(baseURI string, subscriptionID string) TdeCertificatesClient { - return TdeCertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a TDE certificate for a given server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// parameters - the requested TDE certificate to be created or updated. -func (client TdeCertificatesClient) Create(ctx context.Context, resourceGroupName string, serverName string, parameters TdeCertificate) (result TdeCertificatesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TdeCertificatesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TdeCertificateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TdeCertificateProperties.PrivateBlob", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.TdeCertificatesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TdeCertificatesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TdeCertificatesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TdeCertificatesClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters TdeCertificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-10-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.Sql/servers/{serverName}/tdeCertificates", 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 TdeCertificatesClient) CreateSender(req *http.Request) (future TdeCertificatesCreateFuture, 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 TdeCertificatesClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/transparentdataencryptionactivities.go b/services/preview/sql/mgmt/v3.0/sql/transparentdataencryptionactivities.go deleted file mode 100644 index 309e0d47eb0d..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/transparentdataencryptionactivities.go +++ /dev/null @@ -1,115 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TransparentDataEncryptionActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type TransparentDataEncryptionActivitiesClient struct { - BaseClient -} - -// NewTransparentDataEncryptionActivitiesClient creates an instance of the TransparentDataEncryptionActivitiesClient -// client. -func NewTransparentDataEncryptionActivitiesClient(subscriptionID string) TransparentDataEncryptionActivitiesClient { - return NewTransparentDataEncryptionActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTransparentDataEncryptionActivitiesClientWithBaseURI creates an instance of the -// TransparentDataEncryptionActivitiesClient 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 NewTransparentDataEncryptionActivitiesClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionActivitiesClient { - return TransparentDataEncryptionActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByConfiguration returns a database's transparent data encryption operation result. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the transparent data encryption applies. -func (client TransparentDataEncryptionActivitiesClient) ListByConfiguration(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryptionActivityListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionActivitiesClient.ListByConfiguration") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByConfigurationPreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionActivitiesClient", "ListByConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.ListByConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionActivitiesClient", "ListByConfiguration", resp, "Failure sending request") - return - } - - result, err = client.ListByConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionActivitiesClient", "ListByConfiguration", resp, "Failure responding to request") - return - } - - return -} - -// ListByConfigurationPreparer prepares the ListByConfiguration request. -func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByConfigurationSender sends the ListByConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByConfigurationResponder handles the response to the ListByConfiguration request. The method always -// closes the http.Response Body. -func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationResponder(resp *http.Response) (result TransparentDataEncryptionActivityListResult, 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/sql/mgmt/v3.0/sql/transparentdataencryptions.go b/services/preview/sql/mgmt/v3.0/sql/transparentdataencryptions.go deleted file mode 100644 index 691b41cd1464..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/transparentdataencryptions.go +++ /dev/null @@ -1,198 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// TransparentDataEncryptionsClient is the the Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type TransparentDataEncryptionsClient struct { - BaseClient -} - -// NewTransparentDataEncryptionsClient creates an instance of the TransparentDataEncryptionsClient client. -func NewTransparentDataEncryptionsClient(subscriptionID string) TransparentDataEncryptionsClient { - return NewTransparentDataEncryptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTransparentDataEncryptionsClientWithBaseURI creates an instance of the TransparentDataEncryptionsClient 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 NewTransparentDataEncryptionsClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionsClient { - return TransparentDataEncryptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a database's transparent data encryption configuration. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which setting the transparent data encryption applies. -// parameters - the required parameters for creating or updating transparent data encryption. -func (client TransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionsClient.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, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TransparentDataEncryptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = 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.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}", 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 TransparentDataEncryptionsClient) 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 TransparentDataEncryptionsClient) CreateOrUpdateResponder(resp *http.Response) (result TransparentDataEncryption, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a database's transparent data encryption configuration. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the transparent data encryption applies. -func (client TransparentDataEncryptionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryption, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionsClient.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, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TransparentDataEncryptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - } - - const APIVersion = "2014-04-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.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}", 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 TransparentDataEncryptionsClient) 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 TransparentDataEncryptionsClient) GetResponder(resp *http.Response) (result TransparentDataEncryption, 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/sql/mgmt/v3.0/sql/usages.go b/services/preview/sql/mgmt/v3.0/sql/usages.go deleted file mode 100644 index 5afa6c8dc189..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/usages.go +++ /dev/null @@ -1,156 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// UsagesClient is the the Azure SQL Database management API provides a RESTful set of web services that interact with -// Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete -// databases. -type UsagesClient struct { - BaseClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient 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 NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByInstancePool gets all instance pool usage metrics -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// instancePoolName - the name of the instance pool to be retrieved. -// expandChildren - optional request parameter to include managed instance usages within the instance pool. -func (client UsagesClient) ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string, expandChildren *bool) (result UsageListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.ListByInstancePool") - defer func() { - sc := -1 - if result.ulr.Response.Response != nil { - sc = result.ulr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByInstancePoolNextResults - req, err := client.ListByInstancePoolPreparer(ctx, resourceGroupName, instancePoolName, expandChildren) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.UsagesClient", "ListByInstancePool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByInstancePoolSender(req) - if err != nil { - result.ulr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.UsagesClient", "ListByInstancePool", resp, "Failure sending request") - return - } - - result.ulr, err = client.ListByInstancePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.UsagesClient", "ListByInstancePool", resp, "Failure responding to request") - return - } - if result.ulr.hasNextLink() && result.ulr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByInstancePoolPreparer prepares the ListByInstancePool request. -func (client UsagesClient) ListByInstancePoolPreparer(ctx context.Context, resourceGroupName string, instancePoolName string, expandChildren *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instancePoolName": autorest.Encode("path", instancePoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if expandChildren != nil { - queryParameters["expandChildren"] = autorest.Encode("query", *expandChildren) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByInstancePoolSender sends the ListByInstancePool request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListByInstancePoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByInstancePoolResponder handles the response to the ListByInstancePool request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListByInstancePoolResponder(resp *http.Response) (result UsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByInstancePoolNextResults retrieves the next set of results, if any. -func (client UsagesClient) listByInstancePoolNextResults(ctx context.Context, lastResults UsageListResult) (result UsageListResult, err error) { - req, err := lastResults.usageListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.UsagesClient", "listByInstancePoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByInstancePoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.UsagesClient", "listByInstancePoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByInstancePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.UsagesClient", "listByInstancePoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByInstancePoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client UsagesClient) ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string, expandChildren *bool) (result UsageListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.ListByInstancePool") - 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.ListByInstancePool(ctx, resourceGroupName, instancePoolName, expandChildren) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/version.go b/services/preview/sql/mgmt/v3.0/sql/version.go deleted file mode 100644 index ce5cf4c1e32c..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package sql - -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() + " sql/v3.0" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/sql/mgmt/v3.0/sql/virtualclusters.go b/services/preview/sql/mgmt/v3.0/sql/virtualclusters.go deleted file mode 100644 index a5f661baaf7b..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/virtualclusters.go +++ /dev/null @@ -1,502 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// VirtualClustersClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type VirtualClustersClient struct { - BaseClient -} - -// NewVirtualClustersClient creates an instance of the VirtualClustersClient client. -func NewVirtualClustersClient(subscriptionID string) VirtualClustersClient { - return NewVirtualClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualClustersClientWithBaseURI creates an instance of the VirtualClustersClient 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 NewVirtualClustersClientWithBaseURI(baseURI string, subscriptionID string) VirtualClustersClient { - return VirtualClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes a virtual cluster. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// virtualClusterName - the name of the virtual cluster. -func (client VirtualClustersClient) Delete(ctx context.Context, resourceGroupName string, virtualClusterName string) (result VirtualClustersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, virtualClusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualClusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualClusterName": autorest.Encode("path", virtualClusterName), - } - - const APIVersion = "2015-05-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.Sql/virtualClusters/{virtualClusterName}", 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 VirtualClustersClient) DeleteSender(req *http.Request) (future VirtualClustersDeleteFuture, 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 VirtualClustersClient) 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 a virtual cluster. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// virtualClusterName - the name of the virtual cluster. -func (client VirtualClustersClient) Get(ctx context.Context, resourceGroupName string, virtualClusterName string) (result VirtualCluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.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, virtualClusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualClusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualClusterName": autorest.Encode("path", virtualClusterName), - } - - const APIVersion = "2015-05-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.Sql/virtualClusters/{virtualClusterName}", 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 VirtualClustersClient) 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 VirtualClustersClient) GetResponder(resp *http.Response) (result VirtualCluster, 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 virtualClusters in the subscription. -func (client VirtualClustersClient) List(ctx context.Context) (result VirtualClusterListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.List") - defer func() { - sc := -1 - if result.vclr.Response.Response != nil { - sc = result.vclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.vclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "List", resp, "Failure sending request") - return - } - - result.vclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "List", resp, "Failure responding to request") - return - } - if result.vclr.hasNextLink() && result.vclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters", 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 VirtualClustersClient) 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 VirtualClustersClient) ListResponder(resp *http.Response) (result VirtualClusterListResult, 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 VirtualClustersClient) listNextResults(ctx context.Context, lastResults VirtualClusterListResult) (result VirtualClusterListResult, err error) { - req, err := lastResults.virtualClusterListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "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, "sql.VirtualClustersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualClustersClient) ListComplete(ctx context.Context) (result VirtualClusterListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.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 virtual clusters in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -func (client VirtualClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VirtualClusterListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.vclr.Response.Response != nil { - sc = result.vclr.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, "sql.VirtualClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.vclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.vclr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.vclr.hasNextLink() && result.vclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client VirtualClustersClient) 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-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.Sql/virtualClusters", 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 VirtualClustersClient) 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 VirtualClustersClient) ListByResourceGroupResponder(resp *http.Response) (result VirtualClusterListResult, 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 VirtualClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults VirtualClusterListResult) (result VirtualClusterListResult, err error) { - req, err := lastResults.virtualClusterListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "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, "sql.VirtualClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VirtualClusterListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.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 -} - -// Update updates a virtual cluster. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// virtualClusterName - the name of the virtual cluster. -// parameters - the requested managed instance resource state. -func (client VirtualClustersClient) Update(ctx context.Context, resourceGroupName string, virtualClusterName string, parameters VirtualClusterUpdate) (result VirtualClustersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClustersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, virtualClusterName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualClustersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VirtualClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, virtualClusterName string, parameters VirtualClusterUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualClusterName": autorest.Encode("path", virtualClusterName), - } - - const APIVersion = "2015-05-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.Sql/virtualClusters/{virtualClusterName}", 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 VirtualClustersClient) UpdateSender(req *http.Request) (future VirtualClustersUpdateFuture, 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 VirtualClustersClient) UpdateResponder(resp *http.Response) (result VirtualCluster, 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/preview/sql/mgmt/v3.0/sql/virtualnetworkrules.go b/services/preview/sql/mgmt/v3.0/sql/virtualnetworkrules.go deleted file mode 100644 index 91880b34fb82..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/virtualnetworkrules.go +++ /dev/null @@ -1,406 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// VirtualNetworkRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type VirtualNetworkRulesClient struct { - BaseClient -} - -// NewVirtualNetworkRulesClient creates an instance of the VirtualNetworkRulesClient client. -func NewVirtualNetworkRulesClient(subscriptionID string) VirtualNetworkRulesClient { - return NewVirtualNetworkRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworkRulesClientWithBaseURI creates an instance of the VirtualNetworkRulesClient 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 NewVirtualNetworkRulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkRulesClient { - return VirtualNetworkRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an existing virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -// parameters - the requested virtual Network Rule Resource state. -func (client VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (result VirtualNetworkRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties.VirtualNetworkSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.VirtualNetworkRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworkRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkRulesCreateOrUpdateFuture, 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 VirtualNetworkRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkRule, 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 the virtual network rule with the given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworkRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) DeleteSender(req *http.Request) (future VirtualNetworkRulesDeleteFuture, 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 VirtualNetworkRulesClient) 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 a virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.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, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworkRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", 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 VirtualNetworkRulesClient) 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 VirtualNetworkRulesClient) GetResponder(resp *http.Response) (result VirtualNetworkRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of virtual network rules in a server. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -func (client VirtualNetworkRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - defer func() { - sc := -1 - if result.vnrlr.Response.Response != nil { - sc = result.vnrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.vnrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.vnrlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.vnrlr.hasNextLink() && result.vnrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client VirtualNetworkRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-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.Sql/servers/{serverName}/virtualNetworkRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) ListByServerResponder(resp *http.Response) (result VirtualNetworkRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client VirtualNetworkRulesClient) listByServerNextResults(ctx context.Context, lastResults VirtualNetworkRuleListResult) (result VirtualNetworkRuleListResult, err error) { - req, err := lastResults.virtualNetworkRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - 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.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/workloadclassifiers.go b/services/preview/sql/mgmt/v3.0/sql/workloadclassifiers.go deleted file mode 100644 index 30827c6f9a7b..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/workloadclassifiers.go +++ /dev/null @@ -1,422 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkloadClassifiersClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type WorkloadClassifiersClient struct { - BaseClient -} - -// NewWorkloadClassifiersClient creates an instance of the WorkloadClassifiersClient client. -func NewWorkloadClassifiersClient(subscriptionID string) WorkloadClassifiersClient { - return NewWorkloadClassifiersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkloadClassifiersClientWithBaseURI creates an instance of the WorkloadClassifiersClient 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 NewWorkloadClassifiersClientWithBaseURI(baseURI string, subscriptionID string) WorkloadClassifiersClient { - return WorkloadClassifiersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workload classifier. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// workloadGroupName - the name of the workload group from which to receive the classifier from. -// workloadClassifierName - the name of the workload classifier to create/update. -// parameters - the properties of the workload classifier. -func (client WorkloadClassifiersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string, parameters WorkloadClassifier) (result WorkloadClassifiersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifiersClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WorkloadClassifierProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WorkloadClassifierProperties.MemberName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("sql.WorkloadClassifiersClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkloadClassifiersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string, parameters WorkloadClassifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadClassifierName": autorest.Encode("path", workloadClassifierName), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}", 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 WorkloadClassifiersClient) CreateOrUpdateSender(req *http.Request) (future WorkloadClassifiersCreateOrUpdateFuture, 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 WorkloadClassifiersClient) CreateOrUpdateResponder(resp *http.Response) (result WorkloadClassifier, 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 a workload classifier. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// workloadGroupName - the name of the workload group from which to receive the classifier from. -// workloadClassifierName - the name of the workload classifier to delete. -func (client WorkloadClassifiersClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string) (result WorkloadClassifiersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifiersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkloadClassifiersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadClassifierName": autorest.Encode("path", workloadClassifierName), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}", 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 WorkloadClassifiersClient) DeleteSender(req *http.Request) (future WorkloadClassifiersDeleteFuture, 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 WorkloadClassifiersClient) 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 a workload classifier -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// workloadGroupName - the name of the workload group from which to receive the classifier from. -// workloadClassifierName - the name of the workload classifier. -func (client WorkloadClassifiersClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string) (result WorkloadClassifier, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifiersClient.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, serverName, databaseName, workloadGroupName, workloadClassifierName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkloadClassifiersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadClassifierName": autorest.Encode("path", workloadClassifierName), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}", 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 WorkloadClassifiersClient) 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 WorkloadClassifiersClient) GetResponder(resp *http.Response) (result WorkloadClassifier, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkloadGroup gets the list of workload classifiers for a workload group -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// workloadGroupName - the name of the workload group from which to receive the classifiers from. -func (client WorkloadClassifiersClient) ListByWorkloadGroup(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (result WorkloadClassifierListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifiersClient.ListByWorkloadGroup") - defer func() { - sc := -1 - if result.wclr.Response.Response != nil { - sc = result.wclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByWorkloadGroupNextResults - req, err := client.ListByWorkloadGroupPreparer(ctx, resourceGroupName, serverName, databaseName, workloadGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "ListByWorkloadGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkloadGroupSender(req) - if err != nil { - result.wclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "ListByWorkloadGroup", resp, "Failure sending request") - return - } - - result.wclr, err = client.ListByWorkloadGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "ListByWorkloadGroup", resp, "Failure responding to request") - return - } - if result.wclr.hasNextLink() && result.wclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkloadGroupPreparer prepares the ListByWorkloadGroup request. -func (client WorkloadClassifiersClient) ListByWorkloadGroupPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkloadGroupSender sends the ListByWorkloadGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WorkloadClassifiersClient) ListByWorkloadGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkloadGroupResponder handles the response to the ListByWorkloadGroup request. The method always -// closes the http.Response Body. -func (client WorkloadClassifiersClient) ListByWorkloadGroupResponder(resp *http.Response) (result WorkloadClassifierListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkloadGroupNextResults retrieves the next set of results, if any. -func (client WorkloadClassifiersClient) listByWorkloadGroupNextResults(ctx context.Context, lastResults WorkloadClassifierListResult) (result WorkloadClassifierListResult, err error) { - req, err := lastResults.workloadClassifierListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "listByWorkloadGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkloadGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "listByWorkloadGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkloadGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadClassifiersClient", "listByWorkloadGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkloadGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkloadClassifiersClient) ListByWorkloadGroupComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (result WorkloadClassifierListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifiersClient.ListByWorkloadGroup") - 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.ListByWorkloadGroup(ctx, resourceGroupName, serverName, databaseName, workloadGroupName) - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/workloadgroups.go b/services/preview/sql/mgmt/v3.0/sql/workloadgroups.go deleted file mode 100644 index 2c492cae55e1..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/workloadgroups.go +++ /dev/null @@ -1,416 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkloadGroupsClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type WorkloadGroupsClient struct { - BaseClient -} - -// NewWorkloadGroupsClient creates an instance of the WorkloadGroupsClient client. -func NewWorkloadGroupsClient(subscriptionID string) WorkloadGroupsClient { - return NewWorkloadGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkloadGroupsClientWithBaseURI creates an instance of the WorkloadGroupsClient 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 NewWorkloadGroupsClientWithBaseURI(baseURI string, subscriptionID string) WorkloadGroupsClient { - return WorkloadGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workload group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// workloadGroupName - the name of the workload group. -// parameters - the requested workload group state. -func (client WorkloadGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, parameters WorkloadGroup) (result WorkloadGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WorkloadGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WorkloadGroupProperties.MinResourcePercent", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WorkloadGroupProperties.MaxResourcePercent", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WorkloadGroupProperties.MinResourcePercentPerRequest", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("sql.WorkloadGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, workloadGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkloadGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, parameters WorkloadGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}", 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 WorkloadGroupsClient) CreateOrUpdateSender(req *http.Request) (future WorkloadGroupsCreateOrUpdateFuture, 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 WorkloadGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result WorkloadGroup, 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 a workload group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// workloadGroupName - the name of the workload group to delete. -func (client WorkloadGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (result WorkloadGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName, workloadGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkloadGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}", 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 WorkloadGroupsClient) DeleteSender(req *http.Request) (future WorkloadGroupsDeleteFuture, 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 WorkloadGroupsClient) 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 a workload group -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -// workloadGroupName - the name of the workload group. -func (client WorkloadGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (result WorkloadGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupsClient.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, serverName, databaseName, workloadGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkloadGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}", 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 WorkloadGroupsClient) 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 WorkloadGroupsClient) GetResponder(resp *http.Response) (result WorkloadGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase gets the list of workload groups -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client WorkloadGroupsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result WorkloadGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupsClient.ListByDatabase") - defer func() { - sc := -1 - if result.wglr.Response.Response != nil { - sc = result.wglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDatabaseNextResults - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.wglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result.wglr, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - if result.wglr.hasNextLink() && result.wglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client WorkloadGroupsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client WorkloadGroupsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client WorkloadGroupsClient) ListByDatabaseResponder(resp *http.Response) (result WorkloadGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDatabaseNextResults retrieves the next set of results, if any. -func (client WorkloadGroupsClient) listByDatabaseNextResults(ctx context.Context, lastResults WorkloadGroupListResult) (result WorkloadGroupListResult, err error) { - req, err := lastResults.workloadGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.WorkloadGroupsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkloadGroupsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result WorkloadGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupsClient.ListByDatabase") - 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.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) - return -} diff --git a/services/preview/synapse/2019-11-01-preview/monitoring/CHANGELOG.md b/services/preview/synapse/2019-11-01-preview/monitoring/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/synapse/2019-11-01-preview/monitoring/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/synapse/2019-11-01-preview/monitoring/client.go b/services/preview/synapse/2019-11-01-preview/monitoring/client.go deleted file mode 100644 index d53dc7709101..000000000000 --- a/services/preview/synapse/2019-11-01-preview/monitoring/client.go +++ /dev/null @@ -1,33 +0,0 @@ -// Package monitoring implements the Azure ARM Monitoring service API version 2019-11-01-preview. -// -// -package monitoring - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BaseClient is the base client for Monitoring. -type BaseClient struct { - autorest.Client - Endpoint string -} - -// New creates an instance of the BaseClient client. -func New(endpoint string) BaseClient { - return NewWithoutDefaults(endpoint) -} - -// NewWithoutDefaults creates an instance of the BaseClient client. -func NewWithoutDefaults(endpoint string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - Endpoint: endpoint, - } -} diff --git a/services/preview/synapse/2019-11-01-preview/monitoring/dataplane_meta.json b/services/preview/synapse/2019-11-01-preview/monitoring/dataplane_meta.json deleted file mode 100644 index ced8624a1d22..000000000000 --- a/services/preview/synapse/2019-11-01-preview/monitoring/dataplane_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/synapse/data-plane/readme.md", - "tag": "package-monitoring-2019-11-01-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-monitoring-2019-11-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/synapse/data-plane/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/synapse/2019-11-01-preview/monitoring/models.go b/services/preview/synapse/2019-11-01-preview/monitoring/models.go deleted file mode 100644 index 0e257b325959..000000000000 --- a/services/preview/synapse/2019-11-01-preview/monitoring/models.go +++ /dev/null @@ -1,47 +0,0 @@ -package monitoring - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/Azure/go-autorest/autorest/date" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-11-01-preview/monitoring" - -// SparkJob ... -type SparkJob struct { - State *string `json:"state,omitempty"` - Name *string `json:"name,omitempty"` - Submitter *string `json:"submitter,omitempty"` - Compute *string `json:"compute,omitempty"` - SparkApplicationID *string `json:"sparkApplicationId,omitempty"` - LivyID *string `json:"livyId,omitempty"` - Timing *[]string `json:"timing,omitempty"` - SparkJobDefinition *string `json:"sparkJobDefinition,omitempty"` - Pipeline *[]SparkJob `json:"pipeline,omitempty"` - JobType *string `json:"jobType,omitempty"` - SubmitTime *date.Time `json:"submitTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - QueuedDuration *string `json:"queuedDuration,omitempty"` - RunningDuration *string `json:"runningDuration,omitempty"` - TotalDuration *string `json:"totalDuration,omitempty"` -} - -// SparkJobListViewResponse ... -type SparkJobListViewResponse struct { - autorest.Response `json:"-"` - NJobs *int32 `json:"nJobs,omitempty"` - SparkJobs *[]SparkJob `json:"sparkJobs,omitempty"` -} - -// SQLQueryStringDataModel ... -type SQLQueryStringDataModel struct { - autorest.Response `json:"-"` - Query *string `json:"query,omitempty"` -} diff --git a/services/preview/synapse/2019-11-01-preview/monitoring/monitoring.go b/services/preview/synapse/2019-11-01-preview/monitoring/monitoring.go deleted file mode 100644 index bf9405ea0fd5..000000000000 --- a/services/preview/synapse/2019-11-01-preview/monitoring/monitoring.go +++ /dev/null @@ -1,188 +0,0 @@ -package monitoring - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// Client is the client for the Monitoring methods of the Monitoring service. -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(endpoint string) Client { - return Client{New(endpoint)} -} - -// GetSparkJobList get list of spark applications for the workspace. -// Parameters: -// xMsClientRequestID - can provide a guid, which is helpful for debugging and to provide better customer -// support -func (client Client) GetSparkJobList(ctx context.Context, APIVersion string, xMsClientRequestID string) (result SparkJobListViewResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetSparkJobList") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetSparkJobListPreparer(ctx, APIVersion, xMsClientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "monitoring.Client", "GetSparkJobList", nil, "Failure preparing request") - return - } - - resp, err := client.GetSparkJobListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitoring.Client", "GetSparkJobList", resp, "Failure sending request") - return - } - - result, err = client.GetSparkJobListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitoring.Client", "GetSparkJobList", resp, "Failure responding to request") - return - } - - return -} - -// GetSparkJobListPreparer prepares the GetSparkJobList request. -func (client Client) GetSparkJobListPreparer(ctx context.Context, APIVersion string, xMsClientRequestID string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - } - - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}", urlParameters), - autorest.WithPath("/monitoring/workloadTypes/spark/Applications"), - autorest.WithQueryParameters(queryParameters)) - if len(xMsClientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSparkJobListSender sends the GetSparkJobList request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetSparkJobListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetSparkJobListResponder handles the response to the GetSparkJobList request. The method always -// closes the http.Response Body. -func (client Client) GetSparkJobListResponder(resp *http.Response) (result SparkJobListViewResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSQLJobQueryString get SQL OD/DW Query for the workspace. -// Parameters: -// xMsClientRequestID - can provide a guid, which is helpful for debugging and to provide better customer -// support -func (client Client) GetSQLJobQueryString(ctx context.Context, APIVersion string, xMsClientRequestID string, filter string, orderby string, skip string) (result SQLQueryStringDataModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetSQLJobQueryString") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetSQLJobQueryStringPreparer(ctx, APIVersion, xMsClientRequestID, filter, orderby, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "monitoring.Client", "GetSQLJobQueryString", nil, "Failure preparing request") - return - } - - resp, err := client.GetSQLJobQueryStringSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitoring.Client", "GetSQLJobQueryString", resp, "Failure sending request") - return - } - - result, err = client.GetSQLJobQueryStringResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitoring.Client", "GetSQLJobQueryString", resp, "Failure responding to request") - return - } - - return -} - -// GetSQLJobQueryStringPreparer prepares the GetSQLJobQueryString request. -func (client Client) GetSQLJobQueryStringPreparer(ctx context.Context, APIVersion string, xMsClientRequestID string, filter string, orderby string, skip string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - } - - 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 len(skip) > 0 { - queryParameters["skip"] = autorest.Encode("query", skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}", urlParameters), - autorest.WithPath("/monitoring/workloadTypes/sql/querystring"), - autorest.WithQueryParameters(queryParameters)) - if len(xMsClientRequestID) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSQLJobQueryStringSender sends the GetSQLJobQueryString request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetSQLJobQueryStringSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetSQLJobQueryStringResponder handles the response to the GetSQLJobQueryString request. The method always -// closes the http.Response Body. -func (client Client) GetSQLJobQueryStringResponder(resp *http.Response) (result SQLQueryStringDataModel, 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/synapse/2019-11-01-preview/monitoring/monitoringapi/interfaces.go b/services/preview/synapse/2019-11-01-preview/monitoring/monitoringapi/interfaces.go deleted file mode 100644 index 3f7c04519563..000000000000 --- a/services/preview/synapse/2019-11-01-preview/monitoring/monitoringapi/interfaces.go +++ /dev/null @@ -1,20 +0,0 @@ -package monitoringapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/synapse/2019-11-01-preview/monitoring" -) - -// ClientAPI contains the set of methods on the Client type. -type ClientAPI interface { - GetSparkJobList(ctx context.Context, APIVersion string, xMsClientRequestID string) (result monitoring.SparkJobListViewResponse, err error) - GetSQLJobQueryString(ctx context.Context, APIVersion string, xMsClientRequestID string, filter string, orderby string, skip string) (result monitoring.SQLQueryStringDataModel, err error) -} - -var _ ClientAPI = (*monitoring.Client)(nil) diff --git a/services/preview/synapse/2019-11-01-preview/monitoring/version.go b/services/preview/synapse/2019-11-01-preview/monitoring/version.go deleted file mode 100644 index f4aed110b798..000000000000 --- a/services/preview/synapse/2019-11-01-preview/monitoring/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package monitoring - -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() + " monitoring/2019-11-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/synapse/2019-11-01-preview/spark/CHANGELOG.md b/services/preview/synapse/2019-11-01-preview/spark/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/synapse/2019-11-01-preview/spark/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/synapse/2019-11-01-preview/spark/batch.go b/services/preview/synapse/2019-11-01-preview/spark/batch.go deleted file mode 100644 index c84b154e1f5d..000000000000 --- a/services/preview/synapse/2019-11-01-preview/spark/batch.go +++ /dev/null @@ -1,347 +0,0 @@ -package spark - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BatchClient is the client for the Batch methods of the Spark service. -type BatchClient struct { - BaseClient -} - -// NewBatchClient creates an instance of the BatchClient client. -func NewBatchClient(endpoint string, sparkPoolName string) BatchClient { - return BatchClient{New(endpoint, sparkPoolName)} -} - -// CancelSparkBatchJob cancels a running spark batch job. -// Parameters: -// batchID - identifier for the batch job. -func (client BatchClient) CancelSparkBatchJob(ctx context.Context, batchID int32) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BatchClient.CancelSparkBatchJob") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelSparkBatchJobPreparer(ctx, batchID) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.BatchClient", "CancelSparkBatchJob", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSparkBatchJobSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "spark.BatchClient", "CancelSparkBatchJob", resp, "Failure sending request") - return - } - - result, err = client.CancelSparkBatchJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.BatchClient", "CancelSparkBatchJob", resp, "Failure responding to request") - return - } - - return -} - -// CancelSparkBatchJobPreparer prepares the CancelSparkBatchJob request. -func (client BatchClient) CancelSparkBatchJobPreparer(ctx context.Context, batchID int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - pathParameters := map[string]interface{}{ - "batchId": autorest.Encode("path", batchID), - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPathParameters("/batches/{batchId}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSparkBatchJobSender sends the CancelSparkBatchJob request. The method will close the -// http.Response Body if it receives an error. -func (client BatchClient) CancelSparkBatchJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CancelSparkBatchJobResponder handles the response to the CancelSparkBatchJob request. The method always -// closes the http.Response Body. -func (client BatchClient) CancelSparkBatchJobResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateSparkBatchJob create new spark batch job. -// Parameters: -// sparkBatchJobOptions - livy compatible batch job request payload. -// detailed - optional query param specifying whether detailed response is returned beyond plain livy. -func (client BatchClient) CreateSparkBatchJob(ctx context.Context, sparkBatchJobOptions BatchJobOptions, detailed *bool) (result BatchJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BatchClient.CreateSparkBatchJob") - 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: sparkBatchJobOptions, - Constraints: []validation.Constraint{{Target: "sparkBatchJobOptions.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "sparkBatchJobOptions.File", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("spark.BatchClient", "CreateSparkBatchJob", err.Error()) - } - - req, err := client.CreateSparkBatchJobPreparer(ctx, sparkBatchJobOptions, detailed) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.BatchClient", "CreateSparkBatchJob", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSparkBatchJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.BatchClient", "CreateSparkBatchJob", resp, "Failure sending request") - return - } - - result, err = client.CreateSparkBatchJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.BatchClient", "CreateSparkBatchJob", resp, "Failure responding to request") - return - } - - return -} - -// CreateSparkBatchJobPreparer prepares the CreateSparkBatchJob request. -func (client BatchClient) CreateSparkBatchJobPreparer(ctx context.Context, sparkBatchJobOptions BatchJobOptions, detailed *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - queryParameters := map[string]interface{}{} - if detailed != nil { - queryParameters["detailed"] = autorest.Encode("query", *detailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPath("/batches"), - autorest.WithJSON(sparkBatchJobOptions), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSparkBatchJobSender sends the CreateSparkBatchJob request. The method will close the -// http.Response Body if it receives an error. -func (client BatchClient) CreateSparkBatchJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateSparkBatchJobResponder handles the response to the CreateSparkBatchJob request. The method always -// closes the http.Response Body. -func (client BatchClient) CreateSparkBatchJobResponder(resp *http.Response) (result BatchJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSparkBatchJob gets a single spark batch job. -// Parameters: -// batchID - identifier for the batch job. -// detailed - optional query param specifying whether detailed response is returned beyond plain livy. -func (client BatchClient) GetSparkBatchJob(ctx context.Context, batchID int32, detailed *bool) (result BatchJob, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BatchClient.GetSparkBatchJob") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetSparkBatchJobPreparer(ctx, batchID, detailed) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.BatchClient", "GetSparkBatchJob", nil, "Failure preparing request") - return - } - - resp, err := client.GetSparkBatchJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.BatchClient", "GetSparkBatchJob", resp, "Failure sending request") - return - } - - result, err = client.GetSparkBatchJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.BatchClient", "GetSparkBatchJob", resp, "Failure responding to request") - return - } - - return -} - -// GetSparkBatchJobPreparer prepares the GetSparkBatchJob request. -func (client BatchClient) GetSparkBatchJobPreparer(ctx context.Context, batchID int32, detailed *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - pathParameters := map[string]interface{}{ - "batchId": autorest.Encode("path", batchID), - } - - queryParameters := map[string]interface{}{} - if detailed != nil { - queryParameters["detailed"] = autorest.Encode("query", *detailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPathParameters("/batches/{batchId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSparkBatchJobSender sends the GetSparkBatchJob request. The method will close the -// http.Response Body if it receives an error. -func (client BatchClient) GetSparkBatchJobSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetSparkBatchJobResponder handles the response to the GetSparkBatchJob request. The method always -// closes the http.Response Body. -func (client BatchClient) GetSparkBatchJobResponder(resp *http.Response) (result BatchJob, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSparkBatchJobs list all spark batch jobs which are running under a particular spark pool. -// Parameters: -// from - optional param specifying which index the list should begin from. -// size - optional param specifying the size of the returned list. -// By default it is 20 and that is the maximum. -// detailed - optional query param specifying whether detailed response is returned beyond plain livy. -func (client BatchClient) GetSparkBatchJobs(ctx context.Context, from *int32, size *int32, detailed *bool) (result BatchJobCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BatchClient.GetSparkBatchJobs") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetSparkBatchJobsPreparer(ctx, from, size, detailed) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.BatchClient", "GetSparkBatchJobs", nil, "Failure preparing request") - return - } - - resp, err := client.GetSparkBatchJobsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.BatchClient", "GetSparkBatchJobs", resp, "Failure sending request") - return - } - - result, err = client.GetSparkBatchJobsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.BatchClient", "GetSparkBatchJobs", resp, "Failure responding to request") - return - } - - return -} - -// GetSparkBatchJobsPreparer prepares the GetSparkBatchJobs request. -func (client BatchClient) GetSparkBatchJobsPreparer(ctx context.Context, from *int32, size *int32, detailed *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - queryParameters := map[string]interface{}{} - if from != nil { - queryParameters["from"] = autorest.Encode("query", *from) - } - if size != nil { - queryParameters["size"] = autorest.Encode("query", *size) - } - if detailed != nil { - queryParameters["detailed"] = autorest.Encode("query", *detailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPath("/batches"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSparkBatchJobsSender sends the GetSparkBatchJobs request. The method will close the -// http.Response Body if it receives an error. -func (client BatchClient) GetSparkBatchJobsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetSparkBatchJobsResponder handles the response to the GetSparkBatchJobs request. The method always -// closes the http.Response Body. -func (client BatchClient) GetSparkBatchJobsResponder(resp *http.Response) (result BatchJobCollection, 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/synapse/2019-11-01-preview/spark/client.go b/services/preview/synapse/2019-11-01-preview/spark/client.go deleted file mode 100644 index 880b0a2b98dd..000000000000 --- a/services/preview/synapse/2019-11-01-preview/spark/client.go +++ /dev/null @@ -1,42 +0,0 @@ -// Package spark implements the Azure ARM Spark service API version 2019-11-01-preview. -// -// -package spark - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - // DefaultLivyAPIVersion is the default value for livy api version - DefaultLivyAPIVersion = "2019-11-01-preview" -) - -// BaseClient is the base client for Spark. -type BaseClient struct { - autorest.Client - Endpoint string - LivyAPIVersion string - SparkPoolName string -} - -// New creates an instance of the BaseClient client. -func New(endpoint string, sparkPoolName string) BaseClient { - return NewWithoutDefaults(endpoint, sparkPoolName, DefaultLivyAPIVersion) -} - -// NewWithoutDefaults creates an instance of the BaseClient client. -func NewWithoutDefaults(endpoint string, sparkPoolName string, livyAPIVersion string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - Endpoint: endpoint, - LivyAPIVersion: livyAPIVersion, - SparkPoolName: sparkPoolName, - } -} diff --git a/services/preview/synapse/2019-11-01-preview/spark/dataplane_meta.json b/services/preview/synapse/2019-11-01-preview/spark/dataplane_meta.json deleted file mode 100644 index d6975fd5ddda..000000000000 --- a/services/preview/synapse/2019-11-01-preview/spark/dataplane_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/synapse/data-plane/readme.md", - "tag": "package-spark-2019-11-01-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-spark-2019-11-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/synapse/data-plane/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/synapse/2019-11-01-preview/spark/enums.go b/services/preview/synapse/2019-11-01-preview/spark/enums.go deleted file mode 100644 index 525f05fa74e0..000000000000 --- a/services/preview/synapse/2019-11-01-preview/spark/enums.go +++ /dev/null @@ -1,140 +0,0 @@ -package spark - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// BatchJobResultType enumerates the values for batch job result type. -type BatchJobResultType string - -const ( - // Cancelled ... - Cancelled BatchJobResultType = "Cancelled" - // Failed ... - Failed BatchJobResultType = "Failed" - // Succeeded ... - Succeeded BatchJobResultType = "Succeeded" - // Uncertain ... - Uncertain BatchJobResultType = "Uncertain" -) - -// PossibleBatchJobResultTypeValues returns an array of possible values for the BatchJobResultType const type. -func PossibleBatchJobResultTypeValues() []BatchJobResultType { - return []BatchJobResultType{Cancelled, Failed, Succeeded, Uncertain} -} - -// ErrorSource enumerates the values for error source. -type ErrorSource string - -const ( - // Dependency ... - Dependency ErrorSource = "Dependency" - // System ... - System ErrorSource = "System" - // Unknown ... - Unknown ErrorSource = "Unknown" - // User ... - User ErrorSource = "User" -) - -// PossibleErrorSourceValues returns an array of possible values for the ErrorSource const type. -func PossibleErrorSourceValues() []ErrorSource { - return []ErrorSource{Dependency, System, Unknown, User} -} - -// JobType enumerates the values for job type. -type JobType string - -const ( - // SparkBatch ... - SparkBatch JobType = "SparkBatch" - // SparkSession ... - SparkSession JobType = "SparkSession" -) - -// PossibleJobTypeValues returns an array of possible values for the JobType const type. -func PossibleJobTypeValues() []JobType { - return []JobType{SparkBatch, SparkSession} -} - -// PluginCurrentState enumerates the values for plugin current state. -type PluginCurrentState string - -const ( - // Cleanup ... - Cleanup PluginCurrentState = "Cleanup" - // Ended ... - Ended PluginCurrentState = "Ended" - // Monitoring ... - Monitoring PluginCurrentState = "Monitoring" - // Preparation ... - Preparation PluginCurrentState = "Preparation" - // Queued ... - Queued PluginCurrentState = "Queued" - // ResourceAcquisition ... - ResourceAcquisition PluginCurrentState = "ResourceAcquisition" - // Submission ... - Submission PluginCurrentState = "Submission" -) - -// PossiblePluginCurrentStateValues returns an array of possible values for the PluginCurrentState const type. -func PossiblePluginCurrentStateValues() []PluginCurrentState { - return []PluginCurrentState{Cleanup, Ended, Monitoring, Preparation, Queued, ResourceAcquisition, Submission} -} - -// SchedulerCurrentState enumerates the values for scheduler current state. -type SchedulerCurrentState string - -const ( - // SchedulerCurrentStateEnded ... - SchedulerCurrentStateEnded SchedulerCurrentState = "Ended" - // SchedulerCurrentStateQueued ... - SchedulerCurrentStateQueued SchedulerCurrentState = "Queued" - // SchedulerCurrentStateScheduled ... - SchedulerCurrentStateScheduled SchedulerCurrentState = "Scheduled" -) - -// PossibleSchedulerCurrentStateValues returns an array of possible values for the SchedulerCurrentState const type. -func PossibleSchedulerCurrentStateValues() []SchedulerCurrentState { - return []SchedulerCurrentState{SchedulerCurrentStateEnded, SchedulerCurrentStateQueued, SchedulerCurrentStateScheduled} -} - -// SessionResultType enumerates the values for session result type. -type SessionResultType string - -const ( - // SessionResultTypeCancelled ... - SessionResultTypeCancelled SessionResultType = "Cancelled" - // SessionResultTypeFailed ... - SessionResultTypeFailed SessionResultType = "Failed" - // SessionResultTypeSucceeded ... - SessionResultTypeSucceeded SessionResultType = "Succeeded" - // SessionResultTypeUncertain ... - SessionResultTypeUncertain SessionResultType = "Uncertain" -) - -// PossibleSessionResultTypeValues returns an array of possible values for the SessionResultType const type. -func PossibleSessionResultTypeValues() []SessionResultType { - return []SessionResultType{SessionResultTypeCancelled, SessionResultTypeFailed, SessionResultTypeSucceeded, SessionResultTypeUncertain} -} - -// StatementLanguageType enumerates the values for statement language type. -type StatementLanguageType string - -const ( - // Dotnetspark ... - Dotnetspark StatementLanguageType = "dotnetspark" - // Pyspark ... - Pyspark StatementLanguageType = "pyspark" - // Spark ... - Spark StatementLanguageType = "spark" - // SQL ... - SQL StatementLanguageType = "sql" -) - -// PossibleStatementLanguageTypeValues returns an array of possible values for the StatementLanguageType const type. -func PossibleStatementLanguageTypeValues() []StatementLanguageType { - return []StatementLanguageType{Dotnetspark, Pyspark, Spark, SQL} -} diff --git a/services/preview/synapse/2019-11-01-preview/spark/models.go b/services/preview/synapse/2019-11-01-preview/spark/models.go deleted file mode 100644 index 25a539ab5111..000000000000 --- a/services/preview/synapse/2019-11-01-preview/spark/models.go +++ /dev/null @@ -1,538 +0,0 @@ -package spark - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 ( - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-11-01-preview/spark" - -// BatchJob ... -type BatchJob struct { - autorest.Response `json:"-"` - LivyInfo *BatchJobState `json:"livyInfo,omitempty"` - // Name - The batch name. - Name *string `json:"name,omitempty"` - // WorkspaceName - The workspace name. - WorkspaceName *string `json:"workspaceName,omitempty"` - // SparkPoolName - The Spark pool name. - SparkPoolName *string `json:"sparkPoolName,omitempty"` - // SubmitterName - The submitter name. - SubmitterName *string `json:"submitterName,omitempty"` - // SubmitterID - The submitter identifier. - SubmitterID *string `json:"submitterId,omitempty"` - // ArtifactID - The artifact identifier. - ArtifactID *string `json:"artifactId,omitempty"` - // JobType - The job type. Possible values include: 'SparkBatch', 'SparkSession' - JobType JobType `json:"jobType,omitempty"` - // Result - The Spark batch job result. Possible values include: 'Uncertain', 'Succeeded', 'Failed', 'Cancelled' - Result BatchJobResultType `json:"result,omitempty"` - // Scheduler - The scheduler information. - Scheduler *Scheduler `json:"schedulerInfo,omitempty"` - // Plugin - The plugin information. - Plugin *ServicePlugin `json:"pluginInfo,omitempty"` - // Errors - The error information. - Errors *[]ServiceError `json:"errorInfo,omitempty"` - // Tags - The tags. - Tags map[string]*string `json:"tags"` - // ID - The session Id. - ID *int32 `json:"id,omitempty"` - // AppID - The application id of this session - AppID *string `json:"appId,omitempty"` - // AppInfo - The detailed application info. - AppInfo map[string]*string `json:"appInfo"` - // State - The batch state - State *string `json:"state,omitempty"` - // LogLines - The log lines. - LogLines *[]string `json:"log,omitempty"` -} - -// MarshalJSON is the custom marshaler for BatchJob. -func (bj BatchJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bj.LivyInfo != nil { - objectMap["livyInfo"] = bj.LivyInfo - } - if bj.Name != nil { - objectMap["name"] = bj.Name - } - if bj.WorkspaceName != nil { - objectMap["workspaceName"] = bj.WorkspaceName - } - if bj.SparkPoolName != nil { - objectMap["sparkPoolName"] = bj.SparkPoolName - } - if bj.SubmitterName != nil { - objectMap["submitterName"] = bj.SubmitterName - } - if bj.SubmitterID != nil { - objectMap["submitterId"] = bj.SubmitterID - } - if bj.ArtifactID != nil { - objectMap["artifactId"] = bj.ArtifactID - } - if bj.JobType != "" { - objectMap["jobType"] = bj.JobType - } - if bj.Result != "" { - objectMap["result"] = bj.Result - } - if bj.Scheduler != nil { - objectMap["schedulerInfo"] = bj.Scheduler - } - if bj.Plugin != nil { - objectMap["pluginInfo"] = bj.Plugin - } - if bj.Errors != nil { - objectMap["errorInfo"] = bj.Errors - } - if bj.Tags != nil { - objectMap["tags"] = bj.Tags - } - if bj.ID != nil { - objectMap["id"] = bj.ID - } - if bj.AppID != nil { - objectMap["appId"] = bj.AppID - } - if bj.AppInfo != nil { - objectMap["appInfo"] = bj.AppInfo - } - if bj.State != nil { - objectMap["state"] = bj.State - } - if bj.LogLines != nil { - objectMap["log"] = bj.LogLines - } - return json.Marshal(objectMap) -} - -// BatchJobCollection response for batch list operation. -type BatchJobCollection struct { - autorest.Response `json:"-"` - // From - The start index of fetched sessions. - From *int32 `json:"from,omitempty"` - // Total - Number of sessions fetched. - Total *int32 `json:"total,omitempty"` - // Sessions - Batch list - Sessions *[]BatchJob `json:"sessions,omitempty"` -} - -// BatchJobOptions ... -type BatchJobOptions struct { - Tags map[string]*string `json:"tags"` - ArtifactID *string `json:"artifactId,omitempty"` - Name *string `json:"name,omitempty"` - File *string `json:"file,omitempty"` - ClassName *string `json:"className,omitempty"` - Arguments *[]string `json:"args,omitempty"` - Jars *[]string `json:"jars,omitempty"` - PythonFiles *[]string `json:"pyFiles,omitempty"` - Files *[]string `json:"files,omitempty"` - Archives *[]string `json:"archives,omitempty"` - Configuration map[string]*string `json:"conf"` - DriverMemory *string `json:"driverMemory,omitempty"` - DriverCores *int32 `json:"driverCores,omitempty"` - ExecutorMemory *string `json:"executorMemory,omitempty"` - ExecutorCores *int32 `json:"executorCores,omitempty"` - ExecutorCount *int32 `json:"numExecutors,omitempty"` -} - -// MarshalJSON is the custom marshaler for BatchJobOptions. -func (bjo BatchJobOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bjo.Tags != nil { - objectMap["tags"] = bjo.Tags - } - if bjo.ArtifactID != nil { - objectMap["artifactId"] = bjo.ArtifactID - } - if bjo.Name != nil { - objectMap["name"] = bjo.Name - } - if bjo.File != nil { - objectMap["file"] = bjo.File - } - if bjo.ClassName != nil { - objectMap["className"] = bjo.ClassName - } - if bjo.Arguments != nil { - objectMap["args"] = bjo.Arguments - } - if bjo.Jars != nil { - objectMap["jars"] = bjo.Jars - } - if bjo.PythonFiles != nil { - objectMap["pyFiles"] = bjo.PythonFiles - } - if bjo.Files != nil { - objectMap["files"] = bjo.Files - } - if bjo.Archives != nil { - objectMap["archives"] = bjo.Archives - } - if bjo.Configuration != nil { - objectMap["conf"] = bjo.Configuration - } - if bjo.DriverMemory != nil { - objectMap["driverMemory"] = bjo.DriverMemory - } - if bjo.DriverCores != nil { - objectMap["driverCores"] = bjo.DriverCores - } - if bjo.ExecutorMemory != nil { - objectMap["executorMemory"] = bjo.ExecutorMemory - } - if bjo.ExecutorCores != nil { - objectMap["executorCores"] = bjo.ExecutorCores - } - if bjo.ExecutorCount != nil { - objectMap["numExecutors"] = bjo.ExecutorCount - } - return json.Marshal(objectMap) -} - -// BatchJobState ... -type BatchJobState struct { - // NotStartedAt - the time that at which "not_started" livy state was first seen. - NotStartedAt *date.Time `json:"notStartedAt,omitempty"` - // StartingAt - the time that at which "starting" livy state was first seen. - StartingAt *date.Time `json:"startingAt,omitempty"` - // RunningAt - the time that at which "running" livy state was first seen. - RunningAt *date.Time `json:"runningAt,omitempty"` - // DeadAt - time that at which "dead" livy state was first seen. - DeadAt *date.Time `json:"deadAt,omitempty"` - // SuccessAt - the time that at which "success" livy state was first seen. - SuccessAt *date.Time `json:"successAt,omitempty"` - // TerminatedAt - the time that at which "killed" livy state was first seen. - TerminatedAt *date.Time `json:"killedAt,omitempty"` - // RecoveringAt - the time that at which "recovering" livy state was first seen. - RecoveringAt *date.Time `json:"recoveringAt,omitempty"` - // CurrentState - the Spark job state. - CurrentState *string `json:"currentState,omitempty"` - JobCreationRequest *Request `json:"jobCreationRequest,omitempty"` -} - -// Request ... -type Request struct { - Name *string `json:"name,omitempty"` - File *string `json:"file,omitempty"` - ClassName *string `json:"className,omitempty"` - Arguments *[]string `json:"args,omitempty"` - Jars *[]string `json:"jars,omitempty"` - PythonFiles *[]string `json:"pyFiles,omitempty"` - Files *[]string `json:"files,omitempty"` - Archives *[]string `json:"archives,omitempty"` - Configuration map[string]*string `json:"conf"` - DriverMemory *string `json:"driverMemory,omitempty"` - DriverCores *int32 `json:"driverCores,omitempty"` - ExecutorMemory *string `json:"executorMemory,omitempty"` - ExecutorCores *int32 `json:"executorCores,omitempty"` - ExecutorCount *int32 `json:"numExecutors,omitempty"` -} - -// MarshalJSON is the custom marshaler for Request. -func (r Request) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Name != nil { - objectMap["name"] = r.Name - } - if r.File != nil { - objectMap["file"] = r.File - } - if r.ClassName != nil { - objectMap["className"] = r.ClassName - } - if r.Arguments != nil { - objectMap["args"] = r.Arguments - } - if r.Jars != nil { - objectMap["jars"] = r.Jars - } - if r.PythonFiles != nil { - objectMap["pyFiles"] = r.PythonFiles - } - if r.Files != nil { - objectMap["files"] = r.Files - } - if r.Archives != nil { - objectMap["archives"] = r.Archives - } - if r.Configuration != nil { - objectMap["conf"] = r.Configuration - } - if r.DriverMemory != nil { - objectMap["driverMemory"] = r.DriverMemory - } - if r.DriverCores != nil { - objectMap["driverCores"] = r.DriverCores - } - if r.ExecutorMemory != nil { - objectMap["executorMemory"] = r.ExecutorMemory - } - if r.ExecutorCores != nil { - objectMap["executorCores"] = r.ExecutorCores - } - if r.ExecutorCount != nil { - objectMap["numExecutors"] = r.ExecutorCount - } - return json.Marshal(objectMap) -} - -// Scheduler ... -type Scheduler struct { - SubmittedAt *date.Time `json:"submittedAt,omitempty"` - ScheduledAt *date.Time `json:"scheduledAt,omitempty"` - EndedAt *date.Time `json:"endedAt,omitempty"` - CancellationRequestedAt *date.Time `json:"cancellationRequestedAt,omitempty"` - // CurrentState - Possible values include: 'SchedulerCurrentStateQueued', 'SchedulerCurrentStateScheduled', 'SchedulerCurrentStateEnded' - CurrentState SchedulerCurrentState `json:"currentState,omitempty"` -} - -// ServiceError ... -type ServiceError struct { - Message *string `json:"message,omitempty"` - ErrorCode *string `json:"errorCode,omitempty"` - // Source - Possible values include: 'System', 'User', 'Unknown', 'Dependency' - Source ErrorSource `json:"source,omitempty"` -} - -// ServicePlugin ... -type ServicePlugin struct { - PreparationStartedAt *date.Time `json:"preparationStartedAt,omitempty"` - ResourceAcquisitionStartedAt *date.Time `json:"resourceAcquisitionStartedAt,omitempty"` - SubmissionStartedAt *date.Time `json:"submissionStartedAt,omitempty"` - MonitoringStartedAt *date.Time `json:"monitoringStartedAt,omitempty"` - CleanupStartedAt *date.Time `json:"cleanupStartedAt,omitempty"` - // CurrentState - Possible values include: 'Preparation', 'ResourceAcquisition', 'Queued', 'Submission', 'Monitoring', 'Cleanup', 'Ended' - CurrentState PluginCurrentState `json:"currentState,omitempty"` -} - -// Session ... -type Session struct { - autorest.Response `json:"-"` - LivyInfo *SessionState `json:"livyInfo,omitempty"` - Name *string `json:"name,omitempty"` - WorkspaceName *string `json:"workspaceName,omitempty"` - SparkPoolName *string `json:"sparkPoolName,omitempty"` - SubmitterName *string `json:"submitterName,omitempty"` - SubmitterID *string `json:"submitterId,omitempty"` - ArtifactID *string `json:"artifactId,omitempty"` - // JobType - Possible values include: 'SparkBatch', 'SparkSession' - JobType JobType `json:"jobType,omitempty"` - // Result - Possible values include: 'SessionResultTypeUncertain', 'SessionResultTypeSucceeded', 'SessionResultTypeFailed', 'SessionResultTypeCancelled' - Result SessionResultType `json:"result,omitempty"` - Scheduler *Scheduler `json:"schedulerInfo,omitempty"` - Plugin *ServicePlugin `json:"pluginInfo,omitempty"` - Errors *[]ServiceError `json:"errorInfo,omitempty"` - Tags map[string]*string `json:"tags"` - ID *int32 `json:"id,omitempty"` - AppID *string `json:"appId,omitempty"` - AppInfo map[string]*string `json:"appInfo"` - State *string `json:"state,omitempty"` - LogLines *[]string `json:"log,omitempty"` -} - -// MarshalJSON is the custom marshaler for Session. -func (s Session) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.LivyInfo != nil { - objectMap["livyInfo"] = s.LivyInfo - } - if s.Name != nil { - objectMap["name"] = s.Name - } - if s.WorkspaceName != nil { - objectMap["workspaceName"] = s.WorkspaceName - } - if s.SparkPoolName != nil { - objectMap["sparkPoolName"] = s.SparkPoolName - } - if s.SubmitterName != nil { - objectMap["submitterName"] = s.SubmitterName - } - if s.SubmitterID != nil { - objectMap["submitterId"] = s.SubmitterID - } - if s.ArtifactID != nil { - objectMap["artifactId"] = s.ArtifactID - } - if s.JobType != "" { - objectMap["jobType"] = s.JobType - } - if s.Result != "" { - objectMap["result"] = s.Result - } - if s.Scheduler != nil { - objectMap["schedulerInfo"] = s.Scheduler - } - if s.Plugin != nil { - objectMap["pluginInfo"] = s.Plugin - } - if s.Errors != nil { - objectMap["errorInfo"] = s.Errors - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - if s.ID != nil { - objectMap["id"] = s.ID - } - if s.AppID != nil { - objectMap["appId"] = s.AppID - } - if s.AppInfo != nil { - objectMap["appInfo"] = s.AppInfo - } - if s.State != nil { - objectMap["state"] = s.State - } - if s.LogLines != nil { - objectMap["log"] = s.LogLines - } - return json.Marshal(objectMap) -} - -// SessionCollection ... -type SessionCollection struct { - autorest.Response `json:"-"` - From *int32 `json:"from,omitempty"` - Total *int32 `json:"total,omitempty"` - Sessions *[]Session `json:"sessions,omitempty"` -} - -// SessionOptions ... -type SessionOptions struct { - Tags map[string]*string `json:"tags"` - ArtifactID *string `json:"artifactId,omitempty"` - Name *string `json:"name,omitempty"` - File *string `json:"file,omitempty"` - ClassName *string `json:"className,omitempty"` - Arguments *[]string `json:"args,omitempty"` - Jars *[]string `json:"jars,omitempty"` - PythonFiles *[]string `json:"pyFiles,omitempty"` - Files *[]string `json:"files,omitempty"` - Archives *[]string `json:"archives,omitempty"` - Configuration map[string]*string `json:"conf"` - DriverMemory *string `json:"driverMemory,omitempty"` - DriverCores *int32 `json:"driverCores,omitempty"` - ExecutorMemory *string `json:"executorMemory,omitempty"` - ExecutorCores *int32 `json:"executorCores,omitempty"` - ExecutorCount *int32 `json:"numExecutors,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionOptions. -func (so SessionOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if so.Tags != nil { - objectMap["tags"] = so.Tags - } - if so.ArtifactID != nil { - objectMap["artifactId"] = so.ArtifactID - } - if so.Name != nil { - objectMap["name"] = so.Name - } - if so.File != nil { - objectMap["file"] = so.File - } - if so.ClassName != nil { - objectMap["className"] = so.ClassName - } - if so.Arguments != nil { - objectMap["args"] = so.Arguments - } - if so.Jars != nil { - objectMap["jars"] = so.Jars - } - if so.PythonFiles != nil { - objectMap["pyFiles"] = so.PythonFiles - } - if so.Files != nil { - objectMap["files"] = so.Files - } - if so.Archives != nil { - objectMap["archives"] = so.Archives - } - if so.Configuration != nil { - objectMap["conf"] = so.Configuration - } - if so.DriverMemory != nil { - objectMap["driverMemory"] = so.DriverMemory - } - if so.DriverCores != nil { - objectMap["driverCores"] = so.DriverCores - } - if so.ExecutorMemory != nil { - objectMap["executorMemory"] = so.ExecutorMemory - } - if so.ExecutorCores != nil { - objectMap["executorCores"] = so.ExecutorCores - } - if so.ExecutorCount != nil { - objectMap["numExecutors"] = so.ExecutorCount - } - return json.Marshal(objectMap) -} - -// SessionState ... -type SessionState struct { - NotStartedAt *date.Time `json:"notStartedAt,omitempty"` - StartingAt *date.Time `json:"startingAt,omitempty"` - IdleAt *date.Time `json:"idleAt,omitempty"` - DeadAt *date.Time `json:"deadAt,omitempty"` - ShuttingDownAt *date.Time `json:"shuttingDownAt,omitempty"` - TerminatedAt *date.Time `json:"killedAt,omitempty"` - RecoveringAt *date.Time `json:"recoveringAt,omitempty"` - BusyAt *date.Time `json:"busyAt,omitempty"` - ErrorAt *date.Time `json:"errorAt,omitempty"` - CurrentState *string `json:"currentState,omitempty"` - JobCreationRequest *Request `json:"jobCreationRequest,omitempty"` -} - -// Statement ... -type Statement struct { - autorest.Response `json:"-"` - ID *int32 `json:"id,omitempty"` - Code *string `json:"code,omitempty"` - State *string `json:"state,omitempty"` - Output *StatementOutput `json:"output,omitempty"` -} - -// StatementCancellationResult ... -type StatementCancellationResult struct { - autorest.Response `json:"-"` - Msg *string `json:"msg,omitempty"` -} - -// StatementCollection ... -type StatementCollection struct { - autorest.Response `json:"-"` - Total *int32 `json:"total_statements,omitempty"` - Statements *[]Statement `json:"statements,omitempty"` -} - -// StatementOptions ... -type StatementOptions struct { - Code *string `json:"code,omitempty"` - // Kind - Possible values include: 'Spark', 'Pyspark', 'Dotnetspark', 'SQL' - Kind StatementLanguageType `json:"kind,omitempty"` -} - -// StatementOutput ... -type StatementOutput struct { - Status *string `json:"status,omitempty"` - ExecutionCount *int32 `json:"execution_count,omitempty"` - Data interface{} `json:"data,omitempty"` - ErrorName *string `json:"ename,omitempty"` - ErrorValue *string `json:"evalue,omitempty"` - Traceback *[]string `json:"traceback,omitempty"` -} diff --git a/services/preview/synapse/2019-11-01-preview/spark/session.go b/services/preview/synapse/2019-11-01-preview/spark/session.go deleted file mode 100644 index 7d64b5111f6d..000000000000 --- a/services/preview/synapse/2019-11-01-preview/spark/session.go +++ /dev/null @@ -1,717 +0,0 @@ -package spark - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SessionClient is the client for the Session methods of the Spark service. -type SessionClient struct { - BaseClient -} - -// NewSessionClient creates an instance of the SessionClient client. -func NewSessionClient(endpoint string, sparkPoolName string) SessionClient { - return SessionClient{New(endpoint, sparkPoolName)} -} - -// CancelSparkSession cancels a running spark session. -// Parameters: -// sessionID - identifier for the session. -func (client SessionClient) CancelSparkSession(ctx context.Context, sessionID int32) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionClient.CancelSparkSession") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelSparkSessionPreparer(ctx, sessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CancelSparkSession", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSparkSessionSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CancelSparkSession", resp, "Failure sending request") - return - } - - result, err = client.CancelSparkSessionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CancelSparkSession", resp, "Failure responding to request") - return - } - - return -} - -// CancelSparkSessionPreparer prepares the CancelSparkSession request. -func (client SessionClient) CancelSparkSessionPreparer(ctx context.Context, sessionID int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - pathParameters := map[string]interface{}{ - "sessionId": autorest.Encode("path", sessionID), - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPathParameters("/sessions/{sessionId}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSparkSessionSender sends the CancelSparkSession request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) CancelSparkSessionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CancelSparkSessionResponder handles the response to the CancelSparkSession request. The method always -// closes the http.Response Body. -func (client SessionClient) CancelSparkSessionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// CancelSparkStatement kill a statement within a session. -// Parameters: -// sessionID - identifier for the session. -// statementID - identifier for the statement. -func (client SessionClient) CancelSparkStatement(ctx context.Context, sessionID int32, statementID int32) (result StatementCancellationResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionClient.CancelSparkStatement") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelSparkStatementPreparer(ctx, sessionID, statementID) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CancelSparkStatement", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSparkStatementSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CancelSparkStatement", resp, "Failure sending request") - return - } - - result, err = client.CancelSparkStatementResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CancelSparkStatement", resp, "Failure responding to request") - return - } - - return -} - -// CancelSparkStatementPreparer prepares the CancelSparkStatement request. -func (client SessionClient) CancelSparkStatementPreparer(ctx context.Context, sessionID int32, statementID int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - pathParameters := map[string]interface{}{ - "sessionId": autorest.Encode("path", sessionID), - "statementId": autorest.Encode("path", statementID), - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPathParameters("/sessions/{sessionId}/statements/{statementId}/cancel", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSparkStatementSender sends the CancelSparkStatement request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) CancelSparkStatementSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CancelSparkStatementResponder handles the response to the CancelSparkStatement request. The method always -// closes the http.Response Body. -func (client SessionClient) CancelSparkStatementResponder(resp *http.Response) (result StatementCancellationResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateSparkSession create new spark session. -// Parameters: -// sparkSessionOptions - livy compatible batch job request payload. -// detailed - optional query param specifying whether detailed response is returned beyond plain livy. -func (client SessionClient) CreateSparkSession(ctx context.Context, sparkSessionOptions SessionOptions, detailed *bool) (result Session, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionClient.CreateSparkSession") - 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: sparkSessionOptions, - Constraints: []validation.Constraint{{Target: "sparkSessionOptions.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("spark.SessionClient", "CreateSparkSession", err.Error()) - } - - req, err := client.CreateSparkSessionPreparer(ctx, sparkSessionOptions, detailed) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CreateSparkSession", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSparkSessionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CreateSparkSession", resp, "Failure sending request") - return - } - - result, err = client.CreateSparkSessionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CreateSparkSession", resp, "Failure responding to request") - return - } - - return -} - -// CreateSparkSessionPreparer prepares the CreateSparkSession request. -func (client SessionClient) CreateSparkSessionPreparer(ctx context.Context, sparkSessionOptions SessionOptions, detailed *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - queryParameters := map[string]interface{}{} - if detailed != nil { - queryParameters["detailed"] = autorest.Encode("query", *detailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPath("/sessions"), - autorest.WithJSON(sparkSessionOptions), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSparkSessionSender sends the CreateSparkSession request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) CreateSparkSessionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateSparkSessionResponder handles the response to the CreateSparkSession request. The method always -// closes the http.Response Body. -func (client SessionClient) CreateSparkSessionResponder(resp *http.Response) (result Session, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateSparkStatement create statement within a spark session. -// Parameters: -// sessionID - identifier for the session. -// sparkStatementOptions - livy compatible batch job request payload. -func (client SessionClient) CreateSparkStatement(ctx context.Context, sessionID int32, sparkStatementOptions StatementOptions) (result Statement, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionClient.CreateSparkStatement") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateSparkStatementPreparer(ctx, sessionID, sparkStatementOptions) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CreateSparkStatement", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSparkStatementSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CreateSparkStatement", resp, "Failure sending request") - return - } - - result, err = client.CreateSparkStatementResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "CreateSparkStatement", resp, "Failure responding to request") - return - } - - return -} - -// CreateSparkStatementPreparer prepares the CreateSparkStatement request. -func (client SessionClient) CreateSparkStatementPreparer(ctx context.Context, sessionID int32, sparkStatementOptions StatementOptions) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - pathParameters := map[string]interface{}{ - "sessionId": autorest.Encode("path", sessionID), - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPathParameters("/sessions/{sessionId}/statements", pathParameters), - autorest.WithJSON(sparkStatementOptions)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSparkStatementSender sends the CreateSparkStatement request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) CreateSparkStatementSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateSparkStatementResponder handles the response to the CreateSparkStatement request. The method always -// closes the http.Response Body. -func (client SessionClient) CreateSparkStatementResponder(resp *http.Response) (result Statement, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSparkSession gets a single spark session. -// Parameters: -// sessionID - identifier for the session. -// detailed - optional query param specifying whether detailed response is returned beyond plain livy. -func (client SessionClient) GetSparkSession(ctx context.Context, sessionID int32, detailed *bool) (result Session, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionClient.GetSparkSession") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetSparkSessionPreparer(ctx, sessionID, detailed) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkSession", nil, "Failure preparing request") - return - } - - resp, err := client.GetSparkSessionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkSession", resp, "Failure sending request") - return - } - - result, err = client.GetSparkSessionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkSession", resp, "Failure responding to request") - return - } - - return -} - -// GetSparkSessionPreparer prepares the GetSparkSession request. -func (client SessionClient) GetSparkSessionPreparer(ctx context.Context, sessionID int32, detailed *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - pathParameters := map[string]interface{}{ - "sessionId": autorest.Encode("path", sessionID), - } - - queryParameters := map[string]interface{}{} - if detailed != nil { - queryParameters["detailed"] = autorest.Encode("query", *detailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPathParameters("/sessions/{sessionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSparkSessionSender sends the GetSparkSession request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) GetSparkSessionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetSparkSessionResponder handles the response to the GetSparkSession request. The method always -// closes the http.Response Body. -func (client SessionClient) GetSparkSessionResponder(resp *http.Response) (result Session, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSparkSessions list all spark sessions which are running under a particular spark pool. -// Parameters: -// from - optional param specifying which index the list should begin from. -// size - optional param specifying the size of the returned list. -// By default it is 20 and that is the maximum. -// detailed - optional query param specifying whether detailed response is returned beyond plain livy. -func (client SessionClient) GetSparkSessions(ctx context.Context, from *int32, size *int32, detailed *bool) (result SessionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionClient.GetSparkSessions") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetSparkSessionsPreparer(ctx, from, size, detailed) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkSessions", nil, "Failure preparing request") - return - } - - resp, err := client.GetSparkSessionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkSessions", resp, "Failure sending request") - return - } - - result, err = client.GetSparkSessionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkSessions", resp, "Failure responding to request") - return - } - - return -} - -// GetSparkSessionsPreparer prepares the GetSparkSessions request. -func (client SessionClient) GetSparkSessionsPreparer(ctx context.Context, from *int32, size *int32, detailed *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - queryParameters := map[string]interface{}{} - if from != nil { - queryParameters["from"] = autorest.Encode("query", *from) - } - if size != nil { - queryParameters["size"] = autorest.Encode("query", *size) - } - if detailed != nil { - queryParameters["detailed"] = autorest.Encode("query", *detailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPath("/sessions"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSparkSessionsSender sends the GetSparkSessions request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) GetSparkSessionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetSparkSessionsResponder handles the response to the GetSparkSessions request. The method always -// closes the http.Response Body. -func (client SessionClient) GetSparkSessionsResponder(resp *http.Response) (result SessionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSparkStatement gets a single statement within a spark session. -// Parameters: -// sessionID - identifier for the session. -// statementID - identifier for the statement. -func (client SessionClient) GetSparkStatement(ctx context.Context, sessionID int32, statementID int32) (result Statement, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionClient.GetSparkStatement") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetSparkStatementPreparer(ctx, sessionID, statementID) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkStatement", nil, "Failure preparing request") - return - } - - resp, err := client.GetSparkStatementSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkStatement", resp, "Failure sending request") - return - } - - result, err = client.GetSparkStatementResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkStatement", resp, "Failure responding to request") - return - } - - return -} - -// GetSparkStatementPreparer prepares the GetSparkStatement request. -func (client SessionClient) GetSparkStatementPreparer(ctx context.Context, sessionID int32, statementID int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - pathParameters := map[string]interface{}{ - "sessionId": autorest.Encode("path", sessionID), - "statementId": autorest.Encode("path", statementID), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPathParameters("/sessions/{sessionId}/statements/{statementId}", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSparkStatementSender sends the GetSparkStatement request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) GetSparkStatementSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetSparkStatementResponder handles the response to the GetSparkStatement request. The method always -// closes the http.Response Body. -func (client SessionClient) GetSparkStatementResponder(resp *http.Response) (result Statement, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSparkStatements gets a list of statements within a spark session. -// Parameters: -// sessionID - identifier for the session. -func (client SessionClient) GetSparkStatements(ctx context.Context, sessionID int32) (result StatementCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionClient.GetSparkStatements") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetSparkStatementsPreparer(ctx, sessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkStatements", nil, "Failure preparing request") - return - } - - resp, err := client.GetSparkStatementsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkStatements", resp, "Failure sending request") - return - } - - result, err = client.GetSparkStatementsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "GetSparkStatements", resp, "Failure responding to request") - return - } - - return -} - -// GetSparkStatementsPreparer prepares the GetSparkStatements request. -func (client SessionClient) GetSparkStatementsPreparer(ctx context.Context, sessionID int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - pathParameters := map[string]interface{}{ - "sessionId": autorest.Encode("path", sessionID), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPathParameters("/sessions/{sessionId}/statements", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSparkStatementsSender sends the GetSparkStatements request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) GetSparkStatementsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetSparkStatementsResponder handles the response to the GetSparkStatements request. The method always -// closes the http.Response Body. -func (client SessionClient) GetSparkStatementsResponder(resp *http.Response) (result StatementCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ResetSparkSessionTimeout sends a keep alive call to the current session to reset the session timeout. -// Parameters: -// sessionID - identifier for the session. -func (client SessionClient) ResetSparkSessionTimeout(ctx context.Context, sessionID int32) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionClient.ResetSparkSessionTimeout") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ResetSparkSessionTimeoutPreparer(ctx, sessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "ResetSparkSessionTimeout", nil, "Failure preparing request") - return - } - - resp, err := client.ResetSparkSessionTimeoutSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "spark.SessionClient", "ResetSparkSessionTimeout", resp, "Failure sending request") - return - } - - result, err = client.ResetSparkSessionTimeoutResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "spark.SessionClient", "ResetSparkSessionTimeout", resp, "Failure responding to request") - return - } - - return -} - -// ResetSparkSessionTimeoutPreparer prepares the ResetSparkSessionTimeout request. -func (client SessionClient) ResetSparkSessionTimeoutPreparer(ctx context.Context, sessionID int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - "livyApiVersion": client.LivyAPIVersion, - "sparkPoolName": client.SparkPoolName, - } - - pathParameters := map[string]interface{}{ - "sessionId": autorest.Encode("path", sessionID), - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}", urlParameters), - autorest.WithPathParameters("/sessions/{sessionId}/reset-timeout", pathParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ResetSparkSessionTimeoutSender sends the ResetSparkSessionTimeout request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) ResetSparkSessionTimeoutSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ResetSparkSessionTimeoutResponder handles the response to the ResetSparkSessionTimeout request. The method always -// closes the http.Response Body. -func (client SessionClient) ResetSparkSessionTimeoutResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/synapse/2019-11-01-preview/spark/sparkapi/interfaces.go b/services/preview/synapse/2019-11-01-preview/spark/sparkapi/interfaces.go deleted file mode 100644 index 4b8058a3868b..000000000000 --- a/services/preview/synapse/2019-11-01-preview/spark/sparkapi/interfaces.go +++ /dev/null @@ -1,38 +0,0 @@ -package sparkapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/synapse/2019-11-01-preview/spark" - "github.com/Azure/go-autorest/autorest" -) - -// BatchClientAPI contains the set of methods on the BatchClient type. -type BatchClientAPI interface { - CancelSparkBatchJob(ctx context.Context, batchID int32) (result autorest.Response, err error) - CreateSparkBatchJob(ctx context.Context, sparkBatchJobOptions spark.BatchJobOptions, detailed *bool) (result spark.BatchJob, err error) - GetSparkBatchJob(ctx context.Context, batchID int32, detailed *bool) (result spark.BatchJob, err error) - GetSparkBatchJobs(ctx context.Context, from *int32, size *int32, detailed *bool) (result spark.BatchJobCollection, err error) -} - -var _ BatchClientAPI = (*spark.BatchClient)(nil) - -// SessionClientAPI contains the set of methods on the SessionClient type. -type SessionClientAPI interface { - CancelSparkSession(ctx context.Context, sessionID int32) (result autorest.Response, err error) - CancelSparkStatement(ctx context.Context, sessionID int32, statementID int32) (result spark.StatementCancellationResult, err error) - CreateSparkSession(ctx context.Context, sparkSessionOptions spark.SessionOptions, detailed *bool) (result spark.Session, err error) - CreateSparkStatement(ctx context.Context, sessionID int32, sparkStatementOptions spark.StatementOptions) (result spark.Statement, err error) - GetSparkSession(ctx context.Context, sessionID int32, detailed *bool) (result spark.Session, err error) - GetSparkSessions(ctx context.Context, from *int32, size *int32, detailed *bool) (result spark.SessionCollection, err error) - GetSparkStatement(ctx context.Context, sessionID int32, statementID int32) (result spark.Statement, err error) - GetSparkStatements(ctx context.Context, sessionID int32) (result spark.StatementCollection, err error) - ResetSparkSessionTimeout(ctx context.Context, sessionID int32) (result autorest.Response, err error) -} - -var _ SessionClientAPI = (*spark.SessionClient)(nil) diff --git a/services/preview/synapse/2019-11-01-preview/spark/version.go b/services/preview/synapse/2019-11-01-preview/spark/version.go deleted file mode 100644 index 0cf75034e683..000000000000 --- a/services/preview/synapse/2019-11-01-preview/spark/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package spark - -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() + " spark/2019-11-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/synapse/2020-02-01-preview/accesscontrol/CHANGELOG.md b/services/preview/synapse/2020-02-01-preview/accesscontrol/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/synapse/2020-02-01-preview/accesscontrol/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/synapse/2020-02-01-preview/accesscontrol/accesscontrolapi/interfaces.go b/services/preview/synapse/2020-02-01-preview/accesscontrol/accesscontrolapi/interfaces.go deleted file mode 100644 index 0ec36fdf8035..000000000000 --- a/services/preview/synapse/2020-02-01-preview/accesscontrol/accesscontrolapi/interfaces.go +++ /dev/null @@ -1,27 +0,0 @@ -package accesscontrolapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/synapse/2020-02-01-preview/accesscontrol" - "github.com/Azure/go-autorest/autorest" -) - -// BaseClientAPI contains the set of methods on the BaseClient type. -type BaseClientAPI interface { - CreateRoleAssignment(ctx context.Context, createRoleAssignmentOptions accesscontrol.RoleAssignmentOptions) (result accesscontrol.RoleAssignmentDetails, err error) - DeleteRoleAssignmentByID(ctx context.Context, roleAssignmentID string) (result autorest.Response, err error) - GetCallerRoleAssignments(ctx context.Context) (result accesscontrol.ListString, err error) - GetRoleAssignmentByID(ctx context.Context, roleAssignmentID string) (result accesscontrol.RoleAssignmentDetails, err error) - GetRoleAssignments(ctx context.Context, roleID string, principalID string, continuationToken string) (result accesscontrol.ListRoleAssignmentDetails, err error) - GetRoleDefinitionByID(ctx context.Context, roleID string) (result accesscontrol.SynapseRole, err error) - GetRoleDefinitions(ctx context.Context) (result accesscontrol.RolesListResponsePage, err error) - GetRoleDefinitionsComplete(ctx context.Context) (result accesscontrol.RolesListResponseIterator, err error) -} - -var _ BaseClientAPI = (*accesscontrol.BaseClient)(nil) diff --git a/services/preview/synapse/2020-02-01-preview/accesscontrol/client.go b/services/preview/synapse/2020-02-01-preview/accesscontrol/client.go deleted file mode 100644 index 94bdd655f954..000000000000 --- a/services/preview/synapse/2020-02-01-preview/accesscontrol/client.go +++ /dev/null @@ -1,631 +0,0 @@ -// Package accesscontrol implements the Azure ARM Accesscontrol service API version 2020-02-01-preview. -// -// -package accesscontrol - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BaseClient is the base client for Accesscontrol. -type BaseClient struct { - autorest.Client - Endpoint string -} - -// New creates an instance of the BaseClient client. -func New(endpoint string) BaseClient { - return NewWithoutDefaults(endpoint) -} - -// NewWithoutDefaults creates an instance of the BaseClient client. -func NewWithoutDefaults(endpoint string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - Endpoint: endpoint, - } -} - -// CreateRoleAssignment create role assignment. -// Parameters: -// createRoleAssignmentOptions - details of role id and object id. -func (client BaseClient) CreateRoleAssignment(ctx context.Context, createRoleAssignmentOptions RoleAssignmentOptions) (result RoleAssignmentDetails, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateRoleAssignment") - 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: createRoleAssignmentOptions, - Constraints: []validation.Constraint{{Target: "createRoleAssignmentOptions.RoleID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createRoleAssignmentOptions.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("accesscontrol.BaseClient", "CreateRoleAssignment", err.Error()) - } - - req, err := client.CreateRoleAssignmentPreparer(ctx, createRoleAssignmentOptions) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "CreateRoleAssignment", nil, "Failure preparing request") - return - } - - resp, err := client.CreateRoleAssignmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "CreateRoleAssignment", resp, "Failure sending request") - return - } - - result, err = client.CreateRoleAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "CreateRoleAssignment", resp, "Failure responding to request") - return - } - - return -} - -// CreateRoleAssignmentPreparer prepares the CreateRoleAssignment request. -func (client BaseClient) CreateRoleAssignmentPreparer(ctx context.Context, createRoleAssignmentOptions RoleAssignmentOptions) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - } - - const APIVersion = "2020-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithCustomBaseURL("{endpoint}", urlParameters), - autorest.WithPath("/rbac/roleAssignments"), - autorest.WithJSON(createRoleAssignmentOptions), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateRoleAssignmentSender sends the CreateRoleAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) CreateRoleAssignmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateRoleAssignmentResponder handles the response to the CreateRoleAssignment request. The method always -// closes the http.Response Body. -func (client BaseClient) CreateRoleAssignmentResponder(resp *http.Response) (result RoleAssignmentDetails, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteRoleAssignmentByID delete role assignment by role assignment Id. -// Parameters: -// roleAssignmentID - the ID of the role assignment. -func (client BaseClient) DeleteRoleAssignmentByID(ctx context.Context, roleAssignmentID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteRoleAssignmentByID") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: roleAssignmentID, - Constraints: []validation.Constraint{{Target: "roleAssignmentID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("accesscontrol.BaseClient", "DeleteRoleAssignmentByID", err.Error()) - } - - req, err := client.DeleteRoleAssignmentByIDPreparer(ctx, roleAssignmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "DeleteRoleAssignmentByID", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteRoleAssignmentByIDSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "DeleteRoleAssignmentByID", resp, "Failure sending request") - return - } - - result, err = client.DeleteRoleAssignmentByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "DeleteRoleAssignmentByID", resp, "Failure responding to request") - return - } - - return -} - -// DeleteRoleAssignmentByIDPreparer prepares the DeleteRoleAssignmentByID request. -func (client BaseClient) DeleteRoleAssignmentByIDPreparer(ctx context.Context, roleAssignmentID string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - } - - pathParameters := map[string]interface{}{ - "roleAssignmentId": autorest.Encode("path", roleAssignmentID), - } - - const APIVersion = "2020-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{endpoint}", urlParameters), - autorest.WithPathParameters("/rbac/roleAssignments/{roleAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteRoleAssignmentByIDSender sends the DeleteRoleAssignmentByID request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) DeleteRoleAssignmentByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteRoleAssignmentByIDResponder handles the response to the DeleteRoleAssignmentByID request. The method always -// closes the http.Response Body. -func (client BaseClient) DeleteRoleAssignmentByIDResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetCallerRoleAssignments list role assignments of the caller. -func (client BaseClient) GetCallerRoleAssignments(ctx context.Context) (result ListString, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCallerRoleAssignments") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetCallerRoleAssignmentsPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetCallerRoleAssignments", nil, "Failure preparing request") - return - } - - resp, err := client.GetCallerRoleAssignmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetCallerRoleAssignments", resp, "Failure sending request") - return - } - - result, err = client.GetCallerRoleAssignmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetCallerRoleAssignments", resp, "Failure responding to request") - return - } - - return -} - -// GetCallerRoleAssignmentsPreparer prepares the GetCallerRoleAssignments request. -func (client BaseClient) GetCallerRoleAssignmentsPreparer(ctx context.Context) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - } - - const APIVersion = "2020-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithCustomBaseURL("{endpoint}", urlParameters), - autorest.WithPath("/rbac/getMyAssignedRoles"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCallerRoleAssignmentsSender sends the GetCallerRoleAssignments request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetCallerRoleAssignmentsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetCallerRoleAssignmentsResponder handles the response to the GetCallerRoleAssignments request. The method always -// closes the http.Response Body. -func (client BaseClient) GetCallerRoleAssignmentsResponder(resp *http.Response) (result ListString, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRoleAssignmentByID get role assignment by role assignment Id. -// Parameters: -// roleAssignmentID - the ID of the role assignment. -func (client BaseClient) GetRoleAssignmentByID(ctx context.Context, roleAssignmentID string) (result RoleAssignmentDetails, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetRoleAssignmentByID") - 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: roleAssignmentID, - Constraints: []validation.Constraint{{Target: "roleAssignmentID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("accesscontrol.BaseClient", "GetRoleAssignmentByID", err.Error()) - } - - req, err := client.GetRoleAssignmentByIDPreparer(ctx, roleAssignmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleAssignmentByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetRoleAssignmentByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleAssignmentByID", resp, "Failure sending request") - return - } - - result, err = client.GetRoleAssignmentByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleAssignmentByID", resp, "Failure responding to request") - return - } - - return -} - -// GetRoleAssignmentByIDPreparer prepares the GetRoleAssignmentByID request. -func (client BaseClient) GetRoleAssignmentByIDPreparer(ctx context.Context, roleAssignmentID string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - } - - pathParameters := map[string]interface{}{ - "roleAssignmentId": autorest.Encode("path", roleAssignmentID), - } - - const APIVersion = "2020-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}", urlParameters), - autorest.WithPathParameters("/rbac/roleAssignments/{roleAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetRoleAssignmentByIDSender sends the GetRoleAssignmentByID request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetRoleAssignmentByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetRoleAssignmentByIDResponder handles the response to the GetRoleAssignmentByID request. The method always -// closes the http.Response Body. -func (client BaseClient) GetRoleAssignmentByIDResponder(resp *http.Response) (result RoleAssignmentDetails, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRoleAssignments list role assignments. -// Parameters: -// roleID - synapse Built-In Role Id. -// principalID - object ID of the AAD principal or security-group. -// continuationToken - continuation token. -func (client BaseClient) GetRoleAssignments(ctx context.Context, roleID string, principalID string, continuationToken string) (result ListRoleAssignmentDetails, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetRoleAssignments") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetRoleAssignmentsPreparer(ctx, roleID, principalID, continuationToken) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleAssignments", nil, "Failure preparing request") - return - } - - resp, err := client.GetRoleAssignmentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleAssignments", resp, "Failure sending request") - return - } - - result, err = client.GetRoleAssignmentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleAssignments", resp, "Failure responding to request") - return - } - - return -} - -// GetRoleAssignmentsPreparer prepares the GetRoleAssignments request. -func (client BaseClient) GetRoleAssignmentsPreparer(ctx context.Context, roleID string, principalID string, continuationToken string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - } - - const APIVersion = "2020-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(roleID) > 0 { - queryParameters["roleId"] = autorest.Encode("query", roleID) - } - if len(principalID) > 0 { - queryParameters["principalId"] = autorest.Encode("query", principalID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}", urlParameters), - autorest.WithPath("/rbac/roleAssignments"), - autorest.WithQueryParameters(queryParameters)) - if len(continuationToken) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-continuation", autorest.String(continuationToken))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetRoleAssignmentsSender sends the GetRoleAssignments request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetRoleAssignmentsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetRoleAssignmentsResponder handles the response to the GetRoleAssignments request. The method always -// closes the http.Response Body. -func (client BaseClient) GetRoleAssignmentsResponder(resp *http.Response) (result ListRoleAssignmentDetails, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRoleDefinitionByID get role by role Id. -// Parameters: -// roleID - synapse Built-In Role Id. -func (client BaseClient) GetRoleDefinitionByID(ctx context.Context, roleID string) (result SynapseRole, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetRoleDefinitionByID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetRoleDefinitionByIDPreparer(ctx, roleID) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleDefinitionByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetRoleDefinitionByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleDefinitionByID", resp, "Failure sending request") - return - } - - result, err = client.GetRoleDefinitionByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleDefinitionByID", resp, "Failure responding to request") - return - } - - return -} - -// GetRoleDefinitionByIDPreparer prepares the GetRoleDefinitionByID request. -func (client BaseClient) GetRoleDefinitionByIDPreparer(ctx context.Context, roleID string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - } - - pathParameters := map[string]interface{}{ - "roleId": autorest.Encode("path", roleID), - } - - const APIVersion = "2020-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}", urlParameters), - autorest.WithPathParameters("/rbac/roles/{roleId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetRoleDefinitionByIDSender sends the GetRoleDefinitionByID request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetRoleDefinitionByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetRoleDefinitionByIDResponder handles the response to the GetRoleDefinitionByID request. The method always -// closes the http.Response Body. -func (client BaseClient) GetRoleDefinitionByIDResponder(resp *http.Response) (result SynapseRole, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRoleDefinitions list roles. -func (client BaseClient) GetRoleDefinitions(ctx context.Context) (result RolesListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetRoleDefinitions") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getRoleDefinitionsNextResults - req, err := client.GetRoleDefinitionsPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.GetRoleDefinitionsSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleDefinitions", resp, "Failure sending request") - return - } - - result.rlr, err = client.GetRoleDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "GetRoleDefinitions", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetRoleDefinitionsPreparer prepares the GetRoleDefinitions request. -func (client BaseClient) GetRoleDefinitionsPreparer(ctx context.Context) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "endpoint": client.Endpoint, - } - - const APIVersion = "2020-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{endpoint}", urlParameters), - autorest.WithPath("/rbac/roles"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetRoleDefinitionsSender sends the GetRoleDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetRoleDefinitionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetRoleDefinitionsResponder handles the response to the GetRoleDefinitions request. The method always -// closes the http.Response Body. -func (client BaseClient) GetRoleDefinitionsResponder(resp *http.Response) (result RolesListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getRoleDefinitionsNextResults retrieves the next set of results, if any. -func (client BaseClient) getRoleDefinitionsNextResults(ctx context.Context, lastResults RolesListResponse) (result RolesListResponse, err error) { - req, err := lastResults.rolesListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "getRoleDefinitionsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetRoleDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "getRoleDefinitionsNextResults", resp, "Failure sending next results request") - } - result, err = client.GetRoleDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "accesscontrol.BaseClient", "getRoleDefinitionsNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetRoleDefinitionsComplete enumerates all values, automatically crossing page boundaries as required. -func (client BaseClient) GetRoleDefinitionsComplete(ctx context.Context) (result RolesListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetRoleDefinitions") - 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.GetRoleDefinitions(ctx) - return -} diff --git a/services/preview/synapse/2020-02-01-preview/accesscontrol/dataplane_meta.json b/services/preview/synapse/2020-02-01-preview/accesscontrol/dataplane_meta.json deleted file mode 100644 index 7ff2ff84d636..000000000000 --- a/services/preview/synapse/2020-02-01-preview/accesscontrol/dataplane_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/synapse/data-plane/readme.md", - "tag": "package-access-control-2020-02-01-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-access-control-2020-02-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/synapse/data-plane/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/synapse/2020-02-01-preview/accesscontrol/models.go b/services/preview/synapse/2020-02-01-preview/accesscontrol/models.go deleted file mode 100644 index 14201882b293..000000000000 --- a/services/preview/synapse/2020-02-01-preview/accesscontrol/models.go +++ /dev/null @@ -1,240 +0,0 @@ -package accesscontrol - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/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/preview/synapse/2020-02-01-preview/accesscontrol" - -// ErrorContract contains details when the response code indicates an error. -type ErrorContract struct { - // Error - The error details. - Error *ErrorResponse `json:"error,omitempty"` -} - -// ErrorDetail ... -type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` -} - -// ErrorResponse ... -type ErrorResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]ErrorDetail `json:"details,omitempty"` -} - -// ListRoleAssignmentDetails ... -type ListRoleAssignmentDetails struct { - autorest.Response `json:"-"` - Value *[]RoleAssignmentDetails `json:"value,omitempty"` -} - -// ListString ... -type ListString struct { - autorest.Response `json:"-"` - Value *[]string `json:"value,omitempty"` -} - -// RoleAssignmentDetails role Assignment response details -type RoleAssignmentDetails struct { - autorest.Response `json:"-"` - // ID - Role Assignment ID - ID *string `json:"id,omitempty"` - // RoleID - Role ID of the Synapse Built-In Role - RoleID *string `json:"roleId,omitempty"` - // PrincipalID - Object ID of the AAD principal or security-group - PrincipalID *string `json:"principalId,omitempty"` -} - -// RoleAssignmentOptions role Assignment request details -type RoleAssignmentOptions struct { - // RoleID - Role ID of the Synapse Built-In Role - RoleID *string `json:"roleId,omitempty"` - // PrincipalID - Object ID of the AAD principal or security-group - PrincipalID *string `json:"principalId,omitempty"` -} - -// RolesListResponse a list of Synapse roles available. -type RolesListResponse struct { - autorest.Response `json:"-"` - // Value - List of Synapse roles. - Value *[]SynapseRole `json:"value,omitempty"` - // NextLink - The link to the next page of results, if any remaining results exist. - NextLink *string `json:"nextLink,omitempty"` -} - -// RolesListResponseIterator provides access to a complete listing of SynapseRole values. -type RolesListResponseIterator struct { - i int - page RolesListResponsePage -} - -// 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 *RolesListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RolesListResponseIterator.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 *RolesListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RolesListResponseIterator) 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 RolesListResponseIterator) Response() RolesListResponse { - 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 RolesListResponseIterator) Value() SynapseRole { - if !iter.page.NotDone() { - return SynapseRole{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RolesListResponseIterator type. -func NewRolesListResponseIterator(page RolesListResponsePage) RolesListResponseIterator { - return RolesListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RolesListResponse) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RolesListResponse) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// rolesListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RolesListResponse) rolesListResponsePreparer(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))) -} - -// RolesListResponsePage contains a page of SynapseRole values. -type RolesListResponsePage struct { - fn func(context.Context, RolesListResponse) (RolesListResponse, error) - rlr RolesListResponse -} - -// 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 *RolesListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RolesListResponsePage.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 *RolesListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RolesListResponsePage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RolesListResponsePage) Response() RolesListResponse { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RolesListResponsePage) Values() []SynapseRole { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RolesListResponsePage type. -func NewRolesListResponsePage(cur RolesListResponse, getNextPage func(context.Context, RolesListResponse) (RolesListResponse, error)) RolesListResponsePage { - return RolesListResponsePage{ - fn: getNextPage, - rlr: cur, - } -} - -// SynapseRole synapse role details -type SynapseRole struct { - autorest.Response `json:"-"` - // ID - Role ID - ID *string `json:"id,omitempty"` - // Name - Name of the Synapse role - Name *string `json:"name,omitempty"` - // IsBuiltIn - Is a built-in role or not - IsBuiltIn *bool `json:"isBuiltIn,omitempty"` -} diff --git a/services/preview/synapse/2020-02-01-preview/accesscontrol/version.go b/services/preview/synapse/2020-02-01-preview/accesscontrol/version.go deleted file mode 100644 index c796318a31e7..000000000000 --- a/services/preview/synapse/2020-02-01-preview/accesscontrol/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package accesscontrol - -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() + " accesscontrol/2020-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/synapse/mgmt/2019-06-01-preview/synapse/CHANGELOG.md b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/_meta.json b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/_meta.json deleted file mode 100644 index 3d8c2a24767b..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3a3a9452f965a227ce43e6b545035b99dd175f23", - "readme": "/_/azure-rest-api-specs/specification/synapse/resource-manager/readme.md", - "tag": "package-2019-06-01-preview", - "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-2019-06-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/synapse/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/bigdatapools.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/bigdatapools.go deleted file mode 100644 index ec2ed2b620ff..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/bigdatapools.go +++ /dev/null @@ -1,530 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BigDataPoolsClient is the azure Synapse Analytics Management Client -type BigDataPoolsClient struct { - BaseClient -} - -// NewBigDataPoolsClient creates an instance of the BigDataPoolsClient client. -func NewBigDataPoolsClient(subscriptionID string) BigDataPoolsClient { - return NewBigDataPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBigDataPoolsClientWithBaseURI creates an instance of the BigDataPoolsClient 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 NewBigDataPoolsClientWithBaseURI(baseURI string, subscriptionID string) BigDataPoolsClient { - return BigDataPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new Big Data pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// bigDataPoolName - big Data pool name -// bigDataPoolInfo - the Big Data pool to create. -// force - whether to stop any running jobs in the Big Data pool -func (client BigDataPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolInfo BigDataPoolResourceInfo, force *bool) (result BigDataPoolsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.BigDataPoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, bigDataPoolName, bigDataPoolInfo, force) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BigDataPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolInfo BigDataPoolResourceInfo, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bigDataPoolName": autorest.Encode("path", bigDataPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } else { - queryParameters["force"] = autorest.Encode("query", false) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}", pathParameters), - autorest.WithJSON(bigDataPoolInfo), - 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 BigDataPoolsClient) CreateOrUpdateSender(req *http.Request) (future BigDataPoolsCreateOrUpdateFuture, 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 BigDataPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result BigDataPoolResourceInfo, 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 delete a Big Data pool from the workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// bigDataPoolName - big Data pool name -func (client BigDataPoolsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (result BigDataPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.BigDataPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, bigDataPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BigDataPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bigDataPoolName": autorest.Encode("path", bigDataPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}", 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 BigDataPoolsClient) DeleteSender(req *http.Request) (future BigDataPoolsDeleteFuture, 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 BigDataPoolsClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a Big Data pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// bigDataPoolName - big Data pool name -func (client BigDataPoolsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (result BigDataPoolResourceInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.BigDataPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, bigDataPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BigDataPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bigDataPoolName": autorest.Encode("path", bigDataPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}", 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 BigDataPoolsClient) 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 BigDataPoolsClient) GetResponder(resp *http.Response) (result BigDataPoolResourceInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list Big Data pools in a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client BigDataPoolsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result BigDataPoolResourceInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.ListByWorkspace") - defer func() { - sc := -1 - if result.bdprilr.Response.Response != nil { - sc = result.bdprilr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.BigDataPoolsClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.bdprilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.bdprilr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.bdprilr.hasNextLink() && result.bdprilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client BigDataPoolsClient) ListByWorkspacePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/bigDataPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client BigDataPoolsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client BigDataPoolsClient) ListByWorkspaceResponder(resp *http.Response) (result BigDataPoolResourceInfoListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client BigDataPoolsClient) listByWorkspaceNextResults(ctx context.Context, lastResults BigDataPoolResourceInfoListResult) (result BigDataPoolResourceInfoListResult, err error) { - req, err := lastResults.bigDataPoolResourceInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client BigDataPoolsClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result BigDataPoolResourceInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// Update patch a Big Data pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// bigDataPoolName - big Data pool name -// bigDataPoolPatchInfo - the updated Big Data pool properties -func (client BigDataPoolsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolPatchInfo BigDataPoolPatchInfo) (result BigDataPoolResourceInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.BigDataPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, bigDataPoolName, bigDataPoolPatchInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BigDataPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolPatchInfo BigDataPoolPatchInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bigDataPoolName": autorest.Encode("path", bigDataPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}", pathParameters), - autorest.WithJSON(bigDataPoolPatchInfo), - 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 BigDataPoolsClient) 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 BigDataPoolsClient) UpdateResponder(resp *http.Response) (result BigDataPoolResourceInfo, 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/synapse/mgmt/2019-06-01-preview/synapse/client.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/client.go deleted file mode 100644 index e30bd9b9ff8e..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package synapse implements the Azure ARM Synapse service API version 2019-06-01-preview. -// -// Azure Synapse Analytics Management Client -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Synapse - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Synapse. -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/synapse/mgmt/2019-06-01-preview/synapse/datamaskingpolicies.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/datamaskingpolicies.go deleted file mode 100644 index d63af258206a..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/datamaskingpolicies.go +++ /dev/null @@ -1,217 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DataMaskingPoliciesClient is the azure Synapse Analytics Management Client -type DataMaskingPoliciesClient struct { - BaseClient -} - -// NewDataMaskingPoliciesClient creates an instance of the DataMaskingPoliciesClient client. -func NewDataMaskingPoliciesClient(subscriptionID string) DataMaskingPoliciesClient { - return NewDataMaskingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataMaskingPoliciesClientWithBaseURI creates an instance of the DataMaskingPoliciesClient 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 NewDataMaskingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingPoliciesClient { - return DataMaskingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Sql pool data masking policy -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - parameters for creating or updating a data masking policy. -func (client DataMaskingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters DataMaskingPolicy) (result DataMaskingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.DataMaskingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataMaskingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters DataMaskingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.Kind = nil - parameters.ManagedBy = 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}", 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 DataMaskingPoliciesClient) 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 DataMaskingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a Sql pool data masking policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client DataMaskingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result DataMaskingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.DataMaskingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataMaskingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}", 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 DataMaskingPoliciesClient) 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 DataMaskingPoliciesClient) GetResponder(resp *http.Response) (result DataMaskingPolicy, 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/synapse/mgmt/2019-06-01-preview/synapse/datamaskingrules.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/datamaskingrules.go deleted file mode 100644 index 7d9994a3f9a8..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/datamaskingrules.go +++ /dev/null @@ -1,224 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DataMaskingRulesClient is the azure Synapse Analytics Management Client -type DataMaskingRulesClient struct { - BaseClient -} - -// NewDataMaskingRulesClient creates an instance of the DataMaskingRulesClient client. -func NewDataMaskingRulesClient(subscriptionID string) DataMaskingRulesClient { - return NewDataMaskingRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataMaskingRulesClientWithBaseURI creates an instance of the DataMaskingRulesClient 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 NewDataMaskingRulesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingRulesClient { - return DataMaskingRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Sql pool data masking rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// dataMaskingRuleName - the name of the data masking rule. -// parameters - the required parameters for creating or updating a data masking rule. -func (client DataMaskingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, dataMaskingRuleName string, parameters DataMaskingRule) (result DataMaskingRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties.SchemaName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataMaskingRuleProperties.TableName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataMaskingRuleProperties.ColumnName", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("synapse.DataMaskingRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, dataMaskingRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataMaskingRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, dataMaskingRuleName string, parameters DataMaskingRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "dataMaskingRuleName": autorest.Encode("path", dataMaskingRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}", 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 DataMaskingRulesClient) 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 DataMaskingRulesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySQLPool gets a list of Sql pool data masking rules. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client DataMaskingRulesClient) ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result DataMaskingRuleListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.ListBySQLPool") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.DataMaskingRulesClient", "ListBySQLPool", err.Error()) - } - - req, err := client.ListBySQLPoolPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "ListBySQLPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "ListBySQLPool", resp, "Failure sending request") - return - } - - result, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "ListBySQLPool", resp, "Failure responding to request") - return - } - - return -} - -// ListBySQLPoolPreparer prepares the ListBySQLPool request. -func (client DataMaskingRulesClient) ListBySQLPoolPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySQLPoolSender sends the ListBySQLPool request. The method will close the -// http.Response Body if it receives an error. -func (client DataMaskingRulesClient) ListBySQLPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySQLPoolResponder handles the response to the ListBySQLPool request. The method always -// closes the http.Response Body. -func (client DataMaskingRulesClient) ListBySQLPoolResponder(resp *http.Response) (result DataMaskingRuleListResult, 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/synapse/mgmt/2019-06-01-preview/synapse/enums.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/enums.go deleted file mode 100644 index 5ea3a28a9dfb..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/enums.go +++ /dev/null @@ -1,916 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActualState enumerates the values for actual state. -type ActualState string - -const ( - // Disabled ... - Disabled ActualState = "Disabled" - // Disabling ... - Disabling ActualState = "Disabling" - // Enabled ... - Enabled ActualState = "Enabled" - // Enabling ... - Enabling ActualState = "Enabling" - // Unknown ... - Unknown ActualState = "Unknown" -) - -// PossibleActualStateValues returns an array of possible values for the ActualState const type. -func PossibleActualStateValues() []ActualState { - return []ActualState{Disabled, Disabling, Enabled, Enabling, Unknown} -} - -// AuthorizationType enumerates the values for authorization type. -type AuthorizationType string - -const ( - // AuthorizationTypeKey ... - AuthorizationTypeKey AuthorizationType = "Key" - // AuthorizationTypeLinkedIntegrationRuntimeType ... - AuthorizationTypeLinkedIntegrationRuntimeType AuthorizationType = "LinkedIntegrationRuntimeType" - // AuthorizationTypeRBAC ... - AuthorizationTypeRBAC AuthorizationType = "RBAC" -) - -// PossibleAuthorizationTypeValues returns an array of possible values for the AuthorizationType const type. -func PossibleAuthorizationTypeValues() []AuthorizationType { - return []AuthorizationType{AuthorizationTypeKey, AuthorizationTypeLinkedIntegrationRuntimeType, AuthorizationTypeRBAC} -} - -// BlobAuditingPolicyState enumerates the values for blob auditing policy state. -type BlobAuditingPolicyState string - -const ( - // BlobAuditingPolicyStateDisabled ... - BlobAuditingPolicyStateDisabled BlobAuditingPolicyState = "Disabled" - // BlobAuditingPolicyStateEnabled ... - BlobAuditingPolicyStateEnabled BlobAuditingPolicyState = "Enabled" -) - -// PossibleBlobAuditingPolicyStateValues returns an array of possible values for the BlobAuditingPolicyState const type. -func PossibleBlobAuditingPolicyStateValues() []BlobAuditingPolicyState { - return []BlobAuditingPolicyState{BlobAuditingPolicyStateDisabled, BlobAuditingPolicyStateEnabled} -} - -// ColumnDataType enumerates the values for column data type. -type ColumnDataType string - -const ( - // Bigint ... - Bigint ColumnDataType = "bigint" - // Binary ... - Binary ColumnDataType = "binary" - // Bit ... - Bit ColumnDataType = "bit" - // Char ... - Char ColumnDataType = "char" - // Date ... - Date ColumnDataType = "date" - // Datetime ... - Datetime ColumnDataType = "datetime" - // Datetime2 ... - Datetime2 ColumnDataType = "datetime2" - // Datetimeoffset ... - Datetimeoffset ColumnDataType = "datetimeoffset" - // Decimal ... - Decimal ColumnDataType = "decimal" - // Float ... - Float ColumnDataType = "float" - // Geography ... - Geography ColumnDataType = "geography" - // Geometry ... - Geometry ColumnDataType = "geometry" - // Hierarchyid ... - Hierarchyid ColumnDataType = "hierarchyid" - // Image ... - Image ColumnDataType = "image" - // Int ... - Int ColumnDataType = "int" - // Money ... - Money ColumnDataType = "money" - // Nchar ... - Nchar ColumnDataType = "nchar" - // Ntext ... - Ntext ColumnDataType = "ntext" - // Numeric ... - Numeric ColumnDataType = "numeric" - // Nvarchar ... - Nvarchar ColumnDataType = "nvarchar" - // Real ... - Real ColumnDataType = "real" - // Smalldatetime ... - Smalldatetime ColumnDataType = "smalldatetime" - // Smallint ... - Smallint ColumnDataType = "smallint" - // Smallmoney ... - Smallmoney ColumnDataType = "smallmoney" - // SQLVariant ... - SQLVariant ColumnDataType = "sql_variant" - // Sysname ... - Sysname ColumnDataType = "sysname" - // Text ... - Text ColumnDataType = "text" - // Time ... - Time ColumnDataType = "time" - // Timestamp ... - Timestamp ColumnDataType = "timestamp" - // Tinyint ... - Tinyint ColumnDataType = "tinyint" - // Uniqueidentifier ... - Uniqueidentifier ColumnDataType = "uniqueidentifier" - // Varbinary ... - Varbinary ColumnDataType = "varbinary" - // Varchar ... - Varchar ColumnDataType = "varchar" - // XML ... - XML ColumnDataType = "xml" -) - -// PossibleColumnDataTypeValues returns an array of possible values for the ColumnDataType const type. -func PossibleColumnDataTypeValues() []ColumnDataType { - return []ColumnDataType{Bigint, Binary, Bit, Char, Date, Datetime, Datetime2, Datetimeoffset, Decimal, Float, Geography, Geometry, Hierarchyid, Image, Int, Money, Nchar, Ntext, Numeric, Nvarchar, Real, Smalldatetime, Smallint, Smallmoney, SQLVariant, Sysname, Text, Time, Timestamp, Tinyint, Uniqueidentifier, Varbinary, Varchar, XML} -} - -// DataFlowComputeType enumerates the values for data flow compute type. -type DataFlowComputeType string - -const ( - // ComputeOptimized ... - ComputeOptimized DataFlowComputeType = "ComputeOptimized" - // General ... - General DataFlowComputeType = "General" - // MemoryOptimized ... - MemoryOptimized DataFlowComputeType = "MemoryOptimized" -) - -// PossibleDataFlowComputeTypeValues returns an array of possible values for the DataFlowComputeType const type. -func PossibleDataFlowComputeTypeValues() []DataFlowComputeType { - return []DataFlowComputeType{ComputeOptimized, General, MemoryOptimized} -} - -// DataMaskingFunction enumerates the values for data masking function. -type DataMaskingFunction string - -const ( - // DataMaskingFunctionCCN ... - DataMaskingFunctionCCN DataMaskingFunction = "CCN" - // DataMaskingFunctionDefault ... - DataMaskingFunctionDefault DataMaskingFunction = "Default" - // DataMaskingFunctionEmail ... - DataMaskingFunctionEmail DataMaskingFunction = "Email" - // DataMaskingFunctionNumber ... - DataMaskingFunctionNumber DataMaskingFunction = "Number" - // DataMaskingFunctionSSN ... - DataMaskingFunctionSSN DataMaskingFunction = "SSN" - // DataMaskingFunctionText ... - DataMaskingFunctionText DataMaskingFunction = "Text" -) - -// PossibleDataMaskingFunctionValues returns an array of possible values for the DataMaskingFunction const type. -func PossibleDataMaskingFunctionValues() []DataMaskingFunction { - return []DataMaskingFunction{DataMaskingFunctionCCN, DataMaskingFunctionDefault, DataMaskingFunctionEmail, DataMaskingFunctionNumber, DataMaskingFunctionSSN, DataMaskingFunctionText} -} - -// DataMaskingRuleState enumerates the values for data masking rule state. -type DataMaskingRuleState string - -const ( - // DataMaskingRuleStateDisabled ... - DataMaskingRuleStateDisabled DataMaskingRuleState = "Disabled" - // DataMaskingRuleStateEnabled ... - DataMaskingRuleStateEnabled DataMaskingRuleState = "Enabled" -) - -// PossibleDataMaskingRuleStateValues returns an array of possible values for the DataMaskingRuleState const type. -func PossibleDataMaskingRuleStateValues() []DataMaskingRuleState { - return []DataMaskingRuleState{DataMaskingRuleStateDisabled, DataMaskingRuleStateEnabled} -} - -// DataMaskingState enumerates the values for data masking state. -type DataMaskingState string - -const ( - // DataMaskingStateDisabled ... - DataMaskingStateDisabled DataMaskingState = "Disabled" - // DataMaskingStateEnabled ... - DataMaskingStateEnabled DataMaskingState = "Enabled" -) - -// PossibleDataMaskingStateValues returns an array of possible values for the DataMaskingState const type. -func PossibleDataMaskingStateValues() []DataMaskingState { - return []DataMaskingState{DataMaskingStateDisabled, DataMaskingStateEnabled} -} - -// DesiredState enumerates the values for desired state. -type DesiredState string - -const ( - // DesiredStateDisabled ... - DesiredStateDisabled DesiredState = "Disabled" - // DesiredStateEnabled ... - DesiredStateEnabled DesiredState = "Enabled" -) - -// PossibleDesiredStateValues returns an array of possible values for the DesiredState const type. -func PossibleDesiredStateValues() []DesiredState { - return []DesiredState{DesiredStateDisabled, DesiredStateEnabled} -} - -// GeoBackupPolicyState enumerates the values for geo backup policy state. -type GeoBackupPolicyState string - -const ( - // GeoBackupPolicyStateDisabled ... - GeoBackupPolicyStateDisabled GeoBackupPolicyState = "Disabled" - // GeoBackupPolicyStateEnabled ... - GeoBackupPolicyStateEnabled GeoBackupPolicyState = "Enabled" -) - -// PossibleGeoBackupPolicyStateValues returns an array of possible values for the GeoBackupPolicyState const type. -func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { - return []GeoBackupPolicyState{GeoBackupPolicyStateDisabled, GeoBackupPolicyStateEnabled} -} - -// IntegrationRuntimeAuthKeyName enumerates the values for integration runtime auth key name. -type IntegrationRuntimeAuthKeyName string - -const ( - // AuthKey1 ... - AuthKey1 IntegrationRuntimeAuthKeyName = "authKey1" - // AuthKey2 ... - AuthKey2 IntegrationRuntimeAuthKeyName = "authKey2" -) - -// PossibleIntegrationRuntimeAuthKeyNameValues returns an array of possible values for the IntegrationRuntimeAuthKeyName const type. -func PossibleIntegrationRuntimeAuthKeyNameValues() []IntegrationRuntimeAuthKeyName { - return []IntegrationRuntimeAuthKeyName{AuthKey1, AuthKey2} -} - -// IntegrationRuntimeAutoUpdate enumerates the values for integration runtime auto update. -type IntegrationRuntimeAutoUpdate string - -const ( - // Off ... - Off IntegrationRuntimeAutoUpdate = "Off" - // On ... - On IntegrationRuntimeAutoUpdate = "On" -) - -// PossibleIntegrationRuntimeAutoUpdateValues returns an array of possible values for the IntegrationRuntimeAutoUpdate const type. -func PossibleIntegrationRuntimeAutoUpdateValues() []IntegrationRuntimeAutoUpdate { - return []IntegrationRuntimeAutoUpdate{Off, On} -} - -// IntegrationRuntimeEdition enumerates the values for integration runtime edition. -type IntegrationRuntimeEdition string - -const ( - // Enterprise ... - Enterprise IntegrationRuntimeEdition = "Enterprise" - // Standard ... - Standard IntegrationRuntimeEdition = "Standard" -) - -// PossibleIntegrationRuntimeEditionValues returns an array of possible values for the IntegrationRuntimeEdition const type. -func PossibleIntegrationRuntimeEditionValues() []IntegrationRuntimeEdition { - return []IntegrationRuntimeEdition{Enterprise, Standard} -} - -// IntegrationRuntimeEntityReferenceType enumerates the values for integration runtime entity reference type. -type IntegrationRuntimeEntityReferenceType string - -const ( - // IntegrationRuntimeReference ... - IntegrationRuntimeReference IntegrationRuntimeEntityReferenceType = "IntegrationRuntimeReference" - // LinkedServiceReference ... - LinkedServiceReference IntegrationRuntimeEntityReferenceType = "LinkedServiceReference" -) - -// PossibleIntegrationRuntimeEntityReferenceTypeValues returns an array of possible values for the IntegrationRuntimeEntityReferenceType const type. -func PossibleIntegrationRuntimeEntityReferenceTypeValues() []IntegrationRuntimeEntityReferenceType { - return []IntegrationRuntimeEntityReferenceType{IntegrationRuntimeReference, LinkedServiceReference} -} - -// IntegrationRuntimeInternalChannelEncryptionMode enumerates the values for integration runtime internal -// channel encryption mode. -type IntegrationRuntimeInternalChannelEncryptionMode string - -const ( - // NotEncrypted ... - NotEncrypted IntegrationRuntimeInternalChannelEncryptionMode = "NotEncrypted" - // NotSet ... - NotSet IntegrationRuntimeInternalChannelEncryptionMode = "NotSet" - // SslEncrypted ... - SslEncrypted IntegrationRuntimeInternalChannelEncryptionMode = "SslEncrypted" -) - -// PossibleIntegrationRuntimeInternalChannelEncryptionModeValues returns an array of possible values for the IntegrationRuntimeInternalChannelEncryptionMode const type. -func PossibleIntegrationRuntimeInternalChannelEncryptionModeValues() []IntegrationRuntimeInternalChannelEncryptionMode { - return []IntegrationRuntimeInternalChannelEncryptionMode{NotEncrypted, NotSet, SslEncrypted} -} - -// IntegrationRuntimeLicenseType enumerates the values for integration runtime license type. -type IntegrationRuntimeLicenseType string - -const ( - // BasePrice ... - BasePrice IntegrationRuntimeLicenseType = "BasePrice" - // LicenseIncluded ... - LicenseIncluded IntegrationRuntimeLicenseType = "LicenseIncluded" -) - -// PossibleIntegrationRuntimeLicenseTypeValues returns an array of possible values for the IntegrationRuntimeLicenseType const type. -func PossibleIntegrationRuntimeLicenseTypeValues() []IntegrationRuntimeLicenseType { - return []IntegrationRuntimeLicenseType{BasePrice, LicenseIncluded} -} - -// IntegrationRuntimeSsisCatalogPricingTier enumerates the values for integration runtime ssis catalog pricing -// tier. -type IntegrationRuntimeSsisCatalogPricingTier string - -const ( - // IntegrationRuntimeSsisCatalogPricingTierBasic ... - IntegrationRuntimeSsisCatalogPricingTierBasic IntegrationRuntimeSsisCatalogPricingTier = "Basic" - // IntegrationRuntimeSsisCatalogPricingTierPremium ... - IntegrationRuntimeSsisCatalogPricingTierPremium IntegrationRuntimeSsisCatalogPricingTier = "Premium" - // IntegrationRuntimeSsisCatalogPricingTierPremiumRS ... - IntegrationRuntimeSsisCatalogPricingTierPremiumRS IntegrationRuntimeSsisCatalogPricingTier = "PremiumRS" - // IntegrationRuntimeSsisCatalogPricingTierStandard ... - IntegrationRuntimeSsisCatalogPricingTierStandard IntegrationRuntimeSsisCatalogPricingTier = "Standard" -) - -// PossibleIntegrationRuntimeSsisCatalogPricingTierValues returns an array of possible values for the IntegrationRuntimeSsisCatalogPricingTier const type. -func PossibleIntegrationRuntimeSsisCatalogPricingTierValues() []IntegrationRuntimeSsisCatalogPricingTier { - return []IntegrationRuntimeSsisCatalogPricingTier{IntegrationRuntimeSsisCatalogPricingTierBasic, IntegrationRuntimeSsisCatalogPricingTierPremium, IntegrationRuntimeSsisCatalogPricingTierPremiumRS, IntegrationRuntimeSsisCatalogPricingTierStandard} -} - -// IntegrationRuntimeState enumerates the values for integration runtime state. -type IntegrationRuntimeState string - -const ( - // AccessDenied ... - AccessDenied IntegrationRuntimeState = "AccessDenied" - // Initial ... - Initial IntegrationRuntimeState = "Initial" - // Limited ... - Limited IntegrationRuntimeState = "Limited" - // NeedRegistration ... - NeedRegistration IntegrationRuntimeState = "NeedRegistration" - // Offline ... - Offline IntegrationRuntimeState = "Offline" - // Online ... - Online IntegrationRuntimeState = "Online" - // Started ... - Started IntegrationRuntimeState = "Started" - // Starting ... - Starting IntegrationRuntimeState = "Starting" - // Stopped ... - Stopped IntegrationRuntimeState = "Stopped" - // Stopping ... - Stopping IntegrationRuntimeState = "Stopping" -) - -// PossibleIntegrationRuntimeStateValues returns an array of possible values for the IntegrationRuntimeState const type. -func PossibleIntegrationRuntimeStateValues() []IntegrationRuntimeState { - return []IntegrationRuntimeState{AccessDenied, Initial, Limited, NeedRegistration, Offline, Online, Started, Starting, Stopped, Stopping} -} - -// IntegrationRuntimeType enumerates the values for integration runtime type. -type IntegrationRuntimeType string - -const ( - // Managed ... - Managed IntegrationRuntimeType = "Managed" - // SelfHosted ... - SelfHosted IntegrationRuntimeType = "SelfHosted" -) - -// PossibleIntegrationRuntimeTypeValues returns an array of possible values for the IntegrationRuntimeType const type. -func PossibleIntegrationRuntimeTypeValues() []IntegrationRuntimeType { - return []IntegrationRuntimeType{Managed, SelfHosted} -} - -// IntegrationRuntimeUpdateResult enumerates the values for integration runtime update result. -type IntegrationRuntimeUpdateResult string - -const ( - // Fail ... - Fail IntegrationRuntimeUpdateResult = "Fail" - // None ... - None IntegrationRuntimeUpdateResult = "None" - // Succeed ... - Succeed IntegrationRuntimeUpdateResult = "Succeed" -) - -// PossibleIntegrationRuntimeUpdateResultValues returns an array of possible values for the IntegrationRuntimeUpdateResult const type. -func PossibleIntegrationRuntimeUpdateResultValues() []IntegrationRuntimeUpdateResult { - return []IntegrationRuntimeUpdateResult{Fail, None, Succeed} -} - -// ManagedIntegrationRuntimeNodeStatus enumerates the values for managed integration runtime node status. -type ManagedIntegrationRuntimeNodeStatus string - -const ( - // ManagedIntegrationRuntimeNodeStatusAvailable ... - ManagedIntegrationRuntimeNodeStatusAvailable ManagedIntegrationRuntimeNodeStatus = "Available" - // ManagedIntegrationRuntimeNodeStatusRecycling ... - ManagedIntegrationRuntimeNodeStatusRecycling ManagedIntegrationRuntimeNodeStatus = "Recycling" - // ManagedIntegrationRuntimeNodeStatusStarting ... - ManagedIntegrationRuntimeNodeStatusStarting ManagedIntegrationRuntimeNodeStatus = "Starting" - // ManagedIntegrationRuntimeNodeStatusUnavailable ... - ManagedIntegrationRuntimeNodeStatusUnavailable ManagedIntegrationRuntimeNodeStatus = "Unavailable" -) - -// PossibleManagedIntegrationRuntimeNodeStatusValues returns an array of possible values for the ManagedIntegrationRuntimeNodeStatus const type. -func PossibleManagedIntegrationRuntimeNodeStatusValues() []ManagedIntegrationRuntimeNodeStatus { - return []ManagedIntegrationRuntimeNodeStatus{ManagedIntegrationRuntimeNodeStatusAvailable, ManagedIntegrationRuntimeNodeStatusRecycling, ManagedIntegrationRuntimeNodeStatusStarting, ManagedIntegrationRuntimeNodeStatusUnavailable} -} - -// ManagementOperationState enumerates the values for management operation state. -type ManagementOperationState string - -const ( - // CancelInProgress ... - CancelInProgress ManagementOperationState = "CancelInProgress" - // Cancelled ... - Cancelled ManagementOperationState = "Cancelled" - // Failed ... - Failed ManagementOperationState = "Failed" - // InProgress ... - InProgress ManagementOperationState = "InProgress" - // Pending ... - Pending ManagementOperationState = "Pending" - // Succeeded ... - Succeeded ManagementOperationState = "Succeeded" -) - -// PossibleManagementOperationStateValues returns an array of possible values for the ManagementOperationState const type. -func PossibleManagementOperationStateValues() []ManagementOperationState { - return []ManagementOperationState{CancelInProgress, Cancelled, Failed, InProgress, Pending, Succeeded} -} - -// NodeSize enumerates the values for node size. -type NodeSize string - -const ( - // NodeSizeLarge ... - NodeSizeLarge NodeSize = "Large" - // NodeSizeMedium ... - NodeSizeMedium NodeSize = "Medium" - // NodeSizeNone ... - NodeSizeNone NodeSize = "None" - // NodeSizeSmall ... - NodeSizeSmall NodeSize = "Small" - // NodeSizeXLarge ... - NodeSizeXLarge NodeSize = "XLarge" - // NodeSizeXXLarge ... - NodeSizeXXLarge NodeSize = "XXLarge" - // NodeSizeXXXLarge ... - NodeSizeXXXLarge NodeSize = "XXXLarge" -) - -// PossibleNodeSizeValues returns an array of possible values for the NodeSize const type. -func PossibleNodeSizeValues() []NodeSize { - return []NodeSize{NodeSizeLarge, NodeSizeMedium, NodeSizeNone, NodeSizeSmall, NodeSizeXLarge, NodeSizeXXLarge, NodeSizeXXXLarge} -} - -// NodeSizeFamily enumerates the values for node size family. -type NodeSizeFamily string - -const ( - // NodeSizeFamilyMemoryOptimized ... - NodeSizeFamilyMemoryOptimized NodeSizeFamily = "MemoryOptimized" - // NodeSizeFamilyNone ... - NodeSizeFamilyNone NodeSizeFamily = "None" -) - -// PossibleNodeSizeFamilyValues returns an array of possible values for the NodeSizeFamily const type. -func PossibleNodeSizeFamilyValues() []NodeSizeFamily { - return []NodeSizeFamily{NodeSizeFamilyMemoryOptimized, NodeSizeFamilyNone} -} - -// OperationStatus enumerates the values for operation status. -type OperationStatus string - -const ( - // OperationStatusCanceled ... - OperationStatusCanceled OperationStatus = "Canceled" - // OperationStatusFailed ... - OperationStatusFailed OperationStatus = "Failed" - // OperationStatusInProgress ... - OperationStatusInProgress OperationStatus = "InProgress" - // OperationStatusSucceeded ... - OperationStatusSucceeded OperationStatus = "Succeeded" -) - -// PossibleOperationStatusValues returns an array of possible values for the OperationStatus const type. -func PossibleOperationStatusValues() []OperationStatus { - return []OperationStatus{OperationStatusCanceled, OperationStatusFailed, OperationStatusInProgress, OperationStatusSucceeded} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateDeleteError ... - ProvisioningStateDeleteError ProvisioningState = "DeleteError" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateProvisioning ... - ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateDeleteError, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateProvisioning, ProvisioningStateSucceeded} -} - -// QueryAggregationFunction enumerates the values for query aggregation function. -type QueryAggregationFunction string - -const ( - // Avg ... - Avg QueryAggregationFunction = "avg" - // Max ... - Max QueryAggregationFunction = "max" - // Min ... - Min QueryAggregationFunction = "min" - // Sum ... - Sum QueryAggregationFunction = "sum" -) - -// PossibleQueryAggregationFunctionValues returns an array of possible values for the QueryAggregationFunction const type. -func PossibleQueryAggregationFunctionValues() []QueryAggregationFunction { - return []QueryAggregationFunction{Avg, Max, Min, Sum} -} - -// QueryExecutionType enumerates the values for query execution type. -type QueryExecutionType string - -const ( - // Aborted ... - Aborted QueryExecutionType = "aborted" - // Any ... - Any QueryExecutionType = "any" - // Exception ... - Exception QueryExecutionType = "exception" - // Irregular ... - Irregular QueryExecutionType = "irregular" - // Regular ... - Regular QueryExecutionType = "regular" -) - -// PossibleQueryExecutionTypeValues returns an array of possible values for the QueryExecutionType const type. -func PossibleQueryExecutionTypeValues() []QueryExecutionType { - return []QueryExecutionType{Aborted, Any, Exception, Irregular, Regular} -} - -// QueryMetricUnit enumerates the values for query metric unit. -type QueryMetricUnit string - -const ( - // KB ... - KB QueryMetricUnit = "KB" - // Microseconds ... - Microseconds QueryMetricUnit = "microseconds" - // Percentage ... - Percentage QueryMetricUnit = "percentage" -) - -// PossibleQueryMetricUnitValues returns an array of possible values for the QueryMetricUnit const type. -func PossibleQueryMetricUnitValues() []QueryMetricUnit { - return []QueryMetricUnit{KB, Microseconds, Percentage} -} - -// QueryObservedMetricType enumerates the values for query observed metric type. -type QueryObservedMetricType string - -const ( - // CPU ... - CPU QueryObservedMetricType = "cpu" - // Duration ... - Duration QueryObservedMetricType = "duration" - // ExecutionCount ... - ExecutionCount QueryObservedMetricType = "executionCount" - // Io ... - Io QueryObservedMetricType = "io" - // Logio ... - Logio QueryObservedMetricType = "logio" -) - -// PossibleQueryObservedMetricTypeValues returns an array of possible values for the QueryObservedMetricType const type. -func PossibleQueryObservedMetricTypeValues() []QueryObservedMetricType { - return []QueryObservedMetricType{CPU, Duration, ExecutionCount, Io, Logio} -} - -// ReplicationRole enumerates the values for replication role. -type ReplicationRole string - -const ( - // Copy ... - Copy ReplicationRole = "Copy" - // NonReadableSecondary ... - NonReadableSecondary ReplicationRole = "NonReadableSecondary" - // Primary ... - Primary ReplicationRole = "Primary" - // Secondary ... - Secondary ReplicationRole = "Secondary" - // Source ... - Source ReplicationRole = "Source" -) - -// PossibleReplicationRoleValues returns an array of possible values for the ReplicationRole const type. -func PossibleReplicationRoleValues() []ReplicationRole { - return []ReplicationRole{Copy, NonReadableSecondary, Primary, Secondary, Source} -} - -// ReplicationState enumerates the values for replication state. -type ReplicationState string - -const ( - // CATCHUP ... - CATCHUP ReplicationState = "CATCH_UP" - // PENDING ... - PENDING ReplicationState = "PENDING" - // SEEDING ... - SEEDING ReplicationState = "SEEDING" - // SUSPENDED ... - SUSPENDED ReplicationState = "SUSPENDED" -) - -// PossibleReplicationStateValues returns an array of possible values for the ReplicationState const type. -func PossibleReplicationStateValues() []ReplicationState { - return []ReplicationState{CATCHUP, PENDING, SEEDING, SUSPENDED} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned} -} - -// RestorePointType enumerates the values for restore point type. -type RestorePointType string - -const ( - // CONTINUOUS ... - CONTINUOUS RestorePointType = "CONTINUOUS" - // DISCRETE ... - DISCRETE RestorePointType = "DISCRETE" -) - -// PossibleRestorePointTypeValues returns an array of possible values for the RestorePointType const type. -func PossibleRestorePointTypeValues() []RestorePointType { - return []RestorePointType{CONTINUOUS, DISCRETE} -} - -// SecurityAlertPolicyState enumerates the values for security alert policy state. -type SecurityAlertPolicyState string - -const ( - // SecurityAlertPolicyStateDisabled ... - SecurityAlertPolicyStateDisabled SecurityAlertPolicyState = "Disabled" - // SecurityAlertPolicyStateEnabled ... - SecurityAlertPolicyStateEnabled SecurityAlertPolicyState = "Enabled" - // SecurityAlertPolicyStateNew ... - SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New" -) - -// PossibleSecurityAlertPolicyStateValues returns an array of possible values for the SecurityAlertPolicyState const type. -func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { - return []SecurityAlertPolicyState{SecurityAlertPolicyStateDisabled, SecurityAlertPolicyStateEnabled, SecurityAlertPolicyStateNew} -} - -// SelfHostedIntegrationRuntimeNodeStatus enumerates the values for self hosted integration runtime node -// status. -type SelfHostedIntegrationRuntimeNodeStatus string - -const ( - // SelfHostedIntegrationRuntimeNodeStatusInitializeFailed ... - SelfHostedIntegrationRuntimeNodeStatusInitializeFailed SelfHostedIntegrationRuntimeNodeStatus = "InitializeFailed" - // SelfHostedIntegrationRuntimeNodeStatusInitializing ... - SelfHostedIntegrationRuntimeNodeStatusInitializing SelfHostedIntegrationRuntimeNodeStatus = "Initializing" - // SelfHostedIntegrationRuntimeNodeStatusLimited ... - SelfHostedIntegrationRuntimeNodeStatusLimited SelfHostedIntegrationRuntimeNodeStatus = "Limited" - // SelfHostedIntegrationRuntimeNodeStatusNeedRegistration ... - SelfHostedIntegrationRuntimeNodeStatusNeedRegistration SelfHostedIntegrationRuntimeNodeStatus = "NeedRegistration" - // SelfHostedIntegrationRuntimeNodeStatusOffline ... - SelfHostedIntegrationRuntimeNodeStatusOffline SelfHostedIntegrationRuntimeNodeStatus = "Offline" - // SelfHostedIntegrationRuntimeNodeStatusOnline ... - SelfHostedIntegrationRuntimeNodeStatusOnline SelfHostedIntegrationRuntimeNodeStatus = "Online" - // SelfHostedIntegrationRuntimeNodeStatusUpgrading ... - SelfHostedIntegrationRuntimeNodeStatusUpgrading SelfHostedIntegrationRuntimeNodeStatus = "Upgrading" -) - -// PossibleSelfHostedIntegrationRuntimeNodeStatusValues returns an array of possible values for the SelfHostedIntegrationRuntimeNodeStatus const type. -func PossibleSelfHostedIntegrationRuntimeNodeStatusValues() []SelfHostedIntegrationRuntimeNodeStatus { - return []SelfHostedIntegrationRuntimeNodeStatus{SelfHostedIntegrationRuntimeNodeStatusInitializeFailed, SelfHostedIntegrationRuntimeNodeStatusInitializing, SelfHostedIntegrationRuntimeNodeStatusLimited, SelfHostedIntegrationRuntimeNodeStatusNeedRegistration, SelfHostedIntegrationRuntimeNodeStatusOffline, SelfHostedIntegrationRuntimeNodeStatusOnline, SelfHostedIntegrationRuntimeNodeStatusUpgrading} -} - -// SensitivityLabelSource enumerates the values for sensitivity label source. -type SensitivityLabelSource string - -const ( - // Current ... - Current SensitivityLabelSource = "current" - // Recommended ... - Recommended SensitivityLabelSource = "recommended" -) - -// PossibleSensitivityLabelSourceValues returns an array of possible values for the SensitivityLabelSource const type. -func PossibleSensitivityLabelSourceValues() []SensitivityLabelSource { - return []SensitivityLabelSource{Current, Recommended} -} - -// SsisObjectMetadataType enumerates the values for ssis object metadata type. -type SsisObjectMetadataType string - -const ( - // Environment ... - Environment SsisObjectMetadataType = "Environment" - // Folder ... - Folder SsisObjectMetadataType = "Folder" - // Package ... - Package SsisObjectMetadataType = "Package" - // Project ... - Project SsisObjectMetadataType = "Project" -) - -// PossibleSsisObjectMetadataTypeValues returns an array of possible values for the SsisObjectMetadataType const type. -func PossibleSsisObjectMetadataTypeValues() []SsisObjectMetadataType { - return []SsisObjectMetadataType{Environment, Folder, Package, Project} -} - -// TransparentDataEncryptionStatus enumerates the values for transparent data encryption status. -type TransparentDataEncryptionStatus string - -const ( - // TransparentDataEncryptionStatusDisabled ... - TransparentDataEncryptionStatusDisabled TransparentDataEncryptionStatus = "Disabled" - // TransparentDataEncryptionStatusEnabled ... - TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = "Enabled" -) - -// PossibleTransparentDataEncryptionStatusValues returns an array of possible values for the TransparentDataEncryptionStatus const type. -func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryptionStatus { - return []TransparentDataEncryptionStatus{TransparentDataEncryptionStatusDisabled, TransparentDataEncryptionStatusEnabled} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeIntegrationRuntime ... - TypeIntegrationRuntime Type = "IntegrationRuntime" - // TypeManaged ... - TypeManaged Type = "Managed" - // TypeSelfHosted ... - TypeSelfHosted Type = "SelfHosted" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeIntegrationRuntime, TypeManaged, TypeSelfHosted} -} - -// TypeBasicCustomSetupBase enumerates the values for type basic custom setup base. -type TypeBasicCustomSetupBase string - -const ( - // TypeCmdkeySetup ... - TypeCmdkeySetup TypeBasicCustomSetupBase = "CmdkeySetup" - // TypeComponentSetup ... - TypeComponentSetup TypeBasicCustomSetupBase = "ComponentSetup" - // TypeCustomSetupBase ... - TypeCustomSetupBase TypeBasicCustomSetupBase = "CustomSetupBase" - // TypeEnvironmentVariableSetup ... - TypeEnvironmentVariableSetup TypeBasicCustomSetupBase = "EnvironmentVariableSetup" -) - -// PossibleTypeBasicCustomSetupBaseValues returns an array of possible values for the TypeBasicCustomSetupBase const type. -func PossibleTypeBasicCustomSetupBaseValues() []TypeBasicCustomSetupBase { - return []TypeBasicCustomSetupBase{TypeCmdkeySetup, TypeComponentSetup, TypeCustomSetupBase, TypeEnvironmentVariableSetup} -} - -// TypeBasicIntegrationRuntimeStatus enumerates the values for type basic integration runtime status. -type TypeBasicIntegrationRuntimeStatus string - -const ( - // TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus ... - TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus TypeBasicIntegrationRuntimeStatus = "IntegrationRuntimeStatus" - // TypeBasicIntegrationRuntimeStatusTypeManaged ... - TypeBasicIntegrationRuntimeStatusTypeManaged TypeBasicIntegrationRuntimeStatus = "Managed" - // TypeBasicIntegrationRuntimeStatusTypeSelfHosted ... - TypeBasicIntegrationRuntimeStatusTypeSelfHosted TypeBasicIntegrationRuntimeStatus = "SelfHosted" -) - -// PossibleTypeBasicIntegrationRuntimeStatusValues returns an array of possible values for the TypeBasicIntegrationRuntimeStatus const type. -func PossibleTypeBasicIntegrationRuntimeStatusValues() []TypeBasicIntegrationRuntimeStatus { - return []TypeBasicIntegrationRuntimeStatus{TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus, TypeBasicIntegrationRuntimeStatusTypeManaged, TypeBasicIntegrationRuntimeStatusTypeSelfHosted} -} - -// TypeBasicSecretBase enumerates the values for type basic secret base. -type TypeBasicSecretBase string - -const ( - // TypeSecretBase ... - TypeSecretBase TypeBasicSecretBase = "SecretBase" - // TypeSecureString ... - TypeSecureString TypeBasicSecretBase = "SecureString" -) - -// PossibleTypeBasicSecretBaseValues returns an array of possible values for the TypeBasicSecretBase const type. -func PossibleTypeBasicSecretBaseValues() []TypeBasicSecretBase { - return []TypeBasicSecretBase{TypeSecretBase, TypeSecureString} -} - -// TypeBasicSsisObjectMetadata enumerates the values for type basic ssis object metadata. -type TypeBasicSsisObjectMetadata string - -const ( - // TypeEnvironment ... - TypeEnvironment TypeBasicSsisObjectMetadata = "Environment" - // TypeFolder ... - TypeFolder TypeBasicSsisObjectMetadata = "Folder" - // TypePackage ... - TypePackage TypeBasicSsisObjectMetadata = "Package" - // TypeProject ... - TypeProject TypeBasicSsisObjectMetadata = "Project" - // TypeSsisObjectMetadata ... - TypeSsisObjectMetadata TypeBasicSsisObjectMetadata = "SsisObjectMetadata" -) - -// PossibleTypeBasicSsisObjectMetadataValues returns an array of possible values for the TypeBasicSsisObjectMetadata const type. -func PossibleTypeBasicSsisObjectMetadataValues() []TypeBasicSsisObjectMetadata { - return []TypeBasicSsisObjectMetadata{TypeEnvironment, TypeFolder, TypePackage, TypeProject, TypeSsisObjectMetadata} -} - -// VulnerabilityAssessmentPolicyBaselineName enumerates the values for vulnerability assessment policy baseline -// name. -type VulnerabilityAssessmentPolicyBaselineName string - -const ( - // Default ... - Default VulnerabilityAssessmentPolicyBaselineName = "default" - // Master ... - Master VulnerabilityAssessmentPolicyBaselineName = "master" -) - -// PossibleVulnerabilityAssessmentPolicyBaselineNameValues returns an array of possible values for the VulnerabilityAssessmentPolicyBaselineName const type. -func PossibleVulnerabilityAssessmentPolicyBaselineNameValues() []VulnerabilityAssessmentPolicyBaselineName { - return []VulnerabilityAssessmentPolicyBaselineName{Default, Master} -} - -// VulnerabilityAssessmentScanState enumerates the values for vulnerability assessment scan state. -type VulnerabilityAssessmentScanState string - -const ( - // VulnerabilityAssessmentScanStateFailed ... - VulnerabilityAssessmentScanStateFailed VulnerabilityAssessmentScanState = "Failed" - // VulnerabilityAssessmentScanStateFailedToRun ... - VulnerabilityAssessmentScanStateFailedToRun VulnerabilityAssessmentScanState = "FailedToRun" - // VulnerabilityAssessmentScanStateInProgress ... - VulnerabilityAssessmentScanStateInProgress VulnerabilityAssessmentScanState = "InProgress" - // VulnerabilityAssessmentScanStatePassed ... - VulnerabilityAssessmentScanStatePassed VulnerabilityAssessmentScanState = "Passed" -) - -// PossibleVulnerabilityAssessmentScanStateValues returns an array of possible values for the VulnerabilityAssessmentScanState const type. -func PossibleVulnerabilityAssessmentScanStateValues() []VulnerabilityAssessmentScanState { - return []VulnerabilityAssessmentScanState{VulnerabilityAssessmentScanStateFailed, VulnerabilityAssessmentScanStateFailedToRun, VulnerabilityAssessmentScanStateInProgress, VulnerabilityAssessmentScanStatePassed} -} - -// VulnerabilityAssessmentScanTriggerType enumerates the values for vulnerability assessment scan trigger type. -type VulnerabilityAssessmentScanTriggerType string - -const ( - // OnDemand ... - OnDemand VulnerabilityAssessmentScanTriggerType = "OnDemand" - // Recurring ... - Recurring VulnerabilityAssessmentScanTriggerType = "Recurring" -) - -// PossibleVulnerabilityAssessmentScanTriggerTypeValues returns an array of possible values for the VulnerabilityAssessmentScanTriggerType const type. -func PossibleVulnerabilityAssessmentScanTriggerTypeValues() []VulnerabilityAssessmentScanTriggerType { - return []VulnerabilityAssessmentScanTriggerType{OnDemand, Recurring} -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/extendedsqlpoolblobauditingpolicies.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/extendedsqlpoolblobauditingpolicies.go deleted file mode 100644 index 0af52963eafc..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/extendedsqlpoolblobauditingpolicies.go +++ /dev/null @@ -1,345 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ExtendedSQLPoolBlobAuditingPoliciesClient is the azure Synapse Analytics Management Client -type ExtendedSQLPoolBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewExtendedSQLPoolBlobAuditingPoliciesClient creates an instance of the ExtendedSQLPoolBlobAuditingPoliciesClient -// client. -func NewExtendedSQLPoolBlobAuditingPoliciesClient(subscriptionID string) ExtendedSQLPoolBlobAuditingPoliciesClient { - return NewExtendedSQLPoolBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExtendedSQLPoolBlobAuditingPoliciesClientWithBaseURI creates an instance of the -// ExtendedSQLPoolBlobAuditingPoliciesClient 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 NewExtendedSQLPoolBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ExtendedSQLPoolBlobAuditingPoliciesClient { - return ExtendedSQLPoolBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an extended Sql pool's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the extended Sql pool blob auditing policy. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters ExtendedSQLPoolBlobAuditingPolicy) (result ExtendedSQLPoolBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters ExtendedSQLPoolBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 ExtendedSQLPoolBlobAuditingPoliciesClient) 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 ExtendedSQLPoolBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ExtendedSQLPoolBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets an extended Sql pool's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ExtendedSQLPoolBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 ExtendedSQLPoolBlobAuditingPoliciesClient) 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 ExtendedSQLPoolBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result ExtendedSQLPoolBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySQLPool lists extended auditing settings of a Sql pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ExtendedSQLPoolBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPoliciesClient.ListBySQLPool") - defer func() { - sc := -1 - if result.espbaplr.Response.Response != nil { - sc = result.espbaplr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", err.Error()) - } - - result.fn = client.listBySQLPoolNextResults - req, err := client.ListBySQLPoolPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.espbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", resp, "Failure sending request") - return - } - - result.espbaplr, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", resp, "Failure responding to request") - return - } - if result.espbaplr.hasNextLink() && result.espbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySQLPoolPreparer prepares the ListBySQLPool request. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPoolPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySQLPoolSender sends the ListBySQLPool request. The method will close the -// http.Response Body if it receives an error. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySQLPoolResponder handles the response to the ListBySQLPool request. The method always -// closes the http.Response Body. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPoolResponder(resp *http.Response) (result ExtendedSQLPoolBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySQLPoolNextResults retrieves the next set of results, if any. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) listBySQLPoolNextResults(ctx context.Context, lastResults ExtendedSQLPoolBlobAuditingPolicyListResult) (result ExtendedSQLPoolBlobAuditingPolicyListResult, err error) { - req, err := lastResults.extendedSQLPoolBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySQLPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPoolComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ExtendedSQLPoolBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPoliciesClient.ListBySQLPool") - 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.ListBySQLPool(ctx, resourceGroupName, workspaceName, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeauthkeys.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeauthkeys.go deleted file mode 100644 index 2b9d68964128..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeauthkeys.go +++ /dev/null @@ -1,212 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeAuthKeysClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeAuthKeysClient struct { - BaseClient -} - -// NewIntegrationRuntimeAuthKeysClient creates an instance of the IntegrationRuntimeAuthKeysClient client. -func NewIntegrationRuntimeAuthKeysClient(subscriptionID string) IntegrationRuntimeAuthKeysClient { - return NewIntegrationRuntimeAuthKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeAuthKeysClientWithBaseURI creates an instance of the IntegrationRuntimeAuthKeysClient 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 NewIntegrationRuntimeAuthKeysClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeAuthKeysClient { - return IntegrationRuntimeAuthKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list authentication keys in an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeAuthKeysClient) List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeAuthKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeAuthKeysClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeAuthKeysClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationRuntimeAuthKeysClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys", 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 IntegrationRuntimeAuthKeysClient) 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 IntegrationRuntimeAuthKeysClient) ListResponder(resp *http.Response) (result IntegrationRuntimeAuthKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Regenerate regenerate the authentication key for an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// regenerateKeyParameters - the parameters for regenerating integration runtime authentication key. -func (client IntegrationRuntimeAuthKeysClient) Regenerate(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, regenerateKeyParameters IntegrationRuntimeRegenerateKeyParameters) (result IntegrationRuntimeAuthKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeAuthKeysClient.Regenerate") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeAuthKeysClient", "Regenerate", err.Error()) - } - - req, err := client.RegeneratePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, regenerateKeyParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "Regenerate", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "Regenerate", resp, "Failure sending request") - return - } - - result, err = client.RegenerateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "Regenerate", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePreparer prepares the Regenerate request. -func (client IntegrationRuntimeAuthKeysClient) RegeneratePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, regenerateKeyParameters IntegrationRuntimeRegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey", pathParameters), - autorest.WithJSON(regenerateKeyParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSender sends the Regenerate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimeAuthKeysClient) RegenerateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateResponder handles the response to the Regenerate request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimeAuthKeysClient) RegenerateResponder(resp *http.Response) (result IntegrationRuntimeAuthKeys, 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/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeconnectioninfos.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeconnectioninfos.go deleted file mode 100644 index a4bed66bc1e9..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeconnectioninfos.go +++ /dev/null @@ -1,122 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeConnectionInfosClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeConnectionInfosClient struct { - BaseClient -} - -// NewIntegrationRuntimeConnectionInfosClient creates an instance of the IntegrationRuntimeConnectionInfosClient -// client. -func NewIntegrationRuntimeConnectionInfosClient(subscriptionID string) IntegrationRuntimeConnectionInfosClient { - return NewIntegrationRuntimeConnectionInfosClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeConnectionInfosClientWithBaseURI creates an instance of the -// IntegrationRuntimeConnectionInfosClient 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 NewIntegrationRuntimeConnectionInfosClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeConnectionInfosClient { - return IntegrationRuntimeConnectionInfosClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get connection info for an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeConnectionInfosClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeConnectionInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeConnectionInfosClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeConnectionInfosClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeConnectionInfosClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeConnectionInfosClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeConnectionInfosClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimeConnectionInfosClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo", 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 IntegrationRuntimeConnectionInfosClient) 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 IntegrationRuntimeConnectionInfosClient) GetResponder(resp *http.Response) (result IntegrationRuntimeConnectionInfo, 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/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimecredentials.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimecredentials.go deleted file mode 100644 index d8aa07188763..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimecredentials.go +++ /dev/null @@ -1,123 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeCredentialsClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeCredentialsClient struct { - BaseClient -} - -// NewIntegrationRuntimeCredentialsClient creates an instance of the IntegrationRuntimeCredentialsClient client. -func NewIntegrationRuntimeCredentialsClient(subscriptionID string) IntegrationRuntimeCredentialsClient { - return NewIntegrationRuntimeCredentialsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeCredentialsClientWithBaseURI creates an instance of the IntegrationRuntimeCredentialsClient -// 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 NewIntegrationRuntimeCredentialsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeCredentialsClient { - return IntegrationRuntimeCredentialsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Sync force the integration runtime to synchronize credentials across integration runtime nodes, and this will -// override the credentials across all worker nodes with those available on the dispatcher node. If you already have -// the latest credential backup file, you should manually import it (preferred) on any self-hosted integration runtime -// node than using this API directly. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeCredentialsClient) Sync(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeCredentialsClient.Sync") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeCredentialsClient", "Sync", err.Error()) - } - - req, err := client.SyncPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeCredentialsClient", "Sync", nil, "Failure preparing request") - return - } - - resp, err := client.SyncSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeCredentialsClient", "Sync", resp, "Failure sending request") - return - } - - result, err = client.SyncResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeCredentialsClient", "Sync", resp, "Failure responding to request") - return - } - - return -} - -// SyncPreparer prepares the Sync request. -func (client IntegrationRuntimeCredentialsClient) SyncPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SyncSender sends the Sync request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimeCredentialsClient) SyncSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SyncResponder handles the response to the Sync request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimeCredentialsClient) SyncResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimemonitoringdata.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimemonitoringdata.go deleted file mode 100644 index ea3533eeb1c1..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimemonitoringdata.go +++ /dev/null @@ -1,121 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeMonitoringDataClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeMonitoringDataClient struct { - BaseClient -} - -// NewIntegrationRuntimeMonitoringDataClient creates an instance of the IntegrationRuntimeMonitoringDataClient client. -func NewIntegrationRuntimeMonitoringDataClient(subscriptionID string) IntegrationRuntimeMonitoringDataClient { - return NewIntegrationRuntimeMonitoringDataClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeMonitoringDataClientWithBaseURI creates an instance of the -// IntegrationRuntimeMonitoringDataClient 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 NewIntegrationRuntimeMonitoringDataClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeMonitoringDataClient { - return IntegrationRuntimeMonitoringDataClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get monitoring data for an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeMonitoringDataClient) List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeMonitoringData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeMonitoringDataClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeMonitoringDataClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeMonitoringDataClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeMonitoringDataClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeMonitoringDataClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationRuntimeMonitoringDataClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/monitoringData", 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 IntegrationRuntimeMonitoringDataClient) 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 IntegrationRuntimeMonitoringDataClient) ListResponder(resp *http.Response) (result IntegrationRuntimeMonitoringData, 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/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimenodeipaddress.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimenodeipaddress.go deleted file mode 100644 index ec2b097baad0..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimenodeipaddress.go +++ /dev/null @@ -1,123 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeNodeIPAddressClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeNodeIPAddressClient struct { - BaseClient -} - -// NewIntegrationRuntimeNodeIPAddressClient creates an instance of the IntegrationRuntimeNodeIPAddressClient client. -func NewIntegrationRuntimeNodeIPAddressClient(subscriptionID string) IntegrationRuntimeNodeIPAddressClient { - return NewIntegrationRuntimeNodeIPAddressClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeNodeIPAddressClientWithBaseURI creates an instance of the IntegrationRuntimeNodeIPAddressClient -// 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 NewIntegrationRuntimeNodeIPAddressClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeNodeIPAddressClient { - return IntegrationRuntimeNodeIPAddressClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the IP address of an integration runtime node -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// nodeName - integration runtime node name -func (client IntegrationRuntimeNodeIPAddressClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result IntegrationRuntimeNodeIPAddress, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeNodeIPAddressClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeNodeIPAddressClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, nodeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodeIPAddressClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodeIPAddressClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodeIPAddressClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimeNodeIPAddressClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress", 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 IntegrationRuntimeNodeIPAddressClient) 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 IntegrationRuntimeNodeIPAddressClient) GetResponder(resp *http.Response) (result IntegrationRuntimeNodeIPAddress, 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/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimenodes.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimenodes.go deleted file mode 100644 index e86085f4edf7..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimenodes.go +++ /dev/null @@ -1,305 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeNodesClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeNodesClient struct { - BaseClient -} - -// NewIntegrationRuntimeNodesClient creates an instance of the IntegrationRuntimeNodesClient client. -func NewIntegrationRuntimeNodesClient(subscriptionID string) IntegrationRuntimeNodesClient { - return NewIntegrationRuntimeNodesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeNodesClientWithBaseURI creates an instance of the IntegrationRuntimeNodesClient 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 NewIntegrationRuntimeNodesClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeNodesClient { - return IntegrationRuntimeNodesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete an integration runtime node -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// nodeName - integration runtime node name -func (client IntegrationRuntimeNodesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeNodesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeNodesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, nodeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationRuntimeNodesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}", 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 IntegrationRuntimeNodesClient) 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 IntegrationRuntimeNodesClient) 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 an integration runtime node -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// nodeName - integration runtime node name -func (client IntegrationRuntimeNodesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result SelfHostedIntegrationRuntimeNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeNodesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeNodesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, nodeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimeNodesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}", 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 IntegrationRuntimeNodesClient) 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 IntegrationRuntimeNodesClient) GetResponder(resp *http.Response) (result SelfHostedIntegrationRuntimeNode, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update create an integration runtime node -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// nodeName - integration runtime node name -// updateIntegrationRuntimeNodeRequest - the parameters for updating an integration runtime node. -func (client IntegrationRuntimeNodesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string, updateIntegrationRuntimeNodeRequest UpdateIntegrationRuntimeNodeRequest) (result SelfHostedIntegrationRuntimeNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeNodesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeNodesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, nodeName, updateIntegrationRuntimeNodeRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IntegrationRuntimeNodesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string, updateIntegrationRuntimeNodeRequest UpdateIntegrationRuntimeNodeRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}", pathParameters), - autorest.WithJSON(updateIntegrationRuntimeNodeRequest), - 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 IntegrationRuntimeNodesClient) 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 IntegrationRuntimeNodesClient) UpdateResponder(resp *http.Response) (result SelfHostedIntegrationRuntimeNode, 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/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeobjectmetadata.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeobjectmetadata.go deleted file mode 100644 index d0b9f2714507..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimeobjectmetadata.go +++ /dev/null @@ -1,218 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeObjectMetadataClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeObjectMetadataClient struct { - BaseClient -} - -// NewIntegrationRuntimeObjectMetadataClient creates an instance of the IntegrationRuntimeObjectMetadataClient client. -func NewIntegrationRuntimeObjectMetadataClient(subscriptionID string) IntegrationRuntimeObjectMetadataClient { - return NewIntegrationRuntimeObjectMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeObjectMetadataClientWithBaseURI creates an instance of the -// IntegrationRuntimeObjectMetadataClient 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 NewIntegrationRuntimeObjectMetadataClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeObjectMetadataClient { - return IntegrationRuntimeObjectMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get object metadata from an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// getMetadataRequest - the parameters for getting a SSIS object metadata. -func (client IntegrationRuntimeObjectMetadataClient) List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, getMetadataRequest *GetSsisObjectMetadataRequest) (result SsisObjectMetadataListResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeObjectMetadataClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeObjectMetadataClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, getMetadataRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationRuntimeObjectMetadataClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, getMetadataRequest *GetSsisObjectMetadataRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getObjectMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if getMetadataRequest != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(getMetadataRequest)) - } - 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 IntegrationRuntimeObjectMetadataClient) 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 IntegrationRuntimeObjectMetadataClient) ListResponder(resp *http.Response) (result SsisObjectMetadataListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Refresh refresh the object metadata in an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeObjectMetadataClient) Refresh(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeObjectMetadataRefreshFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeObjectMetadataClient.Refresh") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeObjectMetadataClient", "Refresh", err.Error()) - } - - req, err := client.RefreshPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "Refresh", nil, "Failure preparing request") - return - } - - result, err = client.RefreshSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "Refresh", result.Response(), "Failure sending request") - return - } - - return -} - -// RefreshPreparer prepares the Refresh request. -func (client IntegrationRuntimeObjectMetadataClient) RefreshPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshSender sends the Refresh request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimeObjectMetadataClient) RefreshSender(req *http.Request) (future IntegrationRuntimeObjectMetadataRefreshFuture, 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 -} - -// RefreshResponder handles the response to the Refresh request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimeObjectMetadataClient) RefreshResponder(resp *http.Response) (result SsisObjectMetadataStatusResponse, 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/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimes.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimes.go deleted file mode 100644 index eb6f195234b4..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimes.go +++ /dev/null @@ -1,984 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimesClient is the azure Synapse Analytics Management Client -type IntegrationRuntimesClient struct { - BaseClient -} - -// NewIntegrationRuntimesClient creates an instance of the IntegrationRuntimesClient client. -func NewIntegrationRuntimesClient(subscriptionID string) IntegrationRuntimesClient { - return NewIntegrationRuntimesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimesClientWithBaseURI creates an instance of the IntegrationRuntimesClient 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 NewIntegrationRuntimesClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimesClient { - return IntegrationRuntimesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// integrationRuntime - integration runtime resource definition. -// ifMatch - eTag of the integration runtime entity. Should only be specified for update, for which it should -// match existing entity or can be * for unconditional update. -func (client IntegrationRuntimesClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, integrationRuntime IntegrationRuntimeResource, ifMatch string) (result IntegrationRuntimesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, integrationRuntime, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client IntegrationRuntimesClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, integrationRuntime IntegrationRuntimeResource, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}", pathParameters), - autorest.WithJSON(integrationRuntime), - 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)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) CreateSender(req *http.Request) (future IntegrationRuntimesCreateFuture, 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 IntegrationRuntimesClient) CreateResponder(resp *http.Response) (result IntegrationRuntimeResource, 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 delete an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationRuntimesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}", 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 IntegrationRuntimesClient) DeleteSender(req *http.Request) (future IntegrationRuntimesDeleteFuture, 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 IntegrationRuntimesClient) 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 -} - -// DisableInteractiveQuery disable interactive query in integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) DisableInteractiveQuery(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesDisableInteractiveQueryFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.DisableInteractiveQuery") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "DisableInteractiveQuery", err.Error()) - } - - req, err := client.DisableInteractiveQueryPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "DisableInteractiveQuery", nil, "Failure preparing request") - return - } - - result, err = client.DisableInteractiveQuerySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "DisableInteractiveQuery", result.Response(), "Failure sending request") - return - } - - return -} - -// DisableInteractiveQueryPreparer prepares the DisableInteractiveQuery request. -func (client IntegrationRuntimesClient) DisableInteractiveQueryPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/disableInteractiveQuery", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableInteractiveQuerySender sends the DisableInteractiveQuery request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) DisableInteractiveQuerySender(req *http.Request) (future IntegrationRuntimesDisableInteractiveQueryFuture, 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 -} - -// DisableInteractiveQueryResponder handles the response to the DisableInteractiveQuery request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimesClient) DisableInteractiveQueryResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// EnableInteractiveQuery enable interactive query in integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) EnableInteractiveQuery(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesEnableInteractiveQueryFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.EnableInteractiveQuery") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "EnableInteractiveQuery", err.Error()) - } - - req, err := client.EnableInteractiveQueryPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "EnableInteractiveQuery", nil, "Failure preparing request") - return - } - - result, err = client.EnableInteractiveQuerySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "EnableInteractiveQuery", result.Response(), "Failure sending request") - return - } - - return -} - -// EnableInteractiveQueryPreparer prepares the EnableInteractiveQuery request. -func (client IntegrationRuntimesClient) EnableInteractiveQueryPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableInteractiveQuery", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableInteractiveQuerySender sends the EnableInteractiveQuery request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) EnableInteractiveQuerySender(req *http.Request) (future IntegrationRuntimesEnableInteractiveQueryFuture, 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 -} - -// EnableInteractiveQueryResponder handles the response to the EnableInteractiveQuery request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimesClient) EnableInteractiveQueryResponder(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 get an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// ifNoneMatch - eTag of the integration runtime entity. Should only be specified for get. If the ETag matches -// the existing entity tag, or if * was provided, then no content will be returned. -func (client IntegrationRuntimesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, ifNoneMatch string) (result IntegrationRuntimeResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - 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 IntegrationRuntimesClient) 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 IntegrationRuntimesClient) GetResponder(resp *http.Response) (result IntegrationRuntimeResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotModified), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list all integration runtimes -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -func (client IntegrationRuntimesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result IntegrationRuntimeListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.irlr.Response.Response != nil { - sc = result.irlr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.irlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.irlr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.irlr.hasNextLink() && result.irlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client IntegrationRuntimesClient) ListByWorkspacePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimesClient) ListByWorkspaceResponder(resp *http.Response) (result IntegrationRuntimeListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client IntegrationRuntimesClient) listByWorkspaceNextResults(ctx context.Context, lastResults IntegrationRuntimeListResponse) (result IntegrationRuntimeListResponse, err error) { - req, err := lastResults.integrationRuntimeListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationRuntimesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result IntegrationRuntimeListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// Start start an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) Start(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client IntegrationRuntimesClient) StartPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/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 IntegrationRuntimesClient) StartSender(req *http.Request) (future IntegrationRuntimesStartFuture, 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 IntegrationRuntimesClient) StartResponder(resp *http.Response) (result IntegrationRuntimeStatusResponse, 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 stop an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) Stop(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesStopFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = client.StopSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Stop", result.Response(), "Failure sending request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client IntegrationRuntimesClient) StopPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/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 IntegrationRuntimesClient) StopSender(req *http.Request) (future IntegrationRuntimesStopFuture, 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 IntegrationRuntimesClient) StopResponder(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 update an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// updateIntegrationRuntimeRequest - the parameters for updating an integration runtime. -func (client IntegrationRuntimesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, updateIntegrationRuntimeRequest UpdateIntegrationRuntimeRequest) (result IntegrationRuntimeResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, updateIntegrationRuntimeRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IntegrationRuntimesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, updateIntegrationRuntimeRequest UpdateIntegrationRuntimeRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}", pathParameters), - autorest.WithJSON(updateIntegrationRuntimeRequest), - 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 IntegrationRuntimesClient) 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 IntegrationRuntimesClient) UpdateResponder(resp *http.Response) (result IntegrationRuntimeResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Upgrade upgrade an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) Upgrade(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.Upgrade") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimesClient", "Upgrade", err.Error()) - } - - req, err := client.UpgradePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Upgrade", nil, "Failure preparing request") - return - } - - resp, err := client.UpgradeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Upgrade", resp, "Failure sending request") - return - } - - result, err = client.UpgradeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Upgrade", resp, "Failure responding to request") - return - } - - return -} - -// UpgradePreparer prepares the Upgrade request. -func (client IntegrationRuntimesClient) UpgradePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/upgrade", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpgradeSender sends the Upgrade request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) UpgradeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpgradeResponder handles the response to the Upgrade request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimesClient) UpgradeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimestatus.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimestatus.go deleted file mode 100644 index 4a8aa1bb9e28..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/integrationruntimestatus.go +++ /dev/null @@ -1,121 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeStatusClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeStatusClient struct { - BaseClient -} - -// NewIntegrationRuntimeStatusClient creates an instance of the IntegrationRuntimeStatusClient client. -func NewIntegrationRuntimeStatusClient(subscriptionID string) IntegrationRuntimeStatusClient { - return NewIntegrationRuntimeStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeStatusClientWithBaseURI creates an instance of the IntegrationRuntimeStatusClient 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 NewIntegrationRuntimeStatusClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeStatusClient { - return IntegrationRuntimeStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the integration runtime status -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeStatusClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeStatusResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeStatusClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IntegrationRuntimeStatusClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeStatusClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimeStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getStatus", 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 IntegrationRuntimeStatusClient) 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 IntegrationRuntimeStatusClient) GetResponder(resp *http.Response) (result IntegrationRuntimeStatusResponse, 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/synapse/mgmt/2019-06-01-preview/synapse/ipfirewallrules.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/ipfirewallrules.go deleted file mode 100644 index 947c9b217543..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/ipfirewallrules.go +++ /dev/null @@ -1,525 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IPFirewallRulesClient is the azure Synapse Analytics Management Client -type IPFirewallRulesClient struct { - BaseClient -} - -// NewIPFirewallRulesClient creates an instance of the IPFirewallRulesClient client. -func NewIPFirewallRulesClient(subscriptionID string) IPFirewallRulesClient { - return NewIPFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIPFirewallRulesClientWithBaseURI creates an instance of the IPFirewallRulesClient 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 NewIPFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) IPFirewallRulesClient { - return IPFirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a firewall rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// ruleName - the IP firewall rule name -// IPFirewallRuleInfo - IP firewall rule properties -func (client IPFirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string, IPFirewallRuleInfo IPFirewallRuleInfo) (result IPFirewallRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IPFirewallRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, ruleName, IPFirewallRuleInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IPFirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string, IPFirewallRuleInfo IPFirewallRuleInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}", pathParameters), - autorest.WithJSON(IPFirewallRuleInfo), - 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 IPFirewallRulesClient) CreateOrUpdateSender(req *http.Request) (future IPFirewallRulesCreateOrUpdateFuture, 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 IPFirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result IPFirewallRuleInfo, 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 a firewall rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// ruleName - the IP firewall rule name -func (client IPFirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (result IPFirewallRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IPFirewallRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IPFirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/firewallRules/{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 IPFirewallRulesClient) DeleteSender(req *http.Request) (future IPFirewallRulesDeleteFuture, 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 IPFirewallRulesClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a firewall rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// ruleName - the IP firewall rule name -func (client IPFirewallRulesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (result IPFirewallRuleInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IPFirewallRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IPFirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/firewallRules/{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 IPFirewallRulesClient) 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 IPFirewallRulesClient) GetResponder(resp *http.Response) (result IPFirewallRuleInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace returns a list of firewall rules -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client IPFirewallRulesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result IPFirewallRuleInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.ifrilr.Response.Response != nil { - sc = result.ifrilr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IPFirewallRulesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.ifrilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.ifrilr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.ifrilr.hasNextLink() && result.ifrilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client IPFirewallRulesClient) ListByWorkspacePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client IPFirewallRulesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client IPFirewallRulesClient) ListByWorkspaceResponder(resp *http.Response) (result IPFirewallRuleInfoListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client IPFirewallRulesClient) listByWorkspaceNextResults(ctx context.Context, lastResults IPFirewallRuleInfoListResult) (result IPFirewallRuleInfoListResult, err error) { - req, err := lastResults.iPFirewallRuleInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IPFirewallRulesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result IPFirewallRuleInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// ReplaceAll replaces firewall rules -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// request - replace all IP firewall rules request -func (client IPFirewallRulesClient) ReplaceAll(ctx context.Context, resourceGroupName string, workspaceName string, request ReplaceAllIPFirewallRulesRequest) (result IPFirewallRulesReplaceAllFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.ReplaceAll") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.IPFirewallRulesClient", "ReplaceAll", err.Error()) - } - - req, err := client.ReplaceAllPreparer(ctx, resourceGroupName, workspaceName, request) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ReplaceAll", nil, "Failure preparing request") - return - } - - result, err = client.ReplaceAllSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ReplaceAll", result.Response(), "Failure sending request") - return - } - - return -} - -// ReplaceAllPreparer prepares the ReplaceAll request. -func (client IPFirewallRulesClient) ReplaceAllPreparer(ctx context.Context, resourceGroupName string, workspaceName string, request ReplaceAllIPFirewallRulesRequest) (*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 = "2019-06-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.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReplaceAllSender sends the ReplaceAll request. The method will close the -// http.Response Body if it receives an error. -func (client IPFirewallRulesClient) ReplaceAllSender(req *http.Request) (future IPFirewallRulesReplaceAllFuture, 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 -} - -// ReplaceAllResponder handles the response to the ReplaceAll request. The method always -// closes the http.Response Body. -func (client IPFirewallRulesClient) ReplaceAllResponder(resp *http.Response) (result ReplaceAllFirewallRulesOperationResponse, 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/preview/synapse/mgmt/2019-06-01-preview/synapse/keys.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/keys.go deleted file mode 100644 index 437d3f0665b7..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/keys.go +++ /dev/null @@ -1,427 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// KeysClient is the azure Synapse Analytics Management Client -type KeysClient struct { - BaseClient -} - -// NewKeysClient creates an instance of the KeysClient client. -func NewKeysClient(subscriptionID string) KeysClient { - return NewKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewKeysClientWithBaseURI creates an instance of the KeysClient 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 NewKeysClientWithBaseURI(baseURI string, subscriptionID string) KeysClient { - return KeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workspace key -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// keyName - the name of the workspace key -// keyProperties - key put request properties -func (client KeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, keyName string, keyProperties Key) (result Key, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.KeysClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, keyName, keyProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client KeysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, keyName string, keyProperties Key) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/keys/{keyName}", pathParameters), - autorest.WithJSON(keyProperties), - 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 KeysClient) 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 KeysClient) CreateOrUpdateResponder(resp *http.Response) (result Key, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a workspace key -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// keyName - the name of the workspace key -func (client KeysClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (result Key, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.KeysClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client KeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/keys/{keyName}", 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 KeysClient) 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 KeysClient) DeleteResponder(resp *http.Response) (result Key, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a workspace key -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// keyName - the name of the workspace key -func (client KeysClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (result Key, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.KeysClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client KeysClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/keys/{keyName}", 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 KeysClient) 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 KeysClient) GetResponder(resp *http.Response) (result Key, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace returns a list of keys in a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client KeysClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result KeyInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.ListByWorkspace") - defer func() { - sc := -1 - if result.kilr.Response.Response != nil { - sc = result.kilr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.KeysClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.kilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.kilr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.kilr.hasNextLink() && result.kilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client KeysClient) ListByWorkspacePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/keys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client KeysClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client KeysClient) ListByWorkspaceResponder(resp *http.Response) (result KeyInfoListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client KeysClient) listByWorkspaceNextResults(ctx context.Context, lastResults KeyInfoListResult) (result KeyInfoListResult, err error) { - req, err := lastResults.keyInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.KeysClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.KeysClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client KeysClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result KeyInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/models.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/models.go deleted file mode 100644 index 595b1d3d4c96..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/models.go +++ /dev/null @@ -1,15219 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/2019-06-01-preview/synapse" - -// AadAdminProperties workspace active directory administrator properties -type AadAdminProperties struct { - // TenantID - Tenant ID of the workspace active directory administrator - TenantID *string `json:"tenantId,omitempty"` - // Login - Login of the workspace active directory administrator - Login *string `json:"login,omitempty"` - // AdministratorType - Workspace active directory administrator type - AdministratorType *string `json:"administratorType,omitempty"` - // Sid - Object ID of the workspace active directory administrator - Sid *string `json:"sid,omitempty"` -} - -// AutoPauseProperties auto-pausing properties of a Big Data pool powered by Apache Spark -type AutoPauseProperties struct { - // DelayInMinutes - Number of minutes of idle time before the Big Data pool is automatically paused. - DelayInMinutes *int32 `json:"delayInMinutes,omitempty"` - // Enabled - Whether auto-pausing is enabled for the Big Data pool. - Enabled *bool `json:"enabled,omitempty"` -} - -// AutoScaleProperties auto-scaling properties of a Big Data pool powered by Apache Spark -type AutoScaleProperties struct { - // MinNodeCount - The minimum number of nodes the Big Data pool can support. - MinNodeCount *int32 `json:"minNodeCount,omitempty"` - // Enabled - Whether automatic scaling is enabled for the Big Data pool. - Enabled *bool `json:"enabled,omitempty"` - // MaxNodeCount - The maximum number of nodes the Big Data pool can support. - MaxNodeCount *int32 `json:"maxNodeCount,omitempty"` -} - -// AvailableRpOperation an operation that is available in this resource provider -type AvailableRpOperation struct { - // Display - Display properties of the operation - Display *AvailableRpOperationDisplayInfo `json:"display,omitempty"` - // IsDataAction - Whether this operation is a data action - IsDataAction *string `json:"isDataAction,omitempty"` - // Name - Operation name - Name *string `json:"name,omitempty"` - // OperationMetaPropertyInfo - Operation properties - *OperationMetaPropertyInfo `json:"properties,omitempty"` - // Origin - Operation origin - Origin *string `json:"origin,omitempty"` -} - -// MarshalJSON is the custom marshaler for AvailableRpOperation. -func (aro AvailableRpOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aro.Display != nil { - objectMap["display"] = aro.Display - } - if aro.IsDataAction != nil { - objectMap["isDataAction"] = aro.IsDataAction - } - if aro.Name != nil { - objectMap["name"] = aro.Name - } - if aro.OperationMetaPropertyInfo != nil { - objectMap["properties"] = aro.OperationMetaPropertyInfo - } - if aro.Origin != nil { - objectMap["origin"] = aro.Origin - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AvailableRpOperation struct. -func (aro *AvailableRpOperation) 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 AvailableRpOperationDisplayInfo - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - aro.Display = &display - } - case "isDataAction": - if v != nil { - var isDataAction string - err = json.Unmarshal(*v, &isDataAction) - if err != nil { - return err - } - aro.IsDataAction = &isDataAction - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aro.Name = &name - } - case "properties": - if v != nil { - var operationMetaPropertyInfo OperationMetaPropertyInfo - err = json.Unmarshal(*v, &operationMetaPropertyInfo) - if err != nil { - return err - } - aro.OperationMetaPropertyInfo = &operationMetaPropertyInfo - } - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - aro.Origin = &origin - } - } - } - - return nil -} - -// AvailableRpOperationDisplayInfo description of an available operation -type AvailableRpOperationDisplayInfo struct { - // Description - Operation description - Description *string `json:"description,omitempty"` - // Resource - Resource type - Resource *string `json:"resource,omitempty"` - // Provider - Resource provider name - Provider *string `json:"provider,omitempty"` - // Operation - Operation name - Operation *string `json:"operation,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) -} - -// BigDataPoolPatchInfo properties patch for a Big Data pool -type BigDataPoolPatchInfo struct { - // Tags - Updated tags for the Big Data pool - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for BigDataPoolPatchInfo. -func (bdppi BigDataPoolPatchInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bdppi.Tags != nil { - objectMap["tags"] = bdppi.Tags - } - return json.Marshal(objectMap) -} - -// BigDataPoolResourceInfo a Big Data pool -type BigDataPoolResourceInfo struct { - autorest.Response `json:"-"` - // BigDataPoolResourceProperties - Big Data pool properties - *BigDataPoolResourceProperties `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 BigDataPoolResourceInfo. -func (bdpri BigDataPoolResourceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bdpri.BigDataPoolResourceProperties != nil { - objectMap["properties"] = bdpri.BigDataPoolResourceProperties - } - if bdpri.Tags != nil { - objectMap["tags"] = bdpri.Tags - } - if bdpri.Location != nil { - objectMap["location"] = bdpri.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BigDataPoolResourceInfo struct. -func (bdpri *BigDataPoolResourceInfo) 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 bigDataPoolResourceProperties BigDataPoolResourceProperties - err = json.Unmarshal(*v, &bigDataPoolResourceProperties) - if err != nil { - return err - } - bdpri.BigDataPoolResourceProperties = &bigDataPoolResourceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bdpri.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bdpri.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bdpri.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bdpri.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bdpri.Type = &typeVar - } - } - } - - return nil -} - -// BigDataPoolResourceInfoListResult collection of Big Data pool information -type BigDataPoolResourceInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of Big Data pools - Value *[]BigDataPoolResourceInfo `json:"value,omitempty"` -} - -// BigDataPoolResourceInfoListResultIterator provides access to a complete listing of -// BigDataPoolResourceInfo values. -type BigDataPoolResourceInfoListResultIterator struct { - i int - page BigDataPoolResourceInfoListResultPage -} - -// 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 *BigDataPoolResourceInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolResourceInfoListResultIterator.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 *BigDataPoolResourceInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BigDataPoolResourceInfoListResultIterator) 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 BigDataPoolResourceInfoListResultIterator) Response() BigDataPoolResourceInfoListResult { - 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 BigDataPoolResourceInfoListResultIterator) Value() BigDataPoolResourceInfo { - if !iter.page.NotDone() { - return BigDataPoolResourceInfo{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BigDataPoolResourceInfoListResultIterator type. -func NewBigDataPoolResourceInfoListResultIterator(page BigDataPoolResourceInfoListResultPage) BigDataPoolResourceInfoListResultIterator { - return BigDataPoolResourceInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bdprilr BigDataPoolResourceInfoListResult) IsEmpty() bool { - return bdprilr.Value == nil || len(*bdprilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bdprilr BigDataPoolResourceInfoListResult) hasNextLink() bool { - return bdprilr.NextLink != nil && len(*bdprilr.NextLink) != 0 -} - -// bigDataPoolResourceInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bdprilr BigDataPoolResourceInfoListResult) bigDataPoolResourceInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !bdprilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bdprilr.NextLink))) -} - -// BigDataPoolResourceInfoListResultPage contains a page of BigDataPoolResourceInfo values. -type BigDataPoolResourceInfoListResultPage struct { - fn func(context.Context, BigDataPoolResourceInfoListResult) (BigDataPoolResourceInfoListResult, error) - bdprilr BigDataPoolResourceInfoListResult -} - -// 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 *BigDataPoolResourceInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolResourceInfoListResultPage.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.bdprilr) - if err != nil { - return err - } - page.bdprilr = 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 *BigDataPoolResourceInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BigDataPoolResourceInfoListResultPage) NotDone() bool { - return !page.bdprilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BigDataPoolResourceInfoListResultPage) Response() BigDataPoolResourceInfoListResult { - return page.bdprilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BigDataPoolResourceInfoListResultPage) Values() []BigDataPoolResourceInfo { - if page.bdprilr.IsEmpty() { - return nil - } - return *page.bdprilr.Value -} - -// Creates a new instance of the BigDataPoolResourceInfoListResultPage type. -func NewBigDataPoolResourceInfoListResultPage(cur BigDataPoolResourceInfoListResult, getNextPage func(context.Context, BigDataPoolResourceInfoListResult) (BigDataPoolResourceInfoListResult, error)) BigDataPoolResourceInfoListResultPage { - return BigDataPoolResourceInfoListResultPage{ - fn: getNextPage, - bdprilr: cur, - } -} - -// BigDataPoolResourceProperties properties of a Big Data pool powered by Apache Spark -type BigDataPoolResourceProperties struct { - // ProvisioningState - The state of the Big Data pool. - ProvisioningState *string `json:"provisioningState,omitempty"` - // AutoScale - Auto-scaling properties - AutoScale *AutoScaleProperties `json:"autoScale,omitempty"` - // CreationDate - The time when the Big Data pool was created. - CreationDate *date.Time `json:"creationDate,omitempty"` - // AutoPause - Auto-pausing properties - AutoPause *AutoPauseProperties `json:"autoPause,omitempty"` - // IsComputeIsolationEnabled - Whether compute isolation is required or not. - IsComputeIsolationEnabled *bool `json:"isComputeIsolationEnabled,omitempty"` - // HaveLibraryRequirementsChanged - Whether library requirements changed. - HaveLibraryRequirementsChanged *bool `json:"haveLibraryRequirementsChanged,omitempty"` - // SessionLevelPackagesEnabled - Whether session level packages enabled. - SessionLevelPackagesEnabled *bool `json:"sessionLevelPackagesEnabled,omitempty"` - // SparkEventsFolder - The Spark events folder - SparkEventsFolder *string `json:"sparkEventsFolder,omitempty"` - // NodeCount - The number of nodes in the Big Data pool. - NodeCount *int32 `json:"nodeCount,omitempty"` - // LibraryRequirements - Library version requirements - LibraryRequirements *LibraryRequirements `json:"libraryRequirements,omitempty"` - // SparkConfigProperties - Spark configuration file to specify additional properties - SparkConfigProperties *LibraryRequirements `json:"sparkConfigProperties,omitempty"` - // SparkVersion - The Apache Spark version. - SparkVersion *string `json:"sparkVersion,omitempty"` - // DefaultSparkLogFolder - The default folder where Spark logs will be written. - DefaultSparkLogFolder *string `json:"defaultSparkLogFolder,omitempty"` - // NodeSize - The level of compute power that each node in the Big Data pool has. Possible values include: 'NodeSizeNone', 'NodeSizeSmall', 'NodeSizeMedium', 'NodeSizeLarge', 'NodeSizeXLarge', 'NodeSizeXXLarge', 'NodeSizeXXXLarge' - NodeSize NodeSize `json:"nodeSize,omitempty"` - // NodeSizeFamily - The kind of nodes that the Big Data pool provides. Possible values include: 'NodeSizeFamilyNone', 'NodeSizeFamilyMemoryOptimized' - NodeSizeFamily NodeSizeFamily `json:"nodeSizeFamily,omitempty"` -} - -// BigDataPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BigDataPoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BigDataPoolsClient) (BigDataPoolResourceInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BigDataPoolsCreateOrUpdateFuture) 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 BigDataPoolsCreateOrUpdateFuture.Result. -func (future *BigDataPoolsCreateOrUpdateFuture) result(client BigDataPoolsClient) (bdpri BigDataPoolResourceInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bdpri.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.BigDataPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bdpri.Response.Response, err = future.GetResult(sender); err == nil && bdpri.Response.Response.StatusCode != http.StatusNoContent { - bdpri, err = client.CreateOrUpdateResponder(bdpri.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsCreateOrUpdateFuture", "Result", bdpri.Response.Response, "Failure responding to request") - } - } - return -} - -// BigDataPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BigDataPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BigDataPoolsClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BigDataPoolsDeleteFuture) 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 BigDataPoolsDeleteFuture.Result. -func (future *BigDataPoolsDeleteFuture) result(client BigDataPoolsClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.BigDataPoolsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.DeleteResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsDeleteFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// CheckNameAvailabilityRequest a request about whether a workspace name is available -type CheckNameAvailabilityRequest struct { - // Name - Workspace name - Name *string `json:"name,omitempty"` - // Type - Type: workspace - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResponse a response saying whether the workspace name is available -type CheckNameAvailabilityResponse struct { - autorest.Response `json:"-"` - // Message - Validation message - Message *string `json:"message,omitempty"` - // Available - Whether the workspace name is available - Available *bool `json:"available,omitempty"` - // Reason - Reason the workspace name is or is not available - Reason *string `json:"reason,omitempty"` - // Name - Workspace name - Name *string `json:"name,omitempty"` -} - -// CloudError the object that defines the structure of an Azure Synapse error response. -type CloudError struct { - // CloudErrorBody - Error data - *CloudErrorBody `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for CloudError. -func (ce CloudError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ce.CloudErrorBody != nil { - objectMap["error"] = ce.CloudErrorBody - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CloudError struct. -func (ce *CloudError) 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 "error": - if v != nil { - var cloudErrorBody CloudErrorBody - err = json.Unmarshal(*v, &cloudErrorBody) - if err != nil { - return err - } - ce.CloudErrorBody = &cloudErrorBody - } - } - } - - return nil -} - -// CloudErrorBody the object that defines the structure of an Azure Synapse error. -type CloudErrorBody struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // Message - Error message. - Message *string `json:"message,omitempty"` - // Target - Property name/path in request associated with error. - Target *string `json:"target,omitempty"` - // Details - Array with additional error details. - Details *[]CloudError `json:"details,omitempty"` -} - -// CmdkeySetup the custom setup of running cmdkey commands. -type CmdkeySetup struct { - // CmdkeySetupTypeProperties - Cmdkey command custom setup type properties. - *CmdkeySetupTypeProperties `json:"typeProperties,omitempty"` - // Type - Possible values include: 'TypeCustomSetupBase', 'TypeCmdkeySetup', 'TypeEnvironmentVariableSetup', 'TypeComponentSetup' - Type TypeBasicCustomSetupBase `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for CmdkeySetup. -func (cs CmdkeySetup) MarshalJSON() ([]byte, error) { - cs.Type = TypeCmdkeySetup - objectMap := make(map[string]interface{}) - if cs.CmdkeySetupTypeProperties != nil { - objectMap["typeProperties"] = cs.CmdkeySetupTypeProperties - } - if cs.Type != "" { - objectMap["type"] = cs.Type - } - return json.Marshal(objectMap) -} - -// AsCmdkeySetup is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsCmdkeySetup() (*CmdkeySetup, bool) { - return &cs, true -} - -// AsEnvironmentVariableSetup is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) { - return nil, false -} - -// AsComponentSetup is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsComponentSetup() (*ComponentSetup, bool) { - return nil, false -} - -// AsCustomSetupBase is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsCustomSetupBase() (*CustomSetupBase, bool) { - return nil, false -} - -// AsBasicCustomSetupBase is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsBasicCustomSetupBase() (BasicCustomSetupBase, bool) { - return &cs, true -} - -// UnmarshalJSON is the custom unmarshaler for CmdkeySetup struct. -func (cs *CmdkeySetup) 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 "typeProperties": - if v != nil { - var cmdkeySetupTypeProperties CmdkeySetupTypeProperties - err = json.Unmarshal(*v, &cmdkeySetupTypeProperties) - if err != nil { - return err - } - cs.CmdkeySetupTypeProperties = &cmdkeySetupTypeProperties - } - case "type": - if v != nil { - var typeVar TypeBasicCustomSetupBase - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cs.Type = typeVar - } - } - } - - return nil -} - -// CmdkeySetupTypeProperties cmdkey command custom setup type properties. -type CmdkeySetupTypeProperties struct { - // TargetName - The server name of data source access. - TargetName interface{} `json:"targetName,omitempty"` - // UserName - The user name of data source access. - UserName interface{} `json:"userName,omitempty"` - // Password - The password of data source access. - Password BasicSecretBase `json:"password,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for CmdkeySetupTypeProperties struct. -func (cstp *CmdkeySetupTypeProperties) 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 "targetName": - if v != nil { - var targetName interface{} - err = json.Unmarshal(*v, &targetName) - if err != nil { - return err - } - cstp.TargetName = targetName - } - case "userName": - if v != nil { - var userName interface{} - err = json.Unmarshal(*v, &userName) - if err != nil { - return err - } - cstp.UserName = userName - } - case "password": - if v != nil { - password, err := unmarshalBasicSecretBase(*v) - if err != nil { - return err - } - cstp.Password = password - } - } - } - - return nil -} - -// ComponentSetup the custom setup of installing 3rd party components. -type ComponentSetup struct { - // LicensedComponentSetupTypeProperties - Install 3rd party component type properties. - *LicensedComponentSetupTypeProperties `json:"typeProperties,omitempty"` - // Type - Possible values include: 'TypeCustomSetupBase', 'TypeCmdkeySetup', 'TypeEnvironmentVariableSetup', 'TypeComponentSetup' - Type TypeBasicCustomSetupBase `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ComponentSetup. -func (cs ComponentSetup) MarshalJSON() ([]byte, error) { - cs.Type = TypeComponentSetup - objectMap := make(map[string]interface{}) - if cs.LicensedComponentSetupTypeProperties != nil { - objectMap["typeProperties"] = cs.LicensedComponentSetupTypeProperties - } - if cs.Type != "" { - objectMap["type"] = cs.Type - } - return json.Marshal(objectMap) -} - -// AsCmdkeySetup is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsCmdkeySetup() (*CmdkeySetup, bool) { - return nil, false -} - -// AsEnvironmentVariableSetup is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) { - return nil, false -} - -// AsComponentSetup is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsComponentSetup() (*ComponentSetup, bool) { - return &cs, true -} - -// AsCustomSetupBase is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsCustomSetupBase() (*CustomSetupBase, bool) { - return nil, false -} - -// AsBasicCustomSetupBase is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsBasicCustomSetupBase() (BasicCustomSetupBase, bool) { - return &cs, true -} - -// UnmarshalJSON is the custom unmarshaler for ComponentSetup struct. -func (cs *ComponentSetup) 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 "typeProperties": - if v != nil { - var licensedComponentSetupTypeProperties LicensedComponentSetupTypeProperties - err = json.Unmarshal(*v, &licensedComponentSetupTypeProperties) - if err != nil { - return err - } - cs.LicensedComponentSetupTypeProperties = &licensedComponentSetupTypeProperties - } - case "type": - if v != nil { - var typeVar TypeBasicCustomSetupBase - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cs.Type = typeVar - } - } - } - - return nil -} - -// CreateSQLPoolRestorePointDefinition contains the information necessary to perform a create Sql pool -// restore point operation. -type CreateSQLPoolRestorePointDefinition struct { - // RestorePointLabel - The restore point label to apply - RestorePointLabel *string `json:"restorePointLabel,omitempty"` -} - -// CustomerManagedKeyDetails details of the customer managed key associated with the workspace -type CustomerManagedKeyDetails struct { - // Status - READ-ONLY; The customer managed key status on the workspace - Status *string `json:"status,omitempty"` - // Key - The key object of the workspace - Key *WorkspaceKeyDetails `json:"key,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomerManagedKeyDetails. -func (cmkd CustomerManagedKeyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cmkd.Key != nil { - objectMap["key"] = cmkd.Key - } - return json.Marshal(objectMap) -} - -// BasicCustomSetupBase the base definition of the custom setup. -type BasicCustomSetupBase interface { - AsCmdkeySetup() (*CmdkeySetup, bool) - AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) - AsComponentSetup() (*ComponentSetup, bool) - AsCustomSetupBase() (*CustomSetupBase, bool) -} - -// CustomSetupBase the base definition of the custom setup. -type CustomSetupBase struct { - // Type - Possible values include: 'TypeCustomSetupBase', 'TypeCmdkeySetup', 'TypeEnvironmentVariableSetup', 'TypeComponentSetup' - Type TypeBasicCustomSetupBase `json:"type,omitempty"` -} - -func unmarshalBasicCustomSetupBase(body []byte) (BasicCustomSetupBase, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeCmdkeySetup): - var cs CmdkeySetup - err := json.Unmarshal(body, &cs) - return cs, err - case string(TypeEnvironmentVariableSetup): - var evs EnvironmentVariableSetup - err := json.Unmarshal(body, &evs) - return evs, err - case string(TypeComponentSetup): - var cs ComponentSetup - err := json.Unmarshal(body, &cs) - return cs, err - default: - var csb CustomSetupBase - err := json.Unmarshal(body, &csb) - return csb, err - } -} -func unmarshalBasicCustomSetupBaseArray(body []byte) ([]BasicCustomSetupBase, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - csbArray := make([]BasicCustomSetupBase, len(rawMessages)) - - for index, rawMessage := range rawMessages { - csb, err := unmarshalBasicCustomSetupBase(*rawMessage) - if err != nil { - return nil, err - } - csbArray[index] = csb - } - return csbArray, nil -} - -// MarshalJSON is the custom marshaler for CustomSetupBase. -func (csb CustomSetupBase) MarshalJSON() ([]byte, error) { - csb.Type = TypeCustomSetupBase - objectMap := make(map[string]interface{}) - if csb.Type != "" { - objectMap["type"] = csb.Type - } - return json.Marshal(objectMap) -} - -// AsCmdkeySetup is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsCmdkeySetup() (*CmdkeySetup, bool) { - return nil, false -} - -// AsEnvironmentVariableSetup is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) { - return nil, false -} - -// AsComponentSetup is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsComponentSetup() (*ComponentSetup, bool) { - return nil, false -} - -// AsCustomSetupBase is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsCustomSetupBase() (*CustomSetupBase, bool) { - return &csb, true -} - -// AsBasicCustomSetupBase is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsBasicCustomSetupBase() (BasicCustomSetupBase, bool) { - return &csb, true -} - -// DataLakeStorageAccountDetails details of the data lake storage account associated with the workspace -type DataLakeStorageAccountDetails struct { - // AccountURL - Account URL - AccountURL *string `json:"accountUrl,omitempty"` - // Filesystem - Filesystem name - Filesystem *string `json:"filesystem,omitempty"` -} - -// DataMaskingPolicy ... -type DataMaskingPolicy struct { - autorest.Response `json:"-"` - // DataMaskingPolicyProperties - The properties of the data masking policy. - *DataMaskingPolicyProperties `json:"properties,omitempty"` - // Location - READ-ONLY; The location of the data masking policy. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; The kind of data masking policy. Metadata, used for Azure portal. - Kind *string `json:"kind,omitempty"` - // ManagedBy - READ-ONLY; Fully qualified resource ID of the sql pool - ManagedBy *string `json:"managedBy,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 DataMaskingPolicy. -func (dmp DataMaskingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmp.DataMaskingPolicyProperties != nil { - objectMap["properties"] = dmp.DataMaskingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataMaskingPolicy struct. -func (dmp *DataMaskingPolicy) 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 dataMaskingPolicyProperties DataMaskingPolicyProperties - err = json.Unmarshal(*v, &dataMaskingPolicyProperties) - if err != nil { - return err - } - dmp.DataMaskingPolicyProperties = &dataMaskingPolicyProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dmp.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dmp.Kind = &kind - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - dmp.ManagedBy = &managedBy - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dmp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dmp.Type = &typeVar - } - } - } - - return nil -} - -// DataMaskingPolicyProperties the properties of a database data masking policy. -type DataMaskingPolicyProperties struct { - // DataMaskingState - The state of the data masking policy. Possible values include: 'DataMaskingStateDisabled', 'DataMaskingStateEnabled' - DataMaskingState DataMaskingState `json:"dataMaskingState,omitempty"` - // ExemptPrincipals - The list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. - ExemptPrincipals *string `json:"exemptPrincipals,omitempty"` - // ApplicationPrincipals - READ-ONLY; The list of the application principals. This is a legacy parameter and is no longer used. - ApplicationPrincipals *string `json:"applicationPrincipals,omitempty"` - // MaskingLevel - READ-ONLY; The masking level. This is a legacy parameter and is no longer used. - MaskingLevel *string `json:"maskingLevel,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataMaskingPolicyProperties. -func (dmpp DataMaskingPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmpp.DataMaskingState != "" { - objectMap["dataMaskingState"] = dmpp.DataMaskingState - } - if dmpp.ExemptPrincipals != nil { - objectMap["exemptPrincipals"] = dmpp.ExemptPrincipals - } - return json.Marshal(objectMap) -} - -// DataMaskingRule represents a Sql pool data masking rule. -type DataMaskingRule struct { - autorest.Response `json:"-"` - // DataMaskingRuleProperties - The properties of the resource. - *DataMaskingRuleProperties `json:"properties,omitempty"` - // Location - READ-ONLY; The location of the data masking rule. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; The kind of Data Masking Rule. Metadata, used for Azure portal. - Kind *string `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"` -} - -// MarshalJSON is the custom marshaler for DataMaskingRule. -func (dmr DataMaskingRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmr.DataMaskingRuleProperties != nil { - objectMap["properties"] = dmr.DataMaskingRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataMaskingRule struct. -func (dmr *DataMaskingRule) 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 dataMaskingRuleProperties DataMaskingRuleProperties - err = json.Unmarshal(*v, &dataMaskingRuleProperties) - if err != nil { - return err - } - dmr.DataMaskingRuleProperties = &dataMaskingRuleProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dmr.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dmr.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dmr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dmr.Type = &typeVar - } - } - } - - return nil -} - -// DataMaskingRuleListResult the response to a list data masking rules request. -type DataMaskingRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of Sql pool data masking rules. - Value *[]DataMaskingRule `json:"value,omitempty"` -} - -// DataMaskingRuleProperties the properties of a Sql pool data masking rule. -type DataMaskingRuleProperties struct { - // ID - READ-ONLY; The rule Id. - ID *string `json:"id,omitempty"` - // AliasName - The alias name. This is a legacy parameter and is no longer used. - AliasName *string `json:"aliasName,omitempty"` - // RuleState - The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: 'DataMaskingRuleStateDisabled', 'DataMaskingRuleStateEnabled' - RuleState DataMaskingRuleState `json:"ruleState,omitempty"` - // SchemaName - The schema name on which the data masking rule is applied. - SchemaName *string `json:"schemaName,omitempty"` - // TableName - The table name on which the data masking rule is applied. - TableName *string `json:"tableName,omitempty"` - // ColumnName - The column name on which the data masking rule is applied. - ColumnName *string `json:"columnName,omitempty"` - // MaskingFunction - The masking function that is used for the data masking rule. Possible values include: 'DataMaskingFunctionDefault', 'DataMaskingFunctionCCN', 'DataMaskingFunctionEmail', 'DataMaskingFunctionNumber', 'DataMaskingFunctionSSN', 'DataMaskingFunctionText' - MaskingFunction DataMaskingFunction `json:"maskingFunction,omitempty"` - // NumberFrom - The numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. - NumberFrom *string `json:"numberFrom,omitempty"` - // NumberTo - The numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. - NumberTo *string `json:"numberTo,omitempty"` - // PrefixSize - If maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, this parameter will be ignored. - PrefixSize *string `json:"prefixSize,omitempty"` - // SuffixSize - If maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this parameter will be ignored. - SuffixSize *string `json:"suffixSize,omitempty"` - // ReplacementString - If maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. - ReplacementString *string `json:"replacementString,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataMaskingRuleProperties. -func (dmrp DataMaskingRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmrp.AliasName != nil { - objectMap["aliasName"] = dmrp.AliasName - } - if dmrp.RuleState != "" { - objectMap["ruleState"] = dmrp.RuleState - } - if dmrp.SchemaName != nil { - objectMap["schemaName"] = dmrp.SchemaName - } - if dmrp.TableName != nil { - objectMap["tableName"] = dmrp.TableName - } - if dmrp.ColumnName != nil { - objectMap["columnName"] = dmrp.ColumnName - } - if dmrp.MaskingFunction != "" { - objectMap["maskingFunction"] = dmrp.MaskingFunction - } - if dmrp.NumberFrom != nil { - objectMap["numberFrom"] = dmrp.NumberFrom - } - if dmrp.NumberTo != nil { - objectMap["numberTo"] = dmrp.NumberTo - } - if dmrp.PrefixSize != nil { - objectMap["prefixSize"] = dmrp.PrefixSize - } - if dmrp.SuffixSize != nil { - objectMap["suffixSize"] = dmrp.SuffixSize - } - if dmrp.ReplacementString != nil { - objectMap["replacementString"] = dmrp.ReplacementString - } - return json.Marshal(objectMap) -} - -// DataWarehouseUserActivities user activities of a data warehouse -type DataWarehouseUserActivities struct { - autorest.Response `json:"-"` - // DataWarehouseUserActivitiesProperties - Resource properties. - *DataWarehouseUserActivitiesProperties `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 DataWarehouseUserActivities. -func (dwua DataWarehouseUserActivities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dwua.DataWarehouseUserActivitiesProperties != nil { - objectMap["properties"] = dwua.DataWarehouseUserActivitiesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataWarehouseUserActivities struct. -func (dwua *DataWarehouseUserActivities) 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 dataWarehouseUserActivitiesProperties DataWarehouseUserActivitiesProperties - err = json.Unmarshal(*v, &dataWarehouseUserActivitiesProperties) - if err != nil { - return err - } - dwua.DataWarehouseUserActivitiesProperties = &dataWarehouseUserActivitiesProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dwua.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dwua.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dwua.Type = &typeVar - } - } - } - - return nil -} - -// DataWarehouseUserActivitiesProperties user activities of a data warehouse. This currently includes the -// count of running or suspended queries. For more information, please view the sys.dm_pdw_exec_requests -// dynamic management view (DMV). -type DataWarehouseUserActivitiesProperties struct { - // ActiveQueriesCount - READ-ONLY; Count of running and suspended queries. - ActiveQueriesCount *int32 `json:"activeQueriesCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataWarehouseUserActivitiesProperties. -func (dwuap DataWarehouseUserActivitiesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EncryptionDetails details of the encryption associated with the workspace -type EncryptionDetails struct { - // DoubleEncryptionEnabled - READ-ONLY; Double Encryption enabled - DoubleEncryptionEnabled *bool `json:"doubleEncryptionEnabled,omitempty"` - // Cmk - Customer Managed Key Details - Cmk *CustomerManagedKeyDetails `json:"cmk,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionDetails. -func (ed EncryptionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ed.Cmk != nil { - objectMap["cmk"] = ed.Cmk - } - return json.Marshal(objectMap) -} - -// EntityReference the entity reference. -type EntityReference struct { - // Type - The type of this referenced entity. Possible values include: 'IntegrationRuntimeReference', 'LinkedServiceReference' - Type IntegrationRuntimeEntityReferenceType `json:"type,omitempty"` - // ReferenceName - The name of this referenced entity. - ReferenceName *string `json:"referenceName,omitempty"` -} - -// EnvironmentVariableSetup the custom setup of setting environment variable. -type EnvironmentVariableSetup struct { - // EnvironmentVariableSetupTypeProperties - Add environment variable type properties. - *EnvironmentVariableSetupTypeProperties `json:"typeProperties,omitempty"` - // Type - Possible values include: 'TypeCustomSetupBase', 'TypeCmdkeySetup', 'TypeEnvironmentVariableSetup', 'TypeComponentSetup' - Type TypeBasicCustomSetupBase `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) MarshalJSON() ([]byte, error) { - evs.Type = TypeEnvironmentVariableSetup - objectMap := make(map[string]interface{}) - if evs.EnvironmentVariableSetupTypeProperties != nil { - objectMap["typeProperties"] = evs.EnvironmentVariableSetupTypeProperties - } - if evs.Type != "" { - objectMap["type"] = evs.Type - } - return json.Marshal(objectMap) -} - -// AsCmdkeySetup is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsCmdkeySetup() (*CmdkeySetup, bool) { - return nil, false -} - -// AsEnvironmentVariableSetup is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) { - return &evs, true -} - -// AsComponentSetup is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsComponentSetup() (*ComponentSetup, bool) { - return nil, false -} - -// AsCustomSetupBase is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsCustomSetupBase() (*CustomSetupBase, bool) { - return nil, false -} - -// AsBasicCustomSetupBase is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsBasicCustomSetupBase() (BasicCustomSetupBase, bool) { - return &evs, true -} - -// UnmarshalJSON is the custom unmarshaler for EnvironmentVariableSetup struct. -func (evs *EnvironmentVariableSetup) 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 "typeProperties": - if v != nil { - var environmentVariableSetupTypeProperties EnvironmentVariableSetupTypeProperties - err = json.Unmarshal(*v, &environmentVariableSetupTypeProperties) - if err != nil { - return err - } - evs.EnvironmentVariableSetupTypeProperties = &environmentVariableSetupTypeProperties - } - case "type": - if v != nil { - var typeVar TypeBasicCustomSetupBase - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - evs.Type = typeVar - } - } - } - - return nil -} - -// EnvironmentVariableSetupTypeProperties environment variable custom setup type properties. -type EnvironmentVariableSetupTypeProperties struct { - // VariableName - The name of the environment variable. - VariableName *string `json:"variableName,omitempty"` - // VariableValue - The value of the environment variable. - VariableValue *string `json:"variableValue,omitempty"` -} - -// 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) -} - -// ErrorContract contains details when the response code indicates an error. -type ErrorContract struct { - // Error - The error details. - Error *ErrorResponse `json:"error,omitempty"` -} - -// ErrorDetail error details -type ErrorDetail struct { - // Message - Error message - Message *string `json:"message,omitempty"` - // Code - Error code - Code *string `json:"code,omitempty"` - // Target - Error target - Target *string `json:"target,omitempty"` -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.) -type ErrorResponse struct { - // 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 *[]ErrorResponse `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExtendedServerBlobAuditingPolicy an extended server blob auditing policy. -type ExtendedServerBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ExtendedServerBlobAuditingPolicyProperties - Resource properties. - *ExtendedServerBlobAuditingPolicyProperties `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 ExtendedServerBlobAuditingPolicy. -func (esbap ExtendedServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if esbap.ExtendedServerBlobAuditingPolicyProperties != nil { - objectMap["properties"] = esbap.ExtendedServerBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExtendedServerBlobAuditingPolicy struct. -func (esbap *ExtendedServerBlobAuditingPolicy) 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 extendedServerBlobAuditingPolicyProperties ExtendedServerBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &extendedServerBlobAuditingPolicyProperties) - if err != nil { - return err - } - esbap.ExtendedServerBlobAuditingPolicyProperties = &extendedServerBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - esbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - esbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - esbap.Type = &typeVar - } - } - } - - return nil -} - -// ExtendedServerBlobAuditingPolicyListResult a list of server extended auditing settings. -type ExtendedServerBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ExtendedServerBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicyListResult. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExtendedServerBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ExtendedServerBlobAuditingPolicy values. -type ExtendedServerBlobAuditingPolicyListResultIterator struct { - i int - page ExtendedServerBlobAuditingPolicyListResultPage -} - -// 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 *ExtendedServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultIterator.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 *ExtendedServerBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExtendedServerBlobAuditingPolicyListResultIterator) 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 ExtendedServerBlobAuditingPolicyListResultIterator) Response() ExtendedServerBlobAuditingPolicyListResult { - 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 ExtendedServerBlobAuditingPolicyListResultIterator) Value() ExtendedServerBlobAuditingPolicy { - if !iter.page.NotDone() { - return ExtendedServerBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultIterator type. -func NewExtendedServerBlobAuditingPolicyListResultIterator(page ExtendedServerBlobAuditingPolicyListResultPage) ExtendedServerBlobAuditingPolicyListResultIterator { - return ExtendedServerBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) IsEmpty() bool { - return esbaplr.Value == nil || len(*esbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) hasNextLink() bool { - return esbaplr.NextLink != nil && len(*esbaplr.NextLink) != 0 -} - -// extendedServerBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) extendedServerBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !esbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(esbaplr.NextLink))) -} - -// ExtendedServerBlobAuditingPolicyListResultPage contains a page of ExtendedServerBlobAuditingPolicy -// values. -type ExtendedServerBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error) - esbaplr ExtendedServerBlobAuditingPolicyListResult -} - -// 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 *ExtendedServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultPage.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.esbaplr) - if err != nil { - return err - } - page.esbaplr = 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 *ExtendedServerBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExtendedServerBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.esbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExtendedServerBlobAuditingPolicyListResultPage) Response() ExtendedServerBlobAuditingPolicyListResult { - return page.esbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExtendedServerBlobAuditingPolicyListResultPage) Values() []ExtendedServerBlobAuditingPolicy { - if page.esbaplr.IsEmpty() { - return nil - } - return *page.esbaplr.Value -} - -// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultPage type. -func NewExtendedServerBlobAuditingPolicyListResultPage(cur ExtendedServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error)) ExtendedServerBlobAuditingPolicyListResultPage { - return ExtendedServerBlobAuditingPolicyListResultPage{ - fn: getNextPage, - esbaplr: cur, - } -} - -// ExtendedServerBlobAuditingPolicyProperties properties of an extended server blob auditing policy. -type ExtendedServerBlobAuditingPolicyProperties struct { - // PredicateExpression - Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// ExtendedSQLPoolBlobAuditingPolicy an extended Sql pool blob auditing policy. -type ExtendedSQLPoolBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ExtendedSQLPoolBlobAuditingPolicyProperties - Resource properties. - *ExtendedSQLPoolBlobAuditingPolicyProperties `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 ExtendedSQLPoolBlobAuditingPolicy. -func (espbap ExtendedSQLPoolBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if espbap.ExtendedSQLPoolBlobAuditingPolicyProperties != nil { - objectMap["properties"] = espbap.ExtendedSQLPoolBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExtendedSQLPoolBlobAuditingPolicy struct. -func (espbap *ExtendedSQLPoolBlobAuditingPolicy) 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 extendedSQLPoolBlobAuditingPolicyProperties ExtendedSQLPoolBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &extendedSQLPoolBlobAuditingPolicyProperties) - if err != nil { - return err - } - espbap.ExtendedSQLPoolBlobAuditingPolicyProperties = &extendedSQLPoolBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - espbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - espbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - espbap.Type = &typeVar - } - } - } - - return nil -} - -// ExtendedSQLPoolBlobAuditingPolicyListResult a list of sql pool extended auditing settings. -type ExtendedSQLPoolBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ExtendedSQLPoolBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedSQLPoolBlobAuditingPolicyListResult. -func (espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExtendedSQLPoolBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ExtendedSQLPoolBlobAuditingPolicy values. -type ExtendedSQLPoolBlobAuditingPolicyListResultIterator struct { - i int - page ExtendedSQLPoolBlobAuditingPolicyListResultPage -} - -// 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 *ExtendedSQLPoolBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPolicyListResultIterator.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 *ExtendedSQLPoolBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExtendedSQLPoolBlobAuditingPolicyListResultIterator) 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 ExtendedSQLPoolBlobAuditingPolicyListResultIterator) Response() ExtendedSQLPoolBlobAuditingPolicyListResult { - 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 ExtendedSQLPoolBlobAuditingPolicyListResultIterator) Value() ExtendedSQLPoolBlobAuditingPolicy { - if !iter.page.NotDone() { - return ExtendedSQLPoolBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExtendedSQLPoolBlobAuditingPolicyListResultIterator type. -func NewExtendedSQLPoolBlobAuditingPolicyListResultIterator(page ExtendedSQLPoolBlobAuditingPolicyListResultPage) ExtendedSQLPoolBlobAuditingPolicyListResultIterator { - return ExtendedSQLPoolBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult) IsEmpty() bool { - return espbaplr.Value == nil || len(*espbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult) hasNextLink() bool { - return espbaplr.NextLink != nil && len(*espbaplr.NextLink) != 0 -} - -// extendedSQLPoolBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult) extendedSQLPoolBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !espbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(espbaplr.NextLink))) -} - -// ExtendedSQLPoolBlobAuditingPolicyListResultPage contains a page of ExtendedSQLPoolBlobAuditingPolicy -// values. -type ExtendedSQLPoolBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ExtendedSQLPoolBlobAuditingPolicyListResult) (ExtendedSQLPoolBlobAuditingPolicyListResult, error) - espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult -} - -// 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 *ExtendedSQLPoolBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPolicyListResultPage.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.espbaplr) - if err != nil { - return err - } - page.espbaplr = 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 *ExtendedSQLPoolBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExtendedSQLPoolBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.espbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExtendedSQLPoolBlobAuditingPolicyListResultPage) Response() ExtendedSQLPoolBlobAuditingPolicyListResult { - return page.espbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExtendedSQLPoolBlobAuditingPolicyListResultPage) Values() []ExtendedSQLPoolBlobAuditingPolicy { - if page.espbaplr.IsEmpty() { - return nil - } - return *page.espbaplr.Value -} - -// Creates a new instance of the ExtendedSQLPoolBlobAuditingPolicyListResultPage type. -func NewExtendedSQLPoolBlobAuditingPolicyListResultPage(cur ExtendedSQLPoolBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedSQLPoolBlobAuditingPolicyListResult) (ExtendedSQLPoolBlobAuditingPolicyListResult, error)) ExtendedSQLPoolBlobAuditingPolicyListResultPage { - return ExtendedSQLPoolBlobAuditingPolicyListResultPage{ - fn: getNextPage, - espbaplr: cur, - } -} - -// ExtendedSQLPoolBlobAuditingPolicyProperties properties of an extended Sql pool blob auditing policy. -type ExtendedSQLPoolBlobAuditingPolicyProperties struct { - // PredicateExpression - Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// GeoBackupPolicy a database geo backup policy. -type GeoBackupPolicy struct { - autorest.Response `json:"-"` - // GeoBackupPolicyProperties - The properties of the geo backup policy. - *GeoBackupPolicyProperties `json:"properties,omitempty"` - // Kind - READ-ONLY; Kind of geo backup policy. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Backup policy location. - 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 GeoBackupPolicy. -func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gbp.GeoBackupPolicyProperties != nil { - objectMap["properties"] = gbp.GeoBackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GeoBackupPolicy struct. -func (gbp *GeoBackupPolicy) 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 geoBackupPolicyProperties GeoBackupPolicyProperties - err = json.Unmarshal(*v, &geoBackupPolicyProperties) - if err != nil { - return err - } - gbp.GeoBackupPolicyProperties = &geoBackupPolicyProperties - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - gbp.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gbp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gbp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gbp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gbp.Type = &typeVar - } - } - } - - return nil -} - -// GeoBackupPolicyListResult the response to a list geo backup policies request. -type GeoBackupPolicyListResult struct { - autorest.Response `json:"-"` - // Value - The list of geo backup policies. - Value *[]GeoBackupPolicy `json:"value,omitempty"` -} - -// GeoBackupPolicyProperties the properties of the geo backup policy. -type GeoBackupPolicyProperties struct { - // State - The state of the geo backup policy. Possible values include: 'GeoBackupPolicyStateDisabled', 'GeoBackupPolicyStateEnabled' - State GeoBackupPolicyState `json:"state,omitempty"` - // StorageType - READ-ONLY; The storage type of the geo backup policy. - StorageType *string `json:"storageType,omitempty"` -} - -// MarshalJSON is the custom marshaler for GeoBackupPolicyProperties. -func (gbpp GeoBackupPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gbpp.State != "" { - objectMap["state"] = gbpp.State - } - return json.Marshal(objectMap) -} - -// GetSsisObjectMetadataRequest the request payload of get SSIS object metadata. -type GetSsisObjectMetadataRequest struct { - // MetadataPath - Metadata path. - MetadataPath *string `json:"metadataPath,omitempty"` -} - -// BasicIntegrationRuntime azure Synapse nested object which serves as a compute resource for activities. -type BasicIntegrationRuntime interface { - AsManagedIntegrationRuntime() (*ManagedIntegrationRuntime, bool) - AsSelfHostedIntegrationRuntime() (*SelfHostedIntegrationRuntime, bool) - AsIntegrationRuntime() (*IntegrationRuntime, bool) -} - -// IntegrationRuntime azure Synapse nested object which serves as a compute resource for activities. -type IntegrationRuntime struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Description - Integration runtime description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeIntegrationRuntime', 'TypeManaged', 'TypeSelfHosted' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicIntegrationRuntime(body []byte) (BasicIntegrationRuntime, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeManaged): - var mir ManagedIntegrationRuntime - err := json.Unmarshal(body, &mir) - return mir, err - case string(TypeSelfHosted): - var shir SelfHostedIntegrationRuntime - err := json.Unmarshal(body, &shir) - return shir, err - default: - var ir IntegrationRuntime - err := json.Unmarshal(body, &ir) - return ir, err - } -} -func unmarshalBasicIntegrationRuntimeArray(body []byte) ([]BasicIntegrationRuntime, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - irArray := make([]BasicIntegrationRuntime, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ir, err := unmarshalBasicIntegrationRuntime(*rawMessage) - if err != nil { - return nil, err - } - irArray[index] = ir - } - return irArray, nil -} - -// MarshalJSON is the custom marshaler for IntegrationRuntime. -func (ir IntegrationRuntime) MarshalJSON() ([]byte, error) { - ir.Type = TypeIntegrationRuntime - objectMap := make(map[string]interface{}) - if ir.Description != nil { - objectMap["description"] = ir.Description - } - if ir.Type != "" { - objectMap["type"] = ir.Type - } - for k, v := range ir.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntime is the BasicIntegrationRuntime implementation for IntegrationRuntime. -func (ir IntegrationRuntime) AsManagedIntegrationRuntime() (*ManagedIntegrationRuntime, bool) { - return nil, false -} - -// AsSelfHostedIntegrationRuntime is the BasicIntegrationRuntime implementation for IntegrationRuntime. -func (ir IntegrationRuntime) AsSelfHostedIntegrationRuntime() (*SelfHostedIntegrationRuntime, bool) { - return nil, false -} - -// AsIntegrationRuntime is the BasicIntegrationRuntime implementation for IntegrationRuntime. -func (ir IntegrationRuntime) AsIntegrationRuntime() (*IntegrationRuntime, bool) { - return &ir, true -} - -// AsBasicIntegrationRuntime is the BasicIntegrationRuntime implementation for IntegrationRuntime. -func (ir IntegrationRuntime) AsBasicIntegrationRuntime() (BasicIntegrationRuntime, bool) { - return &ir, true -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntime struct. -func (ir *IntegrationRuntime) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ir.AdditionalProperties == nil { - ir.AdditionalProperties = make(map[string]interface{}) - } - ir.AdditionalProperties[k] = additionalProperties - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ir.Description = &description - } - case "type": - if v != nil { - var typeVar Type - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ir.Type = typeVar - } - } - } - - return nil -} - -// IntegrationRuntimeAuthKeys the integration runtime authentication keys. -type IntegrationRuntimeAuthKeys struct { - autorest.Response `json:"-"` - // AuthKey1 - The primary integration runtime authentication key. - AuthKey1 *string `json:"authKey1,omitempty"` - // AuthKey2 - The secondary integration runtime authentication key. - AuthKey2 *string `json:"authKey2,omitempty"` -} - -// IntegrationRuntimeComputeProperties the compute resource properties for managed integration runtime. -type IntegrationRuntimeComputeProperties struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Location - The location for managed integration runtime. The supported regions could be found on https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities - Location *string `json:"location,omitempty"` - // NodeSize - The node size requirement to managed integration runtime. - NodeSize *string `json:"nodeSize,omitempty"` - // NumberOfNodes - The required number of nodes for managed integration runtime. - NumberOfNodes *int32 `json:"numberOfNodes,omitempty"` - // MaxParallelExecutionsPerNode - Maximum parallel executions count per node for managed integration runtime. - MaxParallelExecutionsPerNode *int32 `json:"maxParallelExecutionsPerNode,omitempty"` - // DataFlowProperties - Data flow properties for managed integration runtime. - DataFlowProperties *IntegrationRuntimeDataFlowProperties `json:"dataFlowProperties,omitempty"` - // VNetProperties - VNet properties for managed integration runtime. - VNetProperties *IntegrationRuntimeVNetProperties `json:"vNetProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeComputeProperties. -func (ircp IntegrationRuntimeComputeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ircp.Location != nil { - objectMap["location"] = ircp.Location - } - if ircp.NodeSize != nil { - objectMap["nodeSize"] = ircp.NodeSize - } - if ircp.NumberOfNodes != nil { - objectMap["numberOfNodes"] = ircp.NumberOfNodes - } - if ircp.MaxParallelExecutionsPerNode != nil { - objectMap["maxParallelExecutionsPerNode"] = ircp.MaxParallelExecutionsPerNode - } - if ircp.DataFlowProperties != nil { - objectMap["dataFlowProperties"] = ircp.DataFlowProperties - } - if ircp.VNetProperties != nil { - objectMap["vNetProperties"] = ircp.VNetProperties - } - for k, v := range ircp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeComputeProperties struct. -func (ircp *IntegrationRuntimeComputeProperties) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ircp.AdditionalProperties == nil { - ircp.AdditionalProperties = make(map[string]interface{}) - } - ircp.AdditionalProperties[k] = additionalProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ircp.Location = &location - } - case "nodeSize": - if v != nil { - var nodeSize string - err = json.Unmarshal(*v, &nodeSize) - if err != nil { - return err - } - ircp.NodeSize = &nodeSize - } - case "numberOfNodes": - if v != nil { - var numberOfNodes int32 - err = json.Unmarshal(*v, &numberOfNodes) - if err != nil { - return err - } - ircp.NumberOfNodes = &numberOfNodes - } - case "maxParallelExecutionsPerNode": - if v != nil { - var maxParallelExecutionsPerNode int32 - err = json.Unmarshal(*v, &maxParallelExecutionsPerNode) - if err != nil { - return err - } - ircp.MaxParallelExecutionsPerNode = &maxParallelExecutionsPerNode - } - case "dataFlowProperties": - if v != nil { - var dataFlowProperties IntegrationRuntimeDataFlowProperties - err = json.Unmarshal(*v, &dataFlowProperties) - if err != nil { - return err - } - ircp.DataFlowProperties = &dataFlowProperties - } - case "vNetProperties": - if v != nil { - var vNetProperties IntegrationRuntimeVNetProperties - err = json.Unmarshal(*v, &vNetProperties) - if err != nil { - return err - } - ircp.VNetProperties = &vNetProperties - } - } - } - - return nil -} - -// IntegrationRuntimeConnectionInfo connection information for encrypting the on-premises data source -// credentials. -type IntegrationRuntimeConnectionInfo struct { - autorest.Response `json:"-"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ServiceToken - READ-ONLY; The token generated in service. Callers use this token to authenticate to integration runtime. - ServiceToken *string `json:"serviceToken,omitempty"` - // IdentityCertThumbprint - READ-ONLY; The integration runtime SSL certificate thumbprint. Click-Once application uses it to do server validation. - IdentityCertThumbprint *string `json:"identityCertThumbprint,omitempty"` - // HostServiceURI - READ-ONLY; The on-premises integration runtime host URL. - HostServiceURI *string `json:"hostServiceUri,omitempty"` - // Version - READ-ONLY; The integration runtime version. - Version *string `json:"version,omitempty"` - // PublicKey - READ-ONLY; The public key for encrypting a credential when transferring the credential to the integration runtime. - PublicKey *string `json:"publicKey,omitempty"` - // IsIdentityCertExprired - READ-ONLY; Whether the identity certificate is expired. - IsIdentityCertExprired *bool `json:"isIdentityCertExprired,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeConnectionInfo. -func (irci IntegrationRuntimeConnectionInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - for k, v := range irci.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeConnectionInfo struct. -func (irci *IntegrationRuntimeConnectionInfo) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irci.AdditionalProperties == nil { - irci.AdditionalProperties = make(map[string]interface{}) - } - irci.AdditionalProperties[k] = additionalProperties - } - case "serviceToken": - if v != nil { - var serviceToken string - err = json.Unmarshal(*v, &serviceToken) - if err != nil { - return err - } - irci.ServiceToken = &serviceToken - } - case "identityCertThumbprint": - if v != nil { - var identityCertThumbprint string - err = json.Unmarshal(*v, &identityCertThumbprint) - if err != nil { - return err - } - irci.IdentityCertThumbprint = &identityCertThumbprint - } - case "hostServiceUri": - if v != nil { - var hostServiceURI string - err = json.Unmarshal(*v, &hostServiceURI) - if err != nil { - return err - } - irci.HostServiceURI = &hostServiceURI - } - case "version": - if v != nil { - var version string - err = json.Unmarshal(*v, &version) - if err != nil { - return err - } - irci.Version = &version - } - case "publicKey": - if v != nil { - var publicKey string - err = json.Unmarshal(*v, &publicKey) - if err != nil { - return err - } - irci.PublicKey = &publicKey - } - case "isIdentityCertExprired": - if v != nil { - var isIdentityCertExprired bool - err = json.Unmarshal(*v, &isIdentityCertExprired) - if err != nil { - return err - } - irci.IsIdentityCertExprired = &isIdentityCertExprired - } - } - } - - return nil -} - -// IntegrationRuntimeCustomSetupScriptProperties custom setup script properties for a managed dedicated -// integration runtime. -type IntegrationRuntimeCustomSetupScriptProperties struct { - // BlobContainerURI - The URI of the Azure blob container that contains the custom setup script. - BlobContainerURI *string `json:"blobContainerUri,omitempty"` - // SasToken - The SAS token of the Azure blob container. - SasToken *SecureString `json:"sasToken,omitempty"` -} - -// IntegrationRuntimeDataFlowProperties data flow properties for managed integration runtime. -type IntegrationRuntimeDataFlowProperties struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ComputeType - Compute type of the cluster which will execute data flow job. Possible values include: 'General', 'MemoryOptimized', 'ComputeOptimized' - ComputeType DataFlowComputeType `json:"computeType,omitempty"` - // CoreCount - Core count of the cluster which will execute data flow job. Supported values are: 8, 16, 32, 48, 80, 144 and 272. - CoreCount *int32 `json:"coreCount,omitempty"` - // TimeToLive - Time to live (in minutes) setting of the cluster which will execute data flow job. - TimeToLive *int32 `json:"timeToLive,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeDataFlowProperties. -func (irdfp IntegrationRuntimeDataFlowProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if irdfp.ComputeType != "" { - objectMap["computeType"] = irdfp.ComputeType - } - if irdfp.CoreCount != nil { - objectMap["coreCount"] = irdfp.CoreCount - } - if irdfp.TimeToLive != nil { - objectMap["timeToLive"] = irdfp.TimeToLive - } - for k, v := range irdfp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeDataFlowProperties struct. -func (irdfp *IntegrationRuntimeDataFlowProperties) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irdfp.AdditionalProperties == nil { - irdfp.AdditionalProperties = make(map[string]interface{}) - } - irdfp.AdditionalProperties[k] = additionalProperties - } - case "computeType": - if v != nil { - var computeType DataFlowComputeType - err = json.Unmarshal(*v, &computeType) - if err != nil { - return err - } - irdfp.ComputeType = computeType - } - case "coreCount": - if v != nil { - var coreCount int32 - err = json.Unmarshal(*v, &coreCount) - if err != nil { - return err - } - irdfp.CoreCount = &coreCount - } - case "timeToLive": - if v != nil { - var timeToLive int32 - err = json.Unmarshal(*v, &timeToLive) - if err != nil { - return err - } - irdfp.TimeToLive = &timeToLive - } - } - } - - return nil -} - -// IntegrationRuntimeDataProxyProperties data proxy properties for a managed dedicated integration runtime. -type IntegrationRuntimeDataProxyProperties struct { - // ConnectVia - The self-hosted integration runtime reference. - ConnectVia *EntityReference `json:"connectVia,omitempty"` - // StagingLinkedService - The staging linked service reference. - StagingLinkedService *EntityReference `json:"stagingLinkedService,omitempty"` - // Path - The path to contain the staged data in the Blob storage. - Path *string `json:"path,omitempty"` -} - -// IntegrationRuntimeListResponse a list of integration runtime resources. -type IntegrationRuntimeListResponse struct { - autorest.Response `json:"-"` - // Value - List of integration runtimes. - Value *[]IntegrationRuntimeResource `json:"value,omitempty"` - // NextLink - The link to the next page of results, if any remaining results exist. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationRuntimeListResponseIterator provides access to a complete listing of -// IntegrationRuntimeResource values. -type IntegrationRuntimeListResponseIterator struct { - i int - page IntegrationRuntimeListResponsePage -} - -// 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 *IntegrationRuntimeListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeListResponseIterator.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 *IntegrationRuntimeListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationRuntimeListResponseIterator) 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 IntegrationRuntimeListResponseIterator) Response() IntegrationRuntimeListResponse { - 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 IntegrationRuntimeListResponseIterator) Value() IntegrationRuntimeResource { - if !iter.page.NotDone() { - return IntegrationRuntimeResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationRuntimeListResponseIterator type. -func NewIntegrationRuntimeListResponseIterator(page IntegrationRuntimeListResponsePage) IntegrationRuntimeListResponseIterator { - return IntegrationRuntimeListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (irlr IntegrationRuntimeListResponse) IsEmpty() bool { - return irlr.Value == nil || len(*irlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (irlr IntegrationRuntimeListResponse) hasNextLink() bool { - return irlr.NextLink != nil && len(*irlr.NextLink) != 0 -} - -// integrationRuntimeListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (irlr IntegrationRuntimeListResponse) integrationRuntimeListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !irlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(irlr.NextLink))) -} - -// IntegrationRuntimeListResponsePage contains a page of IntegrationRuntimeResource values. -type IntegrationRuntimeListResponsePage struct { - fn func(context.Context, IntegrationRuntimeListResponse) (IntegrationRuntimeListResponse, error) - irlr IntegrationRuntimeListResponse -} - -// 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 *IntegrationRuntimeListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeListResponsePage.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.irlr) - if err != nil { - return err - } - page.irlr = 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 *IntegrationRuntimeListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationRuntimeListResponsePage) NotDone() bool { - return !page.irlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationRuntimeListResponsePage) Response() IntegrationRuntimeListResponse { - return page.irlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationRuntimeListResponsePage) Values() []IntegrationRuntimeResource { - if page.irlr.IsEmpty() { - return nil - } - return *page.irlr.Value -} - -// Creates a new instance of the IntegrationRuntimeListResponsePage type. -func NewIntegrationRuntimeListResponsePage(cur IntegrationRuntimeListResponse, getNextPage func(context.Context, IntegrationRuntimeListResponse) (IntegrationRuntimeListResponse, error)) IntegrationRuntimeListResponsePage { - return IntegrationRuntimeListResponsePage{ - fn: getNextPage, - irlr: cur, - } -} - -// IntegrationRuntimeMonitoringData get monitoring data response. -type IntegrationRuntimeMonitoringData struct { - autorest.Response `json:"-"` - // Name - Integration runtime name. - Name *string `json:"name,omitempty"` - // Nodes - Integration runtime node monitoring data. - Nodes *[]IntegrationRuntimeNodeMonitoringData `json:"nodes,omitempty"` -} - -// IntegrationRuntimeNodeIPAddress the IP address of self-hosted integration runtime node. -type IntegrationRuntimeNodeIPAddress struct { - autorest.Response `json:"-"` - // IPAddress - READ-ONLY; The IP address of self-hosted integration runtime node. - IPAddress *string `json:"ipAddress,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeNodeIPAddress. -func (irnia IntegrationRuntimeNodeIPAddress) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IntegrationRuntimeNodeMonitoringData monitoring data for integration runtime node. -type IntegrationRuntimeNodeMonitoringData struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // NodeName - READ-ONLY; Name of the integration runtime node. - NodeName *string `json:"nodeName,omitempty"` - // AvailableMemoryInMB - READ-ONLY; Available memory (MB) on the integration runtime node. - AvailableMemoryInMB *int32 `json:"availableMemoryInMB,omitempty"` - // CPUUtilization - READ-ONLY; CPU percentage on the integration runtime node. - CPUUtilization *int32 `json:"cpuUtilization,omitempty"` - // ConcurrentJobsLimit - READ-ONLY; Maximum concurrent jobs on the integration runtime node. - ConcurrentJobsLimit *int32 `json:"concurrentJobsLimit,omitempty"` - // ConcurrentJobsRunning - READ-ONLY; The number of jobs currently running on the integration runtime node. - ConcurrentJobsRunning *int32 `json:"concurrentJobsRunning,omitempty"` - // MaxConcurrentJobs - READ-ONLY; The maximum concurrent jobs in this integration runtime. - MaxConcurrentJobs *int32 `json:"maxConcurrentJobs,omitempty"` - // SentBytes - READ-ONLY; Sent bytes on the integration runtime node. - SentBytes *float64 `json:"sentBytes,omitempty"` - // ReceivedBytes - READ-ONLY; Received bytes on the integration runtime node. - ReceivedBytes *float64 `json:"receivedBytes,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeNodeMonitoringData. -func (irnmd IntegrationRuntimeNodeMonitoringData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - for k, v := range irnmd.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeNodeMonitoringData struct. -func (irnmd *IntegrationRuntimeNodeMonitoringData) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irnmd.AdditionalProperties == nil { - irnmd.AdditionalProperties = make(map[string]interface{}) - } - irnmd.AdditionalProperties[k] = additionalProperties - } - case "nodeName": - if v != nil { - var nodeName string - err = json.Unmarshal(*v, &nodeName) - if err != nil { - return err - } - irnmd.NodeName = &nodeName - } - case "availableMemoryInMB": - if v != nil { - var availableMemoryInMB int32 - err = json.Unmarshal(*v, &availableMemoryInMB) - if err != nil { - return err - } - irnmd.AvailableMemoryInMB = &availableMemoryInMB - } - case "cpuUtilization": - if v != nil { - var CPUUtilization int32 - err = json.Unmarshal(*v, &CPUUtilization) - if err != nil { - return err - } - irnmd.CPUUtilization = &CPUUtilization - } - case "concurrentJobsLimit": - if v != nil { - var concurrentJobsLimit int32 - err = json.Unmarshal(*v, &concurrentJobsLimit) - if err != nil { - return err - } - irnmd.ConcurrentJobsLimit = &concurrentJobsLimit - } - case "concurrentJobsRunning": - if v != nil { - var concurrentJobsRunning int32 - err = json.Unmarshal(*v, &concurrentJobsRunning) - if err != nil { - return err - } - irnmd.ConcurrentJobsRunning = &concurrentJobsRunning - } - case "maxConcurrentJobs": - if v != nil { - var maxConcurrentJobs int32 - err = json.Unmarshal(*v, &maxConcurrentJobs) - if err != nil { - return err - } - irnmd.MaxConcurrentJobs = &maxConcurrentJobs - } - case "sentBytes": - if v != nil { - var sentBytes float64 - err = json.Unmarshal(*v, &sentBytes) - if err != nil { - return err - } - irnmd.SentBytes = &sentBytes - } - case "receivedBytes": - if v != nil { - var receivedBytes float64 - err = json.Unmarshal(*v, &receivedBytes) - if err != nil { - return err - } - irnmd.ReceivedBytes = &receivedBytes - } - } - } - - return nil -} - -// IntegrationRuntimeObjectMetadataRefreshFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type IntegrationRuntimeObjectMetadataRefreshFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimeObjectMetadataClient) (SsisObjectMetadataStatusResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimeObjectMetadataRefreshFuture) 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 IntegrationRuntimeObjectMetadataRefreshFuture.Result. -func (future *IntegrationRuntimeObjectMetadataRefreshFuture) result(client IntegrationRuntimeObjectMetadataClient) (somsr SsisObjectMetadataStatusResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataRefreshFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - somsr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimeObjectMetadataRefreshFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if somsr.Response.Response, err = future.GetResult(sender); err == nil && somsr.Response.Response.StatusCode != http.StatusNoContent { - somsr, err = client.RefreshResponder(somsr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataRefreshFuture", "Result", somsr.Response.Response, "Failure responding to request") - } - } - return -} - -// IntegrationRuntimeRegenerateKeyParameters parameters to regenerate the authentication key. -type IntegrationRuntimeRegenerateKeyParameters struct { - // KeyName - The name of the authentication key to regenerate. Possible values include: 'AuthKey1', 'AuthKey2' - KeyName IntegrationRuntimeAuthKeyName `json:"keyName,omitempty"` -} - -// IntegrationRuntimeResource integration runtime resource type. -type IntegrationRuntimeResource struct { - autorest.Response `json:"-"` - // Properties - Integration runtime properties. - Properties BasicIntegrationRuntime `json:"properties,omitempty"` - // 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 IntegrationRuntimeResource. -func (irr IntegrationRuntimeResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = irr.Properties - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeResource struct. -func (irr *IntegrationRuntimeResource) 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 { - properties, err := unmarshalBasicIntegrationRuntime(*v) - if err != nil { - return err - } - irr.Properties = properties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - irr.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - irr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - irr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - irr.Type = &typeVar - } - } - } - - return nil -} - -// IntegrationRuntimesCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IntegrationRuntimesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (IntegrationRuntimeResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesCreateFuture) 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 IntegrationRuntimesCreateFuture.Result. -func (future *IntegrationRuntimesCreateFuture) result(client IntegrationRuntimesClient) (irr IntegrationRuntimeResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - irr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if irr.Response.Response, err = future.GetResult(sender); err == nil && irr.Response.Response.StatusCode != http.StatusNoContent { - irr, err = client.CreateResponder(irr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesCreateFuture", "Result", irr.Response.Response, "Failure responding to request") - } - } - return -} - -// IntegrationRuntimesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IntegrationRuntimesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesDeleteFuture) 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 IntegrationRuntimesDeleteFuture.Result. -func (future *IntegrationRuntimesDeleteFuture) result(client IntegrationRuntimesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// IntegrationRuntimesDisableInteractiveQueryFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type IntegrationRuntimesDisableInteractiveQueryFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesDisableInteractiveQueryFuture) 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 IntegrationRuntimesDisableInteractiveQueryFuture.Result. -func (future *IntegrationRuntimesDisableInteractiveQueryFuture) result(client IntegrationRuntimesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesDisableInteractiveQueryFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesDisableInteractiveQueryFuture") - return - } - ar.Response = future.Response() - return -} - -// IntegrationRuntimesEnableInteractiveQueryFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type IntegrationRuntimesEnableInteractiveQueryFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesEnableInteractiveQueryFuture) 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 IntegrationRuntimesEnableInteractiveQueryFuture.Result. -func (future *IntegrationRuntimesEnableInteractiveQueryFuture) result(client IntegrationRuntimesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesEnableInteractiveQueryFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesEnableInteractiveQueryFuture") - return - } - ar.Response = future.Response() - return -} - -// IntegrationRuntimeSsisCatalogInfo catalog information for managed dedicated integration runtime. -type IntegrationRuntimeSsisCatalogInfo struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // CatalogServerEndpoint - The catalog database server URL. - CatalogServerEndpoint *string `json:"catalogServerEndpoint,omitempty"` - // CatalogAdminUserName - The administrator user name of catalog database. - CatalogAdminUserName *string `json:"catalogAdminUserName,omitempty"` - // CatalogAdminPassword - The password of the administrator user account of the catalog database. - CatalogAdminPassword *SecureString `json:"catalogAdminPassword,omitempty"` - // CatalogPricingTier - The pricing tier for the catalog database. The valid values could be found in https://azure.microsoft.com/en-us/pricing/details/sql-database/. Possible values include: 'IntegrationRuntimeSsisCatalogPricingTierBasic', 'IntegrationRuntimeSsisCatalogPricingTierStandard', 'IntegrationRuntimeSsisCatalogPricingTierPremium', 'IntegrationRuntimeSsisCatalogPricingTierPremiumRS' - CatalogPricingTier IntegrationRuntimeSsisCatalogPricingTier `json:"catalogPricingTier,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeSsisCatalogInfo. -func (irsci IntegrationRuntimeSsisCatalogInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if irsci.CatalogServerEndpoint != nil { - objectMap["catalogServerEndpoint"] = irsci.CatalogServerEndpoint - } - if irsci.CatalogAdminUserName != nil { - objectMap["catalogAdminUserName"] = irsci.CatalogAdminUserName - } - if irsci.CatalogAdminPassword != nil { - objectMap["catalogAdminPassword"] = irsci.CatalogAdminPassword - } - if irsci.CatalogPricingTier != "" { - objectMap["catalogPricingTier"] = irsci.CatalogPricingTier - } - for k, v := range irsci.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeSsisCatalogInfo struct. -func (irsci *IntegrationRuntimeSsisCatalogInfo) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irsci.AdditionalProperties == nil { - irsci.AdditionalProperties = make(map[string]interface{}) - } - irsci.AdditionalProperties[k] = additionalProperties - } - case "catalogServerEndpoint": - if v != nil { - var catalogServerEndpoint string - err = json.Unmarshal(*v, &catalogServerEndpoint) - if err != nil { - return err - } - irsci.CatalogServerEndpoint = &catalogServerEndpoint - } - case "catalogAdminUserName": - if v != nil { - var catalogAdminUserName string - err = json.Unmarshal(*v, &catalogAdminUserName) - if err != nil { - return err - } - irsci.CatalogAdminUserName = &catalogAdminUserName - } - case "catalogAdminPassword": - if v != nil { - var catalogAdminPassword SecureString - err = json.Unmarshal(*v, &catalogAdminPassword) - if err != nil { - return err - } - irsci.CatalogAdminPassword = &catalogAdminPassword - } - case "catalogPricingTier": - if v != nil { - var catalogPricingTier IntegrationRuntimeSsisCatalogPricingTier - err = json.Unmarshal(*v, &catalogPricingTier) - if err != nil { - return err - } - irsci.CatalogPricingTier = catalogPricingTier - } - } - } - - return nil -} - -// IntegrationRuntimeSsisProperties SSIS properties for managed integration runtime. -type IntegrationRuntimeSsisProperties struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // CatalogInfo - Catalog information for managed dedicated integration runtime. - CatalogInfo *IntegrationRuntimeSsisCatalogInfo `json:"catalogInfo,omitempty"` - // LicenseType - License type for bringing your own license scenario. Possible values include: 'BasePrice', 'LicenseIncluded' - LicenseType IntegrationRuntimeLicenseType `json:"licenseType,omitempty"` - // CustomSetupScriptProperties - Custom setup script properties for a managed dedicated integration runtime. - CustomSetupScriptProperties *IntegrationRuntimeCustomSetupScriptProperties `json:"customSetupScriptProperties,omitempty"` - // DataProxyProperties - Data proxy properties for a managed dedicated integration runtime. - DataProxyProperties *IntegrationRuntimeDataProxyProperties `json:"dataProxyProperties,omitempty"` - // Edition - The edition for the SSIS Integration Runtime. Possible values include: 'Standard', 'Enterprise' - Edition IntegrationRuntimeEdition `json:"edition,omitempty"` - // ExpressCustomSetupProperties - Custom setup without script properties for a SSIS integration runtime. - ExpressCustomSetupProperties *[]BasicCustomSetupBase `json:"expressCustomSetupProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeSsisProperties. -func (irsp IntegrationRuntimeSsisProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if irsp.CatalogInfo != nil { - objectMap["catalogInfo"] = irsp.CatalogInfo - } - if irsp.LicenseType != "" { - objectMap["licenseType"] = irsp.LicenseType - } - if irsp.CustomSetupScriptProperties != nil { - objectMap["customSetupScriptProperties"] = irsp.CustomSetupScriptProperties - } - if irsp.DataProxyProperties != nil { - objectMap["dataProxyProperties"] = irsp.DataProxyProperties - } - if irsp.Edition != "" { - objectMap["edition"] = irsp.Edition - } - if irsp.ExpressCustomSetupProperties != nil { - objectMap["expressCustomSetupProperties"] = irsp.ExpressCustomSetupProperties - } - for k, v := range irsp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeSsisProperties struct. -func (irsp *IntegrationRuntimeSsisProperties) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irsp.AdditionalProperties == nil { - irsp.AdditionalProperties = make(map[string]interface{}) - } - irsp.AdditionalProperties[k] = additionalProperties - } - case "catalogInfo": - if v != nil { - var catalogInfo IntegrationRuntimeSsisCatalogInfo - err = json.Unmarshal(*v, &catalogInfo) - if err != nil { - return err - } - irsp.CatalogInfo = &catalogInfo - } - case "licenseType": - if v != nil { - var licenseType IntegrationRuntimeLicenseType - err = json.Unmarshal(*v, &licenseType) - if err != nil { - return err - } - irsp.LicenseType = licenseType - } - case "customSetupScriptProperties": - if v != nil { - var customSetupScriptProperties IntegrationRuntimeCustomSetupScriptProperties - err = json.Unmarshal(*v, &customSetupScriptProperties) - if err != nil { - return err - } - irsp.CustomSetupScriptProperties = &customSetupScriptProperties - } - case "dataProxyProperties": - if v != nil { - var dataProxyProperties IntegrationRuntimeDataProxyProperties - err = json.Unmarshal(*v, &dataProxyProperties) - if err != nil { - return err - } - irsp.DataProxyProperties = &dataProxyProperties - } - case "edition": - if v != nil { - var edition IntegrationRuntimeEdition - err = json.Unmarshal(*v, &edition) - if err != nil { - return err - } - irsp.Edition = edition - } - case "expressCustomSetupProperties": - if v != nil { - expressCustomSetupProperties, err := unmarshalBasicCustomSetupBaseArray(*v) - if err != nil { - return err - } - irsp.ExpressCustomSetupProperties = &expressCustomSetupProperties - } - } - } - - return nil -} - -// IntegrationRuntimesStartFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IntegrationRuntimesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (IntegrationRuntimeStatusResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesStartFuture) 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 IntegrationRuntimesStartFuture.Result. -func (future *IntegrationRuntimesStartFuture) result(client IntegrationRuntimesClient) (irsr IntegrationRuntimeStatusResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - irsr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesStartFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if irsr.Response.Response, err = future.GetResult(sender); err == nil && irsr.Response.Response.StatusCode != http.StatusNoContent { - irsr, err = client.StartResponder(irsr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesStartFuture", "Result", irsr.Response.Response, "Failure responding to request") - } - } - return -} - -// IntegrationRuntimesStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type IntegrationRuntimesStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesStopFuture) 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 IntegrationRuntimesStopFuture.Result. -func (future *IntegrationRuntimesStopFuture) result(client IntegrationRuntimesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesStopFuture") - return - } - ar.Response = future.Response() - return -} - -// BasicIntegrationRuntimeStatus integration runtime status. -type BasicIntegrationRuntimeStatus interface { - AsManagedIntegrationRuntimeStatus() (*ManagedIntegrationRuntimeStatus, bool) - AsSelfHostedIntegrationRuntimeStatus() (*SelfHostedIntegrationRuntimeStatus, bool) - AsIntegrationRuntimeStatus() (*IntegrationRuntimeStatus, bool) -} - -// IntegrationRuntimeStatus integration runtime status. -type IntegrationRuntimeStatus struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // DataFactoryName - READ-ONLY; The workspace name which the integration runtime belong to. - DataFactoryName *string `json:"dataFactoryName,omitempty"` - // State - READ-ONLY; The state of integration runtime. Possible values include: 'Initial', 'Stopped', 'Started', 'Starting', 'Stopping', 'NeedRegistration', 'Online', 'Limited', 'Offline', 'AccessDenied' - State IntegrationRuntimeState `json:"state,omitempty"` - // Type - Possible values include: 'TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus', 'TypeBasicIntegrationRuntimeStatusTypeManaged', 'TypeBasicIntegrationRuntimeStatusTypeSelfHosted' - Type TypeBasicIntegrationRuntimeStatus `json:"type,omitempty"` -} - -func unmarshalBasicIntegrationRuntimeStatus(body []byte) (BasicIntegrationRuntimeStatus, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicIntegrationRuntimeStatusTypeManaged): - var mirs ManagedIntegrationRuntimeStatus - err := json.Unmarshal(body, &mirs) - return mirs, err - case string(TypeBasicIntegrationRuntimeStatusTypeSelfHosted): - var shirs SelfHostedIntegrationRuntimeStatus - err := json.Unmarshal(body, &shirs) - return shirs, err - default: - var irs IntegrationRuntimeStatus - err := json.Unmarshal(body, &irs) - return irs, err - } -} -func unmarshalBasicIntegrationRuntimeStatusArray(body []byte) ([]BasicIntegrationRuntimeStatus, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - irsArray := make([]BasicIntegrationRuntimeStatus, len(rawMessages)) - - for index, rawMessage := range rawMessages { - irs, err := unmarshalBasicIntegrationRuntimeStatus(*rawMessage) - if err != nil { - return nil, err - } - irsArray[index] = irs - } - return irsArray, nil -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) MarshalJSON() ([]byte, error) { - irs.Type = TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus - objectMap := make(map[string]interface{}) - if irs.Type != "" { - objectMap["type"] = irs.Type - } - for k, v := range irs.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) AsManagedIntegrationRuntimeStatus() (*ManagedIntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsSelfHostedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) AsSelfHostedIntegrationRuntimeStatus() (*SelfHostedIntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) AsIntegrationRuntimeStatus() (*IntegrationRuntimeStatus, bool) { - return &irs, true -} - -// AsBasicIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) AsBasicIntegrationRuntimeStatus() (BasicIntegrationRuntimeStatus, bool) { - return &irs, true -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeStatus struct. -func (irs *IntegrationRuntimeStatus) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irs.AdditionalProperties == nil { - irs.AdditionalProperties = make(map[string]interface{}) - } - irs.AdditionalProperties[k] = additionalProperties - } - case "dataFactoryName": - if v != nil { - var dataFactoryName string - err = json.Unmarshal(*v, &dataFactoryName) - if err != nil { - return err - } - irs.DataFactoryName = &dataFactoryName - } - case "state": - if v != nil { - var state IntegrationRuntimeState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - irs.State = state - } - case "type": - if v != nil { - var typeVar TypeBasicIntegrationRuntimeStatus - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - irs.Type = typeVar - } - } - } - - return nil -} - -// IntegrationRuntimeStatusResponse integration runtime status response. -type IntegrationRuntimeStatusResponse struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; The integration runtime name. - Name *string `json:"name,omitempty"` - // Properties - Integration runtime properties. - Properties BasicIntegrationRuntimeStatus `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeStatusResponse. -func (irsr IntegrationRuntimeStatusResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = irsr.Properties - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeStatusResponse struct. -func (irsr *IntegrationRuntimeStatusResponse) 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 - } - irsr.Name = &name - } - case "properties": - if v != nil { - properties, err := unmarshalBasicIntegrationRuntimeStatus(*v) - if err != nil { - return err - } - irsr.Properties = properties - } - } - } - - return nil -} - -// IntegrationRuntimeVNetProperties vNet properties for managed integration runtime. -type IntegrationRuntimeVNetProperties struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // VNetID - The ID of the VNet that this integration runtime will join. - VNetID *string `json:"vNetId,omitempty"` - // Subnet - The name of the subnet this integration runtime will join. - Subnet *string `json:"subnet,omitempty"` - // PublicIPs - Resource IDs of the public IP addresses that this integration runtime will use. - PublicIPs *[]string `json:"publicIPs,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeVNetProperties. -func (irvnp IntegrationRuntimeVNetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if irvnp.VNetID != nil { - objectMap["vNetId"] = irvnp.VNetID - } - if irvnp.Subnet != nil { - objectMap["subnet"] = irvnp.Subnet - } - if irvnp.PublicIPs != nil { - objectMap["publicIPs"] = irvnp.PublicIPs - } - for k, v := range irvnp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeVNetProperties struct. -func (irvnp *IntegrationRuntimeVNetProperties) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irvnp.AdditionalProperties == nil { - irvnp.AdditionalProperties = make(map[string]interface{}) - } - irvnp.AdditionalProperties[k] = additionalProperties - } - case "vNetId": - if v != nil { - var vNetID string - err = json.Unmarshal(*v, &vNetID) - if err != nil { - return err - } - irvnp.VNetID = &vNetID - } - case "subnet": - if v != nil { - var subnet string - err = json.Unmarshal(*v, &subnet) - if err != nil { - return err - } - irvnp.Subnet = &subnet - } - case "publicIPs": - if v != nil { - var publicIPs []string - err = json.Unmarshal(*v, &publicIPs) - if err != nil { - return err - } - irvnp.PublicIPs = &publicIPs - } - } - } - - return nil -} - -// IPFirewallRuleInfo IP firewall rule -type IPFirewallRuleInfo struct { - autorest.Response `json:"-"` - // IPFirewallRuleProperties - IP firewall rule properties - *IPFirewallRuleProperties `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 IPFirewallRuleInfo. -func (ifri IPFirewallRuleInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ifri.IPFirewallRuleProperties != nil { - objectMap["properties"] = ifri.IPFirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IPFirewallRuleInfo struct. -func (ifri *IPFirewallRuleInfo) 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 IPFirewallRuleProperties IPFirewallRuleProperties - err = json.Unmarshal(*v, &IPFirewallRuleProperties) - if err != nil { - return err - } - ifri.IPFirewallRuleProperties = &IPFirewallRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ifri.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ifri.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ifri.Type = &typeVar - } - } - } - - return nil -} - -// IPFirewallRuleInfoListResult list of IP firewall rules -type IPFirewallRuleInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of IP firewall rules - Value *[]IPFirewallRuleInfo `json:"value,omitempty"` -} - -// IPFirewallRuleInfoListResultIterator provides access to a complete listing of IPFirewallRuleInfo values. -type IPFirewallRuleInfoListResultIterator struct { - i int - page IPFirewallRuleInfoListResultPage -} - -// 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 *IPFirewallRuleInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRuleInfoListResultIterator.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 *IPFirewallRuleInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IPFirewallRuleInfoListResultIterator) 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 IPFirewallRuleInfoListResultIterator) Response() IPFirewallRuleInfoListResult { - 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 IPFirewallRuleInfoListResultIterator) Value() IPFirewallRuleInfo { - if !iter.page.NotDone() { - return IPFirewallRuleInfo{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IPFirewallRuleInfoListResultIterator type. -func NewIPFirewallRuleInfoListResultIterator(page IPFirewallRuleInfoListResultPage) IPFirewallRuleInfoListResultIterator { - return IPFirewallRuleInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ifrilr IPFirewallRuleInfoListResult) IsEmpty() bool { - return ifrilr.Value == nil || len(*ifrilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ifrilr IPFirewallRuleInfoListResult) hasNextLink() bool { - return ifrilr.NextLink != nil && len(*ifrilr.NextLink) != 0 -} - -// iPFirewallRuleInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ifrilr IPFirewallRuleInfoListResult) iPFirewallRuleInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ifrilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ifrilr.NextLink))) -} - -// IPFirewallRuleInfoListResultPage contains a page of IPFirewallRuleInfo values. -type IPFirewallRuleInfoListResultPage struct { - fn func(context.Context, IPFirewallRuleInfoListResult) (IPFirewallRuleInfoListResult, error) - ifrilr IPFirewallRuleInfoListResult -} - -// 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 *IPFirewallRuleInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRuleInfoListResultPage.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.ifrilr) - if err != nil { - return err - } - page.ifrilr = 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 *IPFirewallRuleInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IPFirewallRuleInfoListResultPage) NotDone() bool { - return !page.ifrilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IPFirewallRuleInfoListResultPage) Response() IPFirewallRuleInfoListResult { - return page.ifrilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IPFirewallRuleInfoListResultPage) Values() []IPFirewallRuleInfo { - if page.ifrilr.IsEmpty() { - return nil - } - return *page.ifrilr.Value -} - -// Creates a new instance of the IPFirewallRuleInfoListResultPage type. -func NewIPFirewallRuleInfoListResultPage(cur IPFirewallRuleInfoListResult, getNextPage func(context.Context, IPFirewallRuleInfoListResult) (IPFirewallRuleInfoListResult, error)) IPFirewallRuleInfoListResultPage { - return IPFirewallRuleInfoListResultPage{ - fn: getNextPage, - ifrilr: cur, - } -} - -// IPFirewallRuleProperties IP firewall rule properties -type IPFirewallRuleProperties struct { - // EndIPAddress - The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress - EndIPAddress *string `json:"endIpAddress,omitempty"` - // ProvisioningState - READ-ONLY; Resource provisioning state. Possible values include: 'ProvisioningStateProvisioning', 'ProvisioningStateSucceeded', 'ProvisioningStateDeleting', 'ProvisioningStateFailed', 'ProvisioningStateDeleteError' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // StartIPAddress - The start IP address of the firewall rule. Must be IPv4 format - StartIPAddress *string `json:"startIpAddress,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPFirewallRuleProperties. -func (ifrp IPFirewallRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ifrp.EndIPAddress != nil { - objectMap["endIpAddress"] = ifrp.EndIPAddress - } - if ifrp.StartIPAddress != nil { - objectMap["startIpAddress"] = ifrp.StartIPAddress - } - return json.Marshal(objectMap) -} - -// IPFirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IPFirewallRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPFirewallRulesClient) (IPFirewallRuleInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPFirewallRulesCreateOrUpdateFuture) 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 IPFirewallRulesCreateOrUpdateFuture.Result. -func (future *IPFirewallRulesCreateOrUpdateFuture) result(client IPFirewallRulesClient) (ifri IPFirewallRuleInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifri.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IPFirewallRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifri.Response.Response, err = future.GetResult(sender); err == nil && ifri.Response.Response.StatusCode != http.StatusNoContent { - ifri, err = client.CreateOrUpdateResponder(ifri.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesCreateOrUpdateFuture", "Result", ifri.Response.Response, "Failure responding to request") - } - } - return -} - -// IPFirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type IPFirewallRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPFirewallRulesClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPFirewallRulesDeleteFuture) 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 IPFirewallRulesDeleteFuture.Result. -func (future *IPFirewallRulesDeleteFuture) result(client IPFirewallRulesClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IPFirewallRulesDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.DeleteResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesDeleteFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// IPFirewallRulesReplaceAllFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IPFirewallRulesReplaceAllFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPFirewallRulesClient) (ReplaceAllFirewallRulesOperationResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPFirewallRulesReplaceAllFuture) 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 IPFirewallRulesReplaceAllFuture.Result. -func (future *IPFirewallRulesReplaceAllFuture) result(client IPFirewallRulesClient) (rafror ReplaceAllFirewallRulesOperationResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesReplaceAllFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rafror.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IPFirewallRulesReplaceAllFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rafror.Response.Response, err = future.GetResult(sender); err == nil && rafror.Response.Response.StatusCode != http.StatusNoContent { - rafror, err = client.ReplaceAllResponder(rafror.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesReplaceAllFuture", "Result", rafror.Response.Response, "Failure responding to request") - } - } - return -} - -// Key a workspace key -type Key struct { - autorest.Response `json:"-"` - // KeyProperties - Keys resource properties - *KeyProperties `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 Key. -func (kVar Key) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kVar.KeyProperties != nil { - objectMap["properties"] = kVar.KeyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Key struct. -func (kVar *Key) 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 keyProperties KeyProperties - err = json.Unmarshal(*v, &keyProperties) - if err != nil { - return err - } - kVar.KeyProperties = &keyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - kVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - kVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - kVar.Type = &typeVar - } - } - } - - return nil -} - -// KeyInfoListResult list of keys -type KeyInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of keys - Value *[]Key `json:"value,omitempty"` -} - -// KeyInfoListResultIterator provides access to a complete listing of Key values. -type KeyInfoListResultIterator struct { - i int - page KeyInfoListResultPage -} - -// 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 *KeyInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeyInfoListResultIterator.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 *KeyInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter KeyInfoListResultIterator) 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 KeyInfoListResultIterator) Response() KeyInfoListResult { - 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 KeyInfoListResultIterator) Value() Key { - if !iter.page.NotDone() { - return Key{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the KeyInfoListResultIterator type. -func NewKeyInfoListResultIterator(page KeyInfoListResultPage) KeyInfoListResultIterator { - return KeyInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (kilr KeyInfoListResult) IsEmpty() bool { - return kilr.Value == nil || len(*kilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (kilr KeyInfoListResult) hasNextLink() bool { - return kilr.NextLink != nil && len(*kilr.NextLink) != 0 -} - -// keyInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (kilr KeyInfoListResult) keyInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !kilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(kilr.NextLink))) -} - -// KeyInfoListResultPage contains a page of Key values. -type KeyInfoListResultPage struct { - fn func(context.Context, KeyInfoListResult) (KeyInfoListResult, error) - kilr KeyInfoListResult -} - -// 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 *KeyInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeyInfoListResultPage.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.kilr) - if err != nil { - return err - } - page.kilr = 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 *KeyInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page KeyInfoListResultPage) NotDone() bool { - return !page.kilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page KeyInfoListResultPage) Response() KeyInfoListResult { - return page.kilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page KeyInfoListResultPage) Values() []Key { - if page.kilr.IsEmpty() { - return nil - } - return *page.kilr.Value -} - -// Creates a new instance of the KeyInfoListResultPage type. -func NewKeyInfoListResultPage(cur KeyInfoListResult, getNextPage func(context.Context, KeyInfoListResult) (KeyInfoListResult, error)) KeyInfoListResultPage { - return KeyInfoListResultPage{ - fn: getNextPage, - kilr: cur, - } -} - -// KeyProperties key properties -type KeyProperties struct { - // IsActiveCMK - Used to activate the workspace after a customer managed key is provided. - IsActiveCMK *bool `json:"isActiveCMK,omitempty"` - // KeyVaultURL - The Key Vault Url of the workspace key. - KeyVaultURL *string `json:"keyVaultUrl,omitempty"` -} - -// LibraryRequirements library requirements for a Big Data pool powered by Apache Spark -type LibraryRequirements struct { - // Time - READ-ONLY; The last update time of the library requirements file. - Time *date.Time `json:"time,omitempty"` - // Content - The library requirements. - Content *string `json:"content,omitempty"` - // Filename - The filename of the library requirements file. - Filename *string `json:"filename,omitempty"` -} - -// MarshalJSON is the custom marshaler for LibraryRequirements. -func (lr LibraryRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lr.Content != nil { - objectMap["content"] = lr.Content - } - if lr.Filename != nil { - objectMap["filename"] = lr.Filename - } - return json.Marshal(objectMap) -} - -// LicensedComponentSetupTypeProperties installation of licensed component setup type properties. -type LicensedComponentSetupTypeProperties struct { - // ComponentName - The name of the 3rd party component. - ComponentName *string `json:"componentName,omitempty"` - // LicenseKey - The license key to activate the component. - LicenseKey BasicSecretBase `json:"licenseKey,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for LicensedComponentSetupTypeProperties struct. -func (lcstp *LicensedComponentSetupTypeProperties) 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 "componentName": - if v != nil { - var componentName string - err = json.Unmarshal(*v, &componentName) - if err != nil { - return err - } - lcstp.ComponentName = &componentName - } - case "licenseKey": - if v != nil { - licenseKey, err := unmarshalBasicSecretBase(*v) - if err != nil { - return err - } - lcstp.LicenseKey = licenseKey - } - } - } - - return nil -} - -// LinkedIntegrationRuntime the linked integration runtime information. -type LinkedIntegrationRuntime struct { - // Name - READ-ONLY; The name of the linked integration runtime. - Name *string `json:"name,omitempty"` - // SubscriptionID - READ-ONLY; The subscription ID for which the linked integration runtime belong to. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // DataFactoryName - READ-ONLY; The name of the workspace for which the linked integration runtime belong to. - DataFactoryName *string `json:"dataFactoryName,omitempty"` - // DataFactoryLocation - READ-ONLY; The location of the workspace for which the linked integration runtime belong to. - DataFactoryLocation *string `json:"dataFactoryLocation,omitempty"` - // CreateTime - READ-ONLY; The creating time of the linked integration runtime. - CreateTime *date.Time `json:"createTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedIntegrationRuntime. -func (lir LinkedIntegrationRuntime) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LinkedIntegrationRuntimeKeyAuthorization the key authorization type integration runtime. -type LinkedIntegrationRuntimeKeyAuthorization struct { - // Key - The key used for authorization. - Key *SecureString `json:"key,omitempty"` - // AuthorizationType - Possible values include: 'AuthorizationTypeLinkedIntegrationRuntimeType', 'AuthorizationTypeKey', 'AuthorizationTypeRBAC' - AuthorizationType AuthorizationType `json:"authorizationType,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) MarshalJSON() ([]byte, error) { - lirka.AuthorizationType = AuthorizationTypeKey - objectMap := make(map[string]interface{}) - if lirka.Key != nil { - objectMap["key"] = lirka.Key - } - if lirka.AuthorizationType != "" { - objectMap["authorizationType"] = lirka.AuthorizationType - } - return json.Marshal(objectMap) -} - -// AsLinkedIntegrationRuntimeKeyAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) AsLinkedIntegrationRuntimeKeyAuthorization() (*LinkedIntegrationRuntimeKeyAuthorization, bool) { - return &lirka, true -} - -// AsLinkedIntegrationRuntimeRbacAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) AsLinkedIntegrationRuntimeRbacAuthorization() (*LinkedIntegrationRuntimeRbacAuthorization, bool) { - return nil, false -} - -// AsLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) AsLinkedIntegrationRuntimeType() (*LinkedIntegrationRuntimeType, bool) { - return nil, false -} - -// AsBasicLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) AsBasicLinkedIntegrationRuntimeType() (BasicLinkedIntegrationRuntimeType, bool) { - return &lirka, true -} - -// LinkedIntegrationRuntimeRbacAuthorization the role based access control (RBAC) authorization type -// integration runtime. -type LinkedIntegrationRuntimeRbacAuthorization struct { - // ResourceID - The resource identifier of the integration runtime to be shared. - ResourceID *string `json:"resourceId,omitempty"` - // AuthorizationType - Possible values include: 'AuthorizationTypeLinkedIntegrationRuntimeType', 'AuthorizationTypeKey', 'AuthorizationTypeRBAC' - AuthorizationType AuthorizationType `json:"authorizationType,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) MarshalJSON() ([]byte, error) { - lirra.AuthorizationType = AuthorizationTypeRBAC - objectMap := make(map[string]interface{}) - if lirra.ResourceID != nil { - objectMap["resourceId"] = lirra.ResourceID - } - if lirra.AuthorizationType != "" { - objectMap["authorizationType"] = lirra.AuthorizationType - } - return json.Marshal(objectMap) -} - -// AsLinkedIntegrationRuntimeKeyAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) AsLinkedIntegrationRuntimeKeyAuthorization() (*LinkedIntegrationRuntimeKeyAuthorization, bool) { - return nil, false -} - -// AsLinkedIntegrationRuntimeRbacAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) AsLinkedIntegrationRuntimeRbacAuthorization() (*LinkedIntegrationRuntimeRbacAuthorization, bool) { - return &lirra, true -} - -// AsLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) AsLinkedIntegrationRuntimeType() (*LinkedIntegrationRuntimeType, bool) { - return nil, false -} - -// AsBasicLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) AsBasicLinkedIntegrationRuntimeType() (BasicLinkedIntegrationRuntimeType, bool) { - return &lirra, true -} - -// BasicLinkedIntegrationRuntimeType the base definition of a linked integration runtime. -type BasicLinkedIntegrationRuntimeType interface { - AsLinkedIntegrationRuntimeKeyAuthorization() (*LinkedIntegrationRuntimeKeyAuthorization, bool) - AsLinkedIntegrationRuntimeRbacAuthorization() (*LinkedIntegrationRuntimeRbacAuthorization, bool) - AsLinkedIntegrationRuntimeType() (*LinkedIntegrationRuntimeType, bool) -} - -// LinkedIntegrationRuntimeType the base definition of a linked integration runtime. -type LinkedIntegrationRuntimeType struct { - // AuthorizationType - Possible values include: 'AuthorizationTypeLinkedIntegrationRuntimeType', 'AuthorizationTypeKey', 'AuthorizationTypeRBAC' - AuthorizationType AuthorizationType `json:"authorizationType,omitempty"` -} - -func unmarshalBasicLinkedIntegrationRuntimeType(body []byte) (BasicLinkedIntegrationRuntimeType, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["authorizationType"] { - case string(AuthorizationTypeKey): - var lirka LinkedIntegrationRuntimeKeyAuthorization - err := json.Unmarshal(body, &lirka) - return lirka, err - case string(AuthorizationTypeRBAC): - var lirra LinkedIntegrationRuntimeRbacAuthorization - err := json.Unmarshal(body, &lirra) - return lirra, err - default: - var lirt LinkedIntegrationRuntimeType - err := json.Unmarshal(body, &lirt) - return lirt, err - } -} -func unmarshalBasicLinkedIntegrationRuntimeTypeArray(body []byte) ([]BasicLinkedIntegrationRuntimeType, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - lirtArray := make([]BasicLinkedIntegrationRuntimeType, len(rawMessages)) - - for index, rawMessage := range rawMessages { - lirt, err := unmarshalBasicLinkedIntegrationRuntimeType(*rawMessage) - if err != nil { - return nil, err - } - lirtArray[index] = lirt - } - return lirtArray, nil -} - -// MarshalJSON is the custom marshaler for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) MarshalJSON() ([]byte, error) { - lirt.AuthorizationType = AuthorizationTypeLinkedIntegrationRuntimeType - objectMap := make(map[string]interface{}) - if lirt.AuthorizationType != "" { - objectMap["authorizationType"] = lirt.AuthorizationType - } - return json.Marshal(objectMap) -} - -// AsLinkedIntegrationRuntimeKeyAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) AsLinkedIntegrationRuntimeKeyAuthorization() (*LinkedIntegrationRuntimeKeyAuthorization, bool) { - return nil, false -} - -// AsLinkedIntegrationRuntimeRbacAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) AsLinkedIntegrationRuntimeRbacAuthorization() (*LinkedIntegrationRuntimeRbacAuthorization, bool) { - return nil, false -} - -// AsLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) AsLinkedIntegrationRuntimeType() (*LinkedIntegrationRuntimeType, bool) { - return &lirt, true -} - -// AsBasicLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) AsBasicLinkedIntegrationRuntimeType() (BasicLinkedIntegrationRuntimeType, bool) { - return &lirt, true -} - -// ListAvailableRpOperation ... -type ListAvailableRpOperation struct { - autorest.Response `json:"-"` - Value *[]AvailableRpOperation `json:"value,omitempty"` -} - -// ListSQLPoolSecurityAlertPolicies a list of SQL pool security alert policies. -type ListSQLPoolSecurityAlertPolicies struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListSQLPoolSecurityAlertPolicies. -func (lspsap ListSQLPoolSecurityAlertPolicies) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListSQLPoolSecurityAlertPoliciesIterator provides access to a complete listing of -// SQLPoolSecurityAlertPolicy values. -type ListSQLPoolSecurityAlertPoliciesIterator struct { - i int - page ListSQLPoolSecurityAlertPoliciesPage -} - -// 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 *ListSQLPoolSecurityAlertPoliciesIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListSQLPoolSecurityAlertPoliciesIterator.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 *ListSQLPoolSecurityAlertPoliciesIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListSQLPoolSecurityAlertPoliciesIterator) 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 ListSQLPoolSecurityAlertPoliciesIterator) Response() ListSQLPoolSecurityAlertPolicies { - 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 ListSQLPoolSecurityAlertPoliciesIterator) Value() SQLPoolSecurityAlertPolicy { - if !iter.page.NotDone() { - return SQLPoolSecurityAlertPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListSQLPoolSecurityAlertPoliciesIterator type. -func NewListSQLPoolSecurityAlertPoliciesIterator(page ListSQLPoolSecurityAlertPoliciesPage) ListSQLPoolSecurityAlertPoliciesIterator { - return ListSQLPoolSecurityAlertPoliciesIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lspsap ListSQLPoolSecurityAlertPolicies) IsEmpty() bool { - return lspsap.Value == nil || len(*lspsap.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lspsap ListSQLPoolSecurityAlertPolicies) hasNextLink() bool { - return lspsap.NextLink != nil && len(*lspsap.NextLink) != 0 -} - -// listSQLPoolSecurityAlertPoliciesPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lspsap ListSQLPoolSecurityAlertPolicies) listSQLPoolSecurityAlertPoliciesPreparer(ctx context.Context) (*http.Request, error) { - if !lspsap.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lspsap.NextLink))) -} - -// ListSQLPoolSecurityAlertPoliciesPage contains a page of SQLPoolSecurityAlertPolicy values. -type ListSQLPoolSecurityAlertPoliciesPage struct { - fn func(context.Context, ListSQLPoolSecurityAlertPolicies) (ListSQLPoolSecurityAlertPolicies, error) - lspsap ListSQLPoolSecurityAlertPolicies -} - -// 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 *ListSQLPoolSecurityAlertPoliciesPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListSQLPoolSecurityAlertPoliciesPage.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.lspsap) - if err != nil { - return err - } - page.lspsap = 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 *ListSQLPoolSecurityAlertPoliciesPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListSQLPoolSecurityAlertPoliciesPage) NotDone() bool { - return !page.lspsap.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListSQLPoolSecurityAlertPoliciesPage) Response() ListSQLPoolSecurityAlertPolicies { - return page.lspsap -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListSQLPoolSecurityAlertPoliciesPage) Values() []SQLPoolSecurityAlertPolicy { - if page.lspsap.IsEmpty() { - return nil - } - return *page.lspsap.Value -} - -// Creates a new instance of the ListSQLPoolSecurityAlertPoliciesPage type. -func NewListSQLPoolSecurityAlertPoliciesPage(cur ListSQLPoolSecurityAlertPolicies, getNextPage func(context.Context, ListSQLPoolSecurityAlertPolicies) (ListSQLPoolSecurityAlertPolicies, error)) ListSQLPoolSecurityAlertPoliciesPage { - return ListSQLPoolSecurityAlertPoliciesPage{ - fn: getNextPage, - lspsap: cur, - } -} - -// ManagedIdentity the workspace managed identity -type ManagedIdentity struct { - // PrincipalID - READ-ONLY; The principal ID of the workspace managed identity - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of the workspace managed identity - TenantID *uuid.UUID `json:"tenantId,omitempty"` - // Type - The type of managed identity for the workspace. Possible values include: 'ResourceIdentityTypeNone', 'ResourceIdentityTypeSystemAssigned' - Type ResourceIdentityType `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIdentity. -func (mi ManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mi.Type != "" { - objectMap["type"] = mi.Type - } - return json.Marshal(objectMap) -} - -// ManagedIdentitySQLControlSettingsModel sql Control Settings for workspace managed identity -type ManagedIdentitySQLControlSettingsModel struct { - autorest.Response `json:"-"` - // ManagedIdentitySQLControlSettingsModelProperties - Sql Control Settings for workspace managed identity - *ManagedIdentitySQLControlSettingsModelProperties `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 ManagedIdentitySQLControlSettingsModel. -func (miscsm ManagedIdentitySQLControlSettingsModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miscsm.ManagedIdentitySQLControlSettingsModelProperties != nil { - objectMap["properties"] = miscsm.ManagedIdentitySQLControlSettingsModelProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedIdentitySQLControlSettingsModel struct. -func (miscsm *ManagedIdentitySQLControlSettingsModel) 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 managedIdentitySQLControlSettingsModelProperties ManagedIdentitySQLControlSettingsModelProperties - err = json.Unmarshal(*v, &managedIdentitySQLControlSettingsModelProperties) - if err != nil { - return err - } - miscsm.ManagedIdentitySQLControlSettingsModelProperties = &managedIdentitySQLControlSettingsModelProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - miscsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - miscsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - miscsm.Type = &typeVar - } - } - } - - return nil -} - -// ManagedIdentitySQLControlSettingsModelProperties sql Control Settings for workspace managed identity -type ManagedIdentitySQLControlSettingsModelProperties struct { - // GrantSQLControlToManagedIdentity - Grant sql control to managed identity - GrantSQLControlToManagedIdentity *ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity `json:"grantSqlControlToManagedIdentity,omitempty"` -} - -// ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity grant sql control to -// managed identity -type ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity struct { - // DesiredState - Desired state. Possible values include: 'DesiredStateEnabled', 'DesiredStateDisabled' - DesiredState DesiredState `json:"desiredState,omitempty"` - // ActualState - READ-ONLY; Actual state. Possible values include: 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Unknown' - ActualState ActualState `json:"actualState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity. -func (miscsmSctmi ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miscsmSctmi.DesiredState != "" { - objectMap["desiredState"] = miscsmSctmi.DesiredState - } - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntime managed integration runtime, including managed elastic and managed dedicated -// integration runtimes. -type ManagedIntegrationRuntime struct { - // State - READ-ONLY; Integration runtime state, only valid for managed dedicated integration runtime. Possible values include: 'Initial', 'Stopped', 'Started', 'Starting', 'Stopping', 'NeedRegistration', 'Online', 'Limited', 'Offline', 'AccessDenied' - State IntegrationRuntimeState `json:"state,omitempty"` - // ManagedIntegrationRuntimeTypeProperties - Managed integration runtime properties. - *ManagedIntegrationRuntimeTypeProperties `json:"typeProperties,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Description - Integration runtime description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeIntegrationRuntime', 'TypeManaged', 'TypeSelfHosted' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) MarshalJSON() ([]byte, error) { - mir.Type = TypeManaged - objectMap := make(map[string]interface{}) - if mir.ManagedIntegrationRuntimeTypeProperties != nil { - objectMap["typeProperties"] = mir.ManagedIntegrationRuntimeTypeProperties - } - if mir.Description != nil { - objectMap["description"] = mir.Description - } - if mir.Type != "" { - objectMap["type"] = mir.Type - } - for k, v := range mir.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntime is the BasicIntegrationRuntime implementation for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) AsManagedIntegrationRuntime() (*ManagedIntegrationRuntime, bool) { - return &mir, true -} - -// AsSelfHostedIntegrationRuntime is the BasicIntegrationRuntime implementation for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) AsSelfHostedIntegrationRuntime() (*SelfHostedIntegrationRuntime, bool) { - return nil, false -} - -// AsIntegrationRuntime is the BasicIntegrationRuntime implementation for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) AsIntegrationRuntime() (*IntegrationRuntime, bool) { - return nil, false -} - -// AsBasicIntegrationRuntime is the BasicIntegrationRuntime implementation for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) AsBasicIntegrationRuntime() (BasicIntegrationRuntime, bool) { - return &mir, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagedIntegrationRuntime struct. -func (mir *ManagedIntegrationRuntime) 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 "state": - if v != nil { - var state IntegrationRuntimeState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - mir.State = state - } - case "typeProperties": - if v != nil { - var managedIntegrationRuntimeTypeProperties ManagedIntegrationRuntimeTypeProperties - err = json.Unmarshal(*v, &managedIntegrationRuntimeTypeProperties) - if err != nil { - return err - } - mir.ManagedIntegrationRuntimeTypeProperties = &managedIntegrationRuntimeTypeProperties - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mir.AdditionalProperties == nil { - mir.AdditionalProperties = make(map[string]interface{}) - } - mir.AdditionalProperties[k] = additionalProperties - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mir.Description = &description - } - case "type": - if v != nil { - var typeVar Type - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mir.Type = typeVar - } - } - } - - return nil -} - -// ManagedIntegrationRuntimeError error definition for managed integration runtime. -type ManagedIntegrationRuntimeError struct { - // Time - READ-ONLY; The time when the error occurred. - Time *date.Time `json:"time,omitempty"` - // Code - READ-ONLY; Error code. - Code *string `json:"code,omitempty"` - // Parameters - READ-ONLY; Managed integration runtime error parameters. - Parameters *[]string `json:"parameters,omitempty"` - // Message - READ-ONLY; Error message. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeError. -func (mire ManagedIntegrationRuntimeError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntimeNode properties of integration runtime node. -type ManagedIntegrationRuntimeNode struct { - // NodeID - READ-ONLY; The managed integration runtime node id. - NodeID *string `json:"nodeId,omitempty"` - // Status - READ-ONLY; The managed integration runtime node status. Possible values include: 'ManagedIntegrationRuntimeNodeStatusStarting', 'ManagedIntegrationRuntimeNodeStatusAvailable', 'ManagedIntegrationRuntimeNodeStatusRecycling', 'ManagedIntegrationRuntimeNodeStatusUnavailable' - Status ManagedIntegrationRuntimeNodeStatus `json:"status,omitempty"` - // Errors - The errors that occurred on this integration runtime node. - Errors *[]ManagedIntegrationRuntimeError `json:"errors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeNode. -func (mirn ManagedIntegrationRuntimeNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mirn.Errors != nil { - objectMap["errors"] = mirn.Errors - } - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntimeOperationResult properties of managed integration runtime operation result. -type ManagedIntegrationRuntimeOperationResult struct { - // Type - READ-ONLY; The operation type. Could be start or stop. - Type *string `json:"type,omitempty"` - // StartTime - READ-ONLY; The start time of the operation. - StartTime *date.Time `json:"startTime,omitempty"` - // Result - READ-ONLY; The operation result. - Result *string `json:"result,omitempty"` - // ErrorCode - READ-ONLY; The error code. - ErrorCode *string `json:"errorCode,omitempty"` - // Parameters - READ-ONLY; Managed integration runtime error parameters. - Parameters *[]string `json:"parameters,omitempty"` - // ActivityID - READ-ONLY; The activity id for the operation request. - ActivityID *string `json:"activityId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeOperationResult. -func (miror ManagedIntegrationRuntimeOperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntimeStatus managed integration runtime status. -type ManagedIntegrationRuntimeStatus struct { - // ManagedIntegrationRuntimeStatusTypeProperties - Managed integration runtime status type properties. - *ManagedIntegrationRuntimeStatusTypeProperties `json:"typeProperties,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // DataFactoryName - READ-ONLY; The workspace name which the integration runtime belong to. - DataFactoryName *string `json:"dataFactoryName,omitempty"` - // State - READ-ONLY; The state of integration runtime. Possible values include: 'Initial', 'Stopped', 'Started', 'Starting', 'Stopping', 'NeedRegistration', 'Online', 'Limited', 'Offline', 'AccessDenied' - State IntegrationRuntimeState `json:"state,omitempty"` - // Type - Possible values include: 'TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus', 'TypeBasicIntegrationRuntimeStatusTypeManaged', 'TypeBasicIntegrationRuntimeStatusTypeSelfHosted' - Type TypeBasicIntegrationRuntimeStatus `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) MarshalJSON() ([]byte, error) { - mirs.Type = TypeBasicIntegrationRuntimeStatusTypeManaged - objectMap := make(map[string]interface{}) - if mirs.ManagedIntegrationRuntimeStatusTypeProperties != nil { - objectMap["typeProperties"] = mirs.ManagedIntegrationRuntimeStatusTypeProperties - } - if mirs.Type != "" { - objectMap["type"] = mirs.Type - } - for k, v := range mirs.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) AsManagedIntegrationRuntimeStatus() (*ManagedIntegrationRuntimeStatus, bool) { - return &mirs, true -} - -// AsSelfHostedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) AsSelfHostedIntegrationRuntimeStatus() (*SelfHostedIntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) AsIntegrationRuntimeStatus() (*IntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsBasicIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) AsBasicIntegrationRuntimeStatus() (BasicIntegrationRuntimeStatus, bool) { - return &mirs, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagedIntegrationRuntimeStatus struct. -func (mirs *ManagedIntegrationRuntimeStatus) 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 "typeProperties": - if v != nil { - var managedIntegrationRuntimeStatusTypeProperties ManagedIntegrationRuntimeStatusTypeProperties - err = json.Unmarshal(*v, &managedIntegrationRuntimeStatusTypeProperties) - if err != nil { - return err - } - mirs.ManagedIntegrationRuntimeStatusTypeProperties = &managedIntegrationRuntimeStatusTypeProperties - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mirs.AdditionalProperties == nil { - mirs.AdditionalProperties = make(map[string]interface{}) - } - mirs.AdditionalProperties[k] = additionalProperties - } - case "dataFactoryName": - if v != nil { - var dataFactoryName string - err = json.Unmarshal(*v, &dataFactoryName) - if err != nil { - return err - } - mirs.DataFactoryName = &dataFactoryName - } - case "state": - if v != nil { - var state IntegrationRuntimeState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - mirs.State = state - } - case "type": - if v != nil { - var typeVar TypeBasicIntegrationRuntimeStatus - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mirs.Type = typeVar - } - } - } - - return nil -} - -// ManagedIntegrationRuntimeStatusTypeProperties managed integration runtime status type properties. -type ManagedIntegrationRuntimeStatusTypeProperties struct { - // CreateTime - READ-ONLY; The time at which the integration runtime was created, in ISO8601 format. - CreateTime *date.Time `json:"createTime,omitempty"` - // Nodes - READ-ONLY; The list of nodes for managed integration runtime. - Nodes *[]ManagedIntegrationRuntimeNode `json:"nodes,omitempty"` - // OtherErrors - READ-ONLY; The errors that occurred on this integration runtime. - OtherErrors *[]ManagedIntegrationRuntimeError `json:"otherErrors,omitempty"` - // LastOperation - READ-ONLY; The last operation result that occurred on this integration runtime. - LastOperation *ManagedIntegrationRuntimeOperationResult `json:"lastOperation,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeStatusTypeProperties. -func (mirstp ManagedIntegrationRuntimeStatusTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntimeTypeProperties managed integration runtime type properties. -type ManagedIntegrationRuntimeTypeProperties struct { - // ComputeProperties - The compute resource for managed integration runtime. - ComputeProperties *IntegrationRuntimeComputeProperties `json:"computeProperties,omitempty"` - // SsisProperties - SSIS properties for managed integration runtime. - SsisProperties *IntegrationRuntimeSsisProperties `json:"ssisProperties,omitempty"` -} - -// ManagedVirtualNetworkSettings managed Virtual Network Settings -type ManagedVirtualNetworkSettings struct { - // PreventDataExfiltration - Prevent Data Exfiltration - PreventDataExfiltration *bool `json:"preventDataExfiltration,omitempty"` - // LinkedAccessCheckOnTargetResource - Linked Access Check On Target Resource - LinkedAccessCheckOnTargetResource *bool `json:"linkedAccessCheckOnTargetResource,omitempty"` - // AllowedAadTenantIdsForLinking - Allowed Aad Tenant Ids For Linking - AllowedAadTenantIdsForLinking *[]string `json:"allowedAadTenantIdsForLinking,omitempty"` -} - -// MetadataSyncConfig configuration for metadata sync -type MetadataSyncConfig struct { - autorest.Response `json:"-"` - // MetadataSyncConfigProperties - Metadata Sync Config properties - *MetadataSyncConfigProperties `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 MetadataSyncConfig. -func (msc MetadataSyncConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msc.MetadataSyncConfigProperties != nil { - objectMap["properties"] = msc.MetadataSyncConfigProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetadataSyncConfig struct. -func (msc *MetadataSyncConfig) 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 metadataSyncConfigProperties MetadataSyncConfigProperties - err = json.Unmarshal(*v, &metadataSyncConfigProperties) - if err != nil { - return err - } - msc.MetadataSyncConfigProperties = &metadataSyncConfigProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - msc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - msc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - msc.Type = &typeVar - } - } - } - - return nil -} - -// MetadataSyncConfigProperties metadata Sync Config properties -type MetadataSyncConfigProperties struct { - // Enabled - Indicates whether the metadata sync is enabled or disabled - Enabled *bool `json:"enabled,omitempty"` - // SyncIntervalInMinutes - The Sync Interval in minutes. - SyncIntervalInMinutes *int32 `json:"syncIntervalInMinutes,omitempty"` -} - -// OperationMetaLogSpecification what is this? -type OperationMetaLogSpecification struct { - // DisplayName - Log display name - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Time range the log covers - BlobDuration *string `json:"blobDuration,omitempty"` - // Name - Log unique name - Name *string `json:"name,omitempty"` -} - -// OperationMetaMetricDimensionSpecification what is this? -type OperationMetaMetricDimensionSpecification struct { - // DisplayName - Dimension display name - DisplayName *string `json:"displayName,omitempty"` - // Name - Dimension unique name - Name *string `json:"name,omitempty"` - // ToBeExportedForShoebox - Whether this metric should be exported for Shoebox - ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` -} - -// OperationMetaMetricSpecification what is this? -type OperationMetaMetricSpecification struct { - // SourceMdmNamespace - The source MDM namespace - SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` - // DisplayName - Metric display name - DisplayName *string `json:"displayName,omitempty"` - // Name - Metric unique name - Name *string `json:"name,omitempty"` - // AggregationType - Metric aggregation type - AggregationType *string `json:"aggregationType,omitempty"` - // DisplayDescription - Metric description - DisplayDescription *string `json:"displayDescription,omitempty"` - // SourceMdmAccount - The source MDM account - SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` - // EnableRegionalMdmAccount - Whether the regional MDM account is enabled - EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` - // Unit - Metric units - Unit *string `json:"unit,omitempty"` - // Dimensions - Metric dimensions - Dimensions *[]OperationMetaMetricDimensionSpecification `json:"dimensions,omitempty"` - // SupportsInstanceLevelAggregation - Whether the metric supports instance-level aggregation - SupportsInstanceLevelAggregation *bool `json:"supportsInstanceLevelAggregation,omitempty"` - // MetricFilterPattern - Metric filter - MetricFilterPattern *string `json:"metricFilterPattern,omitempty"` -} - -// OperationMetaPropertyInfo what is this? -type OperationMetaPropertyInfo struct { - // ServiceSpecification - Operation service specification - ServiceSpecification *OperationMetaServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// OperationMetaServiceSpecification what is this? -type OperationMetaServiceSpecification struct { - // MetricSpecifications - Service metric specifications - MetricSpecifications *[]OperationMetaMetricSpecification `json:"metricSpecifications,omitempty"` - // LogSpecifications - Service log specifications - LogSpecifications *[]OperationMetaLogSpecification `json:"logSpecifications,omitempty"` -} - -// OperationResource an operation -type OperationResource struct { - autorest.Response `json:"-"` - // ID - Operation ID - ID *string `json:"id,omitempty"` - // Name - Operation name - Name *string `json:"name,omitempty"` - // Status - Operation status. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusFailed', 'OperationStatusCanceled' - Status OperationStatus `json:"status,omitempty"` - // Properties - Operation properties - Properties interface{} `json:"properties,omitempty"` - // Error - Errors from the operation - Error *ErrorDetail `json:"error,omitempty"` - // StartTime - Operation start time - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Operation start time - EndTime *date.Time `json:"endTime,omitempty"` - // PercentComplete - Completion percentage of the operation - PercentComplete *float64 `json:"percentComplete,omitempty"` -} - -// PrivateEndpoint private endpoint details -type PrivateEndpoint struct { - // ID - READ-ONLY; Resource id of the private endpoint. - 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 a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Private endpoint connection properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionForPrivateLinkHub ... -type PrivateEndpointConnectionForPrivateLinkHub struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; identifier - ID *string `json:"id,omitempty"` - // PrivateEndpointConnectionProperties - Properties of private endpoint connection for private link hub - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionForPrivateLinkHub. -func (pecfplh PrivateEndpointConnectionForPrivateLinkHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecfplh.Name != nil { - objectMap["name"] = pecfplh.Name - } - if pecfplh.Type != nil { - objectMap["type"] = pecfplh.Type - } - if pecfplh.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pecfplh.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnectionForPrivateLinkHub struct. -func (pecfplh *PrivateEndpointConnectionForPrivateLinkHub) 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 - } - pecfplh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pecfplh.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pecfplh.ID = &ID - } - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pecfplh.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - } - } - - return nil -} - -// PrivateEndpointConnectionForPrivateLinkHubBasic private Endpoint Connection For Private Link Hub - Basic -type PrivateEndpointConnectionForPrivateLinkHubBasic struct { - // ID - READ-ONLY; identifier - ID *string `json:"id,omitempty"` - // PrivateEndpointConnectionProperties - Properties of private endpoint connection for private link hub - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionForPrivateLinkHubBasic. -func (pecfplhb PrivateEndpointConnectionForPrivateLinkHubBasic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecfplhb.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pecfplhb.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnectionForPrivateLinkHubBasic struct. -func (pecfplhb *PrivateEndpointConnectionForPrivateLinkHubBasic) 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 - } - pecfplhb.ID = &ID - } - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pecfplhb.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - } - } - - return nil -} - -// PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse ... -type PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse struct { - autorest.Response `json:"-"` - Value *[]PrivateEndpointConnectionForPrivateLinkHub `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator provides access to a -// complete listing of PrivateEndpointConnectionForPrivateLinkHub values. -type PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator struct { - i int - page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage -} - -// 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 *PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator.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 *PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) 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 PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) Response() PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse { - 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 PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) Value() PrivateEndpointConnectionForPrivateLinkHub { - if !iter.page.NotDone() { - return PrivateEndpointConnectionForPrivateLinkHub{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator type. -func NewPrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator(page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator { - return PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pecfplhRcr PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) IsEmpty() bool { - return pecfplhRcr.Value == nil || len(*pecfplhRcr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pecfplhRcr PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) hasNextLink() bool { - return pecfplhRcr.NextLink != nil && len(*pecfplhRcr.NextLink) != 0 -} - -// privateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pecfplhRcr PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) privateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePreparer(ctx context.Context) (*http.Request, error) { - if !pecfplhRcr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pecfplhRcr.NextLink))) -} - -// PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage contains a page of -// PrivateEndpointConnectionForPrivateLinkHub values. -type PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage struct { - fn func(context.Context, PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) (PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, error) - pecfplhrcr PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse -} - -// 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 *PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage.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.pecfplhrcr) - if err != nil { - return err - } - page.pecfplhrcr = 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 *PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) NotDone() bool { - return !page.pecfplhrcr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) Response() PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse { - return page.pecfplhrcr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) Values() []PrivateEndpointConnectionForPrivateLinkHub { - if page.pecfplhrcr.IsEmpty() { - return nil - } - return *page.pecfplhrcr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage type. -func NewPrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage(cur PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, getNextPage func(context.Context, PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) (PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, error)) PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage { - return PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage{ - fn: getNextPage, - pecfplhrcr: cur, - } -} - -// PrivateEndpointConnectionList a list of private endpoint connections -type PrivateEndpointConnectionList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionList. -func (pecl PrivateEndpointConnectionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListIterator provides access to a complete listing of PrivateEndpointConnection -// values. -type PrivateEndpointConnectionListIterator struct { - i int - page PrivateEndpointConnectionListPage -} - -// 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 *PrivateEndpointConnectionListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListIterator.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 *PrivateEndpointConnectionListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListIterator) 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 PrivateEndpointConnectionListIterator) Response() PrivateEndpointConnectionList { - 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 PrivateEndpointConnectionListIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListIterator type. -func NewPrivateEndpointConnectionListIterator(page PrivateEndpointConnectionListPage) PrivateEndpointConnectionListIterator { - return PrivateEndpointConnectionListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pecl PrivateEndpointConnectionList) IsEmpty() bool { - return pecl.Value == nil || len(*pecl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pecl PrivateEndpointConnectionList) hasNextLink() bool { - return pecl.NextLink != nil && len(*pecl.NextLink) != 0 -} - -// privateEndpointConnectionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pecl PrivateEndpointConnectionList) privateEndpointConnectionListPreparer(ctx context.Context) (*http.Request, error) { - if !pecl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pecl.NextLink))) -} - -// PrivateEndpointConnectionListPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListPage struct { - fn func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error) - pecl PrivateEndpointConnectionList -} - -// 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 *PrivateEndpointConnectionListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListPage.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.pecl) - if err != nil { - return err - } - page.pecl = 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 *PrivateEndpointConnectionListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListPage) NotDone() bool { - return !page.pecl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListPage) Response() PrivateEndpointConnectionList { - return page.pecl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListPage) Values() []PrivateEndpointConnection { - if page.pecl.IsEmpty() { - return nil - } - return *page.pecl.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListPage type. -func NewPrivateEndpointConnectionListPage(cur PrivateEndpointConnectionList, getNextPage func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error)) PrivateEndpointConnectionListPage { - return PrivateEndpointConnectionListPage{ - fn: getNextPage, - pecl: cur, - } -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,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) -} - -// PrivateEndpointConnectionsCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateFuture) 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 PrivateEndpointConnectionsCreateFuture.Result. -func (future *PrivateEndpointConnectionsCreateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.PrivateEndpointConnectionsCreateFuture") - 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.CreateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsCreateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (OperationResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (or OperationResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - or.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.PrivateEndpointConnectionsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { - or, err = client.DeleteResponder(or.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsDeleteFuture", "Result", or.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkHub a privateLinkHub -type PrivateLinkHub struct { - autorest.Response `json:"-"` - // PrivateLinkHubProperties - PrivateLinkHub resource properties - *PrivateLinkHubProperties `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 PrivateLinkHub. -func (plh PrivateLinkHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plh.PrivateLinkHubProperties != nil { - objectMap["properties"] = plh.PrivateLinkHubProperties - } - if plh.Tags != nil { - objectMap["tags"] = plh.Tags - } - if plh.Location != nil { - objectMap["location"] = plh.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkHub struct. -func (plh *PrivateLinkHub) 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 privateLinkHubProperties PrivateLinkHubProperties - err = json.Unmarshal(*v, &privateLinkHubProperties) - if err != nil { - return err - } - plh.PrivateLinkHubProperties = &privateLinkHubProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - plh.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - plh.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plh.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plh.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkHubInfoListResult list of privateLinkHubs -type PrivateLinkHubInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of privateLinkHubs - Value *[]PrivateLinkHub `json:"value,omitempty"` -} - -// PrivateLinkHubInfoListResultIterator provides access to a complete listing of PrivateLinkHub values. -type PrivateLinkHubInfoListResultIterator struct { - i int - page PrivateLinkHubInfoListResultPage -} - -// 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 *PrivateLinkHubInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubInfoListResultIterator.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 *PrivateLinkHubInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkHubInfoListResultIterator) 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 PrivateLinkHubInfoListResultIterator) Response() PrivateLinkHubInfoListResult { - 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 PrivateLinkHubInfoListResultIterator) Value() PrivateLinkHub { - if !iter.page.NotDone() { - return PrivateLinkHub{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkHubInfoListResultIterator type. -func NewPrivateLinkHubInfoListResultIterator(page PrivateLinkHubInfoListResultPage) PrivateLinkHubInfoListResultIterator { - return PrivateLinkHubInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plhilr PrivateLinkHubInfoListResult) IsEmpty() bool { - return plhilr.Value == nil || len(*plhilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plhilr PrivateLinkHubInfoListResult) hasNextLink() bool { - return plhilr.NextLink != nil && len(*plhilr.NextLink) != 0 -} - -// privateLinkHubInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plhilr PrivateLinkHubInfoListResult) privateLinkHubInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plhilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plhilr.NextLink))) -} - -// PrivateLinkHubInfoListResultPage contains a page of PrivateLinkHub values. -type PrivateLinkHubInfoListResultPage struct { - fn func(context.Context, PrivateLinkHubInfoListResult) (PrivateLinkHubInfoListResult, error) - plhilr PrivateLinkHubInfoListResult -} - -// 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 *PrivateLinkHubInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubInfoListResultPage.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.plhilr) - if err != nil { - return err - } - page.plhilr = 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 *PrivateLinkHubInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkHubInfoListResultPage) NotDone() bool { - return !page.plhilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkHubInfoListResultPage) Response() PrivateLinkHubInfoListResult { - return page.plhilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkHubInfoListResultPage) Values() []PrivateLinkHub { - if page.plhilr.IsEmpty() { - return nil - } - return *page.plhilr.Value -} - -// Creates a new instance of the PrivateLinkHubInfoListResultPage type. -func NewPrivateLinkHubInfoListResultPage(cur PrivateLinkHubInfoListResult, getNextPage func(context.Context, PrivateLinkHubInfoListResult) (PrivateLinkHubInfoListResult, error)) PrivateLinkHubInfoListResultPage { - return PrivateLinkHubInfoListResultPage{ - fn: getNextPage, - plhilr: cur, - } -} - -// PrivateLinkHubPatchInfo privateLinkHub patch details -type PrivateLinkHubPatchInfo struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkHubPatchInfo. -func (plhpi PrivateLinkHubPatchInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plhpi.Tags != nil { - objectMap["tags"] = plhpi.Tags - } - return json.Marshal(objectMap) -} - -// PrivateLinkHubProperties privateLinkHub properties -type PrivateLinkHubProperties struct { - // ProvisioningState - PrivateLinkHub provisioning state - ProvisioningState *string `json:"provisioningState,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections - PrivateEndpointConnections *[]PrivateEndpointConnectionForPrivateLinkHubBasic `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkHubProperties. -func (plhp PrivateLinkHubProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plhp.ProvisioningState != nil { - objectMap["provisioningState"] = plhp.ProvisioningState - } - return json.Marshal(objectMap) -} - -// PrivateLinkHubsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PrivateLinkHubsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkHubsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkHubsDeleteFuture) 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 PrivateLinkHubsDeleteFuture.Result. -func (future *PrivateLinkHubsDeleteFuture) result(client PrivateLinkHubsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.PrivateLinkHubsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // Properties - READ-ONLY; The private link resource properties. - Properties *PrivateLinkResourceProperties `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 PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; Required DNS zone names of the the private link resource. - 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 connection state details of the private endpoint -type PrivateLinkServiceConnectionState struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionState. -func (plscs PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscs.Status != nil { - objectMap["status"] = plscs.Status - } - if plscs.Description != nil { - objectMap["description"] = plscs.Description - } - return json.Marshal(objectMap) -} - -// 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) -} - -// PurviewConfiguration purview Configuration -type PurviewConfiguration struct { - // PurviewResourceID - Purview Resource ID - PurviewResourceID *string `json:"purviewResourceId,omitempty"` -} - -// QueryInterval a database query. -type QueryInterval struct { - // IntervalStartTime - READ-ONLY; The start time of the measurement interval (ISO8601 format). - IntervalStartTime *date.Time `json:"intervalStartTime,omitempty"` - // ExecutionCount - READ-ONLY; The number of times the query was executed during this interval. - ExecutionCount *float64 `json:"executionCount,omitempty"` - // Metrics - READ-ONLY; The list of query metrics during this interval. - Metrics *[]QueryMetric `json:"metrics,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryInterval. -func (qi QueryInterval) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QueryMetric a database query. -type QueryMetric struct { - // Name - READ-ONLY; The name of the metric - Name *string `json:"name,omitempty"` - // DisplayName - READ-ONLY; The name of the metric for display in user interface - DisplayName *string `json:"displayName,omitempty"` - // Unit - READ-ONLY; The unit of measurement. Possible values include: 'Percentage', 'KB', 'Microseconds' - Unit QueryMetricUnit `json:"unit,omitempty"` - // Value - READ-ONLY; The measured value - Value *float64 `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryMetric. -func (qm QueryMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QueryStatistic a database query. -type QueryStatistic struct { - // QueryID - READ-ONLY; The id of the query - QueryID *string `json:"queryId,omitempty"` - // Intervals - READ-ONLY; The list of query intervals. - Intervals *[]QueryInterval `json:"intervals,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryStatistic. -func (qs QueryStatistic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableSQLPool a recoverable sql pool -type RecoverableSQLPool struct { - autorest.Response `json:"-"` - // RecoverableSQLPoolProperties - The properties of a recoverable sql pool - *RecoverableSQLPoolProperties `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 RecoverableSQLPool. -func (rsp RecoverableSQLPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsp.RecoverableSQLPoolProperties != nil { - objectMap["properties"] = rsp.RecoverableSQLPoolProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecoverableSQLPool struct. -func (rsp *RecoverableSQLPool) 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 recoverableSQLPoolProperties RecoverableSQLPoolProperties - err = json.Unmarshal(*v, &recoverableSQLPoolProperties) - if err != nil { - return err - } - rsp.RecoverableSQLPoolProperties = &recoverableSQLPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rsp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rsp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rsp.Type = &typeVar - } - } - } - - return nil -} - -// RecoverableSQLPoolListResult the response to a list recoverable sql pools request -type RecoverableSQLPoolListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; A list of recoverable sql pool - Value *[]RecoverableSQLPool `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableSQLPoolListResult. -func (rsplr RecoverableSQLPoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableSQLPoolListResultIterator provides access to a complete listing of RecoverableSQLPool values. -type RecoverableSQLPoolListResultIterator struct { - i int - page RecoverableSQLPoolListResultPage -} - -// 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 *RecoverableSQLPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableSQLPoolListResultIterator.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 *RecoverableSQLPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RecoverableSQLPoolListResultIterator) 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 RecoverableSQLPoolListResultIterator) Response() RecoverableSQLPoolListResult { - 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 RecoverableSQLPoolListResultIterator) Value() RecoverableSQLPool { - if !iter.page.NotDone() { - return RecoverableSQLPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RecoverableSQLPoolListResultIterator type. -func NewRecoverableSQLPoolListResultIterator(page RecoverableSQLPoolListResultPage) RecoverableSQLPoolListResultIterator { - return RecoverableSQLPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rsplr RecoverableSQLPoolListResult) IsEmpty() bool { - return rsplr.Value == nil || len(*rsplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rsplr RecoverableSQLPoolListResult) hasNextLink() bool { - return rsplr.NextLink != nil && len(*rsplr.NextLink) != 0 -} - -// recoverableSQLPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rsplr RecoverableSQLPoolListResult) recoverableSQLPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rsplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rsplr.NextLink))) -} - -// RecoverableSQLPoolListResultPage contains a page of RecoverableSQLPool values. -type RecoverableSQLPoolListResultPage struct { - fn func(context.Context, RecoverableSQLPoolListResult) (RecoverableSQLPoolListResult, error) - rsplr RecoverableSQLPoolListResult -} - -// 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 *RecoverableSQLPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableSQLPoolListResultPage.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.rsplr) - if err != nil { - return err - } - page.rsplr = 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 *RecoverableSQLPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RecoverableSQLPoolListResultPage) NotDone() bool { - return !page.rsplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RecoverableSQLPoolListResultPage) Response() RecoverableSQLPoolListResult { - return page.rsplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RecoverableSQLPoolListResultPage) Values() []RecoverableSQLPool { - if page.rsplr.IsEmpty() { - return nil - } - return *page.rsplr.Value -} - -// Creates a new instance of the RecoverableSQLPoolListResultPage type. -func NewRecoverableSQLPoolListResultPage(cur RecoverableSQLPoolListResult, getNextPage func(context.Context, RecoverableSQLPoolListResult) (RecoverableSQLPoolListResult, error)) RecoverableSQLPoolListResultPage { - return RecoverableSQLPoolListResultPage{ - fn: getNextPage, - rsplr: cur, - } -} - -// RecoverableSQLPoolProperties the properties of a recoverable sql pool -type RecoverableSQLPoolProperties struct { - // Edition - READ-ONLY; The edition of the database - Edition *string `json:"edition,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective name of the database - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // ElasticPoolName - READ-ONLY; The elastic pool name of the database - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // LastAvailableBackupDate - READ-ONLY; The last available backup date of the database (ISO8601 format) - LastAvailableBackupDate *date.Time `json:"lastAvailableBackupDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableSQLPoolProperties. -func (rspp RecoverableSQLPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReplaceAllFirewallRulesOperationResponse an existing operation for replacing the firewall rules -type ReplaceAllFirewallRulesOperationResponse struct { - autorest.Response `json:"-"` - // OperationID - The operation ID - OperationID *string `json:"operationId,omitempty"` -} - -// ReplaceAllIPFirewallRulesRequest replace all IP firewall rules request -type ReplaceAllIPFirewallRulesRequest struct { - // IPFirewallRules - IP firewall rule properties - IPFirewallRules map[string]*IPFirewallRuleProperties `json:"ipFirewallRules"` -} - -// MarshalJSON is the custom marshaler for ReplaceAllIPFirewallRulesRequest. -func (raifrr ReplaceAllIPFirewallRulesRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if raifrr.IPFirewallRules != nil { - objectMap["ipFirewallRules"] = raifrr.IPFirewallRules - } - return json.Marshal(objectMap) -} - -// ReplicationLink represents a Sql pool replication link. -type ReplicationLink struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Location of the workspace that contains this firewall rule. - Location *string `json:"location,omitempty"` - // ReplicationLinkProperties - The properties representing the resource. - *ReplicationLinkProperties `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 ReplicationLink. -func (rl ReplicationLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rl.ReplicationLinkProperties != nil { - objectMap["properties"] = rl.ReplicationLinkProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ReplicationLink struct. -func (rl *ReplicationLink) 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 - } - rl.Location = &location - } - case "properties": - if v != nil { - var replicationLinkProperties ReplicationLinkProperties - err = json.Unmarshal(*v, &replicationLinkProperties) - if err != nil { - return err - } - rl.ReplicationLinkProperties = &replicationLinkProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rl.Type = &typeVar - } - } - } - - return nil -} - -// ReplicationLinkListResult represents the response to a List Sql pool replication link request. -type ReplicationLinkListResult struct { - autorest.Response `json:"-"` - // Value - The list of Sql pool replication links housed in the Sql pool. - Value *[]ReplicationLink `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationLinkListResult. -func (rllr ReplicationLinkListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rllr.Value != nil { - objectMap["value"] = rllr.Value - } - return json.Marshal(objectMap) -} - -// ReplicationLinkListResultIterator provides access to a complete listing of ReplicationLink values. -type ReplicationLinkListResultIterator struct { - i int - page ReplicationLinkListResultPage -} - -// 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 *ReplicationLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinkListResultIterator.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 *ReplicationLinkListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReplicationLinkListResultIterator) 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 ReplicationLinkListResultIterator) Response() ReplicationLinkListResult { - 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 ReplicationLinkListResultIterator) Value() ReplicationLink { - if !iter.page.NotDone() { - return ReplicationLink{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReplicationLinkListResultIterator type. -func NewReplicationLinkListResultIterator(page ReplicationLinkListResultPage) ReplicationLinkListResultIterator { - return ReplicationLinkListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rllr ReplicationLinkListResult) IsEmpty() bool { - return rllr.Value == nil || len(*rllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rllr ReplicationLinkListResult) hasNextLink() bool { - return rllr.NextLink != nil && len(*rllr.NextLink) != 0 -} - -// replicationLinkListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rllr ReplicationLinkListResult) replicationLinkListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rllr.NextLink))) -} - -// ReplicationLinkListResultPage contains a page of ReplicationLink values. -type ReplicationLinkListResultPage struct { - fn func(context.Context, ReplicationLinkListResult) (ReplicationLinkListResult, error) - rllr ReplicationLinkListResult -} - -// 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 *ReplicationLinkListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinkListResultPage.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.rllr) - if err != nil { - return err - } - page.rllr = 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 *ReplicationLinkListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReplicationLinkListResultPage) NotDone() bool { - return !page.rllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReplicationLinkListResultPage) Response() ReplicationLinkListResult { - return page.rllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReplicationLinkListResultPage) Values() []ReplicationLink { - if page.rllr.IsEmpty() { - return nil - } - return *page.rllr.Value -} - -// Creates a new instance of the ReplicationLinkListResultPage type. -func NewReplicationLinkListResultPage(cur ReplicationLinkListResult, getNextPage func(context.Context, ReplicationLinkListResult) (ReplicationLinkListResult, error)) ReplicationLinkListResultPage { - return ReplicationLinkListResultPage{ - fn: getNextPage, - rllr: cur, - } -} - -// ReplicationLinkProperties represents the properties of a Sql pool replication link. -type ReplicationLinkProperties struct { - // IsTerminationAllowed - READ-ONLY; Legacy value indicating whether termination is allowed. Currently always returns true. - IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty"` - // ReplicationMode - READ-ONLY; Replication mode of this replication link. - ReplicationMode *string `json:"replicationMode,omitempty"` - // PartnerServer - READ-ONLY; The name of the workspace hosting the partner Sql pool. - PartnerServer *string `json:"partnerServer,omitempty"` - // PartnerDatabase - READ-ONLY; The name of the partner Sql pool. - PartnerDatabase *string `json:"partnerDatabase,omitempty"` - // PartnerLocation - READ-ONLY; The Azure Region of the partner Sql pool. - PartnerLocation *string `json:"partnerLocation,omitempty"` - // Role - READ-ONLY; The role of the Sql pool in the replication link. Possible values include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', 'Copy' - Role ReplicationRole `json:"role,omitempty"` - // PartnerRole - READ-ONLY; The role of the partner Sql pool in the replication link. Possible values include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', 'Copy' - PartnerRole ReplicationRole `json:"partnerRole,omitempty"` - // StartTime - READ-ONLY; The start time for the replication link. - StartTime *date.Time `json:"startTime,omitempty"` - // PercentComplete - READ-ONLY; The percentage of seeding complete for the replication link. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ReplicationState - READ-ONLY; The replication state for the replication link. Possible values include: 'PENDING', 'SEEDING', 'CATCHUP', 'SUSPENDED' - ReplicationState ReplicationState `json:"replicationState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationLinkProperties. -func (rlp ReplicationLinkProperties) 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) -} - -// RestorableDroppedSQLPool a restorable dropped Sql pool -type RestorableDroppedSQLPool struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // RestorableDroppedSQLPoolProperties - The properties of a restorable dropped Sql pool - *RestorableDroppedSQLPoolProperties `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 RestorableDroppedSQLPool. -func (rdsp RestorableDroppedSQLPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdsp.RestorableDroppedSQLPoolProperties != nil { - objectMap["properties"] = rdsp.RestorableDroppedSQLPoolProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableDroppedSQLPool struct. -func (rdsp *RestorableDroppedSQLPool) 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 - } - rdsp.Location = &location - } - case "properties": - if v != nil { - var restorableDroppedSQLPoolProperties RestorableDroppedSQLPoolProperties - err = json.Unmarshal(*v, &restorableDroppedSQLPoolProperties) - if err != nil { - return err - } - rdsp.RestorableDroppedSQLPoolProperties = &restorableDroppedSQLPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rdsp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rdsp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rdsp.Type = &typeVar - } - } - } - - return nil -} - -// RestorableDroppedSQLPoolListResult the response to a list restorable dropped Sql pools request -type RestorableDroppedSQLPoolListResult struct { - autorest.Response `json:"-"` - // Value - A list of restorable dropped Sql pools - Value *[]RestorableDroppedSQLPool `json:"value,omitempty"` -} - -// RestorableDroppedSQLPoolProperties the properties of a restorable dropped Sql pool -type RestorableDroppedSQLPoolProperties struct { - // DatabaseName - READ-ONLY; The name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // Edition - READ-ONLY; The edition of the database - Edition *string `json:"edition,omitempty"` - // MaxSizeBytes - READ-ONLY; The max size in bytes of the database - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective name of the database - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // ElasticPoolName - READ-ONLY; The elastic pool name of the database - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format) - CreationDate *date.Time `json:"creationDate,omitempty"` - // DeletionDate - READ-ONLY; The deletion date of the database (ISO8601 format) - DeletionDate *date.Time `json:"deletionDate,omitempty"` - // EarliestRestoreDate - READ-ONLY; The earliest restore date of the database (ISO8601 format) - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDroppedSQLPoolProperties. -func (rdspp RestorableDroppedSQLPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorePoint database restore points. -type RestorePoint struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // RestorePointProperties - Resource properties. - *RestorePointProperties `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 RestorePoint. -func (rp RestorePoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RestorePointProperties != nil { - objectMap["properties"] = rp.RestorePointProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorePoint struct. -func (rp *RestorePoint) 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 - } - rp.Location = &location - } - case "properties": - if v != nil { - var restorePointProperties RestorePointProperties - err = json.Unmarshal(*v, &restorePointProperties) - if err != nil { - return err - } - rp.RestorePointProperties = &restorePointProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rp.Type = &typeVar - } - } - } - - return nil -} - -// RestorePointListResult a list of long term retention backups. -type RestorePointListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]RestorePoint `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorePointListResult. -func (rplr RestorePointListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorePointListResultIterator provides access to a complete listing of RestorePoint values. -type RestorePointListResultIterator struct { - i int - page RestorePointListResultPage -} - -// 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 *RestorePointListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointListResultIterator.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 *RestorePointListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RestorePointListResultIterator) 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 RestorePointListResultIterator) Response() RestorePointListResult { - 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 RestorePointListResultIterator) Value() RestorePoint { - if !iter.page.NotDone() { - return RestorePoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RestorePointListResultIterator type. -func NewRestorePointListResultIterator(page RestorePointListResultPage) RestorePointListResultIterator { - return RestorePointListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rplr RestorePointListResult) IsEmpty() bool { - return rplr.Value == nil || len(*rplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rplr RestorePointListResult) hasNextLink() bool { - return rplr.NextLink != nil && len(*rplr.NextLink) != 0 -} - -// restorePointListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rplr RestorePointListResult) restorePointListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rplr.NextLink))) -} - -// RestorePointListResultPage contains a page of RestorePoint values. -type RestorePointListResultPage struct { - fn func(context.Context, RestorePointListResult) (RestorePointListResult, error) - rplr RestorePointListResult -} - -// 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 *RestorePointListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointListResultPage.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.rplr) - if err != nil { - return err - } - page.rplr = 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 *RestorePointListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RestorePointListResultPage) NotDone() bool { - return !page.rplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RestorePointListResultPage) Response() RestorePointListResult { - return page.rplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RestorePointListResultPage) Values() []RestorePoint { - if page.rplr.IsEmpty() { - return nil - } - return *page.rplr.Value -} - -// Creates a new instance of the RestorePointListResultPage type. -func NewRestorePointListResultPage(cur RestorePointListResult, getNextPage func(context.Context, RestorePointListResult) (RestorePointListResult, error)) RestorePointListResultPage { - return RestorePointListResultPage{ - fn: getNextPage, - rplr: cur, - } -} - -// RestorePointProperties properties of a database restore point -type RestorePointProperties struct { - // RestorePointType - READ-ONLY; The type of restore point. Possible values include: 'CONTINUOUS', 'DISCRETE' - RestorePointType RestorePointType `json:"restorePointType,omitempty"` - // EarliestRestoreDate - READ-ONLY; The earliest time to which this database can be restored - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // RestorePointCreationDate - READ-ONLY; The time the backup was taken - RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"` - // RestorePointLabel - READ-ONLY; The label of restore point for backup request by user - RestorePointLabel *string `json:"restorePointLabel,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorePointProperties. -func (rpp RestorePointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BasicSecretBase the base definition of a secret type. -type BasicSecretBase interface { - AsSecureString() (*SecureString, bool) - AsSecretBase() (*SecretBase, bool) -} - -// SecretBase the base definition of a secret type. -type SecretBase struct { - // Type - Possible values include: 'TypeSecretBase', 'TypeSecureString' - Type TypeBasicSecretBase `json:"type,omitempty"` -} - -func unmarshalBasicSecretBase(body []byte) (BasicSecretBase, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeSecureString): - var ss SecureString - err := json.Unmarshal(body, &ss) - return ss, err - default: - var sb SecretBase - err := json.Unmarshal(body, &sb) - return sb, err - } -} -func unmarshalBasicSecretBaseArray(body []byte) ([]BasicSecretBase, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - sbArray := make([]BasicSecretBase, len(rawMessages)) - - for index, rawMessage := range rawMessages { - sb, err := unmarshalBasicSecretBase(*rawMessage) - if err != nil { - return nil, err - } - sbArray[index] = sb - } - return sbArray, nil -} - -// MarshalJSON is the custom marshaler for SecretBase. -func (sb SecretBase) MarshalJSON() ([]byte, error) { - sb.Type = TypeSecretBase - objectMap := make(map[string]interface{}) - if sb.Type != "" { - objectMap["type"] = sb.Type - } - return json.Marshal(objectMap) -} - -// AsSecureString is the BasicSecretBase implementation for SecretBase. -func (sb SecretBase) AsSecureString() (*SecureString, bool) { - return nil, false -} - -// AsSecretBase is the BasicSecretBase implementation for SecretBase. -func (sb SecretBase) AsSecretBase() (*SecretBase, bool) { - return &sb, true -} - -// AsBasicSecretBase is the BasicSecretBase implementation for SecretBase. -func (sb SecretBase) AsBasicSecretBase() (BasicSecretBase, bool) { - return &sb, true -} - -// SecureString azure Synapse secure string definition. The string value will be masked with asterisks '*' -// during Get or List API calls. -type SecureString struct { - // Value - Value of secure string. - Value *string `json:"value,omitempty"` - // Type - Possible values include: 'TypeSecretBase', 'TypeSecureString' - Type TypeBasicSecretBase `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecureString. -func (ss SecureString) MarshalJSON() ([]byte, error) { - ss.Type = TypeSecureString - objectMap := make(map[string]interface{}) - if ss.Value != nil { - objectMap["value"] = ss.Value - } - if ss.Type != "" { - objectMap["type"] = ss.Type - } - return json.Marshal(objectMap) -} - -// AsSecureString is the BasicSecretBase implementation for SecureString. -func (ss SecureString) AsSecureString() (*SecureString, bool) { - return &ss, true -} - -// AsSecretBase is the BasicSecretBase implementation for SecureString. -func (ss SecureString) AsSecretBase() (*SecretBase, bool) { - return nil, false -} - -// AsBasicSecretBase is the BasicSecretBase implementation for SecureString. -func (ss SecureString) AsBasicSecretBase() (BasicSecretBase, bool) { - return &ss, true -} - -// SecurityAlertPolicyProperties properties of a security alert policy. -type SecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific Sql pool. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' - State SecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action - DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses *[]string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // CreationTime - READ-ONLY; Specifies the UTC creation time of the policy. - CreationTime *date.Time `json:"creationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityAlertPolicyProperties. -func (sapp SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sapp.State != "" { - objectMap["state"] = sapp.State - } - if sapp.DisabledAlerts != nil { - objectMap["disabledAlerts"] = sapp.DisabledAlerts - } - if sapp.EmailAddresses != nil { - objectMap["emailAddresses"] = sapp.EmailAddresses - } - if sapp.EmailAccountAdmins != nil { - objectMap["emailAccountAdmins"] = sapp.EmailAccountAdmins - } - if sapp.StorageEndpoint != nil { - objectMap["storageEndpoint"] = sapp.StorageEndpoint - } - if sapp.StorageAccountAccessKey != nil { - objectMap["storageAccountAccessKey"] = sapp.StorageAccountAccessKey - } - if sapp.RetentionDays != nil { - objectMap["retentionDays"] = sapp.RetentionDays - } - return json.Marshal(objectMap) -} - -// SelfHostedIntegrationRuntime self-hosted integration runtime. -type SelfHostedIntegrationRuntime struct { - // SelfHostedIntegrationRuntimeTypeProperties - When this property is not null, means this is a linked integration runtime. The property is used to access original integration runtime. - *SelfHostedIntegrationRuntimeTypeProperties `json:"typeProperties,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Description - Integration runtime description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeIntegrationRuntime', 'TypeManaged', 'TypeSelfHosted' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) MarshalJSON() ([]byte, error) { - shir.Type = TypeSelfHosted - objectMap := make(map[string]interface{}) - if shir.SelfHostedIntegrationRuntimeTypeProperties != nil { - objectMap["typeProperties"] = shir.SelfHostedIntegrationRuntimeTypeProperties - } - if shir.Description != nil { - objectMap["description"] = shir.Description - } - if shir.Type != "" { - objectMap["type"] = shir.Type - } - for k, v := range shir.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntime is the BasicIntegrationRuntime implementation for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) AsManagedIntegrationRuntime() (*ManagedIntegrationRuntime, bool) { - return nil, false -} - -// AsSelfHostedIntegrationRuntime is the BasicIntegrationRuntime implementation for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) AsSelfHostedIntegrationRuntime() (*SelfHostedIntegrationRuntime, bool) { - return &shir, true -} - -// AsIntegrationRuntime is the BasicIntegrationRuntime implementation for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) AsIntegrationRuntime() (*IntegrationRuntime, bool) { - return nil, false -} - -// AsBasicIntegrationRuntime is the BasicIntegrationRuntime implementation for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) AsBasicIntegrationRuntime() (BasicIntegrationRuntime, bool) { - return &shir, true -} - -// UnmarshalJSON is the custom unmarshaler for SelfHostedIntegrationRuntime struct. -func (shir *SelfHostedIntegrationRuntime) 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 "typeProperties": - if v != nil { - var selfHostedIntegrationRuntimeTypeProperties SelfHostedIntegrationRuntimeTypeProperties - err = json.Unmarshal(*v, &selfHostedIntegrationRuntimeTypeProperties) - if err != nil { - return err - } - shir.SelfHostedIntegrationRuntimeTypeProperties = &selfHostedIntegrationRuntimeTypeProperties - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if shir.AdditionalProperties == nil { - shir.AdditionalProperties = make(map[string]interface{}) - } - shir.AdditionalProperties[k] = additionalProperties - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - shir.Description = &description - } - case "type": - if v != nil { - var typeVar Type - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - shir.Type = typeVar - } - } - } - - return nil -} - -// SelfHostedIntegrationRuntimeNode properties of Self-hosted integration runtime node. -type SelfHostedIntegrationRuntimeNode struct { - autorest.Response `json:"-"` - // NodeName - READ-ONLY; Name of the integration runtime node. - NodeName *string `json:"nodeName,omitempty"` - // MachineName - READ-ONLY; Machine name of the integration runtime node. - MachineName *string `json:"machineName,omitempty"` - // HostServiceURI - READ-ONLY; URI for the host machine of the integration runtime. - HostServiceURI *string `json:"hostServiceUri,omitempty"` - // Status - READ-ONLY; Status of the integration runtime node. Possible values include: 'SelfHostedIntegrationRuntimeNodeStatusNeedRegistration', 'SelfHostedIntegrationRuntimeNodeStatusOnline', 'SelfHostedIntegrationRuntimeNodeStatusLimited', 'SelfHostedIntegrationRuntimeNodeStatusOffline', 'SelfHostedIntegrationRuntimeNodeStatusUpgrading', 'SelfHostedIntegrationRuntimeNodeStatusInitializing', 'SelfHostedIntegrationRuntimeNodeStatusInitializeFailed' - Status SelfHostedIntegrationRuntimeNodeStatus `json:"status,omitempty"` - // Capabilities - READ-ONLY; The integration runtime capabilities dictionary - Capabilities map[string]*string `json:"capabilities"` - // VersionStatus - READ-ONLY; Status of the integration runtime node version. - VersionStatus *string `json:"versionStatus,omitempty"` - // Version - READ-ONLY; Version of the integration runtime node. - Version *string `json:"version,omitempty"` - // RegisterTime - READ-ONLY; The time at which the integration runtime node was registered in ISO8601 format. - RegisterTime *date.Time `json:"registerTime,omitempty"` - // LastConnectTime - READ-ONLY; The most recent time at which the integration runtime was connected in ISO8601 format. - LastConnectTime *date.Time `json:"lastConnectTime,omitempty"` - // ExpiryTime - READ-ONLY; The time at which the integration runtime will expire in ISO8601 format. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // LastStartTime - READ-ONLY; The time the node last started up. - LastStartTime *date.Time `json:"lastStartTime,omitempty"` - // LastStopTime - READ-ONLY; The integration runtime node last stop time. - LastStopTime *date.Time `json:"lastStopTime,omitempty"` - // LastUpdateResult - READ-ONLY; The result of the last integration runtime node update. Possible values include: 'None', 'Succeed', 'Fail' - LastUpdateResult IntegrationRuntimeUpdateResult `json:"lastUpdateResult,omitempty"` - // LastStartUpdateTime - READ-ONLY; The last time for the integration runtime node update start. - LastStartUpdateTime *date.Time `json:"lastStartUpdateTime,omitempty"` - // LastEndUpdateTime - READ-ONLY; The last time for the integration runtime node update end. - LastEndUpdateTime *date.Time `json:"lastEndUpdateTime,omitempty"` - // IsActiveDispatcher - READ-ONLY; Indicates whether this node is the active dispatcher for integration runtime requests. - IsActiveDispatcher *bool `json:"isActiveDispatcher,omitempty"` - // ConcurrentJobsLimit - READ-ONLY; Maximum concurrent jobs on the integration runtime node. - ConcurrentJobsLimit *int32 `json:"concurrentJobsLimit,omitempty"` - // MaxConcurrentJobs - READ-ONLY; The maximum concurrent jobs in this integration runtime. - MaxConcurrentJobs *int32 `json:"maxConcurrentJobs,omitempty"` -} - -// MarshalJSON is the custom marshaler for SelfHostedIntegrationRuntimeNode. -func (shirn SelfHostedIntegrationRuntimeNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SelfHostedIntegrationRuntimeStatus self-hosted integration runtime status. -type SelfHostedIntegrationRuntimeStatus struct { - // SelfHostedIntegrationRuntimeStatusTypeProperties - Self-hosted integration runtime status type properties. - *SelfHostedIntegrationRuntimeStatusTypeProperties `json:"typeProperties,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // DataFactoryName - READ-ONLY; The workspace name which the integration runtime belong to. - DataFactoryName *string `json:"dataFactoryName,omitempty"` - // State - READ-ONLY; The state of integration runtime. Possible values include: 'Initial', 'Stopped', 'Started', 'Starting', 'Stopping', 'NeedRegistration', 'Online', 'Limited', 'Offline', 'AccessDenied' - State IntegrationRuntimeState `json:"state,omitempty"` - // Type - Possible values include: 'TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus', 'TypeBasicIntegrationRuntimeStatusTypeManaged', 'TypeBasicIntegrationRuntimeStatusTypeSelfHosted' - Type TypeBasicIntegrationRuntimeStatus `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) MarshalJSON() ([]byte, error) { - shirs.Type = TypeBasicIntegrationRuntimeStatusTypeSelfHosted - objectMap := make(map[string]interface{}) - if shirs.SelfHostedIntegrationRuntimeStatusTypeProperties != nil { - objectMap["typeProperties"] = shirs.SelfHostedIntegrationRuntimeStatusTypeProperties - } - if shirs.Type != "" { - objectMap["type"] = shirs.Type - } - for k, v := range shirs.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) AsManagedIntegrationRuntimeStatus() (*ManagedIntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsSelfHostedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) AsSelfHostedIntegrationRuntimeStatus() (*SelfHostedIntegrationRuntimeStatus, bool) { - return &shirs, true -} - -// AsIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) AsIntegrationRuntimeStatus() (*IntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsBasicIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) AsBasicIntegrationRuntimeStatus() (BasicIntegrationRuntimeStatus, bool) { - return &shirs, true -} - -// UnmarshalJSON is the custom unmarshaler for SelfHostedIntegrationRuntimeStatus struct. -func (shirs *SelfHostedIntegrationRuntimeStatus) 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 "typeProperties": - if v != nil { - var selfHostedIntegrationRuntimeStatusTypeProperties SelfHostedIntegrationRuntimeStatusTypeProperties - err = json.Unmarshal(*v, &selfHostedIntegrationRuntimeStatusTypeProperties) - if err != nil { - return err - } - shirs.SelfHostedIntegrationRuntimeStatusTypeProperties = &selfHostedIntegrationRuntimeStatusTypeProperties - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if shirs.AdditionalProperties == nil { - shirs.AdditionalProperties = make(map[string]interface{}) - } - shirs.AdditionalProperties[k] = additionalProperties - } - case "dataFactoryName": - if v != nil { - var dataFactoryName string - err = json.Unmarshal(*v, &dataFactoryName) - if err != nil { - return err - } - shirs.DataFactoryName = &dataFactoryName - } - case "state": - if v != nil { - var state IntegrationRuntimeState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - shirs.State = state - } - case "type": - if v != nil { - var typeVar TypeBasicIntegrationRuntimeStatus - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - shirs.Type = typeVar - } - } - } - - return nil -} - -// SelfHostedIntegrationRuntimeStatusTypeProperties self-hosted integration runtime status type properties. -type SelfHostedIntegrationRuntimeStatusTypeProperties struct { - // CreateTime - READ-ONLY; The time at which the integration runtime was created, in ISO8601 format. - CreateTime *date.Time `json:"createTime,omitempty"` - // TaskQueueID - READ-ONLY; The task queue id of the integration runtime. - TaskQueueID *string `json:"taskQueueId,omitempty"` - // NodeCommunicationChannelEncryptionMode - READ-ONLY; The node communication Channel encryption mode - NodeCommunicationChannelEncryptionMode *string `json:"nodeCommunicationChannelEncryptionMode,omitempty"` - // InternalChannelEncryption - READ-ONLY; It is used to set the encryption mode for node-node communication channel (when more than 2 self-hosted integration runtime nodes exist). Possible values include: 'NotSet', 'SslEncrypted', 'NotEncrypted' - InternalChannelEncryption IntegrationRuntimeInternalChannelEncryptionMode `json:"internalChannelEncryption,omitempty"` - // Version - READ-ONLY; Version of the integration runtime. - Version *string `json:"version,omitempty"` - // Nodes - The list of nodes for this integration runtime. - Nodes *[]SelfHostedIntegrationRuntimeNode `json:"nodes,omitempty"` - // ScheduledUpdateDate - READ-ONLY; The date at which the integration runtime will be scheduled to update, in ISO8601 format. - ScheduledUpdateDate *date.Time `json:"scheduledUpdateDate,omitempty"` - // UpdateDelayOffset - READ-ONLY; The time in the date scheduled by service to update the integration runtime, e.g., PT03H is 3 hours - UpdateDelayOffset *string `json:"updateDelayOffset,omitempty"` - // LocalTimeZoneOffset - READ-ONLY; The local time zone offset in hours. - LocalTimeZoneOffset *string `json:"localTimeZoneOffset,omitempty"` - // Capabilities - READ-ONLY; Object with additional information about integration runtime capabilities. - Capabilities map[string]*string `json:"capabilities"` - // ServiceUrls - READ-ONLY; The URLs for the services used in integration runtime backend service. - ServiceUrls *[]string `json:"serviceUrls,omitempty"` - // AutoUpdate - READ-ONLY; Whether Self-hosted integration runtime auto update has been turned on. Possible values include: 'On', 'Off' - AutoUpdate IntegrationRuntimeAutoUpdate `json:"autoUpdate,omitempty"` - // VersionStatus - READ-ONLY; Status of the integration runtime version. - VersionStatus *string `json:"versionStatus,omitempty"` - // Links - The list of linked integration runtimes that are created to share with this integration runtime. - Links *[]LinkedIntegrationRuntime `json:"links,omitempty"` - // PushedVersion - READ-ONLY; The version that the integration runtime is going to update to. - PushedVersion *string `json:"pushedVersion,omitempty"` - // LatestVersion - READ-ONLY; The latest version on download center. - LatestVersion *string `json:"latestVersion,omitempty"` - // AutoUpdateETA - READ-ONLY; The estimated time when the self-hosted integration runtime will be updated. - AutoUpdateETA *date.Time `json:"autoUpdateETA,omitempty"` -} - -// MarshalJSON is the custom marshaler for SelfHostedIntegrationRuntimeStatusTypeProperties. -func (shirstp SelfHostedIntegrationRuntimeStatusTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if shirstp.Nodes != nil { - objectMap["nodes"] = shirstp.Nodes - } - if shirstp.Links != nil { - objectMap["links"] = shirstp.Links - } - return json.Marshal(objectMap) -} - -// SelfHostedIntegrationRuntimeTypeProperties the self-hosted integration runtime properties. -type SelfHostedIntegrationRuntimeTypeProperties struct { - // LinkedInfo - Linked integration runtime type from data factory - LinkedInfo BasicLinkedIntegrationRuntimeType `json:"linkedInfo,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for SelfHostedIntegrationRuntimeTypeProperties struct. -func (shirtp *SelfHostedIntegrationRuntimeTypeProperties) 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 "linkedInfo": - if v != nil { - linkedInfo, err := unmarshalBasicLinkedIntegrationRuntimeType(*v) - if err != nil { - return err - } - shirtp.LinkedInfo = linkedInfo - } - } - } - - return nil -} - -// SensitivityLabel a sensitivity label. -type SensitivityLabel struct { - autorest.Response `json:"-"` - // SensitivityLabelProperties - Resource properties. - *SensitivityLabelProperties `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 SensitivityLabel. -func (sl SensitivityLabel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sl.SensitivityLabelProperties != nil { - objectMap["properties"] = sl.SensitivityLabelProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SensitivityLabel struct. -func (sl *SensitivityLabel) 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 sensitivityLabelProperties SensitivityLabelProperties - err = json.Unmarshal(*v, &sensitivityLabelProperties) - if err != nil { - return err - } - sl.SensitivityLabelProperties = &sensitivityLabelProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sl.Type = &typeVar - } - } - } - - return nil -} - -// SensitivityLabelListResult a list of sensitivity labels. -type SensitivityLabelListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SensitivityLabel `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SensitivityLabelListResult. -func (sllr SensitivityLabelListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SensitivityLabelListResultIterator provides access to a complete listing of SensitivityLabel values. -type SensitivityLabelListResultIterator struct { - i int - page SensitivityLabelListResultPage -} - -// 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 *SensitivityLabelListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultIterator.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 *SensitivityLabelListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SensitivityLabelListResultIterator) 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 SensitivityLabelListResultIterator) Response() SensitivityLabelListResult { - 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 SensitivityLabelListResultIterator) Value() SensitivityLabel { - if !iter.page.NotDone() { - return SensitivityLabel{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SensitivityLabelListResultIterator type. -func NewSensitivityLabelListResultIterator(page SensitivityLabelListResultPage) SensitivityLabelListResultIterator { - return SensitivityLabelListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sllr SensitivityLabelListResult) IsEmpty() bool { - return sllr.Value == nil || len(*sllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sllr SensitivityLabelListResult) hasNextLink() bool { - return sllr.NextLink != nil && len(*sllr.NextLink) != 0 -} - -// sensitivityLabelListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sllr SensitivityLabelListResult) sensitivityLabelListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sllr.NextLink))) -} - -// SensitivityLabelListResultPage contains a page of SensitivityLabel values. -type SensitivityLabelListResultPage struct { - fn func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error) - sllr SensitivityLabelListResult -} - -// 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 *SensitivityLabelListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultPage.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.sllr) - if err != nil { - return err - } - page.sllr = 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 *SensitivityLabelListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SensitivityLabelListResultPage) NotDone() bool { - return !page.sllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SensitivityLabelListResultPage) Response() SensitivityLabelListResult { - return page.sllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SensitivityLabelListResultPage) Values() []SensitivityLabel { - if page.sllr.IsEmpty() { - return nil - } - return *page.sllr.Value -} - -// Creates a new instance of the SensitivityLabelListResultPage type. -func NewSensitivityLabelListResultPage(cur SensitivityLabelListResult, getNextPage func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error)) SensitivityLabelListResultPage { - return SensitivityLabelListResultPage{ - fn: getNextPage, - sllr: cur, - } -} - -// SensitivityLabelProperties properties of a sensitivity label. -type SensitivityLabelProperties struct { - // LabelName - The label name. - LabelName *string `json:"labelName,omitempty"` - // LabelID - The label ID. - LabelID *string `json:"labelId,omitempty"` - // InformationType - The information type. - InformationType *string `json:"informationType,omitempty"` - // InformationTypeID - The information type ID. - InformationTypeID *string `json:"informationTypeId,omitempty"` - // IsDisabled - READ-ONLY; Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. - IsDisabled *bool `json:"isDisabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for SensitivityLabelProperties. -func (slp SensitivityLabelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if slp.LabelName != nil { - objectMap["labelName"] = slp.LabelName - } - if slp.LabelID != nil { - objectMap["labelId"] = slp.LabelID - } - if slp.InformationType != nil { - objectMap["informationType"] = slp.InformationType - } - if slp.InformationTypeID != nil { - objectMap["informationTypeId"] = slp.InformationTypeID - } - return json.Marshal(objectMap) -} - -// ServerBlobAuditingPolicy a server blob auditing policy. -type ServerBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ServerBlobAuditingPolicyProperties - Resource properties. - *ServerBlobAuditingPolicyProperties `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 ServerBlobAuditingPolicy. -func (sbap ServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sbap.ServerBlobAuditingPolicyProperties != nil { - objectMap["properties"] = sbap.ServerBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerBlobAuditingPolicy struct. -func (sbap *ServerBlobAuditingPolicy) 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 serverBlobAuditingPolicyProperties ServerBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &serverBlobAuditingPolicyProperties) - if err != nil { - return err - } - sbap.ServerBlobAuditingPolicyProperties = &serverBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sbap.Type = &typeVar - } - } - } - - return nil -} - -// ServerBlobAuditingPolicyListResult a list of server auditing settings. -type ServerBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerBlobAuditingPolicyListResult. -func (sbaplr ServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ServerBlobAuditingPolicy values. -type ServerBlobAuditingPolicyListResultIterator struct { - i int - page ServerBlobAuditingPolicyListResultPage -} - -// 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 *ServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPolicyListResultIterator.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 *ServerBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerBlobAuditingPolicyListResultIterator) 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 ServerBlobAuditingPolicyListResultIterator) Response() ServerBlobAuditingPolicyListResult { - 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 ServerBlobAuditingPolicyListResultIterator) Value() ServerBlobAuditingPolicy { - if !iter.page.NotDone() { - return ServerBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerBlobAuditingPolicyListResultIterator type. -func NewServerBlobAuditingPolicyListResultIterator(page ServerBlobAuditingPolicyListResultPage) ServerBlobAuditingPolicyListResultIterator { - return ServerBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sbaplr ServerBlobAuditingPolicyListResult) IsEmpty() bool { - return sbaplr.Value == nil || len(*sbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sbaplr ServerBlobAuditingPolicyListResult) hasNextLink() bool { - return sbaplr.NextLink != nil && len(*sbaplr.NextLink) != 0 -} - -// serverBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sbaplr ServerBlobAuditingPolicyListResult) serverBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sbaplr.NextLink))) -} - -// ServerBlobAuditingPolicyListResultPage contains a page of ServerBlobAuditingPolicy values. -type ServerBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ServerBlobAuditingPolicyListResult) (ServerBlobAuditingPolicyListResult, error) - sbaplr ServerBlobAuditingPolicyListResult -} - -// 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 *ServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPolicyListResultPage.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.sbaplr) - if err != nil { - return err - } - page.sbaplr = 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 *ServerBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.sbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerBlobAuditingPolicyListResultPage) Response() ServerBlobAuditingPolicyListResult { - return page.sbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerBlobAuditingPolicyListResultPage) Values() []ServerBlobAuditingPolicy { - if page.sbaplr.IsEmpty() { - return nil - } - return *page.sbaplr.Value -} - -// Creates a new instance of the ServerBlobAuditingPolicyListResultPage type. -func NewServerBlobAuditingPolicyListResultPage(cur ServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ServerBlobAuditingPolicyListResult) (ServerBlobAuditingPolicyListResult, error)) ServerBlobAuditingPolicyListResultPage { - return ServerBlobAuditingPolicyListResultPage{ - fn: getNextPage, - sbaplr: cur, - } -} - -// ServerBlobAuditingPolicyProperties properties of a server blob auditing policy. -type ServerBlobAuditingPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// ServerSecurityAlertPolicy workspace managed Sql server security alert policy. -type ServerSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // ServerSecurityAlertPolicyProperties - Resource properties. - *ServerSecurityAlertPolicyProperties `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 ServerSecurityAlertPolicy. -func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssap.ServerSecurityAlertPolicyProperties != nil { - objectMap["properties"] = ssap.ServerSecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. -func (ssap *ServerSecurityAlertPolicy) 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 serverSecurityAlertPolicyProperties ServerSecurityAlertPolicyProperties - err = json.Unmarshal(*v, &serverSecurityAlertPolicyProperties) - if err != nil { - return err - } - ssap.ServerSecurityAlertPolicyProperties = &serverSecurityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ssap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ssap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ssap.Type = &typeVar - } - } - } - - return nil -} - -// ServerSecurityAlertPolicyListResult a list of the workspace managed sql server's security alert -// policies. -type ServerSecurityAlertPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicyListResult. -func (ssaplr ServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerSecurityAlertPolicyListResultIterator provides access to a complete listing of -// ServerSecurityAlertPolicy values. -type ServerSecurityAlertPolicyListResultIterator struct { - i int - page ServerSecurityAlertPolicyListResultPage -} - -// 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 *ServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultIterator.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 *ServerSecurityAlertPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerSecurityAlertPolicyListResultIterator) 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 ServerSecurityAlertPolicyListResultIterator) Response() ServerSecurityAlertPolicyListResult { - 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 ServerSecurityAlertPolicyListResultIterator) Value() ServerSecurityAlertPolicy { - if !iter.page.NotDone() { - return ServerSecurityAlertPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerSecurityAlertPolicyListResultIterator type. -func NewServerSecurityAlertPolicyListResultIterator(page ServerSecurityAlertPolicyListResultPage) ServerSecurityAlertPolicyListResultIterator { - return ServerSecurityAlertPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssaplr ServerSecurityAlertPolicyListResult) IsEmpty() bool { - return ssaplr.Value == nil || len(*ssaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssaplr ServerSecurityAlertPolicyListResult) hasNextLink() bool { - return ssaplr.NextLink != nil && len(*ssaplr.NextLink) != 0 -} - -// serverSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssaplr ServerSecurityAlertPolicyListResult) serverSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ssaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssaplr.NextLink))) -} - -// ServerSecurityAlertPolicyListResultPage contains a page of ServerSecurityAlertPolicy values. -type ServerSecurityAlertPolicyListResultPage struct { - fn func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error) - ssaplr ServerSecurityAlertPolicyListResult -} - -// 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 *ServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultPage.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.ssaplr) - if err != nil { - return err - } - page.ssaplr = 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 *ServerSecurityAlertPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerSecurityAlertPolicyListResultPage) NotDone() bool { - return !page.ssaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerSecurityAlertPolicyListResultPage) Response() ServerSecurityAlertPolicyListResult { - return page.ssaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerSecurityAlertPolicyListResultPage) Values() []ServerSecurityAlertPolicy { - if page.ssaplr.IsEmpty() { - return nil - } - return *page.ssaplr.Value -} - -// Creates a new instance of the ServerSecurityAlertPolicyListResultPage type. -func NewServerSecurityAlertPolicyListResultPage(cur ServerSecurityAlertPolicyListResult, getNextPage func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error)) ServerSecurityAlertPolicyListResultPage { - return ServerSecurityAlertPolicyListResultPage{ - fn: getNextPage, - ssaplr: cur, - } -} - -// ServerSecurityAlertPolicyProperties properties of a security alert policy. -type ServerSecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific server. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' - State SecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action - DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses *[]string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // CreationTime - READ-ONLY; Specifies the UTC creation time of the policy. - CreationTime *date.Time `json:"creationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicyProperties. -func (ssapp ServerSecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssapp.State != "" { - objectMap["state"] = ssapp.State - } - if ssapp.DisabledAlerts != nil { - objectMap["disabledAlerts"] = ssapp.DisabledAlerts - } - if ssapp.EmailAddresses != nil { - objectMap["emailAddresses"] = ssapp.EmailAddresses - } - if ssapp.EmailAccountAdmins != nil { - objectMap["emailAccountAdmins"] = ssapp.EmailAccountAdmins - } - if ssapp.StorageEndpoint != nil { - objectMap["storageEndpoint"] = ssapp.StorageEndpoint - } - if ssapp.StorageAccountAccessKey != nil { - objectMap["storageAccountAccessKey"] = ssapp.StorageAccountAccessKey - } - if ssapp.RetentionDays != nil { - objectMap["retentionDays"] = ssapp.RetentionDays - } - return json.Marshal(objectMap) -} - -// ServerUsage represents server metrics. -type ServerUsage struct { - // Name - READ-ONLY; Name of the server usage metric. - Name *string `json:"name,omitempty"` - // ResourceName - READ-ONLY; The name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // DisplayName - READ-ONLY; The metric display name. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; The current value of the metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The current limit of the metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units of the metric. - Unit *string `json:"unit,omitempty"` - // NextResetTime - READ-ONLY; The next reset time for the metric (ISO8601 format). - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerUsage. -func (su ServerUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerUsageListResult represents the response to a list server metrics request. -type ServerUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of server metrics for the server. - Value *[]ServerUsage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerUsageListResult. -func (sulr ServerUsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sulr.Value != nil { - objectMap["value"] = sulr.Value - } - return json.Marshal(objectMap) -} - -// ServerUsageListResultIterator provides access to a complete listing of ServerUsage values. -type ServerUsageListResultIterator struct { - i int - page ServerUsageListResultPage -} - -// 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 *ServerUsageListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerUsageListResultIterator.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 *ServerUsageListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerUsageListResultIterator) 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 ServerUsageListResultIterator) Response() ServerUsageListResult { - 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 ServerUsageListResultIterator) Value() ServerUsage { - if !iter.page.NotDone() { - return ServerUsage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerUsageListResultIterator type. -func NewServerUsageListResultIterator(page ServerUsageListResultPage) ServerUsageListResultIterator { - return ServerUsageListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sulr ServerUsageListResult) IsEmpty() bool { - return sulr.Value == nil || len(*sulr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sulr ServerUsageListResult) hasNextLink() bool { - return sulr.NextLink != nil && len(*sulr.NextLink) != 0 -} - -// serverUsageListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sulr ServerUsageListResult) serverUsageListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sulr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sulr.NextLink))) -} - -// ServerUsageListResultPage contains a page of ServerUsage values. -type ServerUsageListResultPage struct { - fn func(context.Context, ServerUsageListResult) (ServerUsageListResult, error) - sulr ServerUsageListResult -} - -// 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 *ServerUsageListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerUsageListResultPage.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.sulr) - if err != nil { - return err - } - page.sulr = 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 *ServerUsageListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerUsageListResultPage) NotDone() bool { - return !page.sulr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerUsageListResultPage) Response() ServerUsageListResult { - return page.sulr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerUsageListResultPage) Values() []ServerUsage { - if page.sulr.IsEmpty() { - return nil - } - return *page.sulr.Value -} - -// Creates a new instance of the ServerUsageListResultPage type. -func NewServerUsageListResultPage(cur ServerUsageListResult, getNextPage func(context.Context, ServerUsageListResult) (ServerUsageListResult, error)) ServerUsageListResultPage { - return ServerUsageListResultPage{ - fn: getNextPage, - sulr: cur, - } -} - -// ServerVulnerabilityAssessment a server vulnerability assessment. -type ServerVulnerabilityAssessment struct { - autorest.Response `json:"-"` - // ServerVulnerabilityAssessmentProperties - Resource properties. - *ServerVulnerabilityAssessmentProperties `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 ServerVulnerabilityAssessment. -func (sva ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sva.ServerVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = sva.ServerVulnerabilityAssessmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerVulnerabilityAssessment struct. -func (sva *ServerVulnerabilityAssessment) 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 serverVulnerabilityAssessmentProperties ServerVulnerabilityAssessmentProperties - err = json.Unmarshal(*v, &serverVulnerabilityAssessmentProperties) - if err != nil { - return err - } - sva.ServerVulnerabilityAssessmentProperties = &serverVulnerabilityAssessmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sva.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sva.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sva.Type = &typeVar - } - } - } - - return nil -} - -// ServerVulnerabilityAssessmentListResult a list of the server's vulnerability assessments. -type ServerVulnerabilityAssessmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerVulnerabilityAssessment `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerVulnerabilityAssessmentListResult. -func (svalr ServerVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerVulnerabilityAssessmentListResultIterator provides access to a complete listing of -// ServerVulnerabilityAssessment values. -type ServerVulnerabilityAssessmentListResultIterator struct { - i int - page ServerVulnerabilityAssessmentListResultPage -} - -// 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 *ServerVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultIterator.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 *ServerVulnerabilityAssessmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerVulnerabilityAssessmentListResultIterator) 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 ServerVulnerabilityAssessmentListResultIterator) Response() ServerVulnerabilityAssessmentListResult { - 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 ServerVulnerabilityAssessmentListResultIterator) Value() ServerVulnerabilityAssessment { - if !iter.page.NotDone() { - return ServerVulnerabilityAssessment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerVulnerabilityAssessmentListResultIterator type. -func NewServerVulnerabilityAssessmentListResultIterator(page ServerVulnerabilityAssessmentListResultPage) ServerVulnerabilityAssessmentListResultIterator { - return ServerVulnerabilityAssessmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (svalr ServerVulnerabilityAssessmentListResult) IsEmpty() bool { - return svalr.Value == nil || len(*svalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (svalr ServerVulnerabilityAssessmentListResult) hasNextLink() bool { - return svalr.NextLink != nil && len(*svalr.NextLink) != 0 -} - -// serverVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (svalr ServerVulnerabilityAssessmentListResult) serverVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !svalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(svalr.NextLink))) -} - -// ServerVulnerabilityAssessmentListResultPage contains a page of ServerVulnerabilityAssessment values. -type ServerVulnerabilityAssessmentListResultPage struct { - fn func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error) - svalr ServerVulnerabilityAssessmentListResult -} - -// 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 *ServerVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultPage.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.svalr) - if err != nil { - return err - } - page.svalr = 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 *ServerVulnerabilityAssessmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerVulnerabilityAssessmentListResultPage) NotDone() bool { - return !page.svalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerVulnerabilityAssessmentListResultPage) Response() ServerVulnerabilityAssessmentListResult { - return page.svalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerVulnerabilityAssessmentListResultPage) Values() []ServerVulnerabilityAssessment { - if page.svalr.IsEmpty() { - return nil - } - return *page.svalr.Value -} - -// Creates a new instance of the ServerVulnerabilityAssessmentListResultPage type. -func NewServerVulnerabilityAssessmentListResultPage(cur ServerVulnerabilityAssessmentListResult, getNextPage func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error)) ServerVulnerabilityAssessmentListResultPage { - return ServerVulnerabilityAssessmentListResultPage{ - fn: getNextPage, - svalr: cur, - } -} - -// ServerVulnerabilityAssessmentProperties properties of a server Vulnerability Assessment. -type ServerVulnerabilityAssessmentProperties struct { - // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RecurringScans - The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` -} - -// SetObject ... -type SetObject struct { - autorest.Response `json:"-"` - Value interface{} `json:"value,omitempty"` -} - -// Sku SQL pool SKU -type Sku struct { - // Tier - The service tier - Tier *string `json:"tier,omitempty"` - // Name - The SKU name - Name *string `json:"name,omitempty"` - // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SQLPool a SQL Analytics pool -type SQLPool struct { - autorest.Response `json:"-"` - // Sku - SQL pool SKU - Sku *Sku `json:"sku,omitempty"` - // SQLPoolResourceProperties - SQL pool properties - *SQLPoolResourceProperties `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 SQLPool. -func (sp SQLPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.Sku != nil { - objectMap["sku"] = sp.Sku - } - if sp.SQLPoolResourceProperties != nil { - objectMap["properties"] = sp.SQLPoolResourceProperties - } - if sp.Tags != nil { - objectMap["tags"] = sp.Tags - } - if sp.Location != nil { - objectMap["location"] = sp.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPool struct. -func (sp *SQLPool) 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 - } - sp.Sku = &sku - } - case "properties": - if v != nil { - var SQLPoolResourceProperties SQLPoolResourceProperties - err = json.Unmarshal(*v, &SQLPoolResourceProperties) - if err != nil { - return err - } - sp.SQLPoolResourceProperties = &SQLPoolResourceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sp.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sp.Location = &location - } - 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 - } - } - } - - return nil -} - -// SQLPoolBlobAuditingPolicy a Sql pool blob auditing policy. -type SQLPoolBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty"` - // SQLPoolBlobAuditingPolicyProperties - Resource properties. - *SQLPoolBlobAuditingPolicyProperties `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 SQLPoolBlobAuditingPolicy. -func (spbap SQLPoolBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spbap.SQLPoolBlobAuditingPolicyProperties != nil { - objectMap["properties"] = spbap.SQLPoolBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolBlobAuditingPolicy struct. -func (spbap *SQLPoolBlobAuditingPolicy) 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 - } - spbap.Kind = &kind - } - case "properties": - if v != nil { - var SQLPoolBlobAuditingPolicyProperties SQLPoolBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &SQLPoolBlobAuditingPolicyProperties) - if err != nil { - return err - } - spbap.SQLPoolBlobAuditingPolicyProperties = &SQLPoolBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spbap.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolBlobAuditingPolicyListResult a list of Sql pool auditing settings. -type SQLPoolBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolBlobAuditingPolicyListResult. -func (spbaplr SQLPoolBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolBlobAuditingPolicyListResultIterator provides access to a complete listing of -// SQLPoolBlobAuditingPolicy values. -type SQLPoolBlobAuditingPolicyListResultIterator struct { - i int - page SQLPoolBlobAuditingPolicyListResultPage -} - -// 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 *SQLPoolBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPolicyListResultIterator.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 *SQLPoolBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolBlobAuditingPolicyListResultIterator) 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 SQLPoolBlobAuditingPolicyListResultIterator) Response() SQLPoolBlobAuditingPolicyListResult { - 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 SQLPoolBlobAuditingPolicyListResultIterator) Value() SQLPoolBlobAuditingPolicy { - if !iter.page.NotDone() { - return SQLPoolBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolBlobAuditingPolicyListResultIterator type. -func NewSQLPoolBlobAuditingPolicyListResultIterator(page SQLPoolBlobAuditingPolicyListResultPage) SQLPoolBlobAuditingPolicyListResultIterator { - return SQLPoolBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spbaplr SQLPoolBlobAuditingPolicyListResult) IsEmpty() bool { - return spbaplr.Value == nil || len(*spbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spbaplr SQLPoolBlobAuditingPolicyListResult) hasNextLink() bool { - return spbaplr.NextLink != nil && len(*spbaplr.NextLink) != 0 -} - -// sQLPoolBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spbaplr SQLPoolBlobAuditingPolicyListResult) sQLPoolBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spbaplr.NextLink))) -} - -// SQLPoolBlobAuditingPolicyListResultPage contains a page of SQLPoolBlobAuditingPolicy values. -type SQLPoolBlobAuditingPolicyListResultPage struct { - fn func(context.Context, SQLPoolBlobAuditingPolicyListResult) (SQLPoolBlobAuditingPolicyListResult, error) - spbaplr SQLPoolBlobAuditingPolicyListResult -} - -// 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 *SQLPoolBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPolicyListResultPage.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.spbaplr) - if err != nil { - return err - } - page.spbaplr = 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 *SQLPoolBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.spbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolBlobAuditingPolicyListResultPage) Response() SQLPoolBlobAuditingPolicyListResult { - return page.spbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolBlobAuditingPolicyListResultPage) Values() []SQLPoolBlobAuditingPolicy { - if page.spbaplr.IsEmpty() { - return nil - } - return *page.spbaplr.Value -} - -// Creates a new instance of the SQLPoolBlobAuditingPolicyListResultPage type. -func NewSQLPoolBlobAuditingPolicyListResultPage(cur SQLPoolBlobAuditingPolicyListResult, getNextPage func(context.Context, SQLPoolBlobAuditingPolicyListResult) (SQLPoolBlobAuditingPolicyListResult, error)) SQLPoolBlobAuditingPolicyListResultPage { - return SQLPoolBlobAuditingPolicyListResultPage{ - fn: getNextPage, - spbaplr: cur, - } -} - -// SQLPoolBlobAuditingPolicyProperties properties of a Sql pool blob auditing policy. -type SQLPoolBlobAuditingPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` -} - -// SQLPoolBlobAuditingPolicySQLPoolOperationListResult the response to a list Sql pool operations request -type SQLPoolBlobAuditingPolicySQLPoolOperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolBlobAuditingPolicySQLPoolOperationListResult. -func (spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator provides access to a complete listing of -// SQLPoolOperation values. -type SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator struct { - i int - page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage -} - -// 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 *SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator.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 *SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) 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 SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) Response() SQLPoolBlobAuditingPolicySQLPoolOperationListResult { - 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 SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) Value() SQLPoolOperation { - if !iter.page.NotDone() { - return SQLPoolOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator type. -func NewSQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator(page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator { - return SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult) IsEmpty() bool { - return spbapspolr.Value == nil || len(*spbapspolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult) hasNextLink() bool { - return spbapspolr.NextLink != nil && len(*spbapspolr.NextLink) != 0 -} - -// sQLPoolBlobAuditingPolicySQLPoolOperationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult) sQLPoolBlobAuditingPolicySQLPoolOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spbapspolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spbapspolr.NextLink))) -} - -// SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage contains a page of SQLPoolOperation values. -type SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage struct { - fn func(context.Context, SQLPoolBlobAuditingPolicySQLPoolOperationListResult) (SQLPoolBlobAuditingPolicySQLPoolOperationListResult, error) - spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult -} - -// 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 *SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage.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.spbapspolr) - if err != nil { - return err - } - page.spbapspolr = 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 *SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) NotDone() bool { - return !page.spbapspolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) Response() SQLPoolBlobAuditingPolicySQLPoolOperationListResult { - return page.spbapspolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) Values() []SQLPoolOperation { - if page.spbapspolr.IsEmpty() { - return nil - } - return *page.spbapspolr.Value -} - -// Creates a new instance of the SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage type. -func NewSQLPoolBlobAuditingPolicySQLPoolOperationListResultPage(cur SQLPoolBlobAuditingPolicySQLPoolOperationListResult, getNextPage func(context.Context, SQLPoolBlobAuditingPolicySQLPoolOperationListResult) (SQLPoolBlobAuditingPolicySQLPoolOperationListResult, error)) SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage { - return SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage{ - fn: getNextPage, - spbapspolr: cur, - } -} - -// SQLPoolColumn a Sql pool column resource. -type SQLPoolColumn struct { - autorest.Response `json:"-"` - // SQLPoolColumnProperties - Resource properties. - *SQLPoolColumnProperties `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 SQLPoolColumn. -func (spc SQLPoolColumn) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spc.SQLPoolColumnProperties != nil { - objectMap["properties"] = spc.SQLPoolColumnProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolColumn struct. -func (spc *SQLPoolColumn) 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 SQLPoolColumnProperties SQLPoolColumnProperties - err = json.Unmarshal(*v, &SQLPoolColumnProperties) - if err != nil { - return err - } - spc.SQLPoolColumnProperties = &SQLPoolColumnProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spc.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolColumnListResult a list of Sql pool columns. -type SQLPoolColumnListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolColumn `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolColumnListResult. -func (spclr SQLPoolColumnListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolColumnListResultIterator provides access to a complete listing of SQLPoolColumn values. -type SQLPoolColumnListResultIterator struct { - i int - page SQLPoolColumnListResultPage -} - -// 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 *SQLPoolColumnListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolColumnListResultIterator.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 *SQLPoolColumnListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolColumnListResultIterator) 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 SQLPoolColumnListResultIterator) Response() SQLPoolColumnListResult { - 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 SQLPoolColumnListResultIterator) Value() SQLPoolColumn { - if !iter.page.NotDone() { - return SQLPoolColumn{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolColumnListResultIterator type. -func NewSQLPoolColumnListResultIterator(page SQLPoolColumnListResultPage) SQLPoolColumnListResultIterator { - return SQLPoolColumnListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spclr SQLPoolColumnListResult) IsEmpty() bool { - return spclr.Value == nil || len(*spclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spclr SQLPoolColumnListResult) hasNextLink() bool { - return spclr.NextLink != nil && len(*spclr.NextLink) != 0 -} - -// sQLPoolColumnListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spclr SQLPoolColumnListResult) sQLPoolColumnListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spclr.NextLink))) -} - -// SQLPoolColumnListResultPage contains a page of SQLPoolColumn values. -type SQLPoolColumnListResultPage struct { - fn func(context.Context, SQLPoolColumnListResult) (SQLPoolColumnListResult, error) - spclr SQLPoolColumnListResult -} - -// 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 *SQLPoolColumnListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolColumnListResultPage.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.spclr) - if err != nil { - return err - } - page.spclr = 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 *SQLPoolColumnListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolColumnListResultPage) NotDone() bool { - return !page.spclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolColumnListResultPage) Response() SQLPoolColumnListResult { - return page.spclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolColumnListResultPage) Values() []SQLPoolColumn { - if page.spclr.IsEmpty() { - return nil - } - return *page.spclr.Value -} - -// Creates a new instance of the SQLPoolColumnListResultPage type. -func NewSQLPoolColumnListResultPage(cur SQLPoolColumnListResult, getNextPage func(context.Context, SQLPoolColumnListResult) (SQLPoolColumnListResult, error)) SQLPoolColumnListResultPage { - return SQLPoolColumnListResultPage{ - fn: getNextPage, - spclr: cur, - } -} - -// SQLPoolColumnProperties sql pool column properties. -type SQLPoolColumnProperties struct { - // ColumnType - The column data type. Possible values include: 'Image', 'Text', 'Uniqueidentifier', 'Date', 'Time', 'Datetime2', 'Datetimeoffset', 'Tinyint', 'Smallint', 'Int', 'Smalldatetime', 'Real', 'Money', 'Datetime', 'Float', 'SQLVariant', 'Ntext', 'Bit', 'Decimal', 'Numeric', 'Smallmoney', 'Bigint', 'Hierarchyid', 'Geometry', 'Geography', 'Varbinary', 'Varchar', 'Binary', 'Char', 'Timestamp', 'Nvarchar', 'Nchar', 'XML', 'Sysname' - ColumnType ColumnDataType `json:"columnType,omitempty"` -} - -// SQLPoolConnectionPolicy a Sql pool connection policy. -type SQLPoolConnectionPolicy struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // SQLPoolConnectionPolicyProperties - Resource properties. - *SQLPoolConnectionPolicyProperties `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 SQLPoolConnectionPolicy. -func (spcp SQLPoolConnectionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spcp.SQLPoolConnectionPolicyProperties != nil { - objectMap["properties"] = spcp.SQLPoolConnectionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolConnectionPolicy struct. -func (spcp *SQLPoolConnectionPolicy) 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 - } - spcp.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - spcp.Location = &location - } - case "properties": - if v != nil { - var SQLPoolConnectionPolicyProperties SQLPoolConnectionPolicyProperties - err = json.Unmarshal(*v, &SQLPoolConnectionPolicyProperties) - if err != nil { - return err - } - spcp.SQLPoolConnectionPolicyProperties = &SQLPoolConnectionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spcp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spcp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spcp.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolConnectionPolicyProperties properties of a Sql pool connection policy. -type SQLPoolConnectionPolicyProperties struct { - // SecurityEnabledAccess - The state of security access. - SecurityEnabledAccess *string `json:"securityEnabledAccess,omitempty"` - // ProxyDNSName - The fully qualified host name of the auditing proxy. - ProxyDNSName *string `json:"proxyDnsName,omitempty"` - // ProxyPort - The port number of the auditing proxy. - ProxyPort *string `json:"proxyPort,omitempty"` - // Visibility - The visibility of the auditing proxy. - Visibility *string `json:"visibility,omitempty"` - // UseServerDefault - Whether server default is enabled or disabled. - UseServerDefault *string `json:"useServerDefault,omitempty"` - // RedirectionState - The state of proxy redirection. - RedirectionState *string `json:"redirectionState,omitempty"` - // State - The connection policy state. - State *string `json:"state,omitempty"` -} - -// SQLPoolInfoListResult list of SQL pools -type SQLPoolInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of SQL pools - Value *[]SQLPool `json:"value,omitempty"` -} - -// SQLPoolInfoListResultIterator provides access to a complete listing of SQLPool values. -type SQLPoolInfoListResultIterator struct { - i int - page SQLPoolInfoListResultPage -} - -// 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 *SQLPoolInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolInfoListResultIterator.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 *SQLPoolInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolInfoListResultIterator) 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 SQLPoolInfoListResultIterator) Response() SQLPoolInfoListResult { - 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 SQLPoolInfoListResultIterator) Value() SQLPool { - if !iter.page.NotDone() { - return SQLPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolInfoListResultIterator type. -func NewSQLPoolInfoListResultIterator(page SQLPoolInfoListResultPage) SQLPoolInfoListResultIterator { - return SQLPoolInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spilr SQLPoolInfoListResult) IsEmpty() bool { - return spilr.Value == nil || len(*spilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spilr SQLPoolInfoListResult) hasNextLink() bool { - return spilr.NextLink != nil && len(*spilr.NextLink) != 0 -} - -// sQLPoolInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spilr SQLPoolInfoListResult) sQLPoolInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spilr.NextLink))) -} - -// SQLPoolInfoListResultPage contains a page of SQLPool values. -type SQLPoolInfoListResultPage struct { - fn func(context.Context, SQLPoolInfoListResult) (SQLPoolInfoListResult, error) - spilr SQLPoolInfoListResult -} - -// 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 *SQLPoolInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolInfoListResultPage.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.spilr) - if err != nil { - return err - } - page.spilr = 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 *SQLPoolInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolInfoListResultPage) NotDone() bool { - return !page.spilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolInfoListResultPage) Response() SQLPoolInfoListResult { - return page.spilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolInfoListResultPage) Values() []SQLPool { - if page.spilr.IsEmpty() { - return nil - } - return *page.spilr.Value -} - -// Creates a new instance of the SQLPoolInfoListResultPage type. -func NewSQLPoolInfoListResultPage(cur SQLPoolInfoListResult, getNextPage func(context.Context, SQLPoolInfoListResult) (SQLPoolInfoListResult, error)) SQLPoolInfoListResultPage { - return SQLPoolInfoListResultPage{ - fn: getNextPage, - spilr: cur, - } -} - -// SQLPoolOperation a Sql pool operation. -type SQLPoolOperation struct { - // SQLPoolOperationProperties - Resource properties. - *SQLPoolOperationProperties `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 SQLPoolOperation. -func (spo SQLPoolOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spo.SQLPoolOperationProperties != nil { - objectMap["properties"] = spo.SQLPoolOperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolOperation struct. -func (spo *SQLPoolOperation) 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 SQLPoolOperationProperties SQLPoolOperationProperties - err = json.Unmarshal(*v, &SQLPoolOperationProperties) - if err != nil { - return err - } - spo.SQLPoolOperationProperties = &SQLPoolOperationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spo.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spo.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spo.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolOperationProperties the properties of a Sql pool operation. -type SQLPoolOperationProperties struct { - // DatabaseName - READ-ONLY; The name of the Sql pool the operation is being performed on. - DatabaseName *string `json:"databaseName,omitempty"` - // Operation - READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty"` - // OperationFriendlyName - READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` - // PercentComplete - READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ServerName - READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The operation state. Possible values include: 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled' - State ManagementOperationState `json:"state,omitempty"` - // ErrorCode - READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorDescription - READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty"` - // ErrorSeverity - READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // IsUserError - READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty"` - // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` - // Description - READ-ONLY; The operation description. - Description *string `json:"description,omitempty"` - // IsCancellable - READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolOperationProperties. -func (spop SQLPoolOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolPatchInfo a SQL Analytics pool patch info -type SQLPoolPatchInfo struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // Sku - SQL pool SKU - Sku *Sku `json:"sku,omitempty"` - // SQLPoolResourceProperties - SQL pool properties - *SQLPoolResourceProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolPatchInfo. -func (sppi SQLPoolPatchInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sppi.Tags != nil { - objectMap["tags"] = sppi.Tags - } - if sppi.Location != nil { - objectMap["location"] = sppi.Location - } - if sppi.Sku != nil { - objectMap["sku"] = sppi.Sku - } - if sppi.SQLPoolResourceProperties != nil { - objectMap["properties"] = sppi.SQLPoolResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolPatchInfo struct. -func (sppi *SQLPoolPatchInfo) 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 - } - sppi.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sppi.Location = &location - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sppi.Sku = &sku - } - case "properties": - if v != nil { - var SQLPoolResourceProperties SQLPoolResourceProperties - err = json.Unmarshal(*v, &SQLPoolResourceProperties) - if err != nil { - return err - } - sppi.SQLPoolResourceProperties = &SQLPoolResourceProperties - } - } - } - - return nil -} - -// SQLPoolResourceProperties properties of a SQL Analytics pool -type SQLPoolResourceProperties struct { - // MaxSizeBytes - Maximum size in bytes - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // Collation - Collation mode - Collation *string `json:"collation,omitempty"` - // SourceDatabaseID - Source database to create from - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // RecoverableDatabaseID - Backup database to restore from - RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` - // ProvisioningState - Resource state - ProvisioningState *string `json:"provisioningState,omitempty"` - // Status - Resource status - Status *string `json:"status,omitempty"` - // RestorePointInTime - Snapshot time to restore - RestorePointInTime *string `json:"restorePointInTime,omitempty"` - // CreateMode - What is this? - CreateMode *string `json:"createMode,omitempty"` - // CreationDate - Date the SQL pool was created - CreationDate *date.Time `json:"creationDate,omitempty"` -} - -// SQLPoolRestorePointsCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLPoolRestorePointsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolRestorePointsClient) (RestorePoint, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolRestorePointsCreateFuture) 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 SQLPoolRestorePointsCreateFuture.Result. -func (future *SQLPoolRestorePointsCreateFuture) result(client SQLPoolRestorePointsClient) (rp RestorePoint, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolRestorePointsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rp.Response.Response, err = future.GetResult(sender); err == nil && rp.Response.Response.StatusCode != http.StatusNoContent { - rp, err = client.CreateResponder(rp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsCreateFuture", "Result", rp.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolSchema a Sql pool schema resource. -type SQLPoolSchema struct { - autorest.Response `json:"-"` - // 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 SQLPoolSchema. -func (sps SQLPoolSchema) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolSchemaListResult a list of Sql pool schemas. -type SQLPoolSchemaListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolSchema `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolSchemaListResult. -func (spslr SQLPoolSchemaListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolSchemaListResultIterator provides access to a complete listing of SQLPoolSchema values. -type SQLPoolSchemaListResultIterator struct { - i int - page SQLPoolSchemaListResultPage -} - -// 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 *SQLPoolSchemaListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemaListResultIterator.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 *SQLPoolSchemaListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolSchemaListResultIterator) 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 SQLPoolSchemaListResultIterator) Response() SQLPoolSchemaListResult { - 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 SQLPoolSchemaListResultIterator) Value() SQLPoolSchema { - if !iter.page.NotDone() { - return SQLPoolSchema{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolSchemaListResultIterator type. -func NewSQLPoolSchemaListResultIterator(page SQLPoolSchemaListResultPage) SQLPoolSchemaListResultIterator { - return SQLPoolSchemaListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spslr SQLPoolSchemaListResult) IsEmpty() bool { - return spslr.Value == nil || len(*spslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spslr SQLPoolSchemaListResult) hasNextLink() bool { - return spslr.NextLink != nil && len(*spslr.NextLink) != 0 -} - -// sQLPoolSchemaListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spslr SQLPoolSchemaListResult) sQLPoolSchemaListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spslr.NextLink))) -} - -// SQLPoolSchemaListResultPage contains a page of SQLPoolSchema values. -type SQLPoolSchemaListResultPage struct { - fn func(context.Context, SQLPoolSchemaListResult) (SQLPoolSchemaListResult, error) - spslr SQLPoolSchemaListResult -} - -// 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 *SQLPoolSchemaListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemaListResultPage.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.spslr) - if err != nil { - return err - } - page.spslr = 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 *SQLPoolSchemaListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolSchemaListResultPage) NotDone() bool { - return !page.spslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolSchemaListResultPage) Response() SQLPoolSchemaListResult { - return page.spslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolSchemaListResultPage) Values() []SQLPoolSchema { - if page.spslr.IsEmpty() { - return nil - } - return *page.spslr.Value -} - -// Creates a new instance of the SQLPoolSchemaListResultPage type. -func NewSQLPoolSchemaListResultPage(cur SQLPoolSchemaListResult, getNextPage func(context.Context, SQLPoolSchemaListResult) (SQLPoolSchemaListResult, error)) SQLPoolSchemaListResultPage { - return SQLPoolSchemaListResultPage{ - fn: getNextPage, - spslr: cur, - } -} - -// SQLPoolsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SQLPoolsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolsClient) (SQLPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolsCreateFuture) 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 SQLPoolsCreateFuture.Result. -func (future *SQLPoolsCreateFuture) result(client SQLPoolsClient) (sp SQLPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolsCreateFuture") - 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, "synapse.SQLPoolsCreateFuture", "Result", sp.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SQLPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolsClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolsDeleteFuture) 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 SQLPoolsDeleteFuture.Result. -func (future *SQLPoolsDeleteFuture) result(client SQLPoolsClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.DeleteResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsDeleteFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolSecurityAlertPolicy a Sql pool security alert policy. -type SQLPoolSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // SecurityAlertPolicyProperties - Resource properties. - *SecurityAlertPolicyProperties `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 SQLPoolSecurityAlertPolicy. -func (spsap SQLPoolSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spsap.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = spsap.SecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolSecurityAlertPolicy struct. -func (spsap *SQLPoolSecurityAlertPolicy) 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 securityAlertPolicyProperties SecurityAlertPolicyProperties - err = json.Unmarshal(*v, &securityAlertPolicyProperties) - if err != nil { - return err - } - spsap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spsap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spsap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spsap.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolsPauseFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SQLPoolsPauseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolsClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolsPauseFuture) 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 SQLPoolsPauseFuture.Result. -func (future *SQLPoolsPauseFuture) result(client SQLPoolsClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsPauseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolsPauseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.PauseResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsPauseFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolsResumeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SQLPoolsResumeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolsClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolsResumeFuture) 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 SQLPoolsResumeFuture.Result. -func (future *SQLPoolsResumeFuture) result(client SQLPoolsClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsResumeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolsResumeFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.ResumeResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsResumeFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolTable a Sql pool table resource. -type SQLPoolTable struct { - autorest.Response `json:"-"` - // 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 SQLPoolTable. -func (spt SQLPoolTable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolTableListResult a list of Sql pool tables. -type SQLPoolTableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolTable `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolTableListResult. -func (sptlr SQLPoolTableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolTableListResultIterator provides access to a complete listing of SQLPoolTable values. -type SQLPoolTableListResultIterator struct { - i int - page SQLPoolTableListResultPage -} - -// 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 *SQLPoolTableListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTableListResultIterator.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 *SQLPoolTableListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolTableListResultIterator) 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 SQLPoolTableListResultIterator) Response() SQLPoolTableListResult { - 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 SQLPoolTableListResultIterator) Value() SQLPoolTable { - if !iter.page.NotDone() { - return SQLPoolTable{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolTableListResultIterator type. -func NewSQLPoolTableListResultIterator(page SQLPoolTableListResultPage) SQLPoolTableListResultIterator { - return SQLPoolTableListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sptlr SQLPoolTableListResult) IsEmpty() bool { - return sptlr.Value == nil || len(*sptlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sptlr SQLPoolTableListResult) hasNextLink() bool { - return sptlr.NextLink != nil && len(*sptlr.NextLink) != 0 -} - -// sQLPoolTableListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sptlr SQLPoolTableListResult) sQLPoolTableListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sptlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sptlr.NextLink))) -} - -// SQLPoolTableListResultPage contains a page of SQLPoolTable values. -type SQLPoolTableListResultPage struct { - fn func(context.Context, SQLPoolTableListResult) (SQLPoolTableListResult, error) - sptlr SQLPoolTableListResult -} - -// 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 *SQLPoolTableListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTableListResultPage.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.sptlr) - if err != nil { - return err - } - page.sptlr = 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 *SQLPoolTableListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolTableListResultPage) NotDone() bool { - return !page.sptlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolTableListResultPage) Response() SQLPoolTableListResult { - return page.sptlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolTableListResultPage) Values() []SQLPoolTable { - if page.sptlr.IsEmpty() { - return nil - } - return *page.sptlr.Value -} - -// Creates a new instance of the SQLPoolTableListResultPage type. -func NewSQLPoolTableListResultPage(cur SQLPoolTableListResult, getNextPage func(context.Context, SQLPoolTableListResult) (SQLPoolTableListResult, error)) SQLPoolTableListResultPage { - return SQLPoolTableListResultPage{ - fn: getNextPage, - sptlr: cur, - } -} - -// SQLPoolUsage the Sql pool usages. -type SQLPoolUsage struct { - // Name - READ-ONLY; The name of the usage metric. - Name *string `json:"name,omitempty"` - // ResourceName - READ-ONLY; The name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // DisplayName - READ-ONLY; The usage metric display name. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; The current value of the usage metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The current limit of the usage metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units of the usage metric. - Unit *string `json:"unit,omitempty"` - // NextResetTime - READ-ONLY; The next reset time for the usage metric (ISO8601 format). - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolUsage. -func (spu SQLPoolUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolUsageListResult the response to a list Sql pool usages request. -type SQLPoolUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of usages for the Sql pool. - Value *[]SQLPoolUsage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolUsageListResult. -func (spulr SQLPoolUsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spulr.Value != nil { - objectMap["value"] = spulr.Value - } - return json.Marshal(objectMap) -} - -// SQLPoolUsageListResultIterator provides access to a complete listing of SQLPoolUsage values. -type SQLPoolUsageListResultIterator struct { - i int - page SQLPoolUsageListResultPage -} - -// 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 *SQLPoolUsageListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolUsageListResultIterator.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 *SQLPoolUsageListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolUsageListResultIterator) 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 SQLPoolUsageListResultIterator) Response() SQLPoolUsageListResult { - 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 SQLPoolUsageListResultIterator) Value() SQLPoolUsage { - if !iter.page.NotDone() { - return SQLPoolUsage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolUsageListResultIterator type. -func NewSQLPoolUsageListResultIterator(page SQLPoolUsageListResultPage) SQLPoolUsageListResultIterator { - return SQLPoolUsageListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spulr SQLPoolUsageListResult) IsEmpty() bool { - return spulr.Value == nil || len(*spulr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spulr SQLPoolUsageListResult) hasNextLink() bool { - return spulr.NextLink != nil && len(*spulr.NextLink) != 0 -} - -// sQLPoolUsageListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spulr SQLPoolUsageListResult) sQLPoolUsageListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spulr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spulr.NextLink))) -} - -// SQLPoolUsageListResultPage contains a page of SQLPoolUsage values. -type SQLPoolUsageListResultPage struct { - fn func(context.Context, SQLPoolUsageListResult) (SQLPoolUsageListResult, error) - spulr SQLPoolUsageListResult -} - -// 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 *SQLPoolUsageListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolUsageListResultPage.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.spulr) - if err != nil { - return err - } - page.spulr = 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 *SQLPoolUsageListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolUsageListResultPage) NotDone() bool { - return !page.spulr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolUsageListResultPage) Response() SQLPoolUsageListResult { - return page.spulr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolUsageListResultPage) Values() []SQLPoolUsage { - if page.spulr.IsEmpty() { - return nil - } - return *page.spulr.Value -} - -// Creates a new instance of the SQLPoolUsageListResultPage type. -func NewSQLPoolUsageListResultPage(cur SQLPoolUsageListResult, getNextPage func(context.Context, SQLPoolUsageListResult) (SQLPoolUsageListResult, error)) SQLPoolUsageListResultPage { - return SQLPoolUsageListResultPage{ - fn: getNextPage, - spulr: cur, - } -} - -// SQLPoolVulnerabilityAssessment a Sql pool vulnerability assessment. -type SQLPoolVulnerabilityAssessment struct { - autorest.Response `json:"-"` - // SQLPoolVulnerabilityAssessmentProperties - Resource properties. - *SQLPoolVulnerabilityAssessmentProperties `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 SQLPoolVulnerabilityAssessment. -func (spva SQLPoolVulnerabilityAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spva.SQLPoolVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = spva.SQLPoolVulnerabilityAssessmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolVulnerabilityAssessment struct. -func (spva *SQLPoolVulnerabilityAssessment) 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 SQLPoolVulnerabilityAssessmentProperties SQLPoolVulnerabilityAssessmentProperties - err = json.Unmarshal(*v, &SQLPoolVulnerabilityAssessmentProperties) - if err != nil { - return err - } - spva.SQLPoolVulnerabilityAssessmentProperties = &SQLPoolVulnerabilityAssessmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spva.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spva.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spva.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolVulnerabilityAssessmentListResult a list of the Sql pool's vulnerability assessments. -type SQLPoolVulnerabilityAssessmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolVulnerabilityAssessment `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolVulnerabilityAssessmentListResult. -func (spvalr SQLPoolVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolVulnerabilityAssessmentListResultIterator provides access to a complete listing of -// SQLPoolVulnerabilityAssessment values. -type SQLPoolVulnerabilityAssessmentListResultIterator struct { - i int - page SQLPoolVulnerabilityAssessmentListResultPage -} - -// 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 *SQLPoolVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentListResultIterator.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 *SQLPoolVulnerabilityAssessmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolVulnerabilityAssessmentListResultIterator) 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 SQLPoolVulnerabilityAssessmentListResultIterator) Response() SQLPoolVulnerabilityAssessmentListResult { - 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 SQLPoolVulnerabilityAssessmentListResultIterator) Value() SQLPoolVulnerabilityAssessment { - if !iter.page.NotDone() { - return SQLPoolVulnerabilityAssessment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolVulnerabilityAssessmentListResultIterator type. -func NewSQLPoolVulnerabilityAssessmentListResultIterator(page SQLPoolVulnerabilityAssessmentListResultPage) SQLPoolVulnerabilityAssessmentListResultIterator { - return SQLPoolVulnerabilityAssessmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spvalr SQLPoolVulnerabilityAssessmentListResult) IsEmpty() bool { - return spvalr.Value == nil || len(*spvalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spvalr SQLPoolVulnerabilityAssessmentListResult) hasNextLink() bool { - return spvalr.NextLink != nil && len(*spvalr.NextLink) != 0 -} - -// sQLPoolVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spvalr SQLPoolVulnerabilityAssessmentListResult) sQLPoolVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spvalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spvalr.NextLink))) -} - -// SQLPoolVulnerabilityAssessmentListResultPage contains a page of SQLPoolVulnerabilityAssessment values. -type SQLPoolVulnerabilityAssessmentListResultPage struct { - fn func(context.Context, SQLPoolVulnerabilityAssessmentListResult) (SQLPoolVulnerabilityAssessmentListResult, error) - spvalr SQLPoolVulnerabilityAssessmentListResult -} - -// 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 *SQLPoolVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentListResultPage.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.spvalr) - if err != nil { - return err - } - page.spvalr = 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 *SQLPoolVulnerabilityAssessmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolVulnerabilityAssessmentListResultPage) NotDone() bool { - return !page.spvalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolVulnerabilityAssessmentListResultPage) Response() SQLPoolVulnerabilityAssessmentListResult { - return page.spvalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolVulnerabilityAssessmentListResultPage) Values() []SQLPoolVulnerabilityAssessment { - if page.spvalr.IsEmpty() { - return nil - } - return *page.spvalr.Value -} - -// Creates a new instance of the SQLPoolVulnerabilityAssessmentListResultPage type. -func NewSQLPoolVulnerabilityAssessmentListResultPage(cur SQLPoolVulnerabilityAssessmentListResult, getNextPage func(context.Context, SQLPoolVulnerabilityAssessmentListResult) (SQLPoolVulnerabilityAssessmentListResult, error)) SQLPoolVulnerabilityAssessmentListResultPage { - return SQLPoolVulnerabilityAssessmentListResultPage{ - fn: getNextPage, - spvalr: cur, - } -} - -// SQLPoolVulnerabilityAssessmentProperties properties of a Sql pool Vulnerability Assessment. -type SQLPoolVulnerabilityAssessmentProperties struct { - // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // StorageContainerSasKey - A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RecurringScans - The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` -} - -// SQLPoolVulnerabilityAssessmentRuleBaseline a Sql pool vulnerability assessment rule baseline. -type SQLPoolVulnerabilityAssessmentRuleBaseline struct { - autorest.Response `json:"-"` - // SQLPoolVulnerabilityAssessmentRuleBaselineProperties - Resource properties. - *SQLPoolVulnerabilityAssessmentRuleBaselineProperties `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 SQLPoolVulnerabilityAssessmentRuleBaseline. -func (spvarb SQLPoolVulnerabilityAssessmentRuleBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spvarb.SQLPoolVulnerabilityAssessmentRuleBaselineProperties != nil { - objectMap["properties"] = spvarb.SQLPoolVulnerabilityAssessmentRuleBaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolVulnerabilityAssessmentRuleBaseline struct. -func (spvarb *SQLPoolVulnerabilityAssessmentRuleBaseline) 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 SQLPoolVulnerabilityAssessmentRuleBaselineProperties SQLPoolVulnerabilityAssessmentRuleBaselineProperties - err = json.Unmarshal(*v, &SQLPoolVulnerabilityAssessmentRuleBaselineProperties) - if err != nil { - return err - } - spvarb.SQLPoolVulnerabilityAssessmentRuleBaselineProperties = &SQLPoolVulnerabilityAssessmentRuleBaselineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spvarb.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spvarb.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spvarb.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolVulnerabilityAssessmentRuleBaselineItem properties for an Sql pool vulnerability assessment rule -// baseline's result. -type SQLPoolVulnerabilityAssessmentRuleBaselineItem struct { - // Result - The rule baseline result - Result *[]string `json:"result,omitempty"` -} - -// SQLPoolVulnerabilityAssessmentRuleBaselineProperties properties of a Sql pool vulnerability assessment -// rule baseline. -type SQLPoolVulnerabilityAssessmentRuleBaselineProperties struct { - // BaselineResults - The rule baseline result - BaselineResults *[]SQLPoolVulnerabilityAssessmentRuleBaselineItem `json:"baselineResults,omitempty"` -} - -// SQLPoolVulnerabilityAssessmentScanExportProperties properties of the export operation's result. -type SQLPoolVulnerabilityAssessmentScanExportProperties struct { - // ExportedReportLocation - READ-ONLY; Location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). - ExportedReportLocation *string `json:"exportedReportLocation,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolVulnerabilityAssessmentScanExportProperties. -func (spvasep SQLPoolVulnerabilityAssessmentScanExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolVulnerabilityAssessmentScansExport a Sql pool Vulnerability Assessment scan export resource. -type SQLPoolVulnerabilityAssessmentScansExport struct { - autorest.Response `json:"-"` - // SQLPoolVulnerabilityAssessmentScanExportProperties - Resource properties. - *SQLPoolVulnerabilityAssessmentScanExportProperties `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 SQLPoolVulnerabilityAssessmentScansExport. -func (spvase SQLPoolVulnerabilityAssessmentScansExport) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spvase.SQLPoolVulnerabilityAssessmentScanExportProperties != nil { - objectMap["properties"] = spvase.SQLPoolVulnerabilityAssessmentScanExportProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolVulnerabilityAssessmentScansExport struct. -func (spvase *SQLPoolVulnerabilityAssessmentScansExport) 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 SQLPoolVulnerabilityAssessmentScanExportProperties SQLPoolVulnerabilityAssessmentScanExportProperties - err = json.Unmarshal(*v, &SQLPoolVulnerabilityAssessmentScanExportProperties) - if err != nil { - return err - } - spvase.SQLPoolVulnerabilityAssessmentScanExportProperties = &SQLPoolVulnerabilityAssessmentScanExportProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spvase.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spvase.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spvase.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolVulnerabilityAssessmentScansInitiateScanFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLPoolVulnerabilityAssessmentScansInitiateScanFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolVulnerabilityAssessmentScansClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolVulnerabilityAssessmentScansInitiateScanFuture) 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 SQLPoolVulnerabilityAssessmentScansInitiateScanFuture.Result. -func (future *SQLPoolVulnerabilityAssessmentScansInitiateScanFuture) result(client SQLPoolVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolVulnerabilityAssessmentScansInitiateScanFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLPoolWorkloadClassifierCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLPoolWorkloadClassifierCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolWorkloadClassifierClient) (WorkloadClassifier, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolWorkloadClassifierCreateOrUpdateFuture) 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 SQLPoolWorkloadClassifierCreateOrUpdateFuture.Result. -func (future *SQLPoolWorkloadClassifierCreateOrUpdateFuture) result(client SQLPoolWorkloadClassifierClient) (wc WorkloadClassifier, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - wc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolWorkloadClassifierCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if wc.Response.Response, err = future.GetResult(sender); err == nil && wc.Response.Response.StatusCode != http.StatusNoContent { - wc, err = client.CreateOrUpdateResponder(wc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierCreateOrUpdateFuture", "Result", wc.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolWorkloadClassifierDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLPoolWorkloadClassifierDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolWorkloadClassifierClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolWorkloadClassifierDeleteFuture) 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 SQLPoolWorkloadClassifierDeleteFuture.Result. -func (future *SQLPoolWorkloadClassifierDeleteFuture) result(client SQLPoolWorkloadClassifierClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolWorkloadClassifierDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLPoolWorkloadGroupCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLPoolWorkloadGroupCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolWorkloadGroupClient) (WorkloadGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolWorkloadGroupCreateOrUpdateFuture) 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 SQLPoolWorkloadGroupCreateOrUpdateFuture.Result. -func (future *SQLPoolWorkloadGroupCreateOrUpdateFuture) result(client SQLPoolWorkloadGroupClient) (wg WorkloadGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - wg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolWorkloadGroupCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if wg.Response.Response, err = future.GetResult(sender); err == nil && wg.Response.Response.StatusCode != http.StatusNoContent { - wg, err = client.CreateOrUpdateResponder(wg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupCreateOrUpdateFuture", "Result", wg.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolWorkloadGroupDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLPoolWorkloadGroupDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolWorkloadGroupClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolWorkloadGroupDeleteFuture) 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 SQLPoolWorkloadGroupDeleteFuture.Result. -func (future *SQLPoolWorkloadGroupDeleteFuture) result(client SQLPoolWorkloadGroupClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolWorkloadGroupDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SsisEnvironment ssis environment. -type SsisEnvironment struct { - // FolderID - Folder id which contains environment. - FolderID *int64 `json:"folderId,omitempty"` - // Variables - Variable in environment - Variables *[]SsisVariable `json:"variables,omitempty"` - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeSsisObjectMetadata', 'TypeFolder', 'TypeProject', 'TypePackage', 'TypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SsisEnvironment. -func (se SsisEnvironment) MarshalJSON() ([]byte, error) { - se.Type = TypeEnvironment - objectMap := make(map[string]interface{}) - if se.FolderID != nil { - objectMap["folderId"] = se.FolderID - } - if se.Variables != nil { - objectMap["variables"] = se.Variables - } - if se.ID != nil { - objectMap["id"] = se.ID - } - if se.Name != nil { - objectMap["name"] = se.Name - } - if se.Description != nil { - objectMap["description"] = se.Description - } - if se.Type != "" { - objectMap["type"] = se.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisFolder() (*SsisFolder, bool) { - return nil, false -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisProject() (*SsisProject, bool) { - return nil, false -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisPackage() (*SsisPackage, bool) { - return nil, false -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisEnvironment() (*SsisEnvironment, bool) { - return &se, true -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return nil, false -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &se, true -} - -// SsisEnvironmentReference ssis environment reference. -type SsisEnvironmentReference struct { - // ID - Environment reference id. - ID *int64 `json:"id,omitempty"` - // EnvironmentFolderName - Environment folder name. - EnvironmentFolderName *string `json:"environmentFolderName,omitempty"` - // EnvironmentName - Environment name. - EnvironmentName *string `json:"environmentName,omitempty"` - // ReferenceType - Reference type - ReferenceType *string `json:"referenceType,omitempty"` -} - -// SsisFolder ssis folder. -type SsisFolder struct { - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeSsisObjectMetadata', 'TypeFolder', 'TypeProject', 'TypePackage', 'TypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SsisFolder. -func (sf SsisFolder) MarshalJSON() ([]byte, error) { - sf.Type = TypeFolder - objectMap := make(map[string]interface{}) - if sf.ID != nil { - objectMap["id"] = sf.ID - } - if sf.Name != nil { - objectMap["name"] = sf.Name - } - if sf.Description != nil { - objectMap["description"] = sf.Description - } - if sf.Type != "" { - objectMap["type"] = sf.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisFolder() (*SsisFolder, bool) { - return &sf, true -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisProject() (*SsisProject, bool) { - return nil, false -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisPackage() (*SsisPackage, bool) { - return nil, false -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisEnvironment() (*SsisEnvironment, bool) { - return nil, false -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return nil, false -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &sf, true -} - -// BasicSsisObjectMetadata SSIS object metadata. -type BasicSsisObjectMetadata interface { - AsSsisFolder() (*SsisFolder, bool) - AsSsisProject() (*SsisProject, bool) - AsSsisPackage() (*SsisPackage, bool) - AsSsisEnvironment() (*SsisEnvironment, bool) - AsSsisObjectMetadata() (*SsisObjectMetadata, bool) -} - -// SsisObjectMetadata SSIS object metadata. -type SsisObjectMetadata struct { - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeSsisObjectMetadata', 'TypeFolder', 'TypeProject', 'TypePackage', 'TypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -func unmarshalBasicSsisObjectMetadata(body []byte) (BasicSsisObjectMetadata, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeFolder): - var sf SsisFolder - err := json.Unmarshal(body, &sf) - return sf, err - case string(TypeProject): - var sp SsisProject - err := json.Unmarshal(body, &sp) - return sp, err - case string(TypePackage): - var sp SsisPackage - err := json.Unmarshal(body, &sp) - return sp, err - case string(TypeEnvironment): - var se SsisEnvironment - err := json.Unmarshal(body, &se) - return se, err - default: - var som SsisObjectMetadata - err := json.Unmarshal(body, &som) - return som, err - } -} -func unmarshalBasicSsisObjectMetadataArray(body []byte) ([]BasicSsisObjectMetadata, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - somArray := make([]BasicSsisObjectMetadata, len(rawMessages)) - - for index, rawMessage := range rawMessages { - som, err := unmarshalBasicSsisObjectMetadata(*rawMessage) - if err != nil { - return nil, err - } - somArray[index] = som - } - return somArray, nil -} - -// MarshalJSON is the custom marshaler for SsisObjectMetadata. -func (som SsisObjectMetadata) MarshalJSON() ([]byte, error) { - som.Type = TypeSsisObjectMetadata - objectMap := make(map[string]interface{}) - if som.ID != nil { - objectMap["id"] = som.ID - } - if som.Name != nil { - objectMap["name"] = som.Name - } - if som.Description != nil { - objectMap["description"] = som.Description - } - if som.Type != "" { - objectMap["type"] = som.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisFolder() (*SsisFolder, bool) { - return nil, false -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisProject() (*SsisProject, bool) { - return nil, false -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisPackage() (*SsisPackage, bool) { - return nil, false -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisEnvironment() (*SsisEnvironment, bool) { - return nil, false -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return &som, true -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &som, true -} - -// SsisObjectMetadataListResponse a list of SSIS object metadata. -type SsisObjectMetadataListResponse struct { - autorest.Response `json:"-"` - // Value - List of SSIS object metadata. - Value *[]BasicSsisObjectMetadata `json:"value,omitempty"` - // NextLink - The link to the next page of results, if any remaining results exist. - NextLink *string `json:"nextLink,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for SsisObjectMetadataListResponse struct. -func (somlr *SsisObjectMetadataListResponse) 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 := unmarshalBasicSsisObjectMetadataArray(*v) - if err != nil { - return err - } - somlr.Value = &value - } - case "nextLink": - if v != nil { - var nextLink string - err = json.Unmarshal(*v, &nextLink) - if err != nil { - return err - } - somlr.NextLink = &nextLink - } - } - } - - return nil -} - -// SsisObjectMetadataStatusResponse the status of the operation. -type SsisObjectMetadataStatusResponse struct { - autorest.Response `json:"-"` - // Status - The status of the operation. - Status *string `json:"status,omitempty"` - // Name - The operation name. - Name *string `json:"name,omitempty"` - // Properties - The operation properties. - Properties *string `json:"properties,omitempty"` - // Error - The operation error message. - Error *string `json:"error,omitempty"` -} - -// SsisPackage ssis Package. -type SsisPackage struct { - // FolderID - Folder id which contains package. - FolderID *int64 `json:"folderId,omitempty"` - // ProjectVersion - Project version which contains package. - ProjectVersion *int64 `json:"projectVersion,omitempty"` - // ProjectID - Project id which contains package. - ProjectID *int64 `json:"projectId,omitempty"` - // Parameters - Parameters in package - Parameters *[]SsisParameter `json:"parameters,omitempty"` - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeSsisObjectMetadata', 'TypeFolder', 'TypeProject', 'TypePackage', 'TypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SsisPackage. -func (sp SsisPackage) MarshalJSON() ([]byte, error) { - sp.Type = TypePackage - objectMap := make(map[string]interface{}) - if sp.FolderID != nil { - objectMap["folderId"] = sp.FolderID - } - if sp.ProjectVersion != nil { - objectMap["projectVersion"] = sp.ProjectVersion - } - if sp.ProjectID != nil { - objectMap["projectId"] = sp.ProjectID - } - if sp.Parameters != nil { - objectMap["parameters"] = sp.Parameters - } - if sp.ID != nil { - objectMap["id"] = sp.ID - } - if sp.Name != nil { - objectMap["name"] = sp.Name - } - if sp.Description != nil { - objectMap["description"] = sp.Description - } - if sp.Type != "" { - objectMap["type"] = sp.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisFolder() (*SsisFolder, bool) { - return nil, false -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisProject() (*SsisProject, bool) { - return nil, false -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisPackage() (*SsisPackage, bool) { - return &sp, true -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisEnvironment() (*SsisEnvironment, bool) { - return nil, false -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return nil, false -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &sp, true -} - -// SsisParameter ssis parameter. -type SsisParameter struct { - // ID - Parameter id. - ID *int64 `json:"id,omitempty"` - // Name - Parameter name. - Name *string `json:"name,omitempty"` - // Description - Parameter description. - Description *string `json:"description,omitempty"` - // DataType - Parameter type. - DataType *string `json:"dataType,omitempty"` - // Required - Whether parameter is required. - Required *bool `json:"required,omitempty"` - // Sensitive - Whether parameter is sensitive. - Sensitive *bool `json:"sensitive,omitempty"` - // DesignDefaultValue - Design default value of parameter. - DesignDefaultValue *string `json:"designDefaultValue,omitempty"` - // DefaultValue - Default value of parameter. - DefaultValue *string `json:"defaultValue,omitempty"` - // SensitiveDefaultValue - Default sensitive value of parameter. - SensitiveDefaultValue *string `json:"sensitiveDefaultValue,omitempty"` - // ValueType - Parameter value type. - ValueType *string `json:"valueType,omitempty"` - // ValueSet - Parameter value set. - ValueSet *bool `json:"valueSet,omitempty"` - // Variable - Parameter reference variable. - Variable *string `json:"variable,omitempty"` -} - -// SsisProject ssis project. -type SsisProject struct { - // FolderID - Folder id which contains project. - FolderID *int64 `json:"folderId,omitempty"` - // Version - Project version. - Version *int64 `json:"version,omitempty"` - // EnvironmentRefs - Environment reference in project - EnvironmentRefs *[]SsisEnvironmentReference `json:"environmentRefs,omitempty"` - // Parameters - Parameters in project - Parameters *[]SsisParameter `json:"parameters,omitempty"` - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeSsisObjectMetadata', 'TypeFolder', 'TypeProject', 'TypePackage', 'TypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SsisProject. -func (sp SsisProject) MarshalJSON() ([]byte, error) { - sp.Type = TypeProject - objectMap := make(map[string]interface{}) - if sp.FolderID != nil { - objectMap["folderId"] = sp.FolderID - } - if sp.Version != nil { - objectMap["version"] = sp.Version - } - if sp.EnvironmentRefs != nil { - objectMap["environmentRefs"] = sp.EnvironmentRefs - } - if sp.Parameters != nil { - objectMap["parameters"] = sp.Parameters - } - if sp.ID != nil { - objectMap["id"] = sp.ID - } - if sp.Name != nil { - objectMap["name"] = sp.Name - } - if sp.Description != nil { - objectMap["description"] = sp.Description - } - if sp.Type != "" { - objectMap["type"] = sp.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisFolder() (*SsisFolder, bool) { - return nil, false -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisProject() (*SsisProject, bool) { - return &sp, true -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisPackage() (*SsisPackage, bool) { - return nil, false -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisEnvironment() (*SsisEnvironment, bool) { - return nil, false -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return nil, false -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &sp, true -} - -// SsisVariable ssis variable. -type SsisVariable struct { - // ID - Variable id. - ID *int64 `json:"id,omitempty"` - // Name - Variable name. - Name *string `json:"name,omitempty"` - // Description - Variable description. - Description *string `json:"description,omitempty"` - // DataType - Variable type. - DataType *string `json:"dataType,omitempty"` - // Sensitive - Whether variable is sensitive. - Sensitive *bool `json:"sensitive,omitempty"` - // Value - Variable value. - Value *string `json:"value,omitempty"` - // SensitiveValue - Variable sensitive value. - SensitiveValue *string `json:"sensitiveValue,omitempty"` -} - -// SubResource azure Synapse nested resource, which belongs to a workspace. -type SubResource 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 SubResource. -func (sr SubResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TopQueries a database query. -type TopQueries struct { - // AggregationFunction - READ-ONLY; The function that is used to aggregate each query's metrics. Possible values include: 'Min', 'Max', 'Avg', 'Sum' - AggregationFunction QueryAggregationFunction `json:"aggregationFunction,omitempty"` - // ExecutionType - READ-ONLY; The execution type that is used to filter the query instances that are returned. Possible values include: 'Any', 'Regular', 'Irregular', 'Aborted', 'Exception' - ExecutionType QueryExecutionType `json:"executionType,omitempty"` - // IntervalType - READ-ONLY; The duration of the interval (ISO8601 duration format). - IntervalType *string `json:"intervalType,omitempty"` - // NumberOfTopQueries - READ-ONLY; The number of requested queries. - NumberOfTopQueries *float64 `json:"numberOfTopQueries,omitempty"` - // ObservationStartTime - READ-ONLY; The start time for queries that are returned (ISO8601 format) - ObservationStartTime *date.Time `json:"observationStartTime,omitempty"` - // ObservationEndTime - READ-ONLY; The end time for queries that are returned (ISO8601 format) - ObservationEndTime *date.Time `json:"observationEndTime,omitempty"` - // ObservedMetric - READ-ONLY; The type of metric to use for ordering the top metrics. Possible values include: 'CPU', 'Io', 'Logio', 'Duration', 'ExecutionCount' - ObservedMetric QueryObservedMetricType `json:"observedMetric,omitempty"` - // Queries - READ-ONLY; The list of queries. - Queries *[]QueryStatistic `json:"queries,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopQueries. -func (tq TopQueries) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TopQueriesListResult represents the response to a get top queries request. -type TopQueriesListResult struct { - // Value - The list of top queries. - Value *[]TopQueries `json:"value,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"` -} - -// 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) -} - -// TransparentDataEncryption represents a Sql pool transparent data encryption configuration. -type TransparentDataEncryption struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // TransparentDataEncryptionProperties - Represents the properties of the resource. - *TransparentDataEncryptionProperties `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 TransparentDataEncryption. -func (tde TransparentDataEncryption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tde.TransparentDataEncryptionProperties != nil { - objectMap["properties"] = tde.TransparentDataEncryptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryption struct. -func (tde *TransparentDataEncryption) 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 - } - tde.Location = &location - } - case "properties": - if v != nil { - var transparentDataEncryptionProperties TransparentDataEncryptionProperties - err = json.Unmarshal(*v, &transparentDataEncryptionProperties) - if err != nil { - return err - } - tde.TransparentDataEncryptionProperties = &transparentDataEncryptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tde.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tde.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tde.Type = &typeVar - } - } - } - - return nil -} - -// TransparentDataEncryptionListResult a list of transparent data encryption configurations. -type TransparentDataEncryptionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]TransparentDataEncryption `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryptionListResult. -func (tdelr TransparentDataEncryptionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TransparentDataEncryptionListResultIterator provides access to a complete listing of -// TransparentDataEncryption values. -type TransparentDataEncryptionListResultIterator struct { - i int - page TransparentDataEncryptionListResultPage -} - -// 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 *TransparentDataEncryptionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionListResultIterator.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 *TransparentDataEncryptionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TransparentDataEncryptionListResultIterator) 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 TransparentDataEncryptionListResultIterator) Response() TransparentDataEncryptionListResult { - 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 TransparentDataEncryptionListResultIterator) Value() TransparentDataEncryption { - if !iter.page.NotDone() { - return TransparentDataEncryption{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TransparentDataEncryptionListResultIterator type. -func NewTransparentDataEncryptionListResultIterator(page TransparentDataEncryptionListResultPage) TransparentDataEncryptionListResultIterator { - return TransparentDataEncryptionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tdelr TransparentDataEncryptionListResult) IsEmpty() bool { - return tdelr.Value == nil || len(*tdelr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tdelr TransparentDataEncryptionListResult) hasNextLink() bool { - return tdelr.NextLink != nil && len(*tdelr.NextLink) != 0 -} - -// transparentDataEncryptionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tdelr TransparentDataEncryptionListResult) transparentDataEncryptionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tdelr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tdelr.NextLink))) -} - -// TransparentDataEncryptionListResultPage contains a page of TransparentDataEncryption values. -type TransparentDataEncryptionListResultPage struct { - fn func(context.Context, TransparentDataEncryptionListResult) (TransparentDataEncryptionListResult, error) - tdelr TransparentDataEncryptionListResult -} - -// 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 *TransparentDataEncryptionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionListResultPage.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.tdelr) - if err != nil { - return err - } - page.tdelr = 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 *TransparentDataEncryptionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TransparentDataEncryptionListResultPage) NotDone() bool { - return !page.tdelr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TransparentDataEncryptionListResultPage) Response() TransparentDataEncryptionListResult { - return page.tdelr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TransparentDataEncryptionListResultPage) Values() []TransparentDataEncryption { - if page.tdelr.IsEmpty() { - return nil - } - return *page.tdelr.Value -} - -// Creates a new instance of the TransparentDataEncryptionListResultPage type. -func NewTransparentDataEncryptionListResultPage(cur TransparentDataEncryptionListResult, getNextPage func(context.Context, TransparentDataEncryptionListResult) (TransparentDataEncryptionListResult, error)) TransparentDataEncryptionListResultPage { - return TransparentDataEncryptionListResultPage{ - fn: getNextPage, - tdelr: cur, - } -} - -// TransparentDataEncryptionProperties represents the properties of a database transparent data encryption. -type TransparentDataEncryptionProperties struct { - // Status - The status of the database transparent data encryption. Possible values include: 'TransparentDataEncryptionStatusEnabled', 'TransparentDataEncryptionStatusDisabled' - Status TransparentDataEncryptionStatus `json:"status,omitempty"` -} - -// UpdateIntegrationRuntimeNodeRequest update integration runtime node request. -type UpdateIntegrationRuntimeNodeRequest struct { - // ConcurrentJobsLimit - The number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. - ConcurrentJobsLimit *int32 `json:"concurrentJobsLimit,omitempty"` -} - -// UpdateIntegrationRuntimeRequest update integration runtime request. -type UpdateIntegrationRuntimeRequest struct { - // AutoUpdate - Enables or disables the auto-update feature of the self-hosted integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. Possible values include: 'On', 'Off' - AutoUpdate IntegrationRuntimeAutoUpdate `json:"autoUpdate,omitempty"` - // UpdateDelayOffset - The time offset (in hours) in the day, e.g., PT03H is 3 hours. The integration runtime auto update will happen on that time. - UpdateDelayOffset *string `json:"updateDelayOffset,omitempty"` -} - -// VirtualNetworkProfile virtual Network Profile -type VirtualNetworkProfile struct { - // ComputeSubnetID - Subnet ID used for computes in workspace - ComputeSubnetID *string `json:"computeSubnetId,omitempty"` -} - -// VulnerabilityAssessmentRecurringScansProperties properties of a Vulnerability Assessment recurring -// scans. -type VulnerabilityAssessmentRecurringScansProperties struct { - // IsEnabled - Recurring scans state. - IsEnabled *bool `json:"isEnabled,omitempty"` - // EmailSubscriptionAdmins - Specifies that the schedule scan notification will be is sent to the subscription administrators. - EmailSubscriptionAdmins *bool `json:"emailSubscriptionAdmins,omitempty"` - // Emails - Specifies an array of e-mail addresses to which the scan notification is sent. - Emails *[]string `json:"emails,omitempty"` -} - -// VulnerabilityAssessmentScanError properties of a vulnerability assessment scan error. -type VulnerabilityAssessmentScanError struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanError. -func (vase VulnerabilityAssessmentScanError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VulnerabilityAssessmentScanRecord a vulnerability assessment scan record. -type VulnerabilityAssessmentScanRecord struct { - autorest.Response `json:"-"` - // VulnerabilityAssessmentScanRecordProperties - Resource properties. - *VulnerabilityAssessmentScanRecordProperties `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 VulnerabilityAssessmentScanRecord. -func (vasr VulnerabilityAssessmentScanRecord) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vasr.VulnerabilityAssessmentScanRecordProperties != nil { - objectMap["properties"] = vasr.VulnerabilityAssessmentScanRecordProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VulnerabilityAssessmentScanRecord struct. -func (vasr *VulnerabilityAssessmentScanRecord) 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 vulnerabilityAssessmentScanRecordProperties VulnerabilityAssessmentScanRecordProperties - err = json.Unmarshal(*v, &vulnerabilityAssessmentScanRecordProperties) - if err != nil { - return err - } - vasr.VulnerabilityAssessmentScanRecordProperties = &vulnerabilityAssessmentScanRecordProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vasr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vasr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vasr.Type = &typeVar - } - } - } - - return nil -} - -// VulnerabilityAssessmentScanRecordListResult a list of vulnerability assessment scan records. -type VulnerabilityAssessmentScanRecordListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VulnerabilityAssessmentScanRecord `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecordListResult. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VulnerabilityAssessmentScanRecordListResultIterator provides access to a complete listing of -// VulnerabilityAssessmentScanRecord values. -type VulnerabilityAssessmentScanRecordListResultIterator struct { - i int - page VulnerabilityAssessmentScanRecordListResultPage -} - -// 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 *VulnerabilityAssessmentScanRecordListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VulnerabilityAssessmentScanRecordListResultIterator.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 *VulnerabilityAssessmentScanRecordListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VulnerabilityAssessmentScanRecordListResultIterator) 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 VulnerabilityAssessmentScanRecordListResultIterator) Response() VulnerabilityAssessmentScanRecordListResult { - 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 VulnerabilityAssessmentScanRecordListResultIterator) Value() VulnerabilityAssessmentScanRecord { - if !iter.page.NotDone() { - return VulnerabilityAssessmentScanRecord{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VulnerabilityAssessmentScanRecordListResultIterator type. -func NewVulnerabilityAssessmentScanRecordListResultIterator(page VulnerabilityAssessmentScanRecordListResultPage) VulnerabilityAssessmentScanRecordListResultIterator { - return VulnerabilityAssessmentScanRecordListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) IsEmpty() bool { - return vasrlr.Value == nil || len(*vasrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) hasNextLink() bool { - return vasrlr.NextLink != nil && len(*vasrlr.NextLink) != 0 -} - -// vulnerabilityAssessmentScanRecordListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) vulnerabilityAssessmentScanRecordListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vasrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vasrlr.NextLink))) -} - -// VulnerabilityAssessmentScanRecordListResultPage contains a page of VulnerabilityAssessmentScanRecord -// values. -type VulnerabilityAssessmentScanRecordListResultPage struct { - fn func(context.Context, VulnerabilityAssessmentScanRecordListResult) (VulnerabilityAssessmentScanRecordListResult, error) - vasrlr VulnerabilityAssessmentScanRecordListResult -} - -// 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 *VulnerabilityAssessmentScanRecordListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VulnerabilityAssessmentScanRecordListResultPage.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.vasrlr) - if err != nil { - return err - } - page.vasrlr = 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 *VulnerabilityAssessmentScanRecordListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VulnerabilityAssessmentScanRecordListResultPage) NotDone() bool { - return !page.vasrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VulnerabilityAssessmentScanRecordListResultPage) Response() VulnerabilityAssessmentScanRecordListResult { - return page.vasrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VulnerabilityAssessmentScanRecordListResultPage) Values() []VulnerabilityAssessmentScanRecord { - if page.vasrlr.IsEmpty() { - return nil - } - return *page.vasrlr.Value -} - -// Creates a new instance of the VulnerabilityAssessmentScanRecordListResultPage type. -func NewVulnerabilityAssessmentScanRecordListResultPage(cur VulnerabilityAssessmentScanRecordListResult, getNextPage func(context.Context, VulnerabilityAssessmentScanRecordListResult) (VulnerabilityAssessmentScanRecordListResult, error)) VulnerabilityAssessmentScanRecordListResultPage { - return VulnerabilityAssessmentScanRecordListResultPage{ - fn: getNextPage, - vasrlr: cur, - } -} - -// VulnerabilityAssessmentScanRecordProperties properties of a vulnerability assessment scan record. -type VulnerabilityAssessmentScanRecordProperties struct { - // ScanID - READ-ONLY; The scan ID. - ScanID *string `json:"scanId,omitempty"` - // TriggerType - READ-ONLY; The scan trigger type. Possible values include: 'OnDemand', 'Recurring' - TriggerType VulnerabilityAssessmentScanTriggerType `json:"triggerType,omitempty"` - // State - READ-ONLY; The scan status. Possible values include: 'VulnerabilityAssessmentScanStatePassed', 'VulnerabilityAssessmentScanStateFailed', 'VulnerabilityAssessmentScanStateFailedToRun', 'VulnerabilityAssessmentScanStateInProgress' - State VulnerabilityAssessmentScanState `json:"state,omitempty"` - // StartTime - READ-ONLY; The scan start time (UTC). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The scan end time (UTC). - EndTime *date.Time `json:"endTime,omitempty"` - // Errors - READ-ONLY; The scan errors. - Errors *[]VulnerabilityAssessmentScanError `json:"errors,omitempty"` - // StorageContainerPath - READ-ONLY; The scan results storage container path. - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // NumberOfFailedSecurityChecks - READ-ONLY; The number of failed security checks. - NumberOfFailedSecurityChecks *int32 `json:"numberOfFailedSecurityChecks,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecordProperties. -func (vasrp VulnerabilityAssessmentScanRecordProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkloadClassifier workload classifier operations for a data warehouse -type WorkloadClassifier struct { - autorest.Response `json:"-"` - // WorkloadClassifierProperties - Resource properties. - *WorkloadClassifierProperties `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 WorkloadClassifier. -func (wc WorkloadClassifier) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wc.WorkloadClassifierProperties != nil { - objectMap["properties"] = wc.WorkloadClassifierProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkloadClassifier struct. -func (wc *WorkloadClassifier) 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 workloadClassifierProperties WorkloadClassifierProperties - err = json.Unmarshal(*v, &workloadClassifierProperties) - if err != nil { - return err - } - wc.WorkloadClassifierProperties = &workloadClassifierProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wc.Type = &typeVar - } - } - } - - return nil -} - -// WorkloadClassifierListResult a list of workload classifiers for a workload group. -type WorkloadClassifierListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]WorkloadClassifier `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkloadClassifierListResult. -func (wclr WorkloadClassifierListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkloadClassifierListResultIterator provides access to a complete listing of WorkloadClassifier values. -type WorkloadClassifierListResultIterator struct { - i int - page WorkloadClassifierListResultPage -} - -// 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 *WorkloadClassifierListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifierListResultIterator.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 *WorkloadClassifierListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkloadClassifierListResultIterator) 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 WorkloadClassifierListResultIterator) Response() WorkloadClassifierListResult { - 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 WorkloadClassifierListResultIterator) Value() WorkloadClassifier { - if !iter.page.NotDone() { - return WorkloadClassifier{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkloadClassifierListResultIterator type. -func NewWorkloadClassifierListResultIterator(page WorkloadClassifierListResultPage) WorkloadClassifierListResultIterator { - return WorkloadClassifierListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wclr WorkloadClassifierListResult) IsEmpty() bool { - return wclr.Value == nil || len(*wclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wclr WorkloadClassifierListResult) hasNextLink() bool { - return wclr.NextLink != nil && len(*wclr.NextLink) != 0 -} - -// workloadClassifierListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wclr WorkloadClassifierListResult) workloadClassifierListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wclr.NextLink))) -} - -// WorkloadClassifierListResultPage contains a page of WorkloadClassifier values. -type WorkloadClassifierListResultPage struct { - fn func(context.Context, WorkloadClassifierListResult) (WorkloadClassifierListResult, error) - wclr WorkloadClassifierListResult -} - -// 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 *WorkloadClassifierListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifierListResultPage.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.wclr) - if err != nil { - return err - } - page.wclr = 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 *WorkloadClassifierListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkloadClassifierListResultPage) NotDone() bool { - return !page.wclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkloadClassifierListResultPage) Response() WorkloadClassifierListResult { - return page.wclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkloadClassifierListResultPage) Values() []WorkloadClassifier { - if page.wclr.IsEmpty() { - return nil - } - return *page.wclr.Value -} - -// Creates a new instance of the WorkloadClassifierListResultPage type. -func NewWorkloadClassifierListResultPage(cur WorkloadClassifierListResult, getNextPage func(context.Context, WorkloadClassifierListResult) (WorkloadClassifierListResult, error)) WorkloadClassifierListResultPage { - return WorkloadClassifierListResultPage{ - fn: getNextPage, - wclr: cur, - } -} - -// WorkloadClassifierProperties workload classifier definition. For more information look at -// sys.workload_management_workload_classifiers (DMV). -type WorkloadClassifierProperties struct { - // MemberName - The workload classifier member name. - MemberName *string `json:"memberName,omitempty"` - // Label - The workload classifier label. - Label *string `json:"label,omitempty"` - // Context - The workload classifier context. - Context *string `json:"context,omitempty"` - // StartTime - The workload classifier start time for classification. - StartTime *string `json:"startTime,omitempty"` - // EndTime - The workload classifier end time for classification. - EndTime *string `json:"endTime,omitempty"` - // Importance - The workload classifier importance. - Importance *string `json:"importance,omitempty"` -} - -// WorkloadGroup workload group operations for a sql pool -type WorkloadGroup struct { - autorest.Response `json:"-"` - // WorkloadGroupProperties - Resource properties. - *WorkloadGroupProperties `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 WorkloadGroup. -func (wg WorkloadGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wg.WorkloadGroupProperties != nil { - objectMap["properties"] = wg.WorkloadGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkloadGroup struct. -func (wg *WorkloadGroup) 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 workloadGroupProperties WorkloadGroupProperties - err = json.Unmarshal(*v, &workloadGroupProperties) - if err != nil { - return err - } - wg.WorkloadGroupProperties = &workloadGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wg.Type = &typeVar - } - } - } - - return nil -} - -// WorkloadGroupListResult a list of workload groups. -type WorkloadGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]WorkloadGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkloadGroupListResult. -func (wglr WorkloadGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkloadGroupListResultIterator provides access to a complete listing of WorkloadGroup values. -type WorkloadGroupListResultIterator struct { - i int - page WorkloadGroupListResultPage -} - -// 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 *WorkloadGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupListResultIterator.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 *WorkloadGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkloadGroupListResultIterator) 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 WorkloadGroupListResultIterator) Response() WorkloadGroupListResult { - 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 WorkloadGroupListResultIterator) Value() WorkloadGroup { - if !iter.page.NotDone() { - return WorkloadGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkloadGroupListResultIterator type. -func NewWorkloadGroupListResultIterator(page WorkloadGroupListResultPage) WorkloadGroupListResultIterator { - return WorkloadGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wglr WorkloadGroupListResult) IsEmpty() bool { - return wglr.Value == nil || len(*wglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wglr WorkloadGroupListResult) hasNextLink() bool { - return wglr.NextLink != nil && len(*wglr.NextLink) != 0 -} - -// workloadGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wglr WorkloadGroupListResult) workloadGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wglr.NextLink))) -} - -// WorkloadGroupListResultPage contains a page of WorkloadGroup values. -type WorkloadGroupListResultPage struct { - fn func(context.Context, WorkloadGroupListResult) (WorkloadGroupListResult, error) - wglr WorkloadGroupListResult -} - -// 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 *WorkloadGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupListResultPage.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.wglr) - if err != nil { - return err - } - page.wglr = 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 *WorkloadGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkloadGroupListResultPage) NotDone() bool { - return !page.wglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkloadGroupListResultPage) Response() WorkloadGroupListResult { - return page.wglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkloadGroupListResultPage) Values() []WorkloadGroup { - if page.wglr.IsEmpty() { - return nil - } - return *page.wglr.Value -} - -// Creates a new instance of the WorkloadGroupListResultPage type. -func NewWorkloadGroupListResultPage(cur WorkloadGroupListResult, getNextPage func(context.Context, WorkloadGroupListResult) (WorkloadGroupListResult, error)) WorkloadGroupListResultPage { - return WorkloadGroupListResultPage{ - fn: getNextPage, - wglr: cur, - } -} - -// WorkloadGroupProperties workload group definition. For more information look at -// sys.workload_management_workload_groups (DMV). -type WorkloadGroupProperties struct { - // MinResourcePercent - The workload group minimum percentage resource. - MinResourcePercent *int32 `json:"minResourcePercent,omitempty"` - // MaxResourcePercent - The workload group cap percentage resource. - MaxResourcePercent *int32 `json:"maxResourcePercent,omitempty"` - // MinResourcePercentPerRequest - The workload group request minimum grant percentage. - MinResourcePercentPerRequest *float64 `json:"minResourcePercentPerRequest,omitempty"` - // MaxResourcePercentPerRequest - The workload group request maximum grant percentage. - MaxResourcePercentPerRequest *float64 `json:"maxResourcePercentPerRequest,omitempty"` - // Importance - The workload group importance level. - Importance *string `json:"importance,omitempty"` - // QueryExecutionTimeout - The workload group query execution timeout. - QueryExecutionTimeout *int32 `json:"queryExecutionTimeout,omitempty"` -} - -// Workspace a workspace -type Workspace struct { - autorest.Response `json:"-"` - // WorkspaceProperties - Workspace resource properties - *WorkspaceProperties `json:"properties,omitempty"` - // Identity - Identity of the workspace - Identity *ManagedIdentity `json:"identity,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 Workspace. -func (w Workspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WorkspaceProperties != nil { - objectMap["properties"] = w.WorkspaceProperties - } - if w.Identity != nil { - objectMap["identity"] = w.Identity - } - 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 Workspace struct. -func (w *Workspace) 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 workspaceProperties WorkspaceProperties - err = json.Unmarshal(*v, &workspaceProperties) - if err != nil { - return err - } - w.WorkspaceProperties = &workspaceProperties - } - case "identity": - if v != nil { - var identity ManagedIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - w.Identity = &identity - } - 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 -} - -// WorkspaceAadAdminInfo workspace active directory administrator -type WorkspaceAadAdminInfo struct { - autorest.Response `json:"-"` - // AadAdminProperties - Workspace active directory administrator properties - *AadAdminProperties `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 WorkspaceAadAdminInfo. -func (waai WorkspaceAadAdminInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if waai.AadAdminProperties != nil { - objectMap["properties"] = waai.AadAdminProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspaceAadAdminInfo struct. -func (waai *WorkspaceAadAdminInfo) 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 aadAdminProperties AadAdminProperties - err = json.Unmarshal(*v, &aadAdminProperties) - if err != nil { - return err - } - waai.AadAdminProperties = &aadAdminProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - waai.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - waai.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - waai.Type = &typeVar - } - } - } - - return nil -} - -// WorkspaceAadAdminsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspaceAadAdminsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceAadAdminsClient) (WorkspaceAadAdminInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceAadAdminsCreateOrUpdateFuture) 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 WorkspaceAadAdminsCreateOrUpdateFuture.Result. -func (future *WorkspaceAadAdminsCreateOrUpdateFuture) result(client WorkspaceAadAdminsClient) (waai WorkspaceAadAdminInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - waai.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceAadAdminsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if waai.Response.Response, err = future.GetResult(sender); err == nil && waai.Response.Response.StatusCode != http.StatusNoContent { - waai, err = client.CreateOrUpdateResponder(waai.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsCreateOrUpdateFuture", "Result", waai.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceAadAdminsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspaceAadAdminsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceAadAdminsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceAadAdminsDeleteFuture) 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 WorkspaceAadAdminsDeleteFuture.Result. -func (future *WorkspaceAadAdminsDeleteFuture) result(client WorkspaceAadAdminsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceAadAdminsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WorkspaceInfoListResult list of workspaces -type WorkspaceInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of workspaces - Value *[]Workspace `json:"value,omitempty"` -} - -// WorkspaceInfoListResultIterator provides access to a complete listing of Workspace values. -type WorkspaceInfoListResultIterator struct { - i int - page WorkspaceInfoListResultPage -} - -// 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 *WorkspaceInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceInfoListResultIterator.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 *WorkspaceInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkspaceInfoListResultIterator) 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 WorkspaceInfoListResultIterator) Response() WorkspaceInfoListResult { - 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 WorkspaceInfoListResultIterator) Value() Workspace { - if !iter.page.NotDone() { - return Workspace{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkspaceInfoListResultIterator type. -func NewWorkspaceInfoListResultIterator(page WorkspaceInfoListResultPage) WorkspaceInfoListResultIterator { - return WorkspaceInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wilr WorkspaceInfoListResult) IsEmpty() bool { - return wilr.Value == nil || len(*wilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wilr WorkspaceInfoListResult) hasNextLink() bool { - return wilr.NextLink != nil && len(*wilr.NextLink) != 0 -} - -// workspaceInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wilr WorkspaceInfoListResult) workspaceInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wilr.NextLink))) -} - -// WorkspaceInfoListResultPage contains a page of Workspace values. -type WorkspaceInfoListResultPage struct { - fn func(context.Context, WorkspaceInfoListResult) (WorkspaceInfoListResult, error) - wilr WorkspaceInfoListResult -} - -// 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 *WorkspaceInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceInfoListResultPage.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.wilr) - if err != nil { - return err - } - page.wilr = 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 *WorkspaceInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkspaceInfoListResultPage) NotDone() bool { - return !page.wilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkspaceInfoListResultPage) Response() WorkspaceInfoListResult { - return page.wilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkspaceInfoListResultPage) Values() []Workspace { - if page.wilr.IsEmpty() { - return nil - } - return *page.wilr.Value -} - -// Creates a new instance of the WorkspaceInfoListResultPage type. -func NewWorkspaceInfoListResultPage(cur WorkspaceInfoListResult, getNextPage func(context.Context, WorkspaceInfoListResult) (WorkspaceInfoListResult, error)) WorkspaceInfoListResultPage { - return WorkspaceInfoListResultPage{ - fn: getNextPage, - wilr: cur, - } -} - -// WorkspaceKeyDetails details of the customer managed key associated with the workspace -type WorkspaceKeyDetails struct { - // Name - Workspace Key sub-resource name - Name *string `json:"name,omitempty"` - // KeyVaultURL - Workspace Key sub-resource key vault url - KeyVaultURL *string `json:"keyVaultUrl,omitempty"` -} - -// WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedIdentitySQLControlSettingsClient) (ManagedIdentitySQLControlSettingsModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture) 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 WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture.Result. -func (future *WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture) result(client WorkspaceManagedIdentitySQLControlSettingsClient) (miscsm ManagedIdentitySQLControlSettingsModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - miscsm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if miscsm.Response.Response, err = future.GetResult(sender); err == nil && miscsm.Response.Response.StatusCode != http.StatusNoContent { - miscsm, err = client.CreateOrUpdateResponder(miscsm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture", "Result", miscsm.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedSQLServerBlobAuditingPoliciesClient) (ServerBlobAuditingPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture) 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 WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture.Result. -func (future *WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture) result(client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) (sbap ServerBlobAuditingPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sbap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sbap.Response.Response, err = future.GetResult(sender); err == nil && sbap.Response.Response.StatusCode != http.StatusNoContent { - sbap, err = client.CreateOrUpdateResponder(sbap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", sbap.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring -// and retrieving the results of a long-running operation. -type WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) (ExtendedServerBlobAuditingPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture) 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture.Result. -func (future *WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture) result(client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) (esbap ExtendedServerBlobAuditingPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - esbap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if esbap.Response.Response, err = future.GetResult(sender); err == nil && esbap.Response.Response.StatusCode != http.StatusNoContent { - esbap, err = client.CreateOrUpdateResponder(esbap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture", "Result", esbap.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedSQLServerSecurityAlertPolicyClient) (ServerSecurityAlertPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture) 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 WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture.Result. -func (future *WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture) result(client WorkspaceManagedSQLServerSecurityAlertPolicyClient) (ssap ServerSecurityAlertPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ssap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { - ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspacePatchInfo workspace patch details -type WorkspacePatchInfo struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Identity - The identity of the workspace - Identity *ManagedIdentity `json:"identity,omitempty"` - // WorkspacePatchProperties - Workspace patch properties - *WorkspacePatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspacePatchInfo. -func (wpi WorkspacePatchInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpi.Tags != nil { - objectMap["tags"] = wpi.Tags - } - if wpi.Identity != nil { - objectMap["identity"] = wpi.Identity - } - if wpi.WorkspacePatchProperties != nil { - objectMap["properties"] = wpi.WorkspacePatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspacePatchInfo struct. -func (wpi *WorkspacePatchInfo) 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 - } - wpi.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - wpi.Identity = &identity - } - case "properties": - if v != nil { - var workspacePatchProperties WorkspacePatchProperties - err = json.Unmarshal(*v, &workspacePatchProperties) - if err != nil { - return err - } - wpi.WorkspacePatchProperties = &workspacePatchProperties - } - } - } - - return nil -} - -// WorkspacePatchProperties workspace patch properties -type WorkspacePatchProperties struct { - // SQLAdministratorLoginPassword - SQL administrator login password - SQLAdministratorLoginPassword *string `json:"sqlAdministratorLoginPassword,omitempty"` - // ManagedVirtualNetworkSettings - Managed Virtual Network Settings - ManagedVirtualNetworkSettings *ManagedVirtualNetworkSettings `json:"managedVirtualNetworkSettings,omitempty"` - // WorkspaceRepositoryConfiguration - Git integration settings - WorkspaceRepositoryConfiguration *WorkspaceRepositoryConfiguration `json:"workspaceRepositoryConfiguration,omitempty"` - // PurviewConfiguration - Purview Configuration - PurviewConfiguration *PurviewConfiguration `json:"purviewConfiguration,omitempty"` - // ProvisioningState - READ-ONLY; Resource provisioning state - ProvisioningState *string `json:"provisioningState,omitempty"` - // Encryption - The encryption details of the workspace - Encryption *EncryptionDetails `json:"encryption,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspacePatchProperties. -func (wpp WorkspacePatchProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpp.SQLAdministratorLoginPassword != nil { - objectMap["sqlAdministratorLoginPassword"] = wpp.SQLAdministratorLoginPassword - } - if wpp.ManagedVirtualNetworkSettings != nil { - objectMap["managedVirtualNetworkSettings"] = wpp.ManagedVirtualNetworkSettings - } - if wpp.WorkspaceRepositoryConfiguration != nil { - objectMap["workspaceRepositoryConfiguration"] = wpp.WorkspaceRepositoryConfiguration - } - if wpp.PurviewConfiguration != nil { - objectMap["purviewConfiguration"] = wpp.PurviewConfiguration - } - if wpp.Encryption != nil { - objectMap["encryption"] = wpp.Encryption - } - return json.Marshal(objectMap) -} - -// WorkspaceProperties workspace properties -type WorkspaceProperties struct { - // DefaultDataLakeStorage - Workspace default data lake storage account details - DefaultDataLakeStorage *DataLakeStorageAccountDetails `json:"defaultDataLakeStorage,omitempty"` - // SQLAdministratorLoginPassword - SQL administrator login password - SQLAdministratorLoginPassword *string `json:"sqlAdministratorLoginPassword,omitempty"` - // ManagedResourceGroupName - Workspace managed resource group. The resource group name uniquely identifies the resource group within the user subscriptionId. The resource group name must be no longer than 90 characters long, and must be alphanumeric characters (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note that the name cannot end with '.' - ManagedResourceGroupName *string `json:"managedResourceGroupName,omitempty"` - // ProvisioningState - READ-ONLY; Resource provisioning state - ProvisioningState *string `json:"provisioningState,omitempty"` - // SQLAdministratorLogin - Login for workspace SQL active directory administrator - SQLAdministratorLogin *string `json:"sqlAdministratorLogin,omitempty"` - // VirtualNetworkProfile - Virtual Network profile - VirtualNetworkProfile *VirtualNetworkProfile `json:"virtualNetworkProfile,omitempty"` - // ConnectivityEndpoints - Connectivity endpoints - ConnectivityEndpoints map[string]*string `json:"connectivityEndpoints"` - // ManagedVirtualNetwork - Setting this to 'default' will ensure that all compute for this workspace is in a virtual network managed on behalf of the user. - ManagedVirtualNetwork *string `json:"managedVirtualNetwork,omitempty"` - // PrivateEndpointConnections - Private endpoint connections to the workspace - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // Encryption - The encryption details of the workspace - Encryption *EncryptionDetails `json:"encryption,omitempty"` - // WorkspaceUID - READ-ONLY; The workspace unique identifier - WorkspaceUID *uuid.UUID `json:"workspaceUID,omitempty"` - // ExtraProperties - READ-ONLY; Workspace level configs and feature flags - ExtraProperties map[string]interface{} `json:"extraProperties"` - // ManagedVirtualNetworkSettings - Managed Virtual Network Settings - ManagedVirtualNetworkSettings *ManagedVirtualNetworkSettings `json:"managedVirtualNetworkSettings,omitempty"` - // WorkspaceRepositoryConfiguration - Git integration settings - WorkspaceRepositoryConfiguration *WorkspaceRepositoryConfiguration `json:"workspaceRepositoryConfiguration,omitempty"` - // PurviewConfiguration - Purview Configuration - PurviewConfiguration *PurviewConfiguration `json:"purviewConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceProperties. -func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.DefaultDataLakeStorage != nil { - objectMap["defaultDataLakeStorage"] = wp.DefaultDataLakeStorage - } - if wp.SQLAdministratorLoginPassword != nil { - objectMap["sqlAdministratorLoginPassword"] = wp.SQLAdministratorLoginPassword - } - if wp.ManagedResourceGroupName != nil { - objectMap["managedResourceGroupName"] = wp.ManagedResourceGroupName - } - if wp.SQLAdministratorLogin != nil { - objectMap["sqlAdministratorLogin"] = wp.SQLAdministratorLogin - } - if wp.VirtualNetworkProfile != nil { - objectMap["virtualNetworkProfile"] = wp.VirtualNetworkProfile - } - if wp.ConnectivityEndpoints != nil { - objectMap["connectivityEndpoints"] = wp.ConnectivityEndpoints - } - if wp.ManagedVirtualNetwork != nil { - objectMap["managedVirtualNetwork"] = wp.ManagedVirtualNetwork - } - if wp.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = wp.PrivateEndpointConnections - } - if wp.Encryption != nil { - objectMap["encryption"] = wp.Encryption - } - if wp.ManagedVirtualNetworkSettings != nil { - objectMap["managedVirtualNetworkSettings"] = wp.ManagedVirtualNetworkSettings - } - if wp.WorkspaceRepositoryConfiguration != nil { - objectMap["workspaceRepositoryConfiguration"] = wp.WorkspaceRepositoryConfiguration - } - if wp.PurviewConfiguration != nil { - objectMap["purviewConfiguration"] = wp.PurviewConfiguration - } - return json.Marshal(objectMap) -} - -// WorkspaceRepositoryConfiguration git integration settings -type WorkspaceRepositoryConfiguration struct { - // Type - Type of workspace repositoryID configuration. Example WorkspaceVSTSConfiguration, WorkspaceGitHubConfiguration - Type *string `json:"type,omitempty"` - // HostName - GitHub Enterprise host name. For example: https://github.mydomain.com - HostName *string `json:"hostName,omitempty"` - // AccountName - Account name - AccountName *string `json:"accountName,omitempty"` - // ProjectName - VSTS project name - ProjectName *string `json:"projectName,omitempty"` - // RepositoryName - Repository name - RepositoryName *string `json:"repositoryName,omitempty"` - // CollaborationBranch - Collaboration branch - CollaborationBranch *string `json:"collaborationBranch,omitempty"` - // RootFolder - Root folder to use in the repository - RootFolder *string `json:"rootFolder,omitempty"` -} - -// WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspacesClient) (Workspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspacesCreateOrUpdateFuture) 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 WorkspacesCreateOrUpdateFuture.Result. -func (future *WorkspacesCreateOrUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.CreateOrUpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WorkspacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspacesClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspacesDeleteFuture) 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 WorkspacesDeleteFuture.Result. -func (future *WorkspacesDeleteFuture) result(client WorkspacesClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspacesDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.DeleteResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesDeleteFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceSQLAadAdminsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspaceSQLAadAdminsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceSQLAadAdminsClient) (WorkspaceAadAdminInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceSQLAadAdminsCreateOrUpdateFuture) 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 WorkspaceSQLAadAdminsCreateOrUpdateFuture.Result. -func (future *WorkspaceSQLAadAdminsCreateOrUpdateFuture) result(client WorkspaceSQLAadAdminsClient) (waai WorkspaceAadAdminInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - waai.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceSQLAadAdminsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if waai.Response.Response, err = future.GetResult(sender); err == nil && waai.Response.Response.StatusCode != http.StatusNoContent { - waai, err = client.CreateOrUpdateResponder(waai.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsCreateOrUpdateFuture", "Result", waai.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceSQLAadAdminsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspaceSQLAadAdminsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceSQLAadAdminsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceSQLAadAdminsDeleteFuture) 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 WorkspaceSQLAadAdminsDeleteFuture.Result. -func (future *WorkspaceSQLAadAdminsDeleteFuture) result(client WorkspaceSQLAadAdminsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceSQLAadAdminsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WorkspacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WorkspacesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspacesClient) (Workspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspacesUpdateFuture) 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 WorkspacesUpdateFuture.Result. -func (future *WorkspacesUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspacesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.UpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/operations.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/operations.go deleted file mode 100644 index 14574e7c4f87..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/operations.go +++ /dev/null @@ -1,349 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// OperationsClient is the azure Synapse Analytics 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)} -} - -// CheckNameAvailability check whether a workspace name is available -// Parameters: -// request - the check request -func (client OperationsClient) CheckNameAvailability(ctx context.Context, request CheckNameAvailabilityRequest) (result CheckNameAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.OperationsClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, request) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client OperationsClient) CheckNameAvailabilityPreparer(ctx context.Context, request CheckNameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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}/providers/Microsoft.Synapse/checkNameAvailability", pathParameters), - autorest.WithJSON(request), - 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 OperationsClient) 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 OperationsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAzureAsyncHeaderResult get the status of an operation -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// operationID - operation ID -func (client OperationsClient) GetAzureAsyncHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (result OperationResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.GetAzureAsyncHeaderResult") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.OperationsClient", "GetAzureAsyncHeaderResult", err.Error()) - } - - req, err := client.GetAzureAsyncHeaderResultPreparer(ctx, resourceGroupName, workspaceName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetAzureAsyncHeaderResult", nil, "Failure preparing request") - return - } - - resp, err := client.GetAzureAsyncHeaderResultSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetAzureAsyncHeaderResult", resp, "Failure sending request") - return - } - - result, err = client.GetAzureAsyncHeaderResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetAzureAsyncHeaderResult", resp, "Failure responding to request") - return - } - - return -} - -// GetAzureAsyncHeaderResultPreparer prepares the GetAzureAsyncHeaderResult request. -func (client OperationsClient) GetAzureAsyncHeaderResultPreparer(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/operationStatuses/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAzureAsyncHeaderResultSender sends the GetAzureAsyncHeaderResult request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) GetAzureAsyncHeaderResultSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAzureAsyncHeaderResultResponder handles the response to the GetAzureAsyncHeaderResult request. The method always -// closes the http.Response Body. -func (client OperationsClient) GetAzureAsyncHeaderResultResponder(resp *http.Response) (result OperationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLocationHeaderResult get the result of an operation -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// operationID - operation ID -func (client OperationsClient) GetLocationHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.GetLocationHeaderResult") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.OperationsClient", "GetLocationHeaderResult", err.Error()) - } - - req, err := client.GetLocationHeaderResultPreparer(ctx, resourceGroupName, workspaceName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetLocationHeaderResult", nil, "Failure preparing request") - return - } - - resp, err := client.GetLocationHeaderResultSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetLocationHeaderResult", resp, "Failure sending request") - return - } - - result, err = client.GetLocationHeaderResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetLocationHeaderResult", resp, "Failure responding to request") - return - } - - return -} - -// GetLocationHeaderResultPreparer prepares the GetLocationHeaderResult request. -func (client OperationsClient) GetLocationHeaderResultPreparer(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLocationHeaderResultSender sends the GetLocationHeaderResult request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) GetLocationHeaderResultSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLocationHeaderResultResponder handles the response to the GetLocationHeaderResult request. The method always -// closes the http.Response Body. -func (client OperationsClient) GetLocationHeaderResultResponder(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 -} - -// List get all available operations -func (client OperationsClient) List(ctx context.Context) (result ListAvailableRpOperation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Synapse/operations")) - 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 ListAvailableRpOperation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privateendpointconnections.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privateendpointconnections.go deleted file mode 100644 index 3b586413a2c9..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privateendpointconnections.go +++ /dev/null @@ -1,434 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the azure Synapse Analytics Management Client -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create approve or reject a private endpoint connection. -// Parameters: -// request - request body of private endpoint connection to create. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Create(ctx context.Context, request PrivateEndpointConnection, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateEndpointConnectionsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, request, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client PrivateEndpointConnectionsClient) CreatePreparer(ctx context.Context, request PrivateEndpointConnection, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(request), - 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 PrivateEndpointConnectionsClient) CreateSender(req *http.Request) (future PrivateEndpointConnectionsCreateFuture, 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 PrivateEndpointConnectionsClient) CreateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result OperationResource, 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 -} - -// Get gets a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// List lists private endpoint connection in workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.pecl.Response.Response != nil { - sc = result.pecl.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pecl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result.pecl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - if result.pecl.hasNextLink() && result.pecl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) 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 = "2019-06-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.Synapse/workspaces/{workspaceName}/privateEndpointConnections", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionList, 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 PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionList) (result PrivateEndpointConnectionList, err error) { - req, err := lastResults.privateEndpointConnectionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "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, "synapse.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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/synapse/mgmt/2019-06-01-preview/synapse/privateendpointconnectionsprivatelinkhub.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privateendpointconnectionsprivatelinkhub.go deleted file mode 100644 index 8dbcbcdd4468..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privateendpointconnectionsprivatelinkhub.go +++ /dev/null @@ -1,162 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsPrivateLinkHubClient is the azure Synapse Analytics Management Client -type PrivateEndpointConnectionsPrivateLinkHubClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsPrivateLinkHubClient creates an instance of the -// PrivateEndpointConnectionsPrivateLinkHubClient client. -func NewPrivateEndpointConnectionsPrivateLinkHubClient(subscriptionID string) PrivateEndpointConnectionsPrivateLinkHubClient { - return NewPrivateEndpointConnectionsPrivateLinkHubClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsPrivateLinkHubClientWithBaseURI creates an instance of the -// PrivateEndpointConnectionsPrivateLinkHubClient 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 NewPrivateEndpointConnectionsPrivateLinkHubClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsPrivateLinkHubClient { - return PrivateEndpointConnectionsPrivateLinkHubClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get all PrivateEndpointConnections in the PrivateLinkHub -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateEndpointConnectionsPrivateLinkHubClient) List(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsPrivateLinkHubClient.List") - defer func() { - sc := -1 - if result.pecfplhrcr.Response.Response != nil { - sc = result.pecfplhrcr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pecfplhrcr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "List", resp, "Failure sending request") - return - } - - result.pecfplhrcr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "List", resp, "Failure responding to request") - return - } - if result.pecfplhrcr.hasNextLink() && result.pecfplhrcr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsPrivateLinkHubClient) ListPreparer(ctx context.Context, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections", 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 PrivateEndpointConnectionsPrivateLinkHubClient) 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 PrivateEndpointConnectionsPrivateLinkHubClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, 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 PrivateEndpointConnectionsPrivateLinkHubClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) (result PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, err error) { - req, err := lastResults.privateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "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, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsPrivateLinkHubClient) ListComplete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsPrivateLinkHubClient.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, privateLinkHubName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privatelinkhubs.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privatelinkhubs.go deleted file mode 100644 index 12e3254e740e..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privatelinkhubs.go +++ /dev/null @@ -1,629 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkHubsClient is the azure Synapse Analytics Management Client -type PrivateLinkHubsClient struct { - BaseClient -} - -// NewPrivateLinkHubsClient creates an instance of the PrivateLinkHubsClient client. -func NewPrivateLinkHubsClient(subscriptionID string) PrivateLinkHubsClient { - return NewPrivateLinkHubsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkHubsClientWithBaseURI creates an instance of the PrivateLinkHubsClient 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 NewPrivateLinkHubsClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkHubsClient { - return PrivateLinkHubsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a privateLinkHub -// Parameters: -// privateLinkHubInfo - privateLinkHub create or update request properties -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateLinkHubsClient) CreateOrUpdate(ctx context.Context, privateLinkHubInfo PrivateLinkHub, resourceGroupName string, privateLinkHubName string) (result PrivateLinkHub, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateLinkHubsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, privateLinkHubInfo, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateLinkHubsClient) CreateOrUpdatePreparer(ctx context.Context, privateLinkHubInfo PrivateLinkHub, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Synapse/privateLinkHubs/{privateLinkHubName}", pathParameters), - autorest.WithJSON(privateLinkHubInfo), - 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateLinkHub, 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 a privateLinkHub -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateLinkHubsClient) Delete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateLinkHubsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateLinkHubsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateLinkHubsClient) DeletePreparer(ctx context.Context, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Synapse/privateLinkHubs/{privateLinkHubName}", 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 PrivateLinkHubsClient) DeleteSender(req *http.Request) (future PrivateLinkHubsDeleteFuture, 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 PrivateLinkHubsClient) 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 a privateLinkHub -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateLinkHubsClient) Get(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateLinkHub, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateLinkHubsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkHubsClient) GetPreparer(ctx context.Context, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Synapse/privateLinkHubs/{privateLinkHubName}", 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) GetResponder(resp *http.Response) (result PrivateLinkHub, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns a list of privateLinkHubs in a subscription -func (client PrivateLinkHubsClient) List(ctx context.Context) (result PrivateLinkHubInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.List") - defer func() { - sc := -1 - if result.plhilr.Response.Response != nil { - sc = result.plhilr.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("synapse.PrivateLinkHubsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.plhilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "List", resp, "Failure sending request") - return - } - - result.plhilr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "List", resp, "Failure responding to request") - return - } - if result.plhilr.hasNextLink() && result.plhilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkHubsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/privateLinkHubs", 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) ListResponder(resp *http.Response) (result PrivateLinkHubInfoListResult, 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 PrivateLinkHubsClient) listNextResults(ctx context.Context, lastResults PrivateLinkHubInfoListResult) (result PrivateLinkHubInfoListResult, err error) { - req, err := lastResults.privateLinkHubInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "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, "synapse.PrivateLinkHubsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkHubsClient) ListComplete(ctx context.Context) (result PrivateLinkHubInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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 a list of privateLinkHubs in a resource group -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client PrivateLinkHubsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result PrivateLinkHubInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.plhilr.Response.Response != nil { - sc = result.plhilr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateLinkHubsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.plhilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.plhilr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.plhilr.hasNextLink() && result.plhilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PrivateLinkHubsClient) 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 = "2019-06-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.Synapse/privateLinkHubs", 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) ListByResourceGroupResponder(resp *http.Response) (result PrivateLinkHubInfoListResult, 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 PrivateLinkHubsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PrivateLinkHubInfoListResult) (result PrivateLinkHubInfoListResult, err error) { - req, err := lastResults.privateLinkHubInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "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, "synapse.PrivateLinkHubsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkHubsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result PrivateLinkHubInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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 -} - -// Update updates a privateLinkHub -// Parameters: -// privateLinkHubPatchInfo - privateLinkHub patch request properties -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateLinkHubsClient) Update(ctx context.Context, privateLinkHubPatchInfo PrivateLinkHubPatchInfo, resourceGroupName string, privateLinkHubName string) (result PrivateLinkHub, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateLinkHubsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, privateLinkHubPatchInfo, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PrivateLinkHubsClient) UpdatePreparer(ctx context.Context, privateLinkHubPatchInfo PrivateLinkHubPatchInfo, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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.Synapse/privateLinkHubs/{privateLinkHubName}", pathParameters), - autorest.WithJSON(privateLinkHubPatchInfo), - 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) UpdateResponder(resp *http.Response) (result PrivateLinkHub, 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/synapse/mgmt/2019-06-01-preview/synapse/privatelinkresources.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privatelinkresources.go deleted file mode 100644 index 5c21b8afee5e..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/privatelinkresources.go +++ /dev/null @@ -1,249 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the azure Synapse Analytics Management Client -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get private link resource in workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// privateLinkResourceName - the name of the private link resource -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// List get all private link resources for a workspaces -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.PrivateLinkResourcesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "List", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkResourcesClient) 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 = "2019-06-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.Synapse/workspaces/{workspaceName}/privateLinkResources", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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 PrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "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, "synapse.PrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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/synapse/mgmt/2019-06-01-preview/synapse/restorabledroppedsqlpools.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/restorabledroppedsqlpools.go deleted file mode 100644 index 497de0014cb4..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/restorabledroppedsqlpools.go +++ /dev/null @@ -1,208 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableDroppedSQLPoolsClient is the azure Synapse Analytics Management Client -type RestorableDroppedSQLPoolsClient struct { - BaseClient -} - -// NewRestorableDroppedSQLPoolsClient creates an instance of the RestorableDroppedSQLPoolsClient client. -func NewRestorableDroppedSQLPoolsClient(subscriptionID string) RestorableDroppedSQLPoolsClient { - return NewRestorableDroppedSQLPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableDroppedSQLPoolsClientWithBaseURI creates an instance of the RestorableDroppedSQLPoolsClient 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 NewRestorableDroppedSQLPoolsClientWithBaseURI(baseURI string, subscriptionID string) RestorableDroppedSQLPoolsClient { - return RestorableDroppedSQLPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a deleted sql pool that can be restored -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// restorableDroppedSQLPoolID - the id of the deleted Sql Pool in the form of -// sqlPoolName,deletionTimeInFileTimeFormat -func (client RestorableDroppedSQLPoolsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, restorableDroppedSQLPoolID string) (result RestorableDroppedSQLPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedSQLPoolsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.RestorableDroppedSQLPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, restorableDroppedSQLPoolID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RestorableDroppedSQLPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, restorableDroppedSQLPoolID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorableDroppedSqlPoolId": autorest.Encode("path", restorableDroppedSQLPoolID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId}", 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 RestorableDroppedSQLPoolsClient) 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 RestorableDroppedSQLPoolsClient) GetResponder(resp *http.Response) (result RestorableDroppedSQLPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace gets a list of deleted Sql pools that can be restored -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client RestorableDroppedSQLPoolsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result RestorableDroppedSQLPoolListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedSQLPoolsClient.ListByWorkspace") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.RestorableDroppedSQLPoolsClient", "ListByWorkspace", err.Error()) - } - - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client RestorableDroppedSQLPoolsClient) ListByWorkspacePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableDroppedSQLPoolsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client RestorableDroppedSQLPoolsClient) ListByWorkspaceResponder(resp *http.Response) (result RestorableDroppedSQLPoolListResult, 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/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolblobauditingpolicies.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolblobauditingpolicies.go deleted file mode 100644 index eee10d84ccff..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolblobauditingpolicies.go +++ /dev/null @@ -1,345 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolBlobAuditingPoliciesClient is the azure Synapse Analytics Management Client -type SQLPoolBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewSQLPoolBlobAuditingPoliciesClient creates an instance of the SQLPoolBlobAuditingPoliciesClient client. -func NewSQLPoolBlobAuditingPoliciesClient(subscriptionID string) SQLPoolBlobAuditingPoliciesClient { - return NewSQLPoolBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolBlobAuditingPoliciesClientWithBaseURI creates an instance of the SQLPoolBlobAuditingPoliciesClient 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 NewSQLPoolBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolBlobAuditingPoliciesClient { - return SQLPoolBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a SQL pool's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the database blob auditing policy. -func (client SQLPoolBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolBlobAuditingPolicy) (result SQLPoolBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}", 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 SQLPoolBlobAuditingPoliciesClient) 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 SQLPoolBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result SQLPoolBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a SQL pool's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolBlobAuditingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}", 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 SQLPoolBlobAuditingPoliciesClient) 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 SQLPoolBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result SQLPoolBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySQLPool lists auditing settings of a Sql pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPoliciesClient.ListBySQLPool") - defer func() { - sc := -1 - if result.spbaplr.Response.Response != nil { - sc = result.spbaplr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", err.Error()) - } - - result.fn = client.listBySQLPoolNextResults - req, err := client.ListBySQLPoolPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.spbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", resp, "Failure sending request") - return - } - - result.spbaplr, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", resp, "Failure responding to request") - return - } - if result.spbaplr.hasNextLink() && result.spbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySQLPoolPreparer prepares the ListBySQLPool request. -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPoolPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySQLPoolSender sends the ListBySQLPool request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySQLPoolResponder handles the response to the ListBySQLPool request. The method always -// closes the http.Response Body. -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPoolResponder(resp *http.Response) (result SQLPoolBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySQLPoolNextResults retrieves the next set of results, if any. -func (client SQLPoolBlobAuditingPoliciesClient) listBySQLPoolNextResults(ctx context.Context, lastResults SQLPoolBlobAuditingPolicyListResult) (result SQLPoolBlobAuditingPolicyListResult, err error) { - req, err := lastResults.sQLPoolBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySQLPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPoolComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPoliciesClient.ListBySQLPool") - 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.ListBySQLPool(ctx, resourceGroupName, workspaceName, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolcolumns.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolcolumns.go deleted file mode 100644 index 350c4a7b8b36..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolcolumns.go +++ /dev/null @@ -1,126 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolColumnsClient is the azure Synapse Analytics Management Client -type SQLPoolColumnsClient struct { - BaseClient -} - -// NewSQLPoolColumnsClient creates an instance of the SQLPoolColumnsClient client. -func NewSQLPoolColumnsClient(subscriptionID string) SQLPoolColumnsClient { - return NewSQLPoolColumnsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolColumnsClientWithBaseURI creates an instance of the SQLPoolColumnsClient 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 NewSQLPoolColumnsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolColumnsClient { - return SQLPoolColumnsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get Sql pool column -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SQLPoolColumnsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result SQLPoolColumn, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolColumnsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolColumnsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolColumnsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolColumnsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolColumnsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolColumnsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}", 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 SQLPoolColumnsClient) 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 SQLPoolColumnsClient) GetResponder(resp *http.Response) (result SQLPoolColumn, 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/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolconnectionpolicies.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolconnectionpolicies.go deleted file mode 100644 index 650fc58b64b0..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolconnectionpolicies.go +++ /dev/null @@ -1,122 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolConnectionPoliciesClient is the azure Synapse Analytics Management Client -type SQLPoolConnectionPoliciesClient struct { - BaseClient -} - -// NewSQLPoolConnectionPoliciesClient creates an instance of the SQLPoolConnectionPoliciesClient client. -func NewSQLPoolConnectionPoliciesClient(subscriptionID string) SQLPoolConnectionPoliciesClient { - return NewSQLPoolConnectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolConnectionPoliciesClientWithBaseURI creates an instance of the SQLPoolConnectionPoliciesClient 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 NewSQLPoolConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolConnectionPoliciesClient { - return SQLPoolConnectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a Sql pool's connection policy, which is used with table auditing. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolConnectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolConnectionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolConnectionPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolConnectionPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolConnectionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolConnectionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolConnectionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolConnectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectionPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName}", 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 SQLPoolConnectionPoliciesClient) 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 SQLPoolConnectionPoliciesClient) GetResponder(resp *http.Response) (result SQLPoolConnectionPolicy, 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/synapse/mgmt/2019-06-01-preview/synapse/sqlpooldatawarehouseuseractivities.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooldatawarehouseuseractivities.go deleted file mode 100644 index b50a0904fb7a..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooldatawarehouseuseractivities.go +++ /dev/null @@ -1,123 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolDataWarehouseUserActivitiesClient is the azure Synapse Analytics Management Client -type SQLPoolDataWarehouseUserActivitiesClient struct { - BaseClient -} - -// NewSQLPoolDataWarehouseUserActivitiesClient creates an instance of the SQLPoolDataWarehouseUserActivitiesClient -// client. -func NewSQLPoolDataWarehouseUserActivitiesClient(subscriptionID string) SQLPoolDataWarehouseUserActivitiesClient { - return NewSQLPoolDataWarehouseUserActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolDataWarehouseUserActivitiesClientWithBaseURI creates an instance of the -// SQLPoolDataWarehouseUserActivitiesClient 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 NewSQLPoolDataWarehouseUserActivitiesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolDataWarehouseUserActivitiesClient { - return SQLPoolDataWarehouseUserActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the user activities of a SQL pool which includes running and suspended queries -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolDataWarehouseUserActivitiesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result DataWarehouseUserActivities, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolDataWarehouseUserActivitiesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolDataWarehouseUserActivitiesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolDataWarehouseUserActivitiesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolDataWarehouseUserActivitiesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolDataWarehouseUserActivitiesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolDataWarehouseUserActivitiesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataWarehouseUserActivityName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}", 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 SQLPoolDataWarehouseUserActivitiesClient) 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 SQLPoolDataWarehouseUserActivitiesClient) GetResponder(resp *http.Response) (result DataWarehouseUserActivities, 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/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolgeobackuppolicies.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolgeobackuppolicies.go deleted file mode 100644 index cb3aadbb2016..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolgeobackuppolicies.go +++ /dev/null @@ -1,210 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolGeoBackupPoliciesClient is the azure Synapse Analytics Management Client -type SQLPoolGeoBackupPoliciesClient struct { - BaseClient -} - -// NewSQLPoolGeoBackupPoliciesClient creates an instance of the SQLPoolGeoBackupPoliciesClient client. -func NewSQLPoolGeoBackupPoliciesClient(subscriptionID string) SQLPoolGeoBackupPoliciesClient { - return NewSQLPoolGeoBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolGeoBackupPoliciesClientWithBaseURI creates an instance of the SQLPoolGeoBackupPoliciesClient 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 NewSQLPoolGeoBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolGeoBackupPoliciesClient { - return SQLPoolGeoBackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the specified SQL pool geo backup policy -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolGeoBackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result GeoBackupPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolGeoBackupPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolGeoBackupPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolGeoBackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "geoBackupPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}", 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 SQLPoolGeoBackupPoliciesClient) 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 SQLPoolGeoBackupPoliciesClient) GetResponder(resp *http.Response) (result GeoBackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of SQL pool geo backup policies -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolGeoBackupPoliciesClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result GeoBackupPolicyListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolGeoBackupPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolGeoBackupPoliciesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolGeoBackupPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies", 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 SQLPoolGeoBackupPoliciesClient) 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 SQLPoolGeoBackupPoliciesClient) ListResponder(resp *http.Response) (result GeoBackupPolicyListResult, 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/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolmetadatasyncconfigs.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolmetadatasyncconfigs.go deleted file mode 100644 index ac0f5960724e..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolmetadatasyncconfigs.go +++ /dev/null @@ -1,212 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolMetadataSyncConfigsClient is the azure Synapse Analytics Management Client -type SQLPoolMetadataSyncConfigsClient struct { - BaseClient -} - -// NewSQLPoolMetadataSyncConfigsClient creates an instance of the SQLPoolMetadataSyncConfigsClient client. -func NewSQLPoolMetadataSyncConfigsClient(subscriptionID string) SQLPoolMetadataSyncConfigsClient { - return NewSQLPoolMetadataSyncConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolMetadataSyncConfigsClientWithBaseURI creates an instance of the SQLPoolMetadataSyncConfigsClient 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 NewSQLPoolMetadataSyncConfigsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolMetadataSyncConfigsClient { - return SQLPoolMetadataSyncConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create set the metadata sync configuration for a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// metadataSyncConfiguration - metadata sync configuration -func (client SQLPoolMetadataSyncConfigsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, metadataSyncConfiguration MetadataSyncConfig) (result MetadataSyncConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolMetadataSyncConfigsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolMetadataSyncConfigsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, metadataSyncConfiguration) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SQLPoolMetadataSyncConfigsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, metadataSyncConfiguration MetadataSyncConfig) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config", pathParameters), - autorest.WithJSON(metadataSyncConfiguration), - 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 SQLPoolMetadataSyncConfigsClient) 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 SQLPoolMetadataSyncConfigsClient) CreateResponder(resp *http.Response) (result MetadataSyncConfig, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the metadata sync configuration for a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolMetadataSyncConfigsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result MetadataSyncConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolMetadataSyncConfigsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolMetadataSyncConfigsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolMetadataSyncConfigsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config", 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 SQLPoolMetadataSyncConfigsClient) 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 SQLPoolMetadataSyncConfigsClient) GetResponder(resp *http.Response) (result MetadataSyncConfig, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooloperationresults.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooloperationresults.go deleted file mode 100644 index ae65708304fc..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooloperationresults.go +++ /dev/null @@ -1,123 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolOperationResultsClient is the azure Synapse Analytics Management Client -type SQLPoolOperationResultsClient struct { - BaseClient -} - -// NewSQLPoolOperationResultsClient creates an instance of the SQLPoolOperationResultsClient client. -func NewSQLPoolOperationResultsClient(subscriptionID string) SQLPoolOperationResultsClient { - return NewSQLPoolOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolOperationResultsClientWithBaseURI creates an instance of the SQLPoolOperationResultsClient 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 NewSQLPoolOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolOperationResultsClient { - return SQLPoolOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetLocationHeaderResult get the status of a SQL pool operation -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// operationID - operation ID -func (client SQLPoolOperationResultsClient) GetLocationHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, operationID string) (result SetObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolOperationResultsClient.GetLocationHeaderResult") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolOperationResultsClient", "GetLocationHeaderResult", err.Error()) - } - - req, err := client.GetLocationHeaderResultPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationResultsClient", "GetLocationHeaderResult", nil, "Failure preparing request") - return - } - - resp, err := client.GetLocationHeaderResultSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationResultsClient", "GetLocationHeaderResult", resp, "Failure sending request") - return - } - - result, err = client.GetLocationHeaderResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationResultsClient", "GetLocationHeaderResult", resp, "Failure responding to request") - return - } - - return -} - -// GetLocationHeaderResultPreparer prepares the GetLocationHeaderResult request. -func (client SQLPoolOperationResultsClient) GetLocationHeaderResultPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLocationHeaderResultSender sends the GetLocationHeaderResult request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolOperationResultsClient) GetLocationHeaderResultSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLocationHeaderResultResponder handles the response to the GetLocationHeaderResult request. The method always -// closes the http.Response Body. -func (client SQLPoolOperationResultsClient) GetLocationHeaderResultResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooloperations.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooloperations.go deleted file mode 100644 index 2f1a461832eb..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooloperations.go +++ /dev/null @@ -1,163 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolOperationsClient is the azure Synapse Analytics Management Client -type SQLPoolOperationsClient struct { - BaseClient -} - -// NewSQLPoolOperationsClient creates an instance of the SQLPoolOperationsClient client. -func NewSQLPoolOperationsClient(subscriptionID string) SQLPoolOperationsClient { - return NewSQLPoolOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolOperationsClientWithBaseURI creates an instance of the SQLPoolOperationsClient 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 NewSQLPoolOperationsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolOperationsClient { - return SQLPoolOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets a list of operations performed on the SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolOperationsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolOperationsClient.List") - defer func() { - sc := -1 - if result.spbapspolr.Response.Response != nil { - sc = result.spbapspolr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolOperationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.spbapspolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "List", resp, "Failure sending request") - return - } - - result.spbapspolr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.spbapspolr.hasNextLink() && result.spbapspolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolOperationsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operations", 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 SQLPoolOperationsClient) 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 SQLPoolOperationsClient) ListResponder(resp *http.Response) (result SQLPoolBlobAuditingPolicySQLPoolOperationListResult, 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 SQLPoolOperationsClient) listNextResults(ctx context.Context, lastResults SQLPoolBlobAuditingPolicySQLPoolOperationListResult) (result SQLPoolBlobAuditingPolicySQLPoolOperationListResult, err error) { - req, err := lastResults.sQLPoolBlobAuditingPolicySQLPoolOperationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "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, "synapse.SQLPoolOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolOperationsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolOperationsClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolreplicationlinks.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolreplicationlinks.go deleted file mode 100644 index 8542e3846cfb..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolreplicationlinks.go +++ /dev/null @@ -1,253 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolReplicationLinksClient is the azure Synapse Analytics Management Client -type SQLPoolReplicationLinksClient struct { - BaseClient -} - -// NewSQLPoolReplicationLinksClient creates an instance of the SQLPoolReplicationLinksClient client. -func NewSQLPoolReplicationLinksClient(subscriptionID string) SQLPoolReplicationLinksClient { - return NewSQLPoolReplicationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolReplicationLinksClientWithBaseURI creates an instance of the SQLPoolReplicationLinksClient 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 NewSQLPoolReplicationLinksClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolReplicationLinksClient { - return SQLPoolReplicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByName get SQL pool replication link by name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// linkID - the ID of the replication link. -func (client SQLPoolReplicationLinksClient) GetByName(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, linkID string) (result ReplicationLink, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolReplicationLinksClient.GetByName") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolReplicationLinksClient", "GetByName", err.Error()) - } - - req, err := client.GetByNamePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "GetByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "GetByName", resp, "Failure sending request") - return - } - - result, err = client.GetByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "GetByName", resp, "Failure responding to request") - return - } - - return -} - -// GetByNamePreparer prepares the GetByName request. -func (client SQLPoolReplicationLinksClient) GetByNamePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks/{linkId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByNameSender sends the GetByName request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolReplicationLinksClient) GetByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByNameResponder handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (client SQLPoolReplicationLinksClient) GetByNameResponder(resp *http.Response) (result ReplicationLink, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists a Sql pool's replication links. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolReplicationLinksClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ReplicationLinkListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolReplicationLinksClient.List") - defer func() { - sc := -1 - if result.rllr.Response.Response != nil { - sc = result.rllr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolReplicationLinksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "List", resp, "Failure sending request") - return - } - - result.rllr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "List", resp, "Failure responding to request") - return - } - if result.rllr.hasNextLink() && result.rllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolReplicationLinksClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks", 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 SQLPoolReplicationLinksClient) 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 SQLPoolReplicationLinksClient) ListResponder(resp *http.Response) (result ReplicationLinkListResult, 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 SQLPoolReplicationLinksClient) listNextResults(ctx context.Context, lastResults ReplicationLinkListResult) (result ReplicationLinkListResult, err error) { - req, err := lastResults.replicationLinkListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "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, "synapse.SQLPoolReplicationLinksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolReplicationLinksClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ReplicationLinkListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolReplicationLinksClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolrestorepoints.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolrestorepoints.go deleted file mode 100644 index f9ca9493900c..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolrestorepoints.go +++ /dev/null @@ -1,438 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolRestorePointsClient is the azure Synapse Analytics Management Client -type SQLPoolRestorePointsClient struct { - BaseClient -} - -// NewSQLPoolRestorePointsClient creates an instance of the SQLPoolRestorePointsClient client. -func NewSQLPoolRestorePointsClient(subscriptionID string) SQLPoolRestorePointsClient { - return NewSQLPoolRestorePointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolRestorePointsClientWithBaseURI creates an instance of the SQLPoolRestorePointsClient 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 NewSQLPoolRestorePointsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolRestorePointsClient { - return SQLPoolRestorePointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a restore point for a data warehouse. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the definition for creating the restore point of this Sql pool. -func (client SQLPoolRestorePointsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters CreateSQLPoolRestorePointDefinition) (result SQLPoolRestorePointsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RestorePointLabel", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolRestorePointsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SQLPoolRestorePointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters CreateSQLPoolRestorePointDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints", 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 SQLPoolRestorePointsClient) CreateSender(req *http.Request) (future SQLPoolRestorePointsCreateFuture, 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 SQLPoolRestorePointsClient) CreateResponder(resp *http.Response) (result RestorePoint, 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 a restore point. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// restorePointName - the name of the restore point. -func (client SQLPoolRestorePointsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolRestorePointsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, restorePointName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolRestorePointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorePointName": autorest.Encode("path", restorePointName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}", 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 SQLPoolRestorePointsClient) 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 SQLPoolRestorePointsClient) 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 restore point. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// restorePointName - the name of the restore point. -func (client SQLPoolRestorePointsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (result RestorePoint, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolRestorePointsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, restorePointName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolRestorePointsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorePointName": autorest.Encode("path", restorePointName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}", 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 SQLPoolRestorePointsClient) 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 SQLPoolRestorePointsClient) GetResponder(resp *http.Response) (result RestorePoint, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get SQL pool backup information -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolRestorePointsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result RestorePointListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.List") - defer func() { - sc := -1 - if result.rplr.Response.Response != nil { - sc = result.rplr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolRestorePointsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "List", resp, "Failure sending request") - return - } - - result.rplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "List", resp, "Failure responding to request") - return - } - if result.rplr.hasNextLink() && result.rplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolRestorePointsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints", 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 SQLPoolRestorePointsClient) 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 SQLPoolRestorePointsClient) ListResponder(resp *http.Response) (result RestorePointListResult, 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 SQLPoolRestorePointsClient) listNextResults(ctx context.Context, lastResults RestorePointListResult) (result RestorePointListResult, err error) { - req, err := lastResults.restorePointListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "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, "synapse.SQLPoolRestorePointsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolRestorePointsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result RestorePointListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpools.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpools.go deleted file mode 100644 index 8dca58ae7776..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpools.go +++ /dev/null @@ -1,706 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolsClient is the azure Synapse Analytics Management Client -type SQLPoolsClient struct { - BaseClient -} - -// NewSQLPoolsClient creates an instance of the SQLPoolsClient client. -func NewSQLPoolsClient(subscriptionID string) SQLPoolsClient { - return NewSQLPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolsClientWithBaseURI creates an instance of the SQLPoolsClient 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 NewSQLPoolsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolsClient { - return SQLPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// SQLPoolInfo - the SQL pool to create -func (client SQLPoolsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo SQLPool) (result SQLPoolsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, SQLPoolInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SQLPoolsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo SQLPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}", pathParameters), - autorest.WithJSON(SQLPoolInfo), - 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 SQLPoolsClient) CreateSender(req *http.Request) (future SQLPoolsCreateFuture, 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 SQLPoolsClient) CreateResponder(resp *http.Response) (result SQLPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}", 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 SQLPoolsClient) DeleteSender(req *http.Request) (future SQLPoolsDeleteFuture, 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 SQLPoolsClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get SQL pool properties -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}", 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 SQLPoolsClient) 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 SQLPoolsClient) GetResponder(resp *http.Response) (result SQLPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list all SQL pools -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client SQLPoolsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result SQLPoolInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.ListByWorkspace") - defer func() { - sc := -1 - if result.spilr.Response.Response != nil { - sc = result.spilr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolsClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.spilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.spilr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.spilr.hasNextLink() && result.spilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client SQLPoolsClient) ListByWorkspacePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client SQLPoolsClient) ListByWorkspaceResponder(resp *http.Response) (result SQLPoolInfoListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client SQLPoolsClient) listByWorkspaceNextResults(ctx context.Context, lastResults SQLPoolInfoListResult) (result SQLPoolInfoListResult, err error) { - req, err := lastResults.sQLPoolInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolsClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result SQLPoolInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// Pause pause a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolsClient) Pause(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolsPauseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.Pause") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolsClient", "Pause", err.Error()) - } - - req, err := client.PausePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Pause", nil, "Failure preparing request") - return - } - - result, err = client.PauseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Pause", result.Response(), "Failure sending request") - return - } - - return -} - -// PausePreparer prepares the Pause request. -func (client SQLPoolsClient) PausePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PauseSender sends the Pause request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolsClient) PauseSender(req *http.Request) (future SQLPoolsPauseFuture, 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 -} - -// PauseResponder handles the response to the Pause request. The method always -// closes the http.Response Body. -func (client SQLPoolsClient) PauseResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Resume resume a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolsClient) Resume(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolsResumeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolsClient", "Resume", err.Error()) - } - - req, err := client.ResumePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Resume", nil, "Failure preparing request") - return - } - - result, err = client.ResumeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Resume", result.Response(), "Failure sending request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client SQLPoolsClient) ResumePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/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 SQLPoolsClient) ResumeSender(req *http.Request) (future SQLPoolsResumeFuture, 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 SQLPoolsClient) ResumeResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update apply a partial update to a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// SQLPoolInfo - the updated SQL pool properties -func (client SQLPoolsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo SQLPoolPatchInfo) (result SQLPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, SQLPoolInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SQLPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo SQLPoolPatchInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}", pathParameters), - autorest.WithJSON(SQLPoolInfo), - 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 SQLPoolsClient) 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 SQLPoolsClient) UpdateResponder(resp *http.Response) (result SQLPool, 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/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolschemas.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolschemas.go deleted file mode 100644 index b8747fdbdae7..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolschemas.go +++ /dev/null @@ -1,256 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolSchemasClient is the azure Synapse Analytics Management Client -type SQLPoolSchemasClient struct { - BaseClient -} - -// NewSQLPoolSchemasClient creates an instance of the SQLPoolSchemasClient client. -func NewSQLPoolSchemasClient(subscriptionID string) SQLPoolSchemasClient { - return NewSQLPoolSchemasClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolSchemasClientWithBaseURI creates an instance of the SQLPoolSchemasClient 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 NewSQLPoolSchemasClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolSchemasClient { - return SQLPoolSchemasClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get Sql Pool schema -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -func (client SQLPoolSchemasClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string) (result SQLPoolSchema, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemasClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSchemasClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolSchemasClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}", 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 SQLPoolSchemasClient) 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 SQLPoolSchemasClient) GetResponder(resp *http.Response) (result SQLPoolSchema, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets schemas of a given SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolSchemasClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result SQLPoolSchemaListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemasClient.List") - defer func() { - sc := -1 - if result.spslr.Response.Response != nil { - sc = result.spslr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSchemasClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.spslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "List", resp, "Failure sending request") - return - } - - result.spslr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "List", resp, "Failure responding to request") - return - } - if result.spslr.hasNextLink() && result.spslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolSchemasClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas", 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 SQLPoolSchemasClient) 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 SQLPoolSchemasClient) ListResponder(resp *http.Response) (result SQLPoolSchemaListResult, 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 SQLPoolSchemasClient) listNextResults(ctx context.Context, lastResults SQLPoolSchemaListResult) (result SQLPoolSchemaListResult, err error) { - req, err := lastResults.sQLPoolSchemaListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "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, "synapse.SQLPoolSchemasClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolSchemasClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result SQLPoolSchemaListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemasClient.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, SQLPoolName, filter) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolsecurityalertpolicies.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolsecurityalertpolicies.go deleted file mode 100644 index ffe110f6a9b8..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolsecurityalertpolicies.go +++ /dev/null @@ -1,344 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolSecurityAlertPoliciesClient is the azure Synapse Analytics Management Client -type SQLPoolSecurityAlertPoliciesClient struct { - BaseClient -} - -// NewSQLPoolSecurityAlertPoliciesClient creates an instance of the SQLPoolSecurityAlertPoliciesClient client. -func NewSQLPoolSecurityAlertPoliciesClient(subscriptionID string) SQLPoolSecurityAlertPoliciesClient { - return NewSQLPoolSecurityAlertPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolSecurityAlertPoliciesClientWithBaseURI creates an instance of the SQLPoolSecurityAlertPoliciesClient -// 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 NewSQLPoolSecurityAlertPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolSecurityAlertPoliciesClient { - return SQLPoolSecurityAlertPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Sql pool's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the Sql pool security alert policy. -func (client SQLPoolSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolSecurityAlertPolicy) (result SQLPoolSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSecurityAlertPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSecurityAlertPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}", 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 SQLPoolSecurityAlertPoliciesClient) 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 SQLPoolSecurityAlertPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result SQLPoolSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a Sql pool's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSecurityAlertPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSecurityAlertPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolSecurityAlertPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}", 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 SQLPoolSecurityAlertPoliciesClient) 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 SQLPoolSecurityAlertPoliciesClient) GetResponder(resp *http.Response) (result SQLPoolSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get a list of Sql pool's security alert policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolSecurityAlertPoliciesClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ListSQLPoolSecurityAlertPoliciesPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSecurityAlertPoliciesClient.List") - defer func() { - sc := -1 - if result.lspsap.Response.Response != nil { - sc = result.lspsap.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSecurityAlertPoliciesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lspsap.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "List", resp, "Failure sending request") - return - } - - result.lspsap, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "List", resp, "Failure responding to request") - return - } - if result.lspsap.hasNextLink() && result.lspsap.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolSecurityAlertPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies", 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 SQLPoolSecurityAlertPoliciesClient) 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 SQLPoolSecurityAlertPoliciesClient) ListResponder(resp *http.Response) (result ListSQLPoolSecurityAlertPolicies, 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 SQLPoolSecurityAlertPoliciesClient) listNextResults(ctx context.Context, lastResults ListSQLPoolSecurityAlertPolicies) (result ListSQLPoolSecurityAlertPolicies, err error) { - req, err := lastResults.listSQLPoolSecurityAlertPoliciesPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "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, "synapse.SQLPoolSecurityAlertPoliciesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolSecurityAlertPoliciesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ListSQLPoolSecurityAlertPoliciesIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSecurityAlertPoliciesClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolsensitivitylabels.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolsensitivitylabels.go deleted file mode 100644 index 14bbf09d2c04..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolsensitivitylabels.go +++ /dev/null @@ -1,786 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolSensitivityLabelsClient is the azure Synapse Analytics Management Client -type SQLPoolSensitivityLabelsClient struct { - BaseClient -} - -// NewSQLPoolSensitivityLabelsClient creates an instance of the SQLPoolSensitivityLabelsClient client. -func NewSQLPoolSensitivityLabelsClient(subscriptionID string) SQLPoolSensitivityLabelsClient { - return NewSQLPoolSensitivityLabelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolSensitivityLabelsClientWithBaseURI creates an instance of the SQLPoolSensitivityLabelsClient 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 NewSQLPoolSensitivityLabelsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolSensitivityLabelsClient { - return SQLPoolSensitivityLabelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the sensitivity label of a given column in a Sql pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// parameters - the column sensitivity label resource. -func (client SQLPoolSensitivityLabelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (result SensitivityLabel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSensitivityLabelsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolSensitivityLabelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SQLPoolSensitivityLabelsClient) 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 SQLPoolSensitivityLabelsClient) CreateOrUpdateResponder(resp *http.Response) (result SensitivityLabel, 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 sensitivity label of a given column in a Sql pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SQLPoolSensitivityLabelsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSensitivityLabelsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolSensitivityLabelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SQLPoolSensitivityLabelsClient) 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 SQLPoolSensitivityLabelsClient) 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 -} - -// DisableRecommendation disables sensitivity recommendations on a given column -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SQLPoolSensitivityLabelsClient) DisableRecommendation(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.DisableRecommendation") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSensitivityLabelsClient", "DisableRecommendation", err.Error()) - } - - req, err := client.DisableRecommendationPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "DisableRecommendation", nil, "Failure preparing request") - return - } - - resp, err := client.DisableRecommendationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "DisableRecommendation", resp, "Failure sending request") - return - } - - result, err = client.DisableRecommendationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "DisableRecommendation", resp, "Failure responding to request") - return - } - - return -} - -// DisableRecommendationPreparer prepares the DisableRecommendation request. -func (client SQLPoolSensitivityLabelsClient) DisableRecommendationPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "recommended"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableRecommendationSender sends the DisableRecommendation request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolSensitivityLabelsClient) DisableRecommendationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisableRecommendationResponder handles the response to the DisableRecommendation request. The method always -// closes the http.Response Body. -func (client SQLPoolSensitivityLabelsClient) DisableRecommendationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// EnableRecommendation enables sensitivity recommendations on a given column (recommendations are enabled by default -// on all columns) -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SQLPoolSensitivityLabelsClient) EnableRecommendation(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.EnableRecommendation") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSensitivityLabelsClient", "EnableRecommendation", err.Error()) - } - - req, err := client.EnableRecommendationPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "EnableRecommendation", nil, "Failure preparing request") - return - } - - resp, err := client.EnableRecommendationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "EnableRecommendation", resp, "Failure sending request") - return - } - - result, err = client.EnableRecommendationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "EnableRecommendation", resp, "Failure responding to request") - return - } - - return -} - -// EnableRecommendationPreparer prepares the EnableRecommendation request. -func (client SQLPoolSensitivityLabelsClient) EnableRecommendationPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "recommended"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableRecommendationSender sends the EnableRecommendation request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolSensitivityLabelsClient) EnableRecommendationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableRecommendationResponder handles the response to the EnableRecommendation request. The method always -// closes the http.Response Body. -func (client SQLPoolSensitivityLabelsClient) EnableRecommendationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// sensitivityLabelSource - the source of the sensitivity label. -func (client SQLPoolSensitivityLabelsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (result SensitivityLabel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSensitivityLabelsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName, sensitivityLabelSource) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolSensitivityLabelsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", sensitivityLabelSource), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SQLPoolSensitivityLabelsClient) 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 SQLPoolSensitivityLabelsClient) GetResponder(resp *http.Response) (result SensitivityLabel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCurrent gets SQL pool sensitivity labels. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolSensitivityLabelsClient) ListCurrent(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result SensitivityLabelListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.ListCurrent") - defer func() { - sc := -1 - if result.sllr.Response.Response != nil { - sc = result.sllr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSensitivityLabelsClient", "ListCurrent", err.Error()) - } - - result.fn = client.listCurrentNextResults - req, err := client.ListCurrentPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListCurrent", nil, "Failure preparing request") - return - } - - resp, err := client.ListCurrentSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListCurrent", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListCurrentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListCurrent", resp, "Failure responding to request") - return - } - if result.sllr.hasNextLink() && result.sllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListCurrentPreparer prepares the ListCurrent request. -func (client SQLPoolSensitivityLabelsClient) ListCurrentPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCurrentSender sends the ListCurrent request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolSensitivityLabelsClient) ListCurrentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCurrentResponder handles the response to the ListCurrent request. The method always -// closes the http.Response Body. -func (client SQLPoolSensitivityLabelsClient) ListCurrentResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listCurrentNextResults retrieves the next set of results, if any. -func (client SQLPoolSensitivityLabelsClient) listCurrentNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listCurrentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListCurrentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listCurrentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListCurrentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listCurrentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListCurrentComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolSensitivityLabelsClient) ListCurrentComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result SensitivityLabelListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.ListCurrent") - 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.ListCurrent(ctx, resourceGroupName, workspaceName, SQLPoolName, filter) - return -} - -// ListRecommended gets sensitivity labels of a given SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// includeDisabledRecommendations - specifies whether to include disabled recommendations or not. -// skipToken - an OData query option to indicate how many elements to skip in the collection. -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolSensitivityLabelsClient) ListRecommended(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result SensitivityLabelListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.ListRecommended") - defer func() { - sc := -1 - if result.sllr.Response.Response != nil { - sc = result.sllr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSensitivityLabelsClient", "ListRecommended", err.Error()) - } - - result.fn = client.listRecommendedNextResults - req, err := client.ListRecommendedPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, includeDisabledRecommendations, skipToken, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListRecommended", nil, "Failure preparing request") - return - } - - resp, err := client.ListRecommendedSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListRecommended", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListRecommendedResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListRecommended", resp, "Failure responding to request") - return - } - if result.sllr.hasNextLink() && result.sllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRecommendedPreparer prepares the ListRecommended request. -func (client SQLPoolSensitivityLabelsClient) ListRecommendedPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if includeDisabledRecommendations != nil { - queryParameters["includeDisabledRecommendations"] = autorest.Encode("query", *includeDisabledRecommendations) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRecommendedSender sends the ListRecommended request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolSensitivityLabelsClient) ListRecommendedSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRecommendedResponder handles the response to the ListRecommended request. The method always -// closes the http.Response Body. -func (client SQLPoolSensitivityLabelsClient) ListRecommendedResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRecommendedNextResults retrieves the next set of results, if any. -func (client SQLPoolSensitivityLabelsClient) listRecommendedNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listRecommendedNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRecommendedSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listRecommendedNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRecommendedResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listRecommendedNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRecommendedComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolSensitivityLabelsClient) ListRecommendedComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result SensitivityLabelListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.ListRecommended") - 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.ListRecommended(ctx, resourceGroupName, workspaceName, SQLPoolName, includeDisabledRecommendations, skipToken, filter) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltablecolumns.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltablecolumns.go deleted file mode 100644 index 19365d5d40e5..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltablecolumns.go +++ /dev/null @@ -1,171 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolTableColumnsClient is the azure Synapse Analytics Management Client -type SQLPoolTableColumnsClient struct { - BaseClient -} - -// NewSQLPoolTableColumnsClient creates an instance of the SQLPoolTableColumnsClient client. -func NewSQLPoolTableColumnsClient(subscriptionID string) SQLPoolTableColumnsClient { - return NewSQLPoolTableColumnsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolTableColumnsClientWithBaseURI creates an instance of the SQLPoolTableColumnsClient 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 NewSQLPoolTableColumnsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolTableColumnsClient { - return SQLPoolTableColumnsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByTableName gets columns in a given table in a SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolTableColumnsClient) ListByTableName(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (result SQLPoolColumnListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTableColumnsClient.ListByTableName") - defer func() { - sc := -1 - if result.spclr.Response.Response != nil { - sc = result.spclr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolTableColumnsClient", "ListByTableName", err.Error()) - } - - result.fn = client.listByTableNameNextResults - req, err := client.ListByTableNamePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "ListByTableName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTableNameSender(req) - if err != nil { - result.spclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "ListByTableName", resp, "Failure sending request") - return - } - - result.spclr, err = client.ListByTableNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "ListByTableName", resp, "Failure responding to request") - return - } - if result.spclr.hasNextLink() && result.spclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTableNamePreparer prepares the ListByTableName request. -func (client SQLPoolTableColumnsClient) ListByTableNamePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTableNameSender sends the ListByTableName request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolTableColumnsClient) ListByTableNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTableNameResponder handles the response to the ListByTableName request. The method always -// closes the http.Response Body. -func (client SQLPoolTableColumnsClient) ListByTableNameResponder(resp *http.Response) (result SQLPoolColumnListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTableNameNextResults retrieves the next set of results, if any. -func (client SQLPoolTableColumnsClient) listByTableNameNextResults(ctx context.Context, lastResults SQLPoolColumnListResult) (result SQLPoolColumnListResult, err error) { - req, err := lastResults.sQLPoolColumnListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "listByTableNameNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTableNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "listByTableNameNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTableNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "listByTableNameNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTableNameComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolTableColumnsClient) ListByTableNameComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (result SQLPoolColumnListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTableColumnsClient.ListByTableName") - 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.ListByTableName(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, filter) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltables.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltables.go deleted file mode 100644 index d343491256cb..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltables.go +++ /dev/null @@ -1,260 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolTablesClient is the azure Synapse Analytics Management Client -type SQLPoolTablesClient struct { - BaseClient -} - -// NewSQLPoolTablesClient creates an instance of the SQLPoolTablesClient client. -func NewSQLPoolTablesClient(subscriptionID string) SQLPoolTablesClient { - return NewSQLPoolTablesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolTablesClientWithBaseURI creates an instance of the SQLPoolTablesClient 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 NewSQLPoolTablesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolTablesClient { - return SQLPoolTablesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get Sql pool table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -func (client SQLPoolTablesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string) (result SQLPoolTable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTablesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolTablesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolTablesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}", 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 SQLPoolTablesClient) 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 SQLPoolTablesClient) GetResponder(resp *http.Response) (result SQLPoolTable, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySchema gets tables of a given schema in a SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolTablesClient) ListBySchema(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (result SQLPoolTableListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTablesClient.ListBySchema") - defer func() { - sc := -1 - if result.sptlr.Response.Response != nil { - sc = result.sptlr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolTablesClient", "ListBySchema", err.Error()) - } - - result.fn = client.listBySchemaNextResults - req, err := client.ListBySchemaPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "ListBySchema", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySchemaSender(req) - if err != nil { - result.sptlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "ListBySchema", resp, "Failure sending request") - return - } - - result.sptlr, err = client.ListBySchemaResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "ListBySchema", resp, "Failure responding to request") - return - } - if result.sptlr.hasNextLink() && result.sptlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySchemaPreparer prepares the ListBySchema request. -func (client SQLPoolTablesClient) ListBySchemaPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySchemaSender sends the ListBySchema request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolTablesClient) ListBySchemaSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySchemaResponder handles the response to the ListBySchema request. The method always -// closes the http.Response Body. -func (client SQLPoolTablesClient) ListBySchemaResponder(resp *http.Response) (result SQLPoolTableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySchemaNextResults retrieves the next set of results, if any. -func (client SQLPoolTablesClient) listBySchemaNextResults(ctx context.Context, lastResults SQLPoolTableListResult) (result SQLPoolTableListResult, err error) { - req, err := lastResults.sQLPoolTableListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "listBySchemaNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySchemaSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "listBySchemaNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySchemaResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "listBySchemaNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySchemaComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolTablesClient) ListBySchemaComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (result SQLPoolTableListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTablesClient.ListBySchema") - 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.ListBySchema(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, filter) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltransparentdataencryptions.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltransparentdataencryptions.go deleted file mode 100644 index 8f1d52759f00..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpooltransparentdataencryptions.go +++ /dev/null @@ -1,346 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolTransparentDataEncryptionsClient is the azure Synapse Analytics Management Client -type SQLPoolTransparentDataEncryptionsClient struct { - BaseClient -} - -// NewSQLPoolTransparentDataEncryptionsClient creates an instance of the SQLPoolTransparentDataEncryptionsClient -// client. -func NewSQLPoolTransparentDataEncryptionsClient(subscriptionID string) SQLPoolTransparentDataEncryptionsClient { - return NewSQLPoolTransparentDataEncryptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolTransparentDataEncryptionsClientWithBaseURI creates an instance of the -// SQLPoolTransparentDataEncryptionsClient 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 NewSQLPoolTransparentDataEncryptionsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolTransparentDataEncryptionsClient { - return SQLPoolTransparentDataEncryptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Sql pool's transparent data encryption configuration. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the required parameters for creating or updating transparent data encryption. -func (client SQLPoolTransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTransparentDataEncryptionsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolTransparentDataEncryptionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolTransparentDataEncryptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters TransparentDataEncryption) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}", 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 SQLPoolTransparentDataEncryptionsClient) 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 SQLPoolTransparentDataEncryptionsClient) CreateOrUpdateResponder(resp *http.Response) (result TransparentDataEncryption, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a SQL pool's transparent data encryption configuration. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolTransparentDataEncryptionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result TransparentDataEncryption, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTransparentDataEncryptionsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolTransparentDataEncryptionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolTransparentDataEncryptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}", 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 SQLPoolTransparentDataEncryptionsClient) 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 SQLPoolTransparentDataEncryptionsClient) GetResponder(resp *http.Response) (result TransparentDataEncryption, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of SQL pool's transparent data encryption configurations. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolTransparentDataEncryptionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result TransparentDataEncryptionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTransparentDataEncryptionsClient.List") - defer func() { - sc := -1 - if result.tdelr.Response.Response != nil { - sc = result.tdelr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolTransparentDataEncryptionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tdelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "List", resp, "Failure sending request") - return - } - - result.tdelr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "List", resp, "Failure responding to request") - return - } - if result.tdelr.hasNextLink() && result.tdelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolTransparentDataEncryptionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption", 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 SQLPoolTransparentDataEncryptionsClient) 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 SQLPoolTransparentDataEncryptionsClient) ListResponder(resp *http.Response) (result TransparentDataEncryptionListResult, 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 SQLPoolTransparentDataEncryptionsClient) listNextResults(ctx context.Context, lastResults TransparentDataEncryptionListResult) (result TransparentDataEncryptionListResult, err error) { - req, err := lastResults.transparentDataEncryptionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "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, "synapse.SQLPoolTransparentDataEncryptionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolTransparentDataEncryptionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result TransparentDataEncryptionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTransparentDataEncryptionsClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolusages.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolusages.go deleted file mode 100644 index f1b0c6b3b8d9..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolusages.go +++ /dev/null @@ -1,162 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolUsagesClient is the azure Synapse Analytics Management Client -type SQLPoolUsagesClient struct { - BaseClient -} - -// NewSQLPoolUsagesClient creates an instance of the SQLPoolUsagesClient client. -func NewSQLPoolUsagesClient(subscriptionID string) SQLPoolUsagesClient { - return NewSQLPoolUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolUsagesClientWithBaseURI creates an instance of the SQLPoolUsagesClient 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 NewSQLPoolUsagesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolUsagesClient { - return SQLPoolUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets SQL pool usages. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolUsagesClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolUsageListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolUsagesClient.List") - defer func() { - sc := -1 - if result.spulr.Response.Response != nil { - sc = result.spulr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolUsagesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.spulr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "List", resp, "Failure sending request") - return - } - - result.spulr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "List", resp, "Failure responding to request") - return - } - if result.spulr.hasNextLink() && result.spulr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolUsagesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/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 SQLPoolUsagesClient) 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 SQLPoolUsagesClient) ListResponder(resp *http.Response) (result SQLPoolUsageListResult, 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 SQLPoolUsagesClient) listNextResults(ctx context.Context, lastResults SQLPoolUsageListResult) (result SQLPoolUsageListResult, err error) { - req, err := lastResults.sQLPoolUsageListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "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, "synapse.SQLPoolUsagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolUsagesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolUsageListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolUsagesClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessmentrulebaselines.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessmentrulebaselines.go deleted file mode 100644 index bc552cd7d6bf..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessmentrulebaselines.go +++ /dev/null @@ -1,321 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolVulnerabilityAssessmentRuleBaselinesClient is the azure Synapse Analytics Management Client -type SQLPoolVulnerabilityAssessmentRuleBaselinesClient struct { - BaseClient -} - -// NewSQLPoolVulnerabilityAssessmentRuleBaselinesClient creates an instance of the -// SQLPoolVulnerabilityAssessmentRuleBaselinesClient client. -func NewSQLPoolVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string) SQLPoolVulnerabilityAssessmentRuleBaselinesClient { - return NewSQLPoolVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolVulnerabilityAssessmentRuleBaselinesClientWithBaseURI creates an instance of the -// SQLPoolVulnerabilityAssessmentRuleBaselinesClient 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 NewSQLPoolVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolVulnerabilityAssessmentRuleBaselinesClient { - return SQLPoolVulnerabilityAssessmentRuleBaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Sql pool's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a Sql -// pool level rule and master for workspace level rule). -// parameters - the requested rule baseline resource. -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters SQLPoolVulnerabilityAssessmentRuleBaseline) (result SQLPoolVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentRuleBaselinesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SQLPoolVulnerabilityAssessmentRuleBaselineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SQLPoolVulnerabilityAssessmentRuleBaselineProperties.BaselineResults", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, ruleID, baselineName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters SQLPoolVulnerabilityAssessmentRuleBaseline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdateResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessmentRuleBaseline, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete removes the database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a Sql -// pool level rule and master for workspace level rule). -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentRuleBaselinesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) 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 SqlPool's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a Sql -// pool level rule and master for server level rule). -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result SQLPoolVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentRuleBaselinesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) GetResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessmentRuleBaseline, 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/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessments.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessments.go deleted file mode 100644 index b913a503166e..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessments.go +++ /dev/null @@ -1,432 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolVulnerabilityAssessmentsClient is the azure Synapse Analytics Management Client -type SQLPoolVulnerabilityAssessmentsClient struct { - BaseClient -} - -// NewSQLPoolVulnerabilityAssessmentsClient creates an instance of the SQLPoolVulnerabilityAssessmentsClient client. -func NewSQLPoolVulnerabilityAssessmentsClient(subscriptionID string) SQLPoolVulnerabilityAssessmentsClient { - return NewSQLPoolVulnerabilityAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolVulnerabilityAssessmentsClientWithBaseURI creates an instance of the SQLPoolVulnerabilityAssessmentsClient -// 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 NewSQLPoolVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolVulnerabilityAssessmentsClient { - return SQLPoolVulnerabilityAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the Sql pool vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the requested resource. -func (client SQLPoolVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolVulnerabilityAssessment) (result SQLPoolVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolVulnerabilityAssessmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolVulnerabilityAssessment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 SQLPoolVulnerabilityAssessmentsClient) 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 SQLPoolVulnerabilityAssessmentsClient) CreateOrUpdateResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessment, 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 removes the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolVulnerabilityAssessmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 SQLPoolVulnerabilityAssessmentsClient) 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 SQLPoolVulnerabilityAssessmentsClient) 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 Sql pool's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolVulnerabilityAssessmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 SQLPoolVulnerabilityAssessmentsClient) 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 SQLPoolVulnerabilityAssessmentsClient) GetResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the vulnerability assessment policies associated with a SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolVulnerabilityAssessmentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolVulnerabilityAssessmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.List") - defer func() { - sc := -1 - if result.spvalr.Response.Response != nil { - sc = result.spvalr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.spvalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "List", resp, "Failure sending request") - return - } - - result.spvalr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "List", resp, "Failure responding to request") - return - } - if result.spvalr.hasNextLink() && result.spvalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolVulnerabilityAssessmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments", 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 SQLPoolVulnerabilityAssessmentsClient) 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 SQLPoolVulnerabilityAssessmentsClient) ListResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessmentListResult, 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 SQLPoolVulnerabilityAssessmentsClient) listNextResults(ctx context.Context, lastResults SQLPoolVulnerabilityAssessmentListResult) (result SQLPoolVulnerabilityAssessmentListResult, err error) { - req, err := lastResults.sQLPoolVulnerabilityAssessmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "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, "synapse.SQLPoolVulnerabilityAssessmentsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolVulnerabilityAssessmentsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolVulnerabilityAssessmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessmentscans.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessmentscans.go deleted file mode 100644 index 1832b2e7e478..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolvulnerabilityassessmentscans.go +++ /dev/null @@ -1,440 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolVulnerabilityAssessmentScansClient is the azure Synapse Analytics Management Client -type SQLPoolVulnerabilityAssessmentScansClient struct { - BaseClient -} - -// NewSQLPoolVulnerabilityAssessmentScansClient creates an instance of the SQLPoolVulnerabilityAssessmentScansClient -// client. -func NewSQLPoolVulnerabilityAssessmentScansClient(subscriptionID string) SQLPoolVulnerabilityAssessmentScansClient { - return NewSQLPoolVulnerabilityAssessmentScansClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolVulnerabilityAssessmentScansClientWithBaseURI creates an instance of the -// SQLPoolVulnerabilityAssessmentScansClient 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 NewSQLPoolVulnerabilityAssessmentScansClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolVulnerabilityAssessmentScansClient { - return SQLPoolVulnerabilityAssessmentScansClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Export convert an existing scan result to a human readable format. If already exists nothing happens -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client SQLPoolVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result SQLPoolVulnerabilityAssessmentScansExport, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.Export") - 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentScansClient", "Export", err.Error()) - } - - req, err := client.ExportPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Export", nil, "Failure preparing request") - return - } - - resp, err := client.ExportSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Export", resp, "Failure sending request") - return - } - - result, err = client.ExportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Export", resp, "Failure responding to request") - return - } - - return -} - -// ExportPreparer prepares the Export request. -func (client SQLPoolVulnerabilityAssessmentScansClient) ExportPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolVulnerabilityAssessmentScansClient) ExportSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client SQLPoolVulnerabilityAssessmentScansClient) ExportResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessmentScansExport, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a vulnerability assessment scan record of a Sql pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client SQLPoolVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result VulnerabilityAssessmentScanRecord, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentScansClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolVulnerabilityAssessmentScansClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}", 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 SQLPoolVulnerabilityAssessmentScansClient) 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 SQLPoolVulnerabilityAssessmentScansClient) GetResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecord, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// InitiateScan executes a Vulnerability Assessment database scan. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client SQLPoolVulnerabilityAssessmentScansClient) InitiateScan(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result SQLPoolVulnerabilityAssessmentScansInitiateScanFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.InitiateScan") - 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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentScansClient", "InitiateScan", err.Error()) - } - - req, err := client.InitiateScanPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "InitiateScan", nil, "Failure preparing request") - return - } - - result, err = client.InitiateScanSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "InitiateScan", result.Response(), "Failure sending request") - return - } - - return -} - -// InitiateScanPreparer prepares the InitiateScan request. -func (client SQLPoolVulnerabilityAssessmentScansClient) InitiateScanPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// InitiateScanSender sends the InitiateScan request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolVulnerabilityAssessmentScansClient) InitiateScanSender(req *http.Request) (future SQLPoolVulnerabilityAssessmentScansInitiateScanFuture, 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 -} - -// InitiateScanResponder handles the response to the InitiateScan request. The method always -// closes the http.Response Body. -func (client SQLPoolVulnerabilityAssessmentScansClient) InitiateScanResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists the vulnerability assessment scans of a SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolVulnerabilityAssessmentScansClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result VulnerabilityAssessmentScanRecordListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.List") - defer func() { - sc := -1 - if result.vasrlr.Response.Response != nil { - sc = result.vasrlr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentScansClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.vasrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "List", resp, "Failure sending request") - return - } - - result.vasrlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "List", resp, "Failure responding to request") - return - } - if result.vasrlr.hasNextLink() && result.vasrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolVulnerabilityAssessmentScansClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans", 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 SQLPoolVulnerabilityAssessmentScansClient) 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 SQLPoolVulnerabilityAssessmentScansClient) ListResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecordListResult, 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 SQLPoolVulnerabilityAssessmentScansClient) listNextResults(ctx context.Context, lastResults VulnerabilityAssessmentScanRecordListResult) (result VulnerabilityAssessmentScanRecordListResult, err error) { - req, err := lastResults.vulnerabilityAssessmentScanRecordListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "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, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolVulnerabilityAssessmentScansClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result VulnerabilityAssessmentScanRecordListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolworkloadclassifier.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolworkloadclassifier.go deleted file mode 100644 index 29a22b643006..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolworkloadclassifier.go +++ /dev/null @@ -1,452 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolWorkloadClassifierClient is the azure Synapse Analytics Management Client -type SQLPoolWorkloadClassifierClient struct { - BaseClient -} - -// NewSQLPoolWorkloadClassifierClient creates an instance of the SQLPoolWorkloadClassifierClient client. -func NewSQLPoolWorkloadClassifierClient(subscriptionID string) SQLPoolWorkloadClassifierClient { - return NewSQLPoolWorkloadClassifierClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolWorkloadClassifierClientWithBaseURI creates an instance of the SQLPoolWorkloadClassifierClient 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 NewSQLPoolWorkloadClassifierClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolWorkloadClassifierClient { - return SQLPoolWorkloadClassifierClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create Or Update workload classifier for a Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -// workloadClassifierName - the name of the workload classifier. -// parameters - the properties of the workload classifier. -func (client SQLPoolWorkloadClassifierClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string, parameters WorkloadClassifier) (result SQLPoolWorkloadClassifierCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WorkloadClassifierProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WorkloadClassifierProperties.MemberName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadClassifierClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName, workloadClassifierName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolWorkloadClassifierClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string, parameters WorkloadClassifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadClassifierName": autorest.Encode("path", workloadClassifierName), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}", 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 SQLPoolWorkloadClassifierClient) CreateOrUpdateSender(req *http.Request) (future SQLPoolWorkloadClassifierCreateOrUpdateFuture, 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 SQLPoolWorkloadClassifierClient) CreateOrUpdateResponder(resp *http.Response) (result WorkloadClassifier, 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 remove workload classifier of a Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -// workloadClassifierName - the name of the workload classifier. -func (client SQLPoolWorkloadClassifierClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (result SQLPoolWorkloadClassifierDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadClassifierClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName, workloadClassifierName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolWorkloadClassifierClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadClassifierName": autorest.Encode("path", workloadClassifierName), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}", 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 SQLPoolWorkloadClassifierClient) DeleteSender(req *http.Request) (future SQLPoolWorkloadClassifierDeleteFuture, 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 SQLPoolWorkloadClassifierClient) 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 get a workload classifier of Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -// workloadClassifierName - the name of the workload classifier. -func (client SQLPoolWorkloadClassifierClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (result WorkloadClassifier, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadClassifierClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName, workloadClassifierName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolWorkloadClassifierClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadClassifierName": autorest.Encode("path", workloadClassifierName), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}", 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 SQLPoolWorkloadClassifierClient) 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 SQLPoolWorkloadClassifierClient) GetResponder(resp *http.Response) (result WorkloadClassifier, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of Sql pool's workload classifier for workload groups. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -func (client SQLPoolWorkloadClassifierClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result WorkloadClassifierListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.List") - defer func() { - sc := -1 - if result.wclr.Response.Response != nil { - sc = result.wclr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadClassifierClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "List", resp, "Failure sending request") - return - } - - result.wclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "List", resp, "Failure responding to request") - return - } - if result.wclr.hasNextLink() && result.wclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolWorkloadClassifierClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers", 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 SQLPoolWorkloadClassifierClient) 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 SQLPoolWorkloadClassifierClient) ListResponder(resp *http.Response) (result WorkloadClassifierListResult, 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 SQLPoolWorkloadClassifierClient) listNextResults(ctx context.Context, lastResults WorkloadClassifierListResult) (result WorkloadClassifierListResult, err error) { - req, err := lastResults.workloadClassifierListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "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, "synapse.SQLPoolWorkloadClassifierClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolWorkloadClassifierClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result WorkloadClassifierListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.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, SQLPoolName, workloadGroupName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolworkloadgroup.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolworkloadgroup.go deleted file mode 100644 index 5ef2271a06ea..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/sqlpoolworkloadgroup.go +++ /dev/null @@ -1,447 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolWorkloadGroupClient is the azure Synapse Analytics Management Client -type SQLPoolWorkloadGroupClient struct { - BaseClient -} - -// NewSQLPoolWorkloadGroupClient creates an instance of the SQLPoolWorkloadGroupClient client. -func NewSQLPoolWorkloadGroupClient(subscriptionID string) SQLPoolWorkloadGroupClient { - return NewSQLPoolWorkloadGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolWorkloadGroupClientWithBaseURI creates an instance of the SQLPoolWorkloadGroupClient 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 NewSQLPoolWorkloadGroupClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolWorkloadGroupClient { - return SQLPoolWorkloadGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create Or Update a Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -// parameters - the requested workload group state. -func (client SQLPoolWorkloadGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, parameters WorkloadGroup) (result SQLPoolWorkloadGroupCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WorkloadGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WorkloadGroupProperties.MinResourcePercent", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WorkloadGroupProperties.MaxResourcePercent", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WorkloadGroupProperties.MinResourcePercentPerRequest", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadGroupClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolWorkloadGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, parameters WorkloadGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}", 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 SQLPoolWorkloadGroupClient) CreateOrUpdateSender(req *http.Request) (future SQLPoolWorkloadGroupCreateOrUpdateFuture, 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 SQLPoolWorkloadGroupClient) CreateOrUpdateResponder(resp *http.Response) (result WorkloadGroup, 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 remove Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -func (client SQLPoolWorkloadGroupClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result SQLPoolWorkloadGroupDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadGroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolWorkloadGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}", 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 SQLPoolWorkloadGroupClient) DeleteSender(req *http.Request) (future SQLPoolWorkloadGroupDeleteFuture, 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 SQLPoolWorkloadGroupClient) 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 get a Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -func (client SQLPoolWorkloadGroupClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result WorkloadGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadGroupClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolWorkloadGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}", 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 SQLPoolWorkloadGroupClient) 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 SQLPoolWorkloadGroupClient) GetResponder(resp *http.Response) (result WorkloadGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of Sql pool's workload groups. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolWorkloadGroupClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result WorkloadGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.List") - defer func() { - sc := -1 - if result.wglr.Response.Response != nil { - sc = result.wglr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadGroupClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "List", resp, "Failure sending request") - return - } - - result.wglr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "List", resp, "Failure responding to request") - return - } - if result.wglr.hasNextLink() && result.wglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolWorkloadGroupClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups", 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 SQLPoolWorkloadGroupClient) 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 SQLPoolWorkloadGroupClient) ListResponder(resp *http.Response) (result WorkloadGroupListResult, 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 SQLPoolWorkloadGroupClient) listNextResults(ctx context.Context, lastResults WorkloadGroupListResult) (result WorkloadGroupListResult, err error) { - req, err := lastResults.workloadGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "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, "synapse.SQLPoolWorkloadGroupClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolWorkloadGroupClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result WorkloadGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/synapseapi/interfaces.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/synapseapi/interfaces.go deleted file mode 100644 index 5f2f9c693a56..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/synapseapi/interfaces.go +++ /dev/null @@ -1,527 +0,0 @@ -package synapseapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/synapse/mgmt/2019-06-01-preview/synapse" - "github.com/Azure/go-autorest/autorest" -) - -// BigDataPoolsClientAPI contains the set of methods on the BigDataPoolsClient type. -type BigDataPoolsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolInfo synapse.BigDataPoolResourceInfo, force *bool) (result synapse.BigDataPoolsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (result synapse.BigDataPoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (result synapse.BigDataPoolResourceInfo, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.BigDataPoolResourceInfoListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.BigDataPoolResourceInfoListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolPatchInfo synapse.BigDataPoolPatchInfo) (result synapse.BigDataPoolResourceInfo, err error) -} - -var _ BigDataPoolsClientAPI = (*synapse.BigDataPoolsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - CheckNameAvailability(ctx context.Context, request synapse.CheckNameAvailabilityRequest) (result synapse.CheckNameAvailabilityResponse, err error) - GetAzureAsyncHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (result synapse.OperationResource, err error) - GetLocationHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (result autorest.Response, err error) - List(ctx context.Context) (result synapse.ListAvailableRpOperation, err error) -} - -var _ OperationsClientAPI = (*synapse.OperationsClient)(nil) - -// IPFirewallRulesClientAPI contains the set of methods on the IPFirewallRulesClient type. -type IPFirewallRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string, IPFirewallRuleInfo synapse.IPFirewallRuleInfo) (result synapse.IPFirewallRulesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (result synapse.IPFirewallRulesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (result synapse.IPFirewallRuleInfo, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.IPFirewallRuleInfoListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.IPFirewallRuleInfoListResultIterator, err error) - ReplaceAll(ctx context.Context, resourceGroupName string, workspaceName string, request synapse.ReplaceAllIPFirewallRulesRequest) (result synapse.IPFirewallRulesReplaceAllFuture, err error) -} - -var _ IPFirewallRulesClientAPI = (*synapse.IPFirewallRulesClient)(nil) - -// SQLPoolsClientAPI contains the set of methods on the SQLPoolsClient type. -type SQLPoolsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo synapse.SQLPool) (result synapse.SQLPoolsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPool, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.SQLPoolInfoListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.SQLPoolInfoListResultIterator, err error) - Pause(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolsPauseFuture, err error) - Resume(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolsResumeFuture, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo synapse.SQLPoolPatchInfo) (result synapse.SQLPool, err error) -} - -var _ SQLPoolsClientAPI = (*synapse.SQLPoolsClient)(nil) - -// SQLPoolMetadataSyncConfigsClientAPI contains the set of methods on the SQLPoolMetadataSyncConfigsClient type. -type SQLPoolMetadataSyncConfigsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, metadataSyncConfiguration synapse.MetadataSyncConfig) (result synapse.MetadataSyncConfig, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.MetadataSyncConfig, err error) -} - -var _ SQLPoolMetadataSyncConfigsClientAPI = (*synapse.SQLPoolMetadataSyncConfigsClient)(nil) - -// SQLPoolOperationResultsClientAPI contains the set of methods on the SQLPoolOperationResultsClient type. -type SQLPoolOperationResultsClientAPI interface { - GetLocationHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, operationID string) (result synapse.SetObject, err error) -} - -var _ SQLPoolOperationResultsClientAPI = (*synapse.SQLPoolOperationResultsClient)(nil) - -// SQLPoolGeoBackupPoliciesClientAPI contains the set of methods on the SQLPoolGeoBackupPoliciesClient type. -type SQLPoolGeoBackupPoliciesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.GeoBackupPolicy, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.GeoBackupPolicyListResult, err error) -} - -var _ SQLPoolGeoBackupPoliciesClientAPI = (*synapse.SQLPoolGeoBackupPoliciesClient)(nil) - -// SQLPoolDataWarehouseUserActivitiesClientAPI contains the set of methods on the SQLPoolDataWarehouseUserActivitiesClient type. -type SQLPoolDataWarehouseUserActivitiesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.DataWarehouseUserActivities, err error) -} - -var _ SQLPoolDataWarehouseUserActivitiesClientAPI = (*synapse.SQLPoolDataWarehouseUserActivitiesClient)(nil) - -// SQLPoolRestorePointsClientAPI contains the set of methods on the SQLPoolRestorePointsClient type. -type SQLPoolRestorePointsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.CreateSQLPoolRestorePointDefinition) (result synapse.SQLPoolRestorePointsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (result synapse.RestorePoint, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.RestorePointListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.RestorePointListResultIterator, err error) -} - -var _ SQLPoolRestorePointsClientAPI = (*synapse.SQLPoolRestorePointsClient)(nil) - -// SQLPoolReplicationLinksClientAPI contains the set of methods on the SQLPoolReplicationLinksClient type. -type SQLPoolReplicationLinksClientAPI interface { - GetByName(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, linkID string) (result synapse.ReplicationLink, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ReplicationLinkListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ReplicationLinkListResultIterator, err error) -} - -var _ SQLPoolReplicationLinksClientAPI = (*synapse.SQLPoolReplicationLinksClient)(nil) - -// SQLPoolTransparentDataEncryptionsClientAPI contains the set of methods on the SQLPoolTransparentDataEncryptionsClient type. -type SQLPoolTransparentDataEncryptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.TransparentDataEncryption) (result synapse.TransparentDataEncryption, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.TransparentDataEncryption, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.TransparentDataEncryptionListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.TransparentDataEncryptionListResultIterator, err error) -} - -var _ SQLPoolTransparentDataEncryptionsClientAPI = (*synapse.SQLPoolTransparentDataEncryptionsClient)(nil) - -// SQLPoolBlobAuditingPoliciesClientAPI contains the set of methods on the SQLPoolBlobAuditingPoliciesClient type. -type SQLPoolBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.SQLPoolBlobAuditingPolicy) (result synapse.SQLPoolBlobAuditingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicy, err error) - ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicyListResultPage, err error) - ListBySQLPoolComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicyListResultIterator, err error) -} - -var _ SQLPoolBlobAuditingPoliciesClientAPI = (*synapse.SQLPoolBlobAuditingPoliciesClient)(nil) - -// SQLPoolOperationsClientAPI contains the set of methods on the SQLPoolOperationsClient type. -type SQLPoolOperationsClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator, err error) -} - -var _ SQLPoolOperationsClientAPI = (*synapse.SQLPoolOperationsClient)(nil) - -// SQLPoolUsagesClientAPI contains the set of methods on the SQLPoolUsagesClient type. -type SQLPoolUsagesClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolUsageListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolUsageListResultIterator, err error) -} - -var _ SQLPoolUsagesClientAPI = (*synapse.SQLPoolUsagesClient)(nil) - -// SQLPoolSensitivityLabelsClientAPI contains the set of methods on the SQLPoolSensitivityLabelsClient type. -type SQLPoolSensitivityLabelsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, parameters synapse.SensitivityLabel) (result synapse.SensitivityLabel, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - DisableRecommendation(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - EnableRecommendation(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, sensitivityLabelSource synapse.SensitivityLabelSource) (result synapse.SensitivityLabel, err error) - ListCurrent(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result synapse.SensitivityLabelListResultPage, err error) - ListCurrentComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result synapse.SensitivityLabelListResultIterator, err error) - ListRecommended(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result synapse.SensitivityLabelListResultPage, err error) - ListRecommendedComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result synapse.SensitivityLabelListResultIterator, err error) -} - -var _ SQLPoolSensitivityLabelsClientAPI = (*synapse.SQLPoolSensitivityLabelsClient)(nil) - -// SQLPoolSchemasClientAPI contains the set of methods on the SQLPoolSchemasClient type. -type SQLPoolSchemasClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string) (result synapse.SQLPoolSchema, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result synapse.SQLPoolSchemaListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result synapse.SQLPoolSchemaListResultIterator, err error) -} - -var _ SQLPoolSchemasClientAPI = (*synapse.SQLPoolSchemasClient)(nil) - -// SQLPoolTablesClientAPI contains the set of methods on the SQLPoolTablesClient type. -type SQLPoolTablesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string) (result synapse.SQLPoolTable, err error) - ListBySchema(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (result synapse.SQLPoolTableListResultPage, err error) - ListBySchemaComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (result synapse.SQLPoolTableListResultIterator, err error) -} - -var _ SQLPoolTablesClientAPI = (*synapse.SQLPoolTablesClient)(nil) - -// SQLPoolTableColumnsClientAPI contains the set of methods on the SQLPoolTableColumnsClient type. -type SQLPoolTableColumnsClientAPI interface { - ListByTableName(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (result synapse.SQLPoolColumnListResultPage, err error) - ListByTableNameComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (result synapse.SQLPoolColumnListResultIterator, err error) -} - -var _ SQLPoolTableColumnsClientAPI = (*synapse.SQLPoolTableColumnsClient)(nil) - -// SQLPoolConnectionPoliciesClientAPI contains the set of methods on the SQLPoolConnectionPoliciesClient type. -type SQLPoolConnectionPoliciesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolConnectionPolicy, err error) -} - -var _ SQLPoolConnectionPoliciesClientAPI = (*synapse.SQLPoolConnectionPoliciesClient)(nil) - -// SQLPoolVulnerabilityAssessmentsClientAPI contains the set of methods on the SQLPoolVulnerabilityAssessmentsClient type. -type SQLPoolVulnerabilityAssessmentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.SQLPoolVulnerabilityAssessment) (result synapse.SQLPoolVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolVulnerabilityAssessment, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolVulnerabilityAssessmentListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolVulnerabilityAssessmentListResultIterator, err error) -} - -var _ SQLPoolVulnerabilityAssessmentsClientAPI = (*synapse.SQLPoolVulnerabilityAssessmentsClient)(nil) - -// SQLPoolVulnerabilityAssessmentScansClientAPI contains the set of methods on the SQLPoolVulnerabilityAssessmentScansClient type. -type SQLPoolVulnerabilityAssessmentScansClientAPI interface { - Export(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result synapse.SQLPoolVulnerabilityAssessmentScansExport, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result synapse.VulnerabilityAssessmentScanRecord, err error) - InitiateScan(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result synapse.SQLPoolVulnerabilityAssessmentScansInitiateScanFuture, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.VulnerabilityAssessmentScanRecordListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.VulnerabilityAssessmentScanRecordListResultIterator, err error) -} - -var _ SQLPoolVulnerabilityAssessmentScansClientAPI = (*synapse.SQLPoolVulnerabilityAssessmentScansClient)(nil) - -// SQLPoolSecurityAlertPoliciesClientAPI contains the set of methods on the SQLPoolSecurityAlertPoliciesClient type. -type SQLPoolSecurityAlertPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.SQLPoolSecurityAlertPolicy) (result synapse.SQLPoolSecurityAlertPolicy, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolSecurityAlertPolicy, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ListSQLPoolSecurityAlertPoliciesPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ListSQLPoolSecurityAlertPoliciesIterator, err error) -} - -var _ SQLPoolSecurityAlertPoliciesClientAPI = (*synapse.SQLPoolSecurityAlertPoliciesClient)(nil) - -// SQLPoolVulnerabilityAssessmentRuleBaselinesClientAPI contains the set of methods on the SQLPoolVulnerabilityAssessmentRuleBaselinesClient type. -type SQLPoolVulnerabilityAssessmentRuleBaselinesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName synapse.VulnerabilityAssessmentPolicyBaselineName, parameters synapse.SQLPoolVulnerabilityAssessmentRuleBaseline) (result synapse.SQLPoolVulnerabilityAssessmentRuleBaseline, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName synapse.VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName synapse.VulnerabilityAssessmentPolicyBaselineName) (result synapse.SQLPoolVulnerabilityAssessmentRuleBaseline, err error) -} - -var _ SQLPoolVulnerabilityAssessmentRuleBaselinesClientAPI = (*synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient)(nil) - -// ExtendedSQLPoolBlobAuditingPoliciesClientAPI contains the set of methods on the ExtendedSQLPoolBlobAuditingPoliciesClient type. -type ExtendedSQLPoolBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.ExtendedSQLPoolBlobAuditingPolicy) (result synapse.ExtendedSQLPoolBlobAuditingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ExtendedSQLPoolBlobAuditingPolicy, err error) - ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ExtendedSQLPoolBlobAuditingPolicyListResultPage, err error) - ListBySQLPoolComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ExtendedSQLPoolBlobAuditingPolicyListResultIterator, err error) -} - -var _ ExtendedSQLPoolBlobAuditingPoliciesClientAPI = (*synapse.ExtendedSQLPoolBlobAuditingPoliciesClient)(nil) - -// DataMaskingPoliciesClientAPI contains the set of methods on the DataMaskingPoliciesClient type. -type DataMaskingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.DataMaskingPolicy) (result synapse.DataMaskingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.DataMaskingPolicy, err error) -} - -var _ DataMaskingPoliciesClientAPI = (*synapse.DataMaskingPoliciesClient)(nil) - -// DataMaskingRulesClientAPI contains the set of methods on the DataMaskingRulesClient type. -type DataMaskingRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, dataMaskingRuleName string, parameters synapse.DataMaskingRule) (result synapse.DataMaskingRule, err error) - ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.DataMaskingRuleListResult, err error) -} - -var _ DataMaskingRulesClientAPI = (*synapse.DataMaskingRulesClient)(nil) - -// SQLPoolColumnsClientAPI contains the set of methods on the SQLPoolColumnsClient type. -type SQLPoolColumnsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result synapse.SQLPoolColumn, err error) -} - -var _ SQLPoolColumnsClientAPI = (*synapse.SQLPoolColumnsClient)(nil) - -// SQLPoolWorkloadGroupClientAPI contains the set of methods on the SQLPoolWorkloadGroupClient type. -type SQLPoolWorkloadGroupClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, parameters synapse.WorkloadGroup) (result synapse.SQLPoolWorkloadGroupCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result synapse.SQLPoolWorkloadGroupDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result synapse.WorkloadGroup, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.WorkloadGroupListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.WorkloadGroupListResultIterator, err error) -} - -var _ SQLPoolWorkloadGroupClientAPI = (*synapse.SQLPoolWorkloadGroupClient)(nil) - -// SQLPoolWorkloadClassifierClientAPI contains the set of methods on the SQLPoolWorkloadClassifierClient type. -type SQLPoolWorkloadClassifierClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string, parameters synapse.WorkloadClassifier) (result synapse.SQLPoolWorkloadClassifierCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (result synapse.SQLPoolWorkloadClassifierDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (result synapse.WorkloadClassifier, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result synapse.WorkloadClassifierListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result synapse.WorkloadClassifierListResultIterator, err error) -} - -var _ SQLPoolWorkloadClassifierClientAPI = (*synapse.SQLPoolWorkloadClassifierClient)(nil) - -// WorkspacesClientAPI contains the set of methods on the WorkspacesClient type. -type WorkspacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspaceInfo synapse.Workspace) (result synapse.WorkspacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.Workspace, err error) - List(ctx context.Context) (result synapse.WorkspaceInfoListResultPage, err error) - ListComplete(ctx context.Context) (result synapse.WorkspaceInfoListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result synapse.WorkspaceInfoListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result synapse.WorkspaceInfoListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, workspacePatchInfo synapse.WorkspacePatchInfo) (result synapse.WorkspacesUpdateFuture, err error) -} - -var _ WorkspacesClientAPI = (*synapse.WorkspacesClient)(nil) - -// WorkspaceAadAdminsClientAPI contains the set of methods on the WorkspaceAadAdminsClient type. -type WorkspaceAadAdminsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo synapse.WorkspaceAadAdminInfo) (result synapse.WorkspaceAadAdminsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspaceAadAdminsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspaceAadAdminInfo, err error) -} - -var _ WorkspaceAadAdminsClientAPI = (*synapse.WorkspaceAadAdminsClient)(nil) - -// WorkspaceSQLAadAdminsClientAPI contains the set of methods on the WorkspaceSQLAadAdminsClient type. -type WorkspaceSQLAadAdminsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo synapse.WorkspaceAadAdminInfo) (result synapse.WorkspaceSQLAadAdminsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspaceSQLAadAdminsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspaceAadAdminInfo, err error) -} - -var _ WorkspaceSQLAadAdminsClientAPI = (*synapse.WorkspaceSQLAadAdminsClient)(nil) - -// WorkspaceManagedIdentitySQLControlSettingsClientAPI contains the set of methods on the WorkspaceManagedIdentitySQLControlSettingsClient type. -type WorkspaceManagedIdentitySQLControlSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, managedIdentitySQLControlSettings synapse.ManagedIdentitySQLControlSettingsModel) (result synapse.WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ManagedIdentitySQLControlSettingsModel, err error) -} - -var _ WorkspaceManagedIdentitySQLControlSettingsClientAPI = (*synapse.WorkspaceManagedIdentitySQLControlSettingsClient)(nil) - -// RestorableDroppedSQLPoolsClientAPI contains the set of methods on the RestorableDroppedSQLPoolsClient type. -type RestorableDroppedSQLPoolsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, restorableDroppedSQLPoolID string) (result synapse.RestorableDroppedSQLPool, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.RestorableDroppedSQLPoolListResult, err error) -} - -var _ RestorableDroppedSQLPoolsClientAPI = (*synapse.RestorableDroppedSQLPoolsClient)(nil) - -// IntegrationRuntimesClientAPI contains the set of methods on the IntegrationRuntimesClient type. -type IntegrationRuntimesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, integrationRuntime synapse.IntegrationRuntimeResource, ifMatch string) (result synapse.IntegrationRuntimesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesDeleteFuture, err error) - DisableInteractiveQuery(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesDisableInteractiveQueryFuture, err error) - EnableInteractiveQuery(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesEnableInteractiveQueryFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, ifNoneMatch string) (result synapse.IntegrationRuntimeResource, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.IntegrationRuntimeListResponsePage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.IntegrationRuntimeListResponseIterator, err error) - Start(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesStartFuture, err error) - Stop(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesStopFuture, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, updateIntegrationRuntimeRequest synapse.UpdateIntegrationRuntimeRequest) (result synapse.IntegrationRuntimeResource, err error) - Upgrade(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result autorest.Response, err error) -} - -var _ IntegrationRuntimesClientAPI = (*synapse.IntegrationRuntimesClient)(nil) - -// IntegrationRuntimeNodeIPAddressClientAPI contains the set of methods on the IntegrationRuntimeNodeIPAddressClient type. -type IntegrationRuntimeNodeIPAddressClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result synapse.IntegrationRuntimeNodeIPAddress, err error) -} - -var _ IntegrationRuntimeNodeIPAddressClientAPI = (*synapse.IntegrationRuntimeNodeIPAddressClient)(nil) - -// IntegrationRuntimeObjectMetadataClientAPI contains the set of methods on the IntegrationRuntimeObjectMetadataClient type. -type IntegrationRuntimeObjectMetadataClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, getMetadataRequest *synapse.GetSsisObjectMetadataRequest) (result synapse.SsisObjectMetadataListResponse, err error) - Refresh(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeObjectMetadataRefreshFuture, err error) -} - -var _ IntegrationRuntimeObjectMetadataClientAPI = (*synapse.IntegrationRuntimeObjectMetadataClient)(nil) - -// IntegrationRuntimeNodesClientAPI contains the set of methods on the IntegrationRuntimeNodesClient type. -type IntegrationRuntimeNodesClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result synapse.SelfHostedIntegrationRuntimeNode, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string, updateIntegrationRuntimeNodeRequest synapse.UpdateIntegrationRuntimeNodeRequest) (result synapse.SelfHostedIntegrationRuntimeNode, err error) -} - -var _ IntegrationRuntimeNodesClientAPI = (*synapse.IntegrationRuntimeNodesClient)(nil) - -// IntegrationRuntimeCredentialsClientAPI contains the set of methods on the IntegrationRuntimeCredentialsClient type. -type IntegrationRuntimeCredentialsClientAPI interface { - Sync(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result autorest.Response, err error) -} - -var _ IntegrationRuntimeCredentialsClientAPI = (*synapse.IntegrationRuntimeCredentialsClient)(nil) - -// IntegrationRuntimeConnectionInfosClientAPI contains the set of methods on the IntegrationRuntimeConnectionInfosClient type. -type IntegrationRuntimeConnectionInfosClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeConnectionInfo, err error) -} - -var _ IntegrationRuntimeConnectionInfosClientAPI = (*synapse.IntegrationRuntimeConnectionInfosClient)(nil) - -// IntegrationRuntimeAuthKeysClientAPI contains the set of methods on the IntegrationRuntimeAuthKeysClient type. -type IntegrationRuntimeAuthKeysClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeAuthKeys, err error) - Regenerate(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, regenerateKeyParameters synapse.IntegrationRuntimeRegenerateKeyParameters) (result synapse.IntegrationRuntimeAuthKeys, err error) -} - -var _ IntegrationRuntimeAuthKeysClientAPI = (*synapse.IntegrationRuntimeAuthKeysClient)(nil) - -// IntegrationRuntimeMonitoringDataClientAPI contains the set of methods on the IntegrationRuntimeMonitoringDataClient type. -type IntegrationRuntimeMonitoringDataClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeMonitoringData, err error) -} - -var _ IntegrationRuntimeMonitoringDataClientAPI = (*synapse.IntegrationRuntimeMonitoringDataClient)(nil) - -// IntegrationRuntimeStatusClientAPI contains the set of methods on the IntegrationRuntimeStatusClient type. -type IntegrationRuntimeStatusClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeStatusResponse, err error) -} - -var _ IntegrationRuntimeStatusClientAPI = (*synapse.IntegrationRuntimeStatusClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, privateLinkResourceName string) (result synapse.PrivateLinkResource, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.PrivateLinkResourceListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.PrivateLinkResourceListResultIterator, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*synapse.PrivateLinkResourcesClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - Create(ctx context.Context, request synapse.PrivateEndpointConnection, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result synapse.PrivateEndpointConnectionsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result synapse.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result synapse.PrivateEndpointConnection, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.PrivateEndpointConnectionListPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.PrivateEndpointConnectionListIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*synapse.PrivateEndpointConnectionsClient)(nil) - -// PrivateLinkHubsClientAPI contains the set of methods on the PrivateLinkHubsClient type. -type PrivateLinkHubsClientAPI interface { - CreateOrUpdate(ctx context.Context, privateLinkHubInfo synapse.PrivateLinkHub, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkHub, err error) - Delete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkHubsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkHub, err error) - List(ctx context.Context) (result synapse.PrivateLinkHubInfoListResultPage, err error) - ListComplete(ctx context.Context) (result synapse.PrivateLinkHubInfoListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result synapse.PrivateLinkHubInfoListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result synapse.PrivateLinkHubInfoListResultIterator, err error) - Update(ctx context.Context, privateLinkHubPatchInfo synapse.PrivateLinkHubPatchInfo, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkHub, err error) -} - -var _ PrivateLinkHubsClientAPI = (*synapse.PrivateLinkHubsClient)(nil) - -// PrivateEndpointConnectionsPrivateLinkHubClientAPI contains the set of methods on the PrivateEndpointConnectionsPrivateLinkHubClient type. -type PrivateEndpointConnectionsPrivateLinkHubClientAPI interface { - List(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage, err error) - ListComplete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator, err error) -} - -var _ PrivateEndpointConnectionsPrivateLinkHubClientAPI = (*synapse.PrivateEndpointConnectionsPrivateLinkHubClient)(nil) - -// WorkspaceManagedSQLServerBlobAuditingPoliciesClientAPI contains the set of methods on the WorkspaceManagedSQLServerBlobAuditingPoliciesClient type. -type WorkspaceManagedSQLServerBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.ServerBlobAuditingPolicy) (result synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerBlobAuditingPolicy, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerBlobAuditingPolicyListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerBlobAuditingPolicyListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerBlobAuditingPoliciesClientAPI = (*synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient)(nil) - -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientAPI contains the set of methods on the WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient type. -type WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.ExtendedServerBlobAuditingPolicy) (result synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ExtendedServerBlobAuditingPolicy, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ExtendedServerBlobAuditingPolicyListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ExtendedServerBlobAuditingPolicyListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientAPI = (*synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient)(nil) - -// WorkspaceManagedSQLServerSecurityAlertPolicyClientAPI contains the set of methods on the WorkspaceManagedSQLServerSecurityAlertPolicyClient type. -type WorkspaceManagedSQLServerSecurityAlertPolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.ServerSecurityAlertPolicy) (result synapse.WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerSecurityAlertPolicy, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerSecurityAlertPolicyListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerSecurityAlertPolicyListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerSecurityAlertPolicyClientAPI = (*synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient)(nil) - -// WorkspaceManagedSQLServerVulnerabilityAssessmentsClientAPI contains the set of methods on the WorkspaceManagedSQLServerVulnerabilityAssessmentsClient type. -type WorkspaceManagedSQLServerVulnerabilityAssessmentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.ServerVulnerabilityAssessment) (result synapse.ServerVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerVulnerabilityAssessment, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerVulnerabilityAssessmentListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerVulnerabilityAssessmentListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerVulnerabilityAssessmentsClientAPI = (*synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient)(nil) - -// WorkspaceManagedSQLServerUsagesClientAPI contains the set of methods on the WorkspaceManagedSQLServerUsagesClient type. -type WorkspaceManagedSQLServerUsagesClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerUsageListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerUsageListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerUsagesClientAPI = (*synapse.WorkspaceManagedSQLServerUsagesClient)(nil) - -// WorkspaceManagedSQLServerRecoverableSqlpoolsClientAPI contains the set of methods on the WorkspaceManagedSQLServerRecoverableSqlpoolsClient type. -type WorkspaceManagedSQLServerRecoverableSqlpoolsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLComputeName string) (result synapse.RecoverableSQLPool, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.RecoverableSQLPoolListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.RecoverableSQLPoolListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerRecoverableSqlpoolsClientAPI = (*synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient)(nil) - -// KeysClientAPI contains the set of methods on the KeysClient type. -type KeysClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, keyName string, keyProperties synapse.Key) (result synapse.Key, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (result synapse.Key, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (result synapse.Key, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.KeyInfoListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.KeyInfoListResultIterator, err error) -} - -var _ KeysClientAPI = (*synapse.KeysClient)(nil) diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/version.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/version.go deleted file mode 100644 index e2677862e61f..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package synapse - -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() + " synapse/2019-06-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/synapse/mgmt/2019-06-01-preview/synapse/workspaceaadadmins.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspaceaadadmins.go deleted file mode 100644 index 200704d35e71..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspaceaadadmins.go +++ /dev/null @@ -1,299 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceAadAdminsClient is the azure Synapse Analytics Management Client -type WorkspaceAadAdminsClient struct { - BaseClient -} - -// NewWorkspaceAadAdminsClient creates an instance of the WorkspaceAadAdminsClient client. -func NewWorkspaceAadAdminsClient(subscriptionID string) WorkspaceAadAdminsClient { - return NewWorkspaceAadAdminsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceAadAdminsClientWithBaseURI creates an instance of the WorkspaceAadAdminsClient 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 NewWorkspaceAadAdminsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceAadAdminsClient { - return WorkspaceAadAdminsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workspace active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// aadAdminInfo - workspace active directory administrator properties -func (client WorkspaceAadAdminsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo WorkspaceAadAdminInfo) (result WorkspaceAadAdminsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceAadAdminsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceAadAdminsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, aadAdminInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceAadAdminsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo WorkspaceAadAdminInfo) (*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 = "2019-06-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.Synapse/workspaces/{workspaceName}/administrators/activeDirectory", pathParameters), - autorest.WithJSON(aadAdminInfo), - 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 WorkspaceAadAdminsClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceAadAdminsCreateOrUpdateFuture, 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 WorkspaceAadAdminsClient) CreateOrUpdateResponder(resp *http.Response) (result WorkspaceAadAdminInfo, 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 a workspace active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceAadAdminsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceAadAdminsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceAadAdminsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceAadAdminsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspaceAadAdminsClient) DeletePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/administrators/activeDirectory", 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 WorkspaceAadAdminsClient) DeleteSender(req *http.Request) (future WorkspaceAadAdminsDeleteFuture, 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 WorkspaceAadAdminsClient) 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 a workspace active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceAadAdminsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceAadAdminInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceAadAdminsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceAadAdminsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceAadAdminsClient) GetPreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/administrators/activeDirectory", 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 WorkspaceAadAdminsClient) 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 WorkspaceAadAdminsClient) GetResponder(resp *http.Response) (result WorkspaceAadAdminInfo, 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/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedidentitysqlcontrolsettings.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedidentitysqlcontrolsettings.go deleted file mode 100644 index f1ae180bd181..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedidentitysqlcontrolsettings.go +++ /dev/null @@ -1,212 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedIdentitySQLControlSettingsClient is the azure Synapse Analytics Management Client -type WorkspaceManagedIdentitySQLControlSettingsClient struct { - BaseClient -} - -// NewWorkspaceManagedIdentitySQLControlSettingsClient creates an instance of the -// WorkspaceManagedIdentitySQLControlSettingsClient client. -func NewWorkspaceManagedIdentitySQLControlSettingsClient(subscriptionID string) WorkspaceManagedIdentitySQLControlSettingsClient { - return NewWorkspaceManagedIdentitySQLControlSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedIdentitySQLControlSettingsClientWithBaseURI creates an instance of the -// WorkspaceManagedIdentitySQLControlSettingsClient 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 NewWorkspaceManagedIdentitySQLControlSettingsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedIdentitySQLControlSettingsClient { - return WorkspaceManagedIdentitySQLControlSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// managedIdentitySQLControlSettings - managed Identity Sql Control Settings -func (client WorkspaceManagedIdentitySQLControlSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, managedIdentitySQLControlSettings ManagedIdentitySQLControlSettingsModel) (result WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedIdentitySQLControlSettingsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, managedIdentitySQLControlSettings) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedIdentitySQLControlSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, managedIdentitySQLControlSettings ManagedIdentitySQLControlSettingsModel) (*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 = "2019-06-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.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default", pathParameters), - autorest.WithJSON(managedIdentitySQLControlSettings), - 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 WorkspaceManagedIdentitySQLControlSettingsClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture, 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 WorkspaceManagedIdentitySQLControlSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedIdentitySQLControlSettingsModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedIdentitySQLControlSettingsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ManagedIdentitySQLControlSettingsModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedIdentitySQLControlSettingsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedIdentitySQLControlSettingsClient) GetPreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default", 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 WorkspaceManagedIdentitySQLControlSettingsClient) 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 WorkspaceManagedIdentitySQLControlSettingsClient) GetResponder(resp *http.Response) (result ManagedIdentitySQLControlSettingsModel, 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/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverblobauditingpolicies.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverblobauditingpolicies.go deleted file mode 100644 index 2ea6a40f5f9e..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverblobauditingpolicies.go +++ /dev/null @@ -1,342 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerBlobAuditingPoliciesClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerBlobAuditingPoliciesClient creates an instance of the -// WorkspaceManagedSQLServerBlobAuditingPoliciesClient client. -func NewWorkspaceManagedSQLServerBlobAuditingPoliciesClient(subscriptionID string) WorkspaceManagedSQLServerBlobAuditingPoliciesClient { - return NewWorkspaceManagedSQLServerBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerBlobAuditingPoliciesClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerBlobAuditingPoliciesClient 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 NewWorkspaceManagedSQLServerBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerBlobAuditingPoliciesClient { - return WorkspaceManagedSQLServerBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a workspace managed sql server's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// parameters - properties of extended blob auditing policy. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerBlobAuditingPolicy) (result WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerBlobAuditingPoliciesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}", 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 WorkspaceManagedSQLServerBlobAuditingPoliciesClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture, 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 WorkspaceManagedSQLServerBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerBlobAuditingPolicy, 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 get a workspace managed sql server's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerBlobAuditingPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}", 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 WorkspaceManagedSQLServerBlobAuditingPoliciesClient) 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 WorkspaceManagedSQLServerBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result ServerBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list workspace managed sql server's blob auditing policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerBlobAuditingPoliciesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.sbaplr.Response.Response != nil { - sc = result.sbaplr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.sbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.sbaplr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.sbaplr.hasNextLink() && result.sbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspacePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/auditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspaceResponder(resp *http.Response) (result ServerBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) listByWorkspaceNextResults(ctx context.Context, lastResults ServerBlobAuditingPolicyListResult) (result ServerBlobAuditingPolicyListResult, err error) { - req, err := lastResults.serverBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerBlobAuditingPoliciesClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverextendedblobauditingpolicies.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverextendedblobauditingpolicies.go deleted file mode 100644 index 4a4676759544..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverextendedblobauditingpolicies.go +++ /dev/null @@ -1,342 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient creates an instance of the -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient client. -func NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient(subscriptionID string) WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient { - return NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient 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 NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient { - return WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a workspace managed sql server's extended blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// parameters - properties of extended blob auditing policy. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters ExtendedServerBlobAuditingPolicy) (result WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters ExtendedServerBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture, 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ExtendedServerBlobAuditingPolicy, 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 get a workspace SQL server's extended blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ExtendedServerBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result ExtendedServerBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list workspace managed sql server's extended blob auditing policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result ExtendedServerBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.esbaplr.Response.Response != nil { - sc = result.esbaplr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.esbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.esbaplr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.esbaplr.hasNextLink() && result.esbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspacePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/extendedAuditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspaceResponder(resp *http.Response) (result ExtendedServerBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) listByWorkspaceNextResults(ctx context.Context, lastResults ExtendedServerBlobAuditingPolicyListResult) (result ExtendedServerBlobAuditingPolicyListResult, err error) { - req, err := lastResults.extendedServerBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ExtendedServerBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverrecoverablesqlpools.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverrecoverablesqlpools.go deleted file mode 100644 index 634eb44d9906..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverrecoverablesqlpools.go +++ /dev/null @@ -1,250 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerRecoverableSqlpoolsClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerRecoverableSqlpoolsClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerRecoverableSqlpoolsClient creates an instance of the -// WorkspaceManagedSQLServerRecoverableSqlpoolsClient client. -func NewWorkspaceManagedSQLServerRecoverableSqlpoolsClient(subscriptionID string) WorkspaceManagedSQLServerRecoverableSqlpoolsClient { - return NewWorkspaceManagedSQLServerRecoverableSqlpoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerRecoverableSqlpoolsClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerRecoverableSqlpoolsClient 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 NewWorkspaceManagedSQLServerRecoverableSqlpoolsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerRecoverableSqlpoolsClient { - return WorkspaceManagedSQLServerRecoverableSqlpoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get recoverable sql pools for workspace managed sql server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLComputeName - the name of the sql compute -func (client WorkspaceManagedSQLServerRecoverableSqlpoolsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLComputeName string) (result RecoverableSQLPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerRecoverableSqlpoolsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLComputeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerRecoverableSqlpoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLComputeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlComputeName": autorest.Encode("path", SQLComputeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlComputeName}", 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 WorkspaceManagedSQLServerRecoverableSqlpoolsClient) 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 WorkspaceManagedSQLServerRecoverableSqlpoolsClient) GetResponder(resp *http.Response) (result RecoverableSQLPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of recoverable sql pools for workspace managed sql server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerRecoverableSqlpoolsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result RecoverableSQLPoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerRecoverableSqlpoolsClient.List") - defer func() { - sc := -1 - if result.rsplr.Response.Response != nil { - sc = result.rsplr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rsplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "List", resp, "Failure sending request") - return - } - - result.rsplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "List", resp, "Failure responding to request") - return - } - if result.rsplr.hasNextLink() && result.rsplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspaceManagedSQLServerRecoverableSqlpoolsClient) 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 = "2019-06-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.Synapse/workspaces/{workspaceName}/recoverableSqlpools", 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 WorkspaceManagedSQLServerRecoverableSqlpoolsClient) 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 WorkspaceManagedSQLServerRecoverableSqlpoolsClient) ListResponder(resp *http.Response) (result RecoverableSQLPoolListResult, 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 WorkspaceManagedSQLServerRecoverableSqlpoolsClient) listNextResults(ctx context.Context, lastResults RecoverableSQLPoolListResult) (result RecoverableSQLPoolListResult, err error) { - req, err := lastResults.recoverableSQLPoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "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, "synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSqlpoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerRecoverableSqlpoolsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result RecoverableSQLPoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerRecoverableSqlpoolsClient.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/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserversecurityalertpolicy.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserversecurityalertpolicy.go deleted file mode 100644 index 669685175aea..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserversecurityalertpolicy.go +++ /dev/null @@ -1,342 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerSecurityAlertPolicyClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerSecurityAlertPolicyClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerSecurityAlertPolicyClient creates an instance of the -// WorkspaceManagedSQLServerSecurityAlertPolicyClient client. -func NewWorkspaceManagedSQLServerSecurityAlertPolicyClient(subscriptionID string) WorkspaceManagedSQLServerSecurityAlertPolicyClient { - return NewWorkspaceManagedSQLServerSecurityAlertPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerSecurityAlertPolicyClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerSecurityAlertPolicyClient 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 NewWorkspaceManagedSQLServerSecurityAlertPolicyClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerSecurityAlertPolicyClient { - return WorkspaceManagedSQLServerSecurityAlertPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a workspace managed sql server's threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// parameters - the workspace managed sql server security alert policy. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerSecurityAlertPolicy) (result WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerSecurityAlertPolicyClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}", 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture, 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result ServerSecurityAlertPolicy, 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 get a workspace managed sql server's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerSecurityAlertPolicyClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}", 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) GetResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get workspace managed sql server's threat detection policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerSecurityAlertPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerSecurityAlertPolicyClient.List") - defer func() { - sc := -1 - if result.ssaplr.Response.Response != nil { - sc = result.ssaplr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ssaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "List", resp, "Failure sending request") - return - } - - result.ssaplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "List", resp, "Failure responding to request") - return - } - if result.ssaplr.hasNextLink() && result.ssaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) 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 = "2019-06-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.Synapse/workspaces/{workspaceName}/securityAlertPolicies", 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) ListResponder(resp *http.Response) (result ServerSecurityAlertPolicyListResult, 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) listNextResults(ctx context.Context, lastResults ServerSecurityAlertPolicyListResult) (result ServerSecurityAlertPolicyListResult, err error) { - req, err := lastResults.serverSecurityAlertPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "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, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerSecurityAlertPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerSecurityAlertPolicyClient.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/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverusages.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverusages.go deleted file mode 100644 index 858199a32bc2..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlserverusages.go +++ /dev/null @@ -1,161 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerUsagesClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerUsagesClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerUsagesClient creates an instance of the WorkspaceManagedSQLServerUsagesClient client. -func NewWorkspaceManagedSQLServerUsagesClient(subscriptionID string) WorkspaceManagedSQLServerUsagesClient { - return NewWorkspaceManagedSQLServerUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerUsagesClientWithBaseURI creates an instance of the WorkspaceManagedSQLServerUsagesClient -// 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 NewWorkspaceManagedSQLServerUsagesClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerUsagesClient { - return WorkspaceManagedSQLServerUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get list of server usages metric for workspace managed sql server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerUsagesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerUsageListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerUsagesClient.List") - defer func() { - sc := -1 - if result.sulr.Response.Response != nil { - sc = result.sulr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerUsagesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sulr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "List", resp, "Failure sending request") - return - } - - result.sulr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "List", resp, "Failure responding to request") - return - } - if result.sulr.hasNextLink() && result.sulr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspaceManagedSQLServerUsagesClient) 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 = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlUsages", 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 WorkspaceManagedSQLServerUsagesClient) 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 WorkspaceManagedSQLServerUsagesClient) ListResponder(resp *http.Response) (result ServerUsageListResult, 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 WorkspaceManagedSQLServerUsagesClient) listNextResults(ctx context.Context, lastResults ServerUsageListResult) (result ServerUsageListResult, err error) { - req, err := lastResults.serverUsageListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "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, "synapse.WorkspaceManagedSQLServerUsagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerUsagesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerUsageListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerUsagesClient.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/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlservervulnerabilityassessments.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlservervulnerabilityassessments.go deleted file mode 100644 index 740ab41df7af..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacemanagedsqlservervulnerabilityassessments.go +++ /dev/null @@ -1,428 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerVulnerabilityAssessmentsClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerVulnerabilityAssessmentsClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClient creates an instance of the -// WorkspaceManagedSQLServerVulnerabilityAssessmentsClient client. -func NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClient(subscriptionID string) WorkspaceManagedSQLServerVulnerabilityAssessmentsClient { - return NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerVulnerabilityAssessmentsClient 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 NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerVulnerabilityAssessmentsClient { - return WorkspaceManagedSQLServerVulnerabilityAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update workspace managed sql server's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// parameters - properties for vulnerability assessment. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerVulnerabilityAssessment) (result ServerVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServerVulnerabilityAssessmentProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServerVulnerabilityAssessmentProperties.StorageContainerPath", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerVulnerabilityAssessment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerVulnerabilityAssessment, 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 remove workspace managed sql server's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) DeletePreparer(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), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 workspace managed sql server's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) GetPreparer(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), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2019-06-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.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) GetResponder(resp *http.Response) (result ServerVulnerabilityAssessment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the vulnerability assessment policies associated with a workspace managed sql server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerVulnerabilityAssessmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.List") - defer func() { - sc := -1 - if result.svalr.Response.Response != nil { - sc = result.svalr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.svalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "List", resp, "Failure sending request") - return - } - - result.svalr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "List", resp, "Failure responding to request") - return - } - if result.svalr.hasNextLink() && result.svalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 = "2019-06-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.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments", 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) ListResponder(resp *http.Response) (result ServerVulnerabilityAssessmentListResult, 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) listNextResults(ctx context.Context, lastResults ServerVulnerabilityAssessmentListResult) (result ServerVulnerabilityAssessmentListResult, err error) { - req, err := lastResults.serverVulnerabilityAssessmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "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, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerVulnerabilityAssessmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.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/synapse/mgmt/2019-06-01-preview/synapse/workspaces.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspaces.go deleted file mode 100644 index e27589d25421..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspaces.go +++ /dev/null @@ -1,636 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspacesClient is the azure Synapse Analytics Management Client -type WorkspacesClient struct { - BaseClient -} - -// NewWorkspacesClient creates an instance of the WorkspacesClient client. -func NewWorkspacesClient(subscriptionID string) WorkspacesClient { - return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient 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 NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { - return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// workspaceInfo - workspace create or update request properties -func (client WorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspaceInfo Workspace) (result WorkspacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, workspaceInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, workspaceInfo Workspace) (*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 = "2019-06-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.Synapse/workspaces/{workspaceName}", pathParameters), - autorest.WithJSON(workspaceInfo), - 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 WorkspacesClient) CreateOrUpdateSender(req *http.Request) (future WorkspacesCreateOrUpdateFuture, 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 WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, 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 a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspacesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspacesClient) DeletePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}", 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 WorkspacesClient) DeleteSender(req *http.Request) (future WorkspacesDeleteFuture, 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 WorkspacesClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result Workspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspacesClient) GetPreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}", 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 WorkspacesClient) 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 WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns a list of workspaces in a subscription -func (client WorkspacesClient) List(ctx context.Context) (result WorkspaceInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.List") - defer func() { - sc := -1 - if result.wilr.Response.Response != nil { - sc = result.wilr.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("synapse.WorkspacesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "List", resp, "Failure sending request") - return - } - - result.wilr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "List", resp, "Failure responding to request") - return - } - if result.wilr.hasNextLink() && result.wilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspacesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces", 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 WorkspacesClient) 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 WorkspacesClient) ListResponder(resp *http.Response) (result WorkspaceInfoListResult, 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 WorkspacesClient) listNextResults(ctx context.Context, lastResults WorkspaceInfoListResult) (result WorkspaceInfoListResult, err error) { - req, err := lastResults.workspaceInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "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, "synapse.WorkspacesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspacesClient) ListComplete(ctx context.Context) (result WorkspaceInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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 a list of workspaces in a resource group -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client WorkspacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WorkspaceInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.wilr.Response.Response != nil { - sc = result.wilr.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspacesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.wilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.wilr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.wilr.hasNextLink() && result.wilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WorkspacesClient) 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 = "2019-06-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.Synapse/workspaces", 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 WorkspacesClient) 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 WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceInfoListResult, 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 WorkspacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults WorkspaceInfoListResult) (result WorkspaceInfoListResult, err error) { - req, err := lastResults.workspaceInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "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, "synapse.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result WorkspaceInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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 -} - -// Update updates a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// workspacePatchInfo - workspace patch request properties -func (client WorkspacesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, workspacePatchInfo WorkspacePatchInfo) (result WorkspacesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspacesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, workspacePatchInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WorkspacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, workspacePatchInfo WorkspacePatchInfo) (*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 = "2019-06-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.Synapse/workspaces/{workspaceName}", pathParameters), - autorest.WithJSON(workspacePatchInfo), - 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 WorkspacesClient) UpdateSender(req *http.Request) (future WorkspacesUpdateFuture, 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 WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, 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/synapse/mgmt/2019-06-01-preview/synapse/workspacesqlaadadmins.go b/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacesqlaadadmins.go deleted file mode 100644 index 2c1e5358da70..000000000000 --- a/services/preview/synapse/mgmt/2019-06-01-preview/synapse/workspacesqlaadadmins.go +++ /dev/null @@ -1,299 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceSQLAadAdminsClient is the azure Synapse Analytics Management Client -type WorkspaceSQLAadAdminsClient struct { - BaseClient -} - -// NewWorkspaceSQLAadAdminsClient creates an instance of the WorkspaceSQLAadAdminsClient client. -func NewWorkspaceSQLAadAdminsClient(subscriptionID string) WorkspaceSQLAadAdminsClient { - return NewWorkspaceSQLAadAdminsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceSQLAadAdminsClientWithBaseURI creates an instance of the WorkspaceSQLAadAdminsClient 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 NewWorkspaceSQLAadAdminsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceSQLAadAdminsClient { - return WorkspaceSQLAadAdminsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workspace SQL active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// aadAdminInfo - workspace active directory administrator properties -func (client WorkspaceSQLAadAdminsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo WorkspaceAadAdminInfo) (result WorkspaceSQLAadAdminsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceSQLAadAdminsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceSQLAadAdminsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, aadAdminInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceSQLAadAdminsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo WorkspaceAadAdminInfo) (*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 = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory", pathParameters), - autorest.WithJSON(aadAdminInfo), - 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 WorkspaceSQLAadAdminsClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceSQLAadAdminsCreateOrUpdateFuture, 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 WorkspaceSQLAadAdminsClient) CreateOrUpdateResponder(resp *http.Response) (result WorkspaceAadAdminInfo, 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 a workspace SQL active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceSQLAadAdminsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceSQLAadAdminsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceSQLAadAdminsClient.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: 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceSQLAadAdminsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspaceSQLAadAdminsClient) DeletePreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory", 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 WorkspaceSQLAadAdminsClient) DeleteSender(req *http.Request) (future WorkspaceSQLAadAdminsDeleteFuture, 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 WorkspaceSQLAadAdminsClient) 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 a workspace SQL active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceSQLAadAdminsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceAadAdminInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceSQLAadAdminsClient.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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceSQLAadAdminsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceSQLAadAdminsClient) GetPreparer(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 = "2019-06-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.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory", 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 WorkspaceSQLAadAdminsClient) 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 WorkspaceSQLAadAdminsClient) GetResponder(resp *http.Response) (result WorkspaceAadAdminInfo, 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/synapse/mgmt/v1.0/synapse/CHANGELOG.md b/services/preview/synapse/mgmt/v1.0/synapse/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/synapse/mgmt/v1.0/synapse/_meta.json b/services/preview/synapse/mgmt/v1.0/synapse/_meta.json deleted file mode 100644 index dea22d8661d5..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "296412a72eeb85c73377e9c626953bf7513a59d6", - "readme": "/_/azure-rest-api-specs/specification/synapse/resource-manager/readme.md", - "tag": "package-composite-v1", - "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-composite-v1 --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/synapse/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/synapse/mgmt/v1.0/synapse/azureadonlyauthentications.go b/services/preview/synapse/mgmt/v1.0/synapse/azureadonlyauthentications.go deleted file mode 100644 index 0b25a0a712f4..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/azureadonlyauthentications.go +++ /dev/null @@ -1,341 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// AzureADOnlyAuthenticationsClient is the azure Synapse Analytics Management Client -type AzureADOnlyAuthenticationsClient struct { - BaseClient -} - -// NewAzureADOnlyAuthenticationsClient creates an instance of the AzureADOnlyAuthenticationsClient client. -func NewAzureADOnlyAuthenticationsClient(subscriptionID string) AzureADOnlyAuthenticationsClient { - return NewAzureADOnlyAuthenticationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAzureADOnlyAuthenticationsClientWithBaseURI creates an instance of the AzureADOnlyAuthenticationsClient 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 NewAzureADOnlyAuthenticationsClientWithBaseURI(baseURI string, subscriptionID string) AzureADOnlyAuthenticationsClient { - return AzureADOnlyAuthenticationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create or Update a Azure Active Directory only authentication property for the workspaces -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// azureADOnlyAuthenticationInfo - azure Active Directory Property -func (client AzureADOnlyAuthenticationsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, azureADOnlyAuthenticationInfo AzureADOnlyAuthentication) (result AzureADOnlyAuthenticationsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureADOnlyAuthenticationsClient.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: 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: azureADOnlyAuthenticationInfo, - Constraints: []validation.Constraint{{Target: "azureADOnlyAuthenticationInfo.AzureADOnlyAuthenticationProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "azureADOnlyAuthenticationInfo.AzureADOnlyAuthenticationProperties.AzureADOnlyAuthentication", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("synapse.AzureADOnlyAuthenticationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, azureADOnlyAuthenticationInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AzureADOnlyAuthenticationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, azureADOnlyAuthenticationInfo AzureADOnlyAuthentication) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "azureADOnlyAuthenticationName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}", pathParameters), - autorest.WithJSON(azureADOnlyAuthenticationInfo), - 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 AzureADOnlyAuthenticationsClient) CreateSender(req *http.Request) (future AzureADOnlyAuthenticationsCreateFuture, 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 AzureADOnlyAuthenticationsClient) CreateResponder(resp *http.Response) (result AzureADOnlyAuthentication, 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 -} - -// Get gets a Azure Active Directory only authentication property -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client AzureADOnlyAuthenticationsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result AzureADOnlyAuthentication, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureADOnlyAuthenticationsClient.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("synapse.AzureADOnlyAuthenticationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AzureADOnlyAuthenticationsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "azureADOnlyAuthenticationName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}", 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 AzureADOnlyAuthenticationsClient) 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 AzureADOnlyAuthenticationsClient) GetResponder(resp *http.Response) (result AzureADOnlyAuthentication, 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 Azure Active Directory only authentication property for a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client AzureADOnlyAuthenticationsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result AzureADOnlyAuthenticationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureADOnlyAuthenticationsClient.List") - defer func() { - sc := -1 - if result.aaoalr.Response.Response != nil { - sc = result.aaoalr.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("synapse.AzureADOnlyAuthenticationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.aaoalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "List", resp, "Failure sending request") - return - } - - result.aaoalr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "List", resp, "Failure responding to request") - return - } - if result.aaoalr.hasNextLink() && result.aaoalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AzureADOnlyAuthenticationsClient) 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 = "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.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications", 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 AzureADOnlyAuthenticationsClient) 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 AzureADOnlyAuthenticationsClient) ListResponder(resp *http.Response) (result AzureADOnlyAuthenticationListResult, 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 AzureADOnlyAuthenticationsClient) listNextResults(ctx context.Context, lastResults AzureADOnlyAuthenticationListResult) (result AzureADOnlyAuthenticationListResult, err error) { - req, err := lastResults.azureADOnlyAuthenticationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "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, "synapse.AzureADOnlyAuthenticationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AzureADOnlyAuthenticationsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result AzureADOnlyAuthenticationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureADOnlyAuthenticationsClient.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/synapse/mgmt/v1.0/synapse/bigdatapools.go b/services/preview/synapse/mgmt/v1.0/synapse/bigdatapools.go deleted file mode 100644 index 2456b3ac3051..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/bigdatapools.go +++ /dev/null @@ -1,525 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// BigDataPoolsClient is the azure Synapse Analytics Management Client -type BigDataPoolsClient struct { - BaseClient -} - -// NewBigDataPoolsClient creates an instance of the BigDataPoolsClient client. -func NewBigDataPoolsClient(subscriptionID string) BigDataPoolsClient { - return NewBigDataPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBigDataPoolsClientWithBaseURI creates an instance of the BigDataPoolsClient 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 NewBigDataPoolsClientWithBaseURI(baseURI string, subscriptionID string) BigDataPoolsClient { - return BigDataPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new Big Data pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// bigDataPoolName - big Data pool name -// bigDataPoolInfo - the Big Data pool to create. -// force - whether to stop any running jobs in the Big Data pool -func (client BigDataPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolInfo BigDataPoolResourceInfo, force *bool) (result BigDataPoolsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.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: 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("synapse.BigDataPoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, bigDataPoolName, bigDataPoolInfo, force) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BigDataPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolInfo BigDataPoolResourceInfo, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bigDataPoolName": autorest.Encode("path", bigDataPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } else { - queryParameters["force"] = autorest.Encode("query", false) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}", pathParameters), - autorest.WithJSON(bigDataPoolInfo), - 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 BigDataPoolsClient) CreateOrUpdateSender(req *http.Request) (future BigDataPoolsCreateOrUpdateFuture, 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 BigDataPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result BigDataPoolResourceInfo, 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 delete a Big Data pool from the workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// bigDataPoolName - big Data pool name -func (client BigDataPoolsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (result BigDataPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.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: 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("synapse.BigDataPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, bigDataPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BigDataPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bigDataPoolName": autorest.Encode("path", bigDataPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}", 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 BigDataPoolsClient) DeleteSender(req *http.Request) (future BigDataPoolsDeleteFuture, 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 BigDataPoolsClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a Big Data pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// bigDataPoolName - big Data pool name -func (client BigDataPoolsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (result BigDataPoolResourceInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.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("synapse.BigDataPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, bigDataPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BigDataPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bigDataPoolName": autorest.Encode("path", bigDataPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}", 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 BigDataPoolsClient) 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 BigDataPoolsClient) GetResponder(resp *http.Response) (result BigDataPoolResourceInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list Big Data pools in a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client BigDataPoolsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result BigDataPoolResourceInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.ListByWorkspace") - defer func() { - sc := -1 - if result.bdprilr.Response.Response != nil { - sc = result.bdprilr.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("synapse.BigDataPoolsClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.bdprilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.bdprilr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.bdprilr.hasNextLink() && result.bdprilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client BigDataPoolsClient) ListByWorkspacePreparer(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 = "2021-06-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.Synapse/workspaces/{workspaceName}/bigDataPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client BigDataPoolsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client BigDataPoolsClient) ListByWorkspaceResponder(resp *http.Response) (result BigDataPoolResourceInfoListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client BigDataPoolsClient) listByWorkspaceNextResults(ctx context.Context, lastResults BigDataPoolResourceInfoListResult) (result BigDataPoolResourceInfoListResult, err error) { - req, err := lastResults.bigDataPoolResourceInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client BigDataPoolsClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result BigDataPoolResourceInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// Update patch a Big Data pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// bigDataPoolName - big Data pool name -// bigDataPoolPatchInfo - the updated Big Data pool properties -func (client BigDataPoolsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolPatchInfo BigDataPoolPatchInfo) (result BigDataPoolResourceInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolsClient.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("synapse.BigDataPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, bigDataPoolName, bigDataPoolPatchInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BigDataPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolPatchInfo BigDataPoolPatchInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bigDataPoolName": autorest.Encode("path", bigDataPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}", pathParameters), - autorest.WithJSON(bigDataPoolPatchInfo), - 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 BigDataPoolsClient) 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 BigDataPoolsClient) UpdateResponder(resp *http.Response) (result BigDataPoolResourceInfo, 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/synapse/mgmt/v1.0/synapse/client.go b/services/preview/synapse/mgmt/v1.0/synapse/client.go deleted file mode 100644 index 622ea88b81c1..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package synapse implements the Azure ARM Synapse service API version . -// -// Azure Synapse Analytics Management Client -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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 Synapse - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Synapse. -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/synapse/mgmt/v1.0/synapse/datamaskingpolicies.go b/services/preview/synapse/mgmt/v1.0/synapse/datamaskingpolicies.go deleted file mode 100644 index 3b2a1b340c90..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/datamaskingpolicies.go +++ /dev/null @@ -1,215 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DataMaskingPoliciesClient is the azure Synapse Analytics Management Client -type DataMaskingPoliciesClient struct { - BaseClient -} - -// NewDataMaskingPoliciesClient creates an instance of the DataMaskingPoliciesClient client. -func NewDataMaskingPoliciesClient(subscriptionID string) DataMaskingPoliciesClient { - return NewDataMaskingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataMaskingPoliciesClientWithBaseURI creates an instance of the DataMaskingPoliciesClient 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 NewDataMaskingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingPoliciesClient { - return DataMaskingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Sql pool data masking policy -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - parameters for creating or updating a data masking policy. -func (client DataMaskingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters DataMaskingPolicy) (result DataMaskingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.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}}}}); err != nil { - return result, validation.NewError("synapse.DataMaskingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataMaskingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters DataMaskingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.Kind = nil - parameters.ManagedBy = 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}", 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 DataMaskingPoliciesClient) 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 DataMaskingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a Sql pool data masking policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client DataMaskingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result DataMaskingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingPoliciesClient.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("synapse.DataMaskingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataMaskingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}", 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 DataMaskingPoliciesClient) 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 DataMaskingPoliciesClient) GetResponder(resp *http.Response) (result DataMaskingPolicy, 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/synapse/mgmt/v1.0/synapse/datamaskingrules.go b/services/preview/synapse/mgmt/v1.0/synapse/datamaskingrules.go deleted file mode 100644 index 807549ee9d71..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/datamaskingrules.go +++ /dev/null @@ -1,312 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// DataMaskingRulesClient is the azure Synapse Analytics Management Client -type DataMaskingRulesClient struct { - BaseClient -} - -// NewDataMaskingRulesClient creates an instance of the DataMaskingRulesClient client. -func NewDataMaskingRulesClient(subscriptionID string) DataMaskingRulesClient { - return NewDataMaskingRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataMaskingRulesClientWithBaseURI creates an instance of the DataMaskingRulesClient 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 NewDataMaskingRulesClientWithBaseURI(baseURI string, subscriptionID string) DataMaskingRulesClient { - return DataMaskingRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Sql pool data masking rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// dataMaskingRuleName - the name of the data masking rule. -// parameters - the required parameters for creating or updating a data masking rule. -func (client DataMaskingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, dataMaskingRuleName string, parameters DataMaskingRule) (result DataMaskingRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataMaskingRuleProperties.SchemaName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataMaskingRuleProperties.TableName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataMaskingRuleProperties.ColumnName", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("synapse.DataMaskingRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, dataMaskingRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataMaskingRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, dataMaskingRuleName string, parameters DataMaskingRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "dataMaskingRuleName": autorest.Encode("path", dataMaskingRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - parameters.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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}", 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 DataMaskingRulesClient) 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 DataMaskingRulesClient) CreateOrUpdateResponder(resp *http.Response) (result DataMaskingRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the specific Sql pool data masking rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// dataMaskingRuleName - the name of the data masking rule. -func (client DataMaskingRulesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, dataMaskingRuleName string) (result DataMaskingRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.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("synapse.DataMaskingRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, dataMaskingRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataMaskingRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, dataMaskingRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "dataMaskingRuleName": autorest.Encode("path", dataMaskingRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}", 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 DataMaskingRulesClient) 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 DataMaskingRulesClient) GetResponder(resp *http.Response) (result DataMaskingRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySQLPool gets a list of Sql pool data masking rules. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client DataMaskingRulesClient) ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result DataMaskingRuleListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataMaskingRulesClient.ListBySQLPool") - 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("synapse.DataMaskingRulesClient", "ListBySQLPool", err.Error()) - } - - req, err := client.ListBySQLPoolPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "ListBySQLPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "ListBySQLPool", resp, "Failure sending request") - return - } - - result, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.DataMaskingRulesClient", "ListBySQLPool", resp, "Failure responding to request") - return - } - - return -} - -// ListBySQLPoolPreparer prepares the ListBySQLPool request. -func (client DataMaskingRulesClient) ListBySQLPoolPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataMaskingPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySQLPoolSender sends the ListBySQLPool request. The method will close the -// http.Response Body if it receives an error. -func (client DataMaskingRulesClient) ListBySQLPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySQLPoolResponder handles the response to the ListBySQLPool request. The method always -// closes the http.Response Body. -func (client DataMaskingRulesClient) ListBySQLPoolResponder(resp *http.Response) (result DataMaskingRuleListResult, 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/synapse/mgmt/v1.0/synapse/enums.go b/services/preview/synapse/mgmt/v1.0/synapse/enums.go deleted file mode 100644 index e6f2a3e3eaae..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/enums.go +++ /dev/null @@ -1,1077 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActualState enumerates the values for actual state. -type ActualState string - -const ( - // ActualStateDisabled ... - ActualStateDisabled ActualState = "Disabled" - // ActualStateDisabling ... - ActualStateDisabling ActualState = "Disabling" - // ActualStateEnabled ... - ActualStateEnabled ActualState = "Enabled" - // ActualStateEnabling ... - ActualStateEnabling ActualState = "Enabling" - // ActualStateUnknown ... - ActualStateUnknown ActualState = "Unknown" -) - -// PossibleActualStateValues returns an array of possible values for the ActualState const type. -func PossibleActualStateValues() []ActualState { - return []ActualState{ActualStateDisabled, ActualStateDisabling, ActualStateEnabled, ActualStateEnabling, ActualStateUnknown} -} - -// AuthorizationType enumerates the values for authorization type. -type AuthorizationType string - -const ( - // AuthorizationTypeKey ... - AuthorizationTypeKey AuthorizationType = "Key" - // AuthorizationTypeLinkedIntegrationRuntimeType ... - AuthorizationTypeLinkedIntegrationRuntimeType AuthorizationType = "LinkedIntegrationRuntimeType" - // AuthorizationTypeRBAC ... - AuthorizationTypeRBAC AuthorizationType = "RBAC" -) - -// PossibleAuthorizationTypeValues returns an array of possible values for the AuthorizationType const type. -func PossibleAuthorizationTypeValues() []AuthorizationType { - return []AuthorizationType{AuthorizationTypeKey, AuthorizationTypeLinkedIntegrationRuntimeType, AuthorizationTypeRBAC} -} - -// BlobAuditingPolicyState enumerates the values for blob auditing policy state. -type BlobAuditingPolicyState string - -const ( - // BlobAuditingPolicyStateDisabled ... - BlobAuditingPolicyStateDisabled BlobAuditingPolicyState = "Disabled" - // BlobAuditingPolicyStateEnabled ... - BlobAuditingPolicyStateEnabled BlobAuditingPolicyState = "Enabled" -) - -// PossibleBlobAuditingPolicyStateValues returns an array of possible values for the BlobAuditingPolicyState const type. -func PossibleBlobAuditingPolicyStateValues() []BlobAuditingPolicyState { - return []BlobAuditingPolicyState{BlobAuditingPolicyStateDisabled, BlobAuditingPolicyStateEnabled} -} - -// ColumnDataType enumerates the values for column data type. -type ColumnDataType string - -const ( - // ColumnDataTypeBigint ... - ColumnDataTypeBigint ColumnDataType = "bigint" - // ColumnDataTypeBinary ... - ColumnDataTypeBinary ColumnDataType = "binary" - // ColumnDataTypeBit ... - ColumnDataTypeBit ColumnDataType = "bit" - // ColumnDataTypeChar ... - ColumnDataTypeChar ColumnDataType = "char" - // ColumnDataTypeDate ... - ColumnDataTypeDate ColumnDataType = "date" - // ColumnDataTypeDatetime ... - ColumnDataTypeDatetime ColumnDataType = "datetime" - // ColumnDataTypeDatetime2 ... - ColumnDataTypeDatetime2 ColumnDataType = "datetime2" - // ColumnDataTypeDatetimeoffset ... - ColumnDataTypeDatetimeoffset ColumnDataType = "datetimeoffset" - // ColumnDataTypeDecimal ... - ColumnDataTypeDecimal ColumnDataType = "decimal" - // ColumnDataTypeFloat ... - ColumnDataTypeFloat ColumnDataType = "float" - // ColumnDataTypeGeography ... - ColumnDataTypeGeography ColumnDataType = "geography" - // ColumnDataTypeGeometry ... - ColumnDataTypeGeometry ColumnDataType = "geometry" - // ColumnDataTypeHierarchyid ... - ColumnDataTypeHierarchyid ColumnDataType = "hierarchyid" - // ColumnDataTypeImage ... - ColumnDataTypeImage ColumnDataType = "image" - // ColumnDataTypeInt ... - ColumnDataTypeInt ColumnDataType = "int" - // ColumnDataTypeMoney ... - ColumnDataTypeMoney ColumnDataType = "money" - // ColumnDataTypeNchar ... - ColumnDataTypeNchar ColumnDataType = "nchar" - // ColumnDataTypeNtext ... - ColumnDataTypeNtext ColumnDataType = "ntext" - // ColumnDataTypeNumeric ... - ColumnDataTypeNumeric ColumnDataType = "numeric" - // ColumnDataTypeNvarchar ... - ColumnDataTypeNvarchar ColumnDataType = "nvarchar" - // ColumnDataTypeReal ... - ColumnDataTypeReal ColumnDataType = "real" - // ColumnDataTypeSmalldatetime ... - ColumnDataTypeSmalldatetime ColumnDataType = "smalldatetime" - // ColumnDataTypeSmallint ... - ColumnDataTypeSmallint ColumnDataType = "smallint" - // ColumnDataTypeSmallmoney ... - ColumnDataTypeSmallmoney ColumnDataType = "smallmoney" - // ColumnDataTypeSQLVariant ... - ColumnDataTypeSQLVariant ColumnDataType = "sql_variant" - // ColumnDataTypeSysname ... - ColumnDataTypeSysname ColumnDataType = "sysname" - // ColumnDataTypeText ... - ColumnDataTypeText ColumnDataType = "text" - // ColumnDataTypeTime ... - ColumnDataTypeTime ColumnDataType = "time" - // ColumnDataTypeTimestamp ... - ColumnDataTypeTimestamp ColumnDataType = "timestamp" - // ColumnDataTypeTinyint ... - ColumnDataTypeTinyint ColumnDataType = "tinyint" - // ColumnDataTypeUniqueidentifier ... - ColumnDataTypeUniqueidentifier ColumnDataType = "uniqueidentifier" - // ColumnDataTypeVarbinary ... - ColumnDataTypeVarbinary ColumnDataType = "varbinary" - // ColumnDataTypeVarchar ... - ColumnDataTypeVarchar ColumnDataType = "varchar" - // ColumnDataTypeXML ... - ColumnDataTypeXML ColumnDataType = "xml" -) - -// PossibleColumnDataTypeValues returns an array of possible values for the ColumnDataType const type. -func PossibleColumnDataTypeValues() []ColumnDataType { - return []ColumnDataType{ColumnDataTypeBigint, ColumnDataTypeBinary, ColumnDataTypeBit, ColumnDataTypeChar, ColumnDataTypeDate, ColumnDataTypeDatetime, ColumnDataTypeDatetime2, ColumnDataTypeDatetimeoffset, ColumnDataTypeDecimal, ColumnDataTypeFloat, ColumnDataTypeGeography, ColumnDataTypeGeometry, ColumnDataTypeHierarchyid, ColumnDataTypeImage, ColumnDataTypeInt, ColumnDataTypeMoney, ColumnDataTypeNchar, ColumnDataTypeNtext, ColumnDataTypeNumeric, ColumnDataTypeNvarchar, ColumnDataTypeReal, ColumnDataTypeSmalldatetime, ColumnDataTypeSmallint, ColumnDataTypeSmallmoney, ColumnDataTypeSQLVariant, ColumnDataTypeSysname, ColumnDataTypeText, ColumnDataTypeTime, ColumnDataTypeTimestamp, ColumnDataTypeTinyint, ColumnDataTypeUniqueidentifier, ColumnDataTypeVarbinary, ColumnDataTypeVarchar, ColumnDataTypeXML} -} - -// ConfigurationType enumerates the values for configuration type. -type ConfigurationType string - -const ( - // ConfigurationTypeArtifact ... - ConfigurationTypeArtifact ConfigurationType = "Artifact" - // ConfigurationTypeFile ... - ConfigurationTypeFile ConfigurationType = "File" -) - -// PossibleConfigurationTypeValues returns an array of possible values for the ConfigurationType const type. -func PossibleConfigurationTypeValues() []ConfigurationType { - return []ConfigurationType{ConfigurationTypeArtifact, ConfigurationTypeFile} -} - -// DataFlowComputeType enumerates the values for data flow compute type. -type DataFlowComputeType string - -const ( - // DataFlowComputeTypeComputeOptimized ... - DataFlowComputeTypeComputeOptimized DataFlowComputeType = "ComputeOptimized" - // DataFlowComputeTypeGeneral ... - DataFlowComputeTypeGeneral DataFlowComputeType = "General" - // DataFlowComputeTypeMemoryOptimized ... - DataFlowComputeTypeMemoryOptimized DataFlowComputeType = "MemoryOptimized" -) - -// PossibleDataFlowComputeTypeValues returns an array of possible values for the DataFlowComputeType const type. -func PossibleDataFlowComputeTypeValues() []DataFlowComputeType { - return []DataFlowComputeType{DataFlowComputeTypeComputeOptimized, DataFlowComputeTypeGeneral, DataFlowComputeTypeMemoryOptimized} -} - -// DataMaskingFunction enumerates the values for data masking function. -type DataMaskingFunction string - -const ( - // DataMaskingFunctionCCN ... - DataMaskingFunctionCCN DataMaskingFunction = "CCN" - // DataMaskingFunctionDefault ... - DataMaskingFunctionDefault DataMaskingFunction = "Default" - // DataMaskingFunctionEmail ... - DataMaskingFunctionEmail DataMaskingFunction = "Email" - // DataMaskingFunctionNumber ... - DataMaskingFunctionNumber DataMaskingFunction = "Number" - // DataMaskingFunctionSSN ... - DataMaskingFunctionSSN DataMaskingFunction = "SSN" - // DataMaskingFunctionText ... - DataMaskingFunctionText DataMaskingFunction = "Text" -) - -// PossibleDataMaskingFunctionValues returns an array of possible values for the DataMaskingFunction const type. -func PossibleDataMaskingFunctionValues() []DataMaskingFunction { - return []DataMaskingFunction{DataMaskingFunctionCCN, DataMaskingFunctionDefault, DataMaskingFunctionEmail, DataMaskingFunctionNumber, DataMaskingFunctionSSN, DataMaskingFunctionText} -} - -// DataMaskingRuleState enumerates the values for data masking rule state. -type DataMaskingRuleState string - -const ( - // DataMaskingRuleStateDisabled ... - DataMaskingRuleStateDisabled DataMaskingRuleState = "Disabled" - // DataMaskingRuleStateEnabled ... - DataMaskingRuleStateEnabled DataMaskingRuleState = "Enabled" -) - -// PossibleDataMaskingRuleStateValues returns an array of possible values for the DataMaskingRuleState const type. -func PossibleDataMaskingRuleStateValues() []DataMaskingRuleState { - return []DataMaskingRuleState{DataMaskingRuleStateDisabled, DataMaskingRuleStateEnabled} -} - -// DataMaskingState enumerates the values for data masking state. -type DataMaskingState string - -const ( - // DataMaskingStateDisabled ... - DataMaskingStateDisabled DataMaskingState = "Disabled" - // DataMaskingStateEnabled ... - DataMaskingStateEnabled DataMaskingState = "Enabled" -) - -// PossibleDataMaskingStateValues returns an array of possible values for the DataMaskingState const type. -func PossibleDataMaskingStateValues() []DataMaskingState { - return []DataMaskingState{DataMaskingStateDisabled, DataMaskingStateEnabled} -} - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // DayOfWeekFriday ... - DayOfWeekFriday DayOfWeek = "Friday" - // DayOfWeekMonday ... - DayOfWeekMonday DayOfWeek = "Monday" - // DayOfWeekSaturday ... - DayOfWeekSaturday DayOfWeek = "Saturday" - // DayOfWeekSunday ... - DayOfWeekSunday DayOfWeek = "Sunday" - // DayOfWeekThursday ... - DayOfWeekThursday DayOfWeek = "Thursday" - // DayOfWeekTuesday ... - DayOfWeekTuesday DayOfWeek = "Tuesday" - // DayOfWeekWednesday ... - DayOfWeekWednesday DayOfWeek = "Wednesday" -) - -// PossibleDayOfWeekValues returns an array of possible values for the DayOfWeek const type. -func PossibleDayOfWeekValues() []DayOfWeek { - return []DayOfWeek{DayOfWeekFriday, DayOfWeekMonday, DayOfWeekSaturday, DayOfWeekSunday, DayOfWeekThursday, DayOfWeekTuesday, DayOfWeekWednesday} -} - -// DesiredState enumerates the values for desired state. -type DesiredState string - -const ( - // DesiredStateDisabled ... - DesiredStateDisabled DesiredState = "Disabled" - // DesiredStateEnabled ... - DesiredStateEnabled DesiredState = "Enabled" -) - -// PossibleDesiredStateValues returns an array of possible values for the DesiredState const type. -func PossibleDesiredStateValues() []DesiredState { - return []DesiredState{DesiredStateDisabled, DesiredStateEnabled} -} - -// GeoBackupPolicyState enumerates the values for geo backup policy state. -type GeoBackupPolicyState string - -const ( - // GeoBackupPolicyStateDisabled ... - GeoBackupPolicyStateDisabled GeoBackupPolicyState = "Disabled" - // GeoBackupPolicyStateEnabled ... - GeoBackupPolicyStateEnabled GeoBackupPolicyState = "Enabled" -) - -// PossibleGeoBackupPolicyStateValues returns an array of possible values for the GeoBackupPolicyState const type. -func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { - return []GeoBackupPolicyState{GeoBackupPolicyStateDisabled, GeoBackupPolicyStateEnabled} -} - -// IntegrationRuntimeAuthKeyName enumerates the values for integration runtime auth key name. -type IntegrationRuntimeAuthKeyName string - -const ( - // IntegrationRuntimeAuthKeyNameAuthKey1 ... - IntegrationRuntimeAuthKeyNameAuthKey1 IntegrationRuntimeAuthKeyName = "authKey1" - // IntegrationRuntimeAuthKeyNameAuthKey2 ... - IntegrationRuntimeAuthKeyNameAuthKey2 IntegrationRuntimeAuthKeyName = "authKey2" -) - -// PossibleIntegrationRuntimeAuthKeyNameValues returns an array of possible values for the IntegrationRuntimeAuthKeyName const type. -func PossibleIntegrationRuntimeAuthKeyNameValues() []IntegrationRuntimeAuthKeyName { - return []IntegrationRuntimeAuthKeyName{IntegrationRuntimeAuthKeyNameAuthKey1, IntegrationRuntimeAuthKeyNameAuthKey2} -} - -// IntegrationRuntimeAutoUpdate enumerates the values for integration runtime auto update. -type IntegrationRuntimeAutoUpdate string - -const ( - // IntegrationRuntimeAutoUpdateOff ... - IntegrationRuntimeAutoUpdateOff IntegrationRuntimeAutoUpdate = "Off" - // IntegrationRuntimeAutoUpdateOn ... - IntegrationRuntimeAutoUpdateOn IntegrationRuntimeAutoUpdate = "On" -) - -// PossibleIntegrationRuntimeAutoUpdateValues returns an array of possible values for the IntegrationRuntimeAutoUpdate const type. -func PossibleIntegrationRuntimeAutoUpdateValues() []IntegrationRuntimeAutoUpdate { - return []IntegrationRuntimeAutoUpdate{IntegrationRuntimeAutoUpdateOff, IntegrationRuntimeAutoUpdateOn} -} - -// IntegrationRuntimeEdition enumerates the values for integration runtime edition. -type IntegrationRuntimeEdition string - -const ( - // IntegrationRuntimeEditionEnterprise ... - IntegrationRuntimeEditionEnterprise IntegrationRuntimeEdition = "Enterprise" - // IntegrationRuntimeEditionStandard ... - IntegrationRuntimeEditionStandard IntegrationRuntimeEdition = "Standard" -) - -// PossibleIntegrationRuntimeEditionValues returns an array of possible values for the IntegrationRuntimeEdition const type. -func PossibleIntegrationRuntimeEditionValues() []IntegrationRuntimeEdition { - return []IntegrationRuntimeEdition{IntegrationRuntimeEditionEnterprise, IntegrationRuntimeEditionStandard} -} - -// IntegrationRuntimeEntityReferenceType enumerates the values for integration runtime entity reference type. -type IntegrationRuntimeEntityReferenceType string - -const ( - // IntegrationRuntimeEntityReferenceTypeIntegrationRuntimeReference ... - IntegrationRuntimeEntityReferenceTypeIntegrationRuntimeReference IntegrationRuntimeEntityReferenceType = "IntegrationRuntimeReference" - // IntegrationRuntimeEntityReferenceTypeLinkedServiceReference ... - IntegrationRuntimeEntityReferenceTypeLinkedServiceReference IntegrationRuntimeEntityReferenceType = "LinkedServiceReference" -) - -// PossibleIntegrationRuntimeEntityReferenceTypeValues returns an array of possible values for the IntegrationRuntimeEntityReferenceType const type. -func PossibleIntegrationRuntimeEntityReferenceTypeValues() []IntegrationRuntimeEntityReferenceType { - return []IntegrationRuntimeEntityReferenceType{IntegrationRuntimeEntityReferenceTypeIntegrationRuntimeReference, IntegrationRuntimeEntityReferenceTypeLinkedServiceReference} -} - -// IntegrationRuntimeInternalChannelEncryptionMode enumerates the values for integration runtime internal -// channel encryption mode. -type IntegrationRuntimeInternalChannelEncryptionMode string - -const ( - // IntegrationRuntimeInternalChannelEncryptionModeNotEncrypted ... - IntegrationRuntimeInternalChannelEncryptionModeNotEncrypted IntegrationRuntimeInternalChannelEncryptionMode = "NotEncrypted" - // IntegrationRuntimeInternalChannelEncryptionModeNotSet ... - IntegrationRuntimeInternalChannelEncryptionModeNotSet IntegrationRuntimeInternalChannelEncryptionMode = "NotSet" - // IntegrationRuntimeInternalChannelEncryptionModeSslEncrypted ... - IntegrationRuntimeInternalChannelEncryptionModeSslEncrypted IntegrationRuntimeInternalChannelEncryptionMode = "SslEncrypted" -) - -// PossibleIntegrationRuntimeInternalChannelEncryptionModeValues returns an array of possible values for the IntegrationRuntimeInternalChannelEncryptionMode const type. -func PossibleIntegrationRuntimeInternalChannelEncryptionModeValues() []IntegrationRuntimeInternalChannelEncryptionMode { - return []IntegrationRuntimeInternalChannelEncryptionMode{IntegrationRuntimeInternalChannelEncryptionModeNotEncrypted, IntegrationRuntimeInternalChannelEncryptionModeNotSet, IntegrationRuntimeInternalChannelEncryptionModeSslEncrypted} -} - -// IntegrationRuntimeLicenseType enumerates the values for integration runtime license type. -type IntegrationRuntimeLicenseType string - -const ( - // IntegrationRuntimeLicenseTypeBasePrice ... - IntegrationRuntimeLicenseTypeBasePrice IntegrationRuntimeLicenseType = "BasePrice" - // IntegrationRuntimeLicenseTypeLicenseIncluded ... - IntegrationRuntimeLicenseTypeLicenseIncluded IntegrationRuntimeLicenseType = "LicenseIncluded" -) - -// PossibleIntegrationRuntimeLicenseTypeValues returns an array of possible values for the IntegrationRuntimeLicenseType const type. -func PossibleIntegrationRuntimeLicenseTypeValues() []IntegrationRuntimeLicenseType { - return []IntegrationRuntimeLicenseType{IntegrationRuntimeLicenseTypeBasePrice, IntegrationRuntimeLicenseTypeLicenseIncluded} -} - -// IntegrationRuntimeSsisCatalogPricingTier enumerates the values for integration runtime ssis catalog pricing -// tier. -type IntegrationRuntimeSsisCatalogPricingTier string - -const ( - // IntegrationRuntimeSsisCatalogPricingTierBasic ... - IntegrationRuntimeSsisCatalogPricingTierBasic IntegrationRuntimeSsisCatalogPricingTier = "Basic" - // IntegrationRuntimeSsisCatalogPricingTierPremium ... - IntegrationRuntimeSsisCatalogPricingTierPremium IntegrationRuntimeSsisCatalogPricingTier = "Premium" - // IntegrationRuntimeSsisCatalogPricingTierPremiumRS ... - IntegrationRuntimeSsisCatalogPricingTierPremiumRS IntegrationRuntimeSsisCatalogPricingTier = "PremiumRS" - // IntegrationRuntimeSsisCatalogPricingTierStandard ... - IntegrationRuntimeSsisCatalogPricingTierStandard IntegrationRuntimeSsisCatalogPricingTier = "Standard" -) - -// PossibleIntegrationRuntimeSsisCatalogPricingTierValues returns an array of possible values for the IntegrationRuntimeSsisCatalogPricingTier const type. -func PossibleIntegrationRuntimeSsisCatalogPricingTierValues() []IntegrationRuntimeSsisCatalogPricingTier { - return []IntegrationRuntimeSsisCatalogPricingTier{IntegrationRuntimeSsisCatalogPricingTierBasic, IntegrationRuntimeSsisCatalogPricingTierPremium, IntegrationRuntimeSsisCatalogPricingTierPremiumRS, IntegrationRuntimeSsisCatalogPricingTierStandard} -} - -// IntegrationRuntimeState enumerates the values for integration runtime state. -type IntegrationRuntimeState string - -const ( - // IntegrationRuntimeStateAccessDenied ... - IntegrationRuntimeStateAccessDenied IntegrationRuntimeState = "AccessDenied" - // IntegrationRuntimeStateInitial ... - IntegrationRuntimeStateInitial IntegrationRuntimeState = "Initial" - // IntegrationRuntimeStateLimited ... - IntegrationRuntimeStateLimited IntegrationRuntimeState = "Limited" - // IntegrationRuntimeStateNeedRegistration ... - IntegrationRuntimeStateNeedRegistration IntegrationRuntimeState = "NeedRegistration" - // IntegrationRuntimeStateOffline ... - IntegrationRuntimeStateOffline IntegrationRuntimeState = "Offline" - // IntegrationRuntimeStateOnline ... - IntegrationRuntimeStateOnline IntegrationRuntimeState = "Online" - // IntegrationRuntimeStateStarted ... - IntegrationRuntimeStateStarted IntegrationRuntimeState = "Started" - // IntegrationRuntimeStateStarting ... - IntegrationRuntimeStateStarting IntegrationRuntimeState = "Starting" - // IntegrationRuntimeStateStopped ... - IntegrationRuntimeStateStopped IntegrationRuntimeState = "Stopped" - // IntegrationRuntimeStateStopping ... - IntegrationRuntimeStateStopping IntegrationRuntimeState = "Stopping" -) - -// PossibleIntegrationRuntimeStateValues returns an array of possible values for the IntegrationRuntimeState const type. -func PossibleIntegrationRuntimeStateValues() []IntegrationRuntimeState { - return []IntegrationRuntimeState{IntegrationRuntimeStateAccessDenied, IntegrationRuntimeStateInitial, IntegrationRuntimeStateLimited, IntegrationRuntimeStateNeedRegistration, IntegrationRuntimeStateOffline, IntegrationRuntimeStateOnline, IntegrationRuntimeStateStarted, IntegrationRuntimeStateStarting, IntegrationRuntimeStateStopped, IntegrationRuntimeStateStopping} -} - -// IntegrationRuntimeType enumerates the values for integration runtime type. -type IntegrationRuntimeType string - -const ( - // IntegrationRuntimeTypeManaged ... - IntegrationRuntimeTypeManaged IntegrationRuntimeType = "Managed" - // IntegrationRuntimeTypeSelfHosted ... - IntegrationRuntimeTypeSelfHosted IntegrationRuntimeType = "SelfHosted" -) - -// PossibleIntegrationRuntimeTypeValues returns an array of possible values for the IntegrationRuntimeType const type. -func PossibleIntegrationRuntimeTypeValues() []IntegrationRuntimeType { - return []IntegrationRuntimeType{IntegrationRuntimeTypeManaged, IntegrationRuntimeTypeSelfHosted} -} - -// IntegrationRuntimeUpdateResult enumerates the values for integration runtime update result. -type IntegrationRuntimeUpdateResult string - -const ( - // IntegrationRuntimeUpdateResultFail ... - IntegrationRuntimeUpdateResultFail IntegrationRuntimeUpdateResult = "Fail" - // IntegrationRuntimeUpdateResultNone ... - IntegrationRuntimeUpdateResultNone IntegrationRuntimeUpdateResult = "None" - // IntegrationRuntimeUpdateResultSucceed ... - IntegrationRuntimeUpdateResultSucceed IntegrationRuntimeUpdateResult = "Succeed" -) - -// PossibleIntegrationRuntimeUpdateResultValues returns an array of possible values for the IntegrationRuntimeUpdateResult const type. -func PossibleIntegrationRuntimeUpdateResultValues() []IntegrationRuntimeUpdateResult { - return []IntegrationRuntimeUpdateResult{IntegrationRuntimeUpdateResultFail, IntegrationRuntimeUpdateResultNone, IntegrationRuntimeUpdateResultSucceed} -} - -// ManagedIntegrationRuntimeNodeStatus enumerates the values for managed integration runtime node status. -type ManagedIntegrationRuntimeNodeStatus string - -const ( - // ManagedIntegrationRuntimeNodeStatusAvailable ... - ManagedIntegrationRuntimeNodeStatusAvailable ManagedIntegrationRuntimeNodeStatus = "Available" - // ManagedIntegrationRuntimeNodeStatusRecycling ... - ManagedIntegrationRuntimeNodeStatusRecycling ManagedIntegrationRuntimeNodeStatus = "Recycling" - // ManagedIntegrationRuntimeNodeStatusStarting ... - ManagedIntegrationRuntimeNodeStatusStarting ManagedIntegrationRuntimeNodeStatus = "Starting" - // ManagedIntegrationRuntimeNodeStatusUnavailable ... - ManagedIntegrationRuntimeNodeStatusUnavailable ManagedIntegrationRuntimeNodeStatus = "Unavailable" -) - -// PossibleManagedIntegrationRuntimeNodeStatusValues returns an array of possible values for the ManagedIntegrationRuntimeNodeStatus const type. -func PossibleManagedIntegrationRuntimeNodeStatusValues() []ManagedIntegrationRuntimeNodeStatus { - return []ManagedIntegrationRuntimeNodeStatus{ManagedIntegrationRuntimeNodeStatusAvailable, ManagedIntegrationRuntimeNodeStatusRecycling, ManagedIntegrationRuntimeNodeStatusStarting, ManagedIntegrationRuntimeNodeStatusUnavailable} -} - -// ManagementOperationState enumerates the values for management operation state. -type ManagementOperationState string - -const ( - // ManagementOperationStateCancelInProgress ... - ManagementOperationStateCancelInProgress ManagementOperationState = "CancelInProgress" - // ManagementOperationStateCancelled ... - ManagementOperationStateCancelled ManagementOperationState = "Cancelled" - // ManagementOperationStateFailed ... - ManagementOperationStateFailed ManagementOperationState = "Failed" - // ManagementOperationStateInProgress ... - ManagementOperationStateInProgress ManagementOperationState = "InProgress" - // ManagementOperationStatePending ... - ManagementOperationStatePending ManagementOperationState = "Pending" - // ManagementOperationStateSucceeded ... - ManagementOperationStateSucceeded ManagementOperationState = "Succeeded" -) - -// PossibleManagementOperationStateValues returns an array of possible values for the ManagementOperationState const type. -func PossibleManagementOperationStateValues() []ManagementOperationState { - return []ManagementOperationState{ManagementOperationStateCancelInProgress, ManagementOperationStateCancelled, ManagementOperationStateFailed, ManagementOperationStateInProgress, ManagementOperationStatePending, ManagementOperationStateSucceeded} -} - -// NodeSize enumerates the values for node size. -type NodeSize string - -const ( - // NodeSizeLarge ... - NodeSizeLarge NodeSize = "Large" - // NodeSizeMedium ... - NodeSizeMedium NodeSize = "Medium" - // NodeSizeNone ... - NodeSizeNone NodeSize = "None" - // NodeSizeSmall ... - NodeSizeSmall NodeSize = "Small" - // NodeSizeXLarge ... - NodeSizeXLarge NodeSize = "XLarge" - // NodeSizeXXLarge ... - NodeSizeXXLarge NodeSize = "XXLarge" - // NodeSizeXXXLarge ... - NodeSizeXXXLarge NodeSize = "XXXLarge" -) - -// PossibleNodeSizeValues returns an array of possible values for the NodeSize const type. -func PossibleNodeSizeValues() []NodeSize { - return []NodeSize{NodeSizeLarge, NodeSizeMedium, NodeSizeNone, NodeSizeSmall, NodeSizeXLarge, NodeSizeXXLarge, NodeSizeXXXLarge} -} - -// NodeSizeFamily enumerates the values for node size family. -type NodeSizeFamily string - -const ( - // NodeSizeFamilyHardwareAcceleratedFPGA ... - NodeSizeFamilyHardwareAcceleratedFPGA NodeSizeFamily = "HardwareAcceleratedFPGA" - // NodeSizeFamilyHardwareAcceleratedGPU ... - NodeSizeFamilyHardwareAcceleratedGPU NodeSizeFamily = "HardwareAcceleratedGPU" - // NodeSizeFamilyMemoryOptimized ... - NodeSizeFamilyMemoryOptimized NodeSizeFamily = "MemoryOptimized" - // NodeSizeFamilyNone ... - NodeSizeFamilyNone NodeSizeFamily = "None" -) - -// PossibleNodeSizeFamilyValues returns an array of possible values for the NodeSizeFamily const type. -func PossibleNodeSizeFamilyValues() []NodeSizeFamily { - return []NodeSizeFamily{NodeSizeFamilyHardwareAcceleratedFPGA, NodeSizeFamilyHardwareAcceleratedGPU, NodeSizeFamilyMemoryOptimized, NodeSizeFamilyNone} -} - -// OperationStatus enumerates the values for operation status. -type OperationStatus string - -const ( - // OperationStatusCanceled ... - OperationStatusCanceled OperationStatus = "Canceled" - // OperationStatusFailed ... - OperationStatusFailed OperationStatus = "Failed" - // OperationStatusInProgress ... - OperationStatusInProgress OperationStatus = "InProgress" - // OperationStatusSucceeded ... - OperationStatusSucceeded OperationStatus = "Succeeded" -) - -// PossibleOperationStatusValues returns an array of possible values for the OperationStatus const type. -func PossibleOperationStatusValues() []OperationStatus { - return []OperationStatus{OperationStatusCanceled, OperationStatusFailed, OperationStatusInProgress, OperationStatusSucceeded} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateDeleteError ... - ProvisioningStateDeleteError ProvisioningState = "DeleteError" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateProvisioning ... - ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateDeleteError, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateProvisioning, ProvisioningStateSucceeded} -} - -// QueryAggregationFunction enumerates the values for query aggregation function. -type QueryAggregationFunction string - -const ( - // QueryAggregationFunctionAvg ... - QueryAggregationFunctionAvg QueryAggregationFunction = "avg" - // QueryAggregationFunctionMax ... - QueryAggregationFunctionMax QueryAggregationFunction = "max" - // QueryAggregationFunctionMin ... - QueryAggregationFunctionMin QueryAggregationFunction = "min" - // QueryAggregationFunctionSum ... - QueryAggregationFunctionSum QueryAggregationFunction = "sum" -) - -// PossibleQueryAggregationFunctionValues returns an array of possible values for the QueryAggregationFunction const type. -func PossibleQueryAggregationFunctionValues() []QueryAggregationFunction { - return []QueryAggregationFunction{QueryAggregationFunctionAvg, QueryAggregationFunctionMax, QueryAggregationFunctionMin, QueryAggregationFunctionSum} -} - -// QueryExecutionType enumerates the values for query execution type. -type QueryExecutionType string - -const ( - // QueryExecutionTypeAborted ... - QueryExecutionTypeAborted QueryExecutionType = "aborted" - // QueryExecutionTypeAny ... - QueryExecutionTypeAny QueryExecutionType = "any" - // QueryExecutionTypeException ... - QueryExecutionTypeException QueryExecutionType = "exception" - // QueryExecutionTypeIrregular ... - QueryExecutionTypeIrregular QueryExecutionType = "irregular" - // QueryExecutionTypeRegular ... - QueryExecutionTypeRegular QueryExecutionType = "regular" -) - -// PossibleQueryExecutionTypeValues returns an array of possible values for the QueryExecutionType const type. -func PossibleQueryExecutionTypeValues() []QueryExecutionType { - return []QueryExecutionType{QueryExecutionTypeAborted, QueryExecutionTypeAny, QueryExecutionTypeException, QueryExecutionTypeIrregular, QueryExecutionTypeRegular} -} - -// QueryMetricUnit enumerates the values for query metric unit. -type QueryMetricUnit string - -const ( - // QueryMetricUnitKB ... - QueryMetricUnitKB QueryMetricUnit = "KB" - // QueryMetricUnitMicroseconds ... - QueryMetricUnitMicroseconds QueryMetricUnit = "microseconds" - // QueryMetricUnitPercentage ... - QueryMetricUnitPercentage QueryMetricUnit = "percentage" -) - -// PossibleQueryMetricUnitValues returns an array of possible values for the QueryMetricUnit const type. -func PossibleQueryMetricUnitValues() []QueryMetricUnit { - return []QueryMetricUnit{QueryMetricUnitKB, QueryMetricUnitMicroseconds, QueryMetricUnitPercentage} -} - -// QueryObservedMetricType enumerates the values for query observed metric type. -type QueryObservedMetricType string - -const ( - // QueryObservedMetricTypeCPU ... - QueryObservedMetricTypeCPU QueryObservedMetricType = "cpu" - // QueryObservedMetricTypeDuration ... - QueryObservedMetricTypeDuration QueryObservedMetricType = "duration" - // QueryObservedMetricTypeExecutionCount ... - QueryObservedMetricTypeExecutionCount QueryObservedMetricType = "executionCount" - // QueryObservedMetricTypeIo ... - QueryObservedMetricTypeIo QueryObservedMetricType = "io" - // QueryObservedMetricTypeLogio ... - QueryObservedMetricTypeLogio QueryObservedMetricType = "logio" -) - -// PossibleQueryObservedMetricTypeValues returns an array of possible values for the QueryObservedMetricType const type. -func PossibleQueryObservedMetricTypeValues() []QueryObservedMetricType { - return []QueryObservedMetricType{QueryObservedMetricTypeCPU, QueryObservedMetricTypeDuration, QueryObservedMetricTypeExecutionCount, QueryObservedMetricTypeIo, QueryObservedMetricTypeLogio} -} - -// RecommendedSensitivityLabelUpdateKind enumerates the values for recommended sensitivity label update kind. -type RecommendedSensitivityLabelUpdateKind string - -const ( - // RecommendedSensitivityLabelUpdateKindDisable ... - RecommendedSensitivityLabelUpdateKindDisable RecommendedSensitivityLabelUpdateKind = "disable" - // RecommendedSensitivityLabelUpdateKindEnable ... - RecommendedSensitivityLabelUpdateKindEnable RecommendedSensitivityLabelUpdateKind = "enable" -) - -// PossibleRecommendedSensitivityLabelUpdateKindValues returns an array of possible values for the RecommendedSensitivityLabelUpdateKind const type. -func PossibleRecommendedSensitivityLabelUpdateKindValues() []RecommendedSensitivityLabelUpdateKind { - return []RecommendedSensitivityLabelUpdateKind{RecommendedSensitivityLabelUpdateKindDisable, RecommendedSensitivityLabelUpdateKindEnable} -} - -// ReplicationRole enumerates the values for replication role. -type ReplicationRole string - -const ( - // ReplicationRoleCopy ... - ReplicationRoleCopy ReplicationRole = "Copy" - // ReplicationRoleNonReadableSecondary ... - ReplicationRoleNonReadableSecondary ReplicationRole = "NonReadableSecondary" - // ReplicationRolePrimary ... - ReplicationRolePrimary ReplicationRole = "Primary" - // ReplicationRoleSecondary ... - ReplicationRoleSecondary ReplicationRole = "Secondary" - // ReplicationRoleSource ... - ReplicationRoleSource ReplicationRole = "Source" -) - -// PossibleReplicationRoleValues returns an array of possible values for the ReplicationRole const type. -func PossibleReplicationRoleValues() []ReplicationRole { - return []ReplicationRole{ReplicationRoleCopy, ReplicationRoleNonReadableSecondary, ReplicationRolePrimary, ReplicationRoleSecondary, ReplicationRoleSource} -} - -// ReplicationState enumerates the values for replication state. -type ReplicationState string - -const ( - // ReplicationStateCATCHUP ... - ReplicationStateCATCHUP ReplicationState = "CATCH_UP" - // ReplicationStatePENDING ... - ReplicationStatePENDING ReplicationState = "PENDING" - // ReplicationStateSEEDING ... - ReplicationStateSEEDING ReplicationState = "SEEDING" - // ReplicationStateSUSPENDED ... - ReplicationStateSUSPENDED ReplicationState = "SUSPENDED" -) - -// PossibleReplicationStateValues returns an array of possible values for the ReplicationState const type. -func PossibleReplicationStateValues() []ReplicationState { - return []ReplicationState{ReplicationStateCATCHUP, ReplicationStatePENDING, ReplicationStateSEEDING, ReplicationStateSUSPENDED} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned,UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned} -} - -// RestorePointType enumerates the values for restore point type. -type RestorePointType string - -const ( - // RestorePointTypeCONTINUOUS ... - RestorePointTypeCONTINUOUS RestorePointType = "CONTINUOUS" - // RestorePointTypeDISCRETE ... - RestorePointTypeDISCRETE RestorePointType = "DISCRETE" -) - -// PossibleRestorePointTypeValues returns an array of possible values for the RestorePointType const type. -func PossibleRestorePointTypeValues() []RestorePointType { - return []RestorePointType{RestorePointTypeCONTINUOUS, RestorePointTypeDISCRETE} -} - -// SecurityAlertPolicyState enumerates the values for security alert policy state. -type SecurityAlertPolicyState string - -const ( - // SecurityAlertPolicyStateDisabled ... - SecurityAlertPolicyStateDisabled SecurityAlertPolicyState = "Disabled" - // SecurityAlertPolicyStateEnabled ... - SecurityAlertPolicyStateEnabled SecurityAlertPolicyState = "Enabled" - // SecurityAlertPolicyStateNew ... - SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New" -) - -// PossibleSecurityAlertPolicyStateValues returns an array of possible values for the SecurityAlertPolicyState const type. -func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { - return []SecurityAlertPolicyState{SecurityAlertPolicyStateDisabled, SecurityAlertPolicyStateEnabled, SecurityAlertPolicyStateNew} -} - -// SelfHostedIntegrationRuntimeNodeStatus enumerates the values for self hosted integration runtime node -// status. -type SelfHostedIntegrationRuntimeNodeStatus string - -const ( - // SelfHostedIntegrationRuntimeNodeStatusInitializeFailed ... - SelfHostedIntegrationRuntimeNodeStatusInitializeFailed SelfHostedIntegrationRuntimeNodeStatus = "InitializeFailed" - // SelfHostedIntegrationRuntimeNodeStatusInitializing ... - SelfHostedIntegrationRuntimeNodeStatusInitializing SelfHostedIntegrationRuntimeNodeStatus = "Initializing" - // SelfHostedIntegrationRuntimeNodeStatusLimited ... - SelfHostedIntegrationRuntimeNodeStatusLimited SelfHostedIntegrationRuntimeNodeStatus = "Limited" - // SelfHostedIntegrationRuntimeNodeStatusNeedRegistration ... - SelfHostedIntegrationRuntimeNodeStatusNeedRegistration SelfHostedIntegrationRuntimeNodeStatus = "NeedRegistration" - // SelfHostedIntegrationRuntimeNodeStatusOffline ... - SelfHostedIntegrationRuntimeNodeStatusOffline SelfHostedIntegrationRuntimeNodeStatus = "Offline" - // SelfHostedIntegrationRuntimeNodeStatusOnline ... - SelfHostedIntegrationRuntimeNodeStatusOnline SelfHostedIntegrationRuntimeNodeStatus = "Online" - // SelfHostedIntegrationRuntimeNodeStatusUpgrading ... - SelfHostedIntegrationRuntimeNodeStatusUpgrading SelfHostedIntegrationRuntimeNodeStatus = "Upgrading" -) - -// PossibleSelfHostedIntegrationRuntimeNodeStatusValues returns an array of possible values for the SelfHostedIntegrationRuntimeNodeStatus const type. -func PossibleSelfHostedIntegrationRuntimeNodeStatusValues() []SelfHostedIntegrationRuntimeNodeStatus { - return []SelfHostedIntegrationRuntimeNodeStatus{SelfHostedIntegrationRuntimeNodeStatusInitializeFailed, SelfHostedIntegrationRuntimeNodeStatusInitializing, SelfHostedIntegrationRuntimeNodeStatusLimited, SelfHostedIntegrationRuntimeNodeStatusNeedRegistration, SelfHostedIntegrationRuntimeNodeStatusOffline, SelfHostedIntegrationRuntimeNodeStatusOnline, SelfHostedIntegrationRuntimeNodeStatusUpgrading} -} - -// SensitivityLabelRank enumerates the values for sensitivity label rank. -type SensitivityLabelRank string - -const ( - // SensitivityLabelRankCritical ... - SensitivityLabelRankCritical SensitivityLabelRank = "Critical" - // SensitivityLabelRankHigh ... - SensitivityLabelRankHigh SensitivityLabelRank = "High" - // SensitivityLabelRankLow ... - SensitivityLabelRankLow SensitivityLabelRank = "Low" - // SensitivityLabelRankMedium ... - SensitivityLabelRankMedium SensitivityLabelRank = "Medium" - // SensitivityLabelRankNone ... - SensitivityLabelRankNone SensitivityLabelRank = "None" -) - -// PossibleSensitivityLabelRankValues returns an array of possible values for the SensitivityLabelRank const type. -func PossibleSensitivityLabelRankValues() []SensitivityLabelRank { - return []SensitivityLabelRank{SensitivityLabelRankCritical, SensitivityLabelRankHigh, SensitivityLabelRankLow, SensitivityLabelRankMedium, SensitivityLabelRankNone} -} - -// SensitivityLabelSource enumerates the values for sensitivity label source. -type SensitivityLabelSource string - -const ( - // SensitivityLabelSourceCurrent ... - SensitivityLabelSourceCurrent SensitivityLabelSource = "current" - // SensitivityLabelSourceRecommended ... - SensitivityLabelSourceRecommended SensitivityLabelSource = "recommended" -) - -// PossibleSensitivityLabelSourceValues returns an array of possible values for the SensitivityLabelSource const type. -func PossibleSensitivityLabelSourceValues() []SensitivityLabelSource { - return []SensitivityLabelSource{SensitivityLabelSourceCurrent, SensitivityLabelSourceRecommended} -} - -// SensitivityLabelUpdateKind enumerates the values for sensitivity label update kind. -type SensitivityLabelUpdateKind string - -const ( - // SensitivityLabelUpdateKindRemove ... - SensitivityLabelUpdateKindRemove SensitivityLabelUpdateKind = "remove" - // SensitivityLabelUpdateKindSet ... - SensitivityLabelUpdateKindSet SensitivityLabelUpdateKind = "set" -) - -// PossibleSensitivityLabelUpdateKindValues returns an array of possible values for the SensitivityLabelUpdateKind const type. -func PossibleSensitivityLabelUpdateKindValues() []SensitivityLabelUpdateKind { - return []SensitivityLabelUpdateKind{SensitivityLabelUpdateKindRemove, SensitivityLabelUpdateKindSet} -} - -// ServerKeyType enumerates the values for server key type. -type ServerKeyType string - -const ( - // ServerKeyTypeAzureKeyVault ... - ServerKeyTypeAzureKeyVault ServerKeyType = "AzureKeyVault" - // ServerKeyTypeServiceManaged ... - ServerKeyTypeServiceManaged ServerKeyType = "ServiceManaged" -) - -// PossibleServerKeyTypeValues returns an array of possible values for the ServerKeyType const type. -func PossibleServerKeyTypeValues() []ServerKeyType { - return []ServerKeyType{ServerKeyTypeAzureKeyVault, ServerKeyTypeServiceManaged} -} - -// SsisObjectMetadataType enumerates the values for ssis object metadata type. -type SsisObjectMetadataType string - -const ( - // SsisObjectMetadataTypeEnvironment ... - SsisObjectMetadataTypeEnvironment SsisObjectMetadataType = "Environment" - // SsisObjectMetadataTypeFolder ... - SsisObjectMetadataTypeFolder SsisObjectMetadataType = "Folder" - // SsisObjectMetadataTypePackage ... - SsisObjectMetadataTypePackage SsisObjectMetadataType = "Package" - // SsisObjectMetadataTypeProject ... - SsisObjectMetadataTypeProject SsisObjectMetadataType = "Project" -) - -// PossibleSsisObjectMetadataTypeValues returns an array of possible values for the SsisObjectMetadataType const type. -func PossibleSsisObjectMetadataTypeValues() []SsisObjectMetadataType { - return []SsisObjectMetadataType{SsisObjectMetadataTypeEnvironment, SsisObjectMetadataTypeFolder, SsisObjectMetadataTypePackage, SsisObjectMetadataTypeProject} -} - -// StateValue enumerates the values for state value. -type StateValue string - -const ( - // StateValueConsistent ... - StateValueConsistent StateValue = "Consistent" - // StateValueInConsistent ... - StateValueInConsistent StateValue = "InConsistent" - // StateValueUpdating ... - StateValueUpdating StateValue = "Updating" -) - -// PossibleStateValueValues returns an array of possible values for the StateValue const type. -func PossibleStateValueValues() []StateValue { - return []StateValue{StateValueConsistent, StateValueInConsistent, StateValueUpdating} -} - -// StorageAccountType enumerates the values for storage account type. -type StorageAccountType string - -const ( - // StorageAccountTypeGRS ... - StorageAccountTypeGRS StorageAccountType = "GRS" - // StorageAccountTypeLRS ... - StorageAccountTypeLRS StorageAccountType = "LRS" - // StorageAccountTypeZRS ... - StorageAccountTypeZRS StorageAccountType = "ZRS" -) - -// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. -func PossibleStorageAccountTypeValues() []StorageAccountType { - return []StorageAccountType{StorageAccountTypeGRS, StorageAccountTypeLRS, StorageAccountTypeZRS} -} - -// TransparentDataEncryptionStatus enumerates the values for transparent data encryption status. -type TransparentDataEncryptionStatus string - -const ( - // TransparentDataEncryptionStatusDisabled ... - TransparentDataEncryptionStatusDisabled TransparentDataEncryptionStatus = "Disabled" - // TransparentDataEncryptionStatusEnabled ... - TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = "Enabled" -) - -// PossibleTransparentDataEncryptionStatusValues returns an array of possible values for the TransparentDataEncryptionStatus const type. -func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryptionStatus { - return []TransparentDataEncryptionStatus{TransparentDataEncryptionStatusDisabled, TransparentDataEncryptionStatusEnabled} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeIntegrationRuntime ... - TypeIntegrationRuntime Type = "IntegrationRuntime" - // TypeManaged ... - TypeManaged Type = "Managed" - // TypeSelfHosted ... - TypeSelfHosted Type = "SelfHosted" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeIntegrationRuntime, TypeManaged, TypeSelfHosted} -} - -// TypeBasicCustomSetupBase enumerates the values for type basic custom setup base. -type TypeBasicCustomSetupBase string - -const ( - // TypeBasicCustomSetupBaseTypeCmdkeySetup ... - TypeBasicCustomSetupBaseTypeCmdkeySetup TypeBasicCustomSetupBase = "CmdkeySetup" - // TypeBasicCustomSetupBaseTypeComponentSetup ... - TypeBasicCustomSetupBaseTypeComponentSetup TypeBasicCustomSetupBase = "ComponentSetup" - // TypeBasicCustomSetupBaseTypeCustomSetupBase ... - TypeBasicCustomSetupBaseTypeCustomSetupBase TypeBasicCustomSetupBase = "CustomSetupBase" - // TypeBasicCustomSetupBaseTypeEnvironmentVariableSetup ... - TypeBasicCustomSetupBaseTypeEnvironmentVariableSetup TypeBasicCustomSetupBase = "EnvironmentVariableSetup" -) - -// PossibleTypeBasicCustomSetupBaseValues returns an array of possible values for the TypeBasicCustomSetupBase const type. -func PossibleTypeBasicCustomSetupBaseValues() []TypeBasicCustomSetupBase { - return []TypeBasicCustomSetupBase{TypeBasicCustomSetupBaseTypeCmdkeySetup, TypeBasicCustomSetupBaseTypeComponentSetup, TypeBasicCustomSetupBaseTypeCustomSetupBase, TypeBasicCustomSetupBaseTypeEnvironmentVariableSetup} -} - -// TypeBasicIntegrationRuntimeStatus enumerates the values for type basic integration runtime status. -type TypeBasicIntegrationRuntimeStatus string - -const ( - // TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus ... - TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus TypeBasicIntegrationRuntimeStatus = "IntegrationRuntimeStatus" - // TypeBasicIntegrationRuntimeStatusTypeManaged ... - TypeBasicIntegrationRuntimeStatusTypeManaged TypeBasicIntegrationRuntimeStatus = "Managed" - // TypeBasicIntegrationRuntimeStatusTypeSelfHosted ... - TypeBasicIntegrationRuntimeStatusTypeSelfHosted TypeBasicIntegrationRuntimeStatus = "SelfHosted" -) - -// PossibleTypeBasicIntegrationRuntimeStatusValues returns an array of possible values for the TypeBasicIntegrationRuntimeStatus const type. -func PossibleTypeBasicIntegrationRuntimeStatusValues() []TypeBasicIntegrationRuntimeStatus { - return []TypeBasicIntegrationRuntimeStatus{TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus, TypeBasicIntegrationRuntimeStatusTypeManaged, TypeBasicIntegrationRuntimeStatusTypeSelfHosted} -} - -// TypeBasicSecretBase enumerates the values for type basic secret base. -type TypeBasicSecretBase string - -const ( - // TypeBasicSecretBaseTypeSecretBase ... - TypeBasicSecretBaseTypeSecretBase TypeBasicSecretBase = "SecretBase" - // TypeBasicSecretBaseTypeSecureString ... - TypeBasicSecretBaseTypeSecureString TypeBasicSecretBase = "SecureString" -) - -// PossibleTypeBasicSecretBaseValues returns an array of possible values for the TypeBasicSecretBase const type. -func PossibleTypeBasicSecretBaseValues() []TypeBasicSecretBase { - return []TypeBasicSecretBase{TypeBasicSecretBaseTypeSecretBase, TypeBasicSecretBaseTypeSecureString} -} - -// TypeBasicSsisObjectMetadata enumerates the values for type basic ssis object metadata. -type TypeBasicSsisObjectMetadata string - -const ( - // TypeBasicSsisObjectMetadataTypeEnvironment ... - TypeBasicSsisObjectMetadataTypeEnvironment TypeBasicSsisObjectMetadata = "Environment" - // TypeBasicSsisObjectMetadataTypeFolder ... - TypeBasicSsisObjectMetadataTypeFolder TypeBasicSsisObjectMetadata = "Folder" - // TypeBasicSsisObjectMetadataTypePackage ... - TypeBasicSsisObjectMetadataTypePackage TypeBasicSsisObjectMetadata = "Package" - // TypeBasicSsisObjectMetadataTypeProject ... - TypeBasicSsisObjectMetadataTypeProject TypeBasicSsisObjectMetadata = "Project" - // TypeBasicSsisObjectMetadataTypeSsisObjectMetadata ... - TypeBasicSsisObjectMetadataTypeSsisObjectMetadata TypeBasicSsisObjectMetadata = "SsisObjectMetadata" -) - -// PossibleTypeBasicSsisObjectMetadataValues returns an array of possible values for the TypeBasicSsisObjectMetadata const type. -func PossibleTypeBasicSsisObjectMetadataValues() []TypeBasicSsisObjectMetadata { - return []TypeBasicSsisObjectMetadata{TypeBasicSsisObjectMetadataTypeEnvironment, TypeBasicSsisObjectMetadataTypeFolder, TypeBasicSsisObjectMetadataTypePackage, TypeBasicSsisObjectMetadataTypeProject, TypeBasicSsisObjectMetadataTypeSsisObjectMetadata} -} - -// VulnerabilityAssessmentPolicyBaselineName enumerates the values for vulnerability assessment policy baseline -// name. -type VulnerabilityAssessmentPolicyBaselineName string - -const ( - // VulnerabilityAssessmentPolicyBaselineNameDefault ... - VulnerabilityAssessmentPolicyBaselineNameDefault VulnerabilityAssessmentPolicyBaselineName = "default" - // VulnerabilityAssessmentPolicyBaselineNameMaster ... - VulnerabilityAssessmentPolicyBaselineNameMaster VulnerabilityAssessmentPolicyBaselineName = "master" -) - -// PossibleVulnerabilityAssessmentPolicyBaselineNameValues returns an array of possible values for the VulnerabilityAssessmentPolicyBaselineName const type. -func PossibleVulnerabilityAssessmentPolicyBaselineNameValues() []VulnerabilityAssessmentPolicyBaselineName { - return []VulnerabilityAssessmentPolicyBaselineName{VulnerabilityAssessmentPolicyBaselineNameDefault, VulnerabilityAssessmentPolicyBaselineNameMaster} -} - -// VulnerabilityAssessmentScanState enumerates the values for vulnerability assessment scan state. -type VulnerabilityAssessmentScanState string - -const ( - // VulnerabilityAssessmentScanStateFailed ... - VulnerabilityAssessmentScanStateFailed VulnerabilityAssessmentScanState = "Failed" - // VulnerabilityAssessmentScanStateFailedToRun ... - VulnerabilityAssessmentScanStateFailedToRun VulnerabilityAssessmentScanState = "FailedToRun" - // VulnerabilityAssessmentScanStateInProgress ... - VulnerabilityAssessmentScanStateInProgress VulnerabilityAssessmentScanState = "InProgress" - // VulnerabilityAssessmentScanStatePassed ... - VulnerabilityAssessmentScanStatePassed VulnerabilityAssessmentScanState = "Passed" -) - -// PossibleVulnerabilityAssessmentScanStateValues returns an array of possible values for the VulnerabilityAssessmentScanState const type. -func PossibleVulnerabilityAssessmentScanStateValues() []VulnerabilityAssessmentScanState { - return []VulnerabilityAssessmentScanState{VulnerabilityAssessmentScanStateFailed, VulnerabilityAssessmentScanStateFailedToRun, VulnerabilityAssessmentScanStateInProgress, VulnerabilityAssessmentScanStatePassed} -} - -// VulnerabilityAssessmentScanTriggerType enumerates the values for vulnerability assessment scan trigger type. -type VulnerabilityAssessmentScanTriggerType string - -const ( - // VulnerabilityAssessmentScanTriggerTypeOnDemand ... - VulnerabilityAssessmentScanTriggerTypeOnDemand VulnerabilityAssessmentScanTriggerType = "OnDemand" - // VulnerabilityAssessmentScanTriggerTypeRecurring ... - VulnerabilityAssessmentScanTriggerTypeRecurring VulnerabilityAssessmentScanTriggerType = "Recurring" -) - -// PossibleVulnerabilityAssessmentScanTriggerTypeValues returns an array of possible values for the VulnerabilityAssessmentScanTriggerType const type. -func PossibleVulnerabilityAssessmentScanTriggerTypeValues() []VulnerabilityAssessmentScanTriggerType { - return []VulnerabilityAssessmentScanTriggerType{VulnerabilityAssessmentScanTriggerTypeOnDemand, VulnerabilityAssessmentScanTriggerTypeRecurring} -} - -// WorkspacePublicNetworkAccess enumerates the values for workspace public network access. -type WorkspacePublicNetworkAccess string - -const ( - // WorkspacePublicNetworkAccessDisabled ... - WorkspacePublicNetworkAccessDisabled WorkspacePublicNetworkAccess = "Disabled" - // WorkspacePublicNetworkAccessEnabled ... - WorkspacePublicNetworkAccessEnabled WorkspacePublicNetworkAccess = "Enabled" -) - -// PossibleWorkspacePublicNetworkAccessValues returns an array of possible values for the WorkspacePublicNetworkAccess const type. -func PossibleWorkspacePublicNetworkAccessValues() []WorkspacePublicNetworkAccess { - return []WorkspacePublicNetworkAccess{WorkspacePublicNetworkAccessDisabled, WorkspacePublicNetworkAccessEnabled} -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/extendedsqlpoolblobauditingpolicies.go b/services/preview/synapse/mgmt/v1.0/synapse/extendedsqlpoolblobauditingpolicies.go deleted file mode 100644 index 8f669cb331d2..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/extendedsqlpoolblobauditingpolicies.go +++ /dev/null @@ -1,342 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// ExtendedSQLPoolBlobAuditingPoliciesClient is the azure Synapse Analytics Management Client -type ExtendedSQLPoolBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewExtendedSQLPoolBlobAuditingPoliciesClient creates an instance of the ExtendedSQLPoolBlobAuditingPoliciesClient -// client. -func NewExtendedSQLPoolBlobAuditingPoliciesClient(subscriptionID string) ExtendedSQLPoolBlobAuditingPoliciesClient { - return NewExtendedSQLPoolBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExtendedSQLPoolBlobAuditingPoliciesClientWithBaseURI creates an instance of the -// ExtendedSQLPoolBlobAuditingPoliciesClient 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 NewExtendedSQLPoolBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ExtendedSQLPoolBlobAuditingPoliciesClient { - return ExtendedSQLPoolBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an extended Sql pool's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the extended Sql pool blob auditing policy. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters ExtendedSQLPoolBlobAuditingPolicy) (result ExtendedSQLPoolBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPoliciesClient.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}}}}); err != nil { - return result, validation.NewError("synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters ExtendedSQLPoolBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 ExtendedSQLPoolBlobAuditingPoliciesClient) 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 ExtendedSQLPoolBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ExtendedSQLPoolBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets an extended Sql pool's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ExtendedSQLPoolBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPoliciesClient.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("synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 ExtendedSQLPoolBlobAuditingPoliciesClient) 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 ExtendedSQLPoolBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result ExtendedSQLPoolBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySQLPool lists extended auditing settings of a Sql pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ExtendedSQLPoolBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPoliciesClient.ListBySQLPool") - defer func() { - sc := -1 - if result.espbaplr.Response.Response != nil { - sc = result.espbaplr.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("synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", err.Error()) - } - - result.fn = client.listBySQLPoolNextResults - req, err := client.ListBySQLPoolPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.espbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", resp, "Failure sending request") - return - } - - result.espbaplr, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", resp, "Failure responding to request") - return - } - if result.espbaplr.hasNextLink() && result.espbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySQLPoolPreparer prepares the ListBySQLPool request. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPoolPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySQLPoolSender sends the ListBySQLPool request. The method will close the -// http.Response Body if it receives an error. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySQLPoolResponder handles the response to the ListBySQLPool request. The method always -// closes the http.Response Body. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPoolResponder(resp *http.Response) (result ExtendedSQLPoolBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySQLPoolNextResults retrieves the next set of results, if any. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) listBySQLPoolNextResults(ctx context.Context, lastResults ExtendedSQLPoolBlobAuditingPolicyListResult) (result ExtendedSQLPoolBlobAuditingPolicyListResult, err error) { - req, err := lastResults.extendedSQLPoolBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.ExtendedSQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySQLPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client ExtendedSQLPoolBlobAuditingPoliciesClient) ListBySQLPoolComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ExtendedSQLPoolBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPoliciesClient.ListBySQLPool") - 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.ListBySQLPool(ctx, resourceGroupName, workspaceName, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeauthkeys.go b/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeauthkeys.go deleted file mode 100644 index 3672f634c9f1..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeauthkeys.go +++ /dev/null @@ -1,210 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeAuthKeysClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeAuthKeysClient struct { - BaseClient -} - -// NewIntegrationRuntimeAuthKeysClient creates an instance of the IntegrationRuntimeAuthKeysClient client. -func NewIntegrationRuntimeAuthKeysClient(subscriptionID string) IntegrationRuntimeAuthKeysClient { - return NewIntegrationRuntimeAuthKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeAuthKeysClientWithBaseURI creates an instance of the IntegrationRuntimeAuthKeysClient 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 NewIntegrationRuntimeAuthKeysClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeAuthKeysClient { - return IntegrationRuntimeAuthKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list authentication keys in an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeAuthKeysClient) List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeAuthKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeAuthKeysClient.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("synapse.IntegrationRuntimeAuthKeysClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationRuntimeAuthKeysClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys", 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 IntegrationRuntimeAuthKeysClient) 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 IntegrationRuntimeAuthKeysClient) ListResponder(resp *http.Response) (result IntegrationRuntimeAuthKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Regenerate regenerate the authentication key for an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// regenerateKeyParameters - the parameters for regenerating integration runtime authentication key. -func (client IntegrationRuntimeAuthKeysClient) Regenerate(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, regenerateKeyParameters IntegrationRuntimeRegenerateKeyParameters) (result IntegrationRuntimeAuthKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeAuthKeysClient.Regenerate") - 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("synapse.IntegrationRuntimeAuthKeysClient", "Regenerate", err.Error()) - } - - req, err := client.RegeneratePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, regenerateKeyParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "Regenerate", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "Regenerate", resp, "Failure sending request") - return - } - - result, err = client.RegenerateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeAuthKeysClient", "Regenerate", resp, "Failure responding to request") - return - } - - return -} - -// RegeneratePreparer prepares the Regenerate request. -func (client IntegrationRuntimeAuthKeysClient) RegeneratePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, regenerateKeyParameters IntegrationRuntimeRegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey", pathParameters), - autorest.WithJSON(regenerateKeyParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateSender sends the Regenerate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimeAuthKeysClient) RegenerateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateResponder handles the response to the Regenerate request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimeAuthKeysClient) RegenerateResponder(resp *http.Response) (result IntegrationRuntimeAuthKeys, 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/synapse/mgmt/v1.0/synapse/integrationruntimeconnectioninfos.go b/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeconnectioninfos.go deleted file mode 100644 index fddcda29bf6e..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeconnectioninfos.go +++ /dev/null @@ -1,121 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeConnectionInfosClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeConnectionInfosClient struct { - BaseClient -} - -// NewIntegrationRuntimeConnectionInfosClient creates an instance of the IntegrationRuntimeConnectionInfosClient -// client. -func NewIntegrationRuntimeConnectionInfosClient(subscriptionID string) IntegrationRuntimeConnectionInfosClient { - return NewIntegrationRuntimeConnectionInfosClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeConnectionInfosClientWithBaseURI creates an instance of the -// IntegrationRuntimeConnectionInfosClient 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 NewIntegrationRuntimeConnectionInfosClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeConnectionInfosClient { - return IntegrationRuntimeConnectionInfosClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get connection info for an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeConnectionInfosClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeConnectionInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeConnectionInfosClient.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("synapse.IntegrationRuntimeConnectionInfosClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeConnectionInfosClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeConnectionInfosClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeConnectionInfosClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimeConnectionInfosClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo", 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 IntegrationRuntimeConnectionInfosClient) 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 IntegrationRuntimeConnectionInfosClient) GetResponder(resp *http.Response) (result IntegrationRuntimeConnectionInfo, 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/synapse/mgmt/v1.0/synapse/integrationruntimecredentials.go b/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimecredentials.go deleted file mode 100644 index 6ff77750fc3d..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimecredentials.go +++ /dev/null @@ -1,122 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeCredentialsClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeCredentialsClient struct { - BaseClient -} - -// NewIntegrationRuntimeCredentialsClient creates an instance of the IntegrationRuntimeCredentialsClient client. -func NewIntegrationRuntimeCredentialsClient(subscriptionID string) IntegrationRuntimeCredentialsClient { - return NewIntegrationRuntimeCredentialsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeCredentialsClientWithBaseURI creates an instance of the IntegrationRuntimeCredentialsClient -// 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 NewIntegrationRuntimeCredentialsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeCredentialsClient { - return IntegrationRuntimeCredentialsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Sync force the integration runtime to synchronize credentials across integration runtime nodes, and this will -// override the credentials across all worker nodes with those available on the dispatcher node. If you already have -// the latest credential backup file, you should manually import it (preferred) on any self-hosted integration runtime -// node than using this API directly. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeCredentialsClient) Sync(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeCredentialsClient.Sync") - 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("synapse.IntegrationRuntimeCredentialsClient", "Sync", err.Error()) - } - - req, err := client.SyncPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeCredentialsClient", "Sync", nil, "Failure preparing request") - return - } - - resp, err := client.SyncSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeCredentialsClient", "Sync", resp, "Failure sending request") - return - } - - result, err = client.SyncResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeCredentialsClient", "Sync", resp, "Failure responding to request") - return - } - - return -} - -// SyncPreparer prepares the Sync request. -func (client IntegrationRuntimeCredentialsClient) SyncPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SyncSender sends the Sync request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimeCredentialsClient) SyncSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SyncResponder handles the response to the Sync request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimeCredentialsClient) SyncResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimemonitoringdata.go b/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimemonitoringdata.go deleted file mode 100644 index 946e3b9c6a37..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimemonitoringdata.go +++ /dev/null @@ -1,120 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeMonitoringDataClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeMonitoringDataClient struct { - BaseClient -} - -// NewIntegrationRuntimeMonitoringDataClient creates an instance of the IntegrationRuntimeMonitoringDataClient client. -func NewIntegrationRuntimeMonitoringDataClient(subscriptionID string) IntegrationRuntimeMonitoringDataClient { - return NewIntegrationRuntimeMonitoringDataClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeMonitoringDataClientWithBaseURI creates an instance of the -// IntegrationRuntimeMonitoringDataClient 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 NewIntegrationRuntimeMonitoringDataClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeMonitoringDataClient { - return IntegrationRuntimeMonitoringDataClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get monitoring data for an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeMonitoringDataClient) List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeMonitoringData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeMonitoringDataClient.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("synapse.IntegrationRuntimeMonitoringDataClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeMonitoringDataClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeMonitoringDataClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeMonitoringDataClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationRuntimeMonitoringDataClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/monitoringData", 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 IntegrationRuntimeMonitoringDataClient) 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 IntegrationRuntimeMonitoringDataClient) ListResponder(resp *http.Response) (result IntegrationRuntimeMonitoringData, 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/synapse/mgmt/v1.0/synapse/integrationruntimenodeipaddress.go b/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimenodeipaddress.go deleted file mode 100644 index 2fe9e6ed314c..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimenodeipaddress.go +++ /dev/null @@ -1,122 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeNodeIPAddressClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeNodeIPAddressClient struct { - BaseClient -} - -// NewIntegrationRuntimeNodeIPAddressClient creates an instance of the IntegrationRuntimeNodeIPAddressClient client. -func NewIntegrationRuntimeNodeIPAddressClient(subscriptionID string) IntegrationRuntimeNodeIPAddressClient { - return NewIntegrationRuntimeNodeIPAddressClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeNodeIPAddressClientWithBaseURI creates an instance of the IntegrationRuntimeNodeIPAddressClient -// 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 NewIntegrationRuntimeNodeIPAddressClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeNodeIPAddressClient { - return IntegrationRuntimeNodeIPAddressClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the IP address of an integration runtime node -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// nodeName - integration runtime node name -func (client IntegrationRuntimeNodeIPAddressClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result IntegrationRuntimeNodeIPAddress, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeNodeIPAddressClient.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("synapse.IntegrationRuntimeNodeIPAddressClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, nodeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodeIPAddressClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodeIPAddressClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodeIPAddressClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimeNodeIPAddressClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress", 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 IntegrationRuntimeNodeIPAddressClient) 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 IntegrationRuntimeNodeIPAddressClient) GetResponder(resp *http.Response) (result IntegrationRuntimeNodeIPAddress, 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/synapse/mgmt/v1.0/synapse/integrationruntimenodes.go b/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimenodes.go deleted file mode 100644 index 49256ca8e128..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimenodes.go +++ /dev/null @@ -1,302 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeNodesClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeNodesClient struct { - BaseClient -} - -// NewIntegrationRuntimeNodesClient creates an instance of the IntegrationRuntimeNodesClient client. -func NewIntegrationRuntimeNodesClient(subscriptionID string) IntegrationRuntimeNodesClient { - return NewIntegrationRuntimeNodesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeNodesClientWithBaseURI creates an instance of the IntegrationRuntimeNodesClient 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 NewIntegrationRuntimeNodesClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeNodesClient { - return IntegrationRuntimeNodesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete an integration runtime node -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// nodeName - integration runtime node name -func (client IntegrationRuntimeNodesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeNodesClient.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("synapse.IntegrationRuntimeNodesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, nodeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationRuntimeNodesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}", 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 IntegrationRuntimeNodesClient) 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 IntegrationRuntimeNodesClient) 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 an integration runtime node -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// nodeName - integration runtime node name -func (client IntegrationRuntimeNodesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result SelfHostedIntegrationRuntimeNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeNodesClient.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("synapse.IntegrationRuntimeNodesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, nodeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimeNodesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}", 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 IntegrationRuntimeNodesClient) 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 IntegrationRuntimeNodesClient) GetResponder(resp *http.Response) (result SelfHostedIntegrationRuntimeNode, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update create an integration runtime node -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// nodeName - integration runtime node name -// updateIntegrationRuntimeNodeRequest - the parameters for updating an integration runtime node. -func (client IntegrationRuntimeNodesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string, updateIntegrationRuntimeNodeRequest UpdateIntegrationRuntimeNodeRequest) (result SelfHostedIntegrationRuntimeNode, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeNodesClient.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("synapse.IntegrationRuntimeNodesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, nodeName, updateIntegrationRuntimeNodeRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IntegrationRuntimeNodesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string, updateIntegrationRuntimeNodeRequest UpdateIntegrationRuntimeNodeRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}", pathParameters), - autorest.WithJSON(updateIntegrationRuntimeNodeRequest), - 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 IntegrationRuntimeNodesClient) 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 IntegrationRuntimeNodesClient) UpdateResponder(resp *http.Response) (result SelfHostedIntegrationRuntimeNode, 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/synapse/mgmt/v1.0/synapse/integrationruntimeobjectmetadata.go b/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeobjectmetadata.go deleted file mode 100644 index 0edfbf7e88ae..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimeobjectmetadata.go +++ /dev/null @@ -1,216 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeObjectMetadataClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeObjectMetadataClient struct { - BaseClient -} - -// NewIntegrationRuntimeObjectMetadataClient creates an instance of the IntegrationRuntimeObjectMetadataClient client. -func NewIntegrationRuntimeObjectMetadataClient(subscriptionID string) IntegrationRuntimeObjectMetadataClient { - return NewIntegrationRuntimeObjectMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeObjectMetadataClientWithBaseURI creates an instance of the -// IntegrationRuntimeObjectMetadataClient 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 NewIntegrationRuntimeObjectMetadataClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeObjectMetadataClient { - return IntegrationRuntimeObjectMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get object metadata from an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// getMetadataRequest - the parameters for getting a SSIS object metadata. -func (client IntegrationRuntimeObjectMetadataClient) List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, getMetadataRequest *GetSsisObjectMetadataRequest) (result SsisObjectMetadataListResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeObjectMetadataClient.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("synapse.IntegrationRuntimeObjectMetadataClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, getMetadataRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationRuntimeObjectMetadataClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, getMetadataRequest *GetSsisObjectMetadataRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getObjectMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if getMetadataRequest != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(getMetadataRequest)) - } - 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 IntegrationRuntimeObjectMetadataClient) 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 IntegrationRuntimeObjectMetadataClient) ListResponder(resp *http.Response) (result SsisObjectMetadataListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Refresh refresh the object metadata in an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeObjectMetadataClient) Refresh(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeObjectMetadataRefreshFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeObjectMetadataClient.Refresh") - 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: 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("synapse.IntegrationRuntimeObjectMetadataClient", "Refresh", err.Error()) - } - - req, err := client.RefreshPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "Refresh", nil, "Failure preparing request") - return - } - - result, err = client.RefreshSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "Refresh", result.Response(), "Failure sending request") - return - } - - return -} - -// RefreshPreparer prepares the Refresh request. -func (client IntegrationRuntimeObjectMetadataClient) RefreshPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshSender sends the Refresh request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimeObjectMetadataClient) RefreshSender(req *http.Request) (future IntegrationRuntimeObjectMetadataRefreshFuture, 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 -} - -// RefreshResponder handles the response to the Refresh request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimeObjectMetadataClient) RefreshResponder(resp *http.Response) (result SsisObjectMetadataStatusResponse, 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/preview/synapse/mgmt/v1.0/synapse/integrationruntimes.go b/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimes.go deleted file mode 100644 index c783aa0e5e1b..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimes.go +++ /dev/null @@ -1,1062 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimesClient is the azure Synapse Analytics Management Client -type IntegrationRuntimesClient struct { - BaseClient -} - -// NewIntegrationRuntimesClient creates an instance of the IntegrationRuntimesClient client. -func NewIntegrationRuntimesClient(subscriptionID string) IntegrationRuntimesClient { - return NewIntegrationRuntimesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimesClientWithBaseURI creates an instance of the IntegrationRuntimesClient 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 NewIntegrationRuntimesClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimesClient { - return IntegrationRuntimesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// integrationRuntime - integration runtime resource definition. -// ifMatch - eTag of the integration runtime entity. Should only be specified for update, for which it should -// match existing entity or can be * for unconditional update. -func (client IntegrationRuntimesClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, integrationRuntime IntegrationRuntimeResource, ifMatch string) (result IntegrationRuntimesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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: 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("synapse.IntegrationRuntimesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, integrationRuntime, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client IntegrationRuntimesClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, integrationRuntime IntegrationRuntimeResource, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}", pathParameters), - autorest.WithJSON(integrationRuntime), - 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)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) CreateSender(req *http.Request) (future IntegrationRuntimesCreateFuture, 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 IntegrationRuntimesClient) CreateResponder(resp *http.Response) (result IntegrationRuntimeResource, 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 delete an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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: 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("synapse.IntegrationRuntimesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationRuntimesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}", 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 IntegrationRuntimesClient) DeleteSender(req *http.Request) (future IntegrationRuntimesDeleteFuture, 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 IntegrationRuntimesClient) 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 -} - -// DisableInteractiveQuery disable interactive query in integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) DisableInteractiveQuery(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesDisableInteractiveQueryFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.DisableInteractiveQuery") - 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: 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("synapse.IntegrationRuntimesClient", "DisableInteractiveQuery", err.Error()) - } - - req, err := client.DisableInteractiveQueryPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "DisableInteractiveQuery", nil, "Failure preparing request") - return - } - - result, err = client.DisableInteractiveQuerySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "DisableInteractiveQuery", result.Response(), "Failure sending request") - return - } - - return -} - -// DisableInteractiveQueryPreparer prepares the DisableInteractiveQuery request. -func (client IntegrationRuntimesClient) DisableInteractiveQueryPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/disableInteractiveQuery", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableInteractiveQuerySender sends the DisableInteractiveQuery request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) DisableInteractiveQuerySender(req *http.Request) (future IntegrationRuntimesDisableInteractiveQueryFuture, 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 -} - -// DisableInteractiveQueryResponder handles the response to the DisableInteractiveQuery request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimesClient) DisableInteractiveQueryResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// EnableInteractiveQuery enable interactive query in integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) EnableInteractiveQuery(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesEnableInteractiveQueryFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.EnableInteractiveQuery") - 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: 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("synapse.IntegrationRuntimesClient", "EnableInteractiveQuery", err.Error()) - } - - req, err := client.EnableInteractiveQueryPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "EnableInteractiveQuery", nil, "Failure preparing request") - return - } - - result, err = client.EnableInteractiveQuerySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "EnableInteractiveQuery", result.Response(), "Failure sending request") - return - } - - return -} - -// EnableInteractiveQueryPreparer prepares the EnableInteractiveQuery request. -func (client IntegrationRuntimesClient) EnableInteractiveQueryPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableInteractiveQuery", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableInteractiveQuerySender sends the EnableInteractiveQuery request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) EnableInteractiveQuerySender(req *http.Request) (future IntegrationRuntimesEnableInteractiveQueryFuture, 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 -} - -// EnableInteractiveQueryResponder handles the response to the EnableInteractiveQuery request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimesClient) EnableInteractiveQueryResponder(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 get an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// ifNoneMatch - eTag of the integration runtime entity. Should only be specified for get. If the ETag matches -// the existing entity tag, or if * was provided, then no content will be returned. -func (client IntegrationRuntimesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, ifNoneMatch string) (result IntegrationRuntimeResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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("synapse.IntegrationRuntimesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - 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 IntegrationRuntimesClient) 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 IntegrationRuntimesClient) GetResponder(resp *http.Response) (result IntegrationRuntimeResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotModified), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list all integration runtimes -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -func (client IntegrationRuntimesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result IntegrationRuntimeListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.irlr.Response.Response != nil { - sc = result.irlr.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("synapse.IntegrationRuntimesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.irlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.irlr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.irlr.hasNextLink() && result.irlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client IntegrationRuntimesClient) ListByWorkspacePreparer(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 = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimesClient) ListByWorkspaceResponder(resp *http.Response) (result IntegrationRuntimeListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client IntegrationRuntimesClient) listByWorkspaceNextResults(ctx context.Context, lastResults IntegrationRuntimeListResponse) (result IntegrationRuntimeListResponse, err error) { - req, err := lastResults.integrationRuntimeListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationRuntimesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result IntegrationRuntimeListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// ListOutboundNetworkDependenciesEndpoints gets the list of outbound network dependencies for a given Azure-SSIS -// integration runtime. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.ListOutboundNetworkDependenciesEndpoints") - 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("synapse.IntegrationRuntimesClient", "ListOutboundNetworkDependenciesEndpoints", err.Error()) - } - - req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") - return - } - - result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") - return - } - - return -} - -// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. -func (client IntegrationRuntimesClient) ListOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/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 IntegrationRuntimesClient) 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 IntegrationRuntimesClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Start start an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) Start(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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: 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("synapse.IntegrationRuntimesClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client IntegrationRuntimesClient) StartPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/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 IntegrationRuntimesClient) StartSender(req *http.Request) (future IntegrationRuntimesStartFuture, 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 IntegrationRuntimesClient) StartResponder(resp *http.Response) (result IntegrationRuntimeStatusResponse, 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 stop an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) Stop(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimesStopFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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: 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("synapse.IntegrationRuntimesClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = client.StopSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Stop", result.Response(), "Failure sending request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client IntegrationRuntimesClient) StopPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/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 IntegrationRuntimesClient) StopSender(req *http.Request) (future IntegrationRuntimesStopFuture, 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 IntegrationRuntimesClient) StopResponder(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 update an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -// updateIntegrationRuntimeRequest - the parameters for updating an integration runtime. -func (client IntegrationRuntimesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, updateIntegrationRuntimeRequest UpdateIntegrationRuntimeRequest) (result IntegrationRuntimeResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.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("synapse.IntegrationRuntimesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, updateIntegrationRuntimeRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IntegrationRuntimesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, updateIntegrationRuntimeRequest UpdateIntegrationRuntimeRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}", pathParameters), - autorest.WithJSON(updateIntegrationRuntimeRequest), - 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 IntegrationRuntimesClient) 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 IntegrationRuntimesClient) UpdateResponder(resp *http.Response) (result IntegrationRuntimeResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Upgrade upgrade an integration runtime -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimesClient) Upgrade(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.Upgrade") - 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("synapse.IntegrationRuntimesClient", "Upgrade", err.Error()) - } - - req, err := client.UpgradePreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Upgrade", nil, "Failure preparing request") - return - } - - resp, err := client.UpgradeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Upgrade", resp, "Failure sending request") - return - } - - result, err = client.UpgradeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesClient", "Upgrade", resp, "Failure responding to request") - return - } - - return -} - -// UpgradePreparer prepares the Upgrade request. -func (client IntegrationRuntimesClient) UpgradePreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/upgrade", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpgradeSender sends the Upgrade request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationRuntimesClient) UpgradeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpgradeResponder handles the response to the Upgrade request. The method always -// closes the http.Response Body. -func (client IntegrationRuntimesClient) UpgradeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimestatus.go b/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimestatus.go deleted file mode 100644 index fa9f754b4912..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/integrationruntimestatus.go +++ /dev/null @@ -1,120 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IntegrationRuntimeStatusClient is the azure Synapse Analytics Management Client -type IntegrationRuntimeStatusClient struct { - BaseClient -} - -// NewIntegrationRuntimeStatusClient creates an instance of the IntegrationRuntimeStatusClient client. -func NewIntegrationRuntimeStatusClient(subscriptionID string) IntegrationRuntimeStatusClient { - return NewIntegrationRuntimeStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationRuntimeStatusClientWithBaseURI creates an instance of the IntegrationRuntimeStatusClient 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 NewIntegrationRuntimeStatusClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeStatusClient { - return IntegrationRuntimeStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the integration runtime status -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// integrationRuntimeName - integration runtime name -func (client IntegrationRuntimeStatusClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeStatusResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeStatusClient.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("synapse.IntegrationRuntimeStatusClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeStatusClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationRuntimeStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getStatus", 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 IntegrationRuntimeStatusClient) 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 IntegrationRuntimeStatusClient) GetResponder(resp *http.Response) (result IntegrationRuntimeStatusResponse, 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/synapse/mgmt/v1.0/synapse/ipfirewallrules.go b/services/preview/synapse/mgmt/v1.0/synapse/ipfirewallrules.go deleted file mode 100644 index bacaadac5a8a..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/ipfirewallrules.go +++ /dev/null @@ -1,520 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// IPFirewallRulesClient is the azure Synapse Analytics Management Client -type IPFirewallRulesClient struct { - BaseClient -} - -// NewIPFirewallRulesClient creates an instance of the IPFirewallRulesClient client. -func NewIPFirewallRulesClient(subscriptionID string) IPFirewallRulesClient { - return NewIPFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIPFirewallRulesClientWithBaseURI creates an instance of the IPFirewallRulesClient 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 NewIPFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) IPFirewallRulesClient { - return IPFirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a firewall rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// ruleName - the IP firewall rule name -// IPFirewallRuleInfo - IP firewall rule properties -func (client IPFirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string, IPFirewallRuleInfo IPFirewallRuleInfo) (result IPFirewallRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.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: 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("synapse.IPFirewallRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, ruleName, IPFirewallRuleInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IPFirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string, IPFirewallRuleInfo IPFirewallRuleInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}", pathParameters), - autorest.WithJSON(IPFirewallRuleInfo), - 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 IPFirewallRulesClient) CreateOrUpdateSender(req *http.Request) (future IPFirewallRulesCreateOrUpdateFuture, 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 IPFirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result IPFirewallRuleInfo, 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 a firewall rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// ruleName - the IP firewall rule name -func (client IPFirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (result IPFirewallRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.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: 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("synapse.IPFirewallRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IPFirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/firewallRules/{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 IPFirewallRulesClient) DeleteSender(req *http.Request) (future IPFirewallRulesDeleteFuture, 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 IPFirewallRulesClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a firewall rule -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// ruleName - the IP firewall rule name -func (client IPFirewallRulesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (result IPFirewallRuleInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.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("synapse.IPFirewallRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IPFirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/firewallRules/{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 IPFirewallRulesClient) 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 IPFirewallRulesClient) GetResponder(resp *http.Response) (result IPFirewallRuleInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace returns a list of firewall rules -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client IPFirewallRulesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result IPFirewallRuleInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.ifrilr.Response.Response != nil { - sc = result.ifrilr.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("synapse.IPFirewallRulesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.ifrilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.ifrilr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.ifrilr.hasNextLink() && result.ifrilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client IPFirewallRulesClient) ListByWorkspacePreparer(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 = "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.Synapse/workspaces/{workspaceName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client IPFirewallRulesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client IPFirewallRulesClient) ListByWorkspaceResponder(resp *http.Response) (result IPFirewallRuleInfoListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client IPFirewallRulesClient) listByWorkspaceNextResults(ctx context.Context, lastResults IPFirewallRuleInfoListResult) (result IPFirewallRuleInfoListResult, err error) { - req, err := lastResults.iPFirewallRuleInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client IPFirewallRulesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result IPFirewallRuleInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// ReplaceAll replaces firewall rules -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// request - replace all IP firewall rules request -func (client IPFirewallRulesClient) ReplaceAll(ctx context.Context, resourceGroupName string, workspaceName string, request ReplaceAllIPFirewallRulesRequest) (result IPFirewallRulesReplaceAllFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRulesClient.ReplaceAll") - 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: 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("synapse.IPFirewallRulesClient", "ReplaceAll", err.Error()) - } - - req, err := client.ReplaceAllPreparer(ctx, resourceGroupName, workspaceName, request) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ReplaceAll", nil, "Failure preparing request") - return - } - - result, err = client.ReplaceAllSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesClient", "ReplaceAll", result.Response(), "Failure sending request") - return - } - - return -} - -// ReplaceAllPreparer prepares the ReplaceAll request. -func (client IPFirewallRulesClient) ReplaceAllPreparer(ctx context.Context, resourceGroupName string, workspaceName string, request ReplaceAllIPFirewallRulesRequest) (*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 = "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.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReplaceAllSender sends the ReplaceAll request. The method will close the -// http.Response Body if it receives an error. -func (client IPFirewallRulesClient) ReplaceAllSender(req *http.Request) (future IPFirewallRulesReplaceAllFuture, 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 -} - -// ReplaceAllResponder handles the response to the ReplaceAll request. The method always -// closes the http.Response Body. -func (client IPFirewallRulesClient) ReplaceAllResponder(resp *http.Response) (result ReplaceAllFirewallRulesOperationResponse, 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/preview/synapse/mgmt/v1.0/synapse/keys.go b/services/preview/synapse/mgmt/v1.0/synapse/keys.go deleted file mode 100644 index b2c71a35846d..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/keys.go +++ /dev/null @@ -1,423 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// KeysClient is the azure Synapse Analytics Management Client -type KeysClient struct { - BaseClient -} - -// NewKeysClient creates an instance of the KeysClient client. -func NewKeysClient(subscriptionID string) KeysClient { - return NewKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewKeysClientWithBaseURI creates an instance of the KeysClient 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 NewKeysClientWithBaseURI(baseURI string, subscriptionID string) KeysClient { - return KeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workspace key -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// keyName - the name of the workspace key -// keyProperties - key put request properties -func (client KeysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, keyName string, keyProperties Key) (result Key, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.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}}}}); err != nil { - return result, validation.NewError("synapse.KeysClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, keyName, keyProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client KeysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, keyName string, keyProperties Key) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/keys/{keyName}", pathParameters), - autorest.WithJSON(keyProperties), - 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 KeysClient) 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 KeysClient) CreateOrUpdateResponder(resp *http.Response) (result Key, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a workspace key -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// keyName - the name of the workspace key -func (client KeysClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (result Key, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.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}}}}); err != nil { - return result, validation.NewError("synapse.KeysClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client KeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/keys/{keyName}", 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 KeysClient) 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 KeysClient) DeleteResponder(resp *http.Response) (result Key, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a workspace key -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// keyName - the name of the workspace key -func (client KeysClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (result Key, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.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("synapse.KeysClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client KeysClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/keys/{keyName}", 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 KeysClient) 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 KeysClient) GetResponder(resp *http.Response) (result Key, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace returns a list of keys in a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client KeysClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result KeyInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.ListByWorkspace") - defer func() { - sc := -1 - if result.kilr.Response.Response != nil { - sc = result.kilr.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("synapse.KeysClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.kilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.kilr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.kilr.hasNextLink() && result.kilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client KeysClient) ListByWorkspacePreparer(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 = "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.Synapse/workspaces/{workspaceName}/keys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client KeysClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client KeysClient) ListByWorkspaceResponder(resp *http.Response) (result KeyInfoListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client KeysClient) listByWorkspaceNextResults(ctx context.Context, lastResults KeyInfoListResult) (result KeyInfoListResult, err error) { - req, err := lastResults.keyInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.KeysClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.KeysClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.KeysClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client KeysClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result KeyInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/libraries.go b/services/preview/synapse/mgmt/v1.0/synapse/libraries.go deleted file mode 100644 index 9cd6d79a82f7..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/libraries.go +++ /dev/null @@ -1,159 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LibrariesClient is the azure Synapse Analytics Management Client -type LibrariesClient struct { - BaseClient -} - -// NewLibrariesClient creates an instance of the LibrariesClient client. -func NewLibrariesClient(subscriptionID string) LibrariesClient { - return NewLibrariesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLibrariesClientWithBaseURI creates an instance of the LibrariesClient 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 NewLibrariesClientWithBaseURI(baseURI string, subscriptionID string) LibrariesClient { - return LibrariesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByWorkspace list libraries in a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client LibrariesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result LibraryListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LibrariesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.llr.Response.Response != nil { - sc = result.llr.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("synapse.LibrariesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.LibrariesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.llr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.LibrariesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.llr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.LibrariesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.llr.hasNextLink() && result.llr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client LibrariesClient) ListByWorkspacePreparer(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 = "2021-06-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.Synapse/workspaces/{workspaceName}/libraries", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client LibrariesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client LibrariesClient) ListByWorkspaceResponder(resp *http.Response) (result LibraryListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client LibrariesClient) listByWorkspaceNextResults(ctx context.Context, lastResults LibraryListResponse) (result LibraryListResponse, err error) { - req, err := lastResults.libraryListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.LibrariesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.LibrariesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.LibrariesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client LibrariesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result LibraryListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LibrariesClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/library.go b/services/preview/synapse/mgmt/v1.0/synapse/library.go deleted file mode 100644 index 2b89ef8a5491..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/library.go +++ /dev/null @@ -1,119 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// LibraryClient is the azure Synapse Analytics Management Client -type LibraryClient struct { - BaseClient -} - -// NewLibraryClient creates an instance of the LibraryClient client. -func NewLibraryClient(subscriptionID string) LibraryClient { - return NewLibraryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLibraryClientWithBaseURI creates an instance of the LibraryClient 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 NewLibraryClientWithBaseURI(baseURI string, subscriptionID string) LibraryClient { - return LibraryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get library by name in a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// libraryName - library name -// workspaceName - the name of the workspace -func (client LibraryClient) Get(ctx context.Context, resourceGroupName string, libraryName string, workspaceName string) (result LibraryResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LibraryClient.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("synapse.LibraryClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, libraryName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.LibraryClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.LibraryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.LibraryClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LibraryClient) GetPreparer(ctx context.Context, resourceGroupName string, libraryName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "libraryName": autorest.Encode("path", libraryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/libraries/{libraryName}", 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 LibraryClient) 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 LibraryClient) GetResponder(resp *http.Response) (result LibraryResource, 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/synapse/mgmt/v1.0/synapse/models.go b/services/preview/synapse/mgmt/v1.0/synapse/models.go deleted file mode 100644 index 66872e0886fb..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/models.go +++ /dev/null @@ -1,17023 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/v1.0/synapse" - -// AadAdminProperties workspace active directory administrator properties -type AadAdminProperties struct { - // TenantID - Tenant ID of the workspace active directory administrator - TenantID *string `json:"tenantId,omitempty"` - // Login - Login of the workspace active directory administrator - Login *string `json:"login,omitempty"` - // AdministratorType - Workspace active directory administrator type - AdministratorType *string `json:"administratorType,omitempty"` - // Sid - Object ID of the workspace active directory administrator - Sid *string `json:"sid,omitempty"` -} - -// AutoPauseProperties auto-pausing properties of a Big Data pool powered by Apache Spark -type AutoPauseProperties struct { - // DelayInMinutes - Number of minutes of idle time before the Big Data pool is automatically paused. - DelayInMinutes *int32 `json:"delayInMinutes,omitempty"` - // Enabled - Whether auto-pausing is enabled for the Big Data pool. - Enabled *bool `json:"enabled,omitempty"` -} - -// AutoScaleProperties auto-scaling properties of a Big Data pool powered by Apache Spark -type AutoScaleProperties struct { - // MinNodeCount - The minimum number of nodes the Big Data pool can support. - MinNodeCount *int32 `json:"minNodeCount,omitempty"` - // Enabled - Whether automatic scaling is enabled for the Big Data pool. - Enabled *bool `json:"enabled,omitempty"` - // MaxNodeCount - The maximum number of nodes the Big Data pool can support. - MaxNodeCount *int32 `json:"maxNodeCount,omitempty"` -} - -// AvailableRpOperation an operation that is available in this resource provider -type AvailableRpOperation struct { - // Display - Display properties of the operation - Display *AvailableRpOperationDisplayInfo `json:"display,omitempty"` - // IsDataAction - Whether this operation is a data action - IsDataAction *string `json:"isDataAction,omitempty"` - // Name - Operation name - Name *string `json:"name,omitempty"` - // OperationMetaPropertyInfo - Operation properties - *OperationMetaPropertyInfo `json:"properties,omitempty"` - // Origin - Operation origin - Origin *string `json:"origin,omitempty"` -} - -// MarshalJSON is the custom marshaler for AvailableRpOperation. -func (aro AvailableRpOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aro.Display != nil { - objectMap["display"] = aro.Display - } - if aro.IsDataAction != nil { - objectMap["isDataAction"] = aro.IsDataAction - } - if aro.Name != nil { - objectMap["name"] = aro.Name - } - if aro.OperationMetaPropertyInfo != nil { - objectMap["properties"] = aro.OperationMetaPropertyInfo - } - if aro.Origin != nil { - objectMap["origin"] = aro.Origin - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AvailableRpOperation struct. -func (aro *AvailableRpOperation) 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 AvailableRpOperationDisplayInfo - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - aro.Display = &display - } - case "isDataAction": - if v != nil { - var isDataAction string - err = json.Unmarshal(*v, &isDataAction) - if err != nil { - return err - } - aro.IsDataAction = &isDataAction - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aro.Name = &name - } - case "properties": - if v != nil { - var operationMetaPropertyInfo OperationMetaPropertyInfo - err = json.Unmarshal(*v, &operationMetaPropertyInfo) - if err != nil { - return err - } - aro.OperationMetaPropertyInfo = &operationMetaPropertyInfo - } - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - aro.Origin = &origin - } - } - } - - return nil -} - -// AvailableRpOperationDisplayInfo description of an available operation -type AvailableRpOperationDisplayInfo struct { - // Description - Operation description - Description *string `json:"description,omitempty"` - // Resource - Resource type - Resource *string `json:"resource,omitempty"` - // Provider - Resource provider name - Provider *string `json:"provider,omitempty"` - // Operation - Operation name - Operation *string `json:"operation,omitempty"` -} - -// AzureADOnlyAuthentication azure Active Directory Only Authentication Info -type AzureADOnlyAuthentication struct { - autorest.Response `json:"-"` - // AzureADOnlyAuthenticationProperties - azureADOnlyAuthentication resource properties - *AzureADOnlyAuthenticationProperties `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 AzureADOnlyAuthentication. -func (aaoa AzureADOnlyAuthentication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aaoa.AzureADOnlyAuthenticationProperties != nil { - objectMap["properties"] = aaoa.AzureADOnlyAuthenticationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureADOnlyAuthentication struct. -func (aaoa *AzureADOnlyAuthentication) 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 azureADOnlyAuthenticationProperties AzureADOnlyAuthenticationProperties - err = json.Unmarshal(*v, &azureADOnlyAuthenticationProperties) - if err != nil { - return err - } - aaoa.AzureADOnlyAuthenticationProperties = &azureADOnlyAuthenticationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - aaoa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aaoa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - aaoa.Type = &typeVar - } - } - } - - return nil -} - -// AzureADOnlyAuthenticationListResult a list of active directory only authentications. -type AzureADOnlyAuthenticationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]AzureADOnlyAuthentication `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureADOnlyAuthenticationListResult. -func (aaoalr AzureADOnlyAuthenticationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureADOnlyAuthenticationListResultIterator provides access to a complete listing of -// AzureADOnlyAuthentication values. -type AzureADOnlyAuthenticationListResultIterator struct { - i int - page AzureADOnlyAuthenticationListResultPage -} - -// 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 *AzureADOnlyAuthenticationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureADOnlyAuthenticationListResultIterator.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 *AzureADOnlyAuthenticationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureADOnlyAuthenticationListResultIterator) 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 AzureADOnlyAuthenticationListResultIterator) Response() AzureADOnlyAuthenticationListResult { - 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 AzureADOnlyAuthenticationListResultIterator) Value() AzureADOnlyAuthentication { - if !iter.page.NotDone() { - return AzureADOnlyAuthentication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureADOnlyAuthenticationListResultIterator type. -func NewAzureADOnlyAuthenticationListResultIterator(page AzureADOnlyAuthenticationListResultPage) AzureADOnlyAuthenticationListResultIterator { - return AzureADOnlyAuthenticationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aaoalr AzureADOnlyAuthenticationListResult) IsEmpty() bool { - return aaoalr.Value == nil || len(*aaoalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aaoalr AzureADOnlyAuthenticationListResult) hasNextLink() bool { - return aaoalr.NextLink != nil && len(*aaoalr.NextLink) != 0 -} - -// azureADOnlyAuthenticationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aaoalr AzureADOnlyAuthenticationListResult) azureADOnlyAuthenticationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aaoalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aaoalr.NextLink))) -} - -// AzureADOnlyAuthenticationListResultPage contains a page of AzureADOnlyAuthentication values. -type AzureADOnlyAuthenticationListResultPage struct { - fn func(context.Context, AzureADOnlyAuthenticationListResult) (AzureADOnlyAuthenticationListResult, error) - aaoalr AzureADOnlyAuthenticationListResult -} - -// 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 *AzureADOnlyAuthenticationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureADOnlyAuthenticationListResultPage.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.aaoalr) - if err != nil { - return err - } - page.aaoalr = 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 *AzureADOnlyAuthenticationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureADOnlyAuthenticationListResultPage) NotDone() bool { - return !page.aaoalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureADOnlyAuthenticationListResultPage) Response() AzureADOnlyAuthenticationListResult { - return page.aaoalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureADOnlyAuthenticationListResultPage) Values() []AzureADOnlyAuthentication { - if page.aaoalr.IsEmpty() { - return nil - } - return *page.aaoalr.Value -} - -// Creates a new instance of the AzureADOnlyAuthenticationListResultPage type. -func NewAzureADOnlyAuthenticationListResultPage(cur AzureADOnlyAuthenticationListResult, getNextPage func(context.Context, AzureADOnlyAuthenticationListResult) (AzureADOnlyAuthenticationListResult, error)) AzureADOnlyAuthenticationListResultPage { - return AzureADOnlyAuthenticationListResultPage{ - fn: getNextPage, - aaoalr: cur, - } -} - -// AzureADOnlyAuthenticationProperties properties of a active directory only authentication. -type AzureADOnlyAuthenticationProperties struct { - // AzureADOnlyAuthentication - Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` - // State - READ-ONLY; property configuration state. Possible values include: 'StateValueConsistent', 'StateValueInConsistent', 'StateValueUpdating' - State StateValue `json:"state,omitempty"` - // CreationDate - READ-ONLY; property configuration date - CreationDate *date.Time `json:"creationDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureADOnlyAuthenticationProperties. -func (aaoap AzureADOnlyAuthenticationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aaoap.AzureADOnlyAuthentication != nil { - objectMap["azureADOnlyAuthentication"] = aaoap.AzureADOnlyAuthentication - } - return json.Marshal(objectMap) -} - -// AzureADOnlyAuthenticationsCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AzureADOnlyAuthenticationsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AzureADOnlyAuthenticationsClient) (AzureADOnlyAuthentication, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AzureADOnlyAuthenticationsCreateFuture) 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 AzureADOnlyAuthenticationsCreateFuture.Result. -func (future *AzureADOnlyAuthenticationsCreateFuture) result(client AzureADOnlyAuthenticationsClient) (aaoa AzureADOnlyAuthentication, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - aaoa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.AzureADOnlyAuthenticationsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if aaoa.Response.Response, err = future.GetResult(sender); err == nil && aaoa.Response.Response.StatusCode != http.StatusNoContent { - aaoa, err = client.CreateResponder(aaoa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.AzureADOnlyAuthenticationsCreateFuture", "Result", aaoa.Response.Response, "Failure responding to request") - } - } - return -} - -// 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) -} - -// BigDataPoolPatchInfo properties patch for a Big Data pool -type BigDataPoolPatchInfo struct { - // Tags - Updated tags for the Big Data pool - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for BigDataPoolPatchInfo. -func (bdppi BigDataPoolPatchInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bdppi.Tags != nil { - objectMap["tags"] = bdppi.Tags - } - return json.Marshal(objectMap) -} - -// BigDataPoolResourceInfo a Big Data pool -type BigDataPoolResourceInfo struct { - autorest.Response `json:"-"` - // BigDataPoolResourceProperties - Big Data pool properties - *BigDataPoolResourceProperties `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 BigDataPoolResourceInfo. -func (bdpri BigDataPoolResourceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bdpri.BigDataPoolResourceProperties != nil { - objectMap["properties"] = bdpri.BigDataPoolResourceProperties - } - if bdpri.Tags != nil { - objectMap["tags"] = bdpri.Tags - } - if bdpri.Location != nil { - objectMap["location"] = bdpri.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BigDataPoolResourceInfo struct. -func (bdpri *BigDataPoolResourceInfo) 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 bigDataPoolResourceProperties BigDataPoolResourceProperties - err = json.Unmarshal(*v, &bigDataPoolResourceProperties) - if err != nil { - return err - } - bdpri.BigDataPoolResourceProperties = &bigDataPoolResourceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bdpri.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bdpri.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bdpri.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bdpri.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bdpri.Type = &typeVar - } - } - } - - return nil -} - -// BigDataPoolResourceInfoListResult collection of Big Data pool information -type BigDataPoolResourceInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of Big Data pools - Value *[]BigDataPoolResourceInfo `json:"value,omitempty"` -} - -// BigDataPoolResourceInfoListResultIterator provides access to a complete listing of -// BigDataPoolResourceInfo values. -type BigDataPoolResourceInfoListResultIterator struct { - i int - page BigDataPoolResourceInfoListResultPage -} - -// 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 *BigDataPoolResourceInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolResourceInfoListResultIterator.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 *BigDataPoolResourceInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BigDataPoolResourceInfoListResultIterator) 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 BigDataPoolResourceInfoListResultIterator) Response() BigDataPoolResourceInfoListResult { - 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 BigDataPoolResourceInfoListResultIterator) Value() BigDataPoolResourceInfo { - if !iter.page.NotDone() { - return BigDataPoolResourceInfo{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BigDataPoolResourceInfoListResultIterator type. -func NewBigDataPoolResourceInfoListResultIterator(page BigDataPoolResourceInfoListResultPage) BigDataPoolResourceInfoListResultIterator { - return BigDataPoolResourceInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bdprilr BigDataPoolResourceInfoListResult) IsEmpty() bool { - return bdprilr.Value == nil || len(*bdprilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bdprilr BigDataPoolResourceInfoListResult) hasNextLink() bool { - return bdprilr.NextLink != nil && len(*bdprilr.NextLink) != 0 -} - -// bigDataPoolResourceInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bdprilr BigDataPoolResourceInfoListResult) bigDataPoolResourceInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !bdprilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bdprilr.NextLink))) -} - -// BigDataPoolResourceInfoListResultPage contains a page of BigDataPoolResourceInfo values. -type BigDataPoolResourceInfoListResultPage struct { - fn func(context.Context, BigDataPoolResourceInfoListResult) (BigDataPoolResourceInfoListResult, error) - bdprilr BigDataPoolResourceInfoListResult -} - -// 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 *BigDataPoolResourceInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BigDataPoolResourceInfoListResultPage.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.bdprilr) - if err != nil { - return err - } - page.bdprilr = 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 *BigDataPoolResourceInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BigDataPoolResourceInfoListResultPage) NotDone() bool { - return !page.bdprilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BigDataPoolResourceInfoListResultPage) Response() BigDataPoolResourceInfoListResult { - return page.bdprilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BigDataPoolResourceInfoListResultPage) Values() []BigDataPoolResourceInfo { - if page.bdprilr.IsEmpty() { - return nil - } - return *page.bdprilr.Value -} - -// Creates a new instance of the BigDataPoolResourceInfoListResultPage type. -func NewBigDataPoolResourceInfoListResultPage(cur BigDataPoolResourceInfoListResult, getNextPage func(context.Context, BigDataPoolResourceInfoListResult) (BigDataPoolResourceInfoListResult, error)) BigDataPoolResourceInfoListResultPage { - return BigDataPoolResourceInfoListResultPage{ - fn: getNextPage, - bdprilr: cur, - } -} - -// BigDataPoolResourceProperties properties of a Big Data pool powered by Apache Spark -type BigDataPoolResourceProperties struct { - // ProvisioningState - The state of the Big Data pool. - ProvisioningState *string `json:"provisioningState,omitempty"` - // AutoScale - Auto-scaling properties - AutoScale *AutoScaleProperties `json:"autoScale,omitempty"` - // CreationDate - The time when the Big Data pool was created. - CreationDate *date.Time `json:"creationDate,omitempty"` - // AutoPause - Auto-pausing properties - AutoPause *AutoPauseProperties `json:"autoPause,omitempty"` - // IsComputeIsolationEnabled - Whether compute isolation is required or not. - IsComputeIsolationEnabled *bool `json:"isComputeIsolationEnabled,omitempty"` - // SessionLevelPackagesEnabled - Whether session level packages enabled. - SessionLevelPackagesEnabled *bool `json:"sessionLevelPackagesEnabled,omitempty"` - // CacheSize - The cache size - CacheSize *int32 `json:"cacheSize,omitempty"` - // DynamicExecutorAllocation - Dynamic Executor Allocation - DynamicExecutorAllocation *DynamicExecutorAllocation `json:"dynamicExecutorAllocation,omitempty"` - // SparkEventsFolder - The Spark events folder - SparkEventsFolder *string `json:"sparkEventsFolder,omitempty"` - // NodeCount - The number of nodes in the Big Data pool. - NodeCount *int32 `json:"nodeCount,omitempty"` - // LibraryRequirements - Library version requirements - LibraryRequirements *LibraryRequirements `json:"libraryRequirements,omitempty"` - // CustomLibraries - List of custom libraries/packages associated with the spark pool. - CustomLibraries *[]LibraryInfo `json:"customLibraries,omitempty"` - // SparkConfigProperties - Spark configuration file to specify additional properties - SparkConfigProperties *SparkConfigProperties `json:"sparkConfigProperties,omitempty"` - // SparkVersion - The Apache Spark version. - SparkVersion *string `json:"sparkVersion,omitempty"` - // DefaultSparkLogFolder - The default folder where Spark logs will be written. - DefaultSparkLogFolder *string `json:"defaultSparkLogFolder,omitempty"` - // NodeSize - The level of compute power that each node in the Big Data pool has. Possible values include: 'NodeSizeNone', 'NodeSizeSmall', 'NodeSizeMedium', 'NodeSizeLarge', 'NodeSizeXLarge', 'NodeSizeXXLarge', 'NodeSizeXXXLarge' - NodeSize NodeSize `json:"nodeSize,omitempty"` - // NodeSizeFamily - The kind of nodes that the Big Data pool provides. Possible values include: 'NodeSizeFamilyNone', 'NodeSizeFamilyMemoryOptimized', 'NodeSizeFamilyHardwareAcceleratedFPGA', 'NodeSizeFamilyHardwareAcceleratedGPU' - NodeSizeFamily NodeSizeFamily `json:"nodeSizeFamily,omitempty"` - // LastSucceededTimestamp - READ-ONLY; The time when the Big Data pool was updated successfully. - LastSucceededTimestamp *date.Time `json:"lastSucceededTimestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for BigDataPoolResourceProperties. -func (bdprp BigDataPoolResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bdprp.ProvisioningState != nil { - objectMap["provisioningState"] = bdprp.ProvisioningState - } - if bdprp.AutoScale != nil { - objectMap["autoScale"] = bdprp.AutoScale - } - if bdprp.CreationDate != nil { - objectMap["creationDate"] = bdprp.CreationDate - } - if bdprp.AutoPause != nil { - objectMap["autoPause"] = bdprp.AutoPause - } - if bdprp.IsComputeIsolationEnabled != nil { - objectMap["isComputeIsolationEnabled"] = bdprp.IsComputeIsolationEnabled - } - if bdprp.SessionLevelPackagesEnabled != nil { - objectMap["sessionLevelPackagesEnabled"] = bdprp.SessionLevelPackagesEnabled - } - if bdprp.CacheSize != nil { - objectMap["cacheSize"] = bdprp.CacheSize - } - if bdprp.DynamicExecutorAllocation != nil { - objectMap["dynamicExecutorAllocation"] = bdprp.DynamicExecutorAllocation - } - if bdprp.SparkEventsFolder != nil { - objectMap["sparkEventsFolder"] = bdprp.SparkEventsFolder - } - if bdprp.NodeCount != nil { - objectMap["nodeCount"] = bdprp.NodeCount - } - if bdprp.LibraryRequirements != nil { - objectMap["libraryRequirements"] = bdprp.LibraryRequirements - } - if bdprp.CustomLibraries != nil { - objectMap["customLibraries"] = bdprp.CustomLibraries - } - if bdprp.SparkConfigProperties != nil { - objectMap["sparkConfigProperties"] = bdprp.SparkConfigProperties - } - if bdprp.SparkVersion != nil { - objectMap["sparkVersion"] = bdprp.SparkVersion - } - if bdprp.DefaultSparkLogFolder != nil { - objectMap["defaultSparkLogFolder"] = bdprp.DefaultSparkLogFolder - } - if bdprp.NodeSize != "" { - objectMap["nodeSize"] = bdprp.NodeSize - } - if bdprp.NodeSizeFamily != "" { - objectMap["nodeSizeFamily"] = bdprp.NodeSizeFamily - } - return json.Marshal(objectMap) -} - -// BigDataPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BigDataPoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BigDataPoolsClient) (BigDataPoolResourceInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BigDataPoolsCreateOrUpdateFuture) 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 BigDataPoolsCreateOrUpdateFuture.Result. -func (future *BigDataPoolsCreateOrUpdateFuture) result(client BigDataPoolsClient) (bdpri BigDataPoolResourceInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bdpri.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.BigDataPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bdpri.Response.Response, err = future.GetResult(sender); err == nil && bdpri.Response.Response.StatusCode != http.StatusNoContent { - bdpri, err = client.CreateOrUpdateResponder(bdpri.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsCreateOrUpdateFuture", "Result", bdpri.Response.Response, "Failure responding to request") - } - } - return -} - -// BigDataPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BigDataPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BigDataPoolsClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BigDataPoolsDeleteFuture) 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 BigDataPoolsDeleteFuture.Result. -func (future *BigDataPoolsDeleteFuture) result(client BigDataPoolsClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.BigDataPoolsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.DeleteResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.BigDataPoolsDeleteFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// CheckNameAvailabilityRequest a request about whether a workspace name is available -type CheckNameAvailabilityRequest struct { - // Name - Workspace name - Name *string `json:"name,omitempty"` - // Type - Type: workspace - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResponse a response saying whether the workspace name is available -type CheckNameAvailabilityResponse struct { - autorest.Response `json:"-"` - // Message - Validation message - Message *string `json:"message,omitempty"` - // Available - Whether the workspace name is available - Available *bool `json:"available,omitempty"` - // Reason - Reason the workspace name is or is not available - Reason *string `json:"reason,omitempty"` - // Name - Workspace name - Name *string `json:"name,omitempty"` -} - -// CmdkeySetup the custom setup of running cmdkey commands. -type CmdkeySetup struct { - // CmdkeySetupTypeProperties - Cmdkey command custom setup type properties. - *CmdkeySetupTypeProperties `json:"typeProperties,omitempty"` - // Type - Possible values include: 'TypeBasicCustomSetupBaseTypeCustomSetupBase', 'TypeBasicCustomSetupBaseTypeCmdkeySetup', 'TypeBasicCustomSetupBaseTypeEnvironmentVariableSetup', 'TypeBasicCustomSetupBaseTypeComponentSetup' - Type TypeBasicCustomSetupBase `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for CmdkeySetup. -func (cs CmdkeySetup) MarshalJSON() ([]byte, error) { - cs.Type = TypeBasicCustomSetupBaseTypeCmdkeySetup - objectMap := make(map[string]interface{}) - if cs.CmdkeySetupTypeProperties != nil { - objectMap["typeProperties"] = cs.CmdkeySetupTypeProperties - } - if cs.Type != "" { - objectMap["type"] = cs.Type - } - return json.Marshal(objectMap) -} - -// AsCmdkeySetup is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsCmdkeySetup() (*CmdkeySetup, bool) { - return &cs, true -} - -// AsEnvironmentVariableSetup is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) { - return nil, false -} - -// AsComponentSetup is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsComponentSetup() (*ComponentSetup, bool) { - return nil, false -} - -// AsCustomSetupBase is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsCustomSetupBase() (*CustomSetupBase, bool) { - return nil, false -} - -// AsBasicCustomSetupBase is the BasicCustomSetupBase implementation for CmdkeySetup. -func (cs CmdkeySetup) AsBasicCustomSetupBase() (BasicCustomSetupBase, bool) { - return &cs, true -} - -// UnmarshalJSON is the custom unmarshaler for CmdkeySetup struct. -func (cs *CmdkeySetup) 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 "typeProperties": - if v != nil { - var cmdkeySetupTypeProperties CmdkeySetupTypeProperties - err = json.Unmarshal(*v, &cmdkeySetupTypeProperties) - if err != nil { - return err - } - cs.CmdkeySetupTypeProperties = &cmdkeySetupTypeProperties - } - case "type": - if v != nil { - var typeVar TypeBasicCustomSetupBase - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cs.Type = typeVar - } - } - } - - return nil -} - -// CmdkeySetupTypeProperties cmdkey command custom setup type properties. -type CmdkeySetupTypeProperties struct { - // TargetName - The server name of data source access. - TargetName interface{} `json:"targetName,omitempty"` - // UserName - The user name of data source access. - UserName interface{} `json:"userName,omitempty"` - // Password - The password of data source access. - Password BasicSecretBase `json:"password,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for CmdkeySetupTypeProperties struct. -func (cstp *CmdkeySetupTypeProperties) 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 "targetName": - if v != nil { - var targetName interface{} - err = json.Unmarshal(*v, &targetName) - if err != nil { - return err - } - cstp.TargetName = targetName - } - case "userName": - if v != nil { - var userName interface{} - err = json.Unmarshal(*v, &userName) - if err != nil { - return err - } - cstp.UserName = userName - } - case "password": - if v != nil { - password, err := unmarshalBasicSecretBase(*v) - if err != nil { - return err - } - cstp.Password = password - } - } - } - - return nil -} - -// ComponentSetup the custom setup of installing 3rd party components. -type ComponentSetup struct { - // LicensedComponentSetupTypeProperties - Install 3rd party component type properties. - *LicensedComponentSetupTypeProperties `json:"typeProperties,omitempty"` - // Type - Possible values include: 'TypeBasicCustomSetupBaseTypeCustomSetupBase', 'TypeBasicCustomSetupBaseTypeCmdkeySetup', 'TypeBasicCustomSetupBaseTypeEnvironmentVariableSetup', 'TypeBasicCustomSetupBaseTypeComponentSetup' - Type TypeBasicCustomSetupBase `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ComponentSetup. -func (cs ComponentSetup) MarshalJSON() ([]byte, error) { - cs.Type = TypeBasicCustomSetupBaseTypeComponentSetup - objectMap := make(map[string]interface{}) - if cs.LicensedComponentSetupTypeProperties != nil { - objectMap["typeProperties"] = cs.LicensedComponentSetupTypeProperties - } - if cs.Type != "" { - objectMap["type"] = cs.Type - } - return json.Marshal(objectMap) -} - -// AsCmdkeySetup is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsCmdkeySetup() (*CmdkeySetup, bool) { - return nil, false -} - -// AsEnvironmentVariableSetup is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) { - return nil, false -} - -// AsComponentSetup is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsComponentSetup() (*ComponentSetup, bool) { - return &cs, true -} - -// AsCustomSetupBase is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsCustomSetupBase() (*CustomSetupBase, bool) { - return nil, false -} - -// AsBasicCustomSetupBase is the BasicCustomSetupBase implementation for ComponentSetup. -func (cs ComponentSetup) AsBasicCustomSetupBase() (BasicCustomSetupBase, bool) { - return &cs, true -} - -// UnmarshalJSON is the custom unmarshaler for ComponentSetup struct. -func (cs *ComponentSetup) 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 "typeProperties": - if v != nil { - var licensedComponentSetupTypeProperties LicensedComponentSetupTypeProperties - err = json.Unmarshal(*v, &licensedComponentSetupTypeProperties) - if err != nil { - return err - } - cs.LicensedComponentSetupTypeProperties = &licensedComponentSetupTypeProperties - } - case "type": - if v != nil { - var typeVar TypeBasicCustomSetupBase - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cs.Type = typeVar - } - } - } - - return nil -} - -// CreateSQLPoolRestorePointDefinition contains the information necessary to perform a create Sql pool -// restore point operation. -type CreateSQLPoolRestorePointDefinition struct { - // RestorePointLabel - The restore point label to apply - RestorePointLabel *string `json:"restorePointLabel,omitempty"` -} - -// CspWorkspaceAdminProperties initial workspace AAD admin properties for a CSP subscription -type CspWorkspaceAdminProperties struct { - // InitialWorkspaceAdminObjectID - AAD object ID of initial workspace admin - InitialWorkspaceAdminObjectID *string `json:"initialWorkspaceAdminObjectId,omitempty"` -} - -// CustomerManagedKeyDetails details of the customer managed key associated with the workspace -type CustomerManagedKeyDetails struct { - // Status - READ-ONLY; The customer managed key status on the workspace - Status *string `json:"status,omitempty"` - // Key - The key object of the workspace - Key *WorkspaceKeyDetails `json:"key,omitempty"` - // KekIdentity - Key encryption key - KekIdentity *KekIdentityProperties `json:"kekIdentity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomerManagedKeyDetails. -func (cmkd CustomerManagedKeyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cmkd.Key != nil { - objectMap["key"] = cmkd.Key - } - if cmkd.KekIdentity != nil { - objectMap["kekIdentity"] = cmkd.KekIdentity - } - return json.Marshal(objectMap) -} - -// BasicCustomSetupBase the base definition of the custom setup. -type BasicCustomSetupBase interface { - AsCmdkeySetup() (*CmdkeySetup, bool) - AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) - AsComponentSetup() (*ComponentSetup, bool) - AsCustomSetupBase() (*CustomSetupBase, bool) -} - -// CustomSetupBase the base definition of the custom setup. -type CustomSetupBase struct { - // Type - Possible values include: 'TypeBasicCustomSetupBaseTypeCustomSetupBase', 'TypeBasicCustomSetupBaseTypeCmdkeySetup', 'TypeBasicCustomSetupBaseTypeEnvironmentVariableSetup', 'TypeBasicCustomSetupBaseTypeComponentSetup' - Type TypeBasicCustomSetupBase `json:"type,omitempty"` -} - -func unmarshalBasicCustomSetupBase(body []byte) (BasicCustomSetupBase, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicCustomSetupBaseTypeCmdkeySetup): - var cs CmdkeySetup - err := json.Unmarshal(body, &cs) - return cs, err - case string(TypeBasicCustomSetupBaseTypeEnvironmentVariableSetup): - var evs EnvironmentVariableSetup - err := json.Unmarshal(body, &evs) - return evs, err - case string(TypeBasicCustomSetupBaseTypeComponentSetup): - var cs ComponentSetup - err := json.Unmarshal(body, &cs) - return cs, err - default: - var csb CustomSetupBase - err := json.Unmarshal(body, &csb) - return csb, err - } -} -func unmarshalBasicCustomSetupBaseArray(body []byte) ([]BasicCustomSetupBase, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - csbArray := make([]BasicCustomSetupBase, len(rawMessages)) - - for index, rawMessage := range rawMessages { - csb, err := unmarshalBasicCustomSetupBase(*rawMessage) - if err != nil { - return nil, err - } - csbArray[index] = csb - } - return csbArray, nil -} - -// MarshalJSON is the custom marshaler for CustomSetupBase. -func (csb CustomSetupBase) MarshalJSON() ([]byte, error) { - csb.Type = TypeBasicCustomSetupBaseTypeCustomSetupBase - objectMap := make(map[string]interface{}) - if csb.Type != "" { - objectMap["type"] = csb.Type - } - return json.Marshal(objectMap) -} - -// AsCmdkeySetup is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsCmdkeySetup() (*CmdkeySetup, bool) { - return nil, false -} - -// AsEnvironmentVariableSetup is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) { - return nil, false -} - -// AsComponentSetup is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsComponentSetup() (*ComponentSetup, bool) { - return nil, false -} - -// AsCustomSetupBase is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsCustomSetupBase() (*CustomSetupBase, bool) { - return &csb, true -} - -// AsBasicCustomSetupBase is the BasicCustomSetupBase implementation for CustomSetupBase. -func (csb CustomSetupBase) AsBasicCustomSetupBase() (BasicCustomSetupBase, bool) { - return &csb, true -} - -// DataLakeStorageAccountDetails details of the data lake storage account associated with the workspace -type DataLakeStorageAccountDetails struct { - // AccountURL - Account URL - AccountURL *string `json:"accountUrl,omitempty"` - // Filesystem - Filesystem name - Filesystem *string `json:"filesystem,omitempty"` - // ResourceID - ARM resource Id of this storage account - ResourceID *string `json:"resourceId,omitempty"` - // CreateManagedPrivateEndpoint - Create managed private endpoint to this storage account or not - CreateManagedPrivateEndpoint *bool `json:"createManagedPrivateEndpoint,omitempty"` -} - -// DataMaskingPolicy ... -type DataMaskingPolicy struct { - autorest.Response `json:"-"` - // DataMaskingPolicyProperties - The properties of the data masking policy. - *DataMaskingPolicyProperties `json:"properties,omitempty"` - // Location - READ-ONLY; The location of the data masking policy. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; The kind of data masking policy. Metadata, used for Azure portal. - Kind *string `json:"kind,omitempty"` - // ManagedBy - READ-ONLY; Fully qualified resource ID of the sql pool - ManagedBy *string `json:"managedBy,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 DataMaskingPolicy. -func (dmp DataMaskingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmp.DataMaskingPolicyProperties != nil { - objectMap["properties"] = dmp.DataMaskingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataMaskingPolicy struct. -func (dmp *DataMaskingPolicy) 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 dataMaskingPolicyProperties DataMaskingPolicyProperties - err = json.Unmarshal(*v, &dataMaskingPolicyProperties) - if err != nil { - return err - } - dmp.DataMaskingPolicyProperties = &dataMaskingPolicyProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dmp.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dmp.Kind = &kind - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - dmp.ManagedBy = &managedBy - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dmp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dmp.Type = &typeVar - } - } - } - - return nil -} - -// DataMaskingPolicyProperties the properties of a database data masking policy. -type DataMaskingPolicyProperties struct { - // DataMaskingState - The state of the data masking policy. Possible values include: 'DataMaskingStateDisabled', 'DataMaskingStateEnabled' - DataMaskingState DataMaskingState `json:"dataMaskingState,omitempty"` - // ExemptPrincipals - The list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. - ExemptPrincipals *string `json:"exemptPrincipals,omitempty"` - // ApplicationPrincipals - READ-ONLY; The list of the application principals. This is a legacy parameter and is no longer used. - ApplicationPrincipals *string `json:"applicationPrincipals,omitempty"` - // MaskingLevel - READ-ONLY; The masking level. This is a legacy parameter and is no longer used. - MaskingLevel *string `json:"maskingLevel,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataMaskingPolicyProperties. -func (dmpp DataMaskingPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmpp.DataMaskingState != "" { - objectMap["dataMaskingState"] = dmpp.DataMaskingState - } - if dmpp.ExemptPrincipals != nil { - objectMap["exemptPrincipals"] = dmpp.ExemptPrincipals - } - return json.Marshal(objectMap) -} - -// DataMaskingRule represents a Sql pool data masking rule. -type DataMaskingRule struct { - autorest.Response `json:"-"` - // DataMaskingRuleProperties - The properties of the resource. - *DataMaskingRuleProperties `json:"properties,omitempty"` - // Location - READ-ONLY; The location of the data masking rule. - Location *string `json:"location,omitempty"` - // Kind - READ-ONLY; The kind of Data Masking Rule. Metadata, used for Azure portal. - Kind *string `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"` -} - -// MarshalJSON is the custom marshaler for DataMaskingRule. -func (dmr DataMaskingRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmr.DataMaskingRuleProperties != nil { - objectMap["properties"] = dmr.DataMaskingRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataMaskingRule struct. -func (dmr *DataMaskingRule) 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 dataMaskingRuleProperties DataMaskingRuleProperties - err = json.Unmarshal(*v, &dataMaskingRuleProperties) - if err != nil { - return err - } - dmr.DataMaskingRuleProperties = &dataMaskingRuleProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dmr.Location = &location - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dmr.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dmr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dmr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dmr.Type = &typeVar - } - } - } - - return nil -} - -// DataMaskingRuleListResult the response to a list data masking rules request. -type DataMaskingRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of Sql pool data masking rules. - Value *[]DataMaskingRule `json:"value,omitempty"` -} - -// DataMaskingRuleProperties the properties of a Sql pool data masking rule. -type DataMaskingRuleProperties struct { - // ID - READ-ONLY; The rule Id. - ID *string `json:"id,omitempty"` - // AliasName - The alias name. This is a legacy parameter and is no longer used. - AliasName *string `json:"aliasName,omitempty"` - // RuleState - The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: 'DataMaskingRuleStateDisabled', 'DataMaskingRuleStateEnabled' - RuleState DataMaskingRuleState `json:"ruleState,omitempty"` - // SchemaName - The schema name on which the data masking rule is applied. - SchemaName *string `json:"schemaName,omitempty"` - // TableName - The table name on which the data masking rule is applied. - TableName *string `json:"tableName,omitempty"` - // ColumnName - The column name on which the data masking rule is applied. - ColumnName *string `json:"columnName,omitempty"` - // MaskingFunction - The masking function that is used for the data masking rule. Possible values include: 'DataMaskingFunctionDefault', 'DataMaskingFunctionCCN', 'DataMaskingFunctionEmail', 'DataMaskingFunctionNumber', 'DataMaskingFunctionSSN', 'DataMaskingFunctionText' - MaskingFunction DataMaskingFunction `json:"maskingFunction,omitempty"` - // NumberFrom - The numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. - NumberFrom *string `json:"numberFrom,omitempty"` - // NumberTo - The numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. - NumberTo *string `json:"numberTo,omitempty"` - // PrefixSize - If maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, this parameter will be ignored. - PrefixSize *string `json:"prefixSize,omitempty"` - // SuffixSize - If maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this parameter will be ignored. - SuffixSize *string `json:"suffixSize,omitempty"` - // ReplacementString - If maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. - ReplacementString *string `json:"replacementString,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataMaskingRuleProperties. -func (dmrp DataMaskingRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dmrp.AliasName != nil { - objectMap["aliasName"] = dmrp.AliasName - } - if dmrp.RuleState != "" { - objectMap["ruleState"] = dmrp.RuleState - } - if dmrp.SchemaName != nil { - objectMap["schemaName"] = dmrp.SchemaName - } - if dmrp.TableName != nil { - objectMap["tableName"] = dmrp.TableName - } - if dmrp.ColumnName != nil { - objectMap["columnName"] = dmrp.ColumnName - } - if dmrp.MaskingFunction != "" { - objectMap["maskingFunction"] = dmrp.MaskingFunction - } - if dmrp.NumberFrom != nil { - objectMap["numberFrom"] = dmrp.NumberFrom - } - if dmrp.NumberTo != nil { - objectMap["numberTo"] = dmrp.NumberTo - } - if dmrp.PrefixSize != nil { - objectMap["prefixSize"] = dmrp.PrefixSize - } - if dmrp.SuffixSize != nil { - objectMap["suffixSize"] = dmrp.SuffixSize - } - if dmrp.ReplacementString != nil { - objectMap["replacementString"] = dmrp.ReplacementString - } - return json.Marshal(objectMap) -} - -// DataWarehouseUserActivities user activities of a data warehouse -type DataWarehouseUserActivities struct { - autorest.Response `json:"-"` - // DataWarehouseUserActivitiesProperties - Resource properties. - *DataWarehouseUserActivitiesProperties `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 DataWarehouseUserActivities. -func (dwua DataWarehouseUserActivities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dwua.DataWarehouseUserActivitiesProperties != nil { - objectMap["properties"] = dwua.DataWarehouseUserActivitiesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DataWarehouseUserActivities struct. -func (dwua *DataWarehouseUserActivities) 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 dataWarehouseUserActivitiesProperties DataWarehouseUserActivitiesProperties - err = json.Unmarshal(*v, &dataWarehouseUserActivitiesProperties) - if err != nil { - return err - } - dwua.DataWarehouseUserActivitiesProperties = &dataWarehouseUserActivitiesProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dwua.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dwua.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dwua.Type = &typeVar - } - } - } - - return nil -} - -// DataWarehouseUserActivitiesProperties user activities of a data warehouse. This currently includes the -// count of running or suspended queries. For more information, please view the sys.dm_pdw_exec_requests -// dynamic management view (DMV). -type DataWarehouseUserActivitiesProperties struct { - // ActiveQueriesCount - READ-ONLY; Count of running and suspended queries. - ActiveQueriesCount *int32 `json:"activeQueriesCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataWarehouseUserActivitiesProperties. -func (dwuap DataWarehouseUserActivitiesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DynamicExecutorAllocation dynamic Executor Allocation Properties -type DynamicExecutorAllocation struct { - // Enabled - Indicates whether Dynamic Executor Allocation is enabled or not. - Enabled *bool `json:"enabled,omitempty"` -} - -// EncryptionDetails details of the encryption associated with the workspace -type EncryptionDetails struct { - // DoubleEncryptionEnabled - READ-ONLY; Double Encryption enabled - DoubleEncryptionEnabled *bool `json:"doubleEncryptionEnabled,omitempty"` - // Cmk - Customer Managed Key Details - Cmk *CustomerManagedKeyDetails `json:"cmk,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionDetails. -func (ed EncryptionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ed.Cmk != nil { - objectMap["cmk"] = ed.Cmk - } - return json.Marshal(objectMap) -} - -// EncryptionProtector the server encryption protector. -type EncryptionProtector struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // EncryptionProtectorProperties - Resource properties. - *EncryptionProtectorProperties `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 EncryptionProtector. -func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.EncryptionProtectorProperties != nil { - objectMap["properties"] = ep.EncryptionProtectorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EncryptionProtector struct. -func (ep *EncryptionProtector) 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 - } - ep.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ep.Location = &location - } - case "properties": - if v != nil { - var encryptionProtectorProperties EncryptionProtectorProperties - err = json.Unmarshal(*v, &encryptionProtectorProperties) - if err != nil { - return err - } - ep.EncryptionProtectorProperties = &encryptionProtectorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - } - } - - return nil -} - -// EncryptionProtectorListResult a list of server encryption protectors. -type EncryptionProtectorListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]EncryptionProtector `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionProtectorListResult. -func (eplr EncryptionProtectorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EncryptionProtectorListResultIterator provides access to a complete listing of EncryptionProtector -// values. -type EncryptionProtectorListResultIterator struct { - i int - page EncryptionProtectorListResultPage -} - -// 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 *EncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultIterator.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 *EncryptionProtectorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EncryptionProtectorListResultIterator) 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 EncryptionProtectorListResultIterator) Response() EncryptionProtectorListResult { - 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 EncryptionProtectorListResultIterator) Value() EncryptionProtector { - if !iter.page.NotDone() { - return EncryptionProtector{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EncryptionProtectorListResultIterator type. -func NewEncryptionProtectorListResultIterator(page EncryptionProtectorListResultPage) EncryptionProtectorListResultIterator { - return EncryptionProtectorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eplr EncryptionProtectorListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eplr EncryptionProtectorListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 -} - -// encryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eplr EncryptionProtectorListResult) encryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) -} - -// EncryptionProtectorListResultPage contains a page of EncryptionProtector values. -type EncryptionProtectorListResultPage struct { - fn func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error) - eplr EncryptionProtectorListResult -} - -// 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 *EncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultPage.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.eplr) - if err != nil { - return err - } - page.eplr = 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 *EncryptionProtectorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EncryptionProtectorListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EncryptionProtectorListResultPage) Response() EncryptionProtectorListResult { - return page.eplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EncryptionProtectorListResultPage) Values() []EncryptionProtector { - if page.eplr.IsEmpty() { - return nil - } - return *page.eplr.Value -} - -// Creates a new instance of the EncryptionProtectorListResultPage type. -func NewEncryptionProtectorListResultPage(cur EncryptionProtectorListResult, getNextPage func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error)) EncryptionProtectorListResultPage { - return EncryptionProtectorListResultPage{ - fn: getNextPage, - eplr: cur, - } -} - -// EncryptionProtectorProperties properties for an encryption protector execution. -type EncryptionProtectorProperties struct { - // Subregion - READ-ONLY; Subregion of the encryption protector. - Subregion *string `json:"subregion,omitempty"` - // ServerKeyName - The name of the server key. - ServerKeyName *string `json:"serverKeyName,omitempty"` - // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServerKeyTypeServiceManaged', 'ServerKeyTypeAzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - READ-ONLY; The URI of the server key. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionProtectorProperties. -func (epp EncryptionProtectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epp.ServerKeyName != nil { - objectMap["serverKeyName"] = epp.ServerKeyName - } - if epp.ServerKeyType != "" { - objectMap["serverKeyType"] = epp.ServerKeyType - } - return json.Marshal(objectMap) -} - -// EntityReference the entity reference. -type EntityReference struct { - // Type - The type of this referenced entity. Possible values include: 'IntegrationRuntimeEntityReferenceTypeIntegrationRuntimeReference', 'IntegrationRuntimeEntityReferenceTypeLinkedServiceReference' - Type IntegrationRuntimeEntityReferenceType `json:"type,omitempty"` - // ReferenceName - The name of this referenced entity. - ReferenceName *string `json:"referenceName,omitempty"` -} - -// EnvironmentVariableSetup the custom setup of setting environment variable. -type EnvironmentVariableSetup struct { - // EnvironmentVariableSetupTypeProperties - Add environment variable type properties. - *EnvironmentVariableSetupTypeProperties `json:"typeProperties,omitempty"` - // Type - Possible values include: 'TypeBasicCustomSetupBaseTypeCustomSetupBase', 'TypeBasicCustomSetupBaseTypeCmdkeySetup', 'TypeBasicCustomSetupBaseTypeEnvironmentVariableSetup', 'TypeBasicCustomSetupBaseTypeComponentSetup' - Type TypeBasicCustomSetupBase `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) MarshalJSON() ([]byte, error) { - evs.Type = TypeBasicCustomSetupBaseTypeEnvironmentVariableSetup - objectMap := make(map[string]interface{}) - if evs.EnvironmentVariableSetupTypeProperties != nil { - objectMap["typeProperties"] = evs.EnvironmentVariableSetupTypeProperties - } - if evs.Type != "" { - objectMap["type"] = evs.Type - } - return json.Marshal(objectMap) -} - -// AsCmdkeySetup is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsCmdkeySetup() (*CmdkeySetup, bool) { - return nil, false -} - -// AsEnvironmentVariableSetup is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsEnvironmentVariableSetup() (*EnvironmentVariableSetup, bool) { - return &evs, true -} - -// AsComponentSetup is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsComponentSetup() (*ComponentSetup, bool) { - return nil, false -} - -// AsCustomSetupBase is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsCustomSetupBase() (*CustomSetupBase, bool) { - return nil, false -} - -// AsBasicCustomSetupBase is the BasicCustomSetupBase implementation for EnvironmentVariableSetup. -func (evs EnvironmentVariableSetup) AsBasicCustomSetupBase() (BasicCustomSetupBase, bool) { - return &evs, true -} - -// UnmarshalJSON is the custom unmarshaler for EnvironmentVariableSetup struct. -func (evs *EnvironmentVariableSetup) 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 "typeProperties": - if v != nil { - var environmentVariableSetupTypeProperties EnvironmentVariableSetupTypeProperties - err = json.Unmarshal(*v, &environmentVariableSetupTypeProperties) - if err != nil { - return err - } - evs.EnvironmentVariableSetupTypeProperties = &environmentVariableSetupTypeProperties - } - case "type": - if v != nil { - var typeVar TypeBasicCustomSetupBase - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - evs.Type = typeVar - } - } - } - - return nil -} - -// EnvironmentVariableSetupTypeProperties environment variable custom setup type properties. -type EnvironmentVariableSetupTypeProperties struct { - // VariableName - The name of the environment variable. - VariableName *string `json:"variableName,omitempty"` - // VariableValue - The value of the environment variable. - VariableValue *string `json:"variableValue,omitempty"` -} - -// 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 common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.). -type ErrorResponse struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// ExtendedServerBlobAuditingPolicy an extended server blob auditing policy. -type ExtendedServerBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ExtendedServerBlobAuditingPolicyProperties - Resource properties. - *ExtendedServerBlobAuditingPolicyProperties `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 ExtendedServerBlobAuditingPolicy. -func (esbap ExtendedServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if esbap.ExtendedServerBlobAuditingPolicyProperties != nil { - objectMap["properties"] = esbap.ExtendedServerBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExtendedServerBlobAuditingPolicy struct. -func (esbap *ExtendedServerBlobAuditingPolicy) 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 extendedServerBlobAuditingPolicyProperties ExtendedServerBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &extendedServerBlobAuditingPolicyProperties) - if err != nil { - return err - } - esbap.ExtendedServerBlobAuditingPolicyProperties = &extendedServerBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - esbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - esbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - esbap.Type = &typeVar - } - } - } - - return nil -} - -// ExtendedServerBlobAuditingPolicyListResult a list of server extended auditing settings. -type ExtendedServerBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ExtendedServerBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicyListResult. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExtendedServerBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ExtendedServerBlobAuditingPolicy values. -type ExtendedServerBlobAuditingPolicyListResultIterator struct { - i int - page ExtendedServerBlobAuditingPolicyListResultPage -} - -// 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 *ExtendedServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultIterator.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 *ExtendedServerBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExtendedServerBlobAuditingPolicyListResultIterator) 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 ExtendedServerBlobAuditingPolicyListResultIterator) Response() ExtendedServerBlobAuditingPolicyListResult { - 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 ExtendedServerBlobAuditingPolicyListResultIterator) Value() ExtendedServerBlobAuditingPolicy { - if !iter.page.NotDone() { - return ExtendedServerBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultIterator type. -func NewExtendedServerBlobAuditingPolicyListResultIterator(page ExtendedServerBlobAuditingPolicyListResultPage) ExtendedServerBlobAuditingPolicyListResultIterator { - return ExtendedServerBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) IsEmpty() bool { - return esbaplr.Value == nil || len(*esbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) hasNextLink() bool { - return esbaplr.NextLink != nil && len(*esbaplr.NextLink) != 0 -} - -// extendedServerBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) extendedServerBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !esbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(esbaplr.NextLink))) -} - -// ExtendedServerBlobAuditingPolicyListResultPage contains a page of ExtendedServerBlobAuditingPolicy -// values. -type ExtendedServerBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error) - esbaplr ExtendedServerBlobAuditingPolicyListResult -} - -// 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 *ExtendedServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultPage.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.esbaplr) - if err != nil { - return err - } - page.esbaplr = 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 *ExtendedServerBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExtendedServerBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.esbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExtendedServerBlobAuditingPolicyListResultPage) Response() ExtendedServerBlobAuditingPolicyListResult { - return page.esbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExtendedServerBlobAuditingPolicyListResultPage) Values() []ExtendedServerBlobAuditingPolicy { - if page.esbaplr.IsEmpty() { - return nil - } - return *page.esbaplr.Value -} - -// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultPage type. -func NewExtendedServerBlobAuditingPolicyListResultPage(cur ExtendedServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error)) ExtendedServerBlobAuditingPolicyListResultPage { - return ExtendedServerBlobAuditingPolicyListResultPage{ - fn: getNextPage, - esbaplr: cur, - } -} - -// ExtendedServerBlobAuditingPolicyProperties properties of an extended server blob auditing policy. -type ExtendedServerBlobAuditingPolicyProperties struct { - // PredicateExpression - Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// ExtendedSQLPoolBlobAuditingPolicy an extended Sql pool blob auditing policy. -type ExtendedSQLPoolBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ExtendedSQLPoolBlobAuditingPolicyProperties - Resource properties. - *ExtendedSQLPoolBlobAuditingPolicyProperties `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 ExtendedSQLPoolBlobAuditingPolicy. -func (espbap ExtendedSQLPoolBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if espbap.ExtendedSQLPoolBlobAuditingPolicyProperties != nil { - objectMap["properties"] = espbap.ExtendedSQLPoolBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExtendedSQLPoolBlobAuditingPolicy struct. -func (espbap *ExtendedSQLPoolBlobAuditingPolicy) 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 extendedSQLPoolBlobAuditingPolicyProperties ExtendedSQLPoolBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &extendedSQLPoolBlobAuditingPolicyProperties) - if err != nil { - return err - } - espbap.ExtendedSQLPoolBlobAuditingPolicyProperties = &extendedSQLPoolBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - espbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - espbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - espbap.Type = &typeVar - } - } - } - - return nil -} - -// ExtendedSQLPoolBlobAuditingPolicyListResult a list of sql pool extended auditing settings. -type ExtendedSQLPoolBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ExtendedSQLPoolBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExtendedSQLPoolBlobAuditingPolicyListResult. -func (espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExtendedSQLPoolBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ExtendedSQLPoolBlobAuditingPolicy values. -type ExtendedSQLPoolBlobAuditingPolicyListResultIterator struct { - i int - page ExtendedSQLPoolBlobAuditingPolicyListResultPage -} - -// 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 *ExtendedSQLPoolBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPolicyListResultIterator.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 *ExtendedSQLPoolBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExtendedSQLPoolBlobAuditingPolicyListResultIterator) 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 ExtendedSQLPoolBlobAuditingPolicyListResultIterator) Response() ExtendedSQLPoolBlobAuditingPolicyListResult { - 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 ExtendedSQLPoolBlobAuditingPolicyListResultIterator) Value() ExtendedSQLPoolBlobAuditingPolicy { - if !iter.page.NotDone() { - return ExtendedSQLPoolBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExtendedSQLPoolBlobAuditingPolicyListResultIterator type. -func NewExtendedSQLPoolBlobAuditingPolicyListResultIterator(page ExtendedSQLPoolBlobAuditingPolicyListResultPage) ExtendedSQLPoolBlobAuditingPolicyListResultIterator { - return ExtendedSQLPoolBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult) IsEmpty() bool { - return espbaplr.Value == nil || len(*espbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult) hasNextLink() bool { - return espbaplr.NextLink != nil && len(*espbaplr.NextLink) != 0 -} - -// extendedSQLPoolBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult) extendedSQLPoolBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !espbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(espbaplr.NextLink))) -} - -// ExtendedSQLPoolBlobAuditingPolicyListResultPage contains a page of ExtendedSQLPoolBlobAuditingPolicy -// values. -type ExtendedSQLPoolBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ExtendedSQLPoolBlobAuditingPolicyListResult) (ExtendedSQLPoolBlobAuditingPolicyListResult, error) - espbaplr ExtendedSQLPoolBlobAuditingPolicyListResult -} - -// 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 *ExtendedSQLPoolBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedSQLPoolBlobAuditingPolicyListResultPage.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.espbaplr) - if err != nil { - return err - } - page.espbaplr = 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 *ExtendedSQLPoolBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExtendedSQLPoolBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.espbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExtendedSQLPoolBlobAuditingPolicyListResultPage) Response() ExtendedSQLPoolBlobAuditingPolicyListResult { - return page.espbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExtendedSQLPoolBlobAuditingPolicyListResultPage) Values() []ExtendedSQLPoolBlobAuditingPolicy { - if page.espbaplr.IsEmpty() { - return nil - } - return *page.espbaplr.Value -} - -// Creates a new instance of the ExtendedSQLPoolBlobAuditingPolicyListResultPage type. -func NewExtendedSQLPoolBlobAuditingPolicyListResultPage(cur ExtendedSQLPoolBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedSQLPoolBlobAuditingPolicyListResult) (ExtendedSQLPoolBlobAuditingPolicyListResult, error)) ExtendedSQLPoolBlobAuditingPolicyListResultPage { - return ExtendedSQLPoolBlobAuditingPolicyListResultPage{ - fn: getNextPage, - espbaplr: cur, - } -} - -// ExtendedSQLPoolBlobAuditingPolicyProperties properties of an extended Sql pool blob auditing policy. -type ExtendedSQLPoolBlobAuditingPolicyProperties struct { - // PredicateExpression - Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// GeoBackupPolicy a database geo backup policy. -type GeoBackupPolicy struct { - autorest.Response `json:"-"` - // GeoBackupPolicyProperties - The properties of the geo backup policy. - *GeoBackupPolicyProperties `json:"properties,omitempty"` - // Kind - READ-ONLY; Kind of geo backup policy. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Backup policy location. - 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 GeoBackupPolicy. -func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gbp.GeoBackupPolicyProperties != nil { - objectMap["properties"] = gbp.GeoBackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GeoBackupPolicy struct. -func (gbp *GeoBackupPolicy) 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 geoBackupPolicyProperties GeoBackupPolicyProperties - err = json.Unmarshal(*v, &geoBackupPolicyProperties) - if err != nil { - return err - } - gbp.GeoBackupPolicyProperties = &geoBackupPolicyProperties - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - gbp.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gbp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gbp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gbp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gbp.Type = &typeVar - } - } - } - - return nil -} - -// GeoBackupPolicyListResult the response to a list geo backup policies request. -type GeoBackupPolicyListResult struct { - autorest.Response `json:"-"` - // Value - The list of geo backup policies. - Value *[]GeoBackupPolicy `json:"value,omitempty"` -} - -// GeoBackupPolicyProperties the properties of the geo backup policy. -type GeoBackupPolicyProperties struct { - // State - The state of the geo backup policy. Possible values include: 'GeoBackupPolicyStateDisabled', 'GeoBackupPolicyStateEnabled' - State GeoBackupPolicyState `json:"state,omitempty"` - // StorageType - READ-ONLY; The storage type of the geo backup policy. - StorageType *string `json:"storageType,omitempty"` -} - -// MarshalJSON is the custom marshaler for GeoBackupPolicyProperties. -func (gbpp GeoBackupPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gbpp.State != "" { - objectMap["state"] = gbpp.State - } - return json.Marshal(objectMap) -} - -// GetSsisObjectMetadataRequest the request payload of get SSIS object metadata. -type GetSsisObjectMetadataRequest struct { - // MetadataPath - Metadata path. - MetadataPath *string `json:"metadataPath,omitempty"` -} - -// BasicIntegrationRuntime azure Synapse nested object which serves as a compute resource for activities. -type BasicIntegrationRuntime interface { - AsManagedIntegrationRuntime() (*ManagedIntegrationRuntime, bool) - AsSelfHostedIntegrationRuntime() (*SelfHostedIntegrationRuntime, bool) - AsIntegrationRuntime() (*IntegrationRuntime, bool) -} - -// IntegrationRuntime azure Synapse nested object which serves as a compute resource for activities. -type IntegrationRuntime struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Description - Integration runtime description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeIntegrationRuntime', 'TypeManaged', 'TypeSelfHosted' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicIntegrationRuntime(body []byte) (BasicIntegrationRuntime, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeManaged): - var mir ManagedIntegrationRuntime - err := json.Unmarshal(body, &mir) - return mir, err - case string(TypeSelfHosted): - var shir SelfHostedIntegrationRuntime - err := json.Unmarshal(body, &shir) - return shir, err - default: - var ir IntegrationRuntime - err := json.Unmarshal(body, &ir) - return ir, err - } -} -func unmarshalBasicIntegrationRuntimeArray(body []byte) ([]BasicIntegrationRuntime, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - irArray := make([]BasicIntegrationRuntime, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ir, err := unmarshalBasicIntegrationRuntime(*rawMessage) - if err != nil { - return nil, err - } - irArray[index] = ir - } - return irArray, nil -} - -// MarshalJSON is the custom marshaler for IntegrationRuntime. -func (ir IntegrationRuntime) MarshalJSON() ([]byte, error) { - ir.Type = TypeIntegrationRuntime - objectMap := make(map[string]interface{}) - if ir.Description != nil { - objectMap["description"] = ir.Description - } - if ir.Type != "" { - objectMap["type"] = ir.Type - } - for k, v := range ir.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntime is the BasicIntegrationRuntime implementation for IntegrationRuntime. -func (ir IntegrationRuntime) AsManagedIntegrationRuntime() (*ManagedIntegrationRuntime, bool) { - return nil, false -} - -// AsSelfHostedIntegrationRuntime is the BasicIntegrationRuntime implementation for IntegrationRuntime. -func (ir IntegrationRuntime) AsSelfHostedIntegrationRuntime() (*SelfHostedIntegrationRuntime, bool) { - return nil, false -} - -// AsIntegrationRuntime is the BasicIntegrationRuntime implementation for IntegrationRuntime. -func (ir IntegrationRuntime) AsIntegrationRuntime() (*IntegrationRuntime, bool) { - return &ir, true -} - -// AsBasicIntegrationRuntime is the BasicIntegrationRuntime implementation for IntegrationRuntime. -func (ir IntegrationRuntime) AsBasicIntegrationRuntime() (BasicIntegrationRuntime, bool) { - return &ir, true -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntime struct. -func (ir *IntegrationRuntime) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ir.AdditionalProperties == nil { - ir.AdditionalProperties = make(map[string]interface{}) - } - ir.AdditionalProperties[k] = additionalProperties - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - ir.Description = &description - } - case "type": - if v != nil { - var typeVar Type - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ir.Type = typeVar - } - } - } - - return nil -} - -// IntegrationRuntimeAuthKeys the integration runtime authentication keys. -type IntegrationRuntimeAuthKeys struct { - autorest.Response `json:"-"` - // AuthKey1 - The primary integration runtime authentication key. - AuthKey1 *string `json:"authKey1,omitempty"` - // AuthKey2 - The secondary integration runtime authentication key. - AuthKey2 *string `json:"authKey2,omitempty"` -} - -// IntegrationRuntimeComputeProperties the compute resource properties for managed integration runtime. -type IntegrationRuntimeComputeProperties struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Location - The location for managed integration runtime. The supported regions could be found on https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities - Location *string `json:"location,omitempty"` - // NodeSize - The node size requirement to managed integration runtime. - NodeSize *string `json:"nodeSize,omitempty"` - // NumberOfNodes - The required number of nodes for managed integration runtime. - NumberOfNodes *int32 `json:"numberOfNodes,omitempty"` - // MaxParallelExecutionsPerNode - Maximum parallel executions count per node for managed integration runtime. - MaxParallelExecutionsPerNode *int32 `json:"maxParallelExecutionsPerNode,omitempty"` - // DataFlowProperties - Data flow properties for managed integration runtime. - DataFlowProperties *IntegrationRuntimeDataFlowProperties `json:"dataFlowProperties,omitempty"` - // VNetProperties - VNet properties for managed integration runtime. - VNetProperties *IntegrationRuntimeVNetProperties `json:"vNetProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeComputeProperties. -func (ircp IntegrationRuntimeComputeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ircp.Location != nil { - objectMap["location"] = ircp.Location - } - if ircp.NodeSize != nil { - objectMap["nodeSize"] = ircp.NodeSize - } - if ircp.NumberOfNodes != nil { - objectMap["numberOfNodes"] = ircp.NumberOfNodes - } - if ircp.MaxParallelExecutionsPerNode != nil { - objectMap["maxParallelExecutionsPerNode"] = ircp.MaxParallelExecutionsPerNode - } - if ircp.DataFlowProperties != nil { - objectMap["dataFlowProperties"] = ircp.DataFlowProperties - } - if ircp.VNetProperties != nil { - objectMap["vNetProperties"] = ircp.VNetProperties - } - for k, v := range ircp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeComputeProperties struct. -func (ircp *IntegrationRuntimeComputeProperties) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ircp.AdditionalProperties == nil { - ircp.AdditionalProperties = make(map[string]interface{}) - } - ircp.AdditionalProperties[k] = additionalProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ircp.Location = &location - } - case "nodeSize": - if v != nil { - var nodeSize string - err = json.Unmarshal(*v, &nodeSize) - if err != nil { - return err - } - ircp.NodeSize = &nodeSize - } - case "numberOfNodes": - if v != nil { - var numberOfNodes int32 - err = json.Unmarshal(*v, &numberOfNodes) - if err != nil { - return err - } - ircp.NumberOfNodes = &numberOfNodes - } - case "maxParallelExecutionsPerNode": - if v != nil { - var maxParallelExecutionsPerNode int32 - err = json.Unmarshal(*v, &maxParallelExecutionsPerNode) - if err != nil { - return err - } - ircp.MaxParallelExecutionsPerNode = &maxParallelExecutionsPerNode - } - case "dataFlowProperties": - if v != nil { - var dataFlowProperties IntegrationRuntimeDataFlowProperties - err = json.Unmarshal(*v, &dataFlowProperties) - if err != nil { - return err - } - ircp.DataFlowProperties = &dataFlowProperties - } - case "vNetProperties": - if v != nil { - var vNetProperties IntegrationRuntimeVNetProperties - err = json.Unmarshal(*v, &vNetProperties) - if err != nil { - return err - } - ircp.VNetProperties = &vNetProperties - } - } - } - - return nil -} - -// IntegrationRuntimeConnectionInfo connection information for encrypting the on-premises data source -// credentials. -type IntegrationRuntimeConnectionInfo struct { - autorest.Response `json:"-"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ServiceToken - READ-ONLY; The token generated in service. Callers use this token to authenticate to integration runtime. - ServiceToken *string `json:"serviceToken,omitempty"` - // IdentityCertThumbprint - READ-ONLY; The integration runtime SSL certificate thumbprint. Click-Once application uses it to do server validation. - IdentityCertThumbprint *string `json:"identityCertThumbprint,omitempty"` - // HostServiceURI - READ-ONLY; The on-premises integration runtime host URL. - HostServiceURI *string `json:"hostServiceUri,omitempty"` - // Version - READ-ONLY; The integration runtime version. - Version *string `json:"version,omitempty"` - // PublicKey - READ-ONLY; The public key for encrypting a credential when transferring the credential to the integration runtime. - PublicKey *string `json:"publicKey,omitempty"` - // IsIdentityCertExprired - READ-ONLY; Whether the identity certificate is expired. - IsIdentityCertExprired *bool `json:"isIdentityCertExprired,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeConnectionInfo. -func (irci IntegrationRuntimeConnectionInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - for k, v := range irci.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeConnectionInfo struct. -func (irci *IntegrationRuntimeConnectionInfo) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irci.AdditionalProperties == nil { - irci.AdditionalProperties = make(map[string]interface{}) - } - irci.AdditionalProperties[k] = additionalProperties - } - case "serviceToken": - if v != nil { - var serviceToken string - err = json.Unmarshal(*v, &serviceToken) - if err != nil { - return err - } - irci.ServiceToken = &serviceToken - } - case "identityCertThumbprint": - if v != nil { - var identityCertThumbprint string - err = json.Unmarshal(*v, &identityCertThumbprint) - if err != nil { - return err - } - irci.IdentityCertThumbprint = &identityCertThumbprint - } - case "hostServiceUri": - if v != nil { - var hostServiceURI string - err = json.Unmarshal(*v, &hostServiceURI) - if err != nil { - return err - } - irci.HostServiceURI = &hostServiceURI - } - case "version": - if v != nil { - var version string - err = json.Unmarshal(*v, &version) - if err != nil { - return err - } - irci.Version = &version - } - case "publicKey": - if v != nil { - var publicKey string - err = json.Unmarshal(*v, &publicKey) - if err != nil { - return err - } - irci.PublicKey = &publicKey - } - case "isIdentityCertExprired": - if v != nil { - var isIdentityCertExprired bool - err = json.Unmarshal(*v, &isIdentityCertExprired) - if err != nil { - return err - } - irci.IsIdentityCertExprired = &isIdentityCertExprired - } - } - } - - return nil -} - -// IntegrationRuntimeCustomSetupScriptProperties custom setup script properties for a managed dedicated -// integration runtime. -type IntegrationRuntimeCustomSetupScriptProperties struct { - // BlobContainerURI - The URI of the Azure blob container that contains the custom setup script. - BlobContainerURI *string `json:"blobContainerUri,omitempty"` - // SasToken - The SAS token of the Azure blob container. - SasToken *SecureString `json:"sasToken,omitempty"` -} - -// IntegrationRuntimeDataFlowProperties data flow properties for managed integration runtime. -type IntegrationRuntimeDataFlowProperties struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ComputeType - Compute type of the cluster which will execute data flow job. Possible values include: 'DataFlowComputeTypeGeneral', 'DataFlowComputeTypeMemoryOptimized', 'DataFlowComputeTypeComputeOptimized' - ComputeType DataFlowComputeType `json:"computeType,omitempty"` - // CoreCount - Core count of the cluster which will execute data flow job. Supported values are: 8, 16, 32, 48, 80, 144 and 272. - CoreCount *int32 `json:"coreCount,omitempty"` - // TimeToLive - Time to live (in minutes) setting of the cluster which will execute data flow job. - TimeToLive *int32 `json:"timeToLive,omitempty"` - // Cleanup - Cluster will not be recycled and it will be used in next data flow activity run until TTL (time to live) is reached if this is set as false. Default is true. - Cleanup *bool `json:"cleanup,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeDataFlowProperties. -func (irdfp IntegrationRuntimeDataFlowProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if irdfp.ComputeType != "" { - objectMap["computeType"] = irdfp.ComputeType - } - if irdfp.CoreCount != nil { - objectMap["coreCount"] = irdfp.CoreCount - } - if irdfp.TimeToLive != nil { - objectMap["timeToLive"] = irdfp.TimeToLive - } - if irdfp.Cleanup != nil { - objectMap["cleanup"] = irdfp.Cleanup - } - for k, v := range irdfp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeDataFlowProperties struct. -func (irdfp *IntegrationRuntimeDataFlowProperties) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irdfp.AdditionalProperties == nil { - irdfp.AdditionalProperties = make(map[string]interface{}) - } - irdfp.AdditionalProperties[k] = additionalProperties - } - case "computeType": - if v != nil { - var computeType DataFlowComputeType - err = json.Unmarshal(*v, &computeType) - if err != nil { - return err - } - irdfp.ComputeType = computeType - } - case "coreCount": - if v != nil { - var coreCount int32 - err = json.Unmarshal(*v, &coreCount) - if err != nil { - return err - } - irdfp.CoreCount = &coreCount - } - case "timeToLive": - if v != nil { - var timeToLive int32 - err = json.Unmarshal(*v, &timeToLive) - if err != nil { - return err - } - irdfp.TimeToLive = &timeToLive - } - case "cleanup": - if v != nil { - var cleanup bool - err = json.Unmarshal(*v, &cleanup) - if err != nil { - return err - } - irdfp.Cleanup = &cleanup - } - } - } - - return nil -} - -// IntegrationRuntimeDataProxyProperties data proxy properties for a managed dedicated integration runtime. -type IntegrationRuntimeDataProxyProperties struct { - // ConnectVia - The self-hosted integration runtime reference. - ConnectVia *EntityReference `json:"connectVia,omitempty"` - // StagingLinkedService - The staging linked service reference. - StagingLinkedService *EntityReference `json:"stagingLinkedService,omitempty"` - // Path - The path to contain the staged data in the Blob storage. - Path *string `json:"path,omitempty"` -} - -// IntegrationRuntimeListResponse a list of integration runtime resources. -type IntegrationRuntimeListResponse struct { - autorest.Response `json:"-"` - // Value - List of integration runtimes. - Value *[]IntegrationRuntimeResource `json:"value,omitempty"` - // NextLink - The link to the next page of results, if any remaining results exist. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationRuntimeListResponseIterator provides access to a complete listing of -// IntegrationRuntimeResource values. -type IntegrationRuntimeListResponseIterator struct { - i int - page IntegrationRuntimeListResponsePage -} - -// 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 *IntegrationRuntimeListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeListResponseIterator.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 *IntegrationRuntimeListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationRuntimeListResponseIterator) 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 IntegrationRuntimeListResponseIterator) Response() IntegrationRuntimeListResponse { - 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 IntegrationRuntimeListResponseIterator) Value() IntegrationRuntimeResource { - if !iter.page.NotDone() { - return IntegrationRuntimeResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationRuntimeListResponseIterator type. -func NewIntegrationRuntimeListResponseIterator(page IntegrationRuntimeListResponsePage) IntegrationRuntimeListResponseIterator { - return IntegrationRuntimeListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (irlr IntegrationRuntimeListResponse) IsEmpty() bool { - return irlr.Value == nil || len(*irlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (irlr IntegrationRuntimeListResponse) hasNextLink() bool { - return irlr.NextLink != nil && len(*irlr.NextLink) != 0 -} - -// integrationRuntimeListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (irlr IntegrationRuntimeListResponse) integrationRuntimeListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !irlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(irlr.NextLink))) -} - -// IntegrationRuntimeListResponsePage contains a page of IntegrationRuntimeResource values. -type IntegrationRuntimeListResponsePage struct { - fn func(context.Context, IntegrationRuntimeListResponse) (IntegrationRuntimeListResponse, error) - irlr IntegrationRuntimeListResponse -} - -// 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 *IntegrationRuntimeListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeListResponsePage.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.irlr) - if err != nil { - return err - } - page.irlr = 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 *IntegrationRuntimeListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationRuntimeListResponsePage) NotDone() bool { - return !page.irlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationRuntimeListResponsePage) Response() IntegrationRuntimeListResponse { - return page.irlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationRuntimeListResponsePage) Values() []IntegrationRuntimeResource { - if page.irlr.IsEmpty() { - return nil - } - return *page.irlr.Value -} - -// Creates a new instance of the IntegrationRuntimeListResponsePage type. -func NewIntegrationRuntimeListResponsePage(cur IntegrationRuntimeListResponse, getNextPage func(context.Context, IntegrationRuntimeListResponse) (IntegrationRuntimeListResponse, error)) IntegrationRuntimeListResponsePage { - return IntegrationRuntimeListResponsePage{ - fn: getNextPage, - irlr: cur, - } -} - -// IntegrationRuntimeMonitoringData get monitoring data response. -type IntegrationRuntimeMonitoringData struct { - autorest.Response `json:"-"` - // Name - Integration runtime name. - Name *string `json:"name,omitempty"` - // Nodes - Integration runtime node monitoring data. - Nodes *[]IntegrationRuntimeNodeMonitoringData `json:"nodes,omitempty"` -} - -// IntegrationRuntimeNodeIPAddress the IP address of self-hosted integration runtime node. -type IntegrationRuntimeNodeIPAddress struct { - autorest.Response `json:"-"` - // IPAddress - READ-ONLY; The IP address of self-hosted integration runtime node. - IPAddress *string `json:"ipAddress,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeNodeIPAddress. -func (irnia IntegrationRuntimeNodeIPAddress) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IntegrationRuntimeNodeMonitoringData monitoring data for integration runtime node. -type IntegrationRuntimeNodeMonitoringData struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // NodeName - READ-ONLY; Name of the integration runtime node. - NodeName *string `json:"nodeName,omitempty"` - // AvailableMemoryInMB - READ-ONLY; Available memory (MB) on the integration runtime node. - AvailableMemoryInMB *int32 `json:"availableMemoryInMB,omitempty"` - // CPUUtilization - READ-ONLY; CPU percentage on the integration runtime node. - CPUUtilization *int32 `json:"cpuUtilization,omitempty"` - // ConcurrentJobsLimit - READ-ONLY; Maximum concurrent jobs on the integration runtime node. - ConcurrentJobsLimit *int32 `json:"concurrentJobsLimit,omitempty"` - // ConcurrentJobsRunning - READ-ONLY; The number of jobs currently running on the integration runtime node. - ConcurrentJobsRunning *int32 `json:"concurrentJobsRunning,omitempty"` - // MaxConcurrentJobs - READ-ONLY; The maximum concurrent jobs in this integration runtime. - MaxConcurrentJobs *int32 `json:"maxConcurrentJobs,omitempty"` - // SentBytes - READ-ONLY; Sent bytes on the integration runtime node. - SentBytes *float64 `json:"sentBytes,omitempty"` - // ReceivedBytes - READ-ONLY; Received bytes on the integration runtime node. - ReceivedBytes *float64 `json:"receivedBytes,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeNodeMonitoringData. -func (irnmd IntegrationRuntimeNodeMonitoringData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - for k, v := range irnmd.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeNodeMonitoringData struct. -func (irnmd *IntegrationRuntimeNodeMonitoringData) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irnmd.AdditionalProperties == nil { - irnmd.AdditionalProperties = make(map[string]interface{}) - } - irnmd.AdditionalProperties[k] = additionalProperties - } - case "nodeName": - if v != nil { - var nodeName string - err = json.Unmarshal(*v, &nodeName) - if err != nil { - return err - } - irnmd.NodeName = &nodeName - } - case "availableMemoryInMB": - if v != nil { - var availableMemoryInMB int32 - err = json.Unmarshal(*v, &availableMemoryInMB) - if err != nil { - return err - } - irnmd.AvailableMemoryInMB = &availableMemoryInMB - } - case "cpuUtilization": - if v != nil { - var CPUUtilization int32 - err = json.Unmarshal(*v, &CPUUtilization) - if err != nil { - return err - } - irnmd.CPUUtilization = &CPUUtilization - } - case "concurrentJobsLimit": - if v != nil { - var concurrentJobsLimit int32 - err = json.Unmarshal(*v, &concurrentJobsLimit) - if err != nil { - return err - } - irnmd.ConcurrentJobsLimit = &concurrentJobsLimit - } - case "concurrentJobsRunning": - if v != nil { - var concurrentJobsRunning int32 - err = json.Unmarshal(*v, &concurrentJobsRunning) - if err != nil { - return err - } - irnmd.ConcurrentJobsRunning = &concurrentJobsRunning - } - case "maxConcurrentJobs": - if v != nil { - var maxConcurrentJobs int32 - err = json.Unmarshal(*v, &maxConcurrentJobs) - if err != nil { - return err - } - irnmd.MaxConcurrentJobs = &maxConcurrentJobs - } - case "sentBytes": - if v != nil { - var sentBytes float64 - err = json.Unmarshal(*v, &sentBytes) - if err != nil { - return err - } - irnmd.SentBytes = &sentBytes - } - case "receivedBytes": - if v != nil { - var receivedBytes float64 - err = json.Unmarshal(*v, &receivedBytes) - if err != nil { - return err - } - irnmd.ReceivedBytes = &receivedBytes - } - } - } - - return nil -} - -// IntegrationRuntimeObjectMetadataRefreshFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type IntegrationRuntimeObjectMetadataRefreshFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimeObjectMetadataClient) (SsisObjectMetadataStatusResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimeObjectMetadataRefreshFuture) 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 IntegrationRuntimeObjectMetadataRefreshFuture.Result. -func (future *IntegrationRuntimeObjectMetadataRefreshFuture) result(client IntegrationRuntimeObjectMetadataClient) (somsr SsisObjectMetadataStatusResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataRefreshFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - somsr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimeObjectMetadataRefreshFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if somsr.Response.Response, err = future.GetResult(sender); err == nil && somsr.Response.Response.StatusCode != http.StatusNoContent { - somsr, err = client.RefreshResponder(somsr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataRefreshFuture", "Result", somsr.Response.Response, "Failure responding to request") - } - } - return -} - -// IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint azure-SSIS integration runtime outbound -// network dependency endpoints for one category. -type IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint struct { - // Category - The category of outbound network dependency. - Category *string `json:"category,omitempty"` - // Endpoints - The endpoints for outbound network dependency. - Endpoints *[]IntegrationRuntimeOutboundNetworkDependenciesEndpoint `json:"endpoints,omitempty"` -} - -// IntegrationRuntimeOutboundNetworkDependenciesEndpoint the endpoint for Azure-SSIS integration runtime -// outbound network dependency. -type IntegrationRuntimeOutboundNetworkDependenciesEndpoint struct { - // DomainName - The domain name of endpoint. - DomainName *string `json:"domainName,omitempty"` - // EndpointDetails - The details of endpoint. - EndpointDetails *[]IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails `json:"endpointDetails,omitempty"` -} - -// IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails the details of Azure-SSIS integration -// runtime outbound network dependency endpoint. -type IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails struct { - // Port - The port of endpoint. - Port *int32 `json:"port,omitempty"` -} - -// IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse azure-SSIS integration runtime outbound -// network dependency endpoints. -type IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse struct { - autorest.Response `json:"-"` - // Value - The list of outbound network dependency endpoints. - Value *[]IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint `json:"value,omitempty"` -} - -// IntegrationRuntimeRegenerateKeyParameters parameters to regenerate the authentication key. -type IntegrationRuntimeRegenerateKeyParameters struct { - // KeyName - The name of the authentication key to regenerate. Possible values include: 'IntegrationRuntimeAuthKeyNameAuthKey1', 'IntegrationRuntimeAuthKeyNameAuthKey2' - KeyName IntegrationRuntimeAuthKeyName `json:"keyName,omitempty"` -} - -// IntegrationRuntimeResource integration runtime resource type. -type IntegrationRuntimeResource struct { - autorest.Response `json:"-"` - // Properties - Integration runtime properties. - Properties BasicIntegrationRuntime `json:"properties,omitempty"` - // 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 IntegrationRuntimeResource. -func (irr IntegrationRuntimeResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = irr.Properties - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeResource struct. -func (irr *IntegrationRuntimeResource) 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 { - properties, err := unmarshalBasicIntegrationRuntime(*v) - if err != nil { - return err - } - irr.Properties = properties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - irr.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - irr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - irr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - irr.Type = &typeVar - } - } - } - - return nil -} - -// IntegrationRuntimesCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IntegrationRuntimesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (IntegrationRuntimeResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesCreateFuture) 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 IntegrationRuntimesCreateFuture.Result. -func (future *IntegrationRuntimesCreateFuture) result(client IntegrationRuntimesClient) (irr IntegrationRuntimeResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - irr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if irr.Response.Response, err = future.GetResult(sender); err == nil && irr.Response.Response.StatusCode != http.StatusNoContent { - irr, err = client.CreateResponder(irr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesCreateFuture", "Result", irr.Response.Response, "Failure responding to request") - } - } - return -} - -// IntegrationRuntimesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IntegrationRuntimesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesDeleteFuture) 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 IntegrationRuntimesDeleteFuture.Result. -func (future *IntegrationRuntimesDeleteFuture) result(client IntegrationRuntimesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// IntegrationRuntimesDisableInteractiveQueryFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type IntegrationRuntimesDisableInteractiveQueryFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesDisableInteractiveQueryFuture) 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 IntegrationRuntimesDisableInteractiveQueryFuture.Result. -func (future *IntegrationRuntimesDisableInteractiveQueryFuture) result(client IntegrationRuntimesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesDisableInteractiveQueryFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesDisableInteractiveQueryFuture") - return - } - ar.Response = future.Response() - return -} - -// IntegrationRuntimesEnableInteractiveQueryFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type IntegrationRuntimesEnableInteractiveQueryFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesEnableInteractiveQueryFuture) 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 IntegrationRuntimesEnableInteractiveQueryFuture.Result. -func (future *IntegrationRuntimesEnableInteractiveQueryFuture) result(client IntegrationRuntimesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesEnableInteractiveQueryFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesEnableInteractiveQueryFuture") - return - } - ar.Response = future.Response() - return -} - -// IntegrationRuntimeSsisCatalogInfo catalog information for managed dedicated integration runtime. -type IntegrationRuntimeSsisCatalogInfo struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // CatalogServerEndpoint - The catalog database server URL. - CatalogServerEndpoint *string `json:"catalogServerEndpoint,omitempty"` - // CatalogAdminUserName - The administrator user name of catalog database. - CatalogAdminUserName *string `json:"catalogAdminUserName,omitempty"` - // CatalogAdminPassword - The password of the administrator user account of the catalog database. - CatalogAdminPassword *SecureString `json:"catalogAdminPassword,omitempty"` - // CatalogPricingTier - The pricing tier for the catalog database. The valid values could be found in https://azure.microsoft.com/en-us/pricing/details/sql-database/. Possible values include: 'IntegrationRuntimeSsisCatalogPricingTierBasic', 'IntegrationRuntimeSsisCatalogPricingTierStandard', 'IntegrationRuntimeSsisCatalogPricingTierPremium', 'IntegrationRuntimeSsisCatalogPricingTierPremiumRS' - CatalogPricingTier IntegrationRuntimeSsisCatalogPricingTier `json:"catalogPricingTier,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeSsisCatalogInfo. -func (irsci IntegrationRuntimeSsisCatalogInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if irsci.CatalogServerEndpoint != nil { - objectMap["catalogServerEndpoint"] = irsci.CatalogServerEndpoint - } - if irsci.CatalogAdminUserName != nil { - objectMap["catalogAdminUserName"] = irsci.CatalogAdminUserName - } - if irsci.CatalogAdminPassword != nil { - objectMap["catalogAdminPassword"] = irsci.CatalogAdminPassword - } - if irsci.CatalogPricingTier != "" { - objectMap["catalogPricingTier"] = irsci.CatalogPricingTier - } - for k, v := range irsci.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeSsisCatalogInfo struct. -func (irsci *IntegrationRuntimeSsisCatalogInfo) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irsci.AdditionalProperties == nil { - irsci.AdditionalProperties = make(map[string]interface{}) - } - irsci.AdditionalProperties[k] = additionalProperties - } - case "catalogServerEndpoint": - if v != nil { - var catalogServerEndpoint string - err = json.Unmarshal(*v, &catalogServerEndpoint) - if err != nil { - return err - } - irsci.CatalogServerEndpoint = &catalogServerEndpoint - } - case "catalogAdminUserName": - if v != nil { - var catalogAdminUserName string - err = json.Unmarshal(*v, &catalogAdminUserName) - if err != nil { - return err - } - irsci.CatalogAdminUserName = &catalogAdminUserName - } - case "catalogAdminPassword": - if v != nil { - var catalogAdminPassword SecureString - err = json.Unmarshal(*v, &catalogAdminPassword) - if err != nil { - return err - } - irsci.CatalogAdminPassword = &catalogAdminPassword - } - case "catalogPricingTier": - if v != nil { - var catalogPricingTier IntegrationRuntimeSsisCatalogPricingTier - err = json.Unmarshal(*v, &catalogPricingTier) - if err != nil { - return err - } - irsci.CatalogPricingTier = catalogPricingTier - } - } - } - - return nil -} - -// IntegrationRuntimeSsisProperties SSIS properties for managed integration runtime. -type IntegrationRuntimeSsisProperties struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // CatalogInfo - Catalog information for managed dedicated integration runtime. - CatalogInfo *IntegrationRuntimeSsisCatalogInfo `json:"catalogInfo,omitempty"` - // LicenseType - License type for bringing your own license scenario. Possible values include: 'IntegrationRuntimeLicenseTypeBasePrice', 'IntegrationRuntimeLicenseTypeLicenseIncluded' - LicenseType IntegrationRuntimeLicenseType `json:"licenseType,omitempty"` - // CustomSetupScriptProperties - Custom setup script properties for a managed dedicated integration runtime. - CustomSetupScriptProperties *IntegrationRuntimeCustomSetupScriptProperties `json:"customSetupScriptProperties,omitempty"` - // DataProxyProperties - Data proxy properties for a managed dedicated integration runtime. - DataProxyProperties *IntegrationRuntimeDataProxyProperties `json:"dataProxyProperties,omitempty"` - // Edition - The edition for the SSIS Integration Runtime. Possible values include: 'IntegrationRuntimeEditionStandard', 'IntegrationRuntimeEditionEnterprise' - Edition IntegrationRuntimeEdition `json:"edition,omitempty"` - // ExpressCustomSetupProperties - Custom setup without script properties for a SSIS integration runtime. - ExpressCustomSetupProperties *[]BasicCustomSetupBase `json:"expressCustomSetupProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeSsisProperties. -func (irsp IntegrationRuntimeSsisProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if irsp.CatalogInfo != nil { - objectMap["catalogInfo"] = irsp.CatalogInfo - } - if irsp.LicenseType != "" { - objectMap["licenseType"] = irsp.LicenseType - } - if irsp.CustomSetupScriptProperties != nil { - objectMap["customSetupScriptProperties"] = irsp.CustomSetupScriptProperties - } - if irsp.DataProxyProperties != nil { - objectMap["dataProxyProperties"] = irsp.DataProxyProperties - } - if irsp.Edition != "" { - objectMap["edition"] = irsp.Edition - } - if irsp.ExpressCustomSetupProperties != nil { - objectMap["expressCustomSetupProperties"] = irsp.ExpressCustomSetupProperties - } - for k, v := range irsp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeSsisProperties struct. -func (irsp *IntegrationRuntimeSsisProperties) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irsp.AdditionalProperties == nil { - irsp.AdditionalProperties = make(map[string]interface{}) - } - irsp.AdditionalProperties[k] = additionalProperties - } - case "catalogInfo": - if v != nil { - var catalogInfo IntegrationRuntimeSsisCatalogInfo - err = json.Unmarshal(*v, &catalogInfo) - if err != nil { - return err - } - irsp.CatalogInfo = &catalogInfo - } - case "licenseType": - if v != nil { - var licenseType IntegrationRuntimeLicenseType - err = json.Unmarshal(*v, &licenseType) - if err != nil { - return err - } - irsp.LicenseType = licenseType - } - case "customSetupScriptProperties": - if v != nil { - var customSetupScriptProperties IntegrationRuntimeCustomSetupScriptProperties - err = json.Unmarshal(*v, &customSetupScriptProperties) - if err != nil { - return err - } - irsp.CustomSetupScriptProperties = &customSetupScriptProperties - } - case "dataProxyProperties": - if v != nil { - var dataProxyProperties IntegrationRuntimeDataProxyProperties - err = json.Unmarshal(*v, &dataProxyProperties) - if err != nil { - return err - } - irsp.DataProxyProperties = &dataProxyProperties - } - case "edition": - if v != nil { - var edition IntegrationRuntimeEdition - err = json.Unmarshal(*v, &edition) - if err != nil { - return err - } - irsp.Edition = edition - } - case "expressCustomSetupProperties": - if v != nil { - expressCustomSetupProperties, err := unmarshalBasicCustomSetupBaseArray(*v) - if err != nil { - return err - } - irsp.ExpressCustomSetupProperties = &expressCustomSetupProperties - } - } - } - - return nil -} - -// IntegrationRuntimesStartFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IntegrationRuntimesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (IntegrationRuntimeStatusResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesStartFuture) 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 IntegrationRuntimesStartFuture.Result. -func (future *IntegrationRuntimesStartFuture) result(client IntegrationRuntimesClient) (irsr IntegrationRuntimeStatusResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - irsr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesStartFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if irsr.Response.Response, err = future.GetResult(sender); err == nil && irsr.Response.Response.StatusCode != http.StatusNoContent { - irsr, err = client.StartResponder(irsr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesStartFuture", "Result", irsr.Response.Response, "Failure responding to request") - } - } - return -} - -// IntegrationRuntimesStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type IntegrationRuntimesStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationRuntimesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationRuntimesStopFuture) 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 IntegrationRuntimesStopFuture.Result. -func (future *IntegrationRuntimesStopFuture) result(client IntegrationRuntimesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimesStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IntegrationRuntimesStopFuture") - return - } - ar.Response = future.Response() - return -} - -// BasicIntegrationRuntimeStatus integration runtime status. -type BasicIntegrationRuntimeStatus interface { - AsManagedIntegrationRuntimeStatus() (*ManagedIntegrationRuntimeStatus, bool) - AsSelfHostedIntegrationRuntimeStatus() (*SelfHostedIntegrationRuntimeStatus, bool) - AsIntegrationRuntimeStatus() (*IntegrationRuntimeStatus, bool) -} - -// IntegrationRuntimeStatus integration runtime status. -type IntegrationRuntimeStatus struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // DataFactoryName - READ-ONLY; The workspace name which the integration runtime belong to. - DataFactoryName *string `json:"dataFactoryName,omitempty"` - // State - READ-ONLY; The state of integration runtime. Possible values include: 'IntegrationRuntimeStateInitial', 'IntegrationRuntimeStateStopped', 'IntegrationRuntimeStateStarted', 'IntegrationRuntimeStateStarting', 'IntegrationRuntimeStateStopping', 'IntegrationRuntimeStateNeedRegistration', 'IntegrationRuntimeStateOnline', 'IntegrationRuntimeStateLimited', 'IntegrationRuntimeStateOffline', 'IntegrationRuntimeStateAccessDenied' - State IntegrationRuntimeState `json:"state,omitempty"` - // Type - Possible values include: 'TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus', 'TypeBasicIntegrationRuntimeStatusTypeManaged', 'TypeBasicIntegrationRuntimeStatusTypeSelfHosted' - Type TypeBasicIntegrationRuntimeStatus `json:"type,omitempty"` -} - -func unmarshalBasicIntegrationRuntimeStatus(body []byte) (BasicIntegrationRuntimeStatus, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicIntegrationRuntimeStatusTypeManaged): - var mirs ManagedIntegrationRuntimeStatus - err := json.Unmarshal(body, &mirs) - return mirs, err - case string(TypeBasicIntegrationRuntimeStatusTypeSelfHosted): - var shirs SelfHostedIntegrationRuntimeStatus - err := json.Unmarshal(body, &shirs) - return shirs, err - default: - var irs IntegrationRuntimeStatus - err := json.Unmarshal(body, &irs) - return irs, err - } -} -func unmarshalBasicIntegrationRuntimeStatusArray(body []byte) ([]BasicIntegrationRuntimeStatus, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - irsArray := make([]BasicIntegrationRuntimeStatus, len(rawMessages)) - - for index, rawMessage := range rawMessages { - irs, err := unmarshalBasicIntegrationRuntimeStatus(*rawMessage) - if err != nil { - return nil, err - } - irsArray[index] = irs - } - return irsArray, nil -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) MarshalJSON() ([]byte, error) { - irs.Type = TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus - objectMap := make(map[string]interface{}) - if irs.Type != "" { - objectMap["type"] = irs.Type - } - for k, v := range irs.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) AsManagedIntegrationRuntimeStatus() (*ManagedIntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsSelfHostedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) AsSelfHostedIntegrationRuntimeStatus() (*SelfHostedIntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) AsIntegrationRuntimeStatus() (*IntegrationRuntimeStatus, bool) { - return &irs, true -} - -// AsBasicIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for IntegrationRuntimeStatus. -func (irs IntegrationRuntimeStatus) AsBasicIntegrationRuntimeStatus() (BasicIntegrationRuntimeStatus, bool) { - return &irs, true -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeStatus struct. -func (irs *IntegrationRuntimeStatus) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irs.AdditionalProperties == nil { - irs.AdditionalProperties = make(map[string]interface{}) - } - irs.AdditionalProperties[k] = additionalProperties - } - case "dataFactoryName": - if v != nil { - var dataFactoryName string - err = json.Unmarshal(*v, &dataFactoryName) - if err != nil { - return err - } - irs.DataFactoryName = &dataFactoryName - } - case "state": - if v != nil { - var state IntegrationRuntimeState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - irs.State = state - } - case "type": - if v != nil { - var typeVar TypeBasicIntegrationRuntimeStatus - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - irs.Type = typeVar - } - } - } - - return nil -} - -// IntegrationRuntimeStatusResponse integration runtime status response. -type IntegrationRuntimeStatusResponse struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; The integration runtime name. - Name *string `json:"name,omitempty"` - // Properties - Integration runtime properties. - Properties BasicIntegrationRuntimeStatus `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeStatusResponse. -func (irsr IntegrationRuntimeStatusResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = irsr.Properties - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeStatusResponse struct. -func (irsr *IntegrationRuntimeStatusResponse) 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 - } - irsr.Name = &name - } - case "properties": - if v != nil { - properties, err := unmarshalBasicIntegrationRuntimeStatus(*v) - if err != nil { - return err - } - irsr.Properties = properties - } - } - } - - return nil -} - -// IntegrationRuntimeVNetProperties vNet properties for managed integration runtime. -type IntegrationRuntimeVNetProperties struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // VNetID - The ID of the VNet that this integration runtime will join. - VNetID *string `json:"vNetId,omitempty"` - // Subnet - The name of the subnet this integration runtime will join. - Subnet *string `json:"subnet,omitempty"` - // PublicIPs - Resource IDs of the public IP addresses that this integration runtime will use. - PublicIPs *[]string `json:"publicIPs,omitempty"` - // SubnetID - The ID of subnet, to which this Azure-SSIS integration runtime will be joined. - SubnetID *string `json:"subnetId,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationRuntimeVNetProperties. -func (irvnp IntegrationRuntimeVNetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if irvnp.VNetID != nil { - objectMap["vNetId"] = irvnp.VNetID - } - if irvnp.Subnet != nil { - objectMap["subnet"] = irvnp.Subnet - } - if irvnp.PublicIPs != nil { - objectMap["publicIPs"] = irvnp.PublicIPs - } - if irvnp.SubnetID != nil { - objectMap["subnetId"] = irvnp.SubnetID - } - for k, v := range irvnp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationRuntimeVNetProperties struct. -func (irvnp *IntegrationRuntimeVNetProperties) 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 { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if irvnp.AdditionalProperties == nil { - irvnp.AdditionalProperties = make(map[string]interface{}) - } - irvnp.AdditionalProperties[k] = additionalProperties - } - case "vNetId": - if v != nil { - var vNetID string - err = json.Unmarshal(*v, &vNetID) - if err != nil { - return err - } - irvnp.VNetID = &vNetID - } - case "subnet": - if v != nil { - var subnet string - err = json.Unmarshal(*v, &subnet) - if err != nil { - return err - } - irvnp.Subnet = &subnet - } - case "publicIPs": - if v != nil { - var publicIPs []string - err = json.Unmarshal(*v, &publicIPs) - if err != nil { - return err - } - irvnp.PublicIPs = &publicIPs - } - case "subnetId": - if v != nil { - var subnetID string - err = json.Unmarshal(*v, &subnetID) - if err != nil { - return err - } - irvnp.SubnetID = &subnetID - } - } - } - - return nil -} - -// IPFirewallRuleInfo IP firewall rule -type IPFirewallRuleInfo struct { - autorest.Response `json:"-"` - // IPFirewallRuleProperties - IP firewall rule properties - *IPFirewallRuleProperties `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 IPFirewallRuleInfo. -func (ifri IPFirewallRuleInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ifri.IPFirewallRuleProperties != nil { - objectMap["properties"] = ifri.IPFirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IPFirewallRuleInfo struct. -func (ifri *IPFirewallRuleInfo) 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 IPFirewallRuleProperties IPFirewallRuleProperties - err = json.Unmarshal(*v, &IPFirewallRuleProperties) - if err != nil { - return err - } - ifri.IPFirewallRuleProperties = &IPFirewallRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ifri.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ifri.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ifri.Type = &typeVar - } - } - } - - return nil -} - -// IPFirewallRuleInfoListResult list of IP firewall rules -type IPFirewallRuleInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of IP firewall rules - Value *[]IPFirewallRuleInfo `json:"value,omitempty"` -} - -// IPFirewallRuleInfoListResultIterator provides access to a complete listing of IPFirewallRuleInfo values. -type IPFirewallRuleInfoListResultIterator struct { - i int - page IPFirewallRuleInfoListResultPage -} - -// 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 *IPFirewallRuleInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRuleInfoListResultIterator.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 *IPFirewallRuleInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IPFirewallRuleInfoListResultIterator) 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 IPFirewallRuleInfoListResultIterator) Response() IPFirewallRuleInfoListResult { - 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 IPFirewallRuleInfoListResultIterator) Value() IPFirewallRuleInfo { - if !iter.page.NotDone() { - return IPFirewallRuleInfo{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IPFirewallRuleInfoListResultIterator type. -func NewIPFirewallRuleInfoListResultIterator(page IPFirewallRuleInfoListResultPage) IPFirewallRuleInfoListResultIterator { - return IPFirewallRuleInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ifrilr IPFirewallRuleInfoListResult) IsEmpty() bool { - return ifrilr.Value == nil || len(*ifrilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ifrilr IPFirewallRuleInfoListResult) hasNextLink() bool { - return ifrilr.NextLink != nil && len(*ifrilr.NextLink) != 0 -} - -// iPFirewallRuleInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ifrilr IPFirewallRuleInfoListResult) iPFirewallRuleInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ifrilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ifrilr.NextLink))) -} - -// IPFirewallRuleInfoListResultPage contains a page of IPFirewallRuleInfo values. -type IPFirewallRuleInfoListResultPage struct { - fn func(context.Context, IPFirewallRuleInfoListResult) (IPFirewallRuleInfoListResult, error) - ifrilr IPFirewallRuleInfoListResult -} - -// 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 *IPFirewallRuleInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPFirewallRuleInfoListResultPage.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.ifrilr) - if err != nil { - return err - } - page.ifrilr = 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 *IPFirewallRuleInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IPFirewallRuleInfoListResultPage) NotDone() bool { - return !page.ifrilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IPFirewallRuleInfoListResultPage) Response() IPFirewallRuleInfoListResult { - return page.ifrilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IPFirewallRuleInfoListResultPage) Values() []IPFirewallRuleInfo { - if page.ifrilr.IsEmpty() { - return nil - } - return *page.ifrilr.Value -} - -// Creates a new instance of the IPFirewallRuleInfoListResultPage type. -func NewIPFirewallRuleInfoListResultPage(cur IPFirewallRuleInfoListResult, getNextPage func(context.Context, IPFirewallRuleInfoListResult) (IPFirewallRuleInfoListResult, error)) IPFirewallRuleInfoListResultPage { - return IPFirewallRuleInfoListResultPage{ - fn: getNextPage, - ifrilr: cur, - } -} - -// IPFirewallRuleProperties IP firewall rule properties -type IPFirewallRuleProperties struct { - // EndIPAddress - The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress - EndIPAddress *string `json:"endIpAddress,omitempty"` - // ProvisioningState - READ-ONLY; Resource provisioning state. Possible values include: 'ProvisioningStateProvisioning', 'ProvisioningStateSucceeded', 'ProvisioningStateDeleting', 'ProvisioningStateFailed', 'ProvisioningStateDeleteError' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // StartIPAddress - The start IP address of the firewall rule. Must be IPv4 format - StartIPAddress *string `json:"startIpAddress,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPFirewallRuleProperties. -func (ifrp IPFirewallRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ifrp.EndIPAddress != nil { - objectMap["endIpAddress"] = ifrp.EndIPAddress - } - if ifrp.StartIPAddress != nil { - objectMap["startIpAddress"] = ifrp.StartIPAddress - } - return json.Marshal(objectMap) -} - -// IPFirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IPFirewallRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPFirewallRulesClient) (IPFirewallRuleInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPFirewallRulesCreateOrUpdateFuture) 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 IPFirewallRulesCreateOrUpdateFuture.Result. -func (future *IPFirewallRulesCreateOrUpdateFuture) result(client IPFirewallRulesClient) (ifri IPFirewallRuleInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifri.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IPFirewallRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifri.Response.Response, err = future.GetResult(sender); err == nil && ifri.Response.Response.StatusCode != http.StatusNoContent { - ifri, err = client.CreateOrUpdateResponder(ifri.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesCreateOrUpdateFuture", "Result", ifri.Response.Response, "Failure responding to request") - } - } - return -} - -// IPFirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type IPFirewallRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPFirewallRulesClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPFirewallRulesDeleteFuture) 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 IPFirewallRulesDeleteFuture.Result. -func (future *IPFirewallRulesDeleteFuture) result(client IPFirewallRulesClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IPFirewallRulesDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.DeleteResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesDeleteFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// IPFirewallRulesReplaceAllFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IPFirewallRulesReplaceAllFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPFirewallRulesClient) (ReplaceAllFirewallRulesOperationResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPFirewallRulesReplaceAllFuture) 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 IPFirewallRulesReplaceAllFuture.Result. -func (future *IPFirewallRulesReplaceAllFuture) result(client IPFirewallRulesClient) (rafror ReplaceAllFirewallRulesOperationResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesReplaceAllFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rafror.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.IPFirewallRulesReplaceAllFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rafror.Response.Response, err = future.GetResult(sender); err == nil && rafror.Response.Response.StatusCode != http.StatusNoContent { - rafror, err = client.ReplaceAllResponder(rafror.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.IPFirewallRulesReplaceAllFuture", "Result", rafror.Response.Response, "Failure responding to request") - } - } - return -} - -// KekIdentityProperties key encryption key properties -type KekIdentityProperties struct { - // UserAssignedIdentity - User assigned identity resource Id - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` - // UseSystemAssignedIdentity - Boolean specifying whether to use system assigned identity or not - UseSystemAssignedIdentity interface{} `json:"useSystemAssignedIdentity,omitempty"` -} - -// Key a workspace key -type Key struct { - autorest.Response `json:"-"` - // KeyProperties - Keys resource properties - *KeyProperties `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 Key. -func (kVar Key) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kVar.KeyProperties != nil { - objectMap["properties"] = kVar.KeyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Key struct. -func (kVar *Key) 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 keyProperties KeyProperties - err = json.Unmarshal(*v, &keyProperties) - if err != nil { - return err - } - kVar.KeyProperties = &keyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - kVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - kVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - kVar.Type = &typeVar - } - } - } - - return nil -} - -// KeyInfoListResult list of keys -type KeyInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of keys - Value *[]Key `json:"value,omitempty"` -} - -// KeyInfoListResultIterator provides access to a complete listing of Key values. -type KeyInfoListResultIterator struct { - i int - page KeyInfoListResultPage -} - -// 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 *KeyInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeyInfoListResultIterator.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 *KeyInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter KeyInfoListResultIterator) 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 KeyInfoListResultIterator) Response() KeyInfoListResult { - 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 KeyInfoListResultIterator) Value() Key { - if !iter.page.NotDone() { - return Key{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the KeyInfoListResultIterator type. -func NewKeyInfoListResultIterator(page KeyInfoListResultPage) KeyInfoListResultIterator { - return KeyInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (kilr KeyInfoListResult) IsEmpty() bool { - return kilr.Value == nil || len(*kilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (kilr KeyInfoListResult) hasNextLink() bool { - return kilr.NextLink != nil && len(*kilr.NextLink) != 0 -} - -// keyInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (kilr KeyInfoListResult) keyInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !kilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(kilr.NextLink))) -} - -// KeyInfoListResultPage contains a page of Key values. -type KeyInfoListResultPage struct { - fn func(context.Context, KeyInfoListResult) (KeyInfoListResult, error) - kilr KeyInfoListResult -} - -// 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 *KeyInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/KeyInfoListResultPage.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.kilr) - if err != nil { - return err - } - page.kilr = 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 *KeyInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page KeyInfoListResultPage) NotDone() bool { - return !page.kilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page KeyInfoListResultPage) Response() KeyInfoListResult { - return page.kilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page KeyInfoListResultPage) Values() []Key { - if page.kilr.IsEmpty() { - return nil - } - return *page.kilr.Value -} - -// Creates a new instance of the KeyInfoListResultPage type. -func NewKeyInfoListResultPage(cur KeyInfoListResult, getNextPage func(context.Context, KeyInfoListResult) (KeyInfoListResult, error)) KeyInfoListResultPage { - return KeyInfoListResultPage{ - fn: getNextPage, - kilr: cur, - } -} - -// KeyProperties key properties -type KeyProperties struct { - // IsActiveCMK - Used to activate the workspace after a customer managed key is provided. - IsActiveCMK *bool `json:"isActiveCMK,omitempty"` - // KeyVaultURL - The Key Vault Url of the workspace key. - KeyVaultURL *string `json:"keyVaultUrl,omitempty"` -} - -// LibraryInfo library/package information of a Big Data pool powered by Apache Spark -type LibraryInfo struct { - // Name - Name of the library. - Name *string `json:"name,omitempty"` - // Path - Storage blob path of library. - Path *string `json:"path,omitempty"` - // ContainerName - Storage blob container name. - ContainerName *string `json:"containerName,omitempty"` - // UploadedTimestamp - The last update time of the library. - UploadedTimestamp *date.Time `json:"uploadedTimestamp,omitempty"` - // Type - Type of the library. - Type *string `json:"type,omitempty"` - // ProvisioningStatus - READ-ONLY; Provisioning status of the library/package. - ProvisioningStatus *string `json:"provisioningStatus,omitempty"` - // CreatorID - READ-ONLY; Creator Id of the library/package. - CreatorID *string `json:"creatorId,omitempty"` -} - -// MarshalJSON is the custom marshaler for LibraryInfo. -func (li LibraryInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if li.Name != nil { - objectMap["name"] = li.Name - } - if li.Path != nil { - objectMap["path"] = li.Path - } - if li.ContainerName != nil { - objectMap["containerName"] = li.ContainerName - } - if li.UploadedTimestamp != nil { - objectMap["uploadedTimestamp"] = li.UploadedTimestamp - } - if li.Type != nil { - objectMap["type"] = li.Type - } - return json.Marshal(objectMap) -} - -// LibraryListResponse a list of Library resources. -type LibraryListResponse struct { - autorest.Response `json:"-"` - // Value - List of Library. - Value *[]LibraryResource `json:"value,omitempty"` - // NextLink - The link to the next page of results, if any remaining results exist. - NextLink *string `json:"nextLink,omitempty"` -} - -// LibraryListResponseIterator provides access to a complete listing of LibraryResource values. -type LibraryListResponseIterator struct { - i int - page LibraryListResponsePage -} - -// 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 *LibraryListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LibraryListResponseIterator.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 *LibraryListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LibraryListResponseIterator) 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 LibraryListResponseIterator) Response() LibraryListResponse { - 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 LibraryListResponseIterator) Value() LibraryResource { - if !iter.page.NotDone() { - return LibraryResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LibraryListResponseIterator type. -func NewLibraryListResponseIterator(page LibraryListResponsePage) LibraryListResponseIterator { - return LibraryListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (llr LibraryListResponse) IsEmpty() bool { - return llr.Value == nil || len(*llr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (llr LibraryListResponse) hasNextLink() bool { - return llr.NextLink != nil && len(*llr.NextLink) != 0 -} - -// libraryListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (llr LibraryListResponse) libraryListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !llr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(llr.NextLink))) -} - -// LibraryListResponsePage contains a page of LibraryResource values. -type LibraryListResponsePage struct { - fn func(context.Context, LibraryListResponse) (LibraryListResponse, error) - llr LibraryListResponse -} - -// 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 *LibraryListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LibraryListResponsePage.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.llr) - if err != nil { - return err - } - page.llr = 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 *LibraryListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LibraryListResponsePage) NotDone() bool { - return !page.llr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LibraryListResponsePage) Response() LibraryListResponse { - return page.llr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LibraryListResponsePage) Values() []LibraryResource { - if page.llr.IsEmpty() { - return nil - } - return *page.llr.Value -} - -// Creates a new instance of the LibraryListResponsePage type. -func NewLibraryListResponsePage(cur LibraryListResponse, getNextPage func(context.Context, LibraryListResponse) (LibraryListResponse, error)) LibraryListResponsePage { - return LibraryListResponsePage{ - fn: getNextPage, - llr: cur, - } -} - -// LibraryRequirements library requirements for a Big Data pool powered by Apache Spark -type LibraryRequirements struct { - // Time - READ-ONLY; The last update time of the library requirements file. - Time *date.Time `json:"time,omitempty"` - // Content - The library requirements. - Content *string `json:"content,omitempty"` - // Filename - The filename of the library requirements file. - Filename *string `json:"filename,omitempty"` -} - -// MarshalJSON is the custom marshaler for LibraryRequirements. -func (lr LibraryRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lr.Content != nil { - objectMap["content"] = lr.Content - } - if lr.Filename != nil { - objectMap["filename"] = lr.Filename - } - return json.Marshal(objectMap) -} - -// LibraryResource library response details -type LibraryResource struct { - autorest.Response `json:"-"` - // LibraryInfo - Library/package properties. - *LibraryInfo `json:"properties,omitempty"` - // 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 LibraryResource. -func (lr LibraryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lr.LibraryInfo != nil { - objectMap["properties"] = lr.LibraryInfo - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LibraryResource struct. -func (lr *LibraryResource) 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 libraryInfo LibraryInfo - err = json.Unmarshal(*v, &libraryInfo) - if err != nil { - return err - } - lr.LibraryInfo = &libraryInfo - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lr.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lr.Type = &typeVar - } - } - } - - return nil -} - -// LicensedComponentSetupTypeProperties installation of licensed component setup type properties. -type LicensedComponentSetupTypeProperties struct { - // ComponentName - The name of the 3rd party component. - ComponentName *string `json:"componentName,omitempty"` - // LicenseKey - The license key to activate the component. - LicenseKey BasicSecretBase `json:"licenseKey,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for LicensedComponentSetupTypeProperties struct. -func (lcstp *LicensedComponentSetupTypeProperties) 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 "componentName": - if v != nil { - var componentName string - err = json.Unmarshal(*v, &componentName) - if err != nil { - return err - } - lcstp.ComponentName = &componentName - } - case "licenseKey": - if v != nil { - licenseKey, err := unmarshalBasicSecretBase(*v) - if err != nil { - return err - } - lcstp.LicenseKey = licenseKey - } - } - } - - return nil -} - -// LinkedIntegrationRuntime the linked integration runtime information. -type LinkedIntegrationRuntime struct { - // Name - READ-ONLY; The name of the linked integration runtime. - Name *string `json:"name,omitempty"` - // SubscriptionID - READ-ONLY; The subscription ID for which the linked integration runtime belong to. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // DataFactoryName - READ-ONLY; The name of the workspace for which the linked integration runtime belong to. - DataFactoryName *string `json:"dataFactoryName,omitempty"` - // DataFactoryLocation - READ-ONLY; The location of the workspace for which the linked integration runtime belong to. - DataFactoryLocation *string `json:"dataFactoryLocation,omitempty"` - // CreateTime - READ-ONLY; The creating time of the linked integration runtime. - CreateTime *date.Time `json:"createTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedIntegrationRuntime. -func (lir LinkedIntegrationRuntime) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LinkedIntegrationRuntimeKeyAuthorization the key authorization type integration runtime. -type LinkedIntegrationRuntimeKeyAuthorization struct { - // Key - The key used for authorization. - Key *SecureString `json:"key,omitempty"` - // AuthorizationType - Possible values include: 'AuthorizationTypeLinkedIntegrationRuntimeType', 'AuthorizationTypeKey', 'AuthorizationTypeRBAC' - AuthorizationType AuthorizationType `json:"authorizationType,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) MarshalJSON() ([]byte, error) { - lirka.AuthorizationType = AuthorizationTypeKey - objectMap := make(map[string]interface{}) - if lirka.Key != nil { - objectMap["key"] = lirka.Key - } - if lirka.AuthorizationType != "" { - objectMap["authorizationType"] = lirka.AuthorizationType - } - return json.Marshal(objectMap) -} - -// AsLinkedIntegrationRuntimeKeyAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) AsLinkedIntegrationRuntimeKeyAuthorization() (*LinkedIntegrationRuntimeKeyAuthorization, bool) { - return &lirka, true -} - -// AsLinkedIntegrationRuntimeRbacAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) AsLinkedIntegrationRuntimeRbacAuthorization() (*LinkedIntegrationRuntimeRbacAuthorization, bool) { - return nil, false -} - -// AsLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) AsLinkedIntegrationRuntimeType() (*LinkedIntegrationRuntimeType, bool) { - return nil, false -} - -// AsBasicLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeKeyAuthorization. -func (lirka LinkedIntegrationRuntimeKeyAuthorization) AsBasicLinkedIntegrationRuntimeType() (BasicLinkedIntegrationRuntimeType, bool) { - return &lirka, true -} - -// LinkedIntegrationRuntimeRbacAuthorization the role based access control (RBAC) authorization type -// integration runtime. -type LinkedIntegrationRuntimeRbacAuthorization struct { - // ResourceID - The resource identifier of the integration runtime to be shared. - ResourceID *string `json:"resourceId,omitempty"` - // AuthorizationType - Possible values include: 'AuthorizationTypeLinkedIntegrationRuntimeType', 'AuthorizationTypeKey', 'AuthorizationTypeRBAC' - AuthorizationType AuthorizationType `json:"authorizationType,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) MarshalJSON() ([]byte, error) { - lirra.AuthorizationType = AuthorizationTypeRBAC - objectMap := make(map[string]interface{}) - if lirra.ResourceID != nil { - objectMap["resourceId"] = lirra.ResourceID - } - if lirra.AuthorizationType != "" { - objectMap["authorizationType"] = lirra.AuthorizationType - } - return json.Marshal(objectMap) -} - -// AsLinkedIntegrationRuntimeKeyAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) AsLinkedIntegrationRuntimeKeyAuthorization() (*LinkedIntegrationRuntimeKeyAuthorization, bool) { - return nil, false -} - -// AsLinkedIntegrationRuntimeRbacAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) AsLinkedIntegrationRuntimeRbacAuthorization() (*LinkedIntegrationRuntimeRbacAuthorization, bool) { - return &lirra, true -} - -// AsLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) AsLinkedIntegrationRuntimeType() (*LinkedIntegrationRuntimeType, bool) { - return nil, false -} - -// AsBasicLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeRbacAuthorization. -func (lirra LinkedIntegrationRuntimeRbacAuthorization) AsBasicLinkedIntegrationRuntimeType() (BasicLinkedIntegrationRuntimeType, bool) { - return &lirra, true -} - -// BasicLinkedIntegrationRuntimeType the base definition of a linked integration runtime. -type BasicLinkedIntegrationRuntimeType interface { - AsLinkedIntegrationRuntimeKeyAuthorization() (*LinkedIntegrationRuntimeKeyAuthorization, bool) - AsLinkedIntegrationRuntimeRbacAuthorization() (*LinkedIntegrationRuntimeRbacAuthorization, bool) - AsLinkedIntegrationRuntimeType() (*LinkedIntegrationRuntimeType, bool) -} - -// LinkedIntegrationRuntimeType the base definition of a linked integration runtime. -type LinkedIntegrationRuntimeType struct { - // AuthorizationType - Possible values include: 'AuthorizationTypeLinkedIntegrationRuntimeType', 'AuthorizationTypeKey', 'AuthorizationTypeRBAC' - AuthorizationType AuthorizationType `json:"authorizationType,omitempty"` -} - -func unmarshalBasicLinkedIntegrationRuntimeType(body []byte) (BasicLinkedIntegrationRuntimeType, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["authorizationType"] { - case string(AuthorizationTypeKey): - var lirka LinkedIntegrationRuntimeKeyAuthorization - err := json.Unmarshal(body, &lirka) - return lirka, err - case string(AuthorizationTypeRBAC): - var lirra LinkedIntegrationRuntimeRbacAuthorization - err := json.Unmarshal(body, &lirra) - return lirra, err - default: - var lirt LinkedIntegrationRuntimeType - err := json.Unmarshal(body, &lirt) - return lirt, err - } -} -func unmarshalBasicLinkedIntegrationRuntimeTypeArray(body []byte) ([]BasicLinkedIntegrationRuntimeType, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - lirtArray := make([]BasicLinkedIntegrationRuntimeType, len(rawMessages)) - - for index, rawMessage := range rawMessages { - lirt, err := unmarshalBasicLinkedIntegrationRuntimeType(*rawMessage) - if err != nil { - return nil, err - } - lirtArray[index] = lirt - } - return lirtArray, nil -} - -// MarshalJSON is the custom marshaler for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) MarshalJSON() ([]byte, error) { - lirt.AuthorizationType = AuthorizationTypeLinkedIntegrationRuntimeType - objectMap := make(map[string]interface{}) - if lirt.AuthorizationType != "" { - objectMap["authorizationType"] = lirt.AuthorizationType - } - return json.Marshal(objectMap) -} - -// AsLinkedIntegrationRuntimeKeyAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) AsLinkedIntegrationRuntimeKeyAuthorization() (*LinkedIntegrationRuntimeKeyAuthorization, bool) { - return nil, false -} - -// AsLinkedIntegrationRuntimeRbacAuthorization is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) AsLinkedIntegrationRuntimeRbacAuthorization() (*LinkedIntegrationRuntimeRbacAuthorization, bool) { - return nil, false -} - -// AsLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) AsLinkedIntegrationRuntimeType() (*LinkedIntegrationRuntimeType, bool) { - return &lirt, true -} - -// AsBasicLinkedIntegrationRuntimeType is the BasicLinkedIntegrationRuntimeType implementation for LinkedIntegrationRuntimeType. -func (lirt LinkedIntegrationRuntimeType) AsBasicLinkedIntegrationRuntimeType() (BasicLinkedIntegrationRuntimeType, bool) { - return &lirt, true -} - -// ListAvailableRpOperation ... -type ListAvailableRpOperation struct { - autorest.Response `json:"-"` - Value *[]AvailableRpOperation `json:"value,omitempty"` -} - -// ListSQLPoolSecurityAlertPolicies a list of SQL pool security alert policies. -type ListSQLPoolSecurityAlertPolicies struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListSQLPoolSecurityAlertPolicies. -func (lspsap ListSQLPoolSecurityAlertPolicies) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListSQLPoolSecurityAlertPoliciesIterator provides access to a complete listing of -// SQLPoolSecurityAlertPolicy values. -type ListSQLPoolSecurityAlertPoliciesIterator struct { - i int - page ListSQLPoolSecurityAlertPoliciesPage -} - -// 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 *ListSQLPoolSecurityAlertPoliciesIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListSQLPoolSecurityAlertPoliciesIterator.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 *ListSQLPoolSecurityAlertPoliciesIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListSQLPoolSecurityAlertPoliciesIterator) 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 ListSQLPoolSecurityAlertPoliciesIterator) Response() ListSQLPoolSecurityAlertPolicies { - 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 ListSQLPoolSecurityAlertPoliciesIterator) Value() SQLPoolSecurityAlertPolicy { - if !iter.page.NotDone() { - return SQLPoolSecurityAlertPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListSQLPoolSecurityAlertPoliciesIterator type. -func NewListSQLPoolSecurityAlertPoliciesIterator(page ListSQLPoolSecurityAlertPoliciesPage) ListSQLPoolSecurityAlertPoliciesIterator { - return ListSQLPoolSecurityAlertPoliciesIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lspsap ListSQLPoolSecurityAlertPolicies) IsEmpty() bool { - return lspsap.Value == nil || len(*lspsap.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lspsap ListSQLPoolSecurityAlertPolicies) hasNextLink() bool { - return lspsap.NextLink != nil && len(*lspsap.NextLink) != 0 -} - -// listSQLPoolSecurityAlertPoliciesPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lspsap ListSQLPoolSecurityAlertPolicies) listSQLPoolSecurityAlertPoliciesPreparer(ctx context.Context) (*http.Request, error) { - if !lspsap.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lspsap.NextLink))) -} - -// ListSQLPoolSecurityAlertPoliciesPage contains a page of SQLPoolSecurityAlertPolicy values. -type ListSQLPoolSecurityAlertPoliciesPage struct { - fn func(context.Context, ListSQLPoolSecurityAlertPolicies) (ListSQLPoolSecurityAlertPolicies, error) - lspsap ListSQLPoolSecurityAlertPolicies -} - -// 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 *ListSQLPoolSecurityAlertPoliciesPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListSQLPoolSecurityAlertPoliciesPage.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.lspsap) - if err != nil { - return err - } - page.lspsap = 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 *ListSQLPoolSecurityAlertPoliciesPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListSQLPoolSecurityAlertPoliciesPage) NotDone() bool { - return !page.lspsap.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListSQLPoolSecurityAlertPoliciesPage) Response() ListSQLPoolSecurityAlertPolicies { - return page.lspsap -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListSQLPoolSecurityAlertPoliciesPage) Values() []SQLPoolSecurityAlertPolicy { - if page.lspsap.IsEmpty() { - return nil - } - return *page.lspsap.Value -} - -// Creates a new instance of the ListSQLPoolSecurityAlertPoliciesPage type. -func NewListSQLPoolSecurityAlertPoliciesPage(cur ListSQLPoolSecurityAlertPolicies, getNextPage func(context.Context, ListSQLPoolSecurityAlertPolicies) (ListSQLPoolSecurityAlertPolicies, error)) ListSQLPoolSecurityAlertPoliciesPage { - return ListSQLPoolSecurityAlertPoliciesPage{ - fn: getNextPage, - lspsap: cur, - } -} - -// MaintenanceWindowOptions maintenance window options. -type MaintenanceWindowOptions struct { - autorest.Response `json:"-"` - // MaintenanceWindowOptionsProperties - Resource properties. - *MaintenanceWindowOptionsProperties `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 MaintenanceWindowOptions. -func (mwo MaintenanceWindowOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mwo.MaintenanceWindowOptionsProperties != nil { - objectMap["properties"] = mwo.MaintenanceWindowOptionsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MaintenanceWindowOptions struct. -func (mwo *MaintenanceWindowOptions) 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 maintenanceWindowOptionsProperties MaintenanceWindowOptionsProperties - err = json.Unmarshal(*v, &maintenanceWindowOptionsProperties) - if err != nil { - return err - } - mwo.MaintenanceWindowOptionsProperties = &maintenanceWindowOptionsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mwo.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mwo.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mwo.Type = &typeVar - } - } - } - - return nil -} - -// MaintenanceWindowOptionsProperties maintenance window options properties. -type MaintenanceWindowOptionsProperties struct { - // IsEnabled - Whether maintenance windows are enabled for the database. - IsEnabled *bool `json:"isEnabled,omitempty"` - // MaintenanceWindowCycles - Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, 24*60}. - MaintenanceWindowCycles *[]MaintenanceWindowTimeRange `json:"maintenanceWindowCycles,omitempty"` - // MinDurationInMinutes - Minimum duration of maintenance window. - MinDurationInMinutes *int32 `json:"minDurationInMinutes,omitempty"` - // DefaultDurationInMinutes - Default duration for maintenance window. - DefaultDurationInMinutes *int32 `json:"defaultDurationInMinutes,omitempty"` - // MinCycles - Minimum number of maintenance windows cycles to be set on the database. - MinCycles *int32 `json:"minCycles,omitempty"` - // TimeGranularityInMinutes - Time granularity in minutes for maintenance windows. - TimeGranularityInMinutes *int32 `json:"timeGranularityInMinutes,omitempty"` - // AllowMultipleMaintenanceWindowsPerCycle - Whether we allow multiple maintenance windows per cycle. - AllowMultipleMaintenanceWindowsPerCycle *bool `json:"allowMultipleMaintenanceWindowsPerCycle,omitempty"` -} - -// MaintenanceWindows maintenance windows. -type MaintenanceWindows struct { - autorest.Response `json:"-"` - // MaintenanceWindowsProperties - Resource properties. - *MaintenanceWindowsProperties `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 MaintenanceWindows. -func (mw MaintenanceWindows) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mw.MaintenanceWindowsProperties != nil { - objectMap["properties"] = mw.MaintenanceWindowsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MaintenanceWindows struct. -func (mw *MaintenanceWindows) 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 maintenanceWindowsProperties MaintenanceWindowsProperties - err = json.Unmarshal(*v, &maintenanceWindowsProperties) - if err != nil { - return err - } - mw.MaintenanceWindowsProperties = &maintenanceWindowsProperties - } - 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 - } - } - } - - return nil -} - -// MaintenanceWindowsProperties maintenance windows resource properties. -type MaintenanceWindowsProperties struct { - TimeRanges *[]MaintenanceWindowTimeRange `json:"timeRanges,omitempty"` -} - -// MaintenanceWindowTimeRange maintenance window time range. -type MaintenanceWindowTimeRange struct { - // DayOfWeek - Day of maintenance window. Possible values include: 'DayOfWeekSunday', 'DayOfWeekMonday', 'DayOfWeekTuesday', 'DayOfWeekWednesday', 'DayOfWeekThursday', 'DayOfWeekFriday', 'DayOfWeekSaturday' - DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` - // StartTime - Start time minutes offset from 12am. - StartTime *string `json:"startTime,omitempty"` - // Duration - Duration of maintenance window in minutes. - Duration *string `json:"duration,omitempty"` -} - -// ManagedIdentity the workspace managed identity -type ManagedIdentity struct { - // PrincipalID - READ-ONLY; The principal ID of the workspace managed identity - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of the workspace managed identity - TenantID *uuid.UUID `json:"tenantId,omitempty"` - // Type - The type of managed identity for the workspace. Possible values include: 'ResourceIdentityTypeNone', 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The user assigned managed identities. - UserAssignedIdentities map[string]*UserAssignedManagedIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ManagedIdentity. -func (mi ManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mi.Type != "" { - objectMap["type"] = mi.Type - } - if mi.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = mi.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ManagedIdentitySQLControlSettingsModel sql Control Settings for workspace managed identity -type ManagedIdentitySQLControlSettingsModel struct { - autorest.Response `json:"-"` - // ManagedIdentitySQLControlSettingsModelProperties - Sql Control Settings for workspace managed identity - *ManagedIdentitySQLControlSettingsModelProperties `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 ManagedIdentitySQLControlSettingsModel. -func (miscsm ManagedIdentitySQLControlSettingsModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miscsm.ManagedIdentitySQLControlSettingsModelProperties != nil { - objectMap["properties"] = miscsm.ManagedIdentitySQLControlSettingsModelProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedIdentitySQLControlSettingsModel struct. -func (miscsm *ManagedIdentitySQLControlSettingsModel) 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 managedIdentitySQLControlSettingsModelProperties ManagedIdentitySQLControlSettingsModelProperties - err = json.Unmarshal(*v, &managedIdentitySQLControlSettingsModelProperties) - if err != nil { - return err - } - miscsm.ManagedIdentitySQLControlSettingsModelProperties = &managedIdentitySQLControlSettingsModelProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - miscsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - miscsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - miscsm.Type = &typeVar - } - } - } - - return nil -} - -// ManagedIdentitySQLControlSettingsModelProperties sql Control Settings for workspace managed identity -type ManagedIdentitySQLControlSettingsModelProperties struct { - // GrantSQLControlToManagedIdentity - Grant sql control to managed identity - GrantSQLControlToManagedIdentity *ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity `json:"grantSqlControlToManagedIdentity,omitempty"` -} - -// ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity grant sql control to -// managed identity -type ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity struct { - // DesiredState - Desired state. Possible values include: 'DesiredStateEnabled', 'DesiredStateDisabled' - DesiredState DesiredState `json:"desiredState,omitempty"` - // ActualState - READ-ONLY; Actual state. Possible values include: 'ActualStateEnabling', 'ActualStateEnabled', 'ActualStateDisabling', 'ActualStateDisabled', 'ActualStateUnknown' - ActualState ActualState `json:"actualState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity. -func (miscsmSctmi ManagedIdentitySQLControlSettingsModelPropertiesGrantSQLControlToManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miscsmSctmi.DesiredState != "" { - objectMap["desiredState"] = miscsmSctmi.DesiredState - } - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntime managed integration runtime, including managed elastic and managed dedicated -// integration runtimes. -type ManagedIntegrationRuntime struct { - // State - READ-ONLY; Integration runtime state, only valid for managed dedicated integration runtime. Possible values include: 'IntegrationRuntimeStateInitial', 'IntegrationRuntimeStateStopped', 'IntegrationRuntimeStateStarted', 'IntegrationRuntimeStateStarting', 'IntegrationRuntimeStateStopping', 'IntegrationRuntimeStateNeedRegistration', 'IntegrationRuntimeStateOnline', 'IntegrationRuntimeStateLimited', 'IntegrationRuntimeStateOffline', 'IntegrationRuntimeStateAccessDenied' - State IntegrationRuntimeState `json:"state,omitempty"` - // ManagedIntegrationRuntimeTypeProperties - Managed integration runtime properties. - *ManagedIntegrationRuntimeTypeProperties `json:"typeProperties,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Description - Integration runtime description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeIntegrationRuntime', 'TypeManaged', 'TypeSelfHosted' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) MarshalJSON() ([]byte, error) { - mir.Type = TypeManaged - objectMap := make(map[string]interface{}) - if mir.ManagedIntegrationRuntimeTypeProperties != nil { - objectMap["typeProperties"] = mir.ManagedIntegrationRuntimeTypeProperties - } - if mir.Description != nil { - objectMap["description"] = mir.Description - } - if mir.Type != "" { - objectMap["type"] = mir.Type - } - for k, v := range mir.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntime is the BasicIntegrationRuntime implementation for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) AsManagedIntegrationRuntime() (*ManagedIntegrationRuntime, bool) { - return &mir, true -} - -// AsSelfHostedIntegrationRuntime is the BasicIntegrationRuntime implementation for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) AsSelfHostedIntegrationRuntime() (*SelfHostedIntegrationRuntime, bool) { - return nil, false -} - -// AsIntegrationRuntime is the BasicIntegrationRuntime implementation for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) AsIntegrationRuntime() (*IntegrationRuntime, bool) { - return nil, false -} - -// AsBasicIntegrationRuntime is the BasicIntegrationRuntime implementation for ManagedIntegrationRuntime. -func (mir ManagedIntegrationRuntime) AsBasicIntegrationRuntime() (BasicIntegrationRuntime, bool) { - return &mir, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagedIntegrationRuntime struct. -func (mir *ManagedIntegrationRuntime) 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 "state": - if v != nil { - var state IntegrationRuntimeState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - mir.State = state - } - case "typeProperties": - if v != nil { - var managedIntegrationRuntimeTypeProperties ManagedIntegrationRuntimeTypeProperties - err = json.Unmarshal(*v, &managedIntegrationRuntimeTypeProperties) - if err != nil { - return err - } - mir.ManagedIntegrationRuntimeTypeProperties = &managedIntegrationRuntimeTypeProperties - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mir.AdditionalProperties == nil { - mir.AdditionalProperties = make(map[string]interface{}) - } - mir.AdditionalProperties[k] = additionalProperties - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - mir.Description = &description - } - case "type": - if v != nil { - var typeVar Type - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mir.Type = typeVar - } - } - } - - return nil -} - -// ManagedIntegrationRuntimeError error definition for managed integration runtime. -type ManagedIntegrationRuntimeError struct { - // Time - READ-ONLY; The time when the error occurred. - Time *date.Time `json:"time,omitempty"` - // Code - READ-ONLY; Error code. - Code *string `json:"code,omitempty"` - // Parameters - READ-ONLY; Managed integration runtime error parameters. - Parameters *[]string `json:"parameters,omitempty"` - // Message - READ-ONLY; Error message. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeError. -func (mire ManagedIntegrationRuntimeError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntimeNode properties of integration runtime node. -type ManagedIntegrationRuntimeNode struct { - // NodeID - READ-ONLY; The managed integration runtime node id. - NodeID *string `json:"nodeId,omitempty"` - // Status - READ-ONLY; The managed integration runtime node status. Possible values include: 'ManagedIntegrationRuntimeNodeStatusStarting', 'ManagedIntegrationRuntimeNodeStatusAvailable', 'ManagedIntegrationRuntimeNodeStatusRecycling', 'ManagedIntegrationRuntimeNodeStatusUnavailable' - Status ManagedIntegrationRuntimeNodeStatus `json:"status,omitempty"` - // Errors - The errors that occurred on this integration runtime node. - Errors *[]ManagedIntegrationRuntimeError `json:"errors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeNode. -func (mirn ManagedIntegrationRuntimeNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mirn.Errors != nil { - objectMap["errors"] = mirn.Errors - } - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntimeOperationResult properties of managed integration runtime operation result. -type ManagedIntegrationRuntimeOperationResult struct { - // Type - READ-ONLY; The operation type. Could be start or stop. - Type *string `json:"type,omitempty"` - // StartTime - READ-ONLY; The start time of the operation. - StartTime *date.Time `json:"startTime,omitempty"` - // Result - READ-ONLY; The operation result. - Result *string `json:"result,omitempty"` - // ErrorCode - READ-ONLY; The error code. - ErrorCode *string `json:"errorCode,omitempty"` - // Parameters - READ-ONLY; Managed integration runtime error parameters. - Parameters *[]string `json:"parameters,omitempty"` - // ActivityID - READ-ONLY; The activity id for the operation request. - ActivityID *string `json:"activityId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeOperationResult. -func (miror ManagedIntegrationRuntimeOperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntimeStatus managed integration runtime status. -type ManagedIntegrationRuntimeStatus struct { - // ManagedIntegrationRuntimeStatusTypeProperties - Managed integration runtime status type properties. - *ManagedIntegrationRuntimeStatusTypeProperties `json:"typeProperties,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // DataFactoryName - READ-ONLY; The workspace name which the integration runtime belong to. - DataFactoryName *string `json:"dataFactoryName,omitempty"` - // State - READ-ONLY; The state of integration runtime. Possible values include: 'IntegrationRuntimeStateInitial', 'IntegrationRuntimeStateStopped', 'IntegrationRuntimeStateStarted', 'IntegrationRuntimeStateStarting', 'IntegrationRuntimeStateStopping', 'IntegrationRuntimeStateNeedRegistration', 'IntegrationRuntimeStateOnline', 'IntegrationRuntimeStateLimited', 'IntegrationRuntimeStateOffline', 'IntegrationRuntimeStateAccessDenied' - State IntegrationRuntimeState `json:"state,omitempty"` - // Type - Possible values include: 'TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus', 'TypeBasicIntegrationRuntimeStatusTypeManaged', 'TypeBasicIntegrationRuntimeStatusTypeSelfHosted' - Type TypeBasicIntegrationRuntimeStatus `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) MarshalJSON() ([]byte, error) { - mirs.Type = TypeBasicIntegrationRuntimeStatusTypeManaged - objectMap := make(map[string]interface{}) - if mirs.ManagedIntegrationRuntimeStatusTypeProperties != nil { - objectMap["typeProperties"] = mirs.ManagedIntegrationRuntimeStatusTypeProperties - } - if mirs.Type != "" { - objectMap["type"] = mirs.Type - } - for k, v := range mirs.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) AsManagedIntegrationRuntimeStatus() (*ManagedIntegrationRuntimeStatus, bool) { - return &mirs, true -} - -// AsSelfHostedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) AsSelfHostedIntegrationRuntimeStatus() (*SelfHostedIntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) AsIntegrationRuntimeStatus() (*IntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsBasicIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for ManagedIntegrationRuntimeStatus. -func (mirs ManagedIntegrationRuntimeStatus) AsBasicIntegrationRuntimeStatus() (BasicIntegrationRuntimeStatus, bool) { - return &mirs, true -} - -// UnmarshalJSON is the custom unmarshaler for ManagedIntegrationRuntimeStatus struct. -func (mirs *ManagedIntegrationRuntimeStatus) 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 "typeProperties": - if v != nil { - var managedIntegrationRuntimeStatusTypeProperties ManagedIntegrationRuntimeStatusTypeProperties - err = json.Unmarshal(*v, &managedIntegrationRuntimeStatusTypeProperties) - if err != nil { - return err - } - mirs.ManagedIntegrationRuntimeStatusTypeProperties = &managedIntegrationRuntimeStatusTypeProperties - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if mirs.AdditionalProperties == nil { - mirs.AdditionalProperties = make(map[string]interface{}) - } - mirs.AdditionalProperties[k] = additionalProperties - } - case "dataFactoryName": - if v != nil { - var dataFactoryName string - err = json.Unmarshal(*v, &dataFactoryName) - if err != nil { - return err - } - mirs.DataFactoryName = &dataFactoryName - } - case "state": - if v != nil { - var state IntegrationRuntimeState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - mirs.State = state - } - case "type": - if v != nil { - var typeVar TypeBasicIntegrationRuntimeStatus - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mirs.Type = typeVar - } - } - } - - return nil -} - -// ManagedIntegrationRuntimeStatusTypeProperties managed integration runtime status type properties. -type ManagedIntegrationRuntimeStatusTypeProperties struct { - // CreateTime - READ-ONLY; The time at which the integration runtime was created, in ISO8601 format. - CreateTime *date.Time `json:"createTime,omitempty"` - // Nodes - READ-ONLY; The list of nodes for managed integration runtime. - Nodes *[]ManagedIntegrationRuntimeNode `json:"nodes,omitempty"` - // OtherErrors - READ-ONLY; The errors that occurred on this integration runtime. - OtherErrors *[]ManagedIntegrationRuntimeError `json:"otherErrors,omitempty"` - // LastOperation - READ-ONLY; The last operation result that occurred on this integration runtime. - LastOperation *ManagedIntegrationRuntimeOperationResult `json:"lastOperation,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedIntegrationRuntimeStatusTypeProperties. -func (mirstp ManagedIntegrationRuntimeStatusTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedIntegrationRuntimeTypeProperties managed integration runtime type properties. -type ManagedIntegrationRuntimeTypeProperties struct { - // ComputeProperties - The compute resource for managed integration runtime. - ComputeProperties *IntegrationRuntimeComputeProperties `json:"computeProperties,omitempty"` - // SsisProperties - SSIS properties for managed integration runtime. - SsisProperties *IntegrationRuntimeSsisProperties `json:"ssisProperties,omitempty"` -} - -// ManagedVirtualNetworkSettings managed Virtual Network Settings -type ManagedVirtualNetworkSettings struct { - // PreventDataExfiltration - Prevent Data Exfiltration - PreventDataExfiltration *bool `json:"preventDataExfiltration,omitempty"` - // LinkedAccessCheckOnTargetResource - Linked Access Check On Target Resource - LinkedAccessCheckOnTargetResource *bool `json:"linkedAccessCheckOnTargetResource,omitempty"` - // AllowedAadTenantIdsForLinking - Allowed Aad Tenant Ids For Linking - AllowedAadTenantIdsForLinking *[]string `json:"allowedAadTenantIdsForLinking,omitempty"` -} - -// MetadataSyncConfig configuration for metadata sync -type MetadataSyncConfig struct { - autorest.Response `json:"-"` - // MetadataSyncConfigProperties - Metadata Sync Config properties - *MetadataSyncConfigProperties `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 MetadataSyncConfig. -func (msc MetadataSyncConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msc.MetadataSyncConfigProperties != nil { - objectMap["properties"] = msc.MetadataSyncConfigProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MetadataSyncConfig struct. -func (msc *MetadataSyncConfig) 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 metadataSyncConfigProperties MetadataSyncConfigProperties - err = json.Unmarshal(*v, &metadataSyncConfigProperties) - if err != nil { - return err - } - msc.MetadataSyncConfigProperties = &metadataSyncConfigProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - msc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - msc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - msc.Type = &typeVar - } - } - } - - return nil -} - -// MetadataSyncConfigProperties metadata Sync Config properties -type MetadataSyncConfigProperties struct { - // Enabled - Indicates whether the metadata sync is enabled or disabled - Enabled *bool `json:"enabled,omitempty"` - // SyncIntervalInMinutes - The Sync Interval in minutes. - SyncIntervalInMinutes *int32 `json:"syncIntervalInMinutes,omitempty"` -} - -// OperationMetaLogSpecification what is this? -type OperationMetaLogSpecification struct { - // DisplayName - Log display name - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Time range the log covers - BlobDuration *string `json:"blobDuration,omitempty"` - // Name - Log unique name - Name *string `json:"name,omitempty"` -} - -// OperationMetaMetricDimensionSpecification what is this? -type OperationMetaMetricDimensionSpecification struct { - // DisplayName - Dimension display name - DisplayName *string `json:"displayName,omitempty"` - // Name - Dimension unique name - Name *string `json:"name,omitempty"` - // ToBeExportedForShoebox - Whether this metric should be exported for Shoebox - ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` -} - -// OperationMetaMetricSpecification what is this? -type OperationMetaMetricSpecification struct { - // SourceMdmNamespace - The source MDM namespace - SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` - // DisplayName - Metric display name - DisplayName *string `json:"displayName,omitempty"` - // Name - Metric unique name - Name *string `json:"name,omitempty"` - // AggregationType - Metric aggregation type - AggregationType *string `json:"aggregationType,omitempty"` - // DisplayDescription - Metric description - DisplayDescription *string `json:"displayDescription,omitempty"` - // SourceMdmAccount - The source MDM account - SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` - // EnableRegionalMdmAccount - Whether the regional MDM account is enabled - EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` - // Unit - Metric units - Unit *string `json:"unit,omitempty"` - // Dimensions - Metric dimensions - Dimensions *[]OperationMetaMetricDimensionSpecification `json:"dimensions,omitempty"` - // SupportsInstanceLevelAggregation - Whether the metric supports instance-level aggregation - SupportsInstanceLevelAggregation *bool `json:"supportsInstanceLevelAggregation,omitempty"` - // MetricFilterPattern - Metric filter - MetricFilterPattern *string `json:"metricFilterPattern,omitempty"` -} - -// OperationMetaPropertyInfo what is this? -type OperationMetaPropertyInfo struct { - // ServiceSpecification - Operation service specification - ServiceSpecification *OperationMetaServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// OperationMetaServiceSpecification what is this? -type OperationMetaServiceSpecification struct { - // MetricSpecifications - Service metric specifications - MetricSpecifications *[]OperationMetaMetricSpecification `json:"metricSpecifications,omitempty"` - // LogSpecifications - Service log specifications - LogSpecifications *[]OperationMetaLogSpecification `json:"logSpecifications,omitempty"` -} - -// OperationResource an operation -type OperationResource struct { - autorest.Response `json:"-"` - // ID - Operation ID - ID *string `json:"id,omitempty"` - // Name - Operation name - Name *string `json:"name,omitempty"` - // Status - Operation status. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusFailed', 'OperationStatusCanceled' - Status OperationStatus `json:"status,omitempty"` - // Properties - Operation properties - Properties interface{} `json:"properties,omitempty"` - // Error - Errors from the operation - Error *ErrorDetail `json:"error,omitempty"` - // StartTime - Operation start time - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Operation start time - EndTime *date.Time `json:"endTime,omitempty"` - // PercentComplete - Completion percentage of the operation - PercentComplete *float64 `json:"percentComplete,omitempty"` -} - -// PrivateEndpoint private endpoint details -type PrivateEndpoint struct { - // ID - READ-ONLY; Resource id of the private endpoint. - 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 a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Private endpoint connection properties. - *PrivateEndpointConnectionProperties `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 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 - } - } - } - - return nil -} - -// PrivateEndpointConnectionForPrivateLinkHub ... -type PrivateEndpointConnectionForPrivateLinkHub struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; identifier - ID *string `json:"id,omitempty"` - // PrivateEndpointConnectionProperties - Properties of private endpoint connection for private link hub - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionForPrivateLinkHub. -func (pecfplh PrivateEndpointConnectionForPrivateLinkHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecfplh.Name != nil { - objectMap["name"] = pecfplh.Name - } - if pecfplh.Type != nil { - objectMap["type"] = pecfplh.Type - } - if pecfplh.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pecfplh.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnectionForPrivateLinkHub struct. -func (pecfplh *PrivateEndpointConnectionForPrivateLinkHub) 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 - } - pecfplh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pecfplh.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pecfplh.ID = &ID - } - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pecfplh.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - } - } - - return nil -} - -// PrivateEndpointConnectionForPrivateLinkHubBasic private Endpoint Connection For Private Link Hub - Basic -type PrivateEndpointConnectionForPrivateLinkHubBasic struct { - // ID - READ-ONLY; identifier - ID *string `json:"id,omitempty"` - // PrivateEndpointConnectionProperties - Properties of private endpoint connection for private link hub - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionForPrivateLinkHubBasic. -func (pecfplhb PrivateEndpointConnectionForPrivateLinkHubBasic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecfplhb.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pecfplhb.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnectionForPrivateLinkHubBasic struct. -func (pecfplhb *PrivateEndpointConnectionForPrivateLinkHubBasic) 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 - } - pecfplhb.ID = &ID - } - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pecfplhb.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - } - } - - return nil -} - -// PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse ... -type PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse struct { - autorest.Response `json:"-"` - Value *[]PrivateEndpointConnectionForPrivateLinkHub `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator provides access to a -// complete listing of PrivateEndpointConnectionForPrivateLinkHub values. -type PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator struct { - i int - page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage -} - -// 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 *PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator.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 *PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) 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 PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) Response() PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse { - 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 PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator) Value() PrivateEndpointConnectionForPrivateLinkHub { - if !iter.page.NotDone() { - return PrivateEndpointConnectionForPrivateLinkHub{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator type. -func NewPrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator(page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator { - return PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pecfplhRcr PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) IsEmpty() bool { - return pecfplhRcr.Value == nil || len(*pecfplhRcr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pecfplhRcr PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) hasNextLink() bool { - return pecfplhRcr.NextLink != nil && len(*pecfplhRcr.NextLink) != 0 -} - -// privateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pecfplhRcr PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) privateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePreparer(ctx context.Context) (*http.Request, error) { - if !pecfplhRcr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pecfplhRcr.NextLink))) -} - -// PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage contains a page of -// PrivateEndpointConnectionForPrivateLinkHub values. -type PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage struct { - fn func(context.Context, PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) (PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, error) - pecfplhrcr PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse -} - -// 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 *PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage.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.pecfplhrcr) - if err != nil { - return err - } - page.pecfplhrcr = 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 *PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) NotDone() bool { - return !page.pecfplhrcr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) Response() PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse { - return page.pecfplhrcr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage) Values() []PrivateEndpointConnectionForPrivateLinkHub { - if page.pecfplhrcr.IsEmpty() { - return nil - } - return *page.pecfplhrcr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage type. -func NewPrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage(cur PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, getNextPage func(context.Context, PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) (PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, error)) PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage { - return PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage{ - fn: getNextPage, - pecfplhrcr: cur, - } -} - -// PrivateEndpointConnectionList a list of private endpoint connections -type PrivateEndpointConnectionList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionList. -func (pecl PrivateEndpointConnectionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListIterator provides access to a complete listing of PrivateEndpointConnection -// values. -type PrivateEndpointConnectionListIterator struct { - i int - page PrivateEndpointConnectionListPage -} - -// 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 *PrivateEndpointConnectionListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListIterator.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 *PrivateEndpointConnectionListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListIterator) 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 PrivateEndpointConnectionListIterator) Response() PrivateEndpointConnectionList { - 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 PrivateEndpointConnectionListIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListIterator type. -func NewPrivateEndpointConnectionListIterator(page PrivateEndpointConnectionListPage) PrivateEndpointConnectionListIterator { - return PrivateEndpointConnectionListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pecl PrivateEndpointConnectionList) IsEmpty() bool { - return pecl.Value == nil || len(*pecl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pecl PrivateEndpointConnectionList) hasNextLink() bool { - return pecl.NextLink != nil && len(*pecl.NextLink) != 0 -} - -// privateEndpointConnectionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pecl PrivateEndpointConnectionList) privateEndpointConnectionListPreparer(ctx context.Context) (*http.Request, error) { - if !pecl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pecl.NextLink))) -} - -// PrivateEndpointConnectionListPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListPage struct { - fn func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error) - pecl PrivateEndpointConnectionList -} - -// 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 *PrivateEndpointConnectionListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListPage.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.pecl) - if err != nil { - return err - } - page.pecl = 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 *PrivateEndpointConnectionListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListPage) NotDone() bool { - return !page.pecl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListPage) Response() PrivateEndpointConnectionList { - return page.pecl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListPage) Values() []PrivateEndpointConnection { - if page.pecl.IsEmpty() { - return nil - } - return *page.pecl.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListPage type. -func NewPrivateEndpointConnectionListPage(cur PrivateEndpointConnectionList, getNextPage func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error)) PrivateEndpointConnectionListPage { - return PrivateEndpointConnectionListPage{ - fn: getNextPage, - pecl: cur, - } -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,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) -} - -// PrivateEndpointConnectionsCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateFuture) 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 PrivateEndpointConnectionsCreateFuture.Result. -func (future *PrivateEndpointConnectionsCreateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.PrivateEndpointConnectionsCreateFuture") - 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.CreateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsCreateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (OperationResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (or OperationResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - or.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.PrivateEndpointConnectionsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { - or, err = client.DeleteResponder(or.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsDeleteFuture", "Result", or.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkHub a privateLinkHub -type PrivateLinkHub struct { - autorest.Response `json:"-"` - // PrivateLinkHubProperties - PrivateLinkHub resource properties - *PrivateLinkHubProperties `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 PrivateLinkHub. -func (plh PrivateLinkHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plh.PrivateLinkHubProperties != nil { - objectMap["properties"] = plh.PrivateLinkHubProperties - } - if plh.Tags != nil { - objectMap["tags"] = plh.Tags - } - if plh.Location != nil { - objectMap["location"] = plh.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkHub struct. -func (plh *PrivateLinkHub) 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 privateLinkHubProperties PrivateLinkHubProperties - err = json.Unmarshal(*v, &privateLinkHubProperties) - if err != nil { - return err - } - plh.PrivateLinkHubProperties = &privateLinkHubProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - plh.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - plh.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plh.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plh.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkHubInfoListResult list of privateLinkHubs -type PrivateLinkHubInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of privateLinkHubs - Value *[]PrivateLinkHub `json:"value,omitempty"` -} - -// PrivateLinkHubInfoListResultIterator provides access to a complete listing of PrivateLinkHub values. -type PrivateLinkHubInfoListResultIterator struct { - i int - page PrivateLinkHubInfoListResultPage -} - -// 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 *PrivateLinkHubInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubInfoListResultIterator.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 *PrivateLinkHubInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkHubInfoListResultIterator) 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 PrivateLinkHubInfoListResultIterator) Response() PrivateLinkHubInfoListResult { - 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 PrivateLinkHubInfoListResultIterator) Value() PrivateLinkHub { - if !iter.page.NotDone() { - return PrivateLinkHub{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkHubInfoListResultIterator type. -func NewPrivateLinkHubInfoListResultIterator(page PrivateLinkHubInfoListResultPage) PrivateLinkHubInfoListResultIterator { - return PrivateLinkHubInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plhilr PrivateLinkHubInfoListResult) IsEmpty() bool { - return plhilr.Value == nil || len(*plhilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plhilr PrivateLinkHubInfoListResult) hasNextLink() bool { - return plhilr.NextLink != nil && len(*plhilr.NextLink) != 0 -} - -// privateLinkHubInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plhilr PrivateLinkHubInfoListResult) privateLinkHubInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plhilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plhilr.NextLink))) -} - -// PrivateLinkHubInfoListResultPage contains a page of PrivateLinkHub values. -type PrivateLinkHubInfoListResultPage struct { - fn func(context.Context, PrivateLinkHubInfoListResult) (PrivateLinkHubInfoListResult, error) - plhilr PrivateLinkHubInfoListResult -} - -// 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 *PrivateLinkHubInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubInfoListResultPage.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.plhilr) - if err != nil { - return err - } - page.plhilr = 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 *PrivateLinkHubInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkHubInfoListResultPage) NotDone() bool { - return !page.plhilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkHubInfoListResultPage) Response() PrivateLinkHubInfoListResult { - return page.plhilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkHubInfoListResultPage) Values() []PrivateLinkHub { - if page.plhilr.IsEmpty() { - return nil - } - return *page.plhilr.Value -} - -// Creates a new instance of the PrivateLinkHubInfoListResultPage type. -func NewPrivateLinkHubInfoListResultPage(cur PrivateLinkHubInfoListResult, getNextPage func(context.Context, PrivateLinkHubInfoListResult) (PrivateLinkHubInfoListResult, error)) PrivateLinkHubInfoListResultPage { - return PrivateLinkHubInfoListResultPage{ - fn: getNextPage, - plhilr: cur, - } -} - -// PrivateLinkHubPatchInfo privateLinkHub patch details -type PrivateLinkHubPatchInfo struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkHubPatchInfo. -func (plhpi PrivateLinkHubPatchInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plhpi.Tags != nil { - objectMap["tags"] = plhpi.Tags - } - return json.Marshal(objectMap) -} - -// PrivateLinkHubProperties privateLinkHub properties -type PrivateLinkHubProperties struct { - // ProvisioningState - PrivateLinkHub provisioning state - ProvisioningState *string `json:"provisioningState,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections - PrivateEndpointConnections *[]PrivateEndpointConnectionForPrivateLinkHubBasic `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkHubProperties. -func (plhp PrivateLinkHubProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plhp.ProvisioningState != nil { - objectMap["provisioningState"] = plhp.ProvisioningState - } - return json.Marshal(objectMap) -} - -// PrivateLinkHubsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PrivateLinkHubsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkHubsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkHubsDeleteFuture) 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 PrivateLinkHubsDeleteFuture.Result. -func (future *PrivateLinkHubsDeleteFuture) result(client PrivateLinkHubsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.PrivateLinkHubsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // Properties - READ-ONLY; The private link resource properties. - Properties *PrivateLinkResourceProperties `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 PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) - if err != nil { - return err - } - page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; Required DNS zone names of the the private link resource. - 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 connection state details of the private endpoint -type PrivateLinkServiceConnectionState struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionState. -func (plscs PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscs.Status != nil { - objectMap["status"] = plscs.Status - } - if plscs.Description != nil { - objectMap["description"] = plscs.Description - } - return json.Marshal(objectMap) -} - -// 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) -} - -// PurviewConfiguration purview Configuration -type PurviewConfiguration struct { - // PurviewResourceID - Purview Resource ID - PurviewResourceID *string `json:"purviewResourceId,omitempty"` -} - -// QueryInterval a database query. -type QueryInterval struct { - // IntervalStartTime - READ-ONLY; The start time of the measurement interval (ISO8601 format). - IntervalStartTime *date.Time `json:"intervalStartTime,omitempty"` - // ExecutionCount - READ-ONLY; The number of times the query was executed during this interval. - ExecutionCount *float64 `json:"executionCount,omitempty"` - // Metrics - READ-ONLY; The list of query metrics during this interval. - Metrics *[]QueryMetric `json:"metrics,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryInterval. -func (qi QueryInterval) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QueryMetric a database query. -type QueryMetric struct { - // Name - READ-ONLY; The name of the metric - Name *string `json:"name,omitempty"` - // DisplayName - READ-ONLY; The name of the metric for display in user interface - DisplayName *string `json:"displayName,omitempty"` - // Unit - READ-ONLY; The unit of measurement. Possible values include: 'QueryMetricUnitPercentage', 'QueryMetricUnitKB', 'QueryMetricUnitMicroseconds' - Unit QueryMetricUnit `json:"unit,omitempty"` - // Value - READ-ONLY; The measured value - Value *float64 `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryMetric. -func (qm QueryMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QueryStatistic a database query. -type QueryStatistic struct { - // QueryID - READ-ONLY; The id of the query - QueryID *string `json:"queryId,omitempty"` - // Intervals - READ-ONLY; The list of query intervals. - Intervals *[]QueryInterval `json:"intervals,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryStatistic. -func (qs QueryStatistic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecommendedSensitivityLabelUpdate a recommended sensitivity label update operation. -type RecommendedSensitivityLabelUpdate struct { - // RecommendedSensitivityLabelUpdateProperties - Resource properties. - *RecommendedSensitivityLabelUpdateProperties `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 RecommendedSensitivityLabelUpdate. -func (rslu RecommendedSensitivityLabelUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rslu.RecommendedSensitivityLabelUpdateProperties != nil { - objectMap["properties"] = rslu.RecommendedSensitivityLabelUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecommendedSensitivityLabelUpdate struct. -func (rslu *RecommendedSensitivityLabelUpdate) 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 recommendedSensitivityLabelUpdateProperties RecommendedSensitivityLabelUpdateProperties - err = json.Unmarshal(*v, &recommendedSensitivityLabelUpdateProperties) - if err != nil { - return err - } - rslu.RecommendedSensitivityLabelUpdateProperties = &recommendedSensitivityLabelUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rslu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rslu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rslu.Type = &typeVar - } - } - } - - return nil -} - -// RecommendedSensitivityLabelUpdateList a list of recommended sensitivity label update operations. -type RecommendedSensitivityLabelUpdateList struct { - Operations *[]RecommendedSensitivityLabelUpdate `json:"operations,omitempty"` -} - -// RecommendedSensitivityLabelUpdateProperties properties of an operation executed on a recommended -// sensitivity label. -type RecommendedSensitivityLabelUpdateProperties struct { - // Op - Possible values include: 'RecommendedSensitivityLabelUpdateKindEnable', 'RecommendedSensitivityLabelUpdateKindDisable' - Op RecommendedSensitivityLabelUpdateKind `json:"op,omitempty"` - // Schema - Schema name of the column to update. - Schema *string `json:"schema,omitempty"` - // Table - Table name of the column to update. - Table *string `json:"table,omitempty"` - // Column - Column name to update. - Column *string `json:"column,omitempty"` -} - -// RecoverableSQLPool a recoverable sql pool -type RecoverableSQLPool struct { - autorest.Response `json:"-"` - // RecoverableSQLPoolProperties - The properties of a recoverable sql pool - *RecoverableSQLPoolProperties `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 RecoverableSQLPool. -func (rsp RecoverableSQLPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsp.RecoverableSQLPoolProperties != nil { - objectMap["properties"] = rsp.RecoverableSQLPoolProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecoverableSQLPool struct. -func (rsp *RecoverableSQLPool) 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 recoverableSQLPoolProperties RecoverableSQLPoolProperties - err = json.Unmarshal(*v, &recoverableSQLPoolProperties) - if err != nil { - return err - } - rsp.RecoverableSQLPoolProperties = &recoverableSQLPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rsp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rsp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rsp.Type = &typeVar - } - } - } - - return nil -} - -// RecoverableSQLPoolListResult the response to a list recoverable sql pools request -type RecoverableSQLPoolListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; A list of recoverable sql pool - Value *[]RecoverableSQLPool `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableSQLPoolListResult. -func (rsplr RecoverableSQLPoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableSQLPoolListResultIterator provides access to a complete listing of RecoverableSQLPool values. -type RecoverableSQLPoolListResultIterator struct { - i int - page RecoverableSQLPoolListResultPage -} - -// 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 *RecoverableSQLPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableSQLPoolListResultIterator.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 *RecoverableSQLPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RecoverableSQLPoolListResultIterator) 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 RecoverableSQLPoolListResultIterator) Response() RecoverableSQLPoolListResult { - 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 RecoverableSQLPoolListResultIterator) Value() RecoverableSQLPool { - if !iter.page.NotDone() { - return RecoverableSQLPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RecoverableSQLPoolListResultIterator type. -func NewRecoverableSQLPoolListResultIterator(page RecoverableSQLPoolListResultPage) RecoverableSQLPoolListResultIterator { - return RecoverableSQLPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rsplr RecoverableSQLPoolListResult) IsEmpty() bool { - return rsplr.Value == nil || len(*rsplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rsplr RecoverableSQLPoolListResult) hasNextLink() bool { - return rsplr.NextLink != nil && len(*rsplr.NextLink) != 0 -} - -// recoverableSQLPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rsplr RecoverableSQLPoolListResult) recoverableSQLPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rsplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rsplr.NextLink))) -} - -// RecoverableSQLPoolListResultPage contains a page of RecoverableSQLPool values. -type RecoverableSQLPoolListResultPage struct { - fn func(context.Context, RecoverableSQLPoolListResult) (RecoverableSQLPoolListResult, error) - rsplr RecoverableSQLPoolListResult -} - -// 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 *RecoverableSQLPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableSQLPoolListResultPage.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.rsplr) - if err != nil { - return err - } - page.rsplr = 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 *RecoverableSQLPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RecoverableSQLPoolListResultPage) NotDone() bool { - return !page.rsplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RecoverableSQLPoolListResultPage) Response() RecoverableSQLPoolListResult { - return page.rsplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RecoverableSQLPoolListResultPage) Values() []RecoverableSQLPool { - if page.rsplr.IsEmpty() { - return nil - } - return *page.rsplr.Value -} - -// Creates a new instance of the RecoverableSQLPoolListResultPage type. -func NewRecoverableSQLPoolListResultPage(cur RecoverableSQLPoolListResult, getNextPage func(context.Context, RecoverableSQLPoolListResult) (RecoverableSQLPoolListResult, error)) RecoverableSQLPoolListResultPage { - return RecoverableSQLPoolListResultPage{ - fn: getNextPage, - rsplr: cur, - } -} - -// RecoverableSQLPoolProperties the properties of a recoverable sql pool -type RecoverableSQLPoolProperties struct { - // Edition - READ-ONLY; The edition of the database - Edition *string `json:"edition,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective name of the database - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // ElasticPoolName - READ-ONLY; The elastic pool name of the database - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // LastAvailableBackupDate - READ-ONLY; The last available backup date of the database (ISO8601 format) - LastAvailableBackupDate *date.Time `json:"lastAvailableBackupDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableSQLPoolProperties. -func (rspp RecoverableSQLPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReplaceAllFirewallRulesOperationResponse an existing operation for replacing the firewall rules -type ReplaceAllFirewallRulesOperationResponse struct { - autorest.Response `json:"-"` - // OperationID - The operation ID - OperationID *string `json:"operationId,omitempty"` -} - -// ReplaceAllIPFirewallRulesRequest replace all IP firewall rules request -type ReplaceAllIPFirewallRulesRequest struct { - // IPFirewallRules - IP firewall rule properties - IPFirewallRules map[string]*IPFirewallRuleProperties `json:"ipFirewallRules"` -} - -// MarshalJSON is the custom marshaler for ReplaceAllIPFirewallRulesRequest. -func (raifrr ReplaceAllIPFirewallRulesRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if raifrr.IPFirewallRules != nil { - objectMap["ipFirewallRules"] = raifrr.IPFirewallRules - } - return json.Marshal(objectMap) -} - -// ReplicationLink represents a Sql pool replication link. -type ReplicationLink struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Location of the workspace that contains this firewall rule. - Location *string `json:"location,omitempty"` - // ReplicationLinkProperties - The properties representing the resource. - *ReplicationLinkProperties `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 ReplicationLink. -func (rl ReplicationLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rl.ReplicationLinkProperties != nil { - objectMap["properties"] = rl.ReplicationLinkProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ReplicationLink struct. -func (rl *ReplicationLink) 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 - } - rl.Location = &location - } - case "properties": - if v != nil { - var replicationLinkProperties ReplicationLinkProperties - err = json.Unmarshal(*v, &replicationLinkProperties) - if err != nil { - return err - } - rl.ReplicationLinkProperties = &replicationLinkProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rl.Type = &typeVar - } - } - } - - return nil -} - -// ReplicationLinkListResult represents the response to a List Sql pool replication link request. -type ReplicationLinkListResult struct { - autorest.Response `json:"-"` - // Value - The list of Sql pool replication links housed in the Sql pool. - Value *[]ReplicationLink `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationLinkListResult. -func (rllr ReplicationLinkListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rllr.Value != nil { - objectMap["value"] = rllr.Value - } - return json.Marshal(objectMap) -} - -// ReplicationLinkListResultIterator provides access to a complete listing of ReplicationLink values. -type ReplicationLinkListResultIterator struct { - i int - page ReplicationLinkListResultPage -} - -// 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 *ReplicationLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinkListResultIterator.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 *ReplicationLinkListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReplicationLinkListResultIterator) 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 ReplicationLinkListResultIterator) Response() ReplicationLinkListResult { - 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 ReplicationLinkListResultIterator) Value() ReplicationLink { - if !iter.page.NotDone() { - return ReplicationLink{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReplicationLinkListResultIterator type. -func NewReplicationLinkListResultIterator(page ReplicationLinkListResultPage) ReplicationLinkListResultIterator { - return ReplicationLinkListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rllr ReplicationLinkListResult) IsEmpty() bool { - return rllr.Value == nil || len(*rllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rllr ReplicationLinkListResult) hasNextLink() bool { - return rllr.NextLink != nil && len(*rllr.NextLink) != 0 -} - -// replicationLinkListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rllr ReplicationLinkListResult) replicationLinkListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rllr.NextLink))) -} - -// ReplicationLinkListResultPage contains a page of ReplicationLink values. -type ReplicationLinkListResultPage struct { - fn func(context.Context, ReplicationLinkListResult) (ReplicationLinkListResult, error) - rllr ReplicationLinkListResult -} - -// 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 *ReplicationLinkListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinkListResultPage.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.rllr) - if err != nil { - return err - } - page.rllr = 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 *ReplicationLinkListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReplicationLinkListResultPage) NotDone() bool { - return !page.rllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReplicationLinkListResultPage) Response() ReplicationLinkListResult { - return page.rllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReplicationLinkListResultPage) Values() []ReplicationLink { - if page.rllr.IsEmpty() { - return nil - } - return *page.rllr.Value -} - -// Creates a new instance of the ReplicationLinkListResultPage type. -func NewReplicationLinkListResultPage(cur ReplicationLinkListResult, getNextPage func(context.Context, ReplicationLinkListResult) (ReplicationLinkListResult, error)) ReplicationLinkListResultPage { - return ReplicationLinkListResultPage{ - fn: getNextPage, - rllr: cur, - } -} - -// ReplicationLinkProperties represents the properties of a Sql pool replication link. -type ReplicationLinkProperties struct { - // IsTerminationAllowed - READ-ONLY; Legacy value indicating whether termination is allowed. Currently always returns true. - IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty"` - // ReplicationMode - READ-ONLY; Replication mode of this replication link. - ReplicationMode *string `json:"replicationMode,omitempty"` - // PartnerServer - READ-ONLY; The name of the workspace hosting the partner Sql pool. - PartnerServer *string `json:"partnerServer,omitempty"` - // PartnerDatabase - READ-ONLY; The name of the partner Sql pool. - PartnerDatabase *string `json:"partnerDatabase,omitempty"` - // PartnerLocation - READ-ONLY; The Azure Region of the partner Sql pool. - PartnerLocation *string `json:"partnerLocation,omitempty"` - // Role - READ-ONLY; The role of the Sql pool in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' - Role ReplicationRole `json:"role,omitempty"` - // PartnerRole - READ-ONLY; The role of the partner Sql pool in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' - PartnerRole ReplicationRole `json:"partnerRole,omitempty"` - // StartTime - READ-ONLY; The start time for the replication link. - StartTime *date.Time `json:"startTime,omitempty"` - // PercentComplete - READ-ONLY; The percentage of seeding complete for the replication link. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ReplicationState - READ-ONLY; The replication state for the replication link. Possible values include: 'ReplicationStatePENDING', 'ReplicationStateSEEDING', 'ReplicationStateCATCHUP', 'ReplicationStateSUSPENDED' - ReplicationState ReplicationState `json:"replicationState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicationLinkProperties. -func (rlp ReplicationLinkProperties) 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) -} - -// ResourceMoveDefinition contains the information necessary to perform a resource move (rename). -type ResourceMoveDefinition struct { - // ID - The target ID for the resource - ID *string `json:"id,omitempty"` -} - -// RestorableDroppedSQLPool a restorable dropped Sql pool -type RestorableDroppedSQLPool struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // RestorableDroppedSQLPoolProperties - The properties of a restorable dropped Sql pool - *RestorableDroppedSQLPoolProperties `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 RestorableDroppedSQLPool. -func (rdsp RestorableDroppedSQLPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdsp.RestorableDroppedSQLPoolProperties != nil { - objectMap["properties"] = rdsp.RestorableDroppedSQLPoolProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorableDroppedSQLPool struct. -func (rdsp *RestorableDroppedSQLPool) 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 - } - rdsp.Location = &location - } - case "properties": - if v != nil { - var restorableDroppedSQLPoolProperties RestorableDroppedSQLPoolProperties - err = json.Unmarshal(*v, &restorableDroppedSQLPoolProperties) - if err != nil { - return err - } - rdsp.RestorableDroppedSQLPoolProperties = &restorableDroppedSQLPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rdsp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rdsp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rdsp.Type = &typeVar - } - } - } - - return nil -} - -// RestorableDroppedSQLPoolListResult the response to a list restorable dropped Sql pools request -type RestorableDroppedSQLPoolListResult struct { - autorest.Response `json:"-"` - // Value - A list of restorable dropped Sql pools - Value *[]RestorableDroppedSQLPool `json:"value,omitempty"` -} - -// RestorableDroppedSQLPoolProperties the properties of a restorable dropped Sql pool -type RestorableDroppedSQLPoolProperties struct { - // DatabaseName - READ-ONLY; The name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // Edition - READ-ONLY; The edition of the database - Edition *string `json:"edition,omitempty"` - // MaxSizeBytes - READ-ONLY; The max size in bytes of the database - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective name of the database - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // ElasticPoolName - READ-ONLY; The elastic pool name of the database - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format) - CreationDate *date.Time `json:"creationDate,omitempty"` - // DeletionDate - READ-ONLY; The deletion date of the database (ISO8601 format) - DeletionDate *date.Time `json:"deletionDate,omitempty"` - // EarliestRestoreDate - READ-ONLY; The earliest restore date of the database (ISO8601 format) - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorableDroppedSQLPoolProperties. -func (rdspp RestorableDroppedSQLPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorePoint database restore points. -type RestorePoint struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // RestorePointProperties - Resource properties. - *RestorePointProperties `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 RestorePoint. -func (rp RestorePoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.RestorePointProperties != nil { - objectMap["properties"] = rp.RestorePointProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RestorePoint struct. -func (rp *RestorePoint) 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 - } - rp.Location = &location - } - case "properties": - if v != nil { - var restorePointProperties RestorePointProperties - err = json.Unmarshal(*v, &restorePointProperties) - if err != nil { - return err - } - rp.RestorePointProperties = &restorePointProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rp.Type = &typeVar - } - } - } - - return nil -} - -// RestorePointListResult a list of long term retention backups. -type RestorePointListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]RestorePoint `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorePointListResult. -func (rplr RestorePointListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestorePointListResultIterator provides access to a complete listing of RestorePoint values. -type RestorePointListResultIterator struct { - i int - page RestorePointListResultPage -} - -// 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 *RestorePointListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointListResultIterator.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 *RestorePointListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RestorePointListResultIterator) 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 RestorePointListResultIterator) Response() RestorePointListResult { - 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 RestorePointListResultIterator) Value() RestorePoint { - if !iter.page.NotDone() { - return RestorePoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RestorePointListResultIterator type. -func NewRestorePointListResultIterator(page RestorePointListResultPage) RestorePointListResultIterator { - return RestorePointListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rplr RestorePointListResult) IsEmpty() bool { - return rplr.Value == nil || len(*rplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rplr RestorePointListResult) hasNextLink() bool { - return rplr.NextLink != nil && len(*rplr.NextLink) != 0 -} - -// restorePointListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rplr RestorePointListResult) restorePointListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rplr.NextLink))) -} - -// RestorePointListResultPage contains a page of RestorePoint values. -type RestorePointListResultPage struct { - fn func(context.Context, RestorePointListResult) (RestorePointListResult, error) - rplr RestorePointListResult -} - -// 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 *RestorePointListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorePointListResultPage.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.rplr) - if err != nil { - return err - } - page.rplr = 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 *RestorePointListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RestorePointListResultPage) NotDone() bool { - return !page.rplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RestorePointListResultPage) Response() RestorePointListResult { - return page.rplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RestorePointListResultPage) Values() []RestorePoint { - if page.rplr.IsEmpty() { - return nil - } - return *page.rplr.Value -} - -// Creates a new instance of the RestorePointListResultPage type. -func NewRestorePointListResultPage(cur RestorePointListResult, getNextPage func(context.Context, RestorePointListResult) (RestorePointListResult, error)) RestorePointListResultPage { - return RestorePointListResultPage{ - fn: getNextPage, - rplr: cur, - } -} - -// RestorePointProperties properties of a database restore point -type RestorePointProperties struct { - // RestorePointType - READ-ONLY; The type of restore point. Possible values include: 'RestorePointTypeCONTINUOUS', 'RestorePointTypeDISCRETE' - RestorePointType RestorePointType `json:"restorePointType,omitempty"` - // EarliestRestoreDate - READ-ONLY; The earliest time to which this database can be restored - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // RestorePointCreationDate - READ-ONLY; The time the backup was taken - RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"` - // RestorePointLabel - READ-ONLY; The label of restore point for backup request by user - RestorePointLabel *string `json:"restorePointLabel,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorePointProperties. -func (rpp RestorePointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BasicSecretBase the base definition of a secret type. -type BasicSecretBase interface { - AsSecureString() (*SecureString, bool) - AsSecretBase() (*SecretBase, bool) -} - -// SecretBase the base definition of a secret type. -type SecretBase struct { - // Type - Possible values include: 'TypeBasicSecretBaseTypeSecretBase', 'TypeBasicSecretBaseTypeSecureString' - Type TypeBasicSecretBase `json:"type,omitempty"` -} - -func unmarshalBasicSecretBase(body []byte) (BasicSecretBase, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicSecretBaseTypeSecureString): - var ss SecureString - err := json.Unmarshal(body, &ss) - return ss, err - default: - var sb SecretBase - err := json.Unmarshal(body, &sb) - return sb, err - } -} -func unmarshalBasicSecretBaseArray(body []byte) ([]BasicSecretBase, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - sbArray := make([]BasicSecretBase, len(rawMessages)) - - for index, rawMessage := range rawMessages { - sb, err := unmarshalBasicSecretBase(*rawMessage) - if err != nil { - return nil, err - } - sbArray[index] = sb - } - return sbArray, nil -} - -// MarshalJSON is the custom marshaler for SecretBase. -func (sb SecretBase) MarshalJSON() ([]byte, error) { - sb.Type = TypeBasicSecretBaseTypeSecretBase - objectMap := make(map[string]interface{}) - if sb.Type != "" { - objectMap["type"] = sb.Type - } - return json.Marshal(objectMap) -} - -// AsSecureString is the BasicSecretBase implementation for SecretBase. -func (sb SecretBase) AsSecureString() (*SecureString, bool) { - return nil, false -} - -// AsSecretBase is the BasicSecretBase implementation for SecretBase. -func (sb SecretBase) AsSecretBase() (*SecretBase, bool) { - return &sb, true -} - -// AsBasicSecretBase is the BasicSecretBase implementation for SecretBase. -func (sb SecretBase) AsBasicSecretBase() (BasicSecretBase, bool) { - return &sb, true -} - -// SecureString azure Synapse secure string definition. The string value will be masked with asterisks '*' -// during Get or List API calls. -type SecureString struct { - // Value - Value of secure string. - Value *string `json:"value,omitempty"` - // Type - Possible values include: 'TypeBasicSecretBaseTypeSecretBase', 'TypeBasicSecretBaseTypeSecureString' - Type TypeBasicSecretBase `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecureString. -func (ss SecureString) MarshalJSON() ([]byte, error) { - ss.Type = TypeBasicSecretBaseTypeSecureString - objectMap := make(map[string]interface{}) - if ss.Value != nil { - objectMap["value"] = ss.Value - } - if ss.Type != "" { - objectMap["type"] = ss.Type - } - return json.Marshal(objectMap) -} - -// AsSecureString is the BasicSecretBase implementation for SecureString. -func (ss SecureString) AsSecureString() (*SecureString, bool) { - return &ss, true -} - -// AsSecretBase is the BasicSecretBase implementation for SecureString. -func (ss SecureString) AsSecretBase() (*SecretBase, bool) { - return nil, false -} - -// AsBasicSecretBase is the BasicSecretBase implementation for SecureString. -func (ss SecureString) AsBasicSecretBase() (BasicSecretBase, bool) { - return &ss, true -} - -// SecurityAlertPolicyProperties properties of a security alert policy. -type SecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific Sql pool. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' - State SecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action - DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses *[]string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // CreationTime - READ-ONLY; Specifies the UTC creation time of the policy. - CreationTime *date.Time `json:"creationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityAlertPolicyProperties. -func (sapp SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sapp.State != "" { - objectMap["state"] = sapp.State - } - if sapp.DisabledAlerts != nil { - objectMap["disabledAlerts"] = sapp.DisabledAlerts - } - if sapp.EmailAddresses != nil { - objectMap["emailAddresses"] = sapp.EmailAddresses - } - if sapp.EmailAccountAdmins != nil { - objectMap["emailAccountAdmins"] = sapp.EmailAccountAdmins - } - if sapp.StorageEndpoint != nil { - objectMap["storageEndpoint"] = sapp.StorageEndpoint - } - if sapp.StorageAccountAccessKey != nil { - objectMap["storageAccountAccessKey"] = sapp.StorageAccountAccessKey - } - if sapp.RetentionDays != nil { - objectMap["retentionDays"] = sapp.RetentionDays - } - return json.Marshal(objectMap) -} - -// SelfHostedIntegrationRuntime self-hosted integration runtime. -type SelfHostedIntegrationRuntime struct { - // SelfHostedIntegrationRuntimeTypeProperties - When this property is not null, means this is a linked integration runtime. The property is used to access original integration runtime. - *SelfHostedIntegrationRuntimeTypeProperties `json:"typeProperties,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Description - Integration runtime description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeIntegrationRuntime', 'TypeManaged', 'TypeSelfHosted' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) MarshalJSON() ([]byte, error) { - shir.Type = TypeSelfHosted - objectMap := make(map[string]interface{}) - if shir.SelfHostedIntegrationRuntimeTypeProperties != nil { - objectMap["typeProperties"] = shir.SelfHostedIntegrationRuntimeTypeProperties - } - if shir.Description != nil { - objectMap["description"] = shir.Description - } - if shir.Type != "" { - objectMap["type"] = shir.Type - } - for k, v := range shir.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntime is the BasicIntegrationRuntime implementation for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) AsManagedIntegrationRuntime() (*ManagedIntegrationRuntime, bool) { - return nil, false -} - -// AsSelfHostedIntegrationRuntime is the BasicIntegrationRuntime implementation for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) AsSelfHostedIntegrationRuntime() (*SelfHostedIntegrationRuntime, bool) { - return &shir, true -} - -// AsIntegrationRuntime is the BasicIntegrationRuntime implementation for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) AsIntegrationRuntime() (*IntegrationRuntime, bool) { - return nil, false -} - -// AsBasicIntegrationRuntime is the BasicIntegrationRuntime implementation for SelfHostedIntegrationRuntime. -func (shir SelfHostedIntegrationRuntime) AsBasicIntegrationRuntime() (BasicIntegrationRuntime, bool) { - return &shir, true -} - -// UnmarshalJSON is the custom unmarshaler for SelfHostedIntegrationRuntime struct. -func (shir *SelfHostedIntegrationRuntime) 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 "typeProperties": - if v != nil { - var selfHostedIntegrationRuntimeTypeProperties SelfHostedIntegrationRuntimeTypeProperties - err = json.Unmarshal(*v, &selfHostedIntegrationRuntimeTypeProperties) - if err != nil { - return err - } - shir.SelfHostedIntegrationRuntimeTypeProperties = &selfHostedIntegrationRuntimeTypeProperties - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if shir.AdditionalProperties == nil { - shir.AdditionalProperties = make(map[string]interface{}) - } - shir.AdditionalProperties[k] = additionalProperties - } - case "description": - if v != nil { - var description string - err = json.Unmarshal(*v, &description) - if err != nil { - return err - } - shir.Description = &description - } - case "type": - if v != nil { - var typeVar Type - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - shir.Type = typeVar - } - } - } - - return nil -} - -// SelfHostedIntegrationRuntimeNode properties of Self-hosted integration runtime node. -type SelfHostedIntegrationRuntimeNode struct { - autorest.Response `json:"-"` - // NodeName - READ-ONLY; Name of the integration runtime node. - NodeName *string `json:"nodeName,omitempty"` - // MachineName - READ-ONLY; Machine name of the integration runtime node. - MachineName *string `json:"machineName,omitempty"` - // HostServiceURI - READ-ONLY; URI for the host machine of the integration runtime. - HostServiceURI *string `json:"hostServiceUri,omitempty"` - // Status - READ-ONLY; Status of the integration runtime node. Possible values include: 'SelfHostedIntegrationRuntimeNodeStatusNeedRegistration', 'SelfHostedIntegrationRuntimeNodeStatusOnline', 'SelfHostedIntegrationRuntimeNodeStatusLimited', 'SelfHostedIntegrationRuntimeNodeStatusOffline', 'SelfHostedIntegrationRuntimeNodeStatusUpgrading', 'SelfHostedIntegrationRuntimeNodeStatusInitializing', 'SelfHostedIntegrationRuntimeNodeStatusInitializeFailed' - Status SelfHostedIntegrationRuntimeNodeStatus `json:"status,omitempty"` - // Capabilities - READ-ONLY; The integration runtime capabilities dictionary - Capabilities map[string]*string `json:"capabilities"` - // VersionStatus - READ-ONLY; Status of the integration runtime node version. - VersionStatus *string `json:"versionStatus,omitempty"` - // Version - READ-ONLY; Version of the integration runtime node. - Version *string `json:"version,omitempty"` - // RegisterTime - READ-ONLY; The time at which the integration runtime node was registered in ISO8601 format. - RegisterTime *date.Time `json:"registerTime,omitempty"` - // LastConnectTime - READ-ONLY; The most recent time at which the integration runtime was connected in ISO8601 format. - LastConnectTime *date.Time `json:"lastConnectTime,omitempty"` - // ExpiryTime - READ-ONLY; The time at which the integration runtime will expire in ISO8601 format. - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // LastStartTime - READ-ONLY; The time the node last started up. - LastStartTime *date.Time `json:"lastStartTime,omitempty"` - // LastStopTime - READ-ONLY; The integration runtime node last stop time. - LastStopTime *date.Time `json:"lastStopTime,omitempty"` - // LastUpdateResult - READ-ONLY; The result of the last integration runtime node update. Possible values include: 'IntegrationRuntimeUpdateResultNone', 'IntegrationRuntimeUpdateResultSucceed', 'IntegrationRuntimeUpdateResultFail' - LastUpdateResult IntegrationRuntimeUpdateResult `json:"lastUpdateResult,omitempty"` - // LastStartUpdateTime - READ-ONLY; The last time for the integration runtime node update start. - LastStartUpdateTime *date.Time `json:"lastStartUpdateTime,omitempty"` - // LastEndUpdateTime - READ-ONLY; The last time for the integration runtime node update end. - LastEndUpdateTime *date.Time `json:"lastEndUpdateTime,omitempty"` - // IsActiveDispatcher - READ-ONLY; Indicates whether this node is the active dispatcher for integration runtime requests. - IsActiveDispatcher *bool `json:"isActiveDispatcher,omitempty"` - // ConcurrentJobsLimit - READ-ONLY; Maximum concurrent jobs on the integration runtime node. - ConcurrentJobsLimit *int32 `json:"concurrentJobsLimit,omitempty"` - // MaxConcurrentJobs - READ-ONLY; The maximum concurrent jobs in this integration runtime. - MaxConcurrentJobs *int32 `json:"maxConcurrentJobs,omitempty"` -} - -// MarshalJSON is the custom marshaler for SelfHostedIntegrationRuntimeNode. -func (shirn SelfHostedIntegrationRuntimeNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SelfHostedIntegrationRuntimeStatus self-hosted integration runtime status. -type SelfHostedIntegrationRuntimeStatus struct { - // SelfHostedIntegrationRuntimeStatusTypeProperties - Self-hosted integration runtime status type properties. - *SelfHostedIntegrationRuntimeStatusTypeProperties `json:"typeProperties,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // DataFactoryName - READ-ONLY; The workspace name which the integration runtime belong to. - DataFactoryName *string `json:"dataFactoryName,omitempty"` - // State - READ-ONLY; The state of integration runtime. Possible values include: 'IntegrationRuntimeStateInitial', 'IntegrationRuntimeStateStopped', 'IntegrationRuntimeStateStarted', 'IntegrationRuntimeStateStarting', 'IntegrationRuntimeStateStopping', 'IntegrationRuntimeStateNeedRegistration', 'IntegrationRuntimeStateOnline', 'IntegrationRuntimeStateLimited', 'IntegrationRuntimeStateOffline', 'IntegrationRuntimeStateAccessDenied' - State IntegrationRuntimeState `json:"state,omitempty"` - // Type - Possible values include: 'TypeBasicIntegrationRuntimeStatusTypeIntegrationRuntimeStatus', 'TypeBasicIntegrationRuntimeStatusTypeManaged', 'TypeBasicIntegrationRuntimeStatusTypeSelfHosted' - Type TypeBasicIntegrationRuntimeStatus `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) MarshalJSON() ([]byte, error) { - shirs.Type = TypeBasicIntegrationRuntimeStatusTypeSelfHosted - objectMap := make(map[string]interface{}) - if shirs.SelfHostedIntegrationRuntimeStatusTypeProperties != nil { - objectMap["typeProperties"] = shirs.SelfHostedIntegrationRuntimeStatusTypeProperties - } - if shirs.Type != "" { - objectMap["type"] = shirs.Type - } - for k, v := range shirs.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsManagedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) AsManagedIntegrationRuntimeStatus() (*ManagedIntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsSelfHostedIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) AsSelfHostedIntegrationRuntimeStatus() (*SelfHostedIntegrationRuntimeStatus, bool) { - return &shirs, true -} - -// AsIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) AsIntegrationRuntimeStatus() (*IntegrationRuntimeStatus, bool) { - return nil, false -} - -// AsBasicIntegrationRuntimeStatus is the BasicIntegrationRuntimeStatus implementation for SelfHostedIntegrationRuntimeStatus. -func (shirs SelfHostedIntegrationRuntimeStatus) AsBasicIntegrationRuntimeStatus() (BasicIntegrationRuntimeStatus, bool) { - return &shirs, true -} - -// UnmarshalJSON is the custom unmarshaler for SelfHostedIntegrationRuntimeStatus struct. -func (shirs *SelfHostedIntegrationRuntimeStatus) 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 "typeProperties": - if v != nil { - var selfHostedIntegrationRuntimeStatusTypeProperties SelfHostedIntegrationRuntimeStatusTypeProperties - err = json.Unmarshal(*v, &selfHostedIntegrationRuntimeStatusTypeProperties) - if err != nil { - return err - } - shirs.SelfHostedIntegrationRuntimeStatusTypeProperties = &selfHostedIntegrationRuntimeStatusTypeProperties - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if shirs.AdditionalProperties == nil { - shirs.AdditionalProperties = make(map[string]interface{}) - } - shirs.AdditionalProperties[k] = additionalProperties - } - case "dataFactoryName": - if v != nil { - var dataFactoryName string - err = json.Unmarshal(*v, &dataFactoryName) - if err != nil { - return err - } - shirs.DataFactoryName = &dataFactoryName - } - case "state": - if v != nil { - var state IntegrationRuntimeState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - shirs.State = state - } - case "type": - if v != nil { - var typeVar TypeBasicIntegrationRuntimeStatus - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - shirs.Type = typeVar - } - } - } - - return nil -} - -// SelfHostedIntegrationRuntimeStatusTypeProperties self-hosted integration runtime status type properties. -type SelfHostedIntegrationRuntimeStatusTypeProperties struct { - // CreateTime - READ-ONLY; The time at which the integration runtime was created, in ISO8601 format. - CreateTime *date.Time `json:"createTime,omitempty"` - // TaskQueueID - READ-ONLY; The task queue id of the integration runtime. - TaskQueueID *string `json:"taskQueueId,omitempty"` - // NodeCommunicationChannelEncryptionMode - READ-ONLY; The node communication Channel encryption mode - NodeCommunicationChannelEncryptionMode *string `json:"nodeCommunicationChannelEncryptionMode,omitempty"` - // InternalChannelEncryption - READ-ONLY; It is used to set the encryption mode for node-node communication channel (when more than 2 self-hosted integration runtime nodes exist). Possible values include: 'IntegrationRuntimeInternalChannelEncryptionModeNotSet', 'IntegrationRuntimeInternalChannelEncryptionModeSslEncrypted', 'IntegrationRuntimeInternalChannelEncryptionModeNotEncrypted' - InternalChannelEncryption IntegrationRuntimeInternalChannelEncryptionMode `json:"internalChannelEncryption,omitempty"` - // Version - READ-ONLY; Version of the integration runtime. - Version *string `json:"version,omitempty"` - // Nodes - The list of nodes for this integration runtime. - Nodes *[]SelfHostedIntegrationRuntimeNode `json:"nodes,omitempty"` - // ScheduledUpdateDate - READ-ONLY; The date at which the integration runtime will be scheduled to update, in ISO8601 format. - ScheduledUpdateDate *date.Time `json:"scheduledUpdateDate,omitempty"` - // UpdateDelayOffset - READ-ONLY; The time in the date scheduled by service to update the integration runtime, e.g., PT03H is 3 hours - UpdateDelayOffset *string `json:"updateDelayOffset,omitempty"` - // LocalTimeZoneOffset - READ-ONLY; The local time zone offset in hours. - LocalTimeZoneOffset *string `json:"localTimeZoneOffset,omitempty"` - // Capabilities - READ-ONLY; Object with additional information about integration runtime capabilities. - Capabilities map[string]*string `json:"capabilities"` - // ServiceUrls - READ-ONLY; The URLs for the services used in integration runtime backend service. - ServiceUrls *[]string `json:"serviceUrls,omitempty"` - // AutoUpdate - READ-ONLY; Whether Self-hosted integration runtime auto update has been turned on. Possible values include: 'IntegrationRuntimeAutoUpdateOn', 'IntegrationRuntimeAutoUpdateOff' - AutoUpdate IntegrationRuntimeAutoUpdate `json:"autoUpdate,omitempty"` - // VersionStatus - READ-ONLY; Status of the integration runtime version. - VersionStatus *string `json:"versionStatus,omitempty"` - // Links - The list of linked integration runtimes that are created to share with this integration runtime. - Links *[]LinkedIntegrationRuntime `json:"links,omitempty"` - // PushedVersion - READ-ONLY; The version that the integration runtime is going to update to. - PushedVersion *string `json:"pushedVersion,omitempty"` - // LatestVersion - READ-ONLY; The latest version on download center. - LatestVersion *string `json:"latestVersion,omitempty"` - // AutoUpdateETA - READ-ONLY; The estimated time when the self-hosted integration runtime will be updated. - AutoUpdateETA *date.Time `json:"autoUpdateETA,omitempty"` -} - -// MarshalJSON is the custom marshaler for SelfHostedIntegrationRuntimeStatusTypeProperties. -func (shirstp SelfHostedIntegrationRuntimeStatusTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if shirstp.Nodes != nil { - objectMap["nodes"] = shirstp.Nodes - } - if shirstp.Links != nil { - objectMap["links"] = shirstp.Links - } - return json.Marshal(objectMap) -} - -// SelfHostedIntegrationRuntimeTypeProperties the self-hosted integration runtime properties. -type SelfHostedIntegrationRuntimeTypeProperties struct { - // LinkedInfo - Linked integration runtime type from data factory - LinkedInfo BasicLinkedIntegrationRuntimeType `json:"linkedInfo,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for SelfHostedIntegrationRuntimeTypeProperties struct. -func (shirtp *SelfHostedIntegrationRuntimeTypeProperties) 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 "linkedInfo": - if v != nil { - linkedInfo, err := unmarshalBasicLinkedIntegrationRuntimeType(*v) - if err != nil { - return err - } - shirtp.LinkedInfo = linkedInfo - } - } - } - - return nil -} - -// SensitivityLabel a sensitivity label. -type SensitivityLabel struct { - autorest.Response `json:"-"` - // SensitivityLabelProperties - Resource properties. - *SensitivityLabelProperties `json:"properties,omitempty"` - // ManagedBy - READ-ONLY; managed by - ManagedBy *string `json:"managedBy,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 SensitivityLabel. -func (sl SensitivityLabel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sl.SensitivityLabelProperties != nil { - objectMap["properties"] = sl.SensitivityLabelProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SensitivityLabel struct. -func (sl *SensitivityLabel) 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 sensitivityLabelProperties SensitivityLabelProperties - err = json.Unmarshal(*v, &sensitivityLabelProperties) - if err != nil { - return err - } - sl.SensitivityLabelProperties = &sensitivityLabelProperties - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - sl.ManagedBy = &managedBy - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sl.Type = &typeVar - } - } - } - - return nil -} - -// SensitivityLabelListResult a list of sensitivity labels. -type SensitivityLabelListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SensitivityLabel `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SensitivityLabelListResult. -func (sllr SensitivityLabelListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SensitivityLabelListResultIterator provides access to a complete listing of SensitivityLabel values. -type SensitivityLabelListResultIterator struct { - i int - page SensitivityLabelListResultPage -} - -// 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 *SensitivityLabelListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultIterator.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 *SensitivityLabelListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SensitivityLabelListResultIterator) 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 SensitivityLabelListResultIterator) Response() SensitivityLabelListResult { - 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 SensitivityLabelListResultIterator) Value() SensitivityLabel { - if !iter.page.NotDone() { - return SensitivityLabel{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SensitivityLabelListResultIterator type. -func NewSensitivityLabelListResultIterator(page SensitivityLabelListResultPage) SensitivityLabelListResultIterator { - return SensitivityLabelListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sllr SensitivityLabelListResult) IsEmpty() bool { - return sllr.Value == nil || len(*sllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sllr SensitivityLabelListResult) hasNextLink() bool { - return sllr.NextLink != nil && len(*sllr.NextLink) != 0 -} - -// sensitivityLabelListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sllr SensitivityLabelListResult) sensitivityLabelListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sllr.NextLink))) -} - -// SensitivityLabelListResultPage contains a page of SensitivityLabel values. -type SensitivityLabelListResultPage struct { - fn func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error) - sllr SensitivityLabelListResult -} - -// 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 *SensitivityLabelListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultPage.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.sllr) - if err != nil { - return err - } - page.sllr = 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 *SensitivityLabelListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SensitivityLabelListResultPage) NotDone() bool { - return !page.sllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SensitivityLabelListResultPage) Response() SensitivityLabelListResult { - return page.sllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SensitivityLabelListResultPage) Values() []SensitivityLabel { - if page.sllr.IsEmpty() { - return nil - } - return *page.sllr.Value -} - -// Creates a new instance of the SensitivityLabelListResultPage type. -func NewSensitivityLabelListResultPage(cur SensitivityLabelListResult, getNextPage func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error)) SensitivityLabelListResultPage { - return SensitivityLabelListResultPage{ - fn: getNextPage, - sllr: cur, - } -} - -// SensitivityLabelProperties properties of a sensitivity label. -type SensitivityLabelProperties struct { - // SchemaName - READ-ONLY; The schema name. - SchemaName *string `json:"schemaName,omitempty"` - // TableName - READ-ONLY; The table name. - TableName *string `json:"tableName,omitempty"` - // ColumnName - READ-ONLY; The column name. - ColumnName *string `json:"columnName,omitempty"` - // LabelName - The label name. - LabelName *string `json:"labelName,omitempty"` - // LabelID - The label ID. - LabelID *string `json:"labelId,omitempty"` - // InformationType - The information type. - InformationType *string `json:"informationType,omitempty"` - // InformationTypeID - The information type ID. - InformationTypeID *string `json:"informationTypeId,omitempty"` - // IsDisabled - READ-ONLY; Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. - IsDisabled *bool `json:"isDisabled,omitempty"` - // Rank - Possible values include: 'SensitivityLabelRankNone', 'SensitivityLabelRankLow', 'SensitivityLabelRankMedium', 'SensitivityLabelRankHigh', 'SensitivityLabelRankCritical' - Rank SensitivityLabelRank `json:"rank,omitempty"` -} - -// MarshalJSON is the custom marshaler for SensitivityLabelProperties. -func (slp SensitivityLabelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if slp.LabelName != nil { - objectMap["labelName"] = slp.LabelName - } - if slp.LabelID != nil { - objectMap["labelId"] = slp.LabelID - } - if slp.InformationType != nil { - objectMap["informationType"] = slp.InformationType - } - if slp.InformationTypeID != nil { - objectMap["informationTypeId"] = slp.InformationTypeID - } - if slp.Rank != "" { - objectMap["rank"] = slp.Rank - } - return json.Marshal(objectMap) -} - -// SensitivityLabelUpdate a sensitivity label update operation. -type SensitivityLabelUpdate struct { - // SensitivityLabelUpdateProperties - Resource properties. - *SensitivityLabelUpdateProperties `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 SensitivityLabelUpdate. -func (slu SensitivityLabelUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if slu.SensitivityLabelUpdateProperties != nil { - objectMap["properties"] = slu.SensitivityLabelUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SensitivityLabelUpdate struct. -func (slu *SensitivityLabelUpdate) 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 sensitivityLabelUpdateProperties SensitivityLabelUpdateProperties - err = json.Unmarshal(*v, &sensitivityLabelUpdateProperties) - if err != nil { - return err - } - slu.SensitivityLabelUpdateProperties = &sensitivityLabelUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - slu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - slu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - slu.Type = &typeVar - } - } - } - - return nil -} - -// SensitivityLabelUpdateList a list of sensitivity label update operations. -type SensitivityLabelUpdateList struct { - Operations *[]SensitivityLabelUpdate `json:"operations,omitempty"` -} - -// SensitivityLabelUpdateProperties properties of an operation executed on a sensitivity label. -type SensitivityLabelUpdateProperties struct { - // Op - Possible values include: 'SensitivityLabelUpdateKindSet', 'SensitivityLabelUpdateKindRemove' - Op SensitivityLabelUpdateKind `json:"op,omitempty"` - // Schema - Schema name of the column to update. - Schema *string `json:"schema,omitempty"` - // Table - Table name of the column to update. - Table *string `json:"table,omitempty"` - // Column - Column name to update. - Column *string `json:"column,omitempty"` - // SensitivityLabel - The sensitivity label information to apply on a column. - SensitivityLabel *SensitivityLabel `json:"sensitivityLabel,omitempty"` -} - -// ServerBlobAuditingPolicy a server blob auditing policy. -type ServerBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ServerBlobAuditingPolicyProperties - Resource properties. - *ServerBlobAuditingPolicyProperties `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 ServerBlobAuditingPolicy. -func (sbap ServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sbap.ServerBlobAuditingPolicyProperties != nil { - objectMap["properties"] = sbap.ServerBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerBlobAuditingPolicy struct. -func (sbap *ServerBlobAuditingPolicy) 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 serverBlobAuditingPolicyProperties ServerBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &serverBlobAuditingPolicyProperties) - if err != nil { - return err - } - sbap.ServerBlobAuditingPolicyProperties = &serverBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sbap.Type = &typeVar - } - } - } - - return nil -} - -// ServerBlobAuditingPolicyListResult a list of server auditing settings. -type ServerBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerBlobAuditingPolicyListResult. -func (sbaplr ServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ServerBlobAuditingPolicy values. -type ServerBlobAuditingPolicyListResultIterator struct { - i int - page ServerBlobAuditingPolicyListResultPage -} - -// 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 *ServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPolicyListResultIterator.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 *ServerBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerBlobAuditingPolicyListResultIterator) 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 ServerBlobAuditingPolicyListResultIterator) Response() ServerBlobAuditingPolicyListResult { - 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 ServerBlobAuditingPolicyListResultIterator) Value() ServerBlobAuditingPolicy { - if !iter.page.NotDone() { - return ServerBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerBlobAuditingPolicyListResultIterator type. -func NewServerBlobAuditingPolicyListResultIterator(page ServerBlobAuditingPolicyListResultPage) ServerBlobAuditingPolicyListResultIterator { - return ServerBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sbaplr ServerBlobAuditingPolicyListResult) IsEmpty() bool { - return sbaplr.Value == nil || len(*sbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sbaplr ServerBlobAuditingPolicyListResult) hasNextLink() bool { - return sbaplr.NextLink != nil && len(*sbaplr.NextLink) != 0 -} - -// serverBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sbaplr ServerBlobAuditingPolicyListResult) serverBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sbaplr.NextLink))) -} - -// ServerBlobAuditingPolicyListResultPage contains a page of ServerBlobAuditingPolicy values. -type ServerBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ServerBlobAuditingPolicyListResult) (ServerBlobAuditingPolicyListResult, error) - sbaplr ServerBlobAuditingPolicyListResult -} - -// 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 *ServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPolicyListResultPage.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.sbaplr) - if err != nil { - return err - } - page.sbaplr = 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 *ServerBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.sbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerBlobAuditingPolicyListResultPage) Response() ServerBlobAuditingPolicyListResult { - return page.sbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerBlobAuditingPolicyListResultPage) Values() []ServerBlobAuditingPolicy { - if page.sbaplr.IsEmpty() { - return nil - } - return *page.sbaplr.Value -} - -// Creates a new instance of the ServerBlobAuditingPolicyListResultPage type. -func NewServerBlobAuditingPolicyListResultPage(cur ServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ServerBlobAuditingPolicyListResult) (ServerBlobAuditingPolicyListResult, error)) ServerBlobAuditingPolicyListResultPage { - return ServerBlobAuditingPolicyListResultPage{ - fn: getNextPage, - sbaplr: cur, - } -} - -// ServerBlobAuditingPolicyProperties properties of a server blob auditing policy. -type ServerBlobAuditingPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` -} - -// ServerSecurityAlertPolicy workspace managed Sql server security alert policy. -type ServerSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // ServerSecurityAlertPolicyProperties - Resource properties. - *ServerSecurityAlertPolicyProperties `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 ServerSecurityAlertPolicy. -func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssap.ServerSecurityAlertPolicyProperties != nil { - objectMap["properties"] = ssap.ServerSecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. -func (ssap *ServerSecurityAlertPolicy) 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 serverSecurityAlertPolicyProperties ServerSecurityAlertPolicyProperties - err = json.Unmarshal(*v, &serverSecurityAlertPolicyProperties) - if err != nil { - return err - } - ssap.ServerSecurityAlertPolicyProperties = &serverSecurityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ssap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ssap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ssap.Type = &typeVar - } - } - } - - return nil -} - -// ServerSecurityAlertPolicyListResult a list of the workspace managed sql server's security alert -// policies. -type ServerSecurityAlertPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicyListResult. -func (ssaplr ServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerSecurityAlertPolicyListResultIterator provides access to a complete listing of -// ServerSecurityAlertPolicy values. -type ServerSecurityAlertPolicyListResultIterator struct { - i int - page ServerSecurityAlertPolicyListResultPage -} - -// 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 *ServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultIterator.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 *ServerSecurityAlertPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerSecurityAlertPolicyListResultIterator) 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 ServerSecurityAlertPolicyListResultIterator) Response() ServerSecurityAlertPolicyListResult { - 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 ServerSecurityAlertPolicyListResultIterator) Value() ServerSecurityAlertPolicy { - if !iter.page.NotDone() { - return ServerSecurityAlertPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerSecurityAlertPolicyListResultIterator type. -func NewServerSecurityAlertPolicyListResultIterator(page ServerSecurityAlertPolicyListResultPage) ServerSecurityAlertPolicyListResultIterator { - return ServerSecurityAlertPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssaplr ServerSecurityAlertPolicyListResult) IsEmpty() bool { - return ssaplr.Value == nil || len(*ssaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssaplr ServerSecurityAlertPolicyListResult) hasNextLink() bool { - return ssaplr.NextLink != nil && len(*ssaplr.NextLink) != 0 -} - -// serverSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssaplr ServerSecurityAlertPolicyListResult) serverSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ssaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssaplr.NextLink))) -} - -// ServerSecurityAlertPolicyListResultPage contains a page of ServerSecurityAlertPolicy values. -type ServerSecurityAlertPolicyListResultPage struct { - fn func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error) - ssaplr ServerSecurityAlertPolicyListResult -} - -// 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 *ServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultPage.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.ssaplr) - if err != nil { - return err - } - page.ssaplr = 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 *ServerSecurityAlertPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerSecurityAlertPolicyListResultPage) NotDone() bool { - return !page.ssaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerSecurityAlertPolicyListResultPage) Response() ServerSecurityAlertPolicyListResult { - return page.ssaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerSecurityAlertPolicyListResultPage) Values() []ServerSecurityAlertPolicy { - if page.ssaplr.IsEmpty() { - return nil - } - return *page.ssaplr.Value -} - -// Creates a new instance of the ServerSecurityAlertPolicyListResultPage type. -func NewServerSecurityAlertPolicyListResultPage(cur ServerSecurityAlertPolicyListResult, getNextPage func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error)) ServerSecurityAlertPolicyListResultPage { - return ServerSecurityAlertPolicyListResultPage{ - fn: getNextPage, - ssaplr: cur, - } -} - -// ServerSecurityAlertPolicyProperties properties of a security alert policy. -type ServerSecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific server. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' - State SecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action - DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses *[]string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // CreationTime - READ-ONLY; Specifies the UTC creation time of the policy. - CreationTime *date.Time `json:"creationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicyProperties. -func (ssapp ServerSecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssapp.State != "" { - objectMap["state"] = ssapp.State - } - if ssapp.DisabledAlerts != nil { - objectMap["disabledAlerts"] = ssapp.DisabledAlerts - } - if ssapp.EmailAddresses != nil { - objectMap["emailAddresses"] = ssapp.EmailAddresses - } - if ssapp.EmailAccountAdmins != nil { - objectMap["emailAccountAdmins"] = ssapp.EmailAccountAdmins - } - if ssapp.StorageEndpoint != nil { - objectMap["storageEndpoint"] = ssapp.StorageEndpoint - } - if ssapp.StorageAccountAccessKey != nil { - objectMap["storageAccountAccessKey"] = ssapp.StorageAccountAccessKey - } - if ssapp.RetentionDays != nil { - objectMap["retentionDays"] = ssapp.RetentionDays - } - return json.Marshal(objectMap) -} - -// ServerUsage represents server metrics. -type ServerUsage struct { - // Name - READ-ONLY; Name of the server usage metric. - Name *string `json:"name,omitempty"` - // ResourceName - READ-ONLY; The name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // DisplayName - READ-ONLY; The metric display name. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; The current value of the metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The current limit of the metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units of the metric. - Unit *string `json:"unit,omitempty"` - // NextResetTime - READ-ONLY; The next reset time for the metric (ISO8601 format). - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerUsage. -func (su ServerUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerUsageListResult represents the response to a list server metrics request. -type ServerUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of server metrics for the server. - Value *[]ServerUsage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerUsageListResult. -func (sulr ServerUsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sulr.Value != nil { - objectMap["value"] = sulr.Value - } - return json.Marshal(objectMap) -} - -// ServerUsageListResultIterator provides access to a complete listing of ServerUsage values. -type ServerUsageListResultIterator struct { - i int - page ServerUsageListResultPage -} - -// 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 *ServerUsageListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerUsageListResultIterator.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 *ServerUsageListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerUsageListResultIterator) 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 ServerUsageListResultIterator) Response() ServerUsageListResult { - 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 ServerUsageListResultIterator) Value() ServerUsage { - if !iter.page.NotDone() { - return ServerUsage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerUsageListResultIterator type. -func NewServerUsageListResultIterator(page ServerUsageListResultPage) ServerUsageListResultIterator { - return ServerUsageListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sulr ServerUsageListResult) IsEmpty() bool { - return sulr.Value == nil || len(*sulr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sulr ServerUsageListResult) hasNextLink() bool { - return sulr.NextLink != nil && len(*sulr.NextLink) != 0 -} - -// serverUsageListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sulr ServerUsageListResult) serverUsageListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sulr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sulr.NextLink))) -} - -// ServerUsageListResultPage contains a page of ServerUsage values. -type ServerUsageListResultPage struct { - fn func(context.Context, ServerUsageListResult) (ServerUsageListResult, error) - sulr ServerUsageListResult -} - -// 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 *ServerUsageListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerUsageListResultPage.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.sulr) - if err != nil { - return err - } - page.sulr = 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 *ServerUsageListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerUsageListResultPage) NotDone() bool { - return !page.sulr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerUsageListResultPage) Response() ServerUsageListResult { - return page.sulr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerUsageListResultPage) Values() []ServerUsage { - if page.sulr.IsEmpty() { - return nil - } - return *page.sulr.Value -} - -// Creates a new instance of the ServerUsageListResultPage type. -func NewServerUsageListResultPage(cur ServerUsageListResult, getNextPage func(context.Context, ServerUsageListResult) (ServerUsageListResult, error)) ServerUsageListResultPage { - return ServerUsageListResultPage{ - fn: getNextPage, - sulr: cur, - } -} - -// ServerVulnerabilityAssessment a server vulnerability assessment. -type ServerVulnerabilityAssessment struct { - autorest.Response `json:"-"` - // ServerVulnerabilityAssessmentProperties - Resource properties. - *ServerVulnerabilityAssessmentProperties `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 ServerVulnerabilityAssessment. -func (sva ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sva.ServerVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = sva.ServerVulnerabilityAssessmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerVulnerabilityAssessment struct. -func (sva *ServerVulnerabilityAssessment) 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 serverVulnerabilityAssessmentProperties ServerVulnerabilityAssessmentProperties - err = json.Unmarshal(*v, &serverVulnerabilityAssessmentProperties) - if err != nil { - return err - } - sva.ServerVulnerabilityAssessmentProperties = &serverVulnerabilityAssessmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sva.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sva.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sva.Type = &typeVar - } - } - } - - return nil -} - -// ServerVulnerabilityAssessmentListResult a list of the server's vulnerability assessments. -type ServerVulnerabilityAssessmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerVulnerabilityAssessment `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerVulnerabilityAssessmentListResult. -func (svalr ServerVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerVulnerabilityAssessmentListResultIterator provides access to a complete listing of -// ServerVulnerabilityAssessment values. -type ServerVulnerabilityAssessmentListResultIterator struct { - i int - page ServerVulnerabilityAssessmentListResultPage -} - -// 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 *ServerVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultIterator.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 *ServerVulnerabilityAssessmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerVulnerabilityAssessmentListResultIterator) 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 ServerVulnerabilityAssessmentListResultIterator) Response() ServerVulnerabilityAssessmentListResult { - 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 ServerVulnerabilityAssessmentListResultIterator) Value() ServerVulnerabilityAssessment { - if !iter.page.NotDone() { - return ServerVulnerabilityAssessment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerVulnerabilityAssessmentListResultIterator type. -func NewServerVulnerabilityAssessmentListResultIterator(page ServerVulnerabilityAssessmentListResultPage) ServerVulnerabilityAssessmentListResultIterator { - return ServerVulnerabilityAssessmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (svalr ServerVulnerabilityAssessmentListResult) IsEmpty() bool { - return svalr.Value == nil || len(*svalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (svalr ServerVulnerabilityAssessmentListResult) hasNextLink() bool { - return svalr.NextLink != nil && len(*svalr.NextLink) != 0 -} - -// serverVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (svalr ServerVulnerabilityAssessmentListResult) serverVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !svalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(svalr.NextLink))) -} - -// ServerVulnerabilityAssessmentListResultPage contains a page of ServerVulnerabilityAssessment values. -type ServerVulnerabilityAssessmentListResultPage struct { - fn func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error) - svalr ServerVulnerabilityAssessmentListResult -} - -// 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 *ServerVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultPage.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.svalr) - if err != nil { - return err - } - page.svalr = 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 *ServerVulnerabilityAssessmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerVulnerabilityAssessmentListResultPage) NotDone() bool { - return !page.svalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerVulnerabilityAssessmentListResultPage) Response() ServerVulnerabilityAssessmentListResult { - return page.svalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerVulnerabilityAssessmentListResultPage) Values() []ServerVulnerabilityAssessment { - if page.svalr.IsEmpty() { - return nil - } - return *page.svalr.Value -} - -// Creates a new instance of the ServerVulnerabilityAssessmentListResultPage type. -func NewServerVulnerabilityAssessmentListResultPage(cur ServerVulnerabilityAssessmentListResult, getNextPage func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error)) ServerVulnerabilityAssessmentListResultPage { - return ServerVulnerabilityAssessmentListResultPage{ - fn: getNextPage, - svalr: cur, - } -} - -// ServerVulnerabilityAssessmentProperties properties of a server Vulnerability Assessment. -type ServerVulnerabilityAssessmentProperties struct { - // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RecurringScans - The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` -} - -// SetObject ... -type SetObject struct { - autorest.Response `json:"-"` - Value interface{} `json:"value,omitempty"` -} - -// Sku SQL pool SKU -type Sku struct { - // Tier - The service tier - Tier *string `json:"tier,omitempty"` - // Name - The SKU name - Name *string `json:"name,omitempty"` - // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SparkConfigProperties sparkConfig Properties for a Big Data pool powered by Apache Spark -type SparkConfigProperties struct { - // Time - READ-ONLY; The last update time of the spark config properties file. - Time *date.Time `json:"time,omitempty"` - // Content - The spark config properties. - Content *string `json:"content,omitempty"` - // Filename - The filename of the spark config properties file. - Filename *string `json:"filename,omitempty"` - // ConfigurationType - The type of the spark config properties file. Possible values include: 'ConfigurationTypeFile', 'ConfigurationTypeArtifact' - ConfigurationType ConfigurationType `json:"configurationType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SparkConfigProperties. -func (scp SparkConfigProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.Content != nil { - objectMap["content"] = scp.Content - } - if scp.Filename != nil { - objectMap["filename"] = scp.Filename - } - if scp.ConfigurationType != "" { - objectMap["configurationType"] = scp.ConfigurationType - } - return json.Marshal(objectMap) -} - -// SparkConfigurationInfo sparkConfiguration Artifact information -type SparkConfigurationInfo struct { - // Description - Description about the SparkConfiguration. - Description *string `json:"description,omitempty"` - // Configs - SparkConfiguration configs. - Configs map[string]*string `json:"configs"` - // Annotations - Annotations for SparkConfiguration. - Annotations *[]string `json:"annotations,omitempty"` - // Notes - additional Notes. - Notes *string `json:"notes,omitempty"` - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // Created - The timestamp of resource creation. - Created *date.Time `json:"created,omitempty"` -} - -// MarshalJSON is the custom marshaler for SparkConfigurationInfo. -func (sci SparkConfigurationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sci.Description != nil { - objectMap["description"] = sci.Description - } - if sci.Configs != nil { - objectMap["configs"] = sci.Configs - } - if sci.Annotations != nil { - objectMap["annotations"] = sci.Annotations - } - if sci.Notes != nil { - objectMap["notes"] = sci.Notes - } - if sci.CreatedBy != nil { - objectMap["createdBy"] = sci.CreatedBy - } - if sci.Created != nil { - objectMap["created"] = sci.Created - } - return json.Marshal(objectMap) -} - -// SparkConfigurationListResponse a list of SparkConfiguration resources. -type SparkConfigurationListResponse struct { - autorest.Response `json:"-"` - // Value - List of SparkConfiguration. - Value *[]SparkConfigurationResource `json:"value,omitempty"` - // NextLink - The link to the next page of results, if any remaining results exist. - NextLink *string `json:"nextLink,omitempty"` -} - -// SparkConfigurationListResponseIterator provides access to a complete listing of -// SparkConfigurationResource values. -type SparkConfigurationListResponseIterator struct { - i int - page SparkConfigurationListResponsePage -} - -// 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 *SparkConfigurationListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SparkConfigurationListResponseIterator.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 *SparkConfigurationListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SparkConfigurationListResponseIterator) 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 SparkConfigurationListResponseIterator) Response() SparkConfigurationListResponse { - 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 SparkConfigurationListResponseIterator) Value() SparkConfigurationResource { - if !iter.page.NotDone() { - return SparkConfigurationResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SparkConfigurationListResponseIterator type. -func NewSparkConfigurationListResponseIterator(page SparkConfigurationListResponsePage) SparkConfigurationListResponseIterator { - return SparkConfigurationListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sclr SparkConfigurationListResponse) IsEmpty() bool { - return sclr.Value == nil || len(*sclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sclr SparkConfigurationListResponse) hasNextLink() bool { - return sclr.NextLink != nil && len(*sclr.NextLink) != 0 -} - -// sparkConfigurationListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sclr SparkConfigurationListResponse) sparkConfigurationListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !sclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sclr.NextLink))) -} - -// SparkConfigurationListResponsePage contains a page of SparkConfigurationResource values. -type SparkConfigurationListResponsePage struct { - fn func(context.Context, SparkConfigurationListResponse) (SparkConfigurationListResponse, error) - sclr SparkConfigurationListResponse -} - -// 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 *SparkConfigurationListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SparkConfigurationListResponsePage.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.sclr) - if err != nil { - return err - } - page.sclr = 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 *SparkConfigurationListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SparkConfigurationListResponsePage) NotDone() bool { - return !page.sclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SparkConfigurationListResponsePage) Response() SparkConfigurationListResponse { - return page.sclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SparkConfigurationListResponsePage) Values() []SparkConfigurationResource { - if page.sclr.IsEmpty() { - return nil - } - return *page.sclr.Value -} - -// Creates a new instance of the SparkConfigurationListResponsePage type. -func NewSparkConfigurationListResponsePage(cur SparkConfigurationListResponse, getNextPage func(context.Context, SparkConfigurationListResponse) (SparkConfigurationListResponse, error)) SparkConfigurationListResponsePage { - return SparkConfigurationListResponsePage{ - fn: getNextPage, - sclr: cur, - } -} - -// SparkConfigurationResource sparkConfiguration response details -type SparkConfigurationResource struct { - autorest.Response `json:"-"` - // SparkConfigurationInfo - SparkConfiguration properties. - *SparkConfigurationInfo `json:"properties,omitempty"` - // 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 SparkConfigurationResource. -func (scr SparkConfigurationResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scr.SparkConfigurationInfo != nil { - objectMap["properties"] = scr.SparkConfigurationInfo - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SparkConfigurationResource struct. -func (scr *SparkConfigurationResource) 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 sparkConfigurationInfo SparkConfigurationInfo - err = json.Unmarshal(*v, &sparkConfigurationInfo) - if err != nil { - return err - } - scr.SparkConfigurationInfo = &sparkConfigurationInfo - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - scr.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - scr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - scr.Type = &typeVar - } - } - } - - return nil -} - -// SQLPool a SQL Analytics pool -type SQLPool struct { - autorest.Response `json:"-"` - // Sku - SQL pool SKU - Sku *Sku `json:"sku,omitempty"` - // SQLPoolResourceProperties - SQL pool properties - *SQLPoolResourceProperties `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 SQLPool. -func (sp SQLPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.Sku != nil { - objectMap["sku"] = sp.Sku - } - if sp.SQLPoolResourceProperties != nil { - objectMap["properties"] = sp.SQLPoolResourceProperties - } - if sp.Tags != nil { - objectMap["tags"] = sp.Tags - } - if sp.Location != nil { - objectMap["location"] = sp.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPool struct. -func (sp *SQLPool) 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 - } - sp.Sku = &sku - } - case "properties": - if v != nil { - var SQLPoolResourceProperties SQLPoolResourceProperties - err = json.Unmarshal(*v, &SQLPoolResourceProperties) - if err != nil { - return err - } - sp.SQLPoolResourceProperties = &SQLPoolResourceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sp.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sp.Location = &location - } - 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 - } - } - } - - return nil -} - -// SQLPoolBlobAuditingPolicy a Sql pool blob auditing policy. -type SQLPoolBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty"` - // SQLPoolBlobAuditingPolicyProperties - Resource properties. - *SQLPoolBlobAuditingPolicyProperties `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 SQLPoolBlobAuditingPolicy. -func (spbap SQLPoolBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spbap.SQLPoolBlobAuditingPolicyProperties != nil { - objectMap["properties"] = spbap.SQLPoolBlobAuditingPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolBlobAuditingPolicy struct. -func (spbap *SQLPoolBlobAuditingPolicy) 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 - } - spbap.Kind = &kind - } - case "properties": - if v != nil { - var SQLPoolBlobAuditingPolicyProperties SQLPoolBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &SQLPoolBlobAuditingPolicyProperties) - if err != nil { - return err - } - spbap.SQLPoolBlobAuditingPolicyProperties = &SQLPoolBlobAuditingPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spbap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spbap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spbap.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolBlobAuditingPolicyListResult a list of Sql pool auditing settings. -type SQLPoolBlobAuditingPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolBlobAuditingPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolBlobAuditingPolicyListResult. -func (spbaplr SQLPoolBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolBlobAuditingPolicyListResultIterator provides access to a complete listing of -// SQLPoolBlobAuditingPolicy values. -type SQLPoolBlobAuditingPolicyListResultIterator struct { - i int - page SQLPoolBlobAuditingPolicyListResultPage -} - -// 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 *SQLPoolBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPolicyListResultIterator.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 *SQLPoolBlobAuditingPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolBlobAuditingPolicyListResultIterator) 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 SQLPoolBlobAuditingPolicyListResultIterator) Response() SQLPoolBlobAuditingPolicyListResult { - 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 SQLPoolBlobAuditingPolicyListResultIterator) Value() SQLPoolBlobAuditingPolicy { - if !iter.page.NotDone() { - return SQLPoolBlobAuditingPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolBlobAuditingPolicyListResultIterator type. -func NewSQLPoolBlobAuditingPolicyListResultIterator(page SQLPoolBlobAuditingPolicyListResultPage) SQLPoolBlobAuditingPolicyListResultIterator { - return SQLPoolBlobAuditingPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spbaplr SQLPoolBlobAuditingPolicyListResult) IsEmpty() bool { - return spbaplr.Value == nil || len(*spbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spbaplr SQLPoolBlobAuditingPolicyListResult) hasNextLink() bool { - return spbaplr.NextLink != nil && len(*spbaplr.NextLink) != 0 -} - -// sQLPoolBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spbaplr SQLPoolBlobAuditingPolicyListResult) sQLPoolBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spbaplr.NextLink))) -} - -// SQLPoolBlobAuditingPolicyListResultPage contains a page of SQLPoolBlobAuditingPolicy values. -type SQLPoolBlobAuditingPolicyListResultPage struct { - fn func(context.Context, SQLPoolBlobAuditingPolicyListResult) (SQLPoolBlobAuditingPolicyListResult, error) - spbaplr SQLPoolBlobAuditingPolicyListResult -} - -// 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 *SQLPoolBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPolicyListResultPage.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.spbaplr) - if err != nil { - return err - } - page.spbaplr = 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 *SQLPoolBlobAuditingPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.spbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolBlobAuditingPolicyListResultPage) Response() SQLPoolBlobAuditingPolicyListResult { - return page.spbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolBlobAuditingPolicyListResultPage) Values() []SQLPoolBlobAuditingPolicy { - if page.spbaplr.IsEmpty() { - return nil - } - return *page.spbaplr.Value -} - -// Creates a new instance of the SQLPoolBlobAuditingPolicyListResultPage type. -func NewSQLPoolBlobAuditingPolicyListResultPage(cur SQLPoolBlobAuditingPolicyListResult, getNextPage func(context.Context, SQLPoolBlobAuditingPolicyListResult) (SQLPoolBlobAuditingPolicyListResult, error)) SQLPoolBlobAuditingPolicyListResultPage { - return SQLPoolBlobAuditingPolicyListResultPage{ - fn: getNextPage, - spbaplr: cur, - } -} - -// SQLPoolBlobAuditingPolicyProperties properties of a Sql pool blob auditing policy. -type SQLPoolBlobAuditingPolicyProperties struct { - // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` -} - -// SQLPoolBlobAuditingPolicySQLPoolOperationListResult the response to a list Sql pool operations request -type SQLPoolBlobAuditingPolicySQLPoolOperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolBlobAuditingPolicySQLPoolOperationListResult. -func (spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator provides access to a complete listing of -// SQLPoolOperation values. -type SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator struct { - i int - page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage -} - -// 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 *SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator.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 *SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) 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 SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) Response() SQLPoolBlobAuditingPolicySQLPoolOperationListResult { - 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 SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator) Value() SQLPoolOperation { - if !iter.page.NotDone() { - return SQLPoolOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator type. -func NewSQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator(page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator { - return SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult) IsEmpty() bool { - return spbapspolr.Value == nil || len(*spbapspolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult) hasNextLink() bool { - return spbapspolr.NextLink != nil && len(*spbapspolr.NextLink) != 0 -} - -// sQLPoolBlobAuditingPolicySQLPoolOperationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult) sQLPoolBlobAuditingPolicySQLPoolOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spbapspolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spbapspolr.NextLink))) -} - -// SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage contains a page of SQLPoolOperation values. -type SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage struct { - fn func(context.Context, SQLPoolBlobAuditingPolicySQLPoolOperationListResult) (SQLPoolBlobAuditingPolicySQLPoolOperationListResult, error) - spbapspolr SQLPoolBlobAuditingPolicySQLPoolOperationListResult -} - -// 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 *SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage.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.spbapspolr) - if err != nil { - return err - } - page.spbapspolr = 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 *SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) NotDone() bool { - return !page.spbapspolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) Response() SQLPoolBlobAuditingPolicySQLPoolOperationListResult { - return page.spbapspolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage) Values() []SQLPoolOperation { - if page.spbapspolr.IsEmpty() { - return nil - } - return *page.spbapspolr.Value -} - -// Creates a new instance of the SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage type. -func NewSQLPoolBlobAuditingPolicySQLPoolOperationListResultPage(cur SQLPoolBlobAuditingPolicySQLPoolOperationListResult, getNextPage func(context.Context, SQLPoolBlobAuditingPolicySQLPoolOperationListResult) (SQLPoolBlobAuditingPolicySQLPoolOperationListResult, error)) SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage { - return SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage{ - fn: getNextPage, - spbapspolr: cur, - } -} - -// SQLPoolColumn a Sql pool column resource. -type SQLPoolColumn struct { - autorest.Response `json:"-"` - // SQLPoolColumnProperties - Resource properties. - *SQLPoolColumnProperties `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 SQLPoolColumn. -func (spc SQLPoolColumn) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spc.SQLPoolColumnProperties != nil { - objectMap["properties"] = spc.SQLPoolColumnProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolColumn struct. -func (spc *SQLPoolColumn) 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 SQLPoolColumnProperties SQLPoolColumnProperties - err = json.Unmarshal(*v, &SQLPoolColumnProperties) - if err != nil { - return err - } - spc.SQLPoolColumnProperties = &SQLPoolColumnProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spc.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolColumnListResult a list of Sql pool columns. -type SQLPoolColumnListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolColumn `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolColumnListResult. -func (spclr SQLPoolColumnListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolColumnListResultIterator provides access to a complete listing of SQLPoolColumn values. -type SQLPoolColumnListResultIterator struct { - i int - page SQLPoolColumnListResultPage -} - -// 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 *SQLPoolColumnListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolColumnListResultIterator.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 *SQLPoolColumnListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolColumnListResultIterator) 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 SQLPoolColumnListResultIterator) Response() SQLPoolColumnListResult { - 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 SQLPoolColumnListResultIterator) Value() SQLPoolColumn { - if !iter.page.NotDone() { - return SQLPoolColumn{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolColumnListResultIterator type. -func NewSQLPoolColumnListResultIterator(page SQLPoolColumnListResultPage) SQLPoolColumnListResultIterator { - return SQLPoolColumnListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spclr SQLPoolColumnListResult) IsEmpty() bool { - return spclr.Value == nil || len(*spclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spclr SQLPoolColumnListResult) hasNextLink() bool { - return spclr.NextLink != nil && len(*spclr.NextLink) != 0 -} - -// sQLPoolColumnListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spclr SQLPoolColumnListResult) sQLPoolColumnListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spclr.NextLink))) -} - -// SQLPoolColumnListResultPage contains a page of SQLPoolColumn values. -type SQLPoolColumnListResultPage struct { - fn func(context.Context, SQLPoolColumnListResult) (SQLPoolColumnListResult, error) - spclr SQLPoolColumnListResult -} - -// 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 *SQLPoolColumnListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolColumnListResultPage.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.spclr) - if err != nil { - return err - } - page.spclr = 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 *SQLPoolColumnListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolColumnListResultPage) NotDone() bool { - return !page.spclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolColumnListResultPage) Response() SQLPoolColumnListResult { - return page.spclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolColumnListResultPage) Values() []SQLPoolColumn { - if page.spclr.IsEmpty() { - return nil - } - return *page.spclr.Value -} - -// Creates a new instance of the SQLPoolColumnListResultPage type. -func NewSQLPoolColumnListResultPage(cur SQLPoolColumnListResult, getNextPage func(context.Context, SQLPoolColumnListResult) (SQLPoolColumnListResult, error)) SQLPoolColumnListResultPage { - return SQLPoolColumnListResultPage{ - fn: getNextPage, - spclr: cur, - } -} - -// SQLPoolColumnProperties sql pool column properties. -type SQLPoolColumnProperties struct { - // ColumnType - The column data type. Possible values include: 'ColumnDataTypeImage', 'ColumnDataTypeText', 'ColumnDataTypeUniqueidentifier', 'ColumnDataTypeDate', 'ColumnDataTypeTime', 'ColumnDataTypeDatetime2', 'ColumnDataTypeDatetimeoffset', 'ColumnDataTypeTinyint', 'ColumnDataTypeSmallint', 'ColumnDataTypeInt', 'ColumnDataTypeSmalldatetime', 'ColumnDataTypeReal', 'ColumnDataTypeMoney', 'ColumnDataTypeDatetime', 'ColumnDataTypeFloat', 'ColumnDataTypeSQLVariant', 'ColumnDataTypeNtext', 'ColumnDataTypeBit', 'ColumnDataTypeDecimal', 'ColumnDataTypeNumeric', 'ColumnDataTypeSmallmoney', 'ColumnDataTypeBigint', 'ColumnDataTypeHierarchyid', 'ColumnDataTypeGeometry', 'ColumnDataTypeGeography', 'ColumnDataTypeVarbinary', 'ColumnDataTypeVarchar', 'ColumnDataTypeBinary', 'ColumnDataTypeChar', 'ColumnDataTypeTimestamp', 'ColumnDataTypeNvarchar', 'ColumnDataTypeNchar', 'ColumnDataTypeXML', 'ColumnDataTypeSysname' - ColumnType ColumnDataType `json:"columnType,omitempty"` - // IsComputed - READ-ONLY; Indicates whether column value is computed or not - IsComputed *bool `json:"isComputed,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolColumnProperties. -func (spcp SQLPoolColumnProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spcp.ColumnType != "" { - objectMap["columnType"] = spcp.ColumnType - } - return json.Marshal(objectMap) -} - -// SQLPoolConnectionPolicy a Sql pool connection policy. -type SQLPoolConnectionPolicy struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // SQLPoolConnectionPolicyProperties - Resource properties. - *SQLPoolConnectionPolicyProperties `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 SQLPoolConnectionPolicy. -func (spcp SQLPoolConnectionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spcp.SQLPoolConnectionPolicyProperties != nil { - objectMap["properties"] = spcp.SQLPoolConnectionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolConnectionPolicy struct. -func (spcp *SQLPoolConnectionPolicy) 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 - } - spcp.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - spcp.Location = &location - } - case "properties": - if v != nil { - var SQLPoolConnectionPolicyProperties SQLPoolConnectionPolicyProperties - err = json.Unmarshal(*v, &SQLPoolConnectionPolicyProperties) - if err != nil { - return err - } - spcp.SQLPoolConnectionPolicyProperties = &SQLPoolConnectionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spcp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spcp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spcp.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolConnectionPolicyProperties properties of a Sql pool connection policy. -type SQLPoolConnectionPolicyProperties struct { - // SecurityEnabledAccess - The state of security access. - SecurityEnabledAccess *string `json:"securityEnabledAccess,omitempty"` - // ProxyDNSName - The fully qualified host name of the auditing proxy. - ProxyDNSName *string `json:"proxyDnsName,omitempty"` - // ProxyPort - The port number of the auditing proxy. - ProxyPort *string `json:"proxyPort,omitempty"` - // Visibility - The visibility of the auditing proxy. - Visibility *string `json:"visibility,omitempty"` - // UseServerDefault - Whether server default is enabled or disabled. - UseServerDefault *string `json:"useServerDefault,omitempty"` - // RedirectionState - The state of proxy redirection. - RedirectionState *string `json:"redirectionState,omitempty"` - // State - The connection policy state. - State *string `json:"state,omitempty"` -} - -// SQLPoolInfoListResult list of SQL pools -type SQLPoolInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of SQL pools - Value *[]SQLPool `json:"value,omitempty"` -} - -// SQLPoolInfoListResultIterator provides access to a complete listing of SQLPool values. -type SQLPoolInfoListResultIterator struct { - i int - page SQLPoolInfoListResultPage -} - -// 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 *SQLPoolInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolInfoListResultIterator.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 *SQLPoolInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolInfoListResultIterator) 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 SQLPoolInfoListResultIterator) Response() SQLPoolInfoListResult { - 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 SQLPoolInfoListResultIterator) Value() SQLPool { - if !iter.page.NotDone() { - return SQLPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolInfoListResultIterator type. -func NewSQLPoolInfoListResultIterator(page SQLPoolInfoListResultPage) SQLPoolInfoListResultIterator { - return SQLPoolInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spilr SQLPoolInfoListResult) IsEmpty() bool { - return spilr.Value == nil || len(*spilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spilr SQLPoolInfoListResult) hasNextLink() bool { - return spilr.NextLink != nil && len(*spilr.NextLink) != 0 -} - -// sQLPoolInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spilr SQLPoolInfoListResult) sQLPoolInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spilr.NextLink))) -} - -// SQLPoolInfoListResultPage contains a page of SQLPool values. -type SQLPoolInfoListResultPage struct { - fn func(context.Context, SQLPoolInfoListResult) (SQLPoolInfoListResult, error) - spilr SQLPoolInfoListResult -} - -// 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 *SQLPoolInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolInfoListResultPage.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.spilr) - if err != nil { - return err - } - page.spilr = 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 *SQLPoolInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolInfoListResultPage) NotDone() bool { - return !page.spilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolInfoListResultPage) Response() SQLPoolInfoListResult { - return page.spilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolInfoListResultPage) Values() []SQLPool { - if page.spilr.IsEmpty() { - return nil - } - return *page.spilr.Value -} - -// Creates a new instance of the SQLPoolInfoListResultPage type. -func NewSQLPoolInfoListResultPage(cur SQLPoolInfoListResult, getNextPage func(context.Context, SQLPoolInfoListResult) (SQLPoolInfoListResult, error)) SQLPoolInfoListResultPage { - return SQLPoolInfoListResultPage{ - fn: getNextPage, - spilr: cur, - } -} - -// SQLPoolOperation a Sql pool operation. -type SQLPoolOperation struct { - // SQLPoolOperationProperties - Resource properties. - *SQLPoolOperationProperties `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 SQLPoolOperation. -func (spo SQLPoolOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spo.SQLPoolOperationProperties != nil { - objectMap["properties"] = spo.SQLPoolOperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolOperation struct. -func (spo *SQLPoolOperation) 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 SQLPoolOperationProperties SQLPoolOperationProperties - err = json.Unmarshal(*v, &SQLPoolOperationProperties) - if err != nil { - return err - } - spo.SQLPoolOperationProperties = &SQLPoolOperationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spo.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spo.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spo.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolOperationProperties the properties of a Sql pool operation. -type SQLPoolOperationProperties struct { - // DatabaseName - READ-ONLY; The name of the Sql pool the operation is being performed on. - DatabaseName *string `json:"databaseName,omitempty"` - // Operation - READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty"` - // OperationFriendlyName - READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` - // PercentComplete - READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // ServerName - READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The operation state. Possible values include: 'ManagementOperationStatePending', 'ManagementOperationStateInProgress', 'ManagementOperationStateSucceeded', 'ManagementOperationStateFailed', 'ManagementOperationStateCancelInProgress', 'ManagementOperationStateCancelled' - State ManagementOperationState `json:"state,omitempty"` - // ErrorCode - READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorDescription - READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty"` - // ErrorSeverity - READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // IsUserError - READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty"` - // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` - // Description - READ-ONLY; The operation description. - Description *string `json:"description,omitempty"` - // IsCancellable - READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolOperationProperties. -func (spop SQLPoolOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolPatchInfo a SQL Analytics pool patch info -type SQLPoolPatchInfo struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // Sku - SQL pool SKU - Sku *Sku `json:"sku,omitempty"` - // SQLPoolResourceProperties - SQL pool properties - *SQLPoolResourceProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolPatchInfo. -func (sppi SQLPoolPatchInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sppi.Tags != nil { - objectMap["tags"] = sppi.Tags - } - if sppi.Location != nil { - objectMap["location"] = sppi.Location - } - if sppi.Sku != nil { - objectMap["sku"] = sppi.Sku - } - if sppi.SQLPoolResourceProperties != nil { - objectMap["properties"] = sppi.SQLPoolResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolPatchInfo struct. -func (sppi *SQLPoolPatchInfo) 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 - } - sppi.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sppi.Location = &location - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sppi.Sku = &sku - } - case "properties": - if v != nil { - var SQLPoolResourceProperties SQLPoolResourceProperties - err = json.Unmarshal(*v, &SQLPoolResourceProperties) - if err != nil { - return err - } - sppi.SQLPoolResourceProperties = &SQLPoolResourceProperties - } - } - } - - return nil -} - -// SQLPoolResourceProperties properties of a SQL Analytics pool -type SQLPoolResourceProperties struct { - // MaxSizeBytes - Maximum size in bytes - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // Collation - Collation mode - Collation *string `json:"collation,omitempty"` - // SourceDatabaseID - Source database to create from - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // RecoverableDatabaseID - Backup database to restore from - RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` - // ProvisioningState - Resource state - ProvisioningState *string `json:"provisioningState,omitempty"` - // Status - Resource status - Status *string `json:"status,omitempty"` - // RestorePointInTime - Snapshot time to restore - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // CreateMode - What is this? - CreateMode *string `json:"createMode,omitempty"` - // CreationDate - Date the SQL pool was created - CreationDate *date.Time `json:"creationDate,omitempty"` - // StorageAccountType - The storage account type used to store backups for this sql pool. Possible values include: 'StorageAccountTypeGRS', 'StorageAccountTypeLRS', 'StorageAccountTypeZRS' - StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` - // SourceDatabaseDeletionDate - Specifies the time that the sql pool was deleted - SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` -} - -// SQLPoolRestorePointsCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLPoolRestorePointsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolRestorePointsClient) (RestorePoint, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolRestorePointsCreateFuture) 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 SQLPoolRestorePointsCreateFuture.Result. -func (future *SQLPoolRestorePointsCreateFuture) result(client SQLPoolRestorePointsClient) (rp RestorePoint, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolRestorePointsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rp.Response.Response, err = future.GetResult(sender); err == nil && rp.Response.Response.StatusCode != http.StatusNoContent { - rp, err = client.CreateResponder(rp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsCreateFuture", "Result", rp.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolSchema a Sql pool schema resource. -type SQLPoolSchema struct { - autorest.Response `json:"-"` - // 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 SQLPoolSchema. -func (sps SQLPoolSchema) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolSchemaListResult a list of Sql pool schemas. -type SQLPoolSchemaListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolSchema `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolSchemaListResult. -func (spslr SQLPoolSchemaListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolSchemaListResultIterator provides access to a complete listing of SQLPoolSchema values. -type SQLPoolSchemaListResultIterator struct { - i int - page SQLPoolSchemaListResultPage -} - -// 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 *SQLPoolSchemaListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemaListResultIterator.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 *SQLPoolSchemaListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolSchemaListResultIterator) 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 SQLPoolSchemaListResultIterator) Response() SQLPoolSchemaListResult { - 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 SQLPoolSchemaListResultIterator) Value() SQLPoolSchema { - if !iter.page.NotDone() { - return SQLPoolSchema{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolSchemaListResultIterator type. -func NewSQLPoolSchemaListResultIterator(page SQLPoolSchemaListResultPage) SQLPoolSchemaListResultIterator { - return SQLPoolSchemaListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spslr SQLPoolSchemaListResult) IsEmpty() bool { - return spslr.Value == nil || len(*spslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spslr SQLPoolSchemaListResult) hasNextLink() bool { - return spslr.NextLink != nil && len(*spslr.NextLink) != 0 -} - -// sQLPoolSchemaListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spslr SQLPoolSchemaListResult) sQLPoolSchemaListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spslr.NextLink))) -} - -// SQLPoolSchemaListResultPage contains a page of SQLPoolSchema values. -type SQLPoolSchemaListResultPage struct { - fn func(context.Context, SQLPoolSchemaListResult) (SQLPoolSchemaListResult, error) - spslr SQLPoolSchemaListResult -} - -// 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 *SQLPoolSchemaListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemaListResultPage.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.spslr) - if err != nil { - return err - } - page.spslr = 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 *SQLPoolSchemaListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolSchemaListResultPage) NotDone() bool { - return !page.spslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolSchemaListResultPage) Response() SQLPoolSchemaListResult { - return page.spslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolSchemaListResultPage) Values() []SQLPoolSchema { - if page.spslr.IsEmpty() { - return nil - } - return *page.spslr.Value -} - -// Creates a new instance of the SQLPoolSchemaListResultPage type. -func NewSQLPoolSchemaListResultPage(cur SQLPoolSchemaListResult, getNextPage func(context.Context, SQLPoolSchemaListResult) (SQLPoolSchemaListResult, error)) SQLPoolSchemaListResultPage { - return SQLPoolSchemaListResultPage{ - fn: getNextPage, - spslr: cur, - } -} - -// SQLPoolsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SQLPoolsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolsClient) (SQLPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolsCreateFuture) 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 SQLPoolsCreateFuture.Result. -func (future *SQLPoolsCreateFuture) result(client SQLPoolsClient) (sp SQLPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolsCreateFuture") - 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, "synapse.SQLPoolsCreateFuture", "Result", sp.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SQLPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolsClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolsDeleteFuture) 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 SQLPoolsDeleteFuture.Result. -func (future *SQLPoolsDeleteFuture) result(client SQLPoolsClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.DeleteResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsDeleteFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolSecurityAlertPolicy a Sql pool security alert policy. -type SQLPoolSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // SecurityAlertPolicyProperties - Resource properties. - *SecurityAlertPolicyProperties `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 SQLPoolSecurityAlertPolicy. -func (spsap SQLPoolSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spsap.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = spsap.SecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolSecurityAlertPolicy struct. -func (spsap *SQLPoolSecurityAlertPolicy) 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 securityAlertPolicyProperties SecurityAlertPolicyProperties - err = json.Unmarshal(*v, &securityAlertPolicyProperties) - if err != nil { - return err - } - spsap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spsap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spsap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spsap.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolsPauseFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SQLPoolsPauseFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolsClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolsPauseFuture) 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 SQLPoolsPauseFuture.Result. -func (future *SQLPoolsPauseFuture) result(client SQLPoolsClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsPauseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolsPauseFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.PauseResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsPauseFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolsResumeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SQLPoolsResumeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolsClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolsResumeFuture) 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 SQLPoolsResumeFuture.Result. -func (future *SQLPoolsResumeFuture) result(client SQLPoolsClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsResumeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolsResumeFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.ResumeResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsResumeFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolTable a Sql pool table resource. -type SQLPoolTable struct { - autorest.Response `json:"-"` - // 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 SQLPoolTable. -func (spt SQLPoolTable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolTableListResult a list of Sql pool tables. -type SQLPoolTableListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolTable `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolTableListResult. -func (sptlr SQLPoolTableListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolTableListResultIterator provides access to a complete listing of SQLPoolTable values. -type SQLPoolTableListResultIterator struct { - i int - page SQLPoolTableListResultPage -} - -// 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 *SQLPoolTableListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTableListResultIterator.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 *SQLPoolTableListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolTableListResultIterator) 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 SQLPoolTableListResultIterator) Response() SQLPoolTableListResult { - 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 SQLPoolTableListResultIterator) Value() SQLPoolTable { - if !iter.page.NotDone() { - return SQLPoolTable{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolTableListResultIterator type. -func NewSQLPoolTableListResultIterator(page SQLPoolTableListResultPage) SQLPoolTableListResultIterator { - return SQLPoolTableListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sptlr SQLPoolTableListResult) IsEmpty() bool { - return sptlr.Value == nil || len(*sptlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sptlr SQLPoolTableListResult) hasNextLink() bool { - return sptlr.NextLink != nil && len(*sptlr.NextLink) != 0 -} - -// sQLPoolTableListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sptlr SQLPoolTableListResult) sQLPoolTableListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sptlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sptlr.NextLink))) -} - -// SQLPoolTableListResultPage contains a page of SQLPoolTable values. -type SQLPoolTableListResultPage struct { - fn func(context.Context, SQLPoolTableListResult) (SQLPoolTableListResult, error) - sptlr SQLPoolTableListResult -} - -// 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 *SQLPoolTableListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTableListResultPage.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.sptlr) - if err != nil { - return err - } - page.sptlr = 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 *SQLPoolTableListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolTableListResultPage) NotDone() bool { - return !page.sptlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolTableListResultPage) Response() SQLPoolTableListResult { - return page.sptlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolTableListResultPage) Values() []SQLPoolTable { - if page.sptlr.IsEmpty() { - return nil - } - return *page.sptlr.Value -} - -// Creates a new instance of the SQLPoolTableListResultPage type. -func NewSQLPoolTableListResultPage(cur SQLPoolTableListResult, getNextPage func(context.Context, SQLPoolTableListResult) (SQLPoolTableListResult, error)) SQLPoolTableListResultPage { - return SQLPoolTableListResultPage{ - fn: getNextPage, - sptlr: cur, - } -} - -// SQLPoolUsage the Sql pool usages. -type SQLPoolUsage struct { - // Name - READ-ONLY; The name of the usage metric. - Name *string `json:"name,omitempty"` - // ResourceName - READ-ONLY; The name of the resource. - ResourceName *string `json:"resourceName,omitempty"` - // DisplayName - READ-ONLY; The usage metric display name. - DisplayName *string `json:"displayName,omitempty"` - // CurrentValue - READ-ONLY; The current value of the usage metric. - CurrentValue *float64 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The current limit of the usage metric. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units of the usage metric. - Unit *string `json:"unit,omitempty"` - // NextResetTime - READ-ONLY; The next reset time for the usage metric (ISO8601 format). - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolUsage. -func (spu SQLPoolUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolUsageListResult the response to a list Sql pool usages request. -type SQLPoolUsageListResult struct { - autorest.Response `json:"-"` - // Value - The list of usages for the Sql pool. - Value *[]SQLPoolUsage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolUsageListResult. -func (spulr SQLPoolUsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spulr.Value != nil { - objectMap["value"] = spulr.Value - } - return json.Marshal(objectMap) -} - -// SQLPoolUsageListResultIterator provides access to a complete listing of SQLPoolUsage values. -type SQLPoolUsageListResultIterator struct { - i int - page SQLPoolUsageListResultPage -} - -// 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 *SQLPoolUsageListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolUsageListResultIterator.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 *SQLPoolUsageListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolUsageListResultIterator) 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 SQLPoolUsageListResultIterator) Response() SQLPoolUsageListResult { - 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 SQLPoolUsageListResultIterator) Value() SQLPoolUsage { - if !iter.page.NotDone() { - return SQLPoolUsage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolUsageListResultIterator type. -func NewSQLPoolUsageListResultIterator(page SQLPoolUsageListResultPage) SQLPoolUsageListResultIterator { - return SQLPoolUsageListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spulr SQLPoolUsageListResult) IsEmpty() bool { - return spulr.Value == nil || len(*spulr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spulr SQLPoolUsageListResult) hasNextLink() bool { - return spulr.NextLink != nil && len(*spulr.NextLink) != 0 -} - -// sQLPoolUsageListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spulr SQLPoolUsageListResult) sQLPoolUsageListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spulr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spulr.NextLink))) -} - -// SQLPoolUsageListResultPage contains a page of SQLPoolUsage values. -type SQLPoolUsageListResultPage struct { - fn func(context.Context, SQLPoolUsageListResult) (SQLPoolUsageListResult, error) - spulr SQLPoolUsageListResult -} - -// 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 *SQLPoolUsageListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolUsageListResultPage.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.spulr) - if err != nil { - return err - } - page.spulr = 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 *SQLPoolUsageListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolUsageListResultPage) NotDone() bool { - return !page.spulr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolUsageListResultPage) Response() SQLPoolUsageListResult { - return page.spulr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolUsageListResultPage) Values() []SQLPoolUsage { - if page.spulr.IsEmpty() { - return nil - } - return *page.spulr.Value -} - -// Creates a new instance of the SQLPoolUsageListResultPage type. -func NewSQLPoolUsageListResultPage(cur SQLPoolUsageListResult, getNextPage func(context.Context, SQLPoolUsageListResult) (SQLPoolUsageListResult, error)) SQLPoolUsageListResultPage { - return SQLPoolUsageListResultPage{ - fn: getNextPage, - spulr: cur, - } -} - -// SQLPoolVulnerabilityAssessment a Sql pool vulnerability assessment. -type SQLPoolVulnerabilityAssessment struct { - autorest.Response `json:"-"` - // SQLPoolVulnerabilityAssessmentProperties - Resource properties. - *SQLPoolVulnerabilityAssessmentProperties `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 SQLPoolVulnerabilityAssessment. -func (spva SQLPoolVulnerabilityAssessment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spva.SQLPoolVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = spva.SQLPoolVulnerabilityAssessmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolVulnerabilityAssessment struct. -func (spva *SQLPoolVulnerabilityAssessment) 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 SQLPoolVulnerabilityAssessmentProperties SQLPoolVulnerabilityAssessmentProperties - err = json.Unmarshal(*v, &SQLPoolVulnerabilityAssessmentProperties) - if err != nil { - return err - } - spva.SQLPoolVulnerabilityAssessmentProperties = &SQLPoolVulnerabilityAssessmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spva.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spva.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spva.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolVulnerabilityAssessmentListResult a list of the Sql pool's vulnerability assessments. -type SQLPoolVulnerabilityAssessmentListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLPoolVulnerabilityAssessment `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolVulnerabilityAssessmentListResult. -func (spvalr SQLPoolVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolVulnerabilityAssessmentListResultIterator provides access to a complete listing of -// SQLPoolVulnerabilityAssessment values. -type SQLPoolVulnerabilityAssessmentListResultIterator struct { - i int - page SQLPoolVulnerabilityAssessmentListResultPage -} - -// 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 *SQLPoolVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentListResultIterator.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 *SQLPoolVulnerabilityAssessmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SQLPoolVulnerabilityAssessmentListResultIterator) 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 SQLPoolVulnerabilityAssessmentListResultIterator) Response() SQLPoolVulnerabilityAssessmentListResult { - 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 SQLPoolVulnerabilityAssessmentListResultIterator) Value() SQLPoolVulnerabilityAssessment { - if !iter.page.NotDone() { - return SQLPoolVulnerabilityAssessment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SQLPoolVulnerabilityAssessmentListResultIterator type. -func NewSQLPoolVulnerabilityAssessmentListResultIterator(page SQLPoolVulnerabilityAssessmentListResultPage) SQLPoolVulnerabilityAssessmentListResultIterator { - return SQLPoolVulnerabilityAssessmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spvalr SQLPoolVulnerabilityAssessmentListResult) IsEmpty() bool { - return spvalr.Value == nil || len(*spvalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spvalr SQLPoolVulnerabilityAssessmentListResult) hasNextLink() bool { - return spvalr.NextLink != nil && len(*spvalr.NextLink) != 0 -} - -// sQLPoolVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spvalr SQLPoolVulnerabilityAssessmentListResult) sQLPoolVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spvalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spvalr.NextLink))) -} - -// SQLPoolVulnerabilityAssessmentListResultPage contains a page of SQLPoolVulnerabilityAssessment values. -type SQLPoolVulnerabilityAssessmentListResultPage struct { - fn func(context.Context, SQLPoolVulnerabilityAssessmentListResult) (SQLPoolVulnerabilityAssessmentListResult, error) - spvalr SQLPoolVulnerabilityAssessmentListResult -} - -// 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 *SQLPoolVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentListResultPage.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.spvalr) - if err != nil { - return err - } - page.spvalr = 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 *SQLPoolVulnerabilityAssessmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SQLPoolVulnerabilityAssessmentListResultPage) NotDone() bool { - return !page.spvalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SQLPoolVulnerabilityAssessmentListResultPage) Response() SQLPoolVulnerabilityAssessmentListResult { - return page.spvalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SQLPoolVulnerabilityAssessmentListResultPage) Values() []SQLPoolVulnerabilityAssessment { - if page.spvalr.IsEmpty() { - return nil - } - return *page.spvalr.Value -} - -// Creates a new instance of the SQLPoolVulnerabilityAssessmentListResultPage type. -func NewSQLPoolVulnerabilityAssessmentListResultPage(cur SQLPoolVulnerabilityAssessmentListResult, getNextPage func(context.Context, SQLPoolVulnerabilityAssessmentListResult) (SQLPoolVulnerabilityAssessmentListResult, error)) SQLPoolVulnerabilityAssessmentListResultPage { - return SQLPoolVulnerabilityAssessmentListResultPage{ - fn: getNextPage, - spvalr: cur, - } -} - -// SQLPoolVulnerabilityAssessmentProperties properties of a Sql pool Vulnerability Assessment. -type SQLPoolVulnerabilityAssessmentProperties struct { - // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // StorageContainerSasKey - A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RecurringScans - The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` -} - -// SQLPoolVulnerabilityAssessmentRuleBaseline a Sql pool vulnerability assessment rule baseline. -type SQLPoolVulnerabilityAssessmentRuleBaseline struct { - autorest.Response `json:"-"` - // SQLPoolVulnerabilityAssessmentRuleBaselineProperties - Resource properties. - *SQLPoolVulnerabilityAssessmentRuleBaselineProperties `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 SQLPoolVulnerabilityAssessmentRuleBaseline. -func (spvarb SQLPoolVulnerabilityAssessmentRuleBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spvarb.SQLPoolVulnerabilityAssessmentRuleBaselineProperties != nil { - objectMap["properties"] = spvarb.SQLPoolVulnerabilityAssessmentRuleBaselineProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolVulnerabilityAssessmentRuleBaseline struct. -func (spvarb *SQLPoolVulnerabilityAssessmentRuleBaseline) 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 SQLPoolVulnerabilityAssessmentRuleBaselineProperties SQLPoolVulnerabilityAssessmentRuleBaselineProperties - err = json.Unmarshal(*v, &SQLPoolVulnerabilityAssessmentRuleBaselineProperties) - if err != nil { - return err - } - spvarb.SQLPoolVulnerabilityAssessmentRuleBaselineProperties = &SQLPoolVulnerabilityAssessmentRuleBaselineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spvarb.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spvarb.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spvarb.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolVulnerabilityAssessmentRuleBaselineItem properties for an Sql pool vulnerability assessment rule -// baseline's result. -type SQLPoolVulnerabilityAssessmentRuleBaselineItem struct { - // Result - The rule baseline result - Result *[]string `json:"result,omitempty"` -} - -// SQLPoolVulnerabilityAssessmentRuleBaselineProperties properties of a Sql pool vulnerability assessment -// rule baseline. -type SQLPoolVulnerabilityAssessmentRuleBaselineProperties struct { - // BaselineResults - The rule baseline result - BaselineResults *[]SQLPoolVulnerabilityAssessmentRuleBaselineItem `json:"baselineResults,omitempty"` -} - -// SQLPoolVulnerabilityAssessmentScanExportProperties properties of the export operation's result. -type SQLPoolVulnerabilityAssessmentScanExportProperties struct { - // ExportedReportLocation - READ-ONLY; Location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). - ExportedReportLocation *string `json:"exportedReportLocation,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLPoolVulnerabilityAssessmentScanExportProperties. -func (spvasep SQLPoolVulnerabilityAssessmentScanExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SQLPoolVulnerabilityAssessmentScansExport a Sql pool Vulnerability Assessment scan export resource. -type SQLPoolVulnerabilityAssessmentScansExport struct { - autorest.Response `json:"-"` - // SQLPoolVulnerabilityAssessmentScanExportProperties - Resource properties. - *SQLPoolVulnerabilityAssessmentScanExportProperties `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 SQLPoolVulnerabilityAssessmentScansExport. -func (spvase SQLPoolVulnerabilityAssessmentScansExport) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spvase.SQLPoolVulnerabilityAssessmentScanExportProperties != nil { - objectMap["properties"] = spvase.SQLPoolVulnerabilityAssessmentScanExportProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLPoolVulnerabilityAssessmentScansExport struct. -func (spvase *SQLPoolVulnerabilityAssessmentScansExport) 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 SQLPoolVulnerabilityAssessmentScanExportProperties SQLPoolVulnerabilityAssessmentScanExportProperties - err = json.Unmarshal(*v, &SQLPoolVulnerabilityAssessmentScanExportProperties) - if err != nil { - return err - } - spvase.SQLPoolVulnerabilityAssessmentScanExportProperties = &SQLPoolVulnerabilityAssessmentScanExportProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spvase.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spvase.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spvase.Type = &typeVar - } - } - } - - return nil -} - -// SQLPoolVulnerabilityAssessmentScansInitiateScanFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type SQLPoolVulnerabilityAssessmentScansInitiateScanFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolVulnerabilityAssessmentScansClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolVulnerabilityAssessmentScansInitiateScanFuture) 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 SQLPoolVulnerabilityAssessmentScansInitiateScanFuture.Result. -func (future *SQLPoolVulnerabilityAssessmentScansInitiateScanFuture) result(client SQLPoolVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolVulnerabilityAssessmentScansInitiateScanFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLPoolWorkloadClassifierCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SQLPoolWorkloadClassifierCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolWorkloadClassifierClient) (WorkloadClassifier, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolWorkloadClassifierCreateOrUpdateFuture) 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 SQLPoolWorkloadClassifierCreateOrUpdateFuture.Result. -func (future *SQLPoolWorkloadClassifierCreateOrUpdateFuture) result(client SQLPoolWorkloadClassifierClient) (wc WorkloadClassifier, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - wc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolWorkloadClassifierCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if wc.Response.Response, err = future.GetResult(sender); err == nil && wc.Response.Response.StatusCode != http.StatusNoContent { - wc, err = client.CreateOrUpdateResponder(wc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierCreateOrUpdateFuture", "Result", wc.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolWorkloadClassifierDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLPoolWorkloadClassifierDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolWorkloadClassifierClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolWorkloadClassifierDeleteFuture) 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 SQLPoolWorkloadClassifierDeleteFuture.Result. -func (future *SQLPoolWorkloadClassifierDeleteFuture) result(client SQLPoolWorkloadClassifierClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolWorkloadClassifierDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SQLPoolWorkloadGroupCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLPoolWorkloadGroupCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolWorkloadGroupClient) (WorkloadGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolWorkloadGroupCreateOrUpdateFuture) 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 SQLPoolWorkloadGroupCreateOrUpdateFuture.Result. -func (future *SQLPoolWorkloadGroupCreateOrUpdateFuture) result(client SQLPoolWorkloadGroupClient) (wg WorkloadGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - wg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolWorkloadGroupCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if wg.Response.Response, err = future.GetResult(sender); err == nil && wg.Response.Response.StatusCode != http.StatusNoContent { - wg, err = client.CreateOrUpdateResponder(wg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupCreateOrUpdateFuture", "Result", wg.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLPoolWorkloadGroupDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLPoolWorkloadGroupDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLPoolWorkloadGroupClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLPoolWorkloadGroupDeleteFuture) 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 SQLPoolWorkloadGroupDeleteFuture.Result. -func (future *SQLPoolWorkloadGroupDeleteFuture) result(client SQLPoolWorkloadGroupClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.SQLPoolWorkloadGroupDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SsisEnvironment ssis environment. -type SsisEnvironment struct { - // FolderID - Folder id which contains environment. - FolderID *int64 `json:"folderId,omitempty"` - // Variables - Variable in environment - Variables *[]SsisVariable `json:"variables,omitempty"` - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeBasicSsisObjectMetadataTypeSsisObjectMetadata', 'TypeBasicSsisObjectMetadataTypeFolder', 'TypeBasicSsisObjectMetadataTypeProject', 'TypeBasicSsisObjectMetadataTypePackage', 'TypeBasicSsisObjectMetadataTypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SsisEnvironment. -func (se SsisEnvironment) MarshalJSON() ([]byte, error) { - se.Type = TypeBasicSsisObjectMetadataTypeEnvironment - objectMap := make(map[string]interface{}) - if se.FolderID != nil { - objectMap["folderId"] = se.FolderID - } - if se.Variables != nil { - objectMap["variables"] = se.Variables - } - if se.ID != nil { - objectMap["id"] = se.ID - } - if se.Name != nil { - objectMap["name"] = se.Name - } - if se.Description != nil { - objectMap["description"] = se.Description - } - if se.Type != "" { - objectMap["type"] = se.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisFolder() (*SsisFolder, bool) { - return nil, false -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisProject() (*SsisProject, bool) { - return nil, false -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisPackage() (*SsisPackage, bool) { - return nil, false -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisEnvironment() (*SsisEnvironment, bool) { - return &se, true -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return nil, false -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisEnvironment. -func (se SsisEnvironment) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &se, true -} - -// SsisEnvironmentReference ssis environment reference. -type SsisEnvironmentReference struct { - // ID - Environment reference id. - ID *int64 `json:"id,omitempty"` - // EnvironmentFolderName - Environment folder name. - EnvironmentFolderName *string `json:"environmentFolderName,omitempty"` - // EnvironmentName - Environment name. - EnvironmentName *string `json:"environmentName,omitempty"` - // ReferenceType - Reference type - ReferenceType *string `json:"referenceType,omitempty"` -} - -// SsisFolder ssis folder. -type SsisFolder struct { - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeBasicSsisObjectMetadataTypeSsisObjectMetadata', 'TypeBasicSsisObjectMetadataTypeFolder', 'TypeBasicSsisObjectMetadataTypeProject', 'TypeBasicSsisObjectMetadataTypePackage', 'TypeBasicSsisObjectMetadataTypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SsisFolder. -func (sf SsisFolder) MarshalJSON() ([]byte, error) { - sf.Type = TypeBasicSsisObjectMetadataTypeFolder - objectMap := make(map[string]interface{}) - if sf.ID != nil { - objectMap["id"] = sf.ID - } - if sf.Name != nil { - objectMap["name"] = sf.Name - } - if sf.Description != nil { - objectMap["description"] = sf.Description - } - if sf.Type != "" { - objectMap["type"] = sf.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisFolder() (*SsisFolder, bool) { - return &sf, true -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisProject() (*SsisProject, bool) { - return nil, false -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisPackage() (*SsisPackage, bool) { - return nil, false -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisEnvironment() (*SsisEnvironment, bool) { - return nil, false -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return nil, false -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisFolder. -func (sf SsisFolder) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &sf, true -} - -// BasicSsisObjectMetadata SSIS object metadata. -type BasicSsisObjectMetadata interface { - AsSsisFolder() (*SsisFolder, bool) - AsSsisProject() (*SsisProject, bool) - AsSsisPackage() (*SsisPackage, bool) - AsSsisEnvironment() (*SsisEnvironment, bool) - AsSsisObjectMetadata() (*SsisObjectMetadata, bool) -} - -// SsisObjectMetadata SSIS object metadata. -type SsisObjectMetadata struct { - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeBasicSsisObjectMetadataTypeSsisObjectMetadata', 'TypeBasicSsisObjectMetadataTypeFolder', 'TypeBasicSsisObjectMetadataTypeProject', 'TypeBasicSsisObjectMetadataTypePackage', 'TypeBasicSsisObjectMetadataTypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -func unmarshalBasicSsisObjectMetadata(body []byte) (BasicSsisObjectMetadata, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicSsisObjectMetadataTypeFolder): - var sf SsisFolder - err := json.Unmarshal(body, &sf) - return sf, err - case string(TypeBasicSsisObjectMetadataTypeProject): - var sp SsisProject - err := json.Unmarshal(body, &sp) - return sp, err - case string(TypeBasicSsisObjectMetadataTypePackage): - var sp SsisPackage - err := json.Unmarshal(body, &sp) - return sp, err - case string(TypeBasicSsisObjectMetadataTypeEnvironment): - var se SsisEnvironment - err := json.Unmarshal(body, &se) - return se, err - default: - var som SsisObjectMetadata - err := json.Unmarshal(body, &som) - return som, err - } -} -func unmarshalBasicSsisObjectMetadataArray(body []byte) ([]BasicSsisObjectMetadata, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - somArray := make([]BasicSsisObjectMetadata, len(rawMessages)) - - for index, rawMessage := range rawMessages { - som, err := unmarshalBasicSsisObjectMetadata(*rawMessage) - if err != nil { - return nil, err - } - somArray[index] = som - } - return somArray, nil -} - -// MarshalJSON is the custom marshaler for SsisObjectMetadata. -func (som SsisObjectMetadata) MarshalJSON() ([]byte, error) { - som.Type = TypeBasicSsisObjectMetadataTypeSsisObjectMetadata - objectMap := make(map[string]interface{}) - if som.ID != nil { - objectMap["id"] = som.ID - } - if som.Name != nil { - objectMap["name"] = som.Name - } - if som.Description != nil { - objectMap["description"] = som.Description - } - if som.Type != "" { - objectMap["type"] = som.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisFolder() (*SsisFolder, bool) { - return nil, false -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisProject() (*SsisProject, bool) { - return nil, false -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisPackage() (*SsisPackage, bool) { - return nil, false -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisEnvironment() (*SsisEnvironment, bool) { - return nil, false -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return &som, true -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisObjectMetadata. -func (som SsisObjectMetadata) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &som, true -} - -// SsisObjectMetadataListResponse a list of SSIS object metadata. -type SsisObjectMetadataListResponse struct { - autorest.Response `json:"-"` - // Value - List of SSIS object metadata. - Value *[]BasicSsisObjectMetadata `json:"value,omitempty"` - // NextLink - The link to the next page of results, if any remaining results exist. - NextLink *string `json:"nextLink,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for SsisObjectMetadataListResponse struct. -func (somlr *SsisObjectMetadataListResponse) 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 := unmarshalBasicSsisObjectMetadataArray(*v) - if err != nil { - return err - } - somlr.Value = &value - } - case "nextLink": - if v != nil { - var nextLink string - err = json.Unmarshal(*v, &nextLink) - if err != nil { - return err - } - somlr.NextLink = &nextLink - } - } - } - - return nil -} - -// SsisObjectMetadataStatusResponse the status of the operation. -type SsisObjectMetadataStatusResponse struct { - autorest.Response `json:"-"` - // Status - The status of the operation. - Status *string `json:"status,omitempty"` - // Name - The operation name. - Name *string `json:"name,omitempty"` - // Properties - The operation properties. - Properties *string `json:"properties,omitempty"` - // Error - The operation error message. - Error *string `json:"error,omitempty"` -} - -// SsisPackage ssis Package. -type SsisPackage struct { - // FolderID - Folder id which contains package. - FolderID *int64 `json:"folderId,omitempty"` - // ProjectVersion - Project version which contains package. - ProjectVersion *int64 `json:"projectVersion,omitempty"` - // ProjectID - Project id which contains package. - ProjectID *int64 `json:"projectId,omitempty"` - // Parameters - Parameters in package - Parameters *[]SsisParameter `json:"parameters,omitempty"` - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeBasicSsisObjectMetadataTypeSsisObjectMetadata', 'TypeBasicSsisObjectMetadataTypeFolder', 'TypeBasicSsisObjectMetadataTypeProject', 'TypeBasicSsisObjectMetadataTypePackage', 'TypeBasicSsisObjectMetadataTypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SsisPackage. -func (sp SsisPackage) MarshalJSON() ([]byte, error) { - sp.Type = TypeBasicSsisObjectMetadataTypePackage - objectMap := make(map[string]interface{}) - if sp.FolderID != nil { - objectMap["folderId"] = sp.FolderID - } - if sp.ProjectVersion != nil { - objectMap["projectVersion"] = sp.ProjectVersion - } - if sp.ProjectID != nil { - objectMap["projectId"] = sp.ProjectID - } - if sp.Parameters != nil { - objectMap["parameters"] = sp.Parameters - } - if sp.ID != nil { - objectMap["id"] = sp.ID - } - if sp.Name != nil { - objectMap["name"] = sp.Name - } - if sp.Description != nil { - objectMap["description"] = sp.Description - } - if sp.Type != "" { - objectMap["type"] = sp.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisFolder() (*SsisFolder, bool) { - return nil, false -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisProject() (*SsisProject, bool) { - return nil, false -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisPackage() (*SsisPackage, bool) { - return &sp, true -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisEnvironment() (*SsisEnvironment, bool) { - return nil, false -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return nil, false -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisPackage. -func (sp SsisPackage) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &sp, true -} - -// SsisParameter ssis parameter. -type SsisParameter struct { - // ID - Parameter id. - ID *int64 `json:"id,omitempty"` - // Name - Parameter name. - Name *string `json:"name,omitempty"` - // Description - Parameter description. - Description *string `json:"description,omitempty"` - // DataType - Parameter type. - DataType *string `json:"dataType,omitempty"` - // Required - Whether parameter is required. - Required *bool `json:"required,omitempty"` - // Sensitive - Whether parameter is sensitive. - Sensitive *bool `json:"sensitive,omitempty"` - // DesignDefaultValue - Design default value of parameter. - DesignDefaultValue *string `json:"designDefaultValue,omitempty"` - // DefaultValue - Default value of parameter. - DefaultValue *string `json:"defaultValue,omitempty"` - // SensitiveDefaultValue - Default sensitive value of parameter. - SensitiveDefaultValue *string `json:"sensitiveDefaultValue,omitempty"` - // ValueType - Parameter value type. - ValueType *string `json:"valueType,omitempty"` - // ValueSet - Parameter value set. - ValueSet *bool `json:"valueSet,omitempty"` - // Variable - Parameter reference variable. - Variable *string `json:"variable,omitempty"` -} - -// SsisProject ssis project. -type SsisProject struct { - // FolderID - Folder id which contains project. - FolderID *int64 `json:"folderId,omitempty"` - // Version - Project version. - Version *int64 `json:"version,omitempty"` - // EnvironmentRefs - Environment reference in project - EnvironmentRefs *[]SsisEnvironmentReference `json:"environmentRefs,omitempty"` - // Parameters - Parameters in project - Parameters *[]SsisParameter `json:"parameters,omitempty"` - // ID - Metadata id. - ID *int64 `json:"id,omitempty"` - // Name - Metadata name. - Name *string `json:"name,omitempty"` - // Description - Metadata description. - Description *string `json:"description,omitempty"` - // Type - Possible values include: 'TypeBasicSsisObjectMetadataTypeSsisObjectMetadata', 'TypeBasicSsisObjectMetadataTypeFolder', 'TypeBasicSsisObjectMetadataTypeProject', 'TypeBasicSsisObjectMetadataTypePackage', 'TypeBasicSsisObjectMetadataTypeEnvironment' - Type TypeBasicSsisObjectMetadata `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SsisProject. -func (sp SsisProject) MarshalJSON() ([]byte, error) { - sp.Type = TypeBasicSsisObjectMetadataTypeProject - objectMap := make(map[string]interface{}) - if sp.FolderID != nil { - objectMap["folderId"] = sp.FolderID - } - if sp.Version != nil { - objectMap["version"] = sp.Version - } - if sp.EnvironmentRefs != nil { - objectMap["environmentRefs"] = sp.EnvironmentRefs - } - if sp.Parameters != nil { - objectMap["parameters"] = sp.Parameters - } - if sp.ID != nil { - objectMap["id"] = sp.ID - } - if sp.Name != nil { - objectMap["name"] = sp.Name - } - if sp.Description != nil { - objectMap["description"] = sp.Description - } - if sp.Type != "" { - objectMap["type"] = sp.Type - } - return json.Marshal(objectMap) -} - -// AsSsisFolder is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisFolder() (*SsisFolder, bool) { - return nil, false -} - -// AsSsisProject is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisProject() (*SsisProject, bool) { - return &sp, true -} - -// AsSsisPackage is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisPackage() (*SsisPackage, bool) { - return nil, false -} - -// AsSsisEnvironment is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisEnvironment() (*SsisEnvironment, bool) { - return nil, false -} - -// AsSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsSsisObjectMetadata() (*SsisObjectMetadata, bool) { - return nil, false -} - -// AsBasicSsisObjectMetadata is the BasicSsisObjectMetadata implementation for SsisProject. -func (sp SsisProject) AsBasicSsisObjectMetadata() (BasicSsisObjectMetadata, bool) { - return &sp, true -} - -// SsisVariable ssis variable. -type SsisVariable struct { - // ID - Variable id. - ID *int64 `json:"id,omitempty"` - // Name - Variable name. - Name *string `json:"name,omitempty"` - // Description - Variable description. - Description *string `json:"description,omitempty"` - // DataType - Variable type. - DataType *string `json:"dataType,omitempty"` - // Sensitive - Whether variable is sensitive. - Sensitive *bool `json:"sensitive,omitempty"` - // Value - Variable value. - Value *string `json:"value,omitempty"` - // SensitiveValue - Variable sensitive value. - SensitiveValue *string `json:"sensitiveValue,omitempty"` -} - -// SubResource azure Synapse nested resource, which belongs to a workspace. -type SubResource 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 SubResource. -func (sr SubResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TopQueries a database query. -type TopQueries struct { - // AggregationFunction - READ-ONLY; The function that is used to aggregate each query's metrics. Possible values include: 'QueryAggregationFunctionMin', 'QueryAggregationFunctionMax', 'QueryAggregationFunctionAvg', 'QueryAggregationFunctionSum' - AggregationFunction QueryAggregationFunction `json:"aggregationFunction,omitempty"` - // ExecutionType - READ-ONLY; The execution type that is used to filter the query instances that are returned. Possible values include: 'QueryExecutionTypeAny', 'QueryExecutionTypeRegular', 'QueryExecutionTypeIrregular', 'QueryExecutionTypeAborted', 'QueryExecutionTypeException' - ExecutionType QueryExecutionType `json:"executionType,omitempty"` - // IntervalType - READ-ONLY; The duration of the interval (ISO8601 duration format). - IntervalType *string `json:"intervalType,omitempty"` - // NumberOfTopQueries - READ-ONLY; The number of requested queries. - NumberOfTopQueries *float64 `json:"numberOfTopQueries,omitempty"` - // ObservationStartTime - READ-ONLY; The start time for queries that are returned (ISO8601 format) - ObservationStartTime *date.Time `json:"observationStartTime,omitempty"` - // ObservationEndTime - READ-ONLY; The end time for queries that are returned (ISO8601 format) - ObservationEndTime *date.Time `json:"observationEndTime,omitempty"` - // ObservedMetric - READ-ONLY; The type of metric to use for ordering the top metrics. Possible values include: 'QueryObservedMetricTypeCPU', 'QueryObservedMetricTypeIo', 'QueryObservedMetricTypeLogio', 'QueryObservedMetricTypeDuration', 'QueryObservedMetricTypeExecutionCount' - ObservedMetric QueryObservedMetricType `json:"observedMetric,omitempty"` - // Queries - READ-ONLY; The list of queries. - Queries *[]QueryStatistic `json:"queries,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopQueries. -func (tq TopQueries) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TopQueriesListResult represents the response to a get top queries request. -type TopQueriesListResult struct { - // Value - The list of top queries. - Value *[]TopQueries `json:"value,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"` -} - -// 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) -} - -// TransparentDataEncryption represents a Sql pool transparent data encryption configuration. -type TransparentDataEncryption struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // TransparentDataEncryptionProperties - Represents the properties of the resource. - *TransparentDataEncryptionProperties `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 TransparentDataEncryption. -func (tde TransparentDataEncryption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tde.TransparentDataEncryptionProperties != nil { - objectMap["properties"] = tde.TransparentDataEncryptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryption struct. -func (tde *TransparentDataEncryption) 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 - } - tde.Location = &location - } - case "properties": - if v != nil { - var transparentDataEncryptionProperties TransparentDataEncryptionProperties - err = json.Unmarshal(*v, &transparentDataEncryptionProperties) - if err != nil { - return err - } - tde.TransparentDataEncryptionProperties = &transparentDataEncryptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tde.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tde.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tde.Type = &typeVar - } - } - } - - return nil -} - -// TransparentDataEncryptionListResult a list of transparent data encryption configurations. -type TransparentDataEncryptionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]TransparentDataEncryption `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryptionListResult. -func (tdelr TransparentDataEncryptionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TransparentDataEncryptionListResultIterator provides access to a complete listing of -// TransparentDataEncryption values. -type TransparentDataEncryptionListResultIterator struct { - i int - page TransparentDataEncryptionListResultPage -} - -// 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 *TransparentDataEncryptionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionListResultIterator.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 *TransparentDataEncryptionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TransparentDataEncryptionListResultIterator) 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 TransparentDataEncryptionListResultIterator) Response() TransparentDataEncryptionListResult { - 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 TransparentDataEncryptionListResultIterator) Value() TransparentDataEncryption { - if !iter.page.NotDone() { - return TransparentDataEncryption{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TransparentDataEncryptionListResultIterator type. -func NewTransparentDataEncryptionListResultIterator(page TransparentDataEncryptionListResultPage) TransparentDataEncryptionListResultIterator { - return TransparentDataEncryptionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tdelr TransparentDataEncryptionListResult) IsEmpty() bool { - return tdelr.Value == nil || len(*tdelr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tdelr TransparentDataEncryptionListResult) hasNextLink() bool { - return tdelr.NextLink != nil && len(*tdelr.NextLink) != 0 -} - -// transparentDataEncryptionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tdelr TransparentDataEncryptionListResult) transparentDataEncryptionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !tdelr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tdelr.NextLink))) -} - -// TransparentDataEncryptionListResultPage contains a page of TransparentDataEncryption values. -type TransparentDataEncryptionListResultPage struct { - fn func(context.Context, TransparentDataEncryptionListResult) (TransparentDataEncryptionListResult, error) - tdelr TransparentDataEncryptionListResult -} - -// 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 *TransparentDataEncryptionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionListResultPage.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.tdelr) - if err != nil { - return err - } - page.tdelr = 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 *TransparentDataEncryptionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TransparentDataEncryptionListResultPage) NotDone() bool { - return !page.tdelr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TransparentDataEncryptionListResultPage) Response() TransparentDataEncryptionListResult { - return page.tdelr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TransparentDataEncryptionListResultPage) Values() []TransparentDataEncryption { - if page.tdelr.IsEmpty() { - return nil - } - return *page.tdelr.Value -} - -// Creates a new instance of the TransparentDataEncryptionListResultPage type. -func NewTransparentDataEncryptionListResultPage(cur TransparentDataEncryptionListResult, getNextPage func(context.Context, TransparentDataEncryptionListResult) (TransparentDataEncryptionListResult, error)) TransparentDataEncryptionListResultPage { - return TransparentDataEncryptionListResultPage{ - fn: getNextPage, - tdelr: cur, - } -} - -// TransparentDataEncryptionProperties represents the properties of a database transparent data encryption. -type TransparentDataEncryptionProperties struct { - // Status - The status of the database transparent data encryption. Possible values include: 'TransparentDataEncryptionStatusEnabled', 'TransparentDataEncryptionStatusDisabled' - Status TransparentDataEncryptionStatus `json:"status,omitempty"` -} - -// UpdateIntegrationRuntimeNodeRequest update integration runtime node request. -type UpdateIntegrationRuntimeNodeRequest struct { - // ConcurrentJobsLimit - The number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. - ConcurrentJobsLimit *int32 `json:"concurrentJobsLimit,omitempty"` -} - -// UpdateIntegrationRuntimeRequest update integration runtime request. -type UpdateIntegrationRuntimeRequest struct { - // AutoUpdate - Enables or disables the auto-update feature of the self-hosted integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. Possible values include: 'IntegrationRuntimeAutoUpdateOn', 'IntegrationRuntimeAutoUpdateOff' - AutoUpdate IntegrationRuntimeAutoUpdate `json:"autoUpdate,omitempty"` - // UpdateDelayOffset - The time offset (in hours) in the day, e.g., PT03H is 3 hours. The integration runtime auto update will happen on that time. - UpdateDelayOffset *string `json:"updateDelayOffset,omitempty"` -} - -// UserAssignedManagedIdentity user Assigned Managed Identity -type UserAssignedManagedIdentity struct { - // ClientID - READ-ONLY; The client ID. - ClientID *uuid.UUID `json:"clientId,omitempty"` - // PrincipalID - READ-ONLY; The principal ID. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedManagedIdentity. -func (uami UserAssignedManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkProfile virtual Network Profile -type VirtualNetworkProfile struct { - // ComputeSubnetID - Subnet ID used for computes in workspace - ComputeSubnetID *string `json:"computeSubnetId,omitempty"` -} - -// VulnerabilityAssessmentRecurringScansProperties properties of a Vulnerability Assessment recurring -// scans. -type VulnerabilityAssessmentRecurringScansProperties struct { - // IsEnabled - Recurring scans state. - IsEnabled *bool `json:"isEnabled,omitempty"` - // EmailSubscriptionAdmins - Specifies that the schedule scan notification will be is sent to the subscription administrators. - EmailSubscriptionAdmins *bool `json:"emailSubscriptionAdmins,omitempty"` - // Emails - Specifies an array of e-mail addresses to which the scan notification is sent. - Emails *[]string `json:"emails,omitempty"` -} - -// VulnerabilityAssessmentScanError properties of a vulnerability assessment scan error. -type VulnerabilityAssessmentScanError struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanError. -func (vase VulnerabilityAssessmentScanError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VulnerabilityAssessmentScanRecord a vulnerability assessment scan record. -type VulnerabilityAssessmentScanRecord struct { - autorest.Response `json:"-"` - // VulnerabilityAssessmentScanRecordProperties - Resource properties. - *VulnerabilityAssessmentScanRecordProperties `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 VulnerabilityAssessmentScanRecord. -func (vasr VulnerabilityAssessmentScanRecord) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vasr.VulnerabilityAssessmentScanRecordProperties != nil { - objectMap["properties"] = vasr.VulnerabilityAssessmentScanRecordProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VulnerabilityAssessmentScanRecord struct. -func (vasr *VulnerabilityAssessmentScanRecord) 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 vulnerabilityAssessmentScanRecordProperties VulnerabilityAssessmentScanRecordProperties - err = json.Unmarshal(*v, &vulnerabilityAssessmentScanRecordProperties) - if err != nil { - return err - } - vasr.VulnerabilityAssessmentScanRecordProperties = &vulnerabilityAssessmentScanRecordProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vasr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vasr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vasr.Type = &typeVar - } - } - } - - return nil -} - -// VulnerabilityAssessmentScanRecordListResult a list of vulnerability assessment scan records. -type VulnerabilityAssessmentScanRecordListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VulnerabilityAssessmentScanRecord `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecordListResult. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VulnerabilityAssessmentScanRecordListResultIterator provides access to a complete listing of -// VulnerabilityAssessmentScanRecord values. -type VulnerabilityAssessmentScanRecordListResultIterator struct { - i int - page VulnerabilityAssessmentScanRecordListResultPage -} - -// 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 *VulnerabilityAssessmentScanRecordListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VulnerabilityAssessmentScanRecordListResultIterator.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 *VulnerabilityAssessmentScanRecordListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VulnerabilityAssessmentScanRecordListResultIterator) 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 VulnerabilityAssessmentScanRecordListResultIterator) Response() VulnerabilityAssessmentScanRecordListResult { - 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 VulnerabilityAssessmentScanRecordListResultIterator) Value() VulnerabilityAssessmentScanRecord { - if !iter.page.NotDone() { - return VulnerabilityAssessmentScanRecord{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VulnerabilityAssessmentScanRecordListResultIterator type. -func NewVulnerabilityAssessmentScanRecordListResultIterator(page VulnerabilityAssessmentScanRecordListResultPage) VulnerabilityAssessmentScanRecordListResultIterator { - return VulnerabilityAssessmentScanRecordListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) IsEmpty() bool { - return vasrlr.Value == nil || len(*vasrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) hasNextLink() bool { - return vasrlr.NextLink != nil && len(*vasrlr.NextLink) != 0 -} - -// vulnerabilityAssessmentScanRecordListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vasrlr VulnerabilityAssessmentScanRecordListResult) vulnerabilityAssessmentScanRecordListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vasrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vasrlr.NextLink))) -} - -// VulnerabilityAssessmentScanRecordListResultPage contains a page of VulnerabilityAssessmentScanRecord -// values. -type VulnerabilityAssessmentScanRecordListResultPage struct { - fn func(context.Context, VulnerabilityAssessmentScanRecordListResult) (VulnerabilityAssessmentScanRecordListResult, error) - vasrlr VulnerabilityAssessmentScanRecordListResult -} - -// 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 *VulnerabilityAssessmentScanRecordListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VulnerabilityAssessmentScanRecordListResultPage.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.vasrlr) - if err != nil { - return err - } - page.vasrlr = 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 *VulnerabilityAssessmentScanRecordListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VulnerabilityAssessmentScanRecordListResultPage) NotDone() bool { - return !page.vasrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VulnerabilityAssessmentScanRecordListResultPage) Response() VulnerabilityAssessmentScanRecordListResult { - return page.vasrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VulnerabilityAssessmentScanRecordListResultPage) Values() []VulnerabilityAssessmentScanRecord { - if page.vasrlr.IsEmpty() { - return nil - } - return *page.vasrlr.Value -} - -// Creates a new instance of the VulnerabilityAssessmentScanRecordListResultPage type. -func NewVulnerabilityAssessmentScanRecordListResultPage(cur VulnerabilityAssessmentScanRecordListResult, getNextPage func(context.Context, VulnerabilityAssessmentScanRecordListResult) (VulnerabilityAssessmentScanRecordListResult, error)) VulnerabilityAssessmentScanRecordListResultPage { - return VulnerabilityAssessmentScanRecordListResultPage{ - fn: getNextPage, - vasrlr: cur, - } -} - -// VulnerabilityAssessmentScanRecordProperties properties of a vulnerability assessment scan record. -type VulnerabilityAssessmentScanRecordProperties struct { - // ScanID - READ-ONLY; The scan ID. - ScanID *string `json:"scanId,omitempty"` - // TriggerType - READ-ONLY; The scan trigger type. Possible values include: 'VulnerabilityAssessmentScanTriggerTypeOnDemand', 'VulnerabilityAssessmentScanTriggerTypeRecurring' - TriggerType VulnerabilityAssessmentScanTriggerType `json:"triggerType,omitempty"` - // State - READ-ONLY; The scan status. Possible values include: 'VulnerabilityAssessmentScanStatePassed', 'VulnerabilityAssessmentScanStateFailed', 'VulnerabilityAssessmentScanStateFailedToRun', 'VulnerabilityAssessmentScanStateInProgress' - State VulnerabilityAssessmentScanState `json:"state,omitempty"` - // StartTime - READ-ONLY; The scan start time (UTC). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The scan end time (UTC). - EndTime *date.Time `json:"endTime,omitempty"` - // Errors - READ-ONLY; The scan errors. - Errors *[]VulnerabilityAssessmentScanError `json:"errors,omitempty"` - // StorageContainerPath - READ-ONLY; The scan results storage container path. - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // NumberOfFailedSecurityChecks - READ-ONLY; The number of failed security checks. - NumberOfFailedSecurityChecks *int32 `json:"numberOfFailedSecurityChecks,omitempty"` -} - -// MarshalJSON is the custom marshaler for VulnerabilityAssessmentScanRecordProperties. -func (vasrp VulnerabilityAssessmentScanRecordProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkloadClassifier workload classifier operations for a data warehouse -type WorkloadClassifier struct { - autorest.Response `json:"-"` - // WorkloadClassifierProperties - Resource properties. - *WorkloadClassifierProperties `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 WorkloadClassifier. -func (wc WorkloadClassifier) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wc.WorkloadClassifierProperties != nil { - objectMap["properties"] = wc.WorkloadClassifierProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkloadClassifier struct. -func (wc *WorkloadClassifier) 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 workloadClassifierProperties WorkloadClassifierProperties - err = json.Unmarshal(*v, &workloadClassifierProperties) - if err != nil { - return err - } - wc.WorkloadClassifierProperties = &workloadClassifierProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wc.Type = &typeVar - } - } - } - - return nil -} - -// WorkloadClassifierListResult a list of workload classifiers for a workload group. -type WorkloadClassifierListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]WorkloadClassifier `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkloadClassifierListResult. -func (wclr WorkloadClassifierListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkloadClassifierListResultIterator provides access to a complete listing of WorkloadClassifier values. -type WorkloadClassifierListResultIterator struct { - i int - page WorkloadClassifierListResultPage -} - -// 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 *WorkloadClassifierListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifierListResultIterator.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 *WorkloadClassifierListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkloadClassifierListResultIterator) 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 WorkloadClassifierListResultIterator) Response() WorkloadClassifierListResult { - 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 WorkloadClassifierListResultIterator) Value() WorkloadClassifier { - if !iter.page.NotDone() { - return WorkloadClassifier{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkloadClassifierListResultIterator type. -func NewWorkloadClassifierListResultIterator(page WorkloadClassifierListResultPage) WorkloadClassifierListResultIterator { - return WorkloadClassifierListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wclr WorkloadClassifierListResult) IsEmpty() bool { - return wclr.Value == nil || len(*wclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wclr WorkloadClassifierListResult) hasNextLink() bool { - return wclr.NextLink != nil && len(*wclr.NextLink) != 0 -} - -// workloadClassifierListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wclr WorkloadClassifierListResult) workloadClassifierListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wclr.NextLink))) -} - -// WorkloadClassifierListResultPage contains a page of WorkloadClassifier values. -type WorkloadClassifierListResultPage struct { - fn func(context.Context, WorkloadClassifierListResult) (WorkloadClassifierListResult, error) - wclr WorkloadClassifierListResult -} - -// 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 *WorkloadClassifierListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadClassifierListResultPage.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.wclr) - if err != nil { - return err - } - page.wclr = 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 *WorkloadClassifierListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkloadClassifierListResultPage) NotDone() bool { - return !page.wclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkloadClassifierListResultPage) Response() WorkloadClassifierListResult { - return page.wclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkloadClassifierListResultPage) Values() []WorkloadClassifier { - if page.wclr.IsEmpty() { - return nil - } - return *page.wclr.Value -} - -// Creates a new instance of the WorkloadClassifierListResultPage type. -func NewWorkloadClassifierListResultPage(cur WorkloadClassifierListResult, getNextPage func(context.Context, WorkloadClassifierListResult) (WorkloadClassifierListResult, error)) WorkloadClassifierListResultPage { - return WorkloadClassifierListResultPage{ - fn: getNextPage, - wclr: cur, - } -} - -// WorkloadClassifierProperties workload classifier definition. For more information look at -// sys.workload_management_workload_classifiers (DMV). -type WorkloadClassifierProperties struct { - // MemberName - The workload classifier member name. - MemberName *string `json:"memberName,omitempty"` - // Label - The workload classifier label. - Label *string `json:"label,omitempty"` - // Context - The workload classifier context. - Context *string `json:"context,omitempty"` - // StartTime - The workload classifier start time for classification. - StartTime *string `json:"startTime,omitempty"` - // EndTime - The workload classifier end time for classification. - EndTime *string `json:"endTime,omitempty"` - // Importance - The workload classifier importance. - Importance *string `json:"importance,omitempty"` -} - -// WorkloadGroup workload group operations for a sql pool -type WorkloadGroup struct { - autorest.Response `json:"-"` - // WorkloadGroupProperties - Resource properties. - *WorkloadGroupProperties `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 WorkloadGroup. -func (wg WorkloadGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wg.WorkloadGroupProperties != nil { - objectMap["properties"] = wg.WorkloadGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkloadGroup struct. -func (wg *WorkloadGroup) 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 workloadGroupProperties WorkloadGroupProperties - err = json.Unmarshal(*v, &workloadGroupProperties) - if err != nil { - return err - } - wg.WorkloadGroupProperties = &workloadGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wg.Type = &typeVar - } - } - } - - return nil -} - -// WorkloadGroupListResult a list of workload groups. -type WorkloadGroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]WorkloadGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkloadGroupListResult. -func (wglr WorkloadGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkloadGroupListResultIterator provides access to a complete listing of WorkloadGroup values. -type WorkloadGroupListResultIterator struct { - i int - page WorkloadGroupListResultPage -} - -// 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 *WorkloadGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupListResultIterator.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 *WorkloadGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkloadGroupListResultIterator) 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 WorkloadGroupListResultIterator) Response() WorkloadGroupListResult { - 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 WorkloadGroupListResultIterator) Value() WorkloadGroup { - if !iter.page.NotDone() { - return WorkloadGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkloadGroupListResultIterator type. -func NewWorkloadGroupListResultIterator(page WorkloadGroupListResultPage) WorkloadGroupListResultIterator { - return WorkloadGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wglr WorkloadGroupListResult) IsEmpty() bool { - return wglr.Value == nil || len(*wglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wglr WorkloadGroupListResult) hasNextLink() bool { - return wglr.NextLink != nil && len(*wglr.NextLink) != 0 -} - -// workloadGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wglr WorkloadGroupListResult) workloadGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wglr.NextLink))) -} - -// WorkloadGroupListResultPage contains a page of WorkloadGroup values. -type WorkloadGroupListResultPage struct { - fn func(context.Context, WorkloadGroupListResult) (WorkloadGroupListResult, error) - wglr WorkloadGroupListResult -} - -// 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 *WorkloadGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadGroupListResultPage.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.wglr) - if err != nil { - return err - } - page.wglr = 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 *WorkloadGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkloadGroupListResultPage) NotDone() bool { - return !page.wglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkloadGroupListResultPage) Response() WorkloadGroupListResult { - return page.wglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkloadGroupListResultPage) Values() []WorkloadGroup { - if page.wglr.IsEmpty() { - return nil - } - return *page.wglr.Value -} - -// Creates a new instance of the WorkloadGroupListResultPage type. -func NewWorkloadGroupListResultPage(cur WorkloadGroupListResult, getNextPage func(context.Context, WorkloadGroupListResult) (WorkloadGroupListResult, error)) WorkloadGroupListResultPage { - return WorkloadGroupListResultPage{ - fn: getNextPage, - wglr: cur, - } -} - -// WorkloadGroupProperties workload group definition. For more information look at -// sys.workload_management_workload_groups (DMV). -type WorkloadGroupProperties struct { - // MinResourcePercent - The workload group minimum percentage resource. - MinResourcePercent *int32 `json:"minResourcePercent,omitempty"` - // MaxResourcePercent - The workload group cap percentage resource. - MaxResourcePercent *int32 `json:"maxResourcePercent,omitempty"` - // MinResourcePercentPerRequest - The workload group request minimum grant percentage. - MinResourcePercentPerRequest *float64 `json:"minResourcePercentPerRequest,omitempty"` - // MaxResourcePercentPerRequest - The workload group request maximum grant percentage. - MaxResourcePercentPerRequest *float64 `json:"maxResourcePercentPerRequest,omitempty"` - // Importance - The workload group importance level. - Importance *string `json:"importance,omitempty"` - // QueryExecutionTimeout - The workload group query execution timeout. - QueryExecutionTimeout *int32 `json:"queryExecutionTimeout,omitempty"` -} - -// Workspace a workspace -type Workspace struct { - autorest.Response `json:"-"` - // WorkspaceProperties - Workspace resource properties - *WorkspaceProperties `json:"properties,omitempty"` - // Identity - Identity of the workspace - Identity *ManagedIdentity `json:"identity,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 Workspace. -func (w Workspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WorkspaceProperties != nil { - objectMap["properties"] = w.WorkspaceProperties - } - if w.Identity != nil { - objectMap["identity"] = w.Identity - } - 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 Workspace struct. -func (w *Workspace) 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 workspaceProperties WorkspaceProperties - err = json.Unmarshal(*v, &workspaceProperties) - if err != nil { - return err - } - w.WorkspaceProperties = &workspaceProperties - } - case "identity": - if v != nil { - var identity ManagedIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - w.Identity = &identity - } - 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 -} - -// WorkspaceAadAdminInfo workspace active directory administrator -type WorkspaceAadAdminInfo struct { - autorest.Response `json:"-"` - // AadAdminProperties - Workspace active directory administrator properties - *AadAdminProperties `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 WorkspaceAadAdminInfo. -func (waai WorkspaceAadAdminInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if waai.AadAdminProperties != nil { - objectMap["properties"] = waai.AadAdminProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspaceAadAdminInfo struct. -func (waai *WorkspaceAadAdminInfo) 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 aadAdminProperties AadAdminProperties - err = json.Unmarshal(*v, &aadAdminProperties) - if err != nil { - return err - } - waai.AadAdminProperties = &aadAdminProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - waai.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - waai.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - waai.Type = &typeVar - } - } - } - - return nil -} - -// WorkspaceAadAdminsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspaceAadAdminsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceAadAdminsClient) (WorkspaceAadAdminInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceAadAdminsCreateOrUpdateFuture) 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 WorkspaceAadAdminsCreateOrUpdateFuture.Result. -func (future *WorkspaceAadAdminsCreateOrUpdateFuture) result(client WorkspaceAadAdminsClient) (waai WorkspaceAadAdminInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - waai.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceAadAdminsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if waai.Response.Response, err = future.GetResult(sender); err == nil && waai.Response.Response.StatusCode != http.StatusNoContent { - waai, err = client.CreateOrUpdateResponder(waai.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsCreateOrUpdateFuture", "Result", waai.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceAadAdminsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspaceAadAdminsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceAadAdminsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceAadAdminsDeleteFuture) 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 WorkspaceAadAdminsDeleteFuture.Result. -func (future *WorkspaceAadAdminsDeleteFuture) result(client WorkspaceAadAdminsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceAadAdminsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WorkspaceInfoListResult list of workspaces -type WorkspaceInfoListResult struct { - autorest.Response `json:"-"` - // NextLink - Link to the next page of results - NextLink *string `json:"nextLink,omitempty"` - // Value - List of workspaces - Value *[]Workspace `json:"value,omitempty"` -} - -// WorkspaceInfoListResultIterator provides access to a complete listing of Workspace values. -type WorkspaceInfoListResultIterator struct { - i int - page WorkspaceInfoListResultPage -} - -// 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 *WorkspaceInfoListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceInfoListResultIterator.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 *WorkspaceInfoListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkspaceInfoListResultIterator) 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 WorkspaceInfoListResultIterator) Response() WorkspaceInfoListResult { - 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 WorkspaceInfoListResultIterator) Value() Workspace { - if !iter.page.NotDone() { - return Workspace{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkspaceInfoListResultIterator type. -func NewWorkspaceInfoListResultIterator(page WorkspaceInfoListResultPage) WorkspaceInfoListResultIterator { - return WorkspaceInfoListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wilr WorkspaceInfoListResult) IsEmpty() bool { - return wilr.Value == nil || len(*wilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wilr WorkspaceInfoListResult) hasNextLink() bool { - return wilr.NextLink != nil && len(*wilr.NextLink) != 0 -} - -// workspaceInfoListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wilr WorkspaceInfoListResult) workspaceInfoListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wilr.NextLink))) -} - -// WorkspaceInfoListResultPage contains a page of Workspace values. -type WorkspaceInfoListResultPage struct { - fn func(context.Context, WorkspaceInfoListResult) (WorkspaceInfoListResult, error) - wilr WorkspaceInfoListResult -} - -// 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 *WorkspaceInfoListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceInfoListResultPage.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.wilr) - if err != nil { - return err - } - page.wilr = 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 *WorkspaceInfoListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkspaceInfoListResultPage) NotDone() bool { - return !page.wilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkspaceInfoListResultPage) Response() WorkspaceInfoListResult { - return page.wilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkspaceInfoListResultPage) Values() []Workspace { - if page.wilr.IsEmpty() { - return nil - } - return *page.wilr.Value -} - -// Creates a new instance of the WorkspaceInfoListResultPage type. -func NewWorkspaceInfoListResultPage(cur WorkspaceInfoListResult, getNextPage func(context.Context, WorkspaceInfoListResult) (WorkspaceInfoListResult, error)) WorkspaceInfoListResultPage { - return WorkspaceInfoListResultPage{ - fn: getNextPage, - wilr: cur, - } -} - -// WorkspaceKeyDetails details of the customer managed key associated with the workspace -type WorkspaceKeyDetails struct { - // Name - Workspace Key sub-resource name - Name *string `json:"name,omitempty"` - // KeyVaultURL - Workspace Key sub-resource key vault url - KeyVaultURL *string `json:"keyVaultUrl,omitempty"` -} - -// WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedIdentitySQLControlSettingsClient) (ManagedIdentitySQLControlSettingsModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture) 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 WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture.Result. -func (future *WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture) result(client WorkspaceManagedIdentitySQLControlSettingsClient) (miscsm ManagedIdentitySQLControlSettingsModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - miscsm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if miscsm.Response.Response, err = future.GetResult(sender); err == nil && miscsm.Response.Response.StatusCode != http.StatusNoContent { - miscsm, err = client.CreateOrUpdateResponder(miscsm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture", "Result", miscsm.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedSQLServerBlobAuditingPoliciesClient) (ServerBlobAuditingPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture) 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 WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture.Result. -func (future *WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture) result(client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) (sbap ServerBlobAuditingPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sbap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sbap.Response.Response, err = future.GetResult(sender); err == nil && sbap.Response.Response.StatusCode != http.StatusNoContent { - sbap, err = client.CreateOrUpdateResponder(sbap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", sbap.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedSQLServerEncryptionProtectorClient) (EncryptionProtector, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture) 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 WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture.Result. -func (future *WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture) result(client WorkspaceManagedSQLServerEncryptionProtectorClient) (ep EncryptionProtector, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateOrUpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedSQLServerEncryptionProtectorClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture) 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 WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture.Result. -func (future *WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture) result(client WorkspaceManagedSQLServerEncryptionProtectorClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture") - return - } - ar.Response = future.Response() - return -} - -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring -// and retrieving the results of a long-running operation. -type WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) (ExtendedServerBlobAuditingPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture) 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture.Result. -func (future *WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture) result(client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) (esbap ExtendedServerBlobAuditingPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - esbap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if esbap.Response.Response, err = future.GetResult(sender); err == nil && esbap.Response.Response.StatusCode != http.StatusNoContent { - esbap, err = client.CreateOrUpdateResponder(esbap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture", "Result", esbap.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceManagedSQLServerSecurityAlertPolicyClient) (ServerSecurityAlertPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture) 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 WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture.Result. -func (future *WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture) result(client WorkspaceManagedSQLServerSecurityAlertPolicyClient) (ssap ServerSecurityAlertPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ssap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { - ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspacePatchInfo workspace patch details -type WorkspacePatchInfo struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Identity - The identity of the workspace - Identity *ManagedIdentity `json:"identity,omitempty"` - // WorkspacePatchProperties - Workspace patch properties - *WorkspacePatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspacePatchInfo. -func (wpi WorkspacePatchInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpi.Tags != nil { - objectMap["tags"] = wpi.Tags - } - if wpi.Identity != nil { - objectMap["identity"] = wpi.Identity - } - if wpi.WorkspacePatchProperties != nil { - objectMap["properties"] = wpi.WorkspacePatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspacePatchInfo struct. -func (wpi *WorkspacePatchInfo) 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 - } - wpi.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - wpi.Identity = &identity - } - case "properties": - if v != nil { - var workspacePatchProperties WorkspacePatchProperties - err = json.Unmarshal(*v, &workspacePatchProperties) - if err != nil { - return err - } - wpi.WorkspacePatchProperties = &workspacePatchProperties - } - } - } - - return nil -} - -// WorkspacePatchProperties workspace patch properties -type WorkspacePatchProperties struct { - // SQLAdministratorLoginPassword - SQL administrator login password - SQLAdministratorLoginPassword *string `json:"sqlAdministratorLoginPassword,omitempty"` - // ManagedVirtualNetworkSettings - Managed Virtual Network Settings - ManagedVirtualNetworkSettings *ManagedVirtualNetworkSettings `json:"managedVirtualNetworkSettings,omitempty"` - // WorkspaceRepositoryConfiguration - Git integration settings - WorkspaceRepositoryConfiguration *WorkspaceRepositoryConfiguration `json:"workspaceRepositoryConfiguration,omitempty"` - // PurviewConfiguration - Purview Configuration - PurviewConfiguration *PurviewConfiguration `json:"purviewConfiguration,omitempty"` - // ProvisioningState - READ-ONLY; Resource provisioning state - ProvisioningState *string `json:"provisioningState,omitempty"` - // Encryption - The encryption details of the workspace - Encryption *EncryptionDetails `json:"encryption,omitempty"` - // PublicNetworkAccess - Enable or Disable public network access to workspace. Possible values include: 'WorkspacePublicNetworkAccessEnabled', 'WorkspacePublicNetworkAccessDisabled' - PublicNetworkAccess WorkspacePublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspacePatchProperties. -func (wpp WorkspacePatchProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpp.SQLAdministratorLoginPassword != nil { - objectMap["sqlAdministratorLoginPassword"] = wpp.SQLAdministratorLoginPassword - } - if wpp.ManagedVirtualNetworkSettings != nil { - objectMap["managedVirtualNetworkSettings"] = wpp.ManagedVirtualNetworkSettings - } - if wpp.WorkspaceRepositoryConfiguration != nil { - objectMap["workspaceRepositoryConfiguration"] = wpp.WorkspaceRepositoryConfiguration - } - if wpp.PurviewConfiguration != nil { - objectMap["purviewConfiguration"] = wpp.PurviewConfiguration - } - if wpp.Encryption != nil { - objectMap["encryption"] = wpp.Encryption - } - if wpp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = wpp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// WorkspaceProperties workspace properties -type WorkspaceProperties struct { - // DefaultDataLakeStorage - Workspace default data lake storage account details - DefaultDataLakeStorage *DataLakeStorageAccountDetails `json:"defaultDataLakeStorage,omitempty"` - // SQLAdministratorLoginPassword - SQL administrator login password - SQLAdministratorLoginPassword *string `json:"sqlAdministratorLoginPassword,omitempty"` - // ManagedResourceGroupName - Workspace managed resource group. The resource group name uniquely identifies the resource group within the user subscriptionId. The resource group name must be no longer than 90 characters long, and must be alphanumeric characters (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note that the name cannot end with '.' - ManagedResourceGroupName *string `json:"managedResourceGroupName,omitempty"` - // ProvisioningState - READ-ONLY; Resource provisioning state - ProvisioningState *string `json:"provisioningState,omitempty"` - // SQLAdministratorLogin - Login for workspace SQL active directory administrator - SQLAdministratorLogin *string `json:"sqlAdministratorLogin,omitempty"` - // VirtualNetworkProfile - Virtual Network profile - VirtualNetworkProfile *VirtualNetworkProfile `json:"virtualNetworkProfile,omitempty"` - // ConnectivityEndpoints - Connectivity endpoints - ConnectivityEndpoints map[string]*string `json:"connectivityEndpoints"` - // ManagedVirtualNetwork - Setting this to 'default' will ensure that all compute for this workspace is in a virtual network managed on behalf of the user. - ManagedVirtualNetwork *string `json:"managedVirtualNetwork,omitempty"` - // PrivateEndpointConnections - Private endpoint connections to the workspace - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // Encryption - The encryption details of the workspace - Encryption *EncryptionDetails `json:"encryption,omitempty"` - // WorkspaceUID - READ-ONLY; The workspace unique identifier - WorkspaceUID *uuid.UUID `json:"workspaceUID,omitempty"` - // ExtraProperties - READ-ONLY; Workspace level configs and feature flags - ExtraProperties map[string]interface{} `json:"extraProperties"` - // ManagedVirtualNetworkSettings - Managed Virtual Network Settings - ManagedVirtualNetworkSettings *ManagedVirtualNetworkSettings `json:"managedVirtualNetworkSettings,omitempty"` - // WorkspaceRepositoryConfiguration - Git integration settings - WorkspaceRepositoryConfiguration *WorkspaceRepositoryConfiguration `json:"workspaceRepositoryConfiguration,omitempty"` - // PurviewConfiguration - Purview Configuration - PurviewConfiguration *PurviewConfiguration `json:"purviewConfiguration,omitempty"` - // AdlaResourceID - READ-ONLY; The ADLA resource ID. - AdlaResourceID *string `json:"adlaResourceId,omitempty"` - // PublicNetworkAccess - Enable or Disable public network access to workspace. Possible values include: 'WorkspacePublicNetworkAccessEnabled', 'WorkspacePublicNetworkAccessDisabled' - PublicNetworkAccess WorkspacePublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // CspWorkspaceAdminProperties - Initial workspace AAD admin properties for a CSP subscription - CspWorkspaceAdminProperties *CspWorkspaceAdminProperties `json:"cspWorkspaceAdminProperties,omitempty"` - // Settings - READ-ONLY; Workspace settings - Settings map[string]interface{} `json:"settings"` - // AzureADOnlyAuthentication - Enable or Disable AzureADOnlyAuthentication on All Workspace subresource - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceProperties. -func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.DefaultDataLakeStorage != nil { - objectMap["defaultDataLakeStorage"] = wp.DefaultDataLakeStorage - } - if wp.SQLAdministratorLoginPassword != nil { - objectMap["sqlAdministratorLoginPassword"] = wp.SQLAdministratorLoginPassword - } - if wp.ManagedResourceGroupName != nil { - objectMap["managedResourceGroupName"] = wp.ManagedResourceGroupName - } - if wp.SQLAdministratorLogin != nil { - objectMap["sqlAdministratorLogin"] = wp.SQLAdministratorLogin - } - if wp.VirtualNetworkProfile != nil { - objectMap["virtualNetworkProfile"] = wp.VirtualNetworkProfile - } - if wp.ConnectivityEndpoints != nil { - objectMap["connectivityEndpoints"] = wp.ConnectivityEndpoints - } - if wp.ManagedVirtualNetwork != nil { - objectMap["managedVirtualNetwork"] = wp.ManagedVirtualNetwork - } - if wp.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = wp.PrivateEndpointConnections - } - if wp.Encryption != nil { - objectMap["encryption"] = wp.Encryption - } - if wp.ManagedVirtualNetworkSettings != nil { - objectMap["managedVirtualNetworkSettings"] = wp.ManagedVirtualNetworkSettings - } - if wp.WorkspaceRepositoryConfiguration != nil { - objectMap["workspaceRepositoryConfiguration"] = wp.WorkspaceRepositoryConfiguration - } - if wp.PurviewConfiguration != nil { - objectMap["purviewConfiguration"] = wp.PurviewConfiguration - } - if wp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = wp.PublicNetworkAccess - } - if wp.CspWorkspaceAdminProperties != nil { - objectMap["cspWorkspaceAdminProperties"] = wp.CspWorkspaceAdminProperties - } - if wp.AzureADOnlyAuthentication != nil { - objectMap["azureADOnlyAuthentication"] = wp.AzureADOnlyAuthentication - } - return json.Marshal(objectMap) -} - -// WorkspaceRepositoryConfiguration git integration settings -type WorkspaceRepositoryConfiguration struct { - // Type - Type of workspace repositoryID configuration. Example WorkspaceVSTSConfiguration, WorkspaceGitHubConfiguration - Type *string `json:"type,omitempty"` - // HostName - GitHub Enterprise host name. For example: https://github.mydomain.com - HostName *string `json:"hostName,omitempty"` - // AccountName - Account name - AccountName *string `json:"accountName,omitempty"` - // ProjectName - VSTS project name - ProjectName *string `json:"projectName,omitempty"` - // RepositoryName - Repository name - RepositoryName *string `json:"repositoryName,omitempty"` - // CollaborationBranch - Collaboration branch - CollaborationBranch *string `json:"collaborationBranch,omitempty"` - // RootFolder - Root folder to use in the repository - RootFolder *string `json:"rootFolder,omitempty"` - // LastCommitID - The last commit ID - LastCommitID *string `json:"lastCommitId,omitempty"` - // TenantID - The VSTS tenant ID - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspacesClient) (Workspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspacesCreateOrUpdateFuture) 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 WorkspacesCreateOrUpdateFuture.Result. -func (future *WorkspacesCreateOrUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.CreateOrUpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WorkspacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspacesClient) (SetObject, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspacesDeleteFuture) 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 WorkspacesDeleteFuture.Result. -func (future *WorkspacesDeleteFuture) result(client WorkspacesClient) (so SetObject, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - so.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspacesDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { - so, err = client.DeleteResponder(so.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesDeleteFuture", "Result", so.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceSQLAadAdminsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspaceSQLAadAdminsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceSQLAadAdminsClient) (WorkspaceAadAdminInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceSQLAadAdminsCreateOrUpdateFuture) 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 WorkspaceSQLAadAdminsCreateOrUpdateFuture.Result. -func (future *WorkspaceSQLAadAdminsCreateOrUpdateFuture) result(client WorkspaceSQLAadAdminsClient) (waai WorkspaceAadAdminInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - waai.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceSQLAadAdminsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if waai.Response.Response, err = future.GetResult(sender); err == nil && waai.Response.Response.StatusCode != http.StatusNoContent { - waai, err = client.CreateOrUpdateResponder(waai.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsCreateOrUpdateFuture", "Result", waai.Response.Response, "Failure responding to request") - } - } - return -} - -// WorkspaceSQLAadAdminsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WorkspaceSQLAadAdminsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspaceSQLAadAdminsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspaceSQLAadAdminsDeleteFuture) 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 WorkspaceSQLAadAdminsDeleteFuture.Result. -func (future *WorkspaceSQLAadAdminsDeleteFuture) result(client WorkspaceSQLAadAdminsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceSQLAadAdminsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WorkspacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WorkspacesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkspacesClient) (Workspace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkspacesUpdateFuture) 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 WorkspacesUpdateFuture.Result. -func (future *WorkspacesUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - w.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("synapse.WorkspacesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { - w, err = client.UpdateResponder(w.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesUpdateFuture", "Result", w.Response.Response, "Failure responding to request") - } - } - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/operations.go b/services/preview/synapse/mgmt/v1.0/synapse/operations.go deleted file mode 100644 index a6016359a886..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/operations.go +++ /dev/null @@ -1,347 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// OperationsClient is the azure Synapse Analytics 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)} -} - -// CheckNameAvailability check whether a workspace name is available -// Parameters: -// request - the check request -func (client OperationsClient) CheckNameAvailability(ctx context.Context, request CheckNameAvailabilityRequest) (result CheckNameAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.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: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.OperationsClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, request) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client OperationsClient) CheckNameAvailabilityPreparer(ctx context.Context, request CheckNameAvailabilityRequest) (*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.Synapse/checkNameAvailability", pathParameters), - autorest.WithJSON(request), - 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 OperationsClient) 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 OperationsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAzureAsyncHeaderResult get the status of an operation -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// operationID - operation ID -func (client OperationsClient) GetAzureAsyncHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (result OperationResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.GetAzureAsyncHeaderResult") - 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("synapse.OperationsClient", "GetAzureAsyncHeaderResult", err.Error()) - } - - req, err := client.GetAzureAsyncHeaderResultPreparer(ctx, resourceGroupName, workspaceName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetAzureAsyncHeaderResult", nil, "Failure preparing request") - return - } - - resp, err := client.GetAzureAsyncHeaderResultSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetAzureAsyncHeaderResult", resp, "Failure sending request") - return - } - - result, err = client.GetAzureAsyncHeaderResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetAzureAsyncHeaderResult", resp, "Failure responding to request") - return - } - - return -} - -// GetAzureAsyncHeaderResultPreparer prepares the GetAzureAsyncHeaderResult request. -func (client OperationsClient) GetAzureAsyncHeaderResultPreparer(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/operationStatuses/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAzureAsyncHeaderResultSender sends the GetAzureAsyncHeaderResult request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) GetAzureAsyncHeaderResultSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAzureAsyncHeaderResultResponder handles the response to the GetAzureAsyncHeaderResult request. The method always -// closes the http.Response Body. -func (client OperationsClient) GetAzureAsyncHeaderResultResponder(resp *http.Response) (result OperationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLocationHeaderResult get the result of an operation -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// operationID - operation ID -func (client OperationsClient) GetLocationHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.GetLocationHeaderResult") - 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("synapse.OperationsClient", "GetLocationHeaderResult", err.Error()) - } - - req, err := client.GetLocationHeaderResultPreparer(ctx, resourceGroupName, workspaceName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetLocationHeaderResult", nil, "Failure preparing request") - return - } - - resp, err := client.GetLocationHeaderResultSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetLocationHeaderResult", resp, "Failure sending request") - return - } - - result, err = client.GetLocationHeaderResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "GetLocationHeaderResult", resp, "Failure responding to request") - return - } - - return -} - -// GetLocationHeaderResultPreparer prepares the GetLocationHeaderResult request. -func (client OperationsClient) GetLocationHeaderResultPreparer(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLocationHeaderResultSender sends the GetLocationHeaderResult request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) GetLocationHeaderResultSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLocationHeaderResultResponder handles the response to the GetLocationHeaderResult request. The method always -// closes the http.Response Body. -func (client OperationsClient) GetLocationHeaderResultResponder(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 -} - -// List get all available operations -func (client OperationsClient) List(ctx context.Context) (result ListAvailableRpOperation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Synapse/operations")) - 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 ListAvailableRpOperation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/privateendpointconnections.go b/services/preview/synapse/mgmt/v1.0/synapse/privateendpointconnections.go deleted file mode 100644 index 32b8ba27c18d..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/privateendpointconnections.go +++ /dev/null @@ -1,430 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsClient is the azure Synapse Analytics Management Client -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create approve or reject a private endpoint connection. -// Parameters: -// request - request body of private endpoint connection to create. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Create(ctx context.Context, request PrivateEndpointConnection, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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("synapse.PrivateEndpointConnectionsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, request, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client PrivateEndpointConnectionsClient) CreatePreparer(ctx context.Context, request PrivateEndpointConnection, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(request), - 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 PrivateEndpointConnectionsClient) CreateSender(req *http.Request) (future PrivateEndpointConnectionsCreateFuture, 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 PrivateEndpointConnectionsClient) CreateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: 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("synapse.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result OperationResource, 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 -} - -// Get gets a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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("synapse.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) 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 -} - -// List lists private endpoint connection in workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.pecl.Response.Response != nil { - sc = result.pecl.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("synapse.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pecl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result.pecl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - if result.pecl.hasNextLink() && result.pecl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) 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 = "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.Synapse/workspaces/{workspaceName}/privateEndpointConnections", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionList, 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 PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionList) (result PrivateEndpointConnectionList, err error) { - req, err := lastResults.privateEndpointConnectionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "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, "synapse.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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/synapse/mgmt/v1.0/synapse/privateendpointconnectionsprivatelinkhub.go b/services/preview/synapse/mgmt/v1.0/synapse/privateendpointconnectionsprivatelinkhub.go deleted file mode 100644 index 65e5b546509e..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/privateendpointconnectionsprivatelinkhub.go +++ /dev/null @@ -1,248 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateEndpointConnectionsPrivateLinkHubClient is the azure Synapse Analytics Management Client -type PrivateEndpointConnectionsPrivateLinkHubClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsPrivateLinkHubClient creates an instance of the -// PrivateEndpointConnectionsPrivateLinkHubClient client. -func NewPrivateEndpointConnectionsPrivateLinkHubClient(subscriptionID string) PrivateEndpointConnectionsPrivateLinkHubClient { - return NewPrivateEndpointConnectionsPrivateLinkHubClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsPrivateLinkHubClientWithBaseURI creates an instance of the -// PrivateEndpointConnectionsPrivateLinkHubClient 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 NewPrivateEndpointConnectionsPrivateLinkHubClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsPrivateLinkHubClient { - return PrivateEndpointConnectionsPrivateLinkHubClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get all PrivateEndpointConnection in the PrivateLinkHub by name -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -// privateEndpointConnectionName - name of the privateEndpointConnection -func (client PrivateEndpointConnectionsPrivateLinkHubClient) Get(ctx context.Context, resourceGroupName string, privateLinkHubName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionForPrivateLinkHub, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsPrivateLinkHubClient.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("synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, privateLinkHubName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsPrivateLinkHubClient) GetPreparer(ctx context.Context, resourceGroupName string, privateLinkHubName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "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.Synapse/privateLinkHubs/{privateLinkHubName}/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 PrivateEndpointConnectionsPrivateLinkHubClient) 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 PrivateEndpointConnectionsPrivateLinkHubClient) GetResponder(resp *http.Response) (result PrivateEndpointConnectionForPrivateLinkHub, 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 PrivateEndpointConnections in the PrivateLinkHub -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateEndpointConnectionsPrivateLinkHubClient) List(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsPrivateLinkHubClient.List") - defer func() { - sc := -1 - if result.pecfplhrcr.Response.Response != nil { - sc = result.pecfplhrcr.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("synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pecfplhrcr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "List", resp, "Failure sending request") - return - } - - result.pecfplhrcr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "List", resp, "Failure responding to request") - return - } - if result.pecfplhrcr.hasNextLink() && result.pecfplhrcr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsPrivateLinkHubClient) ListPreparer(ctx context.Context, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "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.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections", 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 PrivateEndpointConnectionsPrivateLinkHubClient) 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 PrivateEndpointConnectionsPrivateLinkHubClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, 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 PrivateEndpointConnectionsPrivateLinkHubClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse) (result PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, err error) { - req, err := lastResults.privateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "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, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateEndpointConnectionsPrivateLinkHubClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsPrivateLinkHubClient) ListComplete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsPrivateLinkHubClient.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, privateLinkHubName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/privatelinkhubprivatelinkresources.go b/services/preview/synapse/mgmt/v1.0/synapse/privatelinkhubprivatelinkresources.go deleted file mode 100644 index 1aea4f59acdb..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/privatelinkhubprivatelinkresources.go +++ /dev/null @@ -1,248 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkHubPrivateLinkResourcesClient is the azure Synapse Analytics Management Client -type PrivateLinkHubPrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkHubPrivateLinkResourcesClient creates an instance of the PrivateLinkHubPrivateLinkResourcesClient -// client. -func NewPrivateLinkHubPrivateLinkResourcesClient(subscriptionID string) PrivateLinkHubPrivateLinkResourcesClient { - return NewPrivateLinkHubPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkHubPrivateLinkResourcesClientWithBaseURI creates an instance of the -// PrivateLinkHubPrivateLinkResourcesClient 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 NewPrivateLinkHubPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkHubPrivateLinkResourcesClient { - return PrivateLinkHubPrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get private link resource in private link hub -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - the name of the private link hub -// privateLinkResourceName - the name of the private link resource -func (client PrivateLinkHubPrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, privateLinkHubName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubPrivateLinkResourcesClient.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("synapse.PrivateLinkHubPrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, privateLinkHubName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubPrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubPrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubPrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkHubPrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, privateLinkHubName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "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.Synapse/privateLinkHubs/{privateLinkHubName}/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 PrivateLinkHubPrivateLinkResourcesClient) 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 PrivateLinkHubPrivateLinkResourcesClient) 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 -} - -// List get all private link resources for a private link hub -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - the name of the private link hub -func (client PrivateLinkHubPrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubPrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.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("synapse.PrivateLinkHubPrivateLinkResourcesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubPrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubPrivateLinkResourcesClient", "List", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubPrivateLinkResourcesClient", "List", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkHubPrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "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.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources", 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 PrivateLinkHubPrivateLinkResourcesClient) 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 PrivateLinkHubPrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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 PrivateLinkHubPrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateLinkHubPrivateLinkResourcesClient", "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, "synapse.PrivateLinkHubPrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubPrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkHubPrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubPrivateLinkResourcesClient.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, privateLinkHubName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/privatelinkhubs.go b/services/preview/synapse/mgmt/v1.0/synapse/privatelinkhubs.go deleted file mode 100644 index 184c18ee1b56..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/privatelinkhubs.go +++ /dev/null @@ -1,624 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkHubsClient is the azure Synapse Analytics Management Client -type PrivateLinkHubsClient struct { - BaseClient -} - -// NewPrivateLinkHubsClient creates an instance of the PrivateLinkHubsClient client. -func NewPrivateLinkHubsClient(subscriptionID string) PrivateLinkHubsClient { - return NewPrivateLinkHubsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkHubsClientWithBaseURI creates an instance of the PrivateLinkHubsClient 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 NewPrivateLinkHubsClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkHubsClient { - return PrivateLinkHubsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a privateLinkHub -// Parameters: -// privateLinkHubInfo - privateLinkHub create or update request properties -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateLinkHubsClient) CreateOrUpdate(ctx context.Context, privateLinkHubInfo PrivateLinkHub, resourceGroupName string, privateLinkHubName string) (result PrivateLinkHub, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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}}}}); err != nil { - return result, validation.NewError("synapse.PrivateLinkHubsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, privateLinkHubInfo, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateLinkHubsClient) CreateOrUpdatePreparer(ctx context.Context, privateLinkHubInfo PrivateLinkHub, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "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.Synapse/privateLinkHubs/{privateLinkHubName}", pathParameters), - autorest.WithJSON(privateLinkHubInfo), - 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateLinkHub, 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 a privateLinkHub -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateLinkHubsClient) Delete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateLinkHubsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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: 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("synapse.PrivateLinkHubsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateLinkHubsClient) DeletePreparer(ctx context.Context, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "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.Synapse/privateLinkHubs/{privateLinkHubName}", 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 PrivateLinkHubsClient) DeleteSender(req *http.Request) (future PrivateLinkHubsDeleteFuture, 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 PrivateLinkHubsClient) 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 a privateLinkHub -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateLinkHubsClient) Get(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result PrivateLinkHub, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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("synapse.PrivateLinkHubsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkHubsClient) GetPreparer(ctx context.Context, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "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.Synapse/privateLinkHubs/{privateLinkHubName}", 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) GetResponder(resp *http.Response) (result PrivateLinkHub, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns a list of privateLinkHubs in a subscription -func (client PrivateLinkHubsClient) List(ctx context.Context) (result PrivateLinkHubInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.List") - defer func() { - sc := -1 - if result.plhilr.Response.Response != nil { - sc = result.plhilr.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("synapse.PrivateLinkHubsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.plhilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "List", resp, "Failure sending request") - return - } - - result.plhilr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "List", resp, "Failure responding to request") - return - } - if result.plhilr.hasNextLink() && result.plhilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkHubsClient) 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.Synapse/privateLinkHubs", 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) ListResponder(resp *http.Response) (result PrivateLinkHubInfoListResult, 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 PrivateLinkHubsClient) listNextResults(ctx context.Context, lastResults PrivateLinkHubInfoListResult) (result PrivateLinkHubInfoListResult, err error) { - req, err := lastResults.privateLinkHubInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "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, "synapse.PrivateLinkHubsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkHubsClient) ListComplete(ctx context.Context) (result PrivateLinkHubInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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 a list of privateLinkHubs in a resource group -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client PrivateLinkHubsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result PrivateLinkHubInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.plhilr.Response.Response != nil { - sc = result.plhilr.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("synapse.PrivateLinkHubsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.plhilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.plhilr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.plhilr.hasNextLink() && result.plhilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client PrivateLinkHubsClient) 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.Synapse/privateLinkHubs", 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) ListByResourceGroupResponder(resp *http.Response) (result PrivateLinkHubInfoListResult, 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 PrivateLinkHubsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PrivateLinkHubInfoListResult) (result PrivateLinkHubInfoListResult, err error) { - req, err := lastResults.privateLinkHubInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "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, "synapse.PrivateLinkHubsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkHubsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result PrivateLinkHubInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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 -} - -// Update updates a privateLinkHub -// Parameters: -// privateLinkHubPatchInfo - privateLinkHub patch request properties -// resourceGroupName - the name of the resource group. The name is case insensitive. -// privateLinkHubName - name of the privateLinkHub -func (client PrivateLinkHubsClient) Update(ctx context.Context, privateLinkHubPatchInfo PrivateLinkHubPatchInfo, resourceGroupName string, privateLinkHubName string) (result PrivateLinkHub, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkHubsClient.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("synapse.PrivateLinkHubsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, privateLinkHubPatchInfo, resourceGroupName, privateLinkHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkHubsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PrivateLinkHubsClient) UpdatePreparer(ctx context.Context, privateLinkHubPatchInfo PrivateLinkHubPatchInfo, resourceGroupName string, privateLinkHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkHubName": autorest.Encode("path", privateLinkHubName), - "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.Synapse/privateLinkHubs/{privateLinkHubName}", pathParameters), - autorest.WithJSON(privateLinkHubPatchInfo), - 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 PrivateLinkHubsClient) 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 PrivateLinkHubsClient) UpdateResponder(resp *http.Response) (result PrivateLinkHub, 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/synapse/mgmt/v1.0/synapse/privatelinkresources.go b/services/preview/synapse/mgmt/v1.0/synapse/privatelinkresources.go deleted file mode 100644 index 49c8de4f3404..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/privatelinkresources.go +++ /dev/null @@ -1,247 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// PrivateLinkResourcesClient is the azure Synapse Analytics Management Client -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get private link resource in workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// privateLinkResourceName - the name of the private link resource -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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("synapse.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) 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 -} - -// List get all private link resources for a workspaces -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.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("synapse.PrivateLinkResourcesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "List", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkResourcesClient) 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 = "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.Synapse/workspaces/{workspaceName}/privateLinkResources", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourceListResult, 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 PrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "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, "synapse.PrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.PrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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/synapse/mgmt/v1.0/synapse/restorabledroppedsqlpools.go b/services/preview/synapse/mgmt/v1.0/synapse/restorabledroppedsqlpools.go deleted file mode 100644 index 09d0b5fa45bc..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/restorabledroppedsqlpools.go +++ /dev/null @@ -1,206 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// RestorableDroppedSQLPoolsClient is the azure Synapse Analytics Management Client -type RestorableDroppedSQLPoolsClient struct { - BaseClient -} - -// NewRestorableDroppedSQLPoolsClient creates an instance of the RestorableDroppedSQLPoolsClient client. -func NewRestorableDroppedSQLPoolsClient(subscriptionID string) RestorableDroppedSQLPoolsClient { - return NewRestorableDroppedSQLPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableDroppedSQLPoolsClientWithBaseURI creates an instance of the RestorableDroppedSQLPoolsClient 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 NewRestorableDroppedSQLPoolsClientWithBaseURI(baseURI string, subscriptionID string) RestorableDroppedSQLPoolsClient { - return RestorableDroppedSQLPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a deleted sql pool that can be restored -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// restorableDroppedSQLPoolID - the id of the deleted Sql Pool in the form of -// sqlPoolName,deletionTimeInFileTimeFormat -func (client RestorableDroppedSQLPoolsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, restorableDroppedSQLPoolID string) (result RestorableDroppedSQLPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedSQLPoolsClient.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("synapse.RestorableDroppedSQLPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, restorableDroppedSQLPoolID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RestorableDroppedSQLPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, restorableDroppedSQLPoolID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorableDroppedSqlPoolId": autorest.Encode("path", restorableDroppedSQLPoolID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId}", 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 RestorableDroppedSQLPoolsClient) 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 RestorableDroppedSQLPoolsClient) GetResponder(resp *http.Response) (result RestorableDroppedSQLPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace gets a list of deleted Sql pools that can be restored -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client RestorableDroppedSQLPoolsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result RestorableDroppedSQLPoolListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedSQLPoolsClient.ListByWorkspace") - 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("synapse.RestorableDroppedSQLPoolsClient", "ListByWorkspace", err.Error()) - } - - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.RestorableDroppedSQLPoolsClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client RestorableDroppedSQLPoolsClient) ListByWorkspacePreparer(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 = "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.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableDroppedSQLPoolsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client RestorableDroppedSQLPoolsClient) ListByWorkspaceResponder(resp *http.Response) (result RestorableDroppedSQLPoolListResult, 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/synapse/mgmt/v1.0/synapse/sparkconfiguration.go b/services/preview/synapse/mgmt/v1.0/synapse/sparkconfiguration.go deleted file mode 100644 index a4a9c8b94bdb..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sparkconfiguration.go +++ /dev/null @@ -1,120 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SparkConfigurationClient is the azure Synapse Analytics Management Client -type SparkConfigurationClient struct { - BaseClient -} - -// NewSparkConfigurationClient creates an instance of the SparkConfigurationClient client. -func NewSparkConfigurationClient(subscriptionID string) SparkConfigurationClient { - return NewSparkConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSparkConfigurationClientWithBaseURI creates an instance of the SparkConfigurationClient 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 NewSparkConfigurationClientWithBaseURI(baseURI string, subscriptionID string) SparkConfigurationClient { - return SparkConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get SparkConfiguration by name in a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// sparkConfigurationName - sparkConfiguration name -// workspaceName - the name of the workspace -func (client SparkConfigurationClient) Get(ctx context.Context, resourceGroupName string, sparkConfigurationName string, workspaceName string) (result SparkConfigurationResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SparkConfigurationClient.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("synapse.SparkConfigurationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, sparkConfigurationName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SparkConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SparkConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SparkConfigurationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SparkConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, sparkConfigurationName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sparkConfigurationName": autorest.Encode("path", sparkConfigurationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-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.Synapse/workspaces/{workspaceName}/sparkconfigurations/{sparkConfigurationName}", 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 SparkConfigurationClient) 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 SparkConfigurationClient) GetResponder(resp *http.Response) (result SparkConfigurationResource, 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/synapse/mgmt/v1.0/synapse/sparkconfigurations.go b/services/preview/synapse/mgmt/v1.0/synapse/sparkconfigurations.go deleted file mode 100644 index 40b58aaf9071..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sparkconfigurations.go +++ /dev/null @@ -1,160 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SparkConfigurationsClient is the azure Synapse Analytics Management Client -type SparkConfigurationsClient struct { - BaseClient -} - -// NewSparkConfigurationsClient creates an instance of the SparkConfigurationsClient client. -func NewSparkConfigurationsClient(subscriptionID string) SparkConfigurationsClient { - return NewSparkConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSparkConfigurationsClientWithBaseURI creates an instance of the SparkConfigurationsClient 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 NewSparkConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SparkConfigurationsClient { - return SparkConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByWorkspace list sparkConfigurations in a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client SparkConfigurationsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result SparkConfigurationListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SparkConfigurationsClient.ListByWorkspace") - defer func() { - sc := -1 - if result.sclr.Response.Response != nil { - sc = result.sclr.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("synapse.SparkConfigurationsClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SparkConfigurationsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.sclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SparkConfigurationsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.sclr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SparkConfigurationsClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.sclr.hasNextLink() && result.sclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client SparkConfigurationsClient) ListByWorkspacePreparer(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 = "2021-06-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.Synapse/workspaces/{workspaceName}/sparkconfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client SparkConfigurationsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client SparkConfigurationsClient) ListByWorkspaceResponder(resp *http.Response) (result SparkConfigurationListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client SparkConfigurationsClient) listByWorkspaceNextResults(ctx context.Context, lastResults SparkConfigurationListResponse) (result SparkConfigurationListResponse, err error) { - req, err := lastResults.sparkConfigurationListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SparkConfigurationsClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SparkConfigurationsClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SparkConfigurationsClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client SparkConfigurationsClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result SparkConfigurationListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SparkConfigurationsClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolblobauditingpolicies.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolblobauditingpolicies.go deleted file mode 100644 index d9f087de120d..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolblobauditingpolicies.go +++ /dev/null @@ -1,342 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolBlobAuditingPoliciesClient is the azure Synapse Analytics Management Client -type SQLPoolBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewSQLPoolBlobAuditingPoliciesClient creates an instance of the SQLPoolBlobAuditingPoliciesClient client. -func NewSQLPoolBlobAuditingPoliciesClient(subscriptionID string) SQLPoolBlobAuditingPoliciesClient { - return NewSQLPoolBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolBlobAuditingPoliciesClientWithBaseURI creates an instance of the SQLPoolBlobAuditingPoliciesClient 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 NewSQLPoolBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolBlobAuditingPoliciesClient { - return SQLPoolBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a SQL pool's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the database blob auditing policy. -func (client SQLPoolBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolBlobAuditingPolicy) (result SQLPoolBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPoliciesClient.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}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}", 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 SQLPoolBlobAuditingPoliciesClient) 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 SQLPoolBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result SQLPoolBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a SQL pool's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPoliciesClient.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("synapse.SQLPoolBlobAuditingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}", 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 SQLPoolBlobAuditingPoliciesClient) 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 SQLPoolBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result SQLPoolBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySQLPool lists auditing settings of a Sql pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPoliciesClient.ListBySQLPool") - defer func() { - sc := -1 - if result.spbaplr.Response.Response != nil { - sc = result.spbaplr.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("synapse.SQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", err.Error()) - } - - result.fn = client.listBySQLPoolNextResults - req, err := client.ListBySQLPoolPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.spbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", resp, "Failure sending request") - return - } - - result.spbaplr, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "ListBySQLPool", resp, "Failure responding to request") - return - } - if result.spbaplr.hasNextLink() && result.spbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySQLPoolPreparer prepares the ListBySQLPool request. -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPoolPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySQLPoolSender sends the ListBySQLPool request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySQLPoolResponder handles the response to the ListBySQLPool request. The method always -// closes the http.Response Body. -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPoolResponder(resp *http.Response) (result SQLPoolBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySQLPoolNextResults retrieves the next set of results, if any. -func (client SQLPoolBlobAuditingPoliciesClient) listBySQLPoolNextResults(ctx context.Context, lastResults SQLPoolBlobAuditingPolicyListResult) (result SQLPoolBlobAuditingPolicyListResult, err error) { - req, err := lastResults.sQLPoolBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySQLPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySQLPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolBlobAuditingPoliciesClient", "listBySQLPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySQLPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolBlobAuditingPoliciesClient) ListBySQLPoolComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolBlobAuditingPoliciesClient.ListBySQLPool") - 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.ListBySQLPool(ctx, resourceGroupName, workspaceName, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolcolumns.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolcolumns.go deleted file mode 100644 index 73c8911a48ed..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolcolumns.go +++ /dev/null @@ -1,125 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolColumnsClient is the azure Synapse Analytics Management Client -type SQLPoolColumnsClient struct { - BaseClient -} - -// NewSQLPoolColumnsClient creates an instance of the SQLPoolColumnsClient client. -func NewSQLPoolColumnsClient(subscriptionID string) SQLPoolColumnsClient { - return NewSQLPoolColumnsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolColumnsClientWithBaseURI creates an instance of the SQLPoolColumnsClient 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 NewSQLPoolColumnsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolColumnsClient { - return SQLPoolColumnsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get Sql pool column -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SQLPoolColumnsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result SQLPoolColumn, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolColumnsClient.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("synapse.SQLPoolColumnsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolColumnsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolColumnsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolColumnsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolColumnsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}", 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 SQLPoolColumnsClient) 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 SQLPoolColumnsClient) GetResponder(resp *http.Response) (result SQLPoolColumn, 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/synapse/mgmt/v1.0/synapse/sqlpoolconnectionpolicies.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolconnectionpolicies.go deleted file mode 100644 index 168806efe5e6..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolconnectionpolicies.go +++ /dev/null @@ -1,121 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolConnectionPoliciesClient is the azure Synapse Analytics Management Client -type SQLPoolConnectionPoliciesClient struct { - BaseClient -} - -// NewSQLPoolConnectionPoliciesClient creates an instance of the SQLPoolConnectionPoliciesClient client. -func NewSQLPoolConnectionPoliciesClient(subscriptionID string) SQLPoolConnectionPoliciesClient { - return NewSQLPoolConnectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolConnectionPoliciesClientWithBaseURI creates an instance of the SQLPoolConnectionPoliciesClient 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 NewSQLPoolConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolConnectionPoliciesClient { - return SQLPoolConnectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a Sql pool's connection policy, which is used with table auditing. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolConnectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolConnectionPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolConnectionPoliciesClient.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("synapse.SQLPoolConnectionPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolConnectionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolConnectionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolConnectionPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolConnectionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectionPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName}", 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 SQLPoolConnectionPoliciesClient) 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 SQLPoolConnectionPoliciesClient) GetResponder(resp *http.Response) (result SQLPoolConnectionPolicy, 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/synapse/mgmt/v1.0/synapse/sqlpooldatawarehouseuseractivities.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpooldatawarehouseuseractivities.go deleted file mode 100644 index 053d7de73f65..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooldatawarehouseuseractivities.go +++ /dev/null @@ -1,122 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolDataWarehouseUserActivitiesClient is the azure Synapse Analytics Management Client -type SQLPoolDataWarehouseUserActivitiesClient struct { - BaseClient -} - -// NewSQLPoolDataWarehouseUserActivitiesClient creates an instance of the SQLPoolDataWarehouseUserActivitiesClient -// client. -func NewSQLPoolDataWarehouseUserActivitiesClient(subscriptionID string) SQLPoolDataWarehouseUserActivitiesClient { - return NewSQLPoolDataWarehouseUserActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolDataWarehouseUserActivitiesClientWithBaseURI creates an instance of the -// SQLPoolDataWarehouseUserActivitiesClient 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 NewSQLPoolDataWarehouseUserActivitiesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolDataWarehouseUserActivitiesClient { - return SQLPoolDataWarehouseUserActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the user activities of a SQL pool which includes running and suspended queries -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolDataWarehouseUserActivitiesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result DataWarehouseUserActivities, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolDataWarehouseUserActivitiesClient.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("synapse.SQLPoolDataWarehouseUserActivitiesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolDataWarehouseUserActivitiesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolDataWarehouseUserActivitiesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolDataWarehouseUserActivitiesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolDataWarehouseUserActivitiesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataWarehouseUserActivityName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}", 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 SQLPoolDataWarehouseUserActivitiesClient) 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 SQLPoolDataWarehouseUserActivitiesClient) GetResponder(resp *http.Response) (result DataWarehouseUserActivities, 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/synapse/mgmt/v1.0/synapse/sqlpoolgeobackuppolicies.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolgeobackuppolicies.go deleted file mode 100644 index 4248110ed538..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolgeobackuppolicies.go +++ /dev/null @@ -1,303 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolGeoBackupPoliciesClient is the azure Synapse Analytics Management Client -type SQLPoolGeoBackupPoliciesClient struct { - BaseClient -} - -// NewSQLPoolGeoBackupPoliciesClient creates an instance of the SQLPoolGeoBackupPoliciesClient client. -func NewSQLPoolGeoBackupPoliciesClient(subscriptionID string) SQLPoolGeoBackupPoliciesClient { - return NewSQLPoolGeoBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolGeoBackupPoliciesClientWithBaseURI creates an instance of the SQLPoolGeoBackupPoliciesClient 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 NewSQLPoolGeoBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolGeoBackupPoliciesClient { - return SQLPoolGeoBackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates a SQL Pool geo backup policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the required parameters for creating or updating the geo backup policy. -func (client SQLPoolGeoBackupPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters GeoBackupPolicy) (result GeoBackupPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolGeoBackupPoliciesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GeoBackupPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolGeoBackupPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolGeoBackupPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters GeoBackupPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "geoBackupPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}", 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 SQLPoolGeoBackupPoliciesClient) 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 SQLPoolGeoBackupPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result GeoBackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the specified SQL pool geo backup policy -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolGeoBackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result GeoBackupPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolGeoBackupPoliciesClient.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("synapse.SQLPoolGeoBackupPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolGeoBackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "geoBackupPolicyName": autorest.Encode("path", "Default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}", 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 SQLPoolGeoBackupPoliciesClient) 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 SQLPoolGeoBackupPoliciesClient) GetResponder(resp *http.Response) (result GeoBackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of SQL pool geo backup policies -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolGeoBackupPoliciesClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result GeoBackupPolicyListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolGeoBackupPoliciesClient.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("synapse.SQLPoolGeoBackupPoliciesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolGeoBackupPoliciesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolGeoBackupPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies", 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 SQLPoolGeoBackupPoliciesClient) 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 SQLPoolGeoBackupPoliciesClient) ListResponder(resp *http.Response) (result GeoBackupPolicyListResult, 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/synapse/mgmt/v1.0/synapse/sqlpoolmaintenancewindowoptions.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolmaintenancewindowoptions.go deleted file mode 100644 index b5057b5e2e4c..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolmaintenancewindowoptions.go +++ /dev/null @@ -1,122 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolMaintenanceWindowOptionsClient is the azure Synapse Analytics Management Client -type SQLPoolMaintenanceWindowOptionsClient struct { - BaseClient -} - -// NewSQLPoolMaintenanceWindowOptionsClient creates an instance of the SQLPoolMaintenanceWindowOptionsClient client. -func NewSQLPoolMaintenanceWindowOptionsClient(subscriptionID string) SQLPoolMaintenanceWindowOptionsClient { - return NewSQLPoolMaintenanceWindowOptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolMaintenanceWindowOptionsClientWithBaseURI creates an instance of the SQLPoolMaintenanceWindowOptionsClient -// 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 NewSQLPoolMaintenanceWindowOptionsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolMaintenanceWindowOptionsClient { - return SQLPoolMaintenanceWindowOptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get list of SQL pool's available maintenance windows. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// maintenanceWindowOptionsName - maintenance window options name. -func (client SQLPoolMaintenanceWindowOptionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, maintenanceWindowOptionsName string) (result MaintenanceWindowOptions, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolMaintenanceWindowOptionsClient.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("synapse.SQLPoolMaintenanceWindowOptionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, maintenanceWindowOptionsName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMaintenanceWindowOptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMaintenanceWindowOptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMaintenanceWindowOptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolMaintenanceWindowOptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, maintenanceWindowOptionsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "maintenanceWindowOptionsName": autorest.Encode("query", maintenanceWindowOptionsName), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenanceWindowOptions/current", 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 SQLPoolMaintenanceWindowOptionsClient) 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 SQLPoolMaintenanceWindowOptionsClient) GetResponder(resp *http.Response) (result MaintenanceWindowOptions, 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/synapse/mgmt/v1.0/synapse/sqlpoolmaintenancewindows.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolmaintenancewindows.go deleted file mode 100644 index b9f29eec1c2d..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolmaintenancewindows.go +++ /dev/null @@ -1,213 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolMaintenanceWindowsClient is the azure Synapse Analytics Management Client -type SQLPoolMaintenanceWindowsClient struct { - BaseClient -} - -// NewSQLPoolMaintenanceWindowsClient creates an instance of the SQLPoolMaintenanceWindowsClient client. -func NewSQLPoolMaintenanceWindowsClient(subscriptionID string) SQLPoolMaintenanceWindowsClient { - return NewSQLPoolMaintenanceWindowsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolMaintenanceWindowsClientWithBaseURI creates an instance of the SQLPoolMaintenanceWindowsClient 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 NewSQLPoolMaintenanceWindowsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolMaintenanceWindowsClient { - return SQLPoolMaintenanceWindowsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Sql pool's maintenance windows settings. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// maintenanceWindowName - maintenance window name. -// parameters - the required parameters for creating or updating Maintenance Windows settings -func (client SQLPoolMaintenanceWindowsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, maintenanceWindowName string, parameters MaintenanceWindows) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolMaintenanceWindowsClient.CreateOrUpdate") - 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("synapse.SQLPoolMaintenanceWindowsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, maintenanceWindowName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMaintenanceWindowsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMaintenanceWindowsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMaintenanceWindowsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolMaintenanceWindowsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, maintenanceWindowName string, parameters MaintenanceWindows) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "maintenanceWindowName": autorest.Encode("query", maintenanceWindowName), - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenancewindows/current", 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 SQLPoolMaintenanceWindowsClient) 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 SQLPoolMaintenanceWindowsClient) CreateOrUpdateResponder(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 SQL pool's Maintenance Windows. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// maintenanceWindowName - maintenance window name. -func (client SQLPoolMaintenanceWindowsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, maintenanceWindowName string) (result MaintenanceWindows, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolMaintenanceWindowsClient.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("synapse.SQLPoolMaintenanceWindowsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, maintenanceWindowName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMaintenanceWindowsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMaintenanceWindowsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMaintenanceWindowsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolMaintenanceWindowsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, maintenanceWindowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "maintenanceWindowName": autorest.Encode("query", maintenanceWindowName), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenancewindows/current", 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 SQLPoolMaintenanceWindowsClient) 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 SQLPoolMaintenanceWindowsClient) GetResponder(resp *http.Response) (result MaintenanceWindows, 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/synapse/mgmt/v1.0/synapse/sqlpoolmetadatasyncconfigs.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolmetadatasyncconfigs.go deleted file mode 100644 index 36300008e69a..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolmetadatasyncconfigs.go +++ /dev/null @@ -1,210 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolMetadataSyncConfigsClient is the azure Synapse Analytics Management Client -type SQLPoolMetadataSyncConfigsClient struct { - BaseClient -} - -// NewSQLPoolMetadataSyncConfigsClient creates an instance of the SQLPoolMetadataSyncConfigsClient client. -func NewSQLPoolMetadataSyncConfigsClient(subscriptionID string) SQLPoolMetadataSyncConfigsClient { - return NewSQLPoolMetadataSyncConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolMetadataSyncConfigsClientWithBaseURI creates an instance of the SQLPoolMetadataSyncConfigsClient 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 NewSQLPoolMetadataSyncConfigsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolMetadataSyncConfigsClient { - return SQLPoolMetadataSyncConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create set the metadata sync configuration for a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// metadataSyncConfiguration - metadata sync configuration -func (client SQLPoolMetadataSyncConfigsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, metadataSyncConfiguration MetadataSyncConfig) (result MetadataSyncConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolMetadataSyncConfigsClient.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}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolMetadataSyncConfigsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, metadataSyncConfiguration) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SQLPoolMetadataSyncConfigsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, metadataSyncConfiguration MetadataSyncConfig) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config", pathParameters), - autorest.WithJSON(metadataSyncConfiguration), - 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 SQLPoolMetadataSyncConfigsClient) 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 SQLPoolMetadataSyncConfigsClient) CreateResponder(resp *http.Response) (result MetadataSyncConfig, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the metadata sync configuration for a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolMetadataSyncConfigsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result MetadataSyncConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolMetadataSyncConfigsClient.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("synapse.SQLPoolMetadataSyncConfigsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolMetadataSyncConfigsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolMetadataSyncConfigsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config", 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 SQLPoolMetadataSyncConfigsClient) 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 SQLPoolMetadataSyncConfigsClient) GetResponder(resp *http.Response) (result MetadataSyncConfig, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooloperationresults.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpooloperationresults.go deleted file mode 100644 index 157d4997d006..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooloperationresults.go +++ /dev/null @@ -1,122 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolOperationResultsClient is the azure Synapse Analytics Management Client -type SQLPoolOperationResultsClient struct { - BaseClient -} - -// NewSQLPoolOperationResultsClient creates an instance of the SQLPoolOperationResultsClient client. -func NewSQLPoolOperationResultsClient(subscriptionID string) SQLPoolOperationResultsClient { - return NewSQLPoolOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolOperationResultsClientWithBaseURI creates an instance of the SQLPoolOperationResultsClient 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 NewSQLPoolOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolOperationResultsClient { - return SQLPoolOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetLocationHeaderResult get the status of a SQL pool operation -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// operationID - operation ID -func (client SQLPoolOperationResultsClient) GetLocationHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, operationID string) (result SetObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolOperationResultsClient.GetLocationHeaderResult") - 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("synapse.SQLPoolOperationResultsClient", "GetLocationHeaderResult", err.Error()) - } - - req, err := client.GetLocationHeaderResultPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationResultsClient", "GetLocationHeaderResult", nil, "Failure preparing request") - return - } - - resp, err := client.GetLocationHeaderResultSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationResultsClient", "GetLocationHeaderResult", resp, "Failure sending request") - return - } - - result, err = client.GetLocationHeaderResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationResultsClient", "GetLocationHeaderResult", resp, "Failure responding to request") - return - } - - return -} - -// GetLocationHeaderResultPreparer prepares the GetLocationHeaderResult request. -func (client SQLPoolOperationResultsClient) GetLocationHeaderResultPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetLocationHeaderResultSender sends the GetLocationHeaderResult request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolOperationResultsClient) GetLocationHeaderResultSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetLocationHeaderResultResponder handles the response to the GetLocationHeaderResult request. The method always -// closes the http.Response Body. -func (client SQLPoolOperationResultsClient) GetLocationHeaderResultResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooloperations.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpooloperations.go deleted file mode 100644 index 92585e4264cc..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooloperations.go +++ /dev/null @@ -1,162 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolOperationsClient is the azure Synapse Analytics Management Client -type SQLPoolOperationsClient struct { - BaseClient -} - -// NewSQLPoolOperationsClient creates an instance of the SQLPoolOperationsClient client. -func NewSQLPoolOperationsClient(subscriptionID string) SQLPoolOperationsClient { - return NewSQLPoolOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolOperationsClientWithBaseURI creates an instance of the SQLPoolOperationsClient 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 NewSQLPoolOperationsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolOperationsClient { - return SQLPoolOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets a list of operations performed on the SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolOperationsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolOperationsClient.List") - defer func() { - sc := -1 - if result.spbapspolr.Response.Response != nil { - sc = result.spbapspolr.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("synapse.SQLPoolOperationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.spbapspolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "List", resp, "Failure sending request") - return - } - - result.spbapspolr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.spbapspolr.hasNextLink() && result.spbapspolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolOperationsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operations", 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 SQLPoolOperationsClient) 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 SQLPoolOperationsClient) ListResponder(resp *http.Response) (result SQLPoolBlobAuditingPolicySQLPoolOperationListResult, 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 SQLPoolOperationsClient) listNextResults(ctx context.Context, lastResults SQLPoolBlobAuditingPolicySQLPoolOperationListResult) (result SQLPoolBlobAuditingPolicySQLPoolOperationListResult, err error) { - req, err := lastResults.sQLPoolBlobAuditingPolicySQLPoolOperationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "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, "synapse.SQLPoolOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolOperationsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolOperationsClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolrecommendedsensitivitylabels.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolrecommendedsensitivitylabels.go deleted file mode 100644 index fc676e8a71e0..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolrecommendedsensitivitylabels.go +++ /dev/null @@ -1,122 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolRecommendedSensitivityLabelsClient is the azure Synapse Analytics Management Client -type SQLPoolRecommendedSensitivityLabelsClient struct { - BaseClient -} - -// NewSQLPoolRecommendedSensitivityLabelsClient creates an instance of the SQLPoolRecommendedSensitivityLabelsClient -// client. -func NewSQLPoolRecommendedSensitivityLabelsClient(subscriptionID string) SQLPoolRecommendedSensitivityLabelsClient { - return NewSQLPoolRecommendedSensitivityLabelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolRecommendedSensitivityLabelsClientWithBaseURI creates an instance of the -// SQLPoolRecommendedSensitivityLabelsClient 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 NewSQLPoolRecommendedSensitivityLabelsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolRecommendedSensitivityLabelsClient { - return SQLPoolRecommendedSensitivityLabelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Update update recommended sensitivity labels states of a given SQL Pool using an operations batch. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolRecommendedSensitivityLabelsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters RecommendedSensitivityLabelUpdateList) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRecommendedSensitivityLabelsClient.Update") - 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("synapse.SQLPoolRecommendedSensitivityLabelsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRecommendedSensitivityLabelsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRecommendedSensitivityLabelsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRecommendedSensitivityLabelsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SQLPoolRecommendedSensitivityLabelsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters RecommendedSensitivityLabelUpdateList) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels", 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 SQLPoolRecommendedSensitivityLabelsClient) 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 SQLPoolRecommendedSensitivityLabelsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolreplicationlinks.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolreplicationlinks.go deleted file mode 100644 index 1d745eb96f68..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolreplicationlinks.go +++ /dev/null @@ -1,251 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolReplicationLinksClient is the azure Synapse Analytics Management Client -type SQLPoolReplicationLinksClient struct { - BaseClient -} - -// NewSQLPoolReplicationLinksClient creates an instance of the SQLPoolReplicationLinksClient client. -func NewSQLPoolReplicationLinksClient(subscriptionID string) SQLPoolReplicationLinksClient { - return NewSQLPoolReplicationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolReplicationLinksClientWithBaseURI creates an instance of the SQLPoolReplicationLinksClient 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 NewSQLPoolReplicationLinksClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolReplicationLinksClient { - return SQLPoolReplicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByName get SQL pool replication link by name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// linkID - the ID of the replication link. -func (client SQLPoolReplicationLinksClient) GetByName(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, linkID string) (result ReplicationLink, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolReplicationLinksClient.GetByName") - 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("synapse.SQLPoolReplicationLinksClient", "GetByName", err.Error()) - } - - req, err := client.GetByNamePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "GetByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "GetByName", resp, "Failure sending request") - return - } - - result, err = client.GetByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "GetByName", resp, "Failure responding to request") - return - } - - return -} - -// GetByNamePreparer prepares the GetByName request. -func (client SQLPoolReplicationLinksClient) GetByNamePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks/{linkId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByNameSender sends the GetByName request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolReplicationLinksClient) GetByNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByNameResponder handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (client SQLPoolReplicationLinksClient) GetByNameResponder(resp *http.Response) (result ReplicationLink, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists a Sql pool's replication links. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolReplicationLinksClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ReplicationLinkListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolReplicationLinksClient.List") - defer func() { - sc := -1 - if result.rllr.Response.Response != nil { - sc = result.rllr.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("synapse.SQLPoolReplicationLinksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "List", resp, "Failure sending request") - return - } - - result.rllr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "List", resp, "Failure responding to request") - return - } - if result.rllr.hasNextLink() && result.rllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolReplicationLinksClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks", 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 SQLPoolReplicationLinksClient) 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 SQLPoolReplicationLinksClient) ListResponder(resp *http.Response) (result ReplicationLinkListResult, 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 SQLPoolReplicationLinksClient) listNextResults(ctx context.Context, lastResults ReplicationLinkListResult) (result ReplicationLinkListResult, err error) { - req, err := lastResults.replicationLinkListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "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, "synapse.SQLPoolReplicationLinksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolReplicationLinksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolReplicationLinksClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ReplicationLinkListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolReplicationLinksClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolrestorepoints.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolrestorepoints.go deleted file mode 100644 index ba0eba0a0255..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolrestorepoints.go +++ /dev/null @@ -1,434 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolRestorePointsClient is the azure Synapse Analytics Management Client -type SQLPoolRestorePointsClient struct { - BaseClient -} - -// NewSQLPoolRestorePointsClient creates an instance of the SQLPoolRestorePointsClient client. -func NewSQLPoolRestorePointsClient(subscriptionID string) SQLPoolRestorePointsClient { - return NewSQLPoolRestorePointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolRestorePointsClientWithBaseURI creates an instance of the SQLPoolRestorePointsClient 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 NewSQLPoolRestorePointsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolRestorePointsClient { - return SQLPoolRestorePointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a restore point for a data warehouse. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the definition for creating the restore point of this Sql pool. -func (client SQLPoolRestorePointsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters CreateSQLPoolRestorePointDefinition) (result SQLPoolRestorePointsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.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: 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RestorePointLabel", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolRestorePointsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SQLPoolRestorePointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters CreateSQLPoolRestorePointDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints", 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 SQLPoolRestorePointsClient) CreateSender(req *http.Request) (future SQLPoolRestorePointsCreateFuture, 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 SQLPoolRestorePointsClient) CreateResponder(resp *http.Response) (result RestorePoint, 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 a restore point. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// restorePointName - the name of the restore point. -func (client SQLPoolRestorePointsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.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("synapse.SQLPoolRestorePointsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, restorePointName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolRestorePointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorePointName": autorest.Encode("path", restorePointName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}", 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 SQLPoolRestorePointsClient) 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 SQLPoolRestorePointsClient) 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 restore point. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// restorePointName - the name of the restore point. -func (client SQLPoolRestorePointsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (result RestorePoint, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.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("synapse.SQLPoolRestorePointsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, restorePointName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolRestorePointsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restorePointName": autorest.Encode("path", restorePointName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}", 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 SQLPoolRestorePointsClient) 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 SQLPoolRestorePointsClient) GetResponder(resp *http.Response) (result RestorePoint, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get SQL pool backup information -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolRestorePointsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result RestorePointListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.List") - defer func() { - sc := -1 - if result.rplr.Response.Response != nil { - sc = result.rplr.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("synapse.SQLPoolRestorePointsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "List", resp, "Failure sending request") - return - } - - result.rplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "List", resp, "Failure responding to request") - return - } - if result.rplr.hasNextLink() && result.rplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolRestorePointsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints", 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 SQLPoolRestorePointsClient) 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 SQLPoolRestorePointsClient) ListResponder(resp *http.Response) (result RestorePointListResult, 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 SQLPoolRestorePointsClient) listNextResults(ctx context.Context, lastResults RestorePointListResult) (result RestorePointListResult, err error) { - req, err := lastResults.restorePointListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "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, "synapse.SQLPoolRestorePointsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolRestorePointsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolRestorePointsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result RestorePointListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolRestorePointsClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpools.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpools.go deleted file mode 100644 index 8527d1b07ec6..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpools.go +++ /dev/null @@ -1,790 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolsClient is the azure Synapse Analytics Management Client -type SQLPoolsClient struct { - BaseClient -} - -// NewSQLPoolsClient creates an instance of the SQLPoolsClient client. -func NewSQLPoolsClient(subscriptionID string) SQLPoolsClient { - return NewSQLPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolsClientWithBaseURI creates an instance of the SQLPoolsClient 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 NewSQLPoolsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolsClient { - return SQLPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// SQLPoolInfo - the SQL pool to create -func (client SQLPoolsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo SQLPool) (result SQLPoolsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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: 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("synapse.SQLPoolsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, SQLPoolInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SQLPoolsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo SQLPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}", pathParameters), - autorest.WithJSON(SQLPoolInfo), - 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 SQLPoolsClient) CreateSender(req *http.Request) (future SQLPoolsCreateFuture, 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 SQLPoolsClient) CreateResponder(resp *http.Response) (result SQLPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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: 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("synapse.SQLPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}", 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 SQLPoolsClient) DeleteSender(req *http.Request) (future SQLPoolsDeleteFuture, 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 SQLPoolsClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get SQL pool properties -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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("synapse.SQLPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}", 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 SQLPoolsClient) 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 SQLPoolsClient) GetResponder(resp *http.Response) (result SQLPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list all SQL pools -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client SQLPoolsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result SQLPoolInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.ListByWorkspace") - defer func() { - sc := -1 - if result.spilr.Response.Response != nil { - sc = result.spilr.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("synapse.SQLPoolsClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.spilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.spilr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.spilr.hasNextLink() && result.spilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client SQLPoolsClient) ListByWorkspacePreparer(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 = "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.Synapse/workspaces/{workspaceName}/sqlPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client SQLPoolsClient) ListByWorkspaceResponder(resp *http.Response) (result SQLPoolInfoListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client SQLPoolsClient) listByWorkspaceNextResults(ctx context.Context, lastResults SQLPoolInfoListResult) (result SQLPoolInfoListResult, err error) { - req, err := lastResults.sQLPoolInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolsClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result SQLPoolInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// Pause pause a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolsClient) Pause(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolsPauseFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.Pause") - 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: 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("synapse.SQLPoolsClient", "Pause", err.Error()) - } - - req, err := client.PausePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Pause", nil, "Failure preparing request") - return - } - - result, err = client.PauseSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Pause", result.Response(), "Failure sending request") - return - } - - return -} - -// PausePreparer prepares the Pause request. -func (client SQLPoolsClient) PausePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PauseSender sends the Pause request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolsClient) PauseSender(req *http.Request) (future SQLPoolsPauseFuture, 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 -} - -// PauseResponder handles the response to the Pause request. The method always -// closes the http.Response Body. -func (client SQLPoolsClient) PauseResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Rename rename a SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the resource move definition for renaming this Sql pool. -func (client SQLPoolsClient) Rename(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters ResourceMoveDefinition) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.Rename") - 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolsClient", "Rename", err.Error()) - } - - req, err := client.RenamePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Rename", nil, "Failure preparing request") - return - } - - resp, err := client.RenameSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Rename", resp, "Failure sending request") - return - } - - result, err = client.RenameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Rename", resp, "Failure responding to request") - return - } - - return -} - -// RenamePreparer prepares the Rename request. -func (client SQLPoolsClient) RenamePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters ResourceMoveDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/move", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RenameSender sends the Rename request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolsClient) RenameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RenameResponder handles the response to the Rename request. The method always -// closes the http.Response Body. -func (client SQLPoolsClient) RenameResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Resume resume a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolsClient) Resume(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolsResumeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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: 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("synapse.SQLPoolsClient", "Resume", err.Error()) - } - - req, err := client.ResumePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Resume", nil, "Failure preparing request") - return - } - - result, err = client.ResumeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Resume", result.Response(), "Failure sending request") - return - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client SQLPoolsClient) ResumePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/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 SQLPoolsClient) ResumeSender(req *http.Request) (future SQLPoolsResumeFuture, 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 SQLPoolsClient) ResumeResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update apply a partial update to a SQL pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// SQLPoolInfo - the updated SQL pool properties -func (client SQLPoolsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo SQLPoolPatchInfo) (result SQLPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolsClient.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("synapse.SQLPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, SQLPoolInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SQLPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo SQLPoolPatchInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}", pathParameters), - autorest.WithJSON(SQLPoolInfo), - 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 SQLPoolsClient) 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 SQLPoolsClient) UpdateResponder(resp *http.Response) (result SQLPool, 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/preview/synapse/mgmt/v1.0/synapse/sqlpoolschemas.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolschemas.go deleted file mode 100644 index 8622c151d377..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolschemas.go +++ /dev/null @@ -1,254 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolSchemasClient is the azure Synapse Analytics Management Client -type SQLPoolSchemasClient struct { - BaseClient -} - -// NewSQLPoolSchemasClient creates an instance of the SQLPoolSchemasClient client. -func NewSQLPoolSchemasClient(subscriptionID string) SQLPoolSchemasClient { - return NewSQLPoolSchemasClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolSchemasClientWithBaseURI creates an instance of the SQLPoolSchemasClient 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 NewSQLPoolSchemasClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolSchemasClient { - return SQLPoolSchemasClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get Sql Pool schema -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -func (client SQLPoolSchemasClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string) (result SQLPoolSchema, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemasClient.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("synapse.SQLPoolSchemasClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolSchemasClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}", 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 SQLPoolSchemasClient) 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 SQLPoolSchemasClient) GetResponder(resp *http.Response) (result SQLPoolSchema, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets schemas of a given SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolSchemasClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result SQLPoolSchemaListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemasClient.List") - defer func() { - sc := -1 - if result.spslr.Response.Response != nil { - sc = result.spslr.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("synapse.SQLPoolSchemasClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.spslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "List", resp, "Failure sending request") - return - } - - result.spslr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "List", resp, "Failure responding to request") - return - } - if result.spslr.hasNextLink() && result.spslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolSchemasClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas", 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 SQLPoolSchemasClient) 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 SQLPoolSchemasClient) ListResponder(resp *http.Response) (result SQLPoolSchemaListResult, 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 SQLPoolSchemasClient) listNextResults(ctx context.Context, lastResults SQLPoolSchemaListResult) (result SQLPoolSchemaListResult, err error) { - req, err := lastResults.sQLPoolSchemaListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "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, "synapse.SQLPoolSchemasClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSchemasClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolSchemasClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result SQLPoolSchemaListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSchemasClient.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, SQLPoolName, filter) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolsecurityalertpolicies.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolsecurityalertpolicies.go deleted file mode 100644 index a1cf24e998cf..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolsecurityalertpolicies.go +++ /dev/null @@ -1,341 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolSecurityAlertPoliciesClient is the azure Synapse Analytics Management Client -type SQLPoolSecurityAlertPoliciesClient struct { - BaseClient -} - -// NewSQLPoolSecurityAlertPoliciesClient creates an instance of the SQLPoolSecurityAlertPoliciesClient client. -func NewSQLPoolSecurityAlertPoliciesClient(subscriptionID string) SQLPoolSecurityAlertPoliciesClient { - return NewSQLPoolSecurityAlertPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolSecurityAlertPoliciesClientWithBaseURI creates an instance of the SQLPoolSecurityAlertPoliciesClient -// 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 NewSQLPoolSecurityAlertPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolSecurityAlertPoliciesClient { - return SQLPoolSecurityAlertPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Sql pool's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the Sql pool security alert policy. -func (client SQLPoolSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolSecurityAlertPolicy) (result SQLPoolSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSecurityAlertPoliciesClient.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}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSecurityAlertPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}", 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 SQLPoolSecurityAlertPoliciesClient) 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 SQLPoolSecurityAlertPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result SQLPoolSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a Sql pool's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSecurityAlertPoliciesClient.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("synapse.SQLPoolSecurityAlertPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolSecurityAlertPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}", 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 SQLPoolSecurityAlertPoliciesClient) 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 SQLPoolSecurityAlertPoliciesClient) GetResponder(resp *http.Response) (result SQLPoolSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get a list of Sql pool's security alert policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolSecurityAlertPoliciesClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ListSQLPoolSecurityAlertPoliciesPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSecurityAlertPoliciesClient.List") - defer func() { - sc := -1 - if result.lspsap.Response.Response != nil { - sc = result.lspsap.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("synapse.SQLPoolSecurityAlertPoliciesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lspsap.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "List", resp, "Failure sending request") - return - } - - result.lspsap, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "List", resp, "Failure responding to request") - return - } - if result.lspsap.hasNextLink() && result.lspsap.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolSecurityAlertPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies", 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 SQLPoolSecurityAlertPoliciesClient) 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 SQLPoolSecurityAlertPoliciesClient) ListResponder(resp *http.Response) (result ListSQLPoolSecurityAlertPolicies, 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 SQLPoolSecurityAlertPoliciesClient) listNextResults(ctx context.Context, lastResults ListSQLPoolSecurityAlertPolicies) (result ListSQLPoolSecurityAlertPolicies, err error) { - req, err := lastResults.listSQLPoolSecurityAlertPoliciesPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "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, "synapse.SQLPoolSecurityAlertPoliciesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSecurityAlertPoliciesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolSecurityAlertPoliciesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result ListSQLPoolSecurityAlertPoliciesIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSecurityAlertPoliciesClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolsensitivitylabels.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolsensitivitylabels.go deleted file mode 100644 index 5e406b0ef75e..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolsensitivitylabels.go +++ /dev/null @@ -1,868 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolSensitivityLabelsClient is the azure Synapse Analytics Management Client -type SQLPoolSensitivityLabelsClient struct { - BaseClient -} - -// NewSQLPoolSensitivityLabelsClient creates an instance of the SQLPoolSensitivityLabelsClient client. -func NewSQLPoolSensitivityLabelsClient(subscriptionID string) SQLPoolSensitivityLabelsClient { - return NewSQLPoolSensitivityLabelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolSensitivityLabelsClientWithBaseURI creates an instance of the SQLPoolSensitivityLabelsClient 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 NewSQLPoolSensitivityLabelsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolSensitivityLabelsClient { - return SQLPoolSensitivityLabelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the sensitivity label of a given column in a Sql pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// parameters - the column sensitivity label resource. -func (client SQLPoolSensitivityLabelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (result SensitivityLabel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.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}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolSensitivityLabelsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolSensitivityLabelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ManagedBy = 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SQLPoolSensitivityLabelsClient) 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 SQLPoolSensitivityLabelsClient) CreateOrUpdateResponder(resp *http.Response) (result SensitivityLabel, 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 sensitivity label of a given column in a Sql pool -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SQLPoolSensitivityLabelsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.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("synapse.SQLPoolSensitivityLabelsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolSensitivityLabelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "current"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SQLPoolSensitivityLabelsClient) 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 SQLPoolSensitivityLabelsClient) 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 -} - -// DisableRecommendation disables sensitivity recommendations on a given column -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SQLPoolSensitivityLabelsClient) DisableRecommendation(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.DisableRecommendation") - 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("synapse.SQLPoolSensitivityLabelsClient", "DisableRecommendation", err.Error()) - } - - req, err := client.DisableRecommendationPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "DisableRecommendation", nil, "Failure preparing request") - return - } - - resp, err := client.DisableRecommendationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "DisableRecommendation", resp, "Failure sending request") - return - } - - result, err = client.DisableRecommendationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "DisableRecommendation", resp, "Failure responding to request") - return - } - - return -} - -// DisableRecommendationPreparer prepares the DisableRecommendation request. -func (client SQLPoolSensitivityLabelsClient) DisableRecommendationPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "recommended"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableRecommendationSender sends the DisableRecommendation request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolSensitivityLabelsClient) DisableRecommendationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisableRecommendationResponder handles the response to the DisableRecommendation request. The method always -// closes the http.Response Body. -func (client SQLPoolSensitivityLabelsClient) DisableRecommendationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// EnableRecommendation enables sensitivity recommendations on a given column (recommendations are enabled by default -// on all columns) -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -func (client SQLPoolSensitivityLabelsClient) EnableRecommendation(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.EnableRecommendation") - 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("synapse.SQLPoolSensitivityLabelsClient", "EnableRecommendation", err.Error()) - } - - req, err := client.EnableRecommendationPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "EnableRecommendation", nil, "Failure preparing request") - return - } - - resp, err := client.EnableRecommendationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "EnableRecommendation", resp, "Failure sending request") - return - } - - result, err = client.EnableRecommendationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "EnableRecommendation", resp, "Failure responding to request") - return - } - - return -} - -// EnableRecommendationPreparer prepares the EnableRecommendation request. -func (client SQLPoolSensitivityLabelsClient) EnableRecommendationPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", "recommended"), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableRecommendationSender sends the EnableRecommendation request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolSensitivityLabelsClient) EnableRecommendationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableRecommendationResponder handles the response to the EnableRecommendation request. The method always -// closes the http.Response Body. -func (client SQLPoolSensitivityLabelsClient) EnableRecommendationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the sensitivity label of a given column -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// columnName - the name of the column. -// sensitivityLabelSource - the source of the sensitivity label. -func (client SQLPoolSensitivityLabelsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (result SensitivityLabel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.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("synapse.SQLPoolSensitivityLabelsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, columnName, sensitivityLabelSource) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolSensitivityLabelsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "columnName": autorest.Encode("path", columnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sensitivityLabelSource": autorest.Encode("path", sensitivityLabelSource), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", 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 SQLPoolSensitivityLabelsClient) 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 SQLPoolSensitivityLabelsClient) GetResponder(resp *http.Response) (result SensitivityLabel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCurrent gets SQL pool sensitivity labels. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolSensitivityLabelsClient) ListCurrent(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result SensitivityLabelListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.ListCurrent") - defer func() { - sc := -1 - if result.sllr.Response.Response != nil { - sc = result.sllr.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("synapse.SQLPoolSensitivityLabelsClient", "ListCurrent", err.Error()) - } - - result.fn = client.listCurrentNextResults - req, err := client.ListCurrentPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListCurrent", nil, "Failure preparing request") - return - } - - resp, err := client.ListCurrentSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListCurrent", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListCurrentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListCurrent", resp, "Failure responding to request") - return - } - if result.sllr.hasNextLink() && result.sllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListCurrentPreparer prepares the ListCurrent request. -func (client SQLPoolSensitivityLabelsClient) ListCurrentPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCurrentSender sends the ListCurrent request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolSensitivityLabelsClient) ListCurrentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCurrentResponder handles the response to the ListCurrent request. The method always -// closes the http.Response Body. -func (client SQLPoolSensitivityLabelsClient) ListCurrentResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listCurrentNextResults retrieves the next set of results, if any. -func (client SQLPoolSensitivityLabelsClient) listCurrentNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listCurrentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListCurrentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listCurrentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListCurrentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listCurrentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListCurrentComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolSensitivityLabelsClient) ListCurrentComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result SensitivityLabelListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.ListCurrent") - 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.ListCurrent(ctx, resourceGroupName, workspaceName, SQLPoolName, filter) - return -} - -// ListRecommended gets sensitivity labels of a given SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// includeDisabledRecommendations - specifies whether to include disabled recommendations or not. -// skipToken - an OData query option to indicate how many elements to skip in the collection. -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolSensitivityLabelsClient) ListRecommended(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result SensitivityLabelListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.ListRecommended") - defer func() { - sc := -1 - if result.sllr.Response.Response != nil { - sc = result.sllr.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("synapse.SQLPoolSensitivityLabelsClient", "ListRecommended", err.Error()) - } - - result.fn = client.listRecommendedNextResults - req, err := client.ListRecommendedPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, includeDisabledRecommendations, skipToken, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListRecommended", nil, "Failure preparing request") - return - } - - resp, err := client.ListRecommendedSender(req) - if err != nil { - result.sllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListRecommended", resp, "Failure sending request") - return - } - - result.sllr, err = client.ListRecommendedResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "ListRecommended", resp, "Failure responding to request") - return - } - if result.sllr.hasNextLink() && result.sllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListRecommendedPreparer prepares the ListRecommended request. -func (client SQLPoolSensitivityLabelsClient) ListRecommendedPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if includeDisabledRecommendations != nil { - queryParameters["includeDisabledRecommendations"] = autorest.Encode("query", *includeDisabledRecommendations) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListRecommendedSender sends the ListRecommended request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolSensitivityLabelsClient) ListRecommendedSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListRecommendedResponder handles the response to the ListRecommended request. The method always -// closes the http.Response Body. -func (client SQLPoolSensitivityLabelsClient) ListRecommendedResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listRecommendedNextResults retrieves the next set of results, if any. -func (client SQLPoolSensitivityLabelsClient) listRecommendedNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { - req, err := lastResults.sensitivityLabelListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listRecommendedNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListRecommendedSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listRecommendedNextResults", resp, "Failure sending next results request") - } - result, err = client.ListRecommendedResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "listRecommendedNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListRecommendedComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolSensitivityLabelsClient) ListRecommendedComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result SensitivityLabelListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.ListRecommended") - 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.ListRecommended(ctx, resourceGroupName, workspaceName, SQLPoolName, includeDisabledRecommendations, skipToken, filter) - return -} - -// Update update sensitivity labels of a given SQL Pool using an operations batch. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolSensitivityLabelsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SensitivityLabelUpdateList) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolSensitivityLabelsClient.Update") - 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("synapse.SQLPoolSensitivityLabelsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolSensitivityLabelsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SQLPoolSensitivityLabelsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SensitivityLabelUpdateList) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels", 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 SQLPoolSensitivityLabelsClient) 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 SQLPoolSensitivityLabelsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooltablecolumns.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpooltablecolumns.go deleted file mode 100644 index f4e1579f6fe3..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooltablecolumns.go +++ /dev/null @@ -1,170 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolTableColumnsClient is the azure Synapse Analytics Management Client -type SQLPoolTableColumnsClient struct { - BaseClient -} - -// NewSQLPoolTableColumnsClient creates an instance of the SQLPoolTableColumnsClient client. -func NewSQLPoolTableColumnsClient(subscriptionID string) SQLPoolTableColumnsClient { - return NewSQLPoolTableColumnsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolTableColumnsClientWithBaseURI creates an instance of the SQLPoolTableColumnsClient 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 NewSQLPoolTableColumnsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolTableColumnsClient { - return SQLPoolTableColumnsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByTableName gets columns in a given table in a SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolTableColumnsClient) ListByTableName(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (result SQLPoolColumnListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTableColumnsClient.ListByTableName") - defer func() { - sc := -1 - if result.spclr.Response.Response != nil { - sc = result.spclr.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("synapse.SQLPoolTableColumnsClient", "ListByTableName", err.Error()) - } - - result.fn = client.listByTableNameNextResults - req, err := client.ListByTableNamePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "ListByTableName", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTableNameSender(req) - if err != nil { - result.spclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "ListByTableName", resp, "Failure sending request") - return - } - - result.spclr, err = client.ListByTableNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "ListByTableName", resp, "Failure responding to request") - return - } - if result.spclr.hasNextLink() && result.spclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTableNamePreparer prepares the ListByTableName request. -func (client SQLPoolTableColumnsClient) ListByTableNamePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTableNameSender sends the ListByTableName request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolTableColumnsClient) ListByTableNameSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTableNameResponder handles the response to the ListByTableName request. The method always -// closes the http.Response Body. -func (client SQLPoolTableColumnsClient) ListByTableNameResponder(resp *http.Response) (result SQLPoolColumnListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTableNameNextResults retrieves the next set of results, if any. -func (client SQLPoolTableColumnsClient) listByTableNameNextResults(ctx context.Context, lastResults SQLPoolColumnListResult) (result SQLPoolColumnListResult, err error) { - req, err := lastResults.sQLPoolColumnListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "listByTableNameNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTableNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "listByTableNameNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTableNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTableColumnsClient", "listByTableNameNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTableNameComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolTableColumnsClient) ListByTableNameComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (result SQLPoolColumnListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTableColumnsClient.ListByTableName") - 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.ListByTableName(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName, filter) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooltables.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpooltables.go deleted file mode 100644 index 9951824c5000..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooltables.go +++ /dev/null @@ -1,258 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolTablesClient is the azure Synapse Analytics Management Client -type SQLPoolTablesClient struct { - BaseClient -} - -// NewSQLPoolTablesClient creates an instance of the SQLPoolTablesClient client. -func NewSQLPoolTablesClient(subscriptionID string) SQLPoolTablesClient { - return NewSQLPoolTablesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolTablesClientWithBaseURI creates an instance of the SQLPoolTablesClient 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 NewSQLPoolTablesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolTablesClient { - return SQLPoolTablesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get Sql pool table -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// tableName - the name of the table. -func (client SQLPoolTablesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string) (result SQLPoolTable, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTablesClient.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("synapse.SQLPoolTablesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, tableName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolTablesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tableName": autorest.Encode("path", tableName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}", 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 SQLPoolTablesClient) 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 SQLPoolTablesClient) GetResponder(resp *http.Response) (result SQLPoolTable, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySchema gets tables of a given schema in a SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// schemaName - the name of the schema. -// filter - an OData filter expression that filters elements in the collection. -func (client SQLPoolTablesClient) ListBySchema(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (result SQLPoolTableListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTablesClient.ListBySchema") - defer func() { - sc := -1 - if result.sptlr.Response.Response != nil { - sc = result.sptlr.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("synapse.SQLPoolTablesClient", "ListBySchema", err.Error()) - } - - result.fn = client.listBySchemaNextResults - req, err := client.ListBySchemaPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "ListBySchema", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySchemaSender(req) - if err != nil { - result.sptlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "ListBySchema", resp, "Failure sending request") - return - } - - result.sptlr, err = client.ListBySchemaResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "ListBySchema", resp, "Failure responding to request") - return - } - if result.sptlr.hasNextLink() && result.sptlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySchemaPreparer prepares the ListBySchema request. -func (client SQLPoolTablesClient) ListBySchemaPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySchemaSender sends the ListBySchema request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolTablesClient) ListBySchemaSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySchemaResponder handles the response to the ListBySchema request. The method always -// closes the http.Response Body. -func (client SQLPoolTablesClient) ListBySchemaResponder(resp *http.Response) (result SQLPoolTableListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySchemaNextResults retrieves the next set of results, if any. -func (client SQLPoolTablesClient) listBySchemaNextResults(ctx context.Context, lastResults SQLPoolTableListResult) (result SQLPoolTableListResult, err error) { - req, err := lastResults.sQLPoolTableListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "listBySchemaNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySchemaSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "listBySchemaNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySchemaResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTablesClient", "listBySchemaNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySchemaComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolTablesClient) ListBySchemaComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (result SQLPoolTableListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTablesClient.ListBySchema") - 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.ListBySchema(ctx, resourceGroupName, workspaceName, SQLPoolName, schemaName, filter) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooltransparentdataencryptions.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpooltransparentdataencryptions.go deleted file mode 100644 index 22de3fe1483d..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpooltransparentdataencryptions.go +++ /dev/null @@ -1,343 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolTransparentDataEncryptionsClient is the azure Synapse Analytics Management Client -type SQLPoolTransparentDataEncryptionsClient struct { - BaseClient -} - -// NewSQLPoolTransparentDataEncryptionsClient creates an instance of the SQLPoolTransparentDataEncryptionsClient -// client. -func NewSQLPoolTransparentDataEncryptionsClient(subscriptionID string) SQLPoolTransparentDataEncryptionsClient { - return NewSQLPoolTransparentDataEncryptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolTransparentDataEncryptionsClientWithBaseURI creates an instance of the -// SQLPoolTransparentDataEncryptionsClient 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 NewSQLPoolTransparentDataEncryptionsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolTransparentDataEncryptionsClient { - return SQLPoolTransparentDataEncryptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Sql pool's transparent data encryption configuration. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the required parameters for creating or updating transparent data encryption. -func (client SQLPoolTransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTransparentDataEncryptionsClient.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}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolTransparentDataEncryptionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolTransparentDataEncryptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters TransparentDataEncryption) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}", 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 SQLPoolTransparentDataEncryptionsClient) 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 SQLPoolTransparentDataEncryptionsClient) CreateOrUpdateResponder(resp *http.Response) (result TransparentDataEncryption, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a SQL pool's transparent data encryption configuration. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolTransparentDataEncryptionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result TransparentDataEncryption, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTransparentDataEncryptionsClient.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("synapse.SQLPoolTransparentDataEncryptionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolTransparentDataEncryptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}", 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 SQLPoolTransparentDataEncryptionsClient) 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 SQLPoolTransparentDataEncryptionsClient) GetResponder(resp *http.Response) (result TransparentDataEncryption, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of SQL pool's transparent data encryption configurations. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolTransparentDataEncryptionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result TransparentDataEncryptionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTransparentDataEncryptionsClient.List") - defer func() { - sc := -1 - if result.tdelr.Response.Response != nil { - sc = result.tdelr.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("synapse.SQLPoolTransparentDataEncryptionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tdelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "List", resp, "Failure sending request") - return - } - - result.tdelr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "List", resp, "Failure responding to request") - return - } - if result.tdelr.hasNextLink() && result.tdelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolTransparentDataEncryptionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption", 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 SQLPoolTransparentDataEncryptionsClient) 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 SQLPoolTransparentDataEncryptionsClient) ListResponder(resp *http.Response) (result TransparentDataEncryptionListResult, 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 SQLPoolTransparentDataEncryptionsClient) listNextResults(ctx context.Context, lastResults TransparentDataEncryptionListResult) (result TransparentDataEncryptionListResult, err error) { - req, err := lastResults.transparentDataEncryptionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "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, "synapse.SQLPoolTransparentDataEncryptionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolTransparentDataEncryptionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolTransparentDataEncryptionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result TransparentDataEncryptionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolTransparentDataEncryptionsClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolusages.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolusages.go deleted file mode 100644 index b0005c9b1db8..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolusages.go +++ /dev/null @@ -1,161 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolUsagesClient is the azure Synapse Analytics Management Client -type SQLPoolUsagesClient struct { - BaseClient -} - -// NewSQLPoolUsagesClient creates an instance of the SQLPoolUsagesClient client. -func NewSQLPoolUsagesClient(subscriptionID string) SQLPoolUsagesClient { - return NewSQLPoolUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolUsagesClientWithBaseURI creates an instance of the SQLPoolUsagesClient 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 NewSQLPoolUsagesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolUsagesClient { - return SQLPoolUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets SQL pool usages. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolUsagesClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolUsageListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolUsagesClient.List") - defer func() { - sc := -1 - if result.spulr.Response.Response != nil { - sc = result.spulr.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("synapse.SQLPoolUsagesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.spulr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "List", resp, "Failure sending request") - return - } - - result.spulr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "List", resp, "Failure responding to request") - return - } - if result.spulr.hasNextLink() && result.spulr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolUsagesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/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 SQLPoolUsagesClient) 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 SQLPoolUsagesClient) ListResponder(resp *http.Response) (result SQLPoolUsageListResult, 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 SQLPoolUsagesClient) listNextResults(ctx context.Context, lastResults SQLPoolUsageListResult) (result SQLPoolUsageListResult, err error) { - req, err := lastResults.sQLPoolUsageListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "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, "synapse.SQLPoolUsagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolUsagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolUsagesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolUsageListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolUsagesClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessmentrulebaselines.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessmentrulebaselines.go deleted file mode 100644 index 81d8b5052d83..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessmentrulebaselines.go +++ /dev/null @@ -1,318 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolVulnerabilityAssessmentRuleBaselinesClient is the azure Synapse Analytics Management Client -type SQLPoolVulnerabilityAssessmentRuleBaselinesClient struct { - BaseClient -} - -// NewSQLPoolVulnerabilityAssessmentRuleBaselinesClient creates an instance of the -// SQLPoolVulnerabilityAssessmentRuleBaselinesClient client. -func NewSQLPoolVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string) SQLPoolVulnerabilityAssessmentRuleBaselinesClient { - return NewSQLPoolVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolVulnerabilityAssessmentRuleBaselinesClientWithBaseURI creates an instance of the -// SQLPoolVulnerabilityAssessmentRuleBaselinesClient 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 NewSQLPoolVulnerabilityAssessmentRuleBaselinesClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolVulnerabilityAssessmentRuleBaselinesClient { - return SQLPoolVulnerabilityAssessmentRuleBaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Sql pool's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a Sql -// pool level rule and master for workspace level rule). -// parameters - the requested rule baseline resource. -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters SQLPoolVulnerabilityAssessmentRuleBaseline) (result SQLPoolVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentRuleBaselinesClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SQLPoolVulnerabilityAssessmentRuleBaselineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SQLPoolVulnerabilityAssessmentRuleBaselineProperties.BaselineResults", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, ruleID, baselineName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters SQLPoolVulnerabilityAssessmentRuleBaseline) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdateResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessmentRuleBaseline, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete removes the database's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a Sql -// pool level rule and master for workspace level rule). -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentRuleBaselinesClient.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("synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) 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 SqlPool's vulnerability assessment rule baseline. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// ruleID - the vulnerability assessment rule ID. -// baselineName - the name of the vulnerability assessment rule baseline (default implies a baseline on a Sql -// pool level rule and master for server level rule). -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (result SQLPoolVulnerabilityAssessmentRuleBaseline, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentRuleBaselinesClient.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("synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, ruleID, baselineName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolVulnerabilityAssessmentRuleBaselinesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "baselineName": autorest.Encode("path", baselineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleId": autorest.Encode("path", ruleID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) 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 SQLPoolVulnerabilityAssessmentRuleBaselinesClient) GetResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessmentRuleBaseline, 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/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessments.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessments.go deleted file mode 100644 index 875a0ba36adc..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessments.go +++ /dev/null @@ -1,428 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolVulnerabilityAssessmentsClient is the azure Synapse Analytics Management Client -type SQLPoolVulnerabilityAssessmentsClient struct { - BaseClient -} - -// NewSQLPoolVulnerabilityAssessmentsClient creates an instance of the SQLPoolVulnerabilityAssessmentsClient client. -func NewSQLPoolVulnerabilityAssessmentsClient(subscriptionID string) SQLPoolVulnerabilityAssessmentsClient { - return NewSQLPoolVulnerabilityAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolVulnerabilityAssessmentsClientWithBaseURI creates an instance of the SQLPoolVulnerabilityAssessmentsClient -// 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 NewSQLPoolVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolVulnerabilityAssessmentsClient { - return SQLPoolVulnerabilityAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the Sql pool vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// parameters - the requested resource. -func (client SQLPoolVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolVulnerabilityAssessment) (result SQLPoolVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.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}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolVulnerabilityAssessmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolVulnerabilityAssessmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters SQLPoolVulnerabilityAssessment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 SQLPoolVulnerabilityAssessmentsClient) 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 SQLPoolVulnerabilityAssessmentsClient) CreateOrUpdateResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessment, 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 removes the database's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.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("synapse.SQLPoolVulnerabilityAssessmentsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolVulnerabilityAssessmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 SQLPoolVulnerabilityAssessmentsClient) 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 SQLPoolVulnerabilityAssessmentsClient) 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 Sql pool's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.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("synapse.SQLPoolVulnerabilityAssessmentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolVulnerabilityAssessmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 SQLPoolVulnerabilityAssessmentsClient) 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 SQLPoolVulnerabilityAssessmentsClient) GetResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the vulnerability assessment policies associated with a SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolVulnerabilityAssessmentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolVulnerabilityAssessmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.List") - defer func() { - sc := -1 - if result.spvalr.Response.Response != nil { - sc = result.spvalr.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("synapse.SQLPoolVulnerabilityAssessmentsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.spvalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "List", resp, "Failure sending request") - return - } - - result.spvalr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "List", resp, "Failure responding to request") - return - } - if result.spvalr.hasNextLink() && result.spvalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolVulnerabilityAssessmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments", 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 SQLPoolVulnerabilityAssessmentsClient) 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 SQLPoolVulnerabilityAssessmentsClient) ListResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessmentListResult, 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 SQLPoolVulnerabilityAssessmentsClient) listNextResults(ctx context.Context, lastResults SQLPoolVulnerabilityAssessmentListResult) (result SQLPoolVulnerabilityAssessmentListResult, err error) { - req, err := lastResults.sQLPoolVulnerabilityAssessmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "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, "synapse.SQLPoolVulnerabilityAssessmentsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolVulnerabilityAssessmentsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result SQLPoolVulnerabilityAssessmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentsClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessmentscans.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessmentscans.go deleted file mode 100644 index 2164a48b48b5..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolvulnerabilityassessmentscans.go +++ /dev/null @@ -1,436 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolVulnerabilityAssessmentScansClient is the azure Synapse Analytics Management Client -type SQLPoolVulnerabilityAssessmentScansClient struct { - BaseClient -} - -// NewSQLPoolVulnerabilityAssessmentScansClient creates an instance of the SQLPoolVulnerabilityAssessmentScansClient -// client. -func NewSQLPoolVulnerabilityAssessmentScansClient(subscriptionID string) SQLPoolVulnerabilityAssessmentScansClient { - return NewSQLPoolVulnerabilityAssessmentScansClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolVulnerabilityAssessmentScansClientWithBaseURI creates an instance of the -// SQLPoolVulnerabilityAssessmentScansClient 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 NewSQLPoolVulnerabilityAssessmentScansClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolVulnerabilityAssessmentScansClient { - return SQLPoolVulnerabilityAssessmentScansClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Export convert an existing scan result to a human readable format. If already exists nothing happens -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client SQLPoolVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result SQLPoolVulnerabilityAssessmentScansExport, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.Export") - 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("synapse.SQLPoolVulnerabilityAssessmentScansClient", "Export", err.Error()) - } - - req, err := client.ExportPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Export", nil, "Failure preparing request") - return - } - - resp, err := client.ExportSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Export", resp, "Failure sending request") - return - } - - result, err = client.ExportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Export", resp, "Failure responding to request") - return - } - - return -} - -// ExportPreparer prepares the Export request. -func (client SQLPoolVulnerabilityAssessmentScansClient) ExportPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolVulnerabilityAssessmentScansClient) ExportSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client SQLPoolVulnerabilityAssessmentScansClient) ExportResponder(resp *http.Response) (result SQLPoolVulnerabilityAssessmentScansExport, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a vulnerability assessment scan record of a Sql pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client SQLPoolVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result VulnerabilityAssessmentScanRecord, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.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("synapse.SQLPoolVulnerabilityAssessmentScansClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolVulnerabilityAssessmentScansClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}", 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 SQLPoolVulnerabilityAssessmentScansClient) 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 SQLPoolVulnerabilityAssessmentScansClient) GetResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecord, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// InitiateScan executes a Vulnerability Assessment database scan. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// scanID - the vulnerability assessment scan Id of the scan to retrieve. -func (client SQLPoolVulnerabilityAssessmentScansClient) InitiateScan(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result SQLPoolVulnerabilityAssessmentScansInitiateScanFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.InitiateScan") - 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: 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("synapse.SQLPoolVulnerabilityAssessmentScansClient", "InitiateScan", err.Error()) - } - - req, err := client.InitiateScanPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, scanID) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "InitiateScan", nil, "Failure preparing request") - return - } - - result, err = client.InitiateScanSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "InitiateScan", result.Response(), "Failure sending request") - return - } - - return -} - -// InitiateScanPreparer prepares the InitiateScan request. -func (client SQLPoolVulnerabilityAssessmentScansClient) InitiateScanPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scanId": autorest.Encode("path", scanID), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// InitiateScanSender sends the InitiateScan request. The method will close the -// http.Response Body if it receives an error. -func (client SQLPoolVulnerabilityAssessmentScansClient) InitiateScanSender(req *http.Request) (future SQLPoolVulnerabilityAssessmentScansInitiateScanFuture, 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 -} - -// InitiateScanResponder handles the response to the InitiateScan request. The method always -// closes the http.Response Body. -func (client SQLPoolVulnerabilityAssessmentScansClient) InitiateScanResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists the vulnerability assessment scans of a SQL pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolVulnerabilityAssessmentScansClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result VulnerabilityAssessmentScanRecordListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.List") - defer func() { - sc := -1 - if result.vasrlr.Response.Response != nil { - sc = result.vasrlr.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("synapse.SQLPoolVulnerabilityAssessmentScansClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.vasrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "List", resp, "Failure sending request") - return - } - - result.vasrlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "List", resp, "Failure responding to request") - return - } - if result.vasrlr.hasNextLink() && result.vasrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolVulnerabilityAssessmentScansClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans", 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 SQLPoolVulnerabilityAssessmentScansClient) 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 SQLPoolVulnerabilityAssessmentScansClient) ListResponder(resp *http.Response) (result VulnerabilityAssessmentScanRecordListResult, 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 SQLPoolVulnerabilityAssessmentScansClient) listNextResults(ctx context.Context, lastResults VulnerabilityAssessmentScanRecordListResult) (result VulnerabilityAssessmentScanRecordListResult, err error) { - req, err := lastResults.vulnerabilityAssessmentScanRecordListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "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, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolVulnerabilityAssessmentScansClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolVulnerabilityAssessmentScansClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result VulnerabilityAssessmentScanRecordListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolVulnerabilityAssessmentScansClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolworkloadclassifier.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolworkloadclassifier.go deleted file mode 100644 index 3f64d2fef293..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolworkloadclassifier.go +++ /dev/null @@ -1,448 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolWorkloadClassifierClient is the azure Synapse Analytics Management Client -type SQLPoolWorkloadClassifierClient struct { - BaseClient -} - -// NewSQLPoolWorkloadClassifierClient creates an instance of the SQLPoolWorkloadClassifierClient client. -func NewSQLPoolWorkloadClassifierClient(subscriptionID string) SQLPoolWorkloadClassifierClient { - return NewSQLPoolWorkloadClassifierClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolWorkloadClassifierClientWithBaseURI creates an instance of the SQLPoolWorkloadClassifierClient 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 NewSQLPoolWorkloadClassifierClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolWorkloadClassifierClient { - return SQLPoolWorkloadClassifierClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create Or Update workload classifier for a Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -// workloadClassifierName - the name of the workload classifier. -// parameters - the properties of the workload classifier. -func (client SQLPoolWorkloadClassifierClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string, parameters WorkloadClassifier) (result SQLPoolWorkloadClassifierCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.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: 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WorkloadClassifierProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WorkloadClassifierProperties.MemberName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadClassifierClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName, workloadClassifierName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolWorkloadClassifierClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string, parameters WorkloadClassifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadClassifierName": autorest.Encode("path", workloadClassifierName), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}", 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 SQLPoolWorkloadClassifierClient) CreateOrUpdateSender(req *http.Request) (future SQLPoolWorkloadClassifierCreateOrUpdateFuture, 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 SQLPoolWorkloadClassifierClient) CreateOrUpdateResponder(resp *http.Response) (result WorkloadClassifier, 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 remove workload classifier of a Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -// workloadClassifierName - the name of the workload classifier. -func (client SQLPoolWorkloadClassifierClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (result SQLPoolWorkloadClassifierDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.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: 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("synapse.SQLPoolWorkloadClassifierClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName, workloadClassifierName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolWorkloadClassifierClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadClassifierName": autorest.Encode("path", workloadClassifierName), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}", 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 SQLPoolWorkloadClassifierClient) DeleteSender(req *http.Request) (future SQLPoolWorkloadClassifierDeleteFuture, 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 SQLPoolWorkloadClassifierClient) 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 get a workload classifier of Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -// workloadClassifierName - the name of the workload classifier. -func (client SQLPoolWorkloadClassifierClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (result WorkloadClassifier, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.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("synapse.SQLPoolWorkloadClassifierClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName, workloadClassifierName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolWorkloadClassifierClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadClassifierName": autorest.Encode("path", workloadClassifierName), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}", 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 SQLPoolWorkloadClassifierClient) 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 SQLPoolWorkloadClassifierClient) GetResponder(resp *http.Response) (result WorkloadClassifier, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of Sql pool's workload classifier for workload groups. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -func (client SQLPoolWorkloadClassifierClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result WorkloadClassifierListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.List") - defer func() { - sc := -1 - if result.wclr.Response.Response != nil { - sc = result.wclr.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("synapse.SQLPoolWorkloadClassifierClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "List", resp, "Failure sending request") - return - } - - result.wclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "List", resp, "Failure responding to request") - return - } - if result.wclr.hasNextLink() && result.wclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolWorkloadClassifierClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers", 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 SQLPoolWorkloadClassifierClient) 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 SQLPoolWorkloadClassifierClient) ListResponder(resp *http.Response) (result WorkloadClassifierListResult, 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 SQLPoolWorkloadClassifierClient) listNextResults(ctx context.Context, lastResults WorkloadClassifierListResult) (result WorkloadClassifierListResult, err error) { - req, err := lastResults.workloadClassifierListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "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, "synapse.SQLPoolWorkloadClassifierClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadClassifierClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolWorkloadClassifierClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result WorkloadClassifierListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadClassifierClient.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, SQLPoolName, workloadGroupName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolworkloadgroup.go b/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolworkloadgroup.go deleted file mode 100644 index a0f35af02c37..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/sqlpoolworkloadgroup.go +++ /dev/null @@ -1,443 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// SQLPoolWorkloadGroupClient is the azure Synapse Analytics Management Client -type SQLPoolWorkloadGroupClient struct { - BaseClient -} - -// NewSQLPoolWorkloadGroupClient creates an instance of the SQLPoolWorkloadGroupClient client. -func NewSQLPoolWorkloadGroupClient(subscriptionID string) SQLPoolWorkloadGroupClient { - return NewSQLPoolWorkloadGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLPoolWorkloadGroupClientWithBaseURI creates an instance of the SQLPoolWorkloadGroupClient 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 NewSQLPoolWorkloadGroupClientWithBaseURI(baseURI string, subscriptionID string) SQLPoolWorkloadGroupClient { - return SQLPoolWorkloadGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create Or Update a Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -// parameters - the requested workload group state. -func (client SQLPoolWorkloadGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, parameters WorkloadGroup) (result SQLPoolWorkloadGroupCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.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: 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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WorkloadGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WorkloadGroupProperties.MinResourcePercent", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WorkloadGroupProperties.MaxResourcePercent", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WorkloadGroupProperties.MinResourcePercentPerRequest", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("synapse.SQLPoolWorkloadGroupClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLPoolWorkloadGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, parameters WorkloadGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}", 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 SQLPoolWorkloadGroupClient) CreateOrUpdateSender(req *http.Request) (future SQLPoolWorkloadGroupCreateOrUpdateFuture, 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 SQLPoolWorkloadGroupClient) CreateOrUpdateResponder(resp *http.Response) (result WorkloadGroup, 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 remove Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -func (client SQLPoolWorkloadGroupClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result SQLPoolWorkloadGroupDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.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: 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("synapse.SQLPoolWorkloadGroupClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLPoolWorkloadGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}", 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 SQLPoolWorkloadGroupClient) DeleteSender(req *http.Request) (future SQLPoolWorkloadGroupDeleteFuture, 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 SQLPoolWorkloadGroupClient) 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 get a Sql pool's workload group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -// workloadGroupName - the name of the workload group. -func (client SQLPoolWorkloadGroupClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result WorkloadGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.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("synapse.SQLPoolWorkloadGroupClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName, workloadGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLPoolWorkloadGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workloadGroupName": autorest.Encode("path", workloadGroupName), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}", 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 SQLPoolWorkloadGroupClient) 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 SQLPoolWorkloadGroupClient) GetResponder(resp *http.Response) (result WorkloadGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of Sql pool's workload groups. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - SQL pool name -func (client SQLPoolWorkloadGroupClient) List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result WorkloadGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.List") - defer func() { - sc := -1 - if result.wglr.Response.Response != nil { - sc = result.wglr.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("synapse.SQLPoolWorkloadGroupClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "List", resp, "Failure sending request") - return - } - - result.wglr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "List", resp, "Failure responding to request") - return - } - if result.wglr.hasNextLink() && result.wglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLPoolWorkloadGroupClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups", 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 SQLPoolWorkloadGroupClient) 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 SQLPoolWorkloadGroupClient) ListResponder(resp *http.Response) (result WorkloadGroupListResult, 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 SQLPoolWorkloadGroupClient) listNextResults(ctx context.Context, lastResults WorkloadGroupListResult) (result WorkloadGroupListResult, err error) { - req, err := lastResults.workloadGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "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, "synapse.SQLPoolWorkloadGroupClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.SQLPoolWorkloadGroupClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLPoolWorkloadGroupClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result WorkloadGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLPoolWorkloadGroupClient.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, SQLPoolName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/synapseapi/interfaces.go b/services/preview/synapse/mgmt/v1.0/synapse/synapseapi/interfaces.go deleted file mode 100644 index c40de4500ec7..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/synapseapi/interfaces.go +++ /dev/null @@ -1,615 +0,0 @@ -package synapseapi - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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/synapse/mgmt/v1.0/synapse" - "github.com/Azure/go-autorest/autorest" -) - -// AzureADOnlyAuthenticationsClientAPI contains the set of methods on the AzureADOnlyAuthenticationsClient type. -type AzureADOnlyAuthenticationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, workspaceName string, azureADOnlyAuthenticationInfo synapse.AzureADOnlyAuthentication) (result synapse.AzureADOnlyAuthenticationsCreateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.AzureADOnlyAuthentication, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.AzureADOnlyAuthenticationListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.AzureADOnlyAuthenticationListResultIterator, err error) -} - -var _ AzureADOnlyAuthenticationsClientAPI = (*synapse.AzureADOnlyAuthenticationsClient)(nil) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - CheckNameAvailability(ctx context.Context, request synapse.CheckNameAvailabilityRequest) (result synapse.CheckNameAvailabilityResponse, err error) - GetAzureAsyncHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (result synapse.OperationResource, err error) - GetLocationHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, operationID string) (result autorest.Response, err error) - List(ctx context.Context) (result synapse.ListAvailableRpOperation, err error) -} - -var _ OperationsClientAPI = (*synapse.OperationsClient)(nil) - -// IPFirewallRulesClientAPI contains the set of methods on the IPFirewallRulesClient type. -type IPFirewallRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string, IPFirewallRuleInfo synapse.IPFirewallRuleInfo) (result synapse.IPFirewallRulesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (result synapse.IPFirewallRulesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, ruleName string) (result synapse.IPFirewallRuleInfo, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.IPFirewallRuleInfoListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.IPFirewallRuleInfoListResultIterator, err error) - ReplaceAll(ctx context.Context, resourceGroupName string, workspaceName string, request synapse.ReplaceAllIPFirewallRulesRequest) (result synapse.IPFirewallRulesReplaceAllFuture, err error) -} - -var _ IPFirewallRulesClientAPI = (*synapse.IPFirewallRulesClient)(nil) - -// KeysClientAPI contains the set of methods on the KeysClient type. -type KeysClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, keyName string, keyProperties synapse.Key) (result synapse.Key, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (result synapse.Key, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, keyName string) (result synapse.Key, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.KeyInfoListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.KeyInfoListResultIterator, err error) -} - -var _ KeysClientAPI = (*synapse.KeysClient)(nil) - -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - Create(ctx context.Context, request synapse.PrivateEndpointConnection, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result synapse.PrivateEndpointConnectionsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result synapse.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result synapse.PrivateEndpointConnection, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.PrivateEndpointConnectionListPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.PrivateEndpointConnectionListIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*synapse.PrivateEndpointConnectionsClient)(nil) - -// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. -type PrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, privateLinkResourceName string) (result synapse.PrivateLinkResource, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.PrivateLinkResourceListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.PrivateLinkResourceListResultIterator, err error) -} - -var _ PrivateLinkResourcesClientAPI = (*synapse.PrivateLinkResourcesClient)(nil) - -// PrivateLinkHubPrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkHubPrivateLinkResourcesClient type. -type PrivateLinkHubPrivateLinkResourcesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, privateLinkHubName string, privateLinkResourceName string) (result synapse.PrivateLinkResource, err error) - List(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkResourceListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkResourceListResultIterator, err error) -} - -var _ PrivateLinkHubPrivateLinkResourcesClientAPI = (*synapse.PrivateLinkHubPrivateLinkResourcesClient)(nil) - -// PrivateLinkHubsClientAPI contains the set of methods on the PrivateLinkHubsClient type. -type PrivateLinkHubsClientAPI interface { - CreateOrUpdate(ctx context.Context, privateLinkHubInfo synapse.PrivateLinkHub, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkHub, err error) - Delete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkHubsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkHub, err error) - List(ctx context.Context) (result synapse.PrivateLinkHubInfoListResultPage, err error) - ListComplete(ctx context.Context) (result synapse.PrivateLinkHubInfoListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result synapse.PrivateLinkHubInfoListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result synapse.PrivateLinkHubInfoListResultIterator, err error) - Update(ctx context.Context, privateLinkHubPatchInfo synapse.PrivateLinkHubPatchInfo, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateLinkHub, err error) -} - -var _ PrivateLinkHubsClientAPI = (*synapse.PrivateLinkHubsClient)(nil) - -// PrivateEndpointConnectionsPrivateLinkHubClientAPI contains the set of methods on the PrivateEndpointConnectionsPrivateLinkHubClient type. -type PrivateEndpointConnectionsPrivateLinkHubClientAPI interface { - Get(ctx context.Context, resourceGroupName string, privateLinkHubName string, privateEndpointConnectionName string) (result synapse.PrivateEndpointConnectionForPrivateLinkHub, err error) - List(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponsePage, err error) - ListComplete(ctx context.Context, resourceGroupName string, privateLinkHubName string) (result synapse.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponseIterator, err error) -} - -var _ PrivateEndpointConnectionsPrivateLinkHubClientAPI = (*synapse.PrivateEndpointConnectionsPrivateLinkHubClient)(nil) - -// SQLPoolsClientAPI contains the set of methods on the SQLPoolsClient type. -type SQLPoolsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo synapse.SQLPool) (result synapse.SQLPoolsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPool, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.SQLPoolInfoListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.SQLPoolInfoListResultIterator, err error) - Pause(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolsPauseFuture, err error) - Rename(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.ResourceMoveDefinition) (result autorest.Response, err error) - Resume(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolsResumeFuture, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, SQLPoolInfo synapse.SQLPoolPatchInfo) (result synapse.SQLPool, err error) -} - -var _ SQLPoolsClientAPI = (*synapse.SQLPoolsClient)(nil) - -// SQLPoolMetadataSyncConfigsClientAPI contains the set of methods on the SQLPoolMetadataSyncConfigsClient type. -type SQLPoolMetadataSyncConfigsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, metadataSyncConfiguration synapse.MetadataSyncConfig) (result synapse.MetadataSyncConfig, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.MetadataSyncConfig, err error) -} - -var _ SQLPoolMetadataSyncConfigsClientAPI = (*synapse.SQLPoolMetadataSyncConfigsClient)(nil) - -// SQLPoolOperationResultsClientAPI contains the set of methods on the SQLPoolOperationResultsClient type. -type SQLPoolOperationResultsClientAPI interface { - GetLocationHeaderResult(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, operationID string) (result synapse.SetObject, err error) -} - -var _ SQLPoolOperationResultsClientAPI = (*synapse.SQLPoolOperationResultsClient)(nil) - -// SQLPoolGeoBackupPoliciesClientAPI contains the set of methods on the SQLPoolGeoBackupPoliciesClient type. -type SQLPoolGeoBackupPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.GeoBackupPolicy) (result synapse.GeoBackupPolicy, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.GeoBackupPolicy, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.GeoBackupPolicyListResult, err error) -} - -var _ SQLPoolGeoBackupPoliciesClientAPI = (*synapse.SQLPoolGeoBackupPoliciesClient)(nil) - -// SQLPoolDataWarehouseUserActivitiesClientAPI contains the set of methods on the SQLPoolDataWarehouseUserActivitiesClient type. -type SQLPoolDataWarehouseUserActivitiesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.DataWarehouseUserActivities, err error) -} - -var _ SQLPoolDataWarehouseUserActivitiesClientAPI = (*synapse.SQLPoolDataWarehouseUserActivitiesClient)(nil) - -// SQLPoolRestorePointsClientAPI contains the set of methods on the SQLPoolRestorePointsClient type. -type SQLPoolRestorePointsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.CreateSQLPoolRestorePointDefinition) (result synapse.SQLPoolRestorePointsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, restorePointName string) (result synapse.RestorePoint, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.RestorePointListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.RestorePointListResultIterator, err error) -} - -var _ SQLPoolRestorePointsClientAPI = (*synapse.SQLPoolRestorePointsClient)(nil) - -// SQLPoolReplicationLinksClientAPI contains the set of methods on the SQLPoolReplicationLinksClient type. -type SQLPoolReplicationLinksClientAPI interface { - GetByName(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, linkID string) (result synapse.ReplicationLink, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ReplicationLinkListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ReplicationLinkListResultIterator, err error) -} - -var _ SQLPoolReplicationLinksClientAPI = (*synapse.SQLPoolReplicationLinksClient)(nil) - -// SQLPoolMaintenanceWindowsClientAPI contains the set of methods on the SQLPoolMaintenanceWindowsClient type. -type SQLPoolMaintenanceWindowsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, maintenanceWindowName string, parameters synapse.MaintenanceWindows) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, maintenanceWindowName string) (result synapse.MaintenanceWindows, err error) -} - -var _ SQLPoolMaintenanceWindowsClientAPI = (*synapse.SQLPoolMaintenanceWindowsClient)(nil) - -// SQLPoolMaintenanceWindowOptionsClientAPI contains the set of methods on the SQLPoolMaintenanceWindowOptionsClient type. -type SQLPoolMaintenanceWindowOptionsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, maintenanceWindowOptionsName string) (result synapse.MaintenanceWindowOptions, err error) -} - -var _ SQLPoolMaintenanceWindowOptionsClientAPI = (*synapse.SQLPoolMaintenanceWindowOptionsClient)(nil) - -// SQLPoolTransparentDataEncryptionsClientAPI contains the set of methods on the SQLPoolTransparentDataEncryptionsClient type. -type SQLPoolTransparentDataEncryptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.TransparentDataEncryption) (result synapse.TransparentDataEncryption, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.TransparentDataEncryption, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.TransparentDataEncryptionListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.TransparentDataEncryptionListResultIterator, err error) -} - -var _ SQLPoolTransparentDataEncryptionsClientAPI = (*synapse.SQLPoolTransparentDataEncryptionsClient)(nil) - -// SQLPoolBlobAuditingPoliciesClientAPI contains the set of methods on the SQLPoolBlobAuditingPoliciesClient type. -type SQLPoolBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.SQLPoolBlobAuditingPolicy) (result synapse.SQLPoolBlobAuditingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicy, err error) - ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicyListResultPage, err error) - ListBySQLPoolComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicyListResultIterator, err error) -} - -var _ SQLPoolBlobAuditingPoliciesClientAPI = (*synapse.SQLPoolBlobAuditingPoliciesClient)(nil) - -// SQLPoolOperationsClientAPI contains the set of methods on the SQLPoolOperationsClient type. -type SQLPoolOperationsClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicySQLPoolOperationListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolBlobAuditingPolicySQLPoolOperationListResultIterator, err error) -} - -var _ SQLPoolOperationsClientAPI = (*synapse.SQLPoolOperationsClient)(nil) - -// SQLPoolUsagesClientAPI contains the set of methods on the SQLPoolUsagesClient type. -type SQLPoolUsagesClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolUsageListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolUsageListResultIterator, err error) -} - -var _ SQLPoolUsagesClientAPI = (*synapse.SQLPoolUsagesClient)(nil) - -// SQLPoolSensitivityLabelsClientAPI contains the set of methods on the SQLPoolSensitivityLabelsClient type. -type SQLPoolSensitivityLabelsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, parameters synapse.SensitivityLabel) (result synapse.SensitivityLabel, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - DisableRecommendation(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - EnableRecommendation(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string, sensitivityLabelSource synapse.SensitivityLabelSource) (result synapse.SensitivityLabel, err error) - ListCurrent(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result synapse.SensitivityLabelListResultPage, err error) - ListCurrentComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result synapse.SensitivityLabelListResultIterator, err error) - ListRecommended(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result synapse.SensitivityLabelListResultPage, err error) - ListRecommendedComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, includeDisabledRecommendations *bool, skipToken string, filter string) (result synapse.SensitivityLabelListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.SensitivityLabelUpdateList) (result autorest.Response, err error) -} - -var _ SQLPoolSensitivityLabelsClientAPI = (*synapse.SQLPoolSensitivityLabelsClient)(nil) - -// SQLPoolRecommendedSensitivityLabelsClientAPI contains the set of methods on the SQLPoolRecommendedSensitivityLabelsClient type. -type SQLPoolRecommendedSensitivityLabelsClientAPI interface { - Update(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.RecommendedSensitivityLabelUpdateList) (result autorest.Response, err error) -} - -var _ SQLPoolRecommendedSensitivityLabelsClientAPI = (*synapse.SQLPoolRecommendedSensitivityLabelsClient)(nil) - -// SQLPoolSchemasClientAPI contains the set of methods on the SQLPoolSchemasClient type. -type SQLPoolSchemasClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string) (result synapse.SQLPoolSchema, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result synapse.SQLPoolSchemaListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, filter string) (result synapse.SQLPoolSchemaListResultIterator, err error) -} - -var _ SQLPoolSchemasClientAPI = (*synapse.SQLPoolSchemasClient)(nil) - -// SQLPoolTablesClientAPI contains the set of methods on the SQLPoolTablesClient type. -type SQLPoolTablesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string) (result synapse.SQLPoolTable, err error) - ListBySchema(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (result synapse.SQLPoolTableListResultPage, err error) - ListBySchemaComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, filter string) (result synapse.SQLPoolTableListResultIterator, err error) -} - -var _ SQLPoolTablesClientAPI = (*synapse.SQLPoolTablesClient)(nil) - -// SQLPoolTableColumnsClientAPI contains the set of methods on the SQLPoolTableColumnsClient type. -type SQLPoolTableColumnsClientAPI interface { - ListByTableName(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (result synapse.SQLPoolColumnListResultPage, err error) - ListByTableNameComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, filter string) (result synapse.SQLPoolColumnListResultIterator, err error) -} - -var _ SQLPoolTableColumnsClientAPI = (*synapse.SQLPoolTableColumnsClient)(nil) - -// SQLPoolConnectionPoliciesClientAPI contains the set of methods on the SQLPoolConnectionPoliciesClient type. -type SQLPoolConnectionPoliciesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolConnectionPolicy, err error) -} - -var _ SQLPoolConnectionPoliciesClientAPI = (*synapse.SQLPoolConnectionPoliciesClient)(nil) - -// SQLPoolVulnerabilityAssessmentsClientAPI contains the set of methods on the SQLPoolVulnerabilityAssessmentsClient type. -type SQLPoolVulnerabilityAssessmentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.SQLPoolVulnerabilityAssessment) (result synapse.SQLPoolVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolVulnerabilityAssessment, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolVulnerabilityAssessmentListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolVulnerabilityAssessmentListResultIterator, err error) -} - -var _ SQLPoolVulnerabilityAssessmentsClientAPI = (*synapse.SQLPoolVulnerabilityAssessmentsClient)(nil) - -// SQLPoolVulnerabilityAssessmentScansClientAPI contains the set of methods on the SQLPoolVulnerabilityAssessmentScansClient type. -type SQLPoolVulnerabilityAssessmentScansClientAPI interface { - Export(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result synapse.SQLPoolVulnerabilityAssessmentScansExport, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result synapse.VulnerabilityAssessmentScanRecord, err error) - InitiateScan(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, scanID string) (result synapse.SQLPoolVulnerabilityAssessmentScansInitiateScanFuture, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.VulnerabilityAssessmentScanRecordListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.VulnerabilityAssessmentScanRecordListResultIterator, err error) -} - -var _ SQLPoolVulnerabilityAssessmentScansClientAPI = (*synapse.SQLPoolVulnerabilityAssessmentScansClient)(nil) - -// SQLPoolSecurityAlertPoliciesClientAPI contains the set of methods on the SQLPoolSecurityAlertPoliciesClient type. -type SQLPoolSecurityAlertPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.SQLPoolSecurityAlertPolicy) (result synapse.SQLPoolSecurityAlertPolicy, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.SQLPoolSecurityAlertPolicy, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ListSQLPoolSecurityAlertPoliciesPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ListSQLPoolSecurityAlertPoliciesIterator, err error) -} - -var _ SQLPoolSecurityAlertPoliciesClientAPI = (*synapse.SQLPoolSecurityAlertPoliciesClient)(nil) - -// SQLPoolVulnerabilityAssessmentRuleBaselinesClientAPI contains the set of methods on the SQLPoolVulnerabilityAssessmentRuleBaselinesClient type. -type SQLPoolVulnerabilityAssessmentRuleBaselinesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName synapse.VulnerabilityAssessmentPolicyBaselineName, parameters synapse.SQLPoolVulnerabilityAssessmentRuleBaseline) (result synapse.SQLPoolVulnerabilityAssessmentRuleBaseline, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName synapse.VulnerabilityAssessmentPolicyBaselineName) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, ruleID string, baselineName synapse.VulnerabilityAssessmentPolicyBaselineName) (result synapse.SQLPoolVulnerabilityAssessmentRuleBaseline, err error) -} - -var _ SQLPoolVulnerabilityAssessmentRuleBaselinesClientAPI = (*synapse.SQLPoolVulnerabilityAssessmentRuleBaselinesClient)(nil) - -// ExtendedSQLPoolBlobAuditingPoliciesClientAPI contains the set of methods on the ExtendedSQLPoolBlobAuditingPoliciesClient type. -type ExtendedSQLPoolBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.ExtendedSQLPoolBlobAuditingPolicy) (result synapse.ExtendedSQLPoolBlobAuditingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ExtendedSQLPoolBlobAuditingPolicy, err error) - ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ExtendedSQLPoolBlobAuditingPolicyListResultPage, err error) - ListBySQLPoolComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.ExtendedSQLPoolBlobAuditingPolicyListResultIterator, err error) -} - -var _ ExtendedSQLPoolBlobAuditingPoliciesClientAPI = (*synapse.ExtendedSQLPoolBlobAuditingPoliciesClient)(nil) - -// DataMaskingPoliciesClientAPI contains the set of methods on the DataMaskingPoliciesClient type. -type DataMaskingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, parameters synapse.DataMaskingPolicy) (result synapse.DataMaskingPolicy, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.DataMaskingPolicy, err error) -} - -var _ DataMaskingPoliciesClientAPI = (*synapse.DataMaskingPoliciesClient)(nil) - -// DataMaskingRulesClientAPI contains the set of methods on the DataMaskingRulesClient type. -type DataMaskingRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, dataMaskingRuleName string, parameters synapse.DataMaskingRule) (result synapse.DataMaskingRule, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, dataMaskingRuleName string) (result synapse.DataMaskingRule, err error) - ListBySQLPool(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.DataMaskingRuleListResult, err error) -} - -var _ DataMaskingRulesClientAPI = (*synapse.DataMaskingRulesClient)(nil) - -// SQLPoolColumnsClientAPI contains the set of methods on the SQLPoolColumnsClient type. -type SQLPoolColumnsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, schemaName string, tableName string, columnName string) (result synapse.SQLPoolColumn, err error) -} - -var _ SQLPoolColumnsClientAPI = (*synapse.SQLPoolColumnsClient)(nil) - -// SQLPoolWorkloadGroupClientAPI contains the set of methods on the SQLPoolWorkloadGroupClient type. -type SQLPoolWorkloadGroupClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, parameters synapse.WorkloadGroup) (result synapse.SQLPoolWorkloadGroupCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result synapse.SQLPoolWorkloadGroupDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result synapse.WorkloadGroup, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.WorkloadGroupListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.WorkloadGroupListResultIterator, err error) -} - -var _ SQLPoolWorkloadGroupClientAPI = (*synapse.SQLPoolWorkloadGroupClient)(nil) - -// SQLPoolWorkloadClassifierClientAPI contains the set of methods on the SQLPoolWorkloadClassifierClient type. -type SQLPoolWorkloadClassifierClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string, parameters synapse.WorkloadClassifier) (result synapse.SQLPoolWorkloadClassifierCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (result synapse.SQLPoolWorkloadClassifierDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string, workloadClassifierName string) (result synapse.WorkloadClassifier, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result synapse.WorkloadClassifierListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string, workloadGroupName string) (result synapse.WorkloadClassifierListResultIterator, err error) -} - -var _ SQLPoolWorkloadClassifierClientAPI = (*synapse.SQLPoolWorkloadClassifierClient)(nil) - -// WorkspaceManagedSQLServerBlobAuditingPoliciesClientAPI contains the set of methods on the WorkspaceManagedSQLServerBlobAuditingPoliciesClient type. -type WorkspaceManagedSQLServerBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.ServerBlobAuditingPolicy) (result synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerBlobAuditingPolicy, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerBlobAuditingPolicyListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerBlobAuditingPolicyListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerBlobAuditingPoliciesClientAPI = (*synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient)(nil) - -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientAPI contains the set of methods on the WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient type. -type WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.ExtendedServerBlobAuditingPolicy) (result synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ExtendedServerBlobAuditingPolicy, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ExtendedServerBlobAuditingPolicyListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ExtendedServerBlobAuditingPolicyListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientAPI = (*synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient)(nil) - -// WorkspaceManagedSQLServerSecurityAlertPolicyClientAPI contains the set of methods on the WorkspaceManagedSQLServerSecurityAlertPolicyClient type. -type WorkspaceManagedSQLServerSecurityAlertPolicyClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.ServerSecurityAlertPolicy) (result synapse.WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerSecurityAlertPolicy, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerSecurityAlertPolicyListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerSecurityAlertPolicyListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerSecurityAlertPolicyClientAPI = (*synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient)(nil) - -// WorkspaceManagedSQLServerVulnerabilityAssessmentsClientAPI contains the set of methods on the WorkspaceManagedSQLServerVulnerabilityAssessmentsClient type. -type WorkspaceManagedSQLServerVulnerabilityAssessmentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.ServerVulnerabilityAssessment) (result synapse.ServerVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerVulnerabilityAssessment, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerVulnerabilityAssessmentListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerVulnerabilityAssessmentListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerVulnerabilityAssessmentsClientAPI = (*synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient)(nil) - -// WorkspaceManagedSQLServerEncryptionProtectorClientAPI contains the set of methods on the WorkspaceManagedSQLServerEncryptionProtectorClient type. -type WorkspaceManagedSQLServerEncryptionProtectorClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.EncryptionProtector) (result synapse.WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.EncryptionProtector, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.EncryptionProtectorListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.EncryptionProtectorListResultIterator, err error) - Revalidate(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture, err error) -} - -var _ WorkspaceManagedSQLServerEncryptionProtectorClientAPI = (*synapse.WorkspaceManagedSQLServerEncryptionProtectorClient)(nil) - -// WorkspaceManagedSQLServerUsagesClientAPI contains the set of methods on the WorkspaceManagedSQLServerUsagesClient type. -type WorkspaceManagedSQLServerUsagesClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerUsageListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ServerUsageListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerUsagesClientAPI = (*synapse.WorkspaceManagedSQLServerUsagesClient)(nil) - -// WorkspaceManagedSQLServerRecoverableSQLPoolsClientAPI contains the set of methods on the WorkspaceManagedSQLServerRecoverableSQLPoolsClient type. -type WorkspaceManagedSQLServerRecoverableSQLPoolsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result synapse.RecoverableSQLPool, err error) - List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.RecoverableSQLPoolListResultPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.RecoverableSQLPoolListResultIterator, err error) -} - -var _ WorkspaceManagedSQLServerRecoverableSQLPoolsClientAPI = (*synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient)(nil) - -// WorkspacesClientAPI contains the set of methods on the WorkspacesClient type. -type WorkspacesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspaceInfo synapse.Workspace) (result synapse.WorkspacesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspacesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.Workspace, err error) - List(ctx context.Context) (result synapse.WorkspaceInfoListResultPage, err error) - ListComplete(ctx context.Context) (result synapse.WorkspaceInfoListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result synapse.WorkspaceInfoListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result synapse.WorkspaceInfoListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, workspacePatchInfo synapse.WorkspacePatchInfo) (result synapse.WorkspacesUpdateFuture, err error) -} - -var _ WorkspacesClientAPI = (*synapse.WorkspacesClient)(nil) - -// WorkspaceAadAdminsClientAPI contains the set of methods on the WorkspaceAadAdminsClient type. -type WorkspaceAadAdminsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo synapse.WorkspaceAadAdminInfo) (result synapse.WorkspaceAadAdminsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspaceAadAdminsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspaceAadAdminInfo, err error) -} - -var _ WorkspaceAadAdminsClientAPI = (*synapse.WorkspaceAadAdminsClient)(nil) - -// WorkspaceSQLAadAdminsClientAPI contains the set of methods on the WorkspaceSQLAadAdminsClient type. -type WorkspaceSQLAadAdminsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo synapse.WorkspaceAadAdminInfo) (result synapse.WorkspaceSQLAadAdminsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspaceSQLAadAdminsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.WorkspaceAadAdminInfo, err error) -} - -var _ WorkspaceSQLAadAdminsClientAPI = (*synapse.WorkspaceSQLAadAdminsClient)(nil) - -// WorkspaceManagedIdentitySQLControlSettingsClientAPI contains the set of methods on the WorkspaceManagedIdentitySQLControlSettingsClient type. -type WorkspaceManagedIdentitySQLControlSettingsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, managedIdentitySQLControlSettings synapse.ManagedIdentitySQLControlSettingsModel) (result synapse.WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.ManagedIdentitySQLControlSettingsModel, err error) -} - -var _ WorkspaceManagedIdentitySQLControlSettingsClientAPI = (*synapse.WorkspaceManagedIdentitySQLControlSettingsClient)(nil) - -// RestorableDroppedSQLPoolsClientAPI contains the set of methods on the RestorableDroppedSQLPoolsClient type. -type RestorableDroppedSQLPoolsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, restorableDroppedSQLPoolID string) (result synapse.RestorableDroppedSQLPool, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.RestorableDroppedSQLPoolListResult, err error) -} - -var _ RestorableDroppedSQLPoolsClientAPI = (*synapse.RestorableDroppedSQLPoolsClient)(nil) - -// BigDataPoolsClientAPI contains the set of methods on the BigDataPoolsClient type. -type BigDataPoolsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolInfo synapse.BigDataPoolResourceInfo, force *bool) (result synapse.BigDataPoolsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (result synapse.BigDataPoolsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string) (result synapse.BigDataPoolResourceInfo, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.BigDataPoolResourceInfoListResultPage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.BigDataPoolResourceInfoListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, bigDataPoolName string, bigDataPoolPatchInfo synapse.BigDataPoolPatchInfo) (result synapse.BigDataPoolResourceInfo, err error) -} - -var _ BigDataPoolsClientAPI = (*synapse.BigDataPoolsClient)(nil) - -// LibraryClientAPI contains the set of methods on the LibraryClient type. -type LibraryClientAPI interface { - Get(ctx context.Context, resourceGroupName string, libraryName string, workspaceName string) (result synapse.LibraryResource, err error) -} - -var _ LibraryClientAPI = (*synapse.LibraryClient)(nil) - -// LibrariesClientAPI contains the set of methods on the LibrariesClient type. -type LibrariesClientAPI interface { - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.LibraryListResponsePage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.LibraryListResponseIterator, err error) -} - -var _ LibrariesClientAPI = (*synapse.LibrariesClient)(nil) - -// IntegrationRuntimesClientAPI contains the set of methods on the IntegrationRuntimesClient type. -type IntegrationRuntimesClientAPI interface { - Create(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, integrationRuntime synapse.IntegrationRuntimeResource, ifMatch string) (result synapse.IntegrationRuntimesCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesDeleteFuture, err error) - DisableInteractiveQuery(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesDisableInteractiveQueryFuture, err error) - EnableInteractiveQuery(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesEnableInteractiveQueryFuture, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, ifNoneMatch string) (result synapse.IntegrationRuntimeResource, err error) - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.IntegrationRuntimeListResponsePage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.IntegrationRuntimeListResponseIterator, err error) - ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse, err error) - Start(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesStartFuture, err error) - Stop(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimesStopFuture, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, updateIntegrationRuntimeRequest synapse.UpdateIntegrationRuntimeRequest) (result synapse.IntegrationRuntimeResource, err error) - Upgrade(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result autorest.Response, err error) -} - -var _ IntegrationRuntimesClientAPI = (*synapse.IntegrationRuntimesClient)(nil) - -// IntegrationRuntimeNodeIPAddressClientAPI contains the set of methods on the IntegrationRuntimeNodeIPAddressClient type. -type IntegrationRuntimeNodeIPAddressClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result synapse.IntegrationRuntimeNodeIPAddress, err error) -} - -var _ IntegrationRuntimeNodeIPAddressClientAPI = (*synapse.IntegrationRuntimeNodeIPAddressClient)(nil) - -// IntegrationRuntimeObjectMetadataClientAPI contains the set of methods on the IntegrationRuntimeObjectMetadataClient type. -type IntegrationRuntimeObjectMetadataClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, getMetadataRequest *synapse.GetSsisObjectMetadataRequest) (result synapse.SsisObjectMetadataListResponse, err error) - Refresh(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeObjectMetadataRefreshFuture, err error) -} - -var _ IntegrationRuntimeObjectMetadataClientAPI = (*synapse.IntegrationRuntimeObjectMetadataClient)(nil) - -// IntegrationRuntimeNodesClientAPI contains the set of methods on the IntegrationRuntimeNodesClient type. -type IntegrationRuntimeNodesClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result synapse.SelfHostedIntegrationRuntimeNode, err error) - Update(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string, updateIntegrationRuntimeNodeRequest synapse.UpdateIntegrationRuntimeNodeRequest) (result synapse.SelfHostedIntegrationRuntimeNode, err error) -} - -var _ IntegrationRuntimeNodesClientAPI = (*synapse.IntegrationRuntimeNodesClient)(nil) - -// IntegrationRuntimeCredentialsClientAPI contains the set of methods on the IntegrationRuntimeCredentialsClient type. -type IntegrationRuntimeCredentialsClientAPI interface { - Sync(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result autorest.Response, err error) -} - -var _ IntegrationRuntimeCredentialsClientAPI = (*synapse.IntegrationRuntimeCredentialsClient)(nil) - -// IntegrationRuntimeConnectionInfosClientAPI contains the set of methods on the IntegrationRuntimeConnectionInfosClient type. -type IntegrationRuntimeConnectionInfosClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeConnectionInfo, err error) -} - -var _ IntegrationRuntimeConnectionInfosClientAPI = (*synapse.IntegrationRuntimeConnectionInfosClient)(nil) - -// IntegrationRuntimeAuthKeysClientAPI contains the set of methods on the IntegrationRuntimeAuthKeysClient type. -type IntegrationRuntimeAuthKeysClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeAuthKeys, err error) - Regenerate(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, regenerateKeyParameters synapse.IntegrationRuntimeRegenerateKeyParameters) (result synapse.IntegrationRuntimeAuthKeys, err error) -} - -var _ IntegrationRuntimeAuthKeysClientAPI = (*synapse.IntegrationRuntimeAuthKeysClient)(nil) - -// IntegrationRuntimeMonitoringDataClientAPI contains the set of methods on the IntegrationRuntimeMonitoringDataClient type. -type IntegrationRuntimeMonitoringDataClientAPI interface { - List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeMonitoringData, err error) -} - -var _ IntegrationRuntimeMonitoringDataClientAPI = (*synapse.IntegrationRuntimeMonitoringDataClient)(nil) - -// IntegrationRuntimeStatusClientAPI contains the set of methods on the IntegrationRuntimeStatusClient type. -type IntegrationRuntimeStatusClientAPI interface { - Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result synapse.IntegrationRuntimeStatusResponse, err error) -} - -var _ IntegrationRuntimeStatusClientAPI = (*synapse.IntegrationRuntimeStatusClient)(nil) - -// SparkConfigurationClientAPI contains the set of methods on the SparkConfigurationClient type. -type SparkConfigurationClientAPI interface { - Get(ctx context.Context, resourceGroupName string, sparkConfigurationName string, workspaceName string) (result synapse.SparkConfigurationResource, err error) -} - -var _ SparkConfigurationClientAPI = (*synapse.SparkConfigurationClient)(nil) - -// SparkConfigurationsClientAPI contains the set of methods on the SparkConfigurationsClient type. -type SparkConfigurationsClientAPI interface { - ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.SparkConfigurationListResponsePage, err error) - ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.SparkConfigurationListResponseIterator, err error) -} - -var _ SparkConfigurationsClientAPI = (*synapse.SparkConfigurationsClient)(nil) diff --git a/services/preview/synapse/mgmt/v1.0/synapse/version.go b/services/preview/synapse/mgmt/v1.0/synapse/version.go deleted file mode 100644 index 2d19fc036204..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package synapse - -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() + " synapse/v1.0" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/workspaceaadadmins.go b/services/preview/synapse/mgmt/v1.0/synapse/workspaceaadadmins.go deleted file mode 100644 index 3c0e196568b2..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspaceaadadmins.go +++ /dev/null @@ -1,296 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceAadAdminsClient is the azure Synapse Analytics Management Client -type WorkspaceAadAdminsClient struct { - BaseClient -} - -// NewWorkspaceAadAdminsClient creates an instance of the WorkspaceAadAdminsClient client. -func NewWorkspaceAadAdminsClient(subscriptionID string) WorkspaceAadAdminsClient { - return NewWorkspaceAadAdminsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceAadAdminsClientWithBaseURI creates an instance of the WorkspaceAadAdminsClient 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 NewWorkspaceAadAdminsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceAadAdminsClient { - return WorkspaceAadAdminsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workspace active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// aadAdminInfo - workspace active directory administrator properties -func (client WorkspaceAadAdminsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo WorkspaceAadAdminInfo) (result WorkspaceAadAdminsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceAadAdminsClient.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: 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("synapse.WorkspaceAadAdminsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, aadAdminInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceAadAdminsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo WorkspaceAadAdminInfo) (*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 = "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.Synapse/workspaces/{workspaceName}/administrators/activeDirectory", pathParameters), - autorest.WithJSON(aadAdminInfo), - 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 WorkspaceAadAdminsClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceAadAdminsCreateOrUpdateFuture, 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 WorkspaceAadAdminsClient) CreateOrUpdateResponder(resp *http.Response) (result WorkspaceAadAdminInfo, 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 a workspace active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceAadAdminsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceAadAdminsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceAadAdminsClient.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: 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("synapse.WorkspaceAadAdminsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspaceAadAdminsClient) DeletePreparer(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 = "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.Synapse/workspaces/{workspaceName}/administrators/activeDirectory", 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 WorkspaceAadAdminsClient) DeleteSender(req *http.Request) (future WorkspaceAadAdminsDeleteFuture, 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 WorkspaceAadAdminsClient) 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 a workspace active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceAadAdminsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceAadAdminInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceAadAdminsClient.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("synapse.WorkspaceAadAdminsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceAadAdminsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceAadAdminsClient) GetPreparer(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 = "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.Synapse/workspaces/{workspaceName}/administrators/activeDirectory", 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 WorkspaceAadAdminsClient) 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 WorkspaceAadAdminsClient) GetResponder(resp *http.Response) (result WorkspaceAadAdminInfo, 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/synapse/mgmt/v1.0/synapse/workspacemanagedidentitysqlcontrolsettings.go b/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedidentitysqlcontrolsettings.go deleted file mode 100644 index b2bcc8fc21a0..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedidentitysqlcontrolsettings.go +++ /dev/null @@ -1,210 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedIdentitySQLControlSettingsClient is the azure Synapse Analytics Management Client -type WorkspaceManagedIdentitySQLControlSettingsClient struct { - BaseClient -} - -// NewWorkspaceManagedIdentitySQLControlSettingsClient creates an instance of the -// WorkspaceManagedIdentitySQLControlSettingsClient client. -func NewWorkspaceManagedIdentitySQLControlSettingsClient(subscriptionID string) WorkspaceManagedIdentitySQLControlSettingsClient { - return NewWorkspaceManagedIdentitySQLControlSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedIdentitySQLControlSettingsClientWithBaseURI creates an instance of the -// WorkspaceManagedIdentitySQLControlSettingsClient 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 NewWorkspaceManagedIdentitySQLControlSettingsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedIdentitySQLControlSettingsClient { - return WorkspaceManagedIdentitySQLControlSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// managedIdentitySQLControlSettings - managed Identity Sql Control Settings -func (client WorkspaceManagedIdentitySQLControlSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, managedIdentitySQLControlSettings ManagedIdentitySQLControlSettingsModel) (result WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedIdentitySQLControlSettingsClient.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: 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("synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, managedIdentitySQLControlSettings) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedIdentitySQLControlSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, managedIdentitySQLControlSettings ManagedIdentitySQLControlSettingsModel) (*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 = "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.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default", pathParameters), - autorest.WithJSON(managedIdentitySQLControlSettings), - 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 WorkspaceManagedIdentitySQLControlSettingsClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceManagedIdentitySQLControlSettingsCreateOrUpdateFuture, 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 WorkspaceManagedIdentitySQLControlSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedIdentitySQLControlSettingsModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedIdentitySQLControlSettingsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ManagedIdentitySQLControlSettingsModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedIdentitySQLControlSettingsClient.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("synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedIdentitySQLControlSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedIdentitySQLControlSettingsClient) GetPreparer(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 = "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.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default", 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 WorkspaceManagedIdentitySQLControlSettingsClient) 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 WorkspaceManagedIdentitySQLControlSettingsClient) GetResponder(resp *http.Response) (result ManagedIdentitySQLControlSettingsModel, 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/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverblobauditingpolicies.go b/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverblobauditingpolicies.go deleted file mode 100644 index 4b5820fdc4c0..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverblobauditingpolicies.go +++ /dev/null @@ -1,339 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerBlobAuditingPoliciesClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerBlobAuditingPoliciesClient creates an instance of the -// WorkspaceManagedSQLServerBlobAuditingPoliciesClient client. -func NewWorkspaceManagedSQLServerBlobAuditingPoliciesClient(subscriptionID string) WorkspaceManagedSQLServerBlobAuditingPoliciesClient { - return NewWorkspaceManagedSQLServerBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerBlobAuditingPoliciesClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerBlobAuditingPoliciesClient 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 NewWorkspaceManagedSQLServerBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerBlobAuditingPoliciesClient { - return WorkspaceManagedSQLServerBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a workspace managed sql server's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// parameters - properties of extended blob auditing policy. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerBlobAuditingPolicy) (result WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerBlobAuditingPoliciesClient.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: 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("synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}", 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 WorkspaceManagedSQLServerBlobAuditingPoliciesClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture, 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 WorkspaceManagedSQLServerBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerBlobAuditingPolicy, 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 get a workspace managed sql server's blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerBlobAuditingPoliciesClient.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("synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}", 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 WorkspaceManagedSQLServerBlobAuditingPoliciesClient) 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 WorkspaceManagedSQLServerBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result ServerBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list workspace managed sql server's blob auditing policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerBlobAuditingPoliciesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.sbaplr.Response.Response != nil { - sc = result.sbaplr.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("synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.sbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.sbaplr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.sbaplr.hasNextLink() && result.sbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspacePreparer(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 = "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.Synapse/workspaces/{workspaceName}/auditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspaceResponder(resp *http.Response) (result ServerBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) listByWorkspaceNextResults(ctx context.Context, lastResults ServerBlobAuditingPolicyListResult) (result ServerBlobAuditingPolicyListResult, err error) { - req, err := lastResults.serverBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerBlobAuditingPoliciesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerBlobAuditingPoliciesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerBlobAuditingPoliciesClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverencryptionprotector.go b/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverencryptionprotector.go deleted file mode 100644 index db5d0122f7c3..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverencryptionprotector.go +++ /dev/null @@ -1,429 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerEncryptionProtectorClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerEncryptionProtectorClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerEncryptionProtectorClient creates an instance of the -// WorkspaceManagedSQLServerEncryptionProtectorClient client. -func NewWorkspaceManagedSQLServerEncryptionProtectorClient(subscriptionID string) WorkspaceManagedSQLServerEncryptionProtectorClient { - return NewWorkspaceManagedSQLServerEncryptionProtectorClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerEncryptionProtectorClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerEncryptionProtectorClient 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 NewWorkspaceManagedSQLServerEncryptionProtectorClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerEncryptionProtectorClient { - return WorkspaceManagedSQLServerEncryptionProtectorClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates workspace managed sql server's encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// parameters - the requested encryption protector resource state. -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters EncryptionProtector) (result WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerEncryptionProtectorClient.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: 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("synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters EncryptionProtector) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - parameters.Location = 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.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}", 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 WorkspaceManagedSQLServerEncryptionProtectorClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture, 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 WorkspaceManagedSQLServerEncryptionProtectorClient) CreateOrUpdateResponder(resp *http.Response) (result EncryptionProtector, 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 get workspace managed sql server's encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result EncryptionProtector, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerEncryptionProtectorClient.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("synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}", 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 WorkspaceManagedSQLServerEncryptionProtectorClient) 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 WorkspaceManagedSQLServerEncryptionProtectorClient) GetResponder(resp *http.Response) (result EncryptionProtector, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of encryption protectors for workspace managed sql server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result EncryptionProtectorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerEncryptionProtectorClient.List") - defer func() { - sc := -1 - if result.eplr.Response.Response != nil { - sc = result.eplr.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("synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.eplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "List", resp, "Failure sending request") - return - } - - result.eplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "List", resp, "Failure responding to request") - return - } - if result.eplr.hasNextLink() && result.eplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) 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 = "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.Synapse/workspaces/{workspaceName}/encryptionProtector", 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 WorkspaceManagedSQLServerEncryptionProtectorClient) 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 WorkspaceManagedSQLServerEncryptionProtectorClient) ListResponder(resp *http.Response) (result EncryptionProtectorListResult, 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 WorkspaceManagedSQLServerEncryptionProtectorClient) listNextResults(ctx context.Context, lastResults EncryptionProtectorListResult) (result EncryptionProtectorListResult, err error) { - req, err := lastResults.encryptionProtectorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "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, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result EncryptionProtectorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerEncryptionProtectorClient.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 -} - -// Revalidate revalidates workspace managed sql server's existing encryption protector. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) Revalidate(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerEncryptionProtectorClient.Revalidate") - 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: 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("synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "Revalidate", err.Error()) - } - - req, err := client.RevalidatePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "Revalidate", nil, "Failure preparing request") - return - } - - result, err = client.RevalidateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerEncryptionProtectorClient", "Revalidate", result.Response(), "Failure sending request") - return - } - - return -} - -// RevalidatePreparer prepares the Revalidate request. -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) RevalidatePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "encryptionProtectorName": autorest.Encode("path", "current"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}/revalidate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevalidateSender sends the Revalidate request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) RevalidateSender(req *http.Request) (future WorkspaceManagedSQLServerEncryptionProtectorRevalidateFuture, 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 -} - -// RevalidateResponder handles the response to the Revalidate request. The method always -// closes the http.Response Body. -func (client WorkspaceManagedSQLServerEncryptionProtectorClient) RevalidateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverextendedblobauditingpolicies.go b/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverextendedblobauditingpolicies.go deleted file mode 100644 index 7a3ed89d2ca1..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverextendedblobauditingpolicies.go +++ /dev/null @@ -1,339 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient creates an instance of the -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient client. -func NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient(subscriptionID string) WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient { - return NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient 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 NewWorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient { - return WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a workspace managed sql server's extended blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// parameters - properties of extended blob auditing policy. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters ExtendedServerBlobAuditingPolicy) (result WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient.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: 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("synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters ExtendedServerBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesCreateOrUpdateFuture, 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ExtendedServerBlobAuditingPolicy, 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 get a workspace SQL server's extended blob auditing policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ExtendedServerBlobAuditingPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient.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("synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "blobAuditingPolicyName": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}", 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) 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 WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) GetResponder(resp *http.Response) (result ExtendedServerBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace list workspace managed sql server's extended blob auditing policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result ExtendedServerBlobAuditingPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.esbaplr.Response.Response != nil { - sc = result.esbaplr.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("synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.esbaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.esbaplr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.esbaplr.hasNextLink() && result.esbaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspacePreparer(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 = "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.Synapse/workspaces/{workspaceName}/extendedAuditingSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspaceResponder(resp *http.Response) (result ExtendedServerBlobAuditingPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) listByWorkspaceNextResults(ctx context.Context, lastResults ExtendedServerBlobAuditingPolicyListResult) (result ExtendedServerBlobAuditingPolicyListResult, err error) { - req, err := lastResults.extendedServerBlobAuditingPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ExtendedServerBlobAuditingPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerExtendedBlobAuditingPoliciesClient.ListByWorkspace") - 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverrecoverablesqlpools.go b/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverrecoverablesqlpools.go deleted file mode 100644 index d31f9b0c0d62..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverrecoverablesqlpools.go +++ /dev/null @@ -1,248 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerRecoverableSQLPoolsClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerRecoverableSQLPoolsClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerRecoverableSQLPoolsClient creates an instance of the -// WorkspaceManagedSQLServerRecoverableSQLPoolsClient client. -func NewWorkspaceManagedSQLServerRecoverableSQLPoolsClient(subscriptionID string) WorkspaceManagedSQLServerRecoverableSQLPoolsClient { - return NewWorkspaceManagedSQLServerRecoverableSQLPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerRecoverableSQLPoolsClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerRecoverableSQLPoolsClient 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 NewWorkspaceManagedSQLServerRecoverableSQLPoolsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerRecoverableSQLPoolsClient { - return WorkspaceManagedSQLServerRecoverableSQLPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get recoverable sql pools for workspace managed sql server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// SQLPoolName - the name of the sql pool -func (client WorkspaceManagedSQLServerRecoverableSQLPoolsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (result RecoverableSQLPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerRecoverableSQLPoolsClient.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("synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, SQLPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerRecoverableSQLPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, SQLPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlPoolName": autorest.Encode("path", SQLPoolName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlPoolName}", 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 WorkspaceManagedSQLServerRecoverableSQLPoolsClient) 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 WorkspaceManagedSQLServerRecoverableSQLPoolsClient) GetResponder(resp *http.Response) (result RecoverableSQLPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get list of recoverable sql pools for workspace managed sql server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerRecoverableSQLPoolsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result RecoverableSQLPoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerRecoverableSQLPoolsClient.List") - defer func() { - sc := -1 - if result.rsplr.Response.Response != nil { - sc = result.rsplr.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("synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rsplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "List", resp, "Failure sending request") - return - } - - result.rsplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "List", resp, "Failure responding to request") - return - } - if result.rsplr.hasNextLink() && result.rsplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspaceManagedSQLServerRecoverableSQLPoolsClient) 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 = "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.Synapse/workspaces/{workspaceName}/recoverableSqlPools", 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 WorkspaceManagedSQLServerRecoverableSQLPoolsClient) 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 WorkspaceManagedSQLServerRecoverableSQLPoolsClient) ListResponder(resp *http.Response) (result RecoverableSQLPoolListResult, 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 WorkspaceManagedSQLServerRecoverableSQLPoolsClient) listNextResults(ctx context.Context, lastResults RecoverableSQLPoolListResult) (result RecoverableSQLPoolListResult, err error) { - req, err := lastResults.recoverableSQLPoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "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, "synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerRecoverableSQLPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result RecoverableSQLPoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerRecoverableSQLPoolsClient.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/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserversecurityalertpolicy.go b/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserversecurityalertpolicy.go deleted file mode 100644 index b5f4a456d73d..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserversecurityalertpolicy.go +++ /dev/null @@ -1,339 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerSecurityAlertPolicyClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerSecurityAlertPolicyClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerSecurityAlertPolicyClient creates an instance of the -// WorkspaceManagedSQLServerSecurityAlertPolicyClient client. -func NewWorkspaceManagedSQLServerSecurityAlertPolicyClient(subscriptionID string) WorkspaceManagedSQLServerSecurityAlertPolicyClient { - return NewWorkspaceManagedSQLServerSecurityAlertPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerSecurityAlertPolicyClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerSecurityAlertPolicyClient 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 NewWorkspaceManagedSQLServerSecurityAlertPolicyClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerSecurityAlertPolicyClient { - return WorkspaceManagedSQLServerSecurityAlertPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a workspace managed sql server's threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// parameters - the workspace managed sql server security alert policy. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerSecurityAlertPolicy) (result WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerSecurityAlertPolicyClient.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: 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("synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}", 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceManagedSQLServerSecurityAlertPolicyCreateOrUpdateFuture, 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result ServerSecurityAlertPolicy, 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 get a workspace managed sql server's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerSecurityAlertPolicyClient.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("synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}", 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) GetResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get workspace managed sql server's threat detection policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerSecurityAlertPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerSecurityAlertPolicyClient.List") - defer func() { - sc := -1 - if result.ssaplr.Response.Response != nil { - sc = result.ssaplr.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("synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ssaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "List", resp, "Failure sending request") - return - } - - result.ssaplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "List", resp, "Failure responding to request") - return - } - if result.ssaplr.hasNextLink() && result.ssaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) 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 = "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.Synapse/workspaces/{workspaceName}/securityAlertPolicies", 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) ListResponder(resp *http.Response) (result ServerSecurityAlertPolicyListResult, 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 WorkspaceManagedSQLServerSecurityAlertPolicyClient) listNextResults(ctx context.Context, lastResults ServerSecurityAlertPolicyListResult) (result ServerSecurityAlertPolicyListResult, err error) { - req, err := lastResults.serverSecurityAlertPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "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, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerSecurityAlertPolicyClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerSecurityAlertPolicyClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerSecurityAlertPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerSecurityAlertPolicyClient.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/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverusages.go b/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverusages.go deleted file mode 100644 index 7f045cea944d..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlserverusages.go +++ /dev/null @@ -1,160 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerUsagesClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerUsagesClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerUsagesClient creates an instance of the WorkspaceManagedSQLServerUsagesClient client. -func NewWorkspaceManagedSQLServerUsagesClient(subscriptionID string) WorkspaceManagedSQLServerUsagesClient { - return NewWorkspaceManagedSQLServerUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerUsagesClientWithBaseURI creates an instance of the WorkspaceManagedSQLServerUsagesClient -// 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 NewWorkspaceManagedSQLServerUsagesClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerUsagesClient { - return WorkspaceManagedSQLServerUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get list of server usages metric for workspace managed sql server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerUsagesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerUsageListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerUsagesClient.List") - defer func() { - sc := -1 - if result.sulr.Response.Response != nil { - sc = result.sulr.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("synapse.WorkspaceManagedSQLServerUsagesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sulr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "List", resp, "Failure sending request") - return - } - - result.sulr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "List", resp, "Failure responding to request") - return - } - if result.sulr.hasNextLink() && result.sulr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspaceManagedSQLServerUsagesClient) 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 = "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.Synapse/workspaces/{workspaceName}/sqlUsages", 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 WorkspaceManagedSQLServerUsagesClient) 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 WorkspaceManagedSQLServerUsagesClient) ListResponder(resp *http.Response) (result ServerUsageListResult, 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 WorkspaceManagedSQLServerUsagesClient) listNextResults(ctx context.Context, lastResults ServerUsageListResult) (result ServerUsageListResult, err error) { - req, err := lastResults.serverUsageListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "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, "synapse.WorkspaceManagedSQLServerUsagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerUsagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerUsagesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerUsageListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerUsagesClient.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/synapse/mgmt/v1.0/synapse/workspacemanagedsqlservervulnerabilityassessments.go b/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlservervulnerabilityassessments.go deleted file mode 100644 index 9db323833a25..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspacemanagedsqlservervulnerabilityassessments.go +++ /dev/null @@ -1,424 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceManagedSQLServerVulnerabilityAssessmentsClient is the azure Synapse Analytics Management Client -type WorkspaceManagedSQLServerVulnerabilityAssessmentsClient struct { - BaseClient -} - -// NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClient creates an instance of the -// WorkspaceManagedSQLServerVulnerabilityAssessmentsClient client. -func NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClient(subscriptionID string) WorkspaceManagedSQLServerVulnerabilityAssessmentsClient { - return NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClientWithBaseURI creates an instance of the -// WorkspaceManagedSQLServerVulnerabilityAssessmentsClient 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 NewWorkspaceManagedSQLServerVulnerabilityAssessmentsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerVulnerabilityAssessmentsClient { - return WorkspaceManagedSQLServerVulnerabilityAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update workspace managed sql server's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// parameters - properties for vulnerability assessment. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerVulnerabilityAssessment) (result ServerVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.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: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServerVulnerabilityAssessmentProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServerVulnerabilityAssessmentProperties.StorageContainerPath", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters ServerVulnerabilityAssessment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerVulnerabilityAssessment, 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 remove workspace managed sql server's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.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("synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) DeletePreparer(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), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 workspace managed sql server's vulnerability assessment. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerVulnerabilityAssessment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.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("synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) GetPreparer(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), - "vulnerabilityAssessmentName": autorest.Encode("path", "default"), - "workspaceName": autorest.Encode("path", workspaceName), - } - - 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.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) GetResponder(resp *http.Response) (result ServerVulnerabilityAssessment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the vulnerability assessment policies associated with a workspace managed sql server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerVulnerabilityAssessmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.List") - defer func() { - sc := -1 - if result.svalr.Response.Response != nil { - sc = result.svalr.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("synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.svalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "List", resp, "Failure sending request") - return - } - - result.svalr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "List", resp, "Failure responding to request") - return - } - if result.svalr.hasNextLink() && result.svalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 = "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.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments", 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) ListResponder(resp *http.Response) (result ServerVulnerabilityAssessmentListResult, 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 WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) listNextResults(ctx context.Context, lastResults ServerVulnerabilityAssessmentListResult) (result ServerVulnerabilityAssessmentListResult, err error) { - req, err := lastResults.serverVulnerabilityAssessmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "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, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerVulnerabilityAssessmentsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspaceManagedSQLServerVulnerabilityAssessmentsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ServerVulnerabilityAssessmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerVulnerabilityAssessmentsClient.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/synapse/mgmt/v1.0/synapse/workspaces.go b/services/preview/synapse/mgmt/v1.0/synapse/workspaces.go deleted file mode 100644 index 30d1f0956d24..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspaces.go +++ /dev/null @@ -1,631 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspacesClient is the azure Synapse Analytics Management Client -type WorkspacesClient struct { - BaseClient -} - -// NewWorkspacesClient creates an instance of the WorkspacesClient client. -func NewWorkspacesClient(subscriptionID string) WorkspacesClient { - return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient 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 NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { - return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// workspaceInfo - workspace create or update request properties -func (client WorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspaceInfo Workspace) (result WorkspacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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: 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("synapse.WorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, workspaceInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, workspaceInfo Workspace) (*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 = "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.Synapse/workspaces/{workspaceName}", pathParameters), - autorest.WithJSON(workspaceInfo), - 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 WorkspacesClient) CreateOrUpdateSender(req *http.Request) (future WorkspacesCreateOrUpdateFuture, 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 WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, 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 a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspacesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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: 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("synapse.WorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspacesClient) DeletePreparer(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 = "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.Synapse/workspaces/{workspaceName}", 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 WorkspacesClient) DeleteSender(req *http.Request) (future WorkspacesDeleteFuture, 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 WorkspacesClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result Workspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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("synapse.WorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspacesClient) GetPreparer(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 = "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.Synapse/workspaces/{workspaceName}", 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 WorkspacesClient) 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 WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns a list of workspaces in a subscription -func (client WorkspacesClient) List(ctx context.Context) (result WorkspaceInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.List") - defer func() { - sc := -1 - if result.wilr.Response.Response != nil { - sc = result.wilr.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("synapse.WorkspacesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "List", resp, "Failure sending request") - return - } - - result.wilr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "List", resp, "Failure responding to request") - return - } - if result.wilr.hasNextLink() && result.wilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspacesClient) 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.Synapse/workspaces", 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 WorkspacesClient) 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 WorkspacesClient) ListResponder(resp *http.Response) (result WorkspaceInfoListResult, 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 WorkspacesClient) listNextResults(ctx context.Context, lastResults WorkspaceInfoListResult) (result WorkspaceInfoListResult, err error) { - req, err := lastResults.workspaceInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "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, "synapse.WorkspacesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspacesClient) ListComplete(ctx context.Context) (result WorkspaceInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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 a list of workspaces in a resource group -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client WorkspacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WorkspaceInfoListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.wilr.Response.Response != nil { - sc = result.wilr.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("synapse.WorkspacesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.wilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.wilr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.wilr.hasNextLink() && result.wilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WorkspacesClient) 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.Synapse/workspaces", 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 WorkspacesClient) 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 WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceInfoListResult, 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 WorkspacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults WorkspaceInfoListResult) (result WorkspaceInfoListResult, err error) { - req, err := lastResults.workspaceInfoListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "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, "synapse.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result WorkspaceInfoListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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 -} - -// Update updates a workspace -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// workspacePatchInfo - workspace patch request properties -func (client WorkspacesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, workspacePatchInfo WorkspacePatchInfo) (result WorkspacesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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: 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("synapse.WorkspacesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, workspacePatchInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspacesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WorkspacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, workspacePatchInfo WorkspacePatchInfo) (*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 = "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.Synapse/workspaces/{workspaceName}", pathParameters), - autorest.WithJSON(workspacePatchInfo), - 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 WorkspacesClient) UpdateSender(req *http.Request) (future WorkspacesUpdateFuture, 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 WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, 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/synapse/mgmt/v1.0/synapse/workspacesqlaadadmins.go b/services/preview/synapse/mgmt/v1.0/synapse/workspacesqlaadadmins.go deleted file mode 100644 index 75e63bcdb62b..000000000000 --- a/services/preview/synapse/mgmt/v1.0/synapse/workspacesqlaadadmins.go +++ /dev/null @@ -1,296 +0,0 @@ -package synapse - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for 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" -) - -// WorkspaceSQLAadAdminsClient is the azure Synapse Analytics Management Client -type WorkspaceSQLAadAdminsClient struct { - BaseClient -} - -// NewWorkspaceSQLAadAdminsClient creates an instance of the WorkspaceSQLAadAdminsClient client. -func NewWorkspaceSQLAadAdminsClient(subscriptionID string) WorkspaceSQLAadAdminsClient { - return NewWorkspaceSQLAadAdminsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceSQLAadAdminsClientWithBaseURI creates an instance of the WorkspaceSQLAadAdminsClient 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 NewWorkspaceSQLAadAdminsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceSQLAadAdminsClient { - return WorkspaceSQLAadAdminsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workspace SQL active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// aadAdminInfo - workspace active directory administrator properties -func (client WorkspaceSQLAadAdminsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo WorkspaceAadAdminInfo) (result WorkspaceSQLAadAdminsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceSQLAadAdminsClient.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: 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("synapse.WorkspaceSQLAadAdminsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, aadAdminInfo) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspaceSQLAadAdminsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, aadAdminInfo WorkspaceAadAdminInfo) (*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 = "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.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory", pathParameters), - autorest.WithJSON(aadAdminInfo), - 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 WorkspaceSQLAadAdminsClient) CreateOrUpdateSender(req *http.Request) (future WorkspaceSQLAadAdminsCreateOrUpdateFuture, 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 WorkspaceSQLAadAdminsClient) CreateOrUpdateResponder(resp *http.Response) (result WorkspaceAadAdminInfo, 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 a workspace SQL active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceSQLAadAdminsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceSQLAadAdminsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceSQLAadAdminsClient.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: 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("synapse.WorkspaceSQLAadAdminsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspaceSQLAadAdminsClient) DeletePreparer(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 = "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.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory", 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 WorkspaceSQLAadAdminsClient) DeleteSender(req *http.Request) (future WorkspaceSQLAadAdminsDeleteFuture, 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 WorkspaceSQLAadAdminsClient) 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 a workspace SQL active directory admin -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspaceSQLAadAdminsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspaceAadAdminInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceSQLAadAdminsClient.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("synapse.WorkspaceSQLAadAdminsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "synapse.WorkspaceSQLAadAdminsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspaceSQLAadAdminsClient) GetPreparer(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 = "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.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory", 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 WorkspaceSQLAadAdminsClient) 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 WorkspaceSQLAadAdminsClient) GetResponder(resp *http.Response) (result WorkspaceAadAdminInfo, 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/version/version.go b/version/version.go index defb0cc0b1b7..c4aee486fa06 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 = "v64.2.0" +const Number = "v65.0.0"